From 148940fb1873023e9a4b69f94f78efa1a57945a8 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Thu, 16 Feb 2017 12:07:15 -0500 Subject: [PATCH 01/96] Add custom audio filters --- asterisk/channels/chan_usbradio.c | 28 ++- asterisk/channels/xpmr/xpmr.c | 83 ++++--- asterisk/channels/xpmr/xpmr.h | 5 + asterisk/channels/xpmr/xpmr_coef.h | 340 ++++++++++++++++------------- configs/usbradio/usbradio.conf | 20 ++ 5 files changed, 292 insertions(+), 184 deletions(-) mode change 100755 => 100644 asterisk/channels/xpmr/xpmr.c mode change 100755 => 100644 asterisk/channels/xpmr/xpmr.h mode change 100755 => 100644 asterisk/channels/xpmr/xpmr_coef.h diff --git a/asterisk/channels/chan_usbradio.c b/asterisk/channels/chan_usbradio.c index b94a41c8..8a497b70 100644 --- a/asterisk/channels/chan_usbradio.c +++ b/asterisk/channels/chan_usbradio.c @@ -17,7 +17,8 @@ * * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. + * at the top of the source tree. + * 20160829 inad added rxlpf rxhpf txlpf txhpf */ /*! \file @@ -33,7 +34,7 @@ /*** MODULEINFO ossaudio usb - yes + yes ***/ #include "asterisk.h" @@ -596,6 +597,10 @@ struct chan_usbradio_pvt { float txctcssgain; char txmixa; char txmixb; + int rxlpf; + int rxhpf; + int txlpf; + int txhpf; char invertptt; @@ -5268,7 +5273,17 @@ static struct chan_usbradio_pvt *store_config(struct ast_config *cfg, char *ctg, M_UINT("area",o->area) M_STR("ukey",o->ukey) M_UINT("duplex3",o->duplex3) - M_END(; + + M_UINT("rxlpf",o->rxlpf) + M_UINT("rxhpf",o->rxhpf) + M_UINT("txlpf",o->txlpf) + M_UINT("txhpf",o->txhpf) +// ast_log(LOG_NOTICE,"rxlpf: %d\n",o->rxlpf); +// ast_log(LOG_NOTICE,"rxhpf: %d\n",o->rxhpf); +// ast_log(LOG_NOTICE,"txlpf: %d\n",o->txlpf); +// ast_log(LOG_NOTICE,"txhpf: %d\n",o->txhpf); + + M_END(; ); for(i = 0; i < 32; i++) { @@ -5343,7 +5358,7 @@ static struct chan_usbradio_pvt *store_config(struct ast_config *cfg, char *ctg, M_UINT("rxsquelchadj", o->rxsquelchadj) M_UINT("fever", o->fever) M_STR("devstr", o->devstr) - M_END(; + M_END(; ); } ast_config_destroy(cfg1); @@ -5431,6 +5446,11 @@ static struct chan_usbradio_pvt *store_config(struct ast_config *cfg, char *ctg, tChan.name=o->name; tChan.fever = o->fever; + tChan.rxhpf=o->rxhpf; + tChan.rxlpf=o->rxlpf; + tChan.txhpf=o->txhpf; + tChan.txlpf=o->txlpf; + o->pmrChan=createPmrChannel(&tChan,FRAME_SIZE); o->pmrChan->radioDuplex=o->radioduplex; diff --git a/asterisk/channels/xpmr/xpmr.c b/asterisk/channels/xpmr/xpmr.c old mode 100755 new mode 100644 index d046cee3..4743b8ca --- a/asterisk/channels/xpmr/xpmr.c +++ b/asterisk/channels/xpmr/xpmr.c @@ -21,9 +21,15 @@ * * This version may be optionally licenced under the GNU LGPL licence. * + * A license has been granted to Digium (via disclaimer) for the use of + * this code. + * A license has been granted to Digium (via disclaimer) for the use of * this code. * + * 20160829 inad added rxlpf rxhpf txlpf txhpf + * 20161024 inad fixed set the number of coefficients + * 20161027 WN3A allow filters of different tap counts * 20090725 2039 sph@xelatec.com improved rxfrontend and squelch */ @@ -538,10 +544,10 @@ i16 pmr_rx_frontend(t_pmr_sps *mySps) #if XPMR_TRACE_FRONTEND == 1 y=0; for(n=0; nparentChan->rxlpf].coefs[n] * x[n]; y=((y/calcAdjust)*outputGain)/M_Q8; - input[i*2]=y; // debug output LowPass at 48KS/s + input[i*2]=y; // debug output LowPass at 48KS/s #endif if(doNoise) @@ -550,8 +556,8 @@ i16 pmr_rx_frontend(t_pmr_sps *mySps) naccum=0; if(mySps->parentChan->rxNoiseFilType==0) { - for(n=0; nparentChan->rxlpf].coefs[n] * x[n]; y=((y/calcAdjust)*outputGain)/M_Q8; @@ -1745,7 +1751,32 @@ t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples) pChan->ukey=tChan->ukey; pChan->name=tChan->name; pChan->fever = tChan->fever; - } + + if(tChan->rxlpfrxlpf>=0) + pChan->rxlpf=tChan->rxlpf; + else + pChan->rxlpf=0; + + if(tChan->rxhpfrxhpf>=0) + pChan->rxhpf=tChan->rxhpf; + else + pChan->rxhpf=0; + + if(tChan->txlpftxlpf>=0) + pChan->txlpf=tChan->txlpf; + else + pChan->txlpf=0; + + if(tChan->txhpftxhpf>=0) + pChan->txhpf=tChan->txhpf; + else + pChan->txhpf=0; + ast_log(LOG_NOTICE,"xpmr rxlpf: %d\n",pChan->rxlpf); + ast_log(LOG_NOTICE,"xpmr rxhpf: %d\n",pChan->rxhpf); + ast_log(LOG_NOTICE,"xpmr txlpf: %d\n",pChan->txlpf); + ast_log(LOG_NOTICE,"xpmr txhpf: %d\n",pChan->txhpf); + + } if(pChan->rxCarrierHyst==0) pChan->rxCarrierHyst = 3000; @@ -2064,13 +2095,13 @@ t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples) pSps->decimator=pSps->decimate=6; pSps->interpolate=pSps->interpolate=1; pSps->nSamples=pChan->nSamplesRx; - pSps->ncoef=taps_fir_bpf_noise_1; + pSps->ncoef=fir_rxlpf[pChan->rxlpf].taps; pSps->size_coef=2; - pSps->coef=(void*)coef_fir_lpf_3K_1; - pSps->nx=taps_fir_bpf_noise_1; + pSps->coef=(void*)fir_rxlpf[pChan->rxlpf].coefs; + pSps->nx=fir_rxlpf[pChan->rxlpf].taps; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_coef)); - pSps->calcAdjust=(gain_fir_lpf_3K_1*256)/0x0100; + pSps->calcAdjust=(fir_rxlpf[pChan->rxlpf].gain*256)/0x0100; pSps->outputGain=(1.0*M_Q8); pSps->discfactor=2; pSps->hyst=pChan->rxCarrierHyst; @@ -2137,14 +2168,14 @@ t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples) pSps->nSamples=pChan->nSamplesRx; pSps->decimator=pSps->decimate=1; pSps->interpolate=1; - pSps->ncoef=taps_fir_hpf_300_9_66; + pSps->ncoef=fir_rxhpf[pChan->rxhpf].taps; pSps->size_coef=2; - pSps->coef=(void*)coef_fir_hpf_300_9_66; - pSps->nx=taps_fir_hpf_300_9_66; + pSps->coef=(void*)fir_rxhpf[pChan->rxhpf].coefs; + pSps->nx=fir_rxhpf[pChan->rxhpf].taps; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); - pSps->calcAdjust=gain_fir_hpf_300_9_66; + pSps->calcAdjust=fir_rxhpf[pChan->rxhpf].gain; pSps->inputGain=(1*M_Q8); pSps->outputGain=(1*M_Q8); pChan->prxVoiceAdjust=&(pSps->outputGain); @@ -2257,14 +2288,14 @@ t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples) pSps->nSamples=pChan->nSamplesTx; pSps->decimator=pSps->decimate=1; pSps->interpolate=1; - pSps->ncoef=taps_fir_hpf_300_9_66; + pSps->ncoef=fir_txhpf[pChan->txhpf].taps; pSps->size_coef=2; - pSps->coef=(void*)coef_fir_hpf_300_9_66; - pSps->nx=taps_fir_hpf_300_9_66; + pSps->coef=(void*)fir_txhpf[pChan->txhpf].coefs; + pSps->nx=fir_txhpf[pChan->txhpf].taps; pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n"); - pSps->calcAdjust=gain_fir_hpf_300_9_66; + pSps->calcAdjust=fir_txhpf[pChan->txhpf].gain; pSps->inputGain=(1*M_Q8); pSps->outputGain=(1*M_Q8); inputTmp=pChan->pTxHpf; @@ -2400,11 +2431,11 @@ t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples) pSps->calcAdjust=gain_fir_lpf_3K_2; #else pSps->interpolate=6; - pSps->ncoef=taps_fir_lpf_3K_1; + pSps->ncoef=fir_txlpf[pChan->txlpf].taps; pSps->size_coef=2; - pSps->coef=(void*)coef_fir_lpf_3K_1; - pSps->nx=taps_fir_lpf_3K_1; - pSps->calcAdjust=gain_fir_lpf_3K_1; + pSps->coef=(void*)fir_txlpf[pChan->txlpf].coefs; + pSps->nx=fir_txlpf[pChan->txlpf].taps; + pSps->calcAdjust=fir_txlpf[pChan->txlpf].gain; #endif pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); @@ -2460,11 +2491,11 @@ t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples) pSps->calcAdjust=(gain_fir_lpf_3K_2); #else pSps->interpolate=6; - pSps->ncoef=taps_fir_lpf_3K_1; + pSps->ncoef=fir_txlpf[pChan->txlpf].taps; pSps->size_coef=2; - pSps->coef=(void*)coef_fir_lpf_3K_1; - pSps->nx=taps_fir_lpf_3K_1; - pSps->calcAdjust=(gain_fir_lpf_3K_1); + pSps->coef=(void*)fir_txlpf[pChan->txlpf].coefs; + pSps->nx=fir_txlpf[pChan->txlpf].taps; + pSps->calcAdjust=(fir_txlpf[pChan->txlpf].gain); #endif pSps->size_x=2; pSps->x=(void*)(calloc(pSps->nx,pSps->size_x)); diff --git a/asterisk/channels/xpmr/xpmr.h b/asterisk/channels/xpmr/xpmr.h old mode 100755 new mode 100644 index b94138dd..498ae1c8 --- a/asterisk/channels/xpmr/xpmr.h +++ b/asterisk/channels/xpmr/xpmr.h @@ -24,6 +24,7 @@ * A license has been granted to Digium (via disclaimer) for the use of * this code. * + * 20160829 inad added rxlpf rxhpf txlpf txhpf */ /*! \file @@ -636,6 +637,10 @@ typedef struct t_pmr_chan char radioDuplex; char rxNoiseFilType; + int rxlpf; + int rxhpf; + int txlpf; + int txhpf; char *pStr; diff --git a/asterisk/channels/xpmr/xpmr_coef.h b/asterisk/channels/xpmr/xpmr_coef.h old mode 100755 new mode 100644 index e5be611a..d2117cd4 --- a/asterisk/channels/xpmr/xpmr_coef.h +++ b/asterisk/channels/xpmr/xpmr_coef.h @@ -26,6 +26,7 @@ * * Some filter coeficients via 'WinFilter' http://www.winfilter.20m.com. * + * 20160829 inad added rxlpf rxhpf txlpf txhpf */ /*! \file @@ -327,80 +328,6 @@ static const int16_t coef_fir_lpf_3K_2[] = { } ; -/* - tbd -*/ -static const int16_t taps_fir_lpf_3K_1 = 66; -static const int32_t gain_fir_lpf_3K_1 = 131072; -static const int16_t coef_fir_lpf_3K_1[] = { - 259, - 58, - -185, - -437, - -654, - -793, - -815, - -696, - -434, - -48, - 414, - 886, - 1284, - 1523, - 1529, - 1254, - 691, - -117, - -1078, - -2049, - -2854, - -3303, - -3220, - -2472, - -995, - 1187, - 3952, - 7086, - 10300, - 13270, - 15672, - 17236, - 17778, - 17236, - 15672, - 13270, - 10300, - 7086, - 3952, - 1187, - -995, - -2472, - -3220, - -3303, - -2854, - -2049, - -1078, - -117, - 691, - 1254, - 1529, - 1523, - 1284, - 886, - 414, - -48, - -434, - -696, - -815, - -793, - -654, - -437, - -185, - 58, - 259, - 393 -}; - /************************************************************** Filter type: Low Pass Filter model: Butterworth @@ -685,86 +612,191 @@ static const int16_t coef_fir_lpf_215_9_88[] = { 1966 }; // end coef fir_lpf_215_9_88 -// -/************************************************************** -Filter type: High Pass -Filter model: Butterworth -Filter order: 9 -Sampling Frequency: 8 KHz -Cut Frequency: 0.300000 KHz -Coefficents Quantization: 16-bit -***************************************************************/ -static const int16_t taps_fir_hpf_300_9_66 = 66; -static const int32_t gain_fir_hpf_300_9_66 = 32768; -static const int16_t coef_fir_hpf_300_9_66[] = -{ - -141, - -114, - -77, - -30, - 23, - 83, - 147, - 210, - 271, - 324, - 367, - 396, - 407, - 396, - 362, - 302, - 216, - 102, - -36, - -199, - -383, - -585, - -798, --1017, --1237, --1452, --1653, --1836, --1995, --2124, --2219, --2278, -30463, --2278, --2219, --2124, --1995, --1836, --1653, --1452, --1237, --1017, - -798, - -585, - -383, - -199, - -36, - 102, - 216, - 302, - 362, - 396, - 407, - 396, - 367, - 324, - 271, - 210, - 147, - 83, - 23, - -30, - -77, - -114, - -141, - -158 - }; + +//////////////////////////////////////////////////////////////////////// +// Filter Tables +//////////////////////////////////////////////////////////////////////// + +#define MAX_COEFS 128 + +typedef struct t_fir { + i16 taps; + i32 gain; + i16 coefs[MAX_COEFS]; +} T_FIR; + + +static const T_FIR fir_rxlpf[] = { + + // Index 0 - 3 kHz corner + { + 66, 131072, + {259, 58, -185, -437, -654, -793, -815, -696, -434, + -48, 414, 886, 1284, 1523, 1529, 1254, 691, -117, -1078, + -2049, -2854, -3303, -3220, -2472, -995, 1187, 3952, 7086, + 10300, 13270, 15672, 17236, 17778, 17236, 15672, 13270, + 10300, 7086, 3952, 1187, -995, -2472, -3220, -3303, -2854, + -2049, -1078, -117, 691, 1254, 1529, 1523, 1284, 886, 414, + -48, -434, -696, -815, -793, -654, -437, -185, 58, 259, 393 } + }, + + // Index 1 -15th order Butterworth, 3.3 kHz corner + { + 128, 131072, + { 47, 83, 108, 114, 98, 61, 5, -58, -118, -163, -181, + -165, -113, -32, 66, 164, 242, 282, 269, 200, 82, -68, + -226, -358, -435, -434, -344, -171, 59, 310, 531, 674, + 697, 580, 325, -32, -436, -807, -1064, -1136, -979, -590, + -15, 655, 1296, 1767, 1937, 1716, 1080, 83, -1133, -2356, + -3325, -3772, -3469, -2270, -151, 2776, 6267, 9965, 13454, + 16317, 18195, 18849, 18195, 16317, 13454, 9965, 6267, 2776, + -151, -2270, -3469, -3772, -3325, -2356, -1133, 83, 1080, + 1716, 1937, 1767, 1296, 655, -15, -590, -979, -1136, -1064, + -807, -436, -32, 325, 580, 697, 674, 531, 310, 59, -171, + -344, -434, -435, -358, -226, -68, 82, 200, 269, 282, 242, + 164, 66, -32, -113, -165, -181, -163, -118, -58, 5, 61, 98, + 114, 108, 83, 47, 6 } + }, + + // Index 2 - 17th order Butterworth, 3.7 kHz corner + { 128, 131072, + { -43, -100, -140, -149, -122, -62, 21, 109, 181, 216, 201, + 135, 26, -102, -220, -298, -310, -246, -112, 66, 249, 392, + 453, 408, 254, 16, -253, -494, -638, -639, -477, -172, 214, + 597, 876, 967, 821, 444, -99, -693, -1190, -1448, -1366, + -912, -148, 774, 1643, 2220, 2304, 1783, 678, -834, -2446, + -3754, -4342, -3862, -2119, 869, 4855, 9381, 13852, 17631, + 20157, 21045, 20157, 17631, 13852, 9381, 4855, 869, -2119, + -3862, -4342, -3754, -2446, -834, 678, 1783, 2304, 2220, + 1643, 774, -148, -912, -1366, -1448, -1190, -693, -99, 444, + 821, 967, 876, 597, 214, -172, -477, -639, -638, -494, -253, + 16, 254, 408, 453, 392, 249, 66, -112, -246, -310, -298, + -220, -102, 26, 135, 201, 216, 181, 109, 21, -62, -122, -149, + -140, -100, -43, 17 } + } +}; // end of RX LPFís + + +static const T_FIR fir_rxhpf[] = { + + // Index 0 - 300 Hz HPF, Butterworth, 9th Order, 16 bit coefs + { + 66, 32768, + { -141, -114, -77, -30, 23, 83, 147, 210, 271, 324, 367, 396, + 407, 396, 362, 302, 216, 102, -36, -199, -383, -585, -798, + -1017, -1237, -1452, -1653, -1836, -1995, -2124, -2219, + -2278, 30463, -2278, -2219, -2124, -1995, -1836, -1653, + -1452, -1237, -1017, -798, -585, -383, -199, -36, 102, 216, + 302, 362, 396, 407, 396, 367, 324, 271, 210, 147, 83, 23, + -30, -77, -114, -141, -158 } + }, + + // Index 1 - 250 Hz HPF, 9th order Butterworth + { + 128, 32768, + { 32, 39, 45, 50, 53, 54, 54, 51, 45, 37, 27, 15, 0, -15, + -32, -50, -68, -85, -100, -114, -124, -130, -132, -129, + -121, -107, -87, -61, -31, 4, 43, 85, 128, 171, 213, 251, + 284, 310, 328, 334, 329, 310, 276, 228, 164, 84, -9, -118, + -240, -372, -514, -663, -815, -968, -1119, -1265, -1403, + -1529, -1641, -1737, -1813, -1869, -1904, 30856, -1904, + -1869, -1813, -1737, -1641, -1529, -1403, -1265, -1119, + -968, -815, -663, -514, -372, -240, -118, -9, 84, 164, 228, + 276, 310, 329, 334, 328, 310, 284, 251, 213, 171, 128, 85, + 43, 4, -31, -61, -87, -107, -121, -129, -132, -130, -124, + -114, -100, -85, -68, -50, -32, -15, 0, 15, 27, 37, 45, 51, + 54, 54, 53, 50, 45, 39, 32, 25 } + } +}; // end of RX HPFís + + +static const T_FIR fir_txhpf[] = { + + // Index 0 - 300 Hz HPF + { + 66, 32768, + { -141, -114, -77, -30, 23, 83, 147, 210, 271, 324, 367, 396, + 407, 396, 362, 302, 216, 102, -36, -199, -383, -585, -798, + -1017, -1237, -1452, -1653, -1836, -1995, -2124, -2219, + -2278, 30463, -2278, -2219, -2124, -1995, -1836, -1653, + -1452, -1237, -1017, -798, -585, -383, -199, -36, 102, 216, + 302, 362, 396, 407, 396, 367, 324, 271, 210, 147, 83, 23, + -30, -77, -114, -141, -158 } + }, + + // Index 1 - 250 Hz HPF, 7th order Butterworth + { + 96, 32768, + { -56, -68, -79, -88, -95, -99, -99, -95, -87, -74, -57, + -35, -9, 20, 53, 89, 125, 162, 197, 229, 257, 279, 292, + 296, 289, 270, 238, 191, 130, 54, -35, -139, -256, -383, + -519, -662, -810, -958, -1105, -1248, -1382, -1505, -1615, + -1709, -1784, -1840, -1873, 30876, -1873, -1840, -1784, + -1709, -1615, -1505, -1382, -1248, -1105, -958, -810, -662, + -519, -383, -256, -139, -35, 54, 130, 191, 238, 270, 289, + 296, 292, 279, 257, 229, 197, 162, 125, 89, 53, 20, -9, -35, + -57, -74, -87, -95, -99, -99, -95, -88, -79, -68, -56, -44 } + }, + + // Index 2 - 120 Hz HPF, 5th order Butterworth + { + 128, 32768, + { 48, 53, 58, 63, 67, 72, 76, 80, 84, 87, 89, 91, 92, 93, + 92, 91, 88, 85, 80, 74, 67, 58, 48, 37, 24, 10, -5, -22, + -41, -61, -82, -105, -130, -156, -183, -211, -240, -270, + -301, -332, -365, -397, -430, -463, -496, -528, -561, -592, + -623, -653, -681, -709, -734, -759, -781, -802, -820, -836, + -850, -861, -871, -877, -881, 31887, -881, -877, -871, -861, + -850, -836, -820, -802, -781, -759, -734, -709, -681, -653, + -623, -592, -561, -528, -496, -463, -430, -397, -365, -332, + -301, -270, -240, -211, -183, -156, -130, -105, -82, -61, + -41, -22, -5, 10, 24, 37, 48, 58, 67, 74, 80, 85, 88, 91, 92, + 93, 92, 91, 89, 87, 84, 80, 76, 72, 67, 63, 58, 53, 48, 43 } + } + +}; // end of TX HPFís + + +static const T_FIR fir_txlpf[] = { + + // Index 0 - 3 kHz LPF + { + 66, 131072, + {259, 58, -185, -437, -654, -793, -815, -696, -434, + -48, 414, 886, 1284, 1523, 1529, 1254, 691, -117, -1078, + -2049, -2854, -3303, -3220, -2472, -995, 1187, 3952, 7086, + 10300, 13270, 15672, 17236, 17778, 17236, 15672, 13270, + 10300, 7086, 3952, 1187, -995, -2472, -3220, -3303, -2854, + -2049, -1078, -117, 691, 1254, 1529, 1523, 1284, 886, 414, + -48, -434, -696, -815, -793, -654, -437, -185, 58, 259, 393 } + }, + + // Index 1 - 3.3 kHz LPF, 15th order Butterworth + { + 128, 131072, + { 47, 83, 108, 114, 98, 61, 5, -58, -118, -163, -181, + -165, -113, -32, 66, 164, 242, 282, 269, 200, 82, -68, + -226, -358, -435, -434, -344, -171, 59, 310, 531, 674, + 697, 580, 325, -32, -436, -807, -1064, -1136, -979, -590, + -15, 655, 1296, 1767, 1937, 1716, 1080, 83, -1133, -2356, + -3325, -3772, -3469, -2270, -151, 2776, 6267, 9965, 13454, + 16317, 18195, 18849, 18195, 16317, 13454, 9965, 6267, 2776, + -151, -2270, -3469, -3772, -3325, -2356, -1133, 83, 1080, + 1716, 1937, 1767, 1296, 655, -15, -590, -979, -1136, -1064, + -807, -436, -32, 325, 580, 697, 674, 531, 310, 59, -171, + -344, -434, -435, -358, -226, -68, 82, 200, 269, 282, 242, + 164, 66, -32, -113, -165, -181, -163, -118, -58, 5, 61, 98, + 114, 108, 83, 47, 6 } + } + +}; // end of TX LPFís + +#define MAX_RXLPF (sizeof(fir_rxlpf) / sizeof(T_FIR)) +#define MAX_RXHPF (sizeof(fir_rxhpf) / sizeof(T_FIR)) +#define MAX_TXHPF (sizeof(fir_txhpf) / sizeof(T_FIR)) +#define MAX_TXLPF (sizeof(fir_txlpf) / sizeof(T_FIR)) + + #endif /* !XPMR_COEF_H */ /* end of file */ diff --git a/configs/usbradio/usbradio.conf b/configs/usbradio/usbradio.conf index 2310e960..ba68e39a 100644 --- a/configs/usbradio/usbradio.conf +++ b/configs/usbradio/usbradio.conf @@ -82,3 +82,23 @@ duplex=1 ; Full Duplex ; release of PTT. Use this only on simplex nodes, and leave commented ; out for repeaters or other full duplex nodes. +rxlpf = 0 ; Receiver Audio Low Pass Filter 0,1,2 + ; 0 - 3.0 kHz cutoff (Default) value for reduced noise and increased intelligibility. (default) + ; 1 - 3.3 kHz cutoff for increased high end, sibilance and brightness. + ; 2 - 3.5 kHz cutoff for even more high end, sibilance and brightness. + +rxhpf = 0 ; Receiver Audio High Pass Filter 0,1 + ; 0 - 300 Hz cutoff. (Default) value to reduce sub-audible signals for retransmission and in the receiver speaker. (default) + ; 1 - 250 Hz cutoff for additional received and retransmitted bass response. + ; recommend using this filter with a CTCSS tone no higher than 186.2 Hz. + +txlpf = 0 ; Transmitter Audio Low Pass Filter 0,1 + ; 0 - 3.0 kHz cutoff. (Default) + ; 1 - 3.3 kHz cutoff for increased high end, sibilance and brightness. + +txhpf = 0 ; Transmitter Audio High Pass Filter 0,1,2 + ; 0 - 300 Hz cutoff Reduce interference between voice and sub-audible signaling tones and codes (default) + ; 1 - 250 Hz cutoff Increase bass response in transmitted audio. + ; 2 - 120 Hz cutoff for special applications requiring additional bass response in transmitted audio + ; Not recommended due to the increased possibility of voice energy interfering with sub-audible signaling + From 5f5501602446bd3a558564512a0365c3d7026eff Mon Sep 17 00:00:00 2001 From: Steve Zingman Date: Mon, 20 Feb 2017 14:57:16 -0500 Subject: [PATCH 02/96] Update chan_echolink.c Increase the size of the the permit and deny list in EchoLink. It is currently defined at 30. Increased to 60 --- asterisk/channels/chan_echolink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asterisk/channels/chan_echolink.c b/asterisk/channels/chan_echolink.c index 655a845c..c5d895b2 100644 --- a/asterisk/channels/chan_echolink.c +++ b/asterisk/channels/chan_echolink.c @@ -155,7 +155,7 @@ Modification #define EL_MAX_SERVERS 3 #define EL_SERVERNAME_SIZE 63 #define EL_MAX_INSTANCES 100 -#define EL_MAX_CALL_LIST 30 +#define EL_MAX_CALL_LIST 60 #define EL_APRS_SERVER "aprs.echolink.org" #define EL_APRS_INTERVAL 600 #define EL_APRS_START_DELAY 10 From 2acc00850bee27c0795322aaa489f5b70a0cd9ce Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Tue, 21 Feb 2017 08:35:46 -0500 Subject: [PATCH 03/96] Add support for CM119B --- asterisk/channels/chan_simpleusb.c | 5 ++++- asterisk/channels/chan_usbradio.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/asterisk/channels/chan_simpleusb.c b/asterisk/channels/chan_simpleusb.c index 67810610..e4db065e 100644 --- a/asterisk/channels/chan_simpleusb.c +++ b/asterisk/channels/chan_simpleusb.c @@ -33,7 +33,7 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 536 $") #include #include @@ -132,6 +132,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") #define N1KDO_PRODUCT_ID 0x6a00 #define C119_PRODUCT_ID 0x0008 #define C119A_PRODUCT_ID 0x013a +#define C119B_PRODUCT_ID 0x0013 #define C108_HID_INTERFACE 3 #define HID_REPORT_GET 0x01 @@ -998,6 +999,7 @@ static struct usb_device *hid_device_init(char *desired_device) (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || + (dev->descriptor.idProduct == C119B_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || (dev->descriptor.idProduct == C119_PRODUCT_ID))) { @@ -1082,6 +1084,7 @@ static int hid_device_mklist(void) (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || + (dev->descriptor.idProduct == C119B_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || (dev->descriptor.idProduct == C119_PRODUCT_ID))) { diff --git a/asterisk/channels/chan_usbradio.c b/asterisk/channels/chan_usbradio.c index 8a497b70..1084c553 100644 --- a/asterisk/channels/chan_usbradio.c +++ b/asterisk/channels/chan_usbradio.c @@ -159,6 +159,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") #define C108AH_PRODUCT_ID 0x013c #define C119_PRODUCT_ID 0x0008 #define C119A_PRODUCT_ID 0x013a +#define C119B_PRODUCT_ID 0x0013 #define N1KDO_PRODUCT_ID 0x6a00 #define C108_HID_INTERFACE 3 @@ -1091,6 +1092,7 @@ static struct usb_device *hid_device_init(char *desired_device) (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || + (dev->descriptor.idProduct == C119B_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || (dev->descriptor.idProduct == C119_PRODUCT_ID))) { @@ -1175,6 +1177,7 @@ static int hid_device_mklist(void) (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || + (dev->descriptor.idProduct == C119B_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || (dev->descriptor.idProduct == C119_PRODUCT_ID))) { From bae086d5099f18d6836113f192f8c5a5e3df9689 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Tue, 21 Feb 2017 08:39:30 -0500 Subject: [PATCH 04/96] Add support for CM119B --- asterisk/channels/chan_usbradio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asterisk/channels/chan_usbradio.c b/asterisk/channels/chan_usbradio.c index 1084c553..94d11588 100644 --- a/asterisk/channels/chan_usbradio.c +++ b/asterisk/channels/chan_usbradio.c @@ -39,7 +39,7 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 536 $") #include #include From 22b4c354a938c9a6c88649f0c4d243a4709bcf0f Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Tue, 21 Feb 2017 15:00:37 -0500 Subject: [PATCH 05/96] Replace references to usbradio with simpleusb --- asterisk/channels/chan_simpleusb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/asterisk/channels/chan_simpleusb.c b/asterisk/channels/chan_simpleusb.c index e4db065e..e65d531c 100644 --- a/asterisk/channels/chan_simpleusb.c +++ b/asterisk/channels/chan_simpleusb.c @@ -28,12 +28,12 @@ */ /*** MODULEINFO - yes + yes ***/ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 536 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 537 $") #include #include @@ -211,7 +211,7 @@ START_CONFIG ; invertptt = 0 - ; duplex = 1 ; duplex mode + ; duplex = 1 ; duplex mode ; duplex3 = 0 ; duplex 3 gain setting (0 to disable) @@ -1459,7 +1459,7 @@ static void *hidthread(void *arg) if (usb_dev == NULL) continue; if ((usb_dev->descriptor.idProduct & 0xff00) != N1KDO_PRODUCT_ID) continue; if (o->index != (usb_dev->descriptor.idProduct & 0xf)) continue; - ast_log(LOG_NOTICE,"N1KDO port %d, USB device %s usbradio channel %s\n", + ast_log(LOG_NOTICE,"N1KDO port %d, USB device %s simpleusb channel %s\n", usb_dev->descriptor.idProduct & 0xf,s,o->name); strcpy(o->devstr,s); isn1kdo = 1; @@ -1770,7 +1770,7 @@ static void *hidthread(void *arg) fr.samples = 0; fr.frametype = AST_FRAME_TEXT; fr.subclass = 0; - fr.src = "chan_usbradio"; + fr.src = "chan_simpleusb"; fr.offset = 0; fr.mallocd=0; fr.delivery.tv_sec = 0; @@ -1815,7 +1815,7 @@ static void *hidthread(void *arg) fr.samples = 0; fr.frametype = AST_FRAME_TEXT; fr.subclass = 0; - fr.src = "chan_usbradio"; + fr.src = "chan_simpleusb"; fr.offset = 0; fr.mallocd=0; fr.delivery.tv_sec = 0; @@ -1835,7 +1835,7 @@ static void *hidthread(void *arg) j = k & (1 << ppinshift[i]); /* set the bit accordingly */ if (j != o->rxppsq) { - if(o->debuglevel)printf("chan_usbradio() hidthread: update rxppsq = %d\n",j); + if(o->debuglevel)printf("chan_simpleusb() hidthread: update rxppsq = %d\n",j); o->rxppsq = j; } } @@ -2267,7 +2267,7 @@ static int simpleusb_text(struct ast_channel *c, const char *text) cnt = sscanf(text,"%s %d",cmd,&i); if (cnt < 2) return 0; o->rxctcssoverride = !i; - if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio RXCTCSS cmd: %s\n",text); + if(o->debuglevel)ast_log(LOG_NOTICE,"parse simpleusb RXCTCSS cmd: %s\n",text); return 0; } From d0fac6950df9c40c87889c33b1ef5f5d1a54aa0f Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Wed, 8 Mar 2017 10:42:12 -0500 Subject: [PATCH 06/96] Apply Debian patches and remove zaptel --- asterisk/configure | 20 +- asterisk/configure.ac | 2 +- asterisk/contrib/init.d/rc.debian.asterisk | 25 +- asterisk/menuselect.makeopts | 6 +- getsrc | 19 - zaptel/.version | 1 - zaptel/ChangeLog | 4249 ---- zaptel/LICENSE | 341 - zaptel/LICENSE.LGPL | 504 - zaptel/Makefile | 693 - zaptel/README | 761 - zaptel/README.Astribank | 3 - zaptel/README.b410p | 29 - zaptel/README.fxotune | 23 - zaptel/README.fxsusb | 15 - zaptel/README.hpec | 21 - zaptel/acinclude.m4 | 89 - zaptel/aclocal.m4 | 14 - zaptel/bittest.h | 17 - zaptel/bootstrap.sh | 25 - zaptel/build_tools/builder | 168 - zaptel/build_tools/genmodconf | 107 - zaptel/build_tools/genudevrules | 39 - zaptel/build_tools/make_firmware_object.in | 11 - zaptel/build_tools/make_svn_branch_name | 61 - zaptel/build_tools/make_tree | 8 - zaptel/build_tools/make_version | 56 - zaptel/build_tools/make_version_h | 9 - zaptel/build_tools/menuselect-deps.in | 1 - zaptel/build_tools/test_kernel_git | 101 - zaptel/build_tools/uninstall-modules | 64 - zaptel/build_tools/zaptel_svn_tarball | 90 - zaptel/checkstack | 46 - zaptel/complex.cc | 61 - zaptel/complex.h | 76 - zaptel/config.guess | 1495 -- zaptel/config.sub | 1609 -- zaptel/configure | 6488 ------ zaptel/configure.ac | 132 - zaptel/doc/fxotune.8 | 206 - zaptel/doc/fxstest.8 | 60 - zaptel/doc/module-parameters.txt | 57 - zaptel/doc/patgen.8 | 42 - zaptel/doc/pattest.8 | 48 - zaptel/doc/torisatool.8 | 29 - zaptel/doc/ztcfg.8 | 61 - zaptel/doc/ztdiag.8 | 52 - zaptel/doc/ztmonitor.8 | 43 - zaptel/doc/ztscan.8 | 94 - zaptel/doc/ztspeed.8 | 26 - zaptel/doc/zttest.8 | 53 - zaptel/doc/zttool.8 | 34 - zaptel/firmware/Makefile | 172 - zaptel/firmware/firmware.xml | 18 - zaptel/fxotune.c | 1119 - zaptel/fxotune.h | 119 - zaptel/fxstest.c | 157 - zaptel/hdlcgen.c | 118 - zaptel/hdlcstress.c | 199 - zaptel/hdlctest.c | 274 - zaptel/hdlcverify.c | 119 - zaptel/ifcfg-hdlc0 | 6 - zaptel/ifup-hdlc | 39 - zaptel/install-sh | 323 - zaptel/install_prereq | 129 - zaptel/kernel/GNUmakefile | 144 - zaptel/kernel/Kbuild | 71 - zaptel/kernel/Makefile | 6 - zaptel/kernel/adt_lec.c | 68 - zaptel/kernel/adt_lec.h | 43 - zaptel/kernel/arith.h | 377 - zaptel/kernel/biquad.h | 73 - zaptel/kernel/datamods/Makefile | 32 - zaptel/kernel/datamods/hdlc_cisco.c | 335 - zaptel/kernel/datamods/hdlc_fr.c | 1273 -- zaptel/kernel/datamods/hdlc_generic.c | 355 - zaptel/kernel/datamods/hdlc_ppp.c | 114 - zaptel/kernel/datamods/hdlc_raw.c | 89 - zaptel/kernel/datamods/hdlc_raw_eth.c | 107 - zaptel/kernel/datamods/syncppp.c | 1485 -- zaptel/kernel/digits.h | 47 - zaptel/kernel/ecdis.h | 118 - zaptel/kernel/fasthdlc.h | 472 - zaptel/kernel/fir.h | 130 - zaptel/kernel/fxo_modes.h | 588 - zaptel/kernel/hpec/hpec.h | 47 - zaptel/kernel/hpec/hpec_user.h | 40 - zaptel/kernel/hpec/hpec_zaptel.h | 146 - zaptel/kernel/jpah.h | 112 - zaptel/kernel/kb1ec.h | 605 - zaptel/kernel/kb1ec_const.h | 85 - zaptel/kernel/makefw.c | 84 - zaptel/kernel/mg2ec.h | 733 - zaptel/kernel/mg2ec_const.h | 101 - zaptel/kernel/oct612x/Makefile | 38 - zaptel/kernel/oct612x/apilib/bt/octapi_bt0.c | 1217 -- .../oct612x/apilib/bt/octapi_bt0_private.h | 93 - .../oct612x/apilib/largmath/octapi_largmath.c | 628 - .../oct612x/apilib/llman/octapi_llman.c | 2787 --- .../apilib/llman/octapi_llman_private.h | 206 - zaptel/kernel/oct612x/get_discards | 51 - .../oct612x/include/apilib/octapi_bt0.h | 75 - .../oct612x/include/apilib/octapi_largmath.h | 69 - .../oct612x/include/apilib/octapi_llman.h | 142 - zaptel/kernel/oct612x/include/digium_unused.h | 297 - .../oct6100api/oct6100_adpcm_chan_inst.h | 74 - .../oct6100api/oct6100_adpcm_chan_pub.h | 90 - .../oct612x/include/oct6100api/oct6100_api.h | 84 - .../include/oct6100api/oct6100_api_inst.h | 138 - .../include/oct6100api/oct6100_apimi.h | 69 - .../include/oct6100api/oct6100_apiud.h | 312 - .../include/oct6100api/oct6100_channel_inst.h | 389 - .../include/oct6100api/oct6100_channel_pub.h | 547 - .../oct6100api/oct6100_chip_open_inst.h | 517 - .../oct6100api/oct6100_chip_open_pub.h | 241 - .../oct6100api/oct6100_chip_stats_inst.h | 84 - .../oct6100api/oct6100_chip_stats_pub.h | 150 - .../oct6100api/oct6100_conf_bridge_inst.h | 104 - .../oct6100api/oct6100_conf_bridge_pub.h | 169 - .../include/oct6100api/oct6100_debug_inst.h | 124 - .../include/oct6100api/oct6100_debug_pub.h | 76 - .../include/oct6100api/oct6100_defines.h | 670 - .../include/oct6100api/oct6100_errors.h | 838 - .../include/oct6100api/oct6100_events_inst.h | 69 - .../include/oct6100api/oct6100_events_pub.h | 111 - .../oct6100api/oct6100_interrupts_inst.h | 134 - .../oct6100api/oct6100_interrupts_pub.h | 102 - .../include/oct6100api/oct6100_mixer_inst.h | 86 - .../include/oct6100api/oct6100_mixer_pub.h | 77 - .../oct6100api/oct6100_phasing_tsst_inst.h | 68 - .../oct6100api/oct6100_phasing_tsst_pub.h | 78 - .../oct6100api/oct6100_playout_buf_inst.h | 88 - .../oct6100api/oct6100_playout_buf_pub.h | 183 - .../oct6100api/oct6100_remote_debug_inst.h | 73 - .../oct6100api/oct6100_remote_debug_pub.h | 64 - .../include/oct6100api/oct6100_tlv_inst.h | 72 - .../oct6100api/oct6100_tone_detection_inst.h | 46 - .../oct6100api/oct6100_tone_detection_pub.h | 74 - .../oct6100api/oct6100_tsi_cnct_inst.h | 70 - .../include/oct6100api/oct6100_tsi_cnct_pub.h | 76 - .../include/oct6100api/oct6100_tsst_inst.h | 55 - zaptel/kernel/oct612x/include/octdef.h | 116 - zaptel/kernel/oct612x/include/octmac.h | 98 - .../kernel/oct612x/include/octosdependant.h | 167 - .../include/octrpc/oct6100_rpc_protocol.h | 348 - .../oct612x/include/octrpc/rpc_protocol.h | 115 - zaptel/kernel/oct612x/include/octtype.h | 153 - zaptel/kernel/oct612x/include/octtypevx.h | 132 - zaptel/kernel/oct612x/include/octtypewin.h | 100 - zaptel/kernel/oct612x/octasic-helper | 39 - .../oct6100api/oct6100_adpcm_chan_priv.h | 131 - .../oct6100_api/oct6100_adpcm_chan.c | 1237 -- .../oct6100api/oct6100_api/oct6100_channel.c | 13931 ------------ .../oct6100_api/oct6100_chip_open.c | 6905 ------ .../oct6100_api/oct6100_chip_stats.c | 440 - .../oct6100_api/oct6100_conf_bridge.c | 7687 ------- .../oct6100api/oct6100_api/oct6100_debug.c | 1278 -- .../oct6100api/oct6100_api/oct6100_events.c | 1380 -- .../oct6100_api/oct6100_interrupts.c | 2011 -- .../oct6100api/oct6100_api/oct6100_memory.c | 831 - .../oct6100_api/oct6100_miscellaneous.c | 640 - .../oct6100api/oct6100_api/oct6100_mixer.c | 1586 -- .../oct6100_api/oct6100_phasing_tsst.c | 921 - .../oct6100_api/oct6100_playout_buf.c | 3350 --- .../oct6100_api/oct6100_remote_debug.c | 1598 -- .../oct6100api/oct6100_api/oct6100_tlv.c | 2055 -- .../oct6100_api/oct6100_tone_detection.c | 1088 - .../oct6100api/oct6100_api/oct6100_tsi_cnct.c | 1023 - .../oct6100api/oct6100_api/oct6100_tsst.c | 575 - .../oct6100api/oct6100_api/oct6100_user.c | 508 - .../oct6100_apimi/oct6100_mask_interrupts.c | 116 - .../oct6100api/oct6100_channel_priv.h | 529 - .../oct6100api/oct6100_chip_open_priv.h | 264 - .../oct6100api/oct6100_chip_stats_priv.h | 55 - .../oct6100api/oct6100_conf_bridge_priv.h | 318 - .../oct6100api/oct6100_debug_priv.h | 58 - .../oct6100api/oct6100_events_priv.h | 82 - .../oct6100api/oct6100_interrupts_priv.h | 158 - .../oct6100api/oct6100_memory_priv.h | 97 - .../oct6100api/oct6100_miscellaneous_priv.h | 431 - .../oct6100api/oct6100_mixer_priv.h | 150 - .../oct6100api/oct6100_phasing_tsst_priv.h | 114 - .../oct6100api/oct6100_playout_buf_priv.h | 201 - .../oct6100api/oct6100_remote_debug_priv.h | 144 - .../oct6100api/oct6100_tlv_priv.h | 515 - .../oct6100api/oct6100_tone_detection_priv.h | 111 - .../oct6100api/oct6100_tsi_cnct_priv.h | 126 - .../oct6100api/oct6100_tsst_priv.h | 89 - .../octdeviceapi/oct6100api/oct6100_version.h | 39 - zaptel/kernel/oct612x/test.c | 46 - zaptel/kernel/pciradio.c | 1935 -- zaptel/kernel/pciradio.rbt | 10531 ---------- zaptel/kernel/proslic.h | 203 - zaptel/kernel/sec-2.h | 451 - zaptel/kernel/sec.h | 310 - zaptel/kernel/tor2-hw.h | 186 - zaptel/kernel/tor2.c | 1521 -- zaptel/kernel/torisa.c | 1171 -- zaptel/kernel/tormenta2.rbt | 17482 ---------------- zaptel/kernel/voicebus.c | 1491 -- zaptel/kernel/voicebus.h | 53 - zaptel/kernel/wcfxo.c | 1102 - zaptel/kernel/wct1xxp.c | 1438 -- zaptel/kernel/wct4xxp/Kbuild | 27 - zaptel/kernel/wct4xxp/Makefile | 36 - zaptel/kernel/wct4xxp/base.c | 3878 ---- zaptel/kernel/wct4xxp/vpm450m.c | 590 - zaptel/kernel/wct4xxp/vpm450m.h | 43 - zaptel/kernel/wct4xxp/wct4xxp-diag.c | 427 - zaptel/kernel/wct4xxp/wct4xxp.h | 113 - zaptel/kernel/wctc4xxp/Kbuild | 20 - zaptel/kernel/wctc4xxp/Makefile | 6 - zaptel/kernel/wctc4xxp/base.c | 3279 --- zaptel/kernel/wctdm.c | 2560 --- zaptel/kernel/wctdm.h | 68 - zaptel/kernel/wctdm24xxp/GpakApi.c | 1630 -- zaptel/kernel/wctdm24xxp/GpakApi.h | 636 - zaptel/kernel/wctdm24xxp/GpakCust.c | 478 - zaptel/kernel/wctdm24xxp/GpakCust.h | 180 - zaptel/kernel/wctdm24xxp/GpakHpi.h | 78 - zaptel/kernel/wctdm24xxp/Kbuild | 25 - zaptel/kernel/wctdm24xxp/Makefile | 27 - zaptel/kernel/wctdm24xxp/base.c | 4167 ---- zaptel/kernel/wctdm24xxp/gpakErrs.h | 155 - zaptel/kernel/wctdm24xxp/gpakenum.h | 191 - zaptel/kernel/wctdm24xxp/voicebus.c | 1491 -- zaptel/kernel/wctdm24xxp/wctdm24xxp.h | 286 - zaptel/kernel/wcte11xp.c | 1644 -- zaptel/kernel/wcte12xp/GpakApi.c | 1616 -- zaptel/kernel/wcte12xp/GpakApi.h | 636 - zaptel/kernel/wcte12xp/GpakErrs.h | 155 - zaptel/kernel/wcte12xp/GpakHpi.h | 79 - zaptel/kernel/wcte12xp/Kbuild | 25 - zaptel/kernel/wcte12xp/Makefile | 25 - zaptel/kernel/wcte12xp/base.c | 1762 -- zaptel/kernel/wcte12xp/gpakenum.h | 190 - zaptel/kernel/wcte12xp/voicebus.c | 1 - zaptel/kernel/wcte12xp/vpmadt032.c | 1311 -- zaptel/kernel/wcte12xp/vpmadt032.h | 145 - zaptel/kernel/wcte12xp/wcte12xp.h | 163 - zaptel/kernel/wcusb.c | 1489 -- zaptel/kernel/wcusb.h | 154 - zaptel/kernel/xpp/.version | 1 - zaptel/kernel/xpp/Changelog_xpp | 340 - zaptel/kernel/xpp/Kbuild | 58 - zaptel/kernel/xpp/Makefile | 7 - zaptel/kernel/xpp/README.Astribank | 1374 -- zaptel/kernel/xpp/card_bri.c | 1506 -- zaptel/kernel/xpp/card_bri.h | 31 - zaptel/kernel/xpp/card_fxo.c | 1354 -- zaptel/kernel/xpp/card_fxo.h | 42 - zaptel/kernel/xpp/card_fxs.c | 1506 -- zaptel/kernel/xpp/card_fxs.h | 42 - zaptel/kernel/xpp/card_global.c | 851 - zaptel/kernel/xpp/card_global.h | 113 - zaptel/kernel/xpp/card_pri.c | 1845 -- zaptel/kernel/xpp/card_pri.h | 32 - zaptel/kernel/xpp/firmwares/FPGA_1141.hex | 650 - zaptel/kernel/xpp/firmwares/FPGA_1151.hex | 697 - zaptel/kernel/xpp/firmwares/FPGA_FXS.hex | 644 - zaptel/kernel/xpp/firmwares/LICENSE.firmware | 37 - zaptel/kernel/xpp/firmwares/README | 19 - zaptel/kernel/xpp/firmwares/USB_FW.hex | 223 - zaptel/kernel/xpp/init_card_1_30 | 535 - zaptel/kernel/xpp/init_card_2_30 | 426 - zaptel/kernel/xpp/init_card_3_30 | 432 - zaptel/kernel/xpp/init_card_4_30 | 387 - zaptel/kernel/xpp/param_doc | 40 - zaptel/kernel/xpp/parport_debug.c | 113 - zaptel/kernel/xpp/parport_debug.h | 31 - zaptel/kernel/xpp/utils/Makefile | 144 - zaptel/kernel/xpp/utils/astribank_hook | 57 - .../kernel/xpp/utils/example_default_zaptel | 31 - zaptel/kernel/xpp/utils/fpga_load.8 | 86 - zaptel/kernel/xpp/utils/fpga_load.c | 1011 - zaptel/kernel/xpp/utils/genzaptelconf | 1198 -- zaptel/kernel/xpp/utils/genzaptelconf.8 | 326 - zaptel/kernel/xpp/utils/hexfile.c | 567 - zaptel/kernel/xpp/utils/hexfile.h | 123 - zaptel/kernel/xpp/utils/lszaptel | 110 - zaptel/kernel/xpp/utils/print_modes.c | 33 - zaptel/kernel/xpp/utils/test_parse.c | 35 - zaptel/kernel/xpp/utils/xpp.rules | 14 - zaptel/kernel/xpp/utils/xpp_blink | 168 - zaptel/kernel/xpp/utils/xpp_fxloader | 292 - zaptel/kernel/xpp/utils/xpp_fxloader.usermap | 10 - zaptel/kernel/xpp/utils/xpp_modprobe | 10 - zaptel/kernel/xpp/utils/xpp_sync | 226 - zaptel/kernel/xpp/utils/xpp_timing | 6 - zaptel/kernel/xpp/utils/zapconf | 603 - zaptel/kernel/xpp/utils/zaptel-helper | 401 - zaptel/kernel/xpp/utils/zaptel_drivers | 9 - zaptel/kernel/xpp/utils/zaptel_hardware | 164 - zaptel/kernel/xpp/utils/zconf/Zaptel.pm | 68 - zaptel/kernel/xpp/utils/zconf/Zaptel/Chans.pm | 255 - .../xpp/utils/zconf/Zaptel/Config/Defaults.pm | 56 - .../kernel/xpp/utils/zconf/Zaptel/Hardware.pm | 168 - .../xpp/utils/zconf/Zaptel/Hardware/PCI.pm | 211 - .../xpp/utils/zconf/Zaptel/Hardware/USB.pm | 116 - zaptel/kernel/xpp/utils/zconf/Zaptel/Span.pm | 300 - zaptel/kernel/xpp/utils/zconf/Zaptel/Utils.pm | 52 - zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp.pm | 199 - .../kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm | 95 - .../kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm | 118 - .../kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm | 123 - zaptel/kernel/xpp/utils/zt_registration | 125 - zaptel/kernel/xpp/xbus-core.c | 1708 -- zaptel/kernel/xpp/xbus-core.h | 305 - zaptel/kernel/xpp/xbus-pcm.c | 1312 -- zaptel/kernel/xpp/xbus-pcm.h | 134 - zaptel/kernel/xpp/xbus-sysfs.c | 427 - zaptel/kernel/xpp/xdefs.h | 138 - zaptel/kernel/xpp/xframe_queue.c | 278 - zaptel/kernel/xpp/xframe_queue.h | 34 - zaptel/kernel/xpp/xpd.h | 231 - zaptel/kernel/xpp/xpp_log.h | 52 - zaptel/kernel/xpp/xpp_usb.c | 1107 - zaptel/kernel/xpp/xpp_zap.c | 1091 - zaptel/kernel/xpp/xpp_zap.h | 53 - zaptel/kernel/xpp/xproto.c | 478 - zaptel/kernel/xpp/xproto.h | 292 - zaptel/kernel/xpp/zap_debug.c | 91 - zaptel/kernel/xpp/zap_debug.h | 201 - zaptel/kernel/zaptel-base.c | 7839 ------- zaptel/kernel/zaptel.h | 2139 -- zaptel/kernel/zconfig.h | 210 - zaptel/kernel/ztd-eth.c | 450 - zaptel/kernel/ztd-loc.c | 280 - zaptel/kernel/ztdummy.c | 441 - zaptel/kernel/ztdummy.h | 150 - zaptel/kernel/ztdynamic.c | 875 - zaptel/kernel/zttranscode.c | 464 - zaptel/live_zap | 200 - zaptel/makeopts.in | 47 - zaptel/menuselect.makedeps | 8 - zaptel/menuselect.makeopts | 4 - zaptel/menuselect/Makefile | 78 - zaptel/menuselect/README | 159 - zaptel/menuselect/acinclude.m4 | 177 - zaptel/menuselect/aclocal.m4 | 14 - zaptel/menuselect/autoconfig.h.in | 96 - zaptel/menuselect/bootstrap.sh | 41 - zaptel/menuselect/config.guess | 1495 -- zaptel/menuselect/config.sub | 1609 -- zaptel/menuselect/configure | 5283 ----- zaptel/menuselect/configure.ac | 74 - zaptel/menuselect/example_menuselect-tree | 500 - zaptel/menuselect/install-sh | 323 - zaptel/menuselect/linkedlists.h | 370 - zaptel/menuselect/make_version | 56 - zaptel/menuselect/makeopts.in | 18 - zaptel/menuselect/menuselect.c | 1282 -- zaptel/menuselect/menuselect.h | 150 - zaptel/menuselect/menuselect_curses.c | 867 - zaptel/menuselect/menuselect_gtk.c | 351 - zaptel/menuselect/menuselect_stub.c | 39 - zaptel/menuselect/missing | 360 - zaptel/menuselect/mxml/ANNOUNCEMENT | 5 - zaptel/menuselect/mxml/CHANGES | 213 - zaptel/menuselect/mxml/COPYING | 482 - zaptel/menuselect/mxml/Makefile.in | 353 - zaptel/menuselect/mxml/README | 204 - zaptel/menuselect/mxml/config.h.in | 69 - zaptel/menuselect/mxml/configure | 4620 ---- zaptel/menuselect/mxml/install-sh | 251 - zaptel/menuselect/mxml/mxml-attr.c | 181 - zaptel/menuselect/mxml/mxml-entity.c | 472 - zaptel/menuselect/mxml/mxml-file.c | 2843 --- zaptel/menuselect/mxml/mxml-index.c | 649 - zaptel/menuselect/mxml/mxml-node.c | 664 - zaptel/menuselect/mxml/mxml-private.c | 128 - zaptel/menuselect/mxml/mxml-search.c | 199 - zaptel/menuselect/mxml/mxml-set.c | 257 - zaptel/menuselect/mxml/mxml-string.c | 377 - zaptel/menuselect/mxml/mxml.h | 254 - zaptel/menuselect/mxml/mxml.list.in | 114 - zaptel/menuselect/mxml/mxml.pc | 10 - zaptel/menuselect/mxml/mxml.pc.in | 10 - zaptel/menuselect/strcompat.c | 344 - zaptel/mkfilter.h | 62 - zaptel/mknotch.cc | 145 - zaptel/orig.ee | Bin 172 -> 0 bytes zaptel/patgen.c | 111 - zaptel/patlooptest.c | 137 - zaptel/pattest.c | 117 - zaptel/ppp/Makefile | 29 - zaptel/ppp/zaptel.c | 293 - zaptel/sethdlc-new.c | 702 - zaptel/sethdlc.c | 400 - zaptel/timertest.c | 67 - zaptel/tonezone.c | 518 - zaptel/tonezone.h | 92 - zaptel/tor2.ee | Bin 172 -> 0 bytes zaptel/torisatool.c | 65 - zaptel/tormenta2.ucf | 194 - zaptel/tormenta2.vhd | 657 - zaptel/usbfxstest.c | 99 - zaptel/zaptel.conf.sample | 291 - zaptel/zaptel.init | 260 - zaptel/zaptel.sysconfig | 69 - zaptel/zaptel.xml | 68 - zaptel/zonedata.c | 938 - zaptel/ztcfg-dude.c | 863 - zaptel/ztcfg.c | 1487 -- zaptel/ztcfg.h | 27 - zaptel/ztdiag.c | 44 - zaptel/ztmonitor.c | 650 - zaptel/ztscan.c | 171 - zaptel/ztspeed.c | 49 - zaptel/zttest.c | 148 - zaptel/zttool.c | 586 - 411 files changed, 38 insertions(+), 239734 deletions(-) delete mode 100755 getsrc delete mode 100644 zaptel/.version delete mode 100644 zaptel/ChangeLog delete mode 100644 zaptel/LICENSE delete mode 100644 zaptel/LICENSE.LGPL delete mode 100644 zaptel/Makefile delete mode 100644 zaptel/README delete mode 100644 zaptel/README.Astribank delete mode 100644 zaptel/README.b410p delete mode 100644 zaptel/README.fxotune delete mode 100644 zaptel/README.fxsusb delete mode 100644 zaptel/README.hpec delete mode 100644 zaptel/acinclude.m4 delete mode 100644 zaptel/aclocal.m4 delete mode 100644 zaptel/bittest.h delete mode 100755 zaptel/bootstrap.sh delete mode 100755 zaptel/build_tools/builder delete mode 100755 zaptel/build_tools/genmodconf delete mode 100755 zaptel/build_tools/genudevrules delete mode 100755 zaptel/build_tools/make_firmware_object.in delete mode 100755 zaptel/build_tools/make_svn_branch_name delete mode 100755 zaptel/build_tools/make_tree delete mode 100755 zaptel/build_tools/make_version delete mode 100755 zaptel/build_tools/make_version_h delete mode 100644 zaptel/build_tools/menuselect-deps.in delete mode 100755 zaptel/build_tools/test_kernel_git delete mode 100755 zaptel/build_tools/uninstall-modules delete mode 100755 zaptel/build_tools/zaptel_svn_tarball delete mode 100755 zaptel/checkstack delete mode 100644 zaptel/complex.cc delete mode 100644 zaptel/complex.h delete mode 100755 zaptel/config.guess delete mode 100755 zaptel/config.sub delete mode 100755 zaptel/configure delete mode 100644 zaptel/configure.ac delete mode 100644 zaptel/doc/fxotune.8 delete mode 100644 zaptel/doc/fxstest.8 delete mode 100644 zaptel/doc/module-parameters.txt delete mode 100644 zaptel/doc/patgen.8 delete mode 100644 zaptel/doc/pattest.8 delete mode 100644 zaptel/doc/torisatool.8 delete mode 100644 zaptel/doc/ztcfg.8 delete mode 100644 zaptel/doc/ztdiag.8 delete mode 100644 zaptel/doc/ztmonitor.8 delete mode 100644 zaptel/doc/ztscan.8 delete mode 100644 zaptel/doc/ztspeed.8 delete mode 100644 zaptel/doc/zttest.8 delete mode 100644 zaptel/doc/zttool.8 delete mode 100644 zaptel/firmware/Makefile delete mode 100644 zaptel/firmware/firmware.xml delete mode 100644 zaptel/fxotune.c delete mode 100644 zaptel/fxotune.h delete mode 100644 zaptel/fxstest.c delete mode 100644 zaptel/hdlcgen.c delete mode 100644 zaptel/hdlcstress.c delete mode 100644 zaptel/hdlctest.c delete mode 100644 zaptel/hdlcverify.c delete mode 100644 zaptel/ifcfg-hdlc0 delete mode 100644 zaptel/ifup-hdlc delete mode 100755 zaptel/install-sh delete mode 100755 zaptel/install_prereq delete mode 100644 zaptel/kernel/GNUmakefile delete mode 100644 zaptel/kernel/Kbuild delete mode 100644 zaptel/kernel/Makefile delete mode 100644 zaptel/kernel/adt_lec.c delete mode 100644 zaptel/kernel/adt_lec.h delete mode 100644 zaptel/kernel/arith.h delete mode 100644 zaptel/kernel/biquad.h delete mode 100644 zaptel/kernel/datamods/Makefile delete mode 100644 zaptel/kernel/datamods/hdlc_cisco.c delete mode 100644 zaptel/kernel/datamods/hdlc_fr.c delete mode 100644 zaptel/kernel/datamods/hdlc_generic.c delete mode 100644 zaptel/kernel/datamods/hdlc_ppp.c delete mode 100644 zaptel/kernel/datamods/hdlc_raw.c delete mode 100644 zaptel/kernel/datamods/hdlc_raw_eth.c delete mode 100644 zaptel/kernel/datamods/syncppp.c delete mode 100644 zaptel/kernel/digits.h delete mode 100644 zaptel/kernel/ecdis.h delete mode 100644 zaptel/kernel/fasthdlc.h delete mode 100644 zaptel/kernel/fir.h delete mode 100644 zaptel/kernel/fxo_modes.h delete mode 100644 zaptel/kernel/hpec/hpec.h delete mode 100644 zaptel/kernel/hpec/hpec_user.h delete mode 100644 zaptel/kernel/hpec/hpec_zaptel.h delete mode 100644 zaptel/kernel/jpah.h delete mode 100644 zaptel/kernel/kb1ec.h delete mode 100644 zaptel/kernel/kb1ec_const.h delete mode 100644 zaptel/kernel/makefw.c delete mode 100644 zaptel/kernel/mg2ec.h delete mode 100644 zaptel/kernel/mg2ec_const.h delete mode 100644 zaptel/kernel/oct612x/Makefile delete mode 100644 zaptel/kernel/oct612x/apilib/bt/octapi_bt0.c delete mode 100644 zaptel/kernel/oct612x/apilib/bt/octapi_bt0_private.h delete mode 100644 zaptel/kernel/oct612x/apilib/largmath/octapi_largmath.c delete mode 100644 zaptel/kernel/oct612x/apilib/llman/octapi_llman.c delete mode 100644 zaptel/kernel/oct612x/apilib/llman/octapi_llman_private.h delete mode 100755 zaptel/kernel/oct612x/get_discards delete mode 100644 zaptel/kernel/oct612x/include/apilib/octapi_bt0.h delete mode 100644 zaptel/kernel/oct612x/include/apilib/octapi_largmath.h delete mode 100644 zaptel/kernel/oct612x/include/apilib/octapi_llman.h delete mode 100644 zaptel/kernel/oct612x/include/digium_unused.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_api.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_api_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_apimi.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_apiud.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_defines.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_errors.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_events_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_events_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_tlv_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_inst.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_pub.h delete mode 100644 zaptel/kernel/oct612x/include/oct6100api/oct6100_tsst_inst.h delete mode 100644 zaptel/kernel/oct612x/include/octdef.h delete mode 100644 zaptel/kernel/oct612x/include/octmac.h delete mode 100644 zaptel/kernel/oct612x/include/octosdependant.h delete mode 100644 zaptel/kernel/oct612x/include/octrpc/oct6100_rpc_protocol.h delete mode 100644 zaptel/kernel/oct612x/include/octrpc/rpc_protocol.h delete mode 100644 zaptel/kernel/oct612x/include/octtype.h delete mode 100644 zaptel/kernel/oct612x/include/octtypevx.h delete mode 100644 zaptel/kernel/oct612x/include/octtypewin.h delete mode 100755 zaptel/kernel/oct612x/octasic-helper delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h delete mode 100644 zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_version.h delete mode 100644 zaptel/kernel/oct612x/test.c delete mode 100644 zaptel/kernel/pciradio.c delete mode 100644 zaptel/kernel/pciradio.rbt delete mode 100644 zaptel/kernel/proslic.h delete mode 100644 zaptel/kernel/sec-2.h delete mode 100644 zaptel/kernel/sec.h delete mode 100644 zaptel/kernel/tor2-hw.h delete mode 100644 zaptel/kernel/tor2.c delete mode 100644 zaptel/kernel/torisa.c delete mode 100644 zaptel/kernel/tormenta2.rbt delete mode 100644 zaptel/kernel/voicebus.c delete mode 100644 zaptel/kernel/voicebus.h delete mode 100644 zaptel/kernel/wcfxo.c delete mode 100644 zaptel/kernel/wct1xxp.c delete mode 100644 zaptel/kernel/wct4xxp/Kbuild delete mode 100644 zaptel/kernel/wct4xxp/Makefile delete mode 100644 zaptel/kernel/wct4xxp/base.c delete mode 100644 zaptel/kernel/wct4xxp/vpm450m.c delete mode 100644 zaptel/kernel/wct4xxp/vpm450m.h delete mode 100644 zaptel/kernel/wct4xxp/wct4xxp-diag.c delete mode 100644 zaptel/kernel/wct4xxp/wct4xxp.h delete mode 100644 zaptel/kernel/wctc4xxp/Kbuild delete mode 100644 zaptel/kernel/wctc4xxp/Makefile delete mode 100644 zaptel/kernel/wctc4xxp/base.c delete mode 100644 zaptel/kernel/wctdm.c delete mode 100644 zaptel/kernel/wctdm.h delete mode 100644 zaptel/kernel/wctdm24xxp/GpakApi.c delete mode 100644 zaptel/kernel/wctdm24xxp/GpakApi.h delete mode 100644 zaptel/kernel/wctdm24xxp/GpakCust.c delete mode 100644 zaptel/kernel/wctdm24xxp/GpakCust.h delete mode 100644 zaptel/kernel/wctdm24xxp/GpakHpi.h delete mode 100644 zaptel/kernel/wctdm24xxp/Kbuild delete mode 100644 zaptel/kernel/wctdm24xxp/Makefile delete mode 100644 zaptel/kernel/wctdm24xxp/base.c delete mode 100644 zaptel/kernel/wctdm24xxp/gpakErrs.h delete mode 100644 zaptel/kernel/wctdm24xxp/gpakenum.h delete mode 100644 zaptel/kernel/wctdm24xxp/voicebus.c delete mode 100644 zaptel/kernel/wctdm24xxp/wctdm24xxp.h delete mode 100644 zaptel/kernel/wcte11xp.c delete mode 100644 zaptel/kernel/wcte12xp/GpakApi.c delete mode 100644 zaptel/kernel/wcte12xp/GpakApi.h delete mode 100644 zaptel/kernel/wcte12xp/GpakErrs.h delete mode 100644 zaptel/kernel/wcte12xp/GpakHpi.h delete mode 100644 zaptel/kernel/wcte12xp/Kbuild delete mode 100644 zaptel/kernel/wcte12xp/Makefile delete mode 100644 zaptel/kernel/wcte12xp/base.c delete mode 100644 zaptel/kernel/wcte12xp/gpakenum.h delete mode 120000 zaptel/kernel/wcte12xp/voicebus.c delete mode 100644 zaptel/kernel/wcte12xp/vpmadt032.c delete mode 100644 zaptel/kernel/wcte12xp/vpmadt032.h delete mode 100644 zaptel/kernel/wcte12xp/wcte12xp.h delete mode 100644 zaptel/kernel/wcusb.c delete mode 100644 zaptel/kernel/wcusb.h delete mode 100644 zaptel/kernel/xpp/.version delete mode 100644 zaptel/kernel/xpp/Changelog_xpp delete mode 100644 zaptel/kernel/xpp/Kbuild delete mode 100644 zaptel/kernel/xpp/Makefile delete mode 100644 zaptel/kernel/xpp/README.Astribank delete mode 100644 zaptel/kernel/xpp/card_bri.c delete mode 100644 zaptel/kernel/xpp/card_bri.h delete mode 100644 zaptel/kernel/xpp/card_fxo.c delete mode 100644 zaptel/kernel/xpp/card_fxo.h delete mode 100644 zaptel/kernel/xpp/card_fxs.c delete mode 100644 zaptel/kernel/xpp/card_fxs.h delete mode 100644 zaptel/kernel/xpp/card_global.c delete mode 100644 zaptel/kernel/xpp/card_global.h delete mode 100644 zaptel/kernel/xpp/card_pri.c delete mode 100644 zaptel/kernel/xpp/card_pri.h delete mode 100644 zaptel/kernel/xpp/firmwares/FPGA_1141.hex delete mode 100644 zaptel/kernel/xpp/firmwares/FPGA_1151.hex delete mode 100644 zaptel/kernel/xpp/firmwares/FPGA_FXS.hex delete mode 100644 zaptel/kernel/xpp/firmwares/LICENSE.firmware delete mode 100644 zaptel/kernel/xpp/firmwares/README delete mode 100644 zaptel/kernel/xpp/firmwares/USB_FW.hex delete mode 100755 zaptel/kernel/xpp/init_card_1_30 delete mode 100755 zaptel/kernel/xpp/init_card_2_30 delete mode 100755 zaptel/kernel/xpp/init_card_3_30 delete mode 100755 zaptel/kernel/xpp/init_card_4_30 delete mode 100755 zaptel/kernel/xpp/param_doc delete mode 100644 zaptel/kernel/xpp/parport_debug.c delete mode 100644 zaptel/kernel/xpp/parport_debug.h delete mode 100644 zaptel/kernel/xpp/utils/Makefile delete mode 100755 zaptel/kernel/xpp/utils/astribank_hook delete mode 100644 zaptel/kernel/xpp/utils/example_default_zaptel delete mode 100644 zaptel/kernel/xpp/utils/fpga_load.8 delete mode 100644 zaptel/kernel/xpp/utils/fpga_load.c delete mode 100755 zaptel/kernel/xpp/utils/genzaptelconf delete mode 100644 zaptel/kernel/xpp/utils/genzaptelconf.8 delete mode 100644 zaptel/kernel/xpp/utils/hexfile.c delete mode 100644 zaptel/kernel/xpp/utils/hexfile.h delete mode 100755 zaptel/kernel/xpp/utils/lszaptel delete mode 100644 zaptel/kernel/xpp/utils/print_modes.c delete mode 100644 zaptel/kernel/xpp/utils/test_parse.c delete mode 100644 zaptel/kernel/xpp/utils/xpp.rules delete mode 100755 zaptel/kernel/xpp/utils/xpp_blink delete mode 100755 zaptel/kernel/xpp/utils/xpp_fxloader delete mode 100644 zaptel/kernel/xpp/utils/xpp_fxloader.usermap delete mode 100644 zaptel/kernel/xpp/utils/xpp_modprobe delete mode 100755 zaptel/kernel/xpp/utils/xpp_sync delete mode 100755 zaptel/kernel/xpp/utils/xpp_timing delete mode 100755 zaptel/kernel/xpp/utils/zapconf delete mode 100644 zaptel/kernel/xpp/utils/zaptel-helper delete mode 100755 zaptel/kernel/xpp/utils/zaptel_drivers delete mode 100755 zaptel/kernel/xpp/utils/zaptel_hardware delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Chans.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/USB.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Span.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Utils.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm delete mode 100644 zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm delete mode 100755 zaptel/kernel/xpp/utils/zt_registration delete mode 100644 zaptel/kernel/xpp/xbus-core.c delete mode 100644 zaptel/kernel/xpp/xbus-core.h delete mode 100644 zaptel/kernel/xpp/xbus-pcm.c delete mode 100644 zaptel/kernel/xpp/xbus-pcm.h delete mode 100644 zaptel/kernel/xpp/xbus-sysfs.c delete mode 100644 zaptel/kernel/xpp/xdefs.h delete mode 100644 zaptel/kernel/xpp/xframe_queue.c delete mode 100644 zaptel/kernel/xpp/xframe_queue.h delete mode 100644 zaptel/kernel/xpp/xpd.h delete mode 100644 zaptel/kernel/xpp/xpp_log.h delete mode 100644 zaptel/kernel/xpp/xpp_usb.c delete mode 100644 zaptel/kernel/xpp/xpp_zap.c delete mode 100644 zaptel/kernel/xpp/xpp_zap.h delete mode 100644 zaptel/kernel/xpp/xproto.c delete mode 100644 zaptel/kernel/xpp/xproto.h delete mode 100644 zaptel/kernel/xpp/zap_debug.c delete mode 100644 zaptel/kernel/xpp/zap_debug.h delete mode 100644 zaptel/kernel/zaptel-base.c delete mode 100644 zaptel/kernel/zaptel.h delete mode 100644 zaptel/kernel/zconfig.h delete mode 100644 zaptel/kernel/ztd-eth.c delete mode 100644 zaptel/kernel/ztd-loc.c delete mode 100644 zaptel/kernel/ztdummy.c delete mode 100644 zaptel/kernel/ztdummy.h delete mode 100644 zaptel/kernel/ztdynamic.c delete mode 100644 zaptel/kernel/zttranscode.c delete mode 100755 zaptel/live_zap delete mode 100644 zaptel/makeopts.in delete mode 100644 zaptel/menuselect.makedeps delete mode 100644 zaptel/menuselect.makeopts delete mode 100644 zaptel/menuselect/Makefile delete mode 100644 zaptel/menuselect/README delete mode 100644 zaptel/menuselect/acinclude.m4 delete mode 100644 zaptel/menuselect/aclocal.m4 delete mode 100644 zaptel/menuselect/autoconfig.h.in delete mode 100755 zaptel/menuselect/bootstrap.sh delete mode 100755 zaptel/menuselect/config.guess delete mode 100755 zaptel/menuselect/config.sub delete mode 100755 zaptel/menuselect/configure delete mode 100644 zaptel/menuselect/configure.ac delete mode 100644 zaptel/menuselect/example_menuselect-tree delete mode 100755 zaptel/menuselect/install-sh delete mode 100644 zaptel/menuselect/linkedlists.h delete mode 100755 zaptel/menuselect/make_version delete mode 100644 zaptel/menuselect/makeopts.in delete mode 100644 zaptel/menuselect/menuselect.c delete mode 100644 zaptel/menuselect/menuselect.h delete mode 100644 zaptel/menuselect/menuselect_curses.c delete mode 100644 zaptel/menuselect/menuselect_gtk.c delete mode 100644 zaptel/menuselect/menuselect_stub.c delete mode 100755 zaptel/menuselect/missing delete mode 100644 zaptel/menuselect/mxml/ANNOUNCEMENT delete mode 100644 zaptel/menuselect/mxml/CHANGES delete mode 100644 zaptel/menuselect/mxml/COPYING delete mode 100644 zaptel/menuselect/mxml/Makefile.in delete mode 100644 zaptel/menuselect/mxml/README delete mode 100644 zaptel/menuselect/mxml/config.h.in delete mode 100755 zaptel/menuselect/mxml/configure delete mode 100755 zaptel/menuselect/mxml/install-sh delete mode 100644 zaptel/menuselect/mxml/mxml-attr.c delete mode 100644 zaptel/menuselect/mxml/mxml-entity.c delete mode 100644 zaptel/menuselect/mxml/mxml-file.c delete mode 100644 zaptel/menuselect/mxml/mxml-index.c delete mode 100644 zaptel/menuselect/mxml/mxml-node.c delete mode 100644 zaptel/menuselect/mxml/mxml-private.c delete mode 100644 zaptel/menuselect/mxml/mxml-search.c delete mode 100644 zaptel/menuselect/mxml/mxml-set.c delete mode 100644 zaptel/menuselect/mxml/mxml-string.c delete mode 100644 zaptel/menuselect/mxml/mxml.h delete mode 100644 zaptel/menuselect/mxml/mxml.list.in delete mode 100644 zaptel/menuselect/mxml/mxml.pc delete mode 100644 zaptel/menuselect/mxml/mxml.pc.in delete mode 100644 zaptel/menuselect/strcompat.c delete mode 100644 zaptel/mkfilter.h delete mode 100644 zaptel/mknotch.cc delete mode 100644 zaptel/orig.ee delete mode 100644 zaptel/patgen.c delete mode 100644 zaptel/patlooptest.c delete mode 100644 zaptel/pattest.c delete mode 100644 zaptel/ppp/Makefile delete mode 100644 zaptel/ppp/zaptel.c delete mode 100644 zaptel/sethdlc-new.c delete mode 100644 zaptel/sethdlc.c delete mode 100644 zaptel/timertest.c delete mode 100644 zaptel/tonezone.c delete mode 100644 zaptel/tonezone.h delete mode 100644 zaptel/tor2.ee delete mode 100644 zaptel/torisatool.c delete mode 100644 zaptel/tormenta2.ucf delete mode 100644 zaptel/tormenta2.vhd delete mode 100644 zaptel/usbfxstest.c delete mode 100644 zaptel/zaptel.conf.sample delete mode 100644 zaptel/zaptel.init delete mode 100644 zaptel/zaptel.sysconfig delete mode 100644 zaptel/zaptel.xml delete mode 100644 zaptel/zonedata.c delete mode 100644 zaptel/ztcfg-dude.c delete mode 100644 zaptel/ztcfg.c delete mode 100644 zaptel/ztcfg.h delete mode 100644 zaptel/ztdiag.c delete mode 100644 zaptel/ztmonitor.c delete mode 100644 zaptel/ztscan.c delete mode 100644 zaptel/ztspeed.c delete mode 100644 zaptel/zttest.c delete mode 100644 zaptel/zttool.c diff --git a/asterisk/configure b/asterisk/configure index fa927ff5..385caa14 100755 --- a/asterisk/configure +++ b/asterisk/configure @@ -27854,9 +27854,9 @@ if test "${USE_OPENSSL}" != "no"; then pbxlibdir="-L${OPENSSL_DIR}" fi fi - { echo "$as_me:$LINENO: checking for ssl2_connect in -lssl" >&5 -echo $ECHO_N "checking for ssl2_connect in -lssl... $ECHO_C" >&6; } -if test "${ac_cv_lib_ssl_ssl2_connect+set}" = set; then + { echo "$as_me:$LINENO: checking for SSL_connect in -lssl" >&5 +echo $ECHO_N "checking for SSL_connect in -lssl... $ECHO_C" >&6; } +if test "${ac_cv_lib_ssl_SSL_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -27874,11 +27874,11 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char ssl2_connect (); +char SSL_connect (); int main () { -return ssl2_connect (); +return SSL_connect (); ; return 0; } @@ -27901,21 +27901,21 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_ssl_ssl2_connect=yes + ac_cv_lib_ssl_SSL_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_ssl_ssl2_connect=no + ac_cv_lib_ssl_SSL_connect=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_ssl2_connect" >&5 -echo "${ECHO_T}$ac_cv_lib_ssl_ssl2_connect" >&6; } -if test $ac_cv_lib_ssl_ssl2_connect = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_ssl_SSL_connect" >&6; } +if test $ac_cv_lib_ssl_SSL_connect = yes; then AST_OPENSSL_FOUND=yes else AST_OPENSSL_FOUND=no diff --git a/asterisk/configure.ac b/asterisk/configure.ac index 4c88623e..0d9d0b15 100644 --- a/asterisk/configure.ac +++ b/asterisk/configure.ac @@ -1319,7 +1319,7 @@ AC_SUBST(PBX_SPEEX_PREPROCESS) AST_EXT_LIB_CHECK([SQLITE], [sqlite], [sqlite_exec], [sqlite.h]) -AST_EXT_LIB_CHECK([OPENSSL], [ssl], [ssl2_connect], [openssl/ssl.h], [-lcrypto]) +AST_EXT_LIB_CHECK([OPENSSL], [ssl], [SSL_connect], [openssl/ssl.h], [-lcrypto]) if test "$PBX_OPENSSL" = "1"; then AST_EXT_LIB_CHECK([OSPTK], [osptk], [OSPPCryptoDecrypt], [osp/osp.h], [-lcrypto -lssl]) diff --git a/asterisk/contrib/init.d/rc.debian.asterisk b/asterisk/contrib/init.d/rc.debian.asterisk index 5dc35b66..b3337ea9 100755 --- a/asterisk/contrib/init.d/rc.debian.asterisk +++ b/asterisk/contrib/init.d/rc.debian.asterisk @@ -1,4 +1,27 @@ -#! /bin/sh +#!/bin/sh +# +# asterisk start the asterisk PBX +# (c) Mark Purcell +# (c) Tzafrir Cohen +# (c) Faidon Liambotis +# +# This package is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +### BEGIN INIT INFO +# Provides: asterisk +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# Should-Start: $syslog $network $named mysql postgresql dahdi +# Should-Stop: $syslog $network $named mysql postgresql +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Asterisk PBX +# Description: Controls the Asterisk PBX +### END INIT INFO + # $Id: rc.debian.asterisk 119318 2008-05-30 18:19:26Z root $ # # Mon Jun 04 2007 Iñaki Baz Castillo diff --git a/asterisk/menuselect.makeopts b/asterisk/menuselect.makeopts index c02db083..e5749cf7 100644 --- a/asterisk/menuselect.makeopts +++ b/asterisk/menuselect.makeopts @@ -7,11 +7,11 @@ MENUSELECT_FUNCS=func_curl func_odbc MENUSELECT_PBX=pbx_gtkconsole MENUSELECT_RES=res_config_odbc res_config_pgsql res_jabber res_odbc res_snmp MENUSELECT_OPTS_app_voicemail= -MENUSELECT_CFLAGS=RADIO_RELAX LOADABLE_MODULES +MENUSELECT_CFLAGS=LOADABLE_MODULES MENUSELECT_EMBED= -MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-GSM +MENUSELECT_CORE_SOUNDS=CORE-SOUNDS-EN-ULAW MENUSELECT_MOH= -MENUSELECT_EXTRA_SOUNDS=EXTRA-SOUNDS-EN-GSM +MENUSELECT_EXTRA_SOUNDS=EXTRA-SOUNDS-EN-ULAW MENUSELECT_BUILD_DEPS=res_adsi chan_local res_indications app_meetme res_monitor res_smdi res_features MENUSELECT_DEPSFAILED=MENUSELECT_APPS=app_osplookup MENUSELECT_DEPSFAILED=MENUSELECT_CDR=cdr_odbc diff --git a/getsrc b/getsrc deleted file mode 100755 index b346f09a..00000000 --- a/getsrc +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -. /etc/sysinfo -ASTSRC=astsrc-vers-${LLVERS}.tar.gz - -umount /mnt/cf 2>/dev/null >/dev/null -mount /mnt/cf -if [ -f /mnt/cf/astsrc.tgz ] # if local copy exists, use it. -then - echo Unpacking local copy /mnt/cf/astsrc.tgz... - tar xzf /mnt/cf/astsrc.tgz || exit 1 -else - echo Fetching a copy of ${ASTSRC}... - wget http://limeylinux.org/downloads/${ASTSRC} || exit 1 - echo Unpacking ${ASTSRC}... - tar xzf ${ASTSRC} || exit 1 - rm ${ASTSRC} -fi -umount /mnt/cf - diff --git a/zaptel/.version b/zaptel/.version deleted file mode 100644 index 3a745bff..00000000 --- a/zaptel/.version +++ /dev/null @@ -1 +0,0 @@ -1.4.12.1RPT_A diff --git a/zaptel/ChangeLog b/zaptel/ChangeLog deleted file mode 100644 index 01b09cd6..00000000 --- a/zaptel/ChangeLog +++ /dev/null @@ -1,4249 +0,0 @@ -2008-09-09 Russell Bryant - - * Zaptel 1.4.12.1 released - -2008-09-09 18:24 +0000 [r4523-4534] Tzafrir Cohen - - * /, kernel/xpp/utils/zconf/Zaptel.pm: Zaptel.pm: Fix sample - program (perldoc-only fix). Merged revisions 4533 via svnmerge - from http://svn.digium.com/svn/zaptel/branches/1.2 - - * /, kernel/xpp/card_global.c, kernel/xpp/init_card_1_30, - kernel/xpp/init_card_2_30, kernel/xpp/init_card_3_30: xpp-zaptel: - Bugfix: Display data_high in /proc/xpp/*/chipregs: * This byte - wasn't shown even if do_datah bit was set. * Also converged all - terminology to "sub-register" and not "indirect" * Changed - accordingly '[WR]I' to [WR]S' in code. * Still allow usage of - '[WR]I' but with deprecation NOTICE() * Convert init_card_* - scripts * Adapt show_regs and write_regs script accordingly. * - Leave FXS internal macros with ...INDIRECT... because that's the - terminology of the SLIC. * You should use both the newer driver - and init script. Specifically: newer init script will fail to - work with older BRI and FXS xpp driver loaded. From xpp rev. - 6117. Merged revisions 4520 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * kernel/xpp/card_fxo.c, /: xpp-zaptel: FXO: Add caller-id - workaround for ESTI-DTMF (for #9096) * Also rename the - CID_STYLE_* constants to formal names. From Xorcom Rev. 6115. - Merged revisions 4519 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * /, kernel/xpp/init_card_2_30: xpp-zaptel: FXO: fix init_card_2_30 - opermode verification * In case of any diff, exit with non-zero - status so the build fails. * Print filename:lineno of missing or - changed lines. * Fix two countries (typos fixed in COLOMBIA and - CYPRUS). * xpp-zaptel: FXO: cleanup opermode verification code - (from DAHDI): - Add proper '-v' option to init_card_2_30 and use - it in xortel/Makefile - Use $mismatches as in DAHDI (minimize - diffs). From xpp rev. 6107,6108 Merged revisions 4517-4518 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * /, kernel/xpp/utils/fpga_load.c: Fix another path to an - uninitialized SUB config provided to us from the controller. From - xpp rev. 6071. Merged revisions 4516 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-09-08 23:32 +0000 [r4515] Jason Parker - - * Makefile: Disable building some modules on kernels 2.6.8 and - older. (closes issue #11523) Reported by: tzafrir Tested by: - tzafrir, qwell Initial patch by: kpfleming - -2008-09-08 20:40 +0000 [r4514] Tzafrir Cohen - - * kernel/xpp/utils/zconf/Zaptel/Chans.pm, /: Minor FXS/FXO type - fixes in case probe was not done. Merged revisions 4512 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-09-08 20:34 +0000 [r4513] Jason Parker - - * firmware/Makefile: Fix hotplug-install when firmware is disabled - from menuselect. Closes issue #13399 - -2008-09-03 18:52 +0000 [r4511] Tzafrir Cohen - - * /, kernel/zaptel-base.c: Before creating a device, register the - major number. Otherwise we need to clean-up those devices in case - of failure, and we don't. This fixes the case of accidentally - loading zaptel after loading dahdi (Already fixed in DAHDI). - Merged revisions 4509 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-08-25 14:53 +0000 [r4506] Shaun Ruffell - - * kernel/wctc4xxp/base.c: Remove this warning, which could occur if - the driver is loaded on a system without a wctc4xxp, and then - subsequently unloaded. - -2008-08-22 13:48 +0000 [r4504] Tzafrir Cohen - - * live_zap, README: Fix init scripts loading in xpp from live_zap - and update README * Set initdir to the directory on the live - system for xpp. * set FIRMWARE_DIR to allow running xpp_fxloader - from 'live_zap exec'. * Update README. - -2008-08-21 07:53 +0000 [r4503] Tzafrir Cohen - - * build_tools/test_kernel_git: Fix reporting of the zaptel version - number in test_kernel_git. - -2008-08-20 21:30 +0000 [r4497] Kevin P. Fleming - - * kernel/wctdm.c, kernel/wctdm24xxp/base.c, kernel/ztdynamic.c: - resolve some compile warnings (closes issue #13278) Reported by: - smurfix Patches: zap-string.patch uploaded by smurfix (license - 547) - -2008-08-20 Kevin P. Fleming - - * Zaptel 1.4.12 released - -2008-08-20 21:30 +0000 [r4496-4497] Kevin P. Fleming - - * kernel/wctdm.c, kernel/wctdm24xxp/base.c, kernel/ztdynamic.c: - resolve some compile warnings (closes issue #13278) Reported by: - smurfix Patches: zap-string.patch uploaded by smurfix (license - 547) - - * kernel/wctdm24xxp/wctdm24xxp.h, kernel/wcte12xp/vpmadt032.c, - kernel/wctdm24xxp/base.c, kernel/wctdm24xxp/GpakApi.c, - kernel/wctdm24xxp/GpakCust.c, kernel/xpp/xpd.h, - kernel/zaptel-base.c: improve compatibility with 2.6.26 and - 2.6.27 kernels (closes issue #13277) Reported by: smurfix - Patches: zap-dev.patch uploaded by smurfix (license 547) - zap-sema.patch uploaded by smurfix (license 547) - -2008-08-20 19:31 +0000 [r4495] Shaun Ruffell - - * kernel/wctc4xxp/base.c: Change to support both 5.3kbps and - 6.3kbps bit rates when using the G723.1 codec. - -2008-08-20 16:58 +0000 [r4494] Tzafrir Cohen - - * kernel/xpp/utils/xpp_fxloader: Mark xpp_fxloader as executable. - -2008-08-19 20:45 +0000 [r4493] Kevin P. Fleming - - * firmware/Makefile: even more improvements in firmware Makefile - -2008-08-19 20:24 +0000 [r4491-4492] Shaun Ruffell - - * kernel/wctc4xxp/base.c: Fix bug where all transcoders are named - tc400b0. - - * kernel/zttranscode.c, kernel/zaptel.h: Couple of fixes for the - transcoder: - In dahdi_transcode.c, Embed the identifiation - number, assigned sequentially when the transcoders are - registered, in the transcoder structure. This allows - DAHDI_TC_GETINFO to work as expected even though the transcoders - are rotated on the list in order to spread the load. - In - wctc4xxp, fix bug where all transcoders are named tc400b0. - -2008-08-19 20:11 +0000 [r4490] Kevin P. Fleming - - * firmware/Makefile: simplify this Makefile a bit by always - creating /usr/lib/hotplug/firmware and /lib/firmware in - $(DESTDIR) if hotplug firmware is being installed work around a - GNU make buglet that caused some target rules not to match - -2008-08-17 17:08 +0000 [r4489] Tzafrir Cohen - - * kernel/xpp/utils/zconf/Zaptel/Chans.pm, /: Zaptel-perl: fix - leftovers from r4475 (handling of spaces) While r4476 solved some - parsing problems of channels with "strange" encoding names, it - introduced a new problem (e.g.: "RED" after "(In use)" which is - fixed here. Merged revisions 4488 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-08-14 21:00 +0000 [r4485-4487] Tzafrir Cohen - - * kernel/xpp/.version, /, kernel/xpp/Changelog_xpp: Update - changelog for xpp rev. 6055. Merged revisions 4486 via svnmerge - from http://svn.digium.com/svn/zaptel/branches/1.2 - - * kernel/xpp/card_fxo.c, /: xpp: FXO: display signed voltage values - (from xpp r6055) This is only an issue with the displayed value. - In case you wondered why you have battery voltage of more than - 220V. Merged revisions 4484 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-08-14 01:57 +0000 [r4481-4483] Kevin P. Fleming - - * kernel/wctc4xxp/Kbuild, kernel/wctc4xxp/base.c, - kernel/wctc4xxp/codec_test.c (removed), kernel/wctc4xxp/Makefile, - kernel/zttranscode.c, kernel/zaptel.h, kernel/zaptel-base.c: - backport new transcoder interface and driver from DAHDI - - * kernel/ztdummy.c, ztcfg-dude.c, kernel/wct1xxp.c, ppp/zaptel.c, - kernel/ztd-eth.c, hdlcverify.c, fxstest.c, tonezone.c, - kernel/wcusb.c, kernel/wcte12xp/base.c, kernel/wct4xxp/vpm450m.c, - hdlctest.c, kernel/pciradio.c, kernel/wct4xxp/base.c, - kernel/wcte12xp/vpmadt032.c, sethdlc-new.c, - kernel/wctc4xxp/base.c, kernel/wctdm24xxp/base.c, hdlcstress.c, - kernel/wctdm24xxp/GpakApi.c, kernel/wctc4xxp/codec_test.c, - timertest.c, kernel/torisa.c, kernel/ztdynamic.c, pattest.c, - sethdlc.c, fxotune.c, kernel/makefw.c, zttool.c, - kernel/ztd-loc.c, kernel/wcte11xp.c, zttest.c, kernel/wctdm.c, - kernel/voicebus.c, torisatool.c, ztscan.c, hdlcgen.c, zonedata.c, - ztmonitor.c, kernel/tor2.c, kernel/wcfxo.c, - kernel/wcte12xp/GpakApi.c, usbfxstest.c, kernel/adt_lec.c, - ztcfg.c, patgen.c, patlooptest.c, ztspeed.c, - kernel/zttranscode.c, ztdiag.c, kernel/wct4xxp/wct4xxp-diag.c, - kernel/wctdm24xxp/GpakCust.c, kernel/zaptel-base.c: more license - header updates - - * kernel/wctdm24xxp/GpakCust.h, kernel/arith.h, - kernel/wctdm24xxp/wctdm24xxp.h, kernel/ztdummy.h, - kernel/hpec/hpec_zaptel.h, tonezone.h, kernel/digits.h, - kernel/fxo_modes.h, kernel/wcusb.h, kernel/kb1ec.h, complex.h, - kernel/fasthdlc.h, kernel/wct4xxp/vpm450m.h, - kernel/wcte12xp/wcte12xp.h, kernel/wcte12xp/GpakErrs.h, - kernel/hpec/hpec_user.h, kernel/wcte12xp/vpmadt032.h, - kernel/hpec/hpec.h, bittest.h, kernel/zaptel.h, kernel/zconfig.h, - kernel/wctdm24xxp/GpakApi.h, kernel/tor2-hw.h, - kernel/mg2ec_const.h, kernel/wctdm24xxp/GpakHpi.h, fxotune.h, - LICENSE.LGPL (added), kernel/proslic.h, kernel/wctdm.h, - kernel/voicebus.h, kernel/jpah.h, kernel/wcte12xp/gpakenum.h, - README, kernel/wcte12xp/GpakApi.h, kernel/wctdm24xxp/gpakenum.h, - kernel/adt_lec.h, kernel/kb1ec_const.h, kernel/mg2ec.h, - mkfilter.h, kernel/wcte12xp/GpakHpi.h, - kernel/wctdm24xxp/gpakErrs.h, kernel/wct4xxp/wct4xxp.h: README - updates and license updates for header files - -2008-08-13 20:51 +0000 [r4479-4480] Doug Bailey - - * kernel/wctdm24xxp/wctdm24xxp.h, kernel/wctdm24xxp/base.c: clean - up a timing issue on debounce of neon mwi detect - - * kernel/wctdm24xxp/wctdm24xxp.h, kernel/wctdm24xxp/base.c: Port in - the NEON MWI detection from the AA50 into the wctdm24xxp driver - -2008-08-13 18:05 +0000 [r4478] Jason Parker - - * Makefile: Make sure we've run configure menuselect before trying - (and failing) to install firmware. - -2008-08-12 20:50 +0000 [r4477] Kevin P. Fleming - - * live_zap, Makefile, kernel/wctc4xxp/Kbuild, - kernel/wctc4xxp/Makefile, build_tools/genudevrules, - firmware/firmware.xml, firmware/Makefile, README, zaptel.xml, - kernel/wctc4xxp/base.c, kernel/wctc4xxp/codec_test.c, - kernel/zttranscode.c (added), kernel/xpp/utils/zaptel-helper, - kernel/wctc4xxp (added), kernel/zaptel.h, kernel/zaptel-base.c: - bring back the transcoder interface... it will be upgraded to the - new improved version here too - -2008-08-12 13:11 +0000 [r4472-4476] Tzafrir Cohen - - * kernel/xpp/utils/zconf/Zaptel/Chans.pm, /: Zaptel-perl: more - robust parsing of channel signalling types. Parse them from a - list rather thna fusing a regex of a "word". Merged revisions - 4475 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * kernel/xpp/card_pri.c, kernel/xpp/card_bri.c, - kernel/xpp/xbus-core.c, /, kernel/xpp/xbus-pcm.c: * pcmtx_chan - debugging parameter now refers to a zaptel channel number. * Do - initialize xsp. Closes issue #13276 . * xbus_core_shutdown can't - be __exit as it is used in initilization as well. Merged - revisions 4473 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * kernel/xpp/card_fxo.c, /: xpp: fxo: fix caller-id - CID_STYLE_PASS_ALWAYS. Merged revisions 4468 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-08-07 18:58 +0000 [r4469] Kevin P. Fleming - - * firmware/Makefile, live_zap, Makefile, README, zaptel.xml, - kernel/zttranscode.c (removed), kernel/xpp/utils/zaptel-helper, - kernel/wctc4xxp (removed), kernel/zaptel.h, - build_tools/genudevrules, firmware/firmware.xml, - kernel/zaptel-base.c: remove support for the Digium TC400 - transcoder card; the interace to this card has been completely - redesigned, and the new interface will only be present in DAHDI; - TC400 users will need to upgrade to DAHDI 2.0.0 to continue using - their transcoder cards - -2008-08-07 10:15 +0000 [r4461-4463] Tzafrir Cohen - - * kernel/xpp/card_pri.c, kernel/xpp/firmwares/FPGA_1151.hex, - kernel/xpp/xbus-core.c: xpp: preliminary CAS support. Uses newer - firmware (5975) for the 1151 alone. - - * kernel/xpp/card_global.c: xpp: reset a reserved protocol field. - - * kernel/xpp/card_fxs.c, kernel/xpp/xbus-pcm.c: xpp: debuggging - parameter pcmtx_chan now refers to a zap channel number. Also fix - a typo in card_fxs. - -2008-08-04 18:12 +0000 [r4456-4459] Tzafrir Cohen - - * kernel/xpp/calibrate_slics (removed), /, - kernel/xpp/utils/Makefile: Remove obsolete calibrate_slics. Clean - more in utils Makefile. Merged revisions 4458 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * kernel/xpp/xpp_zap.c, kernel/xpp/firmwares/FPGA_1141.hex, - kernel/xpp/utils/zconf/Zaptel/Chans.pm, - kernel/xpp/firmwares/FPGA_1151.hex, kernel/xpp/xframe_queue.c, /, - kernel/xpp/Kbuild, kernel/xpp/card_fxs.c, - kernel/xpp/utils/xpp_fxloader, kernel/xpp/utils/lszaptel, - kernel/xpp/firmwares/FPGA_FXS.hex, kernel/xpp/init_card_3_30, - kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm: Merged revisions - 4451-4455 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 ........ r4451 | - tzafrir | 2008-08-04 18:11:01 +0300 (Mon, 04 Aug 2008) | 9 lines - Firmware update: 5959 (DTMF and BRI ID) (From DAHDI rev. 4695) * - Fix some cases of double digits. * Fix some rare cases of a BRI - unit providing incorrect directionality. * Extra debugging code - in card_fxs.c to trace future DTMF issues. * Properly note DAHDI - (as opposed to Zaptel) ioctls. ........ r4452 | tzafrir | - 2008-08-04 18:36:19 +0300 (Mon, 04 Aug 2008) | 2 lines Make it - formally bashism. ........ r4453 | tzafrir | 2008-08-04 18:38:10 - +0300 (Mon, 04 Aug 2008) | 2 lines Kbuild: A more robust check - for the bri_dchan patch. ........ r4454 | tzafrir | 2008-08-04 - 18:39:01 +0300 (Mon, 04 Aug 2008) | 2 lines Minor BRI - initlization improvements. ........ r4455 | tzafrir | 2008-08-04 - 18:43:32 +0300 (Mon, 04 Aug 2008) | 7 lines Add channel alarms in - Zaptel-perl and lszaptel specifically. * Zaptel::Chans now - provides a method alarms() for a list (or number of) alarms. * - lszaptel uses it for a more correct display of channel status. * - Also update PCI hardware list. ........ - -2008-08-03 15:03 +0000 [r4449] Tzafrir Cohen - - * /, kernel/zaptel-base.c: Fix build on kernels 2.6.2-2.6.13: - class_simple_device_remove This function only needs the device as - its parameter. (Note that r4448 has already been fixed in 1.4) - Merged revisions 4447 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-08-01 13:52 +0000 [r4443] Russell Bryant - - * /: Blocked revisions 4442 via svnmerge ........ r4442 | russell | - 2008-08-01 08:50:24 -0500 (Fri, 01 Aug 2008) | 12 lines Fix - detection of ringing on FXO ports. This change was made to wctdm - in 1.4 in revision 4096, but when that code got backported to 1.2 - in rev 4132, the change was not made. I found it just by - comparing the differences in the drivers between 1.2 and 1.4. - (closes issue #13188) Reported by: pyves Patches: - 20080731__issue13188_revert4123z12.diff uploaded by bbryant - (license 36) issue13188.patch1.txt uploaded by russell (license - 2) Tested by: russell, bbryant ........ - -2008-07-30 15:24 +0000 [r4438-4440] Kevin P. Fleming - - * Makefile: use proper method for updating version.h - - * Makefile: version.h is *NOT* a phony target, it's a real file - -2008-07-22 20:33 +0000 [r4429-4432] Kevin P. Fleming - - * Makefile: install tonezone.h during 'install-include' and remove - any DAHDI header files during 'install-include' as well - - * kernel/wctdm.c, kernel/wctdm24xxp/base.c: make battery loss to - red alarm translation actually work for these drivers - -2008-07-21 10:04 +0000 [r4425-4426] Tzafrir Cohen - - * /, kernel/zaptel-base.c: Fix building zaptel with kernel 2.6.26. - Taken from DAHDI-linux rev. 4522. For issue #12944 . Merged - revisions 4424 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * README: Fix URL in README. - -2008-07-18 13:16 +0000 [r4421] Kevin P. Fleming - - * Makefile: ensure that the PWD variable we set during the toplevel - 'make' process actually gets carried down to the subprocesses... - don't know why this ever worked, it shouldn't have :-) (closes - issue #12750) Reported by: atis Tested by: tzafrir, atis - -2008-07-10 08:03 +0000 [r4404-4408] Tzafrir Cohen - - * /, kernel/xpp/xbus-pcm.c: PCM: A bugfix that was reintroduced in - r4353: After this change, the echo-canceler buffers were not - cleared in some cases. As a result when one FXS is put ONHOOK, - the other side could hear noise for a second or two until full - disconnect is done. Merged revisions 4407 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * Makefile, README: A referencable label (cfg_) for each - configuration directive. - -2008-07-08 20:20 +0000 [r4398-4401] Kevin P. Fleming - - * Makefile, build_tools/uninstall-modules: minor improvements to - uninstall-modules: add the PID to the temporary file name to make - it less easy to accidentally duplicate, only search directories - where we expect that DAHDI or Zaptel modules might be found - (known installation locations, even old ones), and always - uninstall old Zaptel modules before installing new ones, in case - a module is no longer in the tree and shouldn't be left installed - - * Makefile, build_tools/uninstall-modules: add the new-and-improved - uninstall-modules script here, and teach the Makefile hw to - uninstall DAHDI kernel modules if they are installed - -2008-07-08 11:14 +0000 [r4395] Tzafrir Cohen - - * /, kernel/xpp/card_fxs.c: A case where we didn't switch to low - power at the end of a ring. Issue may prevents ONHOOK detection. - Merged revisions 4394 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-07-07 17:33 +0000 [r4391] Matthew Fredrickson - - * kernel/wctdm24xxp/wctdm24xxp.h: Default ring debounce timer - should be higher to properly catch callerid - -2008-07-06 10:44 +0000 [r4387] Tzafrir Cohen - - * zaptel.conf.sample: A typo you find when looking for "zaptel" or - "zap". - -2008-07-01 20:37 +0000 [r4381-4384] Kevin P. Fleming - - * kernel/wcte12xp/voicebus.c (added), kernel/wctdm24xxp/Kbuild, - kernel/wctdm24xxp/voicebus.c (added), ztmonitor.c, - kernel/wcte12xp/Kbuild: use symlinks to make multiple builds of - voicebus.o, so it doesn't get rebuilt twice every time 'make' is - run to build modules - - * ztmonitor.c: fix up option parsing so that it actually works and - doesn't go into an infinite loop; in passing, do some validation - of the passed options to keep users from requesting incompatible - modes and getting useless output files - -2008-06-28 22:05 +0000 [r4368-4377] Tzafrir Cohen - - * build_tools/test_kernel_git, build_tools/builder: Integrate - changes from Zaptel. builder is now indeed independent of - dahdi/zaptel . - - * build_tools, build_tools/test_kernel_git, build_tools/builder - (added): build_tools/builder - a script that uses - build_tools/test_kernel_git to test-build various kernels. - test_kernel_git: small fixes. Mainly using 'make distclean' in - setver. Closes issue #12135 . - - * build_tools/test_kernel_git: * Generate the modpost program to be - able to complete a build. * Clean, in order to guarantee - everything belongs to this version/build . * "test" is now - "build". - - * /, kernel/xpp/xdefs.h: Fixes building with the kernel of RHEL - 5.2. Closes issue #12889 . Merged revisions 4367 via svnmerge - from http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-06-24 15:05 +0000 [r4363] Kevin P. Fleming - - * ppp/Makefile: minor Makefile fix to properly find zaptel.h - (DAHDI-3) - -2008-06-20 21:10 +0000 [r4360] Matthew Fredrickson - - * kernel/wct4xxp/base.c: Remove unnecessary udelay from read/write - PCI routines - -2008-06-17 21:41 +0000 [r4356] Kevin P. Fleming - - * firmware/Makefile: fix various problems: - don't actually install - hotplug firmware just because it has been downloaded... wait - until hotplug-install is requested - ensure that tag files aren't - removed and recreated unless the firmware file was successfully - installed - -2008-06-15 17:10 +0000 [r4353] Tzafrir Cohen - - * /, kernel/xpp/xbus-pcm.c: Muted DTMF PCM (from FXS modules) could - "leak" to the next channel. (From xpp r5796). Merged revisions - 4352 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-06-05 20:06 +0000 [r4348] Tzafrir Cohen - - * kernel/zaptel-base.c: Fixes a potential panic in Xorcom - Astribanks devices if disconnected when a userspace program still - holds a channel open. Regression from changeset 4250 . - -2008-06-05 16:39 +0000 [r4345] Shaun Ruffell - - * kernel/wcte12xp/base.c: Fixed type of flags parameter to - spin_lock_irqsave functions. Fixes compilation issues on - platforms where int and long do not have the same size. Closes - issue #12787 - -2008-06-03 19:34 +0000 [r4339-4342] Tzafrir Cohen - - * live_zap: live_zap: Also use the BRI module if it's there. - - * ztmonitor.c: Remove an unused variable from ztmonitor.c . - -2008-05-29 19:55 +0000 [r4333] Brett Bryant - - * ztmonitor.c: Change argument parsing for ztmonitor to use getopt. - This adds more compatibility for loosely formatted arguments. - (closes issue #12732) - -2008-05-28 14:33 +0000 [r4321] Shaun Ruffell - - * doc/module-parameters.txt: Small documentation fix with regards - to the latency module parameter identified by user ZX81. This - closes issue #12721. - -2008-05-22 15:02 +0000 [r4315] Tzafrir Cohen - - * kernel/xpp/xpp_zap.c, /, kernel/xpp/xpd.h: blink_mode was a - boolean and changed to a channels bitmask. Now actually changing - the type from bool to unsigned long. (xpp r5756). Merged - revisions 4314 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-05-20 14:54 +0000 [r4309] Tzafrir Cohen - - * /, kernel/xpp/utils/zconf/Zaptel/Span.pm, - kernel/xpp/utils/zconf/Zaptel/Xpp.pm: * Document Zaptel::Span * - Minor changes to Zaptel::Xpp as well. (Documentation-only - changes. xpp r5746,r5747) Merged revisions 4308 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-05-19 12:42 +0000 [r4305] Tzafrir Cohen - - * kernel/xpp/.version, kernel/xpp/card_fxo.c, /, - kernel/xpp/card_global.c, kernel/xpp/Changelog_xpp, - kernel/xpp/init_card_4_30: * Zaptel-1.2.x does not have - zt_alarm_channel(). Move up the backward compatibility kludge so - it actually affect code (failed compilation on zaptel-1.2 from - Digium without (Closes issue #12654 ). * Cleanup a compile - warning in xpp/card_global.c . * Fix regression in PRI init - script (case of less than 4 modules). * Update changelog and bump - version. Merged revisions 4304 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-05-15 15:09 +0000 [r4296] Matthew Fredrickson - - * ztmonitor.c: Add support for stereo output of receive and - transmit streams in ztmonitor (from Switchvox) - -2008-05-14 19:27 +0000 [r4290] Jason Parker - - * kernel/Kbuild: Allow hpec to build on older(?) 2.6 kernels. - (closes issue #12623) Reported by: ricvil Patches: hpec_src.diff - uploaded by tzafrir (license 46) Tested by: qwell, ricvil - -2008-05-28 Matthew Fredrickson - * Zaptel 1.4.11 released - -2008-05-28 Matthew Fredrickson - * Merge revisions 4305, 4309, 4315, and 4321 in due to bug fixes in - DVT process. - - Rev 4305: - * Zaptel-1.2.x does not have zt_alarm_channel(). Move up the backward - compatibility kludge so it actually affect code (failed compilation on - zaptel-1.2 from Digium without (Closes issue #12654 ). - * Cleanup a compile warning in xpp/card_global.c . - * Fix regression in PRI init script (case of less than 4 modules). - * Update changelog and bump version. - - Rev 4309: - * Document Zaptel::Span - * Minor changes to Zaptel::Xpp as well. - - Rev 4315: - * blink_mode was a boolean and changed to a channels bitmask. Now actually - changing the type from bool to unsigned long. (xpp r5756). - - Rev 4321: - * Small documentation fix with regards to the latency module parameter - identified by user ZX81. - -This closes issue #12721. - -2008-05-14 19:27 +0000 [r4290] Jason Parker - - * kernel/Kbuild: Allow hpec to build on older(?) 2.6 kernels. - (closes issue #12623) Reported by: ricvil Patches: hpec_src.diff - uploaded by tzafrir (license 46) Tested by: qwell, ricvil - -2008-05-14 19:18 +0000 [r4289] Tzafrir Cohen - - * README, /: Wrong version number. Merged revisions 4286 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-05-14 18:42 +0000 [r4285] Jason Parker - - * ztscan.c: Temporarily revert revisions 4006 and 4009, until a - better decision can be made about channels on spans. Closes issue - #12635 - -2008-05-14 16:57 +0000 [r4279] Matthew Fredrickson - - * kernel/wcte11xp.c, kernel/wcte12xp/base.c: Add MTP2 Signalling - support to single span cards - -2008-05-14 15:53 +0000 [r4265-4272] Tzafrir Cohen - - * kernel/xpp/utils/xpp_blink, kernel/xpp/zap_debug.h, /, - kernel/xpp/README.Astribank: XPP documentation fixes. Merged - revisions 4271 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * README, /: The parameter print_dbg of xpp has chnaged to "debug". - Merged revisions 4269 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * kernel/xpp/utils/fpga_load.8, kernel/xpp/zap_debug.h, - kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm, - kernel/xpp/init_card_3_29 (removed), kernel/xpp/init_card_7_29 - (removed), kernel/xpp/init_card_9_29 (removed), - kernel/xpp/utils/xpp_modprobe, kernel/xpp/utils/genzaptelconf, - kernel/xpp/xpp_usb.c, kernel/xpp/xpp_zap.c, - kernel/xpp/utils/print_modes.c, - kernel/xpp/firmwares/FPGA_1151.hex, kernel/xpp/xpp_zap.h, - kernel/xpp/xproto.c, kernel/xpp/Changelog_xpp, - kernel/xpp/init_card_1_30 (added), - kernel/xpp/firmwares/FPGA_FXS.hex, kernel/xpp/init_card_3_30 - (added), kernel/xpp/xpd.h, kernel/xpp/xproto.h, - kernel/xpp/utils/zconf/Zaptel/Chans.pm, - kernel/xpp/utils/xpp_blink, kernel/xpp/card_bri.c, - kernel/xpp/xbus-core.c, kernel/xpp/init_card_4_29 (removed), - kernel/xpp/init_card_6_29 (removed), - kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, - kernel/xpp/utils/xpp_fxloader, kernel/xpp/xbus-core.h, - kernel/xpp/utils/fpga_load.c, kernel/xpp/xdefs.h, - kernel/xpp/.version, kernel/xpp/card_pri.c, - kernel/xpp/firmwares/FPGA_1141.hex, kernel/xpp/card_fxo.c, - kernel/xpp/xframe_queue.c, kernel/xpp/xbus-sysfs.c, /, - kernel/xpp/README.Astribank, kernel/xpp/card_fxs.c, - kernel/xpp/card_global.c, kernel/xpp/card_fxo.h, - kernel/xpp/utils/Makefile, kernel/xpp/init_card_2_30 (added), - kernel/xpp/xbus-pcm.c, kernel/xpp/card_fxs.h, - kernel/xpp/card_global.h, kernel/xpp/init_card_4_30 (added), - kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, - kernel/xpp/zap_debug.c: xpp r5723: Includes, among others: * New - firmware protocol version: 3.0 . * New numbers for the device - types: (e.g. in card_init* scripts) - FXS: 1 (was: 3) - FXO: 2 - (was: 4) - BRI: 3 (was: 6 for TE, 7 for NT) - PRI: 4 (was: 9) * - Init scripts of FXS and FXO modules are now written in Perl as - well (be sure to have File::Basename, e.g: perl-modules in - Debian). * calibrate_slics merged into init_card_1_30 . * Module - parameter print_dbg replaced with debug . Same meaning. * - init_fxo_modes removed: content moved into init_card_2_30, - verified at build time. * Code tested with sparse. Most warnings - were fixed. * Set ZT_SIG_DACS for the bchans in the PRI and BRI - modules to not get ignored by ztscan. * Handle null config_desc - we get from some crazy USB controllers. * genzaptelconf: Fix - reporting of empty slots in list mode. * xpp_blink can now blink - a single analog port. * "slics" has been renamed "chipregs". * - Fixed a small typo in fpga_load(8). * Fixed bashism in - xpp_fxloader. Merged revisions 4264 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * /: Ignore files generated when making README.html . - -2008-05-13 18:01 +0000 [r4261] sruffell : - - * Makefile, build_tools/uninstall-modules: Remove old zaptel - modules from the kernel modules directory before installing the - new ones. (Related to issue #12262) - -2008-05-12 22:19 +0000 [r4257] Tzafrir Cohen - - * live_zap: * Write to zaptel.conf under our live/ directory . * - Fix reading variables from live/live.conf . - -2008-05-12 17:28 +0000 [r4253] Matthew Fredrickson - - * kernel/zaptel.h: Apparently this API changed in 2.6.18, not in - 2.6.22 - -2008-05-11 01:57 +0000 [r4250] Matthew Fredrickson - - * kernel/wct4xxp/base.c, ztcfg.c, kernel/zaptel.h, - kernel/zaptel-base.c: Merge in kernel level MTP2 branch. - -2008-05-04 09:56 +0000 [r4232-4235] Tzafrir Cohen - - * kernel/xpp/card_pri.c, /: * Allow initialization of T1-s (r5665) - . * Remove some false alarms on T1-s (r5669) . Merged revisions - 4234 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * Makefile, README: Docuemnt the tonezones we currently have. - -2008-05-02 19:46 +0000 [r4221-4231] Matthew Fredrickson - - * kernel/wct4xxp/base.c: Remove some useless code that was merged - from the stackcleanup branch - - * kernel/wct4xxp/base.c: Remove old schedule_timout code and - replace with an msleep - - * kernel/wct4xxp/base.c, kernel/wct4xxp/wct4xxp.h: Move the - checktiming parameter to a flag in checkflag as well - - * kernel/wct4xxp/base.c, kernel/wct4xxp/wct4xxp.h: Switch to using - bitflags instead of variables for stopdma field - - * kernel/wct4xxp/base.c: Fix for #12387. Cannot unload wct4xxp - module on FC8 - - * kernel/wct4xxp/base.c, kernel/wct4xxp/wct4xxp.h, - kernel/zaptel-base.c: Merge stack cleanup branch into 1.4. Also - merge firmware load time fix for wct4xxp driver. The stack - cleanup branch reduces the amound of stack used by zaptel, nice - for systems with 4K stacks enabled and where potential stack - overflow is found - -2008-05-01 19:37 +0000 [r4217] Jason Parker - - * zaptel.init: Clarify a message. Some hardware doesn't provide - timing, so this could be confusing. (closes issue #12459) - Reported by: panderson Patches: zaptel.init.patch uploaded by - panderson (license 469) - -2008-05-01 16:46 +0000 [r4213] Terry Wilson - - * Makefile: Allow $(ARCH) to be overridden and pass on through - $(KMAKE) - -2008-05-01 Matthew Fredrickson - - * Zaptel 1.4.10.1 released - -2008-04-23 19:20 +0000 [r4192-4193] Tzafrir Cohen - - * kernel/xpp/Kbuild: A test for a specific #define in zconfig.h was - done by invoking cpp . Sadly the change of CFLAGS handling in - kernel 2.6.24 meant that it is no longer as easy to invoke cpp on - our own. Impact: On kernel >= 2.6.24, xpd_bri never got built, - even if the bri_dchan patch was applied. Fix: use a simpler grep - instead. Hopefully noone passes it through other means. This - should hopfully fix issue #12426 . - - * README: Bumped into yet another incompatibility. - -2008-04-21 21:27 +0000 [r4187] Tzafrir Cohen - - * kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm: - Zaptel::Config::Default - don't die if no config file. - (Accidentally left out of the merge from 1.2) - -2008-04-10 21:01 +0000 [r4167] sruffell : - - * Makefile: Fixed typo in makefile which was preventing make from - installing the udev rules. - -2008-04-10 18:11 +0000 [r4165-4166] Tzafrir Cohen - - * build_tools/zaptel_svn_tarball (added): zaptel_svn_tarball - get - a tarball fron an SVN snapshot. - - * kernel/xpp/.version, /: Officially bumping xpp version - (xpp/.version) to 5566 . Merged revisions 4164 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-04-08 Matthew Fredrickson - - * Zaptel 1.4.10 released - -2008-04-04 17:47 +0000 [r4137] Matthew Fredrickson - - * kernel/wctdm24xxp/base.c: Add support for AEX410 - -2008-04-03 23:27 +0000 [r4130] Mark Spencer - - * kernel/zaptel-base.c: Have to use 'O' since 'F' is reserved (MFR2 - fOrward) - -2008-04-01 16:39 +0000 [r4122] sruffell : - - * kernel/wct4xxp/base.c: Work around for host bridges that generate - fast back to back transactions which the current version of the - quad span cards do not advertise support for. - -2008-04-01 00:45 +0000 [r4119] Tzafrir Cohen - - * Makefile, /: Do clean some modules when there's no kernel tree - available. (and block the backport of r4082). Merged revisions - 4118 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-03-31 17:39 +0000 [r4113-4114] Russell Bryant - - * Makefile: revert a portion of rev 4113 that was committed by - accident - - * Makefile, README, kernel/ztd-ethmf.c (removed), - zaptel.conf.sample: Remove the ztd-ethmf driver for now. It was - not ready to be committed. (issue #12241) - -2008-03-31 08:30 +0000 [r4110] Tzafrir Cohen - - * /, kernel/xpp/README.Astribank: Document when "D-Chan RX Bad - checksum" is not a problem. Merged revisions 4109 via svnmerge - from http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-03-29 06:57 +0000 [r4106-4107] Tzafrir Cohen - - * README: Minor asciidoc fix. - - * README: Document some ABI changes. - -2008-03-27 22:08 +0000 [r4096-4101] sruffell : - - * kernel/xpp/utils/print_modes.c, kernel/xpp/utils/Makefile: No - need to make the wctdm_fxomodes.h file anymore, since it would be - the same as the fxo_modes.h file. - - * kernel/xpp/utils/Makefile: The location of the fxo_modes - structure changed. - - * kernel/fxo_modes.h (added), doc/module-parameters.txt, - kernel/wctdm24xxp/Kbuild, kernel/wctdm24xxp/wctdm24xxp.h, - kernel/wcte12xp/vpmadt032.c, kernel/wctdm.c, - kernel/wctdm24xxp/base.c, kernel/voicebus.c (added), - kernel/wcte12xp/wcte12xp.h, kernel/voicebus.h (added), - kernel/wcte12xp/Kbuild, kernel/wcte12xp/base.c, - kernel/zaptel-base.c: - Updated wctdm24xxp and wcte12xp driver - which are now more tolerant of systems which do not exhibit good - real-time characteristics. - Bringing in improvements to battery - alarm generation that was on kpflemings battery_alarms branch. - (Issue #12099) - -2008-03-27 20:37 +0000 [r4095] Tzafrir Cohen - - * Makefile: Also install wct4xxp/wct4xxp.o in 2.4 kernels... - -2008-03-26 08:45 +0000 [r4078-4086] Tzafrir Cohen - - * /, build_tools/genudevrules: Don't easily fail for missing - udevinfo. Nobody has that older udev version (or otherwise we - might have recieved a bug report about a bogus == rule). TODO: - fix the UDEVRULES test in Makefile. Merged revisions 4085 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - - * Makefile: * Include the .config file. That adds some useful - information. * If we have devfs support, assume we have dynamic - file system, but not UDEV rules. - - * Makefile: Allow overriding DYNFS and UDEVRULES to both ways from - the make command-line. - - * kernel/zaptel.h: Remove yet another "static" inside a struct and - allow building 1.4 in devfs 2.4 systems. - -2008-03-24 21:09 +0000 [r4073] Matthew Fredrickson - - * kernel/wcte12xp/vpmadt032.c: Merged revisions 4072 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r4072 | mattf | 2008-03-24 16:06:00 -0500 (Mon, 24 Mar 2008) | 1 - line Add in new parameters added for 1.16 version of the firmware - for the TE120 which should have already been merged in. ........ - -2008-03-23 22:29 +0000 [r4069] Tzafrir Cohen - - * README, kernel/ztd-ethmf.c (added), zaptel.conf.sample: - ztd-ethmf.c: Ztdynamic driver for Redfone Communications - foneBRIDGE 2. This driver uses a network protocol that is - different from the existing ztd-eth driver. This commit adds the - driver though does not yet build it by default. For the moment - use make MODULES_EXTRA="ztd-ethmf" . Patch - multiframe-032108.patch from #12241 by brettcar. - -2008-03-21 23:30 +0000 [r4050-4063] Kevin P. Fleming - - * kernel/digits.h, tonezone.c, kernel/wcusb.c, kernel/zaptel.h, - zonedata.c, tonezone.h, kernel/zaptel-base.c: add MF R2 tone - generation, and along the way do a lot of cleanup of the tone - building and playback code - - * firmware/Makefile, Makefile: minor fixes... some missing - dependencies and extraneous output when downloading firmware - - * Makefile: the hotplug firmware detection logic got broken in - r3969... this fixes it - - * kernel/wcte12xp/GpakApi.c, kernel/wctdm24xxp/GpakApi.c: silence - some compiler warnings about unused variables - -2008-03-21 11:29 +0000 [r4039-4042] Tzafrir Cohen - - * doc/ztscan.8: Bugs? ztscan has no bugs. - - * kernel/xpp/card_pri.c, kernel/xpp/utils/zconf/Zaptel/Hardware.pm, - kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm, /, - kernel/xpp/README.Astribank, kernel/xpp/Changelog_xpp: * Earleier - initialization of PRI module's register. * Fix zaptel-perl - reporting of battery after procfs changes. * Documentation - updates. * Block hdlcstress/test fixes that followed: already - merged. Merged revisions 4036 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-03-19 20:05 +0000 [r4031] Matthew Fredrickson - - * kernel/wcte12xp/GpakApi.c, kernel/wcte12xp/gpakenum.h, - kernel/wctdm24xxp/base.c, kernel/wcte12xp/GpakApi.h, - kernel/wcte12xp/GpakErrs.h, kernel/wcte12xp/GpakHpi.h: Merging in - 1.16 software for VPMADT032 on wcte12xp driver - -2008-03-19 16:02 +0000 [r4022] Doug Bailey - - * kernel/wctdm24xxp/base.c: Properly handle return value before - testing parameter (Parameter may be uninitialized) - -2008-03-19 02:24 +0000 [r4006-4019] Tzafrir Cohen - - * Makefile: * Generate html pages from the xpp utils dir as well. * - Clean generated HTML-ized man pages on clean. - - * doc/ztscan.8 (added): A man page for ztscan. - - * /, kernel/xpp/card_fxs.c, kernel/xpp/xbus-pcm.c: * We need to - silence the echo-canceller buffers as well. * But no need to - cancel echo on channels without PCM. * Switch to FXS hardware - DTMF detection again. Merged revisions 4012 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * ztscan.c: ztscan can now accept optional list of span numbers and - print output for those spans only. Default remains (when there - are no parameters) to print output for all spans. - - * ztscan.c: ztscan.c: Moving some code, renaming some variables, no - change in functionality. - -2008-03-16 18:30 +0000 [r3996-3997] Tzafrir Cohen - - * kernel/wcfxo.c: cleanup wcfxo module parameters: * Make them all - world-readable. * If value only used at initialization, make them - read-only. - - * ztscan.c: ztscan: detect xpp (pri/bri), tor2 and torisa as - digital as well as they currently claim to support CAS but not - DACS. - -2008-03-14 16:39 +0000 [r3983-3990] Matthew Fredrickson - - * firmware/Makefile, kernel/wctdm24xxp/base.c, - kernel/wctdm24xxp/GpakApi.c, kernel/wctdm24xxp/GpakApi.h: Update - wctdm24xxp's VPMADT032 firmware to version 1.16 - - * kernel/wct4xxp/base.c: When doing the ISR rewrite, forgot to - include the vpmdtmfcheck when doing DTMF polling causing it to - check for DTMF events even when it was told not to - - * Makefile: Update linked mISDN version to latest (1.1.7.2) - -2008-03-09 18:18 +0000 [r3969-3979] Tzafrir Cohen - - * Makefile: Hush grep's output once again and allow building with - firmware support. - - * Makefile: The main Makefile now knows if we don't have kernel - source. * Nicer handling of situations where we don't have kernel - source and don't really need it ('make clean', mainly). * The - test for hotplug firmware is now from the same .config file. No - more strange message about autoconf.h . - - * /, zaptel.conf.sample: More asciidoc polishes and small sample - file fixes. Merged revisions 3972 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * Makefile, README, /, zaptel.conf.sample: Integrating sample / - reference configuration file into the reference documentation. - Merged revisions 3968 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-03-07 16:18 +0000 [r3964] Jason Parker - - * kernel/zaptel-base.c: Fix compilation when using devfs (closes - issue #12156) Reported by: zandbelt Patches: - zaptel-1.4.9.2-devfs-mode.patch uploaded by zandbelt (license 33) - -2008-03-07 01:01 +0000 [r3953-3958] Tzafrir Cohen - - * kernel/zaptel-base.c: Also print channel alarms in /proc/zaptel - files. - - * kernel/xpp/xbus-pcm.h, kernel/xpp/init_card_3_29, - kernel/xpp/utils/zconf/Zaptel/Span.pm, - kernel/xpp/utils/astribank_hook, kernel/xpp/xpp_usb.c, - kernel/xpp/xpp_zap.c, kernel/xpp/firmwares/FPGA_1151.hex, - kernel/xpp/xproto.c, kernel/xpp/Changelog_xpp, - kernel/xpp/firmwares/FPGA_FXS.hex, kernel/xpp/calibrate_slics, - kernel/xpp/card_bri.c, kernel/xpp/xbus-core.c, - kernel/xpp/utils/xpp_fxloader, kernel/xpp/xbus-core.h, - kernel/xpp/xdefs.h, kernel/xpp/utils/zapconf, - kernel/xpp/utils/xpp.rules, - kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm, - kernel/xpp/.version, kernel/xpp/card_pri.c, - kernel/xpp/firmwares/FPGA_1141.hex, kernel/xpp/card_fxo.c, - kernel/xpp/xbus-sysfs.c, kernel/xpp/xframe_queue.c, /, - kernel/xpp/card_global.c, kernel/xpp/card_fxs.c, - kernel/xpp/README.Astribank, kernel/xpp/Kbuild, - kernel/xpp/utils/Makefile, kernel/xpp/utils/xpp_timing (added), - kernel/xpp/xbus-pcm.c: xpp.r5512: * Build: - Zaptel >= 1.4.9 is - migrating to storing kernel stuff in zaptel/kernel/* - We - conditionally use old/new directory scheme: In xpp/Kbuild and - xpp/utils/Makefile use ZAP_KERNEL variable, so it's not confused - with ZAPTEL_DIR (which appears in zaptel/Makefile as well). - Fix - compile warnings on 64 bit systems. - Compile fixes for - kernel-2.6.24 * UDEV: - /etc/udev/rules.d/xpp.rules now uses - XPP_INIT_DIR to find astribank_hook. - astribank_hook: Modify to - do nothing. Add some documentation. * Autoconfiguration -- - zapconf: - Don't fail zapconf et.al. if no config file was found. - - Skip the 'IRQ Missing:' line in /proc/zaptel/nnn for - wcte1xp(?). - Add some newer Digium cards to our hardware - inventory. - Partially handle cases where the /proc/zaptel - strings does not contain info about E1/T1/J1 or NT/TE. * Better - SYNC: - Finer tuning of PLL (New firmware). - Change calculation - algorithm of sync offset. It now copes better with the variance - in USB frame reception timing. - Statistics: . The view of - results was moved from /proc/xpp/XBUS-*/summary to a new - /sys/bus/astribanks/devices/xbus-*/timing and enhanced. . A new - xpp_timing script shows all astribanks. . A new write only - /sys/bus/astribanks/devices/xbus-*/cls is used to clear - statistics. Eventually, clearing of XBUS related statistics - should be done here. One that was migrated is the clearing of - 'PCM [TR]X:' numbers currently appearing in - /proc/xpp/XBUS-*/summary (they should be moved too later). - - Shorten the strings representation sync_mode ("SYNC_MODE_AB" -> - "AB") adapted their use in printk and /proc so the text is clear. - - Added a command line parameter xpp.disable_pll_sync to stop all - adjustments command to AB (calculations still continue as usual). - * PRI: - 4 port support - set clocking master span via ztcfg, - like other zaptel devices. * FXO: - Fix false hangups in some - countries (voltage fluctuations). - Some countries send caller-id - before first ring. Added code to handle caller-id PCM pass - through according to a new command line parameter - (xpd_fxo.caller_id_style). - No longer sends an event on zt_open. - See #12160 . * Misc: - Adapt to zaptel-1.4.8 and above ztscan: - added fields returend by new ZT_SPANSTAT_V2 ioctl() - Document - sysfs and waitfor_xpds. - Miscelaneous optimizations and - bugfixes. - Remove deprecated pcm_tasklet parameter. The - rx_tasklet parameter has replaced it a long time ago. - Add - RX_CMD counter to /proc/xpp/XBUS-*/summary - Unclutter some of - the usb disconnect messages. - xpp_usb: minor preformance - improvements in receive. Expose the number of pending receive - URB's in /proc/xpp/XBUS-*/xpp_usb Merged revisions 3952 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - - * /: Blocking the 'make clean' fix. - -2008-03-05 21:16 +0000 [r3939] Tzafrir Cohen - - * kernel/xpp/utils/zconf/Zaptel/Span.pm: Hopefully a fix for issue - #12150 . - -2008-03-04 23:58 +0000 [r3932] Kevin P. Fleming - - * kernel/zaptel-base.c: don't add an unnecessary delayed battery - transition on FXS ports when we know the other end is already - on-hook (closes issue #9660) Reported by: mmacvicar Patches: - zaptel-base-c_patch_1_4_rev3121 uploaded by meneault (license - 260) Tested by: jmhunter - -2008-03-03 22:04 +0000 [r3916-3921] Tzafrir Cohen - - * Makefile, kernel/GNUmakefile: * Pass some extra variables - explicitly in the 2.4 build. * Clean up the 2.4 kernel - GNUMakefile. Should hopefully fix issue #12056. - - * /: Blocked revisions 3917 via svnmerge ........ r3917 | tzafrir | - 2008-03-03 22:44:01 +0200 (Mon, 03 Mar 2008) | 4 lines No need - for userspace 'make clean' here. Kbuild takes care of it. Closes - issue #12118 . ........ - - * build_tools/test_kernel_git: Fix setting versions in - test_kernel_git. - - * README, zaptel.conf.sample: * Document 'mulaw', 'alaw' and - 'deflaw' in the sample config file. * Fix spacing in the README. - -2008-02-28 Russell Bryant - - * Zaptel 1.4.9.2 released - -2008-02-27 18:30 +0000 [r3883-3885] sruffell : - - * kernel/zaptel-base.c: Set the default tone zone to to the first - loaded zone by default. Should prevent the crash reported in - issue 0012053. - -2008-02-26 23:43 +0000 [r3881] Kevin P. Fleming - - * tonezone.c: properly initialize the buffer used for holding - generated tone samples... this should fix issue #11855 and solve - problems with DTMF generation - -2008-02-21 Russell Bryant - - * Zaptel 1.4.9.1 released - -2008-02-21 [r3869] Jason Parker - - * Makefile, firmware/Makefile: Make firmware get properly installed again. - -2008-02-21 17:51 +0000 [r3863] Kevin P. Fleming - - * kernel/tor2.c: the tor2 private structure has a field for the - corresponding PCI device pointer, but it was never filled in... - since it is now being used in the init_spans() function, this - caused a NULL pointer dereference. solve that problem by actually - filling in the pointer variable that already existed :-) - -2008-02-20 22:02 +0000 [r3861] Jason Parker - - * kernel/Kbuild: Make hpec buildable again. Closes issue #11951, - patch by me. - -2008-02-18 Russell Bryant - - * Zaptel 1.4.9 released - -2008-02-16 20:15 +0000 [r3835-3840] Tzafrir Cohen - - * build_tools/test_kernel_git: Add an options 'versions' to list - available kernel revisions (tags). - - * README, /: * Start documenting module parameters in the README. * - Update the hardware supported by xpp. Merged revisions 3837 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - - * Makefile: Cut a few more lines from the Makefile. - - * Makefile: README.Astribank has moved. Fix docuemtnation - generation. - - * kernel/zaptel-base.c: Make the kerenl parameters of zaptel.ko - world-readable. - -2008-02-16 04:42 +0000 [r3834] Jeff Peeler - - * /: marking 3833 as not applying to 1.4 - -2008-02-15 21:38 +0000 [r3832] Kevin P. Fleming - - * README, /: Merged revisions 3831 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3831 - | kpfleming | 2008-02-15 14:23:27 -0600 (Fri, 15 Feb 2008) | 2 - lines update README to reflect currently supported Digium - interface cards ........ - -2008-02-13 21:18 +0000 [r3830] Tzafrir Cohen - - * Makefile: No explicit list of modules to install for 2.6 -it's - Kbuild's job. This closes issue #9948 . - -2008-02-13 00:34 +0000 [r3823] Kevin P. Fleming - - * kernel/wctc4xxp/Kbuild, kernel/wctc4xxp/base.c: remove some - STANDALONE_ZAPATA stuff that is not needed - -2008-02-09 11:40 +0000 [r3820-3821] Tzafrir Cohen - - * Makefile: Don't automatically export all variables. - - * Makefile: Remove some unused kernel 2.4 code from the Makefile. - -2008-02-07 02:23 +0000 [r3814] Tzafrir Cohen - - * fxstest.c: fxstest.c should include wctdm.h from kernel/ . - -2008-02-05 23:48 +0000 [r3805] sruffell : - - * kernel/wcte12xp/base.c: Changes to the wcte12xp driver. - replace - change to allow driver to recover from descriptor unavailable. - - module echo cancellation parameters now valid under 2.6 kernels. - -2008-02-05 19:26 +0000 [r3793-3802] Tzafrir Cohen - - * Makefile: Make sure version.h is created before building modules. - Closes issue #11924. - - * wcusb.h (removed), kb1ec.h (removed), kernel/datamods, - kernel/arith.h, ztcfg-dude.c, kernel/xpp/utils/zt_registration, - kernel/xpp/init_card_3_29, kernel/xpp/firmwares/README, - ztdynamic.c (removed), kernel/xpp/utils/astribank_hook, - kernel/xpp/utils/zconf/Zaptel/Xpp.pm, tonezone.h, hdlctest.c, - kernel/xpp/utils/hexfile.c, wcte11xp.c (removed), - kernel/fasthdlc.h, kernel/wcte12xp/wcte12xp.h, proslic.h - (removed), kernel/xpp/utils/hexfile.h, kernel/wct4xxp, - kernel/wcte12xp/GpakErrs.h, kernel/torisa.c, configure.ac, - pattest.c, kernel/zconfig.h, kernel/tor2-hw.h, jpah.h (removed), - kernel/biquad.h, kernel/xpp/param_doc, kernel/ztd-loc.c, - kernel/xpp/utils/xpp_blink, kernel/xpp/card_bri.c, torisatool.c, - kernel/xpp/utils/test_parse.c, zttranscode.c (removed), - kernel/xpp/init_card_6_29, kernel/xpp/card_bri.h, mg2ec.h - (removed), wctc4xxp (removed), hdlcgen.c, - kernel/datamods/Makefile, kernel/xpp/.version, - kernel/xpp/card_pri.c, kernel/xpp/firmwares/FPGA_1141.hex, - kernel/xpp/xframe_queue.c, ztcfg.c, wct1xxp.c (removed), - kernel/xpp/card_pri.h, kernel/xpp/xframe_queue.h, fir.h - (removed), kernel/xpp/zap_debug.c, digits.h (removed), pciradio.c - (removed), kernel/xpp/utils/zconf/Zaptel/Hardware.pm, - kernel/xpp/zap_debug.h, wcte12xp (removed), - kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm, hpec (removed), kernel - (added), hdlcverify.c, kernel/xpp/firmwares/LICENSE.firmware, - kernel/wcusb.c, kernel/xpp/init_card_9_29, - kernel/xpp/utils/xpp_modprobe, zaptel.h (removed), - kernel/xpp/utils/genzaptelconf, kernel/xpp/xpp_usb.c, - kernel/wcusb.h, makefw.c (removed), kernel/kb1ec.h, - kernel/xpp/utils/xpp_fxloader.usermap, - kernel/wcte12xp/vpmadt032.c, hdlcstress.c, - kernel/xpp/utils/zconf/Zaptel/Hardware, kernel/hpec/hpec_user.h, - kernel/ztdynamic.c, kernel/wcte12xp/vpmadt032.h, - kernel/xpp/utils/zconf/Zaptel, - kernel/xpp/utils/example_default_zaptel, kernel/wcte12xp/Kbuild, - Kbuild (removed), kernel/wct4xxp/Kbuild, zttool.c, - kernel/xpp/utils/zconf/Zaptel/Xpp, adt_lec.c (removed), ecdis.h - (removed), kernel/wctdm24xxp/GpakHpi.h, kernel/wcte11xp.c, - kernel/wctc4xxp/Kbuild, kernel/xpp/utils/zconf/Zaptel.pm, - kernel/xpp/init_card_4_29, kernel/proslic.h, kb1ec_const.h - (removed), adt_lec.h (removed), wctdm24xxp (removed), - kernel/xpp/utils/lszaptel, kernel/xpp/utils/xpp.rules, - kernel/jpah.h, kernel/datamods/syncppp.c, ztdummy.c (removed), - ztdummy.h (removed), sec-2.h (removed), ztd-eth.c (removed), - sec.h (removed), tormenta2.rbt (removed), kernel/zttranscode.c, - kernel/xpp/Kbuild, kernel/xpp/README.Astribank, - kernel/xpp/card_global.c, kernel/mg2ec.h, - kernel/datamods/hdlc_generic.c, kernel/xpp/utils/Makefile, - kernel/wctc4xxp, kernel/xpp/Makefile, kernel/xpp/parport_debug.c, - kernel/xpp/utils/zconf/Zaptel/Hardware/USB.pm, - kernel/wcte12xp/GpakHpi.h, kernel/xpp/card_global.h, - kernel/wct4xxp/wct4xxp.h, kernel/xpp/utils/fpga_load.8, - kernel/xpp/parport_debug.h, kernel/wct1xxp.c, configure, - fxstest.c, kernel/hpec/hpec_zaptel.h, kernel/xpp/init_card_7_29, - kernel/xpp/utils/zaptel_drivers, kernel/xpp/xpp_log.h, - kernel/fir.h, kernel/wcte12xp/base.c, kernel/digits.h, - kernel/xpp/xpp_zap.c, mg2ec_const.h (removed), kernel/pciradio.c, - kernel/xpp/utils/print_modes.c, kernel/wct4xxp/base.c, - kernel/wcte12xp, kernel/datamods/hdlc_fr.c, kernel/xpp/xpp_zap.h, - kernel/wctc4xxp/base.c, kernel/hpec, wctdm.c (removed), - timertest.c, wctdm.h (removed), kernel/xpp/Changelog_xpp, - kernel/zaptel.h, kernel/xpp/firmwares/FPGA_FXS.hex, tor2.c - (removed), wcfxo.c (removed), xpp (removed), kernel/xpp/xpd.h, - kernel/xpp/calibrate_slics, kernel/makefw.c, Makefile, - kernel/wctdm24xxp/Kbuild, kernel/xpp/xbus-core.c, pciradio.rbt - (removed), kernel/wctc4xxp/Makefile, - kernel/xpp/utils/xpp_fxloader, - kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, - kernel/xpp/utils/fpga_load.c, kernel/xpp/xbus-core.h, - kernel/xpp/xdefs.h, zaptel-base.c (removed), kernel/Kbuild, - kernel/adt_lec.c, datamods (removed), - kernel/xpp/utils/genzaptelconf.8, arith.h (removed), - kernel/ecdis.h, kernel/xpp/firmwares/USB_FW.hex, - kernel/xpp/xbus-sysfs.c, kernel/wctdm24xxp/gpakenum.h, - kernel/adt_lec.h, kernel/kb1ec_const.h, ztdiag.c, - kernel/wctdm24xxp, kernel/wct4xxp/wct4xxp-diag.c, - kernel/wctdm24xxp/GpakCust.c, kernel/xpp/utils/zconf, - kernel/xpp/xbus-pcm.c, kernel/GNUmakefile, - kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, kernel/ztdummy.c, - kernel/wctdm24xxp/GpakCust.h, kernel/xpp/xbus-pcm.h, - kernel/wctdm24xxp/wctdm24xxp.h, fasthdlc.h (removed), - kernel/sec-2.h, kernel/ztdummy.h, kernel/sec.h, - kernel/xpp/utils/zconf/Zaptel/Utils.pm, kernel/ztd-eth.c, - kernel/tormenta2.rbt, kernel/xpp/utils/zconf/Zaptel/Span.pm, - wct4xxp (removed), torisa.c (removed), zconfig.h (removed), - kernel/xpp/firmwares, kernel/datamods/hdlc_ppp.c, - kernel/datamods/hdlc_cisco.c, tor2-hw.h (removed), - kernel/wct4xxp/vpm450m.c, biquad.h (removed), - kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm, - kernel/xpp/firmwares/FPGA_1151.hex, ztd-loc.c (removed), - kernel/wctdm24xxp/base.c, kernel/wct4xxp/vpm450m.h, - kernel/wctdm24xxp/GpakApi.c, kernel/wctc4xxp/codec_test.c, - kernel/xpp/xproto.c, kernel/hpec/hpec.h, - kernel/wctdm24xxp/GpakApi.h, kernel/xpp/xproto.h, - kernel/mg2ec_const.h, fxotune.c, kernel/wcte12xp/Makefile, - kernel/xpp/utils/zconf/Zaptel/Config, - kernel/xpp/utils/zconf/Zaptel/Chans.pm, kernel/wct4xxp/Makefile, - fxotune.h, kernel/wctdm.c, kernel/datamods/hdlc_raw_eth.c, - kernel/datamods/hdlc_raw.c, kernel/wctdm24xxp/Makefile, ztscan.c, - kernel/wctdm.h, ztmonitor.c, kernel/xpp, kernel/tor2.c, - kernel/wcfxo.c, kernel/xpp/utils, kernel/xpp/utils/zapconf, - kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm, - kernel/wcte12xp/gpakenum.h, kernel/wcte12xp/GpakApi.c, - kernel/xpp/utils/xpp_sync, kernel/xpp/card_fxo.c, - kernel/Makefile, kernel/wcte12xp/GpakApi.h, patlooptest.c, - patgen.c, kernel/pciradio.rbt, /, kernel/xpp/card_fxs.c, - kernel/xpp/card_fxo.h, kernel/xpp/utils/zaptel-helper, - kernel/xpp/utils/zaptel_hardware, wcusb.c (removed), - kernel/xpp/card_fxs.h, kernel/wctdm24xxp/gpakErrs.h, - kernel/zaptel-base.c: Move kernel stuff to under kernel/ (merged - branch /zaptel/team/tzafrir/move ) Closes issue #7117. - -2008-02-03 03:43 +0000 [r3785] Tzafrir Cohen - - * zaptel.h, zaptel-base.c: Fix building in 2.4 w/devfs. Closes - issue #11884 (There's still the msleep warning). - -2008-02-01 23:32 +0000 [r3783] Kevin P. Fleming - - * doc/module-parameters.txt (added): add an (incomplete) text - document describing module parameters available in Zaptel modules - -2008-02-01 20:10 +0000 [r3775-3779] Matthew Fredrickson - - * zaptel-base.c: Assume if we're disabling echo can that there are - no paramters passed - - * wctdm24xxp/base.c: Fix bug so that echo cancellation actually - will be disabled - -2008-01-30 22:53 +0000 [r3767] Tzafrir Cohen - - * xpp/utils/zconf/Zaptel/Config/Defaults.pm, /: Don't fail zapconf - if no config file was found. Merged revisions 3766 via svnmerge - from http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-01-28 21:10 +0000 [r3754] Matthew Fredrickson - - * wctdm24xxp/base.c: Allow echo canceller parameters to be updated - dynamically - -2008-01-27 23:10 +0000 [r3748] Tzafrir Cohen - - * wcte12xp/Makefile, Makefile, wct4xxp/Makefile, wctc4xxp/Makefile, - wctdm24xxp/Makefile, xpp/Makefile: * Include Kbuild from $(src). - * This is up to 2.6.9, not 2.6.8. - -2008-01-26 00:21 +0000 [r3745] Kevin P. Fleming - - * wctdm24xxp/GpakCust.h, /: Merged revisions 3744 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3744 - | kpfleming | 2008-01-25 18:19:19 -0600 (Fri, 25 Jan 2008) | 5 - lines enable this module to build against kernels < 2.6.9 (issue - #11523) Reported by: tzafrir ........ - -2008-01-26 00:09 +0000 [r3742] Jason Parker - - * ztmonitor.c: Swap RX and TX streams in ztmonitor, as the files - were being saved incorrectly. Add several defines, and modify - many "magic numbers" to use them correctly (see above) Fix error - message in audio_open() (closes issue #11194) Reported by: - meneault Patches: ztmonitor-c_patch_txrx_1_4_rev3121 uploaded by - meneault (license 260) ztmonitor-c_patch_buffer_1_4_rev3121 - uploaded by meneault (license 260) - ztmonitor-c_patch_audio_1_4_rev3121 uploaded by meneault (license - 260) - -2008-01-25 23:23 +0000 [r3737-3739] Kevin P. Fleming - - * wct4xxp/vpm450m.h: current 2.4 kernels *do* have - linux/firmware.h, so use it (closes issue #11551) Reported by: - richvdh - - * wcte12xp/Makefile, wcte12xp/wcte12xp.h, wcte12xp/base.c: make - wcte12xp build successfully on 2.4 kernels, although it won't - have VPM support (closes issue #11514) Reported by: tzafrir - - * zaptel-base.c: Make CONFIG_ZAPATA_NET compatible with kernels - 2.6.22 and above. (closes issue #11846) Reported by: japple - -2008-01-23 23:02 +0000 [r3733] sruffell : - - * zaptel-base.c: Ensure that the zone lock is always acquired - before the channel lock. (issue #7620) - -2008-01-23 21:35 +0000 [r3726-3731] Matthew Fredrickson - - * wcte12xp/vpmadt032.c, wctdm24xxp/base.c, /, wcte12xp/base.c: - Merged revisions 3730 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3730 - | mattf | 2008-01-23 15:34:07 -0600 (Wed, 23 Jan 2008) | 1 line - Make some echo canceller related parameters adjustable via module - parameter ........ - - * wctdm24xxp/base.c: Revert part of previous commit which wasn't - supposed to be merged yet - - * wctdm24xxp/base.c, zaptel.h: Let an echocan parameter be a signed - value. Also, for convenience, add a place for echocan parameters - in the zt_echocanparams structure - -2008-01-21 23:15 +0000 [r3721] Tzafrir Cohen - - * wct4xxp/Kbuild, wctc4xxp/Kbuild, wctdm24xxp/Kbuild, - wcte12xp/Kbuild: Fix my regression from r3706: Make sure - HOTPLUG_FIRMWARE has effect on the CFLAGS of kernel modules. - Closes issue #11806 . - -2008-01-21 21:51 +0000 [r3718] Kevin P. Fleming - - * wctdm.c, wctdm24xxp/base.c, zaptel-base.c: Report battery loss on - FXO ports of analog cards as a 'red alarm' on the respective - channel. (closes issue #8290) Reported by: tmarkov Patches: - 8290-alarm-total_1_4_rev3705 uploaded by meneault Tested by: - flefoll - -2008-01-21 20:54 +0000 [r3716] Jason Parker - - * zaptel-base.c: Fix compiler error when building with - CONFIG_ZAPATA_PPP. Closes issue #11807. - -2008-01-20 13:38 +0000 [r3706-3711] Tzafrir Cohen - - * Makefile, /: Make sure README.Astribank's HTML copy has a - complete table of contents. Merged revisions 3710 via svnmerge - from http://orig.digium.com/svn/zaptel/branches/1.2 - - * zaptel.h, zconfig.h, zaptel-base.c: Add zconfig build time option - OPTIMIZE_CHANMUTE. Disabled by default. When enabled, a zaptel - channel will have an extra boolean flag: chanmute. If true, - Zaptel needs not waste CPU cycles for copying data for this - channel. If you do not enable the option, this commit should have - no effect. - - * Kbuild (added), Makefile, wctc4xxp/Kbuild, Makefile.kernel26 - (removed): Some more separation of kernel build Makefile from - original one. This is a small change functionality-wise but makes - it much simpler to move things around. It also fixes the major - issue of issue #11141, with only xpp issue left for proper kernel - 2.6.24 support. - -2008-01-17 20:49 +0000 [r3701] Doug Bailey - - * wctdm24xxp/wctdm24xxp.h, wctdm.c, wctdm24xxp/base.c: Added - modified patch so that the ring detect method can be set using a - module parameter. Setting fwringdetect=1 enables the method - submitted by this user. (closes issue #9264) Reported by: mjagdis - Tested by: benbrown - -2008-01-14 Russell Bryant - - * Zaptel 1.4.8 released - -2008-01-14 18:33 +0000 [r3686-3688] Kevin P. Fleming - - * wctdm24xxp/wctdm24xxp.h, wctdm.c, wctdm24xxp/base.c: revert this - change from issue #9264 for now, as it needs more testing before - being put into a release branch - - * ztcfg.c, tonezone.c: make ztcfg able to tolerate tone zones - already being loaded and selected as default (or in use by - channels) without aborting the configuration process - -2008-01-12 16:24 +0000 [r3676-3682] Tzafrir Cohen - - * wcfxo.c: Symbolic names to registers in wcfxo: wcfxo-regs by - meneault from issue #11057. - - * wcfxo.c: Remove the hex that prevented wcfxo international - settings from working. Patch wcfxo-hexa by meneault from issue - #11057. - - * wcfxo.c: Detect cards that do not support international settings: - Cards based on si3035 can not be set with international settings. - This can be tested using REVB (reg. 13, bits 2:5). This commit - tests for that value. It also adds some debugging macros, based - on xpp/zap_debug.h , those maybe those macros should be moved to - a more common place. - - * zaptel-base.c: Don't free a tone zone that was not created. (So - why does tonezone.c do that?) Closes issue #10593 . Sorry for the - noise. - - * doc: Ignore generated html-zed man pages. - -2008-01-11 23:37 +0000 [r3670-3674] Kevin P. Fleming - - * wctdm24xxp/wctdm24xxp.h, wctdm.c, wctdm24xxp/base.c: Improve ring - detection when polarity reversals are present. (closes issue - #9264) Reported by: mjagdis Patches: zaptel-ring.diff uploaded by - mjagdis (modified by me to add support in wctdm24xxp as well) - Tested by: benbrown - - * wctdm24xxp/wctdm24xxp.h, wctdm24xxp/base.c: finish updating to - support echocan params ioctl, even though the parameters are - currently ignored - - * wcte12xp/base.c: minor cleanups - - * wctdm24xxp/base.c: restore ability of this driver to compile... - will finish echo can params code later - -2008-01-11 22:07 +0000 [r3669] Tzafrir Cohen - - * wcfxo.c: * Reduce indentation in wcfxo.c . * Also improve an - error message there. - -2008-01-11 21:35 +0000 [r3665-3667] Kevin P. Fleming - - * zconfig.h, zaptel-base.c: Implement atomic reference counting for - tone zone structures, ensuring that they will never be freed - while they are in use by a channel or as the default zone. In - passing, improve default zone handling so that there will never - be a default zone value pointing to a zone that hasn't been - loaded yet. (closes issue #10593) Reported by: jmhunter Patches - were provided by Matti, but a different solution was chosen - - * wctdm24xxp/base.c, zaptel-base.c: remove some macros that are no - longer needed - -2008-01-11 20:39 +0000 [r3664] Russell Bryant - - * /, zaptel-base.c: Merged revisions 3663 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3663 - | russell | 2008-01-11 14:38:47 -0600 (Fri, 11 Jan 2008) | 8 - lines Revert an unnecessary trylock. Multiple people have looked - at this and nobody can see any reason why this would be required. - (closes issue #10791) Reported by: Matti Patches: patch uploaded - by Matti (license 109) ........ - -2008-01-11 20:22 +0000 [r3662] Kevin P. Fleming - - * kb1ec.h, adt_lec.c, mg2ec.h: apparently strcasecmp() is a fairly - recent addition to the kernel, so use the older method of forcing - the string to lowercase and using strcmp() instead for parameter - parsing - -2008-01-11 19:45 +0000 [r3659-3660] sruffell : - - * wcte12xp/base.c: Minor formatting change. - - * wcte12xp/base.c: Elimates a recursive grab of a spinlock in the - interrupt handler for the wcte12xp. - -2008-01-10 23:59 +0000 [r3649-3654] Kevin P. Fleming - - * mg2ec_const.h, kb1ec.h, kb1ec_const.h, mg2ec.h: finish converting - aggressive suppression mode to runtime control - - * kb1ec.h, mg2ec.h: ensure that any non-zero value supplied will - turn on aggressive mode - - * kb1ec.h: add runtime-controllable aggressive suppression to KB1 - as well - - * mg2ec.h: umm... should have compiled in both modes before - committing - - * mg2ec.h: add runtime-control to MG2 aggressive suppression - (compile-time control is still available, but only sets the - default mode of operation) - - * adt_lec.c (added), wcte12xp/vpmadt032.c, adt_lec.h (added), - wcte12xp/vpmadt032.h, wcte12xp/base.c: add some code to parse - parameters for ADT-based echo cancelers, and update the wcte12xp - driver to be able to push the parameters all the way down to the - DSP initialization function (actually pushing them out to the DSP - will come later) - -2008-01-10 20:24 +0000 [r3646-3647] Tzafrir Cohen - - * live_zap: live_zap: Add an 'exec' command to execute commands in - the 'live' environmnt. - - * xpp/xpp_zap.c, xpp/utils/zconf/Zaptel/Config/Defaults.pm, - xpp/xproto.c, xpp/Changelog_xpp, xpp/xproto.h, xpp/xpd.h, - xpp/utils/zconf/Zaptel/Chans.pm, xpp/card_bri.c, xpp/xbus-core.c, - xpp/utils/zconf/Zaptel.pm, xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, - xpp/utils/fpga_load.c, xpp/utils/lszaptel, xpp/xdefs.h, - xpp/utils/zapconf, xpp/utils/zconf/Zaptel/Hardware/PCI.pm, - xpp/.version, xpp/card_pri.c, xpp/card_fxo.c, xpp/xframe_queue.c, - xpp/Kbuild, xpp/README.Astribank, xpp/card_global.c, - xpp/utils/zaptel_hardware, xpp/Makefile, xpp/utils/Makefile, - xpp/xbus-pcm.c, xpp/zap_debug.c, xpp/zap_debug.h, - xpp/utils/zconf/Zaptel/Xpp/Line.pm (added), /, - xpp/utils/zconf/Zaptel/Span.pm, xpp/utils/astribank_hook, - xpp/init_card_9_29, xpp/xpp_usb.c: xpp.r5254: * Improved polarity - reversal hangups in FXO (r5194). Fixed false detection of - polarity reversals. * Optimize xframe allocation, by not zeroing - the whole memory (in get_xframe()). * Fixed erronous error - message that appeared sometimes from fpga_load during USB - renumeration. * Zaptel::Chans now provides battery() reporting - for some FXO channels (Astribank FXO and wcfxo). Merged revisions - 3643 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2008-01-09 22:53 +0000 [r3639-3641] Matthew Fredrickson - - * fxotune.c, fxotune.h, /: Merged revisions 3640 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3640 - | mattf | 2008-01-09 16:51:57 -0600 (Wed, 09 Jan 2008) | 1 line - BIG fxotune update. New version which uses fourier analysis for - echo return loss measurement. Much more accurate than the old - version, and can penetrate through background noise that may be - on the line as well as noise caused by tones in the background - such as reorder or congestion if the timing parameters aren't - exactly right in the setup. If you have analog fxo modules, it is - recommended that you run fxotune on them again with this latest - version. You will definitely see even better results ........ - - * wcte12xp/vpmadt032.c, wctdm24xxp/base.c, /: Merged revisions 3638 - via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3638 - | mattf | 2008-01-09 16:46:47 -0600 (Wed, 09 Jan 2008) | 1 line - Make sure G.165 EC disable tone detection is enabled ........ - -2008-01-09 17:21 +0000 [r3632-3636] Kevin P. Fleming - - * wcte12xp/vpmadt032.c, wcte12xp/base.c: eliminate compiler - warnings about unused variables - - * zttranscode.c, zaptel.h, zaptel-base.c: For systems using a - dynamic device filesystem (pretty much everything now), don't - register the character device for transcoder support unless the - 'zttranscode'module is loaded. This will result in zttranscode no - longer being automatically loaded when there are no transcoders - present but Asterisk's codec_zap is loaded to look for them. The - zttranscode module will get loaded if any transcoder driver - modules are loaded, so users with transcoders will not see any - change in behavior. - - * zaptel-base.c: use the proper error code for 'no hardware echo - canceler available' - -2008-01-08 22:09 +0000 [r3626-3628] Tzafrir Cohen - - * Makefile: Slightly saner man -> html. - - * Makefile: Another little documentation aid. - - * doc/patgen.8 (added), README, doc/ztdiag.8 (added), doc/pattest.8 - (added): Documentation updates. - -2008-01-07 10:04 +0000 [r3620] Tzafrir Cohen - - * patgen.c, patlooptest.c: Fix some usage messages. - -2008-01-04 22:54 +0000 [r3618] sruffell : - - * wcte12xp/vpmadt032.c, wcte12xp/base.c: Increase the amount of - code that is protected by locks in the wcte12xp interrupt - handler. - -2008-01-04 18:03 +0000 [r3615] Tzafrir Cohen - - * zaptel-base.c: Remove a debug print that found its way into - patch. One of them misleading. - -2008-01-04 17:20 +0000 [r3609-3613] Kevin P. Fleming - - * zaptel.h, zaptel-base.c: [commit message] (issue #10393) Reported - by: tzafrir Patches: chan_alarm_zaptel.diff uploaded by tzafrir - (license 46) (modified by me) - - * xpp/utils: fix a small annoyance - - * wctdm.c, wctdm24xxp/base.c, zaptel.h: various minor cleanups - -2008-01-03 23:37 +0000 [r3607] Tzafrir Cohen - - * live_zap: * Use inline perl to get list of module instead of - script from xpp/utils, as xpp/utils is not copied to remote rsync - copy. * Make sure we set environment early enough to run perl - code. - -2008-01-03 22:23 +0000 [r3604-3605] Kevin P. Fleming - - * mg2ec.h: restore a line of code that was accidentally removed - - * zaptel-base.c: re-add proper support for boards with hardware - echo cancellers - -2008-01-03 17:13 +0000 [r3601] sruffell : - - * wcte12xp/vpmadt032.c, wctdm24xxp/GpakCust.c: Removing some left - over debugging code. - -2008-01-03 16:52 +0000 [r3596-3600] Kevin P. Fleming - - * zaptel.h, zaptel-base.c: a little bit of code cleanup and use - explicit-size types for new ioctl structures - - * zaptel.h, zaptel-base.c: expose the limit for echocan params so - programs will know what to expect - -2008-01-02 20:35 +0000 [r3592-3593] sruffell : - - * wctdm24xxp/GpakCust.c: Corrected unneeded return value. - - * wctdm24xxp/wctdm24xxp.h, wcte12xp/vpmadt032.c, wctdm24xxp/base.c, - wctdm24xxp/GpakCust.c: VPMADT032 stability changes for wctdm24xxp - and wcte12xp: - Remove double reads. - Wait for writes to - complete before starting reads. - Optimize reads of multi-word - register. - -2008-01-02 18:00 +0000 [r3589-3590] Kevin P. Fleming - - * zaptel.h: allow longer parameter names - - * mec.h (removed), kb1ec.h, mec2.h (removed), mec3.h (removed), - Makefile, sec-2.h, mec3-float.h (removed), sec.h, mec2_const.h - (removed), hpec/hpec_zaptel.h, mg2ec.h, zaptel.h, zconfig.h, - zaptel-base.c: bring back the echocan-params code that was - removed in r3545, this time with a small change made to ensure - backwards compatibility with existing applications at both the - binary and source code level - -2008-01-02 15:20 +0000 [r3586] sruffell : - - * wctdm24xxp/base.c, wcte12xp/base.c: Move the release of VPMADT032 - resources to after the interrupt handler has been freed. Closes a - small window of opportunity for NULL pointer access at driver - unload time. - -2007-12-31 13:32 +0000 [r3584] Tzafrir Cohen - - * build_tools/test_kernel_git: Allow passing an arbitrary parameter - to the build command. - -2007-12-30 09:20 +0000 [r3569-3582] Tzafrir Cohen - - * build_tools/test_kernel_git: * git-reset --hard instead of - git-checkout (Paolo Ornati). * "update" command to pull an update - from upstream repo. - - * build_tools/test_kernel_git: The script now will not require - unnecessary parameters: it saves them in - build_tools/git_test.conf - - * /, ztd-eth.c: Adapt ztd-eth to newer interfaces from kernel - 2.6.24 . Merged from branches/1.2 rev. 3577 . - - * ztdynamic.c: Add CAS to channel capabilities of ztdynamic (Patch - by brettcar). Closes issue #11445 . - - * build_tools/test_kernel_git (added): A script to build zaptel vs. - a kernel version from a git tree. This should help test building - vs. kernels in Linus's tree (as of 2.6.11). - - * live_zap: * modules now can take parameters from live.conf - (${module}_ARGS). * zapconf's settings are taken from live.conf . - * Added 'reload' for 'unload; load' . - - * xpp/utils/zconf/Zaptel/Chans.pm: Do detect the type of a wcfxo - channel. - -2007-12-27 20:35 +0000 [r3565-3566] Tzafrir Cohen - - * live_zap: * Some extra hooks to echo canceller modules. * Give - harware modules detection^guessing a chance. - - * /, xpp/README.Astribank: Update documentation. Mainly regarding - the PRI module. Merged revisions 3564 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-12-27 18:02 +0000 [r3561] sruffell : - - * wcte12xp/vpmadt032.c: Shouldn't destroy the workqueue with the - lock held. - -2007-12-24 21:48 +0000 [r3556] Tzafrir Cohen - - * xpp/utils/zconf/XppUtils.pm (removed), xpp/.version, - xpp/utils/xpp_sync, xpp/utils/zconf/Zaptel/Chans.pm, - xpp/utils/zconf/Zaptel/Utils.pm (added), /, xpp/README.Astribank, - xpp/utils/zconf/Zaptel/Span.pm, - xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, xpp/Changelog_xpp, - xpp/utils/zconf/Zaptel/Hardware/USB.pm, - xpp/utils/zconf/Zaptel/Hardware/PCI.pm, - xpp/utils/zconf/Zaptel/Xpp/Xbus.pm: * XppUtils.pm renamed - Zaptel::Utils.pm . * Some more documentation. Merged revisions - 3555 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-12-21 15:25 +0000 [r3552-3553] Kevin P. Fleming - - * wcte11xp.c, wct1xxp.c: fix a bug in wct1xxp (pointed out on - asterisk-dev) and a minor cleanup in wcte11xp.c - - * arith.h: coding guidelines cleanup - -2007-12-20 22:09 +0000 [r3550] sruffell : - - * wcte12xp/vpmadt032.c: Cleanup in case the firmware load from - userspace fails. - -2007-12-20 17:09 +0000 [r3548] Doug Bailey - - * arith.h: Add blackfin enhancement. Closes issue #0011283 - -2007-12-20 01:19 +0000 [r3545] Kevin P. Fleming - - * mec.h (added), kb1ec.h, mec2.h (added), mec3.h (added), Makefile, - sec-2.h, mec3-float.h (added), sec.h, mec2_const.h (added), - hpec/hpec_zaptel.h, mg2ec.h, zaptel.h, zconfig.h, zaptel-base.c: - revert the echocanparams code for now... it's not ready to be - used - -2007-12-19 22:48 +0000 [r3541] Tzafrir Cohen - - * xpp/.version, xpp/card_pri.c, /, xpp/utils/zconf/Zaptel/Span.pm, - xpp/Changelog_xpp, xpp/init_card_9_29, xpp/utils/genzaptelconf, - xpp/utils/zapconf: * A few more fixes to card_pri. * Do use - "crc4" for E1 by default when generating zaptel.conf . Merged - revisions 3540 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-12-19 20:05 +0000 [r3535] sruffell : - - * wcte12xp/vpmadt032.c, wctdm24xxp/GpakCust.c: Improve wctdm24xxp - and wcte12xp drivers' tolerance to host system latencies. - -2007-12-19 19:39 +0000 [r3529] Jason Parker - - * zaptel.init: You need a space after [, since [ is an application - -2007-12-19 19:34 +0000 [r3528] Russell Bryant - - * Makefile, makeopts.in: There is an architectural issue with the - way menuselect works in zaptel. If the menuselect.makeopts file - gets automatically created when running make, then the Makefile - does not get the contents of that file included. The bug exposed - itself where libnewt was not found, but we tried to build it - anyway. This hack prevents that from happening, but the larger - issue needs to be addressed. It can be fixed once the actual - building of the modules and userspace tools are done by sub - Makefiles ... (closes issue #11199) Reported by: dimas Patches: - newt_select_makefile.diff uploaded by tzafrir (license 46) - -2007-12-19 06:45 +0000 [r3516-3526] Kevin P. Fleming - - * hpec/hpec_zaptel.h, zaptel-base.c: eliminate a compiler warning - and restore the ability to use HPEC (without parameters for now) - - * mec.h (removed), kb1ec.h, mec2.h (removed), mec3.h (removed), - Makefile, sec-2.h, mec3-float.h (removed), sec.h, mec2_const.h - (removed), mg2ec.h, zaptel.h, zconfig.h, zaptel-base.c: add - ability to provide parameters to echo cancelers on a per-channel - basis, and remove the three versions of the 'Mark' echo canceler - (later replaced by KB1 and then by MG2) - - * zaptel-base.c: even though it's not very logical, having a 'next - sample' number of zero for a sample is valid, so restore the - ability to set one - -2007-12-18 18:00 +0000 [r3515] Tzafrir Cohen - - * /, zaptel.sysconfig: Enable xpp_usb in the sysconfig file as xpp - no longer generates many interrupts when there's no hardware - connected. Merged revisions 3514 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-12-18 17:23 +0000 [r3513] Kevin P. Fleming - - * /: remove some accidentally merged properties - -2007-12-18 16:36 +0000 [r3501-3511] Tzafrir Cohen - - * /: Block r3509 from 1.4 . - - * xpp/xpp_zap.c, xpp/utils/hexfile.c, xpp/README.metering - (removed), xpp/utils/xpp_fxloader.usermap, - xpp/firmwares/FPGA_1151.hex, xpp/xpp_zap.h, xpp/xproto.c, - xpp/Changelog_xpp, xpp/utils/example_default_zaptel, - xpp/firmwares/FPGA_FXS.hex, xpp/xpd.h, xpp/xproto.h, - xpp/utils/zconf/Zaptel/Chans.pm, xpp/utils/xpp_blink, - xpp/card_bri.c, xpp/xbus-core.c, xpp/utils/zconf/Zaptel.pm, - xpp/utils/test_parse.c, xpp/utils/xpp_fxloader, - xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, xpp/utils/fpga_load.c, - xpp/xbus-core.h, xpp/xdefs.h, xpp/utils/zapconf, - xpp/utils/zconf/Zaptel/Hardware/PCI.pm, xpp/utils/xpp_sync, - xpp/.version, xpp/card_pri.c, xpp/firmwares/FPGA_1141.hex, - xpp/card_fxo.c, xpp/xframe_queue.c (added), xpp/xbus-sysfs.c, - xpp/Kbuild, xpp/README.Astribank, xpp/card_fxs.c, - xpp/card_global.c, xpp/card_fxo.h, xpp/xframe_queue.h (added), - xpp/utils/zaptel_hardware, xpp/xbus-pcm.c (added), - xpp/utils/zconf/Zaptel/Hardware/USB.pm, xpp/card_global.h, - xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, xpp/utils/zconf/XppUtils.pm - (added), xpp/xbus-pcm.h (added), - xpp/utils/zconf/Zaptel/Hardware.pm, xpp/zap_debug.h, - xpp/utils/zt_registration, /, xpp/utils/zconf/Zaptel/Span.pm, - xpp/utils/zaptel_drivers, xpp/init_card_9_29, - xpp/utils/genzaptelconf, xpp/utils/zconf/Zaptel/Xpp.pm, - xpp/xpp_usb.c: xpp r5151: * xpd_pri: Basically ready. * PCM - synchronization changes: - Each Astribank unit ticks - independently. Each with its own PLL. - HOST synchronization is - gone. Loading of xpp will no longer cause useless 250 ticks per - second if you have no Astribank. - Synchronization from the - zaptel sync master requires setting ZAPTEL as sync source - (xpp_sync ZAPTEL). * rx_tasklet is now a parameter of the module - xpp, rather than of xpp_usb. * New FPGA firmware: 5128 (1151) / - 5122 (1141, 1131): - Fixes synchronization issues. - PRI module: - E1 should now work. * perl module and utilities: - Modules no - longer magically scan system on initialization. - Scanning is by - calling explicit methods. - "Serial" has been renamed "Label". It - is basically unique, but should be modifieble. - Some basic - documentation of zaptel perl modules. * Default sort order of - zt_registration is back to SORT_CONNCTOR. * zt_registration proc - file now shows the number of span registered to if registered. - Try: grep . /proc/xpp/XBUS-*/XPD-*/zt_registration * - genzaptelconf: Allow using a custom command instead of - /etc/init.d/asterisk to start/stop asterisk. * Fixed the typo - "Slagish". Merged revisions 3506 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * wcfxo.c: Detect some extra X101P clones out there. - -2007-12-16 20:45 +0000 [r3494-3495] Tzafrir Cohen - - * Makefile: Make sure the asciidoc menu is deep enough. - - * /, build_tools/genudevrules: Simplify udev rules so they will be - in line with ones provided by distributions and allow simple - overriding of file permissions. Closes issue #11276 . Merged - revisions 3493 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-12-14 23:47 +0000 [r3490] Kevin P. Fleming - - * digits.h, Makefile, gendigits.c (removed), /, tonezone.c, - wcusb.c, zaptel.h, zonedata.c, tonezone.h, zaptel-base.c: - (merging dtmf-twister branch plus a few fixes) move DTMF/MF - generation into tonezone.c (libtonezone) so that it can happen at - runtime instead of compile time; this allows for DTMF/MF to be - different on a zone-by-zone basis without requiring a recompile - of Zaptel set DTMF 'twist' for Brazil (zone 'br') to 2dB - -2007-12-13 22:59 +0000 [r3476] Kevin P. Fleming - - * ppp/zaptel.c, /: Merged revisions 3475 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3475 - | kpfleming | 2007-12-13 16:59:16 -0600 (Thu, 13 Dec 2007) | 2 - lines remove some code that is not compatible with modern - versions of pppd ........ - -2007-12-13 Kevin P. Fleming - - * Zaptel 1.4.7.1 released - -2007-12-13 Kevin P. Fleming - - * wcte12xp.c: add new product support - -2007-11-27 Matthew Fredrickson - - * Zaptel 1.4.7 released. - -2007-11-22 00:29 +0000 [r3242-3245] Matthew Fredrickson - - * wct4xxp/base.c: Make sure that's disabled until I retest that - - * wctdm24xxp/wctdm24xxp.h, wctdm24xxp/base.c, /: Merged revisions - 3243 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3243 - | mattf | 2007-11-21 17:51:48 -0600 (Wed, 21 Nov 2007) | 1 line - Add new product support ........ - - * wctc4xxp/base.c, /: Merged revisions 3241 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3241 - | mattf | 2007-11-21 16:45:32 -0600 (Wed, 21 Nov 2007) | 1 line - Transcoder driver updates. Fixes G.723 no audio issues with - latest drivers ........ - -2007-11-14 15:22 +0000 [r3233] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/.version, xpp/utils/print_modes.c, - xpp/init_card_3_29, /, xpp/init_card_4_29, xpp/Changelog_xpp: xpp - r5010: * Fix a deadlock spotted on some SMP installations. * - Improve (reduce) signal attenuation on FXO ports. * Increase FXS - ring detect debounce interval. Merged revisions 3229-3232 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-11-11 01:22 +0000 [r3223-3226] Tzafrir Cohen - - * Makefile, tor2ee.c (removed): tor2ee doesn't build. Remove it. - Closes #10278. - - * /, ztmonitor.c: ztmonitor: Get rid of a pointless static buffer - and strcpy. And also give a more useful conversion message. - Merged revisions 3222 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-11-08 21:48 +0000 [r3221] Tilghman Lesher - - * zttool.c: Add dependency on newt Reported by: dimas Patch by: - tilghman Closes issue #11199 - -2007-11-07 20:18 +0000 [r3218-3220] Tzafrir Cohen - - * Makefile: Don't try to generate bindir and mandir if there are no - binaries to install (this causes an invalid install command). - - * build_tools: make_firmware_object is now generated. Ignore it. - - * xpp/utils/zconf/Zaptel/Chans.pm, /, xpp/utils/genzaptelconf, - xpp/utils/zconf/Zaptel/Hardware/PCI.pm: * zaptel-perl, - genzaptelconf: Detect and list Rhino cards. * zaptel-perl: Fix - reporting of empty slots in analog Digium cards. * genzaptelconf: - More readable case-s. Merged revisions 3217 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-11-06 21:14 +0000 [r3216] Matthew Fredrickson - - * wctdm24xxp/base.c, /: Merged revisions 3215 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3215 - | mattf | 2007-11-06 15:13:09 -0600 (Tue, 06 Nov 2007) | 1 line - Cross port fxo line voltage monitoring patch from wctdm to - wctdm24xxp ........ - -2007-11-03 16:23 +0000 [r3211] Matthew Fredrickson - - * firmware/Makefile, wctc4xxp/base.c: Major update for tc4xxp - driver. Fixes many outstanding issues related to channel lockups, - etc. It also raises the maximum channel count for g.729 to 120 - channels. - -2007-10-31 21:09 +0000 [r3206] Mark Michelson - - * sethdlc-new.c, /, sethdlc.c: Merged revisions 3205 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r3205 | mmichelson | 2007-10-31 16:08:15 -0500 (Wed, 31 Oct 2007) - | 5 lines Fixed potential buffer overflow. See AST-2007-024 for - more details ........ - -2007-10-31 13:10 +0000 [r3202] Tzafrir Cohen - - * /: Blocking merge of r3201 which is a backport from 1.4 . - -2007-10-28 18:26 +0000 [r3198] Tzafrir Cohen - - * firmware/Makefile, build_tools/make_firmware_object (removed), - configure, build_tools/make_firmware_object.in (added), - configure.ac: Firmware object file building does not depend - anymore on another object to be linked into the same module. That - dependency existed solely for checking target binary properties - in make_firmware_object . Those properties are now checked in - autoconf. - -2007-10-27 16:33 +0000 [r3195] Tzafrir Cohen - - * Makefile, configure, configure.ac, makeopts.in: Detect SELinux - support (for install target) in autoconf. Can be manually - overriden in configure or make. - -2007-10-26 15:36 +0000 [r3190] Tzafrir Cohen - - * ztdummy.c, wct4xxp/base.c, wcte11xp.c, wcte12xp.c, wctdm.c, - wctdm24xxp/base.c, tor2.c, zaptel-base.c: If you depend on - anything that is not in /usr/include/zaptel , you must build with - the local zaptel.h . Otherwise you may mix two versions of Zaptel - . - -2007-10-26 15:12 +0000 [r3189] Matthew Fredrickson - - * wctdm24xxp/base.c, /: Merged revisions 3188 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3188 - | mattf | 2007-10-26 10:08:37 -0500 (Fri, 26 Oct 2007) | 1 line - Another clock polarity update. To fix garbage audio on some - systems with the wctdm24xxp driver and VPMADT032 ........ - -2007-10-26 13:34 +0000 [r3185] Tzafrir Cohen - - * wcfxsusb.h (removed), Makefile, wcfxsusb.c (removed): Remove - obsolete drivers (replaced by wcusb). - -2007-10-18 22:56 +0000 [r3170] Jason Parker - - * wct4xxp/base.c, /: Merged revisions 3169 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3169 - | qwell | 2007-10-18 17:56:14 -0500 (Thu, 18 Oct 2007) | 4 lines - Correct the name of the wct4xxp driver. Issue 11030 ........ - -2007-10-18 Matthew Fredrickson - - * Zaptel 1.4.6 released. - -2007-10-18 20:53 +0000 [r3161] Matthew Fredrickson - - * wct4xxp/base.c: Make sure we only increment timingslips when - there actually are timing slips, instead of everytime we service - the framer - -2007-10-18 20:32 +0000 [r3154-3158] Tzafrir Cohen - - * xpp/utils/zconf/Zaptel/Chans.pm, /: Fix zaptel_hardware's - behaviour for unknown span types. Merged revisions 3157 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - - * xpp/.version, /, xpp/init_card_4_29, xpp/Makefile, - xpp/Changelog_xpp, xpp/utils/zconf/Zaptel/Hardware/USB.pm, - xpp/utils/zconf/Zaptel/Xpp.pm: * zaptel-perl should not panic - when there is no /proc/bus/usb (Closes #11020). * Don't build - metering by default for now. * And this is xpp rev 4900. * Make - opermode work again. Merged revisions 3152-3153 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-10-16 20:25 +0000 [r3143-3147] Tzafrir Cohen - - * README, /: Update README yet again. - - * xpp/xpp_zap.c, xpp/.version, xpp/card_pri.c, xpp/card_fxo.c, - xpp/firmwares/USB_FW.hex (added), xpp/card_fxs.c, - xpp/README.Astribank, xpp/utils/zaptel_hardware, xpp/xproto.c, - xpp/Changelog_xpp (added), xpp/firmwares/USB_1130.hex (removed), - xpp/utils/zconf/Zaptel/Hardware/USB.pm, - xpp/firmwares/USB_1140.hex (removed), - xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, xpp/xpd.h, xpp/xproto.h, - xpp/firmwares/USB_1150.hex (removed), - xpp/utils/zconf/Zaptel/Hardware.pm, xpp/ChangeLog (removed), - xpp/utils/zt_registration, xpp/xbus-core.c, /, - xpp/utils/xpp_fxloader, xpp/utils/zaptel_drivers (added), - xpp/utils/fpga_load.c, xpp/xdefs.h, - xpp/utils/zconf/Zaptel/Xpp.pm, - xpp/utils/zconf/Zaptel/Hardware/PCI.pm, xpp/xpp_usb.c: xpp r4892: - * Zaptel/Hardware perl modules: - Use sysfs directly. Don't rely - on lspci/lsusb. - Each device has a description and driver name. - - Zaptel::Hardware::drivers() to show the list of required - drivers for this system (see zaptel_drivers). - zaptel_hardware - shows a description and a (suggested?) driver. * zt_registration - sorts by Serial first and only then by connector. * USB_FW.hex - replaces all the USB_11x0.hex . - Separate USB interface for the - management processor. - Hence fpga_load can now work even with - drivers loaded. * Fix firmware upgrading. * Fix manual firmware - loading while auto-loading. Merged revisions 3142 via svnmerge - from http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-10-16 16:40 +0000 [r3139] Kevin P. Fleming - - * /: use latest Octasic API release - -2007-10-12 22:25 +0000 [r3133] Matthew Fredrickson - - * wctdm24xxp/base.c, /: Merged revisions 3132 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3132 - | mattf | 2007-10-12 17:19:58 -0500 (Fri, 12 Oct 2007) | 1 line - Fix for false power alarms, as well as a clock polarity issue - ........ - -2007-10-07 15:05 +0000 [r3121] Tzafrir Cohen - - * README: Update the links section (including an on-line HTML copy - of the README). - -2007-10-04 18:06 +0000 [r3113] Tzafrir Cohen - - * README, contrib (removed), /, build_tools/install_prereq - (removed), install_prereq (added): * install_prereq is not a - build script. Move it to main directory (which is our scripts - directory). * Don't run/print install command when there's - nothing to install. * Fix install_prereq command in README . - Merged revisions 3109-3112 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-10-03 17:05 +0000 [r3106] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/utils/hexfile.c, xpp/firmwares/FPGA_1151.hex, - xpp/utils/hexfile.h, xpp/xproto.c, xpp/firmwares/FPGA_FXS.hex, - xpp/xproto.h, xpp/xpd.h, xpp/ChangeLog, xpp/xbus-core.c, - xpp/init_card_4_28 (removed), xpp/init_card_4_29 (added), - xpp/init_card_6_28 (removed), xpp/init_card_6_29 (added), - xpp/utils/fpga_load.c, xpp/xdefs.h, xpp/utils/zapconf, - xpp/.version, xpp/firmwares/FPGA_1141.hex, xpp/card_fxo.c, - xpp/xbus-sysfs.c, xpp/utils/zaptel_hardware, xpp/utils/Makefile, - xpp/init_card_3_28 (removed), xpp/utils/zt_registration, - xpp/init_card_3_29 (added), /, xpp/init_card_7_28 (removed), - xpp/init_card_7_29 (added), xpp/init_card_9_28 (removed), - xpp/init_card_9_29 (added), xpp/utils/genzaptelconf, - xpp/utils/zconf/Zaptel/Xpp.pm, xpp/xpp_usb.c: New xpp release: - r4786: * New firmware protocol version: 2.9 . * fpga_load: - initial clean-ups before interface split. * genzaptelconf: Don't - leave an empty directory behind (4784) * Increase xpp - poll_timeout to 1000ms - useful for CentOS 4 (r4781). * Fix - initialization anoyance: if AB don't answer to polls, don't - waitfor_xpds, and show no waiting XPDs (r4725). * Disable - dtmf_detect by default once again (r4712). * Don't check twice - for asterisk to stop. The second test was done while Asterisk was - still stopping (r4708). * Support building the kernel with M= - instead of with SUBDIRS= , as used in some newer build systems - (r4677). Merged revisions 3105 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-10-01 08:21 +0000 [r3100] Tzafrir Cohen - - * /: No need to met those to changes back into 1.4 . - -2007-09-29 01:57 +0000 [r3097] Tzafrir Cohen - - * README: * Document the usage of ./configure . * spacing. - -2007-09-26 20:11 +0000 [r3094] Tilghman Lesher - - * contrib/scripts/install_prereq (added), contrib (added), - contrib/scripts (added): Add a script to load package - prerequisites (closes issue #10523) - -2007-09-23 00:53 +0000 [r3087-3090] Tzafrir Cohen - - * zaptel.init: Ignore errors from fxotune -s. The channel can be - used e.g. if Asterisk is already running. - - * xpp/ChangeLog, /, xpp/card_fxs.c: Re-disable dtmf_detection of - the FXS module (From xpp rev 4712). Merged revisions 3084 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-09-22 20:18 +0000 [r3079-3082] Matthew Fredrickson - - * wct4xxp/base.c: Make some improvements in how we do event - retrieval - - * wct4xxp/base.c: Disable that for now (DTMF detection) - -2007-09-22 08:07 +0000 [r3070-3076] Tzafrir Cohen - - * Makefile.kernel26: Makefile Automatically enabling Zaptel MMX - support. Disabled by default for now. * To enable, build with - ZAPTEL_MMX_AUTO=yes (or any other non-empty value) * There is a - white list of configuration values (without the prefix CONFIG_). - One of them needs to be set in order for CONFIG_ZAPTEL_MMX to be - enabled. * Only adds support for kernel 2.6 . If anybody finds a - simple way to do the same with 2.4 - patches are welcomes. - - * ztdummy.c: Sort out print messages in ztdummy: * Proper priority - to every message. * Remove a useless global. - - * zaptel.init: fxotune must be run after ztcfg. - -2007-09-20 18:42 +0000 [r3067] Jason Parker - - * Makefile: Remove DESTDIR from CONFIG_FILE, since we don't want - DESTDIR passed in as part of the -DZAPTEL_CONFIG. Closes issue - #10764, pointed out by cabal95 - -2007-09-20 16:52 +0000 [r3064] Matthew Fredrickson - - * wctdm24xxp/base.c: Disable native bridging pending resolving of - some issues - -2007-09-19 11:13 +0000 [r3061] Tzafrir Cohen - - * ztcfg.c: Clarify that ztcfg prints the channel map before - actually configuring channels. - -2007-09-18 10:21 +0000 [r3051-3056] Tzafrir Cohen - - * /, xpp/Makefile: Support building the kernel with M= instead of - with SUBDIRS= , as used in some newer build systems. From xpp - r4677. Merged revisions 3055 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * zaptel-base.c: Give proper type for printk messages. - - * zaptel-base.c: Fix the ioctl ZT_CHANDIAG and enable it by - default. (Backport changeset 2384 from trunk) - -2007-09-17 19:32 +0000 [r3048] Tilghman Lesher - - * zaptel.h, zaptel-base.c: Revert previous change on spaninfo and - institute an ABI compatible call, to avoid breaking zaptel ABI - compatibility between releases (closes issue #10745) - -2007-09-16 14:55 +0000 [r3044-3045] Tzafrir Cohen - - * fxotune.c, zaptel.init: * Run fxotune automatically on startup. * - Make fxotune -s less verbose by default so it won't make noise - for the init.d script. - - * ztdummy.c, README: * Document ztdummy changes. * It's a (ztdummy) - clock source, not ztdummy type. - -2007-09-15 20:40 +0000 [r3041] Matthew Fredrickson - - * ztcfg.c: Remove silly CAS signalling conflicts... patch - -2007-09-15 20:21 +0000 [r3020-3038] Tzafrir Cohen - - * ztdummy.c: Include support for high-resolution timers for linux - >= 2.6.22 (#10314). Changes from the patch: * Only support - kernels >= 2.6.22, as hrtimer_forward is only exported as of that - version. * Adapted to my recent changes in ztdummy.c . * Use - ZAPTEL_TIME_NS instead of ZAPTEL_RATE * Simplified ticks debug - statement. Will only be used if debug=2 or debug=3 . - - * ztdummy.c: Include the type of the ztdummy module in the desc - (span description) filed. To check what type of module you built, - use: strings ztdummy.ko | grep type tr '%' '\n' - - * zaptel.init: No need for a duplicate list of modules. - - * /, zaptel.init, zaptel.sysconfig: The order of modules load - counts, if you have multiple cards. Merged revisions 3015 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-09-13 21:33 +0000 [r3014] Joshua Colp - - * /, zaptel.init, zaptel.sysconfig: Merged revisions 3013 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - ........ r3013 | file | 2007-09-13 18:31:30 -0300 (Thu, 13 Sep - 2007) | 2 lines Add TE120P to init script. ........ - -2007-09-11 18:10 +0000 [r3011-3012] Russell Bryant - - * wctdm24xxp/wctdm24xxp.h, wctdm24xxp/base.c: After committing the - patch to make ringdebounce a module parameter in wctdm, I went - ahead and made the same change to wctdm24xxp. *** Note that there - is a discrepancy here. wctdm uses 64 ms as the default ring - debounce value while this module uses 128 ms. I'm not sure which - one is more appropriate, but they should certainly default to the - same thing. - - * wctdm.c: Make ringdebounce a module parameter (closes issue - #10218, pnlarsson - -2007-09-09 23:42 +0000 [r3006-3008] Tzafrir Cohen - - * zaptel.sysconfig: Also probe for wcte12xp by default (before - wcte11xp). - - * xpp/.version, xpp/utils/xpp_sync, xpp/card_pri.c (added), - xpp/firmwares/FPGA_1141.hex, xpp/firmwares/FPGA_1151.hex, - xpp/README.metering, xpp/card_pri.h (added), - xpp/README.Astribank, xpp/Makefile, xpp/utils/Makefile, - xpp/utils/example_default_zaptel (added), - xpp/firmwares/FPGA_FXS.hex, xpp/xpd.h, xpp/xproto.h, - xpp/init_card_4_26, xpp/ChangeLog, /, xpp/init_card_9_26 (added), - xpp/utils/genzaptelconf, xpp/utils/zapconf, xpp/utils: xpp.r4584: - * New firmware to fix FXS leds irregularities. * Less noise at - build time - don't echo version, test compile only once. * - zapconf can generate users.conf snippets. * xpd_pri: initial - version. * ignore perlcheck. Merged revisions 3004-3005 via - svnmerge from http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-09-08 12:08 +0000 [r2995-2999] Tzafrir Cohen - - * Makefile, configure, configure.ac, makeopts.in: * Let autoconf - figure out the switches for asciidoc. * Remove some leftover set - -x from previous debug... - - * Makefile, /, xpp: Allow overriding the asciidoc command. This - allows using asciidoc < 7. Merged revisions 2997 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * zttest.c: * Improve accuracy of zttest by using floats (#10312). - * Account only for the time of actually waiting for the clock. * - Clarify message for zttest -v . * Don't print some digits that - are not meaningful enough. - -2007-09-04 16:16 +0000 [r2992] Tzafrir Cohen - - * zaptel-base.c: Fixing the ZAPTEL_SYNC_TICK patch for - zaptel-base.c (#9645) - -2007-09-04 14:09 +0000 [r2991] Joshua Colp - - * zaptel.h: (closes issue #10087) Reported by: Matti Remove comment - that is no longer true. -1 will not cause the name to be used. - -2007-09-01 03:32 +0000 [r2990] Tzafrir Cohen - - * ppp/Makefile, README, ppp, /, configure, configure.ac, - makeopts.in: * Maintain the same meaning of DESTDIR and - INSTALL_PREFIX as in main Makefile * Document ppp support to the - best of my knowledge. * Err clearly if the VERSION was not found. - * Add some basic/broken detection of ppp in autoconf. Merged - revisions 2987 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-31 15:56 +0000 [r2988] Jason Parker - - * Makefile: CONFIG_FILE already has DESTDIR prepend to it. It is - not needed here. Issue 10619, patch by djflux - -2007-08-30 22:47 +0000 [r2986] Tilghman Lesher - - * zaptel.h, zaptel-base.c: Add two fields to the spanconfig struct - (at the bottom, as suggested by tzafrir), with a define to let - modules know that it's there - -2007-08-30 21:53 +0000 [r2984-2985] Kevin P. Fleming - - * ppp/Makefile, ppp (added), ppp/zaptel.c, /: Merged revisions 2983 - via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2983 - | kpfleming | 2007-08-30 16:48:55 -0500 (Thu, 30 Aug 2007) | 2 - lines add a proper plugin for Zaptel support in pppd, so that it - can be used with any distro-supplied version of pppd instead of - requiring a patched copy from the Digium download site ........ - - * wct4xxp/base.c: don't know how this was missed when i upgraded - the interrupt flags before... - -2007-08-30 17:18 +0000 [r2977-2980] Russell Bryant - - * wctdm24xxp/base.c: remove an unnecessary memset of the global - ifaces array on module init - - * wctdm.c: Remove some code that could never be executed. Instead - of fixing the if statement, I just removed it. The contents of - this global array are guaranteed to be zeroed out for us on load. - -2007-08-28 18:48 +0000 [r2971-2972] Matthew Fredrickson - - * patlooptest.c: Revert the patlooptest changes - - * Makefile, patlooptest.c: Make sure the target name is not the - same as the directory name. Thanks Josh :-) - -2007-08-28 17:53 +0000 [r2967-2969] Russell Bryant - - * zonedata.c: fix index for ru tones. Thanks to Malcolm for - pointing this out. - - * zonedata.c: Add Russian tones. (issue #7953, hanabana) - -2007-08-27 21:42 +0000 [r2963] Jason Parker - - * Makefile, /: Merged revisions 2962 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2962 - | qwell | 2007-08-27 16:38:48 -0500 (Mon, 27 Aug 2007) | 3 lines - Make sure we build the static version of libtonezone (and as a - side-effect, all of the programs) with -fPIC ........ - -2007-08-27 07:15 +0000 [r2952-2961] Tzafrir Cohen - - * Makefile, /: Enact the init.d script when not installing to a - DESTDIR. Merged revisions 2960 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - - * xpp/Makefile: Reduce the noise when building xpp/ . - - * Makefile: * Skip cleaning modules if KSRC is not defined: it is - optional if you build userspace alone ("make programs"). * Pass - HOTPLUG_FIRMWARE explicitly to kernel 2.6 makefile. This is to - help eventually remove .EXPORT_ALL_VARIABLES from Makefile. - - * Makefile: What is -O4 anyway? - - * Makefile: Allow 'make clean' to work without a valid KSRC (for - those building just 'programs'). - - * zaptel.sysconfig: In theory there should be no editing of the - init.d script needed. So document how we can configure it without - editing. - - * zaptel.init: zaptel.init: Allow passing extra arguments (e.g.: -c - conffig) to ztcfg. - - * zconfig.h: Enable the sync tick patch. - - * Makefile: Do install the hdlc network interface script. - -2007-08-24 20:47 +0000 [r2950] Jason Parker - - * /, Makefile.kernel26: Merged revisions 2949 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 (closes issue - #10555) ........ r2949 | qwell | 2007-08-24 15:46:20 -0500 (Fri, - 24 Aug 2007) | 4 lines Fix an issue that caused only MG2 and - possibly HPEC to work. Issue 10555, patch by me. ........ - -2007-08-24 19:41 +0000 [r2946-2948] Matthew Fredrickson - - * wct4xxp/base.c: Let's not exclusive framer interrupts by default - - * zaptel-base.c: More backport code - - * wct4xxp/base.c, zaptel.h, wct4xxp/wct4xxp.h: Beginning backport - of trunk to 1.4 - -2007-08-23 16:42 +0000 [r2941] Matthew Fredrickson - - * wctdm.c, wctdm24xxp/base.c, /: Merged revisions 2940 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r2940 | mattf | 2007-08-23 11:41:36 -0500 (Thu, 23 Aug 2007) | 1 - line Increase CWCID reliability on analog modules significantly. - (although if you have problems with pulse dialing on high REN - loads, see the comment to revert the value back to its previous - value). Thanks Kinsey and Rick. ........ - -2007-08-22 21:02 +0000 [r2934-2937] Jason Parker - - * /, zaptel-base.c: Merged revisions 2936 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2936 - | qwell | 2007-08-22 16:01:14 -0500 (Wed, 22 Aug 2007) | 6 lines - Don't try to create devices 250 and above in udev. Closes issue - 10522, fix found by me (but I'm not going to take credit for the - code, since it already existed in trunk for some reason) ........ - - * Makefile: Reverse logic which checks for existing zaptel.conf - Issue 10527, reported by arcivanov. - -2007-08-21 Matthew Fredrickson - - * Zaptel 1.4.5.1 released. - -2007-08-21 18:42 +0000 [r2922-2924] Matthew Fredrickson - - * wctdm24xxp/GpakCust.h, wctdm24xxp/wctdm24xxp.h, - wctdm24xxp/base.c, /, wctdm24xxp/GpakCust.c: Merged revisions - 2923 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2923 - | mattf | 2007-08-21 13:40:23 -0500 (Tue, 21 Aug 2007) | 1 line - Allow wctdm24xxp to compile on a 2.4 based kernel ........ - - * Makefile: Add some 2.4 Makefile trickery for wctdm24xxp - -2007-08-21 16:49 +0000 [r2920] Tzafrir Cohen - - * xpp/xbus-core.c, /: Fix building on kernel 2.6.23rc1, from Axel - Thimm (xpp r4523). Merged revisions 2919 via svnmerge from - http://svn.digium.com/svn/zaptel/branches/1.2 - -2007-08-21 15:02 +0000 [r2917] Russell Bryant - - * firmware/Makefile: change ftp to downloads - -2007-08-21 08:21 +0000 [r2911-2915] Tzafrir Cohen - - * fxotune.c, /: * Add an explicit mode to the callto open (the - default one that is used anyway). * Clarify error message. closes - #10505 on Zaptel 1.4. Merged revisions 2914 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * /, zaptel.init: * Set maximal zaptel udev timeout to 20 seconds. - * Allow overriding it from cwrcconfconfig file (and explain how). - (From trunk r2909 - got accidentally commited there first). - Merged revisions 2910 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-19 12:12 +0000 [r2905-2907] Tzafrir Cohen - - * /, xpp/README.Astribank: Fix README.Astribank with asciidoc - 8.2.2: make "underlining" more strict. (xpp r4519) Merged - revisions 2906 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * Makefile, /: * Fix Makefile typo in 'install-progrms:' (Thanks, - Mark Purcell). * Rename the generated xpp/README.html to - xpp/README.Astribank.html to provide a unique basename among docs - (helps debian packaging). - -2007-08-17 Matthew Fredrickson - - * Zaptel 1.4.5 released. - -2007-08-17 18:13 +0000 [r2866-2881] Tzafrir Cohen - - * /, build_tools/install_prereq: install_prereq: Don't install - packages twice. Merged revisions 2880 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * /: An 1.2-specific fix. - - * Makefile, README, /: * programs and install-programs are now for - all of userspace. Added the target 'utils' for what 'programs' - used to be. * tonezone.h is installed with install-libs, not - install-include . * Document this. * Document some other - variations on 'make' and 'make install'. * Improve documentation - of /proc/zaptel . * Ignoring some more utilities. - - * /: No need to merge those changes - the implementation in 1.4 is - different. - - * Makefile, makeopts.in: Get LDFLAGS and CFLAGS from autoconf. Make - sure that they get everywhere. - - * Makefile: Build menuselect with the HOSTCC. - - * xpp/xpp_zap.c, xpp/.version, - xpp/utils/zconf/Zaptel/Config/Defaults.pm, xpp/card_fxo.c, - xpp/xbus-sysfs.c, xpp/xpp_zap.h, xpp/card_global.c, - xpp/card_fxs.c, xpp/README.Astribank, xpp/xproto.c, xpp/xpd.h, - xpp/card_bri.c, xpp/zap_debug.h, xpp/ChangeLog, xpp/xbus-core.c, - /, zaptel.sysconfig, xpp/utils/genzaptelconf, xpp/xpp_usb.c: xpp - rev. 4515: * BRI improvement: an 'nt_keepalive' parameter to - xpd_bri forces a BRI_NT to retry a connection indefinitely (this - is our default). When false it revert to the behaviour in - changeset:4415 ("Bezeq like") * Improvement in DBG macros. The - print_dbg parameter is now set of flags to debug. They are - defined in zap_debug.h * Don't use Astribanks connected to USB1 - interfaces Unless the user set the option usb1=1 for xpp_usb - (r4504). * And some more documentation... * Include some of our - variables in the default zaptel sample file. Merged revisions - 2860 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-16 20:48 +0000 [r2858-2865] Matthew Fredrickson - - * wcte12xp.c, /: Merged revisions 2864 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2864 - | mattf | 2007-08-16 15:47:46 -0500 (Thu, 16 Aug 2007) | 1 line - Make sure we enable MRM ........ - - * /, wctdm24xxp/GpakApi.c: Merged revisions 2861 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2861 - | mattf | 2007-08-16 15:10:03 -0500 (Thu, 16 Aug 2007) | 1 line - Remove some unused variables from compilation ........ - - * wcte12xp.c, wctdm24xxp/base.c, /: Merged revisions 2857 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - ........ r2857 | mattf | 2007-08-16 15:02:58 -0500 (Thu, 16 Aug - 2007) | 1 line Fix for when voicebus based cards stop taking - interrupts on some systems ........ - -2007-08-16 18:39 +0000 [r2855] Tzafrir Cohen - - * Makefile, /, xpp: * Add a rule for generating xpp/README.html - (not used by default). * Ignore it, and clean it and README.html - . Merged revisions 2850 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-16 17:05 +0000 [r2853] Matthew Fredrickson - - * wctdm24xxp/base.c, /: Merged revisions 2852 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2852 - | mattf | 2007-08-16 12:01:18 -0500 (Thu, 16 Aug 2007) | 1 line - Make sure the gain adjustment is only done if the VPM100M is - present ........ - -2007-08-16 13:32 +0000 [r2849] Tzafrir Cohen - - * Makefile: Break install target, as in 1.2: * Provide separate - programs and libs targets , and provide separate - install-programs, install-libs , install-includes and - install-modules. * DESTDIR should work. INSTALL_PREFIX was - removed, as it was ambigious. Use the vaiable 'prefix' to - override /usr . * Print a message at the end of the install - target. * Convert shell logic in targets to make logic. * Still - not sure install-libs and install-includes are really needed. * - Use includedir, mandir and libdir (but not sbindir) from - configure. * Install Man pages and utils according to those - selected by the user. - -2007-08-15 22:12 +0000 [r2842-2847] Matthew Fredrickson - - * ztdynamic.c: Fix for 8277. Inproper alarm handling on dynamic - spans - - * Makefile: Make sure that the URL is REALLY up to date - - * Makefile: Make sure we use the new ftp.digium.com - -2007-08-15 14:26 +0000 [r2833-2839] Tzafrir Cohen - - * Makefile, README, /, Makefile.kernel26, zconfig.h: * Allow - setting the echo canceller from the Makefile or the environment - (needed for overriding the default EC in Debian m-a builds) * - Allow specifiying extra modules in the make command line: - MODULES_EXTRA and SUBDIRS_EXTRA Merged revisions 2838 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * /, Makefile.kernel26: Fix building on older CentOS 4 and Trixbox. - Merged revisions 2836 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - - * xpp/.version, xpp/ChangeLog, /, xpp/README.Astribank, - xpp/card_fxs.c, xpp/xproto.c: Merging a few small changes Xorcom: - * Marked with no. 4416, to note that major changes after 4415 - were note merged yet. * Demote the messages about PCM in non-PCM - from notice to debug (r4501). * Fix sample BRI zapata.conf: NT - instead of TE (r4498). * Disable FXS hardware DTMF detection by - default (r4492). Merged revisions 2832 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-10 21:58 +0000 [r2830] Matthew Fredrickson - - * wctdm24xxp/base.c, /: Merged revisions 2829 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2829 - | mattf | 2007-08-10 16:54:56 -0500 (Fri, 10 Aug 2007) | 1 line - Make sure we permit MRM commands ........ - -2007-08-06 20:31 +0000 [r2821-2824] Jason Parker - - * Makefile: Use host compiler to build gendigits Issue 10255, - initial patch by mirabilos, modified by me to work with 1.4. - - * zaptel.h: Include some headers from the target system rather than - the build system. Issue 10254, patch by mirabilos - -2007-08-05 12:31 +0000 [r2819] Tzafrir Cohen - - * /, xpp/utils/zconf/Zaptel/Hardware/PCI.pm: Extra Zaptel PCI IDs - (from Philipp Kempgen). From Xorcom r4466. Merged revisions 2818 - via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-01 22:41 +0000 [r2812] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/.version, xpp/firmwares/FPGA_1141.hex, - xpp/card_fxo.c, xpp/firmwares/FPGA_1151.hex, xpp/xpp_zap.h, - xpp/xbus-sysfs.c (added), xpp/card_fxs.c, xpp/xproto.c, - xpp/utils/Makefile, xpp/Makefile, xpp/firmwares/FPGA_FXS.hex, - xpp/card_global.h, xpp/xpd.h, xpp/xproto.h, xpp/zap_debug.h, - xpp/card_bri.c, xpp/ChangeLog, xpp/xbus-core.c, /, - xpp/utils/xpp_fxloader, xpp/xbus-core.h, xpp/utils/astribank_hook - (added), xpp/utils/xpp.rules, xpp/xpp_usb.c: xpp.r4415: * Show - Astribank 6+2 as 6/2 channels and not 8/8 channels. - Added as a - "subtype" to the device type (r4391). * Fixed a panic in BRI span - shutdown method (r4393). * Changes to debug macros. * Add proper - sysfs support (r4406) - A bus on whuch all of the Astribanks - reside. - Replaces useless sysfs code that existed in the module. - - Currently used to set the sync source automatically at device - adition / removal. * BRI: We do need the T1 timer in NT. If it - gets into G2 state (rr4407). Merged revisions 2811 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 - -2007-08-01 20:21 +0000 [r2809] Jason Parker - - * /, zaptel-base.c: Merged revisions 2808 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2808 - | qwell | 2007-08-01 15:21:04 -0500 (Wed, 01 Aug 2007) | 2 lines - Per Matt Fredrickson, we don't want to use GFP_KERNEL while - holding a spinlock. ........ - -2007-08-01 00:15 +0000 [r2806-2807] Jim Dixon - - * pciradio.c: Merged back in some changes I wasnt aware of - - * pciradio.c: Much newer and improved version of pciradio driver - -2007-07-30 17:23 +0000 [r2802] Jason Parker - - * /, hpec/hpec_zaptel.h: Merged revisions 2251 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2251 - | kpfleming | 2007-02-28 14:44:28 -0600 (Wed, 28 Feb 2007) | 2 - lines allow the HPEC to work even if echotraining has been - requested (the HPEC doesn't do echotraining, but it shouldn't - fail just because the user asked for it) ........ - -2007-07-29 00:39 +0000 [r2797] Tzafrir Cohen - - * /, wctdm24xxp, xpp/utils: * Ignore generated files on the new - wctdm24xxp dir. (from 1.2 r2796) * Ignore two extra man pages on - xpp/utils . - -2007-07-27 21:56 +0000 [r2790] Jason Parker - - * /: Blocked revisions 2789 via svnmerge ........ r2789 | qwell | - 2007-07-27 16:55:56 -0500 (Fri, 27 Jul 2007) | 3 lines Rearrange - and add some Makefile targets to be in line with the original - intentions of the addition of targets such as install-programs. - ........ - -2007-07-27 19:36 +0000 [r2782-2787] Matthew Fredrickson - - * fxotune.c: Quick fix for the could not fill input buffer problem - - * wctdm24xxp/base.c, /: Merged revisions 2781 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2781 - | mattf | 2007-07-27 14:02:28 -0500 (Fri, 27 Jul 2007) | 1 line - Minor message removal ........ - -2007-07-24 18:02 +0000 [r2776] Joshua Colp - - * firmware/Makefile, wctdm24xxp/VPMADT032.bin (removed), - wctdm24xxp/Makefile, wctdm24xxp/Makefile.kernel26: Add support - for building the firmware for the wctdm24xxp driver as an object - using the new firmware system. - -2007-07-22 17:46 +0000 [r2772] Tzafrir Cohen - - * Makefile: Revert initd config file installation to the greeddy - one of before zaptel 1.2.19/1.4.4 - install on both - /etc/default/zaptel and /etc/sysconfig/zaptel . Closes 0010257 . - (From branches/1.2 r2771) - -2007-07-20 22:57 +0000 [r2762-2769] Matthew Fredrickson - - * firmware/Makefile, wctdm24xxp/base.c, firmware/firmware.xml: Make - sure we use the new firmware interface - - * wctdm24xxp/base.c, /: Merged revisions 2765 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2765 - | mattf | 2007-07-20 14:17:25 -0500 (Fri, 20 Jul 2007) | 1 line - Add new 2.6.22 api updates ........ - - * Makefile, wctdm24xxp/base.c, wctdm24xxp/GpakApi.c, - wctdm24xxp/gpakenum.h, wctdm24xxp (added), wctdm24xxp/GpakApi.h, - wctdm24xxp/GpakCust.c, wctdm24xxp/Makefile.kernel26, - wctdm24xxp/gpakErrs.h, zaptel-base.c, wctdm24xxp/GpakCust.h, - wctdm24xxp/GpakHpi.h, wctdm24xxp/wctdm24xxp.h, /, - wctdm24xxp/Makefile, wctdm24xxp.c (removed): Merged revisions - 2761 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2761 - | mattf | 2007-07-20 11:19:47 -0500 (Fri, 20 Jul 2007) | 1 line - New product support, new echo canceler and new boards ........ - -2007-07-19 09:16 +0000 [r2759] Tzafrir Cohen - - * xpp/utils/Makefile: * Generate list of Zaptel Modules directories - automatically. * Evaluate PERLLIBDIR only once. Closes: #10223 - (Xorcom changeset:4379, from 1.2 r2758) - -2007-07-19 02:07 +0000 [r2753-2757] Kevin P. Fleming - - * ztdummy.c, pciradio.c, wct4xxp/base.c, wcte11xp.c, wcte12xp.c, - wct1xxp.c, wctc4xxp/base.c, wctdm.c, /, torisa.c, wctdm24xxp.c, - zaptel.h, tor2.c, wcfxo.c: Merged revisions 2756 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r2756 | kpfleming | 2007-07-18 21:05:03 -0500 (Wed, 18 Jul 2007) - | 2 lines update to 2.6.22 request_irq() flags ........ - - * wcte12xp.c, wctc4xxp/base.c, /, wctdm24xxp.c: Merged revisions - 2754 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2754 - | kpfleming | 2007-07-18 20:21:25 -0500 (Wed, 18 Jul 2007) | 2 - lines convert a few drivers over to current PCI module - registration function ........ - - * /, zaptel-base.c: Merged revisions 2752 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2752 - | kpfleming | 2007-07-18 20:02:53 -0500 (Wed, 18 Jul 2007) | 2 - lines don't try to timeslot-interchange channels that are being - bridged (DACS) if either channel has a txgain or rxgain - specified, since that gain won't be applied any longer if the - DACS is put into effect ........ - -2007-07-18 16:27 +0000 [r2751] Joshua Colp - - * /: Blocked revisions 2750 via svnmerge ........ r2750 | file | - 2007-07-18 13:27:04 -0300 (Wed, 18 Jul 2007) | 2 lines A - distribution may have multiple directories for firmware and - without knowing the proper one we have to copy the firmware into - each. We can't just copy it into the first one found. ........ - -2007-07-16 Russell Bryant - - * Zaptel 1.4.4 released. - -2007-07-16 13:14 +0000 [r2740] Tzafrir Cohen - - * zaptel.init: Simplify hpec_start and remove duplicates. - -2007-07-13 08:22 +0000 [r2733-2736] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/utils/zconf/Zaptel/Config/Defaults.pm, - xpp/firmwares/FPGA_1151.hex, xpp/README.metering (added), - xpp/xpp_zap.h, xpp/xproto.c, xpp/firmwares/FPGA_FXS.hex, - xpp/firmwares/USB_1130.hex, xpp/xpd.h, - xpp/firmwares/USB_1150.hex, xpp/xproto.h, - xpp/utils/zconf/Zaptel/Config (added), - xpp/utils/zconf/Zaptel/Chans.pm, xpp/utils/xpp_blink, - xpp/card_bri.c, xpp/ChangeLog, xpp/xbus-core.c, - xpp/utils/fpga_load.c, xpp/xbus-core.h, xpp/utils/lszaptel, - xpp/xdefs.h, xpp/utils/xpp.rules, xpp/utils/zapconf, - xpp/utils/zconf/Zaptel/Hardware/PCI.pm, xpp/utils/xpp_sync, - xpp/.version, xpp/firmwares/FPGA_1141.hex, xpp/card_fxo.c, - xpp/card_global.c, xpp/README.Astribank, xpp/card_fxs.c, - xpp/utils/zaptel_hardware, xpp/Makefile, xpp/utils/Makefile, - xpp/card_global.h, xpp/firmwares/USB_1140.hex, - xpp/init_card_3_26, xpp/utils/zconf/Zaptel/Hardware.pm, - xpp/utils/zt_registration, xpp/utils/zconf/Zaptel/Span.pm, - xpp/utils/genzaptelconf, xpp/xpp_usb.c: Merge xpp r4372: * Update - to zaptel-1.2.18 and zaptel-1.4.3 (r4308 onward) * Fix a critical - race with zaptel synchronization (r4362) * Added a /proc/xpp/cmds - for statistics about command timing (r4360) * Fix a digit mapping - bug with hardware dtmf detection (r4357) * In xpp/utils/Makefile - add perl syntax checks to our scripts (r4337) * Better USB data - error checking (r4336) * udev rules (xpp.rules) avoid false calls - from wrong nodes (r4331) * Improve hardware detection and - reporting in lszaptel, zaptel_hardware. zapconf is basically - functional. * Leds are blinked synchronously on all Astribanks - now (r4262) * Fix a BRI bug if OPTIMIZE_CHANMUTE was compiled - into zaptel (r4258) (This feature was not yet accepted into - official zaptel) * Removed compile warning about HZ != 1000 - (r4218) * Firmware updates. * fpga_load now supports USB pathes - without zeros (r4211) * XPD numbers have changed to - '' (r4196) * Proper support for ZT_VMWI ioctl, if - used in zaptel (r4092) * Fix FXO power denial detection (r4054) * - FXO could accidentally go off-hook with some compilers (r4048) - (From branches/1.2 r2732, r2735) - - * Makefile: * config target: Replace shell scriptary with makefile - logic. * config target: Add a helpful text for the Zaptel - installer. (From branches/1.2 r2729) - - * README, build_tools/install_prereq (added): Add a script to - install build requirements. This was after the instructions on - which kernel to install on CentOS became a manual script with - if-s and case-s. Should work on Debian and CentOS. (From - branches/1.2 r2728, r2730) - -2007-07-11 19:04 +0000 [r2726] Tzafrir Cohen - - * build_tools/genmodconf: * Use shell, rather than - shell-in-makefile syntax. * Supress ugly text when - /lib/modules/`uname -r` doesn't exist (but we build for a - different kernel) (From branches/1.2 r2724) - -2007-07-11 18:14 +0000 [r2718-2722] Jason Parker - - * README, /: Merged revisions 2721 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2721 - | qwell | 2007-07-11 13:14:11 -0500 (Wed, 11 Jul 2007) | 4 lines - tzafrir pointed out that this was put in the wrong place. Move it - so that asciidoc can properly parse it. ........ - - * README, /: Merged revisions 2717 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2717 - | qwell | 2007-07-11 12:24:21 -0500 (Wed, 11 Jul 2007) | 7 lines - On some systems, sudo does not automatically add the PATH for - root, so things like /sbin may not be in there, which means - chkconfig may not be found. Add a note stating this. Issue 10181. - ........ - -2007-07-11 13:08 +0000 [r2711-2714] Tzafrir Cohen - - * README: Fix the zaptel-perl install insturctions. - - * README.Linux26 (removed): Remove obsolete and inaccurate - README.Linux26 . - - * README, /, zaptel.init, xpp/utils/Makefile: * Enable zaptel-perl - and use perl utilities for Astribank init (from 1.2 r2710) * - Update README accordingly. * Continue documenting Zaptel, while - we're updating the README. * Ignore the generated README.html. - -2007-07-08 19:22 +0000 [r2706-2707] Tzafrir Cohen - - * README: Moving specific commands to a distro-specific part. - - * Makefile, README: * README fixes. * Add makefile target to - generate README.html from README with asciidoc. Note: At least - for now the ability to generate a nice extra HTML copy of the - text README is an extra feature. But the README file is meant to - be primarily read as a text file and will still be readable as - such till further notice. - -2007-07-06 23:24 +0000 [r2703] Tzafrir Cohen - - * README: Two more sections to the README. Though I'm not quite - happy with their style. - -2007-07-05 18:10 +0000 [r2697] Jason Parker - - * /, zaptel-base.c: Merged revisions 2696 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2696 - | qwell | 2007-07-05 13:08:53 -0500 (Thu, 05 Jul 2007) | 5 lines - Do not report channels in ZT_STATE_KEWL or ZT_STATE_AFTERKEWL - (ie; battery drop) states as available. This becomes more likely - if ZT_KEWLTIME or ZT_AFTERKEWLTIME are set to higher values. - Issue 7612, patch by rbraun. ........ - -2007-07-04 19:06 +0000 [r2688-2690] Tzafrir Cohen - - * zaptel.init: Bourne shell scripts should not use >& . dash - doesn't support it. And all of them simply supressed errors, so - they were replaced with 2> /dev/null . (from branches/1.2 r2689) - - * zaptel.init: Set default value for XPP_SYNC. - -2007-07-03 18:58 +0000 [r2684] Jason Parker - - * wctdm.c, /: Merged revisions 2683 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2683 - | qwell | 2007-07-03 13:57:42 -0500 (Tue, 03 Jul 2007) | 4 lines - Fix a potential issue with the reversepolarity module option in - wctdm. Issue 7191, patch by Thomas Andrews. ........ - -2007-07-03 16:46 +0000 [r2681] Matthew Fredrickson - - * wct4xxp/base.c, /: Merged revisions 2680 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2680 - | mattf | 2007-07-03 11:39:34 -0500 (Tue, 03 Jul 2007) | 1 line - Fix for span shutdown issue ........ - -2007-07-02 15:58 +0000 [r2676] Joshua Colp - - * /, ztd-eth.c: Merged revisions 2675 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2675 - | file | 2007-07-02 12:56:18 -0300 (Mon, 02 Jul 2007) | 2 lines - Add support for the 2.6.22 kernel. (issue #10095 reported by - Matti) ........ - -2007-07-02 15:07 +0000 [r2674] Tzafrir Cohen - - * zaptel.init: * Fix unloading of xpp modules. * Add optional - support for using the zaptel perl functions. (From branches/1.2 - changesset:2670 and changeset:2673) - -2007-07-02 13:46 +0000 [r2671] Joshua Colp - - * firmware/Makefile, wctc4xxp/tc400m-firmware.bin (removed), - wctc4xxp/base.c, wctc4xxp/Makefile.kernel26: Nobody ever updated - the wctc4xxp stuff to use the in-tree firmware management - stuff... 'tsk 'tsk. (issue #10093 reported by snuffy) - -2007-06-26 19:37 +0000 [r2669] Kevin P. Fleming - - * /: block fix that is not needed here (already present) - -2007-06-23 15:55 +0000 [r2664] Tzafrir Cohen - - * README: * Correct names for Digium cards. * Further removed - obsolete sections. * Section about the perl stuff added. - -2007-06-21 13:37 +0000 [r2657-2662] Tzafrir Cohen - - * README: A README that will actually help users a bit. - - * zaptel.init: * Remove ztcfg -s from shutdown. * Someone with a - dynamic span, please test the suggested replacement (remmed-out). - * Reduced nesting in wait_for_xpp . - - * zaptel.init: Reduce nesting in hpec startup by moving it to a - function. - - * zaptel.init: Fix a syntax error in hpec startup. - - * xpp/utils: Ignore some generated man pages. - -2007-06-12 14:50 +0000 [r2643-2645] John Sloan - - * wctc4xxp/base.c, /: Merged revisions 2644 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2644 - | jsloan | 2007-06-12 09:07:18 -0500 (Tue, 12 Jun 2007) | 1 line - Corrected test code ........ - - * wctc4xxp/base.c, /: Merged revisions 2642 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2642 - | jsloan | 2007-06-12 08:34:42 -0500 (Tue, 12 Jun 2007) | 1 line - Added new PCI device ID ........ - -2007-06-11 22:18 +0000 [r2639] Matthew Fredrickson - - * wct4xxp/base.c, /: Merged revisions 2638 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2638 - | mattf | 2007-06-11 17:17:14 -0500 (Mon, 11 Jun 2007) | 1 line - Add a couple of PCI ids ........ - -2007-06-11 22:12 +0000 [r2635] Jason Parker - - * genconst.c (removed): Remove a file from the tree that hasn't - been used in a very long time. The last time this file changed - was in revision 79. It is also not referenced anywhere in the - tree, and doesn't even compile... Issue 9923, reported by - tzafrir. - -2007-06-11 22:12 +0000 [r2634] Matthew Fredrickson - - * wct4xxp/base.c, /: Merged revisions 2633 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2633 - | mattf | 2007-06-11 17:10:59 -0500 (Mon, 11 Jun 2007) | 1 line - Make the version check optional ........ - -2007-06-11 15:55 +0000 [r2622] John Sloan - - * wctc4xxp/base.c, /: Merged revisions 2621 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2621 - | jsloan | 2007-06-11 10:47:37 -0500 (Mon, 11 Jun 2007) | 1 line - Fixed SMP bugs on quad processor machines. Reduced memory usage - ........ - -2007-06-09 23:55 +0000 [r2611-2612] Tzafrir Cohen - - * doc/ztmonitor.8, doc/zttool.8, doc/ztcfg.8: ó is non-printable on - non-UTF-8 locales. Replaced with \['o] to make lintian happy. - - * doc/fxstest.8 (added), doc/fxotune.8: * fxotune man page is - up-to-date for 1.4. * fxtest man page. - -2007-06-08 Russell Bryant - - * Zaptel 1.4.3 released. - -2007-06-08 15:58 +0000 [r2601] Russell Bryant - - * wct4xxp/base.c, /: Merged revisions 2599 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2599 - | russell | 2007-06-08 10:57:18 -0500 (Fri, 08 Jun 2007) | 1 line - Make sure the name is right ........ - -2007-06-08 15:37 +0000 [r2591-2597] Tzafrir Cohen - - * Makefile: Make the checkstack target basically work for kernel - 2.6. - - * xpp/card_fxo.c, xpp/utils/xpp_fxloader: Some XPP bugfixes: * Fix - FXO power denial detection (changeset:4054) * Incorrect data type - could cause FXO module to go off-hook (changeset:4048) * - xpp_fxloader: fix the error message when you want to disable * - automatic firmware loading... (changeset:4060) Merged from - branches/1.2 r2589 - -2007-06-07 17:02 +0000 [r2584] Russell Bryant - - * /: Blocked revisions 2583 via svnmerge ........ r2583 | russell | - 2007-06-07 12:01:04 -0500 (Thu, 07 Jun 2007) | 4 lines The -quit - option to find is not supported on the version of find installed - on Centos 4. Lame! Just remove it, as it isn't really necessary. - (issue #9800, noahisaac) ........ - -2007-06-06 13:47 +0000 [r2574] Matthew Fredrickson - - * wct4xxp/base.c: Add 220/420 support - -2007-06-01 17:06 +0000 [r2551] Matthew Fredrickson - - * wct4xxp/vpm450m.c, /: Merged revisions 2550 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2550 - | mattf | 2007-06-01 11:56:09 -0500 (Fri, 01 Jun 2007) | 2 lines - Fix for stack overflow on FC6 and VPM450M. ........ - -2007-05-18 15:50 +0000 [r2540] Matthew Fredrickson - - * /, zaptel-base.c: Merged revisions 2539 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2539 - | mattf | 2007-05-18 10:48:55 -0500 (Fri, 18 May 2007) | 2 lines - Remove silly got signal message ........ - -2007-05-17 21:47 +0000 [r2536] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/firmwares/FPGA_1151.hex, - xpp/utils/zconf/Zaptel/Hardware (added), - xpp/firmwares/FPGA_FXS.hex, xpp/xpd.h, - xpp/utils/zconf/Zaptel/Chans.pm, xpp/card_bri.c, xpp/ChangeLog, - xpp/xbus-core.c, xpp/init_card_6_26, xpp/utils/zconf/Zaptel.pm, - xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, xpp/utils/lszaptel, - xpp/utils/xpp.rules, xpp/utils/zapconf (added), - xpp/utils/zconf/Zaptel/Hardware/PCI.pm, xpp/utils/xpp_sync, - xpp/.version, xpp/firmwares/FPGA_1141.hex, xpp/README.Astribank, - xpp/card_global.c, xpp/utils/zaptel_hardware (added), - xpp/Makefile, xpp/utils/Makefile, xpp/parport_debug.c (added), - xpp/utils/zconf/Zaptel/Hardware/USB.pm, - xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, xpp/parport_debug.h (added), - xpp/utils/zconf/Zaptel/Hardware.pm (added), - xpp/utils/zt_registration, xpp/init_card_7_26, - xpp/utils/zconf/Zaptel/Span.pm, xpp/utils/genzaptelconf, - xpp/utils/zconf/Zaptel/Xpp.pm, xpp/xpp_usb.c: XPP revision 3965: - * Tested with zaptel-1.2.17.1 * Add D-Channel TX, RX and BAD - frames count in /proc/xpp/XBUS-*/XPD-*/bri_info * Adjust output - of xpp_sync script. Pad for 8 port BRI. * Added a debugging - module parport_debug (not compiled by default). * Added an - optional patch to zaptel: - compiles only if ZAPTEL_SYNC_TICK is - defined - Allow interested driver to register for "sync" - notification. - Does not affect drivers that do not use this - feature. * Added external synchronization feature: - Only if - ZAPTEL_SYNC_TICK feature is compiled in - Than XPP may be - synchronized by another card (e.g: an Astribank with FXS can be - synchronized by a Digium PRI card). - May be enabled/disabled in - runtime via the 'sync_tick_active' module parameter to the xpp.ko - module. * Fixed a potential bug in D-Channel hexdump printing. * - New visual indications in BRI leds: - Constant ON RED/GREEN: - Shows the port type -- NT/TE. - Very fast "double blink": Layer1 - work, no D-Channel yet. - Steady blinking (1/2 sec): D-Channel - trafic detected. * xpp_fxloader moved to /usr/share/zaptel . * - adj_clock removed: never really used. * Now we have - Zaptel::Hardware and a sample zaptel_hardware script (not - (installed by default). * We also have a sample perl zapconf (not - installed by default) which aims at replacing genzaptelconf (sans - the modules detection). - -2007-05-17 20:35 +0000 [r2532] Matthew Fredrickson - - * wct4xxp/vpm450m.c: Reduce stack usage of VPM450M. Fix for FC6 - module load problems - -2007-05-17 18:46 +0000 [r2527] Jason Parker - - * Makefile: Fix problem with chan_misdn not being built in - Asterisk, due to missing suppserv. Update to new tarballs from - misdn.org and allow versioning in Makefile. Issue 9064. - -2007-05-17 16:49 +0000 [r2524] Joshua Colp - - * fxotune.c: Allow the fxotune config file to be specified instead - of hardcoded. (issue #8444 reported by pupeno, patch by tzafrir) - -2007-05-17 14:27 +0000 [r2522] Tzafrir Cohen - - * xpp/Makefile: The debugfs code seems to have some bad sideeffects - when badly used. So don't enable it by default. (From chabgeset - 2520) - -2007-05-04 22:37 +0000 [r2495] Tzafrir Cohen - - * zaptel.init: zaptel.init: use automative modules unloading (as in - trunk and 1.2). - -2007-05-01 16:22 +0000 [r2483] Russell Bryant - - * /, zonedata.c: Merged revisions 2482 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2482 - | russell | 2007-05-01 11:20:50 -0500 (Tue, 01 May 2007) | 3 - lines Add zonedata information for the Philippines. (issue #9525, - reported and patched by loloski) ........ - -2007-04-30 23:07 +0000 [r2480] Kevin P. Fleming - - * zaptel.init: eliminate bogus warning message during script - startup with no HPEC licenses - -2007-04-29 22:12 +0000 [r2477] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/utils/hexfile.c, xpp/firmwares/FPGA_1151.hex, - xpp/xpp_zap.h, xpp/utils/hexfile.h, xpp/xproto.c, - xpp/firmwares/FPGA_FXS.hex, xpp/firmwares/USB_1130.hex, - xpp/xproto.h, xpp/firmwares/USB_1150.hex, xpp/xpd.h, - xpp/calibrate_slics, xpp/init_card_4_24 (removed), - xpp/utils/zconf/Zaptel/Chans.pm, xpp/init_card_6_24 (removed), - xpp/utils/xpp_blink (added), xpp/init_card_4_26 (added), - xpp/card_bri.c, xpp/ChangeLog (added), xpp/xbus-core.c, - xpp/init_card_6_26 (added), xpp/utils/zconf/Zaptel.pm, - xpp/utils/adj_clock.c (removed), - xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, xpp/utils/xpp_fxloader, - xpp/utils/fpga_load.c, xpp/utils/lszaptel, xpp/utils/xpp_sync, - xpp/.version, xpp/firmwares/FPGA_1141.hex, - xpp/utils/genzaptelconf.8, xpp/card_fxo.c, xpp/README.Astribank, - xpp/card_fxs.c, xpp/card_global.c, xpp/utils/Makefile, - xpp/utils/adj_clock.8 (removed), xpp/card_global.h, - xpp/firmwares/USB_1140.hex, xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, - xpp/utils/fpga_load.8, xpp/init_card_3_24 (removed), - xpp/init_card_3_26 (added), xpp/utils/zt_registration, - xpp/init_card_7_24 (removed), xpp/init_card_7_26 (added), - xpp/utils/zconf/Zaptel/Span.pm, xpp/utils/genzaptelconf, - xpp/utils/zconf/Zaptel/Xpp.pm, xpp/xpp_usb.c: xpp rev. 3814: * - Protocol no. 2.6: syncing improvements. * Support for 8-port - Astribank BRI. * Firmware unloading now works: rmmod xpp_usb; - /etc/hotplug/usb/xpp_fxloader reset * Defaults of kernel - parameters are now part of parameter description. * - World-readable kernel parameters. * No need for extra patch - beyond bristuff for Astribank BRI. * Default poll intervals - changed: 500 in BRI and FXO. * Allow changing FXS polls interval - at run time. * BRI initalization fixed on SUSE (path to logger). - * When using the SUSE zaptel rpm package, set - modules_var=ZAPTEL_MODULES in /etc/sysconfig/zaptel . * - zt_registration not verbose by default. * xpp_sync warns if FXO - is sync slave. * Fixed genzaptelconf -z (zapscan output - emulation). * PCM fixes. * Solves "multiple ticks" bug. No need - for pcm_tasklets workaround. - -2007-04-28 21:29 +0000 [r2465-2470] Matthew Fredrickson - - * wct4xxp/base.c, /: Merged revisions 2469 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2469 - | mattf | 2007-04-28 16:07:35 -0500 (Sat, 28 Apr 2007) | 1 line - Fix for potential deadlock in wct4xxp driver ........ - - * wcte11xp.c, /: Merged revisions 2464 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2464 - | mattf | 2007-04-28 14:04:50 -0500 (Sat, 28 Apr 2007) | 2 lines - Fix for potential deadlock in drivers ........ - -2007-04-27 19:06 +0000 [r2460] Jason Parker - - * /, ztmonitor.c: Merged revisions 2459 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2459 - | qwell | 2007-04-27 14:05:25 -0500 (Fri, 27 Apr 2007) | 2 lines - Correct and remove (one of each) broken syntax examples. ........ - -2007-04-25 16:32 +0000 [r2452] Matthew Fredrickson - - * wct1xxp.c, /: Merged revisions 2451 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2451 - | mattf | 2007-04-25 11:26:18 -0500 (Wed, 25 Apr 2007) | 1 line - Start fixing potential deadlock between device driver and zaptel - ........ - -2007-04-25 Russell Bryant - - * Zaptel 1.4.2.1 released. - -2007-04-25 15:36 +0000 [r2444] Jason Parker - - * /, zaptel-base.c: Merged revisions 2443 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2443 - | qwell | 2007-04-25 10:35:34 -0500 (Wed, 25 Apr 2007) | 2 lines - Don't try to reference a variable on a channel that may not - exist. ........ - -2007-04-24 Russell Bryant - - * Zaptel 1.4.2 released. - -2007-04-24 18:34 +0000 [r2433-2435] Jason Parker - - * /: Blocked revisions 2434 via svnmerge ........ r2434 | qwell | - 2007-04-24 13:33:29 -0500 (Tue, 24 Apr 2007) | 1 line Backport - pre-echocan debugging for ztmonitor ........ - - * zaptel.h, zconfig.h, ztmonitor.c, jpah.h (added), zaptel-base.c: - Merge in pre-echocan debugging for ztmonitor. - -2007-04-13 23:14 +0000 [r2423] Jason Parker - - * /, zaptel-base.c: Merged revisions 2422 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2422 - | qwell | 2007-04-13 18:12:23 -0500 (Fri, 13 Apr 2007) | 14 lines - Fix several places where we treat confmode as a bitmask. It is a - bitmask...sort of.. I'll explain.. confmode is used for 2 - different things. It defines both the "mode" and the "flags" of - the conference. The "mode" part is in 0x00FF and is NOT bitwise. - The "flag" part is in 0xFF00 and *IS* bitwise. Confused yet? - Good. So, when we want to check the "mode" of the conference, we - need to check only within 0xFF. There were several places where - this was not happening - but due to luck, it worked (...sort of). - That's what this patch fixes. ........ - -2007-04-11 19:03 +0000 [r2406] Matt Frederickson - - * /, zaptel-base.c: Merged revisions 2405 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2405 - | mattf | 2007-04-11 14:01:21 -0500 (Wed, 11 Apr 2007) | 4 lines - Fix buglet in memory corruption fix. ........ - -2007-04-07 16:47 +0000 [r2397] Matt Frederickson - - * zaptel-base.c: Fix for #9208. Memory corruption within zaptel - data. - -2007-03-30 21:03 +0000 [r2359] Matt Frederickson - - * zaptel-base.c: Fix potential spinlock recursion issue. - -2007-03-30 18:57 +0000 [r2354] Jason Parker - - * /, zaptel-base.c: Merged revisions 2353 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2353 - | qwell | 2007-03-30 13:56:46 -0500 (Fri, 30 Mar 2007) | 4 lines - Fix an issue where an echo can was freed incorrectly in certain - circumstances. Issue 9292, fix suggested by ddv2005. ........ - -2007-03-29 16:36 +0000 [r2348-2351] Russell Bryant - - * README.hpec, /, zaptel.init: Merged revisions 2350 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r2350 | russell | 2007-03-29 11:35:37 -0500 (Thu, 29 Mar 2007) | - 4 lines Trim the HPEC readme that is included in zaptel to only - include basic information as the one on the FTP site will always - be the one that contains the full up to date information. Also, - tweak some grammar in the additions to the init script. ........ - - * README.hpec (added), /, zaptel.init: Merged revisions 2347 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - ........ r2347 | russell | 2007-03-29 11:05:32 -0500 (Thu, 29 Mar - 2007) | 3 lines Add a README for HPEC, and add support for HPEC - in the init script. (issue #9413, chozian) ........ - -2007-03-27 18:49 +0000 [r2343] Russell Bryant - - * /, zaptel.init: Merged revisions 2342 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2342 - | russell | 2007-03-27 13:48:23 -0500 (Tue, 27 Mar 2007) | 5 - lines When debug is enabled, ensure that "debug=1" gets passed to - the zaptel module, and not just the hardware modules. Also, run - "ztcfg -s" at the beginning of the "stop" action of the script. - (issue #7409, PCadach and tzafrir) ........ - -2007-03-23 02:11 +0000 [r2336] Kevin P. Fleming - - * Makefile: fix builds for 2.4 kernels - -2007-03-22 Kevin P. Fleming - - * Zaptel 1.4.1 released. - -2007-03-23 02:11 +0000 [r2333-2336] Kevin P. Fleming - - * Makefile: fix builds for 2.4 kernels - - * mec.h, kb1ec.h, mec2.h, mec3.h, sec-2.h, sec.h, - hpec/hpec_zaptel.h, mg2ec.h, zaptel.h, zaptel-base.c: bring in - the rest of the support needed for HPEC - -2007-03-19 16:30 +0000 [r2323] Joshua Colp - - * /, README.Linux26: Merged revisions 2322 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2322 - | file | 2007-03-19 12:28:58 -0400 (Mon, 19 Mar 2007) | 2 lines - Update documentation to match current Makefile. linux26 is no - longer a valid target. (issue #9296 reported by valley) ........ - -2007-03-14 16:08 +0000 [r2308] Matt Frederickson - - * wct4xxp/base.c, /: Merged revisions 2307 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2307 - | mattf | 2007-03-14 10:03:18 -0600 (Wed, 14 Mar 2007) | 2 lines - Fix bug in J1 mode configuration. ........ - -2007-03-09 20:04 +0000 [r2302] Matt Frederickson - - * wct4xxp/vpm450m.c, /: Merged revisions 2301 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2301 - | mattf | 2007-03-09 13:59:43 -0600 (Fri, 09 Mar 2007) | 2 lines - Make sure we don't allocate as GFP_KERNEL in atomic context - ........ - -2007-03-08 15:58 +0000 [r2297] Joshua Colp - - * /, hpec/hpec_zaptel.h: Merged revisions 2296 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2296 - | file | 2007-03-08 10:56:05 -0500 (Thu, 08 Mar 2007) | 2 lines - vprintk is only available on 2.6.9+ (issue #9232 reported by - baconbuttie) ........ - -2007-03-08 00:48 +0000 [r2294] Russell Bryant - - * zaptel.h: Add a constant for ZT_EVENT_REMOVED to allow a driver - to hint to userspace that a channel has been removed. (issue - #7256, tzafrir) - -2007-03-07 19:36 +0000 [r2292] Tzafrir Cohen - - * Makefile: Don't die when there is no udev rules dir (on an - installtion with INSTALL_PREFIX explicitly set). r2290 | tzafrir - | 2007-03-07 21:14:30 +0200 (Wed, 07 Mar 2007) | 3 lines - -2007-03-05 17:02 +0000 [r2288] Tzafrir Cohen - - * /, xpp/xpd.h: Found a proper "marker" for the gfp_t typedef. Now - every 2.6.9 is supported. r2286 | tzafrir | 2007-03-05 18:14:11 - +0200 (Mon, 05 Mar 2007) | 2 lines - -2007-03-05 05:42 +0000 [r2283] Kevin P. Fleming - - * build_tools/make_firmware_object, wcte12xp.c, /: Merged revisions - 2280-2282 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2280 - | kpfleming | 2007-03-04 23:34:43 -0600 (Sun, 04 Mar 2007) | 2 - lines ensure that we run objdump in the most generic language - possible to avoid complications on non-English systems (issue - #9196) ........ r2281 | kpfleming | 2007-03-04 23:40:37 -0600 - (Sun, 04 Mar 2007) | 2 lines remove stray character that my - editor decided to add ........ r2282 | kpfleming | 2007-03-04 - 23:41:30 -0600 (Sun, 04 Mar 2007) | 2 lines this driver does not - use workqueues, so does not need this header (issue #9196) - ........ - -2007-03-02 22:20 +0000 [r2267-2273] Tzafrir Cohen - - * zaptel.init: Support proper loading of the Astribank (xpp) with - proper initialization. - - * Makefile: Don't "fail" a modprobe of ztdummy just because - zaptel.conf is bad. - - * /, xpp/Makefile: Clarify a cyptic build message. r2266 | tzafrir - | 2007-03-02 22:40:06 +0200 (Fri, 02 Mar 2007) | 2 lines - -2007-03-01 19:50 +0000 [r2244-2259] Tzafrir Cohen - - * xpp/xbus-core.c, /: r2257 | tzafrir | 2007-03-01 21:29:12 +0200 - (Thu, 01 Mar 2007) | 2 lines SLAB_KERNEL is an obsolete alias of - GFP_KERNEL. Fix build on Vanilla 2.6.20 . - - * /, xpp/utils/Makefile: r2252 | tzafrir | 2007-02-28 22:57:52 - +0200 (Wed, 28 Feb 2007) | 3 lines Make the xpp/utils/Makefile in - 1.2 closer to the one in 1.4 (and actually work, this tine). - - * /: Forgot to update properties - - * xpp/xpp_zap.c, xpp/utils/hexfile.c, xpp/firmwares/FPGA_1151.hex, - xpp/xpp_zap.h, xpp/utils/hexfile.h, xpp/xproto.c, - xpp/utils/zconf/Zaptel, xpp/firmwares/FPGA_FXS.hex, xpp/xproto.h, - xpp/xpd.h, xpp/firmwares/USB_1150.hex, - xpp/utils/zconf/Zaptel/Chans.pm, xpp/utils/zconf/Zaptel/Xpp, - xpp/card_bri.c (added), xpp/xbus-core.c, - xpp/utils/zconf/Zaptel.pm, xpp/utils/test_parse.c, - xpp/utils/zconf/Zaptel/Xpp/Xpd.pm, xpp/card_bri.h (added), - xpp/utils/xpp_fxloader, xpp/utils/fpga_load.c, xpp/xbus-core.h, - xpp/utils/lszaptel (added), xpp/utils/xpp_sync (added), - xpp/.version (added), xpp/firmwares/FPGA_1141.hex, - xpp/card_fxo.c, xpp/card_fxs.c, xpp/card_global.c, xpp/Makefile, - xpp/utils/Makefile, xpp/utils/zconf (added), - xpp/firmwares/USB_1140.hex, xpp/utils/zconf/Zaptel/Xpp/Xbus.pm, - xpp/utils/zt_registration (added), - xpp/utils/zconf/Zaptel/Span.pm, xpp/utils/genzaptelconf, - xpp/utils/zconf/Zaptel/Xpp.pm, xpp/xpp_usb.c: xpp rev. 3495: - ------------------------------------------------------------------------ - r2243 | tzafrir | 2007-02-28 02:05:59 +0200 (Wed, 28 Feb 2007) | - 4 lines * xpp rev. 3495: fix a race in the FXO driver of recent - weeks. * Add the Astribank BRI driver (though still needs - bristuffed zaptel to build and thus will not build by default) - ------------------------------------------------------------------------ - r2239 | tzafrir | 2007-02-27 08:14:18 +0200 (Tue, 27 Feb 2007) | - 18 lines Xorcom rev. 3491: * Version of xpp modules is set from - xpp/.version, rather than "unknown". * Astribank devices are now - initialized in parallel: faster startup when there are multiple - Astribanks. * Re-added support for the old format of - /proc/xpp/sync write: (echo N 0 > /proc/xpp/sync ) . The new - format (SYNC=NN) is preffered. * Firmware update to fix a PCM - issue. * Fixed a build issue with kernel 2.6.8 . * Fixed missing - initialization in Zaptel::Xpp::Xbus . * genzaptelconf will now - set FXS ports as LS by default. To set them as KS, use - fxs_default_start=ks in /etc/default/zaptel / - /etc/sysconfig/zaptel (Also a workaround for #7755 ). * - Groundwork for sync from zaptel master span: if zaptel is built - with ZAPTEL_SYNC_TIC (see zaptel/team/tzafrir/sync ), xpp will - report its drift from the zaptel sync master. * USB firmware - update: had bad lines checksums (and fxload did not report). * - fpga_load can now better report bad hex file checksum ;-) . - ------------------------------------------------------------------------ - r2223 | tzafrir | 2007-02-24 03:05:05 +0200 (Sat, 24 Feb 2007) | - 3 lines Add the Zaptel and Zaptel::Xpp perl modules, and some - simple utilities that use them. disabled by default for now. - ------------------------------------------------------------------------ - r2222 | tzafrir | 2007-02-24 02:55:05 +0200 (Sat, 24 Feb 2007) | - 2 lines Make the xpp/utils/Makefile in 1.2 closer to the one in - 1.4 . - -2007-02-26 18:20 +0000 [r2230-2233] Joshua Colp - - * Makefile, /: Merged revisions 2232 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2232 - | file | 2007-02-26 13:18:13 -0500 (Mon, 26 Feb 2007) | 2 lines - Just in case... set hotplug firmware loading option to no if on a - 2.4 kernel. (issue #9140 reported by velter) ........ - - * Makefile: Move menuselect build options inclusion to before it is - initially used otherwise the needed variables may not be present - at time of use. (issue #9145 reported by jmls) - -2007-02-26 10:13 +0000 [r2229] Tzafrir Cohen - - * doc/fxotune.8: The fxotune man page was misleading. Dumping some - content into it. Still needs work. - -2007-02-24 00:13 +0000 [r2215-2220] Kevin P. Fleming - - * datamods/Makefile, wct4xxp/Kbuild (removed), Makefile, wcte12xp.c - (added), wct4xxp/Makefile, zaptel.xml, hpec (added), zaptel.c - (removed), zttranscode.c, wctc4xxp (added), Makefile.kernel26 - (added), wct4xxp/Makefile.kernel26 (added), zaptel.h, - firmware/firmware.xml, zaptel-base.c (added): partial update to - support all the stuff that went into Zaptel 1.2 recently... this - definitely still broken for 2.4 kernels, and maybe for 2.6 as - well :-) includes: Makefile split and reorganize TE120P driver - TC400B driver HPEC support (not yet complete) - -2007-02-21 17:27 +0000 [r2200-2209] Matt Frederickson - - * wct4xxp/base.c, /: Merged revisions 2208 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2208 - | mattf | 2007-02-21 11:26:05 -0600 (Wed, 21 Feb 2007) | 2 lines - Make sure we do the IRQ fix in the gen1 interrupt handler as - well. ........ - - * wct4xxp/vpm450m.c, /: Merged revisions 2199 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2199 - | mattf | 2007-02-21 09:57:20 -0600 (Wed, 21 Feb 2007) | 2 lines - Make sure we do the check for memory allocation failure. ........ - - * wct4xxp/vpm450m.c, /: Merged revisions 2198 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2198 - | mattf | 2007-02-21 09:49:50 -0600 (Wed, 21 Feb 2007) | 2 lines - Reduce our stack usage when using the vpm450m ........ - -2007-02-21 14:00 +0000 [r2195] Kevin P. Fleming - - * build_tools/make_svn_branch_name, /: Merged revisions 2194 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - ........ r2194 | kpfleming | 2007-02-21 08:00:20 -0600 (Wed, 21 - Feb 2007) | 2 lines use new tag version numbering script ........ - -2007-02-20 20:17 +0000 [r2180] Russell Bryant - - * Makefile: Fix the check that ran the install for xpp/utils. Also, - add a target to build them, and clean the directory in the clean - target. (issue #8894, tzafrir) - -2007-02-17 17:15 +0000 [r2170] Tzafrir Cohen - - * xpp/utils/Makefile: xpp/utils: Use autoconf's test for libusb. - -2007-02-16 22:18 +0000 [r2167] Matt Frederickson - - * /, wctdm24xxp.c: Merged revisions 2166 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2166 - | mattf | 2007-02-16 16:14:48 -0600 (Fri, 16 Feb 2007) | 2 lines - Fix detection of second single port modules so it actually works - now. ........ - -2007-02-12 23:42 +0000 [r2158-2160] Joshua Colp - - * firmware/Makefile, Makefile: Add hotplug-uninstall target to main - Makefile and make the firmware Makefile keep a record of the - installed firmware in the hotplug directory. This means that as - long as you have the latest version of firmware installed your - checkout will never install it again, and all new checkouts will - not either. This might also help those building packages for - distros. - -2007-02-11 15:48 +0000 [r2151] Tzafrir Cohen - - * xpp/xbus-core.c: struct inode and debugfs: break some Fedoras - rather than all others. (from changeset 2150) - -2007-02-10 20:43 +0000 [r2147] Joshua Colp - - * firmware/Makefile: Only attempt to install firmware to the - hotplug directories if any was selected. - -2007-02-10 00:22 +0000 [r2142-2146] Kevin P. Fleming - - * zaptel.xml: add some inter-module dependencies and add wctc4xxp - to menuselect list - - * zaptel.xml: clean up module naming there is no need to enable the - user to skip building zaptel or ztdynamic (probably zttranscode - too... menuselect needs an upgrade) - -2007-02-09 18:39 +0000 [r2136-2140] Joshua Colp - - * firmware/Makefile: It's probably a good idea to make the tarballs - a requirement to make the object files. - - * firmware/Makefile, wct4xxp/base.c, Makefile: Drop the need for - header files by using non-versioned binary files. - -2007-02-09 15:06 +0000 [r2123-2135] Tzafrir Cohen - - * Makefile: Fix 'make clean' on kernel 2.4: datamods is only made - on 2.6. - - * Makefile: Build xpp/ for kernel >= 2.6.8, not >=2.6.9. - - * xpp/xpp_zap.c: Now 'chans' is used after all. - - * xpp/xpp_zap.c, xpp/firmwares/FPGA_1151.hex, xpp/xpp_zap.h, - xpp/xproto.c, xpp/firmwares/FPGA_FXS.hex, xpp/xproto.h, - xpp/xpd.h, xpp/init_card_4_23 (removed), xpp/init_card_4_24 - (added), xpp/init_card_6_24 (added), xpp/xbus-core.c, - xpp/utils/adj_clock.c, xpp/utils/xpp_fxloader, xpp/xbus-core.h, - xpp/utils/fpga_load.c, xpp/xdefs.h, xpp, xpp/utils/xpp.rules - (added), xpp/firmwares/FPGA_1141.hex (added), xpp/card_fxo.c, - xpp/card_global.c, xpp/card_fxs.c, xpp/README.Astribank, - xpp/utils/zaptel-helper (added), xpp/zaptel-helper (removed), - xpp/utils/Makefile, xpp/Makefile, xpp/utils/adj_clock.8, - xpp/firmwares/USB_1140.hex (added), xpp/zap_debug.c, - xpp/utils/fpga_load.8, xpp/init_card_3_23 (removed), - xpp/init_card_3_24 (added), xpp/zap_debug.h, xpp/init_card_7_24 - (added), xpp/xpp_log.h (added), xpp/utils/genzaptelconf, - xpp/xpp_usb.c: Branch 1.4 is back in sync (currently: xorcom rev. - 3332): * Performance improvements for multi-XPD (span) devices. * - Astribank BRI driver (in next commit). * Changes under /proc: - - XBUS and XPD numbers have two digits. - Every script wildcard - should be replaced from XBUS-? to XBUS-[0-9]* - Added - /proc/xpp/XBUS-*/XPD-*/blink: echo 1 to start and 0 to stop. * - Several countries (South Africa, UAE, anybody else) require a - shorter ring delay. Adjust FXO reg 0x17 (23)'s bits 0:2 to 011. * - Use tasklets to move most of the interrupt PCM copying out of the - interrupt. * Debugfs-based code to dump data to userspace (used - to debug BRI D channel). * Pretend every 2.6.9 actually has later - RHEL's typedefs. * fpga_load supports /dev/bus/usb . * Fixed - physical order sorting in genzaptelconf. * Reverse polarity and - power denial detection. * A short led flash at registration time. - * Add a real version of the xpp modules to them (independent of - the Zaptel version). * Update our line status even when not - registered. * Fixed a false SIG_CHANGED when inserting or - removing cable to FXO. * Fixed compilation fixes for 2.6.20 (Bug - #8982) * A cleaner fix for the bool changes of 2.6.19 . * - Automatically detect echo_can_state_t at debug time. * - Automaitcally set XPP_DEBUGFS (depending on debugfs) at compile - time. * Bug-fixes to zaptel-helper. Moved to xpp/utils . * Xbus - protocol version: 2.4 (Zaptel 1.2.12/1.4.0 had 2.3). XPS Init - scripts renamed accordingly. - -2007-02-07 21:25 +0000 [r2111-2120] Kevin P. Fleming - - * wct4xxp/base.c, /: Merged revisions 2119 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2119 - | kpfleming | 2007-02-07 15:22:44 -0600 (Wed, 07 Feb 2007) | 2 - lines don't allow wct4xxp workqueue support to be built against - kernel 2.6.20... it's not going to work ........ - - * Makefile, xpp/xbus-core.c, /: Merged revisions 2110 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r2110 | kpfleming | 2007-02-07 14:29:22 -0600 (Wed, 07 Feb 2007) - | 3 lines build XPP on the kernels that Xorcom says are OK to - build on update workqueue usage to conform to kernel 2.6.20 API - ........ - -2007-02-07 20:01 +0000 [r2107] Joshua Colp - - * wct4xxp/vpm450m.c, build_tools/make_tree (added), firmware - (added), wct4xxp/base.c, Makefile, configure, - wct4xxp/OCT6114-64D.ima (removed), firmware/firmware.xml, - makeopts.in, firmware/Makefile, wct4xxp/Kbuild, zaptel.xml - (added), wct4xxp/Makefile, menuselect-tree (removed), - wct4xxp/OCT6114-128D.ima (removed), configure.ac: Merge in - zaptel-firmware branch. This basically downloads the firmware - from the FTP site and builds the appropriate headers based on the - current version. Drivers just know they need a certain firmware - and get fed the current version. If this prevents your zaptel - from building do a make distclean and start fresh or make sure - the firmware is checked in make menuselect. - -2007-02-07 19:55 +0000 [r2105] Kevin P. Fleming - - * /, zttranscode.c: Merged revisions 2103 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2103 - | kpfleming | 2007-02-07 13:52:29 -0600 (Wed, 07 Feb 2007) | 2 - lines include headers we need... new kernel releases won't do it - for us ........ - -2007-02-07 16:51 +0000 [r2099] Russell Bryant - - * ztcfg.c: In case the ZT_GETVERSION ioctl fails, ensure that the - buffers are initialized to "Unknown" so that we don't try to - print uninitialized string buffers. (issue #8992, Oron Peled, - tzafrir) - -2007-02-05 21:55 +0000 [r2087] Kevin P. Fleming - - * Makefile, /: Merged revisions 2086 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2086 - | kpfleming | 2007-02-05 15:54:40 -0600 (Mon, 05 Feb 2007) | 2 - lines fix version-numbering logic ........ - -2007-01-31 20:19 +0000 [r2065-2066] Tzafrir Cohen - - * xpp/zaptel-helper (added): r2064: tzafrir | 2007-01-31 21:48:39 - +0200 zaptel-helper deserves wider exposure. Note: it is not - getting installed. However it will probably help preven the - braking of Astribank drivers loading for those who do care. - - * xpp/utils/genzaptelconf: Merging 1.2 changes of genzaptelconf: * - -l (list) now works reliebly. * Cleared some leftover writes to - standard output. * Fixed xpp spans sort order. - -2007-01-31 14:12 +0000 [r2039-2044] Kevin P. Fleming - - * pciradio.c, zttool.c, wct4xxp/base.c, ztcfg-dude.c, Makefile, - zaptel.c, torisatool.c, torisa.c, tonezone.c, ztdynamic.c, - wcfxsusb.c, ztmonitor.c, makefw.c, build_tools/genmodconf, - ztcfg.c, wct1xxp.c, wctdm.c, ztd-eth.c, /, wcusb.c, wctdm24xxp.c, - wcfxo.c, tor2.c: Merged revisions 2043 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2043 - | kpfleming | 2007-01-31 08:06:34 -0600 (Wed, 31 Jan 2007) | 4 - lines fix up author email addresses use the kernel's built-in - support for module aliases instead of manually doing it in - modprobe.conf or equivalent add wctdm8xxp alias for wctdm24xxp - ........ - - * wct4xxp/base.c, /: Merged revisions 2038 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2038 - | kpfleming | 2007-01-30 19:33:25 -0600 (Tue, 30 Jan 2007) | 2 - lines final fix for non-hotplug firmware loading ........ - -2007-01-30 18:11 +0000 [r2019] Russell Bryant - - * /: Blocked revisions 2018 via svnmerge ........ r2018 | russell | - 2007-01-30 12:11:11 -0600 (Tue, 30 Jan 2007) | 5 lines - Make the - build of xpp occur with 2.6.8 or above, instead of 2.6.10 - - remove the installation of the userspace tools - remove the - architecture check (issue #8894, tzafrir) ........ - -2007-01-29 19:21 +0000 [r1998] Kevin P. Fleming - - * wct4xxp/base.c, /: Merged revisions 1996 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1996 - | kpfleming | 2007-01-29 13:20:32 -0600 (Mon, 29 Jan 2007) | 2 - lines _really_ fix the non-hotplug firmware case ........ - -2007-01-27 16:16 +0000 [r1988] Kevin P. Fleming - - * wct4xxp/base.c, /: Merged revisions 1987 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1987 - | kpfleming | 2007-01-27 10:14:54 -0600 (Sat, 27 Jan 2007) | 2 - lines properly reference the size symbol produced by objcopy - ........ - -2007-01-26 15:27 +0000 [r1969-1982] Matt Frederickson - - * wctdm24xxp.c: Add additional product support. - -2007-01-24 13:11 +0000 [r1954] Kevin P. Fleming - - * /, wcfxo.c: Merged revisions 1953 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1953 - | kpfleming | 2007-01-24 07:01:36 -0600 (Wed, 24 Jan 2007) | 2 - lines might as well fix this driver too :-) ........ - -2007-01-24 00:38 +0000 [r1944] Russell Bryant - - * Makefile, /: Merged revisions 1943 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1943 - | russell | 2007-01-23 18:35:48 -0600 (Tue, 23 Jan 2007) | 3 - lines If the xpp pieces get built, install the userspace - utilities as well. (issue #8894) ........ - -2007-01-23 21:49 +0000 [r1937] Matt Frederickson - - * wcte11xp.c, wct1xxp.c, wctdm.c, /, wctdm24xxp.c: Merged revisions - 1936 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1936 - | mattf | 2007-01-23 15:28:14 -0600 (Tue, 23 Jan 2007) | 3 lines - Make sure we don't clear the interrupt before we might have - received it in shared interrupt line scenarios. ........ - -2007-01-23 15:39 +0000 [r1921-1924] Kevin P. Fleming - - * /, ztd-eth.c: Merged revisions 1923 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1923 - | kpfleming | 2007-01-23 09:39:12 -0600 (Tue, 23 Jan 2007) | 2 - lines use the proper function prototype for 2.6 kernels ........ - - * xpp/xpp_zap.c, pciradio.c, wctdm.c, /, zaptel.c, torisa.c, - wctdm24xxp.c: Merged revisions 1920 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1920 - | kpfleming | 2007-01-23 09:25:42 -0600 (Tue, 23 Jan 2007) | 2 - lines clean up various compiler warnings ........ - -2007-01-23 01:58 +0000 [r1913] Joshua Colp - - * /, zonedata.c: Merged revisions 1912 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1912 - | file | 2007-01-22 20:57:00 -0500 (Mon, 22 Jan 2007) | 2 lines - Fix Congestion tone for Australia. (issue #8891 reported by JT) - ........ - -2007-01-22 22:43 +0000 [r1892-1899] Kevin P. Fleming - - * wct4xxp/base.c, /: Merged revisions 1898 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1898 - | kpfleming | 2007-01-22 16:43:06 -0600 (Mon, 22 Jan 2007) | 3 - lines use better definition for linked-in firmware data ensure - that hotplug-loaded firmware is released when we are finished - with it ........ - - * wct4xxp/base.c, /: Merged revisions 1891 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1891 - | kpfleming | 2007-01-22 15:12:35 -0600 (Mon, 22 Jan 2007) | 2 - lines make the non-hotplug firmware case actually compile again - ........ - -2007-01-22 21:04 +0000 [r1889] Jason Parker - - * Makefile: Fix typo in Makefile Issue 8885, patch by James - -2007-01-22 20:59 +0000 [r1878-1887] Kevin P. Fleming - - * wct4xxp/base.c, /: Merged revisions 1886 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1886 - | kpfleming | 2007-01-22 14:58:30 -0600 (Mon, 22 Jan 2007) | 2 - lines might be good if i committed the working version of this - code... ........ - - * wct4xxp/vpm450m.c, wct4xxp/base.c, wct4xxp/vpm450m.h, /: Merged - revisions 1877 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1877 - | kpfleming | 2007-01-22 12:58:34 -0600 (Mon, 22 Jan 2007) | 2 - lines update to PR47 Octasic API kit, and use new GetCapacityPins - API call to only attempt downloading the correct firmware for the - modules we find ........ - -2007-01-18 23:50 +0000 [r1855] Matt Frederickson - - * wct4xxp/base.c: Backporting revs 1812 and 1854 into 1.4. - -2007-01-16 23:45 +0000 [r1836] Jason Parker - - * /, fxsdump.c (removed): Merged revisions 1835 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1835 - | qwell | 2007-01-16 17:44:28 -0600 (Tue, 16 Jan 2007) | 6 lines - Remove file that was never (literally) able to compile - dates - all the way back to zaptel 0.8.0 If we can figure out where this - coeffs.h comes from, I suppose it would be easy to add this back - in the future. Issue 8493 ........ - -2007-01-16 04:38 +0000 [r1820-1828] Kevin P. Fleming - - * wct4xxp/vpm450m.c, build_tools/make_firmware_object, /: Merged - revisions 1826-1827 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1826 - | kpfleming | 2007-01-15 22:30:00 -0600 (Mon, 15 Jan 2007) | 3 - lines make the 'firmware object' files load the firmware blobs as - read-only data simplify the code that uses the firmware objects a - bit ........ r1827 | kpfleming | 2007-01-15 22:37:06 -0600 (Mon, - 15 Jan 2007) | 2 lines use latest Octasic API tag ........ - - * wct4xxp/vpm450m.c, wct4xxp/Kbuild, wct4xxp/base.c, Makefile, - build_tools/make_firmware_object (added), wct4xxp/Makefile, - wct4xxp/vpm450m.h, /, wct4xxp, wct4xxp/fw2h.c (removed): Merged - revisions 1818 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1818 - | kpfleming | 2007-01-15 19:28:54 -0600 (Mon, 15 Jan 2007) | 3 - lines eliminate the fw2h tool, and instead use objcopy to - directly make object files from the firmware binary files pass - HOTPLUG_FIRMWARE down to the module build so that we can avoid - various compiler warnings ........ - -2006-12-30 19:11 +0000 [r1774] Joshua Colp - - * Makefile, /: Merged revisions 1773 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1773 - | file | 2006-12-30 14:09:50 -0500 (Sat, 30 Dec 2006) | 2 lines - Specify full path to restorecon instead of assuming it will be - available from what is in $PATH. (issue #8671 reported by djflux) - ........ - -2006-12-27 22:49 +0000 [r1767] Kevin P. Fleming - - * xpp/xpp_zap.c, xpp/card_fxo.c, /, xpp/card_fxs.c, xpp/xpp_usb.c: - Merged revisions 1766 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1766 - | kpfleming | 2006-12-27 16:47:19 -0600 (Wed, 27 Dec 2006) | 2 - lines remove pointless duplication of ZAPTEL_VERSION that causes - these modules to be rebuilt every time a commit is made to any - part of Zaptel ........ - -2006-12-23 Kevin P. Fleming - - * Zaptel 1.4.0 released. - -2006-12-18 14:01 +0000 [r1726-1729] Tzafrir Cohen - - * xpp/xdefs.h, xpp: r1724@boole: tzafrir | 2006-12-18 15:55:59 - +0200 Code is 2.6-specific anyway, no need for an explicit test. - - * xpp, xpp/xpp_usb.c: r1723@boole: tzafrir | 2006-12-18 15:54:04 - +0200 Use the internal version (without locking) of - usb_reset_device. Intended for kernel 2.6.9 and earlier. Finally - full support of 2.6.8 and 2.6.9. r2937: diego | 2006-12-17 - 14:20:36 +0200 r2940: tzafrir | 2006-12-17 16:32:51 +0200 - - * xpp/xpp_zap.c, xpp: r1722@boole: tzafrir | 2006-12-18 15:50:36 - +0200 xpp_zap.c: Better error hanlding during module init. orig - r2948: oron | 2006-12-17 18:54:00 +0200 - - * xpp, xpp/xpd.h: r1721@boole: tzafrir | 2006-12-18 15:46:42 +0200 - Assume every 2.6.9 kernel is a later RHEL4 kernel, which - backported the gfp_t typedef. Either way we break some systems). - r2938: diego | 2006-12-17 14:22:16 +0200 - -2006-12-15 13:50 +0000 [r1716-1719] Tzafrir Cohen - - * xpp/xpp_zap.c, xpp/card_fxo.c, xpp/README.Astribank, - xpp/utils/xpp_fxloader, xpp/utils/genzaptelconf, xpp: Sync to xpp - RELEASE-1.2.0 2933. r2847@boole: diego | 2006-12-03 10:33:00 - +0200 added documentation which explains which packages are - needed to build the drivers on different distributions. - r2862@boole: tzafrir | 2006-12-05 08:43:50 +0200 - README.Astribank: A typo in the sample config (changeset:2861). - r2891@boole: tzafrir | 2006-12-08 01:11:45 +0200 Re-accept - changeset:2832 after all. r2892@boole: tzafrir | 2006-12-08 - 02:46:07 +0200 Merge genzaptelconf changeset:2866 from trunk: * - Zapata comment on unidentified channel goes to $zapata_file * - Correct pattern for Sangoma A200 card's channels. r2893@boole: - tzafrir | 2006-12-08 03:11:37 +0200 genzaptelconf: * Add options - xpp_fxo_rxgain: add a custom rxgain for every XPP FXO channel. * - Do print the original line for every channel. r2909@boole: - tzafrir | 2006-12-10 20:03:59 +0200 Add some sleeps in older - kernels in the firmware loading script. r2932@boole: tzafrir | - 2006-12-14 17:30:12 +0200 Make the warning about a call to - off-hook FXO debug. At least if we cannot suppress it at module - load time. r2933@boole: tzafrir | 2006-12-14 17:32:00 +0200 Don't - redefine 'bool' on newer kerenls to fix building with kernel - 2.6.19. Taken from Digium tree. (from changeset:2930) - - * xpp/firmwares/FPGA_1151.hex, xpp/firmwares/FPGA_FXS.hex, xpp: - r1715@boole: tzafrir | 2006-12-15 14:35:26 +0200 Firmwares to fix - caller ID detection timing issue. - -2006-12-12 Kevin P. Fleming - - * Zaptel 1.4.0-beta3 released. - -2006-12-11 19:07 +0000 [r1698-1701] Kevin P. Fleming - - * /, xpp/xdefs.h: Merged revisions 1700 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1700 - | kpfleming | 2006-12-11 13:05:43 -0600 (Mon, 11 Dec 2006) | 2 - lines kernel 2.6.19 now has a type called 'bool', although it's - not completely implemented so there will still be some warnings - when building xpp against 2.6.19 kernel headers ........ - - * pciradio.c, wct4xxp/base.c, wcte11xp.c, wct1xxp.c, wctdm.c, /, - torisa.c, wcusb.c, wctdm24xxp.c, zaptel.h, tor2.c, wcfxo.c: - Merged revisions 1697 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1697 - | kpfleming | 2006-12-11 12:27:15 -0600 (Mon, 11 Dec 2006) | 2 - lines kernel 2.6.19 API changes compatibility ........ - -2006-12-06 23:25 +0000 [r1687] Joshua Colp - - * Makefile, ztcfg-dude.c, /: Merged revisions 1686 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r1686 | file | 2006-12-06 18:22:11 -0500 (Wed, 06 Dec 2006) | 2 - lines Link ztcfg-dude against stdc++ so we get needed functions. - (issue #8494 reported by Romik) ........ - -2006-12-01 00:13 +0000 [r1673-1678] Tzafrir Cohen - - * xpp/card_fxo.c, xpp: r1671@boole: tzafrir | 2006-12-01 01:30:24 - +0200 r2806@boole: oron | 2006-11-27 16:54:06 +0200 Fixed panic - in ticket:147 merged code from changeset:2802 changeset:2804 - - * xpp/card_fxo.c, xpp: r1670@boole: tzafrir | 2006-12-01 01:29:57 - +0200 r2794@boole: oron | 2006-11-26 14:24:15 +0200 Remove all - SOFT_RING code (unused for a long time). - - * xpp/xpp_zap.c, xpp, xpp/xpd.h: r1668@boole: tzafrir | 2006-11-30 - 23:48:25 +0200 r2832@boole: tzafrir | 2006-11-29 11:06:06 +0200 - Add parameter xpp_ec to the module xpp (xpp_zap.c). Defaults to - 1. If 0, module will use Zaptel echo canceller even with - XPP_EC_CHUNK. Parameter is read-only for now: cannot be set - through /sys/modules. (Merge of changeset:2830) - - * xpp/utils/genzaptelconf, xpp: r1667@boole: tzafrir | 2006-11-30 - 23:46:46 +0200 r2831@boole: tzafrir | 2006-11-29 11:05:08 +0200 - genzaptelconf: A list of countries for which to use busydetect. - (backport of changeset:2829) - - * xpp/init_card_3_23, xpp/init_card_4_23, xpp/calibrate_slics, - xpp/card_fxo.c, xpp/xbus-core.c, xpp/card_global.c, - xpp/card_fxs.c, xpp/README.Astribank, xpp/utils/Makefile, - xpp/Makefile, xpp/utils/genzaptelconf, xpp: r1666@boole: tzafrir - | 2006-11-30 23:46:11 +0200 r2817@boole: oron | 2006-11-28 - 13:39:47 +0200 Maintenance branch for asterisk-1.2.x - -2006-11-30 00:24 +0000 [r1664] Jason Parker - - * build_tools/genmodconf, /: Merged revisions 1663 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r1663 | qwell | 2006-11-29 18:23:33 -0600 (Wed, 29 Nov 2006) | 2 - lines Fix issue that was discovered by using dash as /bin/sh - instead of bash. ........ - -2006-11-29 22:27 +0000 [r1661] Kevin P. Fleming - - * /, zconfig.h: Merged revisions 1660 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1660 - | kpfleming | 2006-11-29 16:24:07 -0600 (Wed, 29 Nov 2006) | 2 - lines clarify the BOOST_RINGER compile-time option ........ - -2006-11-29 17:31 +0000 [r1656-1658] Matt Frederickson - - * ztcfg.c: Fix for #7860. Make sure we don't allow channel 16 to be - clear if it's in E1/CAS mode. - - * zttool.c: Fix for (#8300) - -2006-11-26 08:12 +0000 [r1642] Russell Bryant - - * wcte11xp.c, /: Merged revisions 1641 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1641 - | russell | 2006-11-26 03:10:22 -0500 (Sun, 26 Nov 2006) | 3 - lines Remove a misplaced semicolon which caused some debug output - to be printed regardless of the debug setting. (issue #8414, - gknispel_proformatique) ........ - -2006-11-22 23:30 +0000 [r1637] Matt Frederickson - - * zaptel.c: Update for #8403 - -2006-11-21 15:19 +0000 [r1623] Tzafrir Cohen - - * xpp/utils/Makefile: Typo: SBINDIR -> BINDIR . - -2006-11-17 17:47 +0000 [r1614-1615] Jason Parker - - * Makefile: Fix an issue (8071) where wct4xxp wasn't being put into - /etc/modprobe.d/zaptel (or similar). There should be no reason - that adding wct4xxp to the MODULES variable at this point in the - Makefile, would cause any harm. Somebody please correct me if I'm - wrong... (Fix is slightly different from 1.2) - - * /: Blocked revisions 1613 via svnmerge ........ r1613 | qwell | - 2006-11-17 11:43:12 -0600 (Fri, 17 Nov 2006) | 5 lines Fix an - issue (8071) where wct4xxp wasn't being put into - /etc/modprobe.d/zaptel (or similar). There should be no reason - that adding wct4xxp to the MODULES variable at this point in the - Makefile, would cause any harm. Somebody please correct me if I'm - wrong... ........ - -2006-11-17 04:12 +0000 [r1611] BJ Weschke - - * /, zaptel.c: Merged revisions 1610 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1610 - | bweschke | 2006-11-16 23:06:05 -0500 (Thu, 16 Nov 2006) | 4 - lines mattf - I'm not sure if this is where you wanted the - definitions placed. If not, please fix, but this gets the - compiles working again for now. ........ - -2006-11-17 00:52 +0000 [r1606-1609] Matt Frederickson - - * zaptel.c: Fix for 7991. - - * zaptel.c: Fix for 7769 - -2006-11-11 14:34 +0000 [r1590] Tzafrir Cohen - - * xpp/init_card_3_23, xpp/init_card_4_23: init_card[34]_23: merge - from 2654,2655. * Redirect stderr to /dev/null. Without any - redirection, it may fail with exitval=4 . Probably, fd 2 is - closed and the shell (or sed which is used in the scripts) tries - to write to it (or do some other I/O related syscall) which - fails. * make XPP_BASE handling identical in the two scripts. - -2006-11-09 15:58 +0000 [r1576] Russell Bryant - - * Makefile: fix an expression in the install target (issue #8321, - tzafrir) - -2006-11-08 23:06 +0000 [r1574] Kevin P. Fleming - - * wct4xxp/vpm450m.c, wct4xxp/base.c, wcte11xp.c, wct4xxp/vpm450m.h, - /: Merged revisions 1573 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1573 - | kpfleming | 2006-11-08 17:04:33 -0600 (Wed, 08 Nov 2006) | 3 - lines clean up recent VPMOCT changes add support for Infineon - FALC rev 2.2 ........ - -2006-11-08 16:01 +0000 [r1571] Tzafrir Cohen - - * xpp/utils/print_modes.c: Fixed a typo in the "wctdm - reimplementation". - -2006-11-08 03:44 +0000 [r1566-1568] Kevin P. Fleming - - * wct4xxp, configure, configure.ac, makeopts.in: update configure - script to add searching for libusb update svn:ignore for new - firmware header file names - -2006-11-06 22:48 +0000 [r1565] Matt Frederickson - - * wct4xxp/vpm450m.c, wct4xxp/Kbuild, wct4xxp/base.c, - wct4xxp/Makefile, wct4xxp/vpm450m.h, wct4xxp/OCT6114-64D.ima - (added): Add support into 1.4 branch for new VPMOCT64 as well - -2006-11-06 19:07 +0000 [r1557-1558] Tzafrir Cohen - - * xpp/init_card_3_23, xpp/init_card_4_23: Fixes for card init - scripts from rev 2633: * Don't log card init scripts to - /tmp/results . * Document how to trace, though. * init_card_4_23: - don't re-open the slics file. - - * xpp/xpp_zap.c, xpp/utils/print_modes.c, - xpp/utils/xpp_fxloader.usermap, xpp/firmwares/FPGA_1151.hex - (added), xpp/xpp_zap.h, xpp/slic.c (removed), xpp/xproto.c, - xpp/firmwares/FPGA_FXS.hex (added), xpp/firmwares/USB_1130.hex - (added), xpp/utils/USB_1130.hex (removed), xpp/utils/FPGA_FXS.hex - (removed), xpp/slic.h (removed), xpp/init_data_3_20.cmd - (removed), xpp/xpd.h, xpp/xproto.h, xpp/firmwares/USB_1150.hex - (added), xpp/init_card_4_23 (added), xpp/calibrate_slics, - xpp/xbus-core.c, xpp/init_data_4_19.cmd (removed), - xpp/utils/adj_clock.c (added), xpp/utils/xpp_fxloader, - xpp/xbus-core.h, xpp/xdefs.h, xpp, xpp/utils, - xpp/utils/genzaptelconf.8, xpp/card_fxo.c, xpp/card_global.c, - xpp/card_fxs.c, xpp/README.Astribank, xpp/card_fxo.h, - xpp/utils/Makefile, xpp/Makefile, xpp/utils/adj_clock.8 (added), - xpp/card_fxs.h, xpp/card_global.h, xpp/init_data_4_20.cmd - (removed), xpp/init_card_3_23 (added), xpp/initialize_registers - (removed), xpp/init_data_3_19.cmd (removed), - xpp/firmwares/LICENSE.firmware (added), xpp/firmwares/README - (added), xpp/utils/USB_8613.hex (removed), xpp/LICENSE.firmware - (removed), xpp/utils/genzaptelconf, xpp/firmwares (added), - xpp/xpp_usb.c: Merging xpp driver release 1.2 (rev. 2569), - originally team/tzafrir/xpp_1.2 * Should build well. Almost - final. * genzaptelconf: Also work when zap_autoreg=0 * - README.Astribank updated for rev. 1.2. * xpp/utils/Makefile: Use - $< with cc -c * Get xpp/utils configuration from autoconf - (without changesin top dir) - -2006-11-01 19:04 +0000 [r1547] Russell Bryant - - * Makefile, wct4xxp/Makefile, configure, configure.ac, - xpp/utils/Makefile, makeopts.in: instead of setting HOSTCC and CC - directly in the Makefile, use the information provided by the - configure script (issue #8055, tzafrir) - -2006-10-31 06:26 +0000 [r1543] Russell Bryant - - * Makefile, /: Merged revisions 1542 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1542 - | russell | 2006-10-31 01:25:16 -0500 (Tue, 31 Oct 2006) | 3 - lines fix the installation of wct4xxp for 2.4 kernels (issue - #7964, fixed by gkloepfer, but the committed fix is slightly - modified) ........ - -2006-10-26 00:03 +0000 [r1536] Kevin P. Fleming - - * wctdm.c, /, wctdm24xxp.c: Merged revisions 1534-1535 via svnmerge - from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ - r1534 | kpfleming | 2006-10-25 18:54:41 -0500 (Wed, 25 Oct 2006) - | 2 lines do ProSLIC 3215 check properly ........ r1535 | - kpfleming | 2006-10-25 19:00:31 -0500 (Wed, 25 Oct 2006) | 2 - lines do ProSLIC 3215 check properly in this driver too ........ - -2006-10-24 01:33 +0000 [r1528-1530] Russell Bryant - - * pciradio_vhdl.tar.gz (removed), raddiag.tar.gz (removed): Both of - these files are corrupted and can not be decompressed, so they - need to be re-added. (issue #8134) - - * /, doc/ztmonitor.8, doc/zttool.8, doc/ztcfg.8: Merged revisions - 1527 via svnmerge from - https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1527 - | russell | 2006-10-23 21:08:27 -0400 (Mon, 23 Oct 2006) | 3 - lines convert some characters of ISO8859-1 encoding to be UTF-8 - (issue #8200, jcollie) ........ - -2006-10-20 01:26 +0000 [r1520] Joshua Colp - - * /, torisa.c, zaptel.h, zconfig.h: Merged revisions 1519 via - svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 - ........ r1519 | file | 2006-10-19 21:23:26 -0400 (Thu, 19 Oct - 2006) | 2 lines Later distros have now taken to removing this - file as it has been deprecated for awhile now... so on kernels - 2.6.18 or higher we can safely not include it. (props to jsmith) - ........ - -2006-10-18 02:15 +0000 [r1518] Russell Bryant - - * /: Blocked revisions 1517 via svnmerge ........ r1517 | russell | - 2006-10-17 22:14:43 -0400 (Tue, 17 Oct 2006) | 3 lines remove - ROOT_PREFIX, and move INSTALL_PREFIX to before the first time it - is used (issue #7913, darren1713) ........ - -2006-10-17 Kevin P. Fleming - - * Zaptel 1.4.0-beta2 released. - -2006-10-17 16:40 +0000 [r1507] Russell Bryant - - * wct4xxp/base.c: Set the readbuf size to be the same size of the - variable, readsize. This buffer was 31 bytes, while the readsize - could be 32 bytes, causing a read into invalid memory. (issue - #8155, araasch) - -2006-10-11 17:25 +0000 [r1500] Joshua Colp - - * Makefile: Copy to both directories, not just the first one. - -2006-10-02 23:50 +0000 [r1490] Matt O'Gorman - - * wctdm.c, wctdm24xxp.c: add support for setting gain registers on - the fxo and fxs modules. - -2006-09-20 Kevin P. Fleming - - * Zaptel 1.4.0-beta1 released. diff --git a/zaptel/LICENSE b/zaptel/LICENSE deleted file mode 100644 index a52b16e4..00000000 --- a/zaptel/LICENSE +++ /dev/null @@ -1,341 +0,0 @@ - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/zaptel/LICENSE.LGPL b/zaptel/LICENSE.LGPL deleted file mode 100644 index 1f7c8cc6..00000000 --- a/zaptel/LICENSE.LGPL +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/zaptel/Makefile b/zaptel/Makefile deleted file mode 100644 index 3861fa77..00000000 --- a/zaptel/Makefile +++ /dev/null @@ -1,693 +0,0 @@ -# -# Makefile for Zaptel driver modules and utilities -# -# Copyright (C) 2001-2007 Digium, Inc. -# -# - -ifneq ($(KBUILD_EXTMOD),) -# We only get in here if we're from kernel 2.6 <= 2.6.9 and going through -# Kbuild. Later versions will include Kbuild instead of Makefile. -include $(src)/Kbuild - -else - -CFLAGS+=-DSTANDALONE_ZAPATA -DBUILDING_TONEZONE - -ifeq ($(MAKELEVEL),0) -PWD:=$(shell pwd) -export PWD -endif - -ifeq ($(ARCH),) -ARCH:=$(shell uname -m | sed -e s/i.86/i386/) -endif - -ifeq ($(ARCH),armv7l) -ARCH:=arm -endif - -ifeq ($(DEB_HOST_GNU_TYPE),) -UNAME_M:=$(shell uname -m) -else -UNAME_M:=$(DEB_HOST_GNU_TYPE) -endif - -# If you want to build for a kernel other than the current kernel, set KVERS -ifndef KVERS -KVERS:=$(shell uname -r) -endif -ifndef KSRC - ifneq (,$(wildcard /lib/modules/$(KVERS)/build)) - KSRC:=/lib/modules/$(KVERS)/build - else - KSRC_SEARCH_PATH:=/usr/src/linux-2.4 /usr/src/linux - KSRC:=$(shell for dir in $(KSRC_SEARCH_PATH); do if [ -d $$dir ]; then echo $$dir; break; fi; done) - endif -endif -KVERS_MAJ:=$(shell echo $(KVERS) | cut -d. -f1-2) -KVERS_POINT:=$(shell echo $(KVERS) | cut -d. -f3 | cut -d- -f1) -KINCLUDES:=$(KSRC)/include - -# We use the kernel's .config file as an indication that the KSRC -# directory is indeed a valid and configured kernel source (or partial -# source) directory. -# -# We also source it, as it has the format of Makefile variables list. -# Thus we will have many CONFIG_* variables from there. -KCONFIG:=$(KSRC)/.config -ifneq (,$(wildcard $(KCONFIG))) - HAS_KSRC=yes - include $(KCONFIG) -else - HAS_KSRC=no -endif - -ifeq ($(KVERS_MAJ),2.4) - BUILDVER:=linux24 -else - BUILDVER:=linux26 -endif - -# Set HOTPLUG_FIRMWARE=no to override automatic building with hotplug support -# if it is enabled in the kernel. -ifeq ($(BUILDVER),linux26) - ifneq (,$(wildcard $(DESTDIR)/etc/udev/rules.d)) - DYNFS=yes - UDEVRULES=yes - endif - ifeq (yes,$(HAS_KSRC)) - HOTPLUG_FIRMWARE:=$(shell if grep -q '^CONFIG_FW_LOADER=[ym]' $(KCONFIG); then echo "yes"; else echo "no"; fi) - endif -endif - -ifneq (,$(findstring $(CONFIG_DEVFS_FS),y m)) - DYNFS=yes - HAS_DEVFS=yes -endif - -# If the file .zaptel.makeopts is present in your home directory, you can -# include all of your favorite menuselect options so that every time you download -# a new version of Asterisk, you don't have to run menuselect to set them. -# The file /etc/zaptel.makeopts will also be included but can be overridden -# by the file in your home directory. - -GLOBAL_MAKEOPTS=$(wildcard /etc/zaptel.makeopts) -USER_MAKEOPTS=$(wildcard ~/.zaptel.makeopts) - -ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),) - ifneq ($(wildcard menuselect.makeopts),) - include menuselect.makeopts - endif -endif - -ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),) - ifneq ($(wildcard makeopts),) - include makeopts - endif -endif - -ifeq ($(BUILDVER),linux24) -INCOMPAT_MODULES:=xpp wcte12xp wctc4xxp wctdm24xxp zttranscode -endif - -ifeq ($(BUILDVER),linux26) -ifneq ($(findstring $(KVERS_POINT),1 2 3 4 5 6 7 8),) -INCOMPAT_MODULES:=wcte12xp wctc4xxp wctdm24xxp zttranscode -endif -endif - -MENUSELECT_MODULES+=$(sort $(INCOMPAT_MODULES)) - -ifeq ($(findstring xpp,$(MENUSELECT_MODULES)),) - BUILD_XPP:=yes -endif - -SUBDIRS_UTILS_ALL:= kernel/xpp/utils ppp -SUBDIRS_UTILS := -ifeq ($(BUILD_XPP),yes) - SUBDIRS_UTILS += kernel/xpp/utils -endif -#SUBDIRS_UTILS += ppp - -TOPDIR_MODULES:=pciradio tor2 torisa wcfxo wct1xxp wctdm wcte11xp wcusb zaptel ztd-eth ztd-loc ztdummy ztdynamic zttranscode -SUBDIR_MODULES:=wct4xxp wctc4xxp xpp wctdm24xxp wcte12xp -TOPDIR_MODULES+=$(MODULES_EXTRA) -SUBDIR_MODULES+=$(SUBDIRS_EXTRA) -BUILD_TOPDIR_MODULES:=$(filter-out $(MENUSELECT_MODULES),$(TOPDIR_MODULES)) -BUILD_SUBDIR_MODULES:=$(filter-out $(MENUSELECT_MODULES),$(SUBDIR_MODULES)) -BUILD_MODULES:=$(BUILD_TOPDIR_MODULES) $(BUILD_SUBDIR_MODULES) - -MOD_DESTDIR:=zaptel - -KERN_DIR:=kernel - -#NOTE NOTE NOTE -# -# all variables set before the include of Makefile.kernel26 are needed by the 2.6 kernel module build process - -ifneq ($(KBUILD_EXTMOD),) - -obj-m:=$(BUILD_TOPDIR_MODULES:%=%.o) -obj-m+=$(BUILD_SUBDIR_MODULES:%=%/) - -include $(src)/Makefile.kernel26 - -else -KBUILD_OBJ_M=$(BUILD_TOPDIR_MODULES:%=%.o) $(BUILD_SUBDIR_MODULES:%=%/) - -ifeq ($(BUILDVER),linux24) - INSTALL_MODULES:=$(BUILD_TOPDIR_MODULES:%=$(KERN_DIR)/%.o) - INSTALL_MODULES+=$(foreach mod,$(BUILD_SUBDIR_MODULES),$(KERN_DIR)/$(mod)/$(mod).o) - ALL_MODULES:=$(TOPDIR_MODULES:%=$(KERN_DIR)/%.o) - ALL_MODULES+=$(SUBDIR_MODULES:%=$(KERN_DIR)/%/%.o) -else - ALL_MODULES:=$(TOPDIR_MODULES:%=%.ko) - ALL_MODULES+=$(foreach mod,$(filter-out xpp,$(SUBDIR_MODULES)),$(mod)/$(mod).ko) - ALL_MODULES+=$(patsubst %,xpp/%.ko,xpp_usb xpd_fxo xpd_fxs xpp) -endif - -OPTFLAG=-O2 -CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER -ifneq (,$(findstring ppc,$(UNAME_M))) -CFLAGS_PPC:=-fsigned-char -endif -ifneq (,$(findstring x86_64,$(UNAME_M))) -CFLAGS_x86_64:=-m64 -endif -CFLAGS+=$(CFLAGS_PPC) $(CFLAGS_x86_64) -KFLAGS=-I$(KINCLUDES) -O6 -KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \ - -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I$(KSRC)/drivers/net/wan -I$(KINCLUDES)/net -ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h)) - KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h -endif -ifneq (,$(findstring ppc,$(UNAME_M))) -KFLAGS_PPC:=-msoft-float -fsigned-char -endif -KFLAGS+=$(KFLAGS_PPC) -ifeq ($(KVERS_MAJ),2.4) - ifneq (,$(findstring x86_64,$(UNAME_M))) - KFLAGS+=-mcmodel=kernel - endif -endif - -# -# Features are now configured in zconfig.h -# - -MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp - -KFLAGS+=-DSTANDALONE_ZAPATA -CFLAGS+=-DSTANDALONE_ZAPATA -ifeq ($(BUILDVER),linux24) -KMAKE = $(MAKE) -C kernel HOTPLUG_FIRMWARE=no \ - HOSTCC=$(HOSTCC) ARCH=$(ARCH) KSRC=$(KSRC) LD=$(LD) CC=$(CC) \ - UNAME_M=$(UNAME_M) \ - BUILD_TOPDIR_MODULES="$(BUILD_TOPDIR_MODULES)" BUILD_SUBDIR_MODULES="$(BUILD_SUBDIR_MODULES)" -else -KMAKE = $(MAKE) -C $(KSRC) ARCH=$(ARCH) SUBDIRS=$(PWD)/kernel \ - HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE) KBUILD_OBJ_M="$(KBUILD_OBJ_M)" -endif -KMAKE_INST = $(KMAKE) \ - INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=misc modules_install - -ROOT_PREFIX= - -CONFIG_FILE=/etc/zaptel.conf -CFLAGS+=-DZAPTEL_CONFIG=\"$(CONFIG_FILE)\" - -# sample makefile "trace print" -#tracedummy=$(shell echo ====== GOT HERE ===== >&2; echo >&2) - -CHKCONFIG := $(wildcard /sbin/chkconfig) -UPDATE_RCD := $(wildcard /usr/sbin/update-rc.d) -ifeq (,$(DESTDIR)) - ifneq (,$(CHKCONFIG)) - ADD_INITD := $(CHKCONFIG) --add zaptel - else - ifndef (,$(UPDATE_RCD)) - ADD_INITD := $(UPDATE_RCD) zaptel defaults 15 30 - endif - endif -endif - -INITRD_DIR := $(firstword $(wildcard /etc/rc.d/init.d /etc/init.d)) -ifneq (,$(INITRD_DIR)) - INIT_TARGET := $(DESTDIR)$(INITRD_DIR)/zaptel - COPY_INITD := install -D zaptel.init $(INIT_TARGET) -endif -RCCONF_DIR := $(firstword $(wildcard /etc/sysconfig /etc/default)) - -NETSCR_DIR := $(firstword $(wildcard /etc/sysconfig/network-scripts )) -ifneq (,$(NETSCR_DIR)) - NETSCR_TARGET := $(DESTDIR)$(NETSCR_DIR)/ifup-hdlc - COPY_NETSCR := install -D ifup-hdlc $(NETSCR_TARGET) -endif - -ifneq ($(wildcard .version),) - ZAPTELVERSION:=$(shell cat .version) -else -ifneq ($(wildcard .svn),) - ZAPTELVERSION=SVN-$(shell build_tools/make_svn_branch_name) -endif -endif - -LTZ_A:=libtonezone.a -LTZ_A_OBJS:=zonedata.o tonezone.o -LTZ_SO:=libtonezone.so -LTZ_SO_OBJS:=zonedata.lo tonezone.lo -LTZ_SO_MAJOR_VER:=1 -LTZ_SO_MINOR_VER:=0 - -# libdir, includedir and mandir are defined in makeopts (from -# configure). -# we use /sbin, rather than configure's $(sbindir) because we use /sbin -# for historical reasons. -BIN_DIR:=/sbin -LIB_DIR:=$(libdir) -INC_DIR:=$(includedir)/zaptel -MAN_DIR:=$(mandir)/man8 -MOD_DIR:=$(DESTDIR)/lib/modules/$(KVERS)/misc - -# Utilities we build with a standard build procedure: -UTILS = zttool zttest ztmonitor ztspeed sethdlc-new ztcfg \ - ztcfg-dude usbfxstest fxstest fxotune ztdiag torisatool \ - ztscan - - -# Makefile mentions them. Source is not included (anynore?) -UTILS += fxsdump ztprovision - -# some tests: -UTILS += patgen pattest patlooptest hdlcstress hdlctest hdlcgen \ - hdlcverify timertest - -UTILSO = $(UTILS:%=%.o) - -BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest ztscan -ifeq (1,$(PBX_LIBNEWT)) - BINS+=zttool -endif -BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS)) -MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8)) - -# All the man pages. Not just installed ones: -GROFF_PAGES := $(wildcard doc/*.8 kernel/xpp/utils/*.8) -GROFF_HTML := $(GROFF_PAGES:%=%.html) - -all: menuselect.makeopts - @$(MAKE) _all - -_all: $(if $(BUILD_MODULES),modules) programs - -libs: $(LTZ_SO) $(LTZ_A) - -utils-subdirs: - @for dir in $(SUBDIRS_UTILS); do \ - $(MAKE) -C $$dir; \ - done - -programs: libs utils - -utils: $(BINS) utils-subdirs - -modules: prereq -ifeq (no,$(HAS_KSRC)) - echo "You do not appear to have the sources for the $(KVERS) kernel installed." - exit 1 -endif - $(KMAKE) modules - -version.h: FORCE - @ZAPTELVERSION="${ZAPTELVERSION}" build_tools/make_version_h > $@.tmp - @if cmp -s $@.tmp $@ ; then :; else \ - mv $@.tmp $@ ; \ - fi - @rm -f $@.tmp - -tests: patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest - -zonedata.o: tonezone.h - -zonedata.lo: zonedata.c tonezone.h - $(CC) -c $(CFLAGS) -o $@ $< - -tonezone.o: kernel/zaptel.h tonezone.h - -tonezone.lo: tonezone.c tonezone.h kernel/zaptel.h - $(CC) -c $(CFLAGS) -o $@ $< - -prereq: config.status version.h - -zttool.o: kernel/zaptel.h -zttool.o: CFLAGS+=$(NEWT_INCLUDE) -zttool: LDLIBS+=$(NEWT_LIB) - -ztscan.o: kernel/zaptel.h - -ztprovision.o: kernel/zaptel.h - -ztmonitor.o: kernel/zaptel.h - -ztspeed: CFLAGS= - -sethdlc-new: CFLAGS+=-I$(KINCLUDES) - -$(LTZ_A): $(LTZ_A_OBJS) - ar rcs $@ $^ - ranlib $@ - -$(LTZ_SO): $(LTZ_SO_OBJS) - $(CC) $(CFLAGS) -shared -Wl,-soname,$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) -o $@ $^ $(LDFLAGS) $(LDLIBS) -lm - -ztcfg.o: ztcfg.h kernel/zaptel.h -ztcfg: ztcfg.o $(LTZ_A) -ztcfg: LDLIBS+=-lm - -ztcfg-shared: ztcfg.o $(LTZ_SO) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) -lm - -ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LTZ_SO) -ztcfg-dude: LDLIBS+=-lm -lstdc++ - -data: - $(MAKE) -C datamods datamods - -# FIXME: we assume CC can build the C++ modules: -complex.o mknotch.o: %.o: %.cc - $(CC) $(CFLAGS) -o $@ -c $< - -usbfxstest: LDLIBS+=-lzap -fxstest: $(LTZ_SO) -fxstest: LDLIBS+=-lm -fxotune: LDLIBS+=-lm -fxsdump: LDLIBS+=-lm - -stackcheck: checkstack modules - ./checkstack kernel/*.ko kernel/*/*.ko - - -tonezones.txt: zonedata.c - perl -ne 'next unless (/\.(country|description) = *"([^"]*)/); \ - print (($$1 eq "country")? "* $$2\t":"$$2\n");' $< \ - >$@ - -zaptel.conf.asciidoc: zaptel.conf.sample - perl -n -e \ - 'if (/^#($$|\s)(.*)/){ if (!$$in_doc){print "\n"}; $$in_doc=1; print "$$2\n" } else { if ($$in_doc){print "\n"}; $$in_doc=0; print " $$_" }' \ - $< \ - | perl -p -e 'if (/^ #?(\w+)=/ && ! exists $$cfgs{$$1}){my $$cfg = $$1; $$cfgs{$$cfg} = 1; s/^/\n[[cfg_$$cfg]]\n/}' >$@ - -README.html: README zaptel.conf.asciidoc tonezones.txt - $(ASCIIDOC) -n -a toc -a toclevels=3 $< - -kernel/xpp/README.Astribank.html: kernel/xpp/README.Astribank - cd $(@D); $(ASCIIDOC) -o $(@F) -n -a toc -a toclevels=4 $($@ - -htmlman: $(GROFF_HTML) - - -MISDNVERSION=1_1_7_2 -MISDNUSERVERSION=1_1_7_2 -b410p: - @if test "$(DOWNLOAD)" = ":" ; then \ - echo "**************************************************"; \ - echo "*** ***"; \ - echo "*** You must have either wget or fetch to be ***"; \ - echo "*** able to automatically download and install ***"; \ - echo "*** b410p support. ***"; \ - echo "*** ***"; \ - echo "*** Please install one of these. ***"; \ - echo "*** ***"; \ - echo "**************************************************"; \ - exit 1; \ - fi - [ -f mISDN-$(MISDNVERSION).tar.gz ] || $(DOWNLOAD) http://downloads.digium.com/pub/zaptel/b410p/mISDN-$(MISDNVERSION).tar.gz - tar -zxf mISDN-$(MISDNVERSION).tar.gz - $(MAKE) -C mISDN-$(MISDNVERSION) install - [ -f mISDNuser-$(MISDNUSERVERSION).tar.gz ] || $(DOWNLOAD) http://downloads.digium.com/pub/zaptel/b410p/mISDNuser-$(MISDNUSERVERSION).tar.gz - tar -zxf mISDNuser-$(MISDNUSERVERSION).tar.gz - $(MAKE) -C mISDNuser-$(MISDNUSERVERSION) install - -$(UTILS): %: %.o - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) - -$(UTILSO): %.o: %.c - $(CC) $(CFLAGS) -o $@ -c $< - -install: all devices install-modules install-programs install-firmware - @echo "###################################################" - @echo "###" - @echo "### Zaptel installed successfully." - @echo "### If you have not done so before, install init scripts with:" - @echo "###" - @echo "### make config" - @echo "###" - @echo "###################################################" -ifneq ($(INCOMPAT_MODULES),) - @echo "***************************************************" - @echo "***" - @echo "*** WARNING:" - @echo "*** The following modules were not installed due to" - @echo "*** being incompatible with your $(KVERS) kernel." - @echo "***" - @echo "*** $(INCOMPAT_MODULES)" - @echo "***" - @echo "***************************************************" -endif - -install-programs: install-utils install-libs install-include - -install-utils: utils install-utils-subdirs -ifneq (,$(BINS)) - install -d $(DESTDIR)$(BIN_DIR) - install $(BINS) $(DESTDIR)$(BIN_DIR)/ - install -d $(DESTDIR)$(MAN_DIR) - install -m 644 $(MAN_PAGES) $(DESTDIR)$(MAN_DIR)/ -endif -ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE))) - $(INSTALL) -D -m 644 zaptel.conf.sample $(DESTDIR)$(CONFIG_FILE) -endif - -# Pushing those two to a separate target that is not used by default: -install-modconf: - build_tools/genmodconf $(BUILDVER) "$(ROOT_PREFIX)" "$(filter-out zaptel ztdummy xpp zttranscode ztdynamic,$(BUILD_MODULES)) $(MODULE_ALIASES)" - @if [ -d /etc/modutils ]; then \ - /sbin/update-modules ; \ - fi - -install-firmware: menuselect.makeopts -ifeq ($(HOTPLUG_FIRMWARE),yes) - $(MAKE) -C firmware hotplug-install DESTDIR=$(DESTDIR) HOTPLUG_FIRMWARE=$(HOTPLUG_FIRMWARE) -endif - -install-libs: libs - $(INSTALL) -D -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/$(LTZ_A) - $(INSTALL) -D -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) -ifeq (,$(DESTDIR)) - if [ `id -u` = 0 ]; then \ - /sbin/ldconfig || : ;\ - fi -endif - rm -f $(DESTDIR)$(LIB_DIR)$(LTZ_SO) - $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ - $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER) - $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ - $(DESTDIR)$(LIB_DIR)/$(LTZ_SO) -ifneq (no,$(USE_SELINUX)) - ifeq (,$(DESTDIR)) - /sbin/restorecon -v $(DESTDIR)$(LIB_DIR)/$(LTZ_SO) - endif -endif - -install-utils-subdirs: - @for dir in $(SUBDIRS_UTILS); do \ - $(MAKE) -C $$dir install; \ - done - -install-include: - $(INSTALL) -D -m 644 kernel/zaptel.h $(DESTDIR)$(INC_DIR)/zaptel.h - $(INSTALL) -D -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/tonezone.h - @rm -rf $(DESTDIR)$(includedir)/dahdi - -devices: -ifneq (yes,$(DYNFS)) - mkdir -p $(DESTDIR)/dev/zap - rm -f $(DESTDIR)/dev/zap/ctl - rm -f $(DESTDIR)/dev/zap/channel - rm -f $(DESTDIR)/dev/zap/pseudo - rm -f $(DESTDIR)/dev/zap/timer - rm -f $(DESTDIR)/dev/zap/transcode - rm -f $(DESTDIR)/dev/zap/253 - rm -f $(DESTDIR)/dev/zap/252 - rm -f $(DESTDIR)/dev/zap/251 - rm -f $(DESTDIR)/dev/zap/250 - mknod $(DESTDIR)/dev/zap/ctl c 196 0 - mknod $(DESTDIR)/dev/zap/transcode c 196 250 - mknod $(DESTDIR)/dev/zap/timer c 196 253 - mknod $(DESTDIR)/dev/zap/channel c 196 254 - mknod $(DESTDIR)/dev/zap/pseudo c 196 255 - N=1; \ - while [ $$N -lt 250 ]; do \ - rm -f $(DESTDIR)/dev/zap/$$N; \ - mknod $(DESTDIR)/dev/zap/$$N c 196 $$N; \ - N=$$[$$N+1]; \ - done -else # DYNFS - ifneq (yes,$(UDEVRULES)) #!UDEVRULES - @echo "**** Dynamic filesystem detected -- not creating device nodes" - else # UDEVRULES - install -d $(DESTDIR)/etc/udev/rules.d - build_tools/genudevrules > $(DESTDIR)/etc/udev/rules.d/zaptel.rules - endif -endif - -install-udev: devices - -uninstall-hotplug: - $(MAKE) -C firmware hotplug-uninstall DESTDIR=$(DESTDIR) - -ifeq ($(BUILDVER),linux24) -install-modules: $(INSTALL_MODULES) - $(INSTALL) -d $(DESTDIR)$(MOD_DIR) - $(INSTALL) -m 644 $(INSTALL_MODULES) $(DESTDIR)$(MOD_DIR) -else -install-modules: -ifndef DESTDIR - @if modinfo dahdi > /dev/null 2>&1; then \ - echo -n "Removing DAHDI modules for kernel $(KVERS), please wait..."; \ - build_tools/uninstall-modules dahdi $(KVERS); \ - rm -rf /lib/modules/$(KVERS)/dahdi; \ - echo "done."; \ - fi - build_tools/uninstall-modules dahdi $(KVERS) -endif - $(KMAKE_INST) -endif - [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : - -uninstall-modules: -ifneq ($(BUILDVER),linux24) -ifdef DESTDIR - echo "Uninstalling modules is not supported with a DESTDIR specified." - exit 1 -else - @if modinfo zaptel > /dev/null 2>&1 ; then \ - echo -n "Removing Zaptel modules for kernel $(KVERS), please wait..."; \ - build_tools/uninstall-modules zaptel $(KVERS); \ - rm -rf /lib/modules/$(KVERS)/zaptel; \ - echo "done."; \ - fi - [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || : -endif -endif - -config: -ifneq (,$(COPY_INITD)) - $(COPY_INITD) -endif -ifneq (,$(RCCONF_DIR)) - ifeq (,$(wildcard $(DESTDIR)$(RCCONF_DIR)/zaptel)) - $(INSTALL) -D -m 644 zaptel.sysconfig $(DESTDIR)$(RCCONF_DIR)/zaptel - endif -endif -ifneq (,$(COPY_NETSCR)) - $(COPY_NETSCR) -endif -ifneq (,$(ADD_INITD)) - $(ADD_INITD) -endif - @echo "Zaptel has been configured." - @echo "" - @echo "If you have any zaptel hardware it is now recommended to " - @echo "edit /etc/default/zaptel or /etc/sysconfig/zaptel and set there an " - @echo "optimal value for the variable MODULES ." - @echo "" - @echo "I think that the zaptel hardware you have on your system is:" - @kernel/xpp/utils/zaptel_hardware || true - - -update: - @if [ -d .svn ]; then \ - echo "Updating from Subversion..." ; \ - svn update | tee update.out; \ - rm -f .version; \ - if [ `grep -c ^C update.out` -gt 0 ]; then \ - echo ; echo "The following files have conflicts:" ; \ - grep ^C update.out | cut -b4- ; \ - fi ; \ - rm -f update.out; \ - else \ - echo "Not under version control"; \ - fi - -clean: - -@$(MAKE) -C menuselect clean - rm -f torisatool - rm -f $(BINS) - rm -f *.o ztcfg tzdriver sethdlc sethdlc-new - rm -f $(LTZ_SO) $(LTZ_A) *.lo -ifeq (yes,$(HAS_KSRC)) - $(KMAKE) clean -else - rm -f kernel/*.o kernel/*.ko kernel/*/*.o kernel/*/*.ko -endif - @for dir in $(SUBDIRS_UTILS_ALL); do \ - $(MAKE) -C $$dir clean; \ - done - $(MAKE) -C firmware clean - rm -rf .tmp_versions - rm -f gendigits tones.h - rm -f libtonezone* - rm -f fxotune - rm -f core - rm -f ztcfg-shared fxstest - rm -rf misdn* - rm -rf mISDNuser* - rm -rf $(GROFF_HTML) - rm -rf README.html xpp/README.Astribank.html zaptel.conf.asciidoc - -distclean: dist-clean - -dist-clean: clean - @$(MAKE) -C menuselect dist-clean - @$(MAKE) -C firmware dist-clean - rm -f makeopts menuselect.makeopts menuselect-tree - rm -f config.log config.status - -config.status: configure - @CFLAGS="" ./configure - @echo "****" - @echo "**** The configure script was just executed, so 'make' needs to be" - @echo "**** restarted." - @echo "****" - @exit 1 - -menuselect.makeopts: menuselect/menuselect menuselect-tree - @menuselect/menuselect --check-deps ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} $@ - -menuconfig: menuselect - -menuselect: menuselect/menuselect menuselect-tree - -@menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!" - -menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h config.status - @CFLAGS="" $(MAKE) -C menuselect CC=$(HOSTCC) - -menuselect-tree: zaptel.xml firmware/firmware.xml - @echo "Generating input for menuselect ..." - @build_tools/make_tree > $@ - -.PHONY: menuselect distclean dist-clean clean all _all install b410p devices programs modules tests devel data stackcheck install-udev config update install-programs install-modules install-include install-libs install-utils-subdirs utils-subdirs uninstall-modules - -FORCE: - -endif - -#end of: ifneq ($(KBUILD_EXTMOD),) -endif diff --git a/zaptel/README b/zaptel/README deleted file mode 100644 index b9c947ad..00000000 --- a/zaptel/README +++ /dev/null @@ -1,761 +0,0 @@ -Zapata Telephony Interface Driver -================================= -Asterisk Development Team -$Revision: 4504 $, $Date: 2008-08-22 06:48:43 -0700 (Fri, 22 Aug 2008) $ - -Zaptel is a short for ZAPata TELephony. - -Supported Hardware ------------------- -Digital Cards -~~~~~~~~~~~~~ -- wct4xxp: - * Digium TE205P/TE207P/TE210P/TE212P: PCI dual-port T1/E1/J1 - * 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 -- wcte12xp: - * Digium TE120P: PCI single-port T1/E1/J1 - * Digium TE121: PCI-Express single-port T1/E1/J1 - * Digium TE122: PCI single-port T1/E1/J1 -- wcte11xp: - * Digium TE110P: PCI single-port T1/E1/J1 -- wct1xxp: - * Digium T100P: PCI single-port T1 - * Digium E100P: PCI single-port E1 -- tor2: Tormenta quad-span T1/E1 card from the Zapata Telephony project -- torisa: The old dual-span ISA T1 card from Zapata Telephony - - -Analog Cards -~~~~~~~~~~~~ -- wctdm24xxp: - * Digium TDM2400P/AEX2400: up to 24 analog ports - * Digium TDM800P/AEX800: up to 8 analog ports - * Digium TDM410: up to 4 analog ports -- wctdm: - * Digium TDM400P: up to 4 analog ports -- xpp: Xorcom Astribank: a USB connected unit of up to 32 ports - (includeing the digital BRI and E1/T1 modules) -- wcfxo: X100P, similar and clones. A simple single-port FXO card -- wcusb: Digium S100U: A simple single-port USB FXS unit - - -Other Drivers -~~~~~~~~~~~~~ -- pciradio: Zapata Telephony PCI Quad Radio Interface -- wctc4xxp: Digium hardware transcoder cards (also need zttranscode) -- ztd-eth: TDM over Ethernet (TDMoE) driver. Requires ztdynamic -- ztd-loc: Mirror a local span. Requires ztdynamic -- ztdummy: A dummy driver that only provides a zaptel timing source. - - -Build Requirements ------------------- -You will need a matching kernel source tree and a working Linux build -system. Some of the programs require some additional libraries. - -The script install_prereq should help you install the -required packages. To see what it suggests, run: - - ./install_prereq test - -You can either copy/paste that code to a terminal to run it, or just -run: - - ./install_prereq install - - -Kernel Source / "Headers" -~~~~~~~~~~~~~~~~~~~~~~~~~ -- Building Zaptel requires a kernel build tree. -- This should basically be at least a partial kernel source tree and - most importantly, the exact kernel .config file used for the build as - well as several files generated at kernel build time. -- KERNEL_VERSION is the output of the command `uname -r` -- If you build your own kernel, you need to point to the exact kernel - build tree. Luckily for you, this will typically be pointed by the - symbolic link /lib/modules/KERNEL_VERSION/build which is the location - zaptel checks by default. -- If you use a kernel from your distribution you will typically have a - package with all the files required to build a kernel modules for your - kernel image. - * On Debian Etch and above and any Ubuntu this is - +++ linux-headers-`uname -r` +++ - * On Fedora, RHEL and compatibles (e.g. CentOS) this is the - kernel-devel package. Or if you run kernel-smp or kernel-xen, you - need kernel-smp-devel or kernel-xen-devel, respectively. - * On SUSE you seem to need the package kernel-source . - * In some distributions (e.g.: in RHEL/CentOS, Fedora, Ubuntu) the - installation of the kernel-devel / kernel-headers package will - be of a version that is newer than the one you currently run. In - such a case you may need to upgrade the kernel package itself as - well and reboot. -- To point explicitly to a different build tree: set KSRC to the kernel - source tree and KVERS to the exact kernel version: - - make KVERS=2.6.18.Custom KSRC=/home/tzafrir/kernels/2.6.18 - - -Kernel Configuration -~~~~~~~~~~~~~~~~~~~~ -If you build a custom kernel, note the following configuration items: - -- CONFIG_CRC_CCITT must be enabled ('y' or 'm'). On 2.6 kernels this can - be selected These can be selected from the "Library Routines" submenu - during kernel configuration via "make menuconfig". -- If you don't have any Zaptel hardware, you need ztdummy. ztdummy takes - its timing from the kernel. It can use either of the following: - * ztdummy on i386/x86_64 with kernels >= 2.6.22 can (and should) use - high resolution timers (CONFIG_HIGH_RES_TIMERS), and (if available), - the system HPET. This shows as "source: HRTimer". This is - recommended. - * ztdummy on i386/x86_64 with kernels >= 2.6.15 can use the - system's RTC (Real Time Clock). This shows as "source: RTC". - * Failing that, on Linux 2.6 kernels with HZ=1000 (was the default - before 2.6.13). This shows as "source: Linux26". - * Alternatives to that for ztdummy are a UHCI USB controller (USB - controllers made by Intel or VIA) or a kernel that has HZ=1000 - (default on kernels 2.6.0-2.6.12, optional on newer kernels. Not - possible on 2.4). This shows as: "source: UHCI". - - -Build System -~~~~~~~~~~~~~~ -gcc and friends. Generally you will need to install the package gcc. -There may be cases where you will need a specific version of gcc to build -kernel modules. - - -Extra Libraries -~~~~~~~~~~~~~~~ -Some libraries are needed for extra utilities that are provided with -Zaptel - -- libusb is needed for building fpga_load, needed for firmware loading of - the Xorcom Astribank. -- libnewt is needed to build the optional but useful utility zttool. - - -Distribution-Specific Instructions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -==== Debian 4.0 (Etch) - apt-get install linux-headers-`uname -r` build-essential libnewt-dev libusb-dev - -==== Debian 3.1 (Sarge) - apt-get install kernel-headers-`uname -r` build-essential libnewt-dev libusb-dev - -==== RHEL4 / CentOS 4 -You need the following non-kernel-related packages: - - yum install gcc newt-devel libusb-devel - -If the following command produces an error, you need to install -the kernel devel package: - - ls /lib/modules/`uname -r`/build/.config - -The right one depends on your kernel version. If the following command -produces output you have an SMP kernel: - - uname -r | grep smp - -and thus need to run: - - yum install kernel-smp kernel-smp-devel - -If that command produced no output, you have a non-SMP kernel: - - yum install kernel kernel-devel - -At this point you should probably reboot to get the new kernel in effect. - - -Installation ------------- -Note: If using `sudo` to build/install, you may need to add /sbin to your PATH. ----------------------------------- -./configure -# optional step: select custom configuration: -#make menuconfig -make -make install -# To install init scripts and config files: -#make config ----------------------------------- - - -Build Tweaks -~~~~~~~~~~~~ -Selecting Modules and Utilities -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You can select the modules and utilities you wish to build and firmwares -you wish to download by running `make menuselect` . The selection of modules -that you build (or rather: not build) is saved in the file -`menuselect.makeopts`. - - -Extra Modules -^^^^^^^^^^^^^ -To build extra modules / modules directory not included in the Zaptel -distribution, use the optional variables MODULES_EXTRA and -SUBDIRS_EXTRA: - - make MODULES_EXTRA="mod1 mod2" - make MODULES_EXTRA="mod1 mod2" SUBDIRS_EXTRA="subdir1/ subdir1/" - -Note that those names are not guaranteed to continue to work on newer -versions. Hopefully there will be no need for such extra configuration. - -Partial Build/Install -^^^^^^^^^^^^^^^^^^^^^ -There are some make targets that are provided to build or install just -parts of Zaptel: - -. Build targets: - - make modules: build just the kernel modules. - - make programs: Build just the Zaptel userspace programs. partial - targets of it: - * make 'utilname': builds 'utilname' alone (e.g: `make ztdiag`) - * make utils: Build libtonezone. - * make libs: Build libtonezone. -. Install targets: - - make install-modules: install just kernel modules. - - make firmware: download and install firmwares for Digium cards - - make install-programs: Userspace: Partial targets of it are: - * make install-utils: install Zaptel userspace programs and - and basic support files. - * make install-libs: install libtonezone - * make install-include: install zaptel.h - - make config: should be run once to configure - -Building to a Subtree -^^^^^^^^^^^^^^^^^^^^^ -The following may be useful when testing the package or when preparing a -package for a binary distribution (such as an rpm package) installing -onto a subtree rather than on th real system. - - make install DESTDIR=targetdir - -This can be useful for any partial install target of the above (e.g: -install-modules or install-programs). - -the targetdir must be an absolute path, at least if you install the -modules. To install to a relative path you can use something like: - - make install-modules DESTDIR=$PWD/target - -The 'install' target might fail if run as a user to a DESTDIR when -attempting to generate device files. In that case, try: - - make install DESTDIR=$PWD/target DYNFS= - - -Test Install: live_zap -^^^^^^^^^^^^^^^^^^^^^^ -If you need to test a version of Zaptel without touching the version -installed on your system, you can use the script live_zap . Note, -however, that it may take some extra configuration to be used right. - -Basic usage: - - ./configure - make - ./live_zap install # instead of 'make install' - ./live_zap config # instead of 'make config' - ./live_zap unload # instead of '/etc/init.d/zaptel stop' - ./live_zap load # instead of '/etc/init.d/zaptel start' - -Everything is installed under the subdirectory live/ . You will probably -need to adjust MODULES . Generally you should not edit the script -itself, but , rather, edit live/live.conf . Please let me know if you -needed to change anything in the script beyond changing live.conf so I -can include useful fixes. - -Testing on a different machine: - - ./configure - make - ./live_zap install # instead of 'make install' - ./live_zap config # instead of 'make config' - ./live_zap rsync root@remotehost - ssh root@remotehost - # in the remote host: - cd /tmp - ./live_zap unload - ./live_zap load - -live_zap also has a command called "exec" to execute commands from the -installed environment. e.g.: - - ./live_zap exec lszaptel - -This sets PATH, PERL5LIB (for the Zaptel-perl modules) and some other -settings. - -For Xorcom Astribank you may need to load a different version of -firmware from that installed on the system. In this case, start with -editing the real system's /etc/default/zaptel (on Debian) or -/etc/sysconfig/zaptel (on RedHat/SUSE) and set: - - XPP_HOTPLUG_DISABLED=yes - -and then run: - - ./live_zap unload - ./live_zap exec ./live/usr/share/zaptel/xpp_fxloader reset - ./live_zap exec ./live/usr/share/zaptel/xpp_fxloader load - # wait a few seconds, see the output of lsusb - ./live_zap load - - -./configure Options -^^^^^^^^^^^^^^^^^^^ -The configure script various several tests and based on them generates -some files ( build_tools/menuselect-deps and makeopts). You can pass it ---with options and variable settings, for instance: - - ./configure --without-ncurses CC="gcc-4.10" - -If you just want to recreate the same files without a full detection -run, use: - - ./config.status - -To re-run ./configure with the same parameters it was run with last -time, use: - - ./ocnfig.status --recheck - - -Configuration -------------- -zaptel.conf -~~~~~~~~~~~ -The main method to configure Zaptel devices is using the utility -*ztcfg*. ztcfg reads data from the configuration file /etc/zaptel.conf , -figures out what configuration to send to channels, and send it. - -A sample annotated zaptel.conf is included in this directory and -installed by default to /etc/zaptel.conf . Edit it to suit your -configuration. Alternatively use the script genzaptelconf to generate -one that should work with your system. - - -sysconfig/default -~~~~~~~~~~~~~~~~~ -The configuration file of the zaptel init.d script is either -/etc/default/zaptel (Debian systems) or /etc/sysconfig/zaptel (most -others). That file is used to override defaults that are set at the -beginning of the init.d script. - -For instance, to define for the init.d script to load the modules wctdm -and xpp_usb (in that order) add the following line to that file: - - MODULES="wctdm xpp_usb" - -Currently that file must set "TELEPHONY=yes" for the zaptel init.d to -work. - -Module Parameters -~~~~~~~~~~~~~~~~~ -The kernel modules can be configured through module parameters. Module -parameters can optionally be set at load time. They are normally set (if -needed) by a line in a file under /etc/modprobe.d/ or in the file -/etc/modprobe.conf (Or /etc/modules.conf in kernel 2.4). - -Example line: - - options zaptel debug=1 - -The module parameters can normally be modified at runtime through sysfs: - - pungenday:~# cat /sys/module/zaptel/parameters/debug - 0 - pungenday:~# echo 1 >/sys/module/zaptel/parameters/debug - pungenday:~# cat /sys/module/zaptel/parameters/debug - 1 - -Viewing and setting parameters that way is possible as of kernel 2.6 . -In kernels older than 2.6.10, the sysfs "files" for the parameters -reside directly under /sys/module/'module_name' . - -Useful module parameters: - -debug (most modules):: - Sets debug mode / debug level. With most modules 'debug' can be either - disabled (0, the default value) or enabled (any other value). - + - + - wctdm and wcte1xp print several extra debugging messages if the value - of debug is more than 1. - + - + - Some modules have "debugging flags" bits - the value of debug is a - bitmask and several messages are printed if some bits are set: - - ztdummy: - * 1: DEBUG_GENERAL - general error messages. - * 2: DEBUG_TICKS - Show that the module is alive :-) - - wctdm24xxp: - * 1: DEBUG_CARD - * 2: DEBUG_ECHOCAN - - wct4xxp: - * 1: DEBUG_MAIN - * 2: DEBUG_DTMF - * 4: DEBUG_REGS - * 8: DEBUG_TSI - * 16: DEBUG_ECHOCAN - * 32: DEBUG_RBS - * 64: DEBUG_FRAMER - - xpp: Previously (before 1.2.26 / 1.4.11) it was called "print_dbg". - See also README.Astribank: - * 1: GENERAL - General debug comments. - * 2: PCM - PCM-related messages. Tend to flood logs. - * 4: LEDS - Anything related to the LEDs status control. The driver - produces a lot of messages when the option is enabled. - * 8: SYNC - Synchronization related messages. - * 16: SIGNAL - Zaptel signalling related messages. - * 32: PROC - Messages related to the procfs interface. - * 64: REGS - Reading and writing to chip registers. Tends to flood - logs. - * 128: DEVICES - Device instantiation, destruction and such. - * 256 - COMMANDS - Protocol commands. Tends to flood logs. - -deftaps (zaptel):: - The default size for the echo canceller. The number is in "taps", that - is "samples", 1/8 ms. The default is 64 - for a tail size of 8 ms. - + - + - Asterisk's chan_zap tends to pass its own value anyway, with a - different default size. So normally setting this doesn't change - anything. - -To get a list of parameters supported by a module, use - - modinfo module_name - -Or, for a module you have just built: - - modinfo ./module_name.ko - -For the xpp modules this will also include the description and default -value of the module. You can find a list of useful xpp module parameters -in README.Astribank . - - -Reference Configuration ------------------------ -include::zaptel.conf.asciidoc[] - -Tonezones -~~~~~~~~~ -The file zonedata.c contains the information about the tone zones used -in libtonezone (and hence also in ztcfg). Here is a list of those zones: - -include::tonezones.txt[] - - -Zaptel PERL modules -------------------- -The directory xpp/utils has, in addition to helper utilities for the -Xorcom Astribank, a collection of perl modules to provide information -related to Zaptel. The perl modules themselves are under xpp/utils/zconf . -In xpp/utils there are several utilities that use those modules: -- xpp-specific: zt_registration, xpp_sync, xpp_blink . -- General: lszaptel, zapconf, zaptel_hardware - -The zaptel perl modules will currently only be automatically installed -if you happen to isntall the xpp module. This should be the defualt, but -you can also initiate it manually by running: - - make -C xpp/utils install - -Those utilities require the perl modules to be installed, however they -will also look for them in the directory zconf, and thus can be run -directly from the zaptel source tree. For example: - - ./xpp/utils/zaptel_hardware - -To get usage information on a program, you can also use perldoc -(sometimes provided in a package separate from perl itself). For -instance: - - perldoc ./xpp/utils/lszaptel - -Some of them are specific for the Xorcom Astribank and described in its -docuemntation. the others are: - -lszaptel:: - A somewhat glorified `cat /proc/zaptel/*`. -zapconf:: - An currently experimental and intended to eventually replace - genzaptelconf by a more maintainable code. -zaptel_drivers:: - A two-liner script (not installed by default) that simply returns the - modules that should be modprobed on this system. -zaptel_hardware:: - Uses the information from sysfs and its own knowledge to show - what PCI/USB Zaptel hardware is connected and if it is currently used - by a driver. Shows also some more information for Astrobanks from - /proc/xpp . - -Internals ---------- -Zaptel Device Files -~~~~~~~~~~~~~~~~~~~ -Userspace programs will usually interact with Zaptel through device -files under the /dev/zap directory (pedantically: characted device files -with major number 196) . Those device files can be generated statically -or dynamically through the udev system. - -* /dev/zap/ctl (196:0) - a general device file for various information and - control operations on the zaptel channels. -* /dev/zap/NNN (196:NNN) - for NNN in the range 1-249. A device file for - zaptel channel NNN. It can be used to read data from the channel - and write data to the channel. -* /dev/zap/transcode (196:250) - Used to connect to a zaptel transcoding - device. -* /dev/zap/timer (196:253) - Allows setting timers. Used anywhere? -* /dev/zap/channel (196:254) - Can be used to open an arbitrary zaptel - channel. This is an alternative to /dev/zap/NNN that is not limited to - 249 channels. -* /dev/zap/pseudo (196:255) - A timing-only device. Every time you open - it, a new Zaptel channel is created. That Zaptel channel is "pseudo" - - Zaptel recieves no data in it, and only sends garbage data with the - same timing as the Zaptel timing master device. - - -Zaptel Timing -~~~~~~~~~~~~~ -A PBX system should generally have a single clock. If you are connected -to a telephony provider via a digital interface (e.g: E1, T1) you should -also typically use the provider's clock (as you get through the -interface). Hence one important job of Asterisk is to provide timing to -the PBX. - -Zaptel "ticks" once per millisecond (1000 times per second). On each -tick every active zaptel channel reads and 8 bytes of data. Asterisk -also uses this for timing, through a zaptel pseudo channel it opens. - -However, not all PBX systems are connected to a telephony provider via -a T1 or similar connection. With an analog connection you are not synced -to the other party. And some systems don't have Zaptel hardware at all. -Even a digital card may be used for other uses or is simply not -connected to a provider. Zaptel cards are also capable of providing timing -from a clock on card. Cheap x100P clone cards are sometimes used for -that pupose. - -If all the above fail, you can use the module ztdummy to provide timing -alone without needing any zaptel hardware. It will work with most -systems and kernels. - -You can check the zaptel timing source with zttest, which is a small -utility that is included with zaptel. It runs in cycles. In each such -cycle it tries to read 8192 bytes, and sees how long it takes. If zaptel -is not loaded or you don't have the device files, it will fail -immedietly. If you lack a timing device it will hang forever in the -first cycle. Eitherwise 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. - -To check the clock source that is built into ztdummy, you can either -look at title of its span in /proc/zaptel file for a "source:" in the -description. Or even run: - - strings zaptel.ko | grep source: - - -Spans and Channels -~~~~~~~~~~~~~~~~~~ -Zaptel provides telephony *channels* to the userspace applications. -Those channels are channels are incoreperated into logical units called -*spans*. - -With digital telephony adapters (e.g: E1 or T1), a span normally -represents a single port. With analog telephony a span typically -represents a PCI adapter or a similar logical unit. - -Both channels and spans are identified by enumerating numbers (beginning -with 1). The number of the channel is the lowest unused one when it is -generated, and ditto for spans. - -See also <>. - - -PROCFS Interface: /proc/zaptel -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A simple way to get the current list of spans and channels each span -contains is the files under /proc/zaptel . /proc/zaptel is generated by -zaptel as it loads. As each span registers to Zaptel, a file under -/proc/zaptel is created for it. The name of that file is the number of -that span. - -Each file has a 1-line title for the span followed by an empty line and -then a line for each channel of the span. - -The title line shows the number of the span, its name and title, and -(potentially) the alarms in which it is. - -The title shows the span number and name, followed by any allarms the -span may have: For example, here is the first span in my system (with no -alarms): - - Span 1: XBUS-00/XPD-00 "Xorcom XPD #0/0: FXS" - -The channel line for each channel shows its channel number, name and the -actual signalling assigned to it through ztcfg. Before being configured -by ztcfg: This is Zaptel channel 2, whose name is 'XPP_FXS/0/0/1'. - - 2 XPP_FXS/0/0/1 - -After being configured by ztcfg: the signalling 'FXOLS' was added. FXS -channels have FXO signalling and vice versa: - - 2 XPP_FXS/0/0/1 FXOLS - -If the channel is in use (typically opened by Asterisk) then you will -see an extra '(In use)': - - 2 XPP_FXS/0/0/1 FXOLS (In use) - - -ABI Compatibility -~~~~~~~~~~~~~~~~~ -Like any other kernel code, Zaptel strives to maintain a stable -interface to userspace programs. The API of Zaptel to userspace -programs, zaptel.h, has remained backword-compatible for a long time and -is expected to remain so in the future. With the ABI (the bits -themselves) things are slightly trickier. - -Zaptel's interface to userspace is mostly ioctl(3) calls. Ioctl calls -are identified by a number that stems from various things, one of which -is the size of the data structure passed between the kernel and -userspace. - -Many of the Zaptel ioctl-s use some sepcific structs to pass information -between kernel and userspace. In some cases the need arose to pass a few -more data members in each call. Simply adding a new member to the struct -would have meant a new number for the ioctl, as its number depends on -the size of the data passed. - -Thus we would add a new ioctl with the same base number and with the -original struct. - -So suppose we had the following ioctl: ----------------------------------- -struct zt_example { - int sample; -} - -#define ZT_EXAMPLE _IOWR (ZT_CODE, 62, struct zt_example) ----------------------------------- - -And we want to add the field 'int onemore', we won't just add it to the -struct. We will do something that is more complex: ------------------------------------- -/* The original, unchanged: */ -struct zt_example_v1 { - int sample; -} - -/* The new struct: */ -struct zt_example { - int sample; - int onemore; -} - -#define ZT_EXAMPLE_V1 _IOWR (ZT_CODE, 62, struct zt_example_v1) -#define ZT_EXAMPLE _IOWR (ZT_CODE, 62, struct zt_example) ------------------------------------- -We actually have here two different ioctls: the old ZT_EXAMPLE would be -0xC0044A3E . ZT_EXAMPLE_V1 would have the same value. But the new value -of ZT_EXAMPLE would be 0xC0084A3E . - -Programs built with the original zaptel.h (before the change) use the -original ioctl, whether or not the kerenl code is actually of the newer -version. Thus in most cases there are no compatibility issues. - -When can we have compatibility issues? if we have code built with the -new zaptel.h, but the loaded kernel code (modules) are of the older -version. Thus the userspace program will try to use the newer ZT_EXAMPLE -(0xC0084A3E). But the kernel code has no handler for that ioctl. The -result: the error 25, ENOTTY, which means "Inappropriate ioctl for -device". - -As a by-product of that method, for each interface change a new #define -is added. That definition is for the old version and thus it might -appear slightly confusing in the code, but it is useful for writing code -that works with both versions of Zaptel. - - -Past Incompatibilities -^^^^^^^^^^^^^^^^^^^^^^ - -.Zaptel 1.4.10: -* Semantics of ZT_LOADZONE. Using newer ztcfg with older modules will - yield -EINVAL with the kernel message 'Invalid tone (96) defined' - -.Zaptel 1.4.8: -* ZT_GET_PARAMS_V1 -* ZT_SET_PARAMS_V1 -* ZT_SPANINFO_V2 - -.Zaptel 1.4.6: -* ZT_SPANINFO_V1 - -ZT_SPANINFO_V1 was originally called (up to zaptel 1.4.8) -"ZT_SPANINFO_COMPAT". - - -PPP Support ------------ -Zaptel digital cards can provide data channels through ppp as -point-to-point connections. This requires a plugin to the ppp daemon -that is included in the ppp/ subdirectory. To install it: - -1. Make sure you have the PPP source / headers installed. On Debian: - - apt-get install ppp-dev - -2. Run 'make' on the ppp subdirectory: - - make -C ppp - make -C ppp install - -3. Make sure your kernel has support for both PPP (which is common is - distribution kernels and for HDLC (much less common) - CONFIG_PPP and - CONFIG_HDLC . - - -License -------- -This package is distributed under the terms of the GNU General Public License -Version 2, except for some components which are distributed under the terms of -the GNU Lesser General Public License Version 2.1. Both licenses are included -in this directory, and each file is clearly marked as to which license applies. - -If you wish to use the Zaptel drivers in an application for which the license -terms are not appropriate (e.g. a proprietary embedded system), licenses under -more flexible terms can be readily obtained through Digium, Inc. at reasonable -cost. - - -How do I report bugs or contribute? ------------------------------------ -Please report bug and patches to the Asterisk.org bug tracker at -http://bugs.digium.com in the "Zaptel" category. - - -Does anything use this library so far? --------------------------------------- -Yes, the Asterisk Open Source PBX does. http://www.asterisk.org - - -Links ------ -- http://asterisk.org/[] - The Asterisk PBX -- http://voip-info.org/[] -- http://voip-info.org/wiki/view/Asterisk+Zaptel+Installation[] -- http://www.zapatatelephony.org/[] - A historical site. -- http://docs.tzafrir.org.il/README.html[Up-to-date HTML version - of this file] diff --git a/zaptel/README.Astribank b/zaptel/README.Astribank deleted file mode 100644 index 21afb7f6..00000000 --- a/zaptel/README.Astribank +++ /dev/null @@ -1,3 +0,0 @@ -See the README.Astribank that resides in the xpp/ directory for more -information regarding the Xorcom Astribank. -eripheral Device). diff --git a/zaptel/README.b410p b/zaptel/README.b410p deleted file mode 100644 index 7b4030ed..00000000 --- a/zaptel/README.b410p +++ /dev/null @@ -1,29 +0,0 @@ -In order to install the b410p drivers one simply needs to type: - -`make b410p` - -The mISDN drivers will be downloaded and installed automatically. Then -you will need to run - -`/etc/init.d/misdn-init config` - -and then configure the /etc/misdn-init.conf in accordance with your desired -port configuration. You will then need to load the modules: - -`/etc/init.d/misdn-init start` - -For the Asterisk portion of the installation, you must use either the -trunk -branch or the crichter branch (for a 1.2 based version of asterisk), which can -be checked out as follows: - -`svn co http://svn.digium.com/svn/asterisk/team/crichter/0.3.0` - -The preferred and working branch right now is above is crichter. Trunk is not -guaranteed to work. - -The remainder of the configuration is just setup of /etc/asterisk/misdn.conf. - -For additional information and questions, refer to http://www.misdn.org/ - ---- -Matthew Fredrickson diff --git a/zaptel/README.fxotune b/zaptel/README.fxotune deleted file mode 100644 index 9e7ac243..00000000 --- a/zaptel/README.fxotune +++ /dev/null @@ -1,23 +0,0 @@ -Q. I have echo problems on my FXO modules and I've tried the different -echo cancellation algorithms in zconfig.h, tried tweaking the gains, and -still nothing works. What can I do? - -A. Use the fxotune utility. - -To use: -Just run the fxotune utility with the -i option. (`fxotune -i 4`) It should -discover which zap channels are FXO modules and tune them accordingly. Be warned -however, it takes a significant amount of time for EACH module to test, I would -say somewhere around 2-3 minutes. But you only have to initialize it once for -the line. It will write a configuration file to /etc/fxotune.conf. You will -need to have your system run fxotune with the -s flag (`fxotune -s`) to set the -module with the previously discovered values from fxotune.conf for it to take -affect, so essentially if each time you reboot the machine you need to run -`fxotune -s`. You might consider putting it in your startup scripts some time -after the module loads and before asterisk runs. - -NOTE: The digit after the -i option is the digit that will break dialtone on the line. - -As always, if you have any questions, you can email me at creslin@NOSPAMdigium.com - -Matthew Fredrickson diff --git a/zaptel/README.fxsusb b/zaptel/README.fxsusb deleted file mode 100644 index 924c009f..00000000 --- a/zaptel/README.fxsusb +++ /dev/null @@ -1,15 +0,0 @@ -To Configure ------------- -Do a "make" and a "make install". You will need to enable a single channel -in /etc/zaptel.conf by adding the following line somewhere near the top: - -fxoks=1 - -To create a single channel with FXO Kewlstart signalling. You may -substitute "fxols" or "fxogs" for Loopstart and Groundstart signalling -respectively. - -Currently known bugs: ---------------------- -* If PROSLIC_POWERSAVE is defined, the ability to send audio while on -hook is limited to four seconds after ring is turned off. diff --git a/zaptel/README.hpec b/zaptel/README.hpec deleted file mode 100644 index bd8b745e..00000000 --- a/zaptel/README.hpec +++ /dev/null @@ -1,21 +0,0 @@ -Digium High Performance Echo Cancellation (HPEC) README ------------------------------------------------- - -[Overview] - -Digium's HPEC is a commercially licensed, proprietary hybrid, echo cancellation -solution for use with Digium and non-Digium Zaptel-compatible telephony -interface cards. Its performance, in terms of its ability to eliminate echo, -is superior to that of the open source routines normally included with Zaptel. - -HPEC is provided free of charge, with limited support, to in-warranty Digium -analog interface cards. For out-of-warranty or non-Digium analog interface -cards, HPEC is provided, with no support, for a per channel fee. - -Qualifying Digium customers may contact Digium directly for information about -obtaining a free license. Non-Digium customers may visit the Digium web site -at www.digium.com for information about purchasing a license. - -See the README on the Digium FTP site for further information: - -http://downloads.digium.com/pub/telephony/hpec/README diff --git a/zaptel/acinclude.m4 b/zaptel/acinclude.m4 deleted file mode 100644 index b8cd1512..00000000 --- a/zaptel/acinclude.m4 +++ /dev/null @@ -1,89 +0,0 @@ -# AST_EXT_LIB([NAME], [FUNCTION], [package header], [package symbol name], [package friendly name], [additional LIB data]) - -AC_DEFUN([AST_EXT_LIB], -[ -AC_ARG_WITH([$1], AC_HELP_STRING([--with-$1=PATH],[use $5 files in PATH]),[ -case ${withval} in - n|no) - USE_$4=no - ;; - y|ye|yes) - $4_MANDATORY="yes" - ;; - *) - $4_DIR="${withval}" - $4_MANDATORY="yes" - ;; -esac -]) - -PBX_LIB$4=0 - -if test "${USE_$4}" != "no"; then - pbxlibdir="" - if test "x${$4_DIR}" != "x"; then - pbxlibdir="-L${$1_DIR}/lib" - fi - AC_CHECK_LIB([$1], [$2], [AST_$4_FOUND=yes], [AST_$4_FOUND=no], ${pbxlibdir} $6) - - if test "${AST_$4_FOUND}" = "yes"; then - $4_LIB="-l$1 $6" - $4_HEADER_FOUND="1" - if test "x${$4_DIR}" != "x"; then - $4_LIB="${pbxlibdir} ${$4_LIB}" - $4_INCLUDE="-I${$4_DIR}/include" - if test "x$3" != "x" ; then - AC_CHECK_HEADER([${$4_DIR}/include/$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] ) - fi - else - if test "x$3" != "x" ; then - AC_CHECK_HEADER([$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] ) - fi - fi - if test "x${$4_HEADER_FOUND}" = "x0" ; then - if test ! -z "${$4_MANDATORY}" ; - then - AC_MSG_NOTICE(***) - AC_MSG_NOTICE(*** It appears that you do not have the $1 development package installed.) - AC_MSG_NOTICE(*** Please install it to include $5 support, or re-run configure) - AC_MSG_NOTICE(*** without explicitly specifying --with-$1) - exit 1 - fi - $4_LIB="" - $4_INCLUDE="" - PBX_LIB$4=0 - else - PBX_LIB$4=1 - AC_DEFINE_UNQUOTED([HAVE_$4], 1, [Define to indicate the $5 library]) - fi - elif test ! -z "${$4_MANDATORY}"; - then - AC_MSG_NOTICE(***) - AC_MSG_NOTICE(*** The $5 installation on this system appears to be broken.) - AC_MSG_NOTICE(*** Either correct the installation, or run configure) - AC_MSG_NOTICE(*** without explicity specifying --with-$1) - exit 1 - fi -fi -AC_SUBST([$4_LIB]) -AC_SUBST([$4_INCLUDE]) -AC_SUBST([PBX_LIB$4]) -]) - - -AC_DEFUN( -[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE, - GNU_MAKE='Not Found' ; - for a in make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - GNU_MAKE=$a ; - break; - fi - done ; -) ; -if test "x$GNU_MAKE" = "xNot Found" ; then - AC_MSG_ERROR(*** Please install GNU make. It is required to build Zaptel!) -fi -AC_SUBST([GNU_MAKE]) -]) diff --git a/zaptel/aclocal.m4 b/zaptel/aclocal.m4 deleted file mode 100644 index 1e4ae301..00000000 --- a/zaptel/aclocal.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_include([acinclude.m4]) diff --git a/zaptel/bittest.h b/zaptel/bittest.h deleted file mode 100644 index c9b9eb23..00000000 --- a/zaptel/bittest.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -static int bit_next(int prev) -{ - return (prev + 1) % 256; -} diff --git a/zaptel/bootstrap.sh b/zaptel/bootstrap.sh deleted file mode 100755 index b26b8288..00000000 --- a/zaptel/bootstrap.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -check_for_app() { - $1 --version 2>&1 >/dev/null - if [ $? != 0 ] - then - echo "Please install $1 and run bootstrap.sh again!" - exit 1 - fi -} - -AUTOCONF_VERSION=2.59 -AUTOMAKE_VERSION=1.9 -export AUTOCONF_VERSION -export AUTOMAKE_VERSION - -check_for_app autoconf -check_for_app automake -check_for_app aclocal -echo "Generating the configure script ..." -aclocal 2>/dev/null -autoconf -automake --add-missing --copy 2>/dev/null - -exit 0 diff --git a/zaptel/build_tools/builder b/zaptel/build_tools/builder deleted file mode 100755 index a0311f52..00000000 --- a/zaptel/build_tools/builder +++ /dev/null @@ -1,168 +0,0 @@ -#!/bin/sh - -# build_test - a build testing script -# -# Copyright (C) 2008 by Xorcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Setup: -# -# 0. Copy this script under build_tools/ and -# -# chmod +x build_tools/builder -# -# 1. Make sure you have git and sqlite3 installed. If the sqlite3 binary -# is called differently, fix the line "SQLITE=" in the script or in -# build_tools/test_build.conf . -# -# 2. Run: -# -# ./build_tools/test_kernel_git init /path/to/some/dir -# -# /path/to/some/dir must exist . This will download a recent kernel -# git repository to /path/to/some/dir/linux-2.6 . Use -# './build_tools/test_kernel_git update' to pull a fresh update there. -# -# 3. Run: -# -# ./build_tools/builder init -# -# -# Usage: -# -# ./build_tools build -# -# The past results are in a sqlite database in the logs subdirectory. For -# a simple list of results: -# -# ./build_tools report -# -# You can also look at the build log for a specific build in the logs -# directory. - -BIN_DIR=`dirname $0` -BASE_DIR=`dirname $BIN_DIR` -SQLITE=sqlite3 -HOSTS="localhost" -LOGS_DIR="$BASE_DIR/logs" -DB=$LOGS_DIR/builds.db -BUILD_SCRIPT=$BIN_DIR/test_kernel_git -KERNELS_localhost="2.6.12 2.6.18 2.6.25" - -usage() { - me=`basename $0` - echo "$me: test building Zaptel/DAHDI with various kernels" - echo "" - echo "Usage: $0 command " - echo " init Create results directory and database." - echo " build [] Run the test builds. The default list: " - echo " $KERNELS_localhost" - echo " report [] Print all results [matching ]" - echo " Default is to print all the resaults." - echo "" - echo "Filters:" - echo " failed: Only failed tests." - echo " fail_type Where fail_type matches ." - echo " 2.6* Only builds for a matching kernel version." - echo " Else: Match a string from the build name, which " - echo " is essentially the time it started." - echo "" -} - -set -e - -if [ -r $BIN_DIR/test_build.conf ]; then . $BIN_DIR/test_build.conf; fi - -# Runs the test script, logs the result, and fails if the test command -# has failed. -build_and_check() { - test_name="$1" - test_cmd="$2" - log_file="$3" - results_str="$4" - fail_type='' - - set +e - $BUILD_SCRIPT $test_cmd >$log_file 2>&1 - rc=$? - set -e - if [ $rc != 0 ]; then - fail_type="$test_name" - echo "$results_str, $rc, '$fail_type', '$log_file');" | $SQLITE $DB - fi - return $rc -} - -build_zaptel() { - build_name="$1" - host="$2" - kvers="$3" - log_base="build__${build_name}__${host}__${kvers}" - log_base_full="$LOGS_DIR/$log_base" - log_file="$log_base_full.log" - results_str="INSERT INTO results VALUES ('$build_name', '$host', '$kvers'" - # Due to 'set -e' a failed test exists the script. - build_and_check setver "setver $kvers" "$log_file" "$results_str" - build_and_check clean "test clean" "$log_file" "$results_str" - build_and_check build "build" "$log_file" "$results_str" - - # If we got here, all was well. - echo "$results_str, 0, 'complete', '$log_file');" | $SQLITE $DB -} - -case "$1" in -init) - mkdir -p $LOGS_DIR - cat <&2 "$0: Unknown command '$1'. Aborting." - exit 1 -esac diff --git a/zaptel/build_tools/genmodconf b/zaptel/build_tools/genmodconf deleted file mode 100755 index ada453e1..00000000 --- a/zaptel/build_tools/genmodconf +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -# this script makes an attempt to build a proper set of rules -# for loading the Zaptel modules and automatically running ztcfg -# -# it accepts three parameters: -# the kernel major version being targeted (either linux24 or linux26) -# the root prefix to be used for finding/creating the files -# the list of module names being installed -# -# the process is as follows: -# -# for linux24, the file can be located either at /etc/modules.conf (combined -# with all other rules) or in /etc/modutils/zaptel (only the Zaptel rules) -# -# for linux26, the file can be located at /etc/modprobe.conf (combined with all -# other rules), /etc/modprobe.d/zaptel (Zaptel only) or /etc/modules.d/zaptel -# (Zaptel only) -# -# when the file is Zaptel rules only, then we don't preserve the existing -# contents of the file; the system administrator can put desired options and -# overrides in a separate file with a name that appears earlier in the sort -# order, so there is no need to edit the file produced by this script -# -# when the file is combined with all other rules, then we make a backup -# of it and remove all the old Zaptel rules we can find, replacing them with -# new ones -# -# in addition, for linux26, versions of module-init-tools 3.2.0 and later -# have the ability to pass module parameters specified on the modprobe command -# line to commands in 'install' rules, thus keeping them from being lost, so -# we try to determine what version is installed and take advantage of that - -if [ "${1}" = "linux24" ]; then - if [ -d ${2}/etc/modutils ]; then - target=${2}/etc/modutils/zaptel - elif [ -f ${2}/etc/modules.conf ]; then - target=${2}/etc/modules.conf - combined=1 - else - echo No suitable location for module rules can be found... exiting. - exit 1 - fi -elif [ "${1}" = "linux26" ]; then - toolver=`/sbin/modprobe --version 2>/dev/null| awk '{print $3}' | cut -d. -f2 | cut -d- -f1` - if [ ${toolver} -ge 2 ]; then - cmdopts=\$CMDLINE_OPTS - fi - if [ -d ${2}/etc/modprobe.d ]; then - target=${2}/etc/modprobe.d/zaptel - elif [ -d ${2}/etc/modules.d ]; then - target=${2}/etc/modules.d/zaptel - elif [ -f ${2}/etc/modprobe.conf ]; then - target=${2}/etc/modprobe.conf - combined=1 - elif [ -f ${2}/etc/conf.modules ]; then - target=${2}/etc/conf.modules - combined=1 - else - echo No suitable location for module rules can be found... exiting. - exit 1 - fi -else - echo Unknown kernel build version requested... exiting. - exit 1 -fi - -if [ -n "${combined}" ]; then - if [ -f ${target} ]; then - mv ${target} ${target}.bak - cat ${target}.bak | grep -v "alias char-major-250" | grep -v "alias char-major-196" > ${target} - fi -else - if [ -f ${target} ]; then - mv ${target} ${target}.bak - fi - echo "# automatically generated file; do not edit" > ${target} -fi - -echo Building ${target}... - -if [ "${1}" = "linux24" ]; then - for mod in ${3}; do - if ! grep -q "post-install ${mod} " ${target}; then - echo "post-install ${mod} /sbin/ztcfg" >> ${target} - fi - done -elif [ "${1}" = "linux26" ]; then - for mod in ${3}; do - if ! grep -q "install ${mod} " ${target}; then - echo "install ${mod} /sbin/modprobe --ignore-install ${mod} ${cmdopts} && /sbin/ztcfg" >> ${target} - fi - done -fi - -if [ -z "${combined}" ]; then - echo "***" - echo "*** WARNING:" - echo "*** If you had custom settings in ${target}," - echo "*** they have been moved to ${target}.bak." - echo "***" - echo "*** In the future, do not edit ${target}, but" - echo "*** instead put your changes in another file" - echo "*** in the same directory so that they will not" - echo "*** be overwritten by future Zaptel updates." - echo "***" -fi diff --git a/zaptel/build_tools/genudevrules b/zaptel/build_tools/genudevrules deleted file mode 100755 index bcf21980..00000000 --- a/zaptel/build_tools/genudevrules +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -ver=`udevinfo -V | cut -f3 -d" "` - -if [ -z "${ver}" ]; then - ver=`udevadm info -V` -fi - -if [ -z "${ver}" ]; then - # nobody has that old version, anyway. - ver=54 -fi - -# udev versions prior to 055 use a single '=' for matching key values -# udev versions 055 and later support '==' for that purpose, and versions -# beyond 092 will probably make it mandatory -# -# very old versions of udev required naming rules and permissions rules to be -# in separate files, but it's not clear at what version number that changed - -if [ ${ver} -gt 54 ]; then - match="==" -else - match="=" -fi - -cat <" -echo -echo "" -cat zaptel.xml -cat firmware/firmware.xml -echo "" diff --git a/zaptel/build_tools/make_version b/zaptel/build_tools/make_version deleted file mode 100755 index d710ffa9..00000000 --- a/zaptel/build_tools/make_version +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -if [ -f ${1}/.version ]; then - cat ${1}.version -elif [ -f ${1}/.svnrevision ]; then - echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision` -elif [ -d .svn ]; then - PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/zaptel/:: | sed -e 's:/: :g'` - BRANCH=0 - TEAM=0 - - REV=`svnversion -c ${1} | cut -d: -f2` - - if [ "${PARTS}" = "trunk" ] - then - echo SVN-'trunk'-r${REV} - exit 0 - fi - - for PART in $PARTS - do - if [ ${BRANCH} != 0 ] - then - RESULT="${RESULT}-${PART}" - break - fi - - if [ ${TEAM} != 0 ] - then - RESULT="${RESULT}-${PART}" - continue - fi - - if [ "${PART}" = "branches" ] - then - BRANCH=1 - RESULT="branch" - continue - fi - - if [ "${PART}" = "tags" ] - then - BRANCH=1 - RESULT="tag" - continue - fi - - if [ "${PART}" = "team" ] - then - TEAM=1 - continue - fi - done - - echo SVN-${RESULT##-}-r${REV} -fi diff --git a/zaptel/build_tools/make_version_h b/zaptel/build_tools/make_version_h deleted file mode 100755 index 01d9c31d..00000000 --- a/zaptel/build_tools/make_version_h +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -cat << END -/* - * version.h - * Automatically generated - */ -#define ZAPTEL_VERSION "${ZAPTELVERSION}" - -END diff --git a/zaptel/build_tools/menuselect-deps.in b/zaptel/build_tools/menuselect-deps.in deleted file mode 100644 index 1c263160..00000000 --- a/zaptel/build_tools/menuselect-deps.in +++ /dev/null @@ -1 +0,0 @@ -LIBNEWT=@PBX_LIBNEWT@ diff --git a/zaptel/build_tools/test_kernel_git b/zaptel/build_tools/test_kernel_git deleted file mode 100755 index 070f894c..00000000 --- a/zaptel/build_tools/test_kernel_git +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh - -set -e - -GIT_URL=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git -CONF_FILE=build_tools/git_test.conf - -usage() { - me=`basename $0` - echo "$me: test building Zaptel vs. kernel from git" - echo "Usage:" - echo " $me checkout Pull a kernel version into " - echo " $me update Update (pull) the kernel tree." - echo " $me setver Set the kernel version" - echo " $me versions Print available versions" - echo " $me version Print current (kernel) version" - echo " $me version_driver Print the version of Zaptel" - echo " $me build Test-build" - echo " $me git Run " - echo "" - echo " $me versions [pattern] List available versions." -} - -# Set a variable in $CONF_FILE -# The format of CONF_FILE is assumed to be: -# VAR=value -# in shell syntax. "value" may be quoted. -# "value should not contain a '|' character. -set_var() { - var="$1" - val="$2" - if grep -q "^$var=" $CONF_FILE 2>/dev/null; then - sed -i -e "s|^$var=.*|$var=\"$val\"|" $CONF_FILE - else - echo "$var=\"$val\"" >>$CONF_FILE - fi -} - -if [ -r "$CONF_FILE" ]; then . "$CONF_FILE"; fi - -if echo "$CONF_FILE" | grep -qv '^/'; then - # make CONF_FILE an absolute path: - CONF_FILE="$PWD/$CONF_FILE" -fi - -command="$1" - -case "$command" in - checkout) - kernel_dir="$2" - cd "$kernel_dir" - git clone $GIT_URL - set_var kernel_dir "$kernel_dir/linux-2.6" - ;; - update) - cd "$kernel_dir" - git pull - ;; - git) - cd "$kernel_dir" - shift - git "$@" - ;; - versions) - cd "$kernel_dir" - git tag -l $2 | cut -c2- - ;; - version) - cd "$kernel_dir" - echo "Configured: $kernel_ver" - echo -n "Actual: " - git describe | cut -c2- - ;; - version_driver) - version_h=version.h - make $version_h >/dev/null - awk -F'"' '/ZAPTEL_VERSION/{print $2}' $version_h - ;; - setver) - kernel_ver="$2" - tag="v$kernel_ver" - cd "$kernel_dir" - git-reset --hard "$tag" - make distclean - make defconfig modules_prepare - set_var kernel_ver "$kernel_ver" - ;; - test|build) - # you can pass extra parameters to the make command in - # two ways: - # 1. Set the value of MAKE_PARAMS in git_test.conf . - # 2. Any extra command-line parameter. - shift - make KSRC="$kernel_dir" KVERS=$kernel_ver $MAKE_PARAMS "$@" - ;; - *) - echo "$0: no such command $command. Aborting." - usage - exit 1 - ;; -esac diff --git a/zaptel/build_tools/uninstall-modules b/zaptel/build_tools/uninstall-modules deleted file mode 100755 index 02b89c98..00000000 --- a/zaptel/build_tools/uninstall-modules +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -# This script takes two arguments: a top-level module name, and a kernel version string -# -# It will search the entire /lib/modules directory tree for the given kernel version, -# and find all modules that are dependent (even indirectly) on the specified module. -# After producing that list, it will remove all those modules. - -base="${1}" -deptree="${base}" -rmlist="" -founddep=1 - -checkmod() { - SAVEIFS="${IFS}" - IFS="," - modname=`basename ${1}` - modname=${modname%.ko} - if test "${modname}" = "${base}"; then - rmlist="${rmlist} ${1}" - IFS="${SAVEIFS}" - return - fi - for dep in `modinfo -F depends ${1}`; do - for mod in ${deptree}; do - if test "${dep}" = "${mod}"; then - addit=1 - for checkmod in ${deptree}; do - if test "${checkmod}" = "${modname}"; then - addit=0 - break - fi - done - if test "${addit}" = "1"; then - deptree="${deptree},${modname%.ko}" - rmlist="${rmlist} ${1}" - founddep=1 - fi - fi - done - done - IFS="${SAVEIFS}" -} - - -while test "${founddep}" = "1"; do - founddep=0 - find /lib/modules/${2}/misc -name \*.ko -print > /tmp/modlist.$$ 2> /dev/null - find /lib/modules/${2}/extra -name \*.ko -print >> /tmp/modlist.$$ 2> /dev/null - find /lib/modules/${2}/zaptel -name \*.ko -print >> /tmp/modlist.$$ 2> /dev/null - find /lib/modules/${2}/dahdi -name \*.ko -print >> /tmp/modlist.$$ 2> /dev/null - exec 9<&0 < /tmp/modlist.$$ - while read mod; do - checkmod ${mod} - done - exec 0<&9 9<&- - rm /tmp/modlist.$$ -done - -if test -n "${rmlist}"; then - for mod in ${rmlist}; do - rm -f ${mod} - done -fi diff --git a/zaptel/build_tools/zaptel_svn_tarball b/zaptel/build_tools/zaptel_svn_tarball deleted file mode 100755 index c45b5b54..00000000 --- a/zaptel/build_tools/zaptel_svn_tarball +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh - -# upload_zaptel: upload a zaptel tarball to updates.xorcom.com -# - -set -e - -BRANCH_NAME=1.4 -REV=HEAD -ZAPTEL_BASE=http://svn.digium.com/svn/zaptel -TARBALLS_DIR=$PWD - -me=`basename $0` - -say() { - echo "$me: $@" -} - -usage() { - echo >&2 "$0: Generate snapshot from Zaptel SVN" - echo >&2 ' ($Id: zaptel_svn_tarball 4166 2008-04-10 18:11:51Z tzafrir $)' - echo >&2 "" - echo >&2 "$0 [-r REV] [-2] [-s]" - echo >&2 "$0 <-h | --help>: This message" - echo >&2 "" - echo >&2 "Options:" - echo >&2 " -2 --zap12: Use Asterisk 1.2. Implies -u." - echo >&2 " -r --rev REV: extract xpp-zaptel from this revision ($REV)." - echo >&2 " -s --show: Just show versions. Do nothing" - -} - -opt_showonly=no - -options=`getopt -o 2hr:s --long zap12,help,rev:,revision:,show -- "$@"` -if [ $? != 0 ] ; then echo >&2 "Terminating..." ; exit 1 ; fi - -# Note the quotes around `$TEMP': they are essential! -eval set -- "$options" - -while true ; do - case "$1" in - -2|--zap12) BRANCH_NAME=1.2;; - -s|--show) opt_showonly=yes ;; - -r|--rev|--revision) REV="$2"; shift ;; - -h|--help) usage; exit 0;; - --) shift ; break ;; - esac - shift; -done - -BRANCH=branches/$BRANCH_NAME -ZAPTEL_URL=$ZAPTEL_BASE/$BRANCH - -set -e - -# Get the name of the "previous version" for this release. -# The idea is to look at the latest tag for that branhch. Tags are -# global, and hence we filter tag names by branch name. -# -# Note: this strips any minor version number. -# e.g: if last releast was 1.4.5.1, this will still return 1.4.5 . Here -# we rely on the fact that the revision number will be added. -zap_ver=`svn ls -r $REV $ZAPTEL_BASE/tags | grep "^$BRANCH_NAME" \ - | sed -e "s/\($BRANCH_NAME\.[0-9]\+\)[/.-].*/\1/" \ - | sort -nu -t . -k 3 | tail -n 1` - -real_rev=`svn info -r $REV $ZAPTEL_URL \ - | awk '/^Last Changed Rev: /{print $4}'` - -ver_full="$zap_ver.9.svn.$real_rev" -tar_name="zaptel-$ver_full" -tar_ball_full="$TARBALLS_DIR/$tar_name.tar.gz" - -say "Version: $ver_full (ver: $zap_ver, rev: $real_rev)" -say "Tarball: $tar_ball_full" - -if [ "$opt_showonly" = 'yes' ]; then - exit 0; -fi - -ZAP_CHECKOUT_DIR=`mktemp -d zaptel_checkout_dir_XXXXXX` - -# Package a tarball from the subversion, using 'make dist': -svn export -q -r $REV $ZAPTEL_URL $ZAP_CHECKOUT_DIR/$tar_name -echo "$ver_full" >$ZAP_CHECKOUT_DIR/$tar_name/.version -tar cz -C $ZAP_CHECKOUT_DIR -f $tar_ball_full $tar_name - -rm -rf $ZAP_CHECKOUT_DIR - diff --git a/zaptel/checkstack b/zaptel/checkstack deleted file mode 100755 index 7f1fa965..00000000 --- a/zaptel/checkstack +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# Written by Keith Owens, modified by Arjan van de Ven to output in deciman -# -# Usage : check-stack.sh vmlinux $(/sbin/modprobe -l) -# -# Run a compiled ix86 kernel and print large local stack usage. -# -# />:/{s/[<>:]*//g; h; } On lines that contain '>:' (headings like -# c0100000 <_stext>:), remove <, > and : and hold the line. Identifies -# the procedure and its start address. -# -# /subl\?.*\$0x[^,][^,][^,].*,%esp/{ Select lines containing -# subl\?...0x...,%esp but only if there are at least 3 digits between 0x and -# ,%esp. These are local stacks of at least 0x100 bytes. -# -# s/.*$0x\([^,]*\).*/\1/; Extract just the stack adjustment -# /^[89a-f].......$/d; Ignore line with 8 digit offsets that are -# negative. Some compilers adjust the stack on exit, seems to be related -# to goto statements -# G; Append the held line (procedure and start address). -# s/\(.*\)\n.* \(.*\)/\1 \2/; Remove the newline and procedure start -# address. Leaves just stack size and procedure name. -# p; }; Print stack size and procedure name. -# -# /subl\?.*%.*,%esp/{ Selects adjustment of %esp by register, dynamic -# arrays on stack. -# G; Append the held line (procedure and start address). -# s/\(.*\)\n\(.*\)/Dynamic \2 \1/; Reformat to "Dynamic", procedure -# start address, procedure name and the instruction that adjusts the -# stack, including its offset within the proc. -# p; }; Print the dynamic line. -# -# -# Leading spaces in the sed string are required. -# -# first check if it's x86, since only that arch works for now -uname -m | grep -q 86$ > /dev/null || exit -# -objdump --disassemble "$@" | \ -sed -ne '/>:/{s/[<>:]*//g; h; } - /subl\?.*\$0x[^,][^,][^,].*,%esp/{ - s/.*\$0x\([^,]*\).*/\1/; /^[89a-f].......$/d; G; s/\(.*\)\n.* \(.*\)/\1 \2/; p; }; - /subl\?.*%.*,%esp/{ G; s/\(.*\)\n\(.*\)/Dynamic \2 \1/; p; }; ' | \ - sort | \ -perl -e 'while (<>) { if (/^([0-9a-f]+)(.*)/) { $decn = hex("0x" . $1); if ($decn > 400) { print "$decn $2\n";} } }' diff --git a/zaptel/complex.cc b/zaptel/complex.cc deleted file mode 100644 index d137f13c..00000000 --- a/zaptel/complex.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* mkfilter -- given n, compute recurrence relation - to implement Butterworth, Bessel or Chebyshev filter of order n - A.J. Fisher, University of York - September 1992 */ - -/* Routines for complex arithmetic */ - -#include - -#include "mkfilter.h" -#include "complex.h" - -static complex eval(complex[], int, complex); -static double Xsqrt(double); - - -global complex evaluate(complex topco[], int nz, complex botco[], int np, complex z) - { /* evaluate response, substituting for z */ - return eval(topco, nz, z) / eval(botco, np, z); - } - -static complex eval(complex coeffs[], int npz, complex z) - { /* evaluate polynomial in z, substituting for z */ - complex sum = complex(0.0); - for (int i = npz; i >= 0; i--) sum = (sum * z) + coeffs[i]; - return sum; - } - -global complex csqrt(complex x) - { double r = hypot(x); - complex z = complex(Xsqrt(0.5 * (r + x.re)), - Xsqrt(0.5 * (r - x.re))); - if (x.im < 0.0) z.im = -z.im; - return z; - } - -static double Xsqrt(double x) - { /* because of deficiencies in hypot on Sparc, it's possible for arg of Xsqrt to be small and -ve, - which logically it can't be (since r >= |x.re|). Take it as 0. */ - return (x >= 0.0) ? sqrt(x) : 0.0; - } - -global complex cexp(complex z) - { return exp(z.re) * expj(z.im); - } - -global complex expj(double theta) - { return complex(cos(theta), sin(theta)); - } - -global complex operator * (complex z1, complex z2) - { return complex(z1.re*z2.re - z1.im*z2.im, - z1.re*z2.im + z1.im*z2.re); - } - -global complex operator / (complex z1, complex z2) - { double mag = (z2.re * z2.re) + (z2.im * z2.im); - return complex (((z1.re * z2.re) + (z1.im * z2.im)) / mag, - ((z1.im * z2.re) - (z1.re * z2.im)) / mag); - } - diff --git a/zaptel/complex.h b/zaptel/complex.h deleted file mode 100644 index dc6a9f90..00000000 --- a/zaptel/complex.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -struct c_complex - { double re, im; - }; - -struct complex - { double re, im; - complex(double r, double i = 0.0) { re = r; im = i; } - complex() { } /* uninitialized complex */ - complex(c_complex z) { re = z.re; im = z.im; } /* init from denotation */ - }; - -extern complex csqrt(complex), cexp(complex), expj(double); /* from complex.C */ -extern complex evaluate(complex[], int, complex[], int, complex); /* from complex.C */ - -inline double hypot(complex z) { return ::hypot(z.im, z.re); } -inline double atan2(complex z) { return ::atan2(z.im, z.re); } - -inline complex cconj(complex z) - { z.im = -z.im; - return z; - } - -inline complex operator * (double a, complex z) - { z.re *= a; z.im *= a; - return z; - } - -inline complex operator / (complex z, double a) - { z.re /= a; z.im /= a; - return z; - } - -inline void operator /= (complex &z, double a) - { z = z / a; - } - -extern complex operator * (complex, complex); -extern complex operator / (complex, complex); - -inline complex operator + (complex z1, complex z2) - { z1.re += z2.re; - z1.im += z2.im; - return z1; - } - -inline complex operator - (complex z1, complex z2) - { z1.re -= z2.re; - z1.im -= z2.im; - return z1; - } - -inline complex operator - (complex z) - { return 0.0 - z; - } - -inline bool operator == (complex z1, complex z2) - { return (z1.re == z2.re) && (z1.im == z2.im); - } - -inline complex sqr(complex z) - { return z*z; - } - diff --git a/zaptel/config.guess b/zaptel/config.guess deleted file mode 100755 index 22906b33..00000000 --- a/zaptel/config.guess +++ /dev/null @@ -1,1495 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-03-13' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - x86:Interix*:[345]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[345]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/zaptel/config.sub b/zaptel/config.sub deleted file mode 100755 index 5705e543..00000000 --- a/zaptel/config.sub +++ /dev/null @@ -1,1609 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-03-07' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m32c) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - m32c-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/zaptel/configure b/zaptel/configure deleted file mode 100755 index c28a3220..00000000 --- a/zaptel/configure +++ /dev/null @@ -1,6488 +0,0 @@ -#! /bin/sh -# From configure.ac Revision: 3198 . -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -# -# "Zaptel" -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="zaptel" -ac_unique_file="kernel/zaptel-base.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -CPP -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -LN_S -GNU_MAKE -BDFNAME -BDFARCH -HOSTCC -GREP -LN -WGET -FETCH -DOWNLOAD -EGREP -CURSES_LIB -CURSES_INCLUDE -PBX_LIBCURSES -NCURSES_LIB -NCURSES_INCLUDE -PBX_LIBNCURSES -NEWT_LIB -NEWT_INCLUDE -PBX_LIBNEWT -USB_LIB -USB_INCLUDE -PBX_LIBUSB -USE_SELINUX -ASCIIDOC -PPPD_VERSION -LIBOBJS -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-curses=PATH use curses files in PATH - --with-ncurses=PATH use ncurses files in PATH - --with-newt=PATH use newt files in PATH - --with-usb=PATH use libusb files in PATH - --with-selinux enable (with) / disable (without) SELinux - --with-ppp=PATH Use ppp support from PATH - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. - -"Zaptel" -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# check existence of the package - - - - - -ac_default_prefix=/usr -if test ${sysconfdir} = '${prefix}/etc'; then - sysconfdir=/etc -fi -if test ${mandir} = '${prefix}/man'; then - mandir=/usr/share/man -fi - -if test ${localstatedir} = '${prefix}/var'; then - localstatedir=/var -fi - -# This needs to be before any macros that use the C compiler - -cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -else - { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6; } -fi - -{ echo "$as_me:$LINENO: checking for GNU make" >&5 -echo $ECHO_N "checking for GNU make... $ECHO_C" >&6; } -if test "${GNU_MAKE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - GNU_MAKE='Not Found' ; - for a in make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - GNU_MAKE=$a ; - break; - fi - done ; - -fi -{ echo "$as_me:$LINENO: result: $GNU_MAKE" >&5 -echo "${ECHO_T}$GNU_MAKE" >&6; } ; -if test "x$GNU_MAKE" = "xNot Found" ; then - { { echo "$as_me:$LINENO: error: *** Please install GNU make. It is required to build Zaptel!" >&5 -echo "$as_me: error: *** Please install GNU make. It is required to build Zaptel!" >&2;} - { (exit 1); exit 1; }; } -fi - - - -test_obj=conftest.o - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - - BDFNAME=`LANG=C objdump -f $test_obj | grep -e "$test_obj:" | sed "s/.*file format \(.*\)/\1/"` - BDFARCH=`LANG=C objdump -f $test_obj | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"` - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - - -# Set the default value of HOSTCC from CC if --host was not provided: -HOSTCC=${HOSTCC:=${CC}} - - -# Extract the first word of "grep", so it can be a program name with args. -set dummy grep; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $GREP in - [\\/]* | ?:[\\/]*) - ac_cv_path_GREP="$GREP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_GREP" && ac_cv_path_GREP=":" - ;; -esac -fi -GREP=$ac_cv_path_GREP -if test -n "$GREP"; then - { echo "$as_me:$LINENO: result: $GREP" >&5 -echo "${ECHO_T}$GREP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -# Extract the first word of "sh", so it can be a program name with args. -set dummy sh; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_SHELL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $SHELL in - [\\/]* | ?:[\\/]*) - ac_cv_path_SHELL="$SHELL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_SHELL="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_SHELL" && ac_cv_path_SHELL=":" - ;; -esac -fi -SHELL=$ac_cv_path_SHELL -if test -n "$SHELL"; then - { echo "$as_me:$LINENO: result: $SHELL" >&5 -echo "${ECHO_T}$SHELL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -# Extract the first word of "ln", so it can be a program name with args. -set dummy ln; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_LN+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $LN in - [\\/]* | ?:[\\/]*) - ac_cv_path_LN="$LN" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_LN" && ac_cv_path_LN=":" - ;; -esac -fi -LN=$ac_cv_path_LN -if test -n "$LN"; then - { echo "$as_me:$LINENO: result: $LN" >&5 -echo "${ECHO_T}$LN" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - -# Extract the first word of "wget", so it can be a program name with args. -set dummy wget; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_WGET+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $WGET in - [\\/]* | ?:[\\/]*) - ac_cv_path_WGET="$WGET" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_WGET" && ac_cv_path_WGET=":" - ;; -esac -fi -WGET=$ac_cv_path_WGET -if test -n "$WGET"; then - { echo "$as_me:$LINENO: result: $WGET" >&5 -echo "${ECHO_T}$WGET" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -if test "${WGET}" != ":" ; then - DOWNLOAD=${WGET} -else - # Extract the first word of "fetch", so it can be a program name with args. -set dummy fetch; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_FETCH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $FETCH in - [\\/]* | ?:[\\/]*) - ac_cv_path_FETCH="$FETCH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_FETCH="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_FETCH" && ac_cv_path_FETCH=":" - ;; -esac -fi -FETCH=$ac_cv_path_FETCH -if test -n "$FETCH"; then - { echo "$as_me:$LINENO: result: $FETCH" >&5 -echo "${ECHO_T}$FETCH" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - DOWNLOAD=${FETCH} -fi - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - -# Check whether --with-curses was given. -if test "${with_curses+set}" = set; then - withval=$with_curses; -case ${withval} in - n|no) - USE_CURSES=no - ;; - y|ye|yes) - CURSES_MANDATORY="yes" - ;; - *) - CURSES_DIR="${withval}" - CURSES_MANDATORY="yes" - ;; -esac - -fi - - -PBX_LIBCURSES=0 - -if test "${USE_CURSES}" != "no"; then - pbxlibdir="" - if test "x${CURSES_DIR}" != "x"; then - pbxlibdir="-L${curses_DIR}/lib" - fi - { echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 -echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_curses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcurses ${pbxlibdir} $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char initscr (); -int -main () -{ -return initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_curses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_curses_initscr=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; } -if test $ac_cv_lib_curses_initscr = yes; then - AST_CURSES_FOUND=yes -else - AST_CURSES_FOUND=no -fi - - - if test "${AST_CURSES_FOUND}" = "yes"; then - CURSES_LIB="-lcurses " - CURSES_HEADER_FOUND="1" - if test "x${CURSES_DIR}" != "x"; then - CURSES_LIB="${pbxlibdir} ${CURSES_LIB}" - CURSES_INCLUDE="-I${CURSES_DIR}/include" - if test "xcurses.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${CURSES_DIR}/include/curses.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h usability" >&5 -echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${CURSES_DIR}/include/curses.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h presence" >&5 -echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${CURSES_DIR}/include/curses.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - CURSES_HEADER_FOUND=1 -else - CURSES_HEADER_FOUND=0 -fi - - - fi - else - if test "xcurses.h" != "x" ; then - if test "${ac_cv_header_curses_h+set}" = set; then - { echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking curses.h usability" >&5 -echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking curses.h presence" >&5 -echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_curses_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } - -fi -if test $ac_cv_header_curses_h = yes; then - CURSES_HEADER_FOUND=1 -else - CURSES_HEADER_FOUND=0 -fi - - - fi - fi - if test "x${CURSES_HEADER_FOUND}" = "x0" ; then - if test ! -z "${CURSES_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the curses development package installed." >&5 -echo "$as_me: *** It appears that you do not have the curses development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include curses support" >&5 -echo "$as_me: *** Please install it to include curses support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-curses" >&5 -echo "$as_me: *** without explicitly specifying --with-curses" >&6;} - exit 1 - fi - CURSES_LIB="" - CURSES_INCLUDE="" - PBX_LIBCURSES=0 - else - PBX_LIBCURSES=1 - -cat >>confdefs.h <<_ACEOF -#define HAVE_CURSES 1 -_ACEOF - - fi - elif test ! -z "${CURSES_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The curses installation on this system appears to be broken." >&5 -echo "$as_me: *** The curses installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-curses" >&5 -echo "$as_me: *** without explicity specifying --with-curses" >&6;} - exit 1 - fi -fi - - - - - - -# Check whether --with-ncurses was given. -if test "${with_ncurses+set}" = set; then - withval=$with_ncurses; -case ${withval} in - n|no) - USE_NCURSES=no - ;; - y|ye|yes) - NCURSES_MANDATORY="yes" - ;; - *) - NCURSES_DIR="${withval}" - NCURSES_MANDATORY="yes" - ;; -esac - -fi - - -PBX_LIBNCURSES=0 - -if test "${USE_NCURSES}" != "no"; then - pbxlibdir="" - if test "x${NCURSES_DIR}" != "x"; then - pbxlibdir="-L${ncurses_DIR}/lib" - fi - { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 -echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_ncurses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses ${pbxlibdir} $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char initscr (); -int -main () -{ -return initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_ncurses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ncurses_initscr=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; } -if test $ac_cv_lib_ncurses_initscr = yes; then - AST_NCURSES_FOUND=yes -else - AST_NCURSES_FOUND=no -fi - - - if test "${AST_NCURSES_FOUND}" = "yes"; then - NCURSES_LIB="-lncurses " - NCURSES_HEADER_FOUND="1" - if test "x${NCURSES_DIR}" != "x"; then - NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}" - NCURSES_INCLUDE="-I${NCURSES_DIR}/include" - if test "xcurses.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5 -echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${NCURSES_DIR}/include/curses.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5 -echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${NCURSES_DIR}/include/curses.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - NCURSES_HEADER_FOUND=1 -else - NCURSES_HEADER_FOUND=0 -fi - - - fi - else - if test "xcurses.h" != "x" ; then - if test "${ac_cv_header_curses_h+set}" = set; then - { echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking curses.h usability" >&5 -echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking curses.h presence" >&5 -echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_curses_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } - -fi -if test $ac_cv_header_curses_h = yes; then - NCURSES_HEADER_FOUND=1 -else - NCURSES_HEADER_FOUND=0 -fi - - - fi - fi - if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then - if test ! -z "${NCURSES_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the ncurses development package installed." >&5 -echo "$as_me: *** It appears that you do not have the ncurses development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include ncurses support" >&5 -echo "$as_me: *** Please install it to include ncurses support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-ncurses" >&5 -echo "$as_me: *** without explicitly specifying --with-ncurses" >&6;} - exit 1 - fi - NCURSES_LIB="" - NCURSES_INCLUDE="" - PBX_LIBNCURSES=0 - else - PBX_LIBNCURSES=1 - -cat >>confdefs.h <<_ACEOF -#define HAVE_NCURSES 1 -_ACEOF - - fi - elif test ! -z "${NCURSES_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The ncurses installation on this system appears to be broken." >&5 -echo "$as_me: *** The ncurses installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-ncurses" >&5 -echo "$as_me: *** without explicity specifying --with-ncurses" >&6;} - exit 1 - fi -fi - - - - - - -# Check whether --with-newt was given. -if test "${with_newt+set}" = set; then - withval=$with_newt; -case ${withval} in - n|no) - USE_NEWT=no - ;; - y|ye|yes) - NEWT_MANDATORY="yes" - ;; - *) - NEWT_DIR="${withval}" - NEWT_MANDATORY="yes" - ;; -esac - -fi - - -PBX_LIBNEWT=0 - -if test "${USE_NEWT}" != "no"; then - pbxlibdir="" - if test "x${NEWT_DIR}" != "x"; then - pbxlibdir="-L${newt_DIR}/lib" - fi - { echo "$as_me:$LINENO: checking for newtBell in -lnewt" >&5 -echo $ECHO_N "checking for newtBell in -lnewt... $ECHO_C" >&6; } -if test "${ac_cv_lib_newt_newtBell+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnewt ${pbxlibdir} $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char newtBell (); -int -main () -{ -return newtBell (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_newt_newtBell=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_newt_newtBell=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_newt_newtBell" >&5 -echo "${ECHO_T}$ac_cv_lib_newt_newtBell" >&6; } -if test $ac_cv_lib_newt_newtBell = yes; then - AST_NEWT_FOUND=yes -else - AST_NEWT_FOUND=no -fi - - - if test "${AST_NEWT_FOUND}" = "yes"; then - NEWT_LIB="-lnewt " - NEWT_HEADER_FOUND="1" - if test "x${NEWT_DIR}" != "x"; then - NEWT_LIB="${pbxlibdir} ${NEWT_LIB}" - NEWT_INCLUDE="-I${NEWT_DIR}/include" - if test "xnewt.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${NEWT_DIR}/include/newt.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5 -echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h usability" >&5 -echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${NEWT_DIR}/include/newt.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h presence" >&5 -echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${NEWT_DIR}/include/newt.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5 -echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - NEWT_HEADER_FOUND=1 -else - NEWT_HEADER_FOUND=0 -fi - - - fi - else - if test "xnewt.h" != "x" ; then - if test "${ac_cv_header_newt_h+set}" = set; then - { echo "$as_me:$LINENO: checking for newt.h" >&5 -echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; } -if test "${ac_cv_header_newt_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5 -echo "${ECHO_T}$ac_cv_header_newt_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking newt.h usability" >&5 -echo $ECHO_N "checking newt.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking newt.h presence" >&5 -echo $ECHO_N "checking newt.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: newt.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: newt.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: newt.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: newt.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: newt.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: newt.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: newt.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: newt.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: newt.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: newt.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: newt.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for newt.h" >&5 -echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; } -if test "${ac_cv_header_newt_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_newt_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5 -echo "${ECHO_T}$ac_cv_header_newt_h" >&6; } - -fi -if test $ac_cv_header_newt_h = yes; then - NEWT_HEADER_FOUND=1 -else - NEWT_HEADER_FOUND=0 -fi - - - fi - fi - if test "x${NEWT_HEADER_FOUND}" = "x0" ; then - if test ! -z "${NEWT_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the newt development package installed." >&5 -echo "$as_me: *** It appears that you do not have the newt development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include newt support" >&5 -echo "$as_me: *** Please install it to include newt support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-newt" >&5 -echo "$as_me: *** without explicitly specifying --with-newt" >&6;} - exit 1 - fi - NEWT_LIB="" - NEWT_INCLUDE="" - PBX_LIBNEWT=0 - else - PBX_LIBNEWT=1 - -cat >>confdefs.h <<_ACEOF -#define HAVE_NEWT 1 -_ACEOF - - fi - elif test ! -z "${NEWT_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The newt installation on this system appears to be broken." >&5 -echo "$as_me: *** The newt installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-newt" >&5 -echo "$as_me: *** without explicity specifying --with-newt" >&6;} - exit 1 - fi -fi - - - - - - -# Check whether --with-usb was given. -if test "${with_usb+set}" = set; then - withval=$with_usb; -case ${withval} in - n|no) - USE_USB=no - ;; - y|ye|yes) - USB_MANDATORY="yes" - ;; - *) - USB_DIR="${withval}" - USB_MANDATORY="yes" - ;; -esac - -fi - - -PBX_LIBUSB=0 - -if test "${USE_USB}" != "no"; then - pbxlibdir="" - if test "x${USB_DIR}" != "x"; then - pbxlibdir="-L${usb_DIR}/lib" - fi - { echo "$as_me:$LINENO: checking for usb_init in -lusb" >&5 -echo $ECHO_N "checking for usb_init in -lusb... $ECHO_C" >&6; } -if test "${ac_cv_lib_usb_usb_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lusb ${pbxlibdir} $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char usb_init (); -int -main () -{ -return usb_init (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_usb_usb_init=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_usb_usb_init=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_usb_usb_init" >&5 -echo "${ECHO_T}$ac_cv_lib_usb_usb_init" >&6; } -if test $ac_cv_lib_usb_usb_init = yes; then - AST_USB_FOUND=yes -else - AST_USB_FOUND=no -fi - - - if test "${AST_USB_FOUND}" = "yes"; then - USB_LIB="-lusb " - USB_HEADER_FOUND="1" - if test "x${USB_DIR}" != "x"; then - USB_LIB="${pbxlibdir} ${USB_LIB}" - USB_INCLUDE="-I${USB_DIR}/include" - if test "xusb.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${USB_DIR}/include/usb.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${USB_DIR}/include/usb.h" >&5 -echo $ECHO_N "checking for ${USB_DIR}/include/usb.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${USB_DIR}/include/usb.h usability" >&5 -echo $ECHO_N "checking ${USB_DIR}/include/usb.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${USB_DIR}/include/usb.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${USB_DIR}/include/usb.h presence" >&5 -echo $ECHO_N "checking ${USB_DIR}/include/usb.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${USB_DIR}/include/usb.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${USB_DIR}/include/usb.h" >&5 -echo $ECHO_N "checking for ${USB_DIR}/include/usb.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - USB_HEADER_FOUND=1 -else - USB_HEADER_FOUND=0 -fi - - - fi - else - if test "xusb.h" != "x" ; then - if test "${ac_cv_header_usb_h+set}" = set; then - { echo "$as_me:$LINENO: checking for usb.h" >&5 -echo $ECHO_N "checking for usb.h... $ECHO_C" >&6; } -if test "${ac_cv_header_usb_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5 -echo "${ECHO_T}$ac_cv_header_usb_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking usb.h usability" >&5 -echo $ECHO_N "checking usb.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking usb.h presence" >&5 -echo $ECHO_N "checking usb.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: usb.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: usb.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: usb.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: usb.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: usb.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: usb.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: usb.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: usb.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: usb.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: usb.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: usb.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: usb.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for usb.h" >&5 -echo $ECHO_N "checking for usb.h... $ECHO_C" >&6; } -if test "${ac_cv_header_usb_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_usb_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5 -echo "${ECHO_T}$ac_cv_header_usb_h" >&6; } - -fi -if test $ac_cv_header_usb_h = yes; then - USB_HEADER_FOUND=1 -else - USB_HEADER_FOUND=0 -fi - - - fi - fi - if test "x${USB_HEADER_FOUND}" = "x0" ; then - if test ! -z "${USB_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the usb development package installed." >&5 -echo "$as_me: *** It appears that you do not have the usb development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include libusb support" >&5 -echo "$as_me: *** Please install it to include libusb support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-usb" >&5 -echo "$as_me: *** without explicitly specifying --with-usb" >&6;} - exit 1 - fi - USB_LIB="" - USB_INCLUDE="" - PBX_LIBUSB=0 - else - PBX_LIBUSB=1 - -cat >>confdefs.h <<_ACEOF -#define HAVE_USB 1 -_ACEOF - - fi - elif test ! -z "${USB_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The libusb installation on this system appears to be broken." >&5 -echo "$as_me: *** The libusb installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-usb" >&5 -echo "$as_me: *** without explicity specifying --with-usb" >&6;} - exit 1 - fi -fi - - - - - - -# Check whether --with-selinux was given. -if test "${with_selinux+set}" = set; then - withval=$with_selinux; USE_SELINUX=$withval -else - if test ! -x /usr/sbin/sestatus; then - USE_SELINUX=no; - elif /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"; then - USE_SELINUX=yes - fi - - -fi - - - - - -# for asciidoc before ver. 7, the backend must be stated explicitly: -ASCIIDOC='asciidoc' -asciidoc_ver=`asciidoc --version 2>&1 | awk '/^asciidoc /{print $2}' | cut -d. -f 1 | head -n 1` -if test "$asciidoc_ver" != '' && test $asciidoc_ver -lt 7; then - ASCIIDOC="asciidoc -b xhtml" -fi - - - -# Check whether --with-ppp was given. -if test "${with_ppp+set}" = set; then - withval=$with_ppp; -else - with_ppp=check - -fi - -# somebody will fix that -default_ppp_path=/usr - -case "$with_ppp" in - yes|check) ppp_path="$default_ppp_path";; - no) ppp_path='' ;; - *) ppp_path="$with_ppp" ;; -esac - -level_file="$ppp_path/include/pppd/patchlevel.h" -PPP_VERSION= -if test "$ppp_path" != '' && test -r "$level_file"; then - PPPD_VERSION=`awk -F '"' '/VERSION/ { print $$2; }' $level_file` -fi - -case "$with_ppp" in - check|no) :;; - *) - # If we asked explicitly for ppp support - if test "$PPPD_VERSION" = ''; then - # but have not detected it - { { echo "$as_me:$LINENO: error: failed to find pppd/patchlevel.h: no ppp support." >&5 -echo "$as_me: error: failed to find pppd/patchlevel.h: no ppp support." >&2;} - { (exit 1); exit 1; }; } - fi - ;; -esac - - - -ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts build_tools/make_firmware_object" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "build_tools/menuselect-deps") CONFIG_FILES="$CONFIG_FILES build_tools/menuselect-deps" ;; - "makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;; - "build_tools/make_firmware_object") CONFIG_FILES="$CONFIG_FILES build_tools/make_firmware_object" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -CPP!$CPP$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -LN_S!$LN_S$ac_delim -GNU_MAKE!$GNU_MAKE$ac_delim -BDFNAME!$BDFNAME$ac_delim -BDFARCH!$BDFARCH$ac_delim -HOSTCC!$HOSTCC$ac_delim -GREP!$GREP$ac_delim -LN!$LN$ac_delim -WGET!$WGET$ac_delim -FETCH!$FETCH$ac_delim -DOWNLOAD!$DOWNLOAD$ac_delim -EGREP!$EGREP$ac_delim -CURSES_LIB!$CURSES_LIB$ac_delim -CURSES_INCLUDE!$CURSES_INCLUDE$ac_delim -PBX_LIBCURSES!$PBX_LIBCURSES$ac_delim -NCURSES_LIB!$NCURSES_LIB$ac_delim -NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim -PBX_LIBNCURSES!$PBX_LIBNCURSES$ac_delim -NEWT_LIB!$NEWT_LIB$ac_delim -NEWT_INCLUDE!$NEWT_INCLUDE$ac_delim -PBX_LIBNEWT!$PBX_LIBNEWT$ac_delim -USB_LIB!$USB_LIB$ac_delim -USB_INCLUDE!$USB_INCLUDE$ac_delim -PBX_LIBUSB!$PBX_LIBUSB$ac_delim -USE_SELINUX!$USE_SELINUX$ac_delim -ASCIIDOC!$ASCIIDOC$ac_delim -PPPD_VERSION!$PPPD_VERSION$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - - - - esac - -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - -chmod a+x build_tools/make_firmware_object - -{ echo "$as_me:$LINENO: *** Zaptel build successfully configured ***" >&5 -echo "$as_me: *** Zaptel build successfully configured ***" >&6;} - diff --git a/zaptel/configure.ac b/zaptel/configure.ac deleted file mode 100644 index c9ecbf9b..00000000 --- a/zaptel/configure.ac +++ /dev/null @@ -1,132 +0,0 @@ -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) - -m4_define([ZAP_VERSION], - m4_bpatsubst(m4_esyscmd([build_tools/make_version .]), - [\([0-9.]*\)\(\w\|\W\)*], - [\1])) -AC_INIT(zaptel, ZAP_VERSION, www.asterisk.org) - -# check existence of the package -AC_CONFIG_SRCDIR([kernel/zaptel-base.c]) - -AC_COPYRIGHT("Zaptel") -AC_REVISION($Revision: 3793 $) - -ac_default_prefix=/usr -if test ${sysconfdir} = '${prefix}/etc'; then - sysconfdir=/etc -fi -if test ${mandir} = '${prefix}/man'; then - mandir=/usr/share/man -fi - -if test ${localstatedir} = '${prefix}/var'; then - localstatedir=/var -fi - -# This needs to be before any macros that use the C compiler -AC_GNU_SOURCE - -# Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LN_S -AST_CHECK_GNU_MAKE - -test_obj=conftest.o -AC_COMPILE_IFELSE(AC_LANG_SOURCE(),[ - BDFNAME=`LANG=C objdump -f $test_obj | grep -e "$test_obj:" | sed "s/.*file format \(.*\)/\1/"` - BDFARCH=`LANG=C objdump -f $test_obj | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"` -],[]) -AC_SUBST(BDFNAME) -AC_SUBST(BDFARCH) - -# Set the default value of HOSTCC from CC if --host was not provided: -HOSTCC=${HOSTCC:=${CC}} -AC_SUBST(HOSTCC) - -AC_PATH_PROG([GREP], [grep], :) -AC_PATH_PROG([SHELL], [sh], :) -AC_PATH_PROG([LN], [ln], :) - -AC_PATH_PROG([WGET], [wget], :) -if test "${WGET}" != ":" ; then - DOWNLOAD=${WGET} -else - AC_PATH_PROG([FETCH], [fetch], [:]) - DOWNLOAD=${FETCH} -fi -AC_SUBST(DOWNLOAD) - -AC_LANG(C) - -AST_EXT_LIB([curses], [initscr], [curses.h], [CURSES], [curses], []) -AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], []) -AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt]) -AST_EXT_LIB([usb], [usb_init], [usb.h], [USB], [libusb]) - -AC_ARG_WITH(selinux, - [AS_HELP_STRING([--with-selinux], - [enable (with) / disable (without) SELinux])], - [USE_SELINUX=$withval], - [ if test ! -x /usr/sbin/sestatus; then - USE_SELINUX=no; - elif /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"; then - USE_SELINUX=yes - fi - ] -) - - -AC_SUBST(USE_SELINUX) - -# for asciidoc before ver. 7, the backend must be stated explicitly: -ASCIIDOC='asciidoc' -asciidoc_ver=`asciidoc --version 2>&1 | awk '/^asciidoc /{print $2}' | cut -d. -f 1 | head -n 1` -if test "$asciidoc_ver" != '' && test $asciidoc_ver -lt 7; then - ASCIIDOC="asciidoc -b xhtml" -fi -AC_SUBST(ASCIIDOC) - -AC_ARG_WITH(ppp, - [AS_HELP_STRING([--with-ppp=PATH],[Use ppp support from PATH])], - [], - [with_ppp=check] - ) -# somebody will fix that -default_ppp_path=/usr - -case "$with_ppp" in - yes|check) ppp_path="$default_ppp_path";; - no) ppp_path='' ;; - *) ppp_path="$with_ppp" ;; -esac - -level_file="$ppp_path/include/pppd/patchlevel.h" -PPP_VERSION= -if test "$ppp_path" != '' && test -r "$level_file"; then - PPPD_VERSION=`awk -F '"' '/VERSION/ { print $$2; }' $level_file` -fi - -case "$with_ppp" in - check|no) :;; - *) - # If we asked explicitly for ppp support - if test "$PPPD_VERSION" = ''; then - # but have not detected it - AC_MSG_ERROR(failed to find pppd/patchlevel.h: no ppp support.) - fi - ;; -esac - -AC_SUBST(PPPD_VERSION) - -AC_CONFIG_FILES([build_tools/menuselect-deps makeopts build_tools/make_firmware_object]) -AC_OUTPUT -chmod a+x build_tools/make_firmware_object - -AC_MSG_NOTICE(*** Zaptel build successfully configured ***) - diff --git a/zaptel/doc/fxotune.8 b/zaptel/doc/fxotune.8 deleted file mode 100644 index 5f42ee2d..00000000 --- a/zaptel/doc/fxotune.8 +++ /dev/null @@ -1,206 +0,0 @@ -.TH FXOTUNE "8" "9 June 2007" "asterisk" "System Manager's Manuals: Asterisk" -.SH NAME -fxotune \- automatically tune zaptel FXO channels -.SH SYNOPSIS -.B fxotune -i -.I [options] -- detect mode - -.B fxotune -d -.I [ options ] -- dump mode - -.B fxotune -s -- Startup mode -.SH -.SH DESCRIPTION -.B fxotune -is a script that fine-tune parameters of the FXO modules of the -card. It has three modes of operation: - -.I Detect mode (-i): -it detects and tunes all the available FXO channels. -It writes settings to a configuration file (/etc/fxotune.conf) -from which it can be loaded (e.g: at startup) using -s . - -.I Dump mode (-d): -Runs detection on a single Zaptel channel, and just dumps waveforms to -.B fxotune_dump.vals -is generated in the current directory. - -.I Startup mode (-s): -fxotune just reads the settings from fxotune.conf into the FXO modules. - -You are advised to run fxotune on all FXO ports you have that support -it and that are connected. Note that the tunning is affected by e.g. -the physical parameters of the connection, and thus if it has been -radically changed, you may need to re-run fxotune. - -FXOTune only works for the Digium TDM400P/800P/2400P cards and -compatible and the Xorcom Astribank devices. Other cards (notably X100P -cards and clones) do not have the hardware to support such tuning. - -The tuning process needs a clear line to do the tuning. In order to do -that, it runs in cycles of the following: sets the line off-hook, dials -a dial string (which should set the PSTN provider waiting for the next -digit), and then starts tuning. It has a limited ammount of time for -tuning before the PSTN gives up and gives a busy tone. So after a while -it hangs up and starts a new cycle. - -.B fxotune -has two operation modes: tune (-i) and set (-s). In the tune mode it -generates /etc/fxotune.conf, and in the set mode it merely applies the -parameters from fxotune.conf to device's ports. - -.SH OPTIONS -The following options below except -v (verbose) affect only the -detection process and hence apply only to the -.I detect -and -.I dump -modes. - -In addition, to maintain compatibility with older versions of fxotune, -if in detect or dump mode there is a parameter with option before it, it -is considered to be the -.I dialstring -parameter (-n). - -.B -b -.I startdev -.RS -Start tuning from zaptel channel num. \fI startdev\fR: skip all previous -channels. By default starting from channel 1. - -In dump mode (-d) this is the single channel that will be tested. -.RE - -.B -e -.I stopdev -.RS -Tune only up to zaptel channel num. \fI stopdev\fR: skip all previous -channels. By default stopping at channel 252. - -In dump mode (-d) this parameter is ignored. -.RE - -.B -l -.I delay-to-silence -.RS -Time in seconds to wait after dialing the dial-string to get a clear line. -The default is 0. -before -.RE - -.B -m -.I silence-good-for -.RS -Time in seconds which states how long the PSTN will wait after we dialed -the dial-string until it starts giving a busy tone. You can test this by -connecting an analog phone to the line and dialing. - -The default is 18 (18 seconds). -.RE - -.B -n -.I dial-string -.RS -Digits to dial to the PSTN in order to get it stop its dialtone and -waiting for the next digit. - -The default is "4" (sending just the digit 4). It should work in most -cases. Again, this can be tested by connecting a phone to the PSTN line -and dialing the dial-string. -.RE - -.B -t -.I detect-type -.RS -This option allows using the older detection method used by fxotune of -zaptel 1.2. use -.B -t 1 -for that older method. whereas -.B -t 2 -(the default) uses the current method. - -This option only applies to detect mode (-i). -.RE - -.B -v[vvvv] -.RS -Sets debugging on. The more v-s, the higher debug level. - -Note that: -vv -v will actually set debug level to 1 instead of 3. -.RE - -.B -w -.I wave-form -.RS -The default: -1, for multitone waveform. Alternatively: a frequency of a -single tone. - -This option only applies to dump mode (-d). -.RE - - -.SH EXAMPLES -.RS -fxotune -i 9 -.RE -if you need to dial 9 for an external line. If you always get a line, you -can simply use any digit. -.RE - -.B -s -.RS -Load settings from the last test. Used at startup. -.RE - -.SH FILES -.I /etc/fxotune.conf -.RS -The configuration file generated by fxotune in detect mode and from which -configuration is loaded when -.B -s -is used. - -.SH NOTES -Running fxotune takes approximately a minute per port. If you wish to only -run fxotune for several ports, you can use the options -b and -e to set a -specific range of ports. Another useful trick is to actually keep asterisk -running, and only "destroy" the zaptel channels you wish to tune (zap -destroy channel NNN): other channels will be used by Asterisk, and hence -skipped. This can be useful if you have many FXO ports that are not connected. - -.B fxotune -writes immedietly to -.B /etc/fxotune.conf -so if you stop it half-way, you may get a half-configured system. If you -have already tuned your FXO channels and wish to test-run fxotune again, -you are advised to backup /etc/fxotune.conf . - -The default for -m is 18 seconds. This asusmes that you get a clear line -for at least 18 seconds. It is advised that you test that timeout earlier -by connecting a phone to the FXO line, dialing 4 (or whatever dial string -you put with -n) and see how much time of silence you have. - -If you connect your device to a PSTN provider that is not in the US, there -is a similar operation you should apply before even getting to fxotune: -setting the opermode. The opermode sets a number of country-specific -parameters. For the Digium analog cards this is set through the kernel module -parameter 'opermode' . For the Xorcom Astribank this is set through the -variable 'opermode' in /etc/default/zaptel or /etc/sysconfig/zaptel . -For valid values of this parameter, see -/usr/share/asterisk/init_fxo_modes . - -.SH SEE ALSO -ztcfg(8), zttool(8), ztmonitor(8), asterisk(8). - -.SH AUTHOR -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/fxstest.8 b/zaptel/doc/fxstest.8 deleted file mode 100644 index 2368dff2..00000000 --- a/zaptel/doc/fxstest.8 +++ /dev/null @@ -1,60 +0,0 @@ -.TH "FXSTEST" "8" "9 June 2007" "asterisk" "System Manager's Manuals: Asterisk" - -.SH NAME -fxstest \- Simple tests for Zaptel FXS adapters -.SH SYNOPSIS - -.B fxstest /dev/zap/\fIN comand\fR - -.SH DESCRIPTION -fxstest can be used to issue one of a number simple tests to FXS -adapters (analog adapters intended to connect phones). - -.SH OPTIONS -All of those tests operate on a single zaptel channel which has to be an -FXS port, and must not be in use by Asterisk or any other program. - -The command has two mandatory parameters. -The first parameter is the device file to operate on. It is typically -/dev/zap/NN , a device file under /dev/zap . - -The second parameter is the name of the command to run on that channel: - -.I stats -.RS -Reports voltages -.RE - -.I regdump -.RS -Dumps ProSLIC registers -.RE - -.I tones -.RS -Plays a series of tones -.RE - -.I polarity -.RS -Requests channel to reverse polarity. -.RE - -.I ring -.RS -Rings phone -.RE - -.SH "SEE ALSO" -.PP -zttool(8), ztcfg(8), ztmonitor(8), asterisk(8). -.SH BUGS -Does not allow testing channels beyond 249. Should support opening -channels through /dev/zap/channel . -.SH AUTHOR -.PP -This manual page was written by Tzafrir Cohen . -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. -.PP diff --git a/zaptel/doc/module-parameters.txt b/zaptel/doc/module-parameters.txt deleted file mode 100644 index 83867485..00000000 --- a/zaptel/doc/module-parameters.txt +++ /dev/null @@ -1,57 +0,0 @@ - === Parameters for Zaptel modules === - -(Note: this list is woefully incomplete, but is a starting point and -will be improved as time permits.) - - - --- VPMADT032 Parameters --- - -The wctdm24xxp and wcte12xp drivers support cards which can have an -optional VPMADT032 hardware echo canceler module. If that module is -present, the following module parameters are available for these -drivers: - -vpmsupport - 0 or 1, defaults to 1 - - Enables or disables use of the VPM. - -vpmdtmfsupport - 0 or 1, defaults to 0 - - Enables or disables DTMF tone detection on the VPM - (currently defaults to 'disabled' due to performance issues - when this functionality is enabled). - -vpmnlptype - 0 through 4, defaults to 1 - - Selects the type of non-linear processor that should be - applied when echo is detected and removed by the VPM. There - are five choices: - - 0 - None (not recommended) - 1 - Mute (mutes the echo) - 2 - Random Noise (replaces the echo with random noise) - 3 - Hoth Noise (replaces the echo with Hoth noise) - 4 - Suppress (suppresses the echo to a specified level) - -vpmnlpthresh - 0 through 40, in decibels (dB), defaults to 24 - - Relative signal level of echo to transmitted audio at which - NLP will be used to remove echo. - -vpmnlpmaxsupp - 0 through 90, in decibels (dB), defaults to 0 - - When vpmnlptype is 'Suppress', this value indicates the - relative energy level decrease that should be applied to the - echo signal). - - --- General Module Parameters --- - -latency - 3 to 32, defaults to 3 - - For the wctdm24xxp and wcte12xp drivers. Specifies the amount of - latency the driver inserts into the voice conversation. On systems - that are unable to service the interrupt in a timely manner, - increasing the latency can decrease module init time since the driver - will not need to dynamically grow the latency during initialization. - However, the latency in the driver does add to the overall latency of - any voice conversation. diff --git a/zaptel/doc/patgen.8 b/zaptel/doc/patgen.8 deleted file mode 100644 index b92bb6ea..00000000 --- a/zaptel/doc/patgen.8 +++ /dev/null @@ -1,42 +0,0 @@ -.TH patgen 8 "2008-01-08" -.SH NAME -patgen \(em Generates a Pattern for a Zaptel Clear Channel Test -.SH SYNOPSIS -.B patgen -.I zap-device - -.SH DESCRIPTION -.B patgen -Sends test data to a Zaptel channel. The channel should be of CLEAR -signalling (e.g: B channel of a PRI line). pattest(8) is used to test -the data at the other side. See its manual for more information. - -.B patgen -Must be able to write to the channel. Hence this cannot be used for a -channel used by Asterisk. - -.SH OPTIONS -.I zap-device -.RS -A Zaptel device file. -.RE - -.SH EXAMPLE - patgen /dev/zap/5 - -.SH BUGS -Will not work with channels whose number > 249 as they don't have device -files. For a simple workaround, see ztdiag.c . - -.SH SEE ALSO -pattest(8), ztcfg(8), asterisk(8). - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/pattest.8 b/zaptel/doc/pattest.8 deleted file mode 100644 index c0d14bbb..00000000 --- a/zaptel/doc/pattest.8 +++ /dev/null @@ -1,48 +0,0 @@ -.TH pattest 8 "2008-01-08" -.SH NAME -pattest \(em Tests a Pattern for a Zaptel Clear Channel Test -.SH SYNOPSIS -.B pattest -.I zap-device - -.SH DESCRIPTION -.B pattest -Recieves test data from a Zaptel channel and checks if it matches the -test pattern. The channel should be of CLEAR signalling (e.g: B channel -of a PRI line). patgen(8) is used to generate the data at the other side. - -.B pattest -Must be able to read from the channel. Hence this cannot be used for a -channel used by Asterisk. - -The pattern is a simple series of values from 0 to 255. Hence it takes -at most one sample to get in sync with the other side. If there is no -output, all is well. Output is an error message. - -.SH OPTIONS -.I zap-device -.RS -A Zaptel device file. -.RE - -.SH EXAMPLE - pattest /dev/zap/5 - -.SH BUGS -Will not work with channels whose number > 249 as they don't have device -files. For a simple workaround, see ztdiag.c . - -Gives way too many errors when does not get any input. - -.SH SEE ALSO -patgen(8), ztcfg(8), asterisk(8). - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/torisatool.8 b/zaptel/doc/torisatool.8 deleted file mode 100644 index b6acfc1e..00000000 --- a/zaptel/doc/torisatool.8 +++ /dev/null @@ -1,29 +0,0 @@ -.TH ztspeed 8 "2005-9-10" -.SH NAME -torisatool \(em get errors from a Tormenta ISA card -.SH SYNOPSIS -.B torisatool -.I chanenl -.B showerrors - -.SH DESCRIPTION -.B torisatool -is a tool to list errors from a Tormenta ISA E1/T1 Zaptel adapter -(normally used with the Asterisk(8) PBX). - -.SH OPTIONS -.B channel -zaptel channel number to check. - -.SH SEE ALSO -zttool(8), ztmonitor(8), zttest(8), ztcfg(8), ztspeed(8), asterisk(8). - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/ztcfg.8 b/zaptel/doc/ztcfg.8 deleted file mode 100644 index 29c7051b..00000000 --- a/zaptel/doc/ztcfg.8 +++ /dev/null @@ -1,61 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "ZTCFG" "8" "15 July 2005" "" "" - -.SH NAME -ztcfg \- reads and loads zaptel.conf -.SH SYNOPSIS - -\fBztcfg\fR [ \fB-c \fICFG_FILE\fB \fR ] [ \fB-s\fR ] [ \fB-f\fR ] [ \fB-t\fR ] [ \fB-v [ -v\fI ...\fB ]\fR ] - - -\fBztcfg\fR [ \fB-h\fR ] - -.SH "DESCRIPTION" -.PP -\fBztcfg\fR configures zaptel interface cards -from a config file. -.PP -You generally need to run it with a valid configurations -in order for zaptel modules to work properly. -.SH "OPTIONS" -.TP -\fB-c \fICFG_FILE\fB\fR -Use an alternative configuration file instead of -\fI/etc/zaptel.conf\fR -.TP -\fB-s\fR -Only shutdown spans. -.TP -\fB-f\fR -Always configure every channel, even if it appears not to have changed. -.TP -\fB-t\fR -Test mode. Don't do anything, just report what you -wanted to do. -.TP -\fB-v\fR -Be more verbose. Add extra v-s for extra verbosity. -.TP -\fB-h\fR -Display a brief help about the usage of \fBztcfg\fR -.SH "FILES" -.PP -\fI/etc/zaptel.conf\fR The default location for the configuration file. -.SH "SEE ALSO" -.PP -zttool(8), ztmonitor(8), asterisk(8). -.SH "AUTHOR" -.PP -This manual page was written by Santiago Ruano Rinc\['o]n - for -the Debian system (but may be used by others). Permission is -granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. -.PP -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/ztdiag.8 b/zaptel/doc/ztdiag.8 deleted file mode 100644 index bdcb4802..00000000 --- a/zaptel/doc/ztdiag.8 +++ /dev/null @@ -1,52 +0,0 @@ -.TH ztdiag 8 "2008-01-07" -.SH NAME -ztdiag \(em Dump Zaptel channel parameters -.SH SYNOPSIS -.B ztdiag -.I channel - -.SH DESCRIPTION -.B ztdiag -asks the kernel to dump parameters for Zaptel channel no. -.I channel -to the kernel logs. You will be able to see them using, e.g. dmesg(1). - - -.SH OPTIONS -.I channel -.RS -The number of the Zaptel channel whose parammeters should be dumped. -May be any Zaptel channel (even if it is open). -.RE - -.SH EXAMPLE - - # /tmp/ztdiag 5 - # dmesg | tail -n 15 - Dump of Zaptel Channel 5 (XPP_BRI_TE/00/01/1,5,2): - - flags: 501 hex, writechunk: c5190948, readchunk: c5190954 - rxgain: ccad2e80, txgain: ccad2e80, gainalloc: 0 - span: c48a900c, sig: 80 hex, sigcap: 80 hex - inreadbuf: -1, outreadbuf: 0, inwritebuf: 0, outwritebuf: -1 - blocksize: 160, numbufs: 4, txbufpolicy: 0, txbufpolicy: 0 - txdisable: 0, rxdisable: 0, iomask: 0 - curzone: c78e7000, tonezone: 0, curtone: 00000000, tonep: 0 - digitmode: 0, txdialbuf: , dialing: 0, aftdialtimer: 0, cadpos. 0 - confna: 0, confn: 0, confmode: 0, confmute: 0 - ec: 00000000, echocancel: 0, deflaw: 0, xlaw: ccab5e80 - echostate: 00, echotimer: 0, echolastupdate: 0 - itimer: 0, otimer: 0, ringdebtimer: 0 - -.SH SEE ALSO -ztcfg(8), asterisk(8), dmesg(1). - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/ztmonitor.8 b/zaptel/doc/ztmonitor.8 deleted file mode 100644 index f2172408..00000000 --- a/zaptel/doc/ztmonitor.8 +++ /dev/null @@ -1,43 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "ZTMONITOR" "8" "15 July 2005" "" "" - -.SH NAME -ztmonitor \- checks the rx/tx levels of the zaptel inteface cards. -.SH SYNOPSIS - -\fBztmonitor \fR \fBchannel number\fR [ \fB-v\fR ] [ \fB-f \fIFILE\fB\fR ] - -.SH "DESCRIPTION" -.PP -ztmonitor monitors a zaptel channel. It gives you a visual -representation of the sound strengths and makes it easy to see if -the received or transmitted signals are too high or out of -balance -.SH "OPTIONS" -.PP -The first (mandatory) parameter is the number of the channel -to monitor. -.TP -\fB -v \fR -Display visual audio levels. -.TP -\fB -f \fIFILE\fB \fR -Write output to FILE -.SH "SEE ALSO" -.PP -zttool(8), ztcfg(8), asterisk(8). -.SH "AUTHOR" -.PP -This manual page was written by Santiago Ruano Rinc\['o]n - for -the Debian system (but may be used by others). Permission is -granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. -.PP -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/ztscan.8 b/zaptel/doc/ztscan.8 deleted file mode 100644 index e03ddba0..00000000 --- a/zaptel/doc/ztscan.8 +++ /dev/null @@ -1,94 +0,0 @@ -.TH ztscan 8 "2008-03-18" -.SH NAME -ztscan \(em Print Configuration of Zaptel Spans -.SH SYNOPSIS -.B ztscan -.I [spans] - -.SH DESCRIPTION -.B ztscan -prints information about zaptel spans in the system. For analog spans it -also provides a list of channels. - -By default it prints information about all the spans in the system. -However if parameters are provided, they will be considered to be a list -of span numbers and information will be printed for them. - -Output is printed to the standard output. The format is that of an -Asterisk configuration file (similar to a "ini" configuration file), -where the name of the section is the number of the span. Note that the -specifically for analog spans some keys may appear more than once, and -hence you can not use a parser for an "ini" format and assume you have a -dictionary. - -.SH EXAMPLES -Printing information for spans 1, 2 and 4: - - ztspan 1 2 4 - -And to print all the spans: - - ztspan - -Information about a certain analog span: - - [5] - active=yes - alarms=OK - description=Xorcom XPD #00/10: FXS - name=XBUS-00/XPD-10 - manufacturer=Xorcom Inc. - devicetype=Astribank: Unit 1 Subunit 0: FXS - location=usb-0000:00:03.3-4 - basechan=125 - totchans=8 - irq=0 - type=analog - port=125,FXS - port=126,FXS - port=127,FXS - port=128,FXS - port=129,FXS - port=130,FXS - port=131,FXS - port=132,FXS - -And an example of a digital span: - - [1] - active=yes - alarms=RED - description=T2XXP (PCI) Card 0 Span 1 - name=TE2/0/1 - manufacturer=Digium - devicetype=Wildcard TE205P (4th Gen) - location=Board ID Switch 0 - basechan=1 - totchans=24 - irq=193 - type=digital-T1 - syncsrc=0 - lbo=0 db (CSU)/0-133 feet (DSX-1) - coding_opts=B8ZS,AMI - framing_opts=ESF,D4 - coding=B8ZS - framing=ESF - -The "type" field may contain: "analog", "digital-T1", "digital-E1", -"digital-J1" or "digital-BRI". - -.SH FILES -Requires read access to /dev/zap/ctl . - -.SH SEE ALSO -ztcfg(8), asterisk(8). - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/ztspeed.8 b/zaptel/doc/ztspeed.8 deleted file mode 100644 index bbe097bb..00000000 --- a/zaptel/doc/ztspeed.8 +++ /dev/null @@ -1,26 +0,0 @@ -.TH ztspeed 8 "2005-06-25" -.SH NAME -ztspeed \(em A generic speed test -.SH SYNOPSIS -.B ztspeed - -.SH DESCRIPTION -.B ztspeed -runs a simple 100% CPU loop for 5 seconds to see how many loops are -performed. Used to measure how much CPU zaptel \fBreally\fR is taking. - -.SH OPTIONS -None. Nothing else to see. - -.SH SEE ALSO -zttool(8), ztmonitor(8), zttest(8), ztcfg(8), asterisk(8). - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/zttest.8 b/zaptel/doc/zttest.8 deleted file mode 100644 index 7b9970f8..00000000 --- a/zaptel/doc/zttest.8 +++ /dev/null @@ -1,53 +0,0 @@ -.TH zttest 8 "2005-06-25" -.SH "NAME" -zttest \(em Test if the zaptel timer provides timely response -.SH "SYNOPSIS" -.B zttest -.I [ -v ] - -.SH "DESCRIPTION" -.B zttest -zttest runs a timing test in a loop and prints the result of each loop. -The test is as follows: - -It reads 8192 bytes from the zaptel timer device (\fI/dev/zap/pseudo\fR). -This should take exactly 8000 ms . It uses calls to -.I gettimeofday(2) -before and after that read to check that indeed exactly 8000ms have passed. - -Values of 100% and 99.99% Are normally considered a definite -.I pass. -Values of 99.98% and 99.97% are probably OK as well. - -.SH OPTIONS -.B -v -.RS -Be more verbose: print one line per test. -.RE - -.B -c -.I count -.RS -Run for -.I count -times instead of running forever. -.RE - -.SH FILES -.B /dev/zap/pseudo -.RS -.RE -The device file used to access the zaptel timer. - -.SH SEE ALSO -zttool(8), ztmonitor(8), ztspeed(8), ztcfg(8), asterisk(8). gettimeofday(2) - -.SH AUTHOR - -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/doc/zttool.8 b/zaptel/doc/zttool.8 deleted file mode 100644 index c3c09d07..00000000 --- a/zaptel/doc/zttool.8 +++ /dev/null @@ -1,34 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "ZTTOOL" "8" "15 July 2005" "" "" - -.SH NAME -zttool \- Zaptel Tool shows status of Digium's interface cards. -.SH SYNOPSIS - -\fBzttool\fR - -.SH "DESCRIPTION" -.PP -zttool shows the current status the Digium Zaptel inteface -cards plugged to the computer. -.PP -It displays values like Current Alarms, SyncSource, Tx/Rx -Levels for each Zaptel interface. -.SH "SEE ALSO" -.PP -ztmonitor(8), asterisk (8). -.SH "AUTHOR" -.PP -This manual page was written by Santiago Ruano Rinc\['o]n - for -the Debian system (but may be used by others). Permission is -granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. -.PP -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/firmware/Makefile b/zaptel/firmware/Makefile deleted file mode 100644 index 88def159..00000000 --- a/zaptel/firmware/Makefile +++ /dev/null @@ -1,172 +0,0 @@ -# -# Zaptel -# -# Makefile for firmware downloading/installation -# -# Copyright (C) 2007, Digium, Inc. -# -# Joshua Colp -# -# This program is free software, distributed under the terms of -# the GNU General Public License -# - -.PHONY: dist-clean all uninstall have_download install - --include ../menuselect.makeopts ../makeopts - -PWD:=$(shell pwd) - -OCT6114_064_VERSION:=1.05.01 -OCT6114_128_VERSION:=1.05.01 -TC400M_VERSION:=MR6.12 -VPMADT032_VERSION:=1.07 - -FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases - -# Firmware files should use the naming convention: zaptel-fw--- or zaptel-fw-- -# First example: zaptel-fw-oct6114-064-1.05.01 -# This means this is version 1.05.01 of the oct6114 64 firmware -# Second example: zaptel-fw-tc400m-MR5.6 -# This means this is version MR5.6 of the tc400m firmware - -# Build a list of firmware package filenames we need -FIRMWARE:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCT6114-064=zaptel-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz) -FIRMWARE:=$(FIRMWARE:FIRMWARE-OCT6114-128=zaptel-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz) -FIRMWARE:=$(FIRMWARE:FIRMWARE-TC400M=zaptel-fw-tc400m-$(TC400M_VERSION).tar.gz) -FIRMWARE:=$(FIRMWARE:FIRMWARE-VPMADT032=zaptel-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz) - -# Build a list of object files if hotplug will not be used -OBJECT_FILES:=$(MENUSELECT_FIRMWARE:FIRMWARE-OCT6114-064=zaptel-fw-oct6114-064.o) -OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-OCT6114-128=zaptel-fw-oct6114-128.o) -OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-TC400M=zaptel-fw-tc400m.o) -OBJECT_FILES:=$(OBJECT_FILES:FIRMWARE-VPMADT032=zaptel-fw-vpmadt032.o) - -# If "fetch" is used, --continue is not a valid option. -ifeq ($(WGET),wget) -WGET_ARGS:=--continue -endif - -all: $(FIRMWARE) - -# Clean up any downloaded/extracted firmware packages -dist-clean: clean - rm -f zaptel-fw-*.bin - rm -f zaptel-fw-*.tar.gz - -# Clean up anything we built -clean: - rm -f zaptel-fw-*.o - -have_download: - @if test "$(DOWNLOAD)" = ":" ; then \ - echo "**************************************************"; \ - echo "*** ***"; \ - echo "*** You must have either wget or fetch to be ***"; \ - echo "*** able to automatically download and install ***"; \ - echo "*** the requested firmware packages. ***"; \ - echo "*** ***"; \ - echo "**************************************************"; \ - exit 1; \ - fi - -# Download and extract firmware tarballs -zaptel-fw-%.tar.gz: - @if ( [ "$(HOTPLUG_FIRMWARE)" = "no" ] ) || ( [ -d $(DESTDIR)/usr/lib/hotplug/firmware ] && ! [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.$(subst .tar.gz,,$*) ] ) || ( [ -d $(DESTDIR)/lib/firmware ] && ! [ -f $(DESTDIR)/lib/firmware/.$(subst .tar.gz,,$*) ] ); then \ - echo "Attempting to download $@"; \ - if test ! -f $@; then $(DOWNLOAD) $(WGET_ARGS) $(FIRMWARE_URL)/$@; fi; \ - if test ! -f $@; then exit 1; fi; \ - (cat $@ | gzip -d | tar -xof -) \ - fi - -# Create object files suitable for linking against -object-build: $(FIRMWARE) $(OBJECT_FILES) - -$(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware: - mkdir -p $@ - -# Install all downloaded firmware images for hotplug usage -hotplug-install: $(DESTDIR)/usr/lib/hotplug/firmware $(DESTDIR)/lib/firmware $(FIRMWARE) -ifneq ($(findstring zaptel-fw-oct6114-064,$(FIRMWARE)),) -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) - @echo "Installing zaptel-fw-oct6114-064.bin to hotplug firmware directories" - @$(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(DESTDIR)/usr/lib/hotplug/firmware - @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-* - @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) - @$(INSTALL) -m 644 zaptel-fw-oct6114-064.bin $(DESTDIR)/lib/firmware - @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-* - @touch $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-064-$(OCT6114_064_VERSION) -else - @echo "Firmware zaptel-fw-oct6114-064.bin is already installed with required version $(OCT6114_064_VERSION)" -endif -endif -ifneq ($(findstring zaptel-fw-oct6114-128,$(FIRMWARE)),) -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) - @echo "Installing zaptel-fw-oct6114-128.bin to hotplug firmware directories" - @$(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(DESTDIR)/usr/lib/hotplug/firmware - @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-* - @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) - @$(INSTALL) -m 644 zaptel-fw-oct6114-128.bin $(DESTDIR)/lib/firmware - @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-* - @touch $(DESTDIR)/lib/firmware/.zaptel-fw-oct6114-128-$(OCT6114_128_VERSION) -else - @echo "Firmware zaptel-fw-oct6114-128.bin is already installed with required version $(OCT6114_128_VERSION)" -endif -endif -ifneq ($(findstring zaptel-fw-tc400m,$(FIRMWARE)),) -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) - @echo "Installing zaptel-fw-tc400m.bin to hotplug firmware directories" - @$(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/usr/lib/hotplug/firmware - @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-* - @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) - @$(INSTALL) -m 644 zaptel-fw-tc400m.bin $(DESTDIR)/lib/firmware - @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-* - @touch $(DESTDIR)/lib/firmware/.zaptel-fw-tc400m-$(TC400M_VERSION) -else - @echo "Firmware zaptel-fw-tc400m.bin is already installed with required version $(TC400M_VERSION)" -endif -endif -ifneq ($(findstring zaptel-fw-vpmadt032,$(FIRMWARE)),) -ifeq ($(shell if ( [ -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ) && ( [ -f $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) ] ); then echo "no"; else echo "yes"; fi),yes) - @echo "Installing zaptel-fw-vpmadt032.bin to hotplug firmware directories" - @$(INSTALL) -m 644 zaptel-fw-vpmadt032.bin $(DESTDIR)/usr/lib/hotplug/firmware - @rm -rf $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-* - @touch $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) - @$(INSTALL) -m 644 zaptel-fw-vpmadt032.bin $(DESTDIR)/lib/firmware - @rm -rf $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-* - @touch $(DESTDIR)/lib/firmware/.zaptel-fw-vpmadt032-$(VPMADT032_VERSION) -else - @echo "Firmware zaptel-fw-vpmadt032.bin is already installed with required version $(VPMADT032_VERSION)" -endif -endif - -# Uninstall any installed zaptel firmware images from hotplug firmware directories -hotplug-uninstall: - if [ -d $(DESTDIR)/usr/lib/hotplug/firmware ]; then \ - rm -f $(DESTDIR)/usr/lib/hotplug/firmware/zaptel-fw-*.bin; \ - rm -f $(DESTDIR)/usr/lib/hotplug/firmware/.zaptel-fw*; \ - fi - if [ -d $(DESTDIR)/lib/firmware ]; then \ - rm -f $(DESTDIR)/lib/firmware/zaptel-fw-*.bin; \ - rm -f $(DESTDIR)/lib/firmware/.zaptel-fw*; \ - fi - -# Build object file of an oct6114 064 firmware image for linking -zaptel-fw-oct6114-064.o: zaptel-fw-oct6114-064-$(OCT6114_064_VERSION).tar.gz zaptel-fw-oct6114-064.bin - @echo Making firmware object file for zaptel-fw-oct6114-064.bin - ../build_tools/make_firmware_object zaptel-fw-oct6114-064.bin $@ - -# Build object file of an oct6114 128 firmware image for linking -zaptel-fw-oct6114-128.o: zaptel-fw-oct6114-128-$(OCT6114_128_VERSION).tar.gz zaptel-fw-oct6114-128.bin - @echo Making firmware object file for zaptel-fw-oct6114-128.bin - ../build_tools/make_firmware_object zaptel-fw-oct6114-128.bin $@ - -# Build object file of a TC400M firmware image for linking -zaptel-fw-tc400m.o: zaptel-fw-tc400m-$(TC400M_VERSION).tar.gz zaptel-fw-tc400m.bin - @echo Making firmware object file for zaptel-fw-tc400m.bin - ../build_tools/make_firmware_object zaptel-fw-tc400m.bin $@ - -# Build object file of a VPMADT032 firmware image for linking -zaptel-fw-vpmadt032.o: zaptel-fw-vpmadt032-$(VPMADT032_VERSION).tar.gz zaptel-fw-vpmadt032.bin - @echo Making firmware object file for zaptel-fw-vpmadt032.bin - ../build_tools/make_firmware_object zaptel-fw-vpmadt032.bin $@ diff --git a/zaptel/firmware/firmware.xml b/zaptel/firmware/firmware.xml deleted file mode 100644 index cedafd19..00000000 --- a/zaptel/firmware/firmware.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - yes - wct4xxp - - - yes - wct4xxp - - - yes - wctc4xxp - - - yes - wctdm24xxp - - diff --git a/zaptel/fxotune.c b/zaptel/fxotune.c deleted file mode 100644 index 21c8fe79..00000000 --- a/zaptel/fxotune.c +++ /dev/null @@ -1,1119 +0,0 @@ -/* - * fxotune.c -- A utility for tuning the various settings on the fxo - * modules for the TDM400 cards. - * - * by Matthew Fredrickson - * - * (C) 2004-2005 Digium, Inc. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif -#include "kernel/wctdm.h" -#include "fxotune.h" - -#define TEST_DURATION 2000 -#define BUFFER_LENGTH (2 * TEST_DURATION) -#define SKIP_SAMPLES 800 - -static const float amplitude = 16384.0; - -static char *zappath = "/dev/zap"; -static char *configfile = "/etc/fxotune.conf"; - -static int audio_dump_fd = -1; - -static char *usage = -"Usage: fxotune [-v[vv] (-s | -i | -d )\n" -"\n" -" -s : set previously calibrated echo settings\n" -" -i : calibrate echo settings\n" -" options : [] [-t ]\n" -" [-b ][-e ]\n" -" [-n ][-l ][-m ]\n" -" -d : dump input and output waveforms to ./fxotune_dump.vals\n" -" options : [-b ][-w ]\n" -" [-n ][-l ][-m ]\n" -" -v : more output (-vv, -vvv also)\n" -" -o : Write the received raw 16-bit signed linear audio that is\n" -" used in processing to the file specified by \n" -" -c \n" -"\n" -" - type of calibration\n" -" (default 2, old method 1)\n" -" \n" -" - defines a range of devices to test\n" -" (default: 1-252)\n" -" - string to dial to clear the line\n" -" (default 5)\n" -" - seconds to wait for line to clear (default 0)\n" -" - seconds before line will no longer be clear\n" -" (default 18)\n" -" - the device to perform waveform dump on\n" -" (default 1)\n" -" - -1 for multitone waveform, or frequency of\n" -" single tone (default -1)\n" -" - Alternative file to set from / calibrate to.\n" -" (Default: /etc/fxotune.conf)\n" -; - - -#define OUT_OF_BOUNDS(x) ((x) < 0 || (x) > 255) - -struct silence_info{ - char *dialstr; - /** fd of device we are working with */ - int device; - /** seconds we should wait after dialing the dialstring before we know for sure we'll have silence */ - int initial_delay; - /** seconds after which a reset should occur */ - int reset_after; - /** time of last reset */ - struct timeval last_reset; -}; - -static short outbuf[TEST_DURATION]; -static int debug = 0; - -static FILE *debugoutfile = NULL; - -static int fxotune_read(int fd, void *buffer, int len) -{ - int res; - - res = read(fd, buffer, len); - - if ((res > 0) && (audio_dump_fd != -1)) { - write(audio_dump_fd, buffer, len); - } - - return res; -} - -/** - * Makes sure that the line is clear. - * Right now, we do this by relying on the user to specify how long after dialing the - * dialstring we can rely on the line being silent (before the telco complains about - * the user not hitting the next digit). - * - * A more robust way to do this would be to actually measure the sound levels on the line, - * but that's a lot more complicated, and this should work. - * - * @return 0 if succesful (no errors), 1 if unsuccesful - */ -static int ensure_silence(struct silence_info *info) -{ - struct timeval tv; - long int elapsedms; - - gettimeofday(&tv, NULL); - - if (info->last_reset.tv_sec == 0) { - /* this is the first request, we will force it to run */ - elapsedms = -1; - } else { - /* this is not the first request, we will compute elapsed time */ - elapsedms = ((tv.tv_sec - info->last_reset.tv_sec) * 1000L + (tv.tv_usec - info->last_reset.tv_usec) / 1000L); - } - if (debug > 4) { - fprintf(stdout, "Reset line request received - elapsed ms = %li / reset after = %ld\n", elapsedms, info->reset_after * 1000L); - } - - if (elapsedms > 0 && elapsedms < info->reset_after * 1000L) - return 0; - - if (debug > 1){ - fprintf(stdout, "Resetting line\n"); - } - - /* do a line reset */ - /* prepare line for silence */ - /* Do line hookstate reset */ - int x = ZT_ONHOOK; - - if (ioctl(info->device, ZT_HOOK, &x)) { - fprintf(stderr, "Unable to hang up fd %d\n", info->device); - return -1; - } - - sleep(2); - x = ZT_OFFHOOK; - if (ioctl(info->device, ZT_HOOK, &x)) { - fprintf(stderr, "Cannot bring fd %d off hook\n", info->device); - return -1; - } - sleep(2); /* Added to ensure that dial can actually takes place */ - - struct zt_dialoperation dop; - memset(&dop, 0, sizeof(dop)); - dop.op = ZT_DIAL_OP_REPLACE; - dop.dialstr[0] = 'T'; - zap_copy_string(dop.dialstr + 1, info->dialstr, sizeof(dop.dialstr)); - - - if (ioctl(info->device, ZT_DIAL, &dop)) { - fprintf(stderr, "Unable to dial!\n"); - return -1; - } - sleep(1); - sleep(info->initial_delay); - - - gettimeofday(&info->last_reset, NULL); - - - return 0; -} - -/** - * Generates a tone of specified frequency. - * - * @param hz the frequency of the tone to be generated - * @param index the current sample - * to begenerated. For a normal waveform you need to increment - * this every time you execute the function. - * - * @return 16bit slinear sample for the specified index - */ -static short inline gentone(int hz, int index) -{ - return amplitude * sin((index * 2.0 * M_PI * hz)/8000); -} - -/* Using DTMF tones for now since they provide good mid band testing - * while not being harmonics of each other */ -static int freqs[] = {697, 770, 941, 1209, 1336, 1633}; -static int freqcount = 6; - -/** - * Generates a waveform of several frequencies. - * - * @param index the current sample - * to begenerated. For a normal waveform you need to increment - * this every time you execute the function. - * - * @return 16bit slinear sample for the specified index - */ -static short inline genwaveform(int index) -{ - int i = 0; - float response = (float)0; - for (i = 0; i < freqcount; i++){ - response += sin((index * 2.0 * M_PI * freqs[i])/8000); - } - - - return amplitude * response / freqcount; -} - - -/** - * Calculates the RMS of the waveform buffer of samples in 16bit slinear format. - * prebuf the buffer of either shorts or floats - * bufsize the number of elements in the prebuf buffer (not the number of bytes!) - * short_format 1 if prebuf points to an array of shorts, 0 if it points to an array of floats - * - * Formula for RMS (http://en.wikipedia.org/wiki/Root_mean_square): - * - * Xrms = sqrt(1/N Sum(x1^2, x2^2, ..., xn^2)) - * - * Note: this isn't really a power calculation - but it gives a good measure of the level of the response - * - * @param prebuf the buffer containing the values to compute - * @param bufsize the size of the buffer - * @param short_format 1 if prebuf contains short values, 0 if it contains float values - */ -static float power_of(void *prebuf, int bufsize, int short_format) -{ - float sum_of_squares = 0; - int numsamples = 0; - float finalanswer = 0; - short *sbuf = (short*)prebuf; - float *fbuf = (float*)prebuf; - int i = 0; - - if (short_format) { - /* idiot proof checks */ - if (bufsize <= 0) - return -1; - - numsamples = bufsize; /* Got rid of divide by 2 - the bufsize parameter should give the number of samples (that's what it does for the float computation, and it should do it here as well) */ - - for (i = 0; i < numsamples; i++) { - sum_of_squares += ((float)sbuf[i] * (float)sbuf[i]); - } - } else { - /* Version for float inputs */ - for (i = 0; i < bufsize; i++) { - sum_of_squares += (fbuf[i] * fbuf[i]); - } - } - - finalanswer = sum_of_squares/(float)bufsize; /* need to divide by the number of elements in the sample for RMS calc */ - - if (finalanswer < 0) { - printf("Error: Final answer negative number %f\n", finalanswer); - return -3; - } - - return sqrtf(finalanswer); -} - -/* - * In an effort to eliminate as much as possible the effect of outside noise, we use principles - * from the Fourier Transform to attempt to calculate the return loss of our signal for each setting. - * - * To begin, we send our output signal out on the line. We then receive back the reflected - * response. In the Fourier Transform, each evenly distributed frequency within the window - * is correlated (multiplied against, then the resulting samples are added together) with - * the real (cos) and imaginary (sin) portions of that frequency base to detect that frequency. - * - * Instead of doing a complete Fourier Transform, we solve the transform for only our signal - * by multiplying the received signal by the real and imaginary portions of our reference - * signal. This then gives us the real and imaginary values that we can use to calculate - * the return loss of the sinusoids that we sent out on the line. This is done by finding - * the magnitude (think polar form) of the vector resulting from the real and imaginary - * portions calculated above. - * - * This essentially filters out any other noise which maybe present on the line which is outside - * the frequencies used in our test multi-tone. - */ -static float db_loss(float measured, float reference) -{ - return 20 * (logf(measured/reference)/logf(10)); -} - -static void one_point_dft(const short *inbuf, int len, int frequency, float *real, float *imaginary) -{ - float myreal = 0, myimag = 0; - int i; - - for (i = 0; i < len; i++) { - myreal += (float) inbuf[i] * cos((i * 2.0 * M_PI * frequency)/8000); - myimag += (float) inbuf[i] * sin((i * 2.0 * M_PI * frequency)/8000); - } - - myimag *= -1; - - *real = myreal / (float) len; - *imaginary = myimag / (float) len; -} - -static float calc_magnitude(short *inbuf, int insamps) -{ - float real, imaginary, magnitude; - float totalmagnitude = 0; - int i; - - for (i = 0; i < freqcount; i++) { - one_point_dft(inbuf, insamps, freqs[i], &real, &imaginary); - magnitude = sqrtf((real * real) + (imaginary * imaginary)); - totalmagnitude += magnitude; - } - - return totalmagnitude; -} - -/** - * dumps input and output buffer contents for the echo test - used to see exactly what's going on - */ -static int maptone(int whichzap, int freq, char *dialstr, int delayuntilsilence) -{ - int i = 0; - int res = 0, x = 0; - struct zt_bufferinfo bi; - short inbuf[TEST_DURATION]; /* changed from BUFFER_LENGTH - this buffer is for short values, so it should be allocated using the length of the test */ - FILE *outfile = NULL; - - outfile = fopen("fxotune_dump.vals", "w"); - if (!outfile) { - fprintf(stdout, "Cannot create fxotune_dump.vals\n"); - return -1; - } - - x = 1; - if (ioctl(whichzap, ZT_SETLINEAR, &x)) { - fprintf(stderr, "Unable to set channel to signed linear mode.\n"); - return -1; - } - - memset(&bi, 0, sizeof(bi)); - if (ioctl(whichzap, ZT_GET_BUFINFO, &bi)) { - fprintf(stderr, "Unable to get buffer information!\n"); - return -1; - } - bi.numbufs = 2; - bi.bufsize = TEST_DURATION; /* KD - changed from BUFFER_LENGTH; */ - bi.txbufpolicy = ZT_POLICY_IMMEDIATE; - bi.rxbufpolicy = ZT_POLICY_IMMEDIATE; - if (ioctl(whichzap, ZT_SET_BUFINFO, &bi)) { - fprintf(stderr, "Unable to set buffer information!\n"); - return -1; - } - - /* Fill the output buffers */ - int leadin = 50; - int trailout = 100; - for (i = 0; i < leadin; i++) - outbuf[i] = 0; - for (; i < TEST_DURATION - trailout; i++){ - outbuf[i] = freq > 0 ? gentone(freq, i) : genwaveform(i); /* if frequency is negative, use a multi-part waveform instead of a single frequency */ - } - for (; i < TEST_DURATION; i++) - outbuf[i] = 0; - - /* Make sure the line is clear */ - struct silence_info sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - sinfo.device = whichzap; - sinfo.dialstr = dialstr; - sinfo.initial_delay = delayuntilsilence; - sinfo.reset_after = 4; /* doesn't matter - we are only running one test */ - - if (ensure_silence(&sinfo)){ - fprintf(stderr, "Unable to get a clear outside line\n"); - return -1; - } - - /* Flush buffers */ - x = ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT; - if (ioctl(whichzap, ZT_FLUSH, &x)) { - fprintf(stderr, "Unable to flush I/O: %s\n", strerror(errno)); - return -1; - } - - /* send data out on line */ - res = write(whichzap, outbuf, BUFFER_LENGTH); /* we are sending a TEST_DURATION length array of shorts (which are 2 bytes each) */ - if (res != BUFFER_LENGTH) { - fprintf(stderr, "Could not write all data to line\n"); - return -1; - } - -retry: - /* read return response */ - res = fxotune_read(whichzap, inbuf, BUFFER_LENGTH); - if (res != BUFFER_LENGTH) { - int x; - - ioctl(whichzap, ZT_GETEVENT, &x); - goto retry; - } - - /* write content of output buffer to debug file */ - float power_result = power_of(inbuf, TEST_DURATION, 1); - float power_waveform = power_of(outbuf, TEST_DURATION, 1); - float echo = power_result/power_waveform; - - fprintf(outfile, "Buffers, freq=%d, outpower=%0.0f, echo=%0.4f\n", freq, power_result, echo); - fprintf(outfile, "Sample, Input (received from the line), Output (sent to the line)\n"); - for (i = 0; i < TEST_DURATION; i++){ - fprintf(outfile, "%d, %d, %d\n", - i, - inbuf[i], - outbuf[i] - ); - } - - fclose(outfile); - - fprintf(stdout, "echo ratio = %0.4f (%0.1f / %0.1f)\n", echo, power_result, power_waveform); - - return 0; -} - - - -/** - * Perform calibration type 2 on the specified device - * - * Determine optimum echo coefficients for the specified device - * - * New tuning strategy. If we have a number that we can dial that will result in silence from the - * switch, the tune will be *much* faster (we don't have to keep hanging up and dialing a digit, etc...) - * The downside is that the user needs to actually find a 'no tone' phone number at their CO's switch - but for - * really fixing echo problems, this is what it takes. - * - * Also, for the purposes of optimizing settings, if we pick a single frequency and test with that, - * we can try a whole bunch of impedence/echo coefficients. This should give better results than trying - * a bunch of frequencies, and we can always do a a frequency sweep to pick between the best 3 or 4 - * impedence/coefficients configurations. - * - * Note: It may be possible to take this even further and do some pertubation analysis on the echo coefficients - * themselves (maybe use the 72 entry sweep to find some settings that are close to working well, then - * deviate the coefficients a bit to see if we can improve things). A better way to do this would be to - * use the optimization strategy from silabs. For reference, here is an application note that describes - * the echo coefficients (and acim values): - * - * http://www.silabs.com/public/documents/tpub_doc/anote/Wireline/Silicon_DAA/en/an84.pdf - * - */ -static int acim_tune2(int whichzap, int freq, char *dialstr, int delayuntilsilence, int silencegoodfor, struct wctdm_echo_coefs *coefs_out) -{ - int i = 0; - int res = 0, x = 0; - int lowesttry = -1; - float lowesttryresult = 999999999999.0; - float lowestecho = 999999999999.0;; - struct zt_bufferinfo bi; - - short inbuf[TEST_DURATION * 2]; - - if (debug && !debugoutfile) { - if (!(debugoutfile = fopen("fxotune.vals", "w"))) { - fprintf(stdout, "Cannot create fxotune.vals\n"); - return -1; - } - } - - /* Set echo settings */ - if (ioctl(whichzap, WCTDM_SET_ECHOTUNE, &echo_trys[0])) { - fprintf(stderr, "Unable to set impedance on fd %d\n", whichzap); - return -1; - } - - x = 1; - if (ioctl(whichzap, ZT_SETLINEAR, &x)) { - fprintf(stderr, "Unable to set channel to signed linear mode.\n"); - return -1; - } - - memset(&bi, 0, sizeof(bi)); - if (ioctl(whichzap, ZT_GET_BUFINFO, &bi)) { - fprintf(stderr, "Unable to get buffer information!\n"); - return -1; - } - bi.numbufs = 2; - bi.bufsize = BUFFER_LENGTH; - bi.txbufpolicy = ZT_POLICY_IMMEDIATE; - bi.rxbufpolicy = ZT_POLICY_IMMEDIATE; - if (ioctl(whichzap, ZT_SET_BUFINFO, &bi)) { - fprintf(stderr, "Unable to set buffer information!\n"); - return -1; - } - x = ZT_OFFHOOK; - if (ioctl(whichzap, ZT_HOOK, &x)) { - fprintf(stderr, "Cannot bring fd %d off hook", whichzap); - return -1; - } - - - /* Set up silence settings */ - struct silence_info sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - sinfo.device = whichzap; - sinfo.dialstr = dialstr; - sinfo.initial_delay = delayuntilsilence; - sinfo.reset_after = silencegoodfor; - - /* Fill the output buffers */ - for (i = 0; i < TEST_DURATION; i++) - outbuf[i] = freq > 0 ? gentone(freq, i) : genwaveform(i); /* if freq is negative, use a multi-frequency waveform */ - - /* compute power of input (so we can later compute echo levels relative to input) */ - float waveform_power = calc_magnitude(outbuf, TEST_DURATION); - - - /* sweep through the various coefficient settings and see how our responses look */ - - int echo_trys_size = 72; - int trys = 0; - for (trys = 0; trys < echo_trys_size; trys++){ - - /* ensure silence on the line */ - if (ensure_silence(&sinfo)){ - fprintf(stderr, "Unable to get a clear outside line\n"); - return -1; - } - - if (ioctl(whichzap, WCTDM_SET_ECHOTUNE, &echo_trys[trys])) { - fprintf(stderr, "Unable to set echo coefficients on fd %d\n", whichzap); - return -1; - } - - /* Flush buffers */ - x = ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT; - if (ioctl(whichzap, ZT_FLUSH, &x)) { - fprintf(stderr, "Unable to flush I/O: %s\n", strerror(errno)); - return -1; - } - - /* send data out on line */ - res = write(whichzap, outbuf, BUFFER_LENGTH); - if (res != BUFFER_LENGTH) { - fprintf(stderr, "Could not write all data to line\n"); - return -1; - } - -retry: - /* read return response */ - res = fxotune_read(whichzap, inbuf, BUFFER_LENGTH * 2); - if (res != BUFFER_LENGTH * 2) { - int x; - - ioctl(whichzap, ZT_GETEVENT, &x); - goto retry; - } - - float freq_result = calc_magnitude(inbuf, TEST_DURATION * 2); - float echo = db_loss(freq_result, waveform_power); - -#if 0 - if (debug > 0) - fprintf(stdout, "%3d,%d,%d,%d,%d,%d,%d,%d,%d: magnitude = %0.0f, echo = %0.4f dB\n", - echo_trys[trys].acim, echo_trys[trys].coef1, echo_trys[trys].coef2, - echo_trys[trys].coef3, echo_trys[trys].coef4, echo_trys[trys].coef5, - echo_trys[trys].coef6, echo_trys[trys].coef7, echo_trys[trys].coef8, - freq_result, echo); -#endif - - if (freq_result < lowesttryresult){ - lowesttry = trys; - lowesttryresult = freq_result; - lowestecho = echo; - } - if (debug) { - char result[256]; - snprintf(result, sizeof(result), "%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%f,%f", - echo_trys[trys].acim, - echo_trys[trys].coef1, - echo_trys[trys].coef2, - echo_trys[trys].coef3, - echo_trys[trys].coef4, - echo_trys[trys].coef5, - echo_trys[trys].coef6, - echo_trys[trys].coef7, - echo_trys[trys].coef8, - freq_result, - echo - ); - - fprintf(debugoutfile, "%s\n", result); - fprintf(stdout, "%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d: magnitude = %0.0f, echo = %0.4f dB\n", - echo_trys[trys].acim, echo_trys[trys].coef1, echo_trys[trys].coef2, - echo_trys[trys].coef3, echo_trys[trys].coef4, echo_trys[trys].coef5, - echo_trys[trys].coef6, echo_trys[trys].coef7, echo_trys[trys].coef8, - freq_result, echo); - } - } - - if (debug > 0) - fprintf(stdout, "Config with lowest response = %d, magnitude = %0.0f, echo = %0.4f dB\n", lowesttry, lowesttryresult, lowestecho); - - memcpy(coefs_out, &echo_trys[lowesttry], sizeof(struct wctdm_echo_coefs)); - - return 0; -} - -/** - * Perform calibration type 1 on the specified device. Only tunes the line impedance. Look for best response range - */ -static int acim_tune(int whichzap, char *dialstr, int delayuntilsilence, int silencegoodfor, struct wctdm_echo_coefs *coefs_out) -{ - int i = 0, freq = 0, acim = 0; - int res = 0, x = 0; - struct zt_bufferinfo bi; - struct wctdm_echo_coefs coefs; - short inbuf[TEST_DURATION]; /* changed from BUFFER_LENGTH - this buffer is for short values, so it should be allocated using the length of the test */ - int lowest = 0; - FILE *outfile = NULL; - float acim_results[16]; - - - if (debug) { - outfile = fopen("fxotune.vals", "w"); - if (!outfile) { - fprintf(stdout, "Cannot create fxotune.vals\n"); - return -1; - } - } - - /* Set up silence settings */ - struct silence_info sinfo; - memset(&sinfo, 0, sizeof(sinfo)); - sinfo.device = whichzap; - sinfo.dialstr = dialstr; - sinfo.initial_delay = delayuntilsilence; - sinfo.reset_after = silencegoodfor; - - /* Set echo settings */ - memset(&coefs, 0, sizeof(coefs)); - if (ioctl(whichzap, WCTDM_SET_ECHOTUNE, &coefs)) { - fprintf(stdout, "Skipping non-TDM / non-FXO\n"); - return -1; - } - - x = 1; - if (ioctl(whichzap, ZT_SETLINEAR, &x)) { - fprintf(stderr, "Unable to set channel to signed linear mode.\n"); - return -1; - } - - memset(&bi, 0, sizeof(bi)); - if (ioctl(whichzap, ZT_GET_BUFINFO, &bi)) { - fprintf(stderr, "Unable to get buffer information!\n"); - return -1; - } - bi.numbufs = 2; - bi.bufsize = BUFFER_LENGTH; - bi.txbufpolicy = ZT_POLICY_IMMEDIATE; - bi.rxbufpolicy = ZT_POLICY_IMMEDIATE; - if (ioctl(whichzap, ZT_SET_BUFINFO, &bi)) { - fprintf(stderr, "Unable to set buffer information!\n"); - return -1; - } - - for (acim = 0; acim < 16; acim++) { - float freq_results[15]; - - coefs.acim = acim; - if (ioctl(whichzap, WCTDM_SET_ECHOTUNE, &coefs)) { - fprintf(stderr, "Unable to set impedance on fd %d\n", whichzap); - return -1; - } - - for (freq = 200; freq <=3000; freq+=200) { - /* Fill the output buffers */ - for (i = 0; i < TEST_DURATION; i++) - outbuf[i] = gentone(freq, i); - - /* Make sure line is ready for next test iteration */ - if (ensure_silence(&sinfo)){ - fprintf(stderr, "Unable to get a clear line\n"); - return -1; - } - - - /* Flush buffers */ - x = ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT; - if (ioctl(whichzap, ZT_FLUSH, &x)) { - fprintf(stderr, "Unable to flush I/O: %s\n", strerror(errno)); - return -1; - } - - /* send data out on line */ - res = write(whichzap, outbuf, BUFFER_LENGTH); - if (res != BUFFER_LENGTH) { - fprintf(stderr, "Could not write all data to line\n"); - return -1; - } - - /* read return response */ -retry: - /* read return response */ - res = fxotune_read(whichzap, inbuf, BUFFER_LENGTH); - if (res != BUFFER_LENGTH) { - int x; - - ioctl(whichzap, ZT_GETEVENT, &x); - goto retry; - } - - /* calculate power of response */ - - freq_results[(freq/200)-1] = power_of(inbuf+SKIP_SAMPLES, TEST_DURATION-SKIP_SAMPLES, 1); /* changed from inbuf+SKIP_BYTES, BUFFER_LENGTH-SKIP_BYTES, 1 */ - if (debug) fprintf(outfile, "%d,%d,%f\n", acim, freq, freq_results[(freq/200)-1]); - } - acim_results[acim] = power_of(freq_results, 15, 0); - } - - if (debug) { - for (i = 0; i < 16; i++) - fprintf(outfile, "acim_results[%d] = %f\n", i, acim_results[i]); - } - /* Find out what the "best" impedance is for the line */ - lowest = 0; - for (i = 0; i < 16; i++) { - if (acim_results[i] < acim_results[lowest]) { - lowest = i; - } - } - - coefs_out->acim = lowest; - coefs_out->coef1 = 0; - coefs_out->coef2 = 0; - coefs_out->coef3 = 0; - coefs_out->coef4 = 0; - coefs_out->coef5 = 0; - coefs_out->coef6 = 0; - coefs_out->coef7 = 0; - coefs_out->coef8 = 0; - - return 0; -} - -/** - * Reads echo register settings from the configuration file and pushes them into - * the appropriate devices - * - * @param configfilename the path of the file that the calibration results should be written to - * - * @return 0 if successful, !0 otherwise - */ -static int do_set(char *configfilename) -{ - FILE *fp = NULL; - int res = 0; - int fd = 0; - - fp = fopen(configfile, "r"); - - if (!fp) { - fprintf(stdout, "Cannot open %s!\n",configfile); - return -1; - } - - - while (res != EOF) { - struct wctdm_echo_coefs mycoefs; - char completezappath[56] = ""; - int myzap,myacim,mycoef1,mycoef2,mycoef3,mycoef4,mycoef5,mycoef6,mycoef7,mycoef8; - - - res = fscanf(fp, "%d=%d,%d,%d,%d,%d,%d,%d,%d,%d",&myzap,&myacim,&mycoef1, - &mycoef2,&mycoef3,&mycoef4,&mycoef5,&mycoef6,&mycoef7, - &mycoef8); - - if (res == EOF) { - break; - } - - /* Check to be sure conversion is done correctly */ - if (OUT_OF_BOUNDS(myacim) || OUT_OF_BOUNDS(mycoef1)|| - OUT_OF_BOUNDS(mycoef2)|| OUT_OF_BOUNDS(mycoef3)|| - OUT_OF_BOUNDS(mycoef4)|| OUT_OF_BOUNDS(mycoef5)|| - OUT_OF_BOUNDS(mycoef6)|| OUT_OF_BOUNDS(mycoef7)|| OUT_OF_BOUNDS(mycoef8)) { - - fprintf(stdout, "Bounds check error on inputs from %s:%d\n", configfile, myzap); - return -1; - } - - mycoefs.acim = myacim; - mycoefs.coef1 = mycoef1; - mycoefs.coef2 = mycoef2; - mycoefs.coef3 = mycoef3; - mycoefs.coef4 = mycoef4; - mycoefs.coef5 = mycoef5; - mycoefs.coef6 = mycoef6; - mycoefs.coef7 = mycoef7; - mycoefs.coef8 = mycoef8; - - snprintf(completezappath, sizeof(completezappath), "%s/%d", zappath, myzap); - fd = open(completezappath, O_RDWR); - - if (fd < 0) { - fprintf(stdout, "open error on %s: %s\n", completezappath, strerror(errno)); - return -1; - } - - if (ioctl(fd, WCTDM_SET_ECHOTUNE, &mycoefs)) { - fprintf(stdout, "%s: %s\n", completezappath, strerror(errno)); - return -1; - } - - close(fd); - } - - fclose(fp); - - if (debug) - fprintf(stdout, "fxotune: successfully set echo coeffecients on FXO modules\n"); - return 0; -} - -/** - * Output waveform information from a single test - * - * Clears the line, then sends a single waveform (multi-tone, or single tone), and listens - * for the response on the line. Output is written to fxotune_dump.vals - * - * @param startdev the device to test - * @param dialstr the string that should be dialed to clear the dialtone from the line - * @param delayuntilsilence the number of seconds to wait after dialing dialstr before starting the test - * @param silencegoodfor the number of seconds that the test can run before having to reset the line again - * (this is basically the amount of time it takes before the 'if you'd like to make a call...' message - * kicks in after you dial dialstr. This test is so short that the value is pretty much ignored. - * @param waveformtype the type of waveform to use - -1 = multi-tone waveform, otherwise the specified value - * is used as the frequency of a single tone. A value of 0 will output silence. - */ -static int do_dump(int startdev, char* dialstr, int delayuntilsilence, int silencegoodfor, int waveformtype) -{ - int res = 0; - int fd; - char zapdev[80] = ""; - - int zapmodule = startdev; - snprintf(zapdev, sizeof(zapdev), "%s/%d", zappath, zapmodule); - - fd = open(zapdev, O_RDWR); - if (fd < 0) { - fprintf(stdout, "%s absent: %s\n", zapdev, strerror(errno)); - return -1; - } - - fprintf(stdout, "Dumping module %s\n", zapdev); - res = maptone(fd, waveformtype, dialstr, delayuntilsilence); - - close(fd); - - if (res) { - fprintf(stdout, "Failure!\n"); - return res; - } else { - fprintf(stdout, "Done!\n"); - return 0; - } - -} - -/** - * Performs calibration on all specified devices - * - * @param startdev the first device to check - * @param enddev the last device to check - * @param calibtype the type of calibration to perform. 1=old style (loops through individual frequencies - * doesn't optimize echo coefficients. 2=new style (uses multi-tone and optimizes echo coefficients - * and acim setting) - * @param configfilename the path of the file that the calibration results should be written to - * @param dialstr the string that should be dialed to clear the dialtone from the line - * @param delayuntilsilence the number of seconds to wait after dialing dialstr before starting the test - * @param silencegoodfor the number of seconds that the test can run before having to reset the line again - * (this is basically the amount of time it takes before the 'if you'd like to make a call...' message - * kicks in after you dial dialstr - * - * @return 0 if successful, !0 otherwise - */ -static int do_calibrate(int startdev, int enddev, int calibtype, char* configfilename, char* dialstr, int delayuntilsilence, int silencegoodfor) -{ - int problems = 0; - int res = 0; - int configfd, fd; - int devno = 0; - char zapdev[80] = ""; - struct wctdm_echo_coefs coefs; - - configfd = open(configfile, O_CREAT|O_TRUNC|O_WRONLY, 0666); - - if (configfd < 0) { - fprintf(stderr, "Cannot generate config file %s: open: %s\n", configfile, strerror(errno)); - return -1; - } - - for (devno = startdev; devno <= enddev; devno++) { - snprintf(zapdev, sizeof(zapdev), "%s/%d", zappath, devno); - - fd = open(zapdev, O_RDWR); - if (fd < 0) { - fprintf(stdout, "%s absent: %s\n", zapdev, strerror(errno)); - continue; - } - - fprintf(stdout, "Tuning module %s\n", zapdev); - - if (1 == calibtype) - res = acim_tune(fd, dialstr, delayuntilsilence, silencegoodfor, &coefs); - else - res = acim_tune2(fd, -1, dialstr, delayuntilsilence, silencegoodfor, &coefs); - - close(fd); - - if (res) { - fprintf(stdout, "Failure!\n"); - problems++; - } else { - fprintf(stdout, "Done!\n"); - } - - if (res == 0) { - - /* Do output to file */ - int len = 0; - static char output[255] = ""; - - snprintf(output, sizeof(output), "%d=%d,%d,%d,%d,%d,%d,%d,%d,%d\n", - devno, - coefs.acim, - coefs.coef1, - coefs.coef2, - coefs.coef3, - coefs.coef4, - coefs.coef5, - coefs.coef6, - coefs.coef7, - coefs.coef8 - ); - - if (debug) - fprintf(stdout, "Found best echo coefficients: %s\n", output); - - len = strlen(output); - res = write(configfd, output, strlen(output)); - if (res != len) { - fprintf(stdout, "Unable to write line \"%s\" to file.\n", output); - return -1; - } - } - } - - close(configfd); - - if (problems) - fprintf(stdout, "Unable to tune %d devices, even though those devices are present\n", problems); - - return problems; -} - -int main(int argc , char **argv) -{ - int startdev = 1; /* -b */ - int stopdev = 252; /* -e */ - int calibtype = 2; /* -t */ - int waveformtype = -1; /* -w multi-tone by default. If > 0, single tone of specified frequency */ - int delaytosilence = 0; /* -l */ - int silencegoodfor = 18; /* -m */ - - char* dialstr = "5"; /* -n */ - - int res = 0; - - int doset = 0; /* -s */ - int docalibrate = 0; /* -i */ - int dodump = 0; /* -d */ - - int i = 0; - - for (i = 1; i < argc; i++){ - if (!(argv[i][0] == '-' || argv[i][0] == '/') || (strlen(argv[i]) <= 1)){ - fprintf(stdout, "Unknown option : %s\n", argv[i]); - /* Show usage */ - fputs(usage, stdout); - return -1; - } - int moreargs = (i < argc - 1); - - switch(argv[i][1]){ - case 's': - doset=1; - continue; - case 'i': - docalibrate = 1; - if (moreargs){ /* we need to check for a value after 'i' for backwards compatability with command line options of old fxotune */ - if (argv[i+1][0] != '-' && argv[i+1][0] != '/') - dialstr = argv[++i]; - } - continue; - case 'c': - configfile = moreargs ? argv[++i] : configfile; - continue; - case 'd': - dodump = 1; - continue; - case 'b': - startdev = moreargs ? atoi(argv[++i]) : startdev; - break; - case 'e': - stopdev = moreargs ? atoi(argv[++i]) : stopdev; - break; - case 't': - calibtype = moreargs ? atoi(argv[++i]) : calibtype; - break; - case 'w': - waveformtype = moreargs ? atoi(argv[++i]) : waveformtype; - break; - case 'l': - delaytosilence = moreargs ? atoi(argv[++i]) : delaytosilence; - break; - case 'm': - silencegoodfor = moreargs ? atoi(argv[++i]) : silencegoodfor; - break; - case 'n': - dialstr = moreargs ? argv[++i] : dialstr; - break; - case 'v': - debug = strlen(argv[i])-1; - break; - case 'o': - if (moreargs) { - audio_dump_fd = open(argv[++i], O_WRONLY|O_CREAT|O_TRUNC, 0666); - if (audio_dump_fd == -1) { - fprintf(stdout, "Unable to open file %s: %s\n", argv[i], strerror(errno)); - return -1; - } - break; - } else { - fprintf(stdout, "No path supplied to -o option!\n"); - return -1; - } - default: - fprintf(stdout, "Unknown option : %s\n", argv[i]); - /* Show usage */ - fputs(usage, stdout); - return -1; - - } - } - - if (debug > 3){ - fprintf(stdout, "Running with parameters:\n"); - fprintf(stdout, "\tdoset=%d\n", doset); - fprintf(stdout, "\tdocalibrate=%d\n", docalibrate); - fprintf(stdout, "\tdodump=%d\n", dodump); - fprintf(stdout, "\tstartdev=%d\n", startdev); - fprintf(stdout, "\tstopdev=%d\n", stopdev); - fprintf(stdout, "\tcalibtype=%d\n", calibtype); - fprintf(stdout, "\twaveformtype=%d\n", waveformtype); - fprintf(stdout, "\tdelaytosilence=%d\n", delaytosilence); - fprintf(stdout, "\tsilencegoodfor=%d\n", silencegoodfor); - fprintf(stdout, "\tdialstr=%s\n", dialstr); - fprintf(stdout, "\tdebug=%d\n", debug); - } - - if (docalibrate){ - res = do_calibrate(startdev, stopdev, calibtype, configfile, dialstr, delaytosilence, silencegoodfor); - if (!res) - return do_set(configfile); - else - return -1; - } - - if (doset) - return do_set(configfile); - - if (dodump){ - res = do_dump(startdev, dialstr, delaytosilence, silencegoodfor, waveformtype); - if (!res) - return 0; - else - return -1; - } - - fputs(usage, stdout); - return -1; -} diff --git a/zaptel/fxotune.h b/zaptel/fxotune.h deleted file mode 100644 index 97b02e6e..00000000 --- a/zaptel/fxotune.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * fxotune.h -- data structures and associated definitions for fxotune.c - * - * By Matthew Fredrickson - * - * Echo coefficients and acim register values taken from AN84 from Silicon - * Laboratories app note AN84 for setting echo cancellation coefficients - * - * (C) 2005 Digium, Inc. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -struct wctdm_echo_coefs echo_trys [] = -{ - /* 600 ohm echo settings */ - { 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 10, 0, 6, 1, 254, 2, 255, 0, 0}, - { 3, 255, 255, 0, 1, 0, 0, 0, 0}, - { 3, 1, 253, 253, 2, 255, 0, 0, 0}, - { 9, 254, 251, 255, 2, 0, 1, 0, 0}, - { 5, 3, 251, 250, 2, 254, 0, 0, 255}, - { 8, 253, 2, 244, 255, 10, 244, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 900 ohm echo settings */ - { 1, 0, 0, 0, 0, 0, 0, 0, 0}, - { 10, 252, 255, 1, 255, 0, 0, 0, 0}, - { 7, 255, 251, 251, 2, 255, 255, 1, 255}, - { 3, 1, 251, 250, 1, 254, 255, 0, 255}, - { 5, 252, 250, 0, 0, 255, 1, 0, 0}, - { 5, 3, 251, 250, 1, 253, 0, 0, 255}, - { 8, 253, 2, 244, 255, 10, 244, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 270 ohm + (750 ohm || 150 nF) (CTR21) */ - { 2, 0, 0, 0, 0, 0, 0, 0, 0}, - { 7, 0, 0, 255, 254, 0, 0, 0, 0}, - { 9, 0, 253, 254, 2, 255, 0, 0, 0}, - { 5, 1, 249, 254, 4, 253, 1, 0, 0}, - { 5, 252, 250, 1, 1, 254, 0, 255, 0}, - { 5, 3, 251, 250, 2, 253, 255, 255, 255}, - { 8, 253, 2, 244, 255, 10, 244, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 220 ohm + (820 ohm || 120 nF) (Australia/NewZealand) and 220 ohm + (820 ohm - * || 115nF) (Slovakia/SAfrica/Germany/Austria/Bulgaria) - */ - { 3, 0, 0, 0, 0, 0, 0, 0, 0}, - { 7, 0, 255, 254, 255, 0, 255, 0, 0}, - { 9, 0, 253, 253, 1, 255, 0, 0, 0}, - { 5, 1, 249, 254, 3, 253, 1, 0, 0}, - { 5, 252, 250, 1, 1, 254, 0, 255, 0}, - { 5, 3, 251, 251, 2, 253, 255, 255, 255}, - { 8, 253, 2, 244, 255, 10, 244, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 370 ohm + (620ohm || 310nF) (New Zealand #2/India) CO Termination */ - { 4, 0, 0, 0, 0, 0, 0, 0, 0}, - { 9, 255, 1, 4, 0, 0, 1, 255, 0}, - { 9, 0, 253, 0, 3, 254, 0, 0, 255}, - { 9, 2, 250, 253, 5, 253, 1, 0 ,255}, - { 5, 252, 250, 1, 2, 255, 0 ,255, 0}, - { 5, 3, 251, 250, 3, 254, 255, 255, 255}, - { 8, 253, 2, 244, 255, 10, 244, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 320 ohm + (1050ohm || 230 nF) (England) CO Termination */ - { 5, 0, 0, 0, 0, 0, 0, 0, 0}, - { 9, 0 ,255, 1, 255, 255, 0, 255, 0}, - { 5, 255, 252, 0, 2, 254, 0, 255, 255}, - { 9, 2, 250, 253, 4, 252, 0, 255, 255}, - { 5, 252, 250, 1, 1, 254, 0 ,255, 255}, - { 5, 3, 251, 250, 2, 253, 255, 255, 254}, - { 3, 1, 1, 242, 2, 9, 245, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 370 ohm + (820 ohm || 110 nF) CO Termination */ - { 6, 0, 0, 0, 0, 0, 0, 0, 0}, - { 6, 1, 254, 253, 0, 255, 0, 0, 0}, - { 9, 0, 251, 252, 2, 255, 0, 0, 0}, - { 5, 1, 248, 252, 4, 253, 1, 0, 0}, - { 5, 252, 250, 0, 0, 254, 0 , 255, 0}, - { 5, 3, 251, 250, 2, 253, 255, 255, 254}, - { 3, 1, 1, 242, 2, 9, 245, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* 275 ohm + (780 ohm || 115 nF) CO Termination */ - { 7, 0, 0, 0, 0, 0, 0, 0, 0}, - { 7, 255, 255, 255, 255, 0, 0, 0, 0}, - { 9, 0, 253, 254, 2, 255, 0, 0, 0}, - { 5, 1, 249, 254, 4, 253, 1, 0, 0}, - { 5, 252, 250, 1, 1, 254, 0, 255, 0}, - { 5, 3, 251, 250, 2, 253, 255, 255, 255}, - { 8, 253, 2, 244, 255, 10, 244, 3, 253}, - { 10, 249, 244, 8, 12, 245, 252, 0, 1}, - - /* Make sure we include the rest of the impedances */ - { 8, 0, 0, 0, 0, 0, 0, 0, 0}, - { 9, 0, 0, 0, 0, 0, 0, 0, 0}, - { 10, 0, 0, 0, 0, 0, 0, 0, 0}, - { 11, 0, 0, 0, 0, 0, 0, 0, 0}, - { 12, 0, 0, 0, 0, 0, 0, 0, 0}, - { 13, 0, 0, 0, 0, 0, 0, 0, 0}, - { 14, 0, 0, 0, 0, 0, 0, 0, 0}, - { 15, 0, 0, 0, 0, 0, 0, 0, 0}, -}; - diff --git a/zaptel/fxstest.c b/zaptel/fxstest.c deleted file mode 100644 index 1ea4cca0..00000000 --- a/zaptel/fxstest.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "kernel/zaptel.h" -#include "tonezone.h" -#include "kernel/wctdm.h" - -static int tones[] = { - ZT_TONE_DIALTONE, - ZT_TONE_BUSY, - ZT_TONE_RINGTONE, - ZT_TONE_CONGESTION, - ZT_TONE_DIALRECALL, -}; - -int main(int argc, char *argv[]) -{ - int fd; - int res; - int x; - if (argc < 3) { - fprintf(stderr, "Usage: fxstest \n" - " where cmd is one of:\n" - " stats - reports voltages\n" - " regdump - dumps ProSLIC registers\n" - " tones - plays a series of tones\n" - " polarity - tests polarity reversal\n" - " ring - rings phone\n"); - exit(1); - } - fd = open(argv[1], O_RDWR); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (!strcasecmp(argv[2], "ring")) { - fprintf(stderr, "Ringing phone...\n"); - x = ZT_RING; - res = ioctl(fd, ZT_HOOK, &x); - if (res) { - fprintf(stderr, "Unable to ring phone...\n"); - } else { - fprintf(stderr, "Phone is ringing...\n"); - sleep(2); - } - } else if (!strcasecmp(argv[2], "polarity")) { - fprintf(stderr, "Twiddling polarity...\n"); - x = 0; - res = ioctl(fd, ZT_SETPOLARITY, &x); - if (res) { - fprintf(stderr, "Unable to polarity...\n"); - } else { - fprintf(stderr, "Polarity is forward...\n"); - sleep(2); - x = 1; - ioctl(fd, ZT_SETPOLARITY, &x); - fprintf(stderr, "Polarity is reversed...\n"); - sleep(5); - x = 0; - ioctl(fd, ZT_SETPOLARITY, &x); - fprintf(stderr, "Polarity is forward...\n"); - sleep(2); - } - } else if (!strcasecmp(argv[2], "tones")) { - int x = 0; - for (;;) { - res = tone_zone_play_tone(fd, tones[x]); - if (res) - fprintf(stderr, "Unable to play tone %d\n", tones[x]); - sleep(3); - x=(x+1) % (sizeof(tones) / sizeof(tones[0])); - } - } else if (!strcasecmp(argv[2], "stats")) { - struct wctdm_stats stats; - res = ioctl(fd, WCTDM_GET_STATS, &stats); - if (res) { - fprintf(stderr, "Unable to get stats on channel %s\n", argv[1]); - } else { - printf("TIP: %7.4f Volts\n", (float)stats.tipvolt / 1000.0); - printf("RING: %7.4f Volts\n", (float)stats.ringvolt / 1000.0); - printf("VBAT: %7.4f Volts\n", (float)stats.batvolt / 1000.0); - } - } else if (!strcasecmp(argv[2], "regdump")) { - struct wctdm_regs regs; - int numregs = NUM_REGS; - memset(®s, 0, sizeof(regs)); - res = ioctl(fd, WCTDM_GET_REGS, ®s); - if (res) { - fprintf(stderr, "Unable to get registers on channel %s\n", argv[1]); - } else { - for (x=60;x -#include -#include -#include -#include -#include - -#define RANDOM "/dev/urandom" /* Not genuinely random */ -/* #define RANDOM "/dev/random" */ /* Quite genuinely random */ - -int myread(int fd, char *buf, int len) -{ - int sofar; - int res; - sofar = 0; - while(sofar < len) { - res = read(fd, buf + sofar, len - sofar); - if (res < 0) - return res; - sofar += res; - } - return sofar; -} - -int main(int argc, char *argv[]) -{ - unsigned char buf[1024]; - unsigned char outbuf[2048]; - int res; - int randin; - int randout; - int hdlcout; - int cnt; - int hdlccnt; - int x; - int flags; - struct fasthdlc_state transmitter; - - fasthdlc_precalc(); - - fasthdlc_init(&transmitter); - - randin = open(RANDOM, O_RDONLY); - if (randin < 0) { - fprintf(stderr, "Unable to open %s: %s\n", RANDOM, strerror(errno)); - exit(1); - } - randout = open("random.raw", O_WRONLY|O_TRUNC|O_CREAT, 0666); - if (randout < 0) { - fprintf(stderr, "Unable to open random.raw: %s\n", strerror(errno)); - exit(1); - } - hdlcout = open("random.hdlc", O_WRONLY|O_TRUNC|O_CREAT, 0666); - if (hdlcout < 0) { - fprintf(stderr, "Unable to open random.hdlc: %s\n", strerror(errno)); - exit(1); - } - for (;;) { - cnt = (rand() % 256) + 4; /* Read a pseudo-random amount of stuff */ - res = myread(randin, buf, cnt); - if (res != cnt) { - fprintf(stderr, "Tried to read %d bytes, but read %d instead\n", cnt, res); - exit(1); - } - res = write(randout, buf, cnt); - if (res != cnt) { - fprintf(stderr, "Tried to write %d bytes, but wrote %d instead\n", cnt, res); - exit(1); - } - /* HDLC encode */ - hdlccnt = 0; - /* Start with a flag */ - fasthdlc_tx_frame(&transmitter); - if (transmitter.bits >= 8) - outbuf[hdlccnt++] = fasthdlc_tx_run(&transmitter); - for (x=0;x= 8) { - outbuf[hdlccnt++] = fasthdlc_tx_run(&transmitter); - } - } - flags = (rand() % 4); - for (x=0;x 1) - printf("Encoded %d byte message with %d bytes of HDLC and %d extra flags\n", cnt, hdlccnt, flags); - res = write(hdlcout, outbuf, hdlccnt); - if (res != hdlccnt) { - fprintf(stderr, "Tried to write %d HDLC bytes, but wrote %d instead\n", cnt, res); - exit(1); - } - - } -} diff --git a/zaptel/hdlcstress.c b/zaptel/hdlcstress.c deleted file mode 100644 index f1ce3d6a..00000000 --- a/zaptel/hdlcstress.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include "kernel/zaptel.h" -#include -#include -#include -#include -#include -#include -#include "bittest.h" -#define FAST_HDLC_NEED_TABLES -#include "kernel/fasthdlc.h" - -/* #define BLOCK_SIZE 2048 */ -#define BLOCK_SIZE 2041 - -static int hdlcmode = 0; - - -static unsigned short fcstab[256] = -{ - 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, - 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, - 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, - 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, - 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, - 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, - 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, - 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, - 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, - 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, - 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, - 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, - 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, - 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, - 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, - 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, - 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, - 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, - 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, - 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, - 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, - 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, - 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, - 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, - 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, - 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, - 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, - 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, - 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, - 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, - 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, - 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 -}; - -#define PPP_INITFCS 0xffff /* Initial FCS value */ -#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ -#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) - -void print_packet(unsigned char *buf, int len) -{ - int x; - printf("{ "); - for (x=0;x 7) - outbuf[pos++] = fasthdlc_tx_run(&fs); - } - fcs ^= 0xffff; - if (fasthdlc_tx_load(&fs, (fcs & 0xff))) - fprintf(stderr, "Load error (fcs1)\n"); - outbuf[pos++] = fasthdlc_tx_run(&fs); - if (fs.bits > 7) - outbuf[pos++] = fasthdlc_tx_run(&fs); - if (fasthdlc_tx_load(&fs, ((fcs >> 8) & 0xff))) - fprintf(stderr, "Load error (fcs2)\n"); - outbuf[pos++] = fasthdlc_tx_run(&fs); - if (fs.bits > 7) - outbuf[pos++] = fasthdlc_tx_run(&fs); - if (fasthdlc_tx_frame(&fs)) - fprintf(stderr, "Frame error\n"); - if (fs.bits > 7) - outbuf[pos++] = fasthdlc_tx_run(&fs); - if (fs.bits > 7) - outbuf[pos++] = fasthdlc_tx_run(&fs); - write(fd, outbuf, pos); - } -} - -int main(int argc, char *argv[]) -{ - int res, x; - ZT_PARAMS tp; - ZT_BUFFERINFO bi; - int bs = BLOCK_SIZE; - unsigned char c=0; - unsigned char outbuf[BLOCK_SIZE]; - if (argc < 2) { - fprintf(stderr, "Usage: markhdlctest \n"); - exit(1); - } - fd = open(argv[1], O_RDWR, 0600); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs)) { - fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_GET_PARAMS, &tp)) { - fprintf(stderr, "Unable to get channel parameters\n"); - exit(1); - } - if ((tp.sigtype & ZT_SIG_HDLCRAW) == ZT_SIG_HDLCRAW) { - printf("In HDLC mode\n"); - hdlcmode = 1; - } else if ((tp.sigtype & ZT_SIG_CLEAR) == ZT_SIG_CLEAR) { - printf("In CLEAR mode\n"); - hdlcmode = 0; - } else { - fprintf(stderr, "Not in a reasonable mode\n"); - exit(1); - } - res = ioctl(fd, ZT_GET_BUFINFO, &bi); - if (!res) { - bi.txbufpolicy = ZT_POLICY_IMMEDIATE; - bi.rxbufpolicy = ZT_POLICY_IMMEDIATE; - bi.numbufs = 4; - res = ioctl(fd, ZT_SET_BUFINFO, &bi); - if (res < 0) { - fprintf(stderr, "Unable to set buf info: %s\n", strerror(errno)); - exit(1); - } - } else { - fprintf(stderr, "Unable to get buf info: %s\n", strerror(errno)); - exit(1); - } - ioctl(fd, ZT_GETEVENT); - fasthdlc_precalc(); - fasthdlc_init(&fs); -#if 0 - print_packet(outbuf, res); - printf("FCS is %x, PPP_GOODFCS is %x\n", - fcs,PPP_GOODFCS); -#endif - for(;;) { - if (c < 1) - c = 1; - for (x=0;x<50;x++) { - outbuf[x] = c; - } - send_packet(outbuf, 50); -#if 0 - printf("Wrote %d of %d bytes\n", res, c); -#endif - c = bit_next(c); -#if 0 - printf("(%d) Wrote %d bytes\n", packets++, res); -#endif - } - -} diff --git a/zaptel/hdlctest.c b/zaptel/hdlctest.c deleted file mode 100644 index 82ee72f2..00000000 --- a/zaptel/hdlctest.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include "kernel/zaptel.h" -#include -#include -#include -#include -#include -#include -#include "bittest.h" -#define FAST_HDLC_NEED_TABLES -#include "kernel/fasthdlc.h" - -#define BLOCK_SIZE 2039 - -static unsigned short fcstab[256] = -{ - 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, - 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, - 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, - 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, - 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, - 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, - 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, - 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, - 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, - 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, - 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, - 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, - 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, - 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, - 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, - 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, - 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, - 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, - 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, - 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, - 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, - 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, - 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, - 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, - 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, - 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, - 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, - 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, - 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, - 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, - 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, - 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 -}; - -#define PPP_INITFCS 0xffff /* Initial FCS value */ -#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ -#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) - -void print_packet(unsigned char *buf, int len) -{ - int x; - printf("{ "); - for (x=0;x\n"); - exit(1); - } - fd = open(argv[1], O_RDWR, 0600); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs)) { - fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_GET_PARAMS, &tp)) { - fprintf(stderr, "Unable to get channel parameters\n"); - exit(1); - } - if ((tp.sigtype & ZT_SIG_HDLCRAW) == ZT_SIG_HDLCRAW) { - printf("In HDLC mode\n"); - hdlcmode = 1; - } else if ((tp.sigtype & ZT_SIG_CLEAR) == ZT_SIG_CLEAR) { - printf("In CLEAR mode\n"); - hdlcmode = 0; - } else { - fprintf(stderr, "Not in a reasonable mode\n"); - exit(1); - } - res = ioctl(fd, ZT_GET_BUFINFO, &bi); - if (!res) { - bi.txbufpolicy = ZT_POLICY_IMMEDIATE; - bi.rxbufpolicy = ZT_POLICY_IMMEDIATE; - bi.numbufs = 4; - res = ioctl(fd, ZT_SET_BUFINFO, &bi); - if (res < 0) { - fprintf(stderr, "Unable to set buf info: %s\n", strerror(errno)); - exit(1); - } - } else { - fprintf(stderr, "Unable to get buf info: %s\n", strerror(errno)); - exit(1); - } - ioctl(fd, ZT_GETEVENT); - fasthdlc_precalc(); - fasthdlc_init(&fs); - for(;;) { - res = read(fd, outbuf, sizeof(outbuf)); - if (hdlcmode) { - if (res < 0) { - if (errno == ELAST) { - if (ioctl(fd, ZT_GETEVENT, &x) < 0) { - fprintf(stderr, "Unaable to get event: %s\n", strerror(errno)); - exit(1); - } - fprintf(stderr, "Event: %d (%d bytes since last error)\n", x, bytes); - bytes=0; - continue; - } else { - fprintf(stderr, "Error: %s\n", strerror(errno)); - exit(1); - } - } -#if 0 - printf("Res is %d, buf0 is %d, buf1 is %d\n", res, outbuf[0], outbuf[1]); -#endif - if (res < 2) { - fprintf(stderr, "Too small? Only got %d bytes\n", res); - } - check_frame(outbuf, res); - } else { - for (x=0;x 64) { - dump_bits(outbuf + x - 64, 64); - dump_bits(outbuf + x, 64); - } - pos = 0; - } else { - if ((out != c) && (pos < c) && !pos) { - printf("Warning: Expecting %d at pos %d, got %d (x =%d)\n", c, pos, out, x); - if (x > 64) { - dump_bits(outbuf + x - 64, 64); - dump_bits(outbuf + x, 64); - } - } - inbuf[pos++] = out; - } - } - } - } - -} diff --git a/zaptel/hdlcverify.c b/zaptel/hdlcverify.c deleted file mode 100644 index c3f3e2ad..00000000 --- a/zaptel/hdlcverify.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#define FAST_HDLC_NEED_TABLES -#include "kernel/fasthdlc.h" -#include -#include -#include -#include -#include -#include - -int myread(int fd, char *buf, int len) -{ - int sofar; - int res; - sofar = 0; - while(sofar < len) { - res = read(fd, buf + sofar, len - sofar); - if (res < 0) - return res; - sofar += res; - } - return sofar; -} - -static inline unsigned char nextchar(int fd) -{ - static unsigned char inbuf[2048]; - static int bytes = 0; - static int pos = 0; - if (pos >= bytes) { - pos = 0; - bytes = read(fd, inbuf, sizeof(inbuf)); - if (bytes < 0) { - fprintf(stderr, "Unable to read more data: %s\n", strerror(errno)); - exit(1); - } - if (bytes == 0) { - fprintf(stderr, "-- END OF DATA --\n"); - exit(0); - } - } - return inbuf[pos++]; -} - -int main(int argc, char *argv[]) -{ - unsigned char decbuf[1024]; - unsigned char actual[1024]; - int res; - int datain; - int hdlcin; - int hdlccnt; - int x; - struct fasthdlc_state receiver; - - fasthdlc_precalc(); - - fasthdlc_init(&receiver); - - hdlcin = open("random.hdlc", O_RDONLY); - if (hdlcin < 0) { - fprintf(stderr, "Unable to open %s: %s\n", "random.hdlc", strerror(errno)); - exit(1); - } - datain = open("random.raw", O_RDONLY); - if (datain < 0) { - fprintf(stderr, "Unable to open random.raw: %s\n", strerror(errno)); - exit(1); - } - hdlccnt = 0; - for (;;) { - /* Feed in some input */ - if (fasthdlc_rx_load(&receiver, nextchar(hdlcin))) { - fprintf(stderr, "Unable to feed receiver :(\n"); - exit(1); - } - res = fasthdlc_rx_run(&receiver); - if (res & RETURN_EMPTY_FLAG) - continue; - if (res & RETURN_COMPLETE_FLAG) { - if (hdlccnt) { - if (argc > 1) - printf("Got message of length %d\n", hdlccnt); - res = myread(datain, actual, hdlccnt); - if (res != hdlccnt) { - fprintf(stderr, "Tried to read %d bytes, but read %d instead\n", hdlccnt, res); - exit(1); - } - for (x=0;x&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/zaptel/install_prereq b/zaptel/install_prereq deleted file mode 100755 index 9b52fa25..00000000 --- a/zaptel/install_prereq +++ /dev/null @@ -1,129 +0,0 @@ -#! /bin/sh - -# install_prereq: a script to install distribution-specific -# prerequirements - -set -e - -usage() { - echo "$0: a script to install distribution-specific prerequirement" - echo 'Revision: $Id: install_prereq 3852 2008-02-19 01:01:01Z tzafrir $' - echo "" - echo "Usage: $0: Shows this message." - echo "Usage: $0 test Prints commands it is about to run." - echo "Usage: $0 install Really install." -} - -PACKAGES_DEBIAN="build-essential libnewt-dev libusb-dev modemp3d" -PACKAGES_RH="gcc newt-devel libusb-devel" -KVERS=`uname -r` - -case "$1" in -test) testcmd=test_cmd ;; -install) testcmd='' ;; -'') usage; exit 0 ;; -*) usage; exit 1 ;; -esac - -NOTHING_TO_INSTALL=true -test_cmd() { - NOTHING_TO_INSTALL=false - echo "$@" -} - -# Fixme: should be done by apt and not by dpkg? -check_installed_debs() { - dpkg-query -W --showformat '${Status} ${Package}\n' "$@" 2>/dev/null \ - | awk '/ not-installed/{print $4}' -} - -# parsing the output of yum is close to impossible. -# We'll use rpm and hope for the best: -check_installed_rpms() { - for pack in "$@" - do - if ! rpm -q $pack >/dev/null 2>/dev/null - then echo $pack - fi - done -} - - -has_kernel_source() { - test -r /lib/modules/$KVERS/build/.config -} - -in_test_mode() { - test "$testcmd" != '' -} - -handle_debian() { - # echo "# Distribution is Debian or compatible" - kernel_package='' - extra_packs=`check_installed_debs $PACKAGES_DEBIAN` - if ! has_kernel_source; then - kernel_package="linux-headers-$KVERS" - debian_release=`cat /etc/debian_version` - case "$debian_release" in - 3.1) kernel_package="kernel-headers-$KVERS";; - esac - echo "# Kernel source not found. Installing $kernel_package" - fi - if [ "$extra_packs$kernel_package" = '' ]; then - return - fi - $testcmd apt-get install -y $extra_packs $kernel_package -} - -handle_rh() { - # echo "# Distribution is RedHat or similar." - kernel_package='' - extra_packs=`check_installed_rpms $PACKAGES_RH` - if ! has_kernel_source; then - kern_str='' # extra "kernel version" - case "$KVERS" in - *smp*) kern_str='-smp';; - *PAE*) kern_str='-PAE';; - *xen*) kern_str='-xen';; - esac - kernel_package="kernel$kern_str-devel-$KVERS" - echo "# Kernel source not found. Installing $kernel_package" - - echo "# if you get an error for the following command, consider" - echo "#" - echo "#yum install -y kernel$kern_str kernel$kern_str-devel" - echo "#" - echo "# and then reboot to upgrade to the newly installed kernel." - fi - if [ "$extra_packs$kernel_package" = '' ]; then - return - fi - $testcmd yum install -y $extra_packs $kernel_package -} - -if in_test_mode; then - echo "#############################################" - echo "## $1: test mode." - echo "## Use the commands here to install your system." - echo "#############################################" -fi - -# handle the easy case of Debians first -if [ -r /etc/debian_version ]; then - handle_debian -elif [ -r /etc/redhat-release ]; then - handle_rh -fi - -echo "#############################################" -if in_test_mode; then - if $NOTHING_TO_INSTALL; then - echo "## $1 completed successfully ((In test mode) " - else - echo "## $1: some extra packages are needed to build zaptel" - exit 1 - fi -else - echo "## $1 completed successfully" -fi -echo "#############################################" diff --git a/zaptel/kernel/GNUmakefile b/zaptel/kernel/GNUmakefile deleted file mode 100644 index 6da09288..00000000 --- a/zaptel/kernel/GNUmakefile +++ /dev/null @@ -1,144 +0,0 @@ -# -# Zaptel kernel 2.4 makefile -# -# Copyright (C) 2008 Digium, Inc. -# - -CFLAGS+=-DSTANDALONE_ZAPATA - -ifeq ($(MAKELEVEL),0) -PWD:=$(shell pwd) -endif - -KINCLUDES:=$(KSRC)/include - -BUILDVER:=linux24 - -HOTPLUG_FIRMWARE:=no - -ifeq ($(HOTPLUG_FIRMWARE),yes) - CFLAGS+=-DHOTPLUG_FIRMWARE -endif - -ifeq ($(ARCH),i386) -ifneq ($(wildcard $(PWD)/hpec/hpec_x86_32.o_shipped),) -HPEC_PRESENT=yes -endif -endif - -ifeq ($(ARCH),x86_64) -ifneq ($(wildcard $(PWD)/hpec/hpec_x86_64.o_shipped),) -HPEC_PRESENT=yes -endif -endif - -BUILD_MODULES:=$(BUILD_TOPDIR_MODULES) $(BUILD_SUBDIR_MODULES) -ALL_MODULES := $(BUILD_TOPDIR_MODULES:%=%.o) \ - $(join $(BUILD_SUBDIR_MODULES:%=%/), $(BUILD_SUBDIR_MODULES:%=%.o)) - -OPTFLAG=-O2 -CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER -ifneq (,$(findstring ppc,$(UNAME_M))) -CFLAGS_PPC:=-fsigned-char -endif -ifneq (,$(findstring x86_64,$(UNAME_M))) -CFLAGS_x86_64:=-m64 -endif -CFLAGS+=$(CFLAGS_PPC) $(CFLAGS_x86_64) -KFLAGS=-I$(KINCLUDES) -O6 -KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \ - -Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I$(KSRC)/drivers/net/wan -I$(KINCLUDES)/net -ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h)) - KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h -endif -ifneq (,$(findstring ppc,$(UNAME_M))) -KFLAGS_PPC:=-msoft-float -fsigned-char -endif -KFLAGS+=$(KFLAGS_PPC) - ifneq (,$(findstring x86_64,$(UNAME_M))) - KFLAGS+=-mcmodel=kernel - endif - -# -# Features are now configured in zconfig.h -# - -MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp - -KFLAGS+=-DSTANDALONE_ZAPATA - -MOD_DIR:=/lib/modules/$(KVERS)/misc - -MAKE_SUBDIR = $(MAKE) CC=$(CC) LD=$(LD) \ - KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.." - -all: modules - -ifeq ($(HPEC_PRESENT),yes) -ifeq ($(ARCH),i386) -ZAPTEL_HPEC:=hpec/hpec_x86_32.o_shipped -endif - -ifeq ($(ARCH),x86_64) -ZAPTEL_HPEC:=hpec/hpec_x86_64.o_shipped -endif - -KFLAGS+=-DECHO_CAN_HPEC -I$(PWD)/hpec -zaptel-base.o: hpec/hpec_zaptel.h hpec/hpec_user.h -endif - -prereq: tor2fw.h radfw.h version.h - -tor2fw.h: tormenta2.rbt makefw - ./makefw $< tor2fw > $@ - -radfw.h: pciradio.rbt makefw - ./makefw $< radfw > $@ - -makefw: makefw.c - $(HOSTCC) -o $@ $^ - - -modules: $(ALL_MODULES) - -wct4xxp/wct4xxp.o: - $(MAKE_SUBDIR) -C wct4xxp - -tor2.o: tor2-hw.h tor2fw.h - -zaptel-base.o: digits.h arith.h sec.h sec-2.h kb1ec.h mg2ec.h zconfig.h - -wcusb.o: wcusb.h - -wctdm.o: wctdm.h - -wctdm24xxp/wctdm24xxp.o: - $(MAKE_SUBDIR) -C wctdm24xxp - -wcte12xp/wcte12xp.o: - $(MAKE_SUBDIR) -C wcte12xp - -pciradio.o: radfw.h - -ztdummy.o: ztdummy.h - -zaptel.o: zaptel-base.o $(ZAPTEL_HPEC) - $(LD) -r -o $@ $< $(ZAPTEL_HPEC) - -$(filter-out zaptel.o,$(BUILD_TOPDIR_MODULES:%=%.o)) zaptel-base.o: %.o: %.c zaptel.h - $(CC) $(KFLAGS) -o $@ -c $< - - -clean: - rm -f makefw tor2fw.h radfw.h - rm -f *.o - $(MAKE_SUBDIR) -C wct4xxp clean - rm -rf .tmp_versions - rm -f core - -distclean: dist-clean - -dist-clean: clean - -.PHONY: distclean dist-clean clean all modules - diff --git a/zaptel/kernel/Kbuild b/zaptel/kernel/Kbuild deleted file mode 100644 index 6ad4a28a..00000000 --- a/zaptel/kernel/Kbuild +++ /dev/null @@ -1,71 +0,0 @@ -ifdef ECHO_CAN_NAME - ECHO_CAN_CFLAGS := -DECHO_CAN_FROMENV -DECHO_CAN_$(ECHO_CAN_NAME) -endif - -obj-m := $(KBUILD_OBJ_M) - -EXTRA_CFLAGS := -I$(src) -DSTANDALONE_ZAPATA -EXTRA_CFLAGS += $(ECHO_CAN_CFLAGS) - -# fix typo present in CentOS and RHEL 2.6.9 kernels -BAD_KERNELS_VERS := 22 34 34.0.1 34.0.2 -BAD_KERNELS := $(foreach ver,$(BAD_KERNELS_VERS),2.6.9-$(ver).EL 2.6.9-$(ver).ELsmp) -ifneq (,$(filter $(KVERS),$(BAD_KERNELS))) -EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t -endif - -zaptel-objs := zaptel-base.o - -ifeq ($(ARCH),i386) -ifneq ($(wildcard $(src)/hpec/hpec_x86_32.o_shipped),) -HPEC_PRESENT=yes -zaptel-objs += hpec/hpec_x86_32.o -endif -endif - -ifeq ($(ARCH),x86_64) -ifneq ($(wildcard $(src)/hpec/hpec_x86_64.o_shipped),) -HPEC_PRESENT=yes -zaptel-objs += hpec/hpec_x86_64.o -endif -endif - -ifeq ($(HPEC_PRESENT),yes) -EXTRA_CFLAGS += -DECHO_CAN_HPEC -I$(src)/hpec -$(obj)/zaptel-base.o: $(src)/hpec/hpec_zaptel.h $(src)/hpec/hpec_user.h -endif - -$(obj)/pciradio.o: $(obj)/radfw.h -$(obj)/tor2.o: $(obj)/tor2fw.h - -hostprogs-y := $(obj)/makefw - -$(obj)/tor2fw.h: $(src)/tormenta2.rbt $(obj)/makefw - $(obj)/makefw $< tor2fw > $@ - -$(obj)/radfw.h: $(src)/pciradio.rbt $(obj)/makefw - $(obj)/makefw $< radfw > $@ - -$(obj)/makefw: $(src)/makefw.c - $(HOSTCC) -o $@ $^ - - -# set CONFIG_ZAPTEL_MMX for a number of CPU types. -# Right now this part is not enabled, unless you build with -# ZAPTEL_MMX_AUTO=something . -ZAPMMX_WHITELIST_i386 = M586MMX M686 MPENTIUMII MPENTIUMIII MPENTIUMM \ - MPENTIUM4 MVIAC3_2 - -ZAPMMX_WHITELIST_x86_64 = - -# A list of configuration variables to test: CONFIG_M686 , etc. -ZAPMMX_CONFIG_VARS := $(ZAPMMX_WHITELIST_$(ARCH):%=CONFIG_%) - -# expand them: -ZAPMMX_CONFIG_VALS := $(strip $(foreach var,$(ZAPMMX_CONFIG_VARS),$(var)) ) -ifneq (,$(ZAPTEL_MMX_AUTO)) - ifneq (,$(ZAPMMX_CONFIG_VALS)) - # TODO: make that - CFLAGS_zaptel-base.o += -DCONFIG_ZAPTEL_MMX - endif -endif diff --git a/zaptel/kernel/Makefile b/zaptel/kernel/Makefile deleted file mode 100644 index 56453cb2..00000000 --- a/zaptel/kernel/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -ifneq ($(KBUILD_EXTMOD),) -# We only get here on kernels 2.6.0-2.6.9 . -# For newer kernels, Kbuild will be included directly by the kernel -# build system. -include $(src)/Kbuild -endif diff --git a/zaptel/kernel/adt_lec.c b/zaptel/kernel/adt_lec.c deleted file mode 100644 index b64d580d..00000000 --- a/zaptel/kernel/adt_lec.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ADT Line Echo Canceller Parameter Parsing - * - * Copyright (C) 2008 Digium, Inc. - * - * Kevin P. Fleming - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _ADT_LEC_C -#define _ADT_LEC_C - -#include - -static inline void adt_lec_init_defaults(struct adt_lec_params *params, __u32 tap_length) -{ - memset(params, 0, sizeof(*params)); - params->tap_length = tap_length; -} - -static int adt_lec_parse_params(struct adt_lec_params *params, struct zt_echocanparams *ecp, struct zt_echocanparam *p) -{ - unsigned int x; - char *c; - - for (x = 0; x < ecp->param_count; x++) { - for (c = p[x].name; *c; c++) - *c = tolower(*c); - if (!strcmp(p[x].name, "nlp_type")) { - switch (p[x].value) { - case ADT_LEC_NLP_OFF: - case ADT_LEC_NLP_MUTE: - case ADT_LEC_RANDOM_NOISE: - case ADT_LEC_HOTH_NOISE: - case ADT_LEC_SUPPRESS: - params->nlp_type = p[x].value; - break; - default: - return -EINVAL; - } - } else if (!strcmp(p[x].name, "nlp_thresh")) { - params->nlp_threshold = p[x].value; - } else if (!strcmp(p[x].name, "nlp_suppress")) { - params->nlp_max_suppress = p[x].value; - } else { - return -EINVAL; - } - } - - return 0; -} - -#endif /* _ADT_LEC_C */ diff --git a/zaptel/kernel/adt_lec.h b/zaptel/kernel/adt_lec.h deleted file mode 100644 index 79edf5e0..00000000 --- a/zaptel/kernel/adt_lec.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ADT Line Echo Canceller Parameter Parsing - * - * Copyright (C) 2008 Digium, Inc. - * - * Kevin P. Fleming - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _ADT_LEC_H -#define _ADT_LEC_H - -enum adt_lec_nlp_type { - ADT_LEC_NLP_OFF = 0, - ADT_LEC_NLP_MUTE, - ADT_LEC_RANDOM_NOISE, - ADT_LEC_HOTH_NOISE, - ADT_LEC_SUPPRESS, -}; - -struct adt_lec_params { - __u32 tap_length; - enum adt_lec_nlp_type nlp_type; - __u32 nlp_threshold; - __u32 nlp_max_suppress; -}; - -#endif /* _ADT_LEC_H */ diff --git a/zaptel/kernel/arith.h b/zaptel/kernel/arith.h deleted file mode 100644 index 50b10100..00000000 --- a/zaptel/kernel/arith.h +++ /dev/null @@ -1,377 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _ZAPTEL_ARITH_H -#define _ZAPTEL_ARITH_H -/* - * Handy add/subtract functions to operate on chunks of shorts. - * Feel free to add customizations for additional architectures - * - */ - -#ifdef CONFIG_ZAPTEL_MMX -#ifdef ZT_CHUNKSIZE -static inline void __ACSS(volatile short *dst, const short *src) -{ - __asm__ __volatile__ ( - "movq 0(%0), %%mm0;\n" - "movq 0(%1), %%mm1;\n" - "movq 8(%0), %%mm2;\n" - "movq 8(%1), %%mm3;\n" - "paddsw %%mm1, %%mm0;\n" - "paddsw %%mm3, %%mm2;\n" - "movq %%mm0, 0(%0);\n" - "movq %%mm2, 8(%0);\n" - : "=r" (dst) - : "r" (src), "0" (dst) - : "memory" -#ifdef CLOBBERMMX - , "%mm0", "%mm1", "%mm2", "%mm3" -#endif - ); - -} -static inline void __SCSS(volatile short *dst, const short *src) -{ - __asm__ __volatile__ ( - "movq 0(%0), %%mm0;\n" - "movq 0(%1), %%mm1;\n" - "movq 8(%0), %%mm2;\n" - "movq 8(%1), %%mm3;\n" - "psubsw %%mm1, %%mm0;\n" - "psubsw %%mm3, %%mm2;\n" - "movq %%mm0, 0(%0);\n" - "movq %%mm2, 8(%0);\n" - : "=r" (dst) - : "r" (src), "0" (dst) - : "memory" -#ifdef CLOBBERMMX - , "%mm0", "%mm1", "%mm2", "%mm3" -#endif - ); - -} - -#if (ZT_CHUNKSIZE == 8) -#define ACSS(a,b) __ACSS(a,b) -#define SCSS(a,b) __SCSS(a,b) -#elif (ZT_CHUNKSIZE > 8) -static inline void ACSS(volatile short *dst, const short *src) -{ - int x; - for (x=0;x>= 4; - - /* Clear our accumulator, mm4 */ - - /* - - For every set of eight... - - Load 16 coefficients into four registers... - Shift each word right 16 to make them shorts... - Pack the resulting shorts into two registers... - With the coefficients now in mm0 and mm2, load the - history into mm1 and mm3... - Multiply/add mm1 into mm0, and mm3 into mm2... - Add mm2 into mm0 (without saturation, alas). Now we have two half-results. - Accumulate in mm4 (again, without saturation, alas) - */ - __asm__ ( - "pxor %%mm4, %%mm4;\n" - "mov %1, %%edi;\n" - "mov %2, %%esi;\n" - "mov %3, %%ecx;\n" - "1:" - "movq 0(%%edi), %%mm0;\n" - "movq 8(%%edi), %%mm1;\n" - "movq 16(%%edi), %%mm2;\n" - "movq 24(%%edi), %%mm3;\n" - /* can't use 4/5 since 4 is the accumulator for us */ - "movq 32(%%edi), %%mm6;\n" - "movq 40(%%edi), %%mm7;\n" - "psrad $16, %%mm0;\n" - "psrad $16, %%mm1;\n" - "psrad $16, %%mm2;\n" - "psrad $16, %%mm3;\n" - "psrad $16, %%mm6;\n" - "psrad $16, %%mm7;\n" - "packssdw %%mm1, %%mm0;\n" - "packssdw %%mm3, %%mm2;\n" - "packssdw %%mm7, %%mm6;\n" - "movq 0(%%esi), %%mm1;\n" - "movq 8(%%esi), %%mm3;\n" - "movq 16(%%esi), %%mm7;\n" - "pmaddwd %%mm1, %%mm0;\n" - "pmaddwd %%mm3, %%mm2;\n" - "pmaddwd %%mm7, %%mm6;\n" - "paddd %%mm6, %%mm4;\n" - "paddd %%mm2, %%mm4;\n" - "paddd %%mm0, %%mm4;\n" - /* Come back and do for the last few bytes */ - "movq 48(%%edi), %%mm6;\n" - "movq 56(%%edi), %%mm7;\n" - "psrad $16, %%mm6;\n" - "psrad $16, %%mm7;\n" - "packssdw %%mm7, %%mm6;\n" - "movq 24(%%esi), %%mm7;\n" - "pmaddwd %%mm7, %%mm6;\n" - "paddd %%mm6, %%mm4;\n" - "add $64, %%edi;\n" - "add $32, %%esi;\n" - "dec %%ecx;\n" - "jnz 1b;\n" - "movq %%mm4, %%mm0;\n" - "psrlq $32, %%mm0;\n" - "paddd %%mm0, %%mm4;\n" - "movd %%mm4, %0;\n" - : "=r" (sum) - : "r" (coeffs), "r" (hist), "r" (len) - : "%ecx", "%edi", "%esi" - ); - - return sum; -} - -static inline void UPDATE(volatile int *taps, const short *history, const int nsuppr, const int ntaps) -{ - int i; - int correction; - for (i=0;i>= 4; - /* First, load up taps, */ - __asm__ ( - "pxor %%mm4, %%mm4;\n" - "mov %0, %%edi;\n" - "mov %1, %%esi;\n" - "mov %3, %%ecx;\n" - "1:" - "jnz 1b;\n" - "movq %%mm4, %%mm0;\n" - "psrlq $32, %%mm0;\n" - "paddd %%mm0, %%mm4;\n" - "movd %%mm4, %0;\n" - : "=r" (taps), "=r" (taps_short) - : "r" (history), "r" (nsuppr), "r" (ntaps), "0" (taps) - : "%ecx", "%edi", "%esi" - ); -#endif -#if 1 - for (i=0;i> 16; - } -#endif -} - -static inline int CONVOLVE2(const short *coeffs, const short *hist, int len) -{ - int sum; - /* Divide length by 16 */ - len >>= 4; - - /* Clear our accumulator, mm4 */ - - /* - - For every set of eight... - Load in eight coefficients and eight historic samples, multliply add and - accumulate the result - */ - __asm__ ( - "pxor %%mm4, %%mm4;\n" - "mov %1, %%edi;\n" - "mov %2, %%esi;\n" - "mov %3, %%ecx;\n" - "1:" - "movq 0(%%edi), %%mm0;\n" - "movq 8(%%edi), %%mm2;\n" - "movq 0(%%esi), %%mm1;\n" - "movq 8(%%esi), %%mm3;\n" - "pmaddwd %%mm1, %%mm0;\n" - "pmaddwd %%mm3, %%mm2;\n" - "paddd %%mm2, %%mm4;\n" - "paddd %%mm0, %%mm4;\n" - "movq 16(%%edi), %%mm0;\n" - "movq 24(%%edi), %%mm2;\n" - "movq 16(%%esi), %%mm1;\n" - "movq 24(%%esi), %%mm3;\n" - "pmaddwd %%mm1, %%mm0;\n" - "pmaddwd %%mm3, %%mm2;\n" - "paddd %%mm2, %%mm4;\n" - "paddd %%mm0, %%mm4;\n" - "add $32, %%edi;\n" - "add $32, %%esi;\n" - "dec %%ecx;\n" - "jnz 1b;\n" - "movq %%mm4, %%mm0;\n" - "psrlq $32, %%mm0;\n" - "paddd %%mm0, %%mm4;\n" - "movd %%mm4, %0;\n" - : "=r" (sum) - : "r" (coeffs), "r" (hist), "r" (len) - : "%ecx", "%edi", "%esi" - ); - - return sum; -} -static inline short MAX16(const short *y, int len, int *pos) -{ - int k; - short max = 0; - int bestpos = 0; - for (k=0;k 32767) - sum = 32767; - else if (sum < -32768) - sum = -32768; - dst[x] = sum; - } -#endif -} - -static inline void SCSS(short *dst, short *src) -{ - int x; - - /* Subtract src from dst with saturation, storing in dst */ -#ifdef BFIN - for (x = 0; x < ZT_CHUNKSIZE; x++) - dst[x] = __builtin_bfin_sub_fr1x16(dst[x], src[x]); -#else - int sum; - - for (x = 0; x < ZT_CHUNKSIZE; x++) { - sum = dst[x] - src[x]; - if (sum > 32767) - sum = 32767; - else if (sum < -32768) - sum = -32768; - dst[x] = sum; - } -#endif -} - -#endif /* ZT_CHUNKSIZE */ - -static inline int CONVOLVE(const int *coeffs, const short *hist, int len) -{ - int x; - int sum = 0; - for (x=0;x> 16) * hist[x]; - return sum; -} - -static inline int CONVOLVE2(const short *coeffs, const short *hist, int len) -{ - int x; - int sum = 0; - for (x=0;x> 16; - } -} - -static inline short MAX16(const short *y, int len, int *pos) -{ - int k; - short max = 0; - int bestpos = 0; - for (k=0;k - * - * Copyright (C) 2001 Steve Underwood - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -typedef struct -{ - int32_t gain; - int32_t a1; - int32_t a2; - int32_t b1; - int32_t b2; - - int32_t z1; - int32_t z2; -} biquad2_state_t; - -static inline void biquad2_init (biquad2_state_t *bq, - int32_t gain, - int32_t a1, - int32_t a2, - int32_t b1, - int32_t b2) -{ - bq->gain = gain; - bq->a1 = a1; - bq->a2 = a2; - bq->b1 = b1; - bq->b2 = b2; - - bq->z1 = 0; - bq->z2 = 0; -} -/*- End of function --------------------------------------------------------*/ - -static inline int16_t biquad2 (biquad2_state_t *bq, int16_t sample) -{ - int32_t y; - int32_t z0; - - z0 = sample*bq->gain + bq->z1*bq->a1 + bq->z2*bq->a2; - y = z0 + bq->z1*bq->b1 + bq->z2*bq->b2; - - bq->z2 = bq->z1; - bq->z1 = z0 >> 15; - y >>= 15; - return y; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/zaptel/kernel/datamods/Makefile b/zaptel/kernel/datamods/Makefile deleted file mode 100644 index 310073eb..00000000 --- a/zaptel/kernel/datamods/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -.EXPORT_ALL_VARIABLES: -MODULES= \ - hdlc_cisco hdlc_generic hdlc_raw syncppp \ - hdlc_fr hdlc_ppp hdlc_raw_eth - - -PWD=$(shell pwd) - -MODULESO:=$(MODULES:%=%.o) -MODULESKO:=$(MODULES:%=%.ko) -KMAKE = $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) -KMAKE_INST = $(KMAKE) \ - INSTALL_MOD_PATH=$(INSTALL_PREFIX) INSTALL_MOD_DIR=misc modules_install - -obj-m := $(MODULESO) -#obj-m:=hdlc_raw.o hdlc_cisco.o -#obj-m := hdlc_cisco.o hdlc_cisco.mod.o hdlc_fr.o hdlc_generic.o hdlc_ppp.o hdlc_raw.o hdlc_raw_eth.o hdlc_raw.mod.o hdlc_x25.o - -all: - @echo "You don't want to do make here. Do it from up above" - -clean: - $(KMAKE) clean - -install: $(MODULESKO) - $(KMAKE_INST) - -datamods: - @echo "To build: $(obj-m)" - @echo $(KSRC) - @if [ -z "$(KSRC)" -o ! -d "$(KSRC)" ]; then echo "You do not appear to have the sources for the $(KVERS) kernel installed."; exit 1 ; fi - $(KMAKE) modules diff --git a/zaptel/kernel/datamods/hdlc_cisco.c b/zaptel/kernel/datamods/hdlc_cisco.c deleted file mode 100644 index 1fd04662..00000000 --- a/zaptel/kernel/datamods/hdlc_cisco.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Generic HDLC support routines for Linux - * Cisco HDLC support - * - * Copyright (C) 2000 - 2003 Krzysztof Halasa - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef DEBUG_HARD_HEADER - -#define CISCO_MULTICAST 0x8F /* Cisco multicast address */ -#define CISCO_UNICAST 0x0F /* Cisco unicast address */ -#define CISCO_KEEPALIVE 0x8035 /* Cisco keepalive protocol */ -#define CISCO_SYS_INFO 0x2000 /* Cisco interface/system info */ -#define CISCO_ADDR_REQ 0 /* Cisco address request */ -#define CISCO_ADDR_REPLY 1 /* Cisco address reply */ -#define CISCO_KEEPALIVE_REQ 2 /* Cisco keepalive request */ - - -static int cisco_hard_header(struct sk_buff *skb, struct net_device *dev, - u16 type, void *daddr, void *saddr, - unsigned int len) -{ - hdlc_header *data; -#ifdef DEBUG_HARD_HEADER - printk(KERN_DEBUG "%s: cisco_hard_header called\n", dev->name); -#endif - - skb_push(skb, sizeof(hdlc_header)); - data = (hdlc_header*)skb->data; - if (type == CISCO_KEEPALIVE) - data->address = CISCO_MULTICAST; - else - data->address = CISCO_UNICAST; - data->control = 0; - data->protocol = htons(type); - - return sizeof(hdlc_header); -} - - - -static void cisco_keepalive_send(struct net_device *dev, u32 type, - u32 par1, u32 par2) -{ - struct sk_buff *skb; - cisco_packet *data; - - skb = dev_alloc_skb(sizeof(hdlc_header) + sizeof(cisco_packet)); - if (!skb) { - printk(KERN_WARNING - "%s: Memory squeeze on cisco_keepalive_send()\n", - dev->name); - return; - } - skb_reserve(skb, 4); - cisco_hard_header(skb, dev, CISCO_KEEPALIVE, NULL, NULL, 0); - data = (cisco_packet*)(skb->data + 4); - - data->type = htonl(type); - data->par1 = htonl(par1); - data->par2 = htonl(par2); - data->rel = 0xFFFF; - /* we will need do_div here if 1000 % HZ != 0 */ - data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ)); - - skb_put(skb, sizeof(cisco_packet)); - skb->priority = TC_PRIO_CONTROL; - skb->dev = dev; - skb->nh.raw = skb->data; - - dev_queue_xmit(skb); -} - - - -static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev) -{ - hdlc_header *data = (hdlc_header*)skb->data; - - if (skb->len < sizeof(hdlc_header)) - return __constant_htons(ETH_P_HDLC); - - if (data->address != CISCO_MULTICAST && - data->address != CISCO_UNICAST) - return __constant_htons(ETH_P_HDLC); - - switch(data->protocol) { - case __constant_htons(ETH_P_IP): - case __constant_htons(ETH_P_IPX): - case __constant_htons(ETH_P_IPV6): - skb_pull(skb, sizeof(hdlc_header)); - return data->protocol; - default: - return __constant_htons(ETH_P_HDLC); - } -} - - -static int cisco_rx(struct sk_buff *skb) -{ - struct net_device *dev = skb->dev; - hdlc_device *hdlc = dev_to_hdlc(dev); - hdlc_header *data = (hdlc_header*)skb->data; - cisco_packet *cisco_data; - struct in_device *in_dev; - u32 addr, mask; - - if (skb->len < sizeof(hdlc_header)) - goto rx_error; - - if (data->address != CISCO_MULTICAST && - data->address != CISCO_UNICAST) - goto rx_error; - - switch(ntohs(data->protocol)) { - case CISCO_SYS_INFO: - /* Packet is not needed, drop it. */ - dev_kfree_skb_any(skb); - return NET_RX_SUCCESS; - - case CISCO_KEEPALIVE: - if (skb->len != sizeof(hdlc_header) + CISCO_PACKET_LEN && - skb->len != sizeof(hdlc_header) + CISCO_BIG_PACKET_LEN) { - printk(KERN_INFO "%s: Invalid length of Cisco " - "control packet (%d bytes)\n", - dev->name, skb->len); - goto rx_error; - } - - cisco_data = (cisco_packet*)(skb->data + sizeof(hdlc_header)); - - switch(ntohl (cisco_data->type)) { - case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */ - in_dev = dev->ip_ptr; - addr = 0; - mask = ~0; /* is the mask correct? */ - - if (in_dev != NULL) { - struct in_ifaddr **ifap = &in_dev->ifa_list; - - while (*ifap != NULL) { - if (strcmp(dev->name, - (*ifap)->ifa_label) == 0) { - addr = (*ifap)->ifa_local; - mask = (*ifap)->ifa_mask; - break; - } - ifap = &(*ifap)->ifa_next; - } - - cisco_keepalive_send(dev, CISCO_ADDR_REPLY, - addr, mask); - } - dev_kfree_skb_any(skb); - return NET_RX_SUCCESS; - - case CISCO_ADDR_REPLY: - printk(KERN_INFO "%s: Unexpected Cisco IP address " - "reply\n", dev->name); - goto rx_error; - - case CISCO_KEEPALIVE_REQ: - hdlc->state.cisco.rxseq = ntohl(cisco_data->par1); - if (hdlc->state.cisco.request_sent && - ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) { - hdlc->state.cisco.last_poll = jiffies; - if (!hdlc->state.cisco.up) { - u32 sec, min, hrs, days; - sec = ntohl(cisco_data->time) / 1000; - min = sec / 60; sec -= min * 60; - hrs = min / 60; min -= hrs * 60; - days = hrs / 24; hrs -= days * 24; - printk(KERN_INFO "%s: Link up (peer " - "uptime %ud%uh%um%us)\n", - dev->name, days, hrs, - min, sec); -#if 0 - netif_carrier_on(dev); -#endif - hdlc->state.cisco.up = 1; - } - } - - dev_kfree_skb_any(skb); - return NET_RX_SUCCESS; - } /* switch(keepalive type) */ - } /* switch(protocol) */ - - printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name, - data->protocol); - dev_kfree_skb_any(skb); - return NET_RX_DROP; - - rx_error: - hdlc->stats.rx_errors++; /* Mark error */ - dev_kfree_skb_any(skb); - return NET_RX_DROP; -} - - - -static void cisco_timer(unsigned long arg) -{ - struct net_device *dev = (struct net_device *)arg; - hdlc_device *hdlc = dev_to_hdlc(dev); - - if (hdlc->state.cisco.up && - time_after(jiffies, hdlc->state.cisco.last_poll + - hdlc->state.cisco.settings.timeout * HZ)) { - hdlc->state.cisco.up = 0; - printk(KERN_INFO "%s: Link down\n", dev->name); -#if 0 - netif_carrier_off(dev); -#endif - } - - cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, - ++hdlc->state.cisco.txseq, - hdlc->state.cisco.rxseq); - hdlc->state.cisco.request_sent = 1; - hdlc->state.cisco.timer.expires = jiffies + - hdlc->state.cisco.settings.interval * HZ; - hdlc->state.cisco.timer.function = cisco_timer; - hdlc->state.cisco.timer.data = arg; - add_timer(&hdlc->state.cisco.timer); -} - - - -static void cisco_start(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - hdlc->state.cisco.up = 0; - hdlc->state.cisco.request_sent = 0; - hdlc->state.cisco.txseq = hdlc->state.cisco.rxseq = 0; - - init_timer(&hdlc->state.cisco.timer); - hdlc->state.cisco.timer.expires = jiffies + HZ; /*First poll after 1s*/ - hdlc->state.cisco.timer.function = cisco_timer; - hdlc->state.cisco.timer.data = (unsigned long)dev; - add_timer(&hdlc->state.cisco.timer); -} - - - -static void cisco_stop(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - del_timer_sync(&hdlc->state.cisco.timer); -#if 0 - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); -#endif - hdlc->state.cisco.up = 0; - hdlc->state.cisco.request_sent = 0; -} - - - -int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr) -{ - cisco_proto __user *cisco_s = ifr->ifr_settings.ifs_ifsu.cisco; - const size_t size = sizeof(cisco_proto); - cisco_proto new_settings; - hdlc_device *hdlc = dev_to_hdlc(dev); - int result; - - switch (ifr->ifr_settings.type) { - case IF_GET_PROTO: - ifr->ifr_settings.type = IF_PROTO_CISCO; - if (ifr->ifr_settings.size < size) { - ifr->ifr_settings.size = size; /* data size wanted */ - return -ENOBUFS; - } - if (copy_to_user(cisco_s, &hdlc->state.cisco.settings, size)) - return -EFAULT; - return 0; - - case IF_PROTO_CISCO: - if(!capable(CAP_NET_ADMIN)) - return -EPERM; - - if(dev->flags & IFF_UP) - return -EBUSY; - - if (copy_from_user(&new_settings, cisco_s, size)) - return -EFAULT; - - if (new_settings.interval < 1 || - new_settings.timeout < 2) - return -EINVAL; - - result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); - - if (result) - return result; - - hdlc_proto_detach(hdlc); - memcpy(&hdlc->state.cisco.settings, &new_settings, size); - memset(&hdlc->proto, 0, sizeof(hdlc->proto)); - - hdlc->proto.start = cisco_start; - hdlc->proto.stop = cisco_stop; - hdlc->proto.netif_rx = cisco_rx; - hdlc->proto.type_trans = cisco_type_trans; - hdlc->proto.id = IF_PROTO_CISCO; - dev->hard_start_xmit = hdlc->xmit; - dev->hard_header = cisco_hard_header; - dev->hard_header_cache = NULL; - dev->type = ARPHRD_CISCO; - dev->flags = IFF_POINTOPOINT | IFF_NOARP; - dev->addr_len = 0; - return 0; - } - - return -EINVAL; -} diff --git a/zaptel/kernel/datamods/hdlc_fr.c b/zaptel/kernel/datamods/hdlc_fr.c deleted file mode 100644 index 523afe17..00000000 --- a/zaptel/kernel/datamods/hdlc_fr.c +++ /dev/null @@ -1,1273 +0,0 @@ -/* - * Generic HDLC support routines for Linux - * Frame Relay support - * - * Copyright (C) 1999 - 2005 Krzysztof Halasa - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - - Theory of PVC state - - DCE mode: - - (exist,new) -> 0,0 when "PVC create" or if "link unreliable" - 0,x -> 1,1 if "link reliable" when sending FULL STATUS - 1,1 -> 1,0 if received FULL STATUS ACK - - (active) -> 0 when "ifconfig PVC down" or "link unreliable" or "PVC create" - -> 1 when "PVC up" and (exist,new) = 1,0 - - DTE mode: - (exist,new,active) = FULL STATUS if "link reliable" - = 0, 0, 0 if "link unreliable" - No LMI: - active = open and "link reliable" - exist = new = not used - - CCITT LMI: ITU-T Q.933 Annex A - ANSI LMI: ANSI T1.617 Annex D - CISCO LMI: the original, aka "Gang of Four" LMI - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef DEBUG_PKT -#undef DEBUG_ECN -#undef DEBUG_LINK - -#define FR_UI 0x03 -#define FR_PAD 0x00 - -#define NLPID_IP 0xCC -#define NLPID_IPV6 0x8E -#define NLPID_SNAP 0x80 -#define NLPID_PAD 0x00 -#define NLPID_CCITT_ANSI_LMI 0x08 -#define NLPID_CISCO_LMI 0x09 - - -#define LMI_CCITT_ANSI_DLCI 0 /* LMI DLCI */ -#define LMI_CISCO_DLCI 1023 - -#define LMI_CALLREF 0x00 /* Call Reference */ -#define LMI_ANSI_LOCKSHIFT 0x95 /* ANSI locking shift */ -#define LMI_ANSI_CISCO_REPTYPE 0x01 /* report type */ -#define LMI_CCITT_REPTYPE 0x51 -#define LMI_ANSI_CISCO_ALIVE 0x03 /* keep alive */ -#define LMI_CCITT_ALIVE 0x53 -#define LMI_ANSI_CISCO_PVCSTAT 0x07 /* PVC status */ -#define LMI_CCITT_PVCSTAT 0x57 - -#define LMI_FULLREP 0x00 /* full report */ -#define LMI_INTEGRITY 0x01 /* link integrity report */ -#define LMI_SINGLE 0x02 /* single PVC report */ - -#define LMI_STATUS_ENQUIRY 0x75 -#define LMI_STATUS 0x7D /* reply */ - -#define LMI_REPT_LEN 1 /* report type element length */ -#define LMI_INTEG_LEN 2 /* link integrity element length */ - -#define LMI_CCITT_CISCO_LENGTH 13 /* LMI frame lengths */ -#define LMI_ANSI_LENGTH 14 - - -typedef struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - unsigned ea1: 1; - unsigned cr: 1; - unsigned dlcih: 6; - - unsigned ea2: 1; - unsigned de: 1; - unsigned becn: 1; - unsigned fecn: 1; - unsigned dlcil: 4; -#else - unsigned dlcih: 6; - unsigned cr: 1; - unsigned ea1: 1; - - unsigned dlcil: 4; - unsigned fecn: 1; - unsigned becn: 1; - unsigned de: 1; - unsigned ea2: 1; -#endif -}__attribute__ ((packed)) fr_hdr; - - -static inline u16 q922_to_dlci(u8 *hdr) -{ - return ((hdr[0] & 0xFC) << 2) | ((hdr[1] & 0xF0) >> 4); -} - - - -static inline void dlci_to_q922(u8 *hdr, u16 dlci) -{ - hdr[0] = (dlci >> 2) & 0xFC; - hdr[1] = ((dlci << 4) & 0xF0) | 0x01; -} - - - -static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) -{ - pvc_device *pvc = hdlc->state.fr.first_pvc; - - while (pvc) { - if (pvc->dlci == dlci) - return pvc; - if (pvc->dlci > dlci) - return NULL; /* the listed is sorted */ - pvc = pvc->next; - } - - return NULL; -} - - -static inline pvc_device* add_pvc(struct net_device *dev, u16 dlci) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - pvc_device *pvc, **pvc_p = &hdlc->state.fr.first_pvc; - - while (*pvc_p) { - if ((*pvc_p)->dlci == dlci) - return *pvc_p; - if ((*pvc_p)->dlci > dlci) - break; /* the list is sorted */ - pvc_p = &(*pvc_p)->next; - } - - pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC); - if (!pvc) - return NULL; - - memset(pvc, 0, sizeof(pvc_device)); - pvc->dlci = dlci; - pvc->master = dev; - pvc->next = *pvc_p; /* Put it in the chain */ - *pvc_p = pvc; - return pvc; -} - - -static inline int pvc_is_used(pvc_device *pvc) -{ - return pvc->main != NULL || pvc->ether != NULL; -} - - -static inline void pvc_carrier(int on, pvc_device *pvc) -{ - if (on) { - if (pvc->main) - if (!netif_carrier_ok(pvc->main)) - netif_carrier_on(pvc->main); - if (pvc->ether) - if (!netif_carrier_ok(pvc->ether)) - netif_carrier_on(pvc->ether); - } else { - if (pvc->main) - if (netif_carrier_ok(pvc->main)) - netif_carrier_off(pvc->main); - if (pvc->ether) - if (netif_carrier_ok(pvc->ether)) - netif_carrier_off(pvc->ether); - } -} - - -static inline void delete_unused_pvcs(hdlc_device *hdlc) -{ - pvc_device **pvc_p = &hdlc->state.fr.first_pvc; - - while (*pvc_p) { - if (!pvc_is_used(*pvc_p)) { - pvc_device *pvc = *pvc_p; - *pvc_p = pvc->next; - kfree(pvc); - continue; - } - pvc_p = &(*pvc_p)->next; - } -} - - -static inline struct net_device** get_dev_p(pvc_device *pvc, int type) -{ - if (type == ARPHRD_ETHER) - return &pvc->ether; - else - return &pvc->main; -} - - -static int fr_hard_header(struct sk_buff **skb_p, u16 dlci) -{ - u16 head_len; - struct sk_buff *skb = *skb_p; - - switch (skb->protocol) { - case __constant_ntohs(NLPID_CCITT_ANSI_LMI): - head_len = 4; - skb_push(skb, head_len); - skb->data[3] = NLPID_CCITT_ANSI_LMI; - break; - - case __constant_ntohs(NLPID_CISCO_LMI): - head_len = 4; - skb_push(skb, head_len); - skb->data[3] = NLPID_CISCO_LMI; - break; - - case __constant_ntohs(ETH_P_IP): - head_len = 4; - skb_push(skb, head_len); - skb->data[3] = NLPID_IP; - break; - - case __constant_ntohs(ETH_P_IPV6): - head_len = 4; - skb_push(skb, head_len); - skb->data[3] = NLPID_IPV6; - break; - - case __constant_ntohs(ETH_P_802_3): - head_len = 10; - if (skb_headroom(skb) < head_len) { - struct sk_buff *skb2 = skb_realloc_headroom(skb, - head_len); - if (!skb2) - return -ENOBUFS; - dev_kfree_skb(skb); - skb = *skb_p = skb2; - } - skb_push(skb, head_len); - skb->data[3] = FR_PAD; - skb->data[4] = NLPID_SNAP; - skb->data[5] = FR_PAD; - skb->data[6] = 0x80; - skb->data[7] = 0xC2; - skb->data[8] = 0x00; - skb->data[9] = 0x07; /* bridged Ethernet frame w/out FCS */ - break; - - default: - head_len = 10; - skb_push(skb, head_len); - skb->data[3] = FR_PAD; - skb->data[4] = NLPID_SNAP; - skb->data[5] = FR_PAD; - skb->data[6] = FR_PAD; - skb->data[7] = FR_PAD; - *(u16*)(skb->data + 8) = skb->protocol; - } - - dlci_to_q922(skb->data, dlci); - skb->data[2] = FR_UI; - return 0; -} - - - -static int pvc_open(struct net_device *dev) -{ - pvc_device *pvc = dev_to_pvc(dev); - - if ((pvc->master->flags & IFF_UP) == 0) - return -EIO; /* Master must be UP in order to activate PVC */ - - if (pvc->open_count++ == 0) { - hdlc_device *hdlc = dev_to_hdlc(pvc->master); - if (hdlc->state.fr.settings.lmi == LMI_NONE) - pvc->state.active = hdlc->carrier; - - pvc_carrier(pvc->state.active, pvc); - hdlc->state.fr.dce_changed = 1; - } - return 0; -} - - - -static int pvc_close(struct net_device *dev) -{ - pvc_device *pvc = dev_to_pvc(dev); - - if (--pvc->open_count == 0) { - hdlc_device *hdlc = dev_to_hdlc(pvc->master); - if (hdlc->state.fr.settings.lmi == LMI_NONE) - pvc->state.active = 0; - - if (hdlc->state.fr.settings.dce) { - hdlc->state.fr.dce_changed = 1; - pvc->state.active = 0; - } - } - return 0; -} - - - -static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - pvc_device *pvc = dev_to_pvc(dev); - fr_proto_pvc_info info; - - if (ifr->ifr_settings.type == IF_GET_PROTO) { - if (dev->type == ARPHRD_ETHER) - ifr->ifr_settings.type = IF_PROTO_FR_ETH_PVC; - else - ifr->ifr_settings.type = IF_PROTO_FR_PVC; - - if (ifr->ifr_settings.size < sizeof(info)) { - /* data size wanted */ - ifr->ifr_settings.size = sizeof(info); - return -ENOBUFS; - } - - info.dlci = pvc->dlci; - memcpy(info.master, pvc->master->name, IFNAMSIZ); - if (copy_to_user(ifr->ifr_settings.ifs_ifsu.fr_pvc_info, - &info, sizeof(info))) - return -EFAULT; - return 0; - } - - return -EINVAL; -} - - -static inline struct net_device_stats *pvc_get_stats(struct net_device *dev) -{ - return netdev_priv(dev); -} - - - -static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) -{ - pvc_device *pvc = dev_to_pvc(dev); - struct net_device_stats *stats = pvc_get_stats(dev); - - if (pvc->state.active) { - if (dev->type == ARPHRD_ETHER) { - int pad = ETH_ZLEN - skb->len; - if (pad > 0) { /* Pad the frame with zeros */ - int len = skb->len; - if (skb_tailroom(skb) < pad) - if (pskb_expand_head(skb, 0, pad, - GFP_ATOMIC)) { - stats->tx_dropped++; - dev_kfree_skb(skb); - return 0; - } - skb_put(skb, pad); - memset(skb->data + len, 0, pad); - } - skb->protocol = __constant_htons(ETH_P_802_3); - } - if (!fr_hard_header(&skb, pvc->dlci)) { - stats->tx_bytes += skb->len; - stats->tx_packets++; - if (pvc->state.fecn) /* TX Congestion counter */ - stats->tx_compressed++; - skb->dev = pvc->master; - dev_queue_xmit(skb); - return 0; - } - } - - stats->tx_dropped++; - dev_kfree_skb(skb); - return 0; -} - - - -static int pvc_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU)) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} - - - -static inline void fr_log_dlci_active(pvc_device *pvc) -{ - printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n", - pvc->master->name, - pvc->dlci, - pvc->main ? pvc->main->name : "", - pvc->main && pvc->ether ? " " : "", - pvc->ether ? pvc->ether->name : "", - pvc->state.new ? " new" : "", - !pvc->state.exist ? "deleted" : - pvc->state.active ? "active" : "inactive"); -} - - - -static inline u8 fr_lmi_nextseq(u8 x) -{ - x++; - return x ? x : 1; -} - - - -static void fr_lmi_send(struct net_device *dev, int fullrep) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - struct sk_buff *skb; - pvc_device *pvc = hdlc->state.fr.first_pvc; - int lmi = hdlc->state.fr.settings.lmi; - int dce = hdlc->state.fr.settings.dce; - int len = lmi == LMI_ANSI ? LMI_ANSI_LENGTH : LMI_CCITT_CISCO_LENGTH; - int stat_len = (lmi == LMI_CISCO) ? 6 : 3; - u8 *data; - int i = 0; - - if (dce && fullrep) { - len += hdlc->state.fr.dce_pvc_count * (2 + stat_len); - if (len > HDLC_MAX_MRU) { - printk(KERN_WARNING "%s: Too many PVCs while sending " - "LMI full report\n", dev->name); - return; - } - } - - skb = dev_alloc_skb(len); - if (!skb) { - printk(KERN_WARNING "%s: Memory squeeze on fr_lmi_send()\n", - dev->name); - return; - } - memset(skb->data, 0, len); - skb_reserve(skb, 4); - if (lmi == LMI_CISCO) { - skb->protocol = __constant_htons(NLPID_CISCO_LMI); - fr_hard_header(&skb, LMI_CISCO_DLCI); - } else { - skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI); - fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI); - } - data = skb->tail; - data[i++] = LMI_CALLREF; - data[i++] = dce ? LMI_STATUS : LMI_STATUS_ENQUIRY; - if (lmi == LMI_ANSI) - data[i++] = LMI_ANSI_LOCKSHIFT; - data[i++] = lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : - LMI_ANSI_CISCO_REPTYPE; - data[i++] = LMI_REPT_LEN; - data[i++] = fullrep ? LMI_FULLREP : LMI_INTEGRITY; - data[i++] = lmi == LMI_CCITT ? LMI_CCITT_ALIVE : LMI_ANSI_CISCO_ALIVE; - data[i++] = LMI_INTEG_LEN; - data[i++] = hdlc->state.fr.txseq =fr_lmi_nextseq(hdlc->state.fr.txseq); - data[i++] = hdlc->state.fr.rxseq; - - if (dce && fullrep) { - while (pvc) { - data[i++] = lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : - LMI_ANSI_CISCO_PVCSTAT; - data[i++] = stat_len; - - /* LMI start/restart */ - if (hdlc->state.fr.reliable && !pvc->state.exist) { - pvc->state.exist = pvc->state.new = 1; - fr_log_dlci_active(pvc); - } - - /* ifconfig PVC up */ - if (pvc->open_count && !pvc->state.active && - pvc->state.exist && !pvc->state.new) { - pvc_carrier(1, pvc); - pvc->state.active = 1; - fr_log_dlci_active(pvc); - } - - if (lmi == LMI_CISCO) { - data[i] = pvc->dlci >> 8; - data[i + 1] = pvc->dlci & 0xFF; - } else { - data[i] = (pvc->dlci >> 4) & 0x3F; - data[i + 1] = ((pvc->dlci << 3) & 0x78) | 0x80; - data[i + 2] = 0x80; - } - - if (pvc->state.new) - data[i + 2] |= 0x08; - else if (pvc->state.active) - data[i + 2] |= 0x02; - - i += stat_len; - pvc = pvc->next; - } - } - - skb_put(skb, i); - skb->priority = TC_PRIO_CONTROL; - skb->dev = dev; - skb->nh.raw = skb->data; - - dev_queue_xmit(skb); -} - - - -static void fr_set_link_state(int reliable, struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - pvc_device *pvc = hdlc->state.fr.first_pvc; - - hdlc->state.fr.reliable = reliable; - if (reliable) { -#if 0 - if (!netif_carrier_ok(dev)) - netif_carrier_on(dev); -#endif - - hdlc->state.fr.n391cnt = 0; /* Request full status */ - hdlc->state.fr.dce_changed = 1; - - if (hdlc->state.fr.settings.lmi == LMI_NONE) { - while (pvc) { /* Activate all PVCs */ - pvc_carrier(1, pvc); - pvc->state.exist = pvc->state.active = 1; - pvc->state.new = 0; - pvc = pvc->next; - } - } - } else { -#if 0 - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); -#endif - - while (pvc) { /* Deactivate all PVCs */ - pvc_carrier(0, pvc); - pvc->state.exist = pvc->state.active = 0; - pvc->state.new = 0; - if (!hdlc->state.fr.settings.dce) - pvc->state.bandwidth = 0; - pvc = pvc->next; - } - } -} - - - -static void fr_timer(unsigned long arg) -{ - struct net_device *dev = (struct net_device *)arg; - hdlc_device *hdlc = dev_to_hdlc(dev); - int i, cnt = 0, reliable; - u32 list; - - if (hdlc->state.fr.settings.dce) { - reliable = hdlc->state.fr.request && - time_before(jiffies, hdlc->state.fr.last_poll + - hdlc->state.fr.settings.t392 * HZ); - hdlc->state.fr.request = 0; - } else { - hdlc->state.fr.last_errors <<= 1; /* Shift the list */ - if (hdlc->state.fr.request) { - if (hdlc->state.fr.reliable) - printk(KERN_INFO "%s: No LMI status reply " - "received\n", dev->name); - hdlc->state.fr.last_errors |= 1; - } - - list = hdlc->state.fr.last_errors; - for (i = 0; i < hdlc->state.fr.settings.n393; i++, list >>= 1) - cnt += (list & 1); /* errors count */ - - reliable = (cnt < hdlc->state.fr.settings.n392); - } - - if (hdlc->state.fr.reliable != reliable) { - printk(KERN_INFO "%s: Link %sreliable\n", dev->name, - reliable ? "" : "un"); - fr_set_link_state(reliable, dev); - } - - if (hdlc->state.fr.settings.dce) - hdlc->state.fr.timer.expires = jiffies + - hdlc->state.fr.settings.t392 * HZ; - else { - if (hdlc->state.fr.n391cnt) - hdlc->state.fr.n391cnt--; - - fr_lmi_send(dev, hdlc->state.fr.n391cnt == 0); - - hdlc->state.fr.last_poll = jiffies; - hdlc->state.fr.request = 1; - hdlc->state.fr.timer.expires = jiffies + - hdlc->state.fr.settings.t391 * HZ; - } - - hdlc->state.fr.timer.function = fr_timer; - hdlc->state.fr.timer.data = arg; - add_timer(&hdlc->state.fr.timer); -} - - - -static int fr_lmi_recv(struct net_device *dev, struct sk_buff *skb) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - pvc_device *pvc; - u8 rxseq, txseq; - int lmi = hdlc->state.fr.settings.lmi; - int dce = hdlc->state.fr.settings.dce; - int stat_len = (lmi == LMI_CISCO) ? 6 : 3, reptype, error, no_ram, i; - - if (skb->len < (lmi == LMI_ANSI ? LMI_ANSI_LENGTH : - LMI_CCITT_CISCO_LENGTH)) { - printk(KERN_INFO "%s: Short LMI frame\n", dev->name); - return 1; - } - - if (skb->data[3] != (lmi == LMI_CISCO ? NLPID_CISCO_LMI : - NLPID_CCITT_ANSI_LMI)) { - printk(KERN_INFO "%s: Received non-LMI frame with LMI" - " DLCI\n", dev->name); - return 1; - } - - if (skb->data[4] != LMI_CALLREF) { - printk(KERN_INFO "%s: Invalid LMI Call reference (0x%02X)\n", - dev->name, skb->data[4]); - return 1; - } - - if (skb->data[5] != (dce ? LMI_STATUS_ENQUIRY : LMI_STATUS)) { - printk(KERN_INFO "%s: Invalid LMI Message type (0x%02X)\n", - dev->name, skb->data[5]); - return 1; - } - - if (lmi == LMI_ANSI) { - if (skb->data[6] != LMI_ANSI_LOCKSHIFT) { - printk(KERN_INFO "%s: Not ANSI locking shift in LMI" - " message (0x%02X)\n", dev->name, skb->data[6]); - return 1; - } - i = 7; - } else - i = 6; - - if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_REPTYPE : - LMI_ANSI_CISCO_REPTYPE)) { - printk(KERN_INFO "%s: Not an LMI Report type IE (0x%02X)\n", - dev->name, skb->data[i]); - return 1; - } - - if (skb->data[++i] != LMI_REPT_LEN) { - printk(KERN_INFO "%s: Invalid LMI Report type IE length" - " (%u)\n", dev->name, skb->data[i]); - return 1; - } - - reptype = skb->data[++i]; - if (reptype != LMI_INTEGRITY && reptype != LMI_FULLREP) { - printk(KERN_INFO "%s: Unsupported LMI Report type (0x%02X)\n", - dev->name, reptype); - return 1; - } - - if (skb->data[++i] != (lmi == LMI_CCITT ? LMI_CCITT_ALIVE : - LMI_ANSI_CISCO_ALIVE)) { - printk(KERN_INFO "%s: Not an LMI Link integrity verification" - " IE (0x%02X)\n", dev->name, skb->data[i]); - return 1; - } - - if (skb->data[++i] != LMI_INTEG_LEN) { - printk(KERN_INFO "%s: Invalid LMI Link integrity verification" - " IE length (%u)\n", dev->name, skb->data[i]); - return 1; - } - i++; - - hdlc->state.fr.rxseq = skb->data[i++]; /* TX sequence from peer */ - rxseq = skb->data[i++]; /* Should confirm our sequence */ - - txseq = hdlc->state.fr.txseq; - - if (dce) - hdlc->state.fr.last_poll = jiffies; - - error = 0; - if (!hdlc->state.fr.reliable) - error = 1; - - if (rxseq == 0 || rxseq != txseq) { - hdlc->state.fr.n391cnt = 0; /* Ask for full report next time */ - error = 1; - } - - if (dce) { - if (hdlc->state.fr.fullrep_sent && !error) { -/* Stop sending full report - the last one has been confirmed by DTE */ - hdlc->state.fr.fullrep_sent = 0; - pvc = hdlc->state.fr.first_pvc; - while (pvc) { - if (pvc->state.new) { - pvc->state.new = 0; - -/* Tell DTE that new PVC is now active */ - hdlc->state.fr.dce_changed = 1; - } - pvc = pvc->next; - } - } - - if (hdlc->state.fr.dce_changed) { - reptype = LMI_FULLREP; - hdlc->state.fr.fullrep_sent = 1; - hdlc->state.fr.dce_changed = 0; - } - - hdlc->state.fr.request = 1; /* got request */ - fr_lmi_send(dev, reptype == LMI_FULLREP ? 1 : 0); - return 0; - } - - /* DTE */ - - hdlc->state.fr.request = 0; /* got response, no request pending */ - - if (error) - return 0; - - if (reptype != LMI_FULLREP) - return 0; - - pvc = hdlc->state.fr.first_pvc; - - while (pvc) { - pvc->state.deleted = 1; - pvc = pvc->next; - } - - no_ram = 0; - while (skb->len >= i + 2 + stat_len) { - u16 dlci; - u32 bw; - unsigned int active, new; - - if (skb->data[i] != (lmi == LMI_CCITT ? LMI_CCITT_PVCSTAT : - LMI_ANSI_CISCO_PVCSTAT)) { - printk(KERN_INFO "%s: Not an LMI PVC status IE" - " (0x%02X)\n", dev->name, skb->data[i]); - return 1; - } - - if (skb->data[++i] != stat_len) { - printk(KERN_INFO "%s: Invalid LMI PVC status IE length" - " (%u)\n", dev->name, skb->data[i]); - return 1; - } - i++; - - new = !! (skb->data[i + 2] & 0x08); - active = !! (skb->data[i + 2] & 0x02); - if (lmi == LMI_CISCO) { - dlci = (skb->data[i] << 8) | skb->data[i + 1]; - bw = (skb->data[i + 3] << 16) | - (skb->data[i + 4] << 8) | - (skb->data[i + 5]); - } else { - dlci = ((skb->data[i] & 0x3F) << 4) | - ((skb->data[i + 1] & 0x78) >> 3); - bw = 0; - } - - pvc = add_pvc(dev, dlci); - - if (!pvc && !no_ram) { - printk(KERN_WARNING - "%s: Memory squeeze on fr_lmi_recv()\n", - dev->name); - no_ram = 1; - } - - if (pvc) { - pvc->state.exist = 1; - pvc->state.deleted = 0; - if (active != pvc->state.active || - new != pvc->state.new || - bw != pvc->state.bandwidth || - !pvc->state.exist) { - pvc->state.new = new; - pvc->state.active = active; - pvc->state.bandwidth = bw; - pvc_carrier(active, pvc); - fr_log_dlci_active(pvc); - } - } - - i += stat_len; - } - - pvc = hdlc->state.fr.first_pvc; - - while (pvc) { - if (pvc->state.deleted && pvc->state.exist) { - pvc_carrier(0, pvc); - pvc->state.active = pvc->state.new = 0; - pvc->state.exist = 0; - pvc->state.bandwidth = 0; - fr_log_dlci_active(pvc); - } - pvc = pvc->next; - } - - /* Next full report after N391 polls */ - hdlc->state.fr.n391cnt = hdlc->state.fr.settings.n391; - - return 0; -} - - - -static int fr_rx(struct sk_buff *skb) -{ - struct net_device *ndev = skb->dev; - hdlc_device *hdlc = dev_to_hdlc(ndev); - fr_hdr *fh = (fr_hdr*)skb->data; - u8 *data = skb->data; - u16 dlci; - pvc_device *pvc; - struct net_device *dev = NULL; - - if (skb->len <= 4 || fh->ea1 || data[2] != FR_UI) - goto rx_error; - - dlci = q922_to_dlci(skb->data); - - if ((dlci == LMI_CCITT_ANSI_DLCI && - (hdlc->state.fr.settings.lmi == LMI_ANSI || - hdlc->state.fr.settings.lmi == LMI_CCITT)) || - (dlci == LMI_CISCO_DLCI && - hdlc->state.fr.settings.lmi == LMI_CISCO)) { - if (fr_lmi_recv(ndev, skb)) - goto rx_error; - dev_kfree_skb_any(skb); - return NET_RX_SUCCESS; - } - - pvc = find_pvc(hdlc, dlci); - if (!pvc) { -#ifdef DEBUG_PKT - printk(KERN_INFO "%s: No PVC for received frame's DLCI %d\n", - ndev->name, dlci); -#endif - dev_kfree_skb_any(skb); - return NET_RX_DROP; - } - - if (pvc->state.fecn != fh->fecn) { -#ifdef DEBUG_ECN - printk(KERN_DEBUG "%s: DLCI %d FECN O%s\n", ndev->name, - dlci, fh->fecn ? "N" : "FF"); -#endif - pvc->state.fecn ^= 1; - } - - if (pvc->state.becn != fh->becn) { -#ifdef DEBUG_ECN - printk(KERN_DEBUG "%s: DLCI %d BECN O%s\n", ndev->name, - dlci, fh->becn ? "N" : "FF"); -#endif - pvc->state.becn ^= 1; - } - - - if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { - hdlc->stats.rx_dropped++; - return NET_RX_DROP; - } - - if (data[3] == NLPID_IP) { - skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */ - dev = pvc->main; - skb->protocol = htons(ETH_P_IP); - - } else if (data[3] == NLPID_IPV6) { - skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */ - dev = pvc->main; - skb->protocol = htons(ETH_P_IPV6); - - } else if (skb->len > 10 && data[3] == FR_PAD && - data[4] == NLPID_SNAP && data[5] == FR_PAD) { - u16 oui = ntohs(*(u16*)(data + 6)); - u16 pid = ntohs(*(u16*)(data + 8)); - skb_pull(skb, 10); - - switch ((((u32)oui) << 16) | pid) { - case ETH_P_ARP: /* routed frame with SNAP */ - case ETH_P_IPX: - case ETH_P_IP: /* a long variant */ - case ETH_P_IPV6: - dev = pvc->main; - skb->protocol = htons(pid); - break; - - case 0x80C20007: /* bridged Ethernet frame */ - if ((dev = pvc->ether) != NULL) - skb->protocol = eth_type_trans(skb, dev); - break; - - default: - printk(KERN_INFO "%s: Unsupported protocol, OUI=%x " - "PID=%x\n", ndev->name, oui, pid); - dev_kfree_skb_any(skb); - return NET_RX_DROP; - } - } else { - printk(KERN_INFO "%s: Unsupported protocol, NLPID=%x " - "length = %i\n", ndev->name, data[3], skb->len); - dev_kfree_skb_any(skb); - return NET_RX_DROP; - } - - if (dev) { - struct net_device_stats *stats = pvc_get_stats(dev); - stats->rx_packets++; /* PVC traffic */ - stats->rx_bytes += skb->len; - if (pvc->state.becn) - stats->rx_compressed++; - skb->dev = dev; - netif_rx(skb); - return NET_RX_SUCCESS; - } else { - dev_kfree_skb_any(skb); - return NET_RX_DROP; - } - - rx_error: - hdlc->stats.rx_errors++; /* Mark error */ - dev_kfree_skb_any(skb); - return NET_RX_DROP; -} - - - -static void fr_start(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); -#ifdef DEBUG_LINK - printk(KERN_DEBUG "fr_start\n"); -#endif - if (hdlc->state.fr.settings.lmi != LMI_NONE) { - hdlc->state.fr.reliable = 0; - hdlc->state.fr.dce_changed = 1; - hdlc->state.fr.request = 0; - hdlc->state.fr.fullrep_sent = 0; - hdlc->state.fr.last_errors = 0xFFFFFFFF; - hdlc->state.fr.n391cnt = 0; - hdlc->state.fr.txseq = hdlc->state.fr.rxseq = 0; - - init_timer(&hdlc->state.fr.timer); - /* First poll after 1 s */ - hdlc->state.fr.timer.expires = jiffies + HZ; - hdlc->state.fr.timer.function = fr_timer; - hdlc->state.fr.timer.data = (unsigned long)dev; - add_timer(&hdlc->state.fr.timer); - } else - fr_set_link_state(1, dev); -} - - - -static void fr_stop(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); -#ifdef DEBUG_LINK - printk(KERN_DEBUG "fr_stop\n"); -#endif - if (hdlc->state.fr.settings.lmi != LMI_NONE) - del_timer_sync(&hdlc->state.fr.timer); - fr_set_link_state(0, dev); -} - - - -static void fr_close(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - pvc_device *pvc = hdlc->state.fr.first_pvc; - - while (pvc) { /* Shutdown all PVCs for this FRAD */ - if (pvc->main) - dev_close(pvc->main); - if (pvc->ether) - dev_close(pvc->ether); - pvc = pvc->next; - } -} - -static void dlci_setup(struct net_device *dev) -{ - dev->type = ARPHRD_DLCI; - dev->flags = IFF_POINTOPOINT; - dev->hard_header_len = 10; - dev->addr_len = 2; -} - -static int fr_add_pvc(struct net_device *master, unsigned int dlci, int type) -{ - hdlc_device *hdlc = dev_to_hdlc(master); - pvc_device *pvc = NULL; - struct net_device *dev; - int result, used; - char * prefix = "pvc%d"; - - if (type == ARPHRD_ETHER) - prefix = "pvceth%d"; - - if ((pvc = add_pvc(master, dlci)) == NULL) { - printk(KERN_WARNING "%s: Memory squeeze on fr_add_pvc()\n", - master->name); - return -ENOBUFS; - } - - if (*get_dev_p(pvc, type)) - return -EEXIST; - - used = pvc_is_used(pvc); - - if (type == ARPHRD_ETHER) - dev = alloc_netdev(sizeof(struct net_device_stats), - "pvceth%d", ether_setup); - else - dev = alloc_netdev(sizeof(struct net_device_stats), - "pvc%d", dlci_setup); - - if (!dev) { - printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", - master->name); - delete_unused_pvcs(hdlc); - return -ENOBUFS; - } - - if (type == ARPHRD_ETHER) { - memcpy(dev->dev_addr, "\x00\x01", 2); - get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2); - } else { - *(u16*)dev->dev_addr = htons(dlci); - dlci_to_q922(dev->broadcast, dlci); - } - dev->hard_start_xmit = pvc_xmit; - dev->get_stats = pvc_get_stats; - dev->open = pvc_open; - dev->stop = pvc_close; - dev->do_ioctl = pvc_ioctl; - dev->change_mtu = pvc_change_mtu; - dev->mtu = HDLC_MAX_MTU; - dev->tx_queue_len = 0; - dev->priv = pvc; - - result = dev_alloc_name(dev, dev->name); - if (result < 0) { - free_netdev(dev); - delete_unused_pvcs(hdlc); - return result; - } - - if (register_netdevice(dev) != 0) { - free_netdev(dev); - delete_unused_pvcs(hdlc); - return -EIO; - } - - dev->destructor = free_netdev; - *get_dev_p(pvc, type) = dev; - if (!used) { - hdlc->state.fr.dce_changed = 1; - hdlc->state.fr.dce_pvc_count++; - } - return 0; -} - - - -static int fr_del_pvc(hdlc_device *hdlc, unsigned int dlci, int type) -{ - pvc_device *pvc; - struct net_device *dev; - - if ((pvc = find_pvc(hdlc, dlci)) == NULL) - return -ENOENT; - - if ((dev = *get_dev_p(pvc, type)) == NULL) - return -ENOENT; - - if (dev->flags & IFF_UP) - return -EBUSY; /* PVC in use */ - - unregister_netdevice(dev); /* the destructor will free_netdev(dev) */ - *get_dev_p(pvc, type) = NULL; - - if (!pvc_is_used(pvc)) { - hdlc->state.fr.dce_pvc_count--; - hdlc->state.fr.dce_changed = 1; - } - delete_unused_pvcs(hdlc); - return 0; -} - - - -static void fr_destroy(hdlc_device *hdlc) -{ - pvc_device *pvc; - - pvc = hdlc->state.fr.first_pvc; - hdlc->state.fr.first_pvc = NULL; /* All PVCs destroyed */ - hdlc->state.fr.dce_pvc_count = 0; - hdlc->state.fr.dce_changed = 1; - - while (pvc) { - pvc_device *next = pvc->next; - /* destructors will free_netdev() main and ether */ - if (pvc->main) - unregister_netdevice(pvc->main); - - if (pvc->ether) - unregister_netdevice(pvc->ether); - - kfree(pvc); - pvc = next; - } -} - - - -int hdlc_fr_ioctl(struct net_device *dev, struct ifreq *ifr) -{ - fr_proto __user *fr_s = ifr->ifr_settings.ifs_ifsu.fr; - const size_t size = sizeof(fr_proto); - fr_proto new_settings; - hdlc_device *hdlc = dev_to_hdlc(dev); - fr_proto_pvc pvc; - int result; - - switch (ifr->ifr_settings.type) { - case IF_GET_PROTO: - ifr->ifr_settings.type = IF_PROTO_FR; - if (ifr->ifr_settings.size < size) { - ifr->ifr_settings.size = size; /* data size wanted */ - return -ENOBUFS; - } - if (copy_to_user(fr_s, &hdlc->state.fr.settings, size)) - return -EFAULT; - return 0; - - case IF_PROTO_FR: - if(!capable(CAP_NET_ADMIN)) - return -EPERM; - - if(dev->flags & IFF_UP) - return -EBUSY; - - if (copy_from_user(&new_settings, fr_s, size)) - return -EFAULT; - - if (new_settings.lmi == LMI_DEFAULT) - new_settings.lmi = LMI_ANSI; - - if ((new_settings.lmi != LMI_NONE && - new_settings.lmi != LMI_ANSI && - new_settings.lmi != LMI_CCITT && - new_settings.lmi != LMI_CISCO) || - new_settings.t391 < 1 || - new_settings.t392 < 2 || - new_settings.n391 < 1 || - new_settings.n392 < 1 || - new_settings.n393 < new_settings.n392 || - new_settings.n393 > 32 || - (new_settings.dce != 0 && - new_settings.dce != 1)) - return -EINVAL; - - result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); - if (result) - return result; - - if (hdlc->proto.id != IF_PROTO_FR) { - hdlc_proto_detach(hdlc); - hdlc->state.fr.first_pvc = NULL; - hdlc->state.fr.dce_pvc_count = 0; - } - memcpy(&hdlc->state.fr.settings, &new_settings, size); - memset(&hdlc->proto, 0, sizeof(hdlc->proto)); - - hdlc->proto.close = fr_close; - hdlc->proto.start = fr_start; - hdlc->proto.stop = fr_stop; - hdlc->proto.detach = fr_destroy; - hdlc->proto.netif_rx = fr_rx; - hdlc->proto.id = IF_PROTO_FR; - dev->hard_start_xmit = hdlc->xmit; - dev->hard_header = NULL; - dev->type = ARPHRD_FRAD; - dev->flags = IFF_POINTOPOINT | IFF_NOARP; - dev->addr_len = 0; - return 0; - - case IF_PROTO_FR_ADD_PVC: - case IF_PROTO_FR_DEL_PVC: - case IF_PROTO_FR_ADD_ETH_PVC: - case IF_PROTO_FR_DEL_ETH_PVC: - if(!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc, - sizeof(fr_proto_pvc))) - return -EFAULT; - - if (pvc.dlci <= 0 || pvc.dlci >= 1024) - return -EINVAL; /* Only 10 bits, DLCI 0 reserved */ - - if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC || - ifr->ifr_settings.type == IF_PROTO_FR_DEL_ETH_PVC) - result = ARPHRD_ETHER; /* bridged Ethernet device */ - else - result = ARPHRD_DLCI; - - if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC || - ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC) - return fr_add_pvc(dev, pvc.dlci, result); - else - return fr_del_pvc(hdlc, pvc.dlci, result); - } - - return -EINVAL; -} diff --git a/zaptel/kernel/datamods/hdlc_generic.c b/zaptel/kernel/datamods/hdlc_generic.c deleted file mode 100644 index 46cef8f9..00000000 --- a/zaptel/kernel/datamods/hdlc_generic.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Generic HDLC support routines for Linux - * - * Copyright (C) 1999 - 2005 Krzysztof Halasa - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * Currently supported: - * * raw IP-in-HDLC - * * Cisco HDLC - * * Frame Relay with ANSI or CCITT LMI (both user and network side) - * * PPP - * * X.25 - * - * Use sethdlc utility to set line parameters, protocol and PVCs - * - * How does it work: - * - proto.open(), close(), start(), stop() calls are serialized. - * The order is: open, [ start, stop ... ] close ... - * - proto.start() and stop() are called with spin_lock_irq held. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static const char* version = "HDLC support module revision 1.18"; - -#undef DEBUG_LINK - - -static int hdlc_change_mtu(struct net_device *dev, int new_mtu) -{ - if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU)) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} - - - -static struct net_device_stats *hdlc_get_stats(struct net_device *dev) -{ - return hdlc_stats(dev); -} - - - -static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, - struct packet_type *p, struct net_device *orig_dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - if (hdlc->proto.netif_rx) - return hdlc->proto.netif_rx(skb); - - hdlc->stats.rx_dropped++; /* Shouldn't happen */ - dev_kfree_skb(skb); - return NET_RX_DROP; -} - - - -static void __hdlc_set_carrier_on(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - if (hdlc->proto.start) - return hdlc->proto.start(dev); -#if 0 -#ifdef DEBUG_LINK - if (netif_carrier_ok(dev)) - printk(KERN_ERR "hdlc_set_carrier_on(): already on\n"); -#endif - netif_carrier_on(dev); -#endif -} - - - -static void __hdlc_set_carrier_off(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - if (hdlc->proto.stop) - return hdlc->proto.stop(dev); - -#if 0 -#ifdef DEBUG_LINK - if (!netif_carrier_ok(dev)) - printk(KERN_ERR "hdlc_set_carrier_off(): already off\n"); -#endif - netif_carrier_off(dev); -#endif -} - - - -void hdlc_set_carrier(int on, struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - unsigned long flags; - on = on ? 1 : 0; - -#ifdef DEBUG_LINK - printk(KERN_DEBUG "hdlc_set_carrier %i\n", on); -#endif - - spin_lock_irqsave(&hdlc->state_lock, flags); - - if (hdlc->carrier == on) - goto carrier_exit; /* no change in DCD line level */ - -#ifdef DEBUG_LINK - printk(KERN_INFO "%s: carrier %s\n", dev->name, on ? "ON" : "off"); -#endif - hdlc->carrier = on; - - if (!hdlc->open) - goto carrier_exit; - - if (hdlc->carrier) { - printk(KERN_INFO "%s: Carrier detected\n", dev->name); - __hdlc_set_carrier_on(dev); - } else { - printk(KERN_INFO "%s: Carrier lost\n", dev->name); - __hdlc_set_carrier_off(dev); - } - -carrier_exit: - spin_unlock_irqrestore(&hdlc->state_lock, flags); -} - - - -/* Must be called by hardware driver when HDLC device is being opened */ -int hdlc_open(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); -#ifdef DEBUG_LINK - printk(KERN_DEBUG "hdlc_open() carrier %i open %i\n", - hdlc->carrier, hdlc->open); -#endif - - if (hdlc->proto.id == -1) - return -ENOSYS; /* no protocol attached */ - - if (hdlc->proto.open) { - int result = hdlc->proto.open(dev); - if (result) - return result; - } - - spin_lock_irq(&hdlc->state_lock); - - if (hdlc->carrier) { - printk(KERN_INFO "%s: Carrier detected\n", dev->name); - __hdlc_set_carrier_on(dev); - } else - printk(KERN_INFO "%s: No carrier\n", dev->name); - - hdlc->open = 1; - - spin_unlock_irq(&hdlc->state_lock); - return 0; -} - - - -/* Must be called by hardware driver when HDLC device is being closed */ -void hdlc_close(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); -#ifdef DEBUG_LINK - printk(KERN_DEBUG "hdlc_close() carrier %i open %i\n", - hdlc->carrier, hdlc->open); -#endif - - spin_lock_irq(&hdlc->state_lock); - - hdlc->open = 0; - if (hdlc->carrier) - __hdlc_set_carrier_off(dev); - - spin_unlock_irq(&hdlc->state_lock); - - if (hdlc->proto.close) - hdlc->proto.close(dev); -} - - - -#ifndef CONFIG_HDLC_RAW -#define hdlc_raw_ioctl(dev, ifr) -ENOSYS -#endif - -#ifndef CONFIG_HDLC_RAW_ETH -#define hdlc_raw_eth_ioctl(dev, ifr) -ENOSYS -#endif - -#ifndef CONFIG_HDLC_PPP -#define hdlc_ppp_ioctl(dev, ifr) -ENOSYS -#endif - -#ifndef CONFIG_HDLC_CISCO -#define hdlc_cisco_ioctl(dev, ifr) -ENOSYS -#endif - -#ifndef CONFIG_HDLC_FR -#define hdlc_fr_ioctl(dev, ifr) -ENOSYS -#endif - -#ifndef CONFIG_HDLC_X25 -#define hdlc_x25_ioctl(dev, ifr) -ENOSYS -#endif - - -int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - unsigned int proto; - - if (cmd != SIOCWANDEV) - return -EINVAL; - - switch(ifr->ifr_settings.type) { - case IF_PROTO_HDLC: - case IF_PROTO_HDLC_ETH: - case IF_PROTO_PPP: - case IF_PROTO_CISCO: - case IF_PROTO_FR: - case IF_PROTO_X25: - proto = ifr->ifr_settings.type; - break; - - default: - proto = hdlc->proto.id; - } - - switch(proto) { - case IF_PROTO_HDLC: return hdlc_raw_ioctl(dev, ifr); - case IF_PROTO_HDLC_ETH: return hdlc_raw_eth_ioctl(dev, ifr); - case IF_PROTO_PPP: return hdlc_ppp_ioctl(dev, ifr); - case IF_PROTO_CISCO: return hdlc_cisco_ioctl(dev, ifr); - case IF_PROTO_FR: return hdlc_fr_ioctl(dev, ifr); - case IF_PROTO_X25: return hdlc_x25_ioctl(dev, ifr); - default: return -EINVAL; - } -} - -static void hdlc_setup(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - - dev->get_stats = hdlc_get_stats; - dev->change_mtu = hdlc_change_mtu; - dev->mtu = HDLC_MAX_MTU; - - dev->type = ARPHRD_RAWHDLC; - dev->hard_header_len = 16; - - dev->flags = IFF_POINTOPOINT | IFF_NOARP; - - hdlc->proto.id = -1; - hdlc->proto.detach = NULL; - hdlc->carrier = 1; - hdlc->open = 0; - spin_lock_init(&hdlc->state_lock); -} - -struct net_device *alloc_hdlcdev(void *priv) -{ - struct net_device *dev; - dev = alloc_netdev(sizeof(hdlc_device), "hdlc%d", hdlc_setup); - if (dev) - dev_to_hdlc(dev)->priv = priv; - return dev; -} - -int register_hdlc_device(struct net_device *dev) -{ - int result = dev_alloc_name(dev, "hdlc%d"); - if (result < 0) - return result; - - result = register_netdev(dev); - if (result != 0) - return -EIO; - -#if 0 - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); /* no carrier until DCD goes up */ -#endif - - return 0; -} - - - -void unregister_hdlc_device(struct net_device *dev) -{ - rtnl_lock(); - hdlc_proto_detach(dev_to_hdlc(dev)); - unregister_netdevice(dev); - rtnl_unlock(); -} - - - -MODULE_AUTHOR("Krzysztof Halasa "); -MODULE_DESCRIPTION("HDLC support module"); -MODULE_LICENSE("GPL v2"); - -EXPORT_SYMBOL(hdlc_open); -EXPORT_SYMBOL(hdlc_close); -EXPORT_SYMBOL(hdlc_set_carrier); -EXPORT_SYMBOL(hdlc_ioctl); -EXPORT_SYMBOL(alloc_hdlcdev); -EXPORT_SYMBOL(register_hdlc_device); -EXPORT_SYMBOL(unregister_hdlc_device); - -static struct packet_type hdlc_packet_type = { - .type = __constant_htons(ETH_P_HDLC), - .func = hdlc_rcv, -}; - - -static int __init hdlc_module_init(void) -{ - printk(KERN_INFO "%s\n", version); - dev_add_pack(&hdlc_packet_type); - return 0; -} - - - -static void __exit hdlc_module_exit(void) -{ - dev_remove_pack(&hdlc_packet_type); -} - - -module_init(hdlc_module_init); -module_exit(hdlc_module_exit); diff --git a/zaptel/kernel/datamods/hdlc_ppp.c b/zaptel/kernel/datamods/hdlc_ppp.c deleted file mode 100644 index b81263ea..00000000 --- a/zaptel/kernel/datamods/hdlc_ppp.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Generic HDLC support routines for Linux - * Point-to-point protocol support - * - * Copyright (C) 1999 - 2003 Krzysztof Halasa - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static int ppp_open(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - void *old_ioctl; - int result; - - dev->priv = &hdlc->state.ppp.syncppp_ptr; - hdlc->state.ppp.syncppp_ptr = &hdlc->state.ppp.pppdev; - hdlc->state.ppp.pppdev.dev = dev; - - old_ioctl = dev->do_ioctl; - hdlc->state.ppp.old_change_mtu = dev->change_mtu; - sppp_attach(&hdlc->state.ppp.pppdev); - /* sppp_attach nukes them. We don't need syncppp's ioctl */ - dev->do_ioctl = old_ioctl; - hdlc->state.ppp.pppdev.sppp.pp_flags &= ~PP_CISCO; - dev->type = ARPHRD_PPP; - result = sppp_open(dev); - if (result) { - sppp_detach(dev); - return result; - } - - return 0; -} - - - -static void ppp_close(struct net_device *dev) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - - sppp_close(dev); - sppp_detach(dev); - dev->rebuild_header = NULL; - dev->change_mtu = hdlc->state.ppp.old_change_mtu; - dev->mtu = HDLC_MAX_MTU; - dev->hard_header_len = 16; -} - - - -static __be16 ppp_type_trans(struct sk_buff *skb, struct net_device *dev) -{ - return __constant_htons(ETH_P_WAN_PPP); -} - - - -int hdlc_ppp_ioctl(struct net_device *dev, struct ifreq *ifr) -{ - hdlc_device *hdlc = dev_to_hdlc(dev); - int result; - - switch (ifr->ifr_settings.type) { - case IF_GET_PROTO: - ifr->ifr_settings.type = IF_PROTO_PPP; - return 0; /* return protocol only, no settable parameters */ - - case IF_PROTO_PPP: - if(!capable(CAP_NET_ADMIN)) - return -EPERM; - - if(dev->flags & IFF_UP) - return -EBUSY; - - /* no settable parameters */ - - result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); - if (result) - return result; - - hdlc_proto_detach(hdlc); - memset(&hdlc->proto, 0, sizeof(hdlc->proto)); - - hdlc->proto.open = ppp_open; - hdlc->proto.close = ppp_close; - hdlc->proto.type_trans = ppp_type_trans; - hdlc->proto.id = IF_PROTO_PPP; - dev->hard_start_xmit = hdlc->xmit; - dev->hard_header = NULL; - dev->type = ARPHRD_PPP; - dev->addr_len = 0; - return 0; - } - - return -EINVAL; -} diff --git a/zaptel/kernel/datamods/hdlc_raw.c b/zaptel/kernel/datamods/hdlc_raw.c deleted file mode 100644 index 9456d31c..00000000 --- a/zaptel/kernel/datamods/hdlc_raw.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Generic HDLC support routines for Linux - * HDLC support - * - * Copyright (C) 1999 - 2003 Krzysztof Halasa - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev) -{ - return __constant_htons(ETH_P_IP); -} - - - -int hdlc_raw_ioctl(struct net_device *dev, struct ifreq *ifr) -{ - raw_hdlc_proto __user *raw_s = ifr->ifr_settings.ifs_ifsu.raw_hdlc; - const size_t size = sizeof(raw_hdlc_proto); - raw_hdlc_proto new_settings; - hdlc_device *hdlc = dev_to_hdlc(dev); - int result; - - switch (ifr->ifr_settings.type) { - case IF_GET_PROTO: - ifr->ifr_settings.type = IF_PROTO_HDLC; - if (ifr->ifr_settings.size < size) { - ifr->ifr_settings.size = size; /* data size wanted */ - return -ENOBUFS; - } - if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size)) - return -EFAULT; - return 0; - - case IF_PROTO_HDLC: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (dev->flags & IFF_UP) - return -EBUSY; - - if (copy_from_user(&new_settings, raw_s, size)) - return -EFAULT; - - if (new_settings.encoding == ENCODING_DEFAULT) - new_settings.encoding = ENCODING_NRZ; - - if (new_settings.parity == PARITY_DEFAULT) - new_settings.parity = PARITY_CRC16_PR1_CCITT; - - result = hdlc->attach(dev, new_settings.encoding, - new_settings.parity); - if (result) - return result; - - hdlc_proto_detach(hdlc); - memcpy(&hdlc->state.raw_hdlc.settings, &new_settings, size); - memset(&hdlc->proto, 0, sizeof(hdlc->proto)); - - hdlc->proto.type_trans = raw_type_trans; - hdlc->proto.id = IF_PROTO_HDLC; - dev->hard_start_xmit = hdlc->xmit; - dev->hard_header = NULL; - dev->type = ARPHRD_RAWHDLC; - dev->flags = IFF_POINTOPOINT | IFF_NOARP; - dev->addr_len = 0; - return 0; - } - - return -EINVAL; -} diff --git a/zaptel/kernel/datamods/hdlc_raw_eth.c b/zaptel/kernel/datamods/hdlc_raw_eth.c deleted file mode 100644 index b1285cc8..00000000 --- a/zaptel/kernel/datamods/hdlc_raw_eth.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Generic HDLC support routines for Linux - * HDLC Ethernet emulation support - * - * Copyright (C) 2002-2003 Krzysztof Halasa - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -static int eth_tx(struct sk_buff *skb, struct net_device *dev) -{ - int pad = ETH_ZLEN - skb->len; - if (pad > 0) { /* Pad the frame with zeros */ - int len = skb->len; - if (skb_tailroom(skb) < pad) - if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC)) { - hdlc_stats(dev)->tx_dropped++; - dev_kfree_skb(skb); - return 0; - } - skb_put(skb, pad); - memset(skb->data + len, 0, pad); - } - return dev_to_hdlc(dev)->xmit(skb, dev); -} - - -int hdlc_raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr) -{ - raw_hdlc_proto __user *raw_s = ifr->ifr_settings.ifs_ifsu.raw_hdlc; - const size_t size = sizeof(raw_hdlc_proto); - raw_hdlc_proto new_settings; - hdlc_device *hdlc = dev_to_hdlc(dev); - int result; - void *old_ch_mtu; - int old_qlen; - - switch (ifr->ifr_settings.type) { - case IF_GET_PROTO: - ifr->ifr_settings.type = IF_PROTO_HDLC_ETH; - if (ifr->ifr_settings.size < size) { - ifr->ifr_settings.size = size; /* data size wanted */ - return -ENOBUFS; - } - if (copy_to_user(raw_s, &hdlc->state.raw_hdlc.settings, size)) - return -EFAULT; - return 0; - - case IF_PROTO_HDLC_ETH: - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (dev->flags & IFF_UP) - return -EBUSY; - - if (copy_from_user(&new_settings, raw_s, size)) - return -EFAULT; - - if (new_settings.encoding == ENCODING_DEFAULT) - new_settings.encoding = ENCODING_NRZ; - - if (new_settings.parity == PARITY_DEFAULT) - new_settings.parity = PARITY_CRC16_PR1_CCITT; - - result = hdlc->attach(dev, new_settings.encoding, - new_settings.parity); - if (result) - return result; - - hdlc_proto_detach(hdlc); - memcpy(&hdlc->state.raw_hdlc.settings, &new_settings, size); - memset(&hdlc->proto, 0, sizeof(hdlc->proto)); - - hdlc->proto.type_trans = eth_type_trans; - hdlc->proto.id = IF_PROTO_HDLC_ETH; - dev->hard_start_xmit = eth_tx; - old_ch_mtu = dev->change_mtu; - old_qlen = dev->tx_queue_len; - ether_setup(dev); - dev->change_mtu = old_ch_mtu; - dev->tx_queue_len = old_qlen; - memcpy(dev->dev_addr, "\x00\x01", 2); - get_random_bytes(dev->dev_addr + 2, ETH_ALEN - 2); - return 0; - } - - return -EINVAL; -} diff --git a/zaptel/kernel/datamods/syncppp.c b/zaptel/kernel/datamods/syncppp.c deleted file mode 100644 index 69d3c926..00000000 --- a/zaptel/kernel/datamods/syncppp.c +++ /dev/null @@ -1,1485 +0,0 @@ -/* - * NET3: A (fairly minimal) implementation of synchronous PPP for Linux - * as well as a CISCO HDLC implementation. See the copyright - * message below for the original source. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the license, or (at your option) any later version. - * - * Note however. This code is also used in a different form by FreeBSD. - * Therefore when making any non OS specific change please consider - * contributing it back to the original author under the terms - * below in addition. - * -- Alan - * - * Port for Linux-2.1 by Jan "Yenya" Kasprzak - */ - -/* - * Synchronous PPP/Cisco link level subroutines. - * Keepalive protocol implemented in both Cisco and PPP modes. - * - * Copyright (C) 1994 Cronyx Ltd. - * Author: Serge Vakulenko, - * - * This software is distributed with NO WARRANTIES, not even the implied - * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Authors grant any other persons or organisations permission to use - * or modify this software as long as this message is kept with the software, - * all derivative works or modified versions. - * - * Version 1.9, Wed Oct 4 18:58:15 MSK 1995 - * - * $Id: syncppp.c 3793 2008-02-04 23:00:48Z tzafrir $ - */ -#undef DEBUG - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#define MAXALIVECNT 6 /* max. alive packets */ - -#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ -#define PPP_UI 0x03 /* Unnumbered Information */ -#define PPP_IP 0x0021 /* Internet Protocol */ -#define PPP_ISO 0x0023 /* ISO OSI Protocol */ -#define PPP_XNS 0x0025 /* Xerox NS Protocol */ -#define PPP_IPX 0x002b /* Novell IPX Protocol */ -#define PPP_LCP 0xc021 /* Link Control Protocol */ -#define PPP_IPCP 0x8021 /* Internet Protocol Control Protocol */ - -#define LCP_CONF_REQ 1 /* PPP LCP configure request */ -#define LCP_CONF_ACK 2 /* PPP LCP configure acknowledge */ -#define LCP_CONF_NAK 3 /* PPP LCP configure negative ack */ -#define LCP_CONF_REJ 4 /* PPP LCP configure reject */ -#define LCP_TERM_REQ 5 /* PPP LCP terminate request */ -#define LCP_TERM_ACK 6 /* PPP LCP terminate acknowledge */ -#define LCP_CODE_REJ 7 /* PPP LCP code reject */ -#define LCP_PROTO_REJ 8 /* PPP LCP protocol reject */ -#define LCP_ECHO_REQ 9 /* PPP LCP echo request */ -#define LCP_ECHO_REPLY 10 /* PPP LCP echo reply */ -#define LCP_DISC_REQ 11 /* PPP LCP discard request */ - -#define LCP_OPT_MRU 1 /* maximum receive unit */ -#define LCP_OPT_ASYNC_MAP 2 /* async control character map */ -#define LCP_OPT_AUTH_PROTO 3 /* authentication protocol */ -#define LCP_OPT_QUAL_PROTO 4 /* quality protocol */ -#define LCP_OPT_MAGIC 5 /* magic number */ -#define LCP_OPT_RESERVED 6 /* reserved */ -#define LCP_OPT_PROTO_COMP 7 /* protocol field compression */ -#define LCP_OPT_ADDR_COMP 8 /* address/control field compression */ - -#define IPCP_CONF_REQ LCP_CONF_REQ /* PPP IPCP configure request */ -#define IPCP_CONF_ACK LCP_CONF_ACK /* PPP IPCP configure acknowledge */ -#define IPCP_CONF_NAK LCP_CONF_NAK /* PPP IPCP configure negative ack */ -#define IPCP_CONF_REJ LCP_CONF_REJ /* PPP IPCP configure reject */ -#define IPCP_TERM_REQ LCP_TERM_REQ /* PPP IPCP terminate request */ -#define IPCP_TERM_ACK LCP_TERM_ACK /* PPP IPCP terminate acknowledge */ -#define IPCP_CODE_REJ LCP_CODE_REJ /* PPP IPCP code reject */ - -#define CISCO_MULTICAST 0x8f /* Cisco multicast address */ -#define CISCO_UNICAST 0x0f /* Cisco unicast address */ -#define CISCO_KEEPALIVE 0x8035 /* Cisco keepalive protocol */ -#define CISCO_ADDR_REQ 0 /* Cisco address request */ -#define CISCO_ADDR_REPLY 1 /* Cisco address reply */ -#define CISCO_KEEPALIVE_REQ 2 /* Cisco keepalive request */ - -struct ppp_header { - u8 address; - u8 control; - u16 protocol; -}; -#define PPP_HEADER_LEN sizeof (struct ppp_header) - -struct lcp_header { - u8 type; - u8 ident; - u16 len; -}; -#define LCP_HEADER_LEN sizeof (struct lcp_header) - -struct cisco_packet { - u32 type; - u32 par1; - u32 par2; - u16 rel; - u16 time0; - u16 time1; -}; -#define CISCO_PACKET_LEN 18 -#define CISCO_BIG_PACKET_LEN 20 - -static struct sppp *spppq; -static struct timer_list sppp_keepalive_timer; -static DEFINE_SPINLOCK(spppq_lock); - -/* global xmit queue for sending packets while spinlock is held */ -static struct sk_buff_head tx_queue; - -static void sppp_keepalive (unsigned long dummy); -static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, - u8 ident, u16 len, void *data); -static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2); -static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); -static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); -static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); -static void sppp_lcp_open (struct sppp *sp); -static void sppp_ipcp_open (struct sppp *sp); -static int sppp_lcp_conf_parse_options (struct sppp *sp, struct lcp_header *h, - int len, u32 *magic); -static void sppp_cp_timeout (unsigned long arg); -static char *sppp_lcp_type_name (u8 type); -static char *sppp_ipcp_type_name (u8 type); -static void sppp_print_bytes (u8 *p, u16 len); - -static int debug; - -/* Flush global outgoing packet queue to dev_queue_xmit(). - * - * dev_queue_xmit() must be called with interrupts enabled - * which means it can't be called with spinlocks held. - * If a packet needs to be sent while a spinlock is held, - * then put the packet into tx_queue, and call sppp_flush_xmit() - * after spinlock is released. - */ -static void sppp_flush_xmit(void) -{ - struct sk_buff *skb; - while ((skb = skb_dequeue(&tx_queue)) != NULL) - dev_queue_xmit(skb); -} - -/* - * Interface down stub - */ - -static void if_down(struct net_device *dev) -{ - struct sppp *sp = (struct sppp *)sppp_of(dev); - - sp->pp_link_state=SPPP_LINK_DOWN; -} - -/* - * Timeout routine activations. - */ - -static void sppp_set_timeout(struct sppp *p,int s) -{ - if (! (p->pp_flags & PP_TIMO)) - { - init_timer(&p->pp_timer); - p->pp_timer.function=sppp_cp_timeout; - p->pp_timer.expires=jiffies+s*HZ; - p->pp_timer.data=(unsigned long)p; - p->pp_flags |= PP_TIMO; - add_timer(&p->pp_timer); - } -} - -static void sppp_clear_timeout(struct sppp *p) -{ - if (p->pp_flags & PP_TIMO) - { - del_timer(&p->pp_timer); - p->pp_flags &= ~PP_TIMO; - } -} - -/** - * sppp_input - receive and process a WAN PPP frame - * @skb: The buffer to process - * @dev: The device it arrived on - * - * This can be called directly by cards that do not have - * timing constraints but is normally called from the network layer - * after interrupt servicing to process frames queued via netif_rx(). - * - * We process the options in the card. If the frame is destined for - * the protocol stacks then it requeues the frame for the upper level - * protocol. If it is a control from it is processed and discarded - * here. - */ - -static void sppp_input (struct net_device *dev, struct sk_buff *skb) -{ - struct ppp_header *h; - struct sppp *sp = (struct sppp *)sppp_of(dev); - unsigned long flags; - - skb->dev=dev; - skb->mac.raw=skb->data; - - if (dev->flags & IFF_RUNNING) - { - /* Count received bytes, add FCS and one flag */ - sp->ibytes+= skb->len + 3; - sp->ipkts++; - } - - if (!pskb_may_pull(skb, PPP_HEADER_LEN)) { - /* Too small packet, drop it. */ - if (sp->pp_flags & PP_DEBUG) - printk (KERN_DEBUG "%s: input packet is too small, %d bytes\n", - dev->name, skb->len); - kfree_skb(skb); - return; - } - - /* Get PPP header. */ - h = (struct ppp_header *)skb->data; - skb_pull(skb,sizeof(struct ppp_header)); - - spin_lock_irqsave(&sp->lock, flags); - - switch (h->address) { - default: /* Invalid PPP packet. */ - goto invalid; - case PPP_ALLSTATIONS: - if (h->control != PPP_UI) - goto invalid; - if (sp->pp_flags & PP_CISCO) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: PPP packet in Cisco mode <0x%x 0x%x 0x%x>\n", - dev->name, - h->address, h->control, ntohs (h->protocol)); - goto drop; - } - switch (ntohs (h->protocol)) { - default: - if (sp->lcp.state == LCP_STATE_OPENED) - sppp_cp_send (sp, PPP_LCP, LCP_PROTO_REJ, - ++sp->pp_seq, skb->len + 2, - &h->protocol); - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid input protocol <0x%x 0x%x 0x%x>\n", - dev->name, - h->address, h->control, ntohs (h->protocol)); - goto drop; - case PPP_LCP: - sppp_lcp_input (sp, skb); - goto drop; - case PPP_IPCP: - if (sp->lcp.state == LCP_STATE_OPENED) - sppp_ipcp_input (sp, skb); - else - printk(KERN_DEBUG "IPCP when still waiting LCP finish.\n"); - goto drop; - case PPP_IP: - if (sp->ipcp.state == IPCP_STATE_OPENED) { - if(sp->pp_flags&PP_DEBUG) - printk(KERN_DEBUG "Yow an IP frame.\n"); - skb->protocol=htons(ETH_P_IP); - netif_rx(skb); - dev->last_rx = jiffies; - goto done; - } - break; -#ifdef IPX - case PPP_IPX: - /* IPX IPXCP not implemented yet */ - if (sp->lcp.state == LCP_STATE_OPENED) { - skb->protocol=htons(ETH_P_IPX); - netif_rx(skb); - dev->last_rx = jiffies; - goto done; - } - break; -#endif - } - break; - case CISCO_MULTICAST: - case CISCO_UNICAST: - /* Don't check the control field here (RFC 1547). */ - if (! (sp->pp_flags & PP_CISCO)) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: Cisco packet in PPP mode <0x%x 0x%x 0x%x>\n", - dev->name, - h->address, h->control, ntohs (h->protocol)); - goto drop; - } - switch (ntohs (h->protocol)) { - default: - goto invalid; - case CISCO_KEEPALIVE: - sppp_cisco_input (sp, skb); - goto drop; -#ifdef CONFIG_INET - case ETH_P_IP: - skb->protocol=htons(ETH_P_IP); - netif_rx(skb); - dev->last_rx = jiffies; - goto done; -#endif -#ifdef CONFIG_IPX - case ETH_P_IPX: - skb->protocol=htons(ETH_P_IPX); - netif_rx(skb); - dev->last_rx = jiffies; - goto done; -#endif - } - break; - } - goto drop; - -invalid: - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid input packet <0x%x 0x%x 0x%x>\n", - dev->name, h->address, h->control, ntohs (h->protocol)); -drop: - kfree_skb(skb); -done: - spin_unlock_irqrestore(&sp->lock, flags); - sppp_flush_xmit(); - return; -} - -/* - * Handle transmit packets. - */ - -static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 type, - void *daddr, void *saddr, unsigned int len) -{ - struct sppp *sp = (struct sppp *)sppp_of(dev); - struct ppp_header *h; - skb_push(skb,sizeof(struct ppp_header)); - h=(struct ppp_header *)skb->data; - if(sp->pp_flags&PP_CISCO) - { - h->address = CISCO_UNICAST; - h->control = 0; - } - else - { - h->address = PPP_ALLSTATIONS; - h->control = PPP_UI; - } - if(sp->pp_flags & PP_CISCO) - { - h->protocol = htons(type); - } - else switch(type) - { - case ETH_P_IP: - h->protocol = htons(PPP_IP); - break; - case ETH_P_IPX: - h->protocol = htons(PPP_IPX); - break; - } - return sizeof(struct ppp_header); -} - -static int sppp_rebuild_header(struct sk_buff *skb) -{ - return 0; -} - -/* - * Send keepalive packets, every 10 seconds. - */ - -static void sppp_keepalive (unsigned long dummy) -{ - struct sppp *sp; - unsigned long flags; - - spin_lock_irqsave(&spppq_lock, flags); - - for (sp=spppq; sp; sp=sp->pp_next) - { - struct net_device *dev = sp->pp_if; - - /* Keepalive mode disabled or channel down? */ - if (! (sp->pp_flags & PP_KEEPALIVE) || - ! (dev->flags & IFF_UP)) - continue; - - spin_lock(&sp->lock); - - /* No keepalive in PPP mode if LCP not opened yet. */ - if (! (sp->pp_flags & PP_CISCO) && - sp->lcp.state != LCP_STATE_OPENED) { - spin_unlock(&sp->lock); - continue; - } - - if (sp->pp_alivecnt == MAXALIVECNT) { - /* No keepalive packets got. Stop the interface. */ - printk (KERN_WARNING "%s: protocol down\n", dev->name); - if_down (dev); - if (! (sp->pp_flags & PP_CISCO)) { - /* Shut down the PPP link. */ - sp->lcp.magic = jiffies; - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - sppp_clear_timeout (sp); - /* Initiate negotiation. */ - sppp_lcp_open (sp); - } - } - if (sp->pp_alivecnt <= MAXALIVECNT) - ++sp->pp_alivecnt; - if (sp->pp_flags & PP_CISCO) - sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, - sp->pp_rseq); - else if (sp->lcp.state == LCP_STATE_OPENED) { - long nmagic = htonl (sp->lcp.magic); - sp->lcp.echoid = ++sp->pp_seq; - sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, - sp->lcp.echoid, 4, &nmagic); - } - - spin_unlock(&sp->lock); - } - spin_unlock_irqrestore(&spppq_lock, flags); - sppp_flush_xmit(); - sppp_keepalive_timer.expires=jiffies+10*HZ; - add_timer(&sppp_keepalive_timer); -} - -/* - * Handle incoming PPP Link Control Protocol packets. - */ - -static void sppp_lcp_input (struct sppp *sp, struct sk_buff *skb) -{ - struct lcp_header *h; - struct net_device *dev = sp->pp_if; - int len = skb->len; - u8 *p, opt[6]; - u32 rmagic; - - if (!pskb_may_pull(skb, sizeof(struct lcp_header))) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid lcp packet length: %d bytes\n", - dev->name, len); - return; - } - h = (struct lcp_header *)skb->data; - skb_pull(skb,sizeof(struct lcp_header *)); - - if (sp->pp_flags & PP_DEBUG) - { - char state = '?'; - switch (sp->lcp.state) { - case LCP_STATE_CLOSED: state = 'C'; break; - case LCP_STATE_ACK_RCVD: state = 'R'; break; - case LCP_STATE_ACK_SENT: state = 'S'; break; - case LCP_STATE_OPENED: state = 'O'; break; - } - printk (KERN_WARNING "%s: lcp input(%c): %d bytes <%s id=%xh len=%xh", - dev->name, state, len, - sppp_lcp_type_name (h->type), h->ident, ntohs (h->len)); - if (len > 4) - sppp_print_bytes ((u8*) (h+1), len-4); - printk (">\n"); - } - if (len > ntohs (h->len)) - len = ntohs (h->len); - switch (h->type) { - default: - /* Unknown packet type -- send Code-Reject packet. */ - sppp_cp_send (sp, PPP_LCP, LCP_CODE_REJ, ++sp->pp_seq, - skb->len, h); - break; - case LCP_CONF_REQ: - if (len < 4) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_DEBUG"%s: invalid lcp configure request packet length: %d bytes\n", - dev->name, len); - break; - } - if (len>4 && !sppp_lcp_conf_parse_options (sp, h, len, &rmagic)) - goto badreq; - if (rmagic == sp->lcp.magic) { - /* Local and remote magics equal -- loopback? */ - if (sp->pp_loopcnt >= MAXALIVECNT*5) { - printk (KERN_WARNING "%s: loopback\n", - dev->name); - sp->pp_loopcnt = 0; - if (dev->flags & IFF_UP) { - if_down (dev); - } - } else if (sp->pp_flags & PP_DEBUG) - printk (KERN_DEBUG "%s: conf req: magic glitch\n", - dev->name); - ++sp->pp_loopcnt; - - /* MUST send Conf-Nack packet. */ - rmagic = ~sp->lcp.magic; - opt[0] = LCP_OPT_MAGIC; - opt[1] = sizeof (opt); - opt[2] = rmagic >> 24; - opt[3] = rmagic >> 16; - opt[4] = rmagic >> 8; - opt[5] = rmagic; - sppp_cp_send (sp, PPP_LCP, LCP_CONF_NAK, - h->ident, sizeof (opt), &opt); -badreq: - switch (sp->lcp.state) { - case LCP_STATE_OPENED: - /* Initiate renegotiation. */ - sppp_lcp_open (sp); - /* fall through... */ - case LCP_STATE_ACK_SENT: - /* Go to closed state. */ - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - } - break; - } - /* Send Configure-Ack packet. */ - sp->pp_loopcnt = 0; - if (sp->lcp.state != LCP_STATE_OPENED) { - sppp_cp_send (sp, PPP_LCP, LCP_CONF_ACK, - h->ident, len-4, h+1); - } - /* Change the state. */ - switch (sp->lcp.state) { - case LCP_STATE_CLOSED: - sp->lcp.state = LCP_STATE_ACK_SENT; - break; - case LCP_STATE_ACK_RCVD: - sp->lcp.state = LCP_STATE_OPENED; - sppp_ipcp_open (sp); - break; - case LCP_STATE_OPENED: - /* Remote magic changed -- close session. */ - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - /* Initiate renegotiation. */ - sppp_lcp_open (sp); - /* Send ACK after our REQ in attempt to break loop */ - sppp_cp_send (sp, PPP_LCP, LCP_CONF_ACK, - h->ident, len-4, h+1); - sp->lcp.state = LCP_STATE_ACK_SENT; - break; - } - break; - case LCP_CONF_ACK: - if (h->ident != sp->lcp.confid) - break; - sppp_clear_timeout (sp); - if ((sp->pp_link_state != SPPP_LINK_UP) && - (dev->flags & IFF_UP)) { - /* Coming out of loopback mode. */ - sp->pp_link_state=SPPP_LINK_UP; - printk (KERN_INFO "%s: protocol up\n", dev->name); - } - switch (sp->lcp.state) { - case LCP_STATE_CLOSED: - sp->lcp.state = LCP_STATE_ACK_RCVD; - sppp_set_timeout (sp, 5); - break; - case LCP_STATE_ACK_SENT: - sp->lcp.state = LCP_STATE_OPENED; - sppp_ipcp_open (sp); - break; - } - break; - case LCP_CONF_NAK: - if (h->ident != sp->lcp.confid) - break; - p = (u8*) (h+1); - if (len>=10 && p[0] == LCP_OPT_MAGIC && p[1] >= 4) { - rmagic = (u32)p[2] << 24 | - (u32)p[3] << 16 | p[4] << 8 | p[5]; - if (rmagic == ~sp->lcp.magic) { - int newmagic; - if (sp->pp_flags & PP_DEBUG) - printk (KERN_DEBUG "%s: conf nak: magic glitch\n", - dev->name); - get_random_bytes(&newmagic, sizeof(newmagic)); - sp->lcp.magic += newmagic; - } else - sp->lcp.magic = rmagic; - } - if (sp->lcp.state != LCP_STATE_ACK_SENT) { - /* Go to closed state. */ - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - } - /* The link will be renegotiated after timeout, - * to avoid endless req-nack loop. */ - sppp_clear_timeout (sp); - sppp_set_timeout (sp, 2); - break; - case LCP_CONF_REJ: - if (h->ident != sp->lcp.confid) - break; - sppp_clear_timeout (sp); - /* Initiate renegotiation. */ - sppp_lcp_open (sp); - if (sp->lcp.state != LCP_STATE_ACK_SENT) { - /* Go to closed state. */ - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - } - break; - case LCP_TERM_REQ: - sppp_clear_timeout (sp); - /* Send Terminate-Ack packet. */ - sppp_cp_send (sp, PPP_LCP, LCP_TERM_ACK, h->ident, 0, NULL); - /* Go to closed state. */ - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - /* Initiate renegotiation. */ - sppp_lcp_open (sp); - break; - case LCP_TERM_ACK: - case LCP_CODE_REJ: - case LCP_PROTO_REJ: - /* Ignore for now. */ - break; - case LCP_DISC_REQ: - /* Discard the packet. */ - break; - case LCP_ECHO_REQ: - if (sp->lcp.state != LCP_STATE_OPENED) - break; - if (len < 8) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid lcp echo request packet length: %d bytes\n", - dev->name, len); - break; - } - if (ntohl (*(long*)(h+1)) == sp->lcp.magic) { - /* Line loopback mode detected. */ - printk (KERN_WARNING "%s: loopback\n", dev->name); - if_down (dev); - - /* Shut down the PPP link. */ - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - sppp_clear_timeout (sp); - /* Initiate negotiation. */ - sppp_lcp_open (sp); - break; - } - *(long*)(h+1) = htonl (sp->lcp.magic); - sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); - break; - case LCP_ECHO_REPLY: - if (h->ident != sp->lcp.echoid) - break; - if (len < 8) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid lcp echo reply packet length: %d bytes\n", - dev->name, len); - break; - } - if (ntohl (*(long*)(h+1)) != sp->lcp.magic) - sp->pp_alivecnt = 0; - break; - } -} - -/* - * Handle incoming Cisco keepalive protocol packets. - */ - -static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb) -{ - struct cisco_packet *h; - struct net_device *dev = sp->pp_if; - - if (!pskb_may_pull(skb, sizeof(struct cisco_packet)) - || (skb->len != CISCO_PACKET_LEN - && skb->len != CISCO_BIG_PACKET_LEN)) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid cisco packet length: %d bytes\n", - dev->name, skb->len); - return; - } - h = (struct cisco_packet *)skb->data; - skb_pull(skb, sizeof(struct cisco_packet*)); - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: cisco input: %d bytes <%xh %xh %xh %xh %xh-%xh>\n", - dev->name, skb->len, - ntohl (h->type), h->par1, h->par2, h->rel, - h->time0, h->time1); - switch (ntohl (h->type)) { - default: - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: unknown cisco packet type: 0x%x\n", - dev->name, ntohl (h->type)); - break; - case CISCO_ADDR_REPLY: - /* Reply on address request, ignore */ - break; - case CISCO_KEEPALIVE_REQ: - sp->pp_alivecnt = 0; - sp->pp_rseq = ntohl (h->par1); - if (sp->pp_seq == sp->pp_rseq) { - /* Local and remote sequence numbers are equal. - * Probably, the line is in loopback mode. */ - int newseq; - if (sp->pp_loopcnt >= MAXALIVECNT) { - printk (KERN_WARNING "%s: loopback\n", - dev->name); - sp->pp_loopcnt = 0; - if (dev->flags & IFF_UP) { - if_down (dev); - } - } - ++sp->pp_loopcnt; - - /* Generate new local sequence number */ - get_random_bytes(&newseq, sizeof(newseq)); - sp->pp_seq ^= newseq; - break; - } - sp->pp_loopcnt = 0; - if (sp->pp_link_state==SPPP_LINK_DOWN && - (dev->flags & IFF_UP)) { - sp->pp_link_state=SPPP_LINK_UP; - printk (KERN_INFO "%s: protocol up\n", dev->name); - } - break; - case CISCO_ADDR_REQ: - /* Stolen from net/ipv4/devinet.c -- SIOCGIFADDR ioctl */ - { - struct in_device *in_dev; - struct in_ifaddr *ifa; - u32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ -#ifdef CONFIG_INET - rcu_read_lock(); - if ((in_dev = __in_dev_get_rcu(dev)) != NULL) - { - for (ifa=in_dev->ifa_list; ifa != NULL; - ifa=ifa->ifa_next) { - if (strcmp(dev->name, ifa->ifa_label) == 0) - { - addr = ifa->ifa_local; - mask = ifa->ifa_mask; - break; - } - } - } - rcu_read_unlock(); -#endif - /* I hope both addr and mask are in the net order */ - sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask); - break; - } - } -} - - -/* - * Send PPP LCP packet. - */ - -static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, - u8 ident, u16 len, void *data) -{ - struct ppp_header *h; - struct lcp_header *lh; - struct sk_buff *skb; - struct net_device *dev = sp->pp_if; - - skb=alloc_skb(dev->hard_header_len+PPP_HEADER_LEN+LCP_HEADER_LEN+len, - GFP_ATOMIC); - if (skb==NULL) - return; - - skb_reserve(skb,dev->hard_header_len); - - h = (struct ppp_header *)skb_put(skb, sizeof(struct ppp_header)); - h->address = PPP_ALLSTATIONS; /* broadcast address */ - h->control = PPP_UI; /* Unnumbered Info */ - h->protocol = htons (proto); /* Link Control Protocol */ - - lh = (struct lcp_header *)skb_put(skb, sizeof(struct lcp_header)); - lh->type = type; - lh->ident = ident; - lh->len = htons (LCP_HEADER_LEN + len); - - if (len) - memcpy(skb_put(skb,len),data, len); - - if (sp->pp_flags & PP_DEBUG) { - printk (KERN_WARNING "%s: %s output <%s id=%xh len=%xh", - dev->name, - proto==PPP_LCP ? "lcp" : "ipcp", - proto==PPP_LCP ? sppp_lcp_type_name (lh->type) : - sppp_ipcp_type_name (lh->type), lh->ident, - ntohs (lh->len)); - if (len) - sppp_print_bytes ((u8*) (lh+1), len); - printk (">\n"); - } - sp->obytes += skb->len; - /* Control is high priority so it doesn't get queued behind data */ - skb->priority=TC_PRIO_CONTROL; - skb->dev = dev; - skb_queue_tail(&tx_queue, skb); -} - -/* - * Send Cisco keepalive packet. - */ - -static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) -{ - struct ppp_header *h; - struct cisco_packet *ch; - struct sk_buff *skb; - struct net_device *dev = sp->pp_if; - u32 t = jiffies * 1000/HZ; - - skb=alloc_skb(dev->hard_header_len+PPP_HEADER_LEN+CISCO_PACKET_LEN, - GFP_ATOMIC); - - if(skb==NULL) - return; - - skb_reserve(skb, dev->hard_header_len); - h = (struct ppp_header *)skb_put (skb, sizeof(struct ppp_header)); - h->address = CISCO_MULTICAST; - h->control = 0; - h->protocol = htons (CISCO_KEEPALIVE); - - ch = (struct cisco_packet*)skb_put(skb, CISCO_PACKET_LEN); - ch->type = htonl (type); - ch->par1 = htonl (par1); - ch->par2 = htonl (par2); - ch->rel = -1; - ch->time0 = htons ((u16) (t >> 16)); - ch->time1 = htons ((u16) t); - - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: cisco output: <%xh %xh %xh %xh %xh-%xh>\n", - dev->name, ntohl (ch->type), ch->par1, - ch->par2, ch->rel, ch->time0, ch->time1); - sp->obytes += skb->len; - skb->priority=TC_PRIO_CONTROL; - skb->dev = dev; - skb_queue_tail(&tx_queue, skb); -} - -/** - * sppp_close - close down a synchronous PPP or Cisco HDLC link - * @dev: The network device to drop the link of - * - * This drops the logical interface to the channel. It is not - * done politely as we assume we will also be dropping DTR. Any - * timeouts are killed. - */ - -int sppp_close (struct net_device *dev) -{ - struct sppp *sp = (struct sppp *)sppp_of(dev); - unsigned long flags; - - spin_lock_irqsave(&sp->lock, flags); - sp->pp_link_state = SPPP_LINK_DOWN; - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - sppp_clear_timeout (sp); - spin_unlock_irqrestore(&sp->lock, flags); - - return 0; -} - -EXPORT_SYMBOL(sppp_close); - -/** - * sppp_open - open a synchronous PPP or Cisco HDLC link - * @dev: Network device to activate - * - * Close down any existing synchronous session and commence - * from scratch. In the PPP case this means negotiating LCP/IPCP - * and friends, while for Cisco HDLC we simply need to start sending - * keepalives - */ - -int sppp_open (struct net_device *dev) -{ - struct sppp *sp = (struct sppp *)sppp_of(dev); - unsigned long flags; - - sppp_close(dev); - - spin_lock_irqsave(&sp->lock, flags); - if (!(sp->pp_flags & PP_CISCO)) { - sppp_lcp_open (sp); - } - sp->pp_link_state = SPPP_LINK_DOWN; - spin_unlock_irqrestore(&sp->lock, flags); - sppp_flush_xmit(); - - return 0; -} - -EXPORT_SYMBOL(sppp_open); - -/** - * sppp_reopen - notify of physical link loss - * @dev: Device that lost the link - * - * This function informs the synchronous protocol code that - * the underlying link died (for example a carrier drop on X.21) - * - * We increment the magic numbers to ensure that if the other end - * failed to notice we will correctly start a new session. It happens - * do to the nature of telco circuits is that you can lose carrier on - * one endonly. - * - * Having done this we go back to negotiating. This function may - * be called from an interrupt context. - */ - -int sppp_reopen (struct net_device *dev) -{ - struct sppp *sp = (struct sppp *)sppp_of(dev); - unsigned long flags; - - sppp_close(dev); - - spin_lock_irqsave(&sp->lock, flags); - if (!(sp->pp_flags & PP_CISCO)) - { - sp->lcp.magic = jiffies; - ++sp->pp_seq; - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - /* Give it a moment for the line to settle then go */ - sppp_set_timeout (sp, 1); - } - sp->pp_link_state=SPPP_LINK_DOWN; - spin_unlock_irqrestore(&sp->lock, flags); - - return 0; -} - -EXPORT_SYMBOL(sppp_reopen); - -/** - * sppp_change_mtu - Change the link MTU - * @dev: Device to change MTU on - * @new_mtu: New MTU - * - * Change the MTU on the link. This can only be called with - * the link down. It returns an error if the link is up or - * the mtu is out of range. - */ - -static int sppp_change_mtu(struct net_device *dev, int new_mtu) -{ - if(new_mtu<128||new_mtu>PPP_MTU||(dev->flags&IFF_UP)) - return -EINVAL; - dev->mtu=new_mtu; - return 0; -} - -/** - * sppp_do_ioctl - Ioctl handler for ppp/hdlc - * @dev: Device subject to ioctl - * @ifr: Interface request block from the user - * @cmd: Command that is being issued - * - * This function handles the ioctls that may be issued by the user - * to control the settings of a PPP/HDLC link. It does both busy - * and security checks. This function is intended to be wrapped by - * callers who wish to add additional ioctl calls of their own. - */ - -int sppp_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - struct sppp *sp = (struct sppp *)sppp_of(dev); - - if(dev->flags&IFF_UP) - return -EBUSY; - - if(!capable(CAP_NET_ADMIN)) - return -EPERM; - - switch(cmd) - { - case SPPPIOCCISCO: - sp->pp_flags|=PP_CISCO; - dev->type = ARPHRD_HDLC; - break; - case SPPPIOCPPP: - sp->pp_flags&=~PP_CISCO; - dev->type = ARPHRD_PPP; - break; - case SPPPIOCDEBUG: - sp->pp_flags&=~PP_DEBUG; - if(ifr->ifr_flags) - sp->pp_flags|=PP_DEBUG; - break; - case SPPPIOCGFLAGS: - if(copy_to_user(ifr->ifr_data, &sp->pp_flags, sizeof(sp->pp_flags))) - return -EFAULT; - break; - case SPPPIOCSFLAGS: - if(copy_from_user(&sp->pp_flags, ifr->ifr_data, sizeof(sp->pp_flags))) - return -EFAULT; - break; - default: - return -EINVAL; - } - return 0; -} - -EXPORT_SYMBOL(sppp_do_ioctl); - -/** - * sppp_attach - attach synchronous PPP/HDLC to a device - * @pd: PPP device to initialise - * - * This initialises the PPP/HDLC support on an interface. At the - * time of calling the dev element must point to the network device - * that this interface is attached to. The interface should not yet - * be registered. - */ - -void sppp_attach(struct ppp_device *pd) -{ - struct net_device *dev = pd->dev; - struct sppp *sp = &pd->sppp; - unsigned long flags; - - /* Make sure embedding is safe for sppp_of */ - BUG_ON(sppp_of(dev) != sp); - - spin_lock_irqsave(&spppq_lock, flags); - /* Initialize keepalive handler. */ - if (! spppq) - { - init_timer(&sppp_keepalive_timer); - sppp_keepalive_timer.expires=jiffies+10*HZ; - sppp_keepalive_timer.function=sppp_keepalive; - add_timer(&sppp_keepalive_timer); - } - /* Insert new entry into the keepalive list. */ - sp->pp_next = spppq; - spppq = sp; - spin_unlock_irqrestore(&spppq_lock, flags); - - sp->pp_loopcnt = 0; - sp->pp_alivecnt = 0; - sp->pp_seq = 0; - sp->pp_rseq = 0; - sp->pp_flags = PP_KEEPALIVE|PP_CISCO|debug;/*PP_DEBUG;*/ - sp->lcp.magic = 0; - sp->lcp.state = LCP_STATE_CLOSED; - sp->ipcp.state = IPCP_STATE_CLOSED; - sp->pp_if = dev; - spin_lock_init(&sp->lock); - - /* - * Device specific setup. All but interrupt handler and - * hard_start_xmit. - */ - - dev->hard_header = sppp_hard_header; - dev->rebuild_header = sppp_rebuild_header; - dev->tx_queue_len = 10; - dev->type = ARPHRD_HDLC; - dev->addr_len = 0; - dev->hard_header_len = sizeof(struct ppp_header); - dev->mtu = PPP_MTU; - /* - * These 4 are callers but MUST also call sppp_ functions - */ - dev->do_ioctl = sppp_do_ioctl; -#if 0 - dev->get_stats = NULL; /* Let the driver override these */ - dev->open = sppp_open; - dev->stop = sppp_close; -#endif - dev->change_mtu = sppp_change_mtu; - dev->hard_header_cache = NULL; - dev->header_cache_update = NULL; - dev->flags = IFF_MULTICAST|IFF_POINTOPOINT|IFF_NOARP; -} - -EXPORT_SYMBOL(sppp_attach); - -/** - * sppp_detach - release PPP resources from a device - * @dev: Network device to release - * - * Stop and free up any PPP/HDLC resources used by this - * interface. This must be called before the device is - * freed. - */ - -void sppp_detach (struct net_device *dev) -{ - struct sppp **q, *p, *sp = (struct sppp *)sppp_of(dev); - unsigned long flags; - - spin_lock_irqsave(&spppq_lock, flags); - /* Remove the entry from the keepalive list. */ - for (q = &spppq; (p = *q); q = &p->pp_next) - if (p == sp) { - *q = p->pp_next; - break; - } - - /* Stop keepalive handler. */ - if (! spppq) - del_timer(&sppp_keepalive_timer); - sppp_clear_timeout (sp); - spin_unlock_irqrestore(&spppq_lock, flags); -} - -EXPORT_SYMBOL(sppp_detach); - -/* - * Analyze the LCP Configure-Request options list - * for the presence of unknown options. - * If the request contains unknown options, build and - * send Configure-reject packet, containing only unknown options. - */ -static int -sppp_lcp_conf_parse_options (struct sppp *sp, struct lcp_header *h, - int len, u32 *magic) -{ - u8 *buf, *r, *p; - int rlen; - - len -= 4; - buf = r = kmalloc (len, GFP_ATOMIC); - if (! buf) - return (0); - - p = (void*) (h+1); - for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { - switch (*p) { - case LCP_OPT_MAGIC: - /* Magic number -- extract. */ - if (len >= 6 && p[1] == 6) { - *magic = (u32)p[2] << 24 | - (u32)p[3] << 16 | p[4] << 8 | p[5]; - continue; - } - break; - case LCP_OPT_ASYNC_MAP: - /* Async control character map -- check to be zero. */ - if (len >= 6 && p[1] == 6 && ! p[2] && ! p[3] && - ! p[4] && ! p[5]) - continue; - break; - case LCP_OPT_MRU: - /* Maximum receive unit -- always OK. */ - continue; - default: - /* Others not supported. */ - break; - } - /* Add the option to rejected list. */ - memcpy(r, p, p[1]); - r += p[1]; - rlen += p[1]; - } - if (rlen) - sppp_cp_send (sp, PPP_LCP, LCP_CONF_REJ, h->ident, rlen, buf); - kfree(buf); - return (rlen == 0); -} - -static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *skb) -{ - struct lcp_header *h; - struct net_device *dev = sp->pp_if; - int len = skb->len; - - if (!pskb_may_pull(skb, sizeof(struct lcp_header))) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid ipcp packet length: %d bytes\n", - dev->name, len); - return; - } - h = (struct lcp_header *)skb->data; - skb_pull(skb,sizeof(struct lcp_header)); - if (sp->pp_flags & PP_DEBUG) { - printk (KERN_WARNING "%s: ipcp input: %d bytes <%s id=%xh len=%xh", - dev->name, len, - sppp_ipcp_type_name (h->type), h->ident, ntohs (h->len)); - if (len > 4) - sppp_print_bytes ((u8*) (h+1), len-4); - printk (">\n"); - } - if (len > ntohs (h->len)) - len = ntohs (h->len); - switch (h->type) { - default: - /* Unknown packet type -- send Code-Reject packet. */ - sppp_cp_send (sp, PPP_IPCP, IPCP_CODE_REJ, ++sp->pp_seq, len, h); - break; - case IPCP_CONF_REQ: - if (len < 4) { - if (sp->pp_flags & PP_DEBUG) - printk (KERN_WARNING "%s: invalid ipcp configure request packet length: %d bytes\n", - dev->name, len); - return; - } - if (len > 4) { - sppp_cp_send (sp, PPP_IPCP, LCP_CONF_REJ, h->ident, - len-4, h+1); - - switch (sp->ipcp.state) { - case IPCP_STATE_OPENED: - /* Initiate renegotiation. */ - sppp_ipcp_open (sp); - /* fall through... */ - case IPCP_STATE_ACK_SENT: - /* Go to closed state. */ - sp->ipcp.state = IPCP_STATE_CLOSED; - } - } else { - /* Send Configure-Ack packet. */ - sppp_cp_send (sp, PPP_IPCP, IPCP_CONF_ACK, h->ident, - 0, NULL); - /* Change the state. */ - if (sp->ipcp.state == IPCP_STATE_ACK_RCVD) - sp->ipcp.state = IPCP_STATE_OPENED; - else - sp->ipcp.state = IPCP_STATE_ACK_SENT; - } - break; - case IPCP_CONF_ACK: - if (h->ident != sp->ipcp.confid) - break; - sppp_clear_timeout (sp); - switch (sp->ipcp.state) { - case IPCP_STATE_CLOSED: - sp->ipcp.state = IPCP_STATE_ACK_RCVD; - sppp_set_timeout (sp, 5); - break; - case IPCP_STATE_ACK_SENT: - sp->ipcp.state = IPCP_STATE_OPENED; - break; - } - break; - case IPCP_CONF_NAK: - case IPCP_CONF_REJ: - if (h->ident != sp->ipcp.confid) - break; - sppp_clear_timeout (sp); - /* Initiate renegotiation. */ - sppp_ipcp_open (sp); - if (sp->ipcp.state != IPCP_STATE_ACK_SENT) - /* Go to closed state. */ - sp->ipcp.state = IPCP_STATE_CLOSED; - break; - case IPCP_TERM_REQ: - /* Send Terminate-Ack packet. */ - sppp_cp_send (sp, PPP_IPCP, IPCP_TERM_ACK, h->ident, 0, NULL); - /* Go to closed state. */ - sp->ipcp.state = IPCP_STATE_CLOSED; - /* Initiate renegotiation. */ - sppp_ipcp_open (sp); - break; - case IPCP_TERM_ACK: - /* Ignore for now. */ - case IPCP_CODE_REJ: - /* Ignore for now. */ - break; - } -} - -static void sppp_lcp_open (struct sppp *sp) -{ - char opt[6]; - - if (! sp->lcp.magic) - sp->lcp.magic = jiffies; - opt[0] = LCP_OPT_MAGIC; - opt[1] = sizeof (opt); - opt[2] = sp->lcp.magic >> 24; - opt[3] = sp->lcp.magic >> 16; - opt[4] = sp->lcp.magic >> 8; - opt[5] = sp->lcp.magic; - sp->lcp.confid = ++sp->pp_seq; - sppp_cp_send (sp, PPP_LCP, LCP_CONF_REQ, sp->lcp.confid, - sizeof (opt), &opt); - sppp_set_timeout (sp, 2); -} - -static void sppp_ipcp_open (struct sppp *sp) -{ - sp->ipcp.confid = ++sp->pp_seq; - sppp_cp_send (sp, PPP_IPCP, IPCP_CONF_REQ, sp->ipcp.confid, 0, NULL); - sppp_set_timeout (sp, 2); -} - -/* - * Process PPP control protocol timeouts. - */ - -static void sppp_cp_timeout (unsigned long arg) -{ - struct sppp *sp = (struct sppp*) arg; - unsigned long flags; - - spin_lock_irqsave(&sp->lock, flags); - - sp->pp_flags &= ~PP_TIMO; - if (! (sp->pp_if->flags & IFF_UP) || (sp->pp_flags & PP_CISCO)) { - spin_unlock_irqrestore(&sp->lock, flags); - return; - } - switch (sp->lcp.state) { - case LCP_STATE_CLOSED: - /* No ACK for Configure-Request, retry. */ - sppp_lcp_open (sp); - break; - case LCP_STATE_ACK_RCVD: - /* ACK got, but no Configure-Request for peer, retry. */ - sppp_lcp_open (sp); - sp->lcp.state = LCP_STATE_CLOSED; - break; - case LCP_STATE_ACK_SENT: - /* ACK sent but no ACK for Configure-Request, retry. */ - sppp_lcp_open (sp); - break; - case LCP_STATE_OPENED: - /* LCP is already OK, try IPCP. */ - switch (sp->ipcp.state) { - case IPCP_STATE_CLOSED: - /* No ACK for Configure-Request, retry. */ - sppp_ipcp_open (sp); - break; - case IPCP_STATE_ACK_RCVD: - /* ACK got, but no Configure-Request for peer, retry. */ - sppp_ipcp_open (sp); - sp->ipcp.state = IPCP_STATE_CLOSED; - break; - case IPCP_STATE_ACK_SENT: - /* ACK sent but no ACK for Configure-Request, retry. */ - sppp_ipcp_open (sp); - break; - case IPCP_STATE_OPENED: - /* IPCP is OK. */ - break; - } - break; - } - spin_unlock_irqrestore(&sp->lock, flags); - sppp_flush_xmit(); -} - -static char *sppp_lcp_type_name (u8 type) -{ - static char buf [8]; - switch (type) { - case LCP_CONF_REQ: return ("conf-req"); - case LCP_CONF_ACK: return ("conf-ack"); - case LCP_CONF_NAK: return ("conf-nack"); - case LCP_CONF_REJ: return ("conf-rej"); - case LCP_TERM_REQ: return ("term-req"); - case LCP_TERM_ACK: return ("term-ack"); - case LCP_CODE_REJ: return ("code-rej"); - case LCP_PROTO_REJ: return ("proto-rej"); - case LCP_ECHO_REQ: return ("echo-req"); - case LCP_ECHO_REPLY: return ("echo-reply"); - case LCP_DISC_REQ: return ("discard-req"); - } - sprintf (buf, "%xh", type); - return (buf); -} - -static char *sppp_ipcp_type_name (u8 type) -{ - static char buf [8]; - switch (type) { - case IPCP_CONF_REQ: return ("conf-req"); - case IPCP_CONF_ACK: return ("conf-ack"); - case IPCP_CONF_NAK: return ("conf-nack"); - case IPCP_CONF_REJ: return ("conf-rej"); - case IPCP_TERM_REQ: return ("term-req"); - case IPCP_TERM_ACK: return ("term-ack"); - case IPCP_CODE_REJ: return ("code-rej"); - } - sprintf (buf, "%xh", type); - return (buf); -} - -static void sppp_print_bytes (u_char *p, u16 len) -{ - printk (" %x", *p++); - while (--len > 0) - printk ("-%x", *p++); -} - -/** - * sppp_rcv - receive and process a WAN PPP frame - * @skb: The buffer to process - * @dev: The device it arrived on - * @p: Unused - * @orig_dev: Unused - * - * Protocol glue. This drives the deferred processing mode the poorer - * cards use. This can be called directly by cards that do not have - * timing constraints but is normally called from the network layer - * after interrupt servicing to process frames queued via netif_rx. - */ - -static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) -{ - if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) - return NET_RX_DROP; - sppp_input(dev,skb); - return 0; -} - -static struct packet_type sppp_packet_type = { - .type = __constant_htons(ETH_P_WAN_PPP), - .func = sppp_rcv, -}; - -static char banner[] __initdata = - KERN_INFO "Cronyx Ltd, Synchronous PPP and CISCO HDLC (c) 1994\n" - KERN_INFO "Linux port (c) 1998 Building Number Three Ltd & " - "Jan \"Yenya\" Kasprzak.\n"; - -static int __init sync_ppp_init(void) -{ - if(debug) - debug=PP_DEBUG; - printk(banner); - skb_queue_head_init(&tx_queue); - dev_add_pack(&sppp_packet_type); - return 0; -} - - -static void __exit sync_ppp_cleanup(void) -{ - dev_remove_pack(&sppp_packet_type); -} - -module_init(sync_ppp_init); -module_exit(sync_ppp_cleanup); -module_param(debug, int, 0); -MODULE_LICENSE("GPL"); - diff --git a/zaptel/kernel/digits.h b/zaptel/kernel/digits.h deleted file mode 100644 index dd849a89..00000000 --- a/zaptel/kernel/digits.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Zapata Telephony - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _DIGITS_H -#define _DIGITS_H - -#define DEFAULT_DTMF_LENGTH 100 * ZT_CHUNKSIZE -#define DEFAULT_MFR1_LENGTH 68 * ZT_CHUNKSIZE -#define DEFAULT_MFR2_LENGTH 100 * ZT_CHUNKSIZE -#define PAUSE_LENGTH 500 * ZT_CHUNKSIZE - -/* At the end of silence, the tone stops */ -static struct zt_tone dtmf_silence = { - .tonesamples = DEFAULT_DTMF_LENGTH, -}; - -/* At the end of silence, the tone stops */ -static struct zt_tone mfr1_silence = { - .tonesamples = DEFAULT_MFR1_LENGTH, -}; - -/* At the end of silence, the tone stops */ -static struct zt_tone mfr2_silence = { - .tonesamples = DEFAULT_MFR2_LENGTH, -}; - -/* A pause in the dialing */ -static struct zt_tone tone_pause = { - .tonesamples = PAUSE_LENGTH, -}; - -#endif diff --git a/zaptel/kernel/ecdis.h b/zaptel/kernel/ecdis.h deleted file mode 100644 index 4d3801b0..00000000 --- a/zaptel/kernel/ecdis.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * ec_disable_detector.h - A detector which should eventually meet the - * G.164/G.165 requirements for detecting the - * 2100Hz echo cancellor disable tone. - * - * Written by Steve Underwood - * - * Copyright (C) 2001 Steve Underwood - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "biquad.h" - -typedef struct -{ - biquad2_state_t notch; - int notch_level; - int channel_level; - int tone_present; - int tone_cycle_duration; - int good_cycles; - int hit; -} echo_can_disable_detector_state_t; - - -#define FALSE 0 -#define TRUE (!FALSE) - -static inline void echo_can_disable_detector_init (echo_can_disable_detector_state_t *det) -{ - /* Elliptic notch */ - /* This is actually centred at 2095Hz, but gets the balance we want, due - to the asymmetric walls of the notch */ - biquad2_init (&det->notch, - (int32_t) (-0.7600000*32768.0), - (int32_t) (-0.1183852*32768.0), - (int32_t) (-0.5104039*32768.0), - (int32_t) ( 0.1567596*32768.0), - (int32_t) ( 1.0000000*32768.0)); - - det->channel_level = 0; - det->notch_level = 0; - det->tone_present = FALSE; - det->tone_cycle_duration = 0; - det->good_cycles = 0; - det->hit = 0; -} -/*- End of function --------------------------------------------------------*/ - -static inline int echo_can_disable_detector_update (echo_can_disable_detector_state_t *det, - int16_t amp) -{ - int16_t notched; - - notched = biquad2 (&det->notch, amp); - /* Estimate the overall energy in the channel, and the energy in - the notch (i.e. overall channel energy - tone energy => noise). - Use abs instead of multiply for speed (is it really faster?). - Damp the overall energy a little more for a stable result. - Damp the notch energy a little less, so we don't damp out the - blip every time the phase reverses */ - det->channel_level += ((abs(amp) - det->channel_level) >> 5); - det->notch_level += ((abs(notched) - det->notch_level) >> 4); - if (det->channel_level > 280) - { - /* There is adequate energy in the channel. Is it mostly at 2100Hz? */ - if (det->notch_level*6 < det->channel_level) - { - /* The notch says yes, so we have the tone. */ - if (!det->tone_present) - { - /* Do we get a kick every 450+-25ms? */ - if (det->tone_cycle_duration >= 425*8 - && - det->tone_cycle_duration <= 475*8) - { - det->good_cycles++; - if (det->good_cycles > 2) - det->hit = TRUE; - } - det->tone_cycle_duration = 0; - } - det->tone_present = TRUE; - } - else - { - det->tone_present = FALSE; - } - det->tone_cycle_duration++; - } - else - { - det->tone_present = FALSE; - det->tone_cycle_duration = 0; - det->good_cycles = 0; - } - return det->hit; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/zaptel/kernel/fasthdlc.h b/zaptel/kernel/fasthdlc.h deleted file mode 100644 index 4892cc9b..00000000 --- a/zaptel/kernel/fasthdlc.h +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Mark's Mythical Table-based raw HDLC implementation - * - * This is designed to be a very fast, but memory efficient - * implementation of standard HDLC protocol. - * - * This table based HDLC technology is PATENT PENDING, but will always be - * remain freely distributable under the terms of the GPL version 2.0. - * - * For non-GPL licensing, please contact Mark Spencer at - * the below e-mail address. - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * Written by Mark Spencer - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _FASTHDLC_H -#define _FASTHDLC_H - -struct fasthdlc_state { - int state; /* What state we are in */ - unsigned int data; /* Our current data queue */ - int bits; /* Number of bits in our data queue */ - int ones; /* Number of ones */ -}; - -#ifdef FAST_HDLC_NEED_TABLES -#define RETURN_COMPLETE_FLAG (0x1000) -#define RETURN_DISCARD_FLAG (0x2000) -#define RETURN_EMPTY_FLAG (0x4000) - -/* Unlike most HDLC implementations, we define only two states, - when we are in a valid frame, and when we are searching for - a frame header */ - -#define FRAME_SEARCH 0 -#define PROCESS_FRAME 1 - -/* - - HDLC Search State table -- Look for a frame header. The return value - of this table is as follows: - - |---8---|---7---|---6---|---5---|---4---|---3---|---2---|---1---| - | Z E R O E S | Next | Bits Consumed | - |-------|-------|-------|-------|-------|-------|-------|-------| - - The indexes for this table are the state (0 or 1) and the next 8 - bits of the stream. - - Note that this table is only used for state 0 and 1. - - The user should discard the top "bits consumed" bits of data before - the next call. "Next state" represents the actual next state for - decoding. - -*/ -static unsigned char hdlc_search[256]; - -/* - HDLC Data Table - - The indexes to this table are the number of one's we've seen so far (0-5) and - the next 10 bits of input (which is enough to guarantee us that we - will retrieve at least one byte of data (or frame or whatever). - - The format for the return value is: - - Bits 15: Status (1=Valid Data, 0=Control Frame (see bits 7-0 for type)) - Bits 14-12: Number of ones in a row, so far - Bits 11-8: The number of bits consumed (0-10) - Bits 7-0: The return data (if appropriate) - - The next state is simply bit #15 - -*/ - -#define CONTROL_COMPLETE 1 -#define CONTROL_ABORT 2 - -#define STATUS_MASK (1 << 15) -#define STATUS_VALID (1 << 15) -#define STATUS_CONTROL (0 << 15) -#define STATE_MASK (1 << 15) -#define ONES_MASK (7 << 12) -#define DATA_MASK (0xff) - -static unsigned short hdlc_frame[6][1024]; - -static unsigned int minbits[2] = { 8, 10 }; - -/* - Last, but not least, we have the encoder table. It takes - as its indices the number of ones so far and a byte of data - and returns an int composed of the following fields: - - Bots 31-22: Actual Data - Bits 21-16: Unused - Bits 15-8: Number of ones - Bits 3-0: Number of bits of output (13-4) to use - - Of course we could optimize by reducing to two tables, but I don't - really think it's worth the trouble at this point. - */ - -static unsigned int hdlc_encode[6][256]; - -static inline char hdlc_search_precalc(unsigned char c) -{ - int x, p=0; - /* Look for a flag. If this isn't a flag, - line us up for the next possible shot at - a flag */ - - /* If it's a flag, we go to state 1, and have - consumed 8 bits */ - if (c == 0x7e) - return 0x10 | 8; - - /* If it's an abort, we stay in the same state - and have consumed 8 bits */ - if (c == 0x7f) - return 0x00 | 8; - - /* If it's all 1's, we state in the same state and - have consumed 8 bits */ - if (c == 0xff) - return 0x00 | 8; - - /* If we get here, we must have at least one zero in us - but we're not the flag. So, start at the end (LSB) and - work our way to the top (MSB) looking for a zero. The - position of that 0 is most optimistic start of a real - frame header */ - x=1; - p=7; - while(p && (c & x)) { - x <<= 1; - p--; - } - return p; -} - -#ifdef DEBUG_PRECALC -static inline void hdlc_search_print(char c, char r) -{ - int x=0x80; - while(x) { - printf("%s", c & x ? "1" : "0"); - x >>= 1; - } - printf(" => State %d, Consume %d\n", (r & 0x10) >> 4, r & 0xf); -} -#endif - -#define HFP(status, ones, bits, data) \ - ((status) | ((ones) << 12) | ((bits) << 8) | (data)) - -static inline unsigned int hdlc_frame_precalc(unsigned char x, unsigned short c) -{ - /* Assume we have seen 'x' one's so far, and have read the - bottom 10 bytes of c (MSB first). Now, we HAVE to have - a byte of data or a frame or something. We are assumed - to be at the beginning of a byte of data or something */ - unsigned char ones = x; - unsigned char data=0; - int bits=0; - int consumed=0; - while(bits < 8) { - data >>=1; - consumed++; - if (ones == 5) { - /* We've seen five ones */ - if (c & 0x0200) { - /* Another one -- Some sort of signal frame */ - if ((!(c & 0x0100)) && (bits == 6)) { - /* This is a frame terminator (10) */ - return HFP(0, - 0, 8, CONTROL_COMPLETE); - } else { - /* Yuck! It's something else... - Abort this entire frame, and - start looking for a good frame */ - return HFP(0, - 0, consumed+1, CONTROL_ABORT); - } - } else { - /* It's an inserted zero, just skip it */ - ones = 0; - data <<= 1; - } - } else { - /* Add it to our bit list, LSB to - MSB */ - if (c & 0x0200) { - data |= 0x80; - ones++; - } else - ones=0; - bits++; - } - c <<= 1; - } - /* Consume the extra 0 now rather than later. */ - if (ones == 5) { - ones = 0; - consumed++; - } - return HFP(STATUS_VALID, ones, consumed, data); -} - -#ifdef DEBUG_PRECALC - -static inline void hdlc_frame_print(unsigned char x, unsigned short c, unsigned int res) -{ - int z=0x0200; - char *status[] = { - "Control", - "Valid", - }; - printf("%d one's then ", x); - while(z) { - printf("%s", c & z ? "1" : "0"); - z >>= 1; - } - printf(" => Status %s, ", res & STATUS_MASK ? "1" : "0"); - printf("Consumed: %d, ", (res & 0x0f00) >> 8); - printf("Status: %s, ", status[(res & STATUS_MASK) >> 15]); - printf("Ones: %d, ", (res & ONES_MASK) >> 12); - printf("Data: %02x\n", res & 0xff); - -} - -#endif - -static inline unsigned int hdlc_encode_precalc(int x, unsigned char y) -{ - int bits=0; - int ones=x; - unsigned short data=0; - int z; - for (z=0;z<8;z++) { - /* Zero-stuff if needed */ - if (ones == 5) { - /* Stuff a zero */ - data <<= 1; - ones=0; - bits++; - } - if (y & 0x01) { - /* There's a one */ - data <<= 1; - data |= 0x1; - ones++; - bits++; - } else { - data <<= 1; - ones = 0; - bits++; - } - y >>= 1; - } - /* Special case -- Stuff the zero at the end if appropriate */ - if (ones == 5) { - /* Stuff a zero */ - data <<= 1; - ones=0; - bits++; - } - data <<= (10-bits); - return (data << 22) | (ones << 8) | (bits); -} - -#ifdef DEBUG_PRECALC -static inline void hdlc_encode_print(int x, unsigned char y, unsigned int val) -{ - unsigned int z; - unsigned short c; - printf("%d ones, %02x (", x, y); - z = 0x80; - while(z) { - printf("%s", y & z ? "1" : "0"); - z >>= 1; - } - printf(") encoded as "); - z = 1 << 31; - for (x=0;x<(val & 0xf);x++) { - printf("%s", val & z ? "1" : "0"); - z >>= 1; - } - printf(" with %d ones now, %d bits in len\n", (val & 0xf00) >> 8, val & 0xf); - - -} -#endif - -static inline void fasthdlc_precalc(void) -{ - int x; - int y; - /* First the easy part -- the searching */ - for (x=0;x<256;x++) { - hdlc_search[x] = hdlc_search_precalc(x); -#ifdef DEBUG_PRECALC - hdlc_search_print(x, hdlc_search[x]); -#endif - } - /* Now the hard part -- the frame tables */ - for (x=0;x<6;x++) { - /* Given the # of preceeding ones, process the next - byte of input (up to 10 actual bits) */ - for (y=0;y<1024;y++) { - hdlc_frame[x][y] = hdlc_frame_precalc(x, y); -#ifdef DEBUG_PRECALC - hdlc_frame_print(x, y, hdlc_frame[x][y]); -#endif - } - } - /* Now another not-so-hard part, the encoding table */ - for (x=0;x<6;x++) { - for (y=0;y<256;y++) { - hdlc_encode[x][y] = hdlc_encode_precalc(x,y); -#ifdef DEBUG_PRECALC - hdlc_encode_print(x,y,hdlc_encode[x][y]); -#endif - } - } -} - - -static inline void fasthdlc_init(struct fasthdlc_state *h) -{ - /* Initializes all states appropriately */ - h->state = 0; - h->bits = 0; - h->data = 0; - h->ones = 0; - -} - -static inline int fasthdlc_tx_load_nocheck(struct fasthdlc_state *h, unsigned char c) -{ - unsigned int res; - res = hdlc_encode[h->ones][c]; - h->ones = (res & 0xf00) >> 8; - h->data |= (res & 0xffc00000) >> h->bits; - h->bits += (res & 0xf); - return 0; -} - -static inline int fasthdlc_tx_load(struct fasthdlc_state *h, unsigned char c) -{ - /* Gotta have at least 10 bits left */ - if (h->bits > 22) - return -1; - return fasthdlc_tx_load_nocheck(h, c); -} - -static inline int fasthdlc_tx_frame_nocheck(struct fasthdlc_state *h) -{ - h->ones = 0; - h->data |= ( 0x7e000000 >> h->bits); - h->bits += 8; - return 0; -} - -static inline int fasthdlc_tx_frame(struct fasthdlc_state *h) -{ - if (h->bits > 24) - return -1; - return fasthdlc_tx_frame_nocheck(h); -} - -static inline int fasthdlc_tx_run_nocheck(struct fasthdlc_state *h) -{ - unsigned char b; - b = h->data >> 24; - h->bits -= 8; - h->data <<= 8; - return b; -} - -static inline int fasthdlc_tx_run(struct fasthdlc_state *h) -{ - if (h->bits < 8) - return -1; - return fasthdlc_tx_run_nocheck(h); -} - -static inline int fasthdlc_rx_load_nocheck(struct fasthdlc_state *h, unsigned char b) -{ - /* Put the new byte in the data stream */ - h->data |= b << (24-h->bits); - h->bits += 8; - return 0; -} - -static inline int fasthdlc_rx_load(struct fasthdlc_state *h, unsigned char b) -{ - /* Make sure we have enough space */ - if (h->bits > 24) - return -1; - return fasthdlc_rx_load_nocheck(h, b); -} - -/* - Returns a data character if available, logical OR'd with - zero or more of RETURN_COMPLETE_FLAG, RETURN_DISCARD_FLAG, - and RETURN_EMPTY_FLAG, signifying a complete frame, a - discarded frame, or there is nothing to return. - */ - -static inline int fasthdlc_rx_run(struct fasthdlc_state *h) -{ - unsigned short next; - int retval=RETURN_EMPTY_FLAG; - while ((h->bits >= minbits[h->state]) && (retval == RETURN_EMPTY_FLAG)) { - /* Run until we can no longer be assured that we will - have enough bits to continue */ - switch(h->state) { - case FRAME_SEARCH: - /* Look for an HDLC frame, keying from - the top byte. */ - next = hdlc_search[h->data >> 24]; - h->bits -= next & 0x0f; - h->data <<= next & 0x0f; - h->state = next >> 4; - h->ones = 0; - break; - case PROCESS_FRAME: - /* Process as much as the next ten bits */ - next = hdlc_frame[h->ones][h->data >> 22]; - h->bits -= ((next & 0x0f00) >> 8); - h->data <<= ((next & 0x0f00) >> 8); - h->state = (next & STATE_MASK) >> 15; - h->ones = (next & ONES_MASK) >> 12; - switch(next & STATUS_MASK) { - case STATUS_CONTROL: - if (next & CONTROL_COMPLETE) { - /* A complete, valid frame received */ - retval = (RETURN_COMPLETE_FLAG); - /* Stay in this state */ - h->state = 1; - } else { - /* An abort (either out of sync of explicit) */ - retval = (RETURN_DISCARD_FLAG); - } - break; - case STATUS_VALID: - retval = (next & DATA_MASK); - } - } - } - return retval; -} -#endif /* FAST_HDLC_NEED_TABLES */ -#endif diff --git a/zaptel/kernel/fir.h b/zaptel/kernel/fir.h deleted file mode 100644 index 17222857..00000000 --- a/zaptel/kernel/fir.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * fir.h - General telephony FIR routines - * - * Written by Steve Underwood - * - * Copyright (C) 2002 Steve Underwood - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#if !defined(_FIR_H_) -#define _FIR_H_ - -typedef struct -{ - int taps; - int curr_pos; - int16_t *coeffs; - int16_t *history; -} fir16_state_t; - -typedef struct -{ - int taps; - int curr_pos; - int32_t *coeffs; - int16_t *history; -} fir32_state_t; - -static inline void fir16_create (fir16_state_t *fir, - int16_t *coeffs, - int taps) -{ - fir->taps = taps; - fir->curr_pos = taps - 1; - fir->coeffs = coeffs; - fir->history = MALLOC (taps*sizeof (int16_t)); - if (fir->history) - memset (fir->history, '\0', taps*sizeof (int16_t)); -} -/*- End of function --------------------------------------------------------*/ - -static inline void fir16_free (fir16_state_t *fir) -{ - FREE (fir->history); -} -/*- End of function --------------------------------------------------------*/ - -static inline int16_t fir16 (fir16_state_t *fir, int16_t sample) -{ - int i; - int offset1; - int offset2; - int32_t y; - - fir->history[fir->curr_pos] = sample; - offset2 = fir->curr_pos + 1; - offset1 = fir->taps - offset2; - y = 0; - for (i = fir->taps - 1; i >= offset1; i--) - y += fir->coeffs[i]*fir->history[i - offset1]; - for ( ; i >= 0; i--) - y += fir->coeffs[i]*fir->history[i + offset2]; - if (fir->curr_pos <= 0) - fir->curr_pos = fir->taps; - fir->curr_pos--; - return y >> 15; -} -/*- End of function --------------------------------------------------------*/ - -static inline void fir32_create (fir32_state_t *fir, - int32_t *coeffs, - int taps) -{ - fir->taps = taps; - fir->curr_pos = taps - 1; - fir->coeffs = coeffs; - fir->history = MALLOC (taps*sizeof (int16_t)); - if (fir->history) - memset (fir->history, '\0', taps*sizeof (int16_t)); -} -/*- End of function --------------------------------------------------------*/ - -static inline void fir32_free (fir32_state_t *fir) -{ - FREE (fir->history); -} -/*- End of function --------------------------------------------------------*/ - -static inline int16_t fir32 (fir32_state_t *fir, int16_t sample) -{ - int i; - int offset1; - int offset2; - int32_t y; - - fir->history[fir->curr_pos] = sample; - offset2 = fir->curr_pos + 1; - offset1 = fir->taps - offset2; - y = 0; - for (i = fir->taps - 1; i >= offset1; i--) - y += fir->coeffs[i]*fir->history[i - offset1]; - for ( ; i >= 0; i--) - y += fir->coeffs[i]*fir->history[i + offset2]; - if (fir->curr_pos <= 0) - fir->curr_pos = fir->taps; - fir->curr_pos--; - return y >> 15; -} -/*- End of function --------------------------------------------------------*/ - -#endif -/*- End of file ------------------------------------------------------------*/ diff --git a/zaptel/kernel/fxo_modes.h b/zaptel/kernel/fxo_modes.h deleted file mode 100644 index ced4d913..00000000 --- a/zaptel/kernel/fxo_modes.h +++ /dev/null @@ -1,588 +0,0 @@ -/* - * FXO port mode settings for various regions - * - * Copyright (C) 2008 Digium, Inc. - * - * extracted from wctdm.c by - * Kevin P. Fleming - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _FXO_MODES_H -#define _FXO_MODES_H - -static struct fxo_mode { - char *name; - int ohs; - int ohs2; - int rz; - int rt; - int ilim; - int dcv; - int mini; - int acim; - int ring_osc; - int ring_x; - unsigned int battdebounce; /* in milliseconds */ - unsigned int battalarm; /* in milliseconds */ - unsigned int battthresh; /* unknown units */ -} fxo_modes[] = -{ - /* US, Canada */ - { .name = "FCC", - .rt = 1, - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - /* Austria, Belgium, Denmark, Finland, France, Germany, - Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands, - Norway, Portugal, Spain, Sweden, Switzerland, and UK */ - { .name = "TBR21", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .ring_osc = 0x7e6c, - .ring_x = 0x023a, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ARGENTINA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "AUSTRALIA", - .ohs = 1, - .mini = 0x3, - .acim = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "AUSTRIA", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "BAHRAIN", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "BELGIUM", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "BRAZIL", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "BULGARIA", - .ilim = 1, - .dcv = 0x3, - .mini = 0x0, - .acim = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "CANADA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "CHILE", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "CHINA", - .mini = 0x3, - .acim = 0xf, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "COLOMBIA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "CROATIA", - .ilim = 1, - .dcv = 0x3, - .mini = 0, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "CYPRUS", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "CZECH", - .ilim = 1, - .dcv = 0x3, - .mini = 0, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "DENMARK", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ECUADOR", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "EGYPT", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ELSALVADOR", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "FINLAND", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "FRANCE", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .mini = 0, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "GERMANY", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "GREECE", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "GUAM", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "HONGKONG", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "HUNGARY", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ICELAND", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "INDIA", - .dcv = 0x3, - .acim = 0x4, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "INDONESIA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "IRELAND", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ISRAEL", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ITALY", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "JAPAN", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "JORDAN", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "KAZAKHSTAN", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "KUWAIT", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "LATVIA", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "LEBANON", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "LUXEMBOURG", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "MACAO", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - /* Current loop >= 20ma */ - { .name = "MALAYSIA", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "MALTA", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "MEXICO", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "MOROCCO", - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "NETHERLANDS", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "NEWZEALAND", - .dcv = 0x3, - .acim = 0x4, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "NIGERIA", - .ilim = 0x1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "NORWAY", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "OMAN", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "PAKISTAN", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "PERU", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "PHILIPPINES", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "POLAND", - .rz = 1, - .rt = 1, - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "PORTUGAL", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "ROMANIA", - .dcv = 3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "RUSSIA", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SAUDIARABIA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SINGAPORE", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SLOVAKIA", - .dcv = 0x3, - .acim = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SLOVENIA", - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SOUTHAFRICA", - .ohs = 1, - .rz = 1, - .dcv = 0x3, - .acim = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SOUTHKOREA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SPAIN", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SWEDEN", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SWITZERLAND", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x2, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "SYRIA", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "TAIWAN", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "THAILAND", - .mini = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "UAE", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "UK", - .ohs2 = 1, - .ilim = 1, - .dcv = 0x3, - .acim = 0x5, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "USA", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, - { .name = "YEMEN", - .dcv = 0x3, - .battdebounce = 64, - .battalarm = 1000, - .battthresh = 3, - }, -}; - -#endif /* _FXO_MODES_H */ diff --git a/zaptel/kernel/hpec/hpec.h b/zaptel/kernel/hpec/hpec.h deleted file mode 100644 index 50e595bb..00000000 --- a/zaptel/kernel/hpec/hpec.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Zapata Telephony Interface to Digium High-Performance Echo Canceller - * - * Copyright (C) 2006 Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#if !defined(_HPEC_H) -#define _HPEC_H - -struct echo_can_state; - -void __attribute__((regparm(0))) hpec_init(int __attribute__((regparm(0))) __attribute__((format (printf, 1, 2))) (*logger)(const char *format, ...), - unsigned int debug, - unsigned int chunk_size, - void * (*memalloc)(size_t len), - void (*memfree)(void *ptr)); - -void __attribute__((regparm(0))) hpec_shutdown(void); - -int __attribute__((regparm(0))) hpec_license_challenge(struct hpec_challenge *challenge); - -int __attribute__((regparm(0))) hpec_license_check(struct hpec_license *license); - -struct echo_can_state __attribute__((regparm(0))) *hpec_channel_alloc(unsigned int len); - -void __attribute__((regparm(0))) hpec_channel_free(struct echo_can_state *channel); - -void __attribute__((regparm(0))) hpec_channel_update(struct echo_can_state *channel, short *iref, short *isig); - -#endif /* !defined(_HPEC_H) */ - diff --git a/zaptel/kernel/hpec/hpec_user.h b/zaptel/kernel/hpec/hpec_user.h deleted file mode 100644 index c864cc50..00000000 --- a/zaptel/kernel/hpec/hpec_user.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Zapata Telephony Interface to Digium High-Performance Echo Canceller - * - * Copyright (C) 2006 Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#if !defined(_HPEC_USER_H) -#define _HPEC_USER_H - -struct hpec_challenge { - __u8 challenge[16]; -}; - -struct hpec_license { - __u32 numchannels; - __u8 userinfo[256]; - __u8 response[16]; -}; - -#define ZT_EC_LICENSE_CHALLENGE _IOR(ZT_CODE, 60, struct hpec_challenge) -#define ZT_EC_LICENSE_RESPONSE _IOW(ZT_CODE, 61, struct hpec_license) - -#endif /* !defined(_HPEC_USER_H) */ - diff --git a/zaptel/kernel/hpec/hpec_zaptel.h b/zaptel/kernel/hpec/hpec_zaptel.h deleted file mode 100644 index 67d677a8..00000000 --- a/zaptel/kernel/hpec/hpec_zaptel.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Zapata Telephony Interface to Digium High-Performance Echo Canceller - * - * Copyright (C) 2006 Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#if !defined(_HPEC_ZAPTEL_H) -#define _HPEC_ZAPTEL_H - -#define ZT_EC_ARRAY_UPDATE - -#include "hpec_user.h" -#include "hpec.h" - -static int __attribute__((regparm(0))) __attribute__((format (printf, 1, 2))) logger(const char *format, ...) -{ - int res; - va_list args; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9) - va_start(args, format); - res = vprintk(format, args); - va_end(args); -#else - char buf[256]; - - va_start(args, format); - res = vsnprintf(buf, sizeof(buf), format, args); - va_end(args); - printk(buf); -#endif - - return res; -} - -static void *memalloc(size_t len) -{ - return kmalloc(len, GFP_KERNEL); -} - -static void memfree(void *ptr) -{ - kfree(ptr); -} - -static void echo_can_init(void) -{ - printk("Zaptel Echo Canceller: Digium High-Performance Echo Canceller\n"); - hpec_init(logger, debug, ZT_CHUNKSIZE, memalloc, memfree); -} - -static void echo_can_identify(char *buf, size_t len) -{ - zap_copy_string(buf, "HPEC", len); -} - -static void echo_can_shutdown(void) -{ - hpec_shutdown(); -} - -static inline void echo_can_free(struct echo_can_state *ec) -{ - hpec_channel_free(ec); -} - -static inline void echo_can_array_update(struct echo_can_state *ec, short *iref, short *isig) -{ - hpec_channel_update(ec, iref, isig); -} - -DECLARE_MUTEX(alloc_lock); - -static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, - struct echo_can_state **ec) -{ - if (ecp->param_count > 0) { - printk(KERN_WARNING "HPEC does not support parameters; failing request\n"); - return -EINVAL; - } - - if (down_interruptible(&alloc_lock)) - return -ENOTTY; - - *ec = hpec_channel_alloc(ecp->tap_length); - - up(&alloc_lock); - - return *ec ? 0 : -ENOTTY; -} - -static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) -{ - return 1; -} - -DECLARE_MUTEX(license_lock); - -static int hpec_license_ioctl(unsigned int cmd, unsigned long data) -{ - struct hpec_challenge challenge; - struct hpec_license license; - int result = 0; - - switch (cmd) { - case ZT_EC_LICENSE_CHALLENGE: - if (down_interruptible(&license_lock)) - return -EINTR; - memset(&challenge, 0, sizeof(challenge)); - if (hpec_license_challenge(&challenge)) - result = -ENODEV; - if (!result && copy_to_user((unsigned char *) data, &challenge, sizeof(challenge))) - result = -EFAULT; - up(&license_lock); - return result; - case ZT_EC_LICENSE_RESPONSE: - if (down_interruptible(&license_lock)) - return -EINTR; - if (copy_from_user(&license, (unsigned char *) data, sizeof(license))) - result = -EFAULT; - if (!result && hpec_license_check(&license)) - result = -EACCES; - up(&license_lock); - return result; - default: - return -ENOSYS; - } -} - -#endif /* !defined(_HPEC_ZAPTEL_H) */ diff --git a/zaptel/kernel/jpah.h b/zaptel/kernel/jpah.h deleted file mode 100644 index 1a6cbb41..00000000 --- a/zaptel/kernel/jpah.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ECHO_CAN_JP1 - * - * by Jason Parker - * - * Based upon mg2ec.h - sort of. - * This "echo can" will completely hose your audio. - * Don't use it unless you're absolutely sure you know what you're doing. - * - * Copyright (C) 2007, Digium, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _JP_ECHO_H -#define _JP_ECHO_H - -#ifdef __KERNEL__ -#include -#include -#define MALLOC(a) kmalloc((a), GFP_KERNEL) -#define FREE(a) kfree(a) -#else -#include -#include -#include -#include -#define MALLOC(a) malloc(a) -#define FREE(a) free(a) -#endif - -/* Echo canceller definition */ -struct echo_can_state { - /* an arbitrary ID for this echo can - this really should be settable from the calling channel... */ - int id; - - /* absolute time - aka. sample number index - essentially the number of samples since this can was init'ed */ - int i_d; -}; - -static void echo_can_init(void) -{ - printk("Zaptel Audio Hoser: JP1\n"); -} - -static void echo_can_identify(char *buf, size_t len) -{ - zap_copy_string(buf, "JP1", len); -} - -static void echo_can_shutdown(void) -{ -} - -static inline void init_cc(struct echo_can_state *ec) -{ - void *ptr = ec; - unsigned long tmp; - /* Double-word align past end of state */ - ptr += sizeof(struct echo_can_state); - tmp = (unsigned long)ptr; - tmp += 3; - tmp &= ~3L; - ptr = (void *)tmp; -} - -static inline void echo_can_free(struct echo_can_state *ec) -{ - FREE(ec); -} - -static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig) -{ - static int blah = 0; - - if (blah < 2) { - blah++; - return 0; - } else { - blah = (blah + 1) % 3; - return isig; - } -} - -static inline struct echo_can_state *echo_can_create(int len, int adaption_mode) -{ - struct echo_can_state *ec; - ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) + 4); /* align */ - if (ec) { - memset(ec, 0, sizeof(struct echo_can_state) + 4); /* align */ - init_cc(ec); - } - return ec; -} - -static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) -{ - return 0; -} -#endif diff --git a/zaptel/kernel/kb1ec.h b/zaptel/kernel/kb1ec.h deleted file mode 100644 index 1ee65131..00000000 --- a/zaptel/kernel/kb1ec.h +++ /dev/null @@ -1,605 +0,0 @@ -/* - * ECHO_CAN_KB1 - * - * by Kris Boutilier - * - * Based upon mech2.h - * - * Copyright (C) 2002, Digium, Inc. - * - * Additional background on the techniques used in this code can be found in: - * - * Messerschmitt, David; Hedberg, David; Cole, Christopher; Haoui, Amine; - * Winship, Peter; "Digital Voice Echo Canceller with a TMS32020," - * in Digital Signal Processing Applications with the TMS320 Family, - * pp. 415-437, Texas Instruments, Inc., 1986. - * - * A pdf of which is available by searching on the document title at http://www.ti.com/ - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _MARK2_ECHO_H -#define _MARK2_ECHO_H - -#include -#include -#include - -#define MALLOC(a) kmalloc((a), GFP_KERNEL) -#define FREE(a) kfree(a) - -/* Uncomment to provide summary statistics for overall echo can performance every 4000 samples */ -/* #define MEC2_STATS 4000 */ - -/* Uncomment to generate per-sample statistics - this will severely degrade system performance and audio quality */ -/* #define MEC2_STATS_DETAILED */ - -/* Get optimized routines for math */ -#include "arith.h" - -/* Bring in definitions for the various constants and thresholds */ -#include "kb1ec_const.h" - -#ifndef NULL -#define NULL 0 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -/* Generic circular buffer definition */ -typedef struct { - /* Pointer to the relative 'start' of the buffer */ - int idx_d; - /* The absolute size of the buffer */ - int size_d; - /* The actual sample - twice as large as we need, however we do store values at idx_d and idx_d+size_d */ - short *buf_d; -} echo_can_cb_s; - -/* Echo canceller definition */ -struct echo_can_state { - /* an arbitrary ID for this echo can - this really should be settable from the calling channel... */ - int id; - - /* absolute time - aka. sample number index - essentially the number of samples since this can was init'ed */ - int i_d; - - /* Pre-computed constants */ - /* ---------------------- */ - /* Number of filter coefficents */ - int N_d; - /* Rate of adaptation of filter */ - int beta2_i; - - /* Accumulators for power computations */ - /* ----------------------------------- */ - /* reference signal power estimate - aka. Average absolute value of y(k) */ - int Ly_i; - /* ... */ - int Lu_i; - - /* Accumulators for signal detectors */ - /* --------------------------------- */ - /* Power estimate of the recent past of the near-end hybrid signal - aka. Short-time average of: 2 x |s(i)| */ - int s_tilde_i; - /* Power estimate of the recent past of the far-end receive signal - aka. Short-time average of: |y(i)| */ - int y_tilde_i; - - /* Near end speech detection counter - stores Hangover counter time remaining, in samples */ - int HCNTR_d; - - /* Circular buffers and coefficients */ - /* --------------------------------- */ - /* ... */ - int *a_i; - /* ... */ - short *a_s; - /* Reference samples of far-end receive signal */ - echo_can_cb_s y_s; - /* Reference samples of near-end signal */ - echo_can_cb_s s_s; - /* Reference samples of near-end signal minus echo estimate */ - echo_can_cb_s u_s; - /* Reference samples of far-end receive signal used to calculate short-time average */ - echo_can_cb_s y_tilde_s; - - /* Peak far-end receive signal */ - /* --------------------------- */ - /* Highest y_tilde value in the sample buffer */ - short max_y_tilde; - /* Index of the sample containing the max_y_tilde value */ - int max_y_tilde_pos; - -#ifdef MEC2_STATS - /* Storage for performance statistics */ - int cntr_nearend_speech_frames; - int cntr_residualcorrected_frames; - int cntr_residualcorrected_framesskipped; - int cntr_coeff_updates; - int cntr_coeff_missedupdates; - - int avg_Lu_i_toolow; - int avg_Lu_i_ok; -#endif - unsigned int aggressive:1; -}; - -static void echo_can_init(void) -{ - printk("Zaptel Echo Canceller: KB1\n"); -} - -static void echo_can_identify(char *buf, size_t len) -{ - zap_copy_string(buf, "KB1", len); -} - -static void echo_can_shutdown(void) -{ -} - -static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where) -{ - cb->buf_d = (short *)where; - cb->idx_d = 0; - cb->size_d = len; -} - -static inline void add_cc_s(echo_can_cb_s *cb, short newval) -{ - /* Can't use modulus because N+M isn't a power of two (generally) */ - cb->idx_d--; - if (cb->idx_d < (int)0) - /* Whoops - the pointer to the 'start' wrapped around so reset it to the top of the buffer */ - cb->idx_d += cb->size_d; - - /* Load two copies into memory */ - cb->buf_d[cb->idx_d] = newval; - cb->buf_d[cb->idx_d + cb->size_d] = newval; -} - -static inline short get_cc_s(echo_can_cb_s *cb, int pos) -{ - /* Load two copies into memory */ - return cb->buf_d[cb->idx_d + pos]; -} - -static inline void init_cc(struct echo_can_state *ec, int N, int maxy, int maxu) -{ - - void *ptr = ec; - unsigned long tmp; - /* Double-word align past end of state */ - ptr += sizeof(struct echo_can_state); - tmp = (unsigned long)ptr; - tmp += 3; - tmp &= ~3L; - ptr = (void *)tmp; - - /* Reset parameters */ - ec->N_d = N; - ec->beta2_i = DEFAULT_BETA1_I; - - /* Allocate coefficient memory */ - ec->a_i = ptr; - ptr += (sizeof(int) * ec->N_d); - ec->a_s = ptr; - ptr += (sizeof(short) * ec->N_d); - - /* Reset Y circular buffer (short version) */ - init_cb_s(&ec->y_s, maxy, ptr); - ptr += (sizeof(short) * (maxy) * 2); - - /* Reset Sigma circular buffer (short version for FIR filter) */ - init_cb_s(&ec->s_s, (1 << DEFAULT_ALPHA_ST_I), ptr); - ptr += (sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) * 2); - - init_cb_s(&ec->u_s, maxu, ptr); - ptr += (sizeof(short) * maxu * 2); - - /* Allocate a buffer for the reference signal power computation */ - init_cb_s(&ec->y_tilde_s, ec->N_d, ptr); - - /* Reset the absolute time index */ - ec->i_d = (int)0; - - /* Reset the power computations (for y and u) */ - ec->Ly_i = DEFAULT_CUTOFF_I; - ec->Lu_i = DEFAULT_CUTOFF_I; - -#ifdef MEC2_STATS - /* set the identity */ - ec->id = (int)&ptr; - - /* Reset performance stats */ - ec->cntr_nearend_speech_frames = (int)0; - ec->cntr_residualcorrected_frames = (int)0; - ec->cntr_residualcorrected_framesskipped = (int)0; - ec->cntr_coeff_updates = (int)0; - ec->cntr_coeff_missedupdates = (int)0; - - ec->avg_Lu_i_toolow = (int)0; - ec->avg_Lu_i_ok = (int)0; -#endif - - /* Reset the near-end speech detector */ - ec->s_tilde_i = (int)0; - ec->y_tilde_i = (int)0; - ec->HCNTR_d = (int)0; - -} - -static inline void echo_can_free(struct echo_can_state *ec) -{ - FREE(ec); -} - -static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig) -{ - - /* Declare local variables that are used more than once */ - /* ... */ - int k; - /* ... */ - int rs; - /* ... */ - short u; - /* ... */ - int Py_i; - /* ... */ - int two_beta_i; - - /* flow A on pg. 428 */ - /* eq. (16): high-pass filter the input to generate the next value; - * push the current value into the circular buffer - * - * sdc_im1_d = sdc_d; - * sdc_d = sig; - * s_i_d = sdc_d; - * s_d = s_i_d; - * s_i_d = (float)(1.0 - gamma_d) * s_i_d - * + (float)(0.5 * (1.0 - gamma_d)) * (sdc_d - sdc_im1_d); - */ - - /* Update the Far-end receive signal circular buffers and accumulators */ - /* ------------------------------------------------------------------- */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->y_tilde_i -= abs(get_cc_s(&ec->y_s, (1 << DEFAULT_ALPHA_YT_I) - 1 )) >> DEFAULT_ALPHA_YT_I; - /* Add the new sample to the power estimate accumulator */ - ec->y_tilde_i += abs(iref) >> DEFAULT_ALPHA_ST_I; - /* Push a copy of the new sample into its circular buffer */ - add_cc_s(&ec->y_s, iref); - - - /* eq. (2): compute r in fixed-point */ - rs = CONVOLVE2(ec->a_s, - ec->y_s.buf_d + ec->y_s.idx_d, - ec->N_d); - rs >>= 15; - - /* eq. (3): compute the output value (see figure 3) and the error - * note: the error is the same as the output signal when near-end - * speech is not present - */ - u = isig - rs; - - /* Push a copy of the output value sample into its circular buffer */ - add_cc_s(&ec->u_s, u); - - - /* Update the Near-end hybrid signal circular buffers and accumulators */ - /* ------------------------------------------------------------------- */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->s_tilde_i -= abs(get_cc_s(&ec->s_s, (1 << DEFAULT_ALPHA_ST_I) - 1 )); - /* Add the new sample to the power estimate accumulator */ - ec->s_tilde_i += abs(isig); - /* Push a copy of the new sample into it's circular buffer */ - add_cc_s(&ec->s_s, isig); - - - /* Push a copy of the current short-time average of the far-end receive signal into it's circular buffer */ - add_cc_s(&ec->y_tilde_s, ec->y_tilde_i); - - /* flow B on pg. 428 */ - - /* If the hangover timer isn't running then compute the new convergence factor, otherwise set Py_i to 32768 */ - if (!ec->HCNTR_d) { - Py_i = (ec->Ly_i >> DEFAULT_SIGMA_LY_I) * (ec->Ly_i >> DEFAULT_SIGMA_LY_I); - Py_i >>= 15; - } else { - Py_i = (1 << 15); - } - -#if 0 - /* Vary rate of adaptation depending on position in the file - * Do not do this for the first (DEFAULT_UPDATE_TIME) secs after speech - * has begun of the file to allow the echo cancellor to estimate the - * channel accurately - * Still needs conversion! - */ - - if (ec->start_speech_d != 0 ){ - if ( ec->i_d > (DEFAULT_T0 + ec->start_speech_d)*(SAMPLE_FREQ) ){ - ec->beta2_d = max_cc_float(MIN_BETA, DEFAULT_BETA1 * exp((-1/DEFAULT_TAU)*((ec->i_d/(float)SAMPLE_FREQ) - DEFAULT_T0 - ec->start_speech_d))); - } - } else { - ec->beta2_d = DEFAULT_BETA1; - } -#endif - - /* Fixed point, inverted */ - ec->beta2_i = DEFAULT_BETA1_I; - - /* Fixed point version, inverted */ - two_beta_i = (ec->beta2_i * Py_i) >> 15; - if (!two_beta_i) - two_beta_i++; - - /* Update the Suppressed signal power estimate accumulator */ - /* ------------------------------------------------------- */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->Lu_i -= abs(get_cc_s(&ec->u_s, (1 << DEFAULT_SIGMA_LU_I) - 1 )) ; - /* Add the new sample to the power estimate accumulator */ - ec->Lu_i += abs(u); - - /* Update the Far-end reference signal power estimate accumulator */ - /* -------------------------------------------------------------- */ - /* eq. (10): update power estimate of the reference */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->Ly_i -= abs(get_cc_s(&ec->y_s, (1 << DEFAULT_SIGMA_LY_I) - 1)) ; - /* Add the new sample to the power estimate accumulator */ - ec->Ly_i += abs(iref); - - if (ec->Ly_i < DEFAULT_CUTOFF_I) - ec->Ly_i = DEFAULT_CUTOFF_I; - - - /* Update the Peak far-end receive signal detected */ - /* ----------------------------------------------- */ - if (ec->y_tilde_i > ec->max_y_tilde) { - /* New highest y_tilde with full life */ - ec->max_y_tilde = ec->y_tilde_i; - ec->max_y_tilde_pos = ec->N_d - 1; - } else if (--ec->max_y_tilde_pos < 0) { - /* Time to find new max y tilde... */ - ec->max_y_tilde = MAX16(ec->y_tilde_s.buf_d + ec->y_tilde_s.idx_d, ec->N_d, &ec->max_y_tilde_pos); - } - - /* Determine if near end speech was detected in this sample */ - /* -------------------------------------------------------- */ - if (((ec->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)) > ec->max_y_tilde) - && (ec->max_y_tilde > 0)) { - /* Then start the Hangover counter */ - ec->HCNTR_d = DEFAULT_HANGT; -#ifdef MEC2_STATS_DETAILED - printk(KERN_INFO "Reset near end speech timer with: s_tilde_i %d, stmnt %d, max_y_tilde %d\n", ec->s_tilde_i, (ec->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)), ec->max_y_tilde); -#endif -#ifdef MEC2_STATS - ++ec->cntr_nearend_speech_frames; -#endif - } else if (ec->HCNTR_d > (int)0) { - /* otherwise, if it's still non-zero, decrement the Hangover counter by one sample */ -#ifdef MEC2_STATS - ++ec->cntr_nearend_speech_frames; -#endif - ec->HCNTR_d--; - } - - /* Update coefficients if no near-end speech in this sample (ie. HCNTR_d = 0) - * and we have enough signal to bother trying to update. - * -------------------------------------------------------------------------- - */ - if (!ec->HCNTR_d && /* no near-end speech present */ - !(ec->i_d % DEFAULT_M)) { /* we only update on every DEFAULM_M'th sample from the stream */ - if (ec->Lu_i > MIN_UPDATE_THRESH_I) { /* there is sufficient energy above the noise floor to contain meaningful data */ - /* so loop over all the filter coefficients */ -#ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "updating coefficients with: ec->Lu_i %9d\n", ec->Lu_i); -#endif -#ifdef MEC2_STATS - ec->avg_Lu_i_ok = ec->avg_Lu_i_ok + ec->Lu_i; - ++ec->cntr_coeff_updates; -#endif - for (k=0; k < ec->N_d; k++) { - /* eq. (7): compute an expectation over M_d samples */ - int grad2; - grad2 = CONVOLVE2(ec->u_s.buf_d + ec->u_s.idx_d, - ec->y_s.buf_d + ec->y_s.idx_d + k, - DEFAULT_M); - /* eq. (7): update the coefficient */ - ec->a_i[k] += grad2 / two_beta_i; - ec->a_s[k] = ec->a_i[k] >> 16; - } - } else { -#ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "insufficient signal to update coefficients ec->Lu_i %5d < %5d\n", ec->Lu_i, MIN_UPDATE_THRESH_I); -#endif -#ifdef MEC2_STATS - ec->avg_Lu_i_toolow = ec->avg_Lu_i_toolow + ec->Lu_i; - ++ec->cntr_coeff_missedupdates; -#endif - } - } - - /* paragraph below eq. (15): if no near-end speech in the sample and - * the reference signal power estimate > cutoff threshold - * then perform residual error suppression - */ -#ifdef MEC2_STATS_DETAILED - if (ec->HCNTR_d == 0) - printk( KERN_INFO "possibily correcting frame with ec->Ly_i %9d ec->Lu_i %9d and expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); -#endif - -#ifndef NO_ECHO_SUPPRESSOR - if (ec->aggressive) { - if ((ec->HCNTR_d < AGGRESSIVE_HCNTR) && (ec->Ly_i > (ec->Lu_i << 1))) { - for (k=0; k < 2; k++) { - u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1); - } -#ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "aggresively correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); -#endif -#ifdef MEC2_STATS - ++ec->cntr_residualcorrected_frames; -#endif - } - } else { - if (ec->HCNTR_d == 0) { - if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) { - for (k=0; k < 1; k++) { - u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1); - } -#ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); -#endif -#ifdef MEC2_STATS - ++ec->cntr_residualcorrected_frames; -#endif - } -#ifdef MEC2_STATS - else { - ++ec->cntr_residualcorrected_framesskipped; - } -#endif - } - } -#endif - -#if 0 - /* This will generate a non-linear supression factor, once converted */ - if ((ec->HCNTR_d == 0) && - ((ec->Lu_d/ec->Ly_d) < DEFAULT_SUPPR) && - (ec->Lu_d/ec->Ly_d > EC_MIN_DB_VALUE)) { - suppr_factor = (10 / (float)(SUPPR_FLOOR - SUPPR_CEIL)) * log(ec->Lu_d/ec->Ly_d) - - SUPPR_CEIL / (float)(SUPPR_FLOOR - SUPPR_CEIL); - u_suppr = pow(10.0, (suppr_factor) * RES_SUPR_FACTOR / 10.0) * u_suppr; - } -#endif - -#ifdef MEC2_STATS - /* Periodically dump performance stats */ - if ((ec->i_d % MEC2_STATS) == 0) { - /* make sure to avoid div0's! */ - if (ec->cntr_coeff_missedupdates > 0) - ec->avg_Lu_i_toolow = (int)(ec->avg_Lu_i_toolow / ec->cntr_coeff_missedupdates); - else - ec->avg_Lu_i_toolow = -1; - - if (ec->cntr_coeff_updates > 0) - ec->avg_Lu_i_ok = (ec->avg_Lu_i_ok / ec->cntr_coeff_updates); - else - ec->avg_Lu_i_ok = -1; - - printk( KERN_INFO "%d: Near end speech: %5d Residuals corrected/skipped: %5d/%5d Coefficients updated ok/low sig: %3d/%3d Lu_i avg ok/low sig %6d/%5d\n", - ec->id, - ec->cntr_nearend_speech_frames, - ec->cntr_residualcorrected_frames, ec->cntr_residualcorrected_framesskipped, - ec->cntr_coeff_updates, ec->cntr_coeff_missedupdates, - ec->avg_Lu_i_ok, ec->avg_Lu_i_toolow); - - ec->cntr_nearend_speech_frames = 0; - ec->cntr_residualcorrected_frames = 0; - ec->cntr_residualcorrected_framesskipped = 0; - ec->cntr_coeff_updates = 0; - ec->cntr_coeff_missedupdates = 0; - ec->avg_Lu_i_ok = 0; - ec->avg_Lu_i_toolow = 0; - } -#endif - - /* Increment the sample index and return the corrected sample */ - ec->i_d++; - return u; -} - -static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, - struct echo_can_state **ec) -{ - int maxy; - int maxu; - size_t size; - unsigned int x; - char *c; - - maxy = ecp->tap_length + DEFAULT_M; - maxu = DEFAULT_M; - if (maxy < (1 << DEFAULT_ALPHA_YT_I)) - maxy = (1 << DEFAULT_ALPHA_YT_I); - if (maxy < (1 << DEFAULT_SIGMA_LY_I)) - maxy = (1 << DEFAULT_SIGMA_LY_I); - if (maxu < (1 << DEFAULT_SIGMA_LU_I)) - maxu = (1 << DEFAULT_SIGMA_LU_I); - - size = sizeof(*ec) + - 4 + /* align */ - sizeof(int) * ecp->tap_length + /* a_i */ - sizeof(short) * ecp->tap_length + /* a_s */ - 2 * sizeof(short) * (maxy) + /* y_s */ - 2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */ - 2 * sizeof(short) * (maxu) + /* u_s */ - 2 * sizeof(short) * ecp->tap_length; /* y_tilde_s */ - - if (!(*ec = MALLOC(size))) - return -ENOMEM; - - memset(*ec, 0, size); - -#ifdef AGGRESSIVE_SUPPRESSOR - (*ec)->aggressive = 1; -#endif - - for (x = 0; x < ecp->param_count; x++) { - for (c = p[x].name; *c; c++) - *c = tolower(*c); - if (!strcmp(p[x].name, "aggressive")) { - (*ec)->aggressive = p[x].value ? 1 : 0; - } else { - printk(KERN_WARNING "Unknown parameter supplied to KB1 echo canceler: '%s'\n", p[x].name); - kfree(*ec); - - return -EINVAL; - } - } - - init_cc(*ec, ecp->tap_length, maxy, maxu); - - return 0; -} - -static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) -{ - /* Set the hangover counter to the length of the can to - * avoid adjustments occuring immediately after initial forced training - */ - ec->HCNTR_d = ec->N_d << 1; - - if (pos >= ec->N_d) - return 1; - - ec->a_i[pos] = val << 17; - ec->a_s[pos] = val << 1; - - if (++pos >= ec->N_d) - return 1; - - return 0; -} - -#endif diff --git a/zaptel/kernel/kb1ec_const.h b/zaptel/kernel/kb1ec_const.h deleted file mode 100644 index 7abdc077..00000000 --- a/zaptel/kernel/kb1ec_const.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* - Important constants for tuning kb1 echo can - */ -#ifndef _MEC2_CONST_H -#define _MEC2_CONST_H - - -/* Convergence (aka. adaptation) speed -- higher means slower */ -#define DEFAULT_BETA1_I 2048 - -/* Constants for various power computations */ -#define DEFAULT_SIGMA_LY_I 7 -#define DEFAULT_SIGMA_LU_I 7 -#define DEFAULT_ALPHA_ST_I 5 /* near-end speech detection sensitivity factor */ -#define DEFAULT_ALPHA_YT_I 5 - -#define DEFAULT_CUTOFF_I 128 - -/* Define the near-end speech hangover counter: if near-end speech - * is declared, hcntr is set equal to hangt (see pg. 432) - */ -#define DEFAULT_HANGT 600 /* in samples, so 600 samples = 75ms */ - -/* define the residual error suppression threshold */ -#define DEFAULT_SUPPR_I 16 /* 16 = -24db */ - -/* This is the minimum reference signal power estimate level - * that will result in filter adaptation. - * If this is too low then background noise will cause the filter - * coefficients to constantly be updated. - */ -#define MIN_UPDATE_THRESH_I 4096 - -/* The number of samples used to update coefficients using the - * the block update method (M). It should be related back to the - * length of the echo can. - * ie. it only updates coefficients when (sample number MOD default_m) = 0 - * - * Getting this wrong may cause an oops. Consider yourself warned! - */ -#define DEFAULT_M 16 /* every 16th sample */ - -/* If AGGRESSIVE supression is enabled, then we start cancelling residual - * echos again even while there is potentially the very end of a near-side - * signal present. - * This defines how many samples of DEFAULT_HANGT can remain before we - * kick back in - */ -#define AGGRESSIVE_HCNTR 160 /* in samples, so 160 samples = 20ms */ - - -/***************************************************************/ -/* The following knobs are not implemented in the current code */ - -/* we need a dynamic level of suppression varying with the ratio of the - power of the echo to the power of the reference signal this is - done so that we have a smoother background. - we have a higher suppression when the power ratio is closer to - suppr_ceil and reduces logarithmically as we approach suppr_floor. - */ -#define SUPPR_FLOOR -64 -#define SUPPR_CEIL -24 - -/* in a second departure, we calculate the residual error suppression - * as a percentage of the reference signal energy level. The threshold - * is defined in terms of dB below the reference signal. - */ -#define RES_SUPR_FACTOR -20 - - -#endif /* _MEC2_CONST_H */ - diff --git a/zaptel/kernel/makefw.c b/zaptel/kernel/makefw.c deleted file mode 100644 index 039ae523..00000000 --- a/zaptel/kernel/makefw.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Xilinx firmware convertor program. - * - * Written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include - -#define SWATH 12 - -int main(int argc, char *argv[]) -{ -FILE *fp; -int i,j,nbytes; -unsigned char c; -char buf[300]; - - if (argc < 3) - { - puts("Usage... makefw filename.rbt array_name"); - exit(1); - } - - fp = fopen(argv[1],"r"); - if (!fp) - { - perror("bit file open"); - exit(1); - } - nbytes = 0; - printf("static unsigned char %s[] = {\n",argv[2]); - i = 0; - while(fgets(buf,sizeof(buf) - 1,fp)) - { - if (!buf[0]) continue; - if (buf[strlen(buf) - 1] < ' ') buf[strlen(buf) - 1] = 0; - if (!buf[0]) continue; - if (buf[strlen(buf) - 1] < ' ') buf[strlen(buf) - 1] = 0; - if (!buf[0]) continue; - if (strlen(buf) < 32) continue; - if ((buf[0] != '0') && (buf[0] != '1')) continue; - c = 0; - for(j = 0; buf[j]; j++) - { - if (buf[j] > '0') c |= 1 << (j & 7); - if ((j & 7) == 7) - { - nbytes++; - if (i) printf(","); - printf("0x%02x",c); - if (i++ == SWATH) { - printf(",\n"); - i = 0; - } - c = 0; - } - } - } - printf("\n};\n\n"); - fprintf(stderr,"Loaded %d bytes from file\n",nbytes); - fclose(fp); - exit(0); -} - diff --git a/zaptel/kernel/mg2ec.h b/zaptel/kernel/mg2ec.h deleted file mode 100644 index a0b7d664..00000000 --- a/zaptel/kernel/mg2ec.h +++ /dev/null @@ -1,733 +0,0 @@ -/* - * ECHO_CAN_MG2 - * - * by Michael Gernoth - * - * Based upon kb1ec.h and mec2.h - * - * Copyright (C) 2002, Digium, Inc. - * - * Additional background on the techniques used in this code can be found in: - * - * Messerschmitt, David; Hedberg, David; Cole, Christopher; Haoui, Amine; - * Winship, Peter; "Digital Voice Echo Canceller with a TMS32020," - * in Digital Signal Processing Applications with the TMS320 Family, - * pp. 415-437, Texas Instruments, Inc., 1986. - * - * A pdf of which is available by searching on the document title at http://www.ti.com/ - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _MG2_ECHO_H -#define _MG2_ECHO_H - -#include -#include -#include - -#define MALLOC(a) kmalloc((a), GFP_KERNEL) -#define FREE(a) kfree(a) - -#define ABS(a) abs(a!=-32768?a:-32767) - -#define RESTORE_COEFFS {\ - int x;\ - memcpy(ec->a_i, ec->c_i, ec->N_d*sizeof(int));\ - for (x=0;xN_d;x++) {\ - ec->a_s[x] = ec->a_i[x] >> 16;\ - }\ - ec->backup = BACKUP;\ - } - -/* Uncomment to provide summary statistics for overall echo can performance every 4000 samples */ -/* #define MEC2_STATS 4000 */ - -/* Uncomment to generate per-sample statistics - this will severely degrade system performance and audio quality */ -/* #define MEC2_STATS_DETAILED */ - -/* Uncomment to generate per-call DC bias offset messages */ -/* #define MEC2_DCBIAS_MESSAGE */ - -/* Get optimized routines for math */ -#include "arith.h" - -/* Bring in definitions for the various constants and thresholds */ -#include "mg2ec_const.h" - -#define DC_NORMALIZE - -#ifndef NULL -#define NULL 0 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -/* Generic circular buffer definition */ -typedef struct { - /* Pointer to the relative 'start' of the buffer */ - int idx_d; - /* The absolute size of the buffer */ - int size_d; - /* The actual sample - twice as large as we need, however we do store values at idx_d and idx_d+size_d */ - short *buf_d; -} echo_can_cb_s; - -/* Echo canceller definition */ -struct echo_can_state { - /* an arbitrary ID for this echo can - this really should be settable from the calling channel... */ - int id; - - /* absolute time - aka. sample number index - essentially the number of samples since this can was init'ed */ - int i_d; - - /* Pre-computed constants */ - /* ---------------------- */ - /* Number of filter coefficents */ - int N_d; - /* Rate of adaptation of filter */ - int beta2_i; - - /* Accumulators for power computations */ - /* ----------------------------------- */ - /* reference signal power estimate - aka. Average absolute value of y(k) */ - int Ly_i; - /* ... */ - int Lu_i; - - /* Accumulators for signal detectors */ - /* --------------------------------- */ - /* Power estimate of the recent past of the near-end hybrid signal - aka. Short-time average of: 2 x |s(i)| */ - int s_tilde_i; - /* Power estimate of the recent past of the far-end receive signal - aka. Short-time average of: |y(i)| */ - int y_tilde_i; - - /* Near end speech detection counter - stores Hangover counter time remaining, in samples */ - int HCNTR_d; - - /* Circular buffers and coefficients */ - /* --------------------------------- */ - /* ... */ - int *a_i; - /* ... */ - short *a_s; - /* Backups */ - int *b_i; - int *c_i; - /* Reference samples of far-end receive signal */ - echo_can_cb_s y_s; - /* Reference samples of near-end signal */ - echo_can_cb_s s_s; - /* Reference samples of near-end signal minus echo estimate */ - echo_can_cb_s u_s; - /* Reference samples of far-end receive signal used to calculate short-time average */ - echo_can_cb_s y_tilde_s; - - /* Peak far-end receive signal */ - /* --------------------------- */ - /* Highest y_tilde value in the sample buffer */ - short max_y_tilde; - /* Index of the sample containing the max_y_tilde value */ - int max_y_tilde_pos; - -#ifdef MEC2_STATS - /* Storage for performance statistics */ - int cntr_nearend_speech_frames; - int cntr_residualcorrected_frames; - int cntr_residualcorrected_framesskipped; - int cntr_coeff_updates; - int cntr_coeff_missedupdates; - - int avg_Lu_i_toolow; - int avg_Lu_i_ok; -#endif - unsigned int aggressive:1; - short lastsig; - int lastcount; - int backup; -#ifdef DC_NORMALIZE - int dc_estimate; -#endif - -}; - -static void echo_can_init(void) -{ - printk("Zaptel Echo Canceller: MG2\n"); -} - -static void echo_can_identify(char *buf, size_t len) -{ - zap_copy_string(buf, "MG2", len); -} - -static void echo_can_shutdown(void) -{ -} - -static inline void init_cb_s(echo_can_cb_s *cb, int len, void *where) -{ - cb->buf_d = (short *)where; - cb->idx_d = 0; - cb->size_d = len; -} - -static inline void add_cc_s(echo_can_cb_s *cb, short newval) -{ - /* Can't use modulus because N+M isn't a power of two (generally) */ - cb->idx_d--; - if (cb->idx_d < (int)0) - /* Whoops - the pointer to the 'start' wrapped around so reset it to the top of the buffer */ - cb->idx_d += cb->size_d; - - /* Load two copies into memory */ - cb->buf_d[cb->idx_d] = newval; - cb->buf_d[cb->idx_d + cb->size_d] = newval; -} - -static inline short get_cc_s(echo_can_cb_s *cb, int pos) -{ - /* Load two copies into memory */ - return cb->buf_d[cb->idx_d + pos]; -} - -static inline void init_cc(struct echo_can_state *ec, int N, int maxy, int maxu) -{ - - void *ptr = ec; - unsigned long tmp; - /* Double-word align past end of state */ - ptr += sizeof(struct echo_can_state); - tmp = (unsigned long)ptr; - tmp += 3; - tmp &= ~3L; - ptr = (void *)tmp; - - /* Reset parameters */ - ec->N_d = N; - ec->beta2_i = DEFAULT_BETA1_I; - - /* Allocate coefficient memory */ - ec->a_i = ptr; - ptr += (sizeof(int) * ec->N_d); - ec->a_s = ptr; - ptr += (sizeof(short) * ec->N_d); - - /* Allocate backup memory */ - ec->b_i = ptr; - ptr += (sizeof(int) * ec->N_d); - ec->c_i = ptr; - ptr += (sizeof(int) * ec->N_d); - - /* Reset Y circular buffer (short version) */ - init_cb_s(&ec->y_s, maxy, ptr); - ptr += (sizeof(short) * (maxy) * 2); - - /* Reset Sigma circular buffer (short version for FIR filter) */ - init_cb_s(&ec->s_s, (1 << DEFAULT_ALPHA_ST_I), ptr); - ptr += (sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) * 2); - - init_cb_s(&ec->u_s, maxu, ptr); - ptr += (sizeof(short) * maxu * 2); - - /* Allocate a buffer for the reference signal power computation */ - init_cb_s(&ec->y_tilde_s, ec->N_d, ptr); - - /* Reset the absolute time index */ - ec->i_d = (int)0; - - /* Reset the power computations (for y and u) */ - ec->Ly_i = DEFAULT_CUTOFF_I; - ec->Lu_i = DEFAULT_CUTOFF_I; - -#ifdef MEC2_STATS - /* set the identity */ - ec->id = (int)&ptr; - - /* Reset performance stats */ - ec->cntr_nearend_speech_frames = (int)0; - ec->cntr_residualcorrected_frames = (int)0; - ec->cntr_residualcorrected_framesskipped = (int)0; - ec->cntr_coeff_updates = (int)0; - ec->cntr_coeff_missedupdates = (int)0; - - ec->avg_Lu_i_toolow = (int)0; - ec->avg_Lu_i_ok = (int)0; -#endif - - /* Reset the near-end speech detector */ - ec->s_tilde_i = (int)0; - ec->y_tilde_i = (int)0; - ec->HCNTR_d = (int)0; - -} - -static inline void echo_can_free(struct echo_can_state *ec) -{ -#if defined(DC_NORMALIZE) && defined(MEC2_DCBIAS_MESSAGE) - printk("EC: DC bias calculated: %d V\n", ec->dc_estimate >> 15); -#endif - FREE(ec); -} - -#ifdef DC_NORMALIZE -short inline dc_removal(int *dc_estimate, short samp) -{ - *dc_estimate += ((((int)samp << 15) - *dc_estimate) >> 9); - return samp - (*dc_estimate >> 15); -} -#endif - -static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig) -{ - - /* Declare local variables that are used more than once */ - /* ... */ - int k; - /* ... */ - int rs; - /* ... */ - short u; - /* ... */ - int Py_i; - /* ... */ - int two_beta_i; - -#ifdef DC_NORMALIZE - isig = dc_removal(&ec->dc_estimate, isig); -#endif - - /* flow A on pg. 428 */ - /* eq. (16): high-pass filter the input to generate the next value; - * push the current value into the circular buffer - * - * sdc_im1_d = sdc_d; - * sdc_d = sig; - * s_i_d = sdc_d; - * s_d = s_i_d; - * s_i_d = (float)(1.0 - gamma_d) * s_i_d - * + (float)(0.5 * (1.0 - gamma_d)) * (sdc_d - sdc_im1_d); - */ - - /* Update the Far-end receive signal circular buffers and accumulators */ - /* ------------------------------------------------------------------- */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->y_tilde_i -= abs(get_cc_s(&ec->y_s, (1 << DEFAULT_ALPHA_YT_I) - 1 )) >> DEFAULT_ALPHA_YT_I; - /* Add the new sample to the power estimate accumulator */ - ec->y_tilde_i += abs(iref) >> DEFAULT_ALPHA_ST_I; - /* Push a copy of the new sample into its circular buffer */ - add_cc_s(&ec->y_s, iref); - - - /* eq. (2): compute r in fixed-point */ - rs = CONVOLVE2(ec->a_s, - ec->y_s.buf_d + ec->y_s.idx_d, - ec->N_d); - rs >>= 15; - - if (ec->lastsig == isig) { - ec->lastcount++; - } else { - ec->lastcount = 0; - ec->lastsig = isig; - } - - if (isig == 0) { - u = 0; - } else if (ec->lastcount > 255) { - /* We have seen the same input-signal more than 255 times, - * we should pass it through uncancelled, as we are likely on hold */ - u = isig; - } else { - if (rs < -32768) { - rs = -32768; - ec->HCNTR_d = DEFAULT_HANGT; - RESTORE_COEFFS; - } else if (rs > 32767) { - rs = 32767; - ec->HCNTR_d = DEFAULT_HANGT; - RESTORE_COEFFS; - } - - if (ABS(ABS(rs)-ABS(isig)) > MAX_SIGN_ERROR) - { - rs = 0; - RESTORE_COEFFS; - } - - /* eq. (3): compute the output value (see figure 3) and the error - * note: the error is the same as the output signal when near-end - * speech is not present - */ - u = isig - rs; - - if (u / isig < 0) - u = isig - (rs >> 1); - } - - /* Push a copy of the output value sample into its circular buffer */ - add_cc_s(&ec->u_s, u); - - if (!ec->backup) { - /* Backup coefficients periodically */ - ec->backup = BACKUP; - memcpy(ec->c_i,ec->b_i,ec->N_d*sizeof(int)); - memcpy(ec->b_i,ec->a_i,ec->N_d*sizeof(int)); - } else - ec->backup--; - - - /* Update the Near-end hybrid signal circular buffers and accumulators */ - /* ------------------------------------------------------------------- */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->s_tilde_i -= abs(get_cc_s(&ec->s_s, (1 << DEFAULT_ALPHA_ST_I) - 1 )); - /* Add the new sample to the power estimate accumulator */ - ec->s_tilde_i += abs(isig); - /* Push a copy of the new sample into it's circular buffer */ - add_cc_s(&ec->s_s, isig); - - - /* Push a copy of the current short-time average of the far-end receive signal into it's circular buffer */ - add_cc_s(&ec->y_tilde_s, ec->y_tilde_i); - - /* flow B on pg. 428 */ - - /* If the hangover timer isn't running then compute the new convergence factor, otherwise set Py_i to 32768 */ - if (!ec->HCNTR_d) { - Py_i = (ec->Ly_i >> DEFAULT_SIGMA_LY_I) * (ec->Ly_i >> DEFAULT_SIGMA_LY_I); - Py_i >>= 15; - } else { - Py_i = (1 << 15); - } - -#if 0 - /* Vary rate of adaptation depending on position in the file - * Do not do this for the first (DEFAULT_UPDATE_TIME) secs after speech - * has begun of the file to allow the echo cancellor to estimate the - * channel accurately - * Still needs conversion! - */ - - if (ec->start_speech_d != 0 ){ - if ( ec->i_d > (DEFAULT_T0 + ec->start_speech_d)*(SAMPLE_FREQ) ){ - ec->beta2_d = max_cc_float(MIN_BETA, DEFAULT_BETA1 * exp((-1/DEFAULT_TAU)*((ec->i_d/(float)SAMPLE_FREQ) - DEFAULT_T0 - ec->start_speech_d))); - } - } else { - ec->beta2_d = DEFAULT_BETA1; - } -#endif - - /* Fixed point, inverted */ - ec->beta2_i = DEFAULT_BETA1_I; - - /* Fixed point version, inverted */ - two_beta_i = (ec->beta2_i * Py_i) >> 15; - if (!two_beta_i) - two_beta_i++; - - /* Update the Suppressed signal power estimate accumulator */ - /* ------------------------------------------------------- */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->Lu_i -= abs(get_cc_s(&ec->u_s, (1 << DEFAULT_SIGMA_LU_I) - 1 )) ; - /* Add the new sample to the power estimate accumulator */ - ec->Lu_i += abs(u); - - /* Update the Far-end reference signal power estimate accumulator */ - /* -------------------------------------------------------------- */ - /* eq. (10): update power estimate of the reference */ - /* Delete the oldest sample from the power estimate accumulator */ - ec->Ly_i -= abs(get_cc_s(&ec->y_s, (1 << DEFAULT_SIGMA_LY_I) - 1)) ; - /* Add the new sample to the power estimate accumulator */ - ec->Ly_i += abs(iref); - - if (ec->Ly_i < DEFAULT_CUTOFF_I) - ec->Ly_i = DEFAULT_CUTOFF_I; - - - /* Update the Peak far-end receive signal detected */ - /* ----------------------------------------------- */ - if (ec->y_tilde_i > ec->max_y_tilde) { - /* New highest y_tilde with full life */ - ec->max_y_tilde = ec->y_tilde_i; - ec->max_y_tilde_pos = ec->N_d - 1; - } else if (--ec->max_y_tilde_pos < 0) { - /* Time to find new max y tilde... */ - ec->max_y_tilde = MAX16(ec->y_tilde_s.buf_d + ec->y_tilde_s.idx_d, ec->N_d, &ec->max_y_tilde_pos); - } - - /* Determine if near end speech was detected in this sample */ - /* -------------------------------------------------------- */ - if (((ec->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)) > ec->max_y_tilde) - && (ec->max_y_tilde > 0)) { - /* Then start the Hangover counter */ - ec->HCNTR_d = DEFAULT_HANGT; - RESTORE_COEFFS; -#ifdef MEC2_STATS_DETAILED - printk(KERN_INFO "Reset near end speech timer with: s_tilde_i %d, stmnt %d, max_y_tilde %d\n", ec->s_tilde_i, (ec->s_tilde_i >> (DEFAULT_ALPHA_ST_I - 1)), ec->max_y_tilde); -#endif -#ifdef MEC2_STATS - ++ec->cntr_nearend_speech_frames; -#endif - } else if (ec->HCNTR_d > (int)0) { - /* otherwise, if it's still non-zero, decrement the Hangover counter by one sample */ -#ifdef MEC2_STATS - ++ec->cntr_nearend_speech_frames; -#endif - ec->HCNTR_d--; - } - - /* Update coefficients if no near-end speech in this sample (ie. HCNTR_d = 0) - * and we have enough signal to bother trying to update. - * -------------------------------------------------------------------------- - */ - if (!ec->HCNTR_d && /* no near-end speech present */ - !(ec->i_d % DEFAULT_M)) { /* we only update on every DEFAULM_M'th sample from the stream */ - if (ec->Lu_i > MIN_UPDATE_THRESH_I) { /* there is sufficient energy above the noise floor to contain meaningful data */ - /* so loop over all the filter coefficients */ -#ifdef USED_COEFFS - int max_coeffs[USED_COEFFS]; - int *pos; - - if (ec->N_d > USED_COEFFS) - memset(max_coeffs, 0, USED_COEFFS*sizeof(int)); -#endif -#ifdef MEC2_STATS_DETAILED - printk(KERN_INFO "updating coefficients with: ec->Lu_i %9d\n", ec->Lu_i); -#endif -#ifdef MEC2_STATS - ec->avg_Lu_i_ok = ec->avg_Lu_i_ok + ec->Lu_i; - ++ec->cntr_coeff_updates; -#endif - for (k=0; k < ec->N_d; k++) { - /* eq. (7): compute an expectation over M_d samples */ - int grad2; - grad2 = CONVOLVE2(ec->u_s.buf_d + ec->u_s.idx_d, - ec->y_s.buf_d + ec->y_s.idx_d + k, - DEFAULT_M); - /* eq. (7): update the coefficient */ - ec->a_i[k] += grad2 / two_beta_i; - ec->a_s[k] = ec->a_i[k] >> 16; - -#ifdef USED_COEFFS - if (ec->N_d > USED_COEFFS) { - if (abs(ec->a_i[k]) > max_coeffs[USED_COEFFS-1]) { - /* More or less insertion-sort... */ - pos = max_coeffs; - while (*pos > abs(ec->a_i[k])) - pos++; - - if (*pos > max_coeffs[USED_COEFFS-1]) - memmove(pos+1, pos, (USED_COEFFS-(pos-max_coeffs)-1)*sizeof(int)); - - *pos = abs(ec->a_i[k]); - } - } -#endif - } - -#ifdef USED_COEFFS - /* Filter out irrelevant coefficients */ - if (ec->N_d > USED_COEFFS) - for (k=0; k < ec->N_d; k++) - if (abs(ec->a_i[k]) < max_coeffs[USED_COEFFS-1]) - ec->a_i[k] = ec->a_s[k] = 0; -#endif - } else { -#ifdef MEC2_STATS_DETAILED - printk(KERN_INFO "insufficient signal to update coefficients ec->Lu_i %5d < %5d\n", ec->Lu_i, MIN_UPDATE_THRESH_I); -#endif -#ifdef MEC2_STATS - ec->avg_Lu_i_toolow = ec->avg_Lu_i_toolow + ec->Lu_i; - ++ec->cntr_coeff_missedupdates; -#endif - } - } - - /* paragraph below eq. (15): if no near-end speech in the sample and - * the reference signal power estimate > cutoff threshold - * then perform residual error suppression - */ -#ifdef MEC2_STATS_DETAILED - if (ec->HCNTR_d == 0) - printk(KERN_INFO "possibily correcting frame with ec->Ly_i %9d ec->Lu_i %9d and expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); -#endif - -#ifndef NO_ECHO_SUPPRESSOR - if (ec->aggressive) { - if ((ec->HCNTR_d < AGGRESSIVE_HCNTR) && (ec->Ly_i > (ec->Lu_i << 1))) { - for (k=0; k < 2; k++) { - u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1); - } -#ifdef MEC2_STATS_DETAILED - printk(KERN_INFO "aggresively correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); -#endif -#ifdef MEC2_STATS - ++ec->cntr_residualcorrected_frames; -#endif - } - } else { - if (ec->HCNTR_d == 0) { - if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) { - for (k=0; k < 1; k++) { - u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1); - } -#ifdef MEC2_STATS_DETAILED - printk(KERN_INFO "correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); -#endif -#ifdef MEC2_STATS - ++ec->cntr_residualcorrected_frames; -#endif - } -#ifdef MEC2_STATS - else { - ++ec->cntr_residualcorrected_framesskipped; - } -#endif - } - } -#endif - -#if 0 - /* This will generate a non-linear supression factor, once converted */ - if ((ec->HCNTR_d == 0) && - ((ec->Lu_d/ec->Ly_d) < DEFAULT_SUPPR) && - (ec->Lu_d/ec->Ly_d > EC_MIN_DB_VALUE)) { - suppr_factor = (10 / (float)(SUPPR_FLOOR - SUPPR_CEIL)) * log(ec->Lu_d/ec->Ly_d) - - SUPPR_CEIL / (float)(SUPPR_FLOOR - SUPPR_CEIL); - u_suppr = pow(10.0, (suppr_factor) * RES_SUPR_FACTOR / 10.0) * u_suppr; - } -#endif - -#ifdef MEC2_STATS - /* Periodically dump performance stats */ - if ((ec->i_d % MEC2_STATS) == 0) { - /* make sure to avoid div0's! */ - if (ec->cntr_coeff_missedupdates > 0) - ec->avg_Lu_i_toolow = (int)(ec->avg_Lu_i_toolow / ec->cntr_coeff_missedupdates); - else - ec->avg_Lu_i_toolow = -1; - - if (ec->cntr_coeff_updates > 0) - ec->avg_Lu_i_ok = (ec->avg_Lu_i_ok / ec->cntr_coeff_updates); - else - ec->avg_Lu_i_ok = -1; - - printk(KERN_INFO "%d: Near end speech: %5d Residuals corrected/skipped: %5d/%5d Coefficients updated ok/low sig: %3d/%3d Lu_i avg ok/low sig %6d/%5d\n", - ec->id, - ec->cntr_nearend_speech_frames, - ec->cntr_residualcorrected_frames, ec->cntr_residualcorrected_framesskipped, - ec->cntr_coeff_updates, ec->cntr_coeff_missedupdates, - ec->avg_Lu_i_ok, ec->avg_Lu_i_toolow); - - ec->cntr_nearend_speech_frames = 0; - ec->cntr_residualcorrected_frames = 0; - ec->cntr_residualcorrected_framesskipped = 0; - ec->cntr_coeff_updates = 0; - ec->cntr_coeff_missedupdates = 0; - ec->avg_Lu_i_ok = 0; - ec->avg_Lu_i_toolow = 0; - } -#endif - - /* Increment the sample index and return the corrected sample */ - ec->i_d++; - return u; -} - -static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, - struct echo_can_state **ec) -{ - int maxy; - int maxu; - size_t size; - unsigned int x; - char *c; - - maxy = ecp->tap_length + DEFAULT_M; - maxu = DEFAULT_M; - if (maxy < (1 << DEFAULT_ALPHA_YT_I)) - maxy = (1 << DEFAULT_ALPHA_YT_I); - if (maxy < (1 << DEFAULT_SIGMA_LY_I)) - maxy = (1 << DEFAULT_SIGMA_LY_I); - if (maxu < (1 << DEFAULT_SIGMA_LU_I)) - maxu = (1 << DEFAULT_SIGMA_LU_I); - size = sizeof(**ec) + - 4 + /* align */ - sizeof(int) * ecp->tap_length + /* a_i */ - sizeof(short) * ecp->tap_length + /* a_s */ - sizeof(int) * ecp->tap_length + /* b_i */ - sizeof(int) * ecp->tap_length + /* c_i */ - 2 * sizeof(short) * (maxy) + /* y_s */ - 2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */ - 2 * sizeof(short) * (maxu) + /* u_s */ - 2 * sizeof(short) * ecp->tap_length; /* y_tilde_s */ - - if (!(*ec = MALLOC(size))) - return -ENOMEM; - - memset(*ec, 0, size); - -#ifdef AGGRESSIVE_SUPPRESSOR - (*ec)->aggressive = 1; -#endif - - for (x = 0; x < ecp->param_count; x++) { - for (c = p[x].name; *c; c++) - *c = tolower(*c); - if (!strcmp(p[x].name, "aggressive")) { - (*ec)->aggressive = p[x].value ? 1 : 0; - } else { - printk(KERN_WARNING "Unknown parameter supplied to MG2 echo canceler: '%s'\n", p[x].name); - kfree(*ec); - - return -EINVAL; - } - } - - init_cc(*ec, ecp->tap_length, maxy, maxu); - - return 0; -} - -static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) -{ - /* Set the hangover counter to the length of the can to - * avoid adjustments occuring immediately after initial forced training - */ - ec->HCNTR_d = ec->N_d << 1; - - if (pos >= ec->N_d) { - memcpy(ec->b_i,ec->a_i,ec->N_d*sizeof(int)); - memcpy(ec->c_i,ec->a_i,ec->N_d*sizeof(int)); - return 1; - } - - ec->a_i[pos] = val << 17; - ec->a_s[pos] = val << 1; - - if (++pos >= ec->N_d) { - memcpy(ec->b_i,ec->a_i,ec->N_d*sizeof(int)); - memcpy(ec->c_i,ec->a_i,ec->N_d*sizeof(int)); - return 1; - } - - return 0; -} - -#endif diff --git a/zaptel/kernel/mg2ec_const.h b/zaptel/kernel/mg2ec_const.h deleted file mode 100644 index 30ad4239..00000000 --- a/zaptel/kernel/mg2ec_const.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* - Important constants for tuning mg2 echo can - */ -#ifndef _MG2_CONST_H -#define _MG2_CONST_H - - -/* Convergence (aka. adaptation) speed -- higher means slower */ -#define DEFAULT_BETA1_I 2048 - -/* Constants for various power computations */ -#define DEFAULT_SIGMA_LY_I 7 -#define DEFAULT_SIGMA_LU_I 7 -#define DEFAULT_ALPHA_ST_I 5 /* near-end speech detection sensitivity factor */ -#define DEFAULT_ALPHA_YT_I 5 - -#define DEFAULT_CUTOFF_I 128 - -/* Define the near-end speech hangover counter: if near-end speech - * is declared, hcntr is set equal to hangt (see pg. 432) - */ -#define DEFAULT_HANGT 600 /* in samples, so 600 samples = 75ms */ - -/* define the residual error suppression threshold */ -#define DEFAULT_SUPPR_I 16 /* 16 = -24db */ - -/* This is the minimum reference signal power estimate level - * that will result in filter adaptation. - * If this is too low then background noise will cause the filter - * coefficients to constantly be updated. - */ -#define MIN_UPDATE_THRESH_I 2048 - -/* The number of samples used to update coefficients using the - * the block update method (M). It should be related back to the - * length of the echo can. - * ie. it only updates coefficients when (sample number MOD default_m) = 0 - * - * Getting this wrong may cause an oops. Consider yourself warned! - */ -#define DEFAULT_M 16 /* every 16th sample */ - -/* If AGGRESSIVE supression is enabled, then we start cancelling residual - * echos again even while there is potentially the very end of a near-side - * signal present. - * This defines how many samples of DEFAULT_HANGT can remain before we - * kick back in - */ -#define AGGRESSIVE_HCNTR 160 /* in samples, so 160 samples = 20ms */ - -/* Treat sample as error if it has a different sign as the - * input signal and is this number larger in ABS() as - * the input-signal */ -#define MAX_SIGN_ERROR 3000 - -/* Number of coefficients really used for calculating the - * simulated echo. The value specifies how many of the - * biggest coefficients are used for calculating rs. - * This helps on long echo-tails by artificially limiting - * the number of coefficients for the calculation and - * preventing overflows. - * Comment this to deactivate the code */ -#define USED_COEFFS 64 - -/* Backup coefficients every this number of samples */ -#define BACKUP 256 - -/***************************************************************/ -/* The following knobs are not implemented in the current code */ - -/* we need a dynamic level of suppression varying with the ratio of the - power of the echo to the power of the reference signal this is - done so that we have a smoother background. - we have a higher suppression when the power ratio is closer to - suppr_ceil and reduces logarithmically as we approach suppr_floor. - */ -#define SUPPR_FLOOR -64 -#define SUPPR_CEIL -24 - -/* in a second departure, we calculate the residual error suppression - * as a percentage of the reference signal energy level. The threshold - * is defined in terms of dB below the reference signal. - */ -#define RES_SUPR_FACTOR -20 - - -#endif /* _MG2_CONST_H */ - diff --git a/zaptel/kernel/oct612x/Makefile b/zaptel/kernel/oct612x/Makefile deleted file mode 100644 index e3e32e51..00000000 --- a/zaptel/kernel/oct612x/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -CFLAGS=-V3.4 -ffunction-sections -I/lib/modules/$(shell uname -r)/build/include -Iinclude -Ioctdeviceapi -Ioctdeviceapi/oct6100api -DGFP_ATOMIC=0 -Dkmalloc=calloc -Dkfree=free -LDFLAGS=-V3.4 -Wl,-Map -Wl,test.map -Wl,--gc-sections - -APIDIR=octdeviceapi/oct6100api/oct6100_api - -OCTASIC_OBJS=$(APIDIR)/oct6100_adpcm_chan.o \ - $(APIDIR)/oct6100_channel.o \ - $(APIDIR)/oct6100_chip_open.o \ - $(APIDIR)/oct6100_chip_stats.o \ - $(APIDIR)/oct6100_conf_bridge.o \ - $(APIDIR)/oct6100_debug.o \ - $(APIDIR)/oct6100_events.o \ - $(APIDIR)/oct6100_interrupts.o \ - $(APIDIR)/oct6100_memory.o \ - $(APIDIR)/oct6100_miscellaneous.o \ - $(APIDIR)/oct6100_mixer.o \ - $(APIDIR)/oct6100_phasing_tsst.o \ - $(APIDIR)/oct6100_playout_buf.o \ - $(APIDIR)/oct6100_remote_debug.o \ - $(APIDIR)/oct6100_tlv.o \ - $(APIDIR)/oct6100_tone_detection.o \ - $(APIDIR)/oct6100_tsi_cnct.o \ - $(APIDIR)/oct6100_tsst.o \ - $(APIDIR)/oct6100_user.o \ - apilib/bt/octapi_bt0.o \ - apilib/largmath/octapi_largmath.o \ - apilib/llman/octapi_llman.o - - -all: test - -test.o: test.c - -test: test.o $(OCTASIC_OBJS) - -clean: - rm -rf test test.o - rm -rf $(OCTASIC_OBJS) diff --git a/zaptel/kernel/oct612x/apilib/bt/octapi_bt0.c b/zaptel/kernel/oct612x/apilib/bt/octapi_bt0.c deleted file mode 100644 index f9af44ae..00000000 --- a/zaptel/kernel/oct612x/apilib/bt/octapi_bt0.c +++ /dev/null @@ -1,1217 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_bt0.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Library used to manage a binary tree of variable max size. Library is - made to use one block of contiguous memory to manage the tree. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 18 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#include "apilib/octapi_bt0.h" -#include "octapi_bt0_private.h" - - - -#if !SKIP_OctApiBt0GetSize -UINT32 OctApiBt0GetSize(UINT32 number_of_items,UINT32 key_size, UINT32 data_size, UINT32 * b_size) -{ - if ((key_size % 4) != 0) return(OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32); - if ((data_size % 4) != 0) return(OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32); - - *b_size = 0; - *b_size += sizeof(OCTAPI_BT0); - *b_size += sizeof(OCTAPI_BT0_NODE) * number_of_items; - *b_size += key_size * number_of_items; - *b_size += data_size * number_of_items; - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiBt0Init -UINT32 OctApiBt0Init(void ** b,UINT32 number_of_items,UINT32 key_size, UINT32 data_size) -{ - UINT32 i; - OCTAPI_BT0 * bb; - - /* Check input parameters.*/ - if ((key_size % 4) != 0) return(OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32); - if ((data_size % 4) != 0) return(OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32); - - /* If b is not already allocated.*/ - if (*b == NULL) return(OCTAPI_BT0_MALLOC_FAILED); - - bb = (OCTAPI_BT0 *)(*b); - - /* Initialize the tree to an empty one!*/ - bb->root_link.node_number = 0xFFFFFFFF; - bb->root_link.depth = 0; - - /* Initialize tree parameters.*/ - bb->number_of_items = number_of_items; - bb->key_size = key_size / 4; - bb->data_size = data_size / 4; - - /* Initialize the next free node pointer.*/ - if (number_of_items != 0) - bb->next_free_node = 0; - else - bb->next_free_node = 0xFFFFFFFF; - - /* Setup the arrays.*/ - OctApiBt0CorrectPointers(bb); - - /* Initialize the Nodes to unused!*/ - for(i=0;inode[i].next_free_node = i + 1; - } - - /* Last empty node points to invalid node.*/ - bb->node[number_of_items-1].next_free_node = 0xFFFFFFFF; - - bb->invalid_value = 0xFFFFFFFF; - bb->no_smaller_key = OCTAPI_BT0_NO_SMALLER_KEY; - - return(GENERIC_OK); -} -#endif - - -#if !SKIP_OctApiBt0CorrectPointers -void OctApiBt0CorrectPointers(OCTAPI_BT0 * bb) -{ - bb->node = (OCTAPI_BT0_NODE *)(((BYTE *)bb) + sizeof(OCTAPI_BT0)); - bb->key = (UINT32 *)(((BYTE *)bb->node) + (sizeof(OCTAPI_BT0_NODE) * bb->number_of_items)); - bb->data = (UINT32 *)(((BYTE *)bb->key) + (sizeof(UINT32) * bb->number_of_items * bb->key_size)); -} -#endif - - -#if !SKIP_OctApiBt0AddNode -UINT32 OctApiBt0AddNode(void * b,void * key,void ** data) -{ - OCTAPI_BT0 * bb; - OCTAPI_BT0_NODE * new_node; - UINT32 * lkey; - UINT32 * nkey; - UINT32 i; - UINT32 new_node_number; - UINT32 result; - - /* Load all!*/ - bb = (OCTAPI_BT0 *)(b); - OctApiBt0CorrectPointers(bb); - - /* Check that there is at least one block left.*/ - if (bb->next_free_node == 0xFFFFFFFF) return(OCTAPI_BT0_NO_NODES_AVAILABLE); - - /* Seize the node!*/ - new_node_number = bb->next_free_node; - new_node = &(bb->node[new_node_number]); - bb->next_free_node = new_node->next_free_node; - - /* Register in the key and the data.*/ - lkey = ((UINT32 *)key); - - /* Find the first UINT32 of the key.*/ - nkey = &(bb->key[bb->key_size * new_node_number]); - - /* Copy the key.*/ - for(i=0;ikey_size;i++) - nkey[i] = lkey[i]; - - /* Attempt to place the node. Only a "multiple hit" will cause an error.*/ - result = OctApiBt0AddNode2(bb,&(bb->root_link), lkey, new_node_number); - if (result != GENERIC_OK) - { - /* This attempt failed. Refree the node!*/ - bb->next_free_node = new_node_number; - - /* Return the error code.*/ - return(result); - } - - /* Return the address of the data to the user.*/ - if ( bb->data_size > 0 ) - *data = (void *)(&(bb->data[bb->data_size * new_node_number])); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiBt0AddNode2 -UINT32 OctApiBt0AddNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 new_node_number) -{ - UINT32 result; - - if (link->node_number == 0xFFFFFFFF) /* We have an empty node. Here, we shall place the new node.*/ - { - bb->node[new_node_number].l[0].node_number = 0xFFFFFFFF; - bb->node[new_node_number].l[0].depth = 0; - bb->node[new_node_number].l[1].node_number = 0xFFFFFFFF; - bb->node[new_node_number].l[1].depth = 0; - - /* OCTAPI_BT0_LINK to parent!*/ - link->node_number = new_node_number; - link->depth = 1; /* We are a leaf, last OCTAPI_BT0_LINK depth is 1.*/ - - return(GENERIC_OK); - } - else /* Current node is used, check for a match and a direction.*/ - { - OCTAPI_BT0_NODE * this_node; - UINT32 compare; - - /* Get a pointer to this node.*/ - this_node = &(bb->node[link->node_number]); - - /* Compare this node to the lkey.*/ - compare = OctApiBt0KeyCompare(bb,link,lkey); - - if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/ - { - result = OctApiBt0AddNode2(bb,&(this_node->l[0]), lkey, new_node_number); - if (result != GENERIC_OK) return(result); - } - else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/ - { - result = OctApiBt0AddNode2(bb,&(this_node->l[1]), lkey, new_node_number); - if (result != GENERIC_OK) return(result); - } - else - { - return(OCTAPI_BT0_KEY_ALREADY_IN_TREE); - } - - /* Check if this node is unbalanced by 2. If so, rebalance it:*/ - if (this_node->l[0].depth > (this_node->l[1].depth + 1) || - this_node->l[1].depth > (this_node->l[0].depth + 1)) - { - OctApiBt0Rebalance(bb,link); - } - - /* Always update the OCTAPI_BT0_LINK depth before exiting.*/ - OctApiBt0UpdateLinkDepth(bb,link); - - return(GENERIC_OK); - } -} -#endif - - -#if !SKIP_OctApiBt0AddNode3 -UINT32 OctApiBt0AddNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number) -{ - UINT32 result; - - if (link->node_number == 0xFFFFFFFF) /* We have an empty node. Here, we shall place the new node.*/ - { - if ( *p_new_node_number == 0xFFFFFFFF ) - return(OCTAPI_BT0_NO_NODES_AVAILABLE); - - bb->node[*p_new_node_number].l[0].node_number = 0xFFFFFFFF; - bb->node[*p_new_node_number].l[0].depth = 0; - bb->node[*p_new_node_number].l[1].node_number = 0xFFFFFFFF; - bb->node[*p_new_node_number].l[1].depth = 0; - - /* OCTAPI_BT0_LINK to parent!*/ - link->node_number = *p_new_node_number; - link->depth = 1; /* We are a leaf, last OCTAPI_BT0_LINK depth is 1.*/ - - return(GENERIC_OK); - } - else /* Current node is used, check for a match and a direction.*/ - { - OCTAPI_BT0_NODE * this_node; - UINT32 compare; - - /* Get a pointer to this node.*/ - this_node = &(bb->node[link->node_number]); - - /* Compare this node to the lkey.*/ - compare = OctApiBt0KeyCompare(bb,link,lkey); - - if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/ - { - result = OctApiBt0AddNode3(bb,&(this_node->l[0]), lkey, p_new_node_number); - if (result != GENERIC_OK) return(result); - } - else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/ - { - result = OctApiBt0AddNode3(bb,&(this_node->l[1]), lkey, p_new_node_number); - if (result != GENERIC_OK) return(result); - } - else - { - *p_new_node_number = link->node_number; - return(OCTAPI_BT0_KEY_ALREADY_IN_TREE); - } - - /* Check if this node is unbalanced by 2. If so, rebalance it:*/ - if (this_node->l[0].depth > (this_node->l[1].depth + 1) || - this_node->l[1].depth > (this_node->l[0].depth + 1)) - { - OctApiBt0Rebalance(bb,link); - } - - /* Always update the OCTAPI_BT0_LINK depth before exiting.*/ - OctApiBt0UpdateLinkDepth(bb,link); - - return(GENERIC_OK); - } -} -#endif - -/* state -0 -> first call to the function. -1 -> recursive call.*/ -#if !SKIP_OctApiBt0AddNode4 -UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number, UINT32 *p_prev_node_number, UINT32 state ) -{ - UINT32 result; - UINT32 *nkey; - UINT32 *okey; - - if (link->node_number == 0xFFFFFFFF) /* We have an empty node. Here, we shall place the new node.*/ - { - bb->node[*p_new_node_number].l[0].node_number = 0xFFFFFFFF; - bb->node[*p_new_node_number].l[0].depth = 0; - bb->node[*p_new_node_number].l[1].node_number = 0xFFFFFFFF; - bb->node[*p_new_node_number].l[1].depth = 0; - - /* OCTAPI_BT0_LINK to parent!*/ - link->node_number = *p_new_node_number; - link->depth = 1; /* We are a leaf, last OCTAPI_BT0_LINK depth is 1.*/ - - if ( state == 0 ) - *p_prev_node_number = 0xFFFFFFFF; - - return(GENERIC_OK); - } - else /* Current node is used, check for a match and a direction.*/ - { - OCTAPI_BT0_NODE * this_node; - UINT32 compare; - - /* Get a pointer to this node.*/ - this_node = &(bb->node[link->node_number]); - - /* Compare this node to the lkey.*/ - compare = OctApiBt0KeyCompare(bb,link,lkey); - - if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/ - { - if ( state == 0 ) - *p_prev_node_number = OCTAPI_BT0_NO_SMALLER_KEY; - - if ( *p_prev_node_number != OCTAPI_BT0_NO_SMALLER_KEY ) - { - /* Check if the key is the smallest one encountered yet.*/ - okey = &(bb->key[bb->key_size * (*p_prev_node_number)]); - nkey = &(bb->key[bb->key_size * link->node_number]); - /* If the node is key smaller then the old small one, change the value.*/ - if ( *nkey > *okey ) - { - if ( *nkey < *lkey ) - *p_prev_node_number = link->node_number; - } - } - - result = OctApiBt0AddNode4(bb,&(this_node->l[0]), lkey, p_new_node_number, p_prev_node_number, 1); - if (result != GENERIC_OK) return(result); - } - else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/ - { - if ( state == 0 ) - *p_prev_node_number = link->node_number; - else - { - if ( *p_prev_node_number == OCTAPI_BT0_NO_SMALLER_KEY ) - *p_prev_node_number = link->node_number; - else - { - /* Check if the key is the smallest one encountered yet.*/ - okey = &(bb->key[bb->key_size * (*p_prev_node_number)]); - nkey = &(bb->key[bb->key_size * link->node_number]); - /* If the node is key smaller then the old small one, change the value.*/ - if ( *nkey > *okey ) - { - if ( *nkey < *lkey ) - *p_prev_node_number = link->node_number; - } - } - } - - result = OctApiBt0AddNode4(bb,&(this_node->l[1]), lkey, p_new_node_number, p_prev_node_number, 1); - if (result != GENERIC_OK) return(result); - } - else - { - *p_new_node_number = link->node_number; - return(OCTAPI_BT0_KEY_ALREADY_IN_TREE); - } - - /* Check if this node is unbalanced by 2. If so, rebalance it:*/ - if (this_node->l[0].depth > (this_node->l[1].depth + 1) || - this_node->l[1].depth > (this_node->l[0].depth + 1)) - { - OctApiBt0Rebalance(bb,link); - } - - /* Always update the OCTAPI_BT0_LINK depth before exiting.*/ - OctApiBt0UpdateLinkDepth(bb,link); - - return(GENERIC_OK); - } -} -#endif - -#if !SKIP_OctApiBt0KeyCompare -UINT32 OctApiBt0KeyCompare(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey) -{ - UINT32 * nkey; - UINT32 i; - - /* Find the first UINT32 of the key.*/ - nkey = &(bb->key[bb->key_size * link->node_number]); - - for(i=0;ikey_size;i++) - { - if (lkey[i] < nkey[i]) - return(OCTAPI_BT0_LKEY_SMALLER); - else if (lkey[i] > nkey[i]) - return(OCTAPI_BT0_LKEY_LARGER); - } - - return(OCTAPI_BT0_LKEY_EQUAL); -} -#endif - - -#if !SKIP_OctApiBt0UpdateLinkDepth -void OctApiBt0UpdateLinkDepth(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link) -{ - OCTAPI_BT0_NODE * this_node; - - /* Get a pointer to this node.*/ - this_node = &(bb->node[link->node_number]); - - if (this_node->l[0].depth > this_node->l[1].depth) - link->depth = this_node->l[0].depth + 1; - else - link->depth = this_node->l[1].depth + 1; -} -#endif - -#if !SKIP_OctApiBt0Rebalance -void OctApiBt0Rebalance(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link) -{ - if (bb->node[root_link->node_number].l[0].depth > (bb->node[root_link->node_number].l[1].depth + 1)) /* Heavy to the left.*/ - { - /* Check if the right child of the heavy child node is causing a problem.*/ - /* If so, do a left rotate in order to make the left most child the longer one.*/ - { - OCTAPI_BT0_LINK * heavy_link; - heavy_link = &(bb->node[root_link->node_number].l[0]); - - if (bb->node[heavy_link->node_number].l[1].depth > bb->node[heavy_link->node_number].l[0].depth) - { - OctApiBt0ExternalHeavy(bb,heavy_link); - } - } - - /* Ready to do super rotation!*/ - { - OCTAPI_BT0_LINK init_root_link; - OCTAPI_BT0_LINK init_heavy_link; - OCTAPI_BT0_LINK init_leaf_tree[3]; - - /* Save pertinent initial OCTAPI_BT0_LINK information.*/ - init_root_link = *root_link; - init_heavy_link = bb->node[root_link->node_number].l[0]; - init_leaf_tree[2] = bb->node[root_link->node_number].l[1]; - init_leaf_tree[0] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[0]; - init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[1]; - - /* Restructure the tree.*/ - *root_link = init_heavy_link; - bb->node[init_heavy_link.node_number].l[1] = init_root_link; - bb->node[init_root_link.node_number].l[0] = init_leaf_tree[1]; - - /* Reconstruct the depth of the branches.*/ - OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[1])); - OctApiBt0UpdateLinkDepth(bb,root_link); - } - } - else if (bb->node[root_link->node_number].l[1].depth > (bb->node[root_link->node_number].l[0].depth + 1)) /* Heavy to the right.*/ - { - /* Check if the right child of the heavy child node is causing a problem.*/ - /* If so, do a left rotate in order to make the left most child the longer one.*/ - { - OCTAPI_BT0_LINK * heavy_link; - heavy_link = &(bb->node[root_link->node_number].l[1]); - - if (bb->node[heavy_link->node_number].l[0].depth > bb->node[heavy_link->node_number].l[1].depth) - { - OctApiBt0ExternalHeavy(bb,heavy_link); - } - } - - /* Ready to do super rotation!*/ - { - OCTAPI_BT0_LINK init_root_link; - OCTAPI_BT0_LINK init_heavy_link; - OCTAPI_BT0_LINK init_leaf_tree[3]; - - /* Save pertinent initial OCTAPI_BT0_LINK information.*/ - init_root_link = *root_link; - init_heavy_link = bb->node[root_link->node_number].l[1]; - init_leaf_tree[2] = bb->node[root_link->node_number].l[0]; - init_leaf_tree[0] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[1]; - init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[0]; - - /* Restructure the tree.*/ - *root_link = init_heavy_link; - bb->node[init_heavy_link.node_number].l[0] = init_root_link; - bb->node[init_root_link.node_number].l[1] = init_leaf_tree[1]; - - /* Reconstruct the depth of the branches.*/ - OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[0])); - OctApiBt0UpdateLinkDepth(bb,root_link); - } - } -} -#endif - -/* This function does a rotation towards the outside of the tree*/ -/* in order to keep the heavy branches towards the outside.*/ -#if !SKIP_OctApiBt0ExternalHeavy -void OctApiBt0ExternalHeavy(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * root_link) -{ - if (bb->node[root_link->node_number].l[1].depth > bb->node[root_link->node_number].l[0].depth) /* Exterior of tree is towards the left.*/ - { - OCTAPI_BT0_LINK init_root_link; - OCTAPI_BT0_LINK init_heavy_link; - OCTAPI_BT0_LINK init_leaf_tree[3]; - - /* Save pertinent initial OCTAPI_BT0_LINK information.*/ - init_root_link = *root_link; - init_leaf_tree[0] = bb->node[root_link->node_number].l[0]; - init_heavy_link = bb->node[root_link->node_number].l[1]; - init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[0]; - init_leaf_tree[2] = bb->node[bb->node[root_link->node_number].l[1].node_number].l[1]; - - /* Restructure the tree.*/ - *root_link = init_heavy_link; - bb->node[init_heavy_link.node_number].l[0] = init_root_link; - bb->node[init_root_link.node_number].l[1] = init_leaf_tree[1]; - - /* Reconstruct the depth of the branches.*/ - OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[0])); - OctApiBt0UpdateLinkDepth(bb,root_link); - } - else if (bb->node[root_link->node_number].l[0].depth > bb->node[root_link->node_number].l[1].depth) /* Exterior of tree is towards the right.*/ - { - OCTAPI_BT0_LINK init_root_link; - OCTAPI_BT0_LINK init_heavy_link; - OCTAPI_BT0_LINK init_leaf_tree[3]; - - /* Save pertinent initial OCTAPI_BT0_LINK information.*/ - init_root_link = *root_link; - init_leaf_tree[0] = bb->node[root_link->node_number].l[1]; - init_heavy_link = bb->node[root_link->node_number].l[0]; - init_leaf_tree[1] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[1]; - init_leaf_tree[2] = bb->node[bb->node[root_link->node_number].l[0].node_number].l[0]; - - /* Restructure the tree.*/ - *root_link = init_heavy_link; - bb->node[init_heavy_link.node_number].l[1] = init_root_link; - bb->node[init_root_link.node_number].l[0] = init_leaf_tree[1]; - - /* Reconstruct the depth of the branches.*/ - OctApiBt0UpdateLinkDepth(bb,&(bb->node[root_link->node_number].l[1])); - OctApiBt0UpdateLinkDepth(bb,root_link); - } -} -#endif - - -/* State:*/ -/* 0 = seeking node to be removed.*/ -/* 1 = node found, left branch taken.*/ -/* 2 = node found, right branch taken.*/ -#if !SKIP_OctApiBt0RemoveNode2 -UINT32 OctApiBt0RemoveNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link) -{ - UINT32 result; - OCTAPI_BT0_NODE * this_node; - - /* Get a pointer to this node.*/ - this_node = &(bb->node[link->node_number]); - - if (state == 0) - { - if (link->node_number == 0xFFFFFFFF) /* We have an empty node. The node we were looking for does not exist.*/ - { - return(OCTAPI_BT0_KEY_NOT_IN_TREE); - } - else /* Current node is used, check for a match and a direction.*/ - { - UINT32 compare; - - /* Compare this node to the lkey.*/ - compare = OctApiBt0KeyCompare(bb,link,lkey); - - if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/ - { - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, 0, NULL); - if (result != GENERIC_OK) return(result); - } - else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/ - { - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, 0, NULL); - if (result != GENERIC_OK) return(result); - } - else - { - link_to_removed_node = link; - - /* Keep on going down to find a replacement node.*/ - if (bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF) - { - /* Doe! No tree left! WHAT TO DO? */ - /* Just delete the current node. That's it.*/ - - /* Release the current node (restore free node link-list)*/ - bb->node[link->node_number].next_free_node = bb->next_free_node; - bb->next_free_node = link->node_number; - - link->node_number = 0xFFFFFFFF; - link->depth = 0; - - return(GENERIC_OK); - } - else if (bb->node[link->node_number].l[0].node_number != 0xFFFFFFFF) /* Left node is present. Go left, then permanently right.*/ - { - OCTAPI_BT0_NODE * removed_node_pnt; - removed_node_pnt = &(bb->node[link->node_number]); - - result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[0]), lkey, link_to_removed_node, 1, link); - if (result != GENERIC_OK) return(result); - - /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/ - /* but is about to be discarded! Save it quickly!*/ - /* bb->node[link->node_number].l[0] = removed_node_pnt->l[0];*/ - } - else /* Right node is present. Go right, then permanently left.*/ - { - OCTAPI_BT0_NODE * removed_node_pnt; - removed_node_pnt = &(bb->node[link->node_number]); - - result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[1]), lkey, link_to_removed_node, 2, link); - if (result != GENERIC_OK) return(result); - - /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/ - /* but is about to be discarded! Save it quickly!*/ - /* bb->node[link->node_number].l[1] = removed_node_pnt->l[1];*/ - } - } - } - } - else - { - /* Left side, Right-most node found! OR*/ - /* Right side, Left-most node found!*/ - if ((state == 1 && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF) || - (state == 2 && bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF)) - { - OCTAPI_BT0_LINK init_chosen_link; - - /* Release the current node (restore free node link-list)*/ - bb->node[link_to_removed_node->node_number].next_free_node = bb->next_free_node; - bb->next_free_node = link_to_removed_node->node_number; - - /* Save the link to the chosen node, because it is about to be deleted.*/ - init_chosen_link = *link; - - /* Remove this node, and allow the tree to go on:*/ - { - OCTAPI_BT0_LINK init_child_link[2]; - - init_child_link[0] = bb->node[link->node_number].l[0]; - init_child_link[1] = bb->node[link->node_number].l[1]; - - if (state == 1) - *link = init_child_link[0]; - else - *link = init_child_link[1]; - } - - /* Replace the removed node by this node.*/ - { - OCTAPI_BT0_LINK init_removed_child_link[2]; - - init_removed_child_link[0] = bb->node[link_to_removed_node->node_number].l[0]; - init_removed_child_link[1] = bb->node[link_to_removed_node->node_number].l[1]; - - *link_to_removed_node = init_chosen_link; - bb->node[init_chosen_link.node_number].l[0] = init_removed_child_link[0]; - bb->node[init_chosen_link.node_number].l[1] = init_removed_child_link[1]; - } - - return(GENERIC_OK); - } - else - { - /* Keep on going, we have not found the center most node yet!*/ - if (state == 1) - { - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, state, NULL); - if (result != GENERIC_OK) return(result); - - /* Refresh the link if our link is volatile.*/ - if (volatile_grandparent_link != NULL) - { - link = &(bb->node[volatile_grandparent_link->node_number].l[0]); - } - } - else - { - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, state, NULL); - if (result != GENERIC_OK) return(result); - - /* Refresh the link if our link is volatile.*/ - if (volatile_grandparent_link != NULL) - { - link = &(bb->node[volatile_grandparent_link->node_number].l[1]); - } - } - } - } - - /* We may have messed up the tree. So patch it!*/ - /* Check if this node is unbalanced by 2. If so, rebalance it:*/ - if (this_node->l[0].depth > (this_node->l[1].depth + 1) || - this_node->l[1].depth > (this_node->l[0].depth + 1)) - { - OctApiBt0Rebalance(bb,link); - } - - /* Always update the OCTAPI_BT0_LINK depth before exiting.*/ - OctApiBt0UpdateLinkDepth(bb,link); - - return(GENERIC_OK); -} -#endif - - -/* State:*/ -/* 0 = seeking node to be removed.*/ -/* 1 = node found, left branch taken.*/ -/* 2 = node found, right branch taken.*/ -#if !SKIP_OctApiBt0RemoveNode3 -UINT32 OctApiBt0RemoveNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link, UINT32 *p_prev_node_number ) -{ - UINT32 result; - UINT32 *nkey; - UINT32 *okey; - OCTAPI_BT0_NODE * this_node; - - /* Get a pointer to this node.*/ - this_node = &(bb->node[link->node_number]); - - if (state == 0) - { - if (link->node_number == 0xFFFFFFFF) /* We have an empty node. The node we were looking for does not exist.*/ - { - return(OCTAPI_BT0_KEY_NOT_IN_TREE); - } - else /* Current node is used, check for a match and a direction.*/ - { - UINT32 compare; - - /* Compare this node to the lkey.*/ - compare = OctApiBt0KeyCompare(bb,link,lkey); - - if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/ - { - /* Check if the key is the biggest one encountered yet.*/ - okey = &(bb->key[bb->key_size * (*p_prev_node_number)]); - nkey = &(bb->key[bb->key_size * link->node_number]); - /* If the node is key bigger then the old one, change the value.*/ - if ( *nkey > *okey ) - { - if ( *nkey < *lkey ) - *p_prev_node_number = link->node_number; - } - - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, 0, NULL); - if (result != GENERIC_OK) return(result); - } - else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/ - { - /* Check if the key is the biggest one encountered yet.*/ - okey = &(bb->key[bb->key_size * (*p_prev_node_number)]); - nkey = &(bb->key[bb->key_size * link->node_number]); - /* If the node is key bigger then the old one, change the value.*/ - if ( *nkey > *okey ) - { - if ( *nkey < *lkey ) - *p_prev_node_number = link->node_number; - } - - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, 0, NULL); - if (result != GENERIC_OK) return(result); - } - else - { - link_to_removed_node = link; - - /* Keep on going down to find a replacement node.*/ - if (bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF) - { - /* Doe! No tree left! WHAT TO DO? */ - /* Just delete the current node. That's it.*/ - - /* Release the current node (restore free node link-list)*/ - bb->node[link->node_number].next_free_node = bb->next_free_node; - bb->next_free_node = link->node_number; - - link->node_number = 0xFFFFFFFF; - link->depth = 0; - - return(GENERIC_OK); - } - else if (bb->node[link->node_number].l[0].node_number != 0xFFFFFFFF) /* Left node is present. Go left, then permanently right.*/ - { - OCTAPI_BT0_NODE * removed_node_pnt; - removed_node_pnt = &(bb->node[link->node_number]); - - result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[0]), lkey, link_to_removed_node, 1, link); - if (result != GENERIC_OK) return(result); - - /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/ - /* but is about to be discarded! Save it quickly!*/ - /* bb->node[link->node_number].l[0] = removed_node_pnt->l[0];*/ - } - else /* Right node is present. Go right, then permanently left.*/ - { - OCTAPI_BT0_NODE * removed_node_pnt; - removed_node_pnt = &(bb->node[link->node_number]); - - result = OctApiBt0RemoveNode2(bb,&(removed_node_pnt->l[1]), lkey, link_to_removed_node, 2, link); - if (result != GENERIC_OK) return(result); - - /* Caution! Once we are here, the link->node_pnt->l[0] has been modified,*/ - /* but is about to be discarded! Save it quickly!*/ - /* bb->node[link->node_number].l[1] = removed_node_pnt->l[1];*/ - } - } - } - } - else - { - /* Check if the key is the biggest one encountered yet.*/ - okey = &(bb->key[bb->key_size * (*p_prev_node_number)]); - nkey = &(bb->key[bb->key_size * link->node_number]); - /* If the node is key bigger then the old one, change the value.*/ - if ( *nkey > *okey ) - { - if ( *nkey < *lkey ) - *p_prev_node_number = link->node_number; - } - - /* Left side, Right-most node found! OR*/ - /* Right side, Left-most node found!*/ - if ((state == 1 && bb->node[link->node_number].l[1].node_number == 0xFFFFFFFF) || - (state == 2 && bb->node[link->node_number].l[0].node_number == 0xFFFFFFFF)) - { - OCTAPI_BT0_LINK init_chosen_link; - - /* Release the current node (restore free node link-list)*/ - bb->node[link_to_removed_node->node_number].next_free_node = bb->next_free_node; - bb->next_free_node = link_to_removed_node->node_number; - - /* Save the link to the chosen node, because it is about to be deleted.*/ - init_chosen_link = *link; - - /* Remove this node, and allow the tree to go on:*/ - { - OCTAPI_BT0_LINK init_child_link[2]; - - init_child_link[0] = bb->node[link->node_number].l[0]; - init_child_link[1] = bb->node[link->node_number].l[1]; - - if (state == 1) - *link = init_child_link[0]; - else - *link = init_child_link[1]; - } - - /* Replace the removed node by this node.*/ - { - OCTAPI_BT0_LINK init_removed_child_link[2]; - - init_removed_child_link[0] = bb->node[link_to_removed_node->node_number].l[0]; - init_removed_child_link[1] = bb->node[link_to_removed_node->node_number].l[1]; - - *link_to_removed_node = init_chosen_link; - bb->node[init_chosen_link.node_number].l[0] = init_removed_child_link[0]; - bb->node[init_chosen_link.node_number].l[1] = init_removed_child_link[1]; - } - - return(GENERIC_OK); - } - else - { - /* Keep on going, we have not found the center most node yet!*/ - if (state == 1) - { - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[1]), lkey, link_to_removed_node, state, NULL); - if (result != GENERIC_OK) return(result); - - /* Refresh the link if our link is volatile.*/ - if (volatile_grandparent_link != NULL) - { - link = &(bb->node[volatile_grandparent_link->node_number].l[0]); - } - } - else - { - result = OctApiBt0RemoveNode2(bb,&(bb->node[link->node_number].l[0]), lkey, link_to_removed_node, state, NULL); - if (result != GENERIC_OK) return(result); - - /* Refresh the link if our link is volatile.*/ - if (volatile_grandparent_link != NULL) - { - link = &(bb->node[volatile_grandparent_link->node_number].l[1]); - } - } - } - } - - /* We may have messed up the tree. So patch it!*/ - /* Check if this node is unbalanced by 2. If so, rebalance it:*/ - if (this_node->l[0].depth > (this_node->l[1].depth + 1) || - this_node->l[1].depth > (this_node->l[0].depth + 1)) - { - OctApiBt0Rebalance(bb,link); - } - - /* Always update the OCTAPI_BT0_LINK depth before exiting.*/ - OctApiBt0UpdateLinkDepth(bb,link); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiBt0RemoveNode -UINT32 OctApiBt0RemoveNode(void * b,void * key) -{ - OCTAPI_BT0 * bb; - UINT32 result; - UINT32 * lkey; - - /* Load all!*/ - bb = (OCTAPI_BT0 *)(b); - OctApiBt0CorrectPointers(bb); - - /* Register in the key and the data.*/ - lkey = ((UINT32 *)key); - - /* Attempt to remove the node. Only a "no hit" will cause an error.*/ - result = OctApiBt0RemoveNode2(bb,&(bb->root_link), lkey, NULL, 0, NULL); - if (result != GENERIC_OK) return(result); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiBt0QueryNode2 -UINT32 OctApiBt0QueryNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 * node_number) -{ - UINT32 result; - - if (link->node_number == 0xFFFFFFFF) /* We have an empty node. The node we were looking for does not exist.*/ - { - return(OCTAPI_BT0_KEY_NOT_IN_TREE); - } - else /* Current node is used, check for a match and a direction.*/ - { - UINT32 compare; - - /* Compare this node to the lkey.*/ - compare = OctApiBt0KeyCompare(bb,link,lkey); - - if (compare == OCTAPI_BT0_LKEY_SMALLER) /* Go left.*/ - { - result = OctApiBt0QueryNode2(bb,&(bb->node[link->node_number].l[0]), lkey, node_number); - if (result != GENERIC_OK) return(result); - } - else if (compare == OCTAPI_BT0_LKEY_LARGER) /* Go right.*/ - { - result = OctApiBt0QueryNode2(bb,&(bb->node[link->node_number].l[1]), lkey, node_number); - if (result != GENERIC_OK) return(result); - } - else - { - /* A match!*/ - *node_number = link->node_number; - } - } - - return(GENERIC_OK); -} -#endif - - -#if !SKIP_OctApiBt0QueryNode -UINT32 OctApiBt0QueryNode(void * b,void * key,void ** data) -{ - OCTAPI_BT0 * bb; - UINT32 node_number; - UINT32 result; - UINT32 * lkey; - - /* Load all!*/ - bb = (OCTAPI_BT0 *)(b); - OctApiBt0CorrectPointers(bb); - - /* Register in the key and the data.*/ - lkey = ((UINT32 *)key); - - /* Get the node number.*/ - result = OctApiBt0QueryNode2(bb,&(bb->root_link),lkey,&node_number); - if (result != GENERIC_OK) return(result); - - /* Return the address of the data to the user.*/ - if ( bb->data_size > 0 ) - *data = (void *)(&(bb->data[bb->data_size * node_number])); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiBt0GetFirstNode -UINT32 OctApiBt0GetFirstNode(void * b,void ** key, void ** data) -{ - OCTAPI_BT0 * bb; - OCTAPI_BT0_NODE * node; - UINT32 node_number; - UINT32 * lkey; - - /* Load all!*/ - bb = (OCTAPI_BT0 *)(b); - OctApiBt0CorrectPointers(bb); - - /* Register in the key and the data.*/ - lkey = ((UINT32 *)key); - - /* Check if there are any keys present in the tree. */ - if (bb->root_link.node_number == 0xFFFFFFFF) return OCTAPI_BT0_NO_NODES_AVAILABLE; - - node_number = bb->root_link.node_number; - node = &bb->node[node_number]; - - /* Make our way down to the left-most node. */ - while (node->l[0].node_number != 0xFFFFFFFF) - { - node_number = node->l[0].node_number; - node = &bb->node[node_number]; - } - - /* Return the address of the data to the user.*/ - if ( bb->key_size > 0 ) - *key = (void *)(&(bb->key[bb->key_size * node_number])); - - if ( bb->data_size > 0 ) - *data = (void *)(&(bb->data[bb->data_size * node_number])); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiBt0FindOrAddNode -UINT32 OctApiBt0FindOrAddNode(void * b,void * key,void ** data, UINT32 *fnct_result) -{ - OCTAPI_BT0 * bb; - OCTAPI_BT0_NODE * new_node; - UINT32 * lkey; - UINT32 * nkey; - UINT32 i; - UINT32 new_node_number; - UINT32 temp_node_number = 0; - UINT32 result; - UINT32 tree_already_full = FALSE; - - /* Load all!*/ - bb = (OCTAPI_BT0 *)(b); - OctApiBt0CorrectPointers(bb); - - /* Seize the node!*/ - new_node_number = bb->next_free_node; - /* Register in the key and the data.*/ - lkey = ((UINT32 *)key); - - /* Check that there is at least one block left.*/ - if (bb->next_free_node != 0xFFFFFFFF) - { - - temp_node_number = new_node_number; - new_node = &(bb->node[new_node_number]); - bb->next_free_node = new_node->next_free_node; - - /* Find the first UINT32 of the key.*/ - nkey = &(bb->key[bb->key_size * new_node_number]); - - /* Copy the key.*/ - for(i=0;ikey_size;i++) - nkey[i] = lkey[i]; - } - else - tree_already_full = TRUE; /* Signal that the tree was already full when the function was called.*/ - - /* Attempt to place the node. Only a "multiple hit" will cause an error.*/ - result = OctApiBt0AddNode3(bb,&(bb->root_link), lkey, &new_node_number); - switch( result ) - { - case GENERIC_OK: - *fnct_result = OCTAPI0_BT0_NODE_ADDDED; - break; - case OCTAPI_BT0_KEY_ALREADY_IN_TREE: - *fnct_result = OCTAPI0_BT0_NODE_FOUND; - /* This attempt did not add a new node. Refree the node!*/ - if ( tree_already_full == FALSE ) - bb->next_free_node = temp_node_number; - result = GENERIC_OK; - break; - default: - break; - } - - if (result != GENERIC_OK) - { - /* This attempt failed. Refree the node!*/ - if ( tree_already_full == FALSE ) - bb->next_free_node = new_node_number; - - /* Return the error code.*/ - return(result); - } - - /* Return the address of the data to the user.*/ - if ( bb->data_size > 0 ) - *data = (void *)(&(bb->data[bb->data_size * new_node_number])); - - return(GENERIC_OK); -} -#endif - - -#if !SKIP_OctApiBt0AddNodeReportPrevNodeData -UINT32 OctApiBt0AddNodeReportPrevNodeData(void * b,void * key,void ** data, void ** prev_data, PUINT32 fnct_result ) -{ - OCTAPI_BT0 * bb; - OCTAPI_BT0_NODE * new_node; - UINT32 * lkey; - UINT32 * nkey; - UINT32 i; - UINT32 new_node_number; - UINT32 temp_node_number; - UINT32 prev_node_number; - UINT32 result; - - /* Load all!*/ - bb = (OCTAPI_BT0 *)(b); - OctApiBt0CorrectPointers(bb); - - /* Check that there is at least one block left.*/ - if (bb->next_free_node == 0xFFFFFFFF) return(OCTAPI_BT0_NO_NODES_AVAILABLE); - - /* Seize the node!*/ - new_node_number = bb->next_free_node; - temp_node_number = new_node_number; - new_node = &(bb->node[new_node_number]); - bb->next_free_node = new_node->next_free_node; - - /* Set the previous node value */ - prev_node_number = 0xFFFFFFFF; - - /* Register in the key and the data.*/ - lkey = ((UINT32 *)key); - - /* Find the first UINT32 of the key.*/ - nkey = &(bb->key[bb->key_size * new_node_number]); - - /* Copy the key.*/ - for(i=0;ikey_size;i++) - nkey[i] = lkey[i]; - - /* Attempt to place the node. Only a "multiple hit" will cause an error.*/ - result = OctApiBt0AddNode4(bb,&(bb->root_link), lkey, &new_node_number, &prev_node_number, 0); - switch( result ) - { - case GENERIC_OK: - *fnct_result = OCTAPI0_BT0_NODE_ADDDED; - break; - case OCTAPI_BT0_KEY_ALREADY_IN_TREE: - *fnct_result = OCTAPI0_BT0_NODE_FOUND; - /* This attempt did not add a new node. Refree the node!*/ - bb->next_free_node = temp_node_number; - result = GENERIC_OK; - break; - default: - break; - } - - if (result != GENERIC_OK) - { - /* This attempt failed. Refree the node!*/ - bb->next_free_node = new_node_number; - - /* Return the error code.*/ - return(result); - } - - /* Return the address of the data to the user.*/ - if ( bb->data_size > 0 ) - *data = (void *)(&(bb->data[bb->data_size * new_node_number])); - - if ( bb->data_size > 0 ) - { - if ( (prev_node_number != 0xFFFFFFFF) && - (prev_node_number != OCTAPI_BT0_NO_SMALLER_KEY) && - (*fnct_result == OCTAPI0_BT0_NODE_ADDDED)) - *prev_data = ( void* )(&(bb->data[bb->data_size * prev_node_number])); - else if ( prev_node_number == 0xFFFFFFFF ) - *prev_data = ( void* )(&bb->invalid_value); - else if ( prev_node_number == OCTAPI_BT0_NO_SMALLER_KEY ) - *prev_data = ( void* )(&bb->no_smaller_key); - } - - return(GENERIC_OK); -} -#endif - diff --git a/zaptel/kernel/oct612x/apilib/bt/octapi_bt0_private.h b/zaptel/kernel/oct612x/apilib/bt/octapi_bt0_private.h deleted file mode 100644 index 8c68c3e3..00000000 --- a/zaptel/kernel/oct612x/apilib/bt/octapi_bt0_private.h +++ /dev/null @@ -1,93 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_bt0_private.h - -Copyright (c) 2001 Octasic Inc. All rights reserved. - -Description: - - Library used to manage a binary tree of variable max size. Library is - made to use one block of contiguous memory to manage the tree. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 11 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTAPI_BT0_PRIVATE_H__ -#define __OCTAPI_BT0_PRIVATE_H__ - - - -#include "octdef.h" - -#define OCTAPI_BT0_LKEY_LARGER 0x0 -#define OCTAPI_BT0_LKEY_SMALLER 0x1 -#define OCTAPI_BT0_LKEY_EQUAL 0x2 - -typedef struct __OCTAPI_BT0_LINK__ -{ - UINT32 node_number; - UINT32 depth; -} OCTAPI_BT0_LINK; - -typedef struct __OCTAPI_BT0_NODE__ -{ - UINT32 next_free_node; /* Number of the next node in the free node link-list.*/ - OCTAPI_BT0_LINK l[2]; /* 0 = left link; 1 = right link.*/ -} OCTAPI_BT0_NODE; - - -typedef struct __OCTAPI_BT0__ -{ - UINT32 number_of_items; /* Number of items on total that can be allocated in the tree.*/ - UINT32 key_size; /* Size is in UINT32s*/ - UINT32 data_size; /* Size is in UINT32s*/ - - /* Empty node linked-list:*/ - UINT32 next_free_node; /* 0xFFFFFFFF means that no nodes are free.*/ - - /* Tree as such:*/ - OCTAPI_BT0_NODE * node; /* Array of nodes (number_of_items in size).*/ - - /* Tree root:*/ - OCTAPI_BT0_LINK root_link; - - /* Associated key structure*/ - UINT32 * key; /* Array of keys associated to NODEs.*/ - - /* Associated data structure.*/ - UINT32 * data; /* Array of data associated to NODEs.*/ - - UINT32 invalid_value; - UINT32 no_smaller_key; - -} OCTAPI_BT0; - -void OctApiBt0CorrectPointers( OCTAPI_BT0 * bb ); -UINT32 OctApiBt0AddNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, UINT32 new_node_number ); -UINT32 OctApiBt0AddNode3( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, UINT32 *p_new_node_number ); -UINT32 OctApiBt0AddNode4(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 *p_new_node_number, UINT32 *p_prev_node_number, UINT32 state ); -UINT32 OctApiBt0KeyCompare( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey ); -void OctApiBt0UpdateLinkDepth( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link ); -void OctApiBt0Rebalance( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link ); -void OctApiBt0ExternalHeavy( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link ); -UINT32 OctApiBt0RemoveNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link ); - - - -#endif /*__OCTAPI_BT0_PRIVATE_H__*/ diff --git a/zaptel/kernel/oct612x/apilib/largmath/octapi_largmath.c b/zaptel/kernel/oct612x/apilib/largmath/octapi_largmath.c deleted file mode 100644 index 75153b8e..00000000 --- a/zaptel/kernel/oct612x/apilib/largmath/octapi_largmath.c +++ /dev/null @@ -1,628 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_largmath.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Library used to perform arithmetic on integer values of an integer multiple - of 32-bits. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 10 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#include "apilib/octapi_largmath.h" - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmAdd. -| -| Description: This function adds 2 numbers, a and b. Number a is -| (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long. The -| result is (zlen + 1) * 32 bits long. It the function succeeds it returns -| GENERIC_OK, else GENERIC_ERROR. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *a UINT32 The array containing the first number. -| alen USHORT The length of array a, minus 1 (0 - 99). -| *b UINT32 The array containing the second number. -| blen USHORT The length of array b, minus 1 (0 - 99). -| *z UINT32 The array containing the resulting number. -| zlen USHORT The length of array z, minus 1 (0 - 99). -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmAdd -UINT32 OctApiLmAdd(UINT32 * a,USHORT alen,UINT32 * b,USHORT blen,UINT32 * z, USHORT zlen) -{ - USHORT i; - UINT32 temp; - UINT32 carry=0; - UINT32 aprim; - UINT32 bprim; - - /* Check for array lengths.*/ - if (alen > zlen || blen > zlen) return(OCTAPI_LM_ARRAY_SIZE_MISMATCH); - - for(i=0;i<=zlen;i++) - { - if (i <= alen) aprim = *(a+i); else aprim = 0; - if (i <= blen) bprim = *(b+i); else bprim = 0; - temp = aprim + bprim + carry; - - /* Calculate carry for next time.*/ - if (carry == 0) - if (temp < aprim) carry = 1; else carry = 0; - else - if (temp <= aprim) carry = 1; else carry = 0; - - /* Write new value.*/ - *(z+i) = temp; - } - - /* Check for overflow.*/ - if (carry == 1) return(OCTAPI_LM_OVERFLOW); - - /* All is well.*/ - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmSubtract. -| -| Description: This function subtracts 2 numbers, a and b. Number a is -| (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long. The result -| is (zlen + 1) * 32 bits long. It the function succeeds it returns -| GENERIC_OK, else GENERIC_ERROR. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *a UINT32 The array containing the first number. -| alen USHORT The length of array a, minus 1 (0 - 99). -| *bneg UINT32 The array containing the second number. -| blen USHORT The length of array b, minus 1 (0 - 99). -| *z UINT32 The array containing the resulting number. -| zlen USHORT The length of array z, minus 1 (0 - 99). -| *neg USHORT Indicates if the result is negative -| (TRUE/FALSE). -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmSubtract -UINT32 OctApiLmSubtract(UINT32 * a,USHORT alen,UINT32 * bneg,USHORT blen,UINT32 * z,USHORT zlen,USHORT * neg) -{ - USHORT i; - UINT32 temp; - UINT32 carry=1; - UINT32 aprim; - UINT32 bprim; - - /* Check for array lengths.*/ - if (alen > zlen || blen > zlen) return(OCTAPI_LM_ARRAY_SIZE_MISMATCH); - - for(i=0;i<=zlen;i++) - { - if (i <= alen) aprim = *(a+i); else aprim = 0; - if (i <= blen) bprim = ~(*(bneg+i)); else bprim = 0xFFFFFFFF; - temp = aprim + bprim + carry; - - /* Calculate carry for next time.*/ - if (carry == 0) - if (temp < aprim) carry = 1; else carry = 0; - else - if (temp <= aprim) carry = 1; else carry = 0; - - /* Write new value.*/ - *(z+i) = temp; - } - - /* Check for overflow, which means negative number!*/ - if (carry == 0) - { - /* Number is not of right neg. Invert and add one to correct neg.*/ - for(i=0;i<=zlen;i++) - *(z+i) = ~(*(z+i)); - - temp = 1; - OctApiLmAdd(&temp,0,z,zlen,z,zlen); - - *neg = TRUE; - return(GENERIC_OK); - } - - /* Result is positive.*/ - *neg = FALSE; - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmCompare. -| -| Description: This function compares two numbers (arrays) of equal lengths. -| Number a is (alen + 1) * 32 bits long; b is (blen + 1) * 32 bits long. The result -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *a UINT32 The array containing the first number. -| alen USHORT The length of array a, minus 1 (0 - 99). -| *b UINT32 The array containing the second number. -| blen USHORT The length of array b, minus 1 (0 - 99). -| *neg USHORT Result of compare. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmCompare -UINT32 OctApiLmCompare(UINT32 * a,USHORT alen,UINT32 * bneg,USHORT blen,USHORT * neg) -{ - USHORT i; - UINT32 temp; - UINT32 carry=1; - UINT32 aprim; - UINT32 bprim; - UINT32 zlen; - - /* Set zlen to alen or blen (which ever is longer)*/ - if (alen < blen) - zlen = blen; - else - zlen = alen; - - for(i=0;i<=zlen;i++) - { - if (i <= alen) aprim = *(a+i); else aprim = 0; - if (i <= blen) bprim = ~(*(bneg+i)); else bprim = 0xFFFFFFFF; - temp = aprim + bprim + carry; - - /* Calculate carry for next time.*/ - if (carry == 0) - if (temp < aprim) carry = 1; else carry = 0; - else - if (temp <= aprim) carry = 1; else carry = 0; - } - - /* Check for overflow, which means negative number!*/ - if (carry == 0) - { - *neg = TRUE; - return(GENERIC_OK); - } - - /* Result is positive.*/ - *neg = FALSE; - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmSubtract. -| -| Description: This function multiplies 2 numbers, a and b. Number a and -| b are both (ablen + 1) * 32 bits long. The result is twice as -| long. If the functions succeeds if returns GENERIC_OK, -| else GENERIC_ERROR. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *a UINT32 The array containing the first number. -| *b UINT32 The array containing the second number. -| ablen USHORT The length of arrays a and b, minus 1 (0 - 99). -| *z UINT32 The array containing the resulting number. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmMultiply -UINT32 OctApiLmMultiply(UINT32 * a,UINT32 * b,USHORT ablen,UINT32 * z) -{ - USHORT i,j,k; - USHORT nos; - UINT32 lownum; - UINT32 highnum; - USHORT longnumi; - USHORT longnumj; - USHORT indentw,indentl; - - - /* Caculate number of shorts in a and b.*/ - nos = (USHORT)((ablen+1) * 2); - - /* Clear answer word.*/ - for(i=0;i OCTAPI_LM_MAX_OPTIMIZE_MUL) - optimizea = FALSE; - if(*b > OCTAPI_LM_MAX_OPTIMIZE_MUL) - optimizeb = FALSE; - - if(optimizea == TRUE) - { - for(l = 0; l < *a; l++) - OctApiLmAdd(z, (USHORT)(nos-1), b, ablen, z, (USHORT)(nos-1)); - return(GENERIC_OK); - } - - if(optimizeb == TRUE) - { - for(l = 0; l < *b; l++) - OctApiLmAdd(z, (USHORT)(nos-1), a, ablen, z, (USHORT)(nos-1)); - return(GENERIC_OK); - } - } - - for(i=0;i>16; /* Odd word. Upper part of long.*/ - - for(j=0;j>16; /* Odd word. Upper part of long.*/ - - /* Find the word indent of the answer. 0 = no indent. 1 = one word indent.*/ - indentw = (USHORT)( j+i ); - indentl = (USHORT)( indentw / 2 ); - - /* Multiply both numbers.*/ - product = highnum * lownum; - - /* After multiplying both numbers, add result to end result.*/ - if ((indentw % 2) == 0) /* Even word boundary, addition in one shot!*/ - { - UINT32 carry=0; - UINT32 temp; - UINT32 addme; - - for(k=indentl;k>16; - else addme = 0; - - temp = *(z+k) + addme + carry; - - /* Calculate carry for next time.*/ - if (carry == 0) - if (temp < addme) carry = 1; else carry = 0; - else - if (temp <= addme) carry = 1; else carry = 0; - - /* Set value.*/ - *(z+k) = temp; - } - - /* Carry should always be 0.*/ - if (carry == 1) return(GENERIC_ERROR); - } - } - } - - return(GENERIC_OK); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmDivide. -| -| Description: This function divides the number n by the number d. The -| quotient is placed in q and the remainder in r. The arrays -| n, d, q and r are all of the same length, namely (ndqrlen + 1). -| If the functions succeeds if returns GENERIC_OK, else -| GENERIC_ERROR. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *a UINT32 The array containing the first number. -| *b UINT32 The array containing the second number. -| ablen USHORT The length of arrays a and b, minus 1 (0 - 99). -| *z UINT32 The array containing the resulting number. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmDivide -UINT32 OctApiLmDivide(UINT32 * n,UINT32 * d,UINT32 * q,UINT32 * r,USHORT ndqrlen) -{ - /* Proceedure for division:*/ - /* r = n*/ - /* q = 0*/ - /* shift = initial_denominator_shift (for upper '1's to be in same bit position).*/ - /* d <<= shift;*/ - /* Start loop:*/ - /* compare r and d*/ - /* if r > d then*/ - /* r -= d;*/ - /* write a '1' to bit "shift" of array q.*/ - /* end if;*/ - /* if shift == 0 then*/ - /* return;*/ - /* else*/ - /* shift--;*/ - /* d>>=1;*/ - /* goto "Start loop:"*/ - /* end if;*/ - - UINT32 i; - UINT32 result; - USHORT shift,n_msb,d_msb; - USHORT neg; - USHORT ConditionFlag = TRUE; - - /* r = n*/ - for(i=0;i<=ndqrlen;i++) - *(r+i) = *(n+i); - - /* q = 0*/ - for(i=0;i<=ndqrlen;i++) - *(q+i) = 0; - - /* shift = initial_denominator_shift (for upper '1's to be in same bit position).*/ - result = OctApiLmGetMsb(d,ndqrlen,&d_msb); - if (result != GENERIC_OK) return(result); - - result = OctApiLmGetMsb(n,ndqrlen,&n_msb); - if (result != GENERIC_OK) return(result); - - if (d_msb == 0xFFFF) /* Division by 0.*/ - return(OCTAPI_LM_DIVISION_BY_ZERO); - - if (n_msb == 0xFFFF) /* 0/n, returns 0 R 0.*/ - return(GENERIC_OK); - - if (n_msb < d_msb) /* x/y, where x is smaller than y, returns 0 R x.*/ - return(GENERIC_OK); - - shift = (USHORT)( n_msb - d_msb ); - - /* Shift d to match n highest bit position.*/ - result = OctApiLmShiftn(d,ndqrlen,TRUE,shift); - if (result != GENERIC_OK) return(result); - - /* Start loop:*/ - while( ConditionFlag == TRUE ) - { - /* compare r and d*/ - result = OctApiLmCompare(r,ndqrlen,d,ndqrlen,&neg); - if (result != GENERIC_OK) return(result); - - if (neg == FALSE) /* Subtraction can be done(do it).*/ - { - /* r -= d;*/ - result = OctApiLmSubtract(r,ndqrlen,d,ndqrlen,r,ndqrlen,&neg); - if (result != GENERIC_OK) return(result); - - /* write a '1' to bit "shift" of array q.*/ - *(q+(shift/32)) |= (UINT32)0x1 << (shift%32); - } - - /* if shift == 0 then*/ - /* return;*/ - if (shift == 0) return(GENERIC_OK); - - /* shift--;*/ - /* d>>=1;*/ - /* goto "Start loop:"*/ - shift--; - OctApiLmShiftRight1(d,ndqrlen); - } - - return(GENERIC_OK); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: octapi_lm_shifright1. -| -| Description: The function is for internal use only. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| N/A. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmShiftRight1 -UINT32 OctApiLmShiftRight1(UINT32 * a,USHORT alen) -{ - UINT32 i; - - /* Start with lower long and move up by one long each time,*/ - /* shifting each long to the right by one bit. The upper bit*/ - /* of the next long will have to be concatenated each time a*/ - /* loop is executed. For the last long, leave the highest bit*/ - /* intact.*/ - for(i=0;i>=1; /* Shift long by one to the right.*/ - *(a+i)|=*(a+i+1)<<31; - } - *(a+alen)>>=1; /* Shift last long, leaving it's highest bit at 0.*/ - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmShiftn. -| -| Description: The function is for internal use only. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| N/A. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmShiftn -UINT32 OctApiLmShiftn(UINT32 * a,USHORT alen,USHORT shiftleft,USHORT shiftn) -{ - UINT32 i; - USHORT long_offset; - USHORT bit_offset; - - long_offset = (USHORT)( shiftn / 32 ); - bit_offset = (USHORT)( shiftn % 32 ); - - if (shiftleft == TRUE) /* Shift left.*/ - { - for(i=alen;i<=alen;i--) - { - /* Fill upper bits of long.*/ - if (i >= long_offset) - *(a+i) = *(a+i-long_offset) << bit_offset; - else - *(a+i) = 0; - - /* Fill lower bits of long.*/ - if (i > long_offset && bit_offset != 0) - *(a+i) |= *(a+i-long_offset-1) >> (32-bit_offset); - } - } - else /* Shift right.*/ - { - for(i=0;i<=alen;i++) - { - /* Fill lower bits of long.*/ - if ((alen-i) >= long_offset) - *(a+i) = *(a+i+long_offset) >> bit_offset; - else - *(a+i) = 0; - - /* Fill upper bits of long.*/ - if ((alen-i) > long_offset && bit_offset != 0) - *(a+i) |= *(a+i+long_offset+1) << (32-bit_offset); - - } - } - - return(GENERIC_OK); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLmGetMsb. -| -| Description: The function is for internal use only. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| N/A. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLmGetMsb -UINT32 OctApiLmGetMsb(UINT32 * a,USHORT alen,USHORT * msb_pos) -{ - UINT32 i,j; - UINT32 x; - - for(i=alen;i<=alen;i--) - { - if (*(a+i) == 0) continue; - - x = *(a+i); - for(j=31;j<=31;j--) - { - /* Test for bit being '1'.*/ - if ((x & 0x80000000) != 0) - { - *msb_pos=(USHORT)(j+(32*i)); - return(GENERIC_OK); - } - - /* Shift bit one bit position, and try again.*/ - x<<=1; - } - } - - /* MSB not found.*/ - *msb_pos = 0xFFFF; - - return(GENERIC_OK); -} -#endif diff --git a/zaptel/kernel/oct612x/apilib/llman/octapi_llman.c b/zaptel/kernel/oct612x/apilib/llman/octapi_llman.c deleted file mode 100644 index 9926d205..00000000 --- a/zaptel/kernel/oct612x/apilib/llman/octapi_llman.c +++ /dev/null @@ -1,2787 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_llman.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Library used to manage allocation tables and linked lists. The library is - made such that only a block of contiguous memory is needed for the - management of the linked list/allocation table. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 22 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#include "octapi_llman_private.h" -#include "apilib/octapi_llman.h" -#include "apilib/octapi_largmath.h" - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctapiLlmAllocGetSize. -| -| Description: This function determines the amount of memory needed to -| manage the allocation of a fixed amount of resources. -| The memory is measured in bytes. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| number_of_items UINT32 The number of resources to be allocated. -| *l_size UINT32 UINT32 The amount of memory needed, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctapiLlmAllocGetSize -UINT32 OctapiLlmAllocGetSize(UINT32 number_of_items,UINT32 * l_size) -{ - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - - *l_size = (sizeof(LLM_ALLOC)) + (number_of_items * sizeof(UINT32)); - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctapiLlmAllocInit. -| -| Description: This function intializes the LLM_ALLOC structure. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| **l void The memory used by the LLM_ALLOC structure. -| number_of_items UINT32 The number of resources to be allocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctapiLlmAllocInit -UINT32 OctapiLlmAllocInit(void ** l,UINT32 number_of_items) -{ - LLM_ALLOC* ls; - UINT32 i; - - /* Check the number of items required.*/ - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - - /* If no memory has been allocated yet:*/ - if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED); - - /* Build the structure before starting.*/ - ls = (LLM_ALLOC *)(*l); - ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC)); - - ls->number_of_items = number_of_items; - - /* Linked list links all structures in ascending order.*/ - for(i=0;ilinked_list[i] = i+1; - } - - ls->linked_list[number_of_items - 1] = 0xFFFFFFFF; /* Invalid link.*/ - - /* Next avail is 0.*/ - ls->next_avail_num = 0; - - /* Number of allocated items is null.*/ - ls->allocated_items = 0; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctapiLlmAllocInfo. -| -| Description: This function returns the number of free and allocated -| block in the LLMAN list. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_ALLOC structure. -| *allocated_items UINT32 Number of allocated items. -| *available_items UINT32 Number of available items. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctapiLlmAllocInfo -UINT32 OctapiLlmAllocInfo(void * l,UINT32 * allocated_items,UINT32 * available_items) -{ - LLM_ALLOC* ls; - - /* Build the structure before starting.*/ - ls = (LLM_ALLOC *)l; - ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC)); - - *allocated_items = ls->allocated_items; - *available_items = ls->number_of_items - ls->allocated_items; - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctapiLlmAllocInfo. -| -| Description: This function allocates the resource indicated by blocknum. -| If the resource can be allocated then GENERIC_OK is returned. -| Else an error. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_ALLOC structure. -| *block_num UINT32 The resource to be allocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctapiLlmAllocAlloc -UINT32 OctapiLlmAllocAlloc(void * l,UINT32 * blocknum) -{ - LLM_ALLOC* ls; - UINT32 allocated_block; - UINT32* node; - - /* Build the structure before starting.*/ - ls = (LLM_ALLOC *)l; - ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC)); - - /* Get next available block number.*/ - allocated_block = ls->next_avail_num; - - /* Check if block is invalid.*/ - if (allocated_block == 0xFFFFFFFF) - { - /* Make blocknum NULL.*/ - *blocknum = 0xFFFFFFFF; - - return(OCTAPI_LLM_NO_STRUCTURES_LEFT); - } - - node = &ls->linked_list[allocated_block]; - - /* Copy next block number.*/ - ls->next_avail_num = *node; - - /* Tag as used the current block number.*/ - *node = 0xFFFFFFFE; - - /* Return proper block number.*/ - *blocknum = allocated_block; - - /* Update block usage number.*/ - ls->allocated_items++; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctapiLlmAllocDealloc. -| -| Description: This function deallocates the resource indicated by blocknum. -| If the resource is not already allocated an error is returned. -| Else GENERIC_OK is returned. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_ALLOC structure. -| block_num UINT32 The resource to be deallocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctapiLlmAllocDealloc -UINT32 OctapiLlmAllocDealloc(void * l,UINT32 blocknum) -{ - LLM_ALLOC* ls; - UINT32* node; - - /* Build the structure before starting.*/ - ls = (LLM_ALLOC *)l; - ls->linked_list = (UINT32 *)((BYTE *)ls + sizeof(LLM_ALLOC)); - - /* Check for null item pointer.*/ - if (blocknum == 0xFFFFFFFF) return(GENERIC_OK); - - /* Check if blocknum is within specified item range.*/ - if (blocknum >= ls->number_of_items) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - - node = &ls->linked_list[blocknum]; - - /* Check if block is really used as of now.*/ - if (*node != 0xFFFFFFFE) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED); - - /* Add link to list.*/ - *node = ls->next_avail_num; - - /* Point to returned block.*/ - ls->next_avail_num = blocknum; - - /* Update block usage number.*/ - ls->allocated_items--; - - return(GENERIC_OK); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiTllmAllocGetSize. -| -| Description: This function determines the amount of memory needed to -| manage the allocation of a fixed amount of resources. -| The memory is measured in bytes. -| -| This version is a time manage version of llman. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| number_of_items UINT32 The number of resources to be allocated. -| *l_size UINT32 UINT32 The amount of memory needed, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiTllmAllocGetSize -UINT32 OctApiTllmAllocGetSize(UINT32 number_of_items,UINT32 * l_size) -{ - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - - *l_size = (sizeof(TLLM_ALLOC)) + (number_of_items * sizeof(TLLM_ALLOC_NODE)); - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiTllmAllocInit. -| -| Description: This function intializes the TLLM_ALLOC structure. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| **l void The memory used by the LLM_ALLOC structure. -| number_of_items UINT32 The number of resources to be allocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiTllmAllocInit -UINT32 OctApiTllmAllocInit(void ** l,UINT32 number_of_items) -{ - TLLM_ALLOC* ls; - UINT32 i; - - /* Check the number of items required.*/ - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - - /* If no memory has been allocated yet.*/ - if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED); - - /* Build the structure before starting.*/ - ls = (TLLM_ALLOC *)(*l); - ls->linked_list = (TLLM_ALLOC_NODE *)((BYTE *)ls + sizeof(TLLM_ALLOC)); - - ls->number_of_items = number_of_items; - - /* Linked list links all structures in ascending order.*/ - for(i=0;ilinked_list[i].value = i+1; - } - - ls->linked_list[number_of_items - 1].value = 0xFFFFFFFF; /* Invalid link.*/ - - /* Next avail is 0.*/ - ls->next_avail_num = 0; - - /* Number of allocated items is null.*/ - ls->allocated_items = 0; - - /* Set the number of timeout entry.*/ - ls->number_of_timeout = 0; - - /* Next timeout is 0.*/ - ls->next_timeout_num = 0xFFFFFFFF; - ls->last_timeout_num = 0xFFFFFFFF; - - /* Set the known time to 0.*/ - ls->last_known_time[ 0 ] = 0; - ls->last_known_time[ 1 ] = 0; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiTllmAllocInfo. -| -| Description: This function returns the number of free and allocated -| block in the TLLMAN list. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_ALLOC structure. -| *allocated_items UINT32 Number of allocated items. -| *available_items UINT32 Number of available items. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiTllmAllocInfo -UINT32 OctApiTllmAllocInfo(void * l,UINT32 * allocated_items,UINT32 * available_items) -{ - TLLM_ALLOC* ls; - - /* Build the structure before starting.*/ - ls = (TLLM_ALLOC *)l; - *allocated_items = ls->allocated_items; - *available_items = ls->number_of_items - ls->allocated_items; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiTllmAllocAlloc. -| -| Description: This function allocates the resource indicated by blocknum. -| If the resource can be allocated then GENERIC_OK is returned. -| Else an error. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_ALLOC structure. -| *block_num UINT32 The resource to be allocated. -| *current_time UINT32 -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiTllmAllocAlloc -UINT32 OctApiTllmAllocAlloc(void * l,UINT32 * blocknum, UINT32 *current_time) -{ - TLLM_ALLOC* ls; - UINT32 allocated_block; - TLLM_ALLOC_NODE* node; - - /* Build the structure before starting.*/ - ls = (TLLM_ALLOC *)l; - ls->linked_list = (TLLM_ALLOC_NODE *)((BYTE *)ls + sizeof(TLLM_ALLOC)); - - if ( ls->allocated_items == ls->number_of_items && - ls->next_timeout_num != 0xFFFFFFFF ) - { - UINT32 l_ulResult; - l_ulResult = OctApiTllmCheckTimeoutList( ls, current_time ); - if ( l_ulResult != GENERIC_OK ) - return l_ulResult; - } - - /* Get next available block number.*/ - allocated_block = ls->next_avail_num; - - /* Check if block is invalid.*/ - if (allocated_block == 0xFFFFFFFF) - { - /* Make blocknum NULL.*/ - *blocknum = 0xFFFFFFFF; - - return(OCTAPI_LLM_NO_STRUCTURES_LEFT); - } - - node = &ls->linked_list[allocated_block]; - - /* Copy next block number.*/ - ls->next_avail_num = node->value; - - /* Tag as used the current block number.*/ - node->value = 0xFFFFFFFE; - - /* Return proper block number.*/ - *blocknum = allocated_block; - - /* Update block usage number.*/ - ls->allocated_items++; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiTllmAllocDealloc. -| -| Description: This function deallocates the resource indicated by blocknum. -| If the resource is not already allocated an error is returned. -| Else GENERIC_OK is returned. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_ALLOC structure. -| block_num UINT32 The resource to be deallocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiTllmAllocDealloc -UINT32 OctApiTllmAllocDealloc(void * l,UINT32 blocknum, UINT32 timeout_value, UINT32 current_time[2]) -{ - TLLM_ALLOC* ls; - TLLM_ALLOC_NODE* node; - UINT32 l_ulResult; - - /* Build the structure before starting.*/ - ls = (TLLM_ALLOC *)l; - ls->linked_list = (TLLM_ALLOC_NODE *)((BYTE *)ls + sizeof(TLLM_ALLOC)); - - /* Check for null item pointer.*/ - if (blocknum == 0xFFFFFFFF) return(GENERIC_OK); - - /* Check if blocknum is within specified item range.*/ - if (blocknum >= ls->number_of_items) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - - if ( ls->next_timeout_num != 0xFFFFFFFF ) - { - l_ulResult = OctApiTllmCheckTimeoutList( ls, current_time ); - if ( l_ulResult != GENERIC_OK ) - return l_ulResult; - } - - node = &ls->linked_list[blocknum]; - - /* Check if block is really used as of now.*/ - if (node->value != 0xFFFFFFFE) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED); - - /* Add link to timeout list.*/ - if ( ls->last_timeout_num != 0xFFFFFFFF ) - { - TLLM_ALLOC_NODE* last_node; - - /* insert the node at the end of the list.*/ - node->value = 0xFFFFFFFF; - last_node = &ls->linked_list[ ls->last_timeout_num ]; - last_node->value = blocknum; - } - else - { - /* The node is alone in the list.*/ - node->value = 0xFFFFFFFF; - ls->next_timeout_num = blocknum; - } - - ls->last_timeout_num = blocknum; - ls->number_of_timeout++; - - /* Set the timeout time of the node.*/ - l_ulResult = OctApiLmAdd( current_time, 1, &timeout_value, 0, node->timeout, 1 ); - if (l_ulResult != GENERIC_OK) - return(l_ulResult); - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiTllmCheckTimeoutList. -| -| Description: This function will verify if the timeout time -| of all the node present in the timeout list are bigger -| then the current time. If so the node will be returned -| ot the free node list. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *ls TLLM_ALLOC The memory used by the TLLM_ALLOC structure. -| current_time UINT32[2] The current time in msec. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiTllmCheckTimeoutList -UINT32 OctApiTllmCheckTimeoutList(TLLM_ALLOC *ls, UINT32 current_time[2]) -{ - UINT32 result; - UINT32 fConditionFlag = TRUE; - - /* Free-up any pending memory before trying the allocation:*/ - if ((ls->last_known_time[0] != current_time[0] || - ls->last_known_time[1] != current_time[1]) && - (current_time[1] != 0 || current_time[0] != 0)) /* Time has changed.*/ - { - TLLM_ALLOC_NODE *pcurrent_node; - UINT32 current_num; - USHORT neg; - - /* Remember time for next time!*/ - ls->last_known_time[0] = current_time[0]; - ls->last_known_time[1] = current_time[1]; - - - while ( fConditionFlag == TRUE ) - { - /* Get a node from the timeout list.*/ - pcurrent_node = &ls->linked_list[ ls->next_timeout_num ]; - current_num = ls->next_timeout_num; - - /* Check if first node has timeout.*/ - result = OctApiLmCompare(current_time,1,pcurrent_node->timeout ,1,&neg); - if (result != GENERIC_OK) return(result); - - /* if the timeout tiem was exceeded, set the block as free.*/ - if ( neg == FALSE ) - { - /* set the next node pointer.*/ - ls->next_timeout_num = pcurrent_node->value; - ls->number_of_timeout--; - - /* reset the last pointer of the timeout list.*/ - if ( ls->number_of_timeout == 0 ) - ls->last_timeout_num = 0xFFFFFFFF; - - /* return the node the free list.*/ - pcurrent_node->value = ls->next_avail_num; - ls->next_avail_num = current_num; - ls->allocated_items--; - } - else /* node not in timeout */ - { - fConditionFlag = FALSE; - break; - } - - if ( ls->next_timeout_num == 0xFFFFFFFF ) - { - fConditionFlag = FALSE; - break; /* end of timeout list.*/ - } - } - } - - return(GENERIC_OK); -} -#endif -/**************************************** llm_alloc section **********************************************/ - - - - - - - -/**************************************** llm_list section **********************************************/ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListGetSize -| -| Description: This function determines the amount of memory needed by -| the LLM_LIST structure to manage the allocation of -| number_of_items number of resources. The memory is -| measured in bytes. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| number_of_items UINT32 The number of resources to be allocated -| amongst all linked-lists. -| number_of_lists UINT32 The maximum number of linked-lists that -| can be allocated. -| *l_size UINT32 UINT32 The amount of memory needed, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListGetSize -UINT32 OctApiLlmListGetSize(UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size,UINT32 * l_size) -{ - UINT32 head_alloc_size; - UINT32 result; - UINT32 user_info_size_roundup; - - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - if (number_of_lists == 0) return(GENERIC_BAD_PARAM); - if (user_info_size == 0) return(GENERIC_BAD_PARAM); - - user_info_size_roundup = ((user_info_size + 3) / 4) * 4; - - result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size); - if(result != GENERIC_OK) return(result); - - *l_size = sizeof(LLM_LIST) + (number_of_lists * sizeof(LLM_LIST_HEAD)) + head_alloc_size + (number_of_items * (sizeof(LLM_LIST_ITEM) + user_info_size_roundup - 4)); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiLlmListGetItemPointer -LLM_LIST_ITEM * OctApiLlmListGetItemPointer(LLM_LIST * ls, UINT32 item_number) -{ - return (LLM_LIST_ITEM *) (((BYTE *)ls->li) + (ls->item_size * item_number)) ; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListInit. -| -| Description: This function intializes the LLM_TALLOC structure. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| number_of_items UINT32 The number of resources to be allocated -| amongst all linked-lists. -| number_of_lists UINT32 The maximum number of linked-lists that -| can be allocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListInit -UINT32 OctApiLlmListInit(void ** l,UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size) -{ - LLM_LIST* ls; - LLM_LIST_ITEM* item; - UINT32 i; - UINT32 head_alloc_size; - UINT32 result; - UINT32 user_info_size_roundup; - UINT32 total_lists; - BYTE* lsbyte; - - - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - if (number_of_lists == 0) return(GENERIC_BAD_PARAM); - if (user_info_size == 0) return(GENERIC_BAD_PARAM); - - user_info_size_roundup = ((user_info_size + 3) / 4) * 4; - - /* Get the size of the Alloc structure used to manage head of list structures.*/ - result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size); - if(result != GENERIC_OK) return(result); - - if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED); - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)(*l); - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - /* Initialize parameters in the structure.*/ - ls->head_alloc_size = head_alloc_size; - ls->user_info_bytes = user_info_size; - ls->user_info_size = user_info_size_roundup; - ls->total_items = number_of_items; - ls->assigned_items = 0; - ls->total_lists = number_of_lists; - ls->assigned_lists = 0; - ls->next_empty_item = 0; - ls->item_size = sizeof(LLM_LIST_ITEM) + user_info_size_roundup - 4; - - /* Complete the build!*/ - ls = (LLM_LIST *)(*l); - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - /* Initialize the head of queue Alloc structure.*/ - result = OctapiLlmAllocInit(&(ls->list_head_alloc),number_of_lists); - if(result != GENERIC_OK) return(result); - - /* Initialize the linked list of the items:*/ - for(i=0; ili + ls->item_size * i); - - if (i == (number_of_items - 1)) - item->forward_link = 0xFFFFFFFF; - else - item->forward_link = i + 1; - } - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListInfo. -| -| Description: This function returns the status of the LLM_LIST structure. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *allocated_lists UINT32 The number of linked_lists allocated. -| *free_lists UINT32 The number of linked_lists still free. -| *allocated_items UINT32 The number of items allocated to lists. -| *free_items UINT32 The number of items still free. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListInfo -UINT32 OctApiLlmListInfo(void * l,UINT32 * allocated_lists,UINT32 * allocated_items, - UINT32 * free_lists,UINT32 * free_items) -{ - LLM_LIST* ls; - BYTE* lsbyte; - UINT32 total_lists; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - *allocated_items = ls->assigned_items; - *free_items = ls->total_items - ls->assigned_items; - - *allocated_lists = ls->assigned_lists; - *free_lists = ls->total_lists - ls->assigned_lists; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListCreate. -| -| Description: This function creates a linked list. The target which is -| allocated the newly created list can request additions -| or removals from the list later on. To target identifies -| its list with the returned list handle. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *list_handle UINT32 The handle to the new list, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListCreate -UINT32 OctApiLlmListCreate(void * l,UINT32 * list_handle) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - UINT32 blocknum; - UINT32 total_lists; - UINT32 result; - BYTE* lsbyte; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - /* Get a list using the list head alloc structure.*/ - result = OctapiLlmAllocAlloc(ls->list_head_alloc, &blocknum); - if (result != GENERIC_OK) return(result); - - /* The handle is the block number.*/ - *list_handle = blocknum; - - /* Initialize the list head structure.*/ - lh = &ls->lh[blocknum]; - lh->list_length = 0; - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - lh->cache_item_number = 0xFFFFFFFF; - lh->cache_item_pointer = 0xFFFFFFFF; - - ls->assigned_lists++; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListDelete. -| -| Description: This function deletes the linked list indicated by the -| handle list_handle. Any items which are still allocated -| to the list are first deallocated. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *list_handle UINT32 The handle to the list. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListDelete -UINT32 OctApiLlmListDelete(void * l,UINT32 list_handle) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - UINT32 total_lists; - UINT32 result; - BYTE* lsbyte; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - - if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - if (ls->lh[list_handle].list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE); - - /* Release internal list header handle...*/ - result = OctapiLlmAllocDealloc(ls->list_head_alloc,list_handle); - if (result != GENERIC_OK) return(result); - - lh = &ls->lh[list_handle]; - - /* Deallocate all items in the list!*/ - if (lh->list_length != 0) - { - LLM_LIST_ITEM * item; - - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->tail_pointer); - - /* Release the items using only the links.*/ - item->forward_link = ls->next_empty_item; - ls->next_empty_item = lh->head_pointer; - - /* Remove items from item counter.*/ - ls->assigned_items -= lh->list_length; - } - - lh->list_length = 0xFFFFFFFF; - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - lh->cache_item_number = 0xFFFFFFFF; - lh->cache_item_pointer = 0xFFFFFFFF; - - ls->assigned_lists--; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListLength. -| -| Description: This function returns the number of items allocated to the -| list indicated by the handle list_handle. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| list_handle UINT32 The handle to the list. -| *number_of_items UINT32 The number of items in the list, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListLength -UINT32 OctApiLlmListLength(void * l,UINT32 list_handle, UINT32 * number_of_items_in_list) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - UINT32 total_lists; - BYTE* lsbyte; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - - if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE); - - *number_of_items_in_list = lh->list_length; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListItemData -| -| Description: This function returns a pointer to the user data associated -| with an item. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| list_handle UINT32 The handle to the list. -| item_number UINT32 The number of the list node in question. -| **item_data_pnt void The pointer to the user data, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListItemData -UINT32 OctApiLlmListItemData(void * l,UINT32 list_handle,UINT32 item_number,void ** item_data_pnt) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* item; - UINT32 cur_list_pnt; - UINT32 cur_list_num; - UINT32 total_lists; - UINT32 list_length; - BYTE* lsbyte; - UINT32 fConditionFlag = TRUE; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - list_length = lh->list_length; - - *item_data_pnt = NULL; - if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - if (list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE); - if (list_length <= item_number) return(OCTAPI_LLM_ELEMENT_NOT_FOUND); - - /* Determine where the search will start.*/ - if (list_length == (item_number + 1)) /* Last item in list:*/ - { - cur_list_pnt = lh->tail_pointer; - cur_list_num = item_number; - } - else if (lh->cache_item_number <= item_number) /* Start at cache:*/ - { - cur_list_pnt = lh->cache_item_pointer; - cur_list_num = lh->cache_item_number; - } - else /* Start at beginning:*/ - { - cur_list_pnt = lh->head_pointer; - cur_list_num = 0; - } - - /* Start search from cur_list_pnt and cur_list_num.*/ - while ( fConditionFlag == TRUE ) - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - - if (cur_list_num == item_number) /* Item number found.*/ - { - /* Write new cache entry.*/ - lh->cache_item_pointer = cur_list_pnt; - lh->cache_item_number = cur_list_num; - - /* Get item info.*/ - *item_data_pnt = (void *)item->user_info; - - return(GENERIC_OK); - } - else if(item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/ - { - return(OCTAPI_LLM_INTERNAL_ERROR0); - } - else /* Item was not found, but continue searching.*/ - { - cur_list_pnt = item->forward_link; - } - - cur_list_num++; - } - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListInsertItem. -| -| Description: This function allocates a node to the linked list specified -| by the handle list_handle. The position of the new item -| can be specified. A position of 0xFFFFFFFF means append to the -| list( use the OCTAPI_LLM_LIST_APPEND define for clarity); -| a position of 0 mean insert at the begining of the list. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *list_handle UINT32 The handle to the list. -| **item_data void Address of the user data space for this item. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListInsertItem -UINT32 OctApiLlmListInsertItem(void * l,UINT32 list_handle,UINT32 item_number,void ** item_data_pnt) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* free_item; - UINT32 free_item_pnt; - UINT32 total_lists; - BYTE* lsbyte; - UINT32 fConditionFlag = TRUE; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - - *item_data_pnt = NULL; - if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE); - if (lh->list_length < item_number && item_number != 0xFFFFFFFF) - return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - if (ls->next_empty_item == 0xFFFFFFFF) return(OCTAPI_LLM_NO_STRUCTURES_LEFT); - - /* Get a free item from the free item list!*/ - free_item_pnt = ls->next_empty_item; - free_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * free_item_pnt); - ls->next_empty_item = free_item->forward_link; - - if (item_number == 0xFFFFFFFF) - item_number = lh->list_length; - - if (lh->list_length == 0) /* First item and only item:*/ - { - free_item->forward_link = 0xFFFFFFFF; - lh->tail_pointer = free_item_pnt; - lh->head_pointer = free_item_pnt; - } - else if (item_number == 0) /* First item and but list not empty:*/ - { - free_item->forward_link = lh->head_pointer; - lh->head_pointer = free_item_pnt; - } - else if (item_number == lh->list_length) /* Append:*/ - { - LLM_LIST_ITEM * last_item; - last_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->tail_pointer); - - last_item->forward_link = free_item_pnt; - free_item->forward_link = 0xFFFFFFFF; - lh->tail_pointer = free_item_pnt; - } - else /* Insert:*/ - { - LLM_LIST_ITEM * last_item = NULL; - LLM_LIST_ITEM * item; - UINT32 last_list_pnt; - UINT32 cur_list_pnt; - UINT32 cur_list_num; - - if (lh->cache_item_number < item_number) /* Start at cache:*/ - { - cur_list_pnt = lh->cache_item_pointer; - cur_list_num = lh->cache_item_number; - } - else /* Start at beginning:*/ - { - cur_list_pnt = lh->head_pointer; - cur_list_num = 0; - } - - last_list_pnt = 0xFFFFFFFF; - - /* Start search from cur_list_pnt and cur_list_num.*/ - while ( fConditionFlag == TRUE ) - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - - if (cur_list_num == item_number) /* Item number found.*/ - { - if (last_list_pnt == 0xFFFFFFFF) return(OCTAPI_LLM_INTERNAL_ERROR1); - - free_item->forward_link = cur_list_pnt; - last_item->forward_link = free_item_pnt; - - fConditionFlag = FALSE; - break; - } - else if (item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/ - { - return(OCTAPI_LLM_INTERNAL_ERROR0); - } - else /* Item was not found, but continue searching.*/ - { - last_item = item; - last_list_pnt = cur_list_pnt; - cur_list_pnt = item->forward_link; - } - - cur_list_num++; - } - } - - /* Increase the list length.*/ - lh->list_length++; - ls->assigned_items++; - *item_data_pnt = (void *)free_item->user_info; - - /* Write new cache entry.*/ - lh->cache_item_pointer = free_item_pnt; - lh->cache_item_number = item_number; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListCreateFull. -| -| Description: This function allocates the desired number of nodes to -| the linked list specified by the handle list_handle. -| The position of the new item can be specified. A -| position of 0xFFFFFFFF means append to the list (use the -| OCTAPI_LLM_LIST_APPEND define for clarity); a position -| of 0 means insert at the begining of the list. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *list_handle UINT32 The handle to the list. -| **item_data void Address of the user data space for this item. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListCreateFull -UINT32 OctApiLlmListCreateFull(void* l, UINT32 list_length, UINT32* plist_handle) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* free_item; - LLM_LIST_ITEM* last_item = NULL; - UINT32 free_item_pnt = 0xFFFFFFFF; - UINT32 total_lists; - UINT32 list_handle; - UINT32 list_length_m1; - UINT32 next_empty_item; - UINT32 result; - UINT32 i; - BYTE* lsbyte; - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Build the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Make sure another list can be created.*/ - if (ls->assigned_lists == ls->total_lists) - return(OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED); - - /* Make sure there are enough free nodes to fill the new list.*/ - if (list_length > (ls->total_items - ls->assigned_items)) - return(OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Create list (i.e. get a list using the list head alloc structure.*/ - result = OctapiLlmAllocAlloc(ls->list_head_alloc, &list_handle); - if (result != GENERIC_OK) return(result); - - /* Initialize the list head structure.*/ - lh = &ls->lh[list_handle]; - lh->list_length = 0; - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - lh->cache_item_number = 0xFFFFFFFF; - lh->cache_item_pointer = 0xFFFFFFFF; - - ls->assigned_lists++; - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Add the number of requested nodes to the list.*/ - lh = &ls->lh[list_handle]; - list_length_m1 = list_length - 1; - next_empty_item = ls->next_empty_item; - - for (i=0; ili + ls->item_size * free_item_pnt); - next_empty_item = free_item->forward_link; - - /* Branch according to whether the node is the first in list, last, or in - the middle.*/ - if (i == 0) - { - /* First item.*/ - free_item->forward_link = 0xFFFFFFFF; - lh->head_pointer = free_item_pnt; - lh->tail_pointer = free_item_pnt; - } - else if (i == list_length_m1) - { - /* Last item.*/ - last_item->forward_link = free_item_pnt; - free_item->forward_link = 0xFFFFFFFF; - lh->tail_pointer = free_item_pnt; - } - else - { - /* Node somewhere in the middle.*/ - last_item->forward_link = free_item_pnt; - } - - /* Store pointer to free item as pointer to last item (for next iteration).*/ - last_item = free_item; - } - - /* Store new value of next_empty_item.*/ - ls->next_empty_item = next_empty_item; - - /* Write new cache entry.*/ - lh->cache_item_pointer = free_item_pnt; - lh->cache_item_number = list_length_m1; - - /* Set the list length.*/ - lh->list_length = list_length; - ls->assigned_items += list_length; - - /* Return pointer to new list.*/ - *plist_handle = list_handle; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListAppendItems. -| -| Description: This function allocates the desired number of nodes to -| the linked list specified by the handle list_handle. -| The position of the new item can be specified. A -| position of 0xFFFFFFFF means append to the list (use the -| OCTAPI_LLM_LIST_APPEND define for clarity); a position -| of 0 means insert at the begining of the list. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *list_handle UINT32 The handle to the list. -| **item_data void Address of the user data space for this item. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListAppendItems -UINT32 OctApiLlmListAppendItems(void* l, UINT32 list_handle, UINT32 num_items) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* item_list; - LLM_LIST_ITEM* curr_item = NULL; - LLM_LIST_ITEM* free_item; - UINT32 curr_item_pnt = 0xFFFFFFFF; - UINT32 total_lists; - UINT32 next_empty_item; - UINT32 item_size; - UINT32 i; - BYTE* lsbyte; - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Build the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Make sure list handle is valid.*/ - if (list_handle >= ls->total_lists) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - - /* Make sure there is at least one item.*/ - if (num_items == 0) - return(OCTAPI_LLM_INVALID_PARAMETER); - - /* Make sure there are enough free nodes.*/ - if (num_items > (ls->total_items - ls->assigned_items)) - return(OCTAPI_LLM_NO_STRUCTURES_LEFT); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Get pointer to list structure.*/ - lh = &ls->lh[list_handle]; - if (lh->list_length == 0xFFFFFFFF) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Add the number of requested nodes to the list.*/ - item_list = ls->li; - item_size = ls->item_size; - next_empty_item = ls->next_empty_item; - - for (i=0; ihead_pointer == 0xFFFFFFFF) - { - /* Current and next items are one and the same!*/ - curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item); - - /* Set new head and tail pointers.*/ - lh->head_pointer = next_empty_item; - lh->tail_pointer = next_empty_item; - - /* Update current item pnt.*/ - curr_item_pnt = next_empty_item; - - /* Update next item.*/ - next_empty_item = curr_item->forward_link; - - /* Set first item to be only item in list.*/ - curr_item->forward_link = 0xFFFFFFFF; - } - else - { - /* Get a free item from the free item list!*/ - curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * lh->tail_pointer); - free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item); - - /* Have current item point to next empty item.*/ - curr_item->forward_link = next_empty_item; - - /* Update current item pnt.*/ - curr_item_pnt = next_empty_item; - - /* Update next_empty_item.*/ - next_empty_item = free_item->forward_link; - - /* Update pointers to current item and free item.*/ - curr_item = free_item; - } - } - else - { - /* Update pointers to current item and free item.*/ - free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item); - - /* Have current item point to next empty item.*/ - curr_item->forward_link = next_empty_item; - - /* Update current item pnt.*/ - curr_item_pnt = next_empty_item; - - /* Update next_empty_item.*/ - next_empty_item = free_item->forward_link; - - /* Update pointers to current item and free item.*/ - curr_item = free_item; - } - } - - /* Terminate list.*/ - if ( curr_item != NULL ) - curr_item->forward_link = 0xFFFFFFFF; - - /* Update llman structure variables.*/ - ls->next_empty_item = next_empty_item; - ls->assigned_items += num_items; - - /* Update list variables.*/ - lh->list_length += num_items; - lh->cache_item_pointer = curr_item_pnt; - lh->cache_item_number = lh->list_length - 1; - lh->tail_pointer = curr_item_pnt; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListAppendAndSetItems. -| -| Description: -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListAppendAndSetItems -UINT32 OctApiLlmListAppendAndSetItems(void* l, UINT32 list_handle, UINT32 num_items, void* data_list) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* item_list; - LLM_LIST_ITEM* curr_item = NULL; - LLM_LIST_ITEM* free_item; - UINT32 curr_item_pnt = 0xFFFFFFFF; - UINT32 total_lists; - UINT32 next_empty_item; - UINT32 user_info_bytes; - UINT32 item_size; - UINT32 i; - BYTE* lsbyte; - void* data_item; - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Build the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Make sure list handle is valid.*/ - if (list_handle >= ls->total_lists) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - - /* Make sure there is at least one item.*/ - if (num_items == 0) - return(OCTAPI_LLM_INVALID_PARAMETER); - - /* Make sure there are enough free nodes.*/ - if (num_items > (ls->total_items - ls->assigned_items)) - return(OCTAPI_LLM_NO_STRUCTURES_LEFT); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Get pointer to list structure.*/ - lh = &ls->lh[list_handle]; - if (lh->list_length == 0xFFFFFFFF) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Add the number of requested nodes to the list.*/ - item_list = ls->li; - user_info_bytes = ls->user_info_bytes; - item_size = ls->item_size; - next_empty_item = ls->next_empty_item; - data_item = data_list; - - for (i=0; ihead_pointer == 0xFFFFFFFF) - { - /* Current and next items are one and the same!*/ - curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item); - - /* Set new head and tail pointers.*/ - lh->head_pointer = next_empty_item; - lh->tail_pointer = next_empty_item; - - /* Update current item pnt.*/ - curr_item_pnt = next_empty_item; - - /* Update next item.*/ - next_empty_item = curr_item->forward_link; - - /* Set first item to be only item in list.*/ - curr_item->forward_link = 0xFFFFFFFF; - } - else - { - /* Get a free item from the free item list!*/ - curr_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * lh->tail_pointer); - free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item); - - /* Have current item point to next empty item.*/ - curr_item->forward_link = next_empty_item; - - /* Update current item pnt.*/ - curr_item_pnt = next_empty_item; - - /* Update next_empty_item.*/ - next_empty_item = free_item->forward_link; - - /* Update pointers to current item and free item.*/ - curr_item = free_item; - } - } - else - { - /* Update pointers to current item and free item.*/ - free_item = (LLM_LIST_ITEM *)((BYTE *)item_list + item_size * next_empty_item); - - /* Have current item point to next empty item.*/ - curr_item->forward_link = next_empty_item; - - /* Update current item pnt.*/ - curr_item_pnt = next_empty_item; - - /* Update next_empty_item.*/ - next_empty_item = free_item->forward_link; - - /* Update pointers to current item and free item.*/ - curr_item = free_item; - } - - /* Copy data to new item.*/ - OctApiLlmMemCpy(curr_item->user_info, data_item, user_info_bytes); - - /* Update data_item pointer for next iteration (item).*/ - data_item = (void *)((BYTE *)data_item + user_info_bytes); - } - - - /* Terminate list.*/ - if ( curr_item != NULL ) - curr_item->forward_link = 0xFFFFFFFF; - - /* Update llman structure variables.*/ - ls->next_empty_item = next_empty_item; - ls->assigned_items += num_items; - - /* Update list variables.*/ - lh->list_length += num_items; - lh->cache_item_pointer = curr_item_pnt; - lh->cache_item_number = lh->list_length - 1; - lh->tail_pointer = curr_item_pnt; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListSetItems. -| -| Description: This function takes a start entry (0 to length - 1), -| a pointer to a list of data (each item of list is the -| size of one data unit, specified at init), and the -| length of the data list. From this, the data will be -| copied from the data list to the linked list, from -| entry start_entry to (start_entry + data_length - 1). -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListSetItems -UINT32 OctApiLlmListSetItems(void* l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, void* pdata_list) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* item = NULL; - UINT32 total_lists; - UINT32 item_pnt = 0xFFFFFFFF; - UINT32 i, j; - BYTE* lsbyte; - void* pdata_item = NULL; - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Build the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Make sure list handle is valid.*/ - if (list_handle >= ls->total_lists) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - lh = &ls->lh[list_handle]; - if (lh->list_length == 0xFFFFFFFF) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - - /* Make sure the start_entry is within limits.*/ - if (start_item >= lh->list_length) - return(OCTAPI_LLM_INVALID_PARAMETER); - - /* Make sure the end_entry is within limits.*/ - lh = &ls->lh[list_handle]; - if ((start_item + data_length) > lh->list_length) - return(OCTAPI_LLM_INVALID_PARAMETER); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Set the data of each node.*/ - for (i=0; icache_item_number + 1)) - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->cache_item_pointer); - item_pnt = item->forward_link; - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt); - } - else - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->head_pointer); - item_pnt = lh->head_pointer; - for (j=0; jforward_link; - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt); - } - } - - pdata_item = (void *)((BYTE *)pdata_list + (i * ls->user_info_bytes)); - } - else - { - item_pnt = item->forward_link; - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt); - - pdata_item = (void *)((BYTE *)pdata_item + ls->user_info_bytes); - } - - /* Set the value of the item's user data.*/ - OctApiLlmMemCpy(item->user_info, pdata_item, ls->user_info_bytes); - } - - /* Write new cache entry.*/ - lh->cache_item_pointer = item_pnt; - lh->cache_item_number = start_item + data_length - 1; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListCopyData. -| -| Description: This function takes a start entry (0 to length - 1), -| a pointer to a list of data (each item of list is the -| size of one data unit, specified at init), and the -| length of the data list. From this, the data will be -| copied from the linked list to the data list, from -| entry start_entry of the linked list to -| (start_entry + data_length - 1). -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListCopyData -UINT32 OctApiLlmListCopyData(void* l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, void* pdata_list) -{ - LLM_LIST* ls; - LLM_LIST_HEAD* lh; - LLM_LIST_ITEM* item = NULL; - UINT32 item_pnt = 0xFFFFFFFF; - UINT32 total_lists; - UINT32 i, j; - BYTE* lsbyte; - void* pdata_item = NULL; - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Build the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Make sure list handle is valid.*/ - if (list_handle >= ls->total_lists) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - lh = &ls->lh[list_handle]; - if (lh->list_length == 0xFFFFFFFF) - return(OCTAPI_LLM_INVALID_LIST_HANDLE); - - /* Make sure the start_entry is within limits.*/ - if (start_item >= lh->list_length) - return(OCTAPI_LLM_INVALID_PARAMETER); - - /* Make sure the end_entry is within limits.*/ - lh = &ls->lh[list_handle]; - if ((start_item + data_length) > lh->list_length) - return(OCTAPI_LLM_INVALID_PARAMETER); - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - - - - /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - /* Set the data of each node.*/ - for (i=0; icache_item_number + 1)) - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->cache_item_pointer); - item_pnt = item->forward_link; - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt); - } - else - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->head_pointer); - for (j=0; jforward_link; - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt); - } - } - - pdata_item = (void *)((BYTE *)pdata_list + (i * ls->user_info_bytes)); - } - else - { - item_pnt = item->forward_link; - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * item_pnt); - - pdata_item = (void *)((BYTE *)pdata_item + ls->user_info_bytes); - } - - /* Set the value of the item's user data.*/ - OctApiLlmMemCpy(pdata_item, item->user_info, ls->user_info_bytes); - } - - /* Write new cache entry.*/ - lh->cache_item_pointer = item_pnt; - lh->cache_item_number = start_item + data_length - 1; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListRemoveItem. -| -| Description: This function deallocates a node of the linked list specified -| by the handle list_handle. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| list_handle UINT32 The handle to the list. -| item_number UINT32 The number of the item to be removed. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmListRemoveItem -UINT32 OctApiLlmListRemoveItem(void * l,UINT32 list_handle,UINT32 item_number) -{ - LLM_LIST* ls; - LLM_LIST_ITEM* freed_item = NULL; - LLM_LIST_HEAD* lh; - UINT32 freed_item_pnt = 0xFFFFFFFF; - UINT32 total_lists; - BYTE* lsbyte; - UINT32 fConditionFlag = TRUE; - - /* Built the structure based on the base address:*/ - ls = (LLM_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM_LIST_HEAD *)(lsbyte + sizeof(LLM_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD))); - ls->li = (LLM_LIST_ITEM *)(lsbyte + sizeof(LLM_LIST) + (total_lists * sizeof(LLM_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - - if (list_handle >= ls->total_lists) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM_INVALID_LIST_HANDLE); - if (lh->list_length <= item_number) return(OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE); - - if (item_number == 0 && lh->list_length == 1)/* First item and only item:*/ - { - freed_item_pnt = lh->head_pointer; - freed_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * freed_item_pnt); - - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - - lh->cache_item_number = 0xFFFFFFFF; - lh->cache_item_pointer = 0xFFFFFFFF; - } - else if (item_number == 0) /* First item and but list not empty:*/ - { - freed_item_pnt = ls->lh[list_handle].head_pointer; - freed_item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * freed_item_pnt); - - lh->head_pointer = freed_item->forward_link; - - lh->cache_item_number = 0; - lh->cache_item_pointer = freed_item->forward_link; - } - else /* Discard non-first item! (Caution: this could be the last item!)*/ - { - LLM_LIST_ITEM * last_item = NULL; - LLM_LIST_ITEM * item; - UINT32 last_list_pnt; - UINT32 cur_list_pnt; - UINT32 cur_list_num; - - if (lh->cache_item_number < item_number) /* Start at cache:*/ - { - cur_list_pnt = lh->cache_item_pointer; - cur_list_num = lh->cache_item_number; - } - else /* Start at beginning:*/ - { - cur_list_pnt = lh->head_pointer; - cur_list_num = 0; - } - - last_list_pnt = 0xFFFFFFFF; - - /* Start search from cur_list_pnt and cur_list_num.*/ - while( fConditionFlag == TRUE ) - { - item = (LLM_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - - if (cur_list_num == item_number) /* Item number found.*/ - { - if (last_list_pnt == 0xFFFFFFFF) return(OCTAPI_LLM_INTERNAL_ERROR1); - - if ((item_number + 1) == lh->list_length) - { - lh->tail_pointer = last_list_pnt; - last_item->forward_link = 0xFFFFFFFF; - } - else - { - last_item->forward_link = item->forward_link; - } - freed_item_pnt = cur_list_pnt; - freed_item = item; - - /* Reset cache entry.*/ - lh->cache_item_pointer = last_list_pnt; - lh->cache_item_number = cur_list_num - 1; - - fConditionFlag = FALSE; - break; - } - else if (item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/ - { - return(OCTAPI_LLM_INTERNAL_ERROR0); - } - else /* Item was not found, but continue searching.*/ - { - last_item = item; - last_list_pnt = cur_list_pnt; - cur_list_pnt = item->forward_link; - } - - cur_list_num++; - } - } - - /* Decrease the list length.*/ - lh->list_length--; - ls->assigned_items--; - - /* Return free block to free block list:*/ - freed_item->forward_link = ls->next_empty_item; - ls->next_empty_item = freed_item_pnt; - - return(GENERIC_OK); -} -#endif - -/**************************************** llm2 function section *****************************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlm2ListGetSize -| -| Description: This function determines the amount of memory needed by -| the LLM2_LIST structure to manage the allocation of -| number_of_items number of resources. The memory is -| measured in bytes. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| number_of_items UINT32 The number of resources to be allocated -| amongst all linked-lists. -| number_of_lists UINT32 The maximum number of linked-lists that -| can be allocated. -| *l_size UINT32 UINT32 The amount of memory needed, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListGetSize -UINT32 OctApiLlm2ListGetSize(UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size,UINT32 * l_size) -{ - UINT32 head_alloc_size; - UINT32 result; - UINT32 user_info_size_roundup; - - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - if (number_of_lists == 0) return(GENERIC_BAD_PARAM); - if (user_info_size == 0) return(GENERIC_BAD_PARAM); - - user_info_size_roundup = ((user_info_size + 3) / 4) * 4; - - result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size); - if(result != GENERIC_OK) return(result); - - *l_size = sizeof(LLM2_LIST) + (number_of_lists * sizeof(LLM2_LIST_HEAD)) + head_alloc_size + (number_of_items * (sizeof(LLM2_LIST_ITEM) + user_info_size_roundup - 4)); - - return(GENERIC_OK); -} -#endif - -#if !SKIP_OctApiLlm2ListGetItemPointer -LLM2_LIST_ITEM * OctApiLlm2ListGetItemPointer(LLM2_LIST * ls, UINT32 item_number) -{ - return (LLM2_LIST_ITEM *) (((BYTE *)ls->li) + (ls->item_size * item_number)) ; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlm2ListInit. -| -| Description: This function intializes the LLM2_TALLOC structure. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM2_LIST structure. -| number_of_items UINT32 The number of resources to be allocated -| amongst all linked-lists. -| number_of_lists UINT32 The maximum number of linked-lists that -| can be allocated. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListInit -UINT32 OctApiLlm2ListInit(void ** l,UINT32 number_of_items,UINT32 number_of_lists,UINT32 user_info_size) -{ - LLM2_LIST* ls; - LLM2_LIST_ITEM* item; - UINT32 i; - UINT32 head_alloc_size; - UINT32 result; - UINT32 user_info_size_roundup; - UINT32 total_lists; - BYTE* lsbyte; - - - if (number_of_items == 0) return(GENERIC_BAD_PARAM); - if (number_of_lists == 0) return(GENERIC_BAD_PARAM); - if (user_info_size == 0) return(GENERIC_BAD_PARAM); - - user_info_size_roundup = ((user_info_size + 3) / 4) * 4; - - /* Get the size of the Alloc structure used to manage head of list structures.*/ - result = OctapiLlmAllocGetSize(number_of_lists,&head_alloc_size); - if(result != GENERIC_OK) return(result); - - if (*l == NULL) return(OCTAPI_LLM_MEMORY_NOT_ALLOCATED); - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)(*l); - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - /* Initialize parameters in the structure.*/ - ls->head_alloc_size = head_alloc_size; - ls->user_info_bytes = user_info_size; - ls->user_info_size = user_info_size_roundup; - ls->total_items = number_of_items; - ls->assigned_items = 0; - ls->total_lists = number_of_lists; - ls->assigned_lists = 0; - ls->next_empty_item = 0; - ls->item_size = sizeof(LLM2_LIST_ITEM) + user_info_size_roundup - 4; - - /* Complete the build!*/ - ls = (LLM2_LIST *)(*l); - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - /* Initialize the head of queue Alloc structure.*/ - result = OctapiLlmAllocInit(&(ls->list_head_alloc),number_of_lists); - if(result != GENERIC_OK) return(result); - - /* Initialize the linked list of the items:*/ - for(i=0; ili + ls->item_size * i); - - if (i == (number_of_items - 1)) - item->forward_link = 0xFFFFFFFF; - else - item->forward_link = i + 1; - } - - return(GENERIC_OK); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlm2ListCreate. -| -| Description: This function creates a linked list. The target which is -| allocated the newly created list can request additions -| or removals from the list later on. To target identifies -| its list with the returned list handle. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM_LIST structure. -| *list_handle UINT32 The handle to the new list, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListCreate -UINT32 OctApiLlm2ListCreate(void * l,UINT32 * list_handle) -{ - LLM2_LIST* ls; - LLM2_LIST_HEAD* lh; - UINT32 blocknum; - UINT32 total_lists; - UINT32 result; - BYTE* lsbyte; - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - /* Get a list using the list head alloc structure.*/ - result = OctapiLlmAllocAlloc(ls->list_head_alloc, &blocknum); - if (result != GENERIC_OK) return(result); - - /* The handle is the block number.*/ - *list_handle = blocknum; - - /* Initialize the list head structure.*/ - lh = &ls->lh[blocknum]; - lh->list_length = 0; - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - - ls->assigned_lists++; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListDelete. -| -| Description: This function deletes the linked list indicated by the -| handle list_handle. Any items which are still allocated -| to the list are first deallocated. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM2_LIST structure. -| *list_handle UINT32 The handle to the list. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListDelete -UINT32 OctApiLlm2ListDelete(void * l,UINT32 list_handle) -{ - LLM2_LIST* ls; - LLM2_LIST_HEAD* lh; - UINT32 total_lists; - UINT32 result; - BYTE* lsbyte; - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - - if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE); - if (ls->lh[list_handle].list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE); - - /* Release internal list header handle...*/ - result = OctapiLlmAllocDealloc(ls->list_head_alloc,list_handle); - if (result != GENERIC_OK) return(result); - - lh = &ls->lh[list_handle]; - - /* Deallocate all items in the list!*/ - if (lh->list_length != 0) - { - LLM2_LIST_ITEM * item; - - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * lh->tail_pointer); - - /* Release the items using only the links.*/ - item->forward_link = ls->next_empty_item; - ls->next_empty_item = lh->head_pointer; - - /* Remove items from item counter.*/ - ls->assigned_items -= lh->list_length; - } - - lh->list_length = 0xFFFFFFFF; - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - - ls->assigned_lists--; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmListLength. -| -| Description: This function returns the number of items allocated to the -| list indicated by the handle list_handle. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM2_LIST structure. -| list_handle UINT32 The handle to the list. -| *number_of_items UINT32 The number of items in the list, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListLength -UINT32 OctApiLlm2ListLength(void * l,UINT32 list_handle, UINT32 * number_of_items_in_list) -{ - LLM2_LIST* ls; - LLM2_LIST_HEAD* lh; - UINT32 total_lists; - BYTE* lsbyte; - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - - if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE); - if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE); - - *number_of_items_in_list = lh->list_length; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlm2ListItemData -| -| Description: This function returns a pointer to the user data associated -| with an item. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM2_LIST structure. -| list_handle UINT32 The handle to the list. -| item_number UINT32 The number of the list node in question. -| **item_data_pnt void The pointer to the user data, returned. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListItemData -UINT32 OctApiLlm2ListItemData(void * l,UINT32 list_handle,UINT32 item_key,void ** item_data_pnt, PUINT32 item_number_pnt) -{ - LLM2_LIST* ls; - LLM2_LIST_HEAD* lh; - LLM2_LIST_ITEM* item; - UINT32 cur_list_pnt; - UINT32 cur_list_key = 0xFFFFFFFF; - UINT32 total_lists; - UINT32 list_length; - BYTE* lsbyte; - UINT32 fConditionFlag = TRUE; - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - list_length = lh->list_length; - - *item_data_pnt = NULL; - *item_number_pnt = 0; - if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE); - if (list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE); - - /* Determine where the search will start.*/ - /* Start at beginning:*/ - cur_list_pnt = lh->head_pointer; - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - cur_list_key = item->key; - - /* Start search from cur_list_pnt and cur_list_num.*/ - while ( fConditionFlag == TRUE ) - { - if (cur_list_key == item_key) /* Item key found.*/ - { - /* Get item info.*/ - *item_data_pnt = (void *)item->user_info; - - return(GENERIC_OK); - } - else if(item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/ - { - return(OCTAPI_LLM2_INTERNAL_ERROR0); - } - else /* Item was not found, but continue searching.*/ - { - cur_list_pnt = item->forward_link; - } - - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - cur_list_key = item->key; - (*item_number_pnt)++; - } - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlm2ListInsertItem. -| -| Description: This function allocates a node to the linked list specified -| by the handle list_handle. The position of the new item -| will be defined based on the key value. All entry are inserted -| in the list in incremental Key value. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM2_LIST structure. -| *list_handle UINT32 The handle to the list. -| **item_data void Address of the user data space for this item. -| **prev_item_data void Address of the user data space for the previous item. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListInsertItem -UINT32 OctApiLlm2ListInsertItem(void * l,UINT32 list_handle,UINT32 item_key,void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt ) -{ - LLM2_LIST* ls; - LLM2_LIST_HEAD* lh; - LLM2_LIST_ITEM* free_item; - UINT32 free_item_pnt; - UINT32 total_lists; - BYTE* lsbyte; - UINT32 ulPassCount = 0; - UINT32 fConditionFlag = TRUE; - - /* Set the status of the insertion.*/ - *insert_status_pnt = OCTAPI_LLM2_INSERT_ERROR; - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - - *item_data_pnt = NULL; - if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE); - if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE); - if (ls->next_empty_item == 0xFFFFFFFF) return(OCTAPI_LLM2_NO_STRUCTURES_LEFT); - - /* Get a free item from the free item list!*/ - free_item_pnt = ls->next_empty_item; - free_item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * free_item_pnt); - free_item->key = item_key; - ls->next_empty_item = free_item->forward_link; - - if (lh->list_length == 0) /* First item and only item:*/ - { - free_item->forward_link = 0xFFFFFFFF; - lh->tail_pointer = free_item_pnt; - lh->head_pointer = free_item_pnt; - *insert_status_pnt = OCTAPI_LLM2_INSERT_FIRST_NODE; - - /* There is no previous node information to return.*/ - *prev_item_data_pnt = NULL; - *prev_prev_item_data_pnt = NULL; - } - else /* Insert:*/ - { - LLM2_LIST_ITEM * last_last_item = NULL; - LLM2_LIST_ITEM * last_item = NULL; - LLM2_LIST_ITEM * item; - UINT32 last_list_pnt; - UINT32 cur_list_pnt; - UINT32 cur_list_key = 0xFFFFFFFF; - - /* Start at beginning:*/ - cur_list_pnt = lh->head_pointer; - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - cur_list_key = item->key; - - last_list_pnt = 0xFFFFFFFF; - - /* Start search from cur_list_pnt and cur_list_num.*/ - while ( fConditionFlag == TRUE ) - { - /* Increment the pass count to determine if the addition will happen next to last.*/ - ulPassCount++; - - if (cur_list_key >= item_key) /* Item new node between the last and the curent. */ - { - if (last_list_pnt == 0xFFFFFFFF) /* Must insert at the head of the list.*/ - { - free_item->forward_link = cur_list_pnt; - lh->head_pointer = free_item_pnt; - } - else /* Standard insertion.*/ - { - free_item->forward_link = cur_list_pnt; - last_item->forward_link = free_item_pnt; - } - - /* Check if the entry was made before the last one.*/ - if ( ulPassCount == lh->list_length ) - *insert_status_pnt = OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE; - else - *insert_status_pnt = OCTAPI_LLM2_INSERT_LIST_NODE; - - fConditionFlag = FALSE; - break; - } - else if (item->forward_link == 0xFFFFFFFF) /* End of list found, must insert at the end.*/ - { - free_item->forward_link = 0xFFFFFFFF; - item->forward_link = free_item_pnt; - lh->tail_pointer = free_item_pnt; - - *insert_status_pnt = OCTAPI_LLM2_INSERT_LAST_NODE; - - fConditionFlag = FALSE; - break; - } - else /* Item was not found, but continue searching.*/ - { - last_last_item = last_item; - last_item = item; - last_list_pnt = cur_list_pnt; - cur_list_pnt = item->forward_link; - } - - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - cur_list_key = item->key; - - } - - /* Return the previous node if possible.*/ - if ( *insert_status_pnt == OCTAPI_LLM2_INSERT_LIST_NODE || - *insert_status_pnt == OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE ) - { - if ( last_item != NULL ) - *prev_item_data_pnt = (void *)last_item->user_info; - - if ( last_last_item != NULL ) - *prev_prev_item_data_pnt = (void *)last_last_item->user_info; - else - *prev_prev_item_data_pnt = NULL; - } - else - { - *prev_item_data_pnt = (void *)item->user_info; - - if ( ( last_last_item != NULL ) && ( last_item != NULL ) ) - *prev_prev_item_data_pnt = (void *)last_item->user_info; - else - *prev_prev_item_data_pnt = NULL; - } - } - - /* Increase the list length.*/ - lh->list_length++; - ls->assigned_items++; - *item_data_pnt = (void *)free_item->user_info; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlm2ListRemoveItem. -| -| Description: This function deallocates a node of the linked list specified -| by the handle list_handle. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *l void The memory used by the LLM2_LIST structure. -| list_handle UINT32 The handle to the list. -| item_key UINT32 The key of the item to be removed. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlm2ListRemoveItem -UINT32 OctApiLlm2ListRemoveItem(void * l,UINT32 list_handle,UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt ) -{ - LLM2_LIST* ls; - LLM2_LIST_ITEM* freed_item = NULL; - LLM2_LIST_HEAD* lh; - UINT32 freed_item_pnt = 0xFFFFFFFF; - UINT32 total_lists; - BYTE* lsbyte; - UINT32 fConditionFlag = TRUE; - UINT32 ulPassCount = 0; - - /* Built the structure based on the base address:*/ - ls = (LLM2_LIST *)l; - lsbyte = (BYTE *)ls; - total_lists = ls->total_lists; - - /* Set the status of the removal to error as a default value.*/ - *remove_status_pnt = OCTAPI_LLM2_REMOVE_ERROR; - - ls->lh = (LLM2_LIST_HEAD *)(lsbyte + sizeof(LLM2_LIST)); - ls->list_head_alloc = (void *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD))); - ls->li = (LLM2_LIST_ITEM *)(lsbyte + sizeof(LLM2_LIST) + (total_lists * sizeof(LLM2_LIST_HEAD)) + ls->head_alloc_size); - - lh = &ls->lh[list_handle]; - - if (list_handle >= ls->total_lists) return(OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE); - if (lh->list_length == 0xFFFFFFFF) return(OCTAPI_LLM2_INVALID_LIST_HANDLE); - - if (lh->list_length == 1)/* First item and only item if he matches.*/ - { - freed_item_pnt = lh->head_pointer; - freed_item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * freed_item_pnt); - - if ( freed_item->key == item_key ) - { - lh->head_pointer = 0xFFFFFFFF; - lh->tail_pointer = 0xFFFFFFFF; - } - else - return(OCTAPI_LLM2_INTERNAL_ERROR1); - - /* Indicate that there was no node prior to the one removed.*/ - *prev_item_key_pnt = 0xFFFFFFFF; - *prev_prev_item_key_pnt = 0xFFFFFFFF; - *remove_status_pnt = OCTAPI_LLM2_REMOVE_FIRST_NODE; - } - else /* Discard non-first item! (Caution: this could be the last item!)*/ - { - LLM2_LIST_ITEM * last_last_item = NULL; - LLM2_LIST_ITEM * last_item = NULL; - LLM2_LIST_ITEM * item; - UINT32 last_list_pnt; - UINT32 cur_list_pnt; - UINT32 cur_list_key; - - /* Start at beginning:*/ - cur_list_pnt = lh->head_pointer; - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - cur_list_key = item->key; - - last_list_pnt = 0xFFFFFFFF; - - /* Start search from cur_list_pnt and cur_list_num.*/ - while( fConditionFlag == TRUE ) - { - ulPassCount++; - if (cur_list_key == item_key) /* Item number found.*/ - { - if (last_list_pnt == 0xFFFFFFFF) /* First item in the list.*/ - { - lh->head_pointer = item->forward_link; - *remove_status_pnt = OCTAPI_LLM2_REMOVE_FIRST_NODE; - } - else if ( item->forward_link == 0xFFFFFFFF) /* Last item of the list.*/ - { - last_item->forward_link = 0xFFFFFFFF; - lh->tail_pointer = last_list_pnt; - *remove_status_pnt = OCTAPI_LLM2_REMOVE_LAST_NODE; - } - else - { - last_item->forward_link = item->forward_link; - - if ( ulPassCount == ( lh->list_length - 1 ) ) - *remove_status_pnt = OCTAPI_LLM2_REMOVE_BEFORE_LAST_NODE; - else - *remove_status_pnt = OCTAPI_LLM2_REMOVE_LIST_NODE; - } - - freed_item_pnt = cur_list_pnt; - freed_item = item; - - fConditionFlag = FALSE; - break; - } - else if (item->forward_link == 0xFFFFFFFF) /* End of list found?!?*/ - { - return(OCTAPI_LLM2_INTERNAL_ERROR0); - } - else /* Item was not found, but continue searching.*/ - { - last_last_item = last_item; - last_item = item; - last_list_pnt = cur_list_pnt; - cur_list_pnt = item->forward_link; - } - - item = (LLM2_LIST_ITEM *)((BYTE *)ls->li + ls->item_size * cur_list_pnt); - cur_list_key = item->key; - } - - /* Return the key of the node before the node removed if possible.*/ - if ( last_list_pnt == 0xFFFFFFFF ) - *prev_item_key_pnt = 0xFFFFFFFF; - else if ( last_item != NULL ) - *prev_item_key_pnt = last_item->key; - - /* Return the key of the node before before the node removed if possible.*/ - if ( last_last_item == NULL ) - *prev_prev_item_key_pnt = 0xFFFFFFFF; - else - *prev_prev_item_key_pnt = last_last_item->key; - - } - - /* Decrease the list length.*/ - lh->list_length--; - ls->assigned_items--; - - /* Return free block to free block list:*/ - freed_item->forward_link = ls->next_empty_item; - ls->next_empty_item = freed_item_pnt; - - return(GENERIC_OK); -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ -| API UTILITIES -| -| Function: OctApiLlmMemCpy. -| -| Description: This function copies data from a source to a destination. -| -| ----------------------------------------------------------------------- -| | Variable | Type | Description -| ----------------------------------------------------------------------- -| *f_pvDestination VOID The destination where to copy the data. -| *f_pvSource VOID The source where to copy the data from. -| f_ulSize UINT32 The number of bytes to copy. -| -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OctApiLlmMemCpy -VOID * OctApiLlmMemCpy( VOID *f_pvDestination, const VOID * f_pvSource, UINT32 f_ulSize ) -{ - CHAR * pbyDst; - const CHAR * pbySrc; - UINT32 * f_pulAlignedDst; - const UINT32 * f_pulAlignedSrc; - - pbyDst = (CHAR *)f_pvDestination; - pbySrc = (const CHAR *)f_pvSource; - - /* - * If the size is small, or either SRC or DST is unaligned, - * then punt into the byte copy loop. This should be rare. - */ - if ( ( f_ulSize < sizeof(UINT32) ) - || ( ( (unsigned long)( pbySrc ) & ( sizeof(UINT32) - 1 ) ) | ( (unsigned long)( pbyDst ) & ( sizeof(UINT32) - 1 ) ) ) ) - { - while ( f_ulSize-- ) - *pbyDst++ = *pbySrc++; - return f_pvDestination; - } - - f_pulAlignedDst = (UINT32 *)pbyDst; - f_pulAlignedSrc = (const UINT32 *)pbySrc; - - /* Copy 4X long words at a time if possible. */ - while ( f_ulSize >= 4 * sizeof(UINT32) ) - { - *f_pulAlignedDst++ = *f_pulAlignedSrc++; - *f_pulAlignedDst++ = *f_pulAlignedSrc++; - *f_pulAlignedDst++ = *f_pulAlignedSrc++; - *f_pulAlignedDst++ = *f_pulAlignedSrc++; - f_ulSize -= 4 * sizeof(UINT32); - } - - /* Copy one long word at a time if possible. */ - while ( f_ulSize >= sizeof(UINT32) ) - { - *f_pulAlignedDst++ = *f_pulAlignedSrc++; - f_ulSize -= sizeof(UINT32); - } - - /* Pick up any residual with a byte copier. */ - pbyDst = (CHAR *)f_pulAlignedDst; - pbySrc = (const CHAR *)f_pulAlignedSrc; - while ( f_ulSize-- ) - *pbyDst++ = *pbySrc++; - - return f_pvDestination; -} -#endif - -/**************************************** llm_list section **********************************************/ - diff --git a/zaptel/kernel/oct612x/apilib/llman/octapi_llman_private.h b/zaptel/kernel/oct612x/apilib/llman/octapi_llman_private.h deleted file mode 100644 index 14a053da..00000000 --- a/zaptel/kernel/oct612x/apilib/llman/octapi_llman_private.h +++ /dev/null @@ -1,206 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_llman_private.h - -Copyright (c) 2001 Octasic Inc. All rights reserved. - -Description: - - Library used to manage allocation tables and linked lists. The library is - made such that only a block of contiguous memory is needed for the - management of the linked list/allocation table. - - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 13 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTAPI_LLMAN_PRIVATE_H__ -#define __OCTAPI_LLMAN_PRIVATE_H__ - -#include "octdef.h" - - -/**************************************** llm_alloc section **********************************************/ - - -/* Most basic linked list model. - LLM_STR contains a list of "number_of_items" that - are each "unassigned" or "assigned". When requesting - a new element, llm_alloc must choose an "unassigned" - element. An element that is deallocated will be last - to be allocated. -*/ - -typedef struct _LLM_ALLOC -{ - UINT32 *linked_list; /* Each item is either used (0xFFFFFFFE)*/ - /* or unused (pointer to next unused item, 0xFFFFFFFF means last item reached).*/ - UINT32 next_avail_num; /* Points to the next available item in linked list. (0xFFFFFFFF means none available)*/ - UINT32 number_of_items; /* Total number of items in linked list.*/ - UINT32 allocated_items; /* Allocated items in linked list.*/ - -} LLM_ALLOC; - -typedef struct _TLLM_ALLOC_NODE_ -{ - UINT32 value; /* Each item is either used (0xFFFFFFFE)*/ - /* or unused (pointer to next unused item, 0xFFFFFFFF means last item reached).*/ - UINT32 timeout[2]; /* Timeout value that must be exceeded for the node to be considered free again.*/ - -} TLLM_ALLOC_NODE; - - -typedef struct _TLLM_ALLOC_ -{ - TLLM_ALLOC_NODE *linked_list; /* List of nodes used by the link list.*/ - - UINT32 next_avail_num; /* Points to the next available item in linked list. (0xFFFFFFFF means none available)*/ - UINT32 number_of_items; /* Total number of items in linked list.*/ - UINT32 allocated_items; /* Allocated items in linked list.*/ - - UINT32 number_of_timeout; /* Number of block currently in timeout.*/ - UINT32 next_timeout_num; /* Points to the next block currently in timeout.*/ - UINT32 last_timeout_num; /* Last node of the timeout list.*/ - - UINT32 last_known_time[2]; /* last known time.*/ - -} TLLM_ALLOC; - -/* -void octapi_llm_alloc_build_structure(void *l, LLM_ALLOC ** ls); -*/ -/**************************************** llm_alloc section **********************************************/ - - - -/**************************************** llm_list section **********************************************/ -/* This section contains memory structures and functions used - to maintain a variable number of lists (FIFOs) that each - have a variable amount of items. A total amount of items - can be assigned through-out all the lists. Each item in - each list contains a UINT32 specified by the software using - the lists. Each used item in the list is accessible through - it's position in the list. */ - -typedef struct _LLM_LIST_HEAD -{ - UINT32 list_length; /* Current number of items in the list.*/ - /* 0xFFFFFFFF means that the list is not used.*/ - UINT32 head_pointer; /* Number of the item in the item pool that is the first of this list.*/ - /* 0xFFFFFFFF indicates end-of-list link.*/ - UINT32 tail_pointer; /* Number of the item in the item pool that is the last of this list.*/ - - /* Item cache (pointer within the list of the last accessed item):*/ - UINT32 cache_item_number; /* Number of the last accessed item in the list. 0xFFFFFFFF indicates invalid cache.*/ - UINT32 cache_item_pointer; /* Number of the last accessed item in the item pool.*/ -} LLM_LIST_HEAD; - -typedef struct _LLM_LIST_ITEM -{ - UINT32 forward_link; /* Number of the item in the item pool that is next in this list.*/ - /* 0xFFFFFFFF indicates end-of-list link.*/ - - /* User item info (variable size)*/ - UINT32 user_info[1]; -} LLM_LIST_ITEM; - -typedef struct _LLM_LIST -{ - UINT32 user_info_bytes; /* In bytes, size of the user info in a single item.*/ - UINT32 user_info_size; /* In bytes, size of the user info in a single item.*/ - UINT32 item_size; - - UINT32 head_alloc_size; - UINT32 total_items; - UINT32 assigned_items; - - UINT32 total_lists; - UINT32 assigned_lists; - - UINT32 next_empty_item; /* Contains a pointer to the next empty item in the*/ - /* item pool.*/ - - /* Table of all the possible list heads:*/ - LLM_LIST_HEAD * lh; - void * list_head_alloc; /* LLM_ALLOC structure used for list head allocation!*/ - - /* Table of the list items:*/ - LLM_LIST_ITEM * li; -} LLM_LIST; - - -/**********************************************************************************/ -/* These structures are are used by the Llm2 functions to creates lists of ordered - items based on a key given by the user when a new node is inserted in a list. */ -typedef struct _LLM2_LIST_HEAD -{ - UINT32 list_length; /* Current number of items in the list.*/ - /* 0xFFFFFFFF means that the list is not used.*/ - UINT32 head_pointer; /* Number of the item in the item pool that is the first of this list.*/ - /* 0xFFFFFFFF indicates end-of-list link.*/ - UINT32 tail_pointer; /* Number of the item in the item pool that is the last of this list.*/ - -} LLM2_LIST_HEAD; - -typedef struct _LLM2_LIST_ITEM -{ - UINT32 forward_link; /* Number of the item in the item pool that is next in this list.*/ - /* 0xFFFFFFFF indicates end-of-list link.*/ - UINT32 key; /* Key used to order the entries.*/ - - /* User item info (variable size)*/ - UINT32 user_info[1]; -} LLM2_LIST_ITEM; - -typedef struct _LLM2_LIST -{ - UINT32 user_info_bytes; /* In bytes, size of the user info in a single item.*/ - UINT32 user_info_size; /* In bytes, size of the user info in a single item.*/ - UINT32 item_size; - - UINT32 head_alloc_size; - UINT32 total_items; - UINT32 assigned_items; - - UINT32 total_lists; - UINT32 assigned_lists; - - UINT32 next_empty_item; /* Contains a pointer to the next empty item in the*/ - /* item pool.*/ - - /* Table of all the possible list heads:*/ - LLM2_LIST_HEAD * lh; - void * list_head_alloc; /* LLM_ALLOC structure used for list head allocation!*/ - - /* Table of the list items:*/ - LLM2_LIST_ITEM * li; -} LLM2_LIST; - -/*void octapi_llm_list_build_structure(void *l, LLM_LIST ** ls);*/ -LLM_LIST_ITEM * OctApiLlmListGetItemPointer( LLM_LIST * ls, UINT32 item_number ); -LLM2_LIST_ITEM * OctApiLlm2ListGetItemPointer( LLM2_LIST * ls, UINT32 item_number ); -UINT32 OctApiTllmCheckTimeoutList( TLLM_ALLOC *ls, UINT32 current_time[2] ); -VOID * OctApiLlmMemCpy( VOID *f_pvDestination, const VOID * f_pvSource, UINT32 f_ulSize ); -/**************************************** llm_list section **********************************************/ - - - - - -#endif /*__OCTAPI_LLMAN_PRIVATE_H__*/ diff --git a/zaptel/kernel/oct612x/get_discards b/zaptel/kernel/oct612x/get_discards deleted file mode 100755 index 54361188..00000000 --- a/zaptel/kernel/oct612x/get_discards +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/php - - diff --git a/zaptel/kernel/oct612x/include/apilib/octapi_bt0.h b/zaptel/kernel/oct612x/include/apilib/octapi_bt0.h deleted file mode 100644 index a0f22cad..00000000 --- a/zaptel/kernel/oct612x/include/apilib/octapi_bt0.h +++ /dev/null @@ -1,75 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_bt0.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Library used to manage a binary tree of variable max size. Library is - made to use one block of contiguous memory to manage the tree. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 11 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTAPI_BT0_H__ -#define __OCTAPI_BT0_H__ - -#include "octdef.h" - -#define OCTAPI_BT0_BASE 0xFFFF0000 -#define OCTAPI_BT0_KEY_SIZE_NOT_MUTLIPLE_OF_UINT32 OCTAPI_BT0_BASE+0x0001 -#define OCTAPI_BT0_DATA_SIZE_NOT_MUTLIPLE_OF_UINT32 OCTAPI_BT0_BASE+0x0002 -#define OCTAPI_BT0_MALLOC_FAILED OCTAPI_BT0_BASE+0x0003 -#define OCTAPI_BT0_NO_NODES_AVAILABLE OCTAPI_BT0_BASE+0x0004 -#define OCTAPI_BT0_KEY_ALREADY_IN_TREE OCTAPI_BT0_BASE+0x0005 -#define OCTAPI_BT0_KEY_NOT_IN_TREE OCTAPI_BT0_BASE+0x0006 - -/* Possible result for Find Or Add function. */ -#define OCTAPI0_BT0_NODE_FOUND 0 -#define OCTAPI0_BT0_NODE_ADDDED 1 - -#define OCTAPI_BT0_NO_SMALLER_KEY 0xAAAAAAAA - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define octapi_bt0_get_size( number_of_items, key_size, data_size, b_size ) OctApiBt0GetSize( (UINT32) number_of_items,(UINT32) key_size, (UINT32) data_size, (PUINT32) b_size ) -#define octapi_bt0_init( b, number_of_items, key_size, data_size ) OctApiBt0Init( (void **) b,(UINT32) number_of_items,(UINT32) key_size, (UINT32) data_size ) -#define octapi_bt0_add_node( b, key, data ) OctApiBt0AddNode( (void *) b,(void *) key,(void **) data ) -#define octapi_bt0_remove_node( b, key ) OctApiBt0RemoveNode( (void *) b,(void *) key ) -#define octapi_bt0_query_node( b, key, data ) OctApiBt0QueryNode( (void *) b,(void *) key,(void **) data ) -#define octapi_bt0_get_first_node( b, key, data ) OctApiBt0GetFirstNode( (void *) b,(void **) key, (void **) data ) - -UINT32 OctApiBt0GetSize( UINT32 number_of_items, UINT32 key_size, UINT32 data_size, UINT32 * b_size ); -UINT32 OctApiBt0Init( void ** b, UINT32 number_of_items, UINT32 key_size, UINT32 data_size ); -UINT32 OctApiBt0AddNode( void * b, void * key, void ** data ); -UINT32 OctApiBt0RemoveNode( void * b, void * key ); -UINT32 OctApiBt0QueryNode( void * b, void * key, void ** data ); -UINT32 OctApiBt0GetFirstNode( void * b, void ** key, void ** data ); -UINT32 OctApiBt0FindOrAddNode( void * b, void * key, void ** data, UINT32 *fnct_result ); - -UINT32 OctApiBt0AddNodeReportPrevNodeData( void * b, void * key, void ** data, void ** prev_data, UINT32 *fnct_result ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*__OCTAPI_BT0_H__*/ diff --git a/zaptel/kernel/oct612x/include/apilib/octapi_largmath.h b/zaptel/kernel/oct612x/include/apilib/octapi_largmath.h deleted file mode 100644 index 1680474a..00000000 --- a/zaptel/kernel/oct612x/include/apilib/octapi_largmath.h +++ /dev/null @@ -1,69 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_largmath.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Library used to perform arithmetic on integer values of an integer multiple - of 32-bits. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 6 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTAPI_LARGMATH_H__ -#define __OCTAPI_LARGMATH_H__ - -#include "octdef.h" - -#define OCTAPI_LM_DIVISION_BY_ZERO 0xFFFF -#define OCTAPI_LM_OVERFLOW 0xFFFE -#define OCTAPI_LM_ARRAY_SIZE_MISMATCH 0xFFFD - -#define OCTAPI_LM_MAX_OPTIMIZE_MUL 10 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define octapi_lm_add( a, alen, b, blen, z, zlen ) OctApiLmAdd( (PUINT32) a, (USHORT) alen, (PUINT32) b, (USHORT) blen, (PUINT32) z, (USHORT) zlen ) -#define octapi_lm_subtract( a, alen, bneg, blen, z, zlen, neg ) OctApiLmSubtract( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (PUINT32) z, (USHORT) zlen, (USHORT*) neg ) -#define octapi_lm_compare( a, alen, bneg, blen, neg ) OctApiLmCompare( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (USHORT*) neg ) -#define octapi_lm_multiply( a, b, ablen, z ) OctApiLmMultiply( (PUINT32) a, (PUINT32) b, (USHORT) ablen, (PUINT32) z ) -#define octapi_lm_divide( n, d, q, r, ndqrlen ) OctApiLmDivide( (PUINT32) n, (PUINT32) d, (PUINT32) q, (PUINT32) r, (USHORT) ndqrlen ) -#define octapi_lm_shiftright1( a, alen ) OctApiLmShiftRight1( (PUINT32) a, (USHORT) alen ) -#define octapi_lm_shiftn( a, alen, shiftleft, shiftn ) OctApiLmShiftn( (PUINT32) a, (USHORT) alen, (USHORT) shiftleft, (USHORT) shiftn ) -#define octapi_lm_getmsb( a, alen, msb_pos ) OctApiLmGetMsb( (PUINT32) a, (USHORT) alen, (USHORT*) msb_pos ) - - -UINT32 OctApiLmAdd( PUINT32 a, USHORT alen, PUINT32 b, USHORT blen, PUINT32 z, USHORT zlen ); -UINT32 OctApiLmSubtract( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUINT32 z, USHORT zlen, PUSHORT neg ); -UINT32 OctApiLmCompare( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUSHORT neg ); -UINT32 OctApiLmMultiply( PUINT32 a, PUINT32 b, USHORT ablen, PUINT32 z ); -UINT32 OctApiLmDivide( PUINT32 n, PUINT32 d, PUINT32 q, PUINT32 r, USHORT ndqrlen ); -UINT32 OctApiLmShiftRight1( PUINT32 a, USHORT alen ); -UINT32 OctApiLmShiftn( PUINT32 a, USHORT alen, USHORT shiftleft, USHORT shiftn ); -UINT32 OctApiLmGetMsb( PUINT32 a, USHORT alen, PUSHORT msb_pos ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __OCTAPI_LARGMATH_H__ */ diff --git a/zaptel/kernel/oct612x/include/apilib/octapi_llman.h b/zaptel/kernel/oct612x/include/apilib/octapi_llman.h deleted file mode 100644 index b70a8517..00000000 --- a/zaptel/kernel/oct612x/include/apilib/octapi_llman.h +++ /dev/null @@ -1,142 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octapi_llman.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Library used to manage allocation tables and linked lists. The library is - made such that only a block of contiguous memory is needed for the - management of the linked list/allocation table. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 8 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTAPI_LLMAN_H__ -#define __OCTAPI_LLMAN_H__ - -#include "octdef.h" - -/* Error defines. */ -#define OCTAPI_LLM_MEMORY_NOT_ALLOCATED 0xFFFFFFFF -#define OCTAPI_LLM_NO_STRUCTURES_LEFT 0xFFFFFFFE -#define OCTAPI_LLM_BLOCKNUM_OUT_OF_RANGE 0xFFFFFFFD -#define OCTAPI_LLM_ELEMENT_ALREADY_ASSIGNED 0xFFFFFFFC -#define OCTAPI_LLM_ELEMENT_NOT_FOUND 0xFFFFFFFB -#define OCTAPI_LLM_LIST_EMPTY 0xFFFFFFFA -#define OCTAPI_LLM_INVALID_LIST_HANDLE 0xFFFFFFF9 -#define OCTAPI_LLM_TREE_NODE_ABSENT 0xFFFFFFF8 -#define OCTAPI_LLM_INTERNAL_ERROR0 0xFFFFFFF7 -#define OCTAPI_LLM_INTERNAL_ERROR1 0xFFFFFFF6 -#define OCTAPI_LLM_INVALID_PARAMETER 0xFFFFFFF5 - -#define OCTAPI_LLM2_MEMORY_NOT_ALLOCATED 0xFEFFFFFF -#define OCTAPI_LLM2_NO_STRUCTURES_LEFT 0xFEFFFFFE -#define OCTAPI_LLM2_BLOCKNUM_OUT_OF_RANGE 0xFEFFFFFD -#define OCTAPI_LLM2_ELEMENT_ALREADY_ASSIGNED 0xFEFFFFFC -#define OCTAPI_LLM2_ELEMENT_NOT_FOUND 0xFEFFFFFB -#define OCTAPI_LLM2_LIST_EMPTY 0xFEFFFFFA -#define OCTAPI_LLM2_INVALID_LIST_HANDLE 0xFEFFFFF9 -#define OCTAPI_LLM2_TREE_NODE_ABSENT 0xFEFFFFF8 -#define OCTAPI_LLM2_INTERNAL_ERROR0 0xFEFFFFF7 -#define OCTAPI_LLM2_INTERNAL_ERROR1 0xFEFFFFF6 -#define OCTAPI_LLM2_INVALID_PARAMETER 0xFEFFFFF5 - -/* Other defines. */ -#define OCTAPI_LLM_LIST_APPEND 0xFFFFFFFF -#define OCTAPI_LLM2_INSERT_ERROR 0xFFFFFFFF -#define OCTAPI_LLM2_INSERT_FIRST_NODE 0xFFFF0000 -#define OCTAPI_LLM2_INSERT_LIST_NODE 0xFFFF0001 -#define OCTAPI_LLM2_INSERT_LAST_NODE 0xFFFF0002 -#define OCTAPI_LLM2_INSERT_BEFORE_LAST_NODE 0xFFFF0003 -#define OCTAPI_LLM2_REMOVE_ERROR 0xFFFFFFFF -#define OCTAPI_LLM2_REMOVE_FIRST_NODE 0xFFFF0004 -#define OCTAPI_LLM2_REMOVE_LIST_NODE 0xFFFF0005 -#define OCTAPI_LLM2_REMOVE_LAST_NODE 0xFFFF0006 -#define OCTAPI_LLM2_REMOVE_BEFORE_LAST_NODE 0xFFFF0007 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define octapi_llm_alloc_get_size( number_of_items, l_size ) OctapiLlmAllocGetSize( (UINT32) number_of_items,(PUINT32) l_size ) -#define octapi_llm_alloc_init( l, number_of_items ) OctapiLlmAllocInit( (PVOID*) l,(UINT32) number_of_items ) -#define octapi_llm_alloc_info( l, allocated_items, available_items ) OctapiLlmAllocInfo( (PVOID) l, (PUINT32) allocated_items, (PUINT32) available_items ) -#define octapi_llm_alloc_alloc( l, blocknum ) OctapiLlmAllocAlloc( (PVOID) l, (PUINT32) blocknum ) -#define octapi_llm_alloc_dealloc( l, blocknum ) OctapiLlmAllocDealloc( (PVOID) l,(UINT32) blocknum ) -#define octapi_llm_list_get_size( number_of_items, number_of_lists, user_info_size, l_size ) OctApiLlmListGetSize( (UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size,(PUINT32) l_size ) -#define octapi_llm_list_init( l, number_of_items, number_of_lists, user_info_size ) OctApiLlmListInit( (PVOID*) l,(UINT32) number_of_items,(UINT32) number_of_lists,(UINT32) user_info_size ) -#define octapi_llm_list_info( l, allocated_lists, allocated_items, free_lists, free_items ) OctApiLlmListInfo( (PVOID) l,(PUINT32) allocated_lists,(PUINT32) allocated_items,(PUINT32) free_lists,(PUINT32) free_items ) -#define octapi_llm_list_create( l, list_handle ) OctApiLlmListCreate( (PVOID) l,(PUINT32) list_handle ) -#define octapi_llm_list_create_full( l, list_length, plist_handle ) OctApiLlmListCreateFull( (PVOID) l, (UINT32) list_length, (PUINT32) plist_handle ) -#define octapi_llm_list_append_items( l, list_handle, num_items ) OctApiLlmListAppendItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items ) -#define octapi_llm_list_append_and_set_items( l, list_handle, num_items, data_list ) OctApiLlmListAppendAndSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) num_items, (PVOID) data_list ) -#define octapi_llm_list_delete( l, list_handle ) OctApiLlmListDelete( (PVOID) l,(UINT32) list_handle ) -#define octapi_llm_list_length( l, list_handle, number_of_items_in_list ) OctApiLlmListLength( (PVOID) l,(UINT32) list_handle, (PUINT32) number_of_items_in_list ) -#define octapi_llm_list_insert_item( l, list_handle, item_number, item_data_pnt ) OctApiLlmListInsertItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt ) -#define octapi_llm_list_remove_item( l, list_handle, item_number ) OctApiLlmListRemoveItem( (PVOID) l,(UINT32) list_handle,(UINT32) item_number ) -#define octapi_llm_list_item_data( l, list_handle, item_number, item_data_pnt ) OctApiLlmListItemData( (PVOID) l,(UINT32) list_handle,(UINT32) item_number,(PVOID*) item_data_pnt ) -#define octapi_llm_list_copy_data( l, list_handle, start_item, data_length, pdata_list ) OctApiLlmListCopyData( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list ) -#define octapi_llm_list_set_items( l, list_handle, start_item, data_length, pdata_list ) OctApiLlmListSetItems( (PVOID) l, (UINT32) list_handle, (UINT32) start_item, (UINT32) data_length, (PVOID) pdata_list ) - -/* Alloc man. */ -UINT32 OctapiLlmAllocGetSize( UINT32 number_of_items,PUINT32 l_size ); -UINT32 OctapiLlmAllocInit( PVOID* l,UINT32 number_of_items ); -UINT32 OctapiLlmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items ); -UINT32 OctapiLlmAllocAlloc( PVOID l, PUINT32 blocknum ); -UINT32 OctapiLlmAllocDealloc( PVOID l,UINT32 blocknum ); - -/* Time managed alloc man. */ -UINT32 OctApiTllmAllocGetSize( UINT32 number_of_items, PUINT32 l_size ); -UINT32 OctApiTllmAllocInit( PVOID* l, UINT32 number_of_items ); -UINT32 OctApiTllmAllocInfo( PVOID l, PUINT32 allocated_items, PUINT32 available_items ); -UINT32 OctApiTllmAllocAlloc( PVOID l, PUINT32 blocknum, UINT32 current_time[2] ); -UINT32 OctApiTllmAllocDealloc( PVOID l, UINT32 blocknum, UINT32 timeout_value, UINT32 current_time[2] ); - -/* List man. */ -UINT32 OctApiLlmListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size ); -UINT32 OctApiLlmListInit( PVOID* l, UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size ); -UINT32 OctApiLlmListInfo( PVOID l, PUINT32 allocated_lists, PUINT32 allocated_items, PUINT32 free_lists, PUINT32 free_items ); -UINT32 OctApiLlmListCreate( PVOID l, PUINT32 list_handle ); -UINT32 OctApiLlmListCreateFull( PVOID l, UINT32 list_length, UINT32* plist_handle ); -UINT32 OctApiLlmListAppendItems( PVOID l, UINT32 list_handle, UINT32 num_items ); -UINT32 OctApiLlmListAppendAndSetItems( PVOID l, UINT32 list_handle, UINT32 num_items, PVOID data_list ); -UINT32 OctApiLlmListDelete( PVOID l, UINT32 list_handle ); -UINT32 OctApiLlmListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list ); -UINT32 OctApiLlmListInsertItem( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt ); -UINT32 OctApiLlmListRemoveItem( PVOID l, UINT32 list_handle, UINT32 item_number ); -UINT32 OctApiLlmListItemData( PVOID l, UINT32 list_handle, UINT32 item_number, PVOID* item_data_pnt ); -UINT32 OctApiLlmListCopyData( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list ); -UINT32 OctApiLlmListSetItems( PVOID l, UINT32 list_handle, UINT32 start_item, UINT32 data_length, PVOID pdata_list ); - -/* Second list manager using a key to order info in the list. */ -UINT32 OctApiLlm2ListGetSize( UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size, PUINT32 l_size ); -UINT32 OctApiLlm2ListInit( PVOID* l,UINT32 number_of_items, UINT32 number_of_lists, UINT32 user_info_size ); -UINT32 OctApiLlm2ListCreate( PVOID l, PUINT32 list_handle ); -UINT32 OctApiLlm2ListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_items_in_list ); -UINT32 OctApiLlm2ListInsertItem(void * l, UINT32 list_handle, UINT32 item_key, void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt ); -UINT32 OctApiLlm2ListRemoveItem(void * l, UINT32 list_handle, UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt ); -UINT32 OctApiLlm2ListItemData( PVOID l, UINT32 list_handle, UINT32 item_key, PVOID* item_data_pnt, PUINT32 item_number ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __OCTAPI_LLMAN_H__ */ diff --git a/zaptel/kernel/oct612x/include/digium_unused.h b/zaptel/kernel/oct612x/include/digium_unused.h deleted file mode 100644 index ecf382f8..00000000 --- a/zaptel/kernel/oct612x/include/digium_unused.h +++ /dev/null @@ -1,297 +0,0 @@ -/* Define macros here to suppress functions from the API being built */ - -#if 1 - -#define SKIP_Oct6100AdpcmChanOpenDef 1 -#define SKIP_Oct6100AdpcmChanOpen 1 -#define SKIP_Oct6100AdpcmChanCloseDef 1 -#define SKIP_Oct6100AdpcmChanClose 1 -#define SKIP_Oct6100AdpcmChanOpenSer 1 -#define SKIP_Oct6100ApiCheckAdpcmChanParams 1 -#define SKIP_Oct6100ApiReserveAdpcmChanResources 1 -#define SKIP_Oct6100ApiWriteAdpcmChanStructs 1 -#define SKIP_Oct6100ApiUpdateAdpcmChanEntry 1 -#define SKIP_Oct6100AdpcmChanCloseSer 1 -#define SKIP_Oct6100ApiAssertAdpcmChanParams 1 -#define SKIP_Oct6100ApiInvalidateAdpcmChanStructs 1 -#define SKIP_Oct6100ApiReleaseAdpcmChanResources 1 -#define SKIP_Oct6100ApiReserveAdpcmChanEntry 1 -#define SKIP_Oct6100ApiReleaseAdpcmChanEntry 1 -#define SKIP_Oct6100ChannelCloseDef 1 -#define SKIP_Oct6100ChannelClose 1 -#define SKIP_Oct6100ChannelCreateBiDirDef 1 -#define SKIP_Oct6100ChannelCreateBiDir 1 -#define SKIP_Oct6100ChannelDestroyBiDirDef 1 -#define SKIP_Oct6100ChannelDestroyBiDir 1 -#define SKIP_Oct6100ChannelBroadcastTsstAddDef 1 -#define SKIP_Oct6100ChannelBroadcastTsstAdd 1 -#define SKIP_Oct6100ChannelBroadcastTsstRemove 1 -#define SKIP_Oct6100ChannelGetStatsDef 1 -#define SKIP_Oct6100ChannelGetStats 1 -#define SKIP_Oct6100ChannelMuteDef 1 -#define SKIP_Oct6100ChannelMute 1 -#define SKIP_Oct6100ChannelUnMuteDef 1 -#define SKIP_Oct6100ChannelUnMute 1 -#define SKIP_Oct6100ChannelCloseSer 1 -#define SKIP_Oct6100ApiAssertChannelParams 1 -#define SKIP_Oct6100ApiInvalidateChannelStructs 1 -#define SKIP_Oct6100ApiReleaseChannelResources 1 -#define SKIP_Oct6100ChannelBroadcastTsstAddSer 1 -#define SKIP_Oct6100ApiCheckChanTsstAddParams 1 -#define SKIP_Oct6100ApiReserveTsstAddResources 1 -#define SKIP_Oct6100ApiWriteTsstAddStructs 1 -#define SKIP_Oct6100ApiUpdateTsstAddChanEntry 1 -#define SKIP_Oct6100ApiChannelGetStatsSer 1 -#define SKIP_Oct6100ApiReserveBiDirChanEntry 1 -#define SKIP_Oct6100ApiReleaseBiDirChanEntry 1 -#define SKIP_Oct6100ApiRetrieveNlpConfDword 1 -#define SKIP_Oct6100ApiSaveNlpConfDword 1 -#define SKIP_Oct6100ChannelCreateBiDirSer 1 -#define SKIP_Oct6100ApiCheckChannelCreateBiDirParams 1 -#define SKIP_Oct6100ApiReserveChannelCreateBiDirResources 1 -#define SKIP_Oct6100ApiWriteChannelCreateBiDirStructs 1 -#define SKIP_Oct6100ApiUpdateBiDirChannelEntry 1 -#define SKIP_Oct6100ChannelDestroyBiDirSer 1 -#define SKIP_Oct6100ApiAssertDestroyBiDirChanParams 1 -#define SKIP_Oct6100ApiInvalidateBiDirChannelStructs 1 -#define SKIP_Oct6100ApiReleaseBiDirChannelResources 1 -#define SKIP_Oct6100ApiOctFloatToDbEnergyByte 1 -#define SKIP_Oct6100ApiOctFloatToDbEnergyHalf 1 -#define SKIP_Oct6100ChannelMuteSer 1 -#define SKIP_Oct6100ApiAssertChannelMuteParams 1 -#define SKIP_Oct6100ChannelUnMuteSer 1 -#define SKIP_Oct6100ApiAssertChannelUnMuteParams 1 -#define SKIP_Oct6100ApiMuteSinWithFeatures 1 -#define SKIP_Oct6100ApiMuteChannelPorts 1 -#define SKIP_Oct6100CreateLocalInstanceDef 1 -#define SKIP_Oct6100CreateLocalInstance 1 -#define SKIP_Oct6100DestroyLocalInstanceDef 1 -#define SKIP_Oct6100DestroyLocalInstance 1 -#define SKIP_Oct6100GetHwRevisionDef 1 -#define SKIP_Oct6100GetHwRevision 1 -#define SKIP_Oct6100FreeResourcesDef 1 -#define SKIP_Oct6100FreeResources 1 -#define SKIP_Oct6100ProductionBistDef 1 -#define SKIP_Oct6100ProductionBist 1 -#define SKIP_Oct6100ApiGetVersionDef 1 -#define SKIP_Oct6100ApiGetVersion 1 -#define SKIP_Oct6100FreeResourcesSer 1 -#define SKIP_Oct6100ProductionBistSer 1 -#define SKIP_Oct6100ChipGetStatsDef 1 -#define SKIP_Oct6100ChipGetStats 1 -#define SKIP_Oct6100ChipGetImageInfoDef 1 -#define SKIP_Oct6100ChipGetImageInfo 1 -#define SKIP_Oct6100ChipGetStatsSer 1 -#define SKIP_Oct6100ConfBridgeOpenDef 1 -#define SKIP_Oct6100ConfBridgeOpen 1 -#define SKIP_Oct6100ConfBridgeClose 1 -#define SKIP_Oct6100ConfBridgeChanAddDef 1 -#define SKIP_Oct6100ConfBridgeChanAdd 1 -#define SKIP_Oct6100ConfBridgeChanRemove 1 -#define SKIP_Oct6100ConfBridgeChanMuteDef 1 -#define SKIP_Oct6100ConfBridgeChanMute 1 -#define SKIP_Oct6100ConfBridgeChanUnMuteDef 1 -#define SKIP_Oct6100ConfBridgeChanUnMute 1 -#define SKIP_Oct6100ConfBridgeDominantSpeakerSetDef 1 -#define SKIP_Oct6100ConfBridgeDominantSpeakerSet 1 -#define SKIP_Oct6100ConfBridgeMaskChangeDef 1 -#define SKIP_Oct6100ConfBridgeMaskChange 1 -#define SKIP_Oct6100ConfBridgeGetStatsDef 1 -#define SKIP_Oct6100ConfBridgeGetStats 1 -#define SKIP_Oct6100ConfBridgeOpenSer 1 -#define SKIP_Oct6100ApiCheckBridgeParams 1 -#define SKIP_Oct6100ApiReserveBridgeResources 1 -#define SKIP_Oct6100ApiUpdateBridgeEntry 1 -#define SKIP_Oct6100ConfBridgeChanAddSer 1 -#define SKIP_Oct6100ApiCheckBridgeAddParams 1 -#define SKIP_Oct6100ApiReserveBridgeAddResources 1 -#define SKIP_Oct6100ApiBridgeEventAdd 1 -#define SKIP_Oct6100ApiBridgeAddParticipantToChannel 1 -#define SKIP_Oct6100ConfBridgeChanMuteSer 1 -#define SKIP_Oct6100ApiCheckBridgeMuteParams 1 -#define SKIP_Oct6100ApiUpdateBridgeMuteResources 1 -#define SKIP_Oct6100ConfBridgeChanUnMuteSer 1 -#define SKIP_Oct6100ApiCheckBridgeUnMuteParams 1 -#define SKIP_Oct6100ApiUpdateBridgeUnMuteResources 1 -#define SKIP_Oct6100ConfBridgeDominantSpeakerSetSer 1 -#define SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams 1 -#define SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources 1 -#define SKIP_Oct6100ConfBridgeMaskChangeSer 1 -#define SKIP_Oct6100ApiCheckBridgeMaskChangeParams 1 -#define SKIP_Oct6100ApiUpdateMaskModifyResources 1 -#define SKIP_Oct6100ApiBridgeUpdateMask 1 -#define SKIP_Oct6100ConfBridgeGetStatsSer 1 -#define SKIP_Oct6100ApiReserveBridgeEntry 1 -#define SKIP_Oct6100ApiReserveFlexConfParticipantEntry 1 -#define SKIP_Oct6100DebugSelectChannelDef 1 -#define SKIP_Oct6100DebugSelectChannel 1 -#define SKIP_Oct6100DebugGetDataDef 1 -#define SKIP_Oct6100DebugGetData 1 -#define SKIP_Oct6100DebugSelectChannelSer 1 -#define SKIP_Oct6100DebugGetDataSer 1 -#define SKIP_Oct6100BufferPlayoutGetEventDef 1 -#define SKIP_Oct6100BufferPlayoutGetEvent 1 -#define SKIP_Oct6100BufferPlayoutGetEventSer 1 -#define SKIP_Oct6100InterruptConfigureDef 1 -#define SKIP_Oct6100InterruptConfigure 1 -#define SKIP_Oct6100ApiReserveBufferPlayoutMemoryNode 1 -#define SKIP_Oct6100ApiReleaseBufferPlayoutMemoryNode 1 -#define SKIP_Oct6100ApiReserveBufferPlayoutMemory 1 -#define SKIP_Oct6100ApiReleaseBufferPlayoutMemory 1 -#define SKIP_Oct6100ApiCreateFeatureMask 1 -#define SKIP_Oct6100MixerCopyEventCreateDef 1 -#define SKIP_Oct6100MixerCopyEventCreate 1 -#define SKIP_Oct6100MixerCopyEventDestroyDef 1 -#define SKIP_Oct6100MixerCopyEventDestroy 1 -#define SKIP_Oct6100MixerCopyEventCreateSer 1 -#define SKIP_Oct6100ApiCheckCopyEventCreateParams 1 -#define SKIP_Oct6100ApiReserveCopyEventCreateResources 1 -#define SKIP_Oct6100ApiWriteCopyEventCreateStructs 1 -#define SKIP_Oct6100ApiUpdateCopyEventCreateEntry 1 -#define SKIP_Oct6100MixerCopyEventDestroySer 1 -#define SKIP_Oct6100ApiAssertCopyEventDestroyParams 1 -#define SKIP_Oct6100ApiInvalidateCopyEventStructs 1 -#define SKIP_Oct6100ApiReleaseCopyEventResources 1 -#define SKIP_Oct6100ApiReserveCopyEventEntry 1 -#define SKIP_Oct6100ApiReleaseCopyEventEntry 1 -#define SKIP_Oct6100PhasingTsstOpenDef 1 -#define SKIP_Oct6100PhasingTsstOpen 1 -#define SKIP_Oct6100PhasingTsstCloseDef 1 -#define SKIP_Oct6100PhasingTsstClose 1 -#define SKIP_Oct6100PhasingTsstOpenSer 1 -#define SKIP_Oct6100ApiCheckPhasingParams 1 -#define SKIP_Oct6100ApiReservePhasingResources 1 -#define SKIP_Oct6100ApiWritePhasingStructs 1 -#define SKIP_Oct6100ApiUpdatePhasingEntry 1 -#define SKIP_Oct6100PhasingTsstCloseSer 1 -#define SKIP_Oct6100ApiAssertPhasingParams 1 -#define SKIP_Oct6100ApiInvalidatePhasingStructs 1 -#define SKIP_Oct6100ApiReleasePhasingResources 1 -#define SKIP_Oct6100ApiReservePhasingEntry 1 -#define SKIP_Oct6100ApiReleasePhasingEntry 1 -#define SKIP_Oct6100BufferPlayoutLoadDef 1 -#define SKIP_Oct6100BufferPlayoutLoad 1 -#define SKIP_Oct6100BufferPlayoutLoadBlockInitDef 1 -#define SKIP_Oct6100BufferPlayoutLoadBlockInit 1 -#define SKIP_Oct6100BufferPlayoutLoadBlockDef 1 -#define SKIP_Oct6100BufferPlayoutLoadBlock 1 -#define SKIP_Oct6100BufferPlayoutUnloadDef 1 -#define SKIP_Oct6100BufferPlayoutUnload 1 -#define SKIP_Oct6100BufferPlayoutAddDef 1 -#define SKIP_Oct6100BufferPlayoutAdd 1 -#define SKIP_Oct6100BufferPlayoutStartDef 1 -#define SKIP_Oct6100BufferPlayoutStart 1 -#define SKIP_Oct6100BufferPlayoutStop 1 -#define SKIP_Oct6100BufferLoadSer 1 -#define SKIP_Oct6100BufferLoadBlockInitSer 1 -#define SKIP_Oct6100BufferLoadBlockSer 1 -#define SKIP_Oct6100ApiCheckBufferParams 1 -#define SKIP_Oct6100ApiCheckBufferLoadBlockParams 1 -#define SKIP_Oct6100ApiReserveBufferResources 1 -#define SKIP_Oct6100ApiWriteBufferInMemory 1 -#define SKIP_Oct6100ApiUpdateBufferEntry 1 -#define SKIP_Oct6100BufferUnloadSer 1 -#define SKIP_Oct6100ApiAssertBufferParams 1 -#define SKIP_Oct6100ApiReleaseBufferResources 1 -#define SKIP_Oct6100BufferPlayoutAddSer 1 -#define SKIP_Oct6100ApiCheckPlayoutAddParams 1 -#define SKIP_Oct6100ApiWriteBufferAddStructs 1 -#define SKIP_Oct6100BufferPlayoutStartSer 1 -#define SKIP_Oct6100ApiCheckPlayoutStartParams 1 -#define SKIP_Oct6100ApiWriteChanPlayoutStructs 1 -#define SKIP_Oct6100ApiReserveBufPlayoutListEntry 1 -#define SKIP_Oct6100ApiReleaseBufPlayoutListEntry 1 -#define SKIP_Oct6100RemoteDebugDef 1 -#define SKIP_Oct6100RemoteDebug 1 -#define SKIP_Oct6100ApiCheckEndianDetectField 1 -#define SKIP_Oct6100ApiCalculateChecksum 1 -#define SKIP_Oct6100ApiFormResponsePkt 1 -#define SKIP_Oct6100ApiCheckPktCommands 1 -#define SKIP_Oct6100ApiExecutePktCommands 1 -#define SKIP_Oct6100ApiCheckSessionNum 1 -#define SKIP_Oct6100ApiRpcReadWord 1 -#define SKIP_Oct6100ApiRpcReadBurst 1 -#define SKIP_Oct6100ApiRpcReadArray 1 -#define SKIP_Oct6100ApiRpcWriteWord 1 -#define SKIP_Oct6100ApiRpcWriteSmear 1 -#define SKIP_Oct6100ApiRpcWriteBurst 1 -#define SKIP_Oct6100ApiRpcSetHotChannel 1 -#define SKIP_Oct6100ApiRpcGetDebugChanIndex 1 -#define SKIP_Oct6100ApiRpcDisconnect 1 -#define SKIP_Oct6100ToneDetectionDisable 1 -#define SKIP_Oct6100TsiCnctOpenDef 1 -#define SKIP_Oct6100TsiCnctOpen 1 -#define SKIP_Oct6100TsiCnctCloseDef 1 -#define SKIP_Oct6100TsiCnctClose 1 -#define SKIP_Oct6100TsiCnctOpenSer 1 -#define SKIP_Oct6100ApiCheckTsiParams 1 -#define SKIP_Oct6100ApiReserveTsiResources 1 -#define SKIP_Oct6100ApiWriteTsiStructs 1 -#define SKIP_Oct6100ApiUpdateTsiEntry 1 -#define SKIP_Oct6100TsiCnctCloseSer 1 -#define SKIP_Oct6100ApiAssertTsiParams 1 -#define SKIP_Oct6100ApiInvalidateTsiStructs 1 -#define SKIP_Oct6100ApiReleaseTsiResources 1 -#define SKIP_Oct6100ApiReserveTsiCnctEntry 1 -#define SKIP_Oct6100ApiReleaseTsiCnctEntry 1 -#define SKIP_Oct6100UserDriverWriteOs 1 -#define SKIP_Oct6100UserDriverWriteSmearOs 1 -#define SKIP_Oct6100UserDriverWriteBurstOs 1 -#define SKIP_Oct6100UserDriverReadOs 1 -#define SKIP_Oct6100UserDriverReadBurstOs 1 -#define SKIP_OctApiBt0AddNode 1 -#define SKIP_OctApiBt0AddNode2 1 -#define SKIP_OctApiBt0AddNode3 1 -#define SKIP_OctApiBt0AddNode4 1 -#define SKIP_OctApiBt0KeyCompare 1 -#define SKIP_OctApiBt0UpdateLinkDepth 1 -#define SKIP_OctApiBt0Rebalance 1 -#define SKIP_OctApiBt0ExternalHeavy 1 -#define SKIP_OctApiBt0RemoveNode2 1 -#define SKIP_OctApiBt0RemoveNode3 1 -#define SKIP_OctApiBt0RemoveNode 1 -#define SKIP_OctApiBt0QueryNode2 1 -#define SKIP_OctApiBt0QueryNode 1 -#define SKIP_OctApiBt0GetFirstNode 1 -#define SKIP_OctApiBt0FindOrAddNode 1 -#define SKIP_OctApiBt0AddNodeReportPrevNodeData 1 -#define SKIP_OctApiLmCompare 1 -#define SKIP_OctApiLmMultiply 1 -#define SKIP_OctApiLmDivide 1 -#define SKIP_OctApiLmShiftRight1 1 -#define SKIP_OctApiLmShiftn 1 -#define SKIP_OctApiLmGetMsb 1 -#define SKIP_OctApiTllmAllocGetSize 1 -#define SKIP_OctApiTllmAllocInit 1 -#define SKIP_OctApiTllmAllocInfo 1 -#define SKIP_OctApiTllmAllocAlloc 1 -#define SKIP_OctApiTllmAllocDealloc 1 -#define SKIP_OctApiTllmCheckTimeoutList 1 -#define SKIP_OctApiLlmListGetSize 1 -#define SKIP_OctApiLlmListGetItemPointer 1 -#define SKIP_OctApiLlmListInit 1 -#define SKIP_OctApiLlmListInfo 1 -#define SKIP_OctApiLlmListCreate 1 -#define SKIP_OctApiLlmListDelete 1 -#define SKIP_OctApiLlmListLength 1 -#define SKIP_OctApiLlmListItemData 1 -#define SKIP_OctApiLlmListInsertItem 1 -#define SKIP_OctApiLlmListCreateFull 1 -#define SKIP_OctApiLlmListAppendItems 1 -#define SKIP_OctApiLlmListAppendAndSetItems 1 -#define SKIP_OctApiLlmListSetItems 1 -#define SKIP_OctApiLlmListCopyData 1 -#define SKIP_OctApiLlmListRemoveItem 1 -#define SKIP_OctApiLlm2ListGetSize 1 -#define SKIP_OctApiLlm2ListGetItemPointer 1 -#define SKIP_OctApiLlm2ListInit 1 -#define SKIP_OctApiLlm2ListCreate 1 -#define SKIP_OctApiLlm2ListDelete 1 -#define SKIP_OctApiLlm2ListLength 1 -#define SKIP_OctApiLlm2ListItemData 1 -#define SKIP_OctApiLlm2ListInsertItem 1 -#define SKIP_OctApiLlm2ListRemoveItem 1 -#define SKIP_OctApiLlmMemCpy 1 - -#endif - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h deleted file mode 100644 index 9e33909d..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h +++ /dev/null @@ -1,74 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_adpcm_chan_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_adpcm_chan.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_adpcm_chan_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 6 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_ADPCM_CHAN_INST_H__ -#define __OCT6100_ADPCM_CHAN_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_ADPCM_CHAN_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Count used to manage entry handles allocated to user. */ - UINT8 byEntryOpenCnt; - - /* TSI chariot memory entry. */ - UINT16 usTsiMemIndex; - - /* ADPCM memory entry. */ - UINT16 usAdpcmMemIndex; - - /* Input and output timeslot information. */ - UINT16 usInputTimeslot; - UINT16 usInputStream; - UINT8 byInputNumTssts; - UINT8 byInputPcmLaw; - - UINT16 usOutputTimeslot; - UINT16 usOutputStream; - UINT8 byOutputNumTssts; - UINT8 byOutputPcmLaw; - - /* Internal info for quick access to structures associated to this TSI cnct. */ - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - -} tOCT6100_API_ADPCM_CHAN, *tPOCT6100_API_ADPCM_CHAN; - -#endif /* __OCT6100_ADPCM_CHAN_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h deleted file mode 100644 index e29fac49..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h +++ /dev/null @@ -1,90 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_adpcm_chan_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_adpcm_chan.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_adpcm_chan_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 5 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_ADPCM_CHAN_PUB_H__ -#define __OCT6100_ADPCM_CHAN_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_ADPCM_CHAN_OPEN_ -{ - PUINT32 pulChanHndl; - - UINT32 ulInputTimeslot; - UINT32 ulInputStream; - UINT32 ulInputNumTssts; - UINT32 ulInputPcmLaw; - - UINT32 ulOutputTimeslot; - UINT32 ulOutputStream; - UINT32 ulOutputNumTssts; - UINT32 ulOutputPcmLaw; - - UINT32 ulChanMode; /* Encoding or decoding. */ - - UINT32 ulEncodingRate; - UINT32 ulDecodingRate; - - UINT32 ulAdpcmNibblePosition; - -} tOCT6100_ADPCM_CHAN_OPEN, *tPOCT6100_ADPCM_CHAN_OPEN; - -typedef struct _OCT6100_ADPCM_CHAN_CLOSE_ -{ - UINT32 ulChanHndl; - -} tOCT6100_ADPCM_CHAN_CLOSE, *tPOCT6100_ADPCM_CHAN_CLOSE; - - -/************************** FUNCTION PROTOTYPES *****************************/ - - -UINT32 Oct6100AdpcmChanOpenDef( - OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); -UINT32 Oct6100AdpcmChanOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); - -UINT32 Oct6100AdpcmChanCloseDef( - OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ); -UINT32 Oct6100AdpcmChanClose( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ); - -#endif /* __OCT6100_ADPCM_CHAN_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_api.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_api.h deleted file mode 100644 index 35a96668..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_api.h +++ /dev/null @@ -1,84 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_api.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Header file containing all definitions used throughout the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 23 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_API_H__ -#define __OCT6100_API_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100_defines.h" -#include "oct6100_errors.h" - -#include "oct6100_apiud.h" -#include "oct6100_tlv_inst.h" -#include "oct6100_chip_stats_inst.h" -#include "oct6100_tsi_cnct_inst.h" -#include "oct6100_mixer_inst.h" -#include "oct6100_events_inst.h" -#include "oct6100_tone_detection_inst.h" -#include "oct6100_conf_bridge_inst.h" -#include "oct6100_playout_buf_inst.h" - -#include "oct6100_adpcm_chan_inst.h" -#include "oct6100_phasing_tsst_inst.h" -#include "oct6100_channel_inst.h" -#include "oct6100_interrupts_inst.h" -#include "oct6100_remote_debug_inst.h" -#include "oct6100_debug_inst.h" -#include "oct6100_chip_open_inst.h" -#include "oct6100_api_inst.h" - -#include "oct6100_interrupts_pub.h" -#include "oct6100_tsi_cnct_pub.h" -#include "oct6100_events_pub.h" -#include "oct6100_tone_detection_pub.h" -#include "oct6100_mixer_pub.h" -#include "oct6100_conf_bridge_pub.h" -#include "oct6100_playout_buf_pub.h" - -#include "oct6100_channel_pub.h" -#include "oct6100_remote_debug_pub.h" -#include "oct6100_debug_pub.h" -#include "oct6100_chip_open_pub.h" -#include "oct6100_chip_stats_pub.h" -#include "oct6100_adpcm_chan_pub.h" -#include "oct6100_phasing_tsst_pub.h" - -#ifdef __cplusplus -} -#endif - -#endif /* __OCT6100_API_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_api_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_api_inst.h deleted file mode 100644 index 29bd0fdb..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_api_inst.h +++ /dev/null @@ -1,138 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_api_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing the definition of the API instance structure. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 40 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_API_INST_H__ -#define __OCT6100_API_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_SHARED_INFO_ -{ - /* Local copy of chip configuration structure. */ - tOCT6100_API_CHIP_CONFIG ChipConfig; - - /* Miscellaneous calculations and mapping of static structures in external memory. */ - tOCT6100_API_MISCELLANEOUS MiscVars; - tOCT6100_API_MEMORY_MAP MemoryMap; - - /* Error stats structure. */ - tOCT6100_API_CHIP_ERROR_STATS ErrorStats; - tOCT6100_API_CHIP_STATS ChipStats; - - /* Mixer information. */ - tOCT6100_API_MIXER MixerInfo; - - /* Image breakdown information. */ - tOCT6100_API_IMAGE_REGION ImageRegion[ cOCT6100_MAX_IMAGE_REGION ]; - tOCT6100_API_IMAGE_INFO ImageInfo; - - /* Configuration and management of interrupts. */ - tOCT6100_API_INTRPT_CONFIG IntrptConfig; - tOCT6100_API_INTRPT_MANAGE IntrptManage; - /* Remote debugging. */ - tOCT6100_API_REMOTE_DEBUG_INFO RemoteDebugInfo; - /* Chip debugging information. */ - tOCT6100_API_DEBUG DebugInfo; - - /* Management variables of software and hardware buffers. */ - tOCT6100_API_SOFT_BUFS SoftBufs; - - /* Caller buffer playout memory management structure. */ - tOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO PlayoutInfo; - - - - UINT32 ulChannelListOfst; - UINT32 ulChannelAllocOfst; - - UINT32 ulConversionMemoryAllocOfst; - - UINT32 ulTsiMemoryAllocOfst; - UINT32 ulExtraTsiMemoryAllocOfst; - UINT32 ulEchoMemoryAllocOfst; - - UINT32 ulTsstAllocOfst; - UINT32 ulTsstListOfst; - UINT32 ulTsstListAllocOfst; - - UINT32 ulTsiCnctListOfst; - UINT32 ulTsiCnctAllocOfst; - - UINT32 ulMixerEventListOfst; - UINT32 ulMixerEventAllocOfst; - - UINT32 ulCopyEventListOfst; - UINT32 ulCopyEventAllocOfst; - - UINT32 ulBiDirChannelListOfst; - UINT32 ulBiDirChannelAllocOfst; - - UINT32 ulConfBridgeListOfst; - UINT32 ulConfBridgeAllocOfst; - - UINT32 ulFlexConfParticipantListOfst; - UINT32 ulFlexConfParticipantAllocOfst; - - UINT32 ulPlayoutBufListOfst; - UINT32 ulPlayoutBufAllocOfst; - UINT32 ulPlayoutBufMemoryNodeListOfst; - - - - UINT32 ulAdpcmChanListOfst; - UINT32 ulAdpcmChanAllocOfst; - - UINT32 ulPhasingTsstListOfst; - UINT32 ulPhasingTsstAllocOfst; - -} tOCT6100_SHARED_INFO, *tPOCT6100_SHARED_INFO; - -typedef struct _OCT6100_INSTANCE_API_ -{ - /* Pointer to portion of API instance structure shared amongst all processes. */ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Pointer to user-supplied, process context structure. The structure is - a parameter to all user-supplied functions. */ - PVOID pProcessContext; - - /* Handles to all serialization objects used by the API. */ - tOCT6100_USER_SERIAL_OBJECT ulApiSerObj; - - -} tOCT6100_INSTANCE_API, *tPOCT6100_INSTANCE_API; - -#endif /* __OCT6100_API_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_apimi.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_apimi.h deleted file mode 100644 index dd584ead..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_apimi.h +++ /dev/null @@ -1,69 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_apimi.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the declaration of all functions exported from the - APIMI block. The APIMI block contains only one function: - Oct6100InterruptMask. - The function is used to mask out the interrupt pin of the chip. This - function is used when a deferred procedure call treats the interrupt (new - interrupts must not be generated until the signalled interrupt is treated). - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 6 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_APIMI_H__ -#define __OCT6100_APIMI_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_INTERRUPT_MASK_ -{ - UINT32 ulUserChipIndex; - PVOID pProcessContext; - - -} tOCT6100_INTERRUPT_MASK, *tPOCT6100_INTERRUPT_MASK; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100InterruptMaskDef( - OUT tPOCT6100_INTERRUPT_MASK f_pInterruptMask ); -UINT32 Oct6100InterruptMask( - IN tPOCT6100_INTERRUPT_MASK f_pInterruptMask ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __OCT6100_APIMI_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_apiud.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_apiud.h deleted file mode 100644 index feff93ea..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_apiud.h +++ /dev/null @@ -1,312 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_apiud.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Header file containing the definitions and prototypes that are to be - completed by the user. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 16 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_APIUD_H__ -#define __OCT6100_APIUD_H__ - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -/***************************** DEFINES *************************************/ - - -/* Determines the maximum length of a burst of reads/writes. This value must - be in the range 8 - 1024. This value obtains best performance if set to - a power of 2 (i.e. 2^n). */ -#define cOCT6100_MAX_RW_ACCESSES 32 - -/* The define used to specify that the Oct6100SeizeSerializeObject function - is not to return until the specified serialization object has been seized. */ -#define cOCT6100_WAIT_INFINITELY 0xFFFFFFFF - - -/* Compile option: enabling this compile option inserts code to check every - call to a user provided function to make sure the function parameters - are not changed, as required by the API specification. */ -#define cOCT6100_USER_FUNCTION_CHECK - - - -#define cOCT6100_GET_TIME_FAILED_0 0xFFFF0000 -#define cOCT6100_GET_TIME_FAILED_1 0xFFFF0001 -#define cOCT6100_GET_TIME_FAILED_2 0xFFFF0002 -#define cOCT6100_GET_TIME_FAILED_3 0xFFFF0003 -#define cOCT6100_GET_TIME_FAILED_4 0xFFFF0004 - -#define cOCT6100_CREATE_SERIAL_FAILED_0 0xFFFF0010 -#define cOCT6100_CREATE_SERIAL_FAILED_1 0xFFFF0011 -#define cOCT6100_CREATE_SERIAL_FAILED_2 0xFFFF0012 -#define cOCT6100_CREATE_SERIAL_FAILED_3 0xFFFF0013 -#define cOCT6100_CREATE_SERIAL_FAILED_4 0xFFFF0014 - -#define cOCT6100_DESTROY_SERIAL_FAILED_0 0xFFFF0020 -#define cOCT6100_DESTROY_SERIAL_FAILED_1 0xFFFF0021 -#define cOCT6100_DESTROY_SERIAL_FAILED_2 0xFFFF0022 -#define cOCT6100_DESTROY_SERIAL_FAILED_3 0xFFFF0023 -#define cOCT6100_DESTROY_SERIAL_FAILED_4 0xFFFF0024 - -#define cOCT6100_INVALID_SERIAL_HANDLE_0 0xFFFF0030 -#define cOCT6100_INVALID_SERIAL_HANDLE_1 0xFFFF0031 -#define cOCT6100_INVALID_SERIAL_HANDLE_2 0xFFFF0032 -#define cOCT6100_INVALID_SERIAL_HANDLE_3 0xFFFF0033 -#define cOCT6100_INVALID_SERIAL_HANDLE_4 0xFFFF0034 - -#define cOCT6100_RELEASE_SERIAL_FAILED_0 0xFFFF0040 -#define cOCT6100_RELEASE_SERIAL_FAILED_1 0xFFFF0041 -#define cOCT6100_RELEASE_SERIAL_FAILED_2 0xFFFF0042 -#define cOCT6100_RELEASE_SERIAL_FAILED_3 0xFFFF0043 -#define cOCT6100_RELEASE_SERIAL_FAILED_4 0xFFFF0044 - -#define cOCT6100_SEIZE_SERIAL_FAILED_0 0xFFFF0050 -#define cOCT6100_SEIZE_SERIAL_FAILED_1 0xFFFF0051 -#define cOCT6100_SEIZE_SERIAL_FAILED_2 0xFFFF0052 -#define cOCT6100_SEIZE_SERIAL_FAILED_3 0xFFFF0053 -#define cOCT6100_SEIZE_SERIAL_FAILED_4 0xFFFF0054 - -#define cOCT6100_DRIVER_WRITE_FAILED_0 0xFFFF0060 -#define cOCT6100_DRIVER_WRITE_FAILED_1 0xFFFF0061 -#define cOCT6100_DRIVER_WRITE_FAILED_2 0xFFFF0062 -#define cOCT6100_DRIVER_WRITE_FAILED_3 0xFFFF0063 -#define cOCT6100_DRIVER_WRITE_FAILED_4 0xFFFF0064 - -#define cOCT6100_DRIVER_WSMEAR_FAILED_0 0xFFFF0070 -#define cOCT6100_DRIVER_WSMEAR_FAILED_1 0xFFFF0071 -#define cOCT6100_DRIVER_WSMEAR_FAILED_2 0xFFFF0072 -#define cOCT6100_DRIVER_WSMEAR_FAILED_3 0xFFFF0073 -#define cOCT6100_DRIVER_WSMEAR_FAILED_4 0xFFFF0074 - -#define cOCT6100_DRIVER_WBURST_FAILED_0 0xFFFF0080 -#define cOCT6100_DRIVER_WBURST_FAILED_1 0xFFFF0081 -#define cOCT6100_DRIVER_WBURST_FAILED_2 0xFFFF0082 -#define cOCT6100_DRIVER_WBURST_FAILED_3 0xFFFF0083 -#define cOCT6100_DRIVER_WBURST_FAILED_4 0xFFFF0084 - -#define cOCT6100_DRIVER_READ_FAILED_0 0xFFFF0090 -#define cOCT6100_DRIVER_READ_FAILED_1 0xFFFF0091 -#define cOCT6100_DRIVER_READ_FAILED_2 0xFFFF0092 -#define cOCT6100_DRIVER_READ_FAILED_3 0xFFFF0093 -#define cOCT6100_DRIVER_READ_FAILED_4 0xFFFF0094 - -#define cOCT6100_DRIVER_RBURST_FAILED_0 0xFFFF00A0 -#define cOCT6100_DRIVER_RBURST_FAILED_1 0xFFFF00A1 -#define cOCT6100_DRIVER_RBURST_FAILED_2 0xFFFF00A2 -#define cOCT6100_DRIVER_RBURST_FAILED_3 0xFFFF00A3 -#define cOCT6100_DRIVER_RBURST_FAILED_4 0xFFFF00A4 - - - - - -/***************************** TYPES ***************************************/ - -/*Change this type if your platform uses 64bits semaphores/locks */ -typedef UINT32 tOCT6100_USER_SERIAL_OBJECT; - -typedef struct _OCT6100_GET_TIME_ -{ - PVOID pProcessContext; - UINT32 aulWallTimeUs[ 2 ]; - -} tOCT6100_GET_TIME, *tPOCT6100_GET_TIME; - - - - - -typedef struct _OCT6100_CREATE_SERIALIZE_OBJECT_ -{ - PVOID pProcessContext; - PSZ pszSerialObjName; - tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl; - -} tOCT6100_CREATE_SERIALIZE_OBJECT, *tPOCT6100_CREATE_SERIALIZE_OBJECT; - - -typedef struct _OCT6100_DESTROY_SERIALIZE_OBJECT_ -{ - PVOID pProcessContext; - tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl; - -} tOCT6100_DESTROY_SERIALIZE_OBJECT, *tPOCT6100_DESTROY_SERIALIZE_OBJECT; - - -typedef struct _OCT6100_SEIZE_SERIALIZE_OBJECT_ -{ - PVOID pProcessContext; - tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl; - UINT32 ulTryTimeMs; - -} tOCT6100_SEIZE_SERIALIZE_OBJECT, *tPOCT6100_SEIZE_SERIALIZE_OBJECT; - - -typedef struct _OCT6100_RELEASE_SERIALIZE_OBJECT_ -{ - PVOID pProcessContext; - tOCT6100_USER_SERIAL_OBJECT ulSerialObjHndl; - -} tOCT6100_RELEASE_SERIALIZE_OBJECT, *tPOCT6100_RELEASE_SERIALIZE_OBJECT; - - -typedef struct _OCT6100_WRITE_PARAMS_ -{ - PVOID pProcessContext; - - UINT32 ulUserChipId; - UINT32 ulWriteAddress; - UINT16 usWriteData; - -} tOCT6100_WRITE_PARAMS, *tPOCT6100_WRITE_PARAMS; - - -typedef struct _OCT6100_WRITE_SMEAR_PARAMS_ -{ - PVOID pProcessContext; - - UINT32 ulUserChipId; - UINT32 ulWriteAddress; - UINT32 ulWriteLength; - UINT16 usWriteData; - -} tOCT6100_WRITE_SMEAR_PARAMS, *tPOCT6100_WRITE_SMEAR_PARAMS; - - -typedef struct _OCT6100_WRITE_BURST_PARAMS_ -{ - PVOID pProcessContext; - - UINT32 ulUserChipId; - UINT32 ulWriteAddress; - UINT32 ulWriteLength; - PUINT16 pusWriteData; - -} tOCT6100_WRITE_BURST_PARAMS, *tPOCT6100_WRITE_BURST_PARAMS; - - -typedef struct _OCT6100_READ_PARAMS_ -{ - PVOID pProcessContext; - - UINT32 ulUserChipId; - UINT32 ulReadAddress; - PUINT16 pusReadData; - -} tOCT6100_READ_PARAMS, *tPOCT6100_READ_PARAMS; - - -typedef struct _OCT6100_READ_BURST_PARAMS_ -{ - PVOID pProcessContext; - - UINT32 ulUserChipId; - UINT32 ulReadAddress; - UINT32 ulReadLength; - PUINT16 pusReadData; - -} tOCT6100_READ_BURST_PARAMS, *tPOCT6100_READ_BURST_PARAMS; - - - - - - - - -/************************** FUNCTION PROTOTYPES *****************************/ - -/* Time function. */ -UINT32 Oct6100UserGetTime( - IN OUT tPOCT6100_GET_TIME f_pTime ); - - - -/* Memory management functions. */ -UINT32 Oct6100UserMemSet( - IN PVOID f_pAddress, - IN UINT32 f_ulPattern, - IN UINT32 f_ulLength ); - -UINT32 Oct6100UserMemCopy( - IN PVOID f_pDestination, - IN const void *f_pSource, - IN UINT32 f_ulLength ); - -/* Serialization functions. */ -UINT32 Oct6100UserCreateSerializeObject( - IN OUT tPOCT6100_CREATE_SERIALIZE_OBJECT f_pCreate); - -UINT32 Oct6100UserDestroySerializeObject( - IN tPOCT6100_DESTROY_SERIALIZE_OBJECT f_pDestroy); - -UINT32 Oct6100UserSeizeSerializeObject( - IN tPOCT6100_SEIZE_SERIALIZE_OBJECT f_pSeize); - -UINT32 Oct6100UserReleaseSerializeObject( - IN tPOCT6100_RELEASE_SERIALIZE_OBJECT f_pRelease); - -/* Read/Write functions.*/ -UINT32 Oct6100UserDriverWriteApi( - IN tPOCT6100_WRITE_PARAMS f_pWriteParams ); - -UINT32 Oct6100UserDriverWriteOs( - IN tPOCT6100_WRITE_PARAMS f_pWriteParams ); - -UINT32 Oct6100UserDriverWriteSmearApi( - IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams ); - -UINT32 Oct6100UserDriverWriteSmearOs( - IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams ); - -UINT32 Oct6100UserDriverWriteBurstApi( - IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams ); - -UINT32 Oct6100UserDriverWriteBurstOs( - IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams ); - -UINT32 Oct6100UserDriverReadApi( - IN OUT tPOCT6100_READ_PARAMS f_pReadParams ); - -UINT32 Oct6100UserDriverReadOs( - IN OUT tPOCT6100_READ_PARAMS f_pReadParams ); - -UINT32 Oct6100UserDriverReadBurstApi( - IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams ); - -UINT32 Oct6100UserDriverReadBurstOs( - IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams ); - - - - - - - -#endif /* __OCT6100_APIUD_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_inst.h deleted file mode 100644 index b329a49c..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_inst.h +++ /dev/null @@ -1,389 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_channel_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_channel.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_channel_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 90 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHANNEL_INST_H__ -#define __OCT6100_CHANNEL_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_CHANNEL_TDM_ -{ - /* Laws. */ - UINT8 byRinPcmLaw; - UINT8 bySinPcmLaw; - UINT8 byRoutPcmLaw; - UINT8 bySoutPcmLaw; - - /* RIN port. */ - UINT16 usRinTimeslot; - UINT16 usRinStream; - - /* SIN port. */ - UINT16 usSinTimeslot; - UINT16 usSinStream; - - /* ROUT port. */ - UINT16 usRoutTimeslot; - UINT16 usRoutStream; - - /* SOUT port. */ - UINT16 usSoutTimeslot; - UINT16 usSoutStream; - - /* ROUT broadcast info. */ - UINT16 usRoutBrdcastTsstFirstEntry; - UINT16 usRoutBrdcastTsstNumEntry; - - /* SOUT broadcast info. */ - UINT16 usSoutBrdcastTsstFirstEntry; - UINT16 usSoutBrdcastTsstNumEntry; - - UINT8 byRinNumTssts; - UINT8 bySinNumTssts; - UINT8 byRoutNumTssts; - UINT8 bySoutNumTssts; - -} tOCT6100_API_CHANNEL_TDM, *tPOCT6100_API_CHANNEL_TDM; - -typedef struct _OCT6100_API_CHANNEL_VQE_ -{ - UINT8 fEnableNlp; - UINT8 fEnableTailDisplacement; - UINT16 usTailDisplacement; - UINT16 usTailLength; - - UINT8 fSinDcOffsetRemoval; - UINT8 fRinDcOffsetRemoval; - UINT8 fRinLevelControl; - UINT8 fSoutLevelControl; - - UINT8 fRinAutomaticLevelControl; - UINT8 fSoutAutomaticLevelControl; - OCT_INT8 chRinAutomaticLevelControlTargetDb; - OCT_INT8 chSoutAutomaticLevelControlTargetDb; - - UINT8 fRinHighLevelCompensation; - OCT_INT8 chRinHighLevelCompensationThresholdDb; - - UINT8 bySoutAutomaticListenerEnhancementGainDb; - UINT8 fSoutNaturalListenerEnhancement; - - UINT8 fSoutAdaptiveNoiseReduction; - UINT8 fDtmfToneRemoval; - UINT8 fAcousticEcho; - UINT8 byComfortNoiseMode; - - UINT8 byNonLinearityBehaviorA; - UINT8 byNonLinearityBehaviorB; - OCT_INT8 chRinLevelControlGainDb; - OCT_INT8 chSoutLevelControlGainDb; - - OCT_INT8 chDefaultErlDb; - OCT_INT8 chAecDefaultErlDb; - - UINT8 fRoutNoiseReduction; - OCT_INT8 chRoutNoiseReductionLevelGainDb; - OCT_INT8 chAnrSnrEnhancementDb; - - UINT8 fEnableMusicProtection; - UINT8 fIdleCodeDetection; - - UINT8 byAnrVoiceNoiseSegregation; - UINT8 bySoutNaturalListenerEnhancementGainDb; - - UINT16 usToneDisablerVqeActivationDelay; - UINT16 usAecTailLength; - - UINT8 byDoubleTalkBehavior; - UINT8 fSoutNoiseBleaching; - - - - UINT8 fSoutConferencingNoiseReduction; - - - -} tOCT6100_API_CHANNEL_VQE, *tPOCT6100_API_CHANNEL_VQE; - -typedef struct _OCT6100_API_CHANNEL_CODEC_ -{ - UINT8 byAdpcmNibblePosition; - UINT8 fEnableSilenceSuppression; - - UINT8 byEncoderPort; - UINT8 byEncodingRate; - - UINT8 byDecoderPort; - UINT8 byDecodingRate; - - UINT8 byPhase; - UINT8 byPhasingType; - -} tOCT6100_API_CHANNEL_CODEC, *tPOCT6100_API_CHANNEL_CODEC; - -typedef struct _OCT6100_API_CHANNEL_ -{ - /*=======================================================================*/ - /* Channel configuration. */ - - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Count used to manage entry handles allocated to user. */ - UINT8 byEntryOpenCnt; - - /* Is this a bidirectionnal channel? */ - UINT8 fBiDirChannel; - - /* Enable tone disabler? */ - UINT8 fEnableToneDisabler; - - /* TSI chariot memory entry for the Rin/Rout stream. */ - UINT16 usRinRoutTsiMemIndex; - - /* TSI chariot memory entry for the Sin/Sout stream. */ - UINT16 usSinSoutTsiMemIndex; - - /* Additional TSI entry used to temporarily store the SIN signal. */ - UINT16 usExtraSinTsiMemIndex; - UINT16 usExtraSinTsiDependencyCnt; - - /* Additional TSI entry used to temporarily store the RIN signal. */ - UINT16 usExtraRinTsiMemIndex; - UINT16 usExtraRinTsiDependencyCnt; - - /* Conversion chariot memory entry. */ - UINT16 usRinRoutConversionMemIndex; - UINT16 usSinSoutConversionMemIndex; - - /* TSST control memory entry. */ - UINT16 usRinTsstIndex; - UINT16 usSinTsstIndex; - UINT16 usRoutTsstIndex; - UINT16 usSoutTsstIndex; - - /* SSPX memory entry. */ - UINT16 usEchoMemIndex; - - /* Active mixer events count to test for last event. */ - UINT16 usMixerEventCnt; - - /* User channel ID, transparently passed to the user. */ - UINT32 ulUserChanId; - - /* Copy events. */ - UINT16 usSinCopyEventIndex; - UINT16 usSoutCopyEventIndex; - - /* Silence events. */ - UINT16 usRinSilenceEventIndex; - UINT16 usSinSilenceEventIndex; - - /* TDM configuration. */ - tOCT6100_API_CHANNEL_TDM TdmConfig; - - /* VQE configuration. */ - tOCT6100_API_CHANNEL_VQE VqeConfig; - - /* Current echo operation mode. */ - UINT8 byEchoOperationMode; - - /* Currently muted ports. */ - UINT16 usMutedPorts; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Statistics section. */ - - INT16 sComfortNoiseLevel; - - UINT16 usCurrentEchoDelay; - UINT16 usMaxEchoDelay; - - UINT16 usNumEchoPathChanges; - UINT16 usNumEchoPathChangesOfst; - - INT16 sCurrentERL; - INT16 sCurrentERLE; - - INT16 sMaxERL; - INT16 sMaxERLE; - - INT16 sRinLevel; - INT16 sSinLevel; - - INT16 sRinAppliedGain; - INT16 sSoutAppliedGain; - - UINT8 byToneDisablerStatus; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Bridge information. */ - - UINT16 usBridgeIndex; - - UINT8 fMute; - UINT8 fTap; - UINT8 fBeingTapped; - UINT8 fCopyEventCreated; - - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - - UINT16 usFlexConfParticipantIndex; - UINT16 usTapBridgeIndex; - UINT16 usTapChanIndex; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Buffer playout information. */ - - UINT32 ulRinBufWritePtr; - UINT32 ulRinBufSkipPtr; - - UINT8 fSoutBufPlaying; - UINT8 fRinBufPlaying; - - UINT8 fRinBufPlayoutNotifyOnStop; - UINT8 fRinBufPlayoutRepeatUsed; - - UINT32 ulSoutBufWritePtr; - UINT32 ulSoutBufSkipPtr; - - UINT8 fSoutBufPlayoutNotifyOnStop; - UINT8 fSoutBufPlayoutRepeatUsed; - - UINT8 fRinHardStop; - UINT8 fSoutHardStop; - - UINT32 ulRinUserBufPlayoutEventId; - UINT32 ulSoutUserBufPlayoutEventId; - - UINT8 byRinPlayoutStopEventType; - UINT8 bySoutPlayoutStopEventType; - - UINT8 fRinBufAdded; - UINT8 fSoutBufAdded; - - UINT8 fBufPlayoutActive; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Copy events information. */ - - /* Number of copy events created. */ - UINT16 usCopyEventCnt; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Extended tone detection info. */ - - /* Enable extended tone detection. */ - UINT8 fEnableExtToneDetection; - - UINT16 usExtToneChanIndex; - UINT16 usExtToneMixerIndex; - UINT16 usExtToneTsiIndex; - - /* Mode of operation of the channel based on the extended tone detection configuration. */ - UINT32 ulExtToneChanMode; - - /*=======================================================================*/ - - /* Tone detection state. */ - /* This array is configured as follow. */ - /* Index 0 contain event 0 to 31 and Index 1 contains event 32 - 55 */ - UINT32 aulToneConf[ 2 ]; - UINT32 ulLastSSToneDetected; - UINT32 ulLastSSToneTimestamp; - - /*=======================================================================*/ - - - /*=======================================================================*/ - - /* Index of the phasing TSST */ - UINT16 usPhasingTsstIndex; - - /* State of the codec structure associated to this channel. */ - UINT8 fSinSoutCodecActive; - UINT8 fRinRoutCodecActive; - - /* Codec configuration. */ - tOCT6100_API_CHANNEL_CODEC CodecConfig; - - /*=======================================================================*/ - - - - - - - - /* Nlp Conf Dword, index 0 contains the dword where the dword is located. and - index 1 is the actual value of the dword.*/ - UINT32 aulNlpConfDword[ cOCT6100_MAX_NLP_CONF_DWORD ][ 2 ]; - -} tOCT6100_API_CHANNEL, *tPOCT6100_API_CHANNEL; - -typedef struct _OCT6100_API_BIDIR_CHANNEL_ -{ - UINT16 usFirstChanIndex; - UINT16 usSecondChanIndex; - - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Count used to manage entry handles allocated to user. */ - UINT8 byEntryOpenCnt; - - - -} tOCT6100_API_BIDIR_CHANNEL, *tPOCT6100_API_BIDIR_CHANNEL; - -#endif /* __OCT6100_CHANNEL_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_pub.h deleted file mode 100644 index 2691e101..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_channel_pub.h +++ /dev/null @@ -1,547 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_channel_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_channel.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_channel_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 84 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHANNEL_PUB_H__ -#define __OCT6100_CHANNEL_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -/* Channel open structures. */ -typedef struct _OCT6100_CHANNEL_OPEN_TDM_ -{ - UINT32 ulRinNumTssts; - UINT32 ulSinNumTssts; - UINT32 ulRoutNumTssts; - UINT32 ulSoutNumTssts; - - UINT32 ulSinTimeslot; - UINT32 ulSinStream; - UINT32 ulSinPcmLaw; - - UINT32 ulSoutTimeslot; - UINT32 ulSoutStream; - UINT32 ulSoutPcmLaw; - - UINT32 ulRinTimeslot; - UINT32 ulRinStream; - UINT32 ulRinPcmLaw; - - UINT32 ulRoutTimeslot; - UINT32 ulRoutStream; - UINT32 ulRoutPcmLaw; - -} tOCT6100_CHANNEL_OPEN_TDM, *tPOCT6100_CHANNEL_OPEN_TDM; - -typedef struct _OCT6100_CHANNEL_OPEN_VQE_ -{ - BOOL fEnableNlp; - BOOL fEnableTailDisplacement; - UINT32 ulTailDisplacement; - UINT32 ulTailLength; - - BOOL fSinDcOffsetRemoval; - BOOL fRinDcOffsetRemoval; - BOOL fRinLevelControl; - BOOL fSoutLevelControl; - BOOL fRinAutomaticLevelControl; - BOOL fSoutAutomaticLevelControl; - BOOL fRinHighLevelCompensation; - BOOL fAcousticEcho; - BOOL fSoutAdaptiveNoiseReduction; - BOOL fDtmfToneRemoval; - - BOOL fSoutNoiseBleaching; - BOOL fSoutConferencingNoiseReduction; - - UINT32 ulComfortNoiseMode; - UINT32 ulNonLinearityBehaviorA; - UINT32 ulNonLinearityBehaviorB; - - INT32 lRinLevelControlGainDb; - INT32 lSoutLevelControlGainDb; - INT32 lRinAutomaticLevelControlTargetDb; - INT32 lSoutAutomaticLevelControlTargetDb; - INT32 lRinHighLevelCompensationThresholdDb; - INT32 lDefaultErlDb; - INT32 lAecDefaultErlDb; - UINT32 ulAecTailLength; - UINT32 ulSoutAutomaticListenerEnhancementGainDb; - UINT32 ulSoutNaturalListenerEnhancementGainDb; - BOOL fSoutNaturalListenerEnhancement; - BOOL fRoutNoiseReduction; - INT32 lRoutNoiseReductionLevelGainDb; - INT32 lAnrSnrEnhancementDb; - UINT32 ulAnrVoiceNoiseSegregation; - UINT32 ulDoubleTalkBehavior; - - UINT32 ulToneDisablerVqeActivationDelay; - - BOOL fEnableMusicProtection; - BOOL fIdleCodeDetection; - - - -} tOCT6100_CHANNEL_OPEN_VQE, *tPOCT6100_CHANNEL_OPEN_VQE; - -typedef struct _OCT6100_CHANNEL_OPEN_CODEC_ -{ - UINT32 ulAdpcmNibblePosition; - - UINT32 ulEncoderPort; - UINT32 ulEncodingRate; - - UINT32 ulDecoderPort; - UINT32 ulDecodingRate; - - BOOL fEnableSilenceSuppression; - UINT32 ulPhase; - UINT32 ulPhasingType; - UINT32 ulPhasingTsstHndl; - -} tOCT6100_CHANNEL_OPEN_CODEC, *tPOCT6100_CHANNEL_OPEN_CODEC; - -typedef struct _OCT6100_CHANNEL_OPEN_ -{ - PUINT32 pulChannelHndl; - UINT32 ulUserChanId; - - UINT32 ulEchoOperationMode; - - BOOL fEnableToneDisabler; - - BOOL fEnableExtToneDetection; - - tOCT6100_CHANNEL_OPEN_TDM TdmConfig; - tOCT6100_CHANNEL_OPEN_VQE VqeConfig; - tOCT6100_CHANNEL_OPEN_CODEC CodecConfig; - - - -} tOCT6100_CHANNEL_OPEN, *tPOCT6100_CHANNEL_OPEN; - -/* Channel close structure. */ -typedef struct _OCT6100_CHANNEL_CLOSE_ -{ - UINT32 ulChannelHndl; - -} tOCT6100_CHANNEL_CLOSE, *tPOCT6100_CHANNEL_CLOSE; - -/* Channel modify structures. */ -typedef struct _OCT6100_CHANNEL_MODIFY_TDM_ -{ - UINT32 ulRinNumTssts; - UINT32 ulSinNumTssts; - UINT32 ulRoutNumTssts; - UINT32 ulSoutNumTssts; - - UINT32 ulSinTimeslot; - UINT32 ulSinStream; - UINT32 ulSinPcmLaw; - - UINT32 ulSoutTimeslot; - UINT32 ulSoutStream; - UINT32 ulSoutPcmLaw; - - UINT32 ulRinTimeslot; - UINT32 ulRinStream; - UINT32 ulRinPcmLaw; - - UINT32 ulRoutTimeslot; - UINT32 ulRoutStream; - UINT32 ulRoutPcmLaw; - -} tOCT6100_CHANNEL_MODIFY_TDM, *tPOCT6100_CHANNEL_MODIFY_TDM; - -typedef struct _OCT6100_CHANNEL_MODIFY_VQE_ -{ - BOOL fEnableNlp; - BOOL fEnableTailDisplacement; - UINT32 ulTailDisplacement; - - BOOL fSinDcOffsetRemoval; - BOOL fRinDcOffsetRemoval; - BOOL fRinLevelControl; - BOOL fSoutLevelControl; - BOOL fRinAutomaticLevelControl; - BOOL fSoutAutomaticLevelControl; - BOOL fRinHighLevelCompensation; - BOOL fAcousticEcho; - BOOL fSoutAdaptiveNoiseReduction; - BOOL fDtmfToneRemoval; - - BOOL fSoutConferencingNoiseReduction; - BOOL fSoutNoiseBleaching; - - UINT32 ulNonLinearityBehaviorA; - UINT32 ulNonLinearityBehaviorB; - UINT32 ulComfortNoiseMode; - - INT32 lRinLevelControlGainDb; - INT32 lSoutLevelControlGainDb; - INT32 lRinAutomaticLevelControlTargetDb; - INT32 lSoutAutomaticLevelControlTargetDb; - INT32 lRinHighLevelCompensationThresholdDb; - INT32 lDefaultErlDb; - INT32 lAecDefaultErlDb; - UINT32 ulAecTailLength; - UINT32 ulSoutAutomaticListenerEnhancementGainDb; - UINT32 ulSoutNaturalListenerEnhancementGainDb; - BOOL fSoutNaturalListenerEnhancement; - BOOL fRoutNoiseReduction; - INT32 lRoutNoiseReductionLevelGainDb; - INT32 lAnrSnrEnhancementDb; - UINT32 ulAnrVoiceNoiseSegregation; - UINT32 ulDoubleTalkBehavior; - - UINT32 ulToneDisablerVqeActivationDelay; - - BOOL fEnableMusicProtection; - BOOL fIdleCodeDetection; - - - -} tOCT6100_CHANNEL_MODIFY_VQE, *tPOCT6100_CHANNEL_MODIFY_VQE; - -typedef struct _OCT6100_CHANNEL_MODIFY_CODEC_ -{ - UINT32 ulEncoderPort; - UINT32 ulEncodingRate; - - UINT32 ulDecoderPort; - UINT32 ulDecodingRate; - - BOOL fEnableSilenceSuppression; - UINT32 ulPhase; - UINT32 ulPhasingType; - UINT32 ulPhasingTsstHndl; - -} tOCT6100_CHANNEL_MODIFY_CODEC, *tPOCT6100_CHANNEL_MODIFY_CODEC; - -typedef struct _OCT6100_CHANNEL_MODIFY_ -{ - UINT32 ulChannelHndl; - UINT32 ulUserChanId; - UINT32 ulEchoOperationMode; - - BOOL fEnableToneDisabler; - - BOOL fApplyToAllChannels; - - BOOL fDisableToneDetection; - BOOL fStopBufferPlayout; - BOOL fRemoveConfBridgeParticipant; - BOOL fRemoveBroadcastTssts; - - BOOL fTdmConfigModified; /* TRUE/FALSE */ - BOOL fVqeConfigModified; /* TRUE/FALSE */ - BOOL fCodecConfigModified; /* TRUE/FALSE */ - - - tOCT6100_CHANNEL_MODIFY_TDM TdmConfig; - tOCT6100_CHANNEL_MODIFY_VQE VqeConfig; - tOCT6100_CHANNEL_MODIFY_CODEC CodecConfig; - -} tOCT6100_CHANNEL_MODIFY, *tPOCT6100_CHANNEL_MODIFY; - -typedef struct _OCT6100_CHANNEL_BROADCAST_TSST_ADD_ -{ - UINT32 ulChannelHndl; - - UINT32 ulPort; - UINT32 ulTimeslot; - UINT32 ulStream; - -} tOCT6100_CHANNEL_BROADCAST_TSST_ADD, *tPOCT6100_CHANNEL_BROADCAST_TSST_ADD; - -typedef struct _OCT6100_CHANNEL_BROADCAST_TSST_REMOVE_ -{ - UINT32 ulChannelHndl; - - UINT32 ulPort; - UINT32 ulTimeslot; - UINT32 ulStream; - - BOOL fRemoveAll; - -} tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE, *tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE; - -/* Channel open structures.*/ -typedef struct _OCT6100_CHANNEL_STATS_TDM_ -{ - UINT32 ulMaxBroadcastTssts; - UINT32 ulNumRoutBroadcastTssts; - BOOL fMoreRoutBroadcastTssts; - UINT32 ulNumSoutBroadcastTssts; - BOOL fMoreSoutBroadcastTssts; - - UINT32 ulSinNumTssts; - UINT32 ulSoutNumTssts; - UINT32 ulRinNumTssts; - UINT32 ulRoutNumTssts; - - UINT32 ulSinTimeslot; - UINT32 ulSinStream; - UINT32 ulSinPcmLaw; - - UINT32 ulSoutTimeslot; - UINT32 ulSoutStream; - UINT32 ulSoutPcmLaw; - - PUINT32 pulSoutBroadcastTimeslot; - PUINT32 pulSoutBroadcastStream; - - UINT32 ulRinTimeslot; - UINT32 ulRinStream; - UINT32 ulRinPcmLaw; - - UINT32 ulRoutTimeslot; - UINT32 ulRoutStream; - UINT32 ulRoutPcmLaw; - - PUINT32 pulRoutBroadcastTimeslot; - PUINT32 pulRoutBroadcastStream; - -} tOCT6100_CHANNEL_STATS_TDM, *tPOCT6100_CHANNEL_STATS_TDM; - -typedef struct _OCT6100_CHANNEL_STATS_VQE_ -{ - BOOL fEnableNlp; - BOOL fEnableTailDisplacement; - UINT32 ulTailDisplacement; - UINT32 ulTailLength; - - BOOL fSinDcOffsetRemoval; - BOOL fRinDcOffsetRemoval; - BOOL fRinLevelControl; - BOOL fSoutLevelControl; - BOOL fRinAutomaticLevelControl; - BOOL fSoutAutomaticLevelControl; - BOOL fRinHighLevelCompensation; - BOOL fAcousticEcho; - BOOL fSoutAdaptiveNoiseReduction; - BOOL fDtmfToneRemoval; - - BOOL fSoutConferencingNoiseReduction; - BOOL fSoutNoiseBleaching; - - UINT32 ulComfortNoiseMode; - UINT32 ulNonLinearityBehaviorA; - UINT32 ulNonLinearityBehaviorB; - - INT32 lRinLevelControlGainDb; - INT32 lSoutLevelControlGainDb; - INT32 lRinAutomaticLevelControlTargetDb; - INT32 lSoutAutomaticLevelControlTargetDb; - INT32 lRinHighLevelCompensationThresholdDb; - INT32 lDefaultErlDb; - INT32 lAecDefaultErlDb; - UINT32 ulAecTailLength; - UINT32 ulSoutAutomaticListenerEnhancementGainDb; - UINT32 ulSoutNaturalListenerEnhancementGainDb; - BOOL fSoutNaturalListenerEnhancement; - BOOL fRoutNoiseReduction; - INT32 lRoutNoiseReductionLevelGainDb; - INT32 lAnrSnrEnhancementDb; - UINT32 ulAnrVoiceNoiseSegregation; - UINT32 ulDoubleTalkBehavior; - - UINT32 ulToneDisablerVqeActivationDelay; - - BOOL fEnableMusicProtection; - BOOL fIdleCodeDetection; - - - -} tOCT6100_CHANNEL_STATS_VQE, *tPOCT6100_CHANNEL_STATS_VQE; - -typedef struct _OCT6100_CHANNEL_STATS_CODEC_ -{ - UINT32 ulAdpcmNibblePosition; - - UINT32 ulEncoderPort; - UINT32 ulEncodingRate; - - UINT32 ulDecoderPort; - UINT32 ulDecodingRate; - - BOOL fEnableSilenceSuppression; - UINT32 ulPhase; - UINT32 ulPhasingType; - UINT32 ulPhasingTsstHndl; - -} tOCT6100_CHANNEL_STATS_CODEC, *tPOCT6100_CHANNEL_STATS_CODEC; - -typedef struct _OCT6100_CHANNEL_STATS_ -{ - BOOL fResetStats; - - UINT32 ulChannelHndl; - UINT32 ulUserChanId; - - UINT32 ulEchoOperationMode; - BOOL fEnableToneDisabler; - - UINT32 ulMutePortsMask; - BOOL fEnableExtToneDetection; - - tOCT6100_CHANNEL_STATS_TDM TdmConfig; - tOCT6100_CHANNEL_STATS_VQE VqeConfig; - tOCT6100_CHANNEL_STATS_CODEC CodecConfig; - - /* Real stats. */ - UINT32 ulNumEchoPathChanges; - UINT32 ulToneDisablerStatus; - - INT32 lCurrentERL; - INT32 lCurrentERLE; - UINT32 ulCurrentEchoDelay; - - INT32 lMaxERL; - INT32 lMaxERLE; - UINT32 ulMaxEchoDelay; - - INT32 lRinLevel; - INT32 lSinLevel; - INT32 lRinAppliedGain; - INT32 lSoutAppliedGain; - INT32 lComfortNoiseLevel; - - BOOL fEchoCancellerConverged; - BOOL fSinVoiceDetected; - - - -} tOCT6100_CHANNEL_STATS, *tPOCT6100_CHANNEL_STATS; - -typedef struct _OCT6100_CHANNEL_CREATE_BIDIR_ -{ - PUINT32 pulBiDirChannelHndl; - - UINT32 ulFirstChannelHndl; - UINT32 ulSecondChannelHndl; - - - -} tOCT6100_CHANNEL_CREATE_BIDIR, *tPOCT6100_CHANNEL_CREATE_BIDIR; - -typedef struct _OCT6100_CHANNEL_DESTROY_BIDIR_ -{ - UINT32 ulBiDirChannelHndl; - -} tOCT6100_CHANNEL_DESTROY_BIDIR, *tPOCT6100_CHANNEL_DESTROY_BIDIR; - -typedef struct _OCT6100_CHANNEL_MUTE_ -{ - UINT32 ulChannelHndl; - UINT32 ulPortMask; - -} tOCT6100_CHANNEL_MUTE, *tPOCT6100_CHANNEL_MUTE; - -typedef struct _OCT6100_CHANNEL_UNMUTE_ -{ - UINT32 ulChannelHndl; - UINT32 ulPortMask; - -} tOCT6100_CHANNEL_UNMUTE, *tPOCT6100_CHANNEL_UNMUTE; - - -/************************** FUNCTION PROTOTYPES *****************************/ - - -UINT32 Oct6100ChannelOpenDef( - OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ); -UINT32 Oct6100ChannelOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ); - -UINT32 Oct6100ChannelCloseDef( - OUT tPOCT6100_CHANNEL_CLOSE f_pChannelClose ); -UINT32 Oct6100ChannelClose( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_CLOSE f_pChannelClose ); - -UINT32 Oct6100ChannelModifyDef( - OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ); -UINT32 Oct6100ChannelModify( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ); - -UINT32 Oct6100ChannelBroadcastTsstAddDef( - OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd ); -UINT32 Oct6100ChannelBroadcastTsstAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd ); - -UINT32 Oct6100ChannelBroadcastTsstRemoveDef( - OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove ); -UINT32 Oct6100ChannelBroadcastTsstRemove( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove ); - -UINT32 Oct6100ChannelGetStatsDef( - OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ); -UINT32 Oct6100ChannelGetStats( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ); - -UINT32 Oct6100ChannelCreateBiDirDef( - OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ); -UINT32 Oct6100ChannelCreateBiDir( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ); - -UINT32 Oct6100ChannelDestroyBiDirDef( - OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ); -UINT32 Oct6100ChannelDestroyBiDir( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ); - -UINT32 Oct6100ChannelMuteDef( - OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute ); -UINT32 Oct6100ChannelMute( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute ); - -UINT32 Oct6100ChannelUnMuteDef( - OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ); -UINT32 Oct6100ChannelUnMute( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ); - -#endif /* __OCT6100_CHANNEL_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_inst.h deleted file mode 100644 index 6de2d7e8..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_inst.h +++ /dev/null @@ -1,517 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_open_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_chip_open.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_chip_open_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 122 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_OPEN_INST_H__ -#define __OCT6100_CHIP_OPEN_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_CHIP_CONFIG_ -{ - UINT32 ulUserChipId; - PVOID pProcessContext; - - unsigned char const *pbyImageFile; /* Byte pointer to the image file to be uploaded into the chip. */ - UINT32 ulImageSize; /* Size of the image file (in bytes). */ - - UINT32 ulMemClkFreq; - UINT32 ulUpclkFreq; /* 33.33 or 66.66 MHz. */ - UINT8 fEnableMemClkOut; /* TRUE/FALSE */ - - UINT8 fMultiProcessSystem; - - UINT8 byMemoryType; /* SDRAM or DDR */ - UINT8 byNumMemoryChips; /* Number of memory chips present. */ - UINT32 ulMemoryChipSize; /* The size of the memory chips. */ - - UINT16 usMaxRwAccesses; - UINT16 usTailDisplacement; - - /* Resource allocation parameters. */ - UINT16 usMaxChannels; - UINT16 usMaxBiDirChannels; - - UINT32 aulTdmStreamFreqs[ cOCT6100_TDM_STREAM_MAX_GROUPS ]; - - UINT8 byMaxTdmStreams; - UINT8 byTdmSampling; - - UINT8 fEnableFastH100Mode; - UINT8 fEnableAcousticEcho; /* Acoustic echo enabled. */ - - UINT16 ausTimestampTimeslots[ 4 ]; - UINT16 ausTimestampStreams[ 4 ]; - - UINT8 fUseSynchTimestamp; - - /* Debug feature used to record stream information from a channel.*/ - UINT8 fEnableChannelRecording; - - UINT16 usMaxRemoteDebugSessions; - - UINT8 byInterruptPolarity; - - UINT16 usMaxTsiCncts; - - UINT8 fEnableExtToneDetection; - UINT8 fEnable2100StopEvent; - - - UINT16 usMaxConfBridges; - UINT16 usMaxFlexibleConfParticipants; - UINT16 usMaxPlayoutBuffers; - - /* Playout event software buffer size. */ - UINT32 ulSoftBufPlayoutEventsBufSize; - - /* Soft buffer size. */ - UINT32 ulSoftToneEventsBufSize; - - UINT16 usMaxPhasingTssts; - UINT16 usMaxAdpcmChannels; - - - - - - UINT8 fEnableProductionBist; - UINT32 ulProductionBistMode; - UINT32 ulNumProductionBistLoops; - -} tOCT6100_API_CHIP_CONFIG, *tPOCT6100_API_CHIP_CONFIG; - - -typedef struct _OCT6100_API_MISCELLANEOUS_ -{ - /* Total size of external memories. */ - UINT32 ulTotalMemSize; - - UINT32 ulH100SlaveMode; - - /* Mclk frequency generated by the chip. */ - UINT32 ulMclkFreq; - - /* Array of UINT32s used to perform a burst of writes (avoids having to - allocate on the stack. The size of this array MUST NOT CHANGE (it's - used everywhere). */ - UINT16 ausSuperArray[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ]; - UINT16 ausSuperArray1[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ]; - UINT16 ausSuperArray2[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ]; - - /* Chip ID and revision.*/ - UINT16 usChipId; - UINT16 usChipRevision; - - /* Lsu CPU access variables.*/ - UINT16 usCpuLsuWritePtr; - UINT16 usCodepoint; - - /* Max number of channel supported.*/ - UINT16 usMaxNumberOfChannels; - UINT16 usMaxH100Speed; - UINT16 usTdmClkBoundary; - - UINT16 usNumBridgesOpened; - UINT16 usFirstBridge; - - - - - -} tOCT6100_API_MISCELLANEOUS, *tPOCT6100_API_MISCELLANEOUS; - -typedef struct _OCT6100_API_MEMORY_MAP_ -{ - /*-----------------------------------------------------------------------------*/ - /* Structure contained in external memory. */ - - /* Memory mapping filled using TLV information from the chip. */ - - /* Main channel memory. */ - UINT32 ulChanMainMemBase; - UINT32 ulChanMainMemSize; - - UINT32 ulChanMainIoMemOfst; - - UINT32 ulChanMainRinCBMemOfst; - UINT32 ulChanMainRinCBMemSize; - UINT32 ulChanMainSinCBMemOfst; - UINT32 ulChanMainSinCBMemSize; - UINT32 ulChanMainSoutCBMemOfst; - UINT32 ulChanMainSoutCBMemSize; - - /* Free memory base address. */ - UINT32 ulFreeMemBaseAddress; - - /* Root channel config offset. */ - UINT32 ulChanRootConfOfst; - - /* Playout buffer info. */ - UINT32 ulChanMainRinPlayoutMemOfst; - UINT32 ulChanMainRinPlayoutMemSize; - UINT32 ulChanMainSoutPlayoutMemOfst; - UINT32 ulChanMainSoutPlayoutMemSize; - - /* Channel Stats location */ - UINT32 ulChanMainIoStatsOfst; - UINT32 ulChanMainIoStatsSize; - - /* Buffer playout fields. */ - tOCT6100_TLV_OFFSET PlayoutRinWritePtrOfst; - tOCT6100_TLV_OFFSET PlayoutRinIgnoreSkipCleanOfst; - tOCT6100_TLV_OFFSET PlayoutRinSkipPtrOfst; - tOCT6100_TLV_OFFSET PlayoutSoutWritePtrOfst; - tOCT6100_TLV_OFFSET PlayoutSoutIgnoreSkipCleanOfst; - tOCT6100_TLV_OFFSET PlayoutSoutSkipPtrOfst; - tOCT6100_TLV_OFFSET PlayoutRinReadPtrOfst; - tOCT6100_TLV_OFFSET PlayoutSoutReadPtrOfst; - tOCT6100_TLV_OFFSET PlayoutRinHardSkipOfst; - tOCT6100_TLV_OFFSET PlayoutSoutHardSkipOfst; - - /* Adaptive noise reduction. */ - tOCT6100_TLV_OFFSET AdaptiveNoiseReductionOfst; - - /* DC offset removal. */ - tOCT6100_TLV_OFFSET RinDcOffsetRemovalOfst; - tOCT6100_TLV_OFFSET SinDcOffsetRemovalOfst; - - /* Level control. */ - tOCT6100_TLV_OFFSET RinLevelControlOfst; - tOCT6100_TLV_OFFSET SoutLevelControlOfst; - - /* Auto level control. */ - tOCT6100_TLV_OFFSET RinAutoLevelControlTargetOfst; - tOCT6100_TLV_OFFSET SoutAutoLevelControlTargetOfst; - - /* High level compensation. */ - tOCT6100_TLV_OFFSET RinHighLevelCompensationThresholdOfst; - tOCT6100_TLV_OFFSET SoutHighLevelCompensationThresholdOfst; - - /* Auto level control and high level compensation status. */ - tOCT6100_TLV_OFFSET AlcHlcStatusOfst; - - /* Confort Noise Mode. */ - tOCT6100_TLV_OFFSET ComfortNoiseModeOfst; - - /* NLP control field. */ - tOCT6100_TLV_OFFSET NlpControlFieldOfst; - - /* VAD control field offset.*/ - tOCT6100_TLV_OFFSET VadControlFieldOfst; - - /* NLP Trivial field offset. */ - tOCT6100_TLV_OFFSET NlpTrivialFieldOfst; - - /* Acoustic echo field offset. */ - tOCT6100_TLV_OFFSET AecFieldOfst; - - /* Acoustic echo default ERL field offset. */ - tOCT6100_TLV_OFFSET AecDefaultErlFieldOfst; - - /* Non-linearity behavior A and B field offset. */ - tOCT6100_TLV_OFFSET PcmLeakFieldOfst; - tOCT6100_TLV_OFFSET NlpConvCapFieldOfst; - - /* Default ERL field offset. */ - tOCT6100_TLV_OFFSET DefaultErlFieldOfst; - - /* Tone Removal field offset.*/ - tOCT6100_TLV_OFFSET ToneRemovalFieldOfst; - - - - /* Channel config fields offset. */ - tOCT6100_TLV_OFFSET ChanMainIoMaxEchoPointOfst; - tOCT6100_TLV_OFFSET TailDisplEnableOfst; - - /* Pouch fields offset. */ - tOCT6100_TLV_OFFSET PouchBootInstructionOfst; - tOCT6100_TLV_OFFSET PouchBootResultOfst; - tOCT6100_TLV_OFFSET PouchTailDisplOfst; - - /* 2100 Hz Auto disabling fields offset. */ - tOCT6100_TLV_OFFSET ToneDisablerControlOfst; - - /* Conferencing dominant speaker field offset. */ - tOCT6100_TLV_OFFSET DominantSpeakerFieldOfst; - - /* Conferencing noise reduction field offset. */ - tOCT6100_TLV_OFFSET ConferencingNoiseReductionOfst; - - /* Per channel tail displacement field offset. */ - tOCT6100_TLV_OFFSET PerChanTailDisplacementFieldOfst; - - /* Per channel tail length field offset. */ - tOCT6100_TLV_OFFSET PerChanTailLengthFieldOfst; - - /* AF control/echo cancellation bypass. */ - tOCT6100_TLV_OFFSET AftControlOfst; - - /* Voice detected stat field offset. */ - tOCT6100_TLV_OFFSET SinVoiceDetectedStatOfst; - - /* Rin currently applied gain field offset. */ - tOCT6100_TLV_OFFSET RinAppliedGainStatOfst; - - /* Sout currently applied gain field offset. */ - tOCT6100_TLV_OFFSET SoutAppliedGainStatOfst; - - /* Adaptive listener enhancement field offset. */ - tOCT6100_TLV_OFFSET AdaptiveAleOfst; - - /* Rin NR field offset. */ - tOCT6100_TLV_OFFSET RinAnrOfst; - - /* Rin NR value field offset. */ - tOCT6100_TLV_OFFSET RinAnrValOfst; - - /* Sin Mute field offset. */ - tOCT6100_TLV_OFFSET SinMuteOfst; - - /* Rin Mute field offset. */ - tOCT6100_TLV_OFFSET RinMuteOfst; - - /* Sout ANR SNR enhancement offset. */ - tOCT6100_TLV_OFFSET AnrSnrEnhancementOfst; - - /* Sout ANR voice-noise segregation offset. */ - tOCT6100_TLV_OFFSET AnrVoiceNoiseSegregationOfst; - - /* Tone disabler VQE activation delay offset. */ - tOCT6100_TLV_OFFSET ToneDisablerVqeActivationDelayOfst; - - /* AF tail displacement value configuration offset. */ - tOCT6100_TLV_OFFSET AfTailDisplacementFieldOfst; - - /* Pouch counter field offset. */ - tOCT6100_TLV_OFFSET PouchCounterFieldOfst; - - /* Acoustic echo tail length. */ - tOCT6100_TLV_OFFSET AecTailLengthFieldOfst; - - /* Is ISR called field offset. */ - tOCT6100_TLV_OFFSET IsIsrCalledFieldOfst; - - /* Music protection enable field offset. */ - tOCT6100_TLV_OFFSET MusicProtectionFieldOfst; - - /* Rin port energy level statistics field offset. */ - tOCT6100_TLV_OFFSET RinEnergyStatFieldOfst; - - /* Sout port energy level statistics field offset. */ - tOCT6100_TLV_OFFSET SoutEnergyStatFieldOfst; - - /* Double talk behavior field offset. */ - tOCT6100_TLV_OFFSET DoubleTalkBehaviorFieldOfst; - - /* Idle code detection field offset. */ - tOCT6100_TLV_OFFSET IdleCodeDetectionFieldOfst; - - /* TSI memory mapping information.*/ - UINT32 ulNumTsiEntries; - - /*-----------------------------------------------------------------------------*/ - -} tOCT6100_API_MEMORY_MAP, *tPOCT6100_API_MEMORY_MAP; - -typedef struct _OCT6100_API_SOFT_BUFS_ -{ - /* To avoid compilation errors. */ - UINT32 ulDummyVariable; - - /* Tone events buffer pointers. */ - UINT32 ulToneEventBufferWritePtr; - UINT32 ulToneEventBufferReadPtr; - UINT32 ulToneEventBufferSize; - UINT32 ulToneEventBufferMemOfst; - UINT32 ulToneEventBufferOverflowCnt; - - /* Playout events buffer pointers. */ - UINT32 ulBufPlayoutEventBufferWritePtr; - UINT32 ulBufPlayoutEventBufferReadPtr; - UINT32 ulBufPlayoutEventBufferSize; - UINT32 ulBufPlayoutEventBufferMemOfst; - UINT32 ulBufPlayoutEventBufferOverflowCnt; - -} tOCT6100_API_SOFT_BUFS, *tPOCT6100_API_SOFT_BUFS; - -typedef struct _OCT6100_API_IMAGE_REGION_ -{ - UINT32 ulPart1Size; - UINT32 ulPart2Size; - UINT32 ulClockInfo; - - UINT32 ulReserved; - - UINT32 ulPart1BaseAddress; - UINT32 ulPart2BaseAddress; - -} tOCT6100_API_IMAGE_REGION, *tPOCT6100_API_IMAGE_REGION; - -typedef struct _OCT6100_API_IMAGE_INFO_ -{ - UINT8 fBufferPlayout; - UINT8 fAdaptiveNoiseReduction; - UINT8 fRinDcOffsetRemoval; - UINT8 fSinDcOffsetRemoval; - - UINT8 fRinAutoLevelControl; - UINT8 fSoutAutoLevelControl; - UINT8 fRinHighLevelCompensation; - UINT8 fSoutHighLevelCompensation; - - UINT8 fAlcHlcStatus; - UINT8 fComfortNoise; - UINT8 fNlpControl; - UINT8 fSilenceSuppression; - - UINT8 fToneDisabler; - UINT8 fTailDisplacement; - UINT8 fPerChannelTailDisplacement; - UINT8 fAcousticEcho; - - UINT8 fAecEnabled; - UINT8 fToneRemoval; - UINT8 fDefaultErl; - UINT8 fMaxEchoPoint; - - UINT8 fNonLinearityBehaviorA; - UINT8 fNonLinearityBehaviorB; - UINT8 fAecDefaultErl; - UINT8 fAdpcm; - - UINT8 fConferencing; - UINT8 fConferencingNoiseReduction; - UINT8 fMusicProtection; - UINT8 fDominantSpeakerEnabled; - - UINT8 fAftControl; - UINT8 fSinVoiceDetectedStat; - UINT8 fRinAppliedGainStat; - UINT8 fSoutAppliedGainStat; - - UINT8 fListenerEnhancement; - UINT8 fRoutNoiseReduction; - UINT8 fRoutNoiseReductionLevel; - UINT8 fRinMute; - UINT8 fSinMute; - - UINT8 fAnrSnrEnhancement; - UINT8 fAnrVoiceNoiseSegregation; - UINT8 fRinBufferPlayoutHardSkip; - UINT8 fSoutBufferPlayoutHardSkip; - - UINT16 usMaxNumberOfChannels; - UINT8 fPerChannelTailLength; - UINT8 fToneDisablerVqeActivationDelay; - - UINT32 ulToneProfileNumber; - - UINT16 usMaxTailDisplacement; - UINT16 usMaxTailLength; - - UINT8 byNumToneDetectors; - UINT8 byMaxNumberPlayoutEvents; - - UINT8 fAfTailDisplacement; - UINT8 fAecTailLength; - - UINT8 fMusicProtectionConfiguration; - UINT8 byImageType; - - UINT8 fBufferPlayoutSkipInEvents; - UINT8 fSoutNoiseBleaching; - - UINT8 fRinEnergyStat; - UINT8 fSoutEnergyStat; - - UINT8 fDoubleTalkBehavior; - UINT8 fDoubleTalkBehaviorFieldOfst; - - UINT8 fIdleCodeDetection; - UINT8 fIdleCodeDetectionConfiguration; - - UINT8 fSinLevel; - - - - UINT8 szVersionNumber[ cOCT6100_VERSION_NUMBER_MAX_SIZE ]; - UINT32 ulBuildId; - - tOCT6100_TLV_TONE_INFO aToneInfo[ cOCT6100_MAX_TONE_EVENT ]; - -} tOCT6100_API_IMAGE_INFO, *tPOCT6100_API_IMAGE_INFO; - -typedef struct _OCT6100_API_MIXER_ -{ - /* Pointer to the various event region. */ - UINT16 usFirstSoutCopyEventPtr; - UINT16 usLastSoutCopyEventPtr; - - UINT16 usFirstBridgeEventPtr; - UINT16 usLastBridgeEventPtr; - - UINT16 usFirstSinCopyEventPtr; - UINT16 usLastSinCopyEventPtr; - - /* Recording event info. */ - UINT16 usRecordCopyEventIndex; - UINT16 usRecordSinEventIndex; - -} tOCT6100_API_MIXER, tPOCT6100_API_MIXER; - - -typedef struct _OCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO_ -{ - /* Next node to be checked for free memory. */ - UINT32 ulRovingNode; - - /* First unused node in the unused list. */ - UINT32 ulFirstUnusedNode; - - /* Last unused node in the unused list. */ - UINT32 ulLastUnusedNode; - - /* Count of unused nodes. */ - UINT32 ulUnusedNodeCnt; - -} tOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO, *tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_INFO; - - - - -#endif /* __OCT6100_CHIP_OPEN_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_pub.h deleted file mode 100644 index 71531060..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_open_pub.h +++ /dev/null @@ -1,241 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_open_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_chip_open.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_chip_open_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 54 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_OPEN_PUB_H__ -#define __OCT6100_CHIP_OPEN_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_CHIP_OPEN_ -{ - UINT32 ulUserChipId; - BOOL fMultiProcessSystem; - PVOID pProcessContext; - - UINT32 ulMaxRwAccesses; - - unsigned char const *pbyImageFile; /* Byte pointer to the image file to be uploaded into the chip. */ - UINT32 ulImageSize; /* Size of the image file (in bytes). */ - - UINT32 ulMemClkFreq; /* 10 - 133.3 MHz. */ - UINT32 ulUpclkFreq; /* 1 - 66.6 MHz. */ - BOOL fEnableMemClkOut; - - UINT32 ulMemoryType; /* SDRAM or DDR type external memory. */ - UINT32 ulNumMemoryChips; /* Number of memory chips present. */ - UINT32 ulMemoryChipSize; /* The size of the memory chips. */ - - UINT32 ulTailDisplacement; /* Tail displacement supported by the chip. */ - - BOOL fEnableAcousticEcho;/* Acoustic echo cancellation enabled. */ - - /* Resource allocation parameters. */ - UINT32 ulMaxChannels; - UINT32 ulMaxTsiCncts; - UINT32 ulMaxBiDirChannels; - UINT32 ulMaxConfBridges; - UINT32 ulMaxFlexibleConfParticipants; - UINT32 ulMaxPlayoutBuffers; - - - UINT32 ulMaxPhasingTssts; - UINT32 ulMaxAdpcmChannels; - BOOL fUseSynchTimestamp; - UINT32 aulTimestampTimeslots[ 4 ]; - UINT32 aulTimestampStreams[ 4 ]; - UINT32 ulInterruptPolarity; - tOCT6100_INTERRUPT_CONFIGURE InterruptConfig; - - UINT32 aulTdmStreamFreqs[ cOCT6100_TDM_STREAM_MAX_GROUPS ]; - UINT32 ulMaxTdmStreams; - UINT32 ulTdmSampling; - - BOOL fEnableFastH100Mode; - - UINT32 ulSoftToneEventsBufSize; /* In events. */ - BOOL fEnableExtToneDetection; - BOOL fEnable2100StopEvent; - - - UINT32 ulSoftBufferPlayoutEventsBufSize; /* In events. */ - UINT32 ulMaxRemoteDebugSessions; - - BOOL fEnableChannelRecording; - - BOOL fEnableProductionBist; - UINT32 ulProductionBistMode; - UINT32 ulNumProductionBistLoops; - -} tOCT6100_CHIP_OPEN, *tPOCT6100_CHIP_OPEN; - -typedef struct _OCT6100_GET_INSTANCE_SIZE_ -{ - UINT32 ulApiInstanceSize; - -} tOCT6100_GET_INSTANCE_SIZE, *tPOCT6100_GET_INSTANCE_SIZE; - -typedef struct _OCT6100_CHIP_CLOSE_ -{ - UINT32 ulDummyVariable; - -} tOCT6100_CHIP_CLOSE, *tPOCT6100_CHIP_CLOSE; - -typedef struct _OCT6100_CREATE_LOCAL_INSTANCE_ -{ - tPOCT6100_INSTANCE_API pApiInstShared; - tPOCT6100_INSTANCE_API pApiInstLocal; - PVOID pProcessContext; - UINT32 ulUserChipId; - -} tOCT6100_CREATE_LOCAL_INSTANCE, *tPOCT6100_CREATE_LOCAL_INSTANCE; - -typedef struct _OCT6100_DESTROY_LOCAL_INSTANCE_ -{ - UINT32 ulDummy; - -} tOCT6100_DESTROY_LOCAL_INSTANCE, *tPOCT6100_DESTROY_LOCAL_INSTANCE; - -typedef struct _OCT6100_GET_HW_REVISION_ -{ - UINT32 ulUserChipId; - PVOID pProcessContext; - UINT32 ulRevisionNum; - -} tOCT6100_GET_HW_REVISION, *tPOCT6100_GET_HW_REVISION; - -typedef struct _OCT6100_FREE_RESOURCES_ -{ - BOOL fFreeTsiConnections; - BOOL fFreeConferenceBridges; - BOOL fFreePlayoutBuffers; - BOOL fFreePhasingTssts; - BOOL fFreeAdpcmChannels; - -} tOCT6100_FREE_RESOURCES, *tPOCT6100_FREE_RESOURCES; - -typedef struct _OCT6100_PRODUCTION_BIST_ -{ - UINT32 ulCurrentAddress; - UINT32 ulCurrentLoop; - UINT32 ulCurrentTest; - UINT32 ulBistStatus; - UINT32 ulFailedAddress; - UINT32 ulReadValue; - UINT32 ulExpectedValue; - -} tOCT6100_PRODUCTION_BIST, *tPOCT6100_PRODUCTION_BIST; - -typedef struct _OCT6100_API_GET_VERSION_ -{ - UINT8 achApiVersion[ cOCT6100_API_VERSION_STRING_LENGTH ]; - -} tOCT6100_API_GET_VERSION, *tPOCT6100_API_GET_VERSION; - -typedef struct _OCT6100_API_GET_CAPACITY_PINS_ -{ - UINT32 ulUserChipId; - PVOID pProcessContext; - UINT32 ulMemoryType; /* SDRAM or DDR type external memory. */ - BOOL fEnableMemClkOut; - UINT32 ulMemClkFreq; - UINT32 ulCapacityValue; -} tOCT6100_API_GET_CAPACITY_PINS, *tPOCT6100_API_GET_CAPACITY_PINS; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ChipOpenDef( - OUT tPOCT6100_CHIP_OPEN f_pChipOpen ); -UINT32 Oct6100ChipOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHIP_OPEN f_pChipOpen ); - -UINT32 Oct6100ChipCloseDef( - OUT tPOCT6100_CHIP_CLOSE f_pChipClose ); -UINT32 Oct6100ChipClose( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHIP_CLOSE f_pChipClose ); - -UINT32 Oct6100GetInstanceSizeDef( - OUT tPOCT6100_GET_INSTANCE_SIZE f_pInstanceSize ); -UINT32 Oct6100GetInstanceSize( - IN OUT tPOCT6100_CHIP_OPEN f_pChipOpen, - IN OUT tPOCT6100_GET_INSTANCE_SIZE f_pInstanceSize ); - -UINT32 Oct6100CreateLocalInstanceDef( - OUT tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal ); -UINT32 Oct6100CreateLocalInstance( - IN OUT tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal ); - -UINT32 Oct6100DestroyLocalInstanceDef( - OUT tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal ); -UINT32 Oct6100DestroyLocalInstance( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal ); - -UINT32 Oct6100ApiGetVersionDef( - OUT tPOCT6100_API_GET_VERSION f_pApiGetVersion ); -UINT32 Oct6100ApiGetVersion( - IN OUT tPOCT6100_API_GET_VERSION f_pApiGetVersion ); - -UINT32 Oct6100GetHwRevisionDef( - OUT tPOCT6100_GET_HW_REVISION f_pRevision ); -UINT32 Oct6100GetHwRevision( - IN OUT tPOCT6100_GET_HW_REVISION f_pRevision ); - -UINT32 Oct6100FreeResourcesDef( - OUT tPOCT6100_FREE_RESOURCES f_pFreeResources ); -UINT32 Oct6100FreeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_FREE_RESOURCES f_pFreeResources ); - -UINT32 Oct6100ProductionBistDef( - OUT tPOCT6100_PRODUCTION_BIST f_pProductionBist ); -UINT32 Oct6100ProductionBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PRODUCTION_BIST f_pProductionBist ); - -UINT32 Oct6100ApiGetCapacityPinsDef( - tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins); - -UINT32 Oct6100ApiGetCapacityPins( - tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - - -#endif /* __OCT6100_CHIP_OPEN_PUB_H__ */ - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_inst.h deleted file mode 100644 index bcba6161..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_inst.h +++ /dev/null @@ -1,84 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_stats_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_chip_stats.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_chip_stats_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 21 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_STATS_INST_H__ -#define __OCT6100_CHIP_STATS_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_CHIP_ERROR_STATS_ -{ - UINT8 fFatalChipError; - - UINT32 ulInternalReadTimeoutCnt; - UINT32 ulSdramRefreshTooLateCnt; - UINT32 ulPllJitterErrorCnt; - - /* Internal tone detector error counter. */ - UINT32 ulToneDetectorErrorCnt; - - UINT32 ulOverflowToneEventsCnt; - - UINT32 ulH100OutOfSyncCnt; - UINT32 ulH100ClkABadCnt; - UINT32 ulH100ClkBBadCnt; - UINT32 ulH100FrameABadCnt; - - - -} tOCT6100_API_CHIP_ERROR_STATS, *tPOCT6100_API_CHIP_ERROR_STATS; - -typedef struct _OCT6100_API_CHIP_STATS_ -{ - UINT16 usNumberChannels; - UINT16 usNumberBiDirChannels; - UINT16 usNumberTsiCncts; - UINT16 usNumberConfBridges; - UINT16 usNumberPlayoutBuffers; - UINT16 usNumEcChanUsingMixer; - - UINT32 ulPlayoutMemUsed; - UINT16 usNumberActiveBufPlayoutPorts; - - UINT16 usNumberPhasingTssts; - UINT16 usNumberAdpcmChans; - -} tOCT6100_API_CHIP_STATS, *tPOCT6100_API_CHIP_STATS; - -#endif /* __OCT6100_CHIP_STATS_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_pub.h deleted file mode 100644 index a718f7b6..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_chip_stats_pub.h +++ /dev/null @@ -1,150 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_stats_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_chip_stats.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_chip_stats_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 59 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_STATS_PUB_H__ -#define __OCT6100_CHIP_STATS_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_CHIP_STATS_ -{ - BOOL fResetChipStats; - - UINT32 ulNumberChannels; - UINT32 ulNumberTsiCncts; - UINT32 ulNumberConfBridges; - UINT32 ulNumberPlayoutBuffers; - UINT32 ulPlayoutFreeMemSize; - UINT32 ulNumberPhasingTssts; - UINT32 ulNumberAdpcmChannels; - - UINT32 ulH100OutOfSynchCount; - UINT32 ulH100ClockABadCount; - UINT32 ulH100FrameABadCount; - UINT32 ulH100ClockBBadCount; - - UINT32 ulInternalReadTimeoutCount; - UINT32 ulSdramRefreshTooLateCount; - UINT32 ulPllJitterErrorCount; - - UINT32 ulOverflowToneEventsCount; - UINT32 ulSoftOverflowToneEventsCount; - - UINT32 ulSoftOverflowBufferPlayoutEventsCount; - -} tOCT6100_CHIP_STATS, *tPOCT6100_CHIP_STATS; - -typedef struct _OCT6100_CHIP_TONE_INFO_ -{ - UINT32 ulToneID; - UINT32 ulDetectionPort; - - UINT8 aszToneName[ cOCT6100_TLV_MAX_TONE_NAME_SIZE ]; - -} tOCT6100_CHIP_TONE_INFO, *tPOCT6100_CHIP_TONE_INFO; - -typedef struct _OCT6100_CHIP_IMAGE_INFO_ -{ - BOOL fBufferPlayout; - BOOL fAdaptiveNoiseReduction; - BOOL fSoutNoiseBleaching; - BOOL fAutoLevelControl; - BOOL fHighLevelCompensation; - BOOL fSilenceSuppression; - - BOOL fAdpcm; - BOOL fConferencing; - BOOL fConferencingNoiseReduction; - BOOL fDominantSpeaker; - - BOOL fAcousticEcho; - BOOL fAecTailLength; - BOOL fToneRemoval; - - BOOL fDefaultErl; - BOOL fNonLinearityBehaviorA; - BOOL fNonLinearityBehaviorB; - BOOL fPerChannelTailDisplacement; - BOOL fPerChannelTailLength; - BOOL fListenerEnhancement; - BOOL fRoutNoiseReduction; - BOOL fRoutNoiseReductionLevel; - BOOL fAnrSnrEnhancement; - BOOL fAnrVoiceNoiseSegregation; - BOOL fToneDisablerVqeActivationDelay; - BOOL fMusicProtection; - BOOL fDoubleTalkBehavior; - BOOL fIdleCodeDetection; - BOOL fSinLevel; - - UINT32 ulMaxChannels; - UINT32 ulNumTonesAvailable; - UINT32 ulToneProfileNumber; - UINT32 ulMaxTailDisplacement; - UINT32 ulMaxTailLength; - UINT32 ulDebugEventSize; - UINT32 ulMaxPlayoutEvents; - - UINT32 ulImageType; - - UINT8 szVersionNumber[ cOCT6100_VERSION_NUMBER_MAX_SIZE ]; - UINT32 ulBuildId; - - tOCT6100_CHIP_TONE_INFO aToneInfo[ cOCT6100_MAX_TONE_EVENT ]; - -} tOCT6100_CHIP_IMAGE_INFO, *tPOCT6100_CHIP_IMAGE_INFO; - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ChipGetStatsDef( - OUT tPOCT6100_CHIP_STATS f_pChipStats ); - -UINT32 Oct6100ChipGetStats( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CHIP_STATS f_pChipStats ); - -UINT32 Oct6100ChipGetImageInfoDef( - OUT tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo ); - -UINT32 Oct6100ChipGetImageInfo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo ); - -#endif /* __OCT6100_CHIP_STATS_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_inst.h deleted file mode 100644 index f49a473b..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_inst.h +++ /dev/null @@ -1,104 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_conf_bridge_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_conf_bridge.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_conf_bridge_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 19 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CONF_BRIDGE_INST_H__ -#define __OCT6100_CONF_BRIDGE_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_CONF_BRIDGE_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Entry counter for the resources. */ - UINT8 byEntryOpenCnt; - - /* Next bridge pointer. */ - UINT16 usNextBridgePtr; - - /* Previous bridge pointer. */ - UINT16 usPrevBridgePtr; - - /* Number of clients connected to the bridge. */ - UINT16 usNumClients; - - /* Store the index of the load event, to diffentiate him form the accumulate. */ - UINT16 usLoadIndex; - - /* Pointer to the first bridge events.*/ - UINT16 usFirstLoadEventPtr; - UINT16 usFirstSubStoreEventPtr; - UINT16 usLastSubStoreEventPtr; - - /* Pointer to the silence load event, if it exists. */ - UINT16 usSilenceLoadEventPtr; - - /* Flag specifying whether the dominant speaker is set or not. */ - UINT16 usDominantSpeakerChanIndex; - UINT8 fDominantSpeakerSet; - - /* Flag specifying if this is flexible conferencing bridge. */ - UINT8 fFlexibleConferencing; - - /* Number of clients being tapped. */ - UINT16 usNumTappedClients; - -} tOCT6100_API_CONF_BRIDGE, *tPOCT6100_API_CONF_BRIDGE; - -typedef struct _OCT6100_API_FLEX_CONF_PARTICIPANT_ -{ - /* Input port of the conferencing for this participant. */ - UINT32 ulInputPort; - - /* Whether the flexible mixer has been created. */ - UINT8 fFlexibleMixerCreated; - - /* Listener mask ( who can hear us ). */ - UINT32 ulListenerMask; - - /* Our index in the listener mask. */ - UINT32 ulListenerMaskIndex; - - /* Mixer event indexes for this participant's mixer. */ - UINT16 ausLoadOrAccumulateEventIndex[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - -} tOCT6100_API_FLEX_CONF_PARTICIPANT, *tPOCT6100_API_FLEX_CONF_PARTICIPANT; - -#endif /* __OCT6100_CONF_BRIDGE_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_pub.h deleted file mode 100644 index 4ecea7b0..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_conf_bridge_pub.h +++ /dev/null @@ -1,169 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_conf_bridge_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_conf_bridge.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_conf_bridge_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 22 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CONF_BRIDGE_PUB_H__ -#define __OCT6100_CONF_BRIDGE_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_CONF_BRIDGE_OPEN_ -{ - PUINT32 pulConfBridgeHndl; /* Handle returned when the bridge is opened. */ - BOOL fFlexibleConferencing; - -} tOCT6100_CONF_BRIDGE_OPEN, *tPOCT6100_CONF_BRIDGE_OPEN; - -typedef struct _OCT6100_CONF_BRIDGE_CLOSE_ -{ - UINT32 ulConfBridgeHndl; - -} tOCT6100_CONF_BRIDGE_CLOSE, *tPOCT6100_CONF_BRIDGE_CLOSE; - -typedef struct _OCT6100_CONF_BRIDGE_CHAN_ADD_ -{ - UINT32 ulConfBridgeHndl; - UINT32 ulChannelHndl; - UINT32 ulInputPort; - UINT32 ulListenerMaskIndex; - UINT32 ulListenerMask; - BOOL fMute; - UINT32 ulTappedChannelHndl; - -} tOCT6100_CONF_BRIDGE_CHAN_ADD, *tPOCT6100_CONF_BRIDGE_CHAN_ADD; - -typedef struct _OCT6100_CONF_BRIDGE_CHAN_REMOVE_ -{ - UINT32 ulConfBridgeHndl; - UINT32 ulChannelHndl; - BOOL fRemoveAll; - -} tOCT6100_CONF_BRIDGE_CHAN_REMOVE, *tPOCT6100_CONF_BRIDGE_CHAN_REMOVE; - -typedef struct _OCT6100_CONF_BRIDGE_CHAN_MUTE_ -{ - UINT32 ulChannelHndl; - -} tOCT6100_CONF_BRIDGE_CHAN_MUTE, *tPOCT6100_CONF_BRIDGE_CHAN_MUTE; - -typedef struct _OCT6100_CONF_BRIDGE_CHAN_UNMUTE_ -{ - UINT32 ulChannelHndl; - -} tOCT6100_CONF_BRIDGE_CHAN_UNMUTE, *tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE; - -typedef struct _OCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET_ -{ - UINT32 ulConfBridgeHndl; - UINT32 ulChannelHndl; - -} tOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET, *tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET; - -typedef struct _OCT6100_CONF_BRIDGE_MASK_CHANGE_ -{ - UINT32 ulChannelHndl; - UINT32 ulNewListenerMask; - -} tOCT6100_CONF_BRIDGE_MASK_CHANGE, *tPOCT6100_CONF_BRIDGE_MASK_CHANGE; - -typedef struct _OCT6100_CONF_BRIDGE_STATS_ -{ - UINT32 ulConfBridgeHndl; - UINT32 ulNumChannels; - UINT32 ulNumTappedChannels; - BOOL fFlexibleConferencing; - -} tOCT6100_CONF_BRIDGE_STATS, *tPOCT6100_CONF_BRIDGE_STATS; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ConfBridgeOpenDef( - OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ); -UINT32 Oct6100ConfBridgeOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ); - -UINT32 Oct6100ConfBridgeCloseDef( - OUT tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ); -UINT32 Oct6100ConfBridgeClose( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ); - -UINT32 Oct6100ConfBridgeChanAddDef( - OUT tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ); -UINT32 Oct6100ConfBridgeChanAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ); - -UINT32 Oct6100ConfBridgeChanRemoveDef( - OUT tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ); -UINT32 Oct6100ConfBridgeChanRemove( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ); - -UINT32 Oct6100ConfBridgeChanMuteDef( - OUT tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ); -UINT32 Oct6100ConfBridgeChanMute( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ); - -UINT32 Oct6100ConfBridgeChanUnMuteDef( - OUT tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ); -UINT32 Oct6100ConfBridgeChanUnMute( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ); - -UINT32 Oct6100ConfBridgeDominantSpeakerSetDef( - OUT tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ); -UINT32 Oct6100ConfBridgeDominantSpeakerSet( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ); - -UINT32 Oct6100ConfBridgeMaskChangeDef( - OUT tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ); -UINT32 Oct6100ConfBridgeMaskChange( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ); - -UINT32 Oct6100ConfBridgeGetStatsDef( - OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ); -UINT32 Oct6100ConfBridgeGetStats( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ); - -#endif /* __OCT6100_CONF_BRIDGE_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_inst.h deleted file mode 100644 index 6a6f573e..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_inst.h +++ /dev/null @@ -1,124 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_debug_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_debug.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_debug_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 10 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_DEBUG_INST_H__ -#define __OCT6100_DEBUG_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_DEBUG_ -{ - /* Information from the TLVs. */ - UINT32 ulDebugEventSize; - UINT32 ulMatrixBaseAddress; - UINT32 ulDebugChanStatsByteSize; - UINT32 ulDebugChanLiteStatsByteSize; - UINT32 ulHotChannelSelectBaseAddress; - UINT32 ulMatrixTimestampBaseAddress; - UINT32 ulAfWritePtrByteOffset; - UINT32 ulRecordedPcmEventByteSize; - UINT32 ulMatrixWpBaseAddress; - - /* Pouch counter presence in the image. */ - UINT8 fPouchCounter; - - /* Record channel indexes. */ - UINT16 usRecordMemIndex; - UINT16 usRecordChanIndex; - - UINT16 usRecordRinRoutTsiMemIndex; - UINT16 usRecordSinSoutTsiMemIndex; - - /* Debug channel information.*/ - UINT16 usCurrentDebugChanIndex; - - /* Matrix event mask. */ - UINT16 usMatrixCBMask; - - /* If data is being dumped now. */ - UINT8 fDebugDataBeingDumped; - - /* Index of the last event retrieved. */ - UINT16 usLastDebugEventIndex; - - /* Number of events to retrieve. */ - UINT16 usNumEvents; - - /* Chip debug event write ptr. */ - UINT16 usChipDebugEventWritePtr; - - /* Hot channel read data. */ - UINT16 ausHotChannelData[ 2 ]; - - /* Last PCM sample index. */ - UINT32 ulLastPcmSampleIndex; - - /* Last AF log read pointer. */ - UINT16 usLastAfLogReadPtr; - - /* AF log hardware write pointer. */ - UINT16 usAfLogWritePtr; - - /* Last tone event index retrieved. */ - UINT16 usLastToneEventIndex; - - /* Whether the image version string has been copied in the user buffer. */ - BOOL fImageVersionCopied; - - /* Whether the api version string has been copied in the user buffer. */ - BOOL fApiVersionCopied; - - /* Total number of bytes that will be returned for the current dump. */ - UINT32 ulDebugDataTotalNumBytes; - - /* Field to detect if the ISR is called present? */ - BOOL fIsIsrCalledField; - - /* Remaining number of bytes that will be returned for the current dump. */ - UINT32 ulDebugDataRemainingNumBytes; - - /* AF events control block size. */ - UINT32 ulAfEventCbByteSize; - - /* Current user selected data mode. Must be kept constant throughout a debug session. */ - UINT32 ulCurrentGetDataMode; - -} tOCT6100_API_DEBUG, *tPOCT6100_API_DEBUG; - -#endif /* __OCT6100_DEBUG_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_pub.h deleted file mode 100644 index 097ecc6f..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_debug_pub.h +++ /dev/null @@ -1,76 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_debug_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_debug.c. All elements defined in this file are for public - usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_DEBUG_PUB_H__ -#define __OCT6100_DEBUG_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_DEBUG_SELECT_CHANNEL_ -{ - UINT32 ulChannelHndl; - -} tOCT6100_DEBUG_SELECT_CHANNEL, *tPOCT6100_DEBUG_SELECT_CHANNEL; - -typedef struct _OCT6100_DEBUG_GET_DATA_ -{ - UINT32 ulGetDataMode; - UINT32 ulGetDataContent; - UINT32 ulRemainingNumBytes; - UINT32 ulTotalNumBytes; - UINT32 ulMaxBytes; - UINT32 ulValidNumBytes; - PUINT8 pbyData; - -} tOCT6100_DEBUG_GET_DATA, *tPOCT6100_DEBUG_GET_DATA; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100DebugSelectChannelDef( - OUT tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ); -UINT32 Oct6100DebugSelectChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ); - -UINT32 Oct6100DebugGetDataDef( - OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); -UINT32 Oct6100DebugGetData( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); - -#endif /* __OCT6100_DEBUG_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_defines.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_defines.h deleted file mode 100644 index ab7aab88..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_defines.h +++ /dev/null @@ -1,670 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_defines.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Header file containing all defines used throughout the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.7 - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 171 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_DEFINES_H__ -#define __OCT6100_DEFINES_H__ - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -/***************************** DEFINES *************************************/ - -/* 32-bits values. */ -#define cOCT6100_FFFFFFFF 0xFFFFFFFF -#define cOCT6100_FFFFFFFE 0xFFFFFFFE -#define cOCT6100_7FFFFFFF 0x7FFFFFFF - -/* 16-bits values. */ -#define cOCT6100_FFFD 0xFFFD -#define cOCT6100_FFFE 0xFFFE -#define cOCT6100_FFFF 0xFFFF -#define cOCT6100_7FFF 0x7FFF - -/* 8-bits values. */ -#define cOCT6100_FF 0xFF - -#define cOCT6100_CURRENT_VALUE cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_CHIP_ID cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_HANDLE cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_TIMESLOT cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_STREAM cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_VALUE cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_STAT cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_STAT_W cOCT6100_FFFF -#define cOCT6100_INVALID_PCM_LAW cOCT6100_FF -#define cOCT6100_INVALID_EVENT cOCT6100_FFFF -#define cOCT6100_INVALID_INDEX cOCT6100_FFFF -#define cOCT6100_INVALID_TONE cOCT6100_FFFFFFFF -#define cOCT6100_INVALID_PORT cOCT6100_FF - -#define cOCT6100_AUTO_SELECT cOCT6100_FFFFFFFE -#define cOCT6100_AUTO_SELECT_TAIL cOCT6100_FFFE - -#define cOCT6100_INVALID_BOOL 2 - -#define cOCT6100_KEEP_PREVIOUS_SETTING 0x70100000 - -#define cOCT6100_INVALID_SIGNED_STAT cOCT6100_7FFFFFFF -#define cOCT6100_INVALID_SIGNED_STAT_W cOCT6100_7FFF -#define cOCT6100_INVALID_ECHO_DELAY 0x400 - - - -#define cOCT6100_SIZE_128 128 -#define cOCT6100_SIZE_256 256 -#define cOCT6100_SIZE_512 512 -#define cOCT6100_SIZE_1K 1024 -#define cOCT6100_SIZE_2K 2048 -#define cOCT6100_SIZE_4K 4096 -#define cOCT6100_SIZE_8K 8192 -#define cOCT6100_SIZE_16K 16384 -#define cOCT6100_SIZE_32K 32768 -#define cOCT6100_SIZE_64K 65536 -#define cOCT6100_SIZE_128K 131072 -#define cOCT6100_SIZE_256K 262144 -#define cOCT6100_SIZE_512K 524288 -#define cOCT6100_SIZE_1M 1048576 -#define cOCT6100_SIZE_2M 2097152 -#define cOCT6100_SIZE_4M 4194304 -#define cOCT6100_SIZE_8M 8388608 -#define cOCT6100_SIZE_16M 16777216 -#define cOCT6100_SIZE_32M 33554432 -#define cOCT6100_SIZE_64M 67108864 -#define cOCT6100_SIZE_128M 134217728 -#define cOCT6100_SIZE_256M 268435456 -#define cOCT6100_SIZE_512M 536870912 -#define cOCT6100_SIZE_1G 1073741824 -#define cOCT6100_SIZE_2G 2147483648 - -#define cOCT6100_HNDL_TAG_MASK 0xFF000000 -#define cOCT6100_HNDL_INDEX_MASK 0x0000FFFF -#define cOCT6100_ENTRY_OPEN_CNT_MASK 0x000000FF -#define cOCT6100_ENTRY_OPEN_CNT_SHIFT 16 - -#define cOCT6100_HNDL_TAG_INVALID 0xFF000000 - -#define cOCT6100_HNDL_TAG_CHANNEL 0x01000000 -#define cOCT6100_HNDL_TAG_TSI_CNCT 0x02000000 -#define cOCT6100_HNDL_TAG_CONF_BRIDGE 0x03000000 -#define cOCT6100_HNDL_TAG_PHASING_TSST 0x04000000 -#define cOCT6100_HNDL_TAG_BIDIR_CHANNEL 0x05000000 -#define cOCT6100_HNDL_TAG_COPY_EVENT 0x06000000 -#define cOCT6100_HNDL_TAG_ADPCM_CHANNEL 0x07000000 - -#define cOCT6100_INVALID_HANDLE_TYPE cOCT6100_INVALID_VALUE - -#define cOCT6100_MEMORY_ROUND_SIZE 16 - -#define mOCT6100_ROUND_MEMORY_SIZE( ulMemorySize, ulTempVar ) \ - if ((ulTempVar = ulMemorySize % cOCT6100_MEMORY_ROUND_SIZE) != 0) \ - ulMemorySize += cOCT6100_MEMORY_ROUND_SIZE - ulTempVar; - -#define mOCT6100_ROUND_ADDRESS( ulAddress, ulBoundary, ulTempVar ) \ - if ((ulTempVar = ulAddress % ulBoundary) != 0) \ - ulAddress += ulBoundary - ulTempVar; - -#define cOCT6100_INTERNAL_CLOCK_SOURCE 0 -#define cOCT6100_EXTERNAL_CLOCK_SOURCE 1 - -#define cOCT6100_ACTIVE_HIGH_POLARITY 0 -#define cOCT6100_ACTIVE_LOW_POLARITY 1 - -#define cOCT6100_TDM_SAMPLE_AT_3_QUARTERS 0 -#define cOCT6100_TDM_SAMPLE_AT_RISING_EDGE 1 -#define cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE 2 - -#define cOCT6100_TDM_STREAM_FREQ_2MHZ 0 -#define cOCT6100_TDM_STREAM_FREQ_4MHZ 1 -#define cOCT6100_TDM_STREAM_FREQ_8MHZ 2 -#define cOCT6100_TDM_STREAM_FREQ_16MHZ 3 - -#define cOCT6100_TDM_STREAM_MAX_GROUPS 8 - -#define cOCT6100_PCM_U_LAW 0 -#define cOCT6100_PCM_A_LAW 1 -#define cOCT6100_PCM_UNCHANGED 2 -#define cOCT6100_ADPCM_ENCODED 3 - -#define cOCT6100_INTERRUPT_DISABLE 0 -#define cOCT6100_INTERRUPT_NO_TIMEOUT 1 -#define cOCT6100_INTERRUPT_TIMEOUT 2 - -#define cOCT6100_NUMBER_TSSTS_1 1 -#define cOCT6100_NUMBER_TSSTS_2 2 - -#define cOCT6100_G711_64KBPS 1 -#define cOCT6100_G726_40KBPS 2 -#define cOCT6100_G726_32KBPS 3 -#define cOCT6100_G726_24KBPS 4 -#define cOCT6100_G726_16KBPS 5 -#define cOCT6100_G727_40KBPS_4_1 6 -#define cOCT6100_G727_40KBPS_3_2 7 -#define cOCT6100_G727_40KBPS_2_3 8 -#define cOCT6100_G727_32KBPS_4_0 9 -#define cOCT6100_G727_32KBPS_3_1 10 -#define cOCT6100_G727_32KBPS_2_2 11 -#define cOCT6100_G727_24KBPS_3_0 12 -#define cOCT6100_G727_24KBPS_2_1 13 -#define cOCT6100_G727_16KBPS_2_0 14 -#define cOCT6100_G726_ENCODED 15 -#define cOCT6100_G711_G726_ENCODED 16 -#define cOCT6100_G711_G727_2C_ENCODED 17 -#define cOCT6100_G711_G727_3C_ENCODED 18 -#define cOCT6100_G711_G727_4C_ENCODED 19 -#define cOCT6100_G727_2C_ENCODED 20 -#define cOCT6100_G727_3C_ENCODED 21 -#define cOCT6100_G727_4C_ENCODED 22 - -#define cOCT6100_ADPCM_IN_HIGH_BITS 0 -#define cOCT6100_ADPCM_IN_LOW_BITS 1 - -/* The values of these defines must not change. */ -#define cOCT6100_H100_TRACKA 0 -#define cOCT6100_H100_TRACKB 1 -#define cOCT6100_H100_TRACKA_FALLBACKB 2 -#define cOCT6100_H100_TRACKB_FALLBACKA 3 -#define cOCT6100_H100_DISABLED 4 -#define cOCT6100_H100_MASTERA 5 -#define cOCT6100_H100_BACKUPA 6 -#define cOCT6100_H100_MASTERB 7 -#define cOCT6100_H100_BACKUPB 8 - -#define cOCT6100_FREE_TSST 0 -#define cOCT6100_RX_TSST 16 -#define cOCT6100_TX_TSST 32 - -#define cOCT6100_INTRPT_ACTIVE 0 -#define cOCT6100_INTRPT_WILL_TIMEOUT 1 -#define cOCT6100_INTRPT_IN_TIMEOUT 2 -#define cOCT6100_INTRPT_DISABLED 3 - -#define cOCT6100_EXTERNAL_MEM_BIST_TIMEOUT 1000000 - -/* Clocks defines */ -#define cOCT6100_UPCLK_FREQ_33_33_MHZ 33333333 - -#define cOCT6100_MCLK_FREQ_133_MHZ 133000000 -#define cOCT6100_MCLK_FREQ_125_MHZ 125000000 -#define cOCT6100_MCLK_FREQ_117_MHZ 117000000 -#define cOCT6100_MCLK_FREQ_108_MHZ 108000000 -#define cOCT6100_MCLK_FREQ_100_MHZ 100000000 -#define cOCT6100_MCLK_FREQ_92_MHZ 92000000 -#define cOCT6100_MCLK_FREQ_83_MHZ 83000000 -#define cOCT6100_MCLK_FREQ_75_MHZ 75000000 - -/* Tone buffer defines.*/ -#define cOCT6100_MAX_NUM_TONE_BUFFERS 1344 -#define cOCT6100_MAX_TONES_PER_CALL 32 - -/* Memory defines.*/ -#define cOCT6100_MEM_TYPE_SDR 0 -#define cOCT6100_MEM_TYPE_DDR 1 -#define cOCT6100_MEM_TYPE_SDR_PLL_BYPASS 2 - -#define cOCT6100_MEMORY_CHIP_SIZE_8MB cOCT6100_SIZE_8M -#define cOCT6100_MEMORY_CHIP_SIZE_16MB cOCT6100_SIZE_16M -#define cOCT6100_MEMORY_CHIP_SIZE_32MB cOCT6100_SIZE_32M -#define cOCT6100_MEMORY_CHIP_SIZE_64MB cOCT6100_SIZE_64M -#define cOCT6100_MEMORY_CHIP_SIZE_128MB cOCT6100_SIZE_128M - -#define cOCT6100_MAX_NUM_MEMORY_CHIP 2 - -#define cOCT6100_16MB_MEMORY_BANKS 0 -#define cOCT6100_32MB_MEMORY_BANKS 1 -#define cOCT6100_64MB_MEMORY_BANKS 2 -#define cOCT6100_128MB_MEMORY_BANKS 3 - -#define cOCT6100_1_MEMORY_BANKS 0 -#define cOCT6100_2_MEMORY_BANKS 1 -#define cOCT6100_3_MEMORY_BANKS 2 -#define cOCT6100_4_MEMORY_BANKS 3 - -/* Chip open defines.*/ -#define cOCT6100_INTERNAL_TONE_ARRAY_SIZE 256 /* in words.*/ -#define cOCT6100_INTERNAL_SUPER_ARRAY_SIZE 1024 /* in words.*/ - -/* Internal memory mapping.*/ - -/*=======================================================================*/ -#define cOCT6100_TSST_CONTROL_MEM_BASE 0x26000 - -#define cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE 2 /* Each entries are 2 bytes.*/ -#define cOCT6100_TSST_CONTROL_MEM_INPUT_TSST 0x0800 -#define cOCT6100_TSST_CONTROL_MEM_OUTPUT_TSST 0x2000 - -#define cOCT6100_TSST_CONTROL_MEM_PCM_LAW_OFFSET 12 -#define cOCT6100_TSST_CONTROL_MEM_NIBBLE_POS_OFFSET 11 -#define cOCT6100_TSST_CONTROL_MEM_TSST_NUM_OFFSET 12 - -#define cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK 0x7FF - -#define cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY 1344 -#define cOCT6100_TSST_CONTROL_TIMESTAMP_BASE_ENTRY 1516 - -/*=======================================================================*/ -#define cOCT6100_CONVERSION_CONTROL_MEM_BASE 0x28000 - -/* Each entries are 8 bytes but an 8 bytes mixer entry is located inbetween each entry.*/ -#define cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE 16 -#define cOCT6100_CONVERSION_CONTROL_MEM_ENCODER 0x0000 -#define cOCT6100_CONVERSION_CONTROL_MEM_DECODER 0x8000 -#define cOCT6100_CONVERSION_CONTROL_MEM_ACTIVATE_ENTRY 0x8000 -#define cOCT6100_CONVERSION_CONTROL_MEM_RST_ON_NEXT_FR 0x8000 - -#define cOCT6100_CONVERSION_CONTROL_MEM_PHASE_OFFSET 12 -#define cOCT6100_CONVERSION_CONTROL_MEM_NIBBLE_POS_OFFSET 9 -#define cOCT6100_CONVERSION_CONTROL_MEM_COMP_OFFSET 11 -#define cOCT6100_CONVERSION_CONTROL_MEM_LAW_OFFSET 8 -#define cOCT6100_CONVERSION_CONTROL_MEM_SIL_SUP_OFFSET 8 - -#define cOCT6100_CONVERSION_CONTROL_PHASE_SIZE_BASE_ADD 0x5400 - -/*=======================================================================*/ -#define cOCT6100_MIXER_CONTROL_MEM_BASE 0x28008 - -/* Each entries are 8 bytes but an 8 bytes mixer entry is located inbetween each entry.*/ -#define cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE 16 -#define cOCT6100_MIXER_CONTROL_MEM_SUB_STORE 0xA000 -#define cOCT6100_MIXER_CONTROL_MEM_STORE 0x8000 -#define cOCT6100_MIXER_CONTROL_MEM_LOAD 0x4000 -#define cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE 0x6000 -#define cOCT6100_MIXER_CONTROL_MEM_COPY 0x2000 -#define cOCT6100_MIXER_CONTROL_MEM_NO_OP 0x0000 - -#define cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET 11 - -#define cOCT6100_MIXER_HEAD_NODE 0 -#define cOCT6100_MIXER_TAIL_NODE 1 -#define cOCT6100_MIXER_RECORD_COPY_NODE 2 - -/*=======================================================================*/ -#define cOCT6100_ECHO_CONTROL_MEM_BASE 0x14000 - -#define cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE 4 /* Each entries are 8 bytes.*/ -#define cOCT6100_ECHO_CONTROL_MEM_ACTIVATE_ENTRY 0x8000 -#define cOCT6100_ECHO_CONTROL_MEM_EXTERNAL_AF_CTRL 0x2000 - -#define cOCT6100_ECHO_CONTROL_MEM_DEBUG_OFFSET 14 -#define cOCT6100_ECHO_CONTROL_MEM_AF_CONTROL 14 -#define cOCT6100_ECHO_CONTROL_MEM_INPUT_LAW_OFFSET 12 -#define cOCT6100_ECHO_CONTROL_MEM_OUTPUT_LAW_OFFSET 11 - -#define cOCT6100_ECHO_CONTROL_MEM_TSI_MEM_MASK 0x7FF - -/*=======================================================================*/ -#define cOCT6100_ST_CONTROL_MEM_BASE 0x2000000 - -#define cOCT6100_ST_CONTROL_MEM_ENTRY_SIZE 16 /* Each entries are 8 bytes.*/ - -/*=======================================================================*/ -#define cOCT6100_PART1_BASE 0x00080000 -#define cOCT6100_PART1_CPU_LSU_CB_BASE cOCT6100_PART1_BASE+0x0000E3C0 /* 8 * 8 = 64 bytes */ -#define cOCT6100_PART1_HW_LSU_CB_BASE cOCT6100_PART1_BASE+0x0000E400 /* 8 * 128 = 1K byte */ -#define cOCT6100_PART1_END_STATICS_BASE cOCT6100_PART1_BASE+0x0000E9F0 /* 912 bytes available for your viewing pleasure. */ -#define cOCT6100_PART1_API_SCRATCH_PAD cOCT6100_PART1_END_STATICS_BASE+4+(12*8) -#define cOCT6100_PART1_EGO_REG cOCT6100_PART1_BASE+0x0007FF00 - -/* External Memory mapping. */ -#define cOCT6100_EXTERNAL_MEM_BLOCK_SIZE 1024 -#define cOCT6100_EXTERNAL_MEM_BASE_ADDRESS 0x08000000 - - -#define cOCT6100_TLV_BASE ( 0x00016000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) -#define cOCT6100_CHANNEL_ROOT_BASE ( 0x00020000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) -#define cOCT6100_PGSP_EVENT_OUT_BASE ( 0x002C0000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) -#define cOCT6100_POUCH_BASE ( 0x002E0000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) -#define cOCT6100_IMAGE_FILE_BASE ( 0x00300000 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) - -#define cOCT6100_CHANNEL_ROOT_SIZE 4096 -#define cOCT6100_CHANNEL_ROOT_TOTAL_SIZE ( 672 * cOCT6100_CHANNEL_ROOT_SIZE ) -#define cOCT6100_PGSP_EVENT_OUT_SIZE 131072 -#define cOCT6100_PGSP_TONE_EVENT_SIZE 0x40 -#define cOCT6100_IMAGE_FILE_SIZE 0x100000 - -#define cOCT6100_MATRIX_TIMESTAMP_DWORD_ADD cOCT6100_POUCH_BASE + 0x8 -#define cOCT6100_MATRIX_CHAN_SELECT_DWORD_ADD cOCT6100_POUCH_BASE + 0x14 -#define cOCT6100_MATRIX_WRITE_PTR_DWORD_ADD cOCT6100_POUCH_BASE + 0x4 -#define cOCT6100_MATRIX_PLL_JITTER_COUNT_ADD cOCT6100_POUCH_BASE + 0x1C -#define cOCT6100_MATRIX_DWORD_BASE cOCT6100_POUCH_BASE + 0xE0000 - -#define cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET 0x0000 - -#define cOCT6100_NUM_WORDS_PER_TONE_EVENT 32 -#define cOCT6100_NUM_PGSP_EVENT_OUT 2048 -#define cOCT6100_VALID_TONE_EVENT 0x8000 -#define cOCT6100_LOCAL_TIMESTAMP_INCREMENT 32 /* 4 ms increment. */ -#define cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT 65535 -#define cOCT6100_MIN_TIMESLOT_FOR_TIMESTAMP 5 - - -/*=======================================================================*/ -#define cOCT6100_GSC_PGSP_CONTEXT_BASE_ADD_OFFSET 0x0C -#define cOCT6100_GSC_PGSP_INIT_CONTEXT_BASE_ADD_OFFSET 0x10 -#define cOCT6100_GSC_RIN_CIRC_BUFFER_BASE_ADD_OFFSET 0x14 -#define cOCT6100_GSC_SIN_CIRC_BUFFER_BASE_ADD_OFFSET 0x18 -#define cOCT6100_GSC_SOUT_CIRC_BUFFER_BASE_ADD_OFFSET 0x1C - -#define cOCT6100_GSC_BUFFER_LAW_OFFSET 27 - -/*=======================================================================*/ -#define cOCT6100_CH_MAIN_PGSP_CONTEXT_OFFSET 0x00000 -#define cOCT6100_CH_MAIN_TONE_EVENT_OFFSET 0x00488 - -/*=======================================================================*/ -#define cOCT6100_PLAYOUT_EVENT_REPEAT_OFFSET 31 -#define cOCT6100_PLAYOUT_EVENT_LAW_OFFSET 30 -#define cOCT6100_PLAYOUT_EVENT_MIX_OFFSET 28 -#define cOCT6100_PLAYOUT_EVENT_LOOP_TIMES_OFFSET 27 -#define cOCT6100_PLAYOUT_EVENT_GAIN_OFFSET 24 - -#define cOCT6100_PLAYOUT_EVENT_MEM_SIZE 16 - -/* Image related defines.*/ -#define cOCT6100_MIN_IMAGE_SIZE 0x001000 -#define cOCT6100_MAX_IMAGE_SIZE 0x100000 -#define cOCT6100_MAX_IMAGE_REGION 60 -#define cOCT6100_IMAGE_AF_CST_OFFSET 0x1000; - -/* Max defines.*/ -#define cOCT6100_MAX_ECHO_CHANNELS 672 -#define cOCT6100_MAX_TSI_CNCTS 1530 -#define cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS ( 3328 + 6 ) -#define cOCT6100_MAX_PLAYOUT_BUFFERS ( 1344 + cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS ) -#define cOCT6100_MAX_CONF_BRIDGE 672 -#define cOCT6100_MAX_FLEX_CONF_PARTICIPANTS cOCT6100_MAX_ECHO_CHANNELS -#define cOCT6100_MAX_PHASING_TSST 16 -#define cOCT6100_MAX_ADPCM_CHANNELS 672 - -#define cOCT6100_NUM_TSI_B4_PHASING 1344 -#define cOCT6100_TOTAL_TSI_CONTROL_MEM_ENTRY 1534 -#define cOCT6100_MAX_TSI_CONTROL_MEM_ENTRY 1344 -#define cOCT6100_MAX_ECHO_CONTROL_MEM_ENTRY 672 -#define cOCT6100_MAX_TSI_B4_TIMESTAMP 172 -#define cOCT6100_TSI_MEM_FOR_TIMESTAMP 4 -#define cOCT6100_API_EXT_TONE_EXTRA_TSI 1533 - -/* Echo channel ports */ -#define cOCT6100_CHANNEL_PORT_RIN 0 -#define cOCT6100_CHANNEL_PORT_ROUT 1 -#define cOCT6100_CHANNEL_PORT_SIN 2 -#define cOCT6100_CHANNEL_PORT_SOUT 3 -#define cOCT6100_CHANNEL_PORT_ROUT_SOUT 4 - -#define cOCT6100_NO_ENCODING 10 -#define cOCT6100_NO_DECODING 11 - -/* Buffer playout defines */ -#define cOCT6100_NO_SKIP 0 -#define cOCT6100_BUFFER_PLAYOUT_MIN_SIZE 1024 -#define cOCT6100_DEFAULT_TIMESTAMP 0 -#define cOCT6100_MIXING_0_DB 0 -#define cOCT6100_MIXING_MINUS_6_DB 1 -#define cOCT6100_MIXING_MINUS_12_DB 2 -#define cOCT6100_MIXING_MUTE 3 -#define cOCT6100_PLAYOUT_GAIN 0x41000000 -#define cOCT6100_PLAYOUT_EVENT 1 -#define cOCT6100_MINIMUM_BUFFER_SIZE 64 -#define cOCT6100_BUFFER_SIZE_GRANULARITY 16 -#define cOCT6100_REPEAT_INFINITELY cOCT6100_INVALID_VALUE -#define cOCT6100_REPEAT_MAX 32767 -#define cOCT6100_SAMPLES_PER_MS 8 - -/* For the playout events. */ -#define cOCT6100_MAX_BUFFER_PLAYOUT_EVENT_PER_CALL 32 -#define cOCT6100_MIN_BUFFER_PLAYOUT_EVENT 128 -#define cOCT6100_MAX_BUFFER_PLAYOUT_EVENT 65535 -/* Event types */ -#define cOCT6100_BUFFER_PLAYOUT_EVENT_INVALID cOCT6100_INVALID_VALUE -#define cOCT6100_BUFFER_PLAYOUT_EVENT_STOP 1 - - -/* Phasing defines.*/ -#define cOCT6100_SINGLE_PHASING 0 -#define cOCT6100_DUAL_PHASING 1 -#define cOCT6100_NO_PHASING 2 - -/* Echo canceller mode.*/ -#define cOCT6100_ELECTRIC_EC 0 -#define cOCT6100_ELECTRIC_EC_DISPLACEMENT 1 -#define cOCT6100_ACCOUSTIC_ES 2 - -/* Echo control modes.*/ -#define cOCT6100_ECHO_OP_MODE_NORMAL 0 -#define cOCT6100_ECHO_OP_MODE_HT_FREEZE 1 -#define cOCT6100_ECHO_OP_MODE_HT_RESET 2 -#define cOCT6100_ECHO_OP_MODE_POWER_DOWN 3 -#define cOCT6100_ECHO_OP_MODE_EXTERNAL 4 -#define cOCT6100_ECHO_OP_MODE_NO_ECHO 5 -#define cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION 6 -#define cOCT6100_ECHO_OP_MODE_G169_ALC cOCT6100_ECHO_OP_MODE_NO_ECHO - -/* 2100 Hz disabling configuration. */ -#define cOCT6100_NEVER_DISABLED 0 -#define cOCT6100_G164_2100_HZ 1 -#define cOCT6100_G165_2100_HZ_WITH_PHASE_REV 2 - -/* TSST defines.*/ -#define cOCT6100_UNASSIGNED cOCT6100_FFFD - -#define cOCT6100_MAX_TSSTS 4096 -#define cOCT6100_TWO_TSSTS_INDEX_MASK 0x8000 -#define cOCT6100_TSST_INDEX_MASK 0x7FFF -#define cOCT6100_INPUT_TSST 0 -#define cOCT6100_OUTPUT_TSST 1 - -/* Conference bridges defines.*/ -#define cOCT6100_MAX_MIXER_EVENTS 1344 -#define cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE 32 -#define cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED 672 -#define cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL cOCT6100_FFFFFFFE - -/* Conversion memory defines.*/ -#define cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS 1344 - -/* Tone detection defines.*/ -#define cOCT6100_MAX_TONE_NUMBER 55 - -/* Register definition and address. */ -#define cOCT6100_TONE_EVENT_WRITE_PTR_REG 0x722 -#define cOCT6100_TONE_EVENT_READ_PTR_REG 0x720 - -/* Special Signaling tone IDs. */ -#define cOCT6100_TONE_SIN_SYSTEM7_2000 0x20000023 -#define cOCT6100_TONE_SIN_SYSTEM7_1780 0x20000024 -#define cOCT6100_TONE_ROUT_G168_2100GB_ON 0x10000000 -#define cOCT6100_TONE_ROUT_G168_2100GB_WSPR 0x10000002 -#define cOCT6100_TONE_ROUT_G168_1100GB_ON 0x10000004 -#define cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A 0x10000005 -#define cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B 0x10000006 -#define cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE 0x10000008 -#define cOCT6100_TONE_SOUT_G168_2100GB_ON 0x40000000 -#define cOCT6100_TONE_SOUT_G168_2100GB_WSPR 0x40000002 -#define cOCT6100_TONE_SOUT_G168_1100GB_ON 0x40000004 -#define cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A 0x40000005 -#define cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B 0x40000006 -#define cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE 0x40000008 -#define cOCT6100_TONE_SIN_SYSTEM5_2400 0x20000020 -#define cOCT6100_TONE_SIN_SYSTEM5_2600 0x20000021 -#define cOCT6100_TONE_SIN_SYSTEM5_2400_2600 0x20000022 - -#define cOCT6100_CHIP_ID_REVISION_REG 0x17E - -/* BOOT type. */ -#define cOCT6100_AF_BOOT_TYPE 0x5 -#define cOCT6100_PRODUCTION_BOOT_TYPE 0x7 -#define cOCT6100_PRODUCTION_SHORT_BOOT_TYPE 0x8 - -/*Production Bist Modes*/ -#define cOCT6100_PRODUCTION_BIST_STANDARD 0x0 -#define cOCT6100_PRODUCTION_BIST_SHORT 0x1 - -/* Interrupt register masks.*/ -#define cOCT6100_INTRPT_MASK_REG_102H 0x0001 -#define cOCT6100_INTRPT_MASK_REG_202H 0x1C01 -#define cOCT6100_INTRPT_MASK_REG_302H 0xF100 -#define cOCT6100_INTRPT_MASK_REG_502H 0x0002 -#define cOCT6100_INTRPT_MASK_REG_702H 0x0002 - -#define cOCT6100_DECODER_MEMORY_OFFSET 672 - -/* Debug defines.*/ -#define cOCT6100_DEBUG_MAX_READ_LENGTH 10240 -#define cOCT6100_DEBUG_SOUT_MAX_READ_LENGTH 2560 -#define cOCT6100_DEBUG_CHAN_RECORD_INDEX 64 -#define cOCT6100_DEBUG_RECORD_BUFFER_BYTE_SIZE 0x20000 -#define cOCT6100_DEBUG_RECORD_MATRIX_SIZE 0x8000 -#define cOCT6100_DEBUG_RECORD_READ_DATA_BYTE_SIZE 1024 -#define cOCT6100_DEBUG_RECORD_BLOCK_BYTE_SIZE 0x1000 - -/* Tone event defines.*/ -#define cOCT6100_MAX_TONE_EVENT 56 -#define cOCT6100_TONE_PRESENT 0 -#define cOCT6100_TONE_STOP 1 -#define cOCT6100_TONE_REFRESH 2 - -/* TLV defines.*/ -#define cOCT6100_TLV_MAX_ADDRESS 0x10000000 -#define cOCT6100_TLV_MAX_TONE_NAME_SIZE 64 - -#define cOCT6100_VERSION_NUMBER_MAX_SIZE 1016 - -/* Echo Tail defines.*/ -#define cOCT6100_TAIL_LENGTH_32MS 32 -#define cOCT6100_TAIL_LENGTH_64MS 64 -#define cOCT6100_TAIL_LENGTH_128MS 128 -#define cOCT6100_MAX_ECHO_TAIL_DISPLACEMENT 5600 /* In milliseconds */ - - - - - -/* Generic loop counter.*/ -#define cOCT6100_MAX_LOOP 0x2000 -/* CPU boot timeout counter. */ -#define cOCT6100_MAX_LOOP_CPU_TIMEOUT 0x20000 - -/* Automatic level control */ -#define cOCT6100_PASS_THROUGH_LEVEL_CONTROL 0x90 - -/* Channel stats debug info */ -#define cOCT6100_DEBUG_CHAN_STATS_EVENT_BYTE_SIZE 1024 -#define cOCT6100_DEBUG_CHAN_STATS_LITE_EVENT_BYTE_SIZE 720 - -/* Image start string define */ -#define cOCT6100_IMAGE_START_STRING "EDS3_IMAGE_NAME" - -/* Tone image info defines.*/ -#define cOCT6100_TONE_INFO_START_STRING "[ToneDetectorInfo]" -#define cOCT6100_TONE_INFO_STOP_STRING "[~ToneDetectorInfo]" -#define cOCT6100_TONE_INFO_EVENT_STRING "TONEEVENT=0x" - -#define cOCT6100_MAX_NLP_CONF_DWORD 20 - -/* Tail displacement info.*/ -#define cOCT6100_MAX_TAIL_DISPLACEMENT 896 - -/* Comfort noise define */ -#define cOCT6100_COMFORT_NOISE_NORMAL 0x0 -#define cOCT6100_COMFORT_NOISE_EXTENDED 0x3 -#define cOCT6100_COMFORT_NOISE_OFF 0x2 -#define cOCT6100_COMFORT_NOISE_FAST_LATCH 0x1 - -/* Mixer event type.*/ -#define cOCT6100_EVENT_TYPE_SOUT_COPY 0x0 -#define cOCT6100_EVENT_TYPE_SIN_COPY 0x1 - -/* Tone disabler status.*/ -#define cOCT6100_TONE_DISABLER_EC_ENABLED 0 -#define cOCT6100_TONE_DISABLER_EC_DISABLED 1 - -/* ADPCM Channel defines */ -#define cOCT6100_ADPCM_ENCODING 0 -#define cOCT6100_ADPCM_DECODING 1 - -/* Double talk behavior modes. */ -#define cOCT6100_DOUBLE_TALK_BEH_NORMAL 0x0 -#define cOCT6100_DOUBLE_TALK_BEH_LESS_AGGRESSIVE 0x1 - -/* Api Version string length.*/ -#define cOCT6100_API_VERSION_STRING_LENGTH 32 - -/* Extended tone detection information. */ -#define cOCT6100_API_EXT_TONE_DISABLED 0 -#define cOCT6100_API_EXT_TONE_SIN_PORT_MODE 1 -#define cOCT6100_API_EXT_TONE_RIN_PORT_MODE 2 - - - -/* Mute/UnMute defines. */ -#define cOCT6100_CHANNEL_MUTE_PORT_NONE 0x00 -#define cOCT6100_CHANNEL_MUTE_PORT_RIN 0x01 -#define cOCT6100_CHANNEL_MUTE_PORT_ROUT 0x02 -#define cOCT6100_CHANNEL_MUTE_PORT_SIN 0x04 -#define cOCT6100_CHANNEL_MUTE_PORT_SOUT 0x08 -#define cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES 0x10 - -/* Debug get data dump modes. */ -#define cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE 0x0 -#define cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE 0x1 -#define cOCT6100_DEBUG_GET_DATA_MODE_16S 0x2 -#define cOCT6100_DEBUG_GET_DATA_MODE_120S 0x3 - -/* Debug get data dump content. */ -#define cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE 0x0 /* Full binary dump to be sent for support. */ -#define cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM 0x1 /* Only Rin PCM stream data. */ -#define cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM 0x2 /* Only Sin PCM stream data. */ -#define cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM 0x3 /* Only Sout PCM stream data. */ - - - -#define cOCT6100_BIST_IN_PROGRESS 0x0 -#define cOCT6100_BIST_CONFIGURATION_FAILED 0x1 -#define cOCT6100_BIST_STATUS_CRC_FAILED 0x2 -#define cOCT6100_BIST_MEMORY_FAILED 0x3 -#define cOCT6100_BIST_SUCCESS 0x4 - -/* Image types. */ -#define cOCT6100_IMAGE_TYPE_WIRELINE 0x0 -#define cOCT6100_IMAGE_TYPE_COMBINED 0x1 - -/* Fatal general error types. */ -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_1 0x0001 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_2 0x0002 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_3 0x0004 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_4 0x0008 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_5 0x0010 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_6 0x0020 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_7 0x0040 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_8 0x0080 -#define cOCT6100_FATAL_GENERAL_ERROR_TYPE_9 0x0100 - -#endif /* __OCT6100_DEFINES_H__ */ - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_errors.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_errors.h deleted file mode 100644 index a123762c..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_errors.h +++ /dev/null @@ -1,838 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_errors.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Header file containing all defines used for error codes. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 205 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_ERRORS_H__ -#define __OCT6100_ERRORS_H__ - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -/***************************** DEFINES *************************************/ - -#define cOCT6100_ERR_OK 0x00000000 -#define cOCT6100_ERR_BASE 0x00100000 - -#define cOCT6100_NOT_SUPPORTED_BASE (0xFF000 + cOCT6100_ERR_BASE) - -/* Not supported defines. */ -#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_DEBUG_RECORD (0x00000 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLP_CONTROL (0x00001 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_BKG_NOISE_FREEZE (0x00002 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_DC_OFFSET_REM (0x00003 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_DC_OFFSET_REM (0x00004 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_AUTO_LC (0x00005 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SOUT_AUTO_LC (0x00006 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR (0x00007 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_DISPLACEMENT (0x00008 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ENCODING (0x00009 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DECODING (0x0000A + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_LAW_TRANSLATION (0x0000B + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO (0x0000C + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DEFAULT_ERL (0x0000D + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DOUBLE_TALK (0x0000E + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NON_LINEARITY_B (0x0000F + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_AEC_DEFAULT_ERL (0x00010 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_HIGH_LEVEL_COMP (0x00011 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_PER_CHAN_TAIL (0x00012 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIL_SUP (0x00013 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_ACOUSTIC_ECHO (0x00014 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_TAIL_DISPLACEMENT_VALUE (0x00015 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE (0x00016 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ALE (0x00017 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLE (0x00018 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NR (0x00019 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_MUTE_FEATURES (0x0001A + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SNR_ENHANCEMENT (0x0001B + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SEGREGATION (0x0001C + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_OPEN_USE_SYNCH_TIMESTAMP (0x0001D + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_LENGTH (0x0001E + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY (0x0001F + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH (0x00020 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_MUSIC_PROTECTION (0x00021 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_DEBUG_DATA_MODE_120S (0x00022 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_TONE_NOT_PRESENT_IN_FIRMWARE (0x00023 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_DOUBLE_TALK_BEHAVIOR_MODE (0x00024 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION (0x00025 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION_CONFIG (0x00026 + cOCT6100_NOT_SUPPORTED_BASE) - - -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NOISE_REDUCTION_GAIN (0x0002B + cOCT6100_NOT_SUPPORTED_BASE) - -#define cOCT6100_ERR_NOT_SUPPORTED_BUFFER_PLAYOUT (0x00100 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_CNR (0x00101 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CONF_BRIDGE (0x00102 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CALLER_ID (0x00104 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NOISE_BLEACHING (0x00105 + cOCT6100_NOT_SUPPORTED_BASE) - -#define cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_REMOVAL (0x00300 + cOCT6100_NOT_SUPPORTED_BASE) -#define cOCT6100_ERR_NOT_SUPPORTED_DOMINANT_SPEAKER (0x00301 + cOCT6100_NOT_SUPPORTED_BASE) - - - -#define cOCT6100_ERR_OPEN_INVALID_DEVICE (0x03000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INSUFFICIENT_EXTERNAL_MEMORY (0x03001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MEMORY_CHIP_SIZE (0x03002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_UP_CLK_FREQ (0x03003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_USER_CHIP_ID (0x03004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MULTI_PROCESS_SYSTEM (0x03005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_RW_ACCESSES (0x03006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_IMAGE_SIZE (0x03007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_IMAGE_FILE (0x03008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MEM_CLK_FREQ (0x03009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MEMORY_CHIPS_NUMBER (0x0300A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TOTAL_MEMORY_SIZE (0x0300B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_USE_SYNCH_TIMESTAMP (0x0300C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TIMESTAMP_STREAM (0x0300D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TIMESTAMP_TIMESLOT (0x0300E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TIMESTAMP_TSSTS (0x0300F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TDM_STREAM_FREQS (0x03010 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TDM_SAMPLING (0x03011 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_FAST_H100_MODE (0x03012 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_ECHO_CHANNELS (0x03013 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_PLAYOUT_BUFFERS (0x03014 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_TSI_CNCTS (0x03015 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_PHASING_TSSTS (0x03016 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_EXTERNAL_MEM_BIST_FAILED (0x03017 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_EXTERNAL_MEM_BIST_TIMEOUT (0x03018 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_SDRAM_BIST_FAILED (0x03019 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_CORRUPTED_IMAGE (0x0301A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR (0x0301B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_SOFT_TONE_EVENT_SIZE (0x0301C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INTERRUPT_POLARITY (0x0301D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_FATAL_GENERAL_CONFIG (0x0301E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_REMOTE_DEBUG_SESSIONS (0x0301F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ENABLE_MEM_CLK_OUT (0x03020 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_TDM_STREAM (0x03021 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_CONF_BRIDGES (0x03022 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_AF_CPU_TIMEOUT (0x03024 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MEMORY_TYPE (0x03025 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_FATAL_MEMORY_CONFIG (0x03026 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ERROR_MEMORY_CONFIG (0x03027 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_CONFIG (0x03028 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ERROR_H100_CONFIG (0x03029 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_FATAL_MEMORY_TIMEOUT (0x0302A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ERROR_MEMORY_TIMEOUT (0x0302B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_TIMEOUT (0x0302C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ERROR_H100_TIMEOUT (0x0302D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_IMAGE_WRITE_FAILED (0x0302E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_CRC_ERROR (0x0302F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_EGO_TIMEOUT (0x03030 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_SOFT_DEBUG_EVENT_BUF_SIZE (0x03031 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TONE_INFO_START_TAG_NOT_FOUND (0x03032 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TONE_INFO_STOP_TAG_NOT_FOUND (0x03033 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INVALID_TONE_EVENT (0x03034 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INVALID_TONE_NAME (0x03035 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INVALID_EVENT_NUMBER_SIZE (0x03036 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INTERNAL_MEMORY_BIST (0x03037 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_TAIL_DISPLACEMENT (0x03038 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_DEBUG_CHANNEL_RECORDING (0x03039 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_BIDIR_CHANNELS (0x0303A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_FUNCTIONAL_BIST_FAILED (0x0303C + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_MAX_ADPCM_CHANNELS (0x0303E + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_ENABLE_EXT_TONE_DETECTION (0x03040 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_SOFT_PLAYOUT_STOP_EVENT_SIZE (0x03041 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS (0x03042 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ENABLE_ACOUSTIC_ECHO (0x03043 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_USER_WRITE_BURST_FAILED (0x03045 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_USER_WRITE_SMEAR_FAILED (0x03046 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_USER_READ_BURST_FAILED (0x03047 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_MAX_FLEXIBLE_CONF_PARTICIPANTS (0x03048 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_DEBUG_MEM_INDEX (0x03051 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_ENABLE_CALLER_ID (0x03052 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_CALLER_ID_PLAYOUT_BUFFERS (0x03053 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_ENABLE_PRODUCTION_BIST (0x03055 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_ACTIVATED (0x03056 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_NUM_PRODUCTION_BIST_LOOPS (0x03057 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_PRODUCTION_BOOT_FAILED (0x03058 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_CONF_FAILED (0x03059 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_POUCH_ERROR (0x0305A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_INVALID_TLV_LENGTH (0x0305B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_OPEN_PRODUCTION_BIST_MODE (0x0305C + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_OPEN_ENABLE_2100_STOP_EVENT (0x03060 + cOCT6100_ERR_BASE) - - -#define cOCT6100_ERR_CAP_PINS_INVALID_CHIP_STATE (0x03081 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CAP_PINS_INVALID_CAPACITY_VALUE (0x03082 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_TSI_CNCT_ALL_CHANNELS_ARE_OPENED (0x04000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_DISABLED (0x04001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE (0x04002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_INPUT_TIMESLOT (0x04003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_INPUT_STREAM (0x04004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_OUTPUT_TIMESLOT (0x04005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_OUTPUT_STREAM (0x04006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_INPUT_PCM_LAW (0x04007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_TIMESLOT (0x04008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_STREAM (0x04009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_TSST_RESERVED (0x0400A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_NOT_OPEN (0x0400B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_ASSOCIATED_TSST_RESERVED (0x0400C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSI_CNCT_NO_MORE_TSI_AVAILABLE (0x0400D + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED (0x05000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_PATTERN (0x05001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_TOO_SMALL (0x05002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_PCM_LAW (0x05003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN (0x05004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE (0x05005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX (0x05006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN (0x05007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ACTIVE_DEPENDENCIES (0x05008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID (0x05009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN (0x0500A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ROUT_PORT_PLAYING (0x0500B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_SOUT_PORT_PLAYING (0x0500C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_PORT_INVALID (0x0500D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT (0x0500E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL (0x0500F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT (0x05010 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_MIXING (0x05011 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_STOP_CLEANLY (0x05012 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED (0x05013 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_WRITE_BYTE_COUNT (0x05015 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ECHO_OP_MODE (0x05016 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_LENGTH_INVALID (0x05017 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_OFFSET_INVALID (0x05018 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_RESET (0x05019 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_BUF_EMPTY (0x0501A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_MAX_EVENT (0x0501B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_DISABLED (0x0501C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_NOTIFY_ON_STOP (0x0501D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ALLOW_ACTIVE (0x0501E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_STILL_ACTIVE (0x0501F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_REPEAT_USED (0x05020 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_NLP_DISABLED (0x05021 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_ZERO (0x05022 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_NO_MEMORY (0x05023 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_POINT_NOT_FOUND (0x05024 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT_COUNT (0x05025 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_ADD_GAIN_DB (0x05026 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_BUFFER_PLAYOUT_LIST_EMPTY (0x05027 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_MEMORY_ALL_TSI_MEM_ENTRY_RESERVED (0x06000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MEMORY_ALL_ECHO_MEM_ENTRY_RESERVED (0x06002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MEMORY_EXTERNAL_MEMORY_FULL (0x06003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MEMORY_ALL_CONVERSION_MEM_ENTRY_RESERVED (0x06004 + cOCT6100_ERR_BASE) - - -#define cOCT6100_ERR_CHANNEL_DISABLED (0x07000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_INVALID_HANDLE (0x07001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_NUM_TSSTS (0x07002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_NUM_TSSTS (0x07003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_NUM_TSSTS (0x07004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_NUM_TSSTS (0x07005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_TIMESLOT (0x07006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_STREAM (0x07007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_TIMESLOT (0x07008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_STREAM (0x07009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT (0x0700A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_STREAM (0x0700B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT (0x0700C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_STREAM (0x0700D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MISSING_TSST (0x07012 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIL_SUP_ENABLE (0x07013 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PHASING_TYPE (0x07014 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE (0x07015 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PHASING_TSST_NOT_OPEN (0x07016 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PHASING_INVALID_PHASE (0x07017 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DEBUG (0x07018 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE (0x0701F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_DC_OFFSET_REM (0x07020 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_DC_OFFSET_REM (0x07021 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL (0x07022 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL (0x07023 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL_GAIN (0x07024 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL_GAIN (0x07025 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_ADAPT_NOISE_REDUCTION (0x07026 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ALL_CHANNELS_ARE_OPENED (0x07027 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_NOT_OPEN (0x07029 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ADPCM_NIBBLE (0x0702A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_ADD_PORT (0x0702B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_ADD_TIMESLOT (0x0702C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_ADD_STREAM (0x0702D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_INVALID (0x0702E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_PCM_LAW (0x0702F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_PCM_LAW (0x07030 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_PCM_LAW (0x07031 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_PCM_LAW (0x07032 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DECODER_PORT (0x07033 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ENCODER_PORT (0x07034 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DECODING_RATE (0x07035 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ENCODING_RATE (0x07036 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ENABLE_NLP (0x07037 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_COMFORT_NOISE_MODE (0x07038 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PHASING_TSST_REQUIRED (0x07039 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIL_SUP_INVALID_ENCODER_PORT (0x0703A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MODIFY_CODEC_CONFIG (0x0703B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MODIFY_VQE_CONFIG (0x0703C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MODIFY_TDM_CONFIG (0x0703D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_RIN_PORT_INVALID (0x0703E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_SIN_PORT_INVALID (0x0703F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_PORT (0x07041 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_TIMESLOT (0x07042 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_STREAM (0x07043 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_INVALID_TSST (0x07044 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_GET_STATS_MAX_BROADCAST_TSST (0x07045 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_TIMESLOT (0x07046 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_STREAM (0x07047 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_TIMESLOT (0x07048 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_STREAM (0x07049 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ACTIVE_DEPENDENCIES (0x0704A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TONE_DISABLER_ENABLE (0x0704B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TAIL_LENGTH (0x07053 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT (0x07054 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_INVALID_RIN_CB_SIZE (0x07058 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TSST_REMOVE_NO_BROADCAST_TSST (0x07059 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_INVALID_CODEC_POSITION (0x0705A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_STATS_RESET (0x0705B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ENABLE_TAIL_DISPLACEMENT (0x0705C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE (0x0705E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE (0x0705F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE (0x07060 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED (0x07061 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ALREADY_BIDIR (0x07062 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ALL_BIDIR_CHANNELS_ARE_OPENED (0x07063 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_FIRST_CHAN_SOUT_PORT (0x07064 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_FIRST_CHAN_RIN_PORT (0x07065 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SECOND_CHAN_SOUT_PORT (0x07066 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SECOND_CHAN_RIN_PORT (0x07067 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_BIDIR_PCM_LAW (0x07068 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_BIDIR_CHAN_NOT_OPEN (0x07069 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION (0x0706A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION (0x0706B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL (0x0706C + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_NO_VALID_TDM_CLOCKS (0x0706E + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_OUT_OF_TSI_MEMORY (0x07073 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TONE_REMOVAL (0x07075 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO (0x07077 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DEFAULT_ERL (0x07079 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DOUBLE_TALK (0x0707B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PHASE_TYPE_REQUIRED (0x0707C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIL_SUP_NLP_MUST_BE_ENABLED (0x0707D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ENABLE_EXT_TONE_DETECTION (0x0707E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DECODER_PORT (0x0707F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DISABLED (0x07080 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_NON_LINEARITY_B (0x07082 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_FIRST_CHAN_IN_CONFERENCE (0x07083 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SECOND_CHAN_IN_CONFERENCE (0x07084 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT_CANNOT_MODIFY (0x07085 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_NON_LINEARITY_B_CANNOT_MODIFY (0x07086 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_NOT_ENABLED (0x07087 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_BIDIR_DISABLED (0x0708B + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT_INVALID (0x0708D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_PER_CHAN_TAIL_DISPLACEMENT (0x0708E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_CONFERENCE_NOISE_REDUCTION (0x0708F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_AEC_DEFAULT_ERL (0x07092 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED (0x07093 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL (0x07094 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL (0x07095 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_TARGET (0x07096 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_TARGET (0x07097 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_MANUAL (0x07098 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_MANUAL (0x07099 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP (0x0709A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_HIGH_LEVEL_COMP (0x0709C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_MANUAL (0x0709D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_THRESHOLD (0x0709E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MUTE_MASK (0x0709F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MUTE_MASK_SIN (0x070A0 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ALE_RATIO (0x070A1 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_NLE_FLAG (0x070A2 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ALE_NLE_SIMULTANEOUSLY (0x070A3 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION (0x070A4 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ANR_SNR_ENHANCEMENT (0x070A5 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ANR_SEGREGATION (0x070A6 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_NLE_RATIO (0x070A7 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_APPLY_TO_ALL_CHANNELS (0x070A8 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_STREAM_UNASSIGN (0x070A9 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT_UNASSIGN (0x070AA + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_STREAM_UNASSIGN (0x070AB + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_RIN_TIMESLOT_UNASSIGN (0x070AC + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_STREAM_UNASSIGN (0x070AD + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT_UNASSIGN (0x070AE + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_STREAM_UNASSIGN (0x070AF + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SIN_TIMESLOT_UNASSIGN (0x070B0 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DISABLE_TONE_DETECTION (0x070B1 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_STOP_BUFFER_PLAYOUT (0x070B2 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_REMOVE_CONF_BRIDGE_PARTICIPANT (0x070B3 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_REMOVE_BROADCAST_TSSTS (0x070B4 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY (0x070B5 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_OUT_OF_MIXER_EVENTS (0x070B8 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH (0x070B9 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ENABLE_MUSIC_PROTECTION (0x070BA + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_TAIL_LENGTH_INVALID (0x070BB + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_SUM (0x070BC + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_DOUBLE_TALK_MODE (0x070BD + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING (0x070BE + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING_NR (0x070BF + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ANR_CNR_SIMULTANEOUSLY (0x070C0 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_IDLE_CODE_DETECTION (0x070C1 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_MUST_ENABLE_TONE_DISABLER (0x070C2 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_REQUIRED (0x070C5 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_REQUIRED (0x070C6 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_AUTO_LEVEL_CONTROL_REQUIRED (0x070C8 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHANNEL_COMFORT_NOISE_REQUIRED (0x070CB + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION_GAIN (0x070CC + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_PHASING_TSST_ALL_ENTRIES_ARE_OPENED (0x08000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_DISABLED (0x08001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE (0x08002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_TIMESLOT (0x08003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_STREAM (0x08004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_PHASING_LENGTH (0x08005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_NOT_OPEN (0x08006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_PHASING_TSST_ACTIVE_DEPENDENCIES (0x08007 + cOCT6100_ERR_BASE) - - -#define cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE (0x09000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_DISABLED (0x09001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN (0x09002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_ACTIVE_DEPENDENCIES (0x09003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE (0x09004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND (0x09005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_ALL_BUFFERS_OPEN (0x09006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_INVALID_HANDLE (0x09007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE (0x09008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MUTE (0x09009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE (0x0900A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_ALREADY_MUTED (0x0900B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_NOT_MUTED (0x0900C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_CODEC_ACTIVE (0x0900D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MIXER_FULL (0x0900E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ALREADY_ON_BRIDGE (0x0900F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_ALL (0x09010 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_EXT_TONE_ENABLED (0x09011 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_INVALID_INPUT_PORT (0x09012 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_DOMINANT_SPEAKER (0x09013 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_BIDIR (0x09015 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CNR_MUST_BE_ENABLED (0x09016 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_NLP_MUST_BE_ENABLED (0x09017 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF (0x09018 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_PARTICIPANT_CNT (0x09019 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_MASK_INDEX (0x0901A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_ALL_BUFFERS_OPEN (0x0901B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_DISABLED (0x0901C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_INDEX_USED (0x0901D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_SIMPLE_BRIDGE (0x0901E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_COPY_EVENTS (0x0901F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE (0x09020 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_TAP_NOT_SUPPORTED (0x09021 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_BRIDGE (0x09022 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY (0x09023 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_SAME_BRIDGE (0x09024 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_TAP_SOUT_ONLY (0x09025 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_ALREADY_TAPPED (0x09026 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE (0x09027 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION (0x09028 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_MISC_CANNOT_ROUND_UP_NUMBER (0x0A000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MISC_ASCII_CONVERSION_FAILED (0x0A001 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID (0x0B000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TONE_DETECTION_CHANNEL_NOT_OPEN (0x0B001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TONE_DETECTION_TONE_NUMBER_INVALID (0x0B002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED (0x0B003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED (0x0B004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TONE_DETECTION_TONE_NOT_AVAILABLE (0x0B005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TONE_DETECTION_DISABLE_ALL (0x0B006 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_EVENTS_GET_TONE_RESET_BUFS (0x0C000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY (0x0C001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_EVENTS_MAX_TONES (0x0C002 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_INTRPTS_RW_ERROR (0x0D000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_NOT_ACTIVE (0x0D001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_FATAL_GENERAL_CONFIG (0x0D002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_FATAL_MEMORY_CONFIG (0x0D003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_CONFIG (0x0D004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_CONFIG (0x0D005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_H100_ERROR_CONFIG (0x0D006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_FATAL_GENERAL_TIMEOUT (0x0D007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_FATAL_MEMORY_TIMEOUT (0x0D008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_TIMEOUT (0x0D009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_TIMEOUT (0x0D00A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_H100_ERROR_TIMEOUT (0x0D00B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_AF_TIMESTAMP_READ_TIMEOUT (0x0D00C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_INTRPTS_NLP_TIMESTAMP_READ_TIMEOUT (0x0D00D + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_TSST_TIMESLOT (0x0E000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSST_STREAM (0x0E001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSST_TSST_RESERVED (0x0E002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSST_ASSOCIATED_TSST_RESERVED (0x0E003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_TSST_ALL_TSSTS_ARE_OPENED (0x0E004 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_MULTIPROC_API_INST_SHARED (0x10000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MULTIPROC_API_INST_LOCAL (0x10001 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_DEBUG_CHANNEL_INVALID_HANDLE (0x11000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_PORT (0x11001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_READ_LENGTH (0x11002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_SOUT_READ_LENGTH (0x11003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_READ_DATA (0x11004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_EVENTS_RESET_BUFS (0x11005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_EVENTS_BUF_EMPTY (0x11006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_RIN_PTR_INVALID (0x11007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_SIN_PTR_INVALID (0x11008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_ROUT_PTR_INVALID (0x11009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_SOUT_PTR_INVALID (0x1100A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_RAW_DATA_PTR_INVALID (0x1100B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_LENGTH_INVALID (0x1100C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RECORD_NO_CHAN_SELECTED (0x1100D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_PCM_LAW (0x1100E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_CHANNEL_RECORDING_DISABLED (0x1100F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_DATA_MAX_BYTES (0x11010 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_DATA_PTR_INVALID (0x11011 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_RC_CHANNEL_RECORDING_DISABLED (0x11012 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_DATA_MODE (0x11013 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_CHANNEL_IN_POWER_DOWN (0x11014 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_DATA_CONTENT (0x11015 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_DEBUG_GET_DATA_MODE_CANNOT_CHANGE (0x11016 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_MIXER_ALL_COPY_EVENT_ENTRY_OPENED (0x12000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE (0x12001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE (0x12002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE (0x12003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_SOURCE_PORT (0x12004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_DESTINATION_PORT (0x12005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_EVENT_NOT_OPEN (0x12006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_SOURCE_ADPCM_RESOURCES_ACTIVATED (0x12007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_DEST_ADPCM_RESOURCES_ACTIVATED (0x12008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED (0x12009 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_ADPCM_CHAN_DISABLED (0x13000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE (0x13001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_INPUT_TIMESLOT (0x13002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_INPUT_STREAM (0x13003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_TIMESLOT (0x13004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_STREAM (0x13005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_INPUT_NUM_TSSTS (0x13006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_NUM_TSSTS (0x13007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_INPUT_PCM_LAW (0x13008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_MODE (0x13009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_ENCODING_RATE (0x1300A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_DECODING_RATE (0x1300B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_INCOMPATIBLE_NUM_TSSTS (0x1300C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_NO_MORE_TSI_AVAILABLE (0x1300D + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_OUTPUT_PCM_LAW (0x1300E + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_ADPCM_NIBBLE_POSITION (0x1300F + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_NOT_OPEN (0x13010 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_ADPCM_CHAN_ALL_ADPCM_CHAN_ARE_OPENED (0x13011 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_CHIP_STATS_RESET (0x14000 + cOCT6100_ERR_BASE) - - - -#define cOCT6100_ERR_PRODUCTION_BIST_DISABLED (0x16000 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_PAYLOAD (0x2C000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_PAYLOAD (0x2C001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH (0x2C002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_LENGTH (0x2C003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_ENDIAN_DETECTION_FIELD (0x2C004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_CHECKSUM (0x2C005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR (0x2C006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_ALL_SESSIONS_OPEN (0x2C007 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_INVALID_PACKET (0x2C008 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_TRANSACTION_ANSWERED (0x2C009 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_INAVLID_SESSION_NUMBER (0x2C00A + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_INVALID_HOT_CHAN_INDEX (0x2C00B + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_DISABLED (0x2C00C + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_REMOTEDEBUG_INVALID_RPC_COMMAND_NUM (0x2C00D + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_TLV_TIMEOUT (0x31000 + cOCT6100_ERR_BASE) - -/* Fatal errors must always be greater or equal to 0xE000. */ -#define cOCT6100_ERR_FATAL (0xDE000 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_FATAL_DRIVER_WRITE_API (0xDE000 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_WRITE_EXT_API (0xDE001 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_WRITE_SMEAR_API (0xDE002 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_WRITE_BURST_API (0xDE003 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_READ_API (0xDE004 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_READ_BURST_API (0xDE005 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_READ_DEBUG_API (0xDE006 + cOCT6100_ERR_BASE) -#define cOCT6100_ERR_FATAL_DRIVER_WRITE_ARRAY_API (0xDE007 + cOCT6100_ERR_BASE) - -#define cOCT6100_FATAL_BASE (0xDF000 + cOCT6100_ERR_BASE) - -#define cOCT6100_ERR_FATAL_0 (0x00000 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1 (0x00001 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2 (0x00002 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3 (0x00003 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4 (0x00004 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5 (0x00005 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6 (0x00006 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7 (0x00007 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8 (0x00008 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9 (0x00009 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A (0x0000A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B (0x0000B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C (0x0000C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D (0x0000D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E (0x0000E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_F (0x0000F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_10 (0x00010 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_11 (0x00011 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_12 (0x00012 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_13 (0x00013 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_14 (0x00014 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_15 (0x00015 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_16 (0x00016 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_17 (0x00017 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_18 (0x00018 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_19 (0x00019 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1A (0x0001A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1B (0x0001B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1C (0x0001C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1D (0x0001D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1E (0x0001E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_1F (0x0001F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_20 (0x00020 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_21 (0x00021 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_22 (0x00022 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_23 (0x00023 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_24 (0x00024 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_25 (0x00025 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_26 (0x00026 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_27 (0x00027 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_28 (0x00028 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_29 (0x00029 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2A (0x0002A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2B (0x0002B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2C (0x0002C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2D (0x0002D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2E (0x0002E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_2F (0x0002F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_30 (0x00030 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_31 (0x00031 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_32 (0x00032 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_33 (0x00033 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_34 (0x00034 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_35 (0x00035 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_36 (0x00036 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_37 (0x00037 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_38 (0x00038 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_39 (0x00039 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3A (0x0003A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3B (0x0003B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3C (0x0003C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3D (0x0003D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3E (0x0003E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_3F (0x0003F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_40 (0x00040 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_41 (0x00041 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_42 (0x00042 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_43 (0x00043 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_44 (0x00044 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_45 (0x00045 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_46 (0x00046 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_47 (0x00047 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_48 (0x00048 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_49 (0x00049 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4A (0x0004A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4B (0x0004B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4C (0x0004C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4D (0x0004D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4E (0x0004E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_4F (0x0004F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_50 (0x00050 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_51 (0x00051 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_52 (0x00052 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_53 (0x00053 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_54 (0x00054 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_55 (0x00055 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_56 (0x00056 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_57 (0x00057 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_58 (0x00058 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_59 (0x00059 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5A (0x0005A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5B (0x0005B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5C (0x0005C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5D (0x0005D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5E (0x0005E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_5F (0x0005F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_60 (0x00060 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_61 (0x00061 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_62 (0x00062 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_63 (0x00063 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_64 (0x00064 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_65 (0x00065 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_66 (0x00066 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_67 (0x00067 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_68 (0x00068 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_69 (0x00069 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6A (0x0006A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6B (0x0006B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6C (0x0006C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6D (0x0006D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6E (0x0006E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_6F (0x0006F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_70 (0x00070 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_71 (0x00071 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_72 (0x00072 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_73 (0x00073 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_74 (0x00074 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_75 (0x00075 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_76 (0x00076 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_77 (0x00077 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_78 (0x00078 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_79 (0x00079 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7A (0x0007A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7B (0x0007B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7C (0x0007C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7D (0x0007D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7E (0x0007E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_7F (0x0007F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_80 (0x00080 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_81 (0x00081 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_82 (0x00082 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_83 (0x00083 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_84 (0x00084 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_85 (0x00085 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_86 (0x00086 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_87 (0x00087 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_88 (0x00088 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_89 (0x00089 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8A (0x0008A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8B (0x0008B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8C (0x0008C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8D (0x0008D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8E (0x0008E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_8F (0x0008F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_90 (0x00090 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_91 (0x00091 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_92 (0x00092 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_93 (0x00093 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_94 (0x00094 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_95 (0x00095 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_96 (0x00096 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_97 (0x00097 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_98 (0x00098 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_99 (0x00099 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9A (0x0009A + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9B (0x0009B + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9C (0x0009C + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9D (0x0009D + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9E (0x0009E + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_9F (0x0009F + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A0 (0x000A0 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A1 (0x000A1 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A2 (0x000A2 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A3 (0x000A3 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A4 (0x000A4 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A5 (0x000A5 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A6 (0x000A6 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A7 (0x000A7 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A8 (0x000A8 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_A9 (0x000A9 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_AA (0x000AA + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_AB (0x000AB + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_AC (0x000AC + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_AD (0x000AD + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_AE (0x000AE + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_AF (0x000AF + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B0 (0x000B0 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B1 (0x000B1 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B2 (0x000B2 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B3 (0x000B3 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B4 (0x000B4 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B5 (0x000B5 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B6 (0x000B6 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B7 (0x000B7 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B8 (0x000B8 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_B9 (0x000B9 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_BA (0x000BA + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_BB (0x000BB + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_BC (0x000BC + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_BD (0x000BD + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_BE (0x000BE + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_BF (0x000BF + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C0 (0x000C0 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C1 (0x000C1 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C2 (0x000C2 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C3 (0x000C3 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C4 (0x000C4 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C5 (0x000C5 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C6 (0x000C6 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C7 (0x000C7 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C8 (0x000C8 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_C9 (0x000C9 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_CA (0x000CA + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_CB (0x000CB + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_CC (0x000CC + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_CD (0x000CD + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_CE (0x000CE + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_CF (0x000CF + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D0 (0x000D0 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D1 (0x000D1 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D2 (0x000D2 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D3 (0x000D3 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D4 (0x000D4 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D5 (0x000D5 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D6 (0x000D6 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D7 (0x000D7 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D8 (0x000D8 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_D9 (0x000D9 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_DA (0x000DA + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_DB (0x000DB + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_DC (0x000DC + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_DD (0x000DD + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_DE (0x000DE + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_DF (0x000DF + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E0 (0x000E0 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E1 (0x000E1 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E2 (0x000E2 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E3 (0x000E3 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E4 (0x000E4 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E5 (0x000E5 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E6 (0x000E6 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E7 (0x000E7 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E8 (0x000E8 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_E9 (0x000E9 + cOCT6100_FATAL_BASE) -#define cOCT6100_ERR_FATAL_EA (0x000EA + cOCT6100_FATAL_BASE) - -#endif /* __OCT6100_ERRORS_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_events_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_events_inst.h deleted file mode 100644 index 323cd5bb..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_events_inst.h +++ /dev/null @@ -1,69 +0,0 @@ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_events_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_events.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_events_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 12 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_EVENTS_INST_H__ -#define __OCT6100_EVENTS_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_TONE_EVENT_ -{ - UINT32 ulChannelHandle; - UINT32 ulUserChanId; - UINT32 ulToneDetected; /* Tone number of the tone detected. */ - UINT32 ulTimestamp; - UINT32 ulEventType; - UINT32 ulExtToneDetectionPort; - -} tOCT6100_API_TONE_EVENT, *tPOCT6100_API_TONE_EVENT; - -typedef struct _OCT6100_API_BUFFER_PLAYOUT_EVENT_ -{ - UINT32 ulChannelHandle; - UINT32 ulUserChanId; - UINT32 ulChannelPort; - UINT32 ulTimestamp; - UINT32 ulUserEventId; - UINT32 ulEventType; - -} tOCT6100_API_BUFFER_PLAYOUT_EVENT, *tPOCT6100_API_BUFFER_PLAYOUT_EVENT; - -#endif /* __OCT6100_EVENTS_INST_H__ */ - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_events_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_events_pub.h deleted file mode 100644 index 4ee131a1..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_events_pub.h +++ /dev/null @@ -1,111 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_events_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_events.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_events_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_EVENTS_PUB_H__ -#define __OCT6100_EVENTS_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_TONE_EVENT_ -{ - UINT32 ulChannelHndl; - UINT32 ulUserChanId; - - UINT32 ulToneDetected; - - UINT32 ulTimestamp; - UINT32 ulEventType; - - UINT32 ulExtToneDetectionPort; - -} tOCT6100_TONE_EVENT, *tPOCT6100_TONE_EVENT; - -typedef struct _OCT6100_EVENT_GET_TONE_ -{ - BOOL fMoreEvents; - BOOL fResetBufs; - - UINT32 ulMaxToneEvent; - UINT32 ulNumValidToneEvent; - - tPOCT6100_TONE_EVENT pToneEvent; - -} tOCT6100_EVENT_GET_TONE, *tPOCT6100_EVENT_GET_TONE; - -typedef struct _OCT6100_BUFFER_PLAYOUT_EVENT_ -{ - UINT32 ulChannelHndl; - UINT32 ulUserChanId; - UINT32 ulChannelPort; - - UINT32 ulTimestamp; - - UINT32 ulUserEventId; - UINT32 ulEventType; - -} tOCT6100_BUFFER_PLAYOUT_EVENT, *tPOCT6100_BUFFER_PLAYOUT_EVENT; - -typedef struct _OCT6100_BUFFER_PLAYOUT_GET_EVENT_ -{ - BOOL fMoreEvents; - BOOL fResetBufs; - - UINT32 ulMaxEvent; - UINT32 ulNumValidEvent; - - tPOCT6100_BUFFER_PLAYOUT_EVENT pBufferPlayoutEvent; - -} tOCT6100_BUFFER_PLAYOUT_GET_EVENT, *tPOCT6100_BUFFER_PLAYOUT_GET_EVENT; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100EventGetToneDef( - OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ); -UINT32 Oct6100EventGetTone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ); - -UINT32 Oct6100BufferPlayoutGetEventDef( - OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ); -UINT32 Oct6100BufferPlayoutGetEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ); - -#endif /* __OCT6100_EVENTS_PUB_H__ */ - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_inst.h deleted file mode 100644 index fc82cddc..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_inst.h +++ /dev/null @@ -1,134 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_interrupts_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_interrupts.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_interrupts_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 16 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_INTERRUPTS_INST_H__ -#define __OCT6100_INTERRUPTS_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_INTRPT_CONFIG_ -{ - /* The configuration of each group of interrupts. Each can have one of the - following values: - cOCT6100_INTRPT_DISABLE, - cOCT6100_INTRPT_NO_TIMEOUT, - cOCT6100_INTRPT_TIMEOUT. */ - UINT8 byFatalGeneralConfig; - UINT8 byFatalMemoryConfig; - UINT8 byErrorMemoryConfig; - UINT8 byErrorOverflowToneEventsConfig; - UINT8 byErrorH100Config; - - /* The timeout value for each interrupt group, if the corresponding - configuration variable is set to cOCT6100_INTRPT_TIMEOUT. This - value is kept in mclk cycles. */ - UINT32 ulFatalMemoryTimeoutMclk; - UINT32 ulErrorMemoryTimeoutMclk; - UINT32 ulErrorOverflowToneEventsTimeoutMclk; - UINT32 ulErrorH100TimeoutMclk; - -} tOCT6100_API_INTRPT_CONFIG, *tPOCT6100_API_INTRPT_CONFIG; - -typedef struct _OCT6100_API_INTRPT_MANAGE_ -{ - /* Number of mclk cycles in 1ms. */ - UINT32 ulNumMclkCyclesIn1Ms; - - /* Whether the mclk interrupt is active. */ - UINT8 fMclkIntrptActive; - UINT32 ulNextMclkIntrptTimeHigh; - UINT32 ulNextMclkIntrptTimeLow; - - /* Mclk time read from registers. */ - UINT32 ulRegMclkTimeHigh; - UINT32 ulRegMclkTimeLow; - - /* Used by the interrupt service routine. */ - UINT16 usRegister102h; - UINT16 usRegister202h; - UINT16 usRegister302h; - UINT16 usRegister502h; - UINT16 usRegister702h; - - /* The state of each interrupt group. Can be one of the following: - cOCT6100_INTRPT_ACTIVE, - cOCT6100_INTRPT_WILL_TIMEOUT, - cOCT6100_INTRPT_IN_TIMEOUT, - cOCT6100_INTRPT_WILL_DISABLED. */ - UINT16 byFatalGeneralState; - UINT16 byFatalMemoryState; - UINT16 byErrorMemoryState; - UINT16 byErrorOverflowToneEventsState; - UINT16 byErrorH100State; - - /* The time at which each disabled interrupt was disabled, in mclk cycles. */ - UINT32 ulFatalMemoryDisableMclkHigh; - UINT32 ulFatalMemoryDisableMclkLow; - UINT32 ulErrorMemoryDisableMclkHigh; - UINT32 ulErrorMemoryDisableMclkLow; - UINT32 ulErrorOverflowToneEventsDisableMclkHigh; - UINT32 ulErrorOverflowToneEventsDisableMclkLow; - UINT32 ulErrorH100DisableMclkHigh; - UINT32 ulErrorH100DisableMclkLow; - - /* The time at which each disabled interrupt group is to be reenabled, - in number of mclk cycles. */ - UINT32 ulFatalGeneralEnableMclkHigh; - UINT32 ulFatalGeneralEnableMclkLow; - UINT32 ulFatalMemoryEnableMclkHigh; - UINT32 ulFatalMemoryEnableMclkLow; - UINT32 ulErrorMemoryEnableMclkHigh; - UINT32 ulErrorMemoryEnableMclkLow; - UINT32 ulErrorOverflowToneEventsEnableMclkHigh; - UINT32 ulErrorOverflowToneEventsEnableMclkLow; - UINT32 ulErrorH100EnableMclkHigh; - UINT32 ulErrorH100EnableMclkLow; - - /* If this is set, buffer playout events are pending. */ - UINT8 fBufferPlayoutEventsPending; - /* If this is set, tone events are pending. */ - UINT8 fToneEventsPending; - - - - UINT8 fIsrCalled; - -} tOCT6100_API_INTRPT_MANAGE, *tPOCT6100_API_INTRPT_MANAGE; - -#endif /* __OCT6100_INTERRUPTS_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_pub.h deleted file mode 100644 index a90fdcfb..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_interrupts_pub.h +++ /dev/null @@ -1,102 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_interrupts_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_interrupts.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_interrupts_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 23 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_INTERRUPTS_PUB_H__ -#define __OCT6100_INTERRUPTS_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_INTERRUPT_CONFIGURE_ -{ - UINT32 ulFatalGeneralConfig; - UINT32 ulFatalMemoryConfig; - - UINT32 ulErrorMemoryConfig; - UINT32 ulErrorOverflowToneEventsConfig; - UINT32 ulErrorH100Config; - - UINT32 ulFatalMemoryTimeout; - UINT32 ulErrorMemoryTimeout; - UINT32 ulErrorOverflowToneEventsTimeout; - UINT32 ulErrorH100Timeout; - -} tOCT6100_INTERRUPT_CONFIGURE, *tPOCT6100_INTERRUPT_CONFIGURE; - -typedef struct _OCT6100_INTERRUPT_FLAGS_ -{ - BOOL fFatalGeneral; - UINT32 ulFatalGeneralFlags; - - BOOL fFatalReadTimeout; - - BOOL fErrorRefreshTooLate; - BOOL fErrorPllJitter; - - BOOL fErrorOverflowToneEvents; - - BOOL fErrorH100OutOfSync; - BOOL fErrorH100ClkA; - BOOL fErrorH100ClkB; - BOOL fErrorH100FrameA; - - BOOL fToneEventsPending; - BOOL fBufferPlayoutEventsPending; - - BOOL fApiSynch; - - - -} tOCT6100_INTERRUPT_FLAGS, *tPOCT6100_INTERRUPT_FLAGS; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100InterruptConfigureDef( - OUT tPOCT6100_INTERRUPT_CONFIGURE f_pConfigInts ); -UINT32 Oct6100InterruptConfigure( - IN tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_INTERRUPT_CONFIGURE f_pConfigInts ); - -UINT32 Oct6100InterruptServiceRoutineDef( - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); -UINT32 Oct6100InterruptServiceRoutine( - IN tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -#endif /* __OCT6100_INTERRUPTS_PUB_H__ */ - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_inst.h deleted file mode 100644 index 1415e869..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_inst.h +++ /dev/null @@ -1,86 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mixer_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_mixer.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_mixer_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 13 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MIXER_INST_H__ -#define __OCT6100_MIXER_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_MIXER_EVENT_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Type of the event.*/ - UINT16 usEventType; - - /* Source channel index */ - UINT16 usSourceChanIndex; - - /* Destination channel index */ - UINT16 usDestinationChanIndex; - - /* Pointer to the next entry.*/ - UINT16 usNextEventPtr; - -} tOCT6100_API_MIXER_EVENT, *tPOCT6100_API_MIXER_EVENT; - - -typedef struct _OCT6100_API_COPY_EVENT_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Count used to manage entry handles allocated to user. */ - UINT8 byEntryOpenCnt; - - /* Source + destination ports. */ - UINT8 bySourcePort; - UINT8 byDestinationPort; - - /* Index of the channels associated to this event.*/ - UINT16 usSourceChanIndex; - UINT16 usDestinationChanIndex; - - UINT16 usMixerEventIndex; - -} tOCT6100_API_COPY_EVENT, *tPOCT6100_API_COPY_EVENT; - - -#endif /* __OCT6100_MIXER_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_pub.h deleted file mode 100644 index 08aa28b0..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_mixer_pub.h +++ /dev/null @@ -1,77 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mixer_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_mixer.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_mixer_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 7 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MIXER_PUB_H__ -#define __OCT6100_MIXER_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_COPY_EVENT_CREATE_ -{ - PUINT32 pulCopyEventHndl; - - UINT32 ulSourceChanHndl; - UINT32 ulSourcePort; - - UINT32 ulDestinationChanHndl; - UINT32 ulDestinationPort; - -} tOCT6100_COPY_EVENT_CREATE, *tPOCT6100_COPY_EVENT_CREATE; - -typedef struct _OCT6100_COPY_EVENT_DESTROY_ -{ - UINT32 ulCopyEventHndl; - -} tOCT6100_COPY_EVENT_DESTROY, *tPOCT6100_COPY_EVENT_DESTROY; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100MixerCopyEventCreateDef( - OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ); -UINT32 Oct6100MixerCopyEventCreate( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ); - -UINT32 Oct6100MixerCopyEventDestroyDef( - OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ); -UINT32 Oct6100MixerCopyEventDestroy( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ); - -#endif /* __OCT6100_MIXER_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_inst.h deleted file mode 100644 index a2b2e27e..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_inst.h +++ /dev/null @@ -1,68 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_phasing_tsst_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_phasing_tsst.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_phasing_tsst_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 11 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PHASING_TSST_INST_H__ -#define __OCT6100_PHASING_TSST_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_PHASING_TSST_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Count used to manage entry handles allocated to user. */ - UINT8 byEntryOpenCnt; - - /* Count of number of resources connected in some way to this buffer. */ - UINT16 usDependencyCnt; - - /* TDM timeslot and stream where the counter is read. */ - UINT16 usStream; - UINT16 usTimeslot; - - /* Length of the phasing TSST counter. */ - UINT16 usPhasingLength; - - /* TSST control index where the counter comes from. */ - UINT16 usPhasingTsstIndex; - -} tOCT6100_API_PHASING_TSST, *tPOCT6100_API_PHASING_TSST; - -#endif /* __OCT6100_PHASING_TSST_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_pub.h deleted file mode 100644 index b5af946f..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_phasing_tsst_pub.h +++ /dev/null @@ -1,78 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_phasing_tsst_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_phasing_tsst.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_phasing_tsst_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 10 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PHASING_TSST_PUB_H__ -#define __OCT6100_PHASING_TSST_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_PHASING_TSST_OPEN_ -{ - PUINT32 pulPhasingTsstHndl; - - UINT32 ulPhasingLength; - UINT32 ulTimeslot; - UINT32 ulStream; - - - -} tOCT6100_PHASING_TSST_OPEN, *tPOCT6100_PHASING_TSST_OPEN; - -typedef struct _OCT6100_PHASING_TSST_CLOSE_ -{ - UINT32 ulPhasingTsstHndl; - -} tOCT6100_PHASING_TSST_CLOSE, *tPOCT6100_PHASING_TSST_CLOSE; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100PhasingTsstOpenDef( - OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); -UINT32 Oct6100PhasingTsstOpen( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); - -UINT32 Oct6100PhasingTsstCloseDef( - OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ); -UINT32 Oct6100PhasingTsstClose( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ); - -#endif /* __OCT6100_PHASING_TSST_PUB_H__ */ - diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_inst.h deleted file mode 100644 index 046a6399..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_inst.h +++ /dev/null @@ -1,88 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_playout_buf_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_playout_buf.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_playout_buf_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 10 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PLAYOUT_BUF_INST_H__ -#define __OCT6100_PLAYOUT_BUF_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_BUFFER_MEMORY_NODE_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufMemoryNodeListOfst ); - -#define mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufMemoryNodeListOfst)) + ulIndex; - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE_ -{ - /* Next node. */ - UINT32 ulNext; - - /* Previous node. */ - UINT32 ulPrevious; - - /* Start address of this node. */ - UINT32 ulStartAddress; - - /* Size of this node. */ - UINT32 ulSize; - - /* Allocated node? Free node? */ - UINT8 fAllocated; - -} tOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE, *tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE; - -typedef struct _OCT6100_API_BUFFER_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Pcm law of the buffer. */ - UINT8 byBufferPcmLaw; - - /* Number of channels currently playing this buffer.*/ - UINT16 usDependencyCnt; - - /* Length of the buffer ( in bytes ).*/ - UINT32 ulBufferSize; - - /* Address in external memory of the buffer. */ - UINT32 ulBufferBase; - -} tOCT6100_API_BUFFER, *tPOCT6100_API_BUFFER; - -#endif /* __OCT6100_PLAYOUT_BUF_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_pub.h deleted file mode 100644 index 9fe0d6fe..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_playout_buf_pub.h +++ /dev/null @@ -1,183 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_playout_buf_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_playout_buf.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_playout_buf_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 21 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PLAYOUT_BUF_PUB_H__ -#define __OCT6100_PLAYOUT_BUF_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_BUFFER_LOAD_ -{ - PUINT32 pulBufferIndex; /* Index identifying the buffer. */ - PUINT32 pulPlayoutFreeMemSize; /* Amount of free memory available for other buffers. */ - - PUINT8 pbyBufferPattern; /* A byte pointer pointing to a valid buffer to be loaded into the chip's external memory. */ - UINT32 ulBufferSize; /* Size of the buffer loaded into external memory. */ - - UINT32 ulBufferPcmLaw; /* Buffer PCM law. */ - -} tOCT6100_BUFFER_LOAD, *tPOCT6100_BUFFER_LOAD; - -typedef struct _OCT6100_BUFFER_LOAD_BLOCK_INIT_ -{ - PUINT32 pulBufferIndex; /* Index identifying the buffer. */ - PUINT32 pulPlayoutFreeMemSize; /* Amount of free memory available for other buffers. */ - - UINT32 ulBufferSize; /* Size of the buffer to be loaded in memory. This space will be reserved. */ - - UINT32 ulBufferPcmLaw; /* Buffer PCM law. */ - -} tOCT6100_BUFFER_LOAD_BLOCK_INIT, *tPOCT6100_BUFFER_LOAD_BLOCK_INIT; - -typedef struct _OCT6100_BUFFER_LOAD_BLOCK_ -{ - UINT32 ulBufferIndex; /* Index identifying the buffer. */ - - /* Offset, in bytes, of the first byte in the block to be loaded. */ - /* This offset is with respect to the beginning of the buffer. */ - /* This value must be modulo 2 */ - UINT32 ulBlockOffset; - - /* Size of the block to be loaded into external memory. */ - /* This value must be modulo 2. */ - UINT32 ulBlockLength; - - /* A pointer pointing to a valid buffer block to be loaded */ - /* into the chip's external memory. This is a pointer to the entire */ - /* buffer. The API uses the ulBlockOffset and ulBlockLength to index */ - /* within this buffer and obtain the block to be loaded. */ - PUINT8 pbyBufferPattern; - -} tOCT6100_BUFFER_LOAD_BLOCK, *tPOCT6100_BUFFER_LOAD_BLOCK; - -typedef struct _OCT6100_BUFFER_UNLOAD_ -{ - UINT32 ulBufferIndex; /* Index identifying the buffer. */ - -} tOCT6100_BUFFER_UNLOAD, *tPOCT6100_BUFFER_UNLOAD; - -typedef struct _OCT6100_BUFFER_PLAYOUT_ADD_ -{ - UINT32 ulChannelHndl; /* Echo cancelling channel on which to play the buffer. */ - - UINT32 ulBufferIndex; /* Index identifying the buffer. */ - - UINT32 ulPlayoutPort; /* Selected channel port where to play to tone. */ - UINT32 ulMixingMode; /* Weither or not the voice stream will be muted while playing the buffer. */ - - INT32 lGainDb; /* Gain applied to the buffer that will be played on the specified port. */ - - BOOL fRepeat; /* Use ulRepeatCount variable. */ - UINT32 ulRepeatCount; /* Number of times to repeat playing the selected buffer. */ - - UINT32 ulDuration; /* Duration in millisecond that this buffer should play. Setting this overrides fRepeat. */ - - UINT32 ulBufferLength; /* Length of the buffer to play (starting at the beginning), AUTO_SELECT for all. */ - -} tOCT6100_BUFFER_PLAYOUT_ADD, *tPOCT6100_BUFFER_PLAYOUT_ADD; - -typedef struct _OCT6100_BUFFER_PLAYOUT_START_ -{ - UINT32 ulChannelHndl; /* Echo cancelling channel on which to play the buffer. */ - UINT32 ulPlayoutPort; /* Selected channel port where to play to tone. */ - - BOOL fNotifyOnPlayoutStop; /* Check if the buffers have finished playing on this channel/port. */ - /* The events are queued in a soft buffer that the user must empty regularly. */ - UINT32 ulUserEventId; /* Returned to the user when the playout is finished and the user has set the fNotifyOnPlayoutStop flag. */ - - BOOL fAllowStartWhileActive; /* Use this to add buffers to something that is already playing on the channel/port. */ - -} tOCT6100_BUFFER_PLAYOUT_START, *tPOCT6100_BUFFER_PLAYOUT_START; - -typedef struct _OCT6100_BUFFER_PLAYOUT_STOP_ -{ - UINT32 ulChannelHndl; /* Echo cancelling channel on which to play the buffer. */ - UINT32 ulPlayoutPort; /* Selected channel port where to play to tone. */ - BOOL fStopCleanly; /* Whether or not the skip will be clean. */ - - PBOOL pfAlreadyStopped; /* Whether playout was already stopped or not. */ - PBOOL pfNotifyOnPlayoutStop; /* Whether the user chosed to receive an event on playout stop. */ - -} tOCT6100_BUFFER_PLAYOUT_STOP, *tPOCT6100_BUFFER_PLAYOUT_STOP; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100BufferPlayoutLoadDef( - OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad ); -UINT32 Oct6100BufferPlayoutLoad( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad ); - -UINT32 Oct6100BufferPlayoutLoadBlockInitDef( - OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ); -UINT32 Oct6100BufferPlayoutLoadBlockInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ); - -UINT32 Oct6100BufferPlayoutLoadBlockDef( - OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ); -UINT32 Oct6100BufferPlayoutLoadBlock( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ); - -UINT32 Oct6100BufferPlayoutUnloadDef( - OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload ); -UINT32 Oct6100BufferPlayoutUnload( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload ); - -UINT32 Oct6100BufferPlayoutAddDef( - OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ); -UINT32 Oct6100BufferPlayoutAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ); - -UINT32 Oct6100BufferPlayoutStartDef( - OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart ); -UINT32 Oct6100BufferPlayoutStart( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart ); - -UINT32 Oct6100BufferPlayoutStopDef( - OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ); -UINT32 Oct6100BufferPlayoutStop( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ); - -#endif /* __OCT6100_PLAYOUT_BUF_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_inst.h deleted file mode 100644 index 85a8d39e..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_inst.h +++ /dev/null @@ -1,73 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_remote_debug_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_remote_debug.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_remote_debug_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 6 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_REMOTE_DEBUG_INST_H__ -#define __OCT6100_REMOTE_DEBUG_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_REMOTE_DEBUG_INFO_ -{ - UINT32 ulSessionTreeOfst; - UINT32 ulSessionListOfst; - UINT32 ulSessionListHead; - UINT32 ulSessionListTail; - - UINT32 ulPktCacheOfst; - UINT32 ulDataBufOfst; - - UINT32 ulNumSessionsOpen; - UINT32 ulMaxSessionsOpen; - -} tOCT6100_API_REMOTE_DEBUG_INFO, *tPOCT6100_API_REMOTE_DEBUG_INFO; - -typedef struct _OCT6100_API_REMOTE_DEBUG_SESSION_ -{ - UINT32 ulSessionNum; - UINT32 ulTransactionNum; - UINT32 ulPktRetryNum; - UINT32 ulPktByteSize; - - UINT32 aulLastPktTime[ 2 ]; - UINT32 ulForwardLink; - UINT32 ulBackwardLink; - -} tOCT6100_API_REMOTE_DEBUG_SESSION, *tPOCT6100_API_REMOTE_DEBUG_SESSION; - -#endif /* __OCT6100_REMOTE_DEBUG_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_pub.h deleted file mode 100644 index 18a7e226..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_remote_debug_pub.h +++ /dev/null @@ -1,64 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_remote_debug_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_remote_debug.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_remote_debug_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 6 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_REMOTE_DEBUG_PUB_H__ -#define __OCT6100_REMOTE_DEBUG_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_REMOTE_DEBUG_ -{ - PUINT32 pulReceivedPktPayload; - UINT32 ulReceivedPktLength; - - PUINT32 pulResponsePktPayload; - UINT32 ulMaxResponsePktLength; - UINT32 ulResponsePktLength; - -} tOCT6100_REMOTE_DEBUG, *tPOCT6100_REMOTE_DEBUG; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100RemoteDebugDef( - OUT tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ); -UINT32 Oct6100RemoteDebug( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ); - -#endif /* __OCT6100_REMOTE_DEBUG_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tlv_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_tlv_inst.h deleted file mode 100644 index 093ce0d1..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tlv_inst.h +++ /dev/null @@ -1,72 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tlv_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_tlv.c. All elements defined in this file are for public - usage of the API. All instate elements are defined in the - oct6100_tlv_inst.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 7 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TLV_INST_H__ -#define __OCT6100_TLV_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_TLV_OFFSET_ -{ - /* The dword offset contain the number of dword from a base address to reach the desired dword. - - i.e. usDwordOffset = (total bit offset) / 32; */ - - UINT16 usDwordOffset; - - /* The bit offset will contain the bit offset required to right shift the DWORD read and obtain - the desired value. This field is depend on the field size. - - i.e. byBitOffset = 31 - ((total bit offset) % 32) - byFieldSize; */ - - UINT8 byBitOffset; - UINT8 byFieldSize; - -} tOCT6100_TLV_OFFSET, *tPOCT6100_TLV_OFFSET; - -typedef struct _OCT6100_TLV_TONE_INFO_ -{ - UINT32 ulToneID; - UINT32 ulDetectionPort; - - UINT8 aszToneName[ cOCT6100_TLV_MAX_TONE_NAME_SIZE ]; - - - -} tOCT6100_TLV_TONE_INFO, *tPOCT6100_TLV_TONE_INFO; - -#endif /* __OCT6100_TLV_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_inst.h deleted file mode 100644 index 1ee86fe2..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_inst.h +++ /dev/null @@ -1,46 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tone_detection_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_tone_detection_buf.c. All elements defined in this file are for - public usage of the API. All private elements are defined in the - oct6100_tone_detection_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 8 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TONE_DETECTION_INST_H__ -#define __OCT6100_TONE_DETECTION_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -#endif /* __OCT6100_TONE_DETECTION_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_pub.h deleted file mode 100644 index cf280693..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tone_detection_pub.h +++ /dev/null @@ -1,74 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tone_detection_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_tone_detection.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_tone_detection_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 10 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TONE_DETECTION_PUB_H__ -#define __OCT6100_TONE_DETECTION_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_TONE_DETECTION_ENABLE_ -{ - UINT32 ulChannelHndl; - UINT32 ulToneNumber; - -} tOCT6100_TONE_DETECTION_ENABLE, *tPOCT6100_TONE_DETECTION_ENABLE; - -typedef struct _OCT6100_TONE_DETECTION_DISABLE_ -{ - UINT32 ulChannelHndl; - UINT32 ulToneNumber; - BOOL fDisableAll; - -} tOCT6100_TONE_DETECTION_DISABLE, *tPOCT6100_TONE_DETECTION_DISABLE; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ToneDetectionEnableDef( - OUT tPOCT6100_TONE_DETECTION_ENABLE f_pBufferLoad ); -UINT32 Oct6100ToneDetectionEnable( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TONE_DETECTION_ENABLE f_pBufferLoad ); - -UINT32 Oct6100ToneDetectionDisableDef( - OUT tPOCT6100_TONE_DETECTION_DISABLE f_pBufferUnload ); -UINT32 Oct6100ToneDetectionDisable( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TONE_DETECTION_DISABLE f_pBufferUnload ); - -#endif /* __OCT6100_TONE_DETECTION_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_inst.h deleted file mode 100644 index 9eb23bae..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_inst.h +++ /dev/null @@ -1,70 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsi_cnct_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_tsi_cnct.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_tsi_cnct_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 9 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSI_CNCT_INST_H__ -#define __OCT6100_TSI_CNCT_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_TSI_CNCT_ -{ - /* Flag specifying whether the entry is used or not. */ - UINT8 fReserved; - - /* Count used to manage entry handles allocated to user. */ - UINT8 byEntryOpenCnt; - - /* Input PCM law. */ - UINT8 byInputPcmLaw; - - /* TSI chariot memory entry. */ - UINT16 usTsiMemIndex; - - /* Input and output timeslot information. */ - UINT16 usInputTimeslot; - UINT16 usInputStream; - - UINT16 usOutputTimeslot; - UINT16 usOutputStream; - - /* Internal info for quick access to structures associated to this TSI cnct. */ - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - -} tOCT6100_API_TSI_CNCT, *tPOCT6100_API_TSI_CNCT; - -#endif /* __OCT6100_TSI_CNCT_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_pub.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_pub.h deleted file mode 100644 index c0304682..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsi_cnct_pub.h +++ /dev/null @@ -1,76 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsi_cnct_pub.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_tsi_cnct.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_tsi_cnct_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 11 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSI_CNCT_PUB_H__ -#define __OCT6100_TSI_CNCT_PUB_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_TSI_CNCT_OPEN_ -{ - PUINT32 pulTsiCnctHndl; - - UINT32 ulInputTimeslot; - UINT32 ulInputStream; - UINT32 ulOutputTimeslot; - UINT32 ulOutputStream; - -} tOCT6100_TSI_CNCT_OPEN, *tPOCT6100_TSI_CNCT_OPEN; - -typedef struct _OCT6100_TSI_CNCT_CLOSE_ -{ - UINT32 ulTsiCnctHndl; - -} tOCT6100_TSI_CNCT_CLOSE, *tPOCT6100_TSI_CNCT_CLOSE; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100TsiCnctOpenDef( - OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); -UINT32 Oct6100TsiCnctOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); - -UINT32 Oct6100TsiCnctCloseDef( - OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ); -UINT32 Oct6100TsiCnctClose( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ); - -#endif /* __OCT6100_TSI_CNCT_PUB_H__ */ diff --git a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsst_inst.h b/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsst_inst.h deleted file mode 100644 index 6b9fe77b..00000000 --- a/zaptel/kernel/oct612x/include/oct6100api/oct6100_tsst_inst.h +++ /dev/null @@ -1,55 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsst_inst.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines, macros, and structures pertaining to the file - oct6100_tsst.c. All elements defined in this file are for public - usage of the API. All private elements are defined in the - oct6100_tsst_priv.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 5 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSST_INST_H__ -#define __OCT6100_TSST_INST_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_TSST_ENTRY_ -{ - UINT16 usTsstMemoryIndex; /* Index in the TSST memory of the TSST */ - UINT16 usTsstValue; /* Tsst value given by the user. */ - /* bit 5:0 = stream value, bit 13:6 = timeslot value. */ - - UINT16 usNextEntry; /* Pointer to the next entry in the list. */ - -} tOCT6100_API_TSST_ENTRY, *tPOCT6100_API_TSST_ENTRY; - -#endif /* __OCT6100_TSST_INST_H__ */ diff --git a/zaptel/kernel/oct612x/include/octdef.h b/zaptel/kernel/oct612x/include/octdef.h deleted file mode 100644 index a2da33d6..00000000 --- a/zaptel/kernel/oct612x/include/octdef.h +++ /dev/null @@ -1,116 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octdef.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Common system definitions. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 12 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCTDEF_H__ -#define __OCTDEF_H__ - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************** INCLUDE FILES *******************************/ - -/*-------------------------------------------------------------------------- - Get Platform Dependency headers -----------------------------------------------------------------------------*/ -#include "octosdependant.h" - - -/*-------------------------------------------------------------------------- - Common Type definitions -----------------------------------------------------------------------------*/ -#include "octtype.h" - -/***************************** DEFINES *************************************/ - -/* List of functions to skip compiling since we don't use them */ -#include "digium_unused.h" - - - -/*-------------------------------------------------------------------------- - Miscellaneous constants -----------------------------------------------------------------------------*/ - -#ifndef PROTO -#define PROTO extern -#endif - -/* Generic return codes. */ -#define cOCTDEF_RC_OK 0 /* Generic Ok */ -#define cOCTDEF_RC_ERROR 1 /* Generic Error */ - -/* Default return values of all OCTAPI functions. */ -#ifndef GENERIC_OK -#define GENERIC_OK 0x00000000 -#endif - -#ifndef GENERIC_ERROR -#define GENERIC_ERROR 0x00000001 -#endif - -#ifndef GENERIC_BAD_PARAM -#define GENERIC_BAD_PARAM 0x00000002 -#endif - -/* Defines of boolean expressions (TRUE/FALSE) */ -#ifndef FALSE -#define FALSE (BOOL)0 -#endif - -#ifndef TRUE -#define TRUE (BOOL)1 -#endif - -/*-------------------------------------------------------------------------- - DLL Import-Export -----------------------------------------------------------------------------*/ - -#ifdef OCT_WINENV -#define DLLIMP __declspec( dllimport ) -#define DLLEXP __declspec( dllexport ) -#else -#define DLLIMP -#define DLLEXP -#endif - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __OCTDEF_H__ */ diff --git a/zaptel/kernel/oct612x/include/octmac.h b/zaptel/kernel/oct612x/include/octmac.h deleted file mode 100644 index 2e930ae3..00000000 --- a/zaptel/kernel/oct612x/include/octmac.h +++ /dev/null @@ -1,98 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octmac.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - Common macro definitions. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTMAC_H__ -#define __OCTMAC_H__ - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************** DEFINES *************************************/ - -/* Combine l & h to form a 32 bit quantity. */ -#define mMAKEULONG(l, h) ((ULONG)(((USHORT)(l)) | (((ULONG)((USHORT)(h))) << 16))) - -#define mLOUCHAR(w) ((UCHAR)(w)) -#define mHIUCHAR(w) ((UCHAR)(((USHORT)(w) >> 8) & 0xff)) -#define mLOUSHORT(l) ((USHORT)((ULONG)l)) -#define mHIUSHORT(l) ((USHORT)(((ULONG)(l) >> 16) & 0xffff)) -#define mLOSHORT(l) ((SHORT)((ULONG)l)) -#define mHISHORT(l) ((SHORT)(((ULONG)(l) >> 16) & 0xffff)) - -/* Combine l & h to form a 16 bit quantity. */ -#define mMAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8) -#define mMAKESHORT(l, h) ((SHORT)mMAKEUSHORT(l, h)) - -/* Extract high and low order parts of 16 and 32 bit quantity */ -#define mLOBYTE(w) mLOUCHAR(w) -#define mHIBYTE(w) mHIUCHAR(w) -#define mMAKELONG(l, h) ((LONG)mMAKEULONG(l, h)) - -/*-------------------------------------------------------------------------- - Bite conversion macro -----------------------------------------------------------------------------*/ -#define mSWAP_INT16(x) mMAKEUSHORT( mHIBYTE(x), mLOBYTE(x) ) -#define mSWAP_INT32(x) mMAKEULONG( mSWAP_INT16(mHIUSHORT(x)), mSWAP_INT16(mLOUSHORT(x)) ) - - -/* Cast any variable to an instance of the specified type. */ -#define mMAKETYPE(v, type) (*((type *)&v)) - -/* Calculate the byte offset of a field in a structure of type type. */ -#define mFIELDOFFSET(type, field) ((UINT32)&(((type *)0)->field)) -#define mCOUNTOF(array) (sizeof(array)/sizeof(array[0])) - -#define mMAX(a,b) (((a) > (b)) ? (a) : (b)) -#define mMIN(a,b) (((a) < (b)) ? (a) : (b)) - -#define mDIM(x) (sizeof(x) / sizeof(x[0])) - -#define mFROMDIGIT(ch) ((ch) - 0x30) /* digit to char */ -#define mTODIGIT(ch) ((ch) + 0x30) /* int to char */ - -#define mISLEAP(a) ( !( a % 400 ) || ( ( a % 100 ) && !( a % 4 ) ) ) - -#define mFOREVER for( ;; ) - -#define mROUND_TO_NEXT_4( a ) ( ((a) % 4) ? ( (a) + 4 - ((a)%4) ) : (a) ) - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __OCTMAC_H__ */ diff --git a/zaptel/kernel/oct612x/include/octosdependant.h b/zaptel/kernel/oct612x/include/octosdependant.h deleted file mode 100644 index 6e797bcb..00000000 --- a/zaptel/kernel/oct612x/include/octosdependant.h +++ /dev/null @@ -1,167 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octosdependant.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file is included to set target-specific constants. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 18 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCTOSDEPENDANT_H__ -#define __OCTOSDEPENDANT_H__ - - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - - - -/***************************************************************************** - - Known define values - - MSDEV: - WIN32 == WINDOWS 32 bit app - __WIN32__ == WINDOWS 32 bit app - _Windows == WINDOWS 16 bit app - - _WINDOWS == Windows application .. not console - _DLL == Dll Application - _CONSOLE == Console Application .. no windows - - BORLANDC - __TURBOC__ == Turbo Compiler - __BORLANDC__ == Borland compiler - __OS2__ == Borland OS2 compiler - _Windows == Windows 16 bit app - - GCC Compiler - __GNUC__ == GCC Compiler - __unix__ == Unix system - __vax__ == Unix system - unix == Unix system - vax == vax system - - TORNADO - _VXWORKS_ == VXWORK - - ECOS/CYGWIN - _ECOS_ == eCos - - SOLARIS - _SOLARIS_ == Solaris - -*****************************************************************************/ - -/* Machine endian type */ - -#define OCT_MACH_LITTLE_ENDIAN 1 -#define OCT_MACH_BIG_ENDIAN 2 - -/* Try to find current OCT_MACH_ENDIAN from compiler define values */ -#if !defined( MACH_TYPE_BIG_ENDIAN ) && !defined( MACH_TYPE_LITTLE_ENDIAN ) - /* Does GNU defines the endian ? */ - #if defined(__GNU_C__) - #if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) - #define OCT_MACH_ENDIAN OCT_MACH_BIG_ENDIAN - #elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__) - #define OCT_MACH_ENDIAN OCT_MACH_LITTLE_ENDIAN - #endif - #endif - - /* Try with cpu type */ - #if !defined(OCT_MACH_ENDIAN) - /* Look for intel */ - #if defined( _M_IX86 ) - #define OCT_MACH_ENDIAN OCT_MACH_LITTLE_ENDIAN - /* Look for PowerPC */ - #elif defined( _M_MPPC ) || defined( _M_PPC ) || defined(PPC) || defined(__PPC) || defined(_ARCH_PPC) - #define OCT_MACH_ENDIAN OCT_MACH_BIG_ENDIAN - #elif defined( CPU ) - #if CPU==PPC860 || CPU==SIMNT - #define OCT_MACH_ENDIAN OCT_MACH_BIG_ENDIAN - #else - #define OCT_MACH_ENDIAN OCT_MACH_LITTLE_ENDIAN - #endif - #else - #define OCT_MACH_ENDIAN OCT_MACH_LITTLE_ENDIAN - #endif - #endif -#else - #if defined( MACH_TYPE_BIG_ENDIAN ) - #define OCT_MACH_ENDIAN OCT_MACH_BIG_ENDIAN - #else - #define OCT_MACH_ENDIAN OCT_MACH_LITTLE_ENDIAN - #endif -#endif - -/* Find system type if not already defined */ -#if !defined( OCT_NTDRVENV ) && !defined( OCT_VXENV ) && !defined( OCT_WINENV ) - -#if defined( WIN32 ) || defined( __WIN32__ ) || defined( _WIN32_ ) || defined( WIN32S ) - /* Verif if building a win32 driver */ - #if ( defined( WIN32 ) && WIN32==100 ) - #define OCT_NTDRVENV - #else - #define OCT_WINENV - #endif -#elif defined( _VXWORKS_ ) - #define OCT_VXENV -#elif defined( _ECOS_ ) -#ifndef OCT_ECOSENV - #define OCT_ECOSENV -#endif /* OCT_ECOSENV */ -#elif defined( _SOLARIS_ ) - #define OCT_SOLARISENV -#elif defined( _LINUX_ ) - #define OCT_LINUXENV -#else - /* Unknown environment */ - #define OCT_UNKNOWNENV -#endif /* WIN env */ - -#endif /* Already defined */ - -#if defined( __KERNEL__ ) && defined( OCT_LINUXENV ) -#define OCT_LINUXDRVENV -#endif - -#ifdef _DEBUG -#define OCT_OPT_USER_DEBUG -#endif - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __OCTOSDEPENDANT_H__ */ diff --git a/zaptel/kernel/oct612x/include/octrpc/oct6100_rpc_protocol.h b/zaptel/kernel/oct612x/include/octrpc/oct6100_rpc_protocol.h deleted file mode 100644 index fcee581f..00000000 --- a/zaptel/kernel/oct612x/include/octrpc/oct6100_rpc_protocol.h +++ /dev/null @@ -1,348 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_rpc_protocol.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all defines and prototypes related to the OCT6100 RPC - protocol for exchanging debug commands. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 6 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_RPC_PROTOCOL_H__ -#define __OCT6100_RPC_PROTOCOL_H__ - -/***************************** DEFINES *************************************/ - -#define cOCTRPC_INTERFACE_VERSION 0x00010002 - -/* Octasic commands. */ -#define cOCT6100_RPC_CHIP_LIST 0xFF000000 -#define cOCT6100_RPC_CHIP_CHOICE 0xFF000001 -#define cOCT6100_RPC_ENV_DISCONNECT 0xFF000002 - -/* Commands */ -/* Read commands */ -#define cOCT6100_RPC_READ_WORD 0x00000000 -#define cOCT6100_RPC_READ_BURST 0x00000001 -#define cOCT6100_RPC_READ_DEBUG 0x00000002 -#define cOCT6100_RPC_READ_ARRAY 0x00000003 -#define cOCT6100_RPC_API_DISCONNECT 0x00000004 - -/* Write commands */ -#define cOCT6100_RPC_WRITE_WORD 0x00000010 -#define cOCT6100_RPC_WRITE_BURST 0x00000011 -#define cOCT6100_RPC_WRITE_SMEAR 0x00000012 -#define cOCT6100_RPC_WRITE_INC 0x00000013 - -/* Debug commands.*/ -#define cOCT6100_RPC_SET_HOT_CHANNEL 0x00000014 -#define cOCT6100_RPC_GET_DEBUG_CHAN_INDEX 0x00000015 - -#define cOCTRPC_UNKNOWN_COMMAND_NUM 0xFFFFFFFF - -/* Errors */ -#define cOCT6100_RPCERR_OK 0x00000000 -#define cOCT6100_RPCERR_INVALID_COMMAND_NUMBER 0x00000001 -#define cOCT6100_RPCERR_INVALID_COMMAND_PAYLOAD 0x00000002 -#define cOCT6100_RPCERR_INVALID_COMMAND_LENGTH 0x00000003 - - -/***************************** TYPES ***************************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_READ_WORD - -Description: Command structure for the read of one word. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulAddress Address at which to read. -OUT ulReadData The word read, returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_READ_WORD_ -{ - UINT32 IN ulAddress; - UINT32 OUT ulReadData; - -} tOCT6100_RPC_READ_WORD, *tPOCT6100_RPC_READ_WORD; - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_READ_BURST - -Description: Command structure for a read burst. The burst starts at the - given address and reads the specified number of consecutive - words. - - Whereas every command structure uses a complete dword for every - member, irrespective of the size of data unit needed, this - structure does not do so for the read data. To save bandwidth - the read data words are returned two per dword. - -Example packet: 31 16 15 0 - ------------------------------------------- - | ulAddress = 0x100 | - ------------------------------------------- - | ulBurstLength = 0x3 | - ------------------------------------------- - aulReadData -> | D0 | D1 | - ------------------------------------------- - | D2 | xx | - ------------------------------------------- - - Dy is the read data at ulAddress + 2 * y. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulAddress Address at which to read. -IN ulBurstLength The number of consecutive words to be read. -OUT aulReadData The read data returned. The dwords of the structure - starting at this address are arranged as indicated in - the example packet above. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_READ_BURST_ -{ - UINT32 IN ulAddress; - UINT32 IN ulBurstLength; - UINT32 OUT aulReadData[ 1 ]; - -} tOCT6100_RPC_READ_BURST, *tPOCT6100_RPC_READ_BURST; - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_READ_ARRAY - -Description: Command structure for a variable number of reads. The reads do - not have to be at contiguous addresses. - - Whereas every command structure uses a complete dword for every - member, irrespective of the size of data unit needed, this - structure does not do so for the read data. To save bandwidth - the read data words are returned two per dword, and the - parity bits are returned 16 per dword (two parity bits per read - access). - -Example packet: 31 16 15 0 - ------------------------------------------- - | ulArrayLength = 0x3 | - ------------------------------------------- - aulArrayData ->| A0 | - ------------------------------------------- - | A1 | - ------------------------------------------- - | A2 | - ------------------------------------------- - | D0 | D1 | - ------------------------------------------- - | D2 | xx | - ------------------------------------------- - - Ay is the address for access y. - Dy is the read data at Ay. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulArrayLength Number of reads to do. -IN OUT aulArrayData The addresses at which to read (IN) and the read data - returned (OUT). The dwords of the command structure - starting at this address are arranged as indicated in - the example packet above. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_READ_ARRAY -{ - UINT32 IN ulArrayLength; - UINT32 IN OUT aulArrayData[ 1 ]; - -} tOCT6100_RPC_READ_ARRAY, *tPOCT6100_RPC_READ_ARRAY; - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_WRITE_WORD - -Description: Command structure for the write of one word. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulAddress Address at which to write. -IN ulWriteData The word to write. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_WRITE_WORD_ -{ - UINT32 IN ulAddress; - UINT32 IN ulParity; - UINT32 IN ulWriteData; - -} tOCT6100_RPC_WRITE_WORD, *tPOCT6100_RPC_WRITE_WORD; - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_WRITE_SMEAR - -Description: Command structure for the write of one word at one or many - consecutive addresses. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulAddress Address of first write. -IN ulSmearLength Number of consecutive addresses to write. -IN ulWriteData The word to write at each address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_WRITE_SMEAR_ -{ - UINT32 IN ulAddress; - UINT32 IN ulSmearLength; - UINT32 IN ulParity; - UINT32 IN ulWriteData; - -} tOCT6100_RPC_WRITE_SMEAR, *tPOCT6100_RPC_WRITE_SMEAR; - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_WRITE_INC - -Description: Command structure for the write of an incremental pattern at - one or many consecutive addresses. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulAddress Address of first write. -IN ulIncLength Number of consecutive addresses to write. -IN ulWriteData The first word of the incremental pattern. For each - consecutive write the word will be incremented by 1. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_WRITE_INC_ -{ - UINT32 IN ulAddress; - UINT32 IN ulIncLength; - UINT32 IN ulParity; - UINT32 IN ulWriteData; - -} tOCT6100_RPC_WRITE_INC, *tPOCT6100_RPC_WRITE_INC; - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_WRITE_BURST - -Description: Command structure for a write burst. The burst starts at the - given address and writes a given word for each address. - - Whereas every command structure uses a complete dword for every - member, irrespective of the size of data unit needed, this - structure does not do so for the write data. To save bandwidth - the write data words are sent two per dword. - -Example packet: 31 16 15 0 - ------------------------------------------- - | ulAddress = 0x100 | - ------------------------------------------- - | ulBurstLength = 0x3 | - ------------------------------------------- - aulWriteData ->| D0 | D1 | - ------------------------------------------- - | D2 | xx | - ------------------------------------------- - - Dy is the write data for ulAddress + 2 * y. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulAddress First address at which to write. -IN ulBurstLength The number of consecutive addresses to be write. -IN aulWriteData The write data words. The dwords of the structure - starting at this address are arranged as indicated in - the example packet above. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_WRITE_BURST_ -{ - UINT32 IN ulAddress; - UINT32 IN ulBurstLength; - UINT32 IN ulParity; - UINT32 IN aulWriteData[ 1 ]; - -} tOCT6100_RPC_WRITE_BURST, *tPOCT6100_RPC_WRITE_BURST; - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_SET_HOT_CHANNEL - -Description: Command structure to set the hot channel. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulDebugChannel Index of the channel to debug. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_SET_HOT_CHANNEL_ -{ - UINT32 IN ulHotChannel; - UINT32 IN ulPcmLaw; - -} tOCT6100_RPC_SET_HOT_CHANNEL, *tPOCT6100_RPC_SET_HOT_CHANNEL; - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Structure: OCT6100_RPC_GET_DEBUG_CHAN_INDEX - -Description: Command structure to get the debug channel index used by the API. - -------------------------------------------------------------------------------- -| Member | Description -------------------------------------------------------------------------------- -IN ulDebugChannel Index of the channel to debug. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -typedef struct _OCT6100_RPC_GET_DEBUG_CHAN_INDEX_ -{ - UINT32 OUT ulDebugChanIndex; - -} tOCT6100_RPC_GET_DEBUG_CHAN_INDEX, *tPOCT6100_RPC_GET_DEBUG_CHAN_INDEX; - -#endif /* __OCT6100_RPC_PROTOCOL_H__ */ diff --git a/zaptel/kernel/oct612x/include/octrpc/rpc_protocol.h b/zaptel/kernel/oct612x/include/octrpc/rpc_protocol.h deleted file mode 100644 index 24e15964..00000000 --- a/zaptel/kernel/oct612x/include/octrpc/rpc_protocol.h +++ /dev/null @@ -1,115 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: rpc_protocol.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - -This file contains RPC related definitions and prototypes. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 23 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __RPC_PROTOCOL_H__ -#define __RPC_PROTOCOL_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define cOCTRPC_ENDIAN_DETECT 0x27182819 -#define cOCTRPC_ENDIAN_DETECT_BYTE_W 0x19 -#define cOCTRPC_ENDIAN_DETECT_BYTE_X 0x28 -#define cOCTRPC_ENDIAN_DETECT_BYTE_Y 0x18 -#define cOCTRPC_ENDIAN_DETECT_BYTE_Z 0x27 -#define cOCTRPC_ECHO_PROTOCOL 0x00000000 - -#define cOCTRPC_MIN_PACKET_BYTE_LENGTH (sizeof( tOCTRPC_OGRDTP_HEADER )) -#define cOCTRPC_FIRST_COMMAND_BYTE_OFFSET (sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) -#define cOCTRPC_GENERIC_HEADERS_BYTE_SIZE (sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER ) + sizeof( tOCTRPC_COMMAND_HEADER )) -#define cOCTRPC_MAX_PACKET_BYTE_LENGTH 32768 - -/* Protocol versions */ -#define cOCTRPC_PROTOCOL_V1_0 0x00010000 -#define cOCTRPC_PROTOCOL_V1_1 0x00010001 -#define cOCTRPC_PROTOCOL_V1_2 0x00010002 -#define cOCTRPC_PROTOCOL_V1_3 0x00010003 -#define cOCTRPC_OCTASIC_PROTOCOL_V1_0 0xFF010000 -#define cOCTRPC_OCTASIC_PROTOCOL_V1_1 0xFF010001 -#define cOCTRPC_OCTASIC_PROTOCOL_V1_2 0xFF010002 -#define cOCTRPC_OCTASIC_PROTOCOL_V1_3 0xFF010003 - -/* Chips */ -#define cOCTRPC_OCT8304_INTERFACE 0x00000000 -#define cOCTRPC_OCT6100_INTERFACE 0x00000001 - -/* Timeout values. */ -#define cOCTRPC_SESSION_TIMEOUT 30 - -/* Generic errors */ -#define cOCTRPC_RDBGERR_OK 0x00000000 -#define cOCTRPC_RDBGERR_NO_ANSWER 0xFFFF0000 -#define cOCTRPC_RDBGERR_ALL_SESSIONS_OPEN 0xFFFF0001 -#define cOCTRPC_RDBGERR_PROTOCOL_NUMBER 0xFFFF0002 -#define cOCTRPC_RDBGERR_NO_COMMAND_HEADER 0xFFFF0003 -#define cOCTRPC_RDBGERR_INTERFACE_TYPE 0xFFFF0004 -#define cOCTRPC_RDBGERR_INTERFACE_VERSION 0xFFFF0005 -#define cOCTRPC_RDBGERR_INVALID_PACKET_LENGTH 0xFFFF0006 -#define cOCTRPC_RDBGERR_INVALID_COMMAND_LENGTH 0xFFFF0007 -#define cOCTRPC_RDBGERR_INVALID_COMMAND_NUMBER 0xFFFF0008 -#define cOCTRPC_RDBGERR_PACKET_TOO_LARGE 0xFFFF0009 -#define cOCTRPC_RDBGERR_LIST_EMPTY 0xFFFF000A - -#define cOCTRPC_RDBGERR_FATAL 0xFFFFFFFF - - -/***************************** TYPES ***************************************/ - -typedef struct _OCTRPC_OGRDTP_HEADER_ -{ - UINT32 IN ulEndianDetect; - UINT32 IN ulDebugSessionNum; - UINT32 IN ulTransactionNum; - UINT32 IN ulPktRetryNum; - UINT32 IN ulPktByteSize; - UINT32 IN ulChecksum; - UINT32 OUT ulParsingError; - UINT32 IN ulRpcProtocolNum; - -} tOCTRPC_OGRDTP_HEADER, *tPOCTRPC_OGRDTP_HEADER; - -typedef struct _OCTRPC_INTERFACE_HEADER_ -{ - UINT32 IN ulInterfaceType; - UINT32 IN ulInterfaceVersion; - -} tOCTRPC_INTERFACE_HEADER, *tPOCTRPC_INTERFACE_HEADER; - -typedef struct _OCTRPC_COMMAND_HEADER_ -{ - UINT32 IN ulCommandByteSize; - UINT32 IN OUT ulRpcCommandNum; - UINT32 OUT ulFunctionResult; - -} tOCTRPC_COMMAND_HEADER, *tPOCTRPC_COMMAND_HEADER; - -#endif /* __RPC_PROTOCOL_H__ */ diff --git a/zaptel/kernel/oct612x/include/octtype.h b/zaptel/kernel/oct612x/include/octtype.h deleted file mode 100644 index 4400570f..00000000 --- a/zaptel/kernel/oct612x/include/octtype.h +++ /dev/null @@ -1,153 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octtype.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file defines the base storage types. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 18 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#ifndef __OCTTYPE_H__ -#define __OCTTYPE_H__ - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/*-------------------------------------------------------------------------- - Include target-specific header if available -----------------------------------------------------------------------------*/ -#if defined( OCT_NTDRVENV ) - #include "octtypentdrv.h" /* All NT driver typedef */ -#elif defined( OCT_WINENV ) - #include "octtypewin.h" /* All Win32 typedef */ -#elif defined( OCT_VXENV ) - #include "octtypevx.h" /* All VxWorks typedef */ -#else -/*-------------------------------------------------------------------------- - No target-specific header available -----------------------------------------------------------------------------*/ - -/***************************** DEFINES *************************************/ -/* 16-bit integer */ -typedef unsigned short UINT16; -typedef signed short INT16; -typedef unsigned short *PUINT16; -typedef signed short *PINT16; - -/* 8-bit integer */ -typedef unsigned char UINT8; -typedef signed char INT8; -typedef signed char OCT_INT8; -typedef unsigned char *PUINT8; -typedef signed char *PINT8; - - -/* 32 bit integer */ -typedef unsigned int UINT32; -typedef signed int INT32; -typedef INT32 * PINT32; -typedef UINT32 * PUINT32; - -/* Long integer */ -typedef signed long LONG; -typedef unsigned long ULONG; -typedef long * PLONG; -typedef unsigned long * PULONG; - -/* Short integer */ -typedef short SHORT; -typedef unsigned short USHORT; -typedef short * PSHORT; -typedef unsigned short *PUSHORT; - -/* 8-bit integer*/ -typedef unsigned char BYTE; -typedef BYTE * PBYTE; -typedef unsigned char UCHAR; - -/* Character and strings */ -typedef char CHAR; -typedef CHAR SZ; -typedef CHAR * PSZ; -typedef CHAR * PCHAR; - -/* Double integers */ -typedef double DOUBLE; -typedef double * PDOUBLE; -typedef float FLOAT; -typedef float * PFLOAT; - -typedef void VOID; -typedef void * PVOID; - -/* Booleans */ -typedef int BOOL; -typedef BOOL * PBOOL; - -/* Integers */ -typedef int INT; -typedef int * PINT; -typedef unsigned int UINT; -typedef unsigned int * PUINT; - -/* Define pseudo-keywords IN and OUT if not defined yet */ -#ifndef IN -#define IN /* IN param */ -#endif - -#ifndef OUT -#define OUT /* OUT param */ -#endif - -/* LONG LONG */ -#define LLONG signed long long -#define PLLONG signed long long * -#define ULLONG unsigned long long -#define PULLONG unsigned long long * - -#ifndef OPT -#define OPT /* OPT param */ -#endif - -typedef PSZ * PPSZ; - -#ifndef NULL -#define NULL 0 -#endif - -#endif - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -} -#endif - -#endif /* __OCTTYPE_H__ */ diff --git a/zaptel/kernel/oct612x/include/octtypevx.h b/zaptel/kernel/oct612x/include/octtypevx.h deleted file mode 100644 index 6588ae2a..00000000 --- a/zaptel/kernel/oct612x/include/octtypevx.h +++ /dev/null @@ -1,132 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octtypevx.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file defines the base storage types for the VxWorks environment. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 9 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCTTYPEVX_H__ -#define __OCTTYPEVX_H__ - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "vxWorks.h" - -/* 16-bit pointer integer */ -typedef unsigned short *PUINT16; -typedef signed short *PINT16; - -/* 8-bit integer pointer */ -typedef unsigned char *PUINT8; -typedef signed char *PINT8; - -/* 32-bit integer pointer */ -typedef INT32 * PINT32; -typedef UINT32 * PUINT32; - -/* Long integer pointer */ -/*Intel library for file system definition*/ -#ifndef DATATYPE_H -typedef long LONG; -#endif -typedef long * PLONG; -typedef unsigned long * PULONG; - -/* Short integer pointer */ -typedef short SHORT; -typedef short * PSHORT; -typedef unsigned short *PUSHORT; - -/* 8-bit integer*/ -#if (CPU!=SIMNT) && !defined(DATATYPE_H) -typedef char BYTE; -#endif - - -typedef BYTE * PBYTE; - -/* Character and strings */ -/*Intel library for file system definition*/ -#ifndef DATATYPE_H -typedef char CHAR; -#endif -typedef char * PCHAR; -typedef CHAR SZ; -typedef CHAR * PSZ; -typedef signed char OCT_INT8; - -/* Double integers */ -typedef double DOUBLE; -typedef double * PDOUBLE; -typedef float FLOAT; -typedef float * PFLOAT; - -typedef void * PVOID; - -/* Booleans */ -typedef BOOL * PBOOL; - -/* Integers */ -typedef int INT; -typedef int * PINT; -typedef unsigned int PUINT; - -/* Define pseudo-keywords IN and OUT if not defined yet */ -#ifndef IN -#define IN /* IN param */ -#endif - -#ifndef OUT -#define OUT /* OUT param */ -#endif - -/* LONG LONG */ -#define LLONG signed long long -#define PLLONG signed long long * -#define ULLONG unsigned long long -#define PULLONG unsigned long long * - -#ifndef OPT -#define OPT /* OPT param */ -#endif - -typedef PSZ * PPSZ; - - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ -#ifdef __cplusplus -} -#endif - -#endif /* __OCTTYPEVX_H__ */ diff --git a/zaptel/kernel/oct612x/include/octtypewin.h b/zaptel/kernel/oct612x/include/octtypewin.h deleted file mode 100644 index 8bdd6907..00000000 --- a/zaptel/kernel/oct612x/include/octtypewin.h +++ /dev/null @@ -1,100 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: octtypewin.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file defines the base storage types for the Windows environment. - Includes the Windows definition file and add the missing ones here. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 16 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCTTYPEWIN_H__ -#define __OCTTYPEWIN_H__ - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ -#define WIN32_LEAN_AND_MEAN /* just get the base type definition from Windows */ -#include - -/* Disable argument not used warning */ -#pragma warning( disable : 4100 ) -/* Disable Level 4 warning: nonstandard extension used : translation unit is empty */ -#pragma warning( disable : 4206 ) - -#ifdef __cplusplus -extern "C" { -#endif - -/* 16-bit integer */ -typedef unsigned short UINT16; -typedef signed short INT16; -typedef unsigned short *PUINT16; -typedef signed short *PINT16; - -/* 8-bit integer */ -typedef unsigned char UINT8; -typedef signed char INT8; -typedef signed char OCT_INT8; -typedef unsigned char *PUINT8; -typedef signed char *PINT8; - -typedef double DOUBLE; - - -/* 32 bit integer */ -#if ( defined( _MSC_VER ) && _MSC_VER == 1100 ) -/* MFC5 compiler does not define UINT32 */ -typedef unsigned int UINT32; -typedef signed int INT32; -typedef INT32 * PINT32; -typedef UINT32 * PUINT32; -#endif /* _MSC_VER */ - -/* LONG LONG */ -#define LLONG signed __int64 -#define PLLONG signed __int64 * -#define ULLONG unsigned __int64 -#define PULLONG unsigned __int64 * - -/* Double integers */ -typedef double DOUBLE; -typedef double * PDOUBLE; -typedef float FLOAT; -typedef float * PFLOAT; - -#ifndef OPT -#define OPT /* OPT param */ -#endif - -typedef PSZ * PPSZ; - -/*-------------------------------------------------------------------------- - C language -----------------------------------------------------------------------------*/ -#ifdef __cplusplus -} -#endif - -#endif /* __OCTTYPEWIN_H__ */ diff --git a/zaptel/kernel/oct612x/octasic-helper b/zaptel/kernel/oct612x/octasic-helper deleted file mode 100755 index ab100d12..00000000 --- a/zaptel/kernel/oct612x/octasic-helper +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -# -# Jeffrey C. Ollie -# -# $1 == information requested -# $2 == path to octasic directory -# - -APIDIR=$2/octdeviceapi/oct6100api/oct6100_api - -case $1 in - objects) - echo $APIDIR/oct6100_adpcm_chan.o \ - $APIDIR/oct6100_channel.o \ - $APIDIR/oct6100_chip_open.o \ - $APIDIR/oct6100_chip_stats.o \ - $APIDIR/oct6100_conf_bridge.o \ - $APIDIR/oct6100_debug.o \ - $APIDIR/oct6100_events.o \ - $APIDIR/oct6100_interrupts.o \ - $APIDIR/oct6100_memory.o \ - $APIDIR/oct6100_miscellaneous.o \ - $APIDIR/oct6100_mixer.o \ - $APIDIR/oct6100_phasing_tsst.o \ - $APIDIR/oct6100_playout_buf.o \ - $APIDIR/oct6100_remote_debug.o \ - $APIDIR/oct6100_tlv.o \ - $APIDIR/oct6100_tone_detection.o \ - $APIDIR/oct6100_tsi_cnct.o \ - $APIDIR/oct6100_tsst.o \ - $2/apilib/bt/octapi_bt0.o \ - $2/apilib/largmath/octapi_largmath.o \ - $2/apilib/llman/octapi_llman.o - ;; - cflags) - echo -I$2/include -I$2/octdeviceapi -I$2/octdeviceapi/oct6100api - ;; -esac diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h deleted file mode 100644 index a0780709..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h +++ /dev/null @@ -1,131 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_adpcm_chan_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_adpcm_chan.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_adpcm_chan_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 7 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_ADPCM_CHAN_PRIV_H__ -#define __OCT6100_ADPCM_CHAN_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/* ADPCM channel list pointer macros. */ -#define mOCT6100_GET_ADPCM_CHAN_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_ADPCM_CHAN )(( PUINT8 )pSharedInfo + pSharedInfo->ulAdpcmChanListOfst ); - -#define mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_ADPCM_CHAN )(( PUINT8 )pSharedInfo + pSharedInfo->ulAdpcmChanListOfst)) + ulIndex; - -#define mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulAdpcmChanAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetAdpcmChanSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiAdpcmChanSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - - -UINT32 Oct6100AdpcmChanOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); - -UINT32 Oct6100ApiCheckAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); - -UINT32 Oct6100ApiReserveAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiWriteAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiUpdateAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100AdpcmChanCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ); - -UINT32 Oct6100ApiAssertAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiInvalidateAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiReleaseAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiReserveAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusAdpcmChanIndex ); - -UINT32 Oct6100ApiReleaseAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex ); - -#endif /* __OCT6100_ADPCM_CHAN_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c deleted file mode 100644 index aec4c5ed..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c +++ /dev/null @@ -1,1237 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_adpcm_chan.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open and close ADPCM channels. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 16 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_adpcm_chan_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_adpcm_chan_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_adpcm_chan_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanOpen - -Description: This function opens an ADPCM channel between two TDM timeslots. - This channel will perform ADPCM compression or decompression - depending on the channel mode. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanOpenDef -UINT32 Oct6100AdpcmChanOpenDef( - tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - f_pAdpcmChanOpen->pulChanHndl = NULL; - - f_pAdpcmChanOpen->ulInputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pAdpcmChanOpen->ulInputStream = cOCT6100_INVALID_STREAM; - f_pAdpcmChanOpen->ulInputNumTssts = 1; - f_pAdpcmChanOpen->ulInputPcmLaw = cOCT6100_PCM_U_LAW; - - f_pAdpcmChanOpen->ulOutputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pAdpcmChanOpen->ulOutputStream = cOCT6100_INVALID_STREAM; - f_pAdpcmChanOpen->ulOutputPcmLaw = cOCT6100_PCM_U_LAW; - f_pAdpcmChanOpen->ulOutputNumTssts = 1; - - f_pAdpcmChanOpen->ulChanMode = cOCT6100_ADPCM_ENCODING; - f_pAdpcmChanOpen->ulEncodingRate = cOCT6100_G726_32KBPS; - f_pAdpcmChanOpen->ulDecodingRate = cOCT6100_G726_32KBPS; - - f_pAdpcmChanOpen->ulAdpcmNibblePosition = cOCT6100_ADPCM_IN_LOW_BITS; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100AdpcmChanOpen -UINT32 Oct6100AdpcmChanOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100AdpcmChanOpenSer( f_pApiInstance, f_pAdpcmChanOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanClose - -Description: This function closes an opened ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanClose Pointer to ADPCM channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanCloseDef -UINT32 Oct6100AdpcmChanCloseDef( - tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ) -{ - f_pAdpcmChanClose->ulChanHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100AdpcmChanClose -UINT32 Oct6100AdpcmChanClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100AdpcmChanCloseSer( f_pApiInstance, f_pAdpcmChanClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetAdpcmChanSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the ADPCM memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetAdpcmChanSwSizes -UINT32 Oct6100ApiGetAdpcmChanSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine the amount of memory required for the API ADPCM channel list.*/ - f_pInstSizes->ulAdpcmChannelList = f_pOpenChip->ulMaxAdpcmChannels * sizeof( tOCT6100_API_ADPCM_CHAN ); - - if ( f_pOpenChip->ulMaxAdpcmChannels > 0 ) - { - /* Calculate memory needed for ADPCM memory allocation */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxAdpcmChannels, &f_pInstSizes->ulAdpcmChannelAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_48; - } - else - { - f_pInstSizes->ulAdpcmChannelAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulAdpcmChannelList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulAdpcmChannelAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAdpcmChanSwInit - -Description: Initializes all elements of the instance structure associated - to the ADPCM memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAdpcmChanSwInit -UINT32 Oct6100ApiAdpcmChanSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_ADPCM_CHAN pChannelsTsiList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMaxAdpcmChannels; - PVOID pAdpcmChannelsAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the ADPCM channel API list.*/ - ulMaxAdpcmChannels = pSharedInfo->ChipConfig.usMaxAdpcmChannels; - - /* Set all entries in the ADPCM channel list to unused. */ - mOCT6100_GET_ADPCM_CHAN_LIST_PNT( pSharedInfo, pChannelsTsiList ) - - /* Clear the memory */ - Oct6100UserMemSet( pChannelsTsiList, 0x00, sizeof(tOCT6100_API_ADPCM_CHAN) * ulMaxAdpcmChannels ); - - /* Initialize the ADPCM channel allocation structures to "all free". */ - if ( ulMaxAdpcmChannels > 0 ) - { - mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAdpcmChannelsAlloc ) - - ulResult = OctapiLlmAllocInit( &pAdpcmChannelsAlloc, ulMaxAdpcmChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_BD; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanOpenSer - -Description: Opens an ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to an ADPCM channel open structure - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanOpenSer -UINT32 Oct6100AdpcmChanOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - UINT16 usAdpcmChanIndex; - UINT16 usTsiMemIndex; - UINT16 usAdpcmMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Check the user's configuration of the ADPCM channel open structure for errors. */ - ulResult = Oct6100ApiCheckAdpcmChanParams( f_pApiInstance, f_pAdpcmChanOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the ADPCM channel. */ - ulResult = Oct6100ApiReserveAdpcmChanResources( f_pApiInstance, f_pAdpcmChanOpen, &usAdpcmChanIndex, &usAdpcmMemIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the ADPCM channel. */ - ulResult = Oct6100ApiWriteAdpcmChanStructs( f_pApiInstance, f_pAdpcmChanOpen, usAdpcmMemIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the ADPCM channel entry in the API list. */ - ulResult = Oct6100ApiUpdateAdpcmChanEntry( f_pApiInstance, f_pAdpcmChanOpen, usAdpcmChanIndex, usAdpcmMemIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckAdpcmChanParams - -Description: Checks the user's ADPCM channel open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckAdpcmChanParams -UINT32 Oct6100ApiCheckAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxAdpcmChannels == 0 ) - return cOCT6100_ERR_ADPCM_CHAN_DISABLED; - - if ( f_pAdpcmChanOpen->pulChanHndl == NULL ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - /* Check the input TDM streams, timeslots component for errors. */ - if ( f_pAdpcmChanOpen->ulInputNumTssts != 1 && - f_pAdpcmChanOpen->ulInputNumTssts != 2 ) - return cOCT6100_ERR_ADPCM_CHAN_INPUT_NUM_TSSTS; - - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulInputNumTssts, - f_pAdpcmChanOpen->ulInputTimeslot, - f_pAdpcmChanOpen->ulInputStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_ADPCM_CHAN_INPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_ADPCM_CHAN_INPUT_STREAM; - } - else - { - return ulResult; - } - } - - if( f_pAdpcmChanOpen->ulInputPcmLaw != cOCT6100_PCM_U_LAW && - f_pAdpcmChanOpen->ulInputPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_ADPCM_CHAN_INPUT_PCM_LAW; - - /* Check the output TDM streams, timeslots component for errors. */ - if ( f_pAdpcmChanOpen->ulOutputNumTssts != 1 && - f_pAdpcmChanOpen->ulOutputNumTssts != 2 ) - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_NUM_TSSTS; - - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulOutputNumTssts, - f_pAdpcmChanOpen->ulOutputTimeslot, - f_pAdpcmChanOpen->ulOutputStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_STREAM; - } - else - { - return ulResult; - } - } - if( f_pAdpcmChanOpen->ulOutputPcmLaw != cOCT6100_PCM_U_LAW && - f_pAdpcmChanOpen->ulOutputPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_PCM_LAW; - - /* Now, check the channel mode. */ - if ( f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_ENCODING && - f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_DECODING ) - return cOCT6100_ERR_ADPCM_CHAN_MODE; - - if ( f_pAdpcmChanOpen->ulChanMode == cOCT6100_ADPCM_ENCODING ) - { - /* Check the encoding rate. */ - if ( ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G711_64KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_40KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_32KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_24KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_16KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_40KBPS_4_1 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_40KBPS_3_2 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_40KBPS_2_3 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_32KBPS_4_0 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_32KBPS_3_1 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_32KBPS_2_2 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_24KBPS_3_0 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_24KBPS_2_1 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_16KBPS_2_0 ) ) - return cOCT6100_ERR_ADPCM_CHAN_ENCODING_RATE; - } - else /* if ( f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_DECODING ) */ - { - /* Check the decoding rate. */ - if ( f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_64KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_40KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_32KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_24KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_16KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G726_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G727_2C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G727_3C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G727_4C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G727_2C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G727_3C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G727_4C_ENCODED ) - return cOCT6100_ERR_ADPCM_CHAN_DECODING_RATE; - - /* Make sure that two timeslots are allocated if PCM-ECHO encoded is selected. */ - if ( (f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G726_ENCODED || - f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G727_2C_ENCODED || - f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G727_3C_ENCODED || - f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G727_4C_ENCODED ) && - f_pAdpcmChanOpen->ulInputNumTssts != 2 ) - return cOCT6100_ERR_ADPCM_CHAN_INCOMPATIBLE_NUM_TSSTS; - } - - /* Check the nibble position. */ - if ( f_pAdpcmChanOpen->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_LOW_BITS && - f_pAdpcmChanOpen->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_HIGH_BITS ) - return cOCT6100_ERR_ADPCM_CHAN_ADPCM_NIBBLE_POSITION; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveAdpcmChanResources - -Description: Reserves all resources needed for the new ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel configuration structure. -f_pusAdpcmChanIndex Allocated entry in ADPCM channel list. -f_pusAdpcmMemIndex Allocated entry in the ADPCM control memory. -f_pusTsiMemIndex Allocated entry in the TSI chariot memory. -f_pusInputTsstIndex TSST memory index of the input samples. -f_pusOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveAdpcmChanResources -UINT32 Oct6100ApiReserveAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - OUT PUINT16 f_pusAdpcmChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempVar; - BOOL fAdpcmChanEntry = FALSE; - BOOL fAdpcmMemEntry = FALSE; - BOOL fTsiMemEntry = FALSE; - BOOL fInputTsst = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the ADPCM channel list. */ - ulResult = Oct6100ApiReserveAdpcmChanEntry( f_pApiInstance, f_pusAdpcmChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fAdpcmChanEntry = TRUE; - - /* Find a TSI memory entry.*/ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, f_pusTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fTsiMemEntry = TRUE; - - /* Find a conversion memory entry. */ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, f_pusAdpcmMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fAdpcmMemEntry = TRUE; - - /* Reserve the input TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulInputTimeslot, - f_pAdpcmChanOpen->ulInputStream, - f_pAdpcmChanOpen->ulInputNumTssts, - cOCT6100_INPUT_TSST, - f_pusInputTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fInputTsst = TRUE; - - /* Reserve the output TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulOutputTimeslot, - f_pAdpcmChanOpen->ulOutputStream, - f_pAdpcmChanOpen->ulOutputNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusOutputTsstIndex, - NULL ); - } - } - } - else - { - /* Return an error other than a fatal error. */ - ulResult = cOCT6100_ERR_ADPCM_CHAN_NO_MORE_TSI_AVAILABLE; - } - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - if( fAdpcmChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseAdpcmChanEntry( f_pApiInstance, *f_pusAdpcmChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, *f_pusTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fAdpcmMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, *f_pusAdpcmMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fInputTsst == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulInputTimeslot, - f_pAdpcmChanOpen->ulInputStream, - f_pAdpcmChanOpen->ulInputNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteAdpcmChanStructs - -Description: Performs all the required structure writes to configure the - new ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel configuration structure. -f_pusAdpcmChanIndex Allocated entry in ADPCM channel list. -f_pusAdpcmMemIndex Allocated entry in the ADPCM control memory. -f_pusTsiMemIndex Allocated entry in the TSI chariot memory. -f_pusInputTsstIndex TSST memory index of the input samples. -f_pusOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteAdpcmChanStructs -UINT32 Oct6100ApiWriteAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulCompType = 0; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Configure the TSST control memory. */ - - /* Set the input TSST control entry. */ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usInputTsstIndex, - f_usTsiMemIndex, - f_pAdpcmChanOpen->ulInputPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry. */ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usOutputTsstIndex, - f_pAdpcmChanOpen->ulAdpcmNibblePosition, - f_pAdpcmChanOpen->ulOutputNumTssts, - f_usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Configure the ADPCM memory. */ - - if ( f_pAdpcmChanOpen->ulChanMode == cOCT6100_ADPCM_ENCODING ) - { - switch( f_pAdpcmChanOpen->ulEncodingRate ) - { - case cOCT6100_G711_64KBPS: - - if ( f_pAdpcmChanOpen->ulOutputPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else /* if ( f_pAdpcmChanOpen->ulOutputPcmLaw != cOCT6100_PCM_U_LAW ) */ - ulCompType = 0x5; - break; - case cOCT6100_G726_40KBPS: ulCompType = 0x3; break; - case cOCT6100_G726_32KBPS: ulCompType = 0x2; break; - case cOCT6100_G726_24KBPS: ulCompType = 0x1; break; - case cOCT6100_G726_16KBPS: ulCompType = 0x0; break; - case cOCT6100_G727_40KBPS_4_1: ulCompType = 0xD; break; - case cOCT6100_G727_40KBPS_3_2: ulCompType = 0xA; break; - case cOCT6100_G727_40KBPS_2_3: ulCompType = 0x6; break; - case cOCT6100_G727_32KBPS_4_0: ulCompType = 0xE; break; - case cOCT6100_G727_32KBPS_3_1: ulCompType = 0xB; break; - case cOCT6100_G727_32KBPS_2_2: ulCompType = 0x7; break; - case cOCT6100_G727_24KBPS_3_0: ulCompType = 0xC; break; - case cOCT6100_G727_24KBPS_2_1: ulCompType = 0x8; break; - case cOCT6100_G727_16KBPS_2_0: ulCompType = 0x9; break; - } - - ulResult = Oct6100ApiWriteEncoderMemory( f_pApiInstance, - f_usAdpcmMemIndex, - ulCompType, - f_usTsiMemIndex, - FALSE, - f_pAdpcmChanOpen->ulAdpcmNibblePosition, - cOCT6100_INVALID_INDEX, - cOCT6100_INVALID_VALUE, - cOCT6100_INVALID_VALUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_DECODING ) */ - { - switch( f_pAdpcmChanOpen->ulDecodingRate ) - { - case cOCT6100_G711_64KBPS: ulCompType = 0x8; break; - case cOCT6100_G726_40KBPS: ulCompType = 0x3; break; - case cOCT6100_G726_32KBPS: ulCompType = 0x2; break; - case cOCT6100_G726_24KBPS: ulCompType = 0x1; break; - case cOCT6100_G726_16KBPS: ulCompType = 0x0; break; - case cOCT6100_G727_2C_ENCODED: ulCompType = 0x4; break; - case cOCT6100_G727_3C_ENCODED: ulCompType = 0x5; break; - case cOCT6100_G727_4C_ENCODED: ulCompType = 0x6; break; - case cOCT6100_G726_ENCODED: ulCompType = 0x9; break; - case cOCT6100_G711_G726_ENCODED: ulCompType = 0xA; break; - case cOCT6100_G711_G727_2C_ENCODED: ulCompType = 0xC; break; - case cOCT6100_G711_G727_3C_ENCODED: ulCompType = 0xD; break; - case cOCT6100_G711_G727_4C_ENCODED: ulCompType = 0xE; break; - } - - ulResult = Oct6100ApiWriteDecoderMemory( f_pApiInstance, - f_usAdpcmMemIndex, - ulCompType, - f_usTsiMemIndex, - f_pAdpcmChanOpen->ulOutputPcmLaw, - f_pAdpcmChanOpen->ulAdpcmNibblePosition ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateAdpcmChanEntry - -Description: Updates the new ADPCM channel in the ADPCM channel list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel open configuration structure. -f_usAdpcmChanIndex Allocated entry in the ADPCM channel list. -f_usAdpcmMemIndex Allocated entry in ADPCM memory. -f_usTsiMemIndex Allocated entry in TSI chariot memory. -f_usInputTsstIndex TSST control memory index of the input TSST. -f_usOutputTsstIndex TSST control memory index of the output TSST. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateAdpcmChanEntry -UINT32 Oct6100ApiUpdateAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usAdpcmChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_API_ADPCM_CHAN pAdpcmChanEntry; - - /*------------------------------------------------------------------------------*/ - /* Obtain a pointer to the new ADPCM channel's list entry. */ - - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( f_pApiInstance->pSharedInfo, pAdpcmChanEntry, f_usAdpcmChanIndex ) - - /* Copy the buffer's configuration and allocated resources. */ - pAdpcmChanEntry->usInputTimeslot = (UINT16)( f_pAdpcmChanOpen->ulInputTimeslot & 0xFFFF ); - pAdpcmChanEntry->usInputStream = (UINT16)( f_pAdpcmChanOpen->ulInputStream & 0xFFFF ); - pAdpcmChanEntry->byInputNumTssts = (UINT8)( f_pAdpcmChanOpen->ulInputNumTssts & 0xFF ); - pAdpcmChanEntry->byInputPcmLaw = (UINT8)( f_pAdpcmChanOpen->ulInputPcmLaw & 0xFF ); - - pAdpcmChanEntry->usOutputTimeslot = (UINT16)( f_pAdpcmChanOpen->ulOutputTimeslot & 0xFFFF ); - pAdpcmChanEntry->usOutputStream = (UINT16)( f_pAdpcmChanOpen->ulOutputStream & 0xFFFF ); - pAdpcmChanEntry->byOutputNumTssts = (UINT8)( f_pAdpcmChanOpen->ulOutputNumTssts & 0xFF ); - pAdpcmChanEntry->byOutputPcmLaw = (UINT8)( f_pAdpcmChanOpen->ulOutputPcmLaw & 0xFF ); - - /* Store hardware related information. */ - pAdpcmChanEntry->usTsiMemIndex = f_usTsiMemIndex; - pAdpcmChanEntry->usAdpcmMemIndex = f_usAdpcmMemIndex; - pAdpcmChanEntry->usInputTsstIndex = f_usInputTsstIndex; - pAdpcmChanEntry->usOutputTsstIndex = f_usOutputTsstIndex; - - /* Form handle returned to user. */ - *f_pAdpcmChanOpen->pulChanHndl = cOCT6100_HNDL_TAG_ADPCM_CHANNEL | (pAdpcmChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usAdpcmChanIndex; - - /* Finally, mark the ADPCM channel as opened. */ - pAdpcmChanEntry->fReserved = TRUE; - - /* Increment the number of ADPCM channel opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberAdpcmChans++; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanCloseSer - -Description: Closes an ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanClose Pointer to ADPCM channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanCloseSer -UINT32 Oct6100AdpcmChanCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ) -{ - UINT16 usAdpcmChanIndex; - UINT16 usTsiMemIndex; - UINT16 usAdpcmMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertAdpcmChanParams( f_pApiInstance, f_pAdpcmChanClose, &usAdpcmChanIndex, &usAdpcmMemIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the ADPCM channel. */ - ulResult = Oct6100ApiInvalidateAdpcmChanStructs( f_pApiInstance, usAdpcmMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the ADPCM channel. */ - ulResult = Oct6100ApiReleaseAdpcmChanResources( f_pApiInstance, usAdpcmChanIndex, usAdpcmMemIndex, usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pAdpcmChanClose->ulChanHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertAdpcmChanParams - -Description: Validate the handle given by the user and verify the state of - the ADPCM channel about to be closed. - Also return all required information to deactivate the channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pAdpcmChanClose Pointer to ADPCM channel close structure. -f_pusAdpcmChanIndex Index of the ADPCM channel structure in the API list. -f_pusAdpcmMemIndex Index of the ADPCM memory structure in the API list. -f_pusTsiMemIndex Index of the TSI chariot memory used for this channel. -f_pusInputTsstIndex Index of the input entry in the TSST control memory. -f_pusOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertAdpcmChanParams -UINT32 Oct6100ApiAssertAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose, - OUT PUINT16 f_pusAdpcmChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_ADPCM_CHAN pAdpcmChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pAdpcmChanClose->ulChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_ADPCM_CHANNEL ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - *f_pusAdpcmChanIndex = (UINT16)( f_pAdpcmChanClose->ulChanHndl & cOCT6100_HNDL_INDEX_MASK ); - - if ( *f_pusAdpcmChanIndex >= pSharedInfo->ChipConfig.usMaxAdpcmChannels ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - /*------------------------------------------------------------------------------*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pAdpcmChanEntry, *f_pusAdpcmChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pAdpcmChanClose->ulChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pAdpcmChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_ADPCM_CHAN_NOT_OPEN; - if ( ulEntryOpenCnt != pAdpcmChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - /* Return info needed to close the channel and release all resources. */ - *f_pusInputTsstIndex = pAdpcmChanEntry->usInputTsstIndex; - *f_pusOutputTsstIndex = pAdpcmChanEntry->usOutputTsstIndex; - *f_pusTsiMemIndex = pAdpcmChanEntry->usTsiMemIndex; - *f_pusAdpcmMemIndex = pAdpcmChanEntry->usAdpcmMemIndex; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateAdpcmChanStructs - -Description: Closes an ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usAdpcmMemIndex Index of the ADPCM memory. -f_usInputTsstIndex Index of the input entry in the TSST control memory. -f_usOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateAdpcmChanStructs -UINT32 Oct6100ApiInvalidateAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Deactivate the TSST control memory. */ - - /* Set the input TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usInputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usOutputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Clear the ADPCM memory. */ - - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, f_usAdpcmMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseAdpcmChanResources - -Description: Release and clear the API entry associated to the ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_ulAdpcmChanIndex Index of the ADPCM channel in the API list. -f_usAdpcmMemIndex Index of the ADPCM memory used. -f_usTsiMemIndex Index of the TSI memory used. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseAdpcmChanResources -UINT32 Oct6100ApiReleaseAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_ADPCM_CHAN pAdpcmChanEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pAdpcmChanEntry, f_usAdpcmChanIndex ); - - /*------------------------------------------------------------------------------*/ - /* Release all resources associated with ADPCM channel. */ - - /* Release the entry in the ADPCM channel list. */ - ulResult = Oct6100ApiReleaseAdpcmChanEntry( f_pApiInstance, f_usAdpcmChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, f_usAdpcmMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, f_usTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the input TSST entry. */ - ulResult = Oct6100ApiReleaseTsst( - f_pApiInstance, - pAdpcmChanEntry->usInputTimeslot, - pAdpcmChanEntry->usInputStream, - pAdpcmChanEntry->byInputNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the output TSST entry. */ - ulResult = Oct6100ApiReleaseTsst( - f_pApiInstance, - pAdpcmChanEntry->usOutputTimeslot, - pAdpcmChanEntry->usOutputStream, - pAdpcmChanEntry->byOutputNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - } - } - } - } - - /* Check if an error occured while releasing the reserved resources. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult >= cOCT6100_ERR_FATAL ) - return ulResult; - else - return cOCT6100_ERR_FATAL_4A; - } - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Update the ADPCM channel's list entry. */ - - /* Mark the channel as closed. */ - pAdpcmChanEntry->fReserved = FALSE; - pAdpcmChanEntry->byEntryOpenCnt++; - - /* Decrement the number of ADPCM channels opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberAdpcmChans--; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveAdpcmChanEntry - -Description: Reserves one of the ADPCM channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusAdpcmChanIndex Resulting index reserved in the ADPCM channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveAdpcmChanEntry -UINT32 Oct6100ApiReserveAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusAdpcmChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pAdpcmChanAlloc; - UINT32 ulResult; - UINT32 ulAdpcmChanIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAdpcmChanAlloc ) - - ulResult = OctapiLlmAllocAlloc( pAdpcmChanAlloc, &ulAdpcmChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_ADPCM_CHAN_ALL_ADPCM_CHAN_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_BE; - } - - *f_pusAdpcmChanIndex = (UINT16)( ulAdpcmChanIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseAdpcmChanEntry - -Description: Releases the specified ADPCM channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usAdpcmChanIndex Index reserved in the ADPCM channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseAdpcmChanEntry -UINT32 Oct6100ApiReleaseAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pAdpcmChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAdpcmChanAlloc ) - - ulResult = OctapiLlmAllocDealloc( pAdpcmChanAlloc, f_usAdpcmChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_BF; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c deleted file mode 100644 index 0fe36d59..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c +++ /dev/null @@ -1,13931 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_channel.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open, modify and close echo - cancellation channels. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 492 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_mixer_inst.h" -#include "oct6100api/oct6100_tsi_cnct_inst.h" -#include "oct6100api/oct6100_conf_bridge_inst.h" -#include "oct6100api/oct6100_tone_detection_inst.h" -#include "oct6100api/oct6100_phasing_tsst_inst.h" -#include "oct6100api/oct6100_tsst_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_tsi_cnct_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" -#include "oct6100api/oct6100_phasing_tsst_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" -#include "oct6100api/oct6100_conf_bridge_pub.h" -#include "oct6100api/oct6100_tone_detection_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_debug_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_mixer_priv.h" -#include "oct6100_phasing_tsst_priv.h" -#include "oct6100_tsi_cnct_priv.h" -#include "oct6100_playout_buf_priv.h" -#include "oct6100_conf_bridge_priv.h" -#include "oct6100_tone_detection_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_debug_priv.h" - - -/**************************** PUBLIC FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelOpen - -Description: This function opens a echo cancellation channel. An echo cancellation - channel is constituted of two voice stream (RIN/ROUT and SIN/SOUT), and - an echo cancelling core. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo channel open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelOpenDef -UINT32 Oct6100ChannelOpenDef( - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ) -{ - f_pChannelOpen->pulChannelHndl = NULL; - f_pChannelOpen->ulUserChanId = cOCT6100_INVALID_VALUE; - f_pChannelOpen->ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_POWER_DOWN; - f_pChannelOpen->fEnableToneDisabler = FALSE; - f_pChannelOpen->fEnableExtToneDetection = FALSE; - - /* VQE configuration.*/ - f_pChannelOpen->VqeConfig.fSinDcOffsetRemoval = TRUE; - f_pChannelOpen->VqeConfig.fRinDcOffsetRemoval = TRUE; - f_pChannelOpen->VqeConfig.fRinLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lRinLevelControlGainDb = 0; - f_pChannelOpen->VqeConfig.fSoutLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lSoutLevelControlGainDb = 0; - f_pChannelOpen->VqeConfig.fRinAutomaticLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = -20; - f_pChannelOpen->VqeConfig.fSoutAutomaticLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = -20; - f_pChannelOpen->VqeConfig.fRinHighLevelCompensation = FALSE; - f_pChannelOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = -10; - f_pChannelOpen->VqeConfig.fSoutAdaptiveNoiseReduction = FALSE; - f_pChannelOpen->VqeConfig.fSoutNoiseBleaching = FALSE; - f_pChannelOpen->VqeConfig.fSoutConferencingNoiseReduction = FALSE; - f_pChannelOpen->VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; - f_pChannelOpen->VqeConfig.fEnableNlp = TRUE; - f_pChannelOpen->VqeConfig.fEnableTailDisplacement = FALSE; - f_pChannelOpen->VqeConfig.ulTailDisplacement = cOCT6100_AUTO_SELECT_TAIL; - f_pChannelOpen->VqeConfig.ulTailLength = cOCT6100_AUTO_SELECT_TAIL; - - f_pChannelOpen->VqeConfig.fDtmfToneRemoval = FALSE; - - f_pChannelOpen->VqeConfig.fAcousticEcho = FALSE; - f_pChannelOpen->VqeConfig.lDefaultErlDb = -6; - f_pChannelOpen->VqeConfig.ulAecTailLength = 128; - f_pChannelOpen->VqeConfig.lAecDefaultErlDb = 0; - f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorA = 1; - f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorB = 0; - f_pChannelOpen->VqeConfig.ulDoubleTalkBehavior = cOCT6100_DOUBLE_TALK_BEH_NORMAL; - f_pChannelOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = 0; - f_pChannelOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = 0; - f_pChannelOpen->VqeConfig.fSoutNaturalListenerEnhancement = FALSE; - f_pChannelOpen->VqeConfig.fRoutNoiseReduction = FALSE; - f_pChannelOpen->VqeConfig.lRoutNoiseReductionLevelGainDb = -18; - f_pChannelOpen->VqeConfig.lAnrSnrEnhancementDb = -18; - f_pChannelOpen->VqeConfig.ulAnrVoiceNoiseSegregation = 6; - f_pChannelOpen->VqeConfig.ulToneDisablerVqeActivationDelay = 300; - f_pChannelOpen->VqeConfig.fEnableMusicProtection = FALSE; - /* Older images have idle code detection hard-coded to enabled. */ - f_pChannelOpen->VqeConfig.fIdleCodeDetection = TRUE; - - /* TDM configuration.*/ - f_pChannelOpen->TdmConfig.ulRinNumTssts = 1; - f_pChannelOpen->TdmConfig.ulSinNumTssts = 1; - f_pChannelOpen->TdmConfig.ulRoutNumTssts = 1; - f_pChannelOpen->TdmConfig.ulSoutNumTssts = 1; - - f_pChannelOpen->TdmConfig.ulRinTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRinStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRinPcmLaw = cOCT6100_PCM_U_LAW; - - f_pChannelOpen->TdmConfig.ulSinTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSinStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSinPcmLaw = cOCT6100_PCM_U_LAW; - - f_pChannelOpen->TdmConfig.ulRoutTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRoutStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRoutPcmLaw = cOCT6100_PCM_U_LAW; - - f_pChannelOpen->TdmConfig.ulSoutTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSoutStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSoutPcmLaw = cOCT6100_PCM_U_LAW; - - /* CODEC configuration.*/ - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition = cOCT6100_ADPCM_IN_LOW_BITS; - - f_pChannelOpen->CodecConfig.ulEncoderPort = cOCT6100_CHANNEL_PORT_SOUT; - f_pChannelOpen->CodecConfig.ulEncodingRate = cOCT6100_G711_64KBPS; - f_pChannelOpen->CodecConfig.ulDecoderPort = cOCT6100_CHANNEL_PORT_RIN; - f_pChannelOpen->CodecConfig.ulDecodingRate = cOCT6100_G711_64KBPS; - - f_pChannelOpen->CodecConfig.fEnableSilenceSuppression = FALSE; - f_pChannelOpen->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - f_pChannelOpen->CodecConfig.ulPhase = 1; - f_pChannelOpen->CodecConfig.ulPhasingType = cOCT6100_NO_PHASING; - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelOpen -UINT32 Oct6100ChannelOpen( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelOpenSer( f_pApiInstance, f_pChannelOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelClose - -Description: This function closes an echo canceller channel - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelClose Pointer to channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCloseDef -UINT32 Oct6100ChannelCloseDef( - IN OUT tPOCT6100_CHANNEL_CLOSE f_pChannelClose ) -{ - f_pChannelClose->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelClose -UINT32 Oct6100ChannelClose( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelCloseSer( f_pApiInstance, f_pChannelClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelModify - -Description: This function will modify the parameter of an echo channel. If - the call to this channel allows the channel to go from power down - to enable, the API will activate it. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo channel change structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelModifyDef -UINT32 Oct6100ChannelModifyDef( - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ) -{ - f_pChannelModify->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelModify->ulUserChanId = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->ulEchoOperationMode = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->fEnableToneDisabler = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->fApplyToAllChannels = FALSE; - - f_pChannelModify->fDisableToneDetection = FALSE; - f_pChannelModify->fStopBufferPlayout = FALSE; - f_pChannelModify->fRemoveConfBridgeParticipant = FALSE; - f_pChannelModify->fRemoveBroadcastTssts = FALSE; - - f_pChannelModify->fTdmConfigModified = FALSE; - f_pChannelModify->fVqeConfigModified = FALSE; - f_pChannelModify->fCodecConfigModified = FALSE; - - /* VQE config. */ - f_pChannelModify->VqeConfig.fSinDcOffsetRemoval = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinDcOffsetRemoval = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRinLevelControlGainDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lSoutLevelControlGainDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinAutomaticLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRinAutomaticLevelControlTargetDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutAutomaticLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lSoutAutomaticLevelControlTargetDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinHighLevelCompensation = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRinHighLevelCompensationThresholdDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutAdaptiveNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutNoiseBleaching = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutConferencingNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulComfortNoiseMode = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fEnableNlp = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fEnableTailDisplacement = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulTailDisplacement = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->VqeConfig.fDtmfToneRemoval = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->VqeConfig.fAcousticEcho = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lDefaultErlDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulAecTailLength = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lAecDefaultErlDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulNonLinearityBehaviorA = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulNonLinearityBehaviorB = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulDoubleTalkBehavior = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutNaturalListenerEnhancement = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRoutNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRoutNoiseReductionLevelGainDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lAnrSnrEnhancementDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulAnrVoiceNoiseSegregation = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulToneDisablerVqeActivationDelay = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fEnableMusicProtection = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fIdleCodeDetection = cOCT6100_KEEP_PREVIOUS_SETTING; - - /* TDM config. */ - f_pChannelModify->TdmConfig.ulRinNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSinNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRoutNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSoutNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulRinTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRinStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRinPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulSinTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSinStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSinPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulRoutTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRoutStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRoutPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulSoutTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSoutStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSoutPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - /* CODEC config. */ - f_pChannelModify->CodecConfig.ulEncoderPort = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulEncodingRate = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulDecoderPort = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulDecodingRate = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->CodecConfig.fEnableSilenceSuppression = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulPhasingTsstHndl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulPhase = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulPhasingType = cOCT6100_KEEP_PREVIOUS_SETTING; - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelModify -UINT32 Oct6100ChannelModify( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Check the apply to all channels flag first. */ - if ( f_pChannelModify->fApplyToAllChannels != TRUE && - f_pChannelModify->fApplyToAllChannels != FALSE ) - return cOCT6100_ERR_CHANNEL_APPLY_TO_ALL_CHANNELS; - - /* Check if must apply modification to all channels. */ - if ( f_pChannelModify->fApplyToAllChannels == TRUE ) - { - tPOCT6100_API_CHANNEL pChanEntry; - UINT16 usChanIndex; - - /* Loop through all channels and look for the opened ones. */ - for ( usChanIndex = 0; usChanIndex < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; usChanIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, usChanIndex ); - - /* Check if this one is opened. */ - if ( pChanEntry->fReserved == TRUE ) - { - /* Channel is opened. Form handle and call actual modify function. */ - f_pChannelModify->ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | usChanIndex; - - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelModifySer( f_pApiInstance, f_pChannelModify ); - if ( ulFncRes != cOCT6100_ERR_OK ) - break; - } - } - } - else /* if ( f_pChannelModify->fApplyToAllChannels == FALSE ) */ - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelModifySer( f_pApiInstance, f_pChannelModify ); - } - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelCreateBiDir - -Description: This function creates a bidirectional channel using two standard - echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelCreateBiDir Pointer to channel create BiDir structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCreateBiDirDef -UINT32 Oct6100ChannelCreateBiDirDef( - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ) -{ - f_pChannelCreateBiDir->pulBiDirChannelHndl = NULL; - - f_pChannelCreateBiDir->ulFirstChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelCreateBiDir->ulSecondChannelHndl = cOCT6100_INVALID_HANDLE; - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelCreateBiDir -UINT32 Oct6100ChannelCreateBiDir( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelCreateBiDirSer( f_pApiInstance, f_pChannelCreateBiDir ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelDestroyBiDir - -Description: This function destroys a bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelDestroyBiDir Pointer to channel destroy BiDir structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelDestroyBiDirDef -UINT32 Oct6100ChannelDestroyBiDirDef( - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ) -{ - f_pChannelDestroyBiDir->ulBiDirChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelDestroyBiDir -UINT32 Oct6100ChannelDestroyBiDir( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelDestroyBiDirSer( f_pApiInstance, f_pChannelDestroyBiDir ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstAdd - -Description: This function adds a TSST to one of the two output ports of a channel. - This TSST can never be modified by a call to Oct6100ChannelModify. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelBroadcastTsstAdd Pointer to the an Add Broadcast TSST structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstAddDef -UINT32 Oct6100ChannelBroadcastTsstAddDef( - tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelBroadcastTsstAdd ) -{ - f_pChannelBroadcastTsstAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - f_pChannelBroadcastTsstAdd->ulPort = cOCT6100_INVALID_PORT; - f_pChannelBroadcastTsstAdd->ulTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pChannelBroadcastTsstAdd->ulStream = cOCT6100_INVALID_STREAM; - - return cOCT6100_ERR_OK; - -} -#endif - -#if !SKIP_Oct6100ChannelBroadcastTsstAdd -UINT32 Oct6100ChannelBroadcastTsstAdd( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelBroadcastTsstAdd ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelBroadcastTsstAddSer( f_pApiInstance, f_pChannelBroadcastTsstAdd ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstRemove - -Description: This function removes a TSST from one of the two output ports of a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelBroadcastTsstRemove Pointer to the a Remove Broadcast TSST structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstRemoveDef -UINT32 Oct6100ChannelBroadcastTsstRemoveDef( - tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelBroadcastTsstRemove ) -{ - f_pChannelBroadcastTsstRemove->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - f_pChannelBroadcastTsstRemove->ulPort = cOCT6100_INVALID_PORT; - f_pChannelBroadcastTsstRemove->ulTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pChannelBroadcastTsstRemove->ulStream = cOCT6100_INVALID_STREAM; - - f_pChannelBroadcastTsstRemove->fRemoveAll = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ChannelBroadcastTsstRemove -UINT32 Oct6100ChannelBroadcastTsstRemove( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelBroadcastTsstRemove ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelBroadcastTsstRemoveSer( f_pApiInstance, f_pChannelBroadcastTsstRemove ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelGetStats - -Description: This function retrieves all the config and stats related to the channel - designated by ulChannelHndl. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelStats Pointer to a tOCT6100_CHANNEL_STATS structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelGetStatsDef -UINT32 Oct6100ChannelGetStatsDef( - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ) -{ - f_pChannelStats->fResetStats = FALSE; - - f_pChannelStats->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelStats->ulUserChanId = cOCT6100_INVALID_STAT; - f_pChannelStats->ulEchoOperationMode = cOCT6100_INVALID_STAT; - f_pChannelStats->fEnableToneDisabler = FALSE; - f_pChannelStats->ulMutePortsMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; - f_pChannelStats->fEnableExtToneDetection = FALSE; - - /* VQE configuration.*/ - f_pChannelStats->VqeConfig.fEnableNlp = FALSE; - f_pChannelStats->VqeConfig.fEnableTailDisplacement = FALSE; - f_pChannelStats->VqeConfig.ulTailDisplacement = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulTailLength = cOCT6100_INVALID_STAT; - - f_pChannelStats->VqeConfig.fSinDcOffsetRemoval = FALSE; - f_pChannelStats->VqeConfig.fRinDcOffsetRemoval = FALSE; - f_pChannelStats->VqeConfig.fRinLevelControl = FALSE; - f_pChannelStats->VqeConfig.fSoutLevelControl = FALSE; - f_pChannelStats->VqeConfig.fRinAutomaticLevelControl = FALSE; - f_pChannelStats->VqeConfig.fSoutAutomaticLevelControl = FALSE; - f_pChannelStats->VqeConfig.fRinHighLevelCompensation = FALSE; - f_pChannelStats->VqeConfig.fAcousticEcho = FALSE; - f_pChannelStats->VqeConfig.fSoutAdaptiveNoiseReduction = FALSE; - f_pChannelStats->VqeConfig.fDtmfToneRemoval = FALSE; - - f_pChannelStats->VqeConfig.fSoutNoiseBleaching = FALSE; - f_pChannelStats->VqeConfig.fSoutConferencingNoiseReduction = FALSE; - - f_pChannelStats->VqeConfig.ulComfortNoiseMode = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorA = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorB = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulDoubleTalkBehavior = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.lRinLevelControlGainDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lSoutLevelControlGainDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lRinAutomaticLevelControlTargetDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lSoutAutomaticLevelControlTargetDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lRinHighLevelCompensationThresholdDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lDefaultErlDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lAecDefaultErlDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.ulAecTailLength = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.fSoutNaturalListenerEnhancement = FALSE; - f_pChannelStats->VqeConfig.fRoutNoiseReduction = FALSE; - f_pChannelStats->VqeConfig.lRoutNoiseReductionLevelGainDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lAnrSnrEnhancementDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.ulAnrVoiceNoiseSegregation = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulToneDisablerVqeActivationDelay = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.fEnableMusicProtection = FALSE; - f_pChannelStats->VqeConfig.fIdleCodeDetection = FALSE; - - - - /* TDM configuration.*/ - f_pChannelStats->TdmConfig.ulMaxBroadcastTssts = 0; - f_pChannelStats->TdmConfig.fMoreRoutBroadcastTssts = FALSE; - f_pChannelStats->TdmConfig.fMoreSoutBroadcastTssts = FALSE; - - f_pChannelStats->TdmConfig.ulNumRoutBroadcastTssts = 0; - f_pChannelStats->TdmConfig.ulNumSoutBroadcastTssts = 0; - - f_pChannelStats->TdmConfig.ulRinNumTssts = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSinNumTssts = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRoutNumTssts = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSoutNumTssts = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.ulRinTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRinStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRinPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.ulSinTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSinStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSinPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.ulRoutTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRoutStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRoutPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.pulRoutBroadcastTimeslot = NULL; - f_pChannelStats->TdmConfig.pulRoutBroadcastStream = NULL; - - f_pChannelStats->TdmConfig.ulSoutTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSoutStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSoutPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.pulSoutBroadcastTimeslot = NULL; - f_pChannelStats->TdmConfig.pulSoutBroadcastStream = NULL; - - - /* CODEC configuration.*/ - f_pChannelStats->CodecConfig.ulAdpcmNibblePosition = cOCT6100_INVALID_STAT; - - f_pChannelStats->CodecConfig.ulEncoderPort = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulEncodingRate = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulDecoderPort = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulDecodingRate = cOCT6100_INVALID_STAT; - - f_pChannelStats->CodecConfig.fEnableSilenceSuppression = FALSE; - f_pChannelStats->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulPhase = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulPhasingType = cOCT6100_INVALID_STAT; - - f_pChannelStats->ulNumEchoPathChanges = cOCT6100_INVALID_STAT; - f_pChannelStats->ulToneDisablerStatus = cOCT6100_INVALID_STAT; - f_pChannelStats->fEchoCancellerConverged = FALSE; - f_pChannelStats->fSinVoiceDetected = FALSE; - f_pChannelStats->lCurrentERL = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lCurrentERLE = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->ulCurrentEchoDelay = cOCT6100_INVALID_STAT; - - f_pChannelStats->lMaxERL = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lMaxERLE = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->ulMaxEchoDelay = cOCT6100_INVALID_STAT; - - f_pChannelStats->lRinLevel = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lSinLevel = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lRinAppliedGain = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lSoutAppliedGain = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lComfortNoiseLevel = cOCT6100_INVALID_SIGNED_STAT; - - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelGetStats -UINT32 Oct6100ChannelGetStats( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ApiChannelGetStatsSer( f_pApiInstance, f_pChannelStats ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelMute - -Description: This function mutes some or all of the ports designated by - ulChannelHndl. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelMute Pointer to a tPOCT6100_CHANNEL_MUTE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelMuteDef -UINT32 Oct6100ChannelMuteDef( - IN OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute ) -{ - f_pChannelMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelMute->ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelMute -UINT32 Oct6100ChannelMute( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelMuteSer( f_pApiInstance, f_pChannelMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelUnMute - -Description: This function unmutes some or all of the ports designated by - ulChannelHndl. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelUnMute Pointer to a tPOCT6100_CHANNEL_UNMUTE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelUnMuteDef -UINT32 Oct6100ChannelUnMuteDef( - IN OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ) -{ - f_pChannelUnMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelUnMute->ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelUnMute -UINT32 Oct6100ChannelUnMute( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelUnMuteSer( f_pApiInstance, f_pChannelUnMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetChannelsEchoSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the ECHO memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetChannelsEchoSwSizes -UINT32 Oct6100ApiGetChannelsEchoSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - UINT32 ulMaxChannels; - - ulMaxChannels = f_pOpenChip->ulMaxChannels; - - if ( f_pOpenChip->fEnableChannelRecording == TRUE && ulMaxChannels != 672 ) - ulMaxChannels++; - - /* Determine the amount of memory required for the API echo channel list.*/ - f_pInstSizes->ulChannelList = ulMaxChannels * sizeof( tOCT6100_API_CHANNEL ); /* Add one for the record channel.*/ - f_pInstSizes->ulBiDirChannelList = f_pOpenChip->ulMaxBiDirChannels * sizeof( tOCT6100_API_BIDIR_CHANNEL ); - if ( ulMaxChannels > 0 ) - { - /* Calculate memory needed for ECHO memory allocation */ - ulResult = OctapiLlmAllocGetSize( ulMaxChannels, &f_pInstSizes->ulChannelAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_0; - } - else - { - f_pInstSizes->ulChannelAlloc = 0; - } - if ( f_pOpenChip->ulMaxBiDirChannels > 0 ) - { - /* Calculate memory needed for ECHO memory allocation */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxBiDirChannels, &f_pInstSizes->ulBiDirChannelAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_0; - } - else - { - f_pInstSizes->ulBiDirChannelAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulChannelList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulChannelAlloc, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulBiDirChannelList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulBiDirChannelAlloc, ulTempVar ) - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiChannelsEchoSwInit - -Description: Initializes all elements of the instance structure associated - to the ECHO memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiChannelsEchoSwInit -UINT32 Oct6100ApiChannelsEchoSwInit( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_CHANNEL pChannelsEchoList; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChannelsList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT16 usMaxChannels; - PVOID pEchoChanAlloc; - PVOID pBiDirChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the ECHO channel API list.*/ - usMaxChannels = pSharedInfo->ChipConfig.usMaxChannels; - - /* add a channel to initialize if the recording is activated. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - usMaxChannels++; - - /* Set all entries in the ADCPM channel list to unused. */ - mOCT6100_GET_CHANNEL_LIST_PNT( pSharedInfo, pChannelsEchoList ); - - /* Initialize the API ECHO channels allocation software to "all free". */ - if ( usMaxChannels > 0 ) - { - /* Clear the memory */ - Oct6100UserMemSet( pChannelsEchoList, 0x00, sizeof(tOCT6100_API_CHANNEL) * usMaxChannels ); - - mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pEchoChanAlloc ) - - ulResult = OctapiLlmAllocInit( &pEchoChanAlloc, usMaxChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1; - } - - mOCT6100_GET_BIDIR_CHANNEL_LIST_PNT( pSharedInfo, pBiDirChannelsList ); - - if ( pSharedInfo->ChipConfig.usMaxBiDirChannels > 0 ) - { - /* Clear the memory */ - Oct6100UserMemSet( pBiDirChannelsList, 0x00, sizeof(tOCT6100_API_BIDIR_CHANNEL) * pSharedInfo->ChipConfig.usMaxBiDirChannels ); - - mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pBiDirChanAlloc ) - - ulResult = OctapiLlmAllocInit( &pBiDirChanAlloc, pSharedInfo->ChipConfig.usMaxBiDirChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A9; - - } - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelOpenSer - -Description: Opens a echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to channel configuration structure. Then handle - identifying the buffer in all future function calls is - returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelOpenSer -UINT32 Oct6100ChannelOpenSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ) -{ - tOCT6100_API_ECHO_CHAN_INDEX *ChannelIndexConf; - UINT32 ulResult; - - ChannelIndexConf = kmalloc(sizeof(*ChannelIndexConf), GFP_ATOMIC); - - if (!ChannelIndexConf) - return cOCT6100_ERR_FATAL_0; - - /* Check the user's configuration of the echo cancellation channel for errors. */ - ulResult = Oct6100ApiCheckChannelParams( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Reserve all resources needed by the echo cancellation channel. */ - ulResult = Oct6100ApiReserveChannelResources( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiWriteChannelStructs( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiUpdateChannelEntry( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - kfree(ChannelIndexConf); - return cOCT6100_ERR_OK; - -out: - kfree(ChannelIndexConf); - return ulResult; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChannelParams - -Description: Checks the user's echo cancellation channel open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel open configuration structure. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChannelParams -UINT32 Oct6100ApiCheckChannelParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tPOCT6100_CHANNEL_OPEN_VQE pVqeConfig; - tPOCT6100_CHANNEL_OPEN_CODEC pCodecConfig; - UINT32 ulDecoderNumTssts; - UINT32 ulResult; - - /* Dereference the configuration structure for clearer code and faster access.*/ - pTdmConfig = &f_pChannelOpen->TdmConfig; - pVqeConfig = &f_pChannelOpen->VqeConfig; - pCodecConfig = &f_pChannelOpen->CodecConfig; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels == 0 ) - return cOCT6100_ERR_CHANNEL_DISABLED; - - if ( f_pChannelOpen->pulChannelHndl == NULL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - if ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NORMAL && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_FREEZE && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_RESET && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_POWER_DOWN && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_EXTERNAL && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE; - - /* Check the 2100Hz echo disabling configuration.*/ - if ( f_pChannelOpen->fEnableToneDisabler != TRUE && - f_pChannelOpen->fEnableToneDisabler != FALSE ) - return cOCT6100_ERR_CHANNEL_TONE_DISABLER_ENABLE; - - /* Check the extended Tone Detection flag value.*/ - if ( f_pChannelOpen->fEnableExtToneDetection != TRUE && - f_pChannelOpen->fEnableExtToneDetection != FALSE ) - return cOCT6100_ERR_CHANNEL_ENABLE_EXT_TONE_DETECTION; - - /* Check that extented tone detection is actually enabled by the user. */ - if ( ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) && - ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableExtToneDetection == FALSE ) ) - return cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DISABLED; - - - - /*==============================================================================*/ - /* Check the TDM configuration parameters.*/ - - ulResult = Oct6100ApiCheckTdmConfig( f_pApiInstance, pTdmConfig ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Now validate the VQE parameters */ - - ulResult = Oct6100ApiCheckVqeConfig( f_pApiInstance, pVqeConfig, f_pChannelOpen->fEnableToneDisabler ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Verify if the echo operation mode selected can be applied. */ - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( pVqeConfig->fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( pVqeConfig->fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - /* Comfort noise must be activated for speech recognition mode to work. */ - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( pVqeConfig->ulComfortNoiseMode == cOCT6100_COMFORT_NOISE_OFF ) ) - return cOCT6100_ERR_CHANNEL_COMFORT_NOISE_REQUIRED; - - /*==============================================================================*/ - - /*==============================================================================*/ - /* Finally, validate the CODEC configuration.*/ - - if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - ulDecoderNumTssts = pTdmConfig->ulRinNumTssts; - else /* pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - ulDecoderNumTssts = pTdmConfig->ulSinNumTssts; - - ulResult = Oct6100ApiCheckCodecConfig( f_pApiInstance, pCodecConfig, ulDecoderNumTssts, &f_pChanIndexConf->usPhasingTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - /* make sure that if silence suppression is activated, the NLP is enabled.*/ - if ( pCodecConfig->fEnableSilenceSuppression == TRUE && pVqeConfig->fEnableNlp == FALSE ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_NLP_MUST_BE_ENABLED; - - /* Verify if law conversion is allowed. */ - if ( pCodecConfig->ulEncoderPort == cOCT6100_NO_ENCODING || - pCodecConfig->ulDecoderPort == cOCT6100_NO_DECODING ) - { - /* No law conversion can occurs if one ADPCM memory is not reserved.*/ - if ( pTdmConfig->ulRinPcmLaw != pTdmConfig->ulRoutPcmLaw ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_LAW_TRANSLATION; - - if ( pTdmConfig->ulSinPcmLaw != pTdmConfig->ulSoutPcmLaw ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_LAW_TRANSLATION; - } - - /* Verify if the config supports extended tone detection.*/ - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DECODER_PORT; - } - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveChannelResources - -Description: Reserves all resources needed for the new channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_pulChannelIndex Allocated entry in ECHO channel list. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveChannelResources -UINT32 Oct6100ApiReserveChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tPOCT6100_CHANNEL_OPEN_CODEC pCodecConfig; - - UINT32 ulResult; - UINT32 ulTempVar; - UINT32 ulFreeMixerEventCnt; - - BOOL fRinTsstEntry = FALSE; - BOOL fSinTsstEntry = FALSE; - BOOL fRoutTsstEntry = FALSE; - BOOL fSoutTsstEntry = FALSE; - - BOOL fRinRoutTsiMemEntry = FALSE; - BOOL fSinSoutTsiMemEntry = FALSE; - - BOOL fEchoChanEntry = FALSE; - - PUINT16 pusRinRoutConversionMemIndex = NULL; - PUINT16 pusSinSoutConversionMemIndex = NULL; - BOOL fRinRoutConversionMemEntry = FALSE; - BOOL fSinSoutConversionMemEntry = FALSE; - - BOOL fExtToneChanEntry = FALSE; - BOOL fExtToneTsiEntry = FALSE; - BOOL fExtToneMixerEntry = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a local pointer to the configuration structures.*/ - pTdmConfig = &f_pChannelOpen->TdmConfig; - pCodecConfig = &f_pChannelOpen->CodecConfig; - - /*===============================================================================*/ - /* Reserve Echo and TSI entries. */ - - ulResult = Oct6100ApiReserveEchoEntry( f_pApiInstance, - &f_pChanIndexConf->usEchoChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fEchoChanEntry = TRUE; - - /* Set the echo, encoder and decoder memory indexes.*/ - f_pChanIndexConf->usEchoMemIndex = f_pChanIndexConf->usEchoChanIndex; - - /* Reserve an entry for the RIN/ROUT tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinRoutTsiMemEntry = TRUE; - - /* Reserve an entry for the SIN/SOUT tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinSoutTsiMemEntry = TRUE; - - /* Reserve an ADPCM memory block for compression if required.*/ - if ( pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - pusRinRoutConversionMemIndex = &f_pChanIndexConf->usRinRoutConversionMemIndex; - } - else if ( pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - pusSinSoutConversionMemIndex = &f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - /* Reserve an ADPCM memory block for decompression if required.*/ - if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - pusRinRoutConversionMemIndex = &f_pChanIndexConf->usRinRoutConversionMemIndex; - } - else if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN ) - { - pusSinSoutConversionMemIndex = &f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - - /* Reserve the conversion memories. */ - if ( pusRinRoutConversionMemIndex != NULL ) - { - /* Reserve a conversion memory for the Rin/Rout stream. */ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, - pusRinRoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinRoutConversionMemEntry = TRUE; - } - } - else - { - /* No conversion memory reserved.*/ - f_pChanIndexConf->usRinRoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - if ( ( pusSinSoutConversionMemIndex != NULL ) && - ( ulResult == cOCT6100_ERR_OK ) ) - { - /* Reserve a conversion memory for the Sin/Sout stream. */ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, - pusSinSoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinSoutConversionMemEntry = TRUE; - } - } - else - { - /* No conversion memory reserved.*/ - f_pChanIndexConf->usSinSoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Reserve any resources required if the extended Tone detection is enabled.*/ - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - ulResult = Oct6100ApiReserveEchoEntry( f_pApiInstance, - &f_pChanIndexConf->usExtToneChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fExtToneChanEntry = TRUE; - - /* Reserve an entry for the TSI chariot memory for the additionnal channel. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &f_pChanIndexConf->usExtToneTsiIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fExtToneTsiEntry = TRUE; - - /* Reserve an entry for the TSI chariot memory for the additionnal channel. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - &f_pChanIndexConf->usExtToneMixerIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fExtToneMixerEntry = TRUE; - } - } - } - else - { - f_pChanIndexConf->usExtToneChanIndex = cOCT6100_INVALID_INDEX; - f_pChanIndexConf->usExtToneMixerIndex = cOCT6100_INVALID_INDEX; - f_pChanIndexConf->usExtToneTsiIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - /* Return an error other then a Fatal.*/ - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_TSI_MEMORY; - } - } - else - { - /* Return an error other then a Fatal.*/ - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_TSI_MEMORY; - } - } - - /*===============================================================================*/ - - /*===============================================================================*/ - /* Now reserve the TSST entries if required.*/ - - /* Reserve the Rin TSST entry */ - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulRinTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulRinStream != cOCT6100_UNASSIGNED) ) - { - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulRinTimeslot, - pTdmConfig->ulRinStream, - pTdmConfig->ulRinNumTssts, - cOCT6100_INPUT_TSST, - &f_pChanIndexConf->usRinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fRinTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usRinTsstIndex = cOCT6100_INVALID_INDEX; - } - - - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulSinTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulSinStream != cOCT6100_UNASSIGNED) ) - { - /* Reserve the Sin TSST entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulSinTimeslot, - pTdmConfig->ulSinStream, - pTdmConfig->ulSinNumTssts, - cOCT6100_INPUT_TSST, - &f_pChanIndexConf->usSinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fSinTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usSinTsstIndex = cOCT6100_INVALID_INDEX; - } - - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulRoutTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulRoutStream != cOCT6100_UNASSIGNED) ) - { - /* Reserve the Rout TSST entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulRoutTimeslot, - pTdmConfig->ulRoutStream, - pTdmConfig->ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - &f_pChanIndexConf->usRoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fRoutTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulSoutTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulSoutStream != cOCT6100_UNASSIGNED) ) - { - /* Reserve the Sout TSST entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulSoutTimeslot, - pTdmConfig->ulSoutStream, - pTdmConfig->ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - &f_pChanIndexConf->usSoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fSoutTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Check if there are a couple of mixer events available for us. */ - - if ( ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulMixerEventCntNeeded = 0; - - /* Calculate how many mixer events are needed. */ - if ( f_pChanIndexConf->usRinTsstIndex == cOCT6100_INVALID_INDEX ) - ulMixerEventCntNeeded++; - - if ( f_pChanIndexConf->usSinTsstIndex == cOCT6100_INVALID_INDEX ) - ulMixerEventCntNeeded++; - - /* If at least 1 mixer event is needed, check if those are available. */ - if ( ulMixerEventCntNeeded != 0 ) - { - ulResult = Oct6100ApiGetFreeMixerEventCnt( f_pApiInstance, &ulFreeMixerEventCnt ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* The API might need more mixer events if the ports have to be muted. */ - /* Check if these are available. */ - if ( ulFreeMixerEventCnt < ulMixerEventCntNeeded ) - { - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_MIXER_EVENTS; - } - } - } - } - - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Release the resources if something went wrong */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /*===============================================================================*/ - /* Release the previously reserved resources .*/ - if( fRinTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulRinTimeslot, - pTdmConfig->ulRinStream, - pTdmConfig->ulRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSinTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulSinTimeslot, - pTdmConfig->ulSinStream, - pTdmConfig->ulSinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fRoutTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulRoutTimeslot, - pTdmConfig->ulRoutStream, - pTdmConfig->ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSoutTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulSoutTimeslot, - pTdmConfig->ulSoutStream, - pTdmConfig->ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fRinRoutTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSinSoutTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - /*===============================================================================*/ - /* Release the previously reserved echo resources .*/ - if( fEchoChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseEchoEntry( f_pApiInstance, - f_pChanIndexConf->usEchoChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - /*===============================================================================*/ - /* Release the previously reserved resources for the extended tone detection.*/ - if( fExtToneChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseEchoEntry( f_pApiInstance, - f_pChanIndexConf->usExtToneChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fExtToneTsiEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - f_pChanIndexConf->usExtToneTsiIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fExtToneMixerEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - f_pChanIndexConf->usExtToneMixerIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - /*===============================================================================*/ - - /*===============================================================================*/ - /* Release the conversion resources. */ - if( fRinRoutConversionMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - f_pChanIndexConf->usRinRoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSinSoutConversionMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - f_pChanIndexConf->usSinSoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteChannelStructs - -Description: Performs all the required structure writes to configure the - new echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteChannelStructs -UINT32 Oct6100ApiWriteChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulDwordAddress; - UINT32 ulDwordData; - BOOL fConversionEnabled = FALSE; - BOOL fProgramAdpcmMem; - UINT32 ulCompType = 0; - UINT32 ulPcmLaw; - UINT16 usTempTsiMemIndex; - UINT16 usConversionMemIndex; - UINT32 ulToneEventNumber; - BOOL fSSTone; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a local pointer to the TDM configuration structure.*/ - pTdmConfig = &f_pChannelOpen->TdmConfig; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_pChanIndexConf->usEchoChanIndex ); - - /*==============================================================================*/ - /* Configure the Input Tsst control memory.*/ - - /* Set the RIN Tsst control entry.*/ - if ( f_pChanIndexConf->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usRinTsstIndex, - f_pChanIndexConf->usRinRoutTsiMemIndex, - pTdmConfig->ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the SIN Tsst control entry.*/ - if ( f_pChanIndexConf->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usSinTsstIndex, - f_pChanIndexConf->usSinSoutTsiMemIndex, - pTdmConfig->ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - - /*==============================================================================*/ - /* Configure the ADPCM control memory for the Decoder.*/ - - /* Set the codec state flags.*/ - f_pChanIndexConf->fRinRoutCodecActive = FALSE; - f_pChanIndexConf->fSinSoutCodecActive = FALSE; - - if ( f_pChannelOpen->CodecConfig.ulDecoderPort != cOCT6100_NO_DECODING ) - { - fProgramAdpcmMem = TRUE; - - switch( f_pChannelOpen->CodecConfig.ulDecodingRate ) - { - case cOCT6100_G711_64KBPS: - ulCompType = 0x8; - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - if ( pTdmConfig->ulRinPcmLaw == pTdmConfig->ulRoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( pTdmConfig->ulRinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulRoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - if ( pTdmConfig->ulSinPcmLaw == pTdmConfig->ulSoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - if ( ( pTdmConfig->ulSinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulSoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_2C_ENCODED: - ulCompType = 0x4; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_3C_ENCODED: - ulCompType = 0x5; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_4C_ENCODED: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_ENCODED: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G726_ENCODED: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_2C_ENCODED: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_3C_ENCODED: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_4C_ENCODED: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - default: - return cOCT6100_ERR_FATAL_D4; - } - - if ( fProgramAdpcmMem == TRUE ) - { - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - usTempTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - ulPcmLaw = pTdmConfig->ulRoutPcmLaw; /* Set the law for later use */ - - /* Set the codec state flags.*/ - f_pChanIndexConf->fRinRoutCodecActive = TRUE; - - /* Set the conversion memory index to use for decompression */ - usConversionMemIndex = f_pChanIndexConf->usRinRoutConversionMemIndex; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - usTempTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - ulPcmLaw = pTdmConfig->ulSoutPcmLaw; /* Set the law for later use */ - - /* Set the codec state flags.*/ - f_pChanIndexConf->fSinSoutCodecActive = TRUE; - - /* Set the conversion memory index to use for decompression */ - usConversionMemIndex = f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - ulResult = Oct6100ApiWriteDecoderMemory( f_pApiInstance, - usConversionMemIndex, - ulCompType, - usTempTsiMemIndex, - ulPcmLaw, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Configure the ADPCM control memory for the Encoder */ - - if ( f_pChannelOpen->CodecConfig.ulEncoderPort != cOCT6100_NO_ENCODING ) - { - fProgramAdpcmMem = TRUE; - - switch( f_pChannelOpen->CodecConfig.ulEncodingRate ) - { - case cOCT6100_G711_64KBPS: - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( pTdmConfig->ulRoutPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else - ulCompType = 0x5; - - /* Check for law conversion.*/ - if ( pTdmConfig->ulRinPcmLaw == pTdmConfig->ulRoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( pTdmConfig->ulRinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulRoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - if ( pTdmConfig->ulSoutPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else - ulCompType = 0x5; - - /* Check for law conversion.*/ - if ( pTdmConfig->ulSinPcmLaw == pTdmConfig->ulSoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( pTdmConfig->ulSinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulSoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_4_1: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_3_2: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_2_3: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_4_0: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_3_1: - ulCompType = 0xB; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_2_2: - ulCompType = 0x7; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_3_0: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_2_1: - ulCompType = 0x8; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_16KBPS_2_0: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - default: - return cOCT6100_ERR_FATAL_D5; - } - - /* Program the APDCM memory only if ADPCM is requried.*/ - if ( fProgramAdpcmMem == TRUE || f_pChanIndexConf->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usTempTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - - /* Set the codec state flags.*/ - f_pChanIndexConf->fRinRoutCodecActive = TRUE; - - /* Set the conversion memory index to use for compression */ - usConversionMemIndex = f_pChanIndexConf->usRinRoutConversionMemIndex; - } - - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - usTempTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - - /* Set the codec state flags.*/ - f_pChanIndexConf->fSinSoutCodecActive = TRUE; - - /* Set the conversion memory index to use for compression */ - usConversionMemIndex = f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - ulResult = Oct6100ApiWriteEncoderMemory( f_pApiInstance, - usConversionMemIndex, - ulCompType, - usTempTsiMemIndex, - f_pChannelOpen->CodecConfig.fEnableSilenceSuppression, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - f_pChanIndexConf->usPhasingTsstIndex, - f_pChannelOpen->CodecConfig.ulPhasingType, - f_pChannelOpen->CodecConfig.ulPhase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Clearing the tone events bit vector */ - - ulDwordAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_pChanIndexConf->usEchoChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulDwordAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ulDwordData = 0x00000000; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulDwordAddress += 4; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Write the VQE memory */ - - ulResult = Oct6100ApiWriteVqeMemory( f_pApiInstance, - &f_pChannelOpen->VqeConfig, - f_pChannelOpen, - f_pChanIndexConf->usEchoChanIndex, - f_pChanIndexConf->usEchoMemIndex, - TRUE, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - /*==============================================================================*/ - /* Write the echo memory */ - - ulResult = Oct6100ApiWriteEchoMemory( f_pApiInstance, - pTdmConfig, - f_pChannelOpen, - f_pChanIndexConf->usEchoMemIndex, - f_pChanIndexConf->usRinRoutTsiMemIndex, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - - /*==============================================================================*/ - /* Mute channel if required, this is done on a port basis */ - - /* Initialize the silence indexes to invalid for now. */ - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usSinSilenceEventIndex = cOCT6100_INVALID_INDEX; - - /* Set the TSI memory indexes. */ - pChanEntry->usRinRoutTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - pChanEntry->usSinSoutTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_pChanIndexConf->usEchoChanIndex, - f_pChanIndexConf->usRinTsstIndex, - f_pChanIndexConf->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the dominant speaker to unassigned, if required. */ - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled == TRUE ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_pChanIndexConf->usEchoChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* If necessary, configure the extended tone detection channel.*/ - - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - UINT32 ulTempSinLaw; - UINT32 ulTempSoutLaw; - UINT32 ulTempEchoOpMode; - - /* save the original law.*/ - ulTempSinLaw = pTdmConfig->ulSinPcmLaw; - ulTempSoutLaw = pTdmConfig->ulSoutPcmLaw; - ulTempEchoOpMode = f_pChannelOpen->ulEchoOperationMode; - - /* Now, make sure the Sin and Sout law are the same as the Rin law.*/ - - pTdmConfig->ulSinPcmLaw = pTdmConfig->ulRinPcmLaw; - pTdmConfig->ulSoutPcmLaw = pTdmConfig->ulRinPcmLaw; - - f_pChannelOpen->ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_NORMAL; - - /* Write the Echo and VQE memory of the extended channel.*/ - - ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance, - pTdmConfig, - &f_pChannelOpen->VqeConfig, - f_pChannelOpen, - f_pChanIndexConf->usExtToneChanIndex, - f_pChanIndexConf->usExtToneChanIndex, - cOCT6100_API_EXT_TONE_EXTRA_TSI, - f_pChanIndexConf->usExtToneTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now, write the mixer event used to copy the RIN signal of the original channel - into the SIN signal of the exteded channel. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_pChanIndexConf->usExtToneMixerIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= f_pChanIndexConf->usRinRoutTsiMemIndex; - WriteParams.usWriteData |= pTdmConfig->ulRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = f_pChanIndexConf->usExtToneTsiIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now insert the Sin copy event into the list.*/ - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_pChanIndexConf->usExtToneMixerIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_pChanIndexConf->usEchoChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*==============================================================================*/ - /* Clearing the tone events bit vector */ - - ulDwordAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_pChanIndexConf->usExtToneChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulDwordAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ulDwordData = 0x00000000; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulDwordAddress += 4; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - /* Write back the original values in the channel open structure.*/ - - pTdmConfig->ulSinPcmLaw = ulTempSinLaw; - pTdmConfig->ulSoutPcmLaw = ulTempSoutLaw; - - f_pChannelOpen->ulEchoOperationMode = ulTempEchoOpMode; - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* If necessary, configure the SS tone detection. */ - - for ( ulToneEventNumber = 0; ulToneEventNumber < cOCT6100_MAX_TONE_EVENT; ulToneEventNumber++ ) - { - /* Check if the current tone is a SS tone. */ - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Write to all resources needed to activate tone detection on this SS tone. */ - ulResult = Oct6100ApiWriteToneDetectEvent( - f_pApiInstance, - f_pChanIndexConf->usEchoChanIndex, - ulToneEventNumber, - - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Configure the Output Tsst control memory.*/ - - /* Set the ROUT Tsst control entry.*/ - if ( f_pChanIndexConf->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usRoutTsstIndex, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - pTdmConfig->ulRoutNumTssts, - f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the SOUT Tsst control entry.*/ - if ( f_pChanIndexConf->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usSoutTsstIndex, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - pTdmConfig->ulSoutNumTssts, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateChannelEntry - -Description: Updates the new channel in the ECHO channel list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateChannelEntry -UINT32 Oct6100ApiUpdateChannelEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tPOCT6100_CHANNEL_OPEN_VQE pVqeConfig; - tPOCT6100_CHANNEL_OPEN_CODEC pCodecConfig; - - /* Obtain a pointer to the config structures of the tPOCT6100_CHANNEL_OPEN structure. */ - pTdmConfig = &f_pChannelOpen->TdmConfig; - pVqeConfig = &f_pChannelOpen->VqeConfig; - pCodecConfig = &f_pChannelOpen->CodecConfig; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_pChanIndexConf->usEchoChanIndex ) - - /*=======================================================================*/ - /* Copy the channel's configuration and allocated resources. */ - pChanEntry->ulUserChanId = f_pChannelOpen->ulUserChanId; - pChanEntry->byEchoOperationMode = (UINT8)( f_pChannelOpen->ulEchoOperationMode & 0xFF ); - pChanEntry->fEnableToneDisabler = (UINT8)( f_pChannelOpen->fEnableToneDisabler & 0xFF ); - pChanEntry->fEnableExtToneDetection = (UINT8)( f_pChannelOpen->fEnableExtToneDetection & 0xFF ); - - /* Save the VQE configuration.*/ - pChanEntry->VqeConfig.byComfortNoiseMode = (UINT8)( pVqeConfig->ulComfortNoiseMode & 0xFF ); - pChanEntry->VqeConfig.fEnableNlp = (UINT8)( pVqeConfig->fEnableNlp & 0xFF ); - pChanEntry->VqeConfig.fEnableTailDisplacement = (UINT8)( pVqeConfig->fEnableTailDisplacement ); - pChanEntry->VqeConfig.usTailDisplacement = (UINT16)( pVqeConfig->ulTailDisplacement & 0xFFFF ); - pChanEntry->VqeConfig.usTailLength = (UINT16)( pVqeConfig->ulTailLength & 0xFFFF ); - - pChanEntry->VqeConfig.fSinDcOffsetRemoval = (UINT8)( pVqeConfig->fSinDcOffsetRemoval & 0xFF ); - pChanEntry->VqeConfig.fRinDcOffsetRemoval = (UINT8)( pVqeConfig->fRinDcOffsetRemoval & 0xFF ); - pChanEntry->VqeConfig.fRinLevelControl = (UINT8)( pVqeConfig->fRinLevelControl & 0xFF ); - pChanEntry->VqeConfig.chRinLevelControlGainDb = (OCT_INT8)( pVqeConfig->lRinLevelControlGainDb & 0xFF ); - pChanEntry->VqeConfig.fSoutLevelControl = (UINT8)( pVqeConfig->fSoutLevelControl & 0xFF ); - pChanEntry->VqeConfig.chSoutLevelControlGainDb = (OCT_INT8)( pVqeConfig->lSoutLevelControlGainDb & 0xFF ); - pChanEntry->VqeConfig.fRinAutomaticLevelControl = (UINT8)( pVqeConfig->fRinAutomaticLevelControl & 0xFF ); - pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb = (OCT_INT8)( pVqeConfig->lRinAutomaticLevelControlTargetDb & 0xFF ); - pChanEntry->VqeConfig.fSoutAutomaticLevelControl = (UINT8)( pVqeConfig->fSoutAutomaticLevelControl & 0xFF ); - pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb = (OCT_INT8)( pVqeConfig->lSoutAutomaticLevelControlTargetDb & 0xFF ); - pChanEntry->VqeConfig.fRinHighLevelCompensation = (UINT8)( pVqeConfig->fRinHighLevelCompensation & 0xFF ); - pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb = (OCT_INT8)( pVqeConfig->lRinHighLevelCompensationThresholdDb & 0xFF ); - pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction = (UINT8)( pVqeConfig->fSoutAdaptiveNoiseReduction & 0xFF ); - pChanEntry->VqeConfig.fSoutNoiseBleaching = (UINT8)( pVqeConfig->fSoutNoiseBleaching & 0xFF ); - pChanEntry->VqeConfig.fSoutConferencingNoiseReduction = (UINT8)( pVqeConfig->fSoutConferencingNoiseReduction & 0xFF ); - - pChanEntry->VqeConfig.fAcousticEcho = (UINT8)( pVqeConfig->fAcousticEcho & 0xFF ); - - pChanEntry->VqeConfig.fDtmfToneRemoval = (UINT8)( pVqeConfig->fDtmfToneRemoval & 0xFF ); - - pChanEntry->VqeConfig.chDefaultErlDb = (OCT_INT8)( pVqeConfig->lDefaultErlDb & 0xFF ); - pChanEntry->VqeConfig.chAecDefaultErlDb = (OCT_INT8)( pVqeConfig->lAecDefaultErlDb & 0xFF ); - pChanEntry->VqeConfig.usAecTailLength = (UINT16)( pVqeConfig->ulAecTailLength & 0xFFFF ); - pChanEntry->VqeConfig.byNonLinearityBehaviorA = (UINT8)( pVqeConfig->ulNonLinearityBehaviorA & 0xFF ); - pChanEntry->VqeConfig.byNonLinearityBehaviorB = (UINT8)( pVqeConfig->ulNonLinearityBehaviorB & 0xFF ); - pChanEntry->VqeConfig.byDoubleTalkBehavior = (UINT8)( pVqeConfig->ulDoubleTalkBehavior & 0xFF ); - pChanEntry->VqeConfig.chAnrSnrEnhancementDb = (OCT_INT8)( pVqeConfig->lAnrSnrEnhancementDb & 0xFF ); - pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation = (UINT8)( pVqeConfig->ulAnrVoiceNoiseSegregation & 0xFF ); - pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay = (UINT16)( pVqeConfig->ulToneDisablerVqeActivationDelay & 0xFFFF ); - - pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb = (UINT8)( pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb & 0xFF ); - pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb = (UINT8)( pVqeConfig->ulSoutNaturalListenerEnhancementGainDb & 0xFF ); - pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement = (UINT8)( pVqeConfig->fSoutNaturalListenerEnhancement & 0xFF ); - pChanEntry->VqeConfig.fRoutNoiseReduction = (UINT8)( pVqeConfig->fRoutNoiseReduction & 0xFF ); - pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb = (OCT_INT8) (pVqeConfig->lRoutNoiseReductionLevelGainDb & 0xFF); - pChanEntry->VqeConfig.fEnableMusicProtection = (UINT8)( pVqeConfig->fEnableMusicProtection & 0xFF ); - pChanEntry->VqeConfig.fIdleCodeDetection = (UINT8)( pVqeConfig->fIdleCodeDetection & 0xFF ); - - /* Save the codec information.*/ - pChanEntry->CodecConfig.byAdpcmNibblePosition = (UINT8)( pCodecConfig->ulAdpcmNibblePosition & 0xFF ); - - pChanEntry->CodecConfig.byDecoderPort = (UINT8)( pCodecConfig->ulDecoderPort & 0xFF ); - pChanEntry->CodecConfig.byDecodingRate = (UINT8)( pCodecConfig->ulDecodingRate & 0xFF ); - pChanEntry->CodecConfig.byEncoderPort = (UINT8)( pCodecConfig->ulEncoderPort & 0xFF ); - pChanEntry->CodecConfig.byEncodingRate = (UINT8)( pCodecConfig->ulEncodingRate & 0xFF ); - - pChanEntry->CodecConfig.fEnableSilenceSuppression = (UINT8)( pCodecConfig->fEnableSilenceSuppression & 0xFF ); - pChanEntry->CodecConfig.byPhase = (UINT8)( pCodecConfig->ulPhase & 0xFF ); - pChanEntry->CodecConfig.byPhasingType = (UINT8)( pCodecConfig->ulPhasingType & 0xFF ); - - /* Save the RIN settings.*/ - pChanEntry->TdmConfig.byRinPcmLaw = (UINT8)( pTdmConfig->ulRinPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usRinTimeslot = (UINT16)( pTdmConfig->ulRinTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usRinStream = (UINT16)( pTdmConfig->ulRinStream & 0xFFFF ); - - /* Save the SIN settings.*/ - pChanEntry->TdmConfig.bySinPcmLaw = (UINT8)( pTdmConfig->ulSinPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usSinTimeslot = (UINT16)( pTdmConfig->ulSinTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usSinStream = (UINT16)( pTdmConfig->ulSinStream & 0xFFFF ); - - /* Save the ROUT settings.*/ - pChanEntry->TdmConfig.byRoutPcmLaw = (UINT8)( pTdmConfig->ulRoutPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usRoutTimeslot = (UINT16)( pTdmConfig->ulRoutTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usRoutStream = (UINT16)( pTdmConfig->ulRoutStream & 0xFFFF ); - - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry = 0; - - /* Save the SOUT settings.*/ - pChanEntry->TdmConfig.bySoutPcmLaw = (UINT8)( pTdmConfig->ulSoutPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usSoutTimeslot = (UINT16)( pTdmConfig->ulSoutTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usSoutStream = (UINT16)( pTdmConfig->ulSoutStream & 0xFFFF ); - - pChanEntry->TdmConfig.byRinNumTssts = (UINT8)( pTdmConfig->ulRinNumTssts & 0xFF ); - pChanEntry->TdmConfig.bySinNumTssts = (UINT8)( pTdmConfig->ulSinNumTssts & 0xFF ); - pChanEntry->TdmConfig.byRoutNumTssts = (UINT8)( pTdmConfig->ulRoutNumTssts & 0xFF ); - pChanEntry->TdmConfig.bySoutNumTssts = (UINT8)( pTdmConfig->ulSoutNumTssts & 0xFF ); - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry = 0; - - /* Save the extended Tone detection information.*/ - pChanEntry->usExtToneChanIndex = f_pChanIndexConf->usExtToneChanIndex; - pChanEntry->usExtToneMixerIndex = f_pChanIndexConf->usExtToneMixerIndex; - pChanEntry->usExtToneTsiIndex = f_pChanIndexConf->usExtToneTsiIndex; - - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - tPOCT6100_API_CHANNEL pExtToneChanEntry; - - /* Set the mode of the original channel. He is the channel performing detection on the - SIN port. The extended channel will perform detection on the RIN port.*/ - pChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_SIN_PORT_MODE; - - /* Now, program the associated channel.*/ - - /* Obtain a pointer to the extended tone detection channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pExtToneChanEntry, f_pChanIndexConf->usExtToneChanIndex ); - - pExtToneChanEntry->fReserved = TRUE; - pExtToneChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_RIN_PORT_MODE; /* Detect on RIN port.*/ - pExtToneChanEntry->usExtToneChanIndex = f_pChanIndexConf->usEchoChanIndex; - - pExtToneChanEntry->aulToneConf[ 0 ] = 0; - pExtToneChanEntry->aulToneConf[ 1 ] = 0; - - } - else - { - /* No extended tone detection supported.*/ - pChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_DISABLED; - } - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Store hardware related information.*/ - pChanEntry->usRinRoutTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - pChanEntry->usSinSoutTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - - /* We are not being tapped for now. */ - pChanEntry->fBeingTapped = FALSE; - - pChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX; - - /* The copy event has not yet been created. */ - pChanEntry->fCopyEventCreated = FALSE; - - pChanEntry->usRinRoutConversionMemIndex = f_pChanIndexConf->usRinRoutConversionMemIndex; - pChanEntry->usSinSoutConversionMemIndex = f_pChanIndexConf->usSinSoutConversionMemIndex; - - pChanEntry->usPhasingTsstIndex = f_pChanIndexConf->usPhasingTsstIndex; - - pChanEntry->fSinSoutCodecActive = f_pChanIndexConf->fSinSoutCodecActive; - pChanEntry->fRinRoutCodecActive = f_pChanIndexConf->fRinRoutCodecActive; - - - - pChanEntry->usEchoMemIndex = f_pChanIndexConf->usEchoMemIndex; - - pChanEntry->usRinTsstIndex = f_pChanIndexConf->usRinTsstIndex; - pChanEntry->usSinTsstIndex = f_pChanIndexConf->usSinTsstIndex; - pChanEntry->usRoutTsstIndex = f_pChanIndexConf->usRoutTsstIndex; - pChanEntry->usSoutTsstIndex = f_pChanIndexConf->usSoutTsstIndex; - - pChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usSoutCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Nothing muted for now. */ - pChanEntry->usMutedPorts = cOCT6100_CHANNEL_MUTE_PORT_NONE; - - /* Set all the GW feature initial value.*/ - /* Bridge info */ - pChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - pChanEntry->fMute = FALSE; - - pChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - - /* Buffer playout info.*/ - pChanEntry->fRinBufPlaying = FALSE; - pChanEntry->fSoutBufPlaying = FALSE; - - /* Tone detection state. */ - /* This array is configured as follow.*/ - /* Index 0 contain event 0 to 31 (msb = event 31) and Index 1 contain index 32 - 55 */ - pChanEntry->aulToneConf[ 0 ] = 0; - pChanEntry->aulToneConf[ 1 ] = 0; - pChanEntry->ulLastSSToneDetected = cOCT6100_INVALID_VALUE; - pChanEntry->ulLastSSToneTimestamp = cOCT6100_INVALID_VALUE; - - /* Initialize the bidirectional flag.*/ - pChanEntry->fBiDirChannel = FALSE; - - /*=======================================================================*/ - /* Init some of the stats.*/ - - pChanEntry->sMaxERL = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->sMaxERLE = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->usMaxEchoDelay = cOCT6100_INVALID_STAT_W; - pChanEntry->usNumEchoPathChangesOfst = 0; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the dependency of the phasing TSST if one is associated to the chanel.*/ - - if ( f_pChanIndexConf->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, f_pChanIndexConf->usPhasingTsstIndex ); - - pPhasingEntry->usDependencyCnt++; - } - /*=======================================================================*/ - - /*=======================================================================*/ - - /* Form handle returned to user. */ - *f_pChannelOpen->pulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_pChanIndexConf->usEchoChanIndex; - - /* Finally, mark the channel as open. */ - pChanEntry->fReserved = TRUE; - pChanEntry->usExtraSinTsiDependencyCnt = 0; - - /* Increment the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels++; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelCloseSer - -Description: Closes a echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelClose Pointer to echo cancellation channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCloseSer -UINT32 Oct6100ChannelCloseSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose ) -{ - UINT16 usChannelIndex; - - - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertChannelParams( f_pApiInstance, - f_pChannelClose, - - &usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiInvalidateChannelStructs( f_pApiInstance, - - usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiReleaseChannelResources( f_pApiInstance, usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle.*/ - f_pChannelClose->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChannelParams - -Description: Validate the handle given by the user and verify the state of - the channel about to be closed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelClose Pointer to echo cancellation channel close structure. -f_pulFpgaChanIndex Pointer to the FPGA channel index associated to this channel. -f_pusChanIndex Pointer to the index of the channel within the API instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChannelParams -UINT32 Oct6100ApiAssertChannelParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose, - - IN OUT PUINT16 f_pusChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelClose->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelClose->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelClose->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - if ( pChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL; - - /*=======================================================================*/ - - /* Check if the channel is bound to a bridge. */ - if ( pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_ACTIVE_DEPENDENCIES; - - - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateChannelStructs - -Description: Closes a echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulFpgaChanIndex Index of the channel within the SCN_PLC FPGA. -f_usChanIndex Index of the channel within the API instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateChannelStructs -UINT32 Oct6100ApiInvalidateChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usChanIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL_TDM pTdmConfig; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulResult; - UINT16 usCurrentEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Obtain local pointer to the TDM configuration of the channel */ - pTdmConfig = &pChanEntry->TdmConfig; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* If this channel is currently debugged, automatically close the debug channel. */ - if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - && ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex == f_usChanIndex ) ) - { - tOCT6100_DEBUG_SELECT_CHANNEL SelectDebugChan; - - /* Ensure forward compatibility. */ - Oct6100DebugSelectChannelDef( &SelectDebugChan ); - - /* Set the hot channel to an invalid handle to disable recording. */ - SelectDebugChan.ulChannelHndl = cOCT6100_INVALID_HANDLE; - - /* Call the serialized fonction. */ - ulResult = Oct6100DebugSelectChannelSer( f_pApiInstance, &SelectDebugChan, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Deactivate the TSST control memory if used. */ - - /* RIN port.*/ - if ( pTdmConfig->usRinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usRinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* SIN port.*/ - if ( pTdmConfig->usSinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usSinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - /* ROUT port.*/ - - if ( pTdmConfig->usRoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usRoutTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now the broadcast TSST.*/ - usCurrentEntry = pTdmConfig->usRoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pTsstEntry->usTsstMemoryIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - /*=======================================================================*/ - - /*=======================================================================*/ - /* SOUT port.*/ - - if ( pTdmConfig->usSoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usSoutTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now the broadcast TSST.*/ - usCurrentEntry = pTdmConfig->usSoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pTsstEntry->usTsstMemoryIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - /*=======================================================================*/ - - - /*------------------------------------------------------------------------------*/ - /* Deactivate the ECHO control memory entry.*/ - - /* Set the input Echo control entry to unused.*/ - WriteParams.ulWriteAddress = cOCT6100_ECHO_CONTROL_MEM_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x85FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0xC5FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Deactivate the conversion control memories if used. */ - - if ( pChanEntry->usRinRoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - /* Rin/Rout stream conversion memory was used */ - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, pChanEntry->usRinRoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pChanEntry->usSinSoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - /* Sin/Sout stream conversion memory was used */ - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, pChanEntry->usSinSoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Clear the silence copy events if they were created. */ - - /* Unmute the Rin port if it was muted. */ - if ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /* Unmute the Sin port if it was muted. */ - if ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usSinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usSinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E0; - - pChanEntry->usSinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /*------------------------------------------------------------------------------*/ - - /* Synch all the buffer playout field.*/ - if ( pSharedInfo->ImageInfo.fBufferPlayout == TRUE ) - { - Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); - - BufferPlayoutStop.ulChannelHndl = cOCT6100_INVALID_HANDLE; - BufferPlayoutStop.fStopCleanly = FALSE; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - - - - /* Free all resources reserved for extended tone detection.*/ - if ( pChanEntry->fEnableExtToneDetection == TRUE ) - { - /*------------------------------------------------------------------------------*/ - /* Deactivate the ECHO control memory entry of the extended channel.*/ - - /* Set the input Echo control entry to unused.*/ - WriteParams.ulWriteAddress = cOCT6100_ECHO_CONTROL_MEM_BASE + ( pChanEntry->usExtToneChanIndex * cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x85FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0xC5FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Remove the mixer event used to copy the RIN signal to the SIN port of the extended - channel.*/ - - /* Clear the Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usExtToneMixerIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usExtToneMixerIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - } - - /*------------------------------------------------------------------------------*/ - /* Reset PGSP */ - - WriteParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - WriteParams.usWriteData = 0x0800; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Clear the mute with feature bit. */ - - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - { - ulResult = Oct6100ApiMuteSinWithFeatures( f_pApiInstance, f_usChanIndex, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Clear the VQE memory. */ - - SmearParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst + 0x20; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteLength = 2; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - /*------------------------------------------------------------------------------*/ - /* Clear the NLP memory. */ - - SmearParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst + 0x28; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteLength = 2; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - /* Clear the AF information memory. */ - - SmearParams.ulWriteAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( pChanEntry->usEchoMemIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteLength = 12; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*Reset ALC status*/ - WriteParams.ulWriteAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( pChanEntry->usEchoMemIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + 0x3A; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseChannelResources - -Description: Release and clear the API entry associated to the echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChannelIndex Index of the echo cancellation channel in the API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseChannelResources -UINT32 Oct6100ApiReleaseChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChannelIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL_TDM pTdmConfig; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT32 ulResult; - UINT16 usCurrentEntry; - UINT32 ulTimeslot; - UINT32 ulStream; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChannelIndex ); - - /* Obtain local pointer to the TDM configurationof the channel */ - pTdmConfig = &pChanEntry->TdmConfig; - - /* Release the two TSI chariot memory entries.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2; - - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3; - - /* Now release the ECHO channel and control memory entries.*/ - ulResult = Oct6100ApiReleaseEchoEntry( f_pApiInstance, f_usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_4; - - /* Release the conversion resources.*/ - if ( pChanEntry->usRinRoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, pChanEntry->usRinRoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B9; - - pChanEntry->usRinRoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - if ( pChanEntry->usSinSoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, pChanEntry->usSinSoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_BA; - - pChanEntry->usSinSoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - /*=========================================================================*/ - /* Release the TSST control memory entries if any were reserved.*/ - if ( pTdmConfig->usRinTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usRinTimeslot, - pTdmConfig->usRinStream, - pTdmConfig->byRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_5; - } - - if ( pTdmConfig->usSinTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usSinTimeslot, - pTdmConfig->usSinStream, - pTdmConfig->bySinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_6; - } - - /*=======================================================================*/ - /* Release all the TSSTs associated to the ROUT port of this channel. */ - if ( pTdmConfig->usRoutTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usRoutTimeslot, - pTdmConfig->usRoutStream, - pTdmConfig->byRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_7; - } - - /* Now release the Broadcast TSSTs. */ - usCurrentEntry = pTdmConfig->usRoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - usCurrentEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_8; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - - /* Invalidate the current entry.*/ - pTsstEntry->usTsstMemoryIndex = 0xFFFF; - pTsstEntry->usTsstValue = 0xFFFF; - pTsstEntry->usNextEntry = cOCT6100_INVALID_INDEX; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Release all the TSSTs associated to the SOUT port of this channel. */ - if ( pTdmConfig->usSoutTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usSoutTimeslot, - pTdmConfig->usSoutStream, - pTdmConfig->bySoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_9; - } - - /* Now release the Broadcast TSSTs. */ - usCurrentEntry = pTdmConfig->usSoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - usCurrentEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - - /* Invalidate the current entry.*/ - pTsstEntry->usTsstMemoryIndex = 0xFFFF; - pTsstEntry->usTsstValue = 0xFFFF; - pTsstEntry->usNextEntry = cOCT6100_INVALID_INDEX; - } - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the dependency of the phasing TSST if one is associated to the chanel.*/ - - if ( pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, pChanEntry->usPhasingTsstIndex ); - - pPhasingEntry->usDependencyCnt--; - } - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Release any resources reserved for the extended tone detection.*/ - - if ( pChanEntry->fEnableExtToneDetection == TRUE ) - { - tPOCT6100_API_CHANNEL pExtToneChanEntry; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pExtToneChanEntry, pChanEntry->usExtToneChanIndex ); - - /* Release the ECHO channel and control memory entries.*/ - ulResult = Oct6100ApiReleaseEchoEntry( f_pApiInstance, pChanEntry->usExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_C1; - - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtToneTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_C2; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usExtToneMixerIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_C3; - - /* Now release the channel entry */ - pExtToneChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_DISABLED; - pExtToneChanEntry->fReserved = FALSE; - - /* Set the current entry to disable, just in case.*/ - pChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_DISABLED; - } - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the channel's list entry. */ - - /* Clear the NLP dword array. */ - Oct6100UserMemSet( pChanEntry->aulNlpConfDword, 0, sizeof( pChanEntry->aulNlpConfDword ) ); - - /* Clear the echo operation mode. */ - pChanEntry->byEchoOperationMode = cOCT6100_ECHO_OP_MODE_POWER_DOWN; - - /* Mark the channel as closed. */ - pChanEntry->fReserved = FALSE; - pChanEntry->byEntryOpenCnt++; - - /* Reset the port, the bridge and BidirInfo */ - pChanEntry->usMutedPorts = cOCT6100_CHANNEL_MUTE_PORT_NONE; - pChanEntry->fBiDirChannel = FALSE; - pChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - - /* Decrement the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels--; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; - -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelModifySer - -Description: Modify an echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to channel configuration structure. The handle - identifying the buffer in all future function calls is - returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelModifySer -UINT32 Oct6100ChannelModifySer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ) -{ - UINT16 usChanIndex; - UINT32 ulResult; - UINT16 usNewRinTsstIndex; - UINT16 usNewSinTsstIndex; - UINT16 usNewRoutTsstIndex; - UINT16 usNewSoutTsstIndex; - UINT8 fSinSoutCodecActive = FALSE; - UINT8 fRinRoutCodecActive = FALSE; - UINT16 usNewPhasingTsstIndex; - tOCT6100_CHANNEL_OPEN *pTempChanOpen; - - /* We don't want this 290 byte structure on the stack */ - pTempChanOpen = kmalloc(sizeof(*pTempChanOpen), GFP_ATOMIC); - if (!pTempChanOpen) - return cOCT6100_ERR_FATAL_0; - - /* Check the user's configuration of the echo cancellation channel for errors. */ - ulResult = Oct6100ApiCheckChannelModify( f_pApiInstance, - f_pChannelModify, - pTempChanOpen, - &usNewPhasingTsstIndex, - &usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Reserve all resources needed by the echo cancellation channel. */ - ulResult = Oct6100ApiModifyChannelResources( f_pApiInstance, - f_pChannelModify, - usChanIndex, - &usNewRinTsstIndex, - &usNewSinTsstIndex, - &usNewRoutTsstIndex, - &usNewSoutTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiModifyChannelStructs( f_pApiInstance, - f_pChannelModify, - pTempChanOpen, - usChanIndex, - usNewPhasingTsstIndex, - &fSinSoutCodecActive, - &fRinRoutCodecActive, - usNewRinTsstIndex, - usNewSinTsstIndex, - usNewRoutTsstIndex, - usNewSoutTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiModifyChannelEntry( f_pApiInstance, - f_pChannelModify, - pTempChanOpen, - usChanIndex, - usNewPhasingTsstIndex, - fSinSoutCodecActive, - fRinRoutCodecActive, - usNewRinTsstIndex, - usNewSinTsstIndex, - usNewRoutTsstIndex, - usNewSoutTsstIndex ); -out: - kfree(pTempChanOpen); - - return ulResult; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChannelModify - -Description: Checks the user's echo cancellation channel modify structure for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel modify structure. -f_pTempChanOpen Pointer to a channel open structure. -f_pusNewPhasingTsstIndex Pointer to a new phasing TSST index within the API instance. -f_pusChanIndex Pointer to the channel index within the API instance channel list - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChannelModify -UINT32 Oct6100ApiCheckChannelModify( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pTempChanOpen, - OUT PUINT16 f_pusNewPhasingTsstIndex, - OUT PUINT16 f_pusChanIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulEntryOpenCnt; - UINT32 ulDecoderNumTssts; - - /* Check the provided handle. */ - if ( (f_pChannelModify->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelModify->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelModify->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check the general modify parameters. */ - - if ( f_pChannelModify->ulEchoOperationMode != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NORMAL && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_FREEZE && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_RESET && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_POWER_DOWN && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_EXTERNAL && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE; - - /* Check the 2100Hz echo disabling configuration.*/ - if ( f_pChannelModify->fEnableToneDisabler != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->fEnableToneDisabler != TRUE && - f_pChannelModify->fEnableToneDisabler != FALSE ) - return cOCT6100_ERR_CHANNEL_TONE_DISABLER_ENABLE; - - /* Check the disable tone detection flag. */ - if ( f_pChannelModify->fDisableToneDetection != TRUE && - f_pChannelModify->fDisableToneDetection != FALSE ) - return cOCT6100_ERR_CHANNEL_DISABLE_TONE_DETECTION; - - /* Check the stop buffer playout flag. */ - if ( f_pChannelModify->fStopBufferPlayout != TRUE && - f_pChannelModify->fStopBufferPlayout != FALSE ) - return cOCT6100_ERR_CHANNEL_STOP_BUFFER_PLAYOUT; - - /* Check the remove conference bridge participant flag. */ - if ( f_pChannelModify->fRemoveConfBridgeParticipant != TRUE && - f_pChannelModify->fRemoveConfBridgeParticipant != FALSE ) - return cOCT6100_ERR_CHANNEL_REMOVE_CONF_BRIDGE_PARTICIPANT; - - /* Check the remove broadcast timeslots flag. */ - if ( f_pChannelModify->fRemoveBroadcastTssts != TRUE && - f_pChannelModify->fRemoveBroadcastTssts != FALSE ) - return cOCT6100_ERR_CHANNEL_REMOVE_BROADCAST_TSSTS; - - if ( f_pChannelModify->fCodecConfigModified != TRUE && - f_pChannelModify->fCodecConfigModified != FALSE ) - return cOCT6100_ERR_CHANNEL_MODIFY_CODEC_CONFIG; - - if ( f_pChannelModify->fVqeConfigModified != TRUE && - f_pChannelModify->fVqeConfigModified != FALSE ) - return cOCT6100_ERR_CHANNEL_MODIFY_VQE_CONFIG; - - if ( f_pChannelModify->fTdmConfigModified != TRUE && - f_pChannelModify->fTdmConfigModified != FALSE ) - return cOCT6100_ERR_CHANNEL_MODIFY_TDM_CONFIG; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Verify if any law change was requested. If so reprogram all structures.*/ - - if (( f_pChannelModify->fTdmConfigModified == TRUE ) && - ( f_pChannelModify->TdmConfig.ulRinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulRoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING )) - { - f_pChannelModify->fVqeConfigModified = TRUE; - f_pChannelModify->fCodecConfigModified = TRUE; - } - /*=======================================================================*/ - - ulResult = Oct6100ApiUpdateOpenStruct( f_pApiInstance, f_pChannelModify, f_pTempChanOpen, pChanEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* All further check will now be performed using the TempOpenChan structure in order - to reuse the checks written for the open channel structure.*/ - - - - /* Check the TDM config.*/ - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - tPOCT6100_CHANNEL_MODIFY_TDM pModifyTdm; - tPOCT6100_CHANNEL_OPEN_TDM pOpenTdm; - - pModifyTdm = &f_pChannelModify->TdmConfig; - pOpenTdm = &f_pTempChanOpen->TdmConfig; - - ulResult = Oct6100ApiCheckTdmConfig( f_pApiInstance, - pOpenTdm ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if that Stream and Timeslot values are valid.*/ - - /* Check the RIN port.*/ - if ( f_pChannelModify->TdmConfig.ulRinStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_RIN_STREAM; - - if ( pChanEntry->fBeingTapped == TRUE ) - { - /* Check that the Rin stream + timeslot are not being assigned. */ - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_STREAM; - - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - } - } - - /* Check the SIN port.*/ - if ( f_pChannelModify->TdmConfig.ulSinStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SIN_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulSinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SIN_STREAM; - - /* Check the ROUT port.*/ - if ( f_pChannelModify->TdmConfig.ulRoutStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulRoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_ROUT_STREAM; - - /* Check the SOUT port.*/ - if ( f_pChannelModify->TdmConfig.ulSoutStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulSoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SOUT_STREAM; - - /* Verify if the channel is currently part of a bidirectional channel, and if */ - /* so perform the required checks. */ - if ( pChanEntry->fBiDirChannel == TRUE ) - { - /* Check the ports that must remain unassigned.*/ - if ( f_pTempChanOpen->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - if ( f_pTempChanOpen->TdmConfig.ulSoutTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT; - - /* Check that no PCM law change is requested.*/ - if ( f_pTempChanOpen->TdmConfig.ulRinPcmLaw != f_pTempChanOpen->TdmConfig.ulRoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION; - if ( f_pTempChanOpen->TdmConfig.ulSinPcmLaw != f_pTempChanOpen->TdmConfig.ulSoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION; - } - - /* If this channel is on a conference bridge, a few more things must be checked. */ - if ( pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - { - /* If conferencing, law conversion cannot be applied. */ - /* This check is done only if both input and output ports are assigned. */ - if ( ( f_pTempChanOpen->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - && ( f_pTempChanOpen->TdmConfig.ulRoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - /* Laws must be the same! */ - if ( f_pTempChanOpen->TdmConfig.ulRinPcmLaw != f_pTempChanOpen->TdmConfig.ulRoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION; - } - - /* Check for Sin. */ - if ( ( f_pTempChanOpen->TdmConfig.ulSinTimeslot != cOCT6100_UNASSIGNED ) - && ( f_pTempChanOpen->TdmConfig.ulSoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - /* Laws must be the same! */ - if ( f_pTempChanOpen->TdmConfig.ulSinPcmLaw != f_pTempChanOpen->TdmConfig.ulSoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION; - } - - /* Check if ADPCM is requested. */ - if ( f_pTempChanOpen->CodecConfig.ulEncoderPort != cOCT6100_NO_ENCODING && - f_pTempChanOpen->CodecConfig.ulEncodingRate != cOCT6100_G711_64KBPS ) - { - /* No ADPCM in a conference bridge! */ - return cOCT6100_ERR_CHANNEL_ENCODING_RATE; - } - - if ( f_pTempChanOpen->CodecConfig.ulDecoderPort != cOCT6100_NO_DECODING && - f_pTempChanOpen->CodecConfig.ulDecodingRate != cOCT6100_G711_64KBPS ) - { - /* No ADPCM in a conference bridge! */ - return cOCT6100_ERR_CHANNEL_DECODING_RATE; - } - } - - if ( f_pTempChanOpen->CodecConfig.ulEncoderPort == cOCT6100_NO_ENCODING || - f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_NO_DECODING ) - { - /* Make sure no law conversion is attempted since it is not supported by the device.*/ - if ( f_pTempChanOpen->TdmConfig.ulRinPcmLaw != f_pTempChanOpen->TdmConfig.ulRoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION; - if ( f_pTempChanOpen->TdmConfig.ulSinPcmLaw != f_pTempChanOpen->TdmConfig.ulSoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION; - } - - if ( pChanEntry->fEnableExtToneDetection == TRUE && - f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DECODER_PORT; - - /* A few special checks must be done if the configuration is to be applied */ - /* to all opened channels. */ - if ( f_pChannelModify->fApplyToAllChannels == TRUE ) - { - /* When the configuration to be applied is for all channels, */ - /* check that the stream and timeslot parameters are not being assigned. */ - - /* Check the Rout port. */ - if ( f_pChannelModify->TdmConfig.ulRoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Rout ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulRoutStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_ROUT_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulRoutTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT_UNASSIGN; - } - - /* Check the Rin port. */ - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Rin ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulRinStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT_UNASSIGN; - } - - /* Check the Sout port. */ - if ( f_pChannelModify->TdmConfig.ulSoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Sout ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulSoutStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SOUT_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulSoutTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT_UNASSIGN; - } - - /* Check the Sin port. */ - if ( f_pChannelModify->TdmConfig.ulSinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Sin ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulSinStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SIN_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulSinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SIN_TIMESLOT_UNASSIGN; - } - } - } - - /* Check the VQE config.*/ - if ( f_pChannelModify->fVqeConfigModified == TRUE ) - { - ulResult = Oct6100ApiCheckVqeConfig( f_pApiInstance, - &f_pTempChanOpen->VqeConfig, - f_pTempChanOpen->fEnableToneDisabler ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Verify if the echo operation mode selected can be applied. */ - if ( ( f_pTempChanOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( f_pTempChanOpen->VqeConfig.fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - if ( ( f_pTempChanOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( f_pTempChanOpen->VqeConfig.fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - /* Comfort noise must be activated for speech recognition mode to work. */ - if ( ( f_pTempChanOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( f_pTempChanOpen->VqeConfig.ulComfortNoiseMode == cOCT6100_COMFORT_NOISE_OFF ) ) - return cOCT6100_ERR_CHANNEL_COMFORT_NOISE_REQUIRED; - - /* Check the Codec config.*/ - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - if ( f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - ulDecoderNumTssts = f_pTempChanOpen->TdmConfig.ulRinNumTssts; - else /* f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - ulDecoderNumTssts = f_pTempChanOpen->TdmConfig.ulSinNumTssts; - - ulResult = Oct6100ApiCheckCodecConfig( f_pApiInstance, - &f_pTempChanOpen->CodecConfig, - ulDecoderNumTssts, - f_pusNewPhasingTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - /* make sure that if silence suppression is activated, the NLP is enabled.*/ - if ( f_pTempChanOpen->CodecConfig.fEnableSilenceSuppression == TRUE && f_pTempChanOpen->VqeConfig.fEnableNlp == FALSE ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_NLP_MUST_BE_ENABLED; - - /* Verify if the channel is currently part of a bidirectional channel, and if so perform - the required checks.*/ - if ( pChanEntry->fBiDirChannel == TRUE ) - { - /* Check the ports that must remain unassigned.*/ - if ( f_pTempChanOpen->CodecConfig.ulEncoderPort != cOCT6100_NO_ENCODING && - f_pTempChanOpen->CodecConfig.ulEncodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_ENCODING_RATE; - - if ( f_pTempChanOpen->CodecConfig.ulDecoderPort != cOCT6100_NO_DECODING && - f_pTempChanOpen->CodecConfig.ulDecodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_DECODING_RATE; - } - - } - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiModifyChannelResources - -Description: Reserves any new resources needed for the channel -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel configuration structure. -f_usChanIndex Allocated entry in ECHO channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiModifyChannelResources -UINT32 Oct6100ApiModifyChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewRinTsstIndex, - OUT PUINT16 f_pusNewSinTsstIndex, - OUT PUINT16 f_pusNewRoutTsstIndex, - OUT PUINT16 f_pusNewSoutTsstIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - tPOCT6100_API_CHANNEL_TDM pApiTdmConf; - tPOCT6100_CHANNEL_MODIFY_TDM pModifyTdmConf; - - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar = cOCT6100_ERR_OK; - UINT32 ulFreeMixerEventCnt; - - BOOL fRinReleased = FALSE; - BOOL fSinReleased = FALSE; - BOOL fRoutReleased = FALSE; - BOOL fSoutReleased = FALSE; - - BOOL fRinReserved = FALSE; - BOOL fSinReserved = FALSE; - BOOL fRoutReserved = FALSE; - BOOL fSoutReserved = FALSE; - - BOOL fReserveRin = FALSE; - BOOL fReserveSin = FALSE; - BOOL fReserveRout = FALSE; - BOOL fReserveSout = FALSE; - - BOOL fRinRoutConversionMemReserved = FALSE; - BOOL fSinSoutConversionMemReserved = FALSE; - - - UINT32 ulRinNumTssts = 1; - UINT32 ulSinNumTssts = 1; - UINT32 ulRoutNumTssts = 1; - UINT32 ulSoutNumTssts = 1; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to the TDM configuration structure of the tPOCT6100_CHANNEL_MODIFY structure. */ - pModifyTdmConf = &f_pChannelModify->TdmConfig; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Obtain local pointer to the TDM configuration structure of the tPOCT6100_API_CHANNEL structure. */ - pApiTdmConf = &pChanEntry->TdmConfig; - - /*===============================================================================*/ - /* Modify TSST resources if required.*/ - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - /* First release any entry that need to be released.*/ - if ( ( pModifyTdmConf->ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulRinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRinTimeslot, - pChanEntry->TdmConfig.usRinStream, - pChanEntry->TdmConfig.byRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinReleased = TRUE; - } - } - - fReserveRin = TRUE; - } - - /* Release SIN port.*/ - if ( ( ulResult == cOCT6100_ERR_OK ) - && ( ( pModifyTdmConf->ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulSinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSinTimeslot, - pChanEntry->TdmConfig.usSinStream, - pChanEntry->TdmConfig.bySinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinReleased = TRUE; - } - } - - fReserveSin = TRUE; - } - - /* Release ROUT port.*/ - if ( ( ulResult == cOCT6100_ERR_OK ) - && ( ( pModifyTdmConf->ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) ) - { - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRoutTimeslot, - pChanEntry->TdmConfig.usRoutStream, - pChanEntry->TdmConfig.byRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRoutReleased = TRUE; - } - } - - fReserveRout = TRUE; - } - - /* Release the SOUT port.*/ - if ( ( ulResult == cOCT6100_ERR_OK ) - && ( ( pModifyTdmConf->ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) ) - { - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSoutTimeslot, - pChanEntry->TdmConfig.usSoutStream, - pChanEntry->TdmConfig.bySoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSoutReleased = TRUE; - } - } - - fReserveSout = TRUE; - } - - /* Now reserve any new entry required.*/ - - /* Modify RIN port.*/ - if ( ( fReserveRin == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulRinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulRinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulRinNumTssts = pApiTdmConf->byRinNumTssts; - } - else /* if ( pModifyTdmConf->ulRinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulRinNumTssts = pModifyTdmConf->ulRinNumTssts; - } - - if ( pModifyTdmConf->ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usRinTimeslot, - pApiTdmConf->usRinStream, - ulRinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewRinTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulRinTimeslot, - pModifyTdmConf->ulRinStream, - ulRinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewRinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinReserved = TRUE; - } - } - } - else - { - *f_pusNewRinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewRinTsstIndex = cOCT6100_INVALID_INDEX; - } - - /* Modify SIN port.*/ - if ( ( fReserveSin == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulSinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulSinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulSinNumTssts = pApiTdmConf->bySinNumTssts; - } - else /* if ( pModifyTdmConf->ulSinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulSinNumTssts = pModifyTdmConf->ulSinNumTssts; - } - - if ( pModifyTdmConf->ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usSinTimeslot, - pApiTdmConf->usSinStream, - ulSinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewSinTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulSinTimeslot, - pModifyTdmConf->ulSinStream, - ulSinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewSinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinReserved = TRUE; - } - } - } - else - { - *f_pusNewSinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewSinTsstIndex = cOCT6100_INVALID_INDEX; - } - - /* Modify ROUT port.*/ - if ( ( fReserveRout == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulRoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulRoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulRoutNumTssts = pApiTdmConf->byRoutNumTssts; - } - else /* if ( pModifyTdmConf->ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulRoutNumTssts = pModifyTdmConf->ulRoutNumTssts; - } - - if ( pModifyTdmConf->ulRoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usRoutTimeslot, - pApiTdmConf->usRoutStream, - ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewRoutTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulRoutTimeslot, - pModifyTdmConf->ulRoutStream, - ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewRoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRoutReserved = TRUE; - } - } - } - else - { - *f_pusNewRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - /* Modify SOUT port.*/ - if ( ( fReserveSout == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulSoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulSoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulSoutNumTssts = pApiTdmConf->bySoutNumTssts; - } - else /* if ( pModifyTdmConf->ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulSoutNumTssts = pModifyTdmConf->ulSoutNumTssts; - } - - if ( pModifyTdmConf->ulSoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usSoutTimeslot, - pApiTdmConf->usSoutStream, - ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewSoutTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulSoutTimeslot, - pModifyTdmConf->ulSoutStream, - ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewSoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSoutReserved = TRUE; - } - } - } - else - { - *f_pusNewSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - - } - - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - if ( ulResult == cOCT6100_ERR_OK && - pChanEntry->usRinRoutConversionMemIndex == cOCT6100_INVALID_INDEX && - ( f_pChannelModify->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT || - f_pChannelModify->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) ) - { - /* Reserve an ADPCM memory block.*/ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, &pChanEntry->usRinRoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinRoutConversionMemReserved = TRUE; - } - } - - if ( ulResult == cOCT6100_ERR_OK && - pChanEntry->usSinSoutConversionMemIndex == cOCT6100_INVALID_INDEX && - ( f_pChannelModify->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT || - f_pChannelModify->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN ) ) - { - /* Reserve an ADPCM memory block.*/ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, &pChanEntry->usSinSoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinSoutConversionMemReserved = TRUE; - } - } - } - - - /*===============================================================================*/ - /* Check if there are a couple of mixer events available for us. */ - - if ( ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulMixerEventCntNeeded = 0; - - /* Calculate how many mixer events are needed. */ - if ( pChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - { - /* If the channel is in bidir mode, do not create the Rin silence event!!! */ - if ( pChanEntry->fBiDirChannel == FALSE ) - { - if ( ( *f_pusNewRinTsstIndex == cOCT6100_INVALID_INDEX ) - && ( pChanEntry->usRinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - ulMixerEventCntNeeded++; - } - } - - if ( ( *f_pusNewSinTsstIndex == cOCT6100_INVALID_INDEX ) - && ( pChanEntry->usSinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - { - ulMixerEventCntNeeded++; - } - - /* If at least 1 mixer event is needed, check if those are available. */ - if ( ulMixerEventCntNeeded != 0 ) - { - ulResult = Oct6100ApiGetFreeMixerEventCnt( f_pApiInstance, &ulFreeMixerEventCnt ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* The API might need more mixer events if the ports have to be muted. */ - /* Check if these are available. */ - if ( ulFreeMixerEventCnt < ulMixerEventCntNeeded ) - { - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_MIXER_EVENTS; - } - } - } - } - - /*===============================================================================*/ - - /* Verify if an error occured. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release any resources newly reserved.*/ - if ( fRinReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulRinTimeslot, - pModifyTdmConf->ulRinStream, - ulRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SIN port.*/ - if ( fSinReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulSinTimeslot, - pModifyTdmConf->ulSinStream, - ulSinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the ROUT port.*/ - if ( fRoutReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulRoutTimeslot, - pModifyTdmConf->ulRoutStream, - ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SOUT port.*/ - if ( fSoutReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulSoutTimeslot, - pModifyTdmConf->ulSoutStream, - ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* Now make sure any resources released gets reserved back again.*/ - - /* For the RIN port.*/ - if ( fRinReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRinTimeslot, - pChanEntry->TdmConfig.usRinStream, - pChanEntry->TdmConfig.byRinNumTssts, - cOCT6100_INPUT_TSST, - &pChanEntry->usRinTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SIN port.*/ - if ( fSinReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSinTimeslot, - pChanEntry->TdmConfig.usSinStream, - pChanEntry->TdmConfig.bySinNumTssts, - cOCT6100_INPUT_TSST, - &pChanEntry->usSinTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the ROUT port.*/ - if ( fRoutReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRoutTimeslot, - pChanEntry->TdmConfig.usRoutStream, - pChanEntry->TdmConfig.byRoutNumTssts, - cOCT6100_OUTPUT_TSST, - &pChanEntry->usRoutTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SOUT port.*/ - if ( fSoutReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSoutTimeslot, - pChanEntry->TdmConfig.usSoutStream, - pChanEntry->TdmConfig.bySoutNumTssts, - cOCT6100_OUTPUT_TSST, - &pChanEntry->usSoutTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* Release the conversion memories if they were reserved.*/ - if ( fRinRoutConversionMemReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - pChanEntry->usRinRoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fSinSoutConversionMemReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - pChanEntry->usSinSoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* Now return the error.*/ - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiModifyChannelStructs - -Description: Performs all the required structure writes to configure the - echo cancellation channel based on the new modifications. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel configuration structure. -f_pChannelOpen Pointer to a structure used to store the multiple resources indexes. -f_usChanIndex Index of the channel within the API's channel list. -f_usNewPhasingTsstIndex Index of the new phasing TSST. -f_pfSinSoutCodecActive Pointer to the state of the SIN/SOUT codec. -f_pfRinRoutCodecActive Pointer to the state of the RIN/ROUT codec. -f_usNewRinTsstIndex New RIN TSST memory index. -f_usNewSinTsstIndex New SIN TSST memory index. -f_usNewRoutTsstIndex New ROUT TSST memory index. -f_usNewSoutTsstIndex New SOUT TSST memory index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiModifyChannelStructs -UINT32 Oct6100ApiModifyChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - OUT PUINT8 f_pfSinSoutCodecActive, - OUT PUINT8 f_pfRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_usNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - tPOCT6100_API_CHANNEL_CODEC pApiCodecConf; - tPOCT6100_API_CHANNEL_TDM pApiTdmConf; - tPOCT6100_API_CHANNEL_VQE pApiVqeConf; - - UINT32 ulResult; - UINT16 usReadData; - - UINT16 usSinTsstIndex; - UINT16 usRinTsstIndex; - - UINT32 ulToneConfIndex; - BOOL fClearPlayoutPointers = FALSE; - - BOOL fConversionEnabled = FALSE; - - - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Obtain local pointer to the configuration structures of the tPOCT6100_API_CHANNEL structure. */ - pApiCodecConf = &pChanEntry->CodecConfig; - pApiTdmConf = &pChanEntry->TdmConfig; - pApiVqeConf = &pChanEntry->VqeConfig; - - /*=======================================================================*/ - /* Init the RIN and SIN TSST index */ - - usRinTsstIndex = pChanEntry->usRinTsstIndex; - usSinTsstIndex = pChanEntry->usSinTsstIndex; - - - /*==============================================================================*/ - /* Clear the TSST that will be release.*/ - - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - /* Modify RIN port.*/ - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usRinTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Modify SIN port.*/ - if ( f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usSinTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Modify ROUT port.*/ - if ( f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usRoutTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Modify SOUT port.*/ - if ( f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING) - { - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usSoutTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Now, Configure the Tsst control memory.*/ - - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - /* Modify RIN port.*/ - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - usRinTsstIndex = f_usNewRinTsstIndex; - - if ( f_usNewRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usExtraRinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewRinTsstIndex, - pChanEntry->usExtraRinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewRinTsstIndex, - pChanEntry->usRinRoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - if ( f_pChannelModify->TdmConfig.ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usExtraRinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usRinTsstIndex, - pChanEntry->usExtraRinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usRinTsstIndex, - pChanEntry->usRinRoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Modify SIN port.*/ - if ( f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - usSinTsstIndex = f_usNewSinTsstIndex; - - if ( f_usNewSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewSinTsstIndex, - pChanEntry->usExtraSinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewSinTsstIndex, - pChanEntry->usSinSoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - if ( f_pChannelModify->TdmConfig.ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex , - pChanEntry->usExtraSinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex , - pChanEntry->usSinSoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Modify ROUT port.*/ - if ( ( f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( f_pChannelModify->TdmConfig.ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) - { - if ( f_usNewRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( f_pChannelModify->TdmConfig.ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewRoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - f_pChannelModify->TdmConfig.ulRoutNumTssts, - pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewRoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - pApiTdmConf->byRoutNumTssts, - pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /* Modify SOUT port.*/ - if ( ( f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( f_pChannelModify->TdmConfig.ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) - { - if ( f_usNewSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( f_pChannelModify->TdmConfig.ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewSoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - f_pChannelModify->TdmConfig.ulSoutNumTssts, - pChanEntry->usSinSoutTsiMemIndex ); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewSoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - pApiTdmConf->bySoutNumTssts, - pChanEntry->usSinSoutTsiMemIndex ); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - - - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Modify the Encoder/Decoder memory if required.*/ - - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - UINT32 ulCompType = 0; - UINT16 usTempTsiMemIndex; - UINT16 usDecoderMemIndex; - UINT16 usEncoderMemIndex; - UINT32 ulPcmLaw; - UINT16 usPhasingIndex; - BOOL fModifyAdpcmMem = TRUE; - - /*==============================================================================*/ - /* Reprogram the Decoder memory.*/ - - if ( pChanEntry->CodecConfig.byDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - usDecoderMemIndex = pChanEntry->usRinRoutConversionMemIndex; - } - else - { - usDecoderMemIndex = pChanEntry->usSinSoutConversionMemIndex; - } - - if ( pChanEntry->CodecConfig.byEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usEncoderMemIndex = pChanEntry->usRinRoutConversionMemIndex; - } - else - { - usEncoderMemIndex = pChanEntry->usSinSoutConversionMemIndex; - } - - if ( usDecoderMemIndex != cOCT6100_INVALID_INDEX ) - { - switch( f_pChannelOpen->CodecConfig.ulDecodingRate ) - { - case cOCT6100_G711_64KBPS: - ulCompType = 0x8; - - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - if ( f_pChannelOpen->TdmConfig.ulRinPcmLaw == f_pChannelOpen->TdmConfig.ulRoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulRinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulRoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - if ( f_pChannelOpen->TdmConfig.ulSinPcmLaw == f_pChannelOpen->TdmConfig.ulSoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulSinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulSoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_2C_ENCODED: - ulCompType = 0x4; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_3C_ENCODED: - ulCompType = 0x5; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_4C_ENCODED: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_ENCODED: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G726_ENCODED: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_2C_ENCODED: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_3C_ENCODED: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_4C_ENCODED: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - - default: - return cOCT6100_ERR_FATAL_D6; - } - - if ( fModifyAdpcmMem == TRUE ) - { - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - usTempTsiMemIndex = pChanEntry->usRinRoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; /* Set the law for later use */ - - /* Flag the entry as active.*/ - *f_pfRinRoutCodecActive = TRUE; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - usTempTsiMemIndex = pChanEntry->usSinSoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; /* Set the law for later use */ - - /* Flag the entry as active.*/ - *f_pfSinSoutCodecActive = TRUE; - } - - ulResult = Oct6100ApiWriteDecoderMemory( f_pApiInstance, - usDecoderMemIndex, - ulCompType, - usTempTsiMemIndex, - ulPcmLaw, - pApiCodecConf->byAdpcmNibblePosition ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, - usDecoderMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Flag the entry as deactivated.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - *f_pfRinRoutCodecActive = FALSE; - } - else - { - *f_pfSinSoutCodecActive = FALSE; - } - } - } - - /*==============================================================================*/ - - - - - /*==============================================================================*/ - /* Reprogram the Encoder memory.*/ - - if ( usEncoderMemIndex != cOCT6100_INVALID_INDEX ) - { - - fModifyAdpcmMem = TRUE; - - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usTempTsiMemIndex = pChanEntry->usRinRoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; /* Set the law for later use */ - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - usTempTsiMemIndex = pChanEntry->usSinSoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; /* Set the law for later use */ - } - - /* Set the phasing index .*/ - if ( f_usNewPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - usPhasingIndex = f_usNewPhasingTsstIndex; - else - usPhasingIndex = pChanEntry->usPhasingTsstIndex; - - switch( f_pChannelOpen->CodecConfig.ulEncodingRate ) - { - case cOCT6100_G711_64KBPS: - if ( ulPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else /* ulPcmLaw == cOCT6100_PCM_A_LAW */ - ulCompType = 0x5; - - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( f_pChannelOpen->TdmConfig.ulRinPcmLaw == f_pChannelOpen->TdmConfig.ulRoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulRinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulRoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - if ( f_pChannelOpen->TdmConfig.ulSinPcmLaw == f_pChannelOpen->TdmConfig.ulSoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulSinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulSoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_4_1: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_3_2: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_2_3: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_4_0: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_3_1: - ulCompType = 0xB; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_2_2: - ulCompType = 0x7; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_3_0: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_2_1: - ulCompType = 0x8; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_16KBPS_2_0: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - default: - return cOCT6100_ERR_FATAL_D7; - } - - if ( fModifyAdpcmMem == TRUE ) - { - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - *f_pfRinRoutCodecActive = TRUE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - *f_pfSinSoutCodecActive = TRUE; - } - - ulResult = Oct6100ApiWriteEncoderMemory( f_pApiInstance, - usEncoderMemIndex, - ulCompType, - usTempTsiMemIndex, - f_pChannelOpen->CodecConfig.fEnableSilenceSuppression, - pApiCodecConf->byAdpcmNibblePosition, - usPhasingIndex, - f_pChannelOpen->CodecConfig.ulPhasingType, - f_pChannelOpen->CodecConfig.ulPhase ); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, - usEncoderMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - *f_pfRinRoutCodecActive = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - *f_pfSinSoutCodecActive = FALSE; - } - } - } - - /*==============================================================================*/ - } - - - - - /*==============================================================================*/ - /* Modify the VQE parameter if required.*/ - - if ( ( f_pChannelModify->fVqeConfigModified == TRUE ) - || ( (UINT8)f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) - || ( f_pChannelOpen->fEnableToneDisabler != pChanEntry->fEnableToneDisabler ) ) - { - ulResult = Oct6100ApiWriteVqeMemory( f_pApiInstance, - &f_pChannelOpen->VqeConfig, - f_pChannelOpen, - f_usChanIndex, - pChanEntry->usEchoMemIndex, - FALSE, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - /* Modify the Echo memory if required.*/ - if ( f_pChannelModify->fEnableToneDisabler != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->ulEchoOperationMode != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulRinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulRoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulResult = Oct6100ApiWriteEchoMemory( f_pApiInstance, - &f_pChannelOpen->TdmConfig, - f_pChannelOpen, - pChanEntry->usEchoMemIndex, - pChanEntry->usRinRoutTsiMemIndex, - pChanEntry->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Synch all the buffer playout field if needed by echo operation mode. */ - /* Note that Oct6100ApiWriteVqeMemory does not clear the playout pointers */ - /* since the flag is set to FALSE. */ - if ( ( pSharedInfo->ImageInfo.fBufferPlayout == TRUE ) - && ( ( f_pChannelModify->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_HT_FREEZE ) - || ( f_pChannelModify->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN ) ) ) - { - /* Buffer playout must be stopped. */ - fClearPlayoutPointers = TRUE; - } - } - - /*==============================================================================*/ - /* Modify the Mixer events if law changes are requested. */ - - if ( pChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX && - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify the value according to the new law.*/ - if ( f_pChannelModify->TdmConfig.ulSinPcmLaw == cOCT6100_PCM_A_LAW ) - WriteParams.usWriteData = (UINT16)( usReadData | ( f_pChannelModify->TdmConfig.ulSinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET )); - else - WriteParams.usWriteData = (UINT16)( usReadData & (~( f_pChannelModify->TdmConfig.ulSinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET ))); - - /* Write back the new value.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pChanEntry->usSoutCopyEventIndex != cOCT6100_INVALID_INDEX && - f_pChannelModify->TdmConfig.ulSoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify the value according to the new law.*/ - if ( f_pChannelModify->TdmConfig.ulSoutPcmLaw == cOCT6100_PCM_A_LAW ) - WriteParams.usWriteData = (UINT16)( usReadData | ( f_pChannelModify->TdmConfig.ulSoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET )); - else - WriteParams.usWriteData = (UINT16)( usReadData & (~( f_pChannelModify->TdmConfig.ulSoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET ))); - - /* Write back the new value.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - /* Mute channel if required, this is done on a port basis */ - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_usChanIndex, - usRinTsstIndex, - usSinTsstIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - /* Completely disable tone detection? */ - if ( f_pChannelModify->fDisableToneDetection == TRUE ) - { - /* Check if tone detection has been enabled on this channel. */ - for ( ulToneConfIndex = 0; ulToneConfIndex < ( sizeof( pChanEntry->aulToneConf ) / sizeof(UINT32) ); ulToneConfIndex ++ ) - { - /* Check if some tone has been activated on this channel. */ - if ( pChanEntry->aulToneConf[ ulToneConfIndex ] != 0 ) - { - tOCT6100_TONE_DETECTION_DISABLE ToneDetectDisable; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100ToneDetectionDisableDef( &ToneDetectDisable ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - ToneDetectDisable.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Disable all tones activated on this channel. */ - ToneDetectDisable.fDisableAll = TRUE; - - /* Call tone detection serialized function. */ - ulResult = Oct6100ToneDetectionDisableSer( f_pApiInstance, &ToneDetectDisable ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get out of the loop, tone detection has been disabled! */ - break; - } - } - } - - /* Hard-stop buffer playout? */ - if ( f_pChannelModify->fStopBufferPlayout == TRUE ) - { - /* Check if playout has been started on the Rout port. */ - if ( ( pChanEntry->fRinBufPlaying == TRUE ) || ( pChanEntry->fRinBufAdded == TRUE ) ) - { - tOCT6100_BUFFER_PLAYOUT_STOP PlayoutStop; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100BufferPlayoutStopDef( &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Hard stop request. */ - PlayoutStop.fStopCleanly = FALSE; - - /* Form channel handle. */ - PlayoutStop.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* For the Rout port. */ - PlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - - /* Call buffer playout stop serialized function. */ - ulResult = Oct6100BufferPlayoutStopSer( f_pApiInstance, &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* The chip might still be playing a last buffer. Make sure it hard-stops! */ - fClearPlayoutPointers = TRUE; - } - - /* Check if playout has been started on the Sout port. */ - if ( ( pChanEntry->fSoutBufPlaying == TRUE ) || ( pChanEntry->fSoutBufAdded == TRUE ) ) - { - tOCT6100_BUFFER_PLAYOUT_STOP PlayoutStop; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100BufferPlayoutStopDef( &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Hard stop request. */ - PlayoutStop.fStopCleanly = FALSE; - - /* Form channel handle. */ - PlayoutStop.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* For the Rout port. */ - PlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - - /* Call buffer playout stop serialized function. */ - ulResult = Oct6100BufferPlayoutStopSer( f_pApiInstance, &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* The chip might still be playing a last buffer. Make sure it hard-stops! */ - fClearPlayoutPointers = TRUE; - } - } - - /* Remove participant from bridge? */ - if ( f_pChannelModify->fRemoveConfBridgeParticipant == TRUE ) - { - /* Check if this channel is on a bridge. */ - if ( pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - { - /* Channel is on a bridge, remove it. */ - tOCT6100_CONF_BRIDGE_CHAN_REMOVE BridgeChanRemove; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100ConfBridgeChanRemoveDef( &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - BridgeChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Do not remove all channels, only the one specified. */ - BridgeChanRemove.fRemoveAll = FALSE; - - /* No need to assign conference bridge handle, the remove function will figure it out. */ - - /* Call conference bridge channel remove serialized function. */ - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY ) - { - tPOCT6100_API_CHANNEL pTapChanEntry; - - /* Get a pointer to the tap channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTapChanEntry, pChanEntry->usTapChanIndex ) - - /* Form tap channel handle. */ - BridgeChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pTapChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | pChanEntry->usTapChanIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Re-form original channel handle. */ - BridgeChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - return ulResult; - } - } - } - } - - /* Remove all broadcast TSSTs? */ - if ( f_pChannelModify->fRemoveBroadcastTssts == TRUE ) - { - /* Check if broadcast TSSTs were used on the Rout port. */ - if ( pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry != cOCT6100_INVALID_INDEX ) - { - tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE BroadcastTsstRemove; - - ulResult = Oct6100ChannelBroadcastTsstRemoveDef( &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - BroadcastTsstRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Remove all broadcast TSSTs associated to the current channel. */ - BroadcastTsstRemove.fRemoveAll = TRUE; - - /* On the Rout port. */ - BroadcastTsstRemove.ulPort = cOCT6100_CHANNEL_PORT_ROUT; - - ulResult = Oct6100ChannelBroadcastTsstRemoveSer( f_pApiInstance, &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - /* Check if broadcast TSSTs were used on the Sout port. */ - if ( pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry != cOCT6100_INVALID_INDEX ) - { - tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE BroadcastTsstRemove; - - ulResult = Oct6100ChannelBroadcastTsstRemoveDef( &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - BroadcastTsstRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Remove all broadcast TSSTs associated to the current channel. */ - BroadcastTsstRemove.fRemoveAll = TRUE; - - /* On the Sout port. */ - BroadcastTsstRemove.ulPort = cOCT6100_CHANNEL_PORT_SOUT; - - ulResult = Oct6100ChannelBroadcastTsstRemoveSer( f_pApiInstance, &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Check if have to make sure buffer playout is stopped. */ - if ( fClearPlayoutPointers == TRUE ) - { - tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; - - Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); - - BufferPlayoutStop.fStopCleanly = FALSE; - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiModifyChannelEntry - -Description: Updates the channel structure in the ECHO channel list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel modify structure. -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_usChanIndex Index of the channel within the API's channel list. -f_usNewPhasingTsstIndex Index of the new phasing TSST. -f_fSinSoutCodecActive State of the SIN/SOUT codec. -f_fRinRoutCodecActive State of the RIN/ROUT codec. -f_usNewRinTsstIndex New RIN TSST memory index. -f_usNewSinTsstIndex New SIN TSST memory index. -f_usNewRoutTsstIndex New ROUT TSST memory index. -f_usNewSoutTsstIndex New SOUT TSST memory index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiModifyChannelEntry -UINT32 Oct6100ApiModifyChannelEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - IN UINT8 f_fSinSoutCodecActive, - IN UINT8 f_fRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_usNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL_CODEC pApiCodecConf; - tPOCT6100_API_CHANNEL_TDM pApiTdmConf; - tPOCT6100_API_CHANNEL_VQE pApiVqeConf; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Obtain local pointer to the configuration structures of the tPOCT6100_API_CHANNEL structure. */ - pApiCodecConf = &pChanEntry->CodecConfig; - pApiTdmConf = &pChanEntry->TdmConfig; - pApiVqeConf = &pChanEntry->VqeConfig; - - /*=======================================================================*/ - /* Copy the channel's general configuration. */ - - pChanEntry->ulUserChanId = f_pChannelOpen->ulUserChanId; - pChanEntry->byEchoOperationMode = (UINT8)( f_pChannelOpen->ulEchoOperationMode & 0xFF ); - pChanEntry->fEnableToneDisabler = (UINT8)( f_pChannelOpen->fEnableToneDisabler & 0xFF ); - - /* Save the codec state.*/ - pChanEntry->fSinSoutCodecActive = (UINT8)( f_fSinSoutCodecActive & 0xFF ); - pChanEntry->fRinRoutCodecActive = (UINT8)( f_fRinRoutCodecActive & 0xFF ); - - /*=======================================================================*/ - /* Copy the channel's TDM configuration of all the modified fields. */ - - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - pApiTdmConf->byRinPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulRinPcmLaw & 0xFF ); - pApiTdmConf->bySinPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulSinPcmLaw & 0xFF ); - pApiTdmConf->byRoutPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulRoutPcmLaw & 0xFF ); - pApiTdmConf->bySoutPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulSoutPcmLaw & 0xFF ); - - pApiTdmConf->byRinNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulRinNumTssts & 0xFF ); - pApiTdmConf->bySinNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulSinNumTssts & 0xFF ); - pApiTdmConf->byRoutNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulRoutNumTssts & 0xFF ); - pApiTdmConf->bySoutNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulSoutNumTssts & 0xFF ); - - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usRinStream = (UINT16)( f_pChannelOpen->TdmConfig.ulRinStream & 0xFFFF ); - pApiTdmConf->usRinTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulRinTimeslot & 0xFFFF ); - pChanEntry->usRinTsstIndex = f_usNewRinTsstIndex; - } - else /* f_ulNewRinTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usRinStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usRinTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usRinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - - if ( f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usSinStream = (UINT16)( f_pChannelOpen->TdmConfig.ulSinStream & 0xFFFF ); - pApiTdmConf->usSinTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulSinTimeslot & 0xFFFF ); - pChanEntry->usSinTsstIndex = f_usNewSinTsstIndex; - } - else /* f_ulNewSinTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usSinStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usSinTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usSinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - - if ( f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usRoutStream = (UINT16)( f_pChannelOpen->TdmConfig.ulRoutStream & 0xFFFF ); - pApiTdmConf->usRoutTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulRoutTimeslot & 0xFFFF ); - pChanEntry->usRoutTsstIndex = f_usNewRoutTsstIndex; - } - else /* f_ulNewRoutTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usRoutStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usRoutTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - - if ( f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usSoutStream = (UINT16)( f_pChannelOpen->TdmConfig.ulSoutStream & 0xFFFF ); - pApiTdmConf->usSoutTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulSoutTimeslot & 0xFFFF ); - pChanEntry->usSoutTsstIndex = f_usNewSoutTsstIndex; - } - else /* f_ulNewSoutTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usSoutStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usSoutTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - } - - /*=======================================================================*/ - /* Copy the channel's VQE configuration of all the modified fields. */ - - if ( f_pChannelModify->fVqeConfigModified == TRUE ) - { - pApiVqeConf->fEnableNlp = (UINT8)( f_pChannelOpen->VqeConfig.fEnableNlp & 0xFF ); - pApiVqeConf->byComfortNoiseMode = (UINT8)( f_pChannelOpen->VqeConfig.ulComfortNoiseMode & 0xFF ); - pApiVqeConf->fSinDcOffsetRemoval = (UINT8)( f_pChannelOpen->VqeConfig.fSinDcOffsetRemoval & 0xFF ); - pApiVqeConf->fRinDcOffsetRemoval = (UINT8)( f_pChannelOpen->VqeConfig.fRinDcOffsetRemoval & 0xFF ); - pApiVqeConf->fRinLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fRinLevelControl & 0xFF ); - pApiVqeConf->fSoutLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fSoutLevelControl & 0xFF ); - pApiVqeConf->fRinAutomaticLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fRinAutomaticLevelControl & 0xFF ); - pApiVqeConf->fSoutAutomaticLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fSoutAutomaticLevelControl & 0xFF ); - pApiVqeConf->fRinHighLevelCompensation = (UINT8)( f_pChannelOpen->VqeConfig.fRinHighLevelCompensation & 0xFF ); - - pApiVqeConf->fSoutAdaptiveNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fSoutAdaptiveNoiseReduction & 0xFF ); - pApiVqeConf->fSoutNoiseBleaching = (UINT8)( f_pChannelOpen->VqeConfig.fSoutNoiseBleaching & 0xFF ); - pApiVqeConf->fSoutConferencingNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fSoutConferencingNoiseReduction & 0xFF ); - pApiVqeConf->chRinLevelControlGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRinLevelControlGainDb & 0xFF ); - pApiVqeConf->chSoutLevelControlGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lSoutLevelControlGainDb & 0xFF ); - pApiVqeConf->chRinAutomaticLevelControlTargetDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRinAutomaticLevelControlTargetDb & 0xFF ); - pApiVqeConf->chSoutAutomaticLevelControlTargetDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb & 0xFF ); - pApiVqeConf->chRinHighLevelCompensationThresholdDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRinHighLevelCompensationThresholdDb & 0xFF ); - pApiVqeConf->fEnableTailDisplacement = (UINT8)( f_pChannelOpen->VqeConfig.fEnableTailDisplacement & 0xFF ); - pApiVqeConf->usTailDisplacement = (UINT16)( f_pChannelOpen->VqeConfig.ulTailDisplacement & 0xFFFF ); - pApiVqeConf->usTailLength = (UINT16)( f_pChannelOpen->VqeConfig.ulTailLength & 0xFFFF ); - pApiVqeConf->fAcousticEcho = (UINT8)( f_pChannelOpen->VqeConfig.fAcousticEcho & 0xFF ); - pApiVqeConf->fDtmfToneRemoval = (UINT8)( f_pChannelOpen->VqeConfig.fDtmfToneRemoval & 0xFF ); - - pApiVqeConf->chDefaultErlDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lDefaultErlDb & 0xFF ); - pApiVqeConf->chAecDefaultErlDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lAecDefaultErlDb & 0xFF ); - pApiVqeConf->usAecTailLength = (UINT16)( f_pChannelOpen->VqeConfig.ulAecTailLength & 0xFFFF ); - pApiVqeConf->chAnrSnrEnhancementDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lAnrSnrEnhancementDb & 0xFF ); - pApiVqeConf->byAnrVoiceNoiseSegregation = (UINT8)( f_pChannelOpen->VqeConfig.ulAnrVoiceNoiseSegregation & 0xFF ); - pApiVqeConf->usToneDisablerVqeActivationDelay = (UINT16)( f_pChannelOpen->VqeConfig.ulToneDisablerVqeActivationDelay & 0xFFFF ); - pApiVqeConf->byNonLinearityBehaviorA = (UINT8)( f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorA & 0xFF ); - pApiVqeConf->byNonLinearityBehaviorB = (UINT8)( f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorB & 0xFF ); - pApiVqeConf->byDoubleTalkBehavior = (UINT8)( f_pChannelOpen->VqeConfig.ulDoubleTalkBehavior & 0xFF ); - pApiVqeConf->bySoutAutomaticListenerEnhancementGainDb = (UINT8)( f_pChannelOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb & 0xFF ); - pApiVqeConf->bySoutNaturalListenerEnhancementGainDb = (UINT8)( f_pChannelOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb & 0xFF ); - pApiVqeConf->fSoutNaturalListenerEnhancement = (UINT8)( f_pChannelOpen->VqeConfig.fSoutNaturalListenerEnhancement & 0xFF ); - pApiVqeConf->fRoutNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fRoutNoiseReduction & 0xFF ); - pApiVqeConf->chRoutNoiseReductionLevelGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRoutNoiseReductionLevelGainDb & 0xFF ); - pApiVqeConf->fEnableMusicProtection = (UINT8)( f_pChannelOpen->VqeConfig.fEnableMusicProtection & 0xFF ); - pApiVqeConf->fIdleCodeDetection = (UINT8)( f_pChannelOpen->VqeConfig.fIdleCodeDetection & 0xFF ); - } - - /*=======================================================================*/ - /* Copy the channel's CODEC configuration of all the modified fields. */ - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - pApiCodecConf->byAdpcmNibblePosition = (UINT8)( f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition & 0xFF ); - pApiCodecConf->byEncoderPort = (UINT8)( f_pChannelOpen->CodecConfig.ulEncoderPort & 0xFF ); - pApiCodecConf->byEncodingRate = (UINT8)( f_pChannelOpen->CodecConfig.ulEncodingRate & 0xFF ); - pApiCodecConf->byDecoderPort = (UINT8)( f_pChannelOpen->CodecConfig.ulDecoderPort & 0xFF ); - pApiCodecConf->byDecodingRate = (UINT8)( f_pChannelOpen->CodecConfig.ulDecodingRate & 0xFF ); - pApiCodecConf->fEnableSilenceSuppression = (UINT8)( f_pChannelOpen->CodecConfig.fEnableSilenceSuppression & 0xFF ); - pApiCodecConf->byPhase = (UINT8)( f_pChannelOpen->CodecConfig.ulPhase & 0xFF ); - pApiCodecConf->byPhasingType = (UINT8)( f_pChannelOpen->CodecConfig.ulPhasingType & 0xFF ); - - /* Update the API phasing TSST structure */ - if ( f_usNewPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingTsst; - - /* Release the previous phasing TSST if the channel was already bound to one.*/ - if ( pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingTsst, pChanEntry->usPhasingTsstIndex ); - - pPhasingTsst->usDependencyCnt--; - } - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingTsst, f_usNewPhasingTsstIndex ); - - pPhasingTsst->usDependencyCnt++; - pChanEntry->usPhasingTsstIndex = f_usNewPhasingTsstIndex; - - } - } - - - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstAddSer - -Description: Assign a TSST to one of the port of an echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to TSST assign structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstAddSer -UINT32 Oct6100ChannelBroadcastTsstAddSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd ) -{ - UINT16 usChanIndex; - UINT16 usNewTsstIndex; - UINT16 usNewTsstEntry; - UINT32 ulResult; - - ulResult = Oct6100ApiCheckChanTsstAddParams( f_pApiInstance, f_pChannelTsstAdd, &usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReserveTsstAddResources( f_pApiInstance, f_pChannelTsstAdd, usChanIndex, &usNewTsstIndex, &usNewTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWriteTsstAddStructs( f_pApiInstance, f_pChannelTsstAdd, usChanIndex, usNewTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiUpdateTsstAddChanEntry( f_pApiInstance, f_pChannelTsstAdd, usChanIndex, usNewTsstIndex, usNewTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChanTsstAddParams - -Description: Verify the validity of the tPOCT6100_CHANNEL_BROADCAST_TSST_ADD - structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_pusChanIndex Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChanTsstAddParams -UINT32 Oct6100ApiCheckChanTsstAddParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - OUT PUINT16 f_pusChanIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulNumTssts = 1; - UINT32 ulEntryOpenCnt; - - /* Check the provided handle. */ - if ( (f_pChannelTsstAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelTsstAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelTsstAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* validate the port parameter.*/ - if ( f_pChannelTsstAdd->ulPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pChannelTsstAdd->ulPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_CHANNEL_TSST_ADD_PORT; - - /* Get the required number of TSST based on the port.*/ - switch( f_pChannelTsstAdd->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_B; - } - - /* Check the validity of the timeslot and stream. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - ulNumTssts, - f_pChannelTsstAdd->ulTimeslot, - f_pChannelTsstAdd->ulStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_TSST_ADD_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_TSST_ADD_STREAM; - } - else - { - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsstAddResources - -Description: Reserve the entry for the new broadcast TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index within the API's channel list. -f_pusNewTsstIndex Pointer to the new TSST index within the API's TSST memory. -f_pusNewTsstEntry Pointer to the new TSST entry within the API's TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsstAddResources -UINT32 Oct6100ApiReserveTsstAddResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewTsstIndex, - OUT PUINT16 f_pusNewTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulNumTssts = 1; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - switch( f_pChannelTsstAdd->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_C; - } - - /* Reserve the new entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pChannelTsstAdd->ulTimeslot, - f_pChannelTsstAdd->ulStream, - ulNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewTsstIndex, - f_pusNewTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteTsstAddStructs - -Description: Configure the TSST control memory for the new TSST entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index. -f_usNewTsstIndex Tsst index in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteTsstAddStructs -UINT32 Oct6100ApiWriteTsstAddStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT16 usTsiMemIndex; - UINT32 ulNumTssts = 1; - - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - switch( f_pChannelTsstAdd->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - usTsiMemIndex = pChanEntry->usRinRoutTsiMemIndex; - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - usTsiMemIndex = pChanEntry->usSinSoutTsiMemIndex; - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_D; - } - - - /* Write the new entry now.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usNewTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_OUTPUT_TSST; - WriteParams.usWriteData |= (UINT16)( pChanEntry->CodecConfig.byAdpcmNibblePosition << cOCT6100_TSST_CONTROL_MEM_NIBBLE_POS_OFFSET ); - WriteParams.usWriteData |= (UINT16)( (ulNumTssts - 1) << cOCT6100_TSST_CONTROL_MEM_TSST_NUM_OFFSET ); - WriteParams.usWriteData |= (UINT16)( usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateTsstAddChanEntry - -Description: Update the associated channel API entry to add the new broacast TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index. -f_usNewTsstIndex TSST index within the TSST control memory. -f_usNewTsstEntry TSST entry within the API TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateTsstAddChanEntry -UINT32 Oct6100ApiUpdateTsstAddChanEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex, - IN UINT16 f_usNewTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, f_usNewTsstEntry ); - - /* Update the channel entry.*/ - if ( f_pChannelTsstAdd->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Add the new TSST entry to the broadcast list.*/ - pTsstEntry->usNextEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - pTsstEntry->usTsstMemoryIndex = (UINT16)f_usNewTsstIndex; - pTsstEntry->usTsstValue = (UINT16)( (f_pChannelTsstAdd->ulTimeslot << 5) | f_pChannelTsstAdd->ulStream ); - - /* Modify the first entry pointer.*/ - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = f_usNewTsstEntry; - - /* Increment the number of broadcast TSST. */ - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry++; - - } - else /* f_pChannelTsstAdd->ulPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Add the new TSST entry to the broadcast list.*/ - pTsstEntry->usNextEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - pTsstEntry->usTsstMemoryIndex = (UINT16)f_usNewTsstIndex; - pTsstEntry->usTsstValue = (UINT16)( (f_pChannelTsstAdd->ulTimeslot << 5) | f_pChannelTsstAdd->ulStream ); - - /* Modify the first entry pointer.*/ - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = f_usNewTsstEntry; - - /* Increment the number of broadcast TSST. */ - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry++; - } - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstRemoveSer - -Description: Removes a broadcast TSST from one of the output port of an - echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstRemove Pointer to TSST remove structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstRemoveSer -UINT32 Oct6100ChannelBroadcastTsstRemoveSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove) -{ - UINT16 usChanIndex; - UINT16 usTsstIndex; - UINT16 usTsstEntry; - UINT16 usPrevTsstEntry; - UINT32 ulResult; - - ulResult = Oct6100ApiAssertChanTsstRemoveParams( f_pApiInstance, f_pChannelTsstRemove, &usChanIndex, &usTsstIndex, &usTsstEntry, &usPrevTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiInvalidateTsstRemoveStructs( f_pApiInstance, usChanIndex, usTsstIndex, f_pChannelTsstRemove->ulPort, f_pChannelTsstRemove->fRemoveAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseTsstRemoveResources( f_pApiInstance, f_pChannelTsstRemove, usChanIndex, usTsstIndex, usTsstEntry, usPrevTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChanTsstRemoveParams - -Description: Verify the validity of the tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE - structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstRemove Pointer to echo cancellation channel open configuration structure. -f_pulChanIndex Pointer to a channel index. -f_pulNewTsstIndex Pointer to a TSST index within the TSST control memory. -f_pulNewTsstEntry Pointer to a TSST entry within the API TSST list. -f_pulPrevTsstEntry Pointer to the previous TSST entry. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChanTsstRemoveParams -UINT32 Oct6100ApiAssertChanTsstRemoveParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusTsstIndex, - OUT PUINT16 f_pusTsstEntry, - OUT PUINT16 f_pusPrevTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT32 ulResult; - UINT32 ulNumTssts = 1; - UINT32 ulEntryOpenCnt; - UINT16 usCurrentEntry; - UINT16 usTsstValue; - UINT16 usNumEntry; - - /* Check the provided handle. */ - if ( (f_pChannelTsstRemove->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelTsstRemove->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelTsstRemove->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* validate the port parameter.*/ - if ( f_pChannelTsstRemove->ulPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pChannelTsstRemove->ulPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_PORT; - - /* Verify that the requested entry is present in the channel's port broadcast TSST.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usCurrentEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - usNumEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry; - } - else /* f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - usCurrentEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - usNumEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry; - } - - /* Verify if at least one TSST is present on the channel port.*/ - if ( usNumEntry == 0 ) - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_NO_BROADCAST_TSST; - - /* Get the required number of TSST based on the port.*/ - switch( f_pChannelTsstRemove->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_E; - } - - /* Initialize the TSST entry to invalid.*/ - *f_pusTsstEntry = cOCT6100_INVALID_INDEX; - *f_pusPrevTsstEntry = cOCT6100_INVALID_INDEX; - *f_pusTsstIndex = cOCT6100_INVALID_INDEX; - - if ( f_pChannelTsstRemove->fRemoveAll != TRUE ) - { - /* Check the validity of the timeslot and Stream.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - ulNumTssts, - f_pChannelTsstRemove->ulTimeslot, - f_pChannelTsstRemove->ulStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_STREAM; - } - else - { - return ulResult; - } - } - - /* Set the TSST value based on the timeslot and stream value.*/ - usTsstValue = (UINT16)( (f_pChannelTsstRemove->ulTimeslot << 5) | f_pChannelTsstRemove->ulStream ); - - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - if ( usTsstValue == pTsstEntry->usTsstValue ) - { - /* A match was found.*/ - *f_pusTsstEntry = usCurrentEntry; - *f_pusTsstIndex = pTsstEntry->usTsstMemoryIndex; - break; - } - - /* Move on to the next entry.*/ - *f_pusPrevTsstEntry = usCurrentEntry; - usCurrentEntry = pTsstEntry->usNextEntry; - } - - if ( *f_pusTsstEntry == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_INVALID_TSST; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateTsstRemoveStructs - -Description: Invalidate the entry of the broadcast TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Channel index. -f_usTsstIndex TSST index within the TSST control memory. -f_ulPort Channel port where the TSST are removed from. (only used if remove all == TRUE) -f_fRemoveAll Remove all flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateTsstRemoveStructs -UINT32 Oct6100ApiInvalidateTsstRemoveStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulPort, - IN BOOL f_fRemoveAll ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - if ( f_fRemoveAll == FALSE ) - { - /* Deactivate the entry now.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* f_fRemoveAll == TRUE */ - { - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT16 usTsstEntry; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Clear all entry associated to the selected port.*/ - if ( f_ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - usTsstEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - else - usTsstEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - - do - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usTsstEntry ); - - /* Deactivate the entry now.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( ( pTsstEntry->usTsstMemoryIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usTsstEntry = pTsstEntry->usNextEntry; - - } while ( usTsstEntry != cOCT6100_INVALID_INDEX ); - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsstRemoveResources - -Description: Release all API resources associated to the Removed TSST and - update the channel entry accordingly. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstRemove Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index. -f_usTsstIndex TSST index within the TSST control memory. -f_usTsstEntry TSST entry within the API's TSST list. -f_usPrevTsstEntry Previous TSST entry within the API's TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsstRemoveResources -UINT32 Oct6100ApiReleaseTsstRemoveResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsstEntry, - IN UINT16 f_usPrevTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - tPOCT6100_API_TSST_ENTRY pPrevTsstEntry; - UINT16 usCurrentEntry; - UINT32 ulResult; - UINT32 ulTimeslot; - UINT32 ulStream; - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - if ( f_pChannelTsstRemove->fRemoveAll == FALSE ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, f_usTsstEntry ); - - /* Update the channel entry.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check if the entry was the first in the list.*/ - if ( f_usPrevTsstEntry == cOCT6100_INVALID_INDEX ) - { - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = pTsstEntry->usNextEntry; - } - else /* f_ulPrevTsstEntry != cOCT6100_INVALID_INDEX */ - { - /* Get a pointer to the previous entry.*/ - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPrevTsstEntry, f_usPrevTsstEntry ); - pPrevTsstEntry->usNextEntry = pTsstEntry->usNextEntry; - } - - /* Decrement the number of entry.*/ - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry--; - } - else /* f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Check if the entry was the first in the list.*/ - if ( f_usPrevTsstEntry == cOCT6100_INVALID_INDEX ) - { - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = pTsstEntry->usNextEntry; - } - else /* f_ulPrevTsstEntry != cOCT6100_INVALID_INDEX */ - { - /* Get a pointer to the previous entry.*/ - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPrevTsstEntry, f_usPrevTsstEntry ); - pPrevTsstEntry->usNextEntry = pTsstEntry->usNextEntry; - } - - /* Decrement the number of entry.*/ - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry--; - } - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - /* Release the entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - f_usTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* f_pChannelTsstRemove->fRemoveAll == TRUE */ - { - - /* Update the channel entry.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - usCurrentEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - else - usCurrentEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - - do - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - /* Release the entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - usCurrentEntry ); /* Release the entry.*/ - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usCurrentEntry = pTsstEntry->usNextEntry; - - /* Clear the previous node.*/ - pTsstEntry->usTsstMemoryIndex = 0xFFFF; - pTsstEntry->usTsstValue = 0xFFFF; - pTsstEntry->usNextEntry = cOCT6100_INVALID_INDEX; - - } while ( usCurrentEntry != cOCT6100_INVALID_INDEX ); - - /* Reset the channel status.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry = 0; - } - else - { - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry = 0; - } - } - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiChannelGetStatsSer - -Description: Serialized function that returns all the stats of the specified - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelStats Pointer to a channel stats structure. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiChannelGetStatsSer -UINT32 Oct6100ApiChannelGetStatsSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_STATS f_pChannelStats ) -{ - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS BurstParams; - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT32 ulEntryOpenCnt; - UINT16 usCurrentEntry; - UINT16 usTsstCount; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulTempData; - UINT32 ulMask; - UINT16 usChanIndex; - UINT16 ausReadData[ 32 ]; - - BYTE byRinEnergyRaw; - BYTE bySinEnergyRaw; - BYTE bySoutEnergyRaw; - INT32 lSoutEnergyIndB; - BYTE byCnEnergyRaw; - UINT16 usEchoDelayInFrames; - UINT16 usErlRaw; - - UINT32 ulResult; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusReadData = ausReadData; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Check the reset stats flag.*/ - if ( f_pChannelStats->fResetStats != TRUE && f_pChannelStats->fResetStats != FALSE ) - return cOCT6100_ERR_CHANNEL_STATS_RESET; - - /* Check the provided handle. */ - if ( cOCT6100_HNDL_TAG_CHANNEL != (f_pChannelStats->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - usChanIndex = (UINT16)( f_pChannelStats->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( usChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, usChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelStats->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* Check the value of the max broadcast tsst.*/ - if ( f_pChannelStats->TdmConfig.ulMaxBroadcastTssts > cOCT6100_MAX_TSSTS ) - return cOCT6100_ERR_CHANNEL_GET_STATS_MAX_BROADCAST_TSST; - - if ( f_pChannelStats->TdmConfig.ulMaxBroadcastTssts != 0 ) - { - /* Check if memory was allocated by the user for the stream and timeslot values.*/ - if ( f_pChannelStats->TdmConfig.pulRoutBroadcastTimeslot == NULL ) - return cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_TIMESLOT; - - if ( f_pChannelStats->TdmConfig.pulRoutBroadcastStream == NULL ) - return cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_STREAM; - - if ( f_pChannelStats->TdmConfig.pulSoutBroadcastTimeslot == NULL ) - return cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_TIMESLOT; - - if ( f_pChannelStats->TdmConfig.pulSoutBroadcastStream == NULL ) - return cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_STREAM; - } - - /* Copy the general configuration.*/ - f_pChannelStats->ulUserChanId = pChanEntry->ulUserChanId; - f_pChannelStats->ulEchoOperationMode = pChanEntry->byEchoOperationMode; - f_pChannelStats->fEnableToneDisabler = pChanEntry->fEnableToneDisabler; - f_pChannelStats->ulMutePortsMask = pChanEntry->usMutedPorts; - f_pChannelStats->fEnableExtToneDetection = pChanEntry->fEnableExtToneDetection; - - - - /* Copy the TDM configuration.*/ - f_pChannelStats->TdmConfig.ulNumRoutBroadcastTssts = pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry; - f_pChannelStats->TdmConfig.ulNumSoutBroadcastTssts = pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry; - - f_pChannelStats->TdmConfig.ulSinNumTssts = pChanEntry->TdmConfig.bySinNumTssts; - f_pChannelStats->TdmConfig.ulSinTimeslot = pChanEntry->TdmConfig.usSinTimeslot; - f_pChannelStats->TdmConfig.ulSinStream = pChanEntry->TdmConfig.usSinStream; - f_pChannelStats->TdmConfig.ulSinPcmLaw = pChanEntry->TdmConfig.bySinPcmLaw; - - f_pChannelStats->TdmConfig.ulSoutNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - f_pChannelStats->TdmConfig.ulSoutTimeslot = pChanEntry->TdmConfig.usSoutTimeslot; - f_pChannelStats->TdmConfig.ulSoutStream = pChanEntry->TdmConfig.usSoutStream; - f_pChannelStats->TdmConfig.ulSoutPcmLaw = pChanEntry->TdmConfig.bySoutPcmLaw; - - /* Copy the SOUT Broadcast TSST into the Stream and timeslot array.*/ - usCurrentEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - for( usTsstCount = 0; (usTsstCount < pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry) && (usTsstCount < f_pChannelStats->TdmConfig.ulMaxBroadcastTssts); usTsstCount++ ) - { - if ( usCurrentEntry == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_FATAL_F; - - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - f_pChannelStats->TdmConfig.pulSoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue & 0x1F; - f_pChannelStats->TdmConfig.pulSoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue >> 5; - - /* Obtain the index of the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - - /* Check if all Sout Broadcast TSST were returned.*/ - if ( usTsstCount < pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry ) - { - f_pChannelStats->TdmConfig.fMoreSoutBroadcastTssts = TRUE; - } - else /* usTsstCount >= pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry */ - { - f_pChannelStats->TdmConfig.fMoreSoutBroadcastTssts = FALSE; - } - - f_pChannelStats->TdmConfig.ulRinNumTssts = pChanEntry->TdmConfig.byRinNumTssts; - f_pChannelStats->TdmConfig.ulRinTimeslot = pChanEntry->TdmConfig.usRinTimeslot; - f_pChannelStats->TdmConfig.ulRinStream = pChanEntry->TdmConfig.usRinStream; - f_pChannelStats->TdmConfig.ulRinPcmLaw = pChanEntry->TdmConfig.byRinPcmLaw; - - f_pChannelStats->TdmConfig.ulRoutNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - f_pChannelStats->TdmConfig.ulRoutTimeslot = pChanEntry->TdmConfig.usRoutTimeslot; - f_pChannelStats->TdmConfig.ulRoutStream = pChanEntry->TdmConfig.usRoutStream; - f_pChannelStats->TdmConfig.ulRoutPcmLaw = pChanEntry->TdmConfig.byRoutPcmLaw; - - - /* Copy the ROUT Broadcast TSST into the Stream and timeslot array.*/ - usCurrentEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - for( usTsstCount = 0; (usTsstCount < pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry) && (usTsstCount < f_pChannelStats->TdmConfig.ulMaxBroadcastTssts); usTsstCount++ ) - { - if ( usCurrentEntry == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_FATAL_10; - - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - f_pChannelStats->TdmConfig.pulRoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue & 0x1F; - f_pChannelStats->TdmConfig.pulRoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue >> 5; - - /* Obtain the index of the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - - /* Check if all Rout Broadcast TSST were returned.*/ - if ( usTsstCount < pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry ) - { - f_pChannelStats->TdmConfig.fMoreRoutBroadcastTssts = TRUE; - } - else /* usTsstCount >= pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry */ - { - f_pChannelStats->TdmConfig.fMoreRoutBroadcastTssts = FALSE; - } - - /* Copy the VQE configuration.*/ - f_pChannelStats->VqeConfig.fEnableNlp = pChanEntry->VqeConfig.fEnableNlp; - f_pChannelStats->VqeConfig.ulComfortNoiseMode = pChanEntry->VqeConfig.byComfortNoiseMode; - f_pChannelStats->VqeConfig.fEnableTailDisplacement = pChanEntry->VqeConfig.fEnableTailDisplacement; - if ( pChanEntry->VqeConfig.usTailDisplacement != cOCT6100_AUTO_SELECT_TAIL ) - f_pChannelStats->VqeConfig.ulTailDisplacement = pChanEntry->VqeConfig.usTailDisplacement; - else - f_pChannelStats->VqeConfig.ulTailDisplacement = f_pApiInstance->pSharedInfo->ChipConfig.usTailDisplacement; - - if ( pChanEntry->VqeConfig.usTailLength != cOCT6100_AUTO_SELECT_TAIL ) - f_pChannelStats->VqeConfig.ulTailLength = pChanEntry->VqeConfig.usTailLength; - else - f_pChannelStats->VqeConfig.ulTailLength = f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailLength; - - - - f_pChannelStats->VqeConfig.fSinDcOffsetRemoval = pChanEntry->VqeConfig.fSinDcOffsetRemoval; - f_pChannelStats->VqeConfig.fRinDcOffsetRemoval = pChanEntry->VqeConfig.fRinDcOffsetRemoval; - f_pChannelStats->VqeConfig.fRinLevelControl = pChanEntry->VqeConfig.fRinLevelControl; - f_pChannelStats->VqeConfig.fSoutLevelControl = pChanEntry->VqeConfig.fSoutLevelControl; - f_pChannelStats->VqeConfig.fRinAutomaticLevelControl = pChanEntry->VqeConfig.fRinAutomaticLevelControl; - f_pChannelStats->VqeConfig.fSoutAutomaticLevelControl = pChanEntry->VqeConfig.fSoutAutomaticLevelControl; - f_pChannelStats->VqeConfig.fRinHighLevelCompensation = pChanEntry->VqeConfig.fRinHighLevelCompensation; - f_pChannelStats->VqeConfig.fSoutAdaptiveNoiseReduction = pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction; - f_pChannelStats->VqeConfig.fSoutNoiseBleaching = pChanEntry->VqeConfig.fSoutNoiseBleaching; - f_pChannelStats->VqeConfig.fSoutConferencingNoiseReduction = pChanEntry->VqeConfig.fSoutConferencingNoiseReduction; - f_pChannelStats->VqeConfig.lRinLevelControlGainDb = pChanEntry->VqeConfig.chRinLevelControlGainDb; - f_pChannelStats->VqeConfig.lSoutLevelControlGainDb = pChanEntry->VqeConfig.chSoutLevelControlGainDb; - f_pChannelStats->VqeConfig.lRinAutomaticLevelControlTargetDb = pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb; - f_pChannelStats->VqeConfig.lSoutAutomaticLevelControlTargetDb = pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb; - f_pChannelStats->VqeConfig.lRinHighLevelCompensationThresholdDb = pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb; - f_pChannelStats->VqeConfig.fAcousticEcho = pChanEntry->VqeConfig.fAcousticEcho; - f_pChannelStats->VqeConfig.fDtmfToneRemoval = pChanEntry->VqeConfig.fDtmfToneRemoval; - - f_pChannelStats->VqeConfig.lDefaultErlDb = pChanEntry->VqeConfig.chDefaultErlDb; - f_pChannelStats->VqeConfig.lAecDefaultErlDb = pChanEntry->VqeConfig.chAecDefaultErlDb; - f_pChannelStats->VqeConfig.ulAecTailLength = pChanEntry->VqeConfig.usAecTailLength; - f_pChannelStats->VqeConfig.lAnrSnrEnhancementDb = pChanEntry->VqeConfig.chAnrSnrEnhancementDb; - f_pChannelStats->VqeConfig.ulAnrVoiceNoiseSegregation = pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation; - f_pChannelStats->VqeConfig.ulToneDisablerVqeActivationDelay = pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorA = pChanEntry->VqeConfig.byNonLinearityBehaviorA; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorB = pChanEntry->VqeConfig.byNonLinearityBehaviorB; - f_pChannelStats->VqeConfig.ulDoubleTalkBehavior = pChanEntry->VqeConfig.byDoubleTalkBehavior; - f_pChannelStats->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb; - f_pChannelStats->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb; - f_pChannelStats->VqeConfig.fSoutNaturalListenerEnhancement = pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement; - f_pChannelStats->VqeConfig.fRoutNoiseReduction = pChanEntry->VqeConfig.fRoutNoiseReduction; - f_pChannelStats->VqeConfig.lRoutNoiseReductionLevelGainDb = pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb; - f_pChannelStats->VqeConfig.fEnableMusicProtection = pChanEntry->VqeConfig.fEnableMusicProtection; - f_pChannelStats->VqeConfig.fIdleCodeDetection = pChanEntry->VqeConfig.fIdleCodeDetection; - - /* Copy the CODEC configuration.*/ - f_pChannelStats->CodecConfig.ulAdpcmNibblePosition = pChanEntry->CodecConfig.byAdpcmNibblePosition; - - f_pChannelStats->CodecConfig.ulEncoderPort = pChanEntry->CodecConfig.byEncoderPort; - f_pChannelStats->CodecConfig.ulEncodingRate = pChanEntry->CodecConfig.byEncodingRate; - - f_pChannelStats->CodecConfig.ulDecoderPort = pChanEntry->CodecConfig.byDecoderPort; - f_pChannelStats->CodecConfig.ulDecodingRate = pChanEntry->CodecConfig.byDecodingRate; - - f_pChannelStats->CodecConfig.fEnableSilenceSuppression = pChanEntry->CodecConfig.fEnableSilenceSuppression; - f_pChannelStats->CodecConfig.ulPhase = pChanEntry->CodecConfig.byPhase; - f_pChannelStats->CodecConfig.ulPhasingType = pChanEntry->CodecConfig.byPhasingType; - - if ( pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingTsstEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingTsstEntry, pChanEntry->usPhasingTsstIndex ); - - f_pChannelStats->CodecConfig.ulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsstEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pChanEntry->usPhasingTsstIndex; - } - else - { - f_pChannelStats->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - } - - - /* Reset the stats and exit if the reset flag is set.*/ - if ( f_pChannelStats->fResetStats == TRUE ) - { - pChanEntry->sMaxERLE = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->sMaxERL = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->usMaxEchoDelay = cOCT6100_INVALID_STAT_W; - } - - /*---------------------------------------------------------------------*/ - /* Update the API internal stats.*/ - - BurstParams.ulReadAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + (usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - BurstParams.ulReadAddress += f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsOfst; - BurstParams.ulReadLength = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsSize / 2; /* Length in words.*/ - - mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the energy stat are found in the new memory location. */ - if ( ( pSharedInfo->ImageInfo.fRinEnergyStat == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutEnergyStat == TRUE ) ) - { - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst.byFieldSize; - - ReadParams.ulReadAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + (usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - /* Overwrite value read the old way. */ - ausReadData[ 0 ] &= 0x00FF; - ausReadData[ 0 ] |= (UINT16)( ( ulTempData << 8 ) & 0xFF00 ); - - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst.byFieldSize; - - ReadParams.ulReadAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + (usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - /* Overwrite value read the old way. */ - ausReadData[ 1 ] &= 0x00FF; - ausReadData[ 1 ] |= (UINT16)( ( ulTempData << 8 ) & 0xFF00 ); - } - - byRinEnergyRaw = (BYTE)(( ausReadData[ 0 ] >> 8 ) & 0xFF); - bySinEnergyRaw = (BYTE)(( ausReadData[ 0 ] >> 0 ) & 0xFF); - bySoutEnergyRaw = (BYTE)(( ausReadData[ 1 ] >> 8 ) & 0xFF); - byCnEnergyRaw = (BYTE)(( ausReadData[ 5 ] >> 8 ) & 0xFF); - - usEchoDelayInFrames = (UINT16)(ausReadData[ 4 ]); - usErlRaw = ausReadData[ 2 ]; - - pChanEntry->byToneDisablerStatus = (UINT8)(( ausReadData[ 5 ] >> 0 ) & 0xFF); - if ( f_pChannelStats->fResetStats == TRUE ) - { - pChanEntry->usNumEchoPathChangesOfst = (UINT16)(ausReadData[ 3 ]); - pChanEntry->usNumEchoPathChanges = 0; - } - else /* if ( f_pChannelStats->fResetStats == FALSE ) */ - { - pChanEntry->usNumEchoPathChanges = (UINT16)( ausReadData[ 3 ] - pChanEntry->usNumEchoPathChangesOfst ); - } - - pChanEntry->sComfortNoiseLevel = (INT16)( Oct6100ApiOctFloatToDbEnergyByte( byCnEnergyRaw ) & 0xFFFF ); - pChanEntry->sComfortNoiseLevel -= 12; - pChanEntry->sRinLevel = (INT16)( Oct6100ApiOctFloatToDbEnergyByte( byRinEnergyRaw ) & 0xFFFF ); - pChanEntry->sRinLevel -= 12; - pChanEntry->sSinLevel = (INT16)( Oct6100ApiOctFloatToDbEnergyByte( bySinEnergyRaw ) & 0xFFFF ); - pChanEntry->sSinLevel -= 12; - lSoutEnergyIndB = Oct6100ApiOctFloatToDbEnergyByte( bySoutEnergyRaw ); - lSoutEnergyIndB -= 12; - - /* Process some stats only if the channel is converged.*/ - if ( ( usEchoDelayInFrames != cOCT6100_INVALID_ECHO_DELAY ) - && ( pChanEntry->byEchoOperationMode != cOCT6100_ECHO_OP_MODE_POWER_DOWN ) - && ( pChanEntry->byEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_RESET ) ) - { - /* Update the current ERL. */ - pChanEntry->sCurrentERL = (INT16)( Oct6100ApiOctFloatToDbEnergyHalf( usErlRaw ) & 0xFFFF ); - pChanEntry->sCurrentERLE = (INT16)( ( lSoutEnergyIndB - pChanEntry->sSinLevel ) & 0xFFFF ); - pChanEntry->usCurrentEchoDelay = (UINT16)( usEchoDelayInFrames / 8 ); /* To convert in msec.*/ - - /* Update the max value if required.*/ - if ( pChanEntry->usCurrentEchoDelay > pChanEntry->usMaxEchoDelay || - pChanEntry->usMaxEchoDelay == cOCT6100_INVALID_STAT_W ) - { - pChanEntry->usMaxEchoDelay = pChanEntry->usCurrentEchoDelay; - } - - if ( pChanEntry->sCurrentERL > pChanEntry->sMaxERL || - pChanEntry->sMaxERL == cOCT6100_INVALID_SIGNED_STAT_W ) - { - pChanEntry->sMaxERL = pChanEntry->sCurrentERL; - } - - if ( pChanEntry->sCurrentERLE > pChanEntry->sMaxERLE || - pChanEntry->sMaxERLE == cOCT6100_INVALID_SIGNED_STAT_W ) - { - pChanEntry->sMaxERLE = pChanEntry->sCurrentERLE; - } - } - else - { - pChanEntry->sCurrentERLE = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->sCurrentERL = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->usCurrentEchoDelay = cOCT6100_INVALID_STAT_W; - } - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fRinAppliedGainStat == TRUE ) - { - /* Calculate base address for auto level control + high level compensation configuration. */ - ulBaseAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + ( usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst.byFieldSize; - - ReadParams.ulReadAddress = ulBaseAddress + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - pChanEntry->sRinAppliedGain = (INT16)( 2 * (INT16)( Oct6100ApiOctFloatToDbEnergyHalf( (UINT16)( ulTempData & 0xFFFF ) ) & 0xFFFF ) ); - } - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fSoutAppliedGainStat == TRUE ) - { - /* Calculate base address for auto level control + high level compensation configuration. */ - ulBaseAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + ( usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst.byFieldSize; - - ReadParams.ulReadAddress = ulBaseAddress + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - pChanEntry->sSoutAppliedGain = (INT16)( 2 * (INT16)( Oct6100ApiOctFloatToDbEnergyHalf( (UINT16)( ulTempData & 0xFFFF ) ) & 0xFFFF ) ); - } - - /*---------------------------------------------------------------------*/ - /* Return the real stats.*/ - - f_pChannelStats->ulNumEchoPathChanges = pChanEntry->usNumEchoPathChanges; - if ( usEchoDelayInFrames != cOCT6100_INVALID_ECHO_DELAY ) - { - f_pChannelStats->fEchoCancellerConverged = TRUE; - } - else - { - f_pChannelStats->fEchoCancellerConverged = FALSE; - } - if ( pChanEntry->sCurrentERL == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lCurrentERL = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lCurrentERL = pChanEntry->sCurrentERL; - - if ( pChanEntry->sMaxERL == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lMaxERL = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lMaxERL = pChanEntry->sMaxERL; - - if ( pChanEntry->usMaxEchoDelay == cOCT6100_INVALID_STAT_W ) - f_pChannelStats->ulMaxEchoDelay = cOCT6100_INVALID_STAT; - else - f_pChannelStats->ulMaxEchoDelay = pChanEntry->usMaxEchoDelay; - - if ( pChanEntry->sRinLevel == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lRinLevel = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lRinLevel = pChanEntry->sRinLevel; - - if ( pSharedInfo->ImageInfo.fSinLevel == TRUE ) - { - if ( pChanEntry->sSinLevel == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lSinLevel = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lSinLevel = pChanEntry->sSinLevel; - } - else /* if ( pSharedInfo->ImageInfo.fSinLevel != TRUE ) */ - { - /* SIN level is not supported in this image. */ - f_pChannelStats->lSinLevel = cOCT6100_INVALID_SIGNED_STAT; - } - - f_pChannelStats->lRinAppliedGain = pChanEntry->VqeConfig.chRinLevelControlGainDb; - if ( ( f_pApiInstance->pSharedInfo->ImageInfo.fRinAppliedGainStat == TRUE ) - && ( ( pChanEntry->VqeConfig.fRinAutomaticLevelControl == TRUE ) - || ( pChanEntry->VqeConfig.fRinHighLevelCompensation == TRUE ) ) ) - { - f_pChannelStats->lRinAppliedGain = pChanEntry->sRinAppliedGain; - } - - f_pChannelStats->lSoutAppliedGain = pChanEntry->VqeConfig.chSoutLevelControlGainDb; - if ( ( f_pApiInstance->pSharedInfo->ImageInfo.fSoutAppliedGainStat == TRUE ) - && ( pChanEntry->VqeConfig.fSoutAutomaticLevelControl == TRUE ) ) - { - f_pChannelStats->lSoutAppliedGain = pChanEntry->sSoutAppliedGain; - } - - if ( pChanEntry->usCurrentEchoDelay == cOCT6100_INVALID_STAT_W ) - f_pChannelStats->ulCurrentEchoDelay = cOCT6100_INVALID_STAT; - else - f_pChannelStats->ulCurrentEchoDelay = pChanEntry->usCurrentEchoDelay; - - if ( pSharedInfo->ImageInfo.fSinLevel == TRUE ) - { - if ( pChanEntry->sCurrentERLE == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lCurrentERLE = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lCurrentERLE = pChanEntry->sCurrentERLE; - } - else /* if ( pSharedInfo->ImageInfo.fSinLevel != TRUE ) */ - { - f_pChannelStats->lCurrentERLE = cOCT6100_INVALID_SIGNED_STAT; - } - - if ( pSharedInfo->ImageInfo.fSinLevel == TRUE ) - { - if ( pChanEntry->sMaxERLE == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lMaxERLE = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lMaxERLE = pChanEntry->sMaxERLE; - } - else /* if ( pSharedInfo->ImageInfo.fSinLevel != TRUE ) */ - { - f_pChannelStats->lMaxERLE = cOCT6100_INVALID_SIGNED_STAT; - } - - f_pChannelStats->lComfortNoiseLevel = pChanEntry->sComfortNoiseLevel; - f_pChannelStats->ulToneDisablerStatus = pChanEntry->byToneDisablerStatus; - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fSinVoiceDetectedStat == TRUE ) - { - UINT32 ulVoiceDetectedBytesOfst = f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst.usDwordOffset * 4; - UINT32 ulVoiceDetectedBitOfst = f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst.byBitOffset; - UINT32 ulVoiceDetectedFieldSize = f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst.byFieldSize; - - /* Set the channel root base address.*/ - UINT32 ulChannelRootBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( usChanIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst; - - ReadParams.ulReadAddress = ulChannelRootBaseAddress + ulVoiceDetectedBytesOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulVoiceDetectedBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulVoiceDetectedBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulVoiceDetectedFieldSize, ulVoiceDetectedBitOfst, &ulMask ); - - if ( ( ulTempData & ulMask ) != 0x0 ) - f_pChannelStats->fSinVoiceDetected = TRUE; - else - f_pChannelStats->fSinVoiceDetected = FALSE; - } - - /*---------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveEchoEntry - -Description: Reserves one of the echo channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusEchoIndex Resulting index reserved in the echo channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveEchoEntry -UINT32 Oct6100ApiReserveEchoEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEchoIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pEchoAlloc; - UINT32 ulResult; - UINT32 ulEchoIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pEchoAlloc ) - - ulResult = OctapiLlmAllocAlloc( pEchoAlloc, &ulEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CHANNEL_ALL_CHANNELS_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_11; - } - - *f_pusEchoIndex = (UINT16)( ulEchoIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseEchoEntry - -Description: Releases the specified ECHO channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usEchoIndex Index reserved in the echo channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseEchoEntry -UINT32 Oct6100ApiReleaseEchoEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pEchoAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pEchoAlloc ) - - ulResult = OctapiLlmAllocDealloc( pEchoAlloc, f_usEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_12; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBiDirChanEntry - -Description: Reserves one of the bidirectional channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusBiDirChanIndex Resulting index reserved in the bidir channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBiDirChanEntry -UINT32 Oct6100ApiReserveBiDirChanEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusBiDirChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pChanAlloc; - UINT32 ulResult; - UINT32 ulBiDirChanIndex; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pChanAlloc ) - - ulResult = OctapiLlmAllocAlloc( pChanAlloc, &ulBiDirChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CHANNEL_ALL_BIDIR_CHANNELS_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_9F; - } - - *f_pusBiDirChanIndex = (UINT16)( ulBiDirChanIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBiDirChanEntry - -Description: Releases the specified bidirectional channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulBiDirChanIndex Bidirectional channel index within the API's Bidir channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBiDirChanEntry -UINT32 Oct6100ApiReleaseBiDirChanEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBiDirChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pChanAlloc ) - - ulResult = OctapiLlmAllocDealloc( pChanAlloc, f_ulBiDirChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_A0; - } - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckTdmConfig - -Description: This function will check the validity of the TDM config parameter - of an Open TDM config structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTdmConfig TDM config of the channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckTdmConfig -UINT32 Oct6100ApiCheckTdmConfig( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig ) -{ - UINT32 ulResult; - - /*==============================================================================*/ - /* Check the TDM configuration parameters.*/ - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulRinTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulRinStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulRinNumTssts != 1 && - f_pTdmConfig->ulRinNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_RIN_NUM_TSSTS; - - /* Check the RIN TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulRinNumTssts, - f_pTdmConfig->ulRinTimeslot, - f_pTdmConfig->ulRinStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_RIN_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulRoutTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulRoutStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulRoutNumTssts != 1 && - f_pTdmConfig->ulRoutNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_ROUT_NUM_TSSTS; - - /* Check the ROUT TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulRoutNumTssts, - f_pTdmConfig->ulRoutTimeslot, - f_pTdmConfig->ulRoutStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_ROUT_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulSinTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulSinStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulSinNumTssts != 1 && - f_pTdmConfig->ulSinNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_SIN_NUM_TSSTS; - - /* Check the SIN TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulSinNumTssts, - f_pTdmConfig->ulSinTimeslot, - f_pTdmConfig->ulSinStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_SIN_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_SIN_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulSoutTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulSoutStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulSoutNumTssts != 1 && - f_pTdmConfig->ulSoutNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_SOUT_NUM_TSSTS; - - /* Check the ROUT TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulSoutNumTssts, - f_pTdmConfig->ulSoutTimeslot, - f_pTdmConfig->ulSoutStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_SOUT_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the PCM law parameters.*/ - if ( f_pTdmConfig->ulRinPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulRinPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_RIN_PCM_LAW; - - if ( f_pTdmConfig->ulSinPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulSinPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_SIN_PCM_LAW; - - if ( f_pTdmConfig->ulRoutPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulRoutPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_ROUT_PCM_LAW; - - if ( f_pTdmConfig->ulSoutPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulSoutPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_SOUT_PCM_LAW; - - /*==============================================================================*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckVqeConfig - -Description: This function will check the validity of the VQE config parameter - of an Open VQE config structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig VQE config of the channel. -f_fEnableToneDisabler Whether the tone disabler is active or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckVqeConfig -UINT32 Oct6100ApiCheckVqeConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN BOOL f_fEnableToneDisabler ) -{ - tPOCT6100_API_IMAGE_INFO pImageInfo; - - pImageInfo = &f_pApiInstance->pSharedInfo->ImageInfo; - - if ( f_pVqeConfig->fEnableNlp != TRUE && f_pVqeConfig->fEnableNlp != FALSE ) - return cOCT6100_ERR_CHANNEL_ENABLE_NLP; - - if ( f_pVqeConfig->fEnableNlp == TRUE && pImageInfo->fNlpControl == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLP_CONTROL; - - - - /* Check the comfort noise mode.*/ - if ( f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_OFF && pImageInfo->fComfortNoise == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_BKG_NOISE_FREEZE; - - if ( f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_NORMAL && - f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_EXTENDED && - f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_FAST_LATCH && - f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_OFF ) - return cOCT6100_ERR_CHANNEL_COMFORT_NOISE_MODE; - - /* Check the DC offset removal.*/ - if ( f_pVqeConfig->fSinDcOffsetRemoval != TRUE && f_pVqeConfig->fSinDcOffsetRemoval != FALSE ) - return cOCT6100_ERR_CHANNEL_SIN_DC_OFFSET_REM; - - if ( f_pVqeConfig->fSinDcOffsetRemoval == TRUE && pImageInfo->fSinDcOffsetRemoval == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_DC_OFFSET_REM; - - if ( f_pVqeConfig->fRinDcOffsetRemoval != TRUE && f_pVqeConfig->fRinDcOffsetRemoval != FALSE ) - return cOCT6100_ERR_CHANNEL_RIN_DC_OFFSET_REM; - - if ( f_pVqeConfig->fRinDcOffsetRemoval == TRUE && pImageInfo->fRinDcOffsetRemoval == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_DC_OFFSET_REM; - - /* Check the Level control.*/ - if ( f_pVqeConfig->fRinLevelControl != TRUE && f_pVqeConfig->fRinLevelControl != FALSE ) - return cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL; - - if ( f_pVqeConfig->fSoutLevelControl != TRUE && f_pVqeConfig->fSoutLevelControl != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL; - - if ( ( f_pVqeConfig->lRinLevelControlGainDb < -24 ) || ( f_pVqeConfig->lRinLevelControlGainDb > 24 ) ) - return cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL_GAIN; - - if ( ( f_pVqeConfig->lSoutLevelControlGainDb < -24 ) || ( f_pVqeConfig->lSoutLevelControlGainDb > 24 ) ) - return cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL_GAIN; - - if ( ( f_pVqeConfig->fRinAutomaticLevelControl != TRUE ) && ( f_pVqeConfig->fRinAutomaticLevelControl != FALSE ) ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL; - - if ( ( f_pVqeConfig->fRinHighLevelCompensation != TRUE ) && ( f_pVqeConfig->fRinHighLevelCompensation != FALSE ) ) - return cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP; - - if ( ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) && ( pImageInfo->fRinAutoLevelControl == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_AUTO_LC; - - if ( ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) && ( pImageInfo->fRinHighLevelCompensation == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_HIGH_LEVEL_COMP; - - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - { - if ( f_pVqeConfig->fRinLevelControl == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_MANUAL; - - if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_HIGH_LEVEL_COMP; - - if ( ( f_pVqeConfig->lRinAutomaticLevelControlTargetDb < -40 || f_pVqeConfig->lRinAutomaticLevelControlTargetDb > 0 ) ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_TARGET; - } - - if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) - { - if ( f_pVqeConfig->fRinLevelControl == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_MANUAL; - - if ( ( f_pVqeConfig->lRinHighLevelCompensationThresholdDb < -40 || f_pVqeConfig->lRinHighLevelCompensationThresholdDb > 0 ) ) - return cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_THRESHOLD; - } - - if ( f_pVqeConfig->fSoutAutomaticLevelControl != TRUE && f_pVqeConfig->fSoutAutomaticLevelControl != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL; - - if ( ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) && ( pImageInfo->fSoutAutoLevelControl == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SOUT_AUTO_LC; - - if ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - { - if ( f_pVqeConfig->fSoutLevelControl == TRUE ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_MANUAL; - - if ( ( f_pVqeConfig->lSoutAutomaticLevelControlTargetDb < -40 || f_pVqeConfig->lSoutAutomaticLevelControlTargetDb > 0 ) ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_TARGET; - } - - if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction != TRUE && - f_pVqeConfig->fSoutAdaptiveNoiseReduction != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_ADAPT_NOISE_REDUCTION; - - if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction == TRUE && pImageInfo->fAdaptiveNoiseReduction == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR; - - if ( f_pVqeConfig->fSoutConferencingNoiseReduction != TRUE && - f_pVqeConfig->fSoutConferencingNoiseReduction != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_CONFERENCE_NOISE_REDUCTION; - - if ( f_pVqeConfig->fSoutConferencingNoiseReduction == TRUE && pImageInfo->fConferencingNoiseReduction == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_CNR; - - /* Validate Sout noise bleaching parameter. */ - if ( f_pVqeConfig->fSoutNoiseBleaching != TRUE && - f_pVqeConfig->fSoutNoiseBleaching != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING; - - /* Check if firmware supports Sout noise bleaching. */ - if ( f_pVqeConfig->fSoutNoiseBleaching == TRUE && pImageInfo->fSoutNoiseBleaching == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NOISE_BLEACHING; - - /* If Sout noise bleaching is requested, no ANR or CNR shall be activated. */ - if ( f_pVqeConfig->fSoutNoiseBleaching == TRUE ) - { - /* No xNR! */ - if ( ( f_pVqeConfig->fSoutConferencingNoiseReduction == TRUE ) - || ( f_pVqeConfig->fSoutAdaptiveNoiseReduction == TRUE ) ) - return cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING_NR; - } - - /* Cannot activate both ANR and CNR when noise bleaching is present */ - if ( pImageInfo->fSoutNoiseBleaching == TRUE ) - { - if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction == TRUE && - f_pVqeConfig->fSoutConferencingNoiseReduction == TRUE ) - return cOCT6100_ERR_CHANNEL_ANR_CNR_SIMULTANEOUSLY; - } - - /* Validate the DTMF tone removal parameter.*/ - if ( f_pVqeConfig->fDtmfToneRemoval != TRUE && f_pVqeConfig->fDtmfToneRemoval != FALSE ) - return cOCT6100_ERR_CHANNEL_TONE_REMOVAL; - - if ( f_pVqeConfig->fDtmfToneRemoval == TRUE && pImageInfo->fToneRemoval == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_REMOVAL; - - - - /* Check the Tail displacement enable.*/ - if ( f_pVqeConfig->fEnableTailDisplacement != TRUE && f_pVqeConfig->fEnableTailDisplacement != FALSE ) - return cOCT6100_ERR_CHANNEL_ENABLE_TAIL_DISPLACEMENT; - - if ( f_pVqeConfig->fEnableTailDisplacement == TRUE && pImageInfo->fTailDisplacement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_DISPLACEMENT; - - /* Check the Tail displacement value.*/ - if ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - { - if ( f_pVqeConfig->ulTailDisplacement != cOCT6100_AUTO_SELECT_TAIL ) - { - /* Check if this feature is supported by the image. */ - if ( pImageInfo->fPerChannelTailDisplacement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_PER_CHAN_TAIL; - - /* Check that this value is not greater then what the image supports. */ - if ( f_pVqeConfig->ulTailDisplacement > pImageInfo->usMaxTailDisplacement ) - return cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT_INVALID; - } - } - - /* Check the tail length value. */ - if ( f_pVqeConfig->ulTailLength != cOCT6100_AUTO_SELECT_TAIL ) - { - /* Check if this feature is supported by the image. */ - if ( ( pImageInfo->fPerChannelTailLength == FALSE ) - && ( (UINT16)( f_pVqeConfig->ulTailLength & 0xFFFF ) != pImageInfo->usMaxTailLength ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_LENGTH; - - if ( ( f_pVqeConfig->ulTailLength < 32 ) || ( f_pVqeConfig->ulTailLength > 128 ) - || ( ( f_pVqeConfig->ulTailLength % 4 ) != 0x0 ) ) - return cOCT6100_ERR_CHANNEL_TAIL_LENGTH; - - /* Check if the requested tail length is supported by the chip. */ - if ( f_pVqeConfig->ulTailLength > pImageInfo->usMaxTailLength ) - return cOCT6100_ERR_CHANNEL_TAIL_LENGTH_INVALID; - } - - /* Validate the acoustic echo cancellation parameter.*/ - if ( f_pVqeConfig->fAcousticEcho != TRUE && f_pVqeConfig->fAcousticEcho != FALSE ) - return cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO; - - if ( f_pVqeConfig->fAcousticEcho == TRUE && pImageInfo->fAcousticEcho == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO; - - if ( f_pVqeConfig->fAcousticEcho == TRUE ) - { - /* Check if acoustic echo tail length configuration is supported in the image. */ - if ( ( f_pVqeConfig->ulAecTailLength != 128 ) && ( pImageInfo->fAecTailLength == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH; - - /* Check the requested acoustic echo tail length. */ - if ( ( f_pVqeConfig->ulAecTailLength != 128 ) - && ( f_pVqeConfig->ulAecTailLength != 256 ) - && ( f_pVqeConfig->ulAecTailLength != 512 ) - && ( f_pVqeConfig->ulAecTailLength != 1024 ) ) - return cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH; - - if ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - { - UINT32 ulTailSum; - - /* Start with requested tail displacement. */ - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum = f_pApiInstance->pSharedInfo->ChipConfig.usTailDisplacement; - } - else - { - ulTailSum = f_pVqeConfig->ulTailDisplacement; - } - - /* Add requested tail length. */ - if ( f_pVqeConfig->ulTailLength == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum += f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailLength; - } - else - { - ulTailSum += f_pVqeConfig->ulTailLength; - } - - /* The tail sum must be smaller then the requested AEC tail length. */ - if ( ulTailSum > f_pVqeConfig->ulAecTailLength ) - return cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_SUM; - } - } - - /* Validate the Default ERL parameter.*/ - if ( f_pVqeConfig->lDefaultErlDb != -6 && pImageInfo->fDefaultErl == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DEFAULT_ERL; - - if ( ( f_pVqeConfig->lDefaultErlDb != 0 ) && - ( f_pVqeConfig->lDefaultErlDb != -3 ) && - ( f_pVqeConfig->lDefaultErlDb != -6 ) && - ( f_pVqeConfig->lDefaultErlDb != -9 ) && - ( f_pVqeConfig->lDefaultErlDb != -12 ) ) - return cOCT6100_ERR_CHANNEL_DEFAULT_ERL; - - /* Validate the Default AEC ERL parameter.*/ - if ( f_pVqeConfig->lAecDefaultErlDb != 0 && pImageInfo->fAecDefaultErl == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_AEC_DEFAULT_ERL; - - if ( f_pVqeConfig->lAecDefaultErlDb != 0 && f_pVqeConfig->lAecDefaultErlDb != -3 && f_pVqeConfig->lAecDefaultErlDb != -6 ) - return cOCT6100_ERR_CHANNEL_AEC_DEFAULT_ERL; - - /* Validate the non-linearity A parameter.*/ - if ( f_pVqeConfig->ulNonLinearityBehaviorA != 1 && pImageInfo->fNonLinearityBehaviorA == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DOUBLE_TALK; - - if ( f_pVqeConfig->ulNonLinearityBehaviorA >= 14 ) - return cOCT6100_ERR_CHANNEL_DOUBLE_TALK; - - /* Validate the non-linearity B parameter.*/ - if ( f_pVqeConfig->ulNonLinearityBehaviorB != 0 && pImageInfo->fNonLinearityBehaviorB == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NON_LINEARITY_B; - - if ( f_pVqeConfig->ulNonLinearityBehaviorB >= 9 ) - return cOCT6100_ERR_CHANNEL_NON_LINEARITY_B; - - /* Check if configuring the double talk behavior is supported in the firmware. */ - if ( f_pVqeConfig->ulDoubleTalkBehavior != cOCT6100_DOUBLE_TALK_BEH_NORMAL && pImageInfo->fDoubleTalkBehavior == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_DOUBLE_TALK_BEHAVIOR_MODE; - - /* Validate the double talk behavior mode parameter. */ - if ( f_pVqeConfig->ulDoubleTalkBehavior != cOCT6100_DOUBLE_TALK_BEH_NORMAL && f_pVqeConfig->ulDoubleTalkBehavior != cOCT6100_DOUBLE_TALK_BEH_LESS_AGGRESSIVE ) - return cOCT6100_ERR_CHANNEL_DOUBLE_TALK_MODE; - - /* Validate the Sout automatic listener enhancement ratio. */ - if ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0 && pImageInfo->fListenerEnhancement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ALE; - - if ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb > 30 ) - return cOCT6100_ERR_CHANNEL_ALE_RATIO; - - /* Validate the Sout natural listener enhancement ratio. */ - if ( f_pVqeConfig->fSoutNaturalListenerEnhancement != TRUE && f_pVqeConfig->fSoutNaturalListenerEnhancement != FALSE ) - return cOCT6100_ERR_CHANNEL_NLE_FLAG; - - if ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE && pImageInfo->fListenerEnhancement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLE; - - if ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) - { - if ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb > 30 ) - return cOCT6100_ERR_CHANNEL_NLE_RATIO; - } - - /* Both ALE and NLE cannot be activated simultaneously. */ - if ( ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0 ) - && ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) ) - return cOCT6100_ERR_CHANNEL_ALE_NLE_SIMULTANEOUSLY; - - /* Validate Rout noise reduction. */ - if ( f_pVqeConfig->fRoutNoiseReduction != TRUE && f_pVqeConfig->fRoutNoiseReduction != FALSE ) - return cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION; - - /* Check if Rout noise reduction is supported. */ - if ( f_pVqeConfig->fRoutNoiseReduction == TRUE && pImageInfo->fRoutNoiseReduction == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NR; - - /*Check if noise reduction level gain is supported*/ - if ( ( pImageInfo->fRoutNoiseReductionLevel == FALSE ) && ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; - - if ( ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != 0 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -6 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -12 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) - - return cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; - - /* Check if ANR SNRE is supported. */ - if ( ( f_pVqeConfig->lAnrSnrEnhancementDb != -18 ) && ( pImageInfo->fAnrSnrEnhancement == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SNR_ENHANCEMENT; - - /* Validate Sout ANR SNR enhancement. */ - if ( ( f_pVqeConfig->lAnrSnrEnhancementDb != -9 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -12 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -15 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -18 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -21 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -24 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -27 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -30 ) ) - return cOCT6100_ERR_CHANNEL_ANR_SNR_ENHANCEMENT; - - /* Validate ANR voice-noise segregation. */ - if ( f_pVqeConfig->ulAnrVoiceNoiseSegregation > 15 ) - return cOCT6100_ERR_CHANNEL_ANR_SEGREGATION; - - /* Check if ANR VN segregation is supported. */ - if ( ( f_pVqeConfig->ulAnrVoiceNoiseSegregation != 6 ) && ( pImageInfo->fAnrVoiceNoiseSegregation == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SEGREGATION; - - /* Check if the loaded image supports tone disabler VQE activation delay. */ - if ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay != 300 ) - && ( pImageInfo->fToneDisablerVqeActivationDelay == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY; - - /* Check if the specified tone disabler VQE activation delay is correct. */ - if ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay < 300 ) - || ( ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay - 300 ) % 512 ) != 0 ) ) - return cOCT6100_ERR_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY; - - /* Check the enable music protection flag. */ - if ( ( f_pVqeConfig->fEnableMusicProtection != TRUE ) && ( f_pVqeConfig->fEnableMusicProtection != FALSE ) ) - return cOCT6100_ERR_CHANNEL_ENABLE_MUSIC_PROTECTION; - - /* The music protection module can only be activated if the image supports it. */ - if ( ( f_pVqeConfig->fEnableMusicProtection == TRUE ) && - ( pImageInfo->fMusicProtection == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_MUSIC_PROTECTION; - - /* Check the enable idle code detection flag. */ - if ( ( f_pVqeConfig->fIdleCodeDetection != TRUE ) && ( f_pVqeConfig->fIdleCodeDetection != FALSE ) ) - return cOCT6100_ERR_CHANNEL_IDLE_CODE_DETECTION; - - /* The idle code detection module can only be activated if the image supports it. */ - if ( ( f_pVqeConfig->fIdleCodeDetection == TRUE ) && ( pImageInfo->fIdleCodeDetection == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION; - - /* The idle code detection module can be disabled only if idle code detection configuration */ - /* is supported in the image. */ - if ( pImageInfo->fIdleCodeDetection == TRUE ) - { - if ( ( f_pVqeConfig->fIdleCodeDetection == FALSE ) && ( pImageInfo->fIdleCodeDetectionConfiguration == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION_CONFIG; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckCodecConfig - -Description: This function will check the validity of the Codec config parameter - of an Open Codec config structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCodecConfig Codec config of the channel. -f_ulDecoderNumTssts Number of TSST for the decoder. -f_pusPhasingTsstIndex Pointer to the Phasing TSST index within the API's phasing TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckCodecConfig -UINT32 Oct6100ApiCheckCodecConfig( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_CODEC f_pCodecConfig, - IN UINT32 f_ulDecoderNumTssts, - OUT PUINT16 f_pusPhasingTsstIndex ) -{ - - /* Verify the ADPCM nibble value.*/ - if ( f_pCodecConfig->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_LOW_BITS && - f_pCodecConfig->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_HIGH_BITS ) - return cOCT6100_ERR_CHANNEL_ADPCM_NIBBLE; - - /* Verify the Encoder port.*/ - if ( f_pCodecConfig->ulEncoderPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pCodecConfig->ulEncoderPort != cOCT6100_CHANNEL_PORT_SOUT && - f_pCodecConfig->ulEncoderPort != cOCT6100_NO_ENCODING ) - return cOCT6100_ERR_CHANNEL_ENCODER_PORT; - - /* Verify the Decoder port.*/ - if ( f_pCodecConfig->ulDecoderPort != cOCT6100_CHANNEL_PORT_RIN && - f_pCodecConfig->ulDecoderPort != cOCT6100_CHANNEL_PORT_SIN && - f_pCodecConfig->ulDecoderPort != cOCT6100_NO_DECODING ) - return cOCT6100_ERR_CHANNEL_DECODER_PORT; - - /* The codec cannot be on the same stream.*/ - if ( f_pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT && - f_pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CHANNEL_INVALID_CODEC_POSITION; - - if ( f_pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT && - f_pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN ) - return cOCT6100_ERR_CHANNEL_INVALID_CODEC_POSITION; - - /* Verify if the requested functions are supported by the chip.*/ - if ( f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm == FALSE && - f_pCodecConfig->ulEncoderPort != cOCT6100_NO_ENCODING ) - { - if ( f_pCodecConfig->ulEncodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ENCODING; - } - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm == FALSE && - f_pCodecConfig->ulDecoderPort != cOCT6100_NO_DECODING ) - { - if ( f_pCodecConfig->ulDecodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DECODING; - } - - /* Check if encoder port has been specified when a rate has been set. */ - if ( f_pCodecConfig->ulEncoderPort == cOCT6100_NO_ENCODING && - f_pCodecConfig->ulEncodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_ENCODER_PORT; - - /* Check if decoder port has been specified when a rate has been set. */ - if ( f_pCodecConfig->ulDecoderPort == cOCT6100_NO_DECODING && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_DECODER_PORT; - - /* Check Encoder related parameter if one is used.*/ - if ( f_pCodecConfig->ulEncoderPort != cOCT6100_NO_ENCODING ) - { - /* Check the Encoder compression rate.*/ - if ( ( f_pCodecConfig->ulEncodingRate != cOCT6100_G711_64KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_40KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_32KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_24KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_16KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_40KBPS_4_1 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_40KBPS_3_2 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_40KBPS_2_3 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_32KBPS_4_0 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_32KBPS_3_1 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_32KBPS_2_2 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_24KBPS_3_0 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_24KBPS_2_1 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_16KBPS_2_0 ) ) - return cOCT6100_ERR_CHANNEL_ENCODING_RATE; - - /* Verify phasing information.*/ - if ( f_pCodecConfig->ulPhasingType != cOCT6100_SINGLE_PHASING && - f_pCodecConfig->ulPhasingType != cOCT6100_DUAL_PHASING && - f_pCodecConfig->ulPhasingType != cOCT6100_NO_PHASING ) - return cOCT6100_ERR_CHANNEL_PHASING_TYPE; - - /* Verify the silence suppression parameters.*/ - if ( f_pCodecConfig->fEnableSilenceSuppression != TRUE && - f_pCodecConfig->fEnableSilenceSuppression != FALSE ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_ENABLE; - - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pApiInstance->pSharedInfo->ImageInfo.fSilenceSuppression == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIL_SUP; - - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pCodecConfig->ulPhasingType == cOCT6100_NO_PHASING ) - return cOCT6100_ERR_CHANNEL_PHASE_TYPE_REQUIRED; - - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pCodecConfig->ulPhasingTsstHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CHANNEL_PHASING_TSST_REQUIRED; - - if ( f_pCodecConfig->ulPhasingTsstHndl == cOCT6100_INVALID_HANDLE && - f_pCodecConfig->ulPhasingType != cOCT6100_NO_PHASING ) - return cOCT6100_ERR_CHANNEL_PHASING_TSST_REQUIRED; - - /* Silence suppression can only be performed if the encoder is using the SOUT port.*/ - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pCodecConfig->ulEncoderPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_INVALID_ENCODER_PORT; - - /* Check phasing TSST info if phasing is required.*/ - if ( f_pCodecConfig->ulPhasingTsstHndl != cOCT6100_INVALID_HANDLE ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - UINT32 ulEntryOpenCnt; - - /* Check the provided handle. */ - if ( (f_pCodecConfig->ulPhasingTsstHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_PHASING_TSST ) - return cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE; - - *f_pusPhasingTsstIndex = (UINT16)( f_pCodecConfig->ulPhasingTsstHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusPhasingTsstIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPhasingTssts ) - return cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, *f_pusPhasingTsstIndex ); - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pCodecConfig->ulPhasingTsstHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Verify if the state of the phasing TSST.*/ - if ( pPhasingEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_PHASING_TSST_NOT_OPEN; - if ( ulEntryOpenCnt != pPhasingEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE; - - /* Check the specified phase value against the phasing length of the phasing TSST.*/ - if ( ( f_pCodecConfig->ulPhase == 0 ) - || ( f_pCodecConfig->ulPhase >= pPhasingEntry->usPhasingLength ) ) - return cOCT6100_ERR_CHANNEL_PHASING_INVALID_PHASE; - } - else - { - *f_pusPhasingTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusPhasingTsstIndex = cOCT6100_INVALID_INDEX; - } - - - /* Check Decoder related parameter if one is used.*/ - if ( f_pCodecConfig->ulDecoderPort != cOCT6100_NO_DECODING ) - { - /* Check the Decoding rate.*/ - if ( f_pCodecConfig->ulDecodingRate != cOCT6100_G711_64KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_40KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_32KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_24KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_16KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G726_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G727_2C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G727_3C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G727_4C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G727_2C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G727_3C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G727_4C_ENCODED ) - return cOCT6100_ERR_CHANNEL_DECODING_RATE; - - /* Make sure that two timeslot are allocated if PCM-ECHO encoded is selected.*/ - if ( (f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G726_ENCODED || - f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G727_2C_ENCODED || - f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G727_3C_ENCODED || - f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G727_4C_ENCODED ) && - f_ulDecoderNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_MISSING_TSST; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteInputTsstControlMemory - -Description: This function configure a TSST control memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usTsstIndex TSST index within the TSST control memory. -f_usTsiMemIndex TSI index within the TSI chariot memory. -f_ulTsstInputLaw PCM law of the input TSST. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteInputTsstControlMemory -UINT32 Oct6100ApiWriteInputTsstControlMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulTsstInputLaw ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_INPUT_TSST; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - /* Set the PCM law.*/ - WriteParams.usWriteData |= f_ulTsstInputLaw << cOCT6100_TSST_CONTROL_MEM_PCM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteOutputTsstControlMemory - -Description: This function configure a TSST control memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteOutputTsstControlMemory -UINT32 Oct6100ApiWriteOutputTsstControlMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT32 f_ulNumTssts, - IN UINT16 f_usTsiMemIndex ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_OUTPUT_TSST; - WriteParams.usWriteData |= f_ulAdpcmNibblePosition << cOCT6100_TSST_CONTROL_MEM_NIBBLE_POS_OFFSET; - WriteParams.usWriteData |= (f_ulNumTssts - 1) << cOCT6100_TSST_CONTROL_MEM_TSST_NUM_OFFSET; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteEncoderMemory - -Description: This function configure a Encoded memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulEncoderIndex Index of the encoder block within the ADPCM context memory. -f_ulCompType Compression rate of the encoder. -f_usTsiMemIndex TSI index within the TSI chariot memory used by the encoder. -f_ulEnableSilenceSuppression Silence suppression enable flag. -f_ulAdpcmNibblePosition ADPCM nibble position. -f_usPhasingTsstIndex Phasing TSST index within the API's Phassing TSST list. -f_ulPhasingType Type of the Phasing TSST. -f_ulPhase Phase used with this encoder. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteEncoderMemory -UINT32 Oct6100ApiWriteEncoderMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulEncoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulEnableSilenceSuppression, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT16 f_usPhasingTsstIndex, - IN UINT32 f_ulPhasingType, - IN UINT32 f_ulPhase ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*==============================================================================*/ - /* Conversion Control Base */ - WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_MEM_BASE + ( f_ulEncoderIndex * cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_ENCODER; - WriteParams.usWriteData |= f_ulCompType << cOCT6100_CONVERSION_CONTROL_MEM_COMP_OFFSET; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 2 */ - WriteParams.ulWriteAddress += 2; - - /* Set the phasing TSST number.*/ - if ( f_usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - WriteParams.usWriteData = (UINT16)( f_usPhasingTsstIndex << cOCT6100_CONVERSION_CONTROL_MEM_PHASE_OFFSET ); - else - WriteParams.usWriteData = 0; - - /* Set the phasing type and the phase value if required.*/ - switch( f_ulPhasingType ) - { - case cOCT6100_NO_PHASING: - WriteParams.usWriteData |= 0x1 << 10; - break; - case cOCT6100_SINGLE_PHASING: - WriteParams.usWriteData |= f_ulPhase; - break; - case cOCT6100_DUAL_PHASING: - WriteParams.usWriteData |= 0x1 << 11; - WriteParams.usWriteData |= f_ulPhase; - break; - default: - /* No problem. */ - break; - } - - /* Set the silence suppression flag.*/ - WriteParams.usWriteData |= f_ulEnableSilenceSuppression << cOCT6100_CONVERSION_CONTROL_MEM_SIL_SUP_OFFSET; - - /* Set the nibble position.*/ - WriteParams.usWriteData |= f_ulAdpcmNibblePosition << cOCT6100_CONVERSION_CONTROL_MEM_NIBBLE_POS_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 4 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_RST_ON_NEXT_FR; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 6 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_ACTIVATE_ENTRY; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteDecoderMemory - -Description: This function configure a Decoder memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usDecoderIndex Index of the decoder block within the ADPCM context memory. -f_ulCompType Decompression rate of the decoder. -f_usTsiMemIndex TSI index within the TSI chariot memory. -f_ulPcmLaw PCM law of the decoded samples. -f_ulAdpcmNibblePosition ADPCM nibble position. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteDecoderMemory -UINT32 Oct6100ApiWriteDecoderMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usDecoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulPcmLaw, - IN UINT32 f_ulAdpcmNibblePosition ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - - /*==============================================================================*/ - /* Conversion Control Base */ - WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_MEM_BASE + ( f_usDecoderIndex * cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_DECODER; - WriteParams.usWriteData |= f_ulCompType << cOCT6100_CONVERSION_CONTROL_MEM_COMP_OFFSET; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 2 */ - WriteParams.ulWriteAddress += 2; - - /* Set the nibble position.*/ - WriteParams.usWriteData = (UINT16)( f_ulAdpcmNibblePosition << cOCT6100_CONVERSION_CONTROL_MEM_NIBBLE_POS_OFFSET ); - - /* Set the law.*/ - WriteParams.usWriteData |= f_ulPcmLaw << cOCT6100_CONVERSION_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 4 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_RST_ON_NEXT_FR; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 6 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_ACTIVATE_ENTRY; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearConversionMemory - -Description: This function clears a conversion memory entry in internal - memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usConversionMemIndex Index of the block within the conversion memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiClearConversionMemory -UINT32 Oct6100ApiClearConversionMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 ulBaseAddress; - UINT16 usReadData; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - WriteParams.usWriteData = 0; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*==============================================================================*/ - /* Clear the entry */ - ulBaseAddress = cOCT6100_CONVERSION_CONTROL_MEM_BASE + ( f_usConversionMemIndex * cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE ); - /* The "activate" bit at offset +6 must be cleared first. */ - WriteParams.ulWriteAddress = ulBaseAddress + 6; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read at 0x200 to make sure there is no corruption on channel 0. */ - ReadParams.ulReadAddress = 0x200; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Then clear the rest of the structure. */ - WriteParams.ulWriteAddress = ulBaseAddress + 4; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ulBaseAddress + 2; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ulBaseAddress; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteVqeMemory - -Description: This function configure an echo memory entry in internal memory and - external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig Pointer to a VQE config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearPlayoutPointers Flag indicating if the playout pointer should be cleared. -f_fModifyOnly Flag indicating if the configuration should be - modified only. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteVqeMemory -UINT32 Oct6100ApiWriteVqeMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ) -{ - UINT32 ulResult; - - /* Write the NLP software configuration structure. */ - ulResult = Oct6100ApiWriteVqeNlpMemory( - f_pApiInstance, - f_pVqeConfig, - f_pChannelOpen, - f_usChanIndex, - f_usEchoMemIndex, - f_fClearPlayoutPointers, - f_fModifyOnly ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the AF software configuration structure. */ - ulResult = Oct6100ApiWriteVqeAfMemory( - f_pApiInstance, - f_pVqeConfig, - f_pChannelOpen, - f_usChanIndex, - f_usEchoMemIndex, - f_fClearPlayoutPointers, - f_fModifyOnly ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteVqeNlpMemory - -Description: This function configures the NLP related VQE features of an - echo channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig Pointer to a VQE config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearPlayoutPointers Flag indicating if the playout pointer should be cleared. -f_fModifyOnly Flag indicating if the configuration should be - modified only. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteVqeNlpMemory -UINT32 Oct6100ApiWriteVqeNlpMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulNlpConfigBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT16 usTempData; - BOOL fEchoOperationModeChanged; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /*==============================================================================*/ - /* Configure the CPU NLP configuration of the channel feature by feature.*/ - - ulNlpConfigBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Set initial value to zero.*/ - ulTempData = 0; - - /* Configure Adaptive Noise Reduction.*/ - if ( pSharedInfo->ImageInfo.fAdaptiveNoiseReduction == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->fSoutAdaptiveNoiseReduction != pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction ) - || ( f_pVqeConfig->fSoutNoiseBleaching != pChanEntry->VqeConfig.fSoutNoiseBleaching ) - ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set adaptive noise reduction on the SOUT port.*/ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fSoutAdaptiveNoiseReduction ) << ulFeatureBitOffset ); - - /* If SOUT noise bleaching is requested, ANR must be activated. */ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fSoutNoiseBleaching ) << ulFeatureBitOffset ); - - /* First read the DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure Rout Noise Reduction. */ - if ( pSharedInfo->ImageInfo.fRoutNoiseReduction == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fRoutNoiseReduction != pChanEntry->VqeConfig.fRoutNoiseReduction ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAnrOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAnrOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinAnrOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set noise reduction on the Rout port. */ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fRoutNoiseReduction ) << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - if (pSharedInfo->ImageInfo.fRoutNoiseReductionLevel == TRUE) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( (f_pVqeConfig->lRoutNoiseReductionLevelGainDb != pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb ) - ||( f_pVqeConfig->fRoutNoiseReduction != pChanEntry->VqeConfig.fRoutNoiseReduction ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAnrValOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAnrValOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinAnrValOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if (f_pVqeConfig->fRoutNoiseReduction == TRUE) - { - switch( f_pVqeConfig->lRoutNoiseReductionLevelGainDb) - { - case 0: ulTempData |= ( 0 << ulFeatureBitOffset ); - break; - case -6: ulTempData |= ( 1 << ulFeatureBitOffset ); - break; - case -12: ulTempData |= ( 2 << ulFeatureBitOffset ); - break; - case -18: ulTempData |= ( 3 << ulFeatureBitOffset ); - break; - default: ulTempData |= ( 0 << ulFeatureBitOffset ); - break; - } - } - else - ulTempData |= ( 0 << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - } - - /* Configure Sout ANR SNR enhancement. */ - if ( pSharedInfo->ImageInfo.fAnrSnrEnhancement == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != pChanEntry->VqeConfig.chAnrSnrEnhancementDb ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AnrSnrEnhancementOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AnrSnrEnhancementOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AnrSnrEnhancementOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set ANR SNR enhancement on the Sout port. */ - switch( f_pVqeConfig->lAnrSnrEnhancementDb ) - { - case -9: ulTempData |= ( 7 << ulFeatureBitOffset ); - break; - case -12: ulTempData |= ( 6 << ulFeatureBitOffset ); - break; - case -15: ulTempData |= ( 5 << ulFeatureBitOffset ); - break; - case -21: ulTempData |= ( 3 << ulFeatureBitOffset ); - break; - case -24: ulTempData |= ( 2 << ulFeatureBitOffset ); - break; - case -27: ulTempData |= ( 1 << ulFeatureBitOffset ); - break; - case -30: ulTempData |= ( 0 << ulFeatureBitOffset ); - break; - default: ulTempData |= ( 4 << ulFeatureBitOffset ); - /* -18 */ - break; - } - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure Sout ANR voice-noise segregation. */ - if ( pSharedInfo->ImageInfo.fAnrVoiceNoiseSegregation == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulAnrVoiceNoiseSegregation != pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set ANR voice-noise segregation on the Sout port. */ - ulTempData |= ( ( (UINT32)f_pVqeConfig->ulAnrVoiceNoiseSegregation ) << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure the tone disabler VQE activation delay. */ - if ( pSharedInfo->ImageInfo.fToneDisablerVqeActivationDelay == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay != pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay ) - || ( f_pChannelOpen->fEnableToneDisabler != pChanEntry->fEnableToneDisabler ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set the tone disabler VQE activation delay. The VQE activation delay */ - /* is only set if the tone disabler is activated. */ - if ( f_pChannelOpen->fEnableToneDisabler == TRUE ) - ulTempData |= ( ( (UINT32)( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay - 300 ) / 512 ) ) << ulFeatureBitOffset ); - else - ulTempData |= ( 0 ) << ulFeatureBitOffset; - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure Conferencing Noise Reduction.*/ - if ( pSharedInfo->ImageInfo.fConferencingNoiseReduction == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->fSoutConferencingNoiseReduction != pChanEntry->VqeConfig.fSoutConferencingNoiseReduction ) - || ( f_pVqeConfig->fSoutNoiseBleaching != pChanEntry->VqeConfig.fSoutNoiseBleaching ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set conferencing noise reduction on the SOUT port. */ - ulTempData |= (f_pVqeConfig->fSoutConferencingNoiseReduction << ulFeatureBitOffset ); - - /* If SOUT noise bleaching is requested, CNR must be activated. */ - ulTempData |= (f_pVqeConfig->fSoutNoiseBleaching << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the DC removal on RIN ports.*/ - if ( pSharedInfo->ImageInfo.fRinDcOffsetRemoval == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fRinDcOffsetRemoval != pChanEntry->VqeConfig.fRinDcOffsetRemoval ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set adaptive noise reduction on the SOUT port.*/ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fRinDcOffsetRemoval ) << ulFeatureBitOffset ); - - /* The write the new DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the DC removal on SIN ports.*/ - if ( pSharedInfo->ImageInfo.fSinDcOffsetRemoval == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fSinDcOffsetRemoval != pChanEntry->VqeConfig.fSinDcOffsetRemoval ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set adaptive noise reduction on the SOUT port.*/ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fSinDcOffsetRemoval ) << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the level control. */ - if ( ( pChanEntry->byEchoOperationMode != f_pChannelOpen->ulEchoOperationMode ) - && ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NORMAL ) ) - fEchoOperationModeChanged = TRUE; - else - fEchoOperationModeChanged = FALSE; - - /* If opening the channel, all level control configuration must be written. */ - if ( f_fModifyOnly == FALSE ) - fEchoOperationModeChanged = TRUE; - ulResult = Oct6100ApiSetChannelLevelControl( f_pApiInstance, - f_pVqeConfig, - f_usChanIndex, - f_usEchoMemIndex, - fEchoOperationModeChanged ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the background noise freeze.*/ - if ( pSharedInfo->ImageInfo.fComfortNoise == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulComfortNoiseMode != pChanEntry->VqeConfig.byComfortNoiseMode ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ComfortNoiseModeOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ComfortNoiseModeOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ComfortNoiseModeOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( f_pVqeConfig->ulComfortNoiseMode << ulFeatureBitOffset ); - - /* Save the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the state of the NLP */ - if ( pSharedInfo->ImageInfo.fNlpControl == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fEnableNlp != pChanEntry->VqeConfig.fEnableNlp ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.NlpControlFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.NlpControlFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.NlpControlFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fEnableNlp == FALSE ) - ulTempData |= 0x1 << ulFeatureBitOffset; - - /* Save the new DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the tail configuration. */ - ulResult = Oct6100ApiSetChannelTailConfiguration( - f_pApiInstance, - f_pVqeConfig, - f_usChanIndex, - f_usEchoMemIndex, - f_fModifyOnly ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the Default ERL. */ - if ( ( pSharedInfo->ImageInfo.fDefaultErl == TRUE ) && ( f_pVqeConfig->fAcousticEcho == FALSE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->lDefaultErlDb != pChanEntry->VqeConfig.chDefaultErlDb ) - || ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.DefaultErlFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.DefaultErlFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.DefaultErlFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Convert the DB value to octasic's float format. (In energy) */ - if ( ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lDefaultErlDb ); - } - else - { - /* Clear the defautl ERL when using the no echo cancellation operation mode. */ - usTempData = 0x0; - } - - if ( ulFeatureFieldLength < 16 ) - usTempData = (UINT16)( usTempData >> ( 16 - ulFeatureFieldLength ) ); - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - - /* Save the new DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the Acoustic echo control.*/ - if ( pSharedInfo->ImageInfo.fAcousticEcho == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AecFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AecFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AecFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( (UINT32)f_pVqeConfig->fAcousticEcho ) << ulFeatureBitOffset ); - - /* Then save the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the Acoustic Echo Default ERL. */ - if ( ( pSharedInfo->ImageInfo.fAecDefaultErl == TRUE ) && ( f_pVqeConfig->fAcousticEcho == TRUE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->lAecDefaultErlDb != pChanEntry->VqeConfig.chAecDefaultErlDb ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AecDefaultErlFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AecDefaultErlFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AecDefaultErlFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - /* Convert the DB value to octasic's float format. (In energy) */ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lAecDefaultErlDb ); - } - else - { - /* Clear the AEC defautl ERL when using the no echo cancellation operation mode. */ - usTempData = 0x0; - } - - if ( ulFeatureFieldLength < 16 ) - usTempData = (UINT16)( usTempData >> ( 16 - ulFeatureFieldLength ) ); - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the DTMF tone removal bit.*/ - if ( pSharedInfo->ImageInfo.fToneRemoval == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fDtmfToneRemoval != pChanEntry->VqeConfig.fDtmfToneRemoval ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ToneRemovalFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ToneRemovalFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ToneRemovalFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( (UINT32)f_pVqeConfig->fDtmfToneRemoval ) << ulFeatureBitOffset ); - - /* First read the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - - - /* Set the non-linear behavior A.*/ - if ( pSharedInfo->ImageInfo.fNonLinearityBehaviorA == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulNonLinearityBehaviorA != pChanEntry->VqeConfig.byNonLinearityBehaviorA ) - || ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) ) - { - UINT16 ausLookupTable[ 14 ] = { 0x3663, 0x3906, 0x399C, 0x3A47, 0x3B06, 0x3B99, 0x3C47, 0x3D02, 0x3D99, 0x3E47, 0x3F00, 0x3F99, 0x4042, 0x4100 }; - - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PcmLeakFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PcmLeakFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PcmLeakFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /*If we support ANR level the TLV is shared over 2 bits*/ - if (ulFeatureBitOffset == 18) - { - ulFeatureBitOffset -= 2; - ausLookupTable[ f_pVqeConfig->ulNonLinearityBehaviorA ] &= 0xFFFC; - } - - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - || ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - else - ulTempData |= ( ausLookupTable[ f_pVqeConfig->ulNonLinearityBehaviorA ] << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Synch all the buffer playout field.*/ - if ( pSharedInfo->ImageInfo.fBufferPlayout == TRUE && f_fClearPlayoutPointers == TRUE ) - { - Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); - - BufferPlayoutStop.ulChannelHndl = cOCT6100_INVALID_HANDLE; - BufferPlayoutStop.fStopCleanly = TRUE; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - f_usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - f_usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - /* Write the 2100 Hz Echo Disabling mode */ - - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pChannelOpen->fEnableToneDisabler != pChanEntry->fEnableToneDisabler ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ToneDisablerControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ToneDisablerControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ToneDisablerControlOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* This is a disable bit, so it must be set only if the enable flag is set to false. */ - if ( f_pChannelOpen->fEnableToneDisabler == FALSE ) - ulTempData |= 0x1 << ulFeatureBitOffset; - - /* Save the DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Write the Nlp Trivial enable flag. */ - - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( - - ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.NlpTrivialFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.NlpTrivialFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.NlpTrivialFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - || ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - ulTempData |= TRUE << ulFeatureBitOffset; - } - - - /* Then write the DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the double talk behavior mode. */ - if ( pSharedInfo->ImageInfo.fDoubleTalkBehaviorFieldOfst == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulDoubleTalkBehavior != pChanEntry->VqeConfig.byDoubleTalkBehavior ) ) ) - { - /* The field is located in the CPURO structure. */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= (f_pVqeConfig->ulDoubleTalkBehavior << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the music protection enable. */ - if ( ( pSharedInfo->ImageInfo.fMusicProtection == TRUE ) - && ( pSharedInfo->ImageInfo.fMusicProtectionConfiguration == TRUE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fEnableMusicProtection != pChanEntry->VqeConfig.fEnableMusicProtection ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.MusicProtectionFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.MusicProtectionFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.MusicProtectionFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( f_pVqeConfig->fEnableMusicProtection == TRUE ) - ulTempData |= ( 1 << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteVqeAfMemory - -Description: This function configures the AF related VQE features of an - echo channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig Pointer to a VQE config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearPlayoutPointers Flag indicating if the playout pointer should be cleared. -f_fModifyOnly Flag indicating if the configuration should be - modified only. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteVqeAfMemory -UINT32 Oct6100ApiWriteVqeAfMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulAfConfigBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT16 usTempData; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /*==============================================================================*/ - /* Write the AF CPU configuration of the channel feature by feature.*/ - - /* Calculate AF CPU configuration base address. */ - ulAfConfigBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - /* Set initial value to zero.*/ - ulTempData = 0; - - /*==============================================================================*/ - /* Program the Maximum echo point within the Main channel memory.*/ - if ( pSharedInfo->ImageInfo.fMaxEchoPoint == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->lDefaultErlDb != pChanEntry->VqeConfig.chDefaultErlDb ) - || ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) ) - { - /* Write the echo tail length */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Convert the DB value to octasic's float format.*/ - if ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - { - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lDefaultErlDb ); - } - else - { - /* Clear max echo point. No echo cancellation here. */ - usTempData = 0x0; - } - - if ( ulFeatureFieldLength < 16 ) - usTempData = (UINT16)( usTempData >> ( 16 - ulFeatureFieldLength ) ); - - ulTempData |= usTempData << ulFeatureBitOffset; - - /* First read the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the non-linear behavior B.*/ - if ( pSharedInfo->ImageInfo.fNonLinearityBehaviorB == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulNonLinearityBehaviorB != pChanEntry->VqeConfig.byNonLinearityBehaviorB ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.NlpConvCapFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.NlpConvCapFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.NlpConvCapFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= (f_pVqeConfig->ulNonLinearityBehaviorB << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the listener enhancement feature. */ - if ( pSharedInfo->ImageInfo.fListenerEnhancement == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement != pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement ) - || ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AdaptiveAleOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AdaptiveAleOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AdaptiveAleOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0 ) - { - UINT32 ulGainDb; - - ulGainDb = f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb / 3; - - /* Round up. */ - if ( ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb % 3 ) != 0x0 ) - ulGainDb ++; - - ulTempData |= ( ulGainDb << ulFeatureBitOffset ); - } - else if ( f_pVqeConfig->fSoutNaturalListenerEnhancement != 0 ) - { - UINT32 ulGainDb; - - ulGainDb = f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb / 3; - - /* Round up. */ - if ( ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb % 3 ) != 0x0 ) - ulGainDb ++; - - ulTempData |= ( ( 0x80 | ulGainDb ) << ulFeatureBitOffset ); - } - - /* Now write the DWORD where the field is located containing the new configuration. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the idle code detection enable. */ - if ( ( pSharedInfo->ImageInfo.fIdleCodeDetection == TRUE ) - && ( pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration == TRUE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fIdleCodeDetection != pChanEntry->VqeConfig.fIdleCodeDetection ) ) ) - { - /* Calculate base address in the AF software configuration. */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( f_pVqeConfig->fIdleCodeDetection == FALSE ) - ulTempData |= ( 1 << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the AFT control field. */ - if ( pSharedInfo->ImageInfo.fAftControl == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AftControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AftControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AftControlOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* If the operation mode is no echo, set the field such that echo cancellation is disabled. */ - if ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - { - ulTempData |= ( 0x1234 << ulFeatureBitOffset ); - } - else if ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - { - /* For clarity. */ - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - } - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteEchoMemory - -Description: This function configure an echo memory entry in internal memory.and - external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTdmConfig Pointer to a TDM config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usEchoIndex Echo channel index within the SSPX memory. -f_usRinRoutTsiIndex RIN/ROUT TSI index within the TSI chariot memory -f_usSinSoutTsiIndex SIN/SOUT TSI index within the TSI chariot memory - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteEchoMemory -UINT32 Oct6100ApiWriteEchoMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ) - -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulRinPcmLaw; - UINT32 ulRoutPcmLaw; - UINT32 ulSinPcmLaw; - UINT32 ulSoutPcmLaw; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Set immediately the PCM law to be programmed in the SSPX and NLP memory.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - ulRinPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; - ulRoutPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; - ulSinPcmLaw = f_pChannelOpen->TdmConfig.ulSinPcmLaw; - ulSoutPcmLaw = f_pChannelOpen->TdmConfig.ulSinPcmLaw; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - ulRinPcmLaw = f_pChannelOpen->TdmConfig.ulRinPcmLaw; - ulRoutPcmLaw = f_pChannelOpen->TdmConfig.ulRinPcmLaw; - ulSinPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; - ulSoutPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; - } - - /*==============================================================================*/ - /* Configure the Global Static Configuration of the channel.*/ - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET; - - /* Set the PGSP context base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + cOCT6100_CH_MAIN_PGSP_CONTEXT_OFFSET; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the PGSP init context base address. */ - ulTempData = ( cOCT6100_IMAGE_FILE_BASE + 0x200 ) & 0x07FFFFFF; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_INIT_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the RIN circular buffer base address. */ - ulTempData = ( pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainRinCBMemOfst) & 0x07FFFF00; - ulTempData |= ( ulRoutPcmLaw << cOCT6100_GSC_BUFFER_LAW_OFFSET ); - - /* Set the circular buffer size.*/ - if (( pSharedInfo->MemoryMap.ulChanMainRinCBMemSize & 0xFFFF00FF ) != 0 ) - return cOCT6100_ERR_CHANNEL_INVALID_RIN_CB_SIZE; - ulTempData |= pSharedInfo->MemoryMap.ulChanMainRinCBMemSize >> 8; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_RIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SIN circular buffer base address. */ - ulTempData = ( pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSinCBMemOfst) & 0x07FFFF00; - ulTempData |= ( ulSinPcmLaw << cOCT6100_GSC_BUFFER_LAW_OFFSET ); - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SOUT circular buffer base address. */ - ulTempData = ( pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSoutCBMemOfst ) & 0x07FFFF00; - ulTempData |= ( ulSoutPcmLaw << cOCT6100_GSC_BUFFER_LAW_OFFSET ); - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SOUT_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* ECHO SSPX Memory configuration.*/ - - WriteParams.ulWriteAddress = cOCT6100_ECHO_CONTROL_MEM_BASE + ( f_usEchoIndex * cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE ); - - /* ECHO memory BASE + 2 */ - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0x0000; - - /* Set the echo control field.*/ - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - || ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - WriteParams.usWriteData |= cOCT6100_ECHO_OP_MODE_NORMAL << cOCT6100_ECHO_CONTROL_MEM_AF_CONTROL; - } - else if ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_EXTERNAL ) - { - WriteParams.usWriteData |= f_pChannelOpen->ulEchoOperationMode << cOCT6100_ECHO_CONTROL_MEM_AF_CONTROL; - } - - /* Set the SIN/SOUT law.*/ - WriteParams.usWriteData |= ulSinPcmLaw << cOCT6100_ECHO_CONTROL_MEM_INPUT_LAW_OFFSET; - WriteParams.usWriteData |= ulSoutPcmLaw << cOCT6100_ECHO_CONTROL_MEM_OUTPUT_LAW_OFFSET; - - /* Set the TSI chariot memory field.*/ - WriteParams.usWriteData |= f_usSinSoutTsiIndex & cOCT6100_ECHO_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* ECHO memory BASE */ - WriteParams.ulWriteAddress -= 2; - WriteParams.usWriteData = cOCT6100_ECHO_CONTROL_MEM_ACTIVATE_ENTRY; - - /* Set the RIN/ROUT law.*/ - WriteParams.usWriteData |= ulRinPcmLaw << cOCT6100_ECHO_CONTROL_MEM_INPUT_LAW_OFFSET; - WriteParams.usWriteData |= ulRoutPcmLaw << cOCT6100_ECHO_CONTROL_MEM_OUTPUT_LAW_OFFSET; - - /* Set the RIN external echo control bit.*/ - if ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_EXTERNAL ) - WriteParams.usWriteData |= cOCT6100_ECHO_CONTROL_MEM_EXTERNAL_AF_CTRL; - - /* Set the TSI chariot memory field.*/ - WriteParams.usWriteData |= f_usRinRoutTsiIndex & cOCT6100_ECHO_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateOpenStruct - -Description: This function will copy the new parameter from the modify structure - into a channel open structure to be processed later by the same path - as the channel open function. - If a parameter is set to keep previous, it's current value will be - extracted from the channel entry in the API. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -IN f_pApiInstance Pointer to an API instance structure. -IN f_pChanModify Pointer to a channel modify structure. -IN OUT f_pChanOpen Pointer to a channel open structure. -IN f_pChanEntry Pointer to an API channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateOpenStruct -UINT32 Oct6100ApiUpdateOpenStruct( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChanModify, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChanOpen, - IN tPOCT6100_API_CHANNEL f_pChanEntry ) -{ - - /* Check the generic Echo parameters.*/ - if ( f_pChanModify->ulEchoOperationMode == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->ulEchoOperationMode = f_pChanEntry->byEchoOperationMode; - else - f_pChanOpen->ulEchoOperationMode = f_pChanModify->ulEchoOperationMode; - - - if ( f_pChanModify->fEnableToneDisabler == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->fEnableToneDisabler = f_pChanEntry->fEnableToneDisabler; - else - f_pChanOpen->fEnableToneDisabler = f_pChanModify->fEnableToneDisabler; - - - if ( f_pChanModify->ulUserChanId == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->ulUserChanId = f_pChanEntry->ulUserChanId; - else - f_pChanOpen->ulUserChanId = f_pChanModify->ulUserChanId; - - - - /*======================================================================*/ - /* Now update the TDM config.*/ - /* Rin PCM LAW */ - if ( f_pChanModify->TdmConfig.ulRinPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinPcmLaw = f_pChanEntry->TdmConfig.byRinPcmLaw; - else - f_pChanOpen->TdmConfig.ulRinPcmLaw = f_pChanModify->TdmConfig.ulRinPcmLaw; - - /* Sin PCM LAW */ - if ( f_pChanModify->TdmConfig.ulSinPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinPcmLaw = f_pChanEntry->TdmConfig.bySinPcmLaw; - else - f_pChanOpen->TdmConfig.ulSinPcmLaw = f_pChanModify->TdmConfig.ulSinPcmLaw; - - /* Rout PCM LAW */ - if ( f_pChanModify->TdmConfig.ulRoutPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutPcmLaw = f_pChanEntry->TdmConfig.byRoutPcmLaw; - else - f_pChanOpen->TdmConfig.ulRoutPcmLaw = f_pChanModify->TdmConfig.ulRoutPcmLaw; - - /* Sout PCM LAW */ - if ( f_pChanModify->TdmConfig.ulSoutPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutPcmLaw = f_pChanEntry->TdmConfig.bySoutPcmLaw; - else - f_pChanOpen->TdmConfig.ulSoutPcmLaw = f_pChanModify->TdmConfig.ulSoutPcmLaw; - - - /* Rin Timeslot */ - if ( f_pChanModify->TdmConfig.ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinTimeslot = f_pChanEntry->TdmConfig.usRinTimeslot; - else - f_pChanOpen->TdmConfig.ulRinTimeslot = f_pChanModify->TdmConfig.ulRinTimeslot; - - /* Rin Stream */ - if ( f_pChanModify->TdmConfig.ulRinStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinStream = f_pChanEntry->TdmConfig.usRinStream; - else - f_pChanOpen->TdmConfig.ulRinStream = f_pChanModify->TdmConfig.ulRinStream; - - /* Rin Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulRinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinNumTssts = f_pChanEntry->TdmConfig.byRinNumTssts; - else - f_pChanOpen->TdmConfig.ulRinNumTssts = f_pChanModify->TdmConfig.ulRinNumTssts; - - - /* Sin Timeslot */ - if ( f_pChanModify->TdmConfig.ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinTimeslot = f_pChanEntry->TdmConfig.usSinTimeslot; - else - f_pChanOpen->TdmConfig.ulSinTimeslot = f_pChanModify->TdmConfig.ulSinTimeslot; - - /* Sin Stream */ - if ( f_pChanModify->TdmConfig.ulSinStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinStream = f_pChanEntry->TdmConfig.usSinStream; - else - f_pChanOpen->TdmConfig.ulSinStream = f_pChanModify->TdmConfig.ulSinStream; - - /* Sin Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulSinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinNumTssts = f_pChanEntry->TdmConfig.bySinNumTssts; - else - f_pChanOpen->TdmConfig.ulSinNumTssts = f_pChanModify->TdmConfig.ulSinNumTssts; - - - /* Rout Timeslot */ - if ( f_pChanModify->TdmConfig.ulRoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutTimeslot = f_pChanEntry->TdmConfig.usRoutTimeslot; - else - f_pChanOpen->TdmConfig.ulRoutTimeslot = f_pChanModify->TdmConfig.ulRoutTimeslot; - - /* Rout Stream */ - if ( f_pChanModify->TdmConfig.ulRoutStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutStream = f_pChanEntry->TdmConfig.usRoutStream; - else - f_pChanOpen->TdmConfig.ulRoutStream = f_pChanModify->TdmConfig.ulRoutStream; - - /* Rout Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulRoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutNumTssts = f_pChanEntry->TdmConfig.byRoutNumTssts; - else - f_pChanOpen->TdmConfig.ulRoutNumTssts = f_pChanModify->TdmConfig.ulRoutNumTssts; - - - /* Sout Timeslot */ - if ( f_pChanModify->TdmConfig.ulSoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutTimeslot = f_pChanEntry->TdmConfig.usSoutTimeslot; - else - f_pChanOpen->TdmConfig.ulSoutTimeslot = f_pChanModify->TdmConfig.ulSoutTimeslot; - - /* Sout Stream */ - if ( f_pChanModify->TdmConfig.ulSoutStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutStream = f_pChanEntry->TdmConfig.usSoutStream; - else - f_pChanOpen->TdmConfig.ulSoutStream = f_pChanModify->TdmConfig.ulSoutStream; - - /* Sout Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulSoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutNumTssts = f_pChanEntry->TdmConfig.bySoutNumTssts; - else - f_pChanOpen->TdmConfig.ulSoutNumTssts = f_pChanModify->TdmConfig.ulSoutNumTssts; - - /*======================================================================*/ - - /*======================================================================*/ - /* Now update the VQE config.*/ - - if ( f_pChanModify->VqeConfig.ulComfortNoiseMode == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulComfortNoiseMode = f_pChanEntry->VqeConfig.byComfortNoiseMode; - else - f_pChanOpen->VqeConfig.ulComfortNoiseMode = f_pChanModify->VqeConfig.ulComfortNoiseMode; - - if ( f_pChanModify->VqeConfig.fEnableNlp == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fEnableNlp = f_pChanEntry->VqeConfig.fEnableNlp; - else - f_pChanOpen->VqeConfig.fEnableNlp = f_pChanModify->VqeConfig.fEnableNlp; - - if ( f_pChanModify->VqeConfig.fEnableTailDisplacement == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fEnableTailDisplacement = f_pChanEntry->VqeConfig.fEnableTailDisplacement; - else - f_pChanOpen->VqeConfig.fEnableTailDisplacement = f_pChanModify->VqeConfig.fEnableTailDisplacement; - - if ( f_pChanModify->VqeConfig.ulTailDisplacement == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulTailDisplacement = f_pChanEntry->VqeConfig.usTailDisplacement; - else - f_pChanOpen->VqeConfig.ulTailDisplacement = f_pChanModify->VqeConfig.ulTailDisplacement; - - /* Tail length cannot be modifed. */ - f_pChanOpen->VqeConfig.ulTailLength = f_pChanEntry->VqeConfig.usTailLength; - - - - if ( f_pChanModify->VqeConfig.fRinDcOffsetRemoval == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinDcOffsetRemoval = f_pChanEntry->VqeConfig.fRinDcOffsetRemoval; - else - f_pChanOpen->VqeConfig.fRinDcOffsetRemoval = f_pChanModify->VqeConfig.fRinDcOffsetRemoval; - - - if ( f_pChanModify->VqeConfig.fRinLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinLevelControl = f_pChanEntry->VqeConfig.fRinLevelControl; - else - f_pChanOpen->VqeConfig.fRinLevelControl = f_pChanModify->VqeConfig.fRinLevelControl; - - - if ( f_pChanModify->VqeConfig.fRinAutomaticLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinAutomaticLevelControl = f_pChanEntry->VqeConfig.fRinAutomaticLevelControl; - else - f_pChanOpen->VqeConfig.fRinAutomaticLevelControl = f_pChanModify->VqeConfig.fRinAutomaticLevelControl; - - - if ( f_pChanModify->VqeConfig.fRinHighLevelCompensation == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinHighLevelCompensation = f_pChanEntry->VqeConfig.fRinHighLevelCompensation; - else - f_pChanOpen->VqeConfig.fRinHighLevelCompensation = f_pChanModify->VqeConfig.fRinHighLevelCompensation; - - - if ( f_pChanModify->VqeConfig.lRinHighLevelCompensationThresholdDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = f_pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb; - else - f_pChanOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = f_pChanModify->VqeConfig.lRinHighLevelCompensationThresholdDb; - - - if ( f_pChanModify->VqeConfig.fSinDcOffsetRemoval == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSinDcOffsetRemoval = f_pChanEntry->VqeConfig.fSinDcOffsetRemoval; - else - f_pChanOpen->VqeConfig.fSinDcOffsetRemoval = f_pChanModify->VqeConfig.fSinDcOffsetRemoval; - - - if ( f_pChanModify->VqeConfig.fSoutAdaptiveNoiseReduction == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutAdaptiveNoiseReduction = f_pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction; - else - f_pChanOpen->VqeConfig.fSoutAdaptiveNoiseReduction = f_pChanModify->VqeConfig.fSoutAdaptiveNoiseReduction; - - - if ( f_pChanModify->VqeConfig.fSoutConferencingNoiseReduction == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutConferencingNoiseReduction = f_pChanEntry->VqeConfig.fSoutConferencingNoiseReduction; - else - f_pChanOpen->VqeConfig.fSoutConferencingNoiseReduction = f_pChanModify->VqeConfig.fSoutConferencingNoiseReduction; - - - if ( f_pChanModify->VqeConfig.fSoutNoiseBleaching == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutNoiseBleaching = f_pChanEntry->VqeConfig.fSoutNoiseBleaching; - else - f_pChanOpen->VqeConfig.fSoutNoiseBleaching = f_pChanModify->VqeConfig.fSoutNoiseBleaching; - - - if ( f_pChanModify->VqeConfig.fSoutLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutLevelControl = f_pChanEntry->VqeConfig.fSoutLevelControl; - else - f_pChanOpen->VqeConfig.fSoutLevelControl = f_pChanModify->VqeConfig.fSoutLevelControl; - - - if ( f_pChanModify->VqeConfig.fSoutAutomaticLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutAutomaticLevelControl = f_pChanEntry->VqeConfig.fSoutAutomaticLevelControl; - else - f_pChanOpen->VqeConfig.fSoutAutomaticLevelControl = f_pChanModify->VqeConfig.fSoutAutomaticLevelControl; - - - if ( f_pChanModify->VqeConfig.lRinLevelControlGainDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lRinLevelControlGainDb = f_pChanEntry->VqeConfig.chRinLevelControlGainDb; - else - f_pChanOpen->VqeConfig.lRinLevelControlGainDb = f_pChanModify->VqeConfig.lRinLevelControlGainDb; - - - if ( f_pChanModify->VqeConfig.lSoutLevelControlGainDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lSoutLevelControlGainDb = f_pChanEntry->VqeConfig.chSoutLevelControlGainDb; - else - f_pChanOpen->VqeConfig.lSoutLevelControlGainDb = f_pChanModify->VqeConfig.lSoutLevelControlGainDb; - - - if ( f_pChanModify->VqeConfig.lRinAutomaticLevelControlTargetDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = f_pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb; - else - f_pChanOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = f_pChanModify->VqeConfig.lRinAutomaticLevelControlTargetDb; - - - if ( f_pChanModify->VqeConfig.lSoutAutomaticLevelControlTargetDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = f_pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb; - else - f_pChanOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = f_pChanModify->VqeConfig.lSoutAutomaticLevelControlTargetDb; - - - if ( f_pChanModify->VqeConfig.lDefaultErlDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lDefaultErlDb = f_pChanEntry->VqeConfig.chDefaultErlDb; - else - f_pChanOpen->VqeConfig.lDefaultErlDb = f_pChanModify->VqeConfig.lDefaultErlDb; - - - if ( f_pChanModify->VqeConfig.lAecDefaultErlDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lAecDefaultErlDb = f_pChanEntry->VqeConfig.chAecDefaultErlDb; - else - f_pChanOpen->VqeConfig.lAecDefaultErlDb = f_pChanModify->VqeConfig.lAecDefaultErlDb; - - - if ( f_pChanModify->VqeConfig.ulAecTailLength == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulAecTailLength = f_pChanEntry->VqeConfig.usAecTailLength; - else - f_pChanOpen->VqeConfig.ulAecTailLength = f_pChanModify->VqeConfig.ulAecTailLength; - - - if ( f_pChanModify->VqeConfig.fAcousticEcho == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fAcousticEcho = f_pChanEntry->VqeConfig.fAcousticEcho; - else - f_pChanOpen->VqeConfig.fAcousticEcho = f_pChanModify->VqeConfig.fAcousticEcho; - - - if ( f_pChanModify->VqeConfig.fDtmfToneRemoval == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fDtmfToneRemoval = f_pChanEntry->VqeConfig.fDtmfToneRemoval; - else - f_pChanOpen->VqeConfig.fDtmfToneRemoval = f_pChanModify->VqeConfig.fDtmfToneRemoval; - - - - - - if ( f_pChanModify->VqeConfig.ulNonLinearityBehaviorA == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorA = f_pChanEntry->VqeConfig.byNonLinearityBehaviorA; - else - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorA = f_pChanModify->VqeConfig.ulNonLinearityBehaviorA; - - - if ( f_pChanModify->VqeConfig.ulNonLinearityBehaviorB == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorB = f_pChanEntry->VqeConfig.byNonLinearityBehaviorB; - else - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorB = f_pChanModify->VqeConfig.ulNonLinearityBehaviorB; - - - if ( f_pChanModify->VqeConfig.ulDoubleTalkBehavior == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulDoubleTalkBehavior = f_pChanEntry->VqeConfig.byDoubleTalkBehavior; - else - f_pChanOpen->VqeConfig.ulDoubleTalkBehavior = f_pChanModify->VqeConfig.ulDoubleTalkBehavior; - - - if ( f_pChanModify->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = f_pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb; - else - f_pChanOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = f_pChanModify->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb; - - - if ( f_pChanModify->VqeConfig.ulSoutNaturalListenerEnhancementGainDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = f_pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb; - else - f_pChanOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = f_pChanModify->VqeConfig.ulSoutNaturalListenerEnhancementGainDb; - - - if ( f_pChanModify->VqeConfig.fSoutNaturalListenerEnhancement == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutNaturalListenerEnhancement = f_pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement; - else - f_pChanOpen->VqeConfig.fSoutNaturalListenerEnhancement = f_pChanModify->VqeConfig.fSoutNaturalListenerEnhancement; - - - if ( f_pChanModify->VqeConfig.fRoutNoiseReduction == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRoutNoiseReduction = f_pChanEntry->VqeConfig.fRoutNoiseReduction; - else - f_pChanOpen->VqeConfig.fRoutNoiseReduction = f_pChanModify->VqeConfig.fRoutNoiseReduction; - - if ( f_pChanModify->VqeConfig.lRoutNoiseReductionLevelGainDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.lRoutNoiseReductionLevelGainDb = f_pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb; - else - f_pChanOpen->VqeConfig.lRoutNoiseReductionLevelGainDb = f_pChanModify->VqeConfig.lRoutNoiseReductionLevelGainDb; - - - if ( f_pChanModify->VqeConfig.lAnrSnrEnhancementDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.lAnrSnrEnhancementDb = f_pChanEntry->VqeConfig.chAnrSnrEnhancementDb; - else - f_pChanOpen->VqeConfig.lAnrSnrEnhancementDb = f_pChanModify->VqeConfig.lAnrSnrEnhancementDb; - - - if ( f_pChanModify->VqeConfig.ulAnrVoiceNoiseSegregation == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulAnrVoiceNoiseSegregation = f_pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation; - else - f_pChanOpen->VqeConfig.ulAnrVoiceNoiseSegregation = f_pChanModify->VqeConfig.ulAnrVoiceNoiseSegregation; - - - if ( f_pChanModify->VqeConfig.ulToneDisablerVqeActivationDelay == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulToneDisablerVqeActivationDelay = f_pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay; - else - f_pChanOpen->VqeConfig.ulToneDisablerVqeActivationDelay = f_pChanModify->VqeConfig.ulToneDisablerVqeActivationDelay; - - - if ( f_pChanModify->VqeConfig.fEnableMusicProtection == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fEnableMusicProtection = f_pChanEntry->VqeConfig.fEnableMusicProtection; - else - f_pChanOpen->VqeConfig.fEnableMusicProtection = f_pChanModify->VqeConfig.fEnableMusicProtection; - - - if ( f_pChanModify->VqeConfig.fIdleCodeDetection == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fIdleCodeDetection = f_pChanEntry->VqeConfig.fIdleCodeDetection; - else - f_pChanOpen->VqeConfig.fIdleCodeDetection = f_pChanModify->VqeConfig.fIdleCodeDetection; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Finaly the codec config.*/ - - if ( f_pChanModify->CodecConfig.ulDecoderPort == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulDecoderPort = f_pChanEntry->CodecConfig.byDecoderPort; - else - f_pChanOpen->CodecConfig.ulDecoderPort = f_pChanModify->CodecConfig.ulDecoderPort; - - - if ( f_pChanModify->CodecConfig.ulDecodingRate == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulDecodingRate = f_pChanEntry->CodecConfig.byDecodingRate; - else - f_pChanOpen->CodecConfig.ulDecodingRate = f_pChanModify->CodecConfig.ulDecodingRate; - - - if ( f_pChanModify->CodecConfig.ulEncoderPort == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulEncoderPort = f_pChanEntry->CodecConfig.byEncoderPort; - else - f_pChanOpen->CodecConfig.ulEncoderPort = f_pChanModify->CodecConfig.ulEncoderPort; - - - if ( f_pChanModify->CodecConfig.ulEncodingRate == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulEncodingRate = f_pChanEntry->CodecConfig.byEncodingRate; - else - f_pChanOpen->CodecConfig.ulEncodingRate = f_pChanModify->CodecConfig.ulEncodingRate; - - if ( f_pChanModify->CodecConfig.fEnableSilenceSuppression == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.fEnableSilenceSuppression = f_pChanEntry->CodecConfig.fEnableSilenceSuppression; - else - f_pChanOpen->CodecConfig.fEnableSilenceSuppression = f_pChanModify->CodecConfig.fEnableSilenceSuppression; - - if ( f_pChanModify->CodecConfig.ulPhasingType == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulPhasingType = f_pChanEntry->CodecConfig.byPhasingType; - else - f_pChanOpen->CodecConfig.ulPhasingType = f_pChanModify->CodecConfig.ulPhasingType; - - if ( f_pChanModify->CodecConfig.ulPhase == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulPhase = f_pChanEntry->CodecConfig.byPhase; - else - f_pChanOpen->CodecConfig.ulPhase = f_pChanModify->CodecConfig.ulPhase; - - if ( f_pChanModify->CodecConfig.ulPhasingTsstHndl == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, f_pChanEntry->usPhasingTsstIndex ); - - /* Now recreate the Phasing TSST handle.*/ - f_pChanOpen->CodecConfig.ulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_pChanEntry->usPhasingTsstIndex; - } - else - { - f_pChanOpen->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - } - } - else - { - f_pChanOpen->CodecConfig.ulPhasingTsstHndl = f_pChanModify->CodecConfig.ulPhasingTsstHndl; - } - - f_pChanOpen->CodecConfig.ulAdpcmNibblePosition = f_pChanEntry->CodecConfig.byAdpcmNibblePosition; - /*======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRetrieveNlpConfDword - -Description: This function is used by the API to store on a per channel basis - the various confguration DWORD from the device. The API performs - less read to the chip that way since it is always in synch with the - chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChanEntry Pointer to an API channel structure.. -f_ulAddress Address that needs to be modified.. -f_pulConfigDword Pointer to the content stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRetrieveNlpConfDword -UINT32 Oct6100ApiRetrieveNlpConfDword( - - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulConfigDword ) -{ - UINT32 ulResult; - UINT32 ulFirstEmptyIndex = 0xFFFFFFFF; - UINT32 i; - - /* Search for the Dword.*/ - for ( i = 0; i < cOCT6100_MAX_NLP_CONF_DWORD; i++ ) - { - if ( ( ulFirstEmptyIndex == 0xFFFFFFFF ) && ( f_pChanEntry->aulNlpConfDword[ i ][ 0 ] == 0x0 ) ) - ulFirstEmptyIndex = i; - - if ( f_pChanEntry->aulNlpConfDword[ i ][ 0 ] == f_ulAddress ) - { - /* We found the matching Dword.*/ - *f_pulConfigDword = f_pChanEntry->aulNlpConfDword[ i ][ 1 ]; - return cOCT6100_ERR_OK; - } - } - - if ( i == cOCT6100_MAX_NLP_CONF_DWORD && ulFirstEmptyIndex == 0xFFFFFFFF ) - return cOCT6100_ERR_FATAL_8E; - - /* We did not found any entry, let's create a new entry.*/ - f_pChanEntry->aulNlpConfDword[ ulFirstEmptyIndex ][ 0 ] = f_ulAddress; - - - /* Read the DWORD where the field is located.*/ - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulAddress, - f_pulConfigDword ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSaveNlpConfDword - -Description: This function stores a configuration Dword within an API channel - structure and then writes it into the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChanEntry Pointer to an API channel structure.. -f_ulAddress Address that needs to be modified.. -f_pulConfigDword content to be stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSaveNlpConfDword -UINT32 Oct6100ApiSaveNlpConfDword( - - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - IN UINT32 f_ulConfigDword ) -{ - UINT32 ulResult; - UINT32 i; - - /* Search for the Dword.*/ - for ( i = 0; i < cOCT6100_MAX_NLP_CONF_DWORD; i++ ) - { - - if ( f_pChanEntry->aulNlpConfDword[ i ][ 0 ] == f_ulAddress ) - { - /* We found the matching Dword.*/ - f_pChanEntry->aulNlpConfDword[ i ][ 1 ] = f_ulConfigDword; - break; - } - } - - if ( i == cOCT6100_MAX_NLP_CONF_DWORD ) - return cOCT6100_ERR_FATAL_8F; - - - /* Write the config DWORD.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - f_ulAddress, - f_ulConfigDword ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelCreateBiDirSer - -Description: Creates a bidirectional echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelCreateBiDir Pointer to a create bidirectionnal channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCreateBiDirSer -UINT32 Oct6100ChannelCreateBiDirSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ) -{ - UINT16 usFirstChanIndex; - UINT16 usFirstChanExtraTsiIndex; - UINT16 usFirstChanSinCopyEventIndex; - UINT16 usFirstChanSoutCopyEventIndex; - UINT16 usSecondChanIndex; - UINT16 usSecondChanExtraTsiIndex; - UINT16 usSecondChanSinCopyEventIndex; - UINT16 usSecondChanSoutCopyEventIndex; - UINT16 usBiDirChanIndex; - UINT32 ulResult; - - - /* Check the user's configuration of the bidir channel for errors. */ - ulResult = Oct6100ApiCheckChannelCreateBiDirParams( f_pApiInstance, - f_pChannelCreateBiDir, - &usFirstChanIndex, - &usFirstChanExtraTsiIndex, - &usFirstChanSinCopyEventIndex, - &usSecondChanIndex, - &usSecondChanExtraTsiIndex, - &usSecondChanSinCopyEventIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the bidir channel. */ - ulResult = Oct6100ApiReserveChannelCreateBiDirResources(f_pApiInstance, - - &usBiDirChanIndex, - &usFirstChanExtraTsiIndex, - &usFirstChanSinCopyEventIndex, - &usFirstChanSoutCopyEventIndex, - &usSecondChanExtraTsiIndex, - &usSecondChanSinCopyEventIndex, - &usSecondChanSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiWriteChannelCreateBiDirStructs( f_pApiInstance, - - usFirstChanIndex, - usFirstChanExtraTsiIndex, - usFirstChanSinCopyEventIndex, - usFirstChanSoutCopyEventIndex, - usSecondChanIndex, - usSecondChanExtraTsiIndex, - usSecondChanSinCopyEventIndex, - usSecondChanSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiUpdateBiDirChannelEntry( f_pApiInstance, - f_pChannelCreateBiDir, - usBiDirChanIndex, - usFirstChanIndex, - usFirstChanExtraTsiIndex, - usFirstChanSinCopyEventIndex, - usFirstChanSoutCopyEventIndex, - usSecondChanIndex, - usSecondChanExtraTsiIndex, - usSecondChanSinCopyEventIndex, - usSecondChanSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChannelCreateBiDirParams - -Description: Checks the user's parameter passed to the create bidirectional channel - function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelCreateBiDir Pointer to a create bidirectionnal channel structure. -f_pusFirstChanIndex Pointer to the first channel index. -f_pusFirstChanExtraTsiIndex Pointer to the first channel extra TSI index. -f_pusFirstChanSinCopyEventIndex Pointer to the first channel Sin copy event index. -f_pusSecondChanIndex Pointer to the second channel index. -f_pusSecondChanExtraTsiIndex Pointer to the second channel extra TSI index. -f_pusSecondChanSinCopyEventIndex Pointer to the second channel Sin copy event index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChannelCreateBiDirParams -UINT32 Oct6100ApiCheckChannelCreateBiDirParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - OUT PUINT16 f_pusFirstChanIndex, - OUT PUINT16 f_pusFirstChanExtraTsiIndex, - OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanIndex, - OUT PUINT16 f_pusSecondChanExtraTsiIndex, - OUT PUINT16 f_pusSecondChanSinCopyEventIndex - - ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - UINT32 ulEntryOpenCnt; - BOOL fCheckTssts = TRUE; - - /* Obtain shared resources pointer.*/ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* validate the bidirectional channel handle memory.*/ - if ( f_pChannelCreateBiDir->pulBiDirChannelHndl == NULL ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - - - /* Check if bi-dir channels are activated. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxBiDirChannels == 0 ) - return cOCT6100_ERR_CHANNEL_BIDIR_DISABLED; - - /*=======================================================================*/ - /* Verify the first channel handle. */ - - if ( (f_pChannelCreateBiDir->ulFirstChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; - - *f_pusFirstChanIndex = (UINT16)( f_pChannelCreateBiDir->ulFirstChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusFirstChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, *f_pusFirstChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelCreateBiDir->ulFirstChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pFirstChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pFirstChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; - - /* Check the specific state of the channel.*/ - if ( pFirstChanEntry->fRinRoutCodecActive == TRUE && pFirstChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_ROUT) - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pFirstChanEntry->fSinSoutCodecActive == TRUE && pFirstChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_SOUT) - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pFirstChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_ALREADY_BIDIR; - - if ( pFirstChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_FIRST_CHAN_IN_CONFERENCE; - - if ( fCheckTssts == TRUE ) - { - if ( pFirstChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_FIRST_CHAN_SOUT_PORT; - if ( pFirstChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_FIRST_CHAN_RIN_PORT; - } - - /* Return the desired info.*/ - *f_pusFirstChanExtraTsiIndex = pFirstChanEntry->usExtraSinTsiMemIndex; - *f_pusFirstChanSinCopyEventIndex = pFirstChanEntry->usSinCopyEventIndex; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Verify the second channel handle. */ - - if ( (f_pChannelCreateBiDir->ulSecondChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; - - *f_pusSecondChanIndex = (UINT16)( f_pChannelCreateBiDir->ulSecondChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusSecondChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, *f_pusSecondChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelCreateBiDir->ulSecondChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pSecondChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pSecondChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; - - /* Check the specific state of the channel.*/ - if ( pSecondChanEntry->fRinRoutCodecActive == TRUE && pSecondChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_ROUT) - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pSecondChanEntry->fSinSoutCodecActive == TRUE && pSecondChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_SOUT) - { - - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - } - - if ( pSecondChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_ALREADY_BIDIR; - - if ( fCheckTssts == TRUE ) - { - if ( pSecondChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_SECOND_CHAN_SOUT_PORT; - if ( pSecondChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_SECOND_CHAN_RIN_PORT; - } - - if ( pSecondChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_SECOND_CHAN_IN_CONFERENCE; - - /* Return the desired info.*/ - *f_pusSecondChanExtraTsiIndex = pSecondChanEntry->usExtraSinTsiMemIndex; - *f_pusSecondChanSinCopyEventIndex = pSecondChanEntry->usSinCopyEventIndex; - /*=======================================================================*/ - - /* Check the law compatibility.*/ - if ( pFirstChanEntry->TdmConfig.bySoutPcmLaw != pSecondChanEntry->TdmConfig.byRinPcmLaw || - pFirstChanEntry->TdmConfig.byRinPcmLaw != pSecondChanEntry->TdmConfig.bySoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_BIDIR_PCM_LAW; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveChannelCreateBiDirResources - -Description: Reserves all resources needed for the new bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusBiDirChanIndex Pointer to the index of the bidirectionnal channel within the API instance. -f_pusFirstChanExtraTsiIndex Pointer to the first channel extra TSI index. -f_pusFirstChanSinCopyEventIndex Pointer to the first channel Sin copy event index. -f_pusFirstChanSoutCopyEventIndex Pointer to the first channel Sout copy event index. -f_pusSecondChanExtraTsiIndex Pointer to the second channel extra TSI index. -f_pusSecondChanSinCopyEventIndex Pointer to the second channel Sin copy event index. -f_pusSecondChanSoutCopyEventIndex Pointer to the second channel Sout copy event index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveChannelCreateBiDirResources -UINT32 Oct6100ApiReserveChannelCreateBiDirResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - OUT PUINT16 f_pusBiDirChanIndex, - IN OUT PUINT16 f_pusFirstChanExtraTsiIndex, - IN OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusFirstChanSoutCopyEventIndex, - IN OUT PUINT16 f_pusSecondChanExtraTsiIndex, - IN OUT PUINT16 f_pusSecondChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanSoutCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - - BOOL fBiDirChanIndex = FALSE; - BOOL fFirstExtraTsi = FALSE; - BOOL fSecondExtraTsi = FALSE; - BOOL fFirstSinCopyEvent = FALSE; - BOOL fSecondSinCopyEvent = FALSE; - BOOL fFirstSoutCopyEvent = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*===============================================================================*/ - /* Verify and reserve the resources that might already by allocated. */ - - - { - if ( *f_pusFirstChanExtraTsiIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve the first Extra TSI memory entry */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - f_pusFirstChanExtraTsiIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fFirstExtraTsi = TRUE; - } - - if ( *f_pusFirstChanSinCopyEventIndex == cOCT6100_INVALID_INDEX && ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the Sin copy event for the first channel.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusFirstChanSinCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fFirstSinCopyEvent = TRUE; - } - } - - if ( *f_pusSecondChanExtraTsiIndex == cOCT6100_INVALID_INDEX && ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the second Extra TSI memory entry */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - f_pusSecondChanExtraTsiIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fSecondExtraTsi = TRUE; - } - - if ( *f_pusSecondChanSinCopyEventIndex == cOCT6100_INVALID_INDEX && ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the Sin copy event for the second channel.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusSecondChanSinCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fSecondSinCopyEvent = TRUE; - } - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Now reserve all the resources specific to bidirectional channels */ - - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReserveBiDirChanEntry( f_pApiInstance, - f_pusBiDirChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fBiDirChanIndex = TRUE; - - - { - - /* Reserve the first channel Sout copy mixer event.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusFirstChanSoutCopyEventIndex ); - } - - if ( ulResult == cOCT6100_ERR_OK ) - { - fFirstSoutCopyEvent = TRUE; - - /* Reserve the second channel Sout copy mixer event.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusSecondChanSoutCopyEventIndex ); - } - } - } - - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Release the resources if something went wrong */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /*===============================================================================*/ - /* Release the previously reserved echo resources .*/ - if ( fBiDirChanIndex == TRUE ) - { - ulTempVar = Oct6100ApiReleaseBiDirChanEntry( f_pApiInstance, - *f_pusBiDirChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fFirstExtraTsi == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - *f_pusFirstChanExtraTsiIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fSecondExtraTsi == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - *f_pusSecondChanExtraTsiIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fFirstSinCopyEvent == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - *f_pusFirstChanSinCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fSecondSinCopyEvent == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - *f_pusSecondChanSinCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( ( fFirstSoutCopyEvent == TRUE ) - - ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - *f_pusFirstChanSoutCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteChannelCreateBiDirStructs - -Description: Performs all the required structure writes to configure the - new echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usFirstChanIndex Pointer to the first channel index. -f_usFirstChanExtraTsiIndex Pointer to the first channel extra TSI index. -f_usFirstChanSinCopyEventIndex Pointer to the first channel Sin copy event index. -f_usFirstChanSoutCopyEventIndex Pointer to the first channel Sout copy event index. -f_usFirstChanIndex Pointer to the second channel index. -f_usSecondChanExtraTsiIndex Pointer to the second channel extra TSI index. -f_usSecondChanSinCopyEventIndex Pointer to the second channel Sin copy event index. -f_usSecondChanSoutCopyEventIndex Pointer to the second channel Sout copy event index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteChannelCreateBiDirStructs -UINT32 Oct6100ApiWriteChannelCreateBiDirStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==============================================================================*/ - /* Get a pointer to the two channel entry.*/ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - - - - { - /*==============================================================================*/ - /* Configure the Tsst control memory and add the Sin copy event if necessary. */ - - /*=======================================================================*/ - /* Program the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usFirstChanSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= f_usFirstChanExtraTsiIndex; - WriteParams.usWriteData |= pFirstChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pFirstChanEntry->usSinSoutTsiMemIndex ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pFirstChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pFirstChanEntry->usSinTsstIndex, - f_usFirstChanExtraTsiIndex, - pFirstChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now insert the event into the event list.*/ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usFirstChanSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usFirstChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - } - - - - /*==============================================================================*/ - /* Configure the Tsst control memory and add the Sin copy event if necessary.*/ - - /*=======================================================================*/ - /* Program the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSecondChanSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= f_usSecondChanExtraTsiIndex; - WriteParams.usWriteData |= pSecondChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSecondChanEntry->usSinSoutTsiMemIndex ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pSecondChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pSecondChanEntry->usSinTsstIndex, - f_usSecondChanExtraTsiIndex, - pSecondChanEntry->TdmConfig.bySinPcmLaw ); - } - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now insert the event into the event list.*/ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usSecondChanSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - - /*==============================================================================*/ - /* Now, let's configure the two Sout copy events.*/ - - - /* First event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usFirstChanSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pFirstChanEntry->usSinSoutTsiMemIndex; - WriteParams.usWriteData |= pFirstChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pSecondChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usFirstChanSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usFirstChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - /* Second event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSecondChanSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pSecondChanEntry->usSinSoutTsiMemIndex; - WriteParams.usWriteData |= pSecondChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pFirstChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usSecondChanSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Clear + release the silence events if they were created. */ - - if ( pFirstChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pFirstChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pFirstChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E0; - - pFirstChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - if ( ( pSecondChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - - ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pSecondChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pSecondChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E0; - - pSecondChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBiDirChannelEntry - -Description: Updates the new bidir channel and the channel used to create that channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBiDirChannelEntry -UINT32 Oct6100ApiUpdateBiDirChannelEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - IN UINT16 f_usBiDirChanIndex, - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, f_usBiDirChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - /*=======================================================================*/ - /* Copy the channel's configuration and allocated resources. */ - - pFirstChanEntry->usExtraSinTsiMemIndex = f_usFirstChanExtraTsiIndex; - pFirstChanEntry->usSinCopyEventIndex = f_usFirstChanSinCopyEventIndex; - pFirstChanEntry->usSoutCopyEventIndex = f_usFirstChanSoutCopyEventIndex; - - pSecondChanEntry->usExtraSinTsiMemIndex = f_usSecondChanExtraTsiIndex; - pSecondChanEntry->usSinCopyEventIndex = f_usSecondChanSinCopyEventIndex; - pSecondChanEntry->usSoutCopyEventIndex = f_usSecondChanSoutCopyEventIndex; - - /* Save the channel info in the bidir channel.*/ - pBiDirChanEntry->usFirstChanIndex = f_usFirstChanIndex; - pBiDirChanEntry->usSecondChanIndex = f_usSecondChanIndex; - - - - /* Increment the extra TSI memory dependency count.*/ - - pFirstChanEntry->usExtraSinTsiDependencyCnt++; - pSecondChanEntry->usExtraSinTsiDependencyCnt++; - - /* Set the bidir flag in the channel structure.*/ - pFirstChanEntry->fBiDirChannel = TRUE; - pSecondChanEntry->fBiDirChannel = TRUE; - - /*=======================================================================*/ - - /* Form handle returned to user. */ - *f_pChannelCreateBiDir->pulBiDirChannelHndl = cOCT6100_HNDL_TAG_BIDIR_CHANNEL | (pBiDirChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usBiDirChanIndex; - - /* Finally, mark the channel as open. */ - pBiDirChanEntry->fReserved = TRUE; - - /* Increment the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberBiDirChannels++; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelDestroyBiDirSer - -Description: Closes a bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelDestroyBiDir Pointer to a destroy bidirectionnal channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelDestroyBiDirSer -UINT32 Oct6100ChannelDestroyBiDirSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ) -{ - UINT16 usBiDirChanIndex; - UINT16 usFirstChanIndex; - UINT16 usSecondChanIndex; - - - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertDestroyBiDirChanParams( f_pApiInstance, - f_pChannelDestroyBiDir, - &usBiDirChanIndex, - - &usFirstChanIndex, - &usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiInvalidateBiDirChannelStructs( f_pApiInstance, - - usFirstChanIndex, - usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiReleaseBiDirChannelResources( f_pApiInstance, - usBiDirChanIndex, - - usFirstChanIndex, - usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle.*/ - f_pChannelDestroyBiDir->ulBiDirChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertDestroyBiDirChanParams - -Description: Validate the handle given by the user and verify the state of - the channel about to be closed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelDestroyBiDir Pointer to a destroy bidirectional channel structure. -f_pusBiDirChanIndex Pointer to the bidir channel entry within the API's list. -f_pusFirstChanIndex Pointer to the first channel index part of the bidir channel. -f_pusFirstChanIndex Pointer to the second channel index part of the bidir channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertDestroyBiDirChanParams -UINT32 Oct6100ApiAssertDestroyBiDirChanParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir, - IN OUT PUINT16 f_pusBiDirChanIndex, - - IN OUT PUINT16 f_pusFirstChanIndex, - IN OUT PUINT16 f_pusSecondChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelDestroyBiDir->ulBiDirChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_BIDIR_CHANNEL ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - *f_pusBiDirChanIndex = (UINT16)( f_pChannelDestroyBiDir->ulBiDirChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBiDirChanIndex >= pSharedInfo->ChipConfig.usMaxBiDirChannels ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the bidir channel's list entry. */ - - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, *f_pusBiDirChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelDestroyBiDir->ulBiDirChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBiDirChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHAN_NOT_OPEN; - if ( ulEntryOpenCnt != pBiDirChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - /*=======================================================================*/ - - /* Return the index of the channel used to create this bidirectional channel.*/ - *f_pusFirstChanIndex = pBiDirChanEntry->usFirstChanIndex; - *f_pusSecondChanIndex = pBiDirChanEntry->usSecondChanIndex; - - - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateBiDirChannelStructs - -Description: Destroy the link between the two channels. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateBiDirChannelStructs -UINT32 Oct6100ApiInvalidateBiDirChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get pointers to the API entry of the two channel used to create the bidir channel.*/ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - /* Clear the SIN copy event of the first channel and release the Extra TSI memory if - this feature was the only one using it. */ - - { - if ( pFirstChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /*=======================================================================*/ - /* Clear the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pFirstChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pFirstChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pFirstChanEntry->usSinTsstIndex, - pFirstChanEntry->usSinSoutTsiMemIndex, - pFirstChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pFirstChanEntry->usSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - } - - /* Clear the SIN copy event of the first channel and release the Extra TSI memory if - this feature was the only one using it. */ - if ( pSecondChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /*=======================================================================*/ - /* Clear the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSecondChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pSecondChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pSecondChanEntry->usSinTsstIndex, - pSecondChanEntry->usSinSoutTsiMemIndex, - pSecondChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pSecondChanEntry->usSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - - /* Now remove the sout copy of the first channel.*/ - - - { - /*=======================================================================*/ - /* Clear the Sout Copy event of the first channel.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pFirstChanEntry->usSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pFirstChanEntry->usSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - - /* Now remove the sout copy of the second channel.*/ - - /*=======================================================================*/ - /* Clear the Sout Copy event of the second channel.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSecondChanEntry->usSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pSecondChanEntry->usSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBiDirChannelResources - -Description: Release and clear the API entry associated to the bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBiDirChanIndex Index of the bidirectionnal channel in the API's bidir channel list. -f_usFirstChanIndex Index of the first channel used to create the bidir channel. -f_usSecondChanIndex Index of the second channel used to create the bidir channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBiDirChannelResources -UINT32 Oct6100ApiReleaseBiDirChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBiDirChanIndex, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, f_usBiDirChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - /* Release the bidir entry.*/ - ulResult = Oct6100ApiReleaseBiDirChanEntry( f_pApiInstance, f_usBiDirChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_AC; - - /* Release the Extra TSI memory and the SIN copy event if required.*/ - - { - if ( pFirstChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the two TSI chariot memory entries.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pFirstChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A3; - - /* Relese the SIN copy event.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pFirstChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A4; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pFirstChanEntry->usSinCopyEventIndex ); - - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pFirstChanEntry->usExtraSinTsiDependencyCnt--; - pFirstChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - pFirstChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - } - else - { - pFirstChanEntry->usExtraSinTsiDependencyCnt--; - } - } - - if ( pSecondChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the two TSI chariot memory entries.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pSecondChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A5; - - /* Relese the SIN copy event.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pSecondChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A6; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pSecondChanEntry->usSinCopyEventIndex ); - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pSecondChanEntry->usExtraSinTsiDependencyCnt--; - pSecondChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - pSecondChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - } - else - { - pSecondChanEntry->usExtraSinTsiDependencyCnt--; - } - - - { - /* Release the SOUT copy event of the first channel.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pFirstChanEntry->usSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A7; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pFirstChanEntry->usSoutCopyEventIndex ); - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - - /* Release the SOUT copy event of the second channel.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pSecondChanEntry->usSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A8; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pSecondChanEntry->usSoutCopyEventIndex ); - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - - /*=======================================================================*/ - /* Update the first channel's list entry. */ - - /* Mark the channel as closed. */ - pFirstChanEntry->usSoutCopyEventIndex = cOCT6100_INVALID_INDEX; - pFirstChanEntry->fBiDirChannel = FALSE; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the second channel's list entry. */ - - /* Mark the channel as closed. */ - - pSecondChanEntry->usSoutCopyEventIndex = cOCT6100_INVALID_INDEX; - pSecondChanEntry->fBiDirChannel = FALSE; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the bidirectional channel's list entry. */ - - /* Mark the channel as closed. */ - pBiDirChanEntry->fReserved = FALSE; - pBiDirChanEntry->byEntryOpenCnt++; - - pBiDirChanEntry->usFirstChanIndex = cOCT6100_INVALID_INDEX; - pBiDirChanEntry->usSecondChanIndex = cOCT6100_INVALID_INDEX; - - /* Decrement the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberBiDirChannels--; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check if some of the ports must be muted back. */ - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_usFirstChanIndex, - pFirstChanEntry->usRinTsstIndex, - pFirstChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_usSecondChanIndex, - pSecondChanEntry->usRinTsstIndex, - pSecondChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ApiOctFloatToDbEnergyByte -INT32 Oct6100ApiOctFloatToDbEnergyByte(UINT8 x) -{ - INT32 lResult; - - lResult = Oct6100ApiOctFloatToDbEnergyHalf( (UINT16)(x << 8) ); - return lResult; -} -#endif - -#if !SKIP_Oct6100ApiOctFloatToDbEnergyHalf -INT32 Oct6100ApiOctFloatToDbEnergyHalf(UINT16 x) -{ - INT32 y; - UINT16 m; - - y = (((x >> 8) & 0x7F) - 0x41) * 3; - - m = (UINT16)((x & 0x00E0) >> 5); - if (m < 2) y += 0; - else if (m < 5) y += 1; - else y += 2; - - return y; -} -#endif - -#if !SKIP_Oct6100ApiDbAmpHalfToOctFloat -UINT16 Oct6100ApiDbAmpHalfToOctFloat(INT32 x) -{ - INT32 db_div6; - INT32 db_mod6; - UINT16 rval; - INT32 x_unsigned; - - if(x < 0) - { - x_unsigned = -x; - } - else - { - x_unsigned = x; - } - - db_div6 = x_unsigned / 6; - db_mod6 = x_unsigned % 6; - - if(x < 0) - { - if(db_mod6 == 0) - { - /* Change nothing! */ - db_div6 = -db_div6; - } - else - { - /* When we are negative, round down, and then adjust modulo. For example, if - x is -1, then db_div6 is 0 and db_mod6 is 1. We adjust so db_div6 = -1 and - db_mod6 = 5, which gives the correct adjustment. */ - db_div6 = -db_div6-1; - db_mod6 = 6 - db_mod6; - } - } - - rval = (UINT16)(0x4100 + db_div6 * 0x100); - - if(db_mod6 == 0) - { - rval += 0x0000; - } - else if(db_mod6 == 1) - { - rval += 0x0020; - } - else if(db_mod6 == 2) - { - rval += 0x0040; - } - else if(db_mod6 == 3) - { - rval += 0x0070; - } - else if(db_mod6 == 4) - { - rval += 0x0090; - } - else /* if(db_mod6 == 5) */ - { - rval += 0x00D0; - } - - return rval; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteDebugChanMemory - -Description: This function configure a debug channel echo memory entry - in internal memory.and external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTdmConfig Pointer to a TDM configuration structure. -f_pVqeConfig Pointer to a VQE configuration structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_usRinRoutTsiIndex RIN/ROUT TSI index within the TSI chariot memory. -f_usSinSoutTsiIndex SIN/SOUT TSI index within the TSI chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteDebugChanMemory -UINT32 Oct6100ApiWriteDebugChanMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - - /* Obtain pointer to local portion of the instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*==============================================================================*/ - /* Write the VQE configuration of the debug channel. */ - - ulResult = Oct6100ApiWriteVqeMemory( - f_pApiInstance, - f_pVqeConfig, - f_pChannelOpen, - f_usChanIndex, - f_usEchoMemIndex, - TRUE, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - - /* Write the echo memory configuration of the debug channel. */ - ulResult = Oct6100ApiWriteEchoMemory( - f_pApiInstance, - f_pTdmConfig, - f_pChannelOpen, - f_usEchoMemIndex, - f_usRinRoutTsiIndex, - f_usSinSoutTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiDebugChannelOpen - -Description: Internal function used to open a debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiDebugChannelOpen -UINT32 Oct6100ApiDebugChannelOpen( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_CHANNEL_OPEN TempChanOpen; - - UINT32 ulResult; - UINT16 usChanIndex; - UINT16 usDummyEchoIndex; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Let's program the channel memory.*/ - Oct6100ChannelOpenDef( &TempChanOpen ); - - TempChanOpen.ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_HT_RESET; /* Activate the channel in reset.*/ - TempChanOpen.VqeConfig.fEnableNlp = FALSE; - TempChanOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; - TempChanOpen.VqeConfig.fSinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.fRinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.lDefaultErlDb = 0; - - /* Loop to reserve the proper entry for the debug channel */ - for( usChanIndex = 0; usChanIndex < ( pSharedInfo->DebugInfo.usRecordChanIndex + 1 ); usChanIndex ++ ) - { - ulResult = Oct6100ApiReserveEchoEntry( f_pApiInstance, &usDummyEchoIndex ); - if( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Loop to free all entries except the one for the debug channel */ - for( usChanIndex = pSharedInfo->DebugInfo.usRecordChanIndex; usChanIndex > 0; ) - { - usChanIndex--; - ulResult = Oct6100ApiReleaseEchoEntry( f_pApiInstance, usChanIndex ); - if( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance, - &TempChanOpen.TdmConfig, - &TempChanOpen.VqeConfig, - &TempChanOpen, - pSharedInfo->DebugInfo.usRecordChanIndex, - pSharedInfo->DebugInfo.usRecordMemIndex, - pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex, - pSharedInfo->DebugInfo.usRecordSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMuteChannelPort - -Description: This function will verify if a input TSST is bound to the RIN and - SIN port. If not, the port will be muted. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMutePorts -UINT32 Oct6100ApiMutePorts( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinTsstIndex, - IN UINT16 f_usSinTsstIndex, - IN BOOL f_fCheckBridgeIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usEchoIndex ); - - /* Mute the Rin port. */ - if ( ( f_fCheckBridgeIndex == FALSE ) - || ( ( f_fCheckBridgeIndex == TRUE ) && ( pChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) ) ) - { - /* If the channel is in bidir mode, do not create the Rin silence event!!! */ - if ( pChanEntry->fBiDirChannel == FALSE ) - { - if ( ( ( f_usRinTsstIndex == cOCT6100_INVALID_INDEX ) || ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) ) - && ( pChanEntry->usRinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - { - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - &pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now, write the mixer event used to copy the RIN signal of the silence channel - into the RIN signal of the current channel. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usRinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= 1534; - WriteParams.usWriteData |= cOCT6100_PCM_U_LAW << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now insert the Sin copy event into the list.*/ - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Mute the Sin port. */ - if ( ( ( f_usSinTsstIndex == cOCT6100_INVALID_INDEX ) || ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) ) - && ( pChanEntry->usSinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - { - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - &pChanEntry->usSinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now, write the mixer event used to copy the SIN signal of the silence channel - into the SIN signal of the current channel. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= 1534; - WriteParams.usWriteData |= cOCT6100_PCM_U_LAW << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now insert the Sin copy event into the list.*/ - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - pChanEntry->usSinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Unmute the Rin port if it was muted. */ - if ( ( ( f_usRinTsstIndex != cOCT6100_INVALID_INDEX ) && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) == 0x0 ) ) - && ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E1; - - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /* Unmute the Sin port if it was muted. */ - if ( ( ( f_usSinTsstIndex != cOCT6100_INVALID_INDEX ) && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) == 0x0 ) ) - && ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usSinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usSinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E2; - - pChanEntry->usSinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSetChannelLevelControl - -Description: This function will configure the level control on a given - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig VQE config of the channel. -f_usChanIndex Index of the channel within the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearAlcHlcStatusBit If this is set, the ALC-HLC status bit must be - incremented. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSetChannelLevelControl -UINT32 Oct6100ApiSetChannelLevelControl( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearAlcHlcStatusBit ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT32 i; - UINT16 usTempData; - UINT8 byLastStatus; - BOOL fDisableAlcFirst; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the channel list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Before doing anything, check if the configuration has changed. */ - if ( ( f_fClearAlcHlcStatusBit == TRUE ) - || ( f_pVqeConfig->fRinLevelControl != pChanEntry->VqeConfig.fRinLevelControl ) - || ( f_pVqeConfig->lRinLevelControlGainDb != pChanEntry->VqeConfig.chRinLevelControlGainDb ) - || ( f_pVqeConfig->fRinAutomaticLevelControl != pChanEntry->VqeConfig.fRinAutomaticLevelControl ) - || ( f_pVqeConfig->lRinAutomaticLevelControlTargetDb != pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb ) - || ( f_pVqeConfig->fRinHighLevelCompensation != pChanEntry->VqeConfig.fRinHighLevelCompensation ) - || ( f_pVqeConfig->lRinHighLevelCompensationThresholdDb != pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb ) - || ( f_pVqeConfig->fSoutLevelControl != pChanEntry->VqeConfig.fSoutLevelControl ) - || ( f_pVqeConfig->lSoutLevelControlGainDb != pChanEntry->VqeConfig.chSoutLevelControlGainDb ) - || ( f_pVqeConfig->fSoutAutomaticLevelControl != pChanEntry->VqeConfig.fSoutAutomaticLevelControl ) - || ( f_pVqeConfig->lSoutAutomaticLevelControlTargetDb != pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement != pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement ) - || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb ) - || ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb ) ) - { - /* Calculate base address for manual level control configuration. */ - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Set the Level control on RIN port.*/ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinLevelControlOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( ( f_pVqeConfig->fRinLevelControl == TRUE ) - || ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) ) - { - /* Set the level control value.*/ - if ( ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) ) - ulTempData |= ( 0xFF << ulFeatureBitOffset ); - else - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( f_pVqeConfig->lRinLevelControlGainDb ); - usTempData -= 0x3800; - usTempData &= 0x0FF0; - usTempData >>= 4; - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - } - else /* ( ( f_pVqeConfig->fRinLevelControl == FALSE ) && ( f_pVqeConfig->fRinAutomaticLevelControl == FALSE ) && ( f_pVqeConfig->fRinHighLevelCompensation == FALSE ) ) */ - { - ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the Level control on SOUT port.*/ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SoutLevelControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SoutLevelControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SoutLevelControlOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( ( f_pVqeConfig->fSoutLevelControl == TRUE ) - || ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) - || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0x0 ) ) - { - /* Set the level control value.*/ - if ( ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) - || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0x0 ) ) - ulTempData |= ( 0xFF << ulFeatureBitOffset ); - else - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( f_pVqeConfig->lSoutLevelControlGainDb ); - usTempData -= 0x3800; - usTempData &= 0x0FF0; - usTempData >>= 4; - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - } - else - { - ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Calculate base address for auto level control + high level compensation configuration. */ - ulBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - /* Check which one is to be disabled first. */ - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - fDisableAlcFirst = FALSE; - else - fDisableAlcFirst = TRUE; - - for ( i = 0; i < 2; i ++ ) - { - /* Set the auto level control target Db for the Rin port. */ - if ( ( ( i == 0 ) && ( fDisableAlcFirst == TRUE ) ) || ( ( i == 1 ) && ( fDisableAlcFirst == FALSE ) ) ) - { - if ( pSharedInfo->ImageInfo.fRinAutoLevelControl == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lRinAutomaticLevelControlTargetDb ); - - /* Set auto level control target on the Rin port. */ - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fRinAutomaticLevelControl == FALSE ) */ - { - /* Disable auto level control. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* Set the high level compensation threshold Db for the Rin port. */ - if ( pSharedInfo->ImageInfo.fRinHighLevelCompensation == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lRinHighLevelCompensationThresholdDb ); - - /* Set high level compensation threshold on the Rin port. */ - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fRinHighLevelCompensation == FALSE ) */ - { - /* Disable high level compensation. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Set the auto level control target Db for the Sout port. */ - if ( pSharedInfo->ImageInfo.fRinAutoLevelControl == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lSoutAutomaticLevelControlTargetDb ); - - /* Set auto level control target on the Sout port. */ - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fSoutAutomaticLevelControl == FALSE ) */ - { - /* Disable auto level control. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the high level compensation threshold Db for the Sout port. */ - if ( pSharedInfo->ImageInfo.fSoutHighLevelCompensation == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Disable high level compensation on Sout for now. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if have to clear the ALC-HLC status. */ - if ( ( pSharedInfo->ImageInfo.fAlcHlcStatus == TRUE ) - && ( ( f_fClearAlcHlcStatusBit == TRUE ) - - ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AlcHlcStatusOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AlcHlcStatusOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AlcHlcStatusOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Retrieve last status. */ - byLastStatus = (UINT8)( ( ( ulTempData & ulMask ) >> ulFeatureBitOffset ) & 0xFF ); - - /* Increment to reset context. */ - byLastStatus ++; - - /* Just in case, not to overwrite some context in external memory. */ - byLastStatus &= ( 0x1 << ulFeatureFieldLength ) - 1; - - /* Clear last status. */ - ulTempData &= (~ulMask); - - /* Set new status. */ - ulTempData |= ( byLastStatus << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSetChannelTailConfiguration - -Description: This function will configure the tail displacement and length - on a given channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig VQE config of the channel. -f_usChanIndex Index of the channel within the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fModifyOnly Function called from a modify or open? - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSetChannelTailConfiguration -UINT32 Oct6100ApiSetChannelTailConfiguration( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fModifyOnly ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulNlpConfBaseAddress; - UINT32 ulAfConfBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT32 ulTailSum; - BOOL fTailDisplacementModified = FALSE; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the channel list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Calculate base addresses of NLP + AF configuration structure for the specified channel. */ - ulNlpConfBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - ulAfConfBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - /* Set the tail displacement.*/ - if ( pSharedInfo->ImageInfo.fTailDisplacement == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->fEnableTailDisplacement != pChanEntry->VqeConfig.fEnableTailDisplacement ) - || ( f_pVqeConfig->ulTailDisplacement != pChanEntry->VqeConfig.usTailDisplacement ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - /* Remember that the tail displacement parameters were changed. */ - fTailDisplacementModified = TRUE; - - /* Check if we must set the tail displacement value. */ - if ( ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - && ( pSharedInfo->ImageInfo.fPerChannelTailDisplacement == TRUE ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - && ( f_pVqeConfig->ulTailDisplacement != 0x0 ) ) - { - if ( pSharedInfo->ImageInfo.fAfTailDisplacement == FALSE ) - { - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTempData |= ( ( ( pSharedInfo->ChipConfig.usTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - else - { - ulTempData |= ( ( ( f_pVqeConfig->ulTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - } - else /* if ( pSharedInfo->ImageInfo.fAfTailDisplacement == TRUE ) */ - { - /* If AEC is not activated, this must be set to the requested tail displacement. */ - if ( f_pVqeConfig->fAcousticEcho == FALSE ) - { - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum = pSharedInfo->ChipConfig.usTailDisplacement; - } - else - { - ulTailSum = f_pVqeConfig->ulTailDisplacement; - } - - if ( ulTailSum == 0 ) - { - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 128 ) - { - ulTempData |= ( ( 1 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 384 ) - { - ulTempData |= ( ( 3 ) << ulFeatureBitOffset ); - } - else /* if ( ulTailSum <= 896 ) */ - { - ulTempData |= ( ( 7 ) << ulFeatureBitOffset ); - } - } - else /* if ( f_pVqeConfig->fAcousticEcho == FALSE ) */ - { - /* Otherwise, the tail displacement is configured differently. This field stays to 0. */ - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - } - } - } - - /* Then save the new DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pSharedInfo->ImageInfo.fAfTailDisplacement == TRUE ) - { - /* Set the tail displacement offset in the AF. */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTempData |= ( ( ( pSharedInfo->ChipConfig.usTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - else - { - ulTempData |= ( ( ( f_pVqeConfig->ulTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - ulFeatureBytesOffset = pSharedInfo->MemoryMap.TailDisplEnableOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.TailDisplEnableOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.TailDisplEnableOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( (UINT32)f_pVqeConfig->fEnableTailDisplacement ) << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the tail length. */ - if ( pSharedInfo->ImageInfo.fPerChannelTailLength == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulTailLength != pChanEntry->VqeConfig.usTailLength ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - /* Check if must automatically select maximum or if must use user specific value. */ - if ( f_pVqeConfig->ulTailLength == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTempData |= ( ( ( pSharedInfo->ImageInfo.usMaxTailLength - 32 ) / 4 ) << ulFeatureBitOffset ); - } - else - { - ulTempData |= ( ( ( f_pVqeConfig->ulTailLength - 32 ) / 4 ) << ulFeatureBitOffset ); - } - - /* Then save the DWORD where the field is located.*/ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure AEC tail length. */ - if ( pSharedInfo->ImageInfo.fAecTailLength == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( fTailDisplacementModified == TRUE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulAecTailLength != pChanEntry->VqeConfig.usAecTailLength ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AecTailLengthFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AecTailLengthFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AecTailLengthFieldOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set acoustic echo tail length. */ - if ( f_pVqeConfig->fAcousticEcho == TRUE ) - { - switch( f_pVqeConfig->ulAecTailLength ) - { - case 1024: - ulTempData |= ( ( 3 ) << ulFeatureBitOffset ); - break; - case 512: - ulTempData |= ( ( 2 ) << ulFeatureBitOffset ); - break; - case 256: - ulTempData |= ( ( 1 ) << ulFeatureBitOffset ); - break; - case 128: - default: - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - break; - } - } - else if ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - { - /* No acoustic echo case. */ - - /* Start with requested tail displacement. */ - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum = pSharedInfo->ChipConfig.usTailDisplacement; - } - else - { - ulTailSum = f_pVqeConfig->ulTailDisplacement; - } - - /* Add requested tail length. */ - if ( f_pVqeConfig->ulTailLength == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum += pSharedInfo->ImageInfo.usMaxTailLength; - } - else - { - ulTailSum += f_pVqeConfig->ulTailLength; - } - - /* Round this value up. */ - if ( ulTailSum <= 128 ) - { - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 256 ) - { - ulTempData |= ( ( 1 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 512 ) - { - ulTempData |= ( ( 2 ) << ulFeatureBitOffset ); - } - else /* if ( ulTailSum <= 1024 ) */ - { - ulTempData |= ( ( 3 ) << ulFeatureBitOffset ); - } - } - else - { - /* Keep this to zero. */ - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - } - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelMuteSer - -Description: This function will mute some of the ports on a given - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelMute What channel/ports to mute. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelMuteSer -UINT32 Oct6100ChannelMuteSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute ) -{ - UINT32 ulResult; - UINT16 usChanIndex; - UINT16 usPortMask; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertChannelMuteParams( f_pApiInstance, - f_pChannelMute, - &usChanIndex, - &usPortMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Call the actual channel mute ports function. */ - ulResult = Oct6100ApiMuteChannelPorts( f_pApiInstance, - usChanIndex, - usPortMask, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChannelMuteParams - -Description: Check the user parameters passed to the channel mute function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelMute What channel/ports to mute. -f_pusChanIndex Resulting channel index where the muting should - be applied. -f_pusPorts Port mask on which to apply the muting. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChannelMuteParams -UINT32 Oct6100ApiAssertChannelMuteParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - if ( pChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL; - - /*=======================================================================*/ - - /* Check the provided port mask. */ - - if ( ( f_pChannelMute->ulPortMask & - ~( cOCT6100_CHANNEL_MUTE_PORT_NONE | - cOCT6100_CHANNEL_MUTE_PORT_RIN | - cOCT6100_CHANNEL_MUTE_PORT_ROUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN | - cOCT6100_CHANNEL_MUTE_PORT_SOUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) ) != 0 ) - return cOCT6100_ERR_CHANNEL_MUTE_MASK; - - /* Sin + Sin with features cannot be muted simultaneously. */ - if ( ( ( f_pChannelMute->ulPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( f_pChannelMute->ulPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) ) - return cOCT6100_ERR_CHANNEL_MUTE_MASK_SIN; - - /* Check if Sin mute with features is supported by the firmware. */ - if ( ( ( f_pChannelMute->ulPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( pSharedInfo->ImageInfo.fSinMute == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_MUTE_FEATURES; - - /* Return the ports to the calling function. */ - *f_pusPorts = (UINT16)( f_pChannelMute->ulPortMask & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelUnMuteSer - -Description: This function will unmute some of the ports on a given - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelUnMute What channel/ports to unmute. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelUnMuteSer -UINT32 Oct6100ChannelUnMuteSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ) -{ - UINT32 ulResult; - UINT16 usChanIndex; - UINT16 usPortMask; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertChannelUnMuteParams( f_pApiInstance, - f_pChannelUnMute, - &usChanIndex, - &usPortMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Call the actual channel mute ports function. */ - ulResult = Oct6100ApiMuteChannelPorts( f_pApiInstance, - usChanIndex, - usPortMask, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChannelUnMuteParams - -Description: Check the user parameters passed to the channel unmute function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelUnMute What channel/ports to Unmute. -f_pusChanIndex Resulting channel index where the muting should - be applied. -f_pusPorts Port mask on which to apply the muting. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChannelUnMuteParams -UINT32 Oct6100ApiAssertChannelUnMuteParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelUnMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelUnMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelUnMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - if ( pChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL; - - /*=======================================================================*/ - - /* Check the provided port mask. */ - - if ( ( f_pChannelUnMute->ulPortMask & - ~( cOCT6100_CHANNEL_MUTE_PORT_NONE | - cOCT6100_CHANNEL_MUTE_PORT_RIN | - cOCT6100_CHANNEL_MUTE_PORT_ROUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN | - cOCT6100_CHANNEL_MUTE_PORT_SOUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) ) != 0 ) - return cOCT6100_ERR_CHANNEL_MUTE_MASK; - - /* Return the ports to the calling function. */ - *f_pusPorts = (UINT16)( f_pChannelUnMute->ulPortMask & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMuteSinWithFeatures - -Description: Mute or Unmute the sin with features port. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usChanIndex Resulting channel index where the muting should - be applied. -f_fEnableSinWithFeatures Whether to enable the feature or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMuteSinWithFeatures -UINT32 Oct6100ApiMuteSinWithFeatures( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN BOOL f_fEnableSinWithFeatures ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - if ( pSharedInfo->ImageInfo.fSinMute == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SinMuteOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SinMuteOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SinMuteOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Clear the mute flag. */ - ulTempData &= (~ulMask); - - /* Set the mute flag on the Sin port.*/ - if ( f_fEnableSinWithFeatures == TRUE ) - ulTempData |= ( 0x1 << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMuteChannelPorts - -Description: Mute or Unmute the specified ports, according to the mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usChanIndex Resulting channel index where the muting should - be applied. -f_usPortMask Port mask on which to apply the muting/unmuting. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMuteChannelPorts -UINT32 Oct6100ApiMuteChannelPorts( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usPortMask, - IN BOOL f_fMute ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - BOOL fDisableSinWithFeatures = FALSE; - BOOL fEnableSinWithFeatures = FALSE; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Rin port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) == 0x0 ) ) - { - /* Mute this port. */ - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_RIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - { - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_RIN; - return ulResult; - } - } - else if ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) ) - { - /* Unmute this port. */ - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_RIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Rout port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) == 0x0 ) ) - { - /* Mute this port. */ - - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usRoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.byRoutNumTssts, - 1534 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; - } - else if ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) != 0x0 ) ) - { - /* Unmute this port. */ - - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usRoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.byRoutNumTssts, - pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_ROUT; - } - - /* Sin port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) == 0x0 ) ) - { - /* Mute this port. */ - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_SIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - { - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SIN; - return ulResult; - } - } - else if ( - ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) ) - || - ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) ) ) - { - /* Unmute this port. */ - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Sout port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) == 0x0 ) ) - { - /* Mute this port. */ - - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usSoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.bySoutNumTssts, - 1534 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; - } - else if ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) != 0x0 ) ) - { - /* Unmute this port. */ - - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usSoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.bySoutNumTssts, - pChanEntry->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SOUT; - } - - /* Sin with features port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) == 0x0 ) ) - { - /* Mute this port. */ - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES; - fEnableSinWithFeatures = TRUE; - } - else if ( - ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) ) - || - ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) ) ) - { - /* Unmute this port. */ - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES; - - fDisableSinWithFeatures = TRUE; - } - - /* Check if must enable or disable SIN mute with features. */ - if ( fDisableSinWithFeatures == TRUE || fEnableSinWithFeatures == TRUE ) - { - ulResult = Oct6100ApiMuteSinWithFeatures( f_pApiInstance, f_usChanIndex, fEnableSinWithFeatures ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c deleted file mode 100644 index 0afcc401..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c +++ /dev/null @@ -1,6905 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_open.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to power-up the chip according to the - user's configuration. Also, the API instance is initialized to reflect the - desired configuration. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 347 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_bt0.h" -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_tsi_cnct_inst.h" -#include "oct6100api/oct6100_events_inst.h" -#include "oct6100api/oct6100_conf_bridge_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" - -#include "oct6100api/oct6100_mixer_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_adpcm_chan_inst.h" -#include "oct6100api/oct6100_phasing_tsst_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_chip_stats_pub.h" -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_tsi_cnct_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_conf_bridge_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" - -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_adpcm_chan_pub.h" -#include "oct6100api/oct6100_phasing_tsst_pub.h" -#include "oct6100api/oct6100_remote_debug_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_debug_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_interrupts_priv.h" -#include "oct6100_chip_stats_priv.h" -#include "octrpc/rpc_protocol.h" -#include "oct6100_remote_debug_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_tsi_cnct_priv.h" -#include "oct6100_mixer_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_conf_bridge_priv.h" -#include "oct6100_playout_buf_priv.h" - -#include "oct6100_channel_priv.h" -#include "oct6100_adpcm_chan_priv.h" -#include "oct6100_phasing_tsst_priv.h" -#include "oct6100_tlv_priv.h" -#include "oct6100_debug_priv.h" -#include "oct6100_version.h" - - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100GetInstanceSizeDef - -Description: Retrieves the size of the required API instance structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pGetSize Structure containing API instance size. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100GetInstanceSizeDef -UINT32 Oct6100GetInstanceSizeDef( - tPOCT6100_GET_INSTANCE_SIZE f_pGetSize ) -{ - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100GetInstanceSize -UINT32 Oct6100GetInstanceSize( - tPOCT6100_CHIP_OPEN f_pChipOpen, - tPOCT6100_GET_INSTANCE_SIZE f_pGetSize ) -{ - tOCT6100_API_INSTANCE_SIZES InstanceSizes; - UINT32 ulResult; - - /* Check user configuration for errors and conflicts. */ - ulResult = Oct6100ApiCheckChipConfiguration( f_pChipOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Calculate the instance size required for user's configuration. */ - ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, &InstanceSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Return required size to user. */ - f_pGetSize->ulApiInstanceSize = InstanceSizes.ulApiInstTotal; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipOpenDef - -Description: Inserts default chip configuration parameters into the - structure pointed to by f_pChipOpen. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pChipOpen Structure containing user chip configuration. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipOpenDef -UINT32 Oct6100ChipOpenDef( - tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - UINT32 i; - - f_pChipOpen->ulUserChipId = 0; - f_pChipOpen->fMultiProcessSystem = FALSE; - f_pChipOpen->pProcessContext = NULL; - - f_pChipOpen->ulMaxRwAccesses = 8; - - f_pChipOpen->pbyImageFile = NULL; - f_pChipOpen->ulImageSize = 0; - - f_pChipOpen->ulMemClkFreq = 133000000; /* 133 Mhz */ - f_pChipOpen->ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; /* 33.33 Mhz */ - f_pChipOpen->fEnableMemClkOut = TRUE; - - f_pChipOpen->ulMemoryType = cOCT6100_MEM_TYPE_DDR; - f_pChipOpen->ulNumMemoryChips = 1; - f_pChipOpen->ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_64MB; - - /* Set the tail displacement to zero. */ - f_pChipOpen->ulTailDisplacement = 0; - - /* Disable acoustic echo by default. */ - f_pChipOpen->fEnableAcousticEcho = FALSE; - - /* Resource allocation parameters. */ - f_pChipOpen->ulMaxChannels = 672; - f_pChipOpen->ulMaxTsiCncts = 0; - f_pChipOpen->ulMaxBiDirChannels = 0; - f_pChipOpen->ulMaxConfBridges = 0; - f_pChipOpen->ulMaxFlexibleConfParticipants = 0; - f_pChipOpen->ulMaxPlayoutBuffers = 0; - - f_pChipOpen->ulMaxPhasingTssts = 0; - f_pChipOpen->ulMaxAdpcmChannels = 0; - f_pChipOpen->ulMaxTdmStreams = 32; - f_pChipOpen->fUseSynchTimestamp = FALSE; - for ( i = 0; i < 4; i++ ) - { - f_pChipOpen->aulTimestampTimeslots[ i ] = cOCT6100_INVALID_TIMESLOT; - f_pChipOpen->aulTimestampStreams[ i ] = cOCT6100_INVALID_STREAM; - } - f_pChipOpen->fEnableFastH100Mode = FALSE; - - /* Configure the soft tone event buffer. */ - f_pChipOpen->ulSoftToneEventsBufSize = 2048; - f_pChipOpen->fEnableExtToneDetection = FALSE; - f_pChipOpen->fEnable2100StopEvent = FALSE; - - /* Configure the soft playout event buffer. */ - f_pChipOpen->ulSoftBufferPlayoutEventsBufSize = cOCT6100_INVALID_VALUE; - - /* Interrupt configuration. */ - f_pChipOpen->ulInterruptPolarity = cOCT6100_ACTIVE_LOW_POLARITY; - - f_pChipOpen->InterruptConfig.ulErrorMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulFatalGeneralConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulErrorH100Config = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - - f_pChipOpen->InterruptConfig.ulErrorMemoryTimeout = 100; - f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout = 100; - f_pChipOpen->InterruptConfig.ulErrorH100Timeout = 100; - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout = 100; - f_pChipOpen->ulMaxRemoteDebugSessions = 1; - f_pChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_3_QUARTERS; - for ( i = 0; i < cOCT6100_TDM_STREAM_MAX_GROUPS; i++ ) - f_pChipOpen->aulTdmStreamFreqs[ i ] = cOCT6100_TDM_STREAM_FREQ_8MHZ; - - - - f_pChipOpen->fEnableChannelRecording = FALSE; - f_pChipOpen->fEnableProductionBist = FALSE; - f_pChipOpen->ulProductionBistMode = cOCT6100_PRODUCTION_BIST_STANDARD; - f_pChipOpen->ulNumProductionBistLoops = 1; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipOpen - -Description: Configures the chip according to the user specified - configuration f_pChipOpen. This function will perform all I/O - accesses necessary and initialize the API instance to reflect - the configuration. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipOpen Structure containing user chip configuration. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipOpen -UINT32 Oct6100ChipOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - tOCT6100_API_INSTANCE_SIZES *InstanceSizes; - UINT32 ulStructSize; - UINT32 ulResult; - UINT32 ulTempVar; - - /* Check user chip configuration parameters for errors. */ - ulResult = Oct6100ApiCheckChipConfiguration( f_pChipOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the host system is multi-process or not and adjust instance accordingly. */ - if ( f_pChipOpen->fMultiProcessSystem != TRUE ) - { - /* Set pointer to tOCT6100_SHARED_INFO structure within instance. */ - ulStructSize = sizeof( tOCT6100_INSTANCE_API ); - mOCT6100_ROUND_MEMORY_SIZE( ulStructSize, ulTempVar ) - - f_pApiInstance->pSharedInfo = ( tPOCT6100_SHARED_INFO )(( PUINT8 )f_pApiInstance + ulStructSize); - - /* Save the process context specified by the user. */ - f_pApiInstance->pProcessContext = f_pChipOpen->pProcessContext; - - /* Create serialization object handles. */ - ulResult = Oct6100ApiCreateSerializeObjects( f_pApiInstance, f_pChipOpen->ulUserChipId ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Copy the configuration structure. */ - ulResult = Oct6100ApiCopyChipConfiguration( f_pApiInstance, f_pChipOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Perform various calculations based on user chip configuration. */ - ulResult = Oct6100ApiInitializeMiscellaneousVariables( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - InstanceSizes = kmalloc(sizeof(tOCT6100_API_INSTANCE_SIZES), GFP_ATOMIC); - if (!InstanceSizes) - return cOCT6100_ERR_FATAL_0; - /* Calculate the amount of memory needed for the API instance structure. */ - ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, InstanceSizes ); - if ( ulResult != cOCT6100_ERR_OK ) { - kfree(InstanceSizes); - return ulResult; - } - - /* Allocate the memory for the API instance structure internal pointers. */ - ulResult = Oct6100ApiAllocateInstanceMemory( f_pApiInstance, InstanceSizes ); - kfree(InstanceSizes); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the allocated instance structure memory. */ - ulResult = Oct6100ApiInitializeInstanceMemory( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the tone information structure. */ - ulResult = Oct6100ApiInitToneInfo( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Test the CPU registers. */ - ulResult = Oct6100ApiCpuRegisterBist( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the FC2 PLL. */ - ulResult = Oct6100ApiBootFc2Pll( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the FC1 PLL. */ - ulResult = Oct6100ApiProgramFc1Pll( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Decode the key and bist internal memories. */ - ulResult = Oct6100ApiDecodeKeyAndBist( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the FC1 PLL. */ - ulResult = Oct6100ApiBootFc1Pll( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the SDRAM. */ - ulResult = Oct6100ApiBootSdram( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Bist the external memory. */ - ulResult = Oct6100ApiExternalMemoryBist( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the external memory. */ - ulResult = Oct6100ApiExternalMemoryInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Load the image into the chip. */ - ulResult = Oct6100ApiLoadImage( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the clock distribution registers. */ - ulResult = Oct6100ApiEnableClocks( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the NLP processor. */ - ulResult = Oct6100ApiProgramNLP( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_OPEN_EGO_TIMEOUT ) - ulResult = Oct6100ApiProgramNLP( f_pApiInstance ); - } - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( f_pChipOpen->fEnableProductionBist == FALSE ) - { - /* Read all TLV fields present in external memory. */ - ulResult = Oct6100ApiProcessTlvRegion( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the H.100 interface. */ - ulResult = Oct6100ApiSetH100Register( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Write miscellaneous registers. */ - ulResult = Oct6100ApiWriteMiscellaneousRegisters( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Proceed with the rest only if the production BIST has not been requested. */ - if ( f_pChipOpen->fEnableProductionBist == FALSE ) - { - /* Initialize the errors counters. */ - ulResult = Oct6100ApiChipStatsSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get revision number of chip. */ - ulResult = Oct6100ApiGetChipRevisionNum( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - - - /* Initialize the channels. */ - ulResult = Oct6100ApiInitChannels( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the mixer memory. */ - ulResult = Oct6100ApiInitMixer( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the mixer memory. */ - ulResult = Oct6100ApiInitRecordResources( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize free external memory for buffer playout. */ - ulResult = Oct6100ApiBufferPlayoutMemorySwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - - /*Clear all interrupts that could have occured during startup*/ - ulResult = Oct6100ApiClearInterrupts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the interrupt registers. */ - ulResult = Oct6100ApiIsrHwInit( f_pApiInstance, &f_pChipOpen->InterruptConfig ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipCloseDef - -Description: Puts the chip into soft reset. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipClose Pointer to a tOCT6100_CHIP_CLOSE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipCloseDef -UINT32 Oct6100ChipCloseDef( - tPOCT6100_CHIP_CLOSE f_pChipClose ) -{ - f_pChipClose->ulDummyVariable = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChipClose -UINT32 Oct6100ChipClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_CLOSE f_pChipClose ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Destroy the allocated ressources used for serialization. */ - ulResult = Oct6100ApiDestroySerializeObjects( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100CreateLocalInstance - -Description: Creates a local instance for a process in a multi-process - host system. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pCreateLocal Structure used to create process' local instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100CreateLocalInstanceDef -UINT32 Oct6100CreateLocalInstanceDef( - tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal ) -{ - f_pCreateLocal->pApiInstShared = NULL; - f_pCreateLocal->pApiInstLocal = NULL; - f_pCreateLocal->pProcessContext = NULL; - f_pCreateLocal->ulUserChipId = 0; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100CreateLocalInstance -UINT32 Oct6100CreateLocalInstance( - tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal ) -{ - tPOCT6100_INSTANCE_API pApiInstLocal; - UINT32 ulApiInstSize; - UINT32 ulTempVar; - UINT32 ulResult; - - /* Check user's structure for errors. */ - if ( f_pCreateLocal->pApiInstShared == NULL ) - return cOCT6100_ERR_MULTIPROC_API_INST_SHARED; - - if ( f_pCreateLocal->pApiInstLocal == NULL ) - return cOCT6100_ERR_MULTIPROC_API_INST_LOCAL; - - /* Get local pointer to local instance. */ - pApiInstLocal = f_pCreateLocal->pApiInstLocal; - - /* Assign pointers to local structure. */ - ulApiInstSize = sizeof( tOCT6100_INSTANCE_API ); - mOCT6100_ROUND_MEMORY_SIZE( ulApiInstSize, ulTempVar ) - - pApiInstLocal->pSharedInfo = ( tPOCT6100_SHARED_INFO )(( PUINT8 )f_pCreateLocal->pApiInstShared + ulApiInstSize); - pApiInstLocal->pProcessContext = f_pCreateLocal->pProcessContext; - - /* Create serialization object handles needed. */ - ulResult = Oct6100ApiCreateSerializeObjects( pApiInstLocal, f_pCreateLocal->ulUserChipId ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DestroyLocalInstance - -Description: Release local instance for a process in a multi-process - host system. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pDestroyLocal Structure used to destroy the process' local instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DestroyLocalInstanceDef -UINT32 Oct6100DestroyLocalInstanceDef( - tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal ) -{ - f_pDestroyLocal->ulDummy = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100DestroyLocalInstance -UINT32 Oct6100DestroyLocalInstance( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal ) -{ - UINT32 ulResult; - - /* Destroy the allocated ressources used for serialization. */ - ulResult = Oct6100ApiDestroySerializeObjects( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100GetHwRevision - -Description: Gets the hardware revision number of the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pGetHwRev Pointer to user structure in which to return revision - number. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100GetHwRevisionDef -UINT32 Oct6100GetHwRevisionDef( - tPOCT6100_GET_HW_REVISION f_pGetHwRev ) -{ - f_pGetHwRev->ulUserChipId = cOCT6100_INVALID_CHIP_ID; - f_pGetHwRev->pProcessContext = NULL; - f_pGetHwRev->ulRevisionNum = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100GetHwRevision -UINT32 Oct6100GetHwRevision( - tPOCT6100_GET_HW_REVISION f_pGetHwRev ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Read the hardware revision register. */ - ReadParams.pProcessContext = f_pGetHwRev->pProcessContext; - - ReadParams.ulUserChipId = f_pGetHwRev->ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = 0x17E; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pGetHwRev->ulRevisionNum = ( usReadData >> 8 ) & 0xFF; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100FreeResources - -Description: This function closes all opened channels and frees all - specified global resources used by the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pFreeResources Pointer to user structure in which to choose what - to free. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100FreeResourcesDef -UINT32 Oct6100FreeResourcesDef( - tPOCT6100_FREE_RESOURCES f_pFreeResources ) -{ - f_pFreeResources->fFreeTsiConnections = FALSE; - f_pFreeResources->fFreeConferenceBridges = FALSE; - f_pFreeResources->fFreePlayoutBuffers = FALSE; - f_pFreeResources->fFreePhasingTssts = FALSE; - f_pFreeResources->fFreeAdpcmChannels = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100FreeResources -UINT32 Oct6100FreeResources( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_FREE_RESOURCES f_pFreeResources ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100FreeResourcesSer( f_pApiInstance, f_pFreeResources ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ProductionBist - -Description: This function retrieves the current BIST status of the - firmware. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pProductionBist Pointer to user structure where the bist information - will be returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ProductionBistDef -UINT32 Oct6100ProductionBistDef( - tPOCT6100_PRODUCTION_BIST f_pProductionBist ) -{ - f_pProductionBist->ulCurrentAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulCurrentLoop = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulFailedAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulReadValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulExpectedValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulBistStatus = cOCT6100_BIST_IN_PROGRESS; - f_pProductionBist->ulCurrentTest = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ProductionBist -UINT32 Oct6100ProductionBist( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_PRODUCTION_BIST f_pProductionBist ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ProductionBistSer( f_pApiInstance, f_pProductionBist ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetVersion - -Description: Retrieves the API version. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pApiGetVersion Pointer to structure that will receive version information. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetVersionDef -UINT32 Oct6100ApiGetVersionDef( - tPOCT6100_API_GET_VERSION f_pApiGetVersion ) -{ - UINT32 i; - - /* Initialize the string. */ - for ( i = 0; i < cOCT6100_API_VERSION_STRING_LENGTH; i++ ) - f_pApiGetVersion->achApiVersion[ i ] = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ApiGetVersion -UINT32 Oct6100ApiGetVersion( - tPOCT6100_API_GET_VERSION f_pApiGetVersion ) -{ - /* Copy API version information to user. */ - Oct6100UserMemCopy( f_pApiGetVersion->achApiVersion, cOCT6100_API_VERSION, sizeof(cOCT6100_API_VERSION) ); - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetCapacityPins - -Description: Retrieves the Capcity Pins value. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pGetCapacityPins Pointer to the parameters structure needed - by GetCapacityPins(). - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetCapacityPinsDef -UINT32 Oct6100ApiGetCapacityPinsDef( - tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - - f_pGetCapacityPins->pProcessContext = NULL; - f_pGetCapacityPins->ulUserChipId = 0; - f_pGetCapacityPins->ulMemoryType = cOCT6100_MEM_TYPE_DDR; - f_pGetCapacityPins->ulCapacityValue = cOCT6100_INVALID_VALUE; - f_pGetCapacityPins->fEnableMemClkOut = TRUE; - f_pGetCapacityPins->ulMemClkFreq = 133000000; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ApiGetCapacityPins -UINT32 Oct6100ApiGetCapacityPins( - tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ) -{ - - UINT32 ulResult; - - tOCT6100_INSTANCE_API ApiInstance; - - Oct6100UserMemSet(&ApiInstance,0,sizeof(tOCT6100_INSTANCE_API)); - - /*Check parameters*/ - if ( f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_133_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_125_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_117_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_108_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_100_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_92_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_83_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_75_MHZ ) - return cOCT6100_ERR_OPEN_MEM_CLK_FREQ; - - if ( f_pGetCapacityPins->fEnableMemClkOut != TRUE && - f_pGetCapacityPins->fEnableMemClkOut != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_MEM_CLK_OUT; - - if ( f_pGetCapacityPins->ulMemoryType != cOCT6100_MEM_TYPE_SDR && - f_pGetCapacityPins->ulMemoryType != cOCT6100_MEM_TYPE_DDR && - f_pGetCapacityPins->ulMemoryType != cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - return cOCT6100_ERR_OPEN_MEMORY_TYPE; - - - - ApiInstance.pProcessContext = f_pGetCapacityPins->pProcessContext; - - - - ulResult = Oct6100ApiReadCapacity(&ApiInstance, f_pGetCapacityPins); - - - - return ulResult; -} -#endif - -/*************************** PRIVATE FUNCTIONS *****************************/ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadCapacity - -Description: Read the capacity pins using modified functions from the openchip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pChipOpen Pointer to chip configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OCT6100ApiReadCapacity -UINT32 Oct6100ApiReadCapacity( IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - UINT32 ulResult; - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - - /*Read capacity Pins*/ - - - ReadParams.pProcessContext = f_pGetCapacityPins->pProcessContext; - ReadParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*Check the Reset register*/ - ReadParams.ulReadAddress = 0x100; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ((usReadData & 0xFFFF) != 0x0000) - return cOCT6100_ERR_CAP_PINS_INVALID_CHIP_STATE; - - /* Test the CPU registers. */ - ulResult = Oct6100ApiCpuRegisterBistReadCap( f_pApiInstance, f_pGetCapacityPins ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the FC2 PLL. */ - ulResult = Oct6100ApiBootFc2PllReadCap( f_pApiInstance,f_pGetCapacityPins ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the FC1 PLL. */ - ulResult = Oct6100ApiProgramFc1PllReadCap( f_pApiInstance,f_pGetCapacityPins ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR) || - (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - ReadParams.ulReadAddress = 0x168; - } - else - ReadParams.ulReadAddress = 0x166; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - switch (usReadData & 0xF) - { - case 0x9: - f_pGetCapacityPins->ulCapacityValue = 16; - break; - case 0x8: - f_pGetCapacityPins->ulCapacityValue = 32; - break; - case 0xE: - f_pGetCapacityPins->ulCapacityValue = 64; - break; - case 0x0: - f_pGetCapacityPins->ulCapacityValue = 128; - break; - case 0x2: - f_pGetCapacityPins->ulCapacityValue = 256; - break; - case 0x5: - f_pGetCapacityPins->ulCapacityValue = 512; - break; - case 0x6: - f_pGetCapacityPins->ulCapacityValue = 672; - break; - default: - f_pGetCapacityPins->ulCapacityValue = (usReadData & 0xF); - return cOCT6100_ERR_CAP_PINS_INVALID_CAPACITY_VALUE; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChipConfiguration - -Description: Checks the user chip configuration structure for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pChipOpen Pointer to chip configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChipConfiguration -UINT32 Oct6100ApiCheckChipConfiguration( - IN tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - UINT32 ulTempVar; - UINT32 i; - - /*-----------------------------------------------------------------------------*/ - /* Check general parameters. */ - if ( f_pChipOpen->fMultiProcessSystem != TRUE && - f_pChipOpen->fMultiProcessSystem != FALSE ) - return cOCT6100_ERR_OPEN_MULTI_PROCESS_SYSTEM; - - if ( f_pChipOpen->ulMaxRwAccesses < 1 || - f_pChipOpen->ulMaxRwAccesses > 1024) - return cOCT6100_ERR_OPEN_MAX_RW_ACCESSES; - - /* Check the clocks. */ - if ( f_pChipOpen->ulUpclkFreq != cOCT6100_UPCLK_FREQ_33_33_MHZ ) - return cOCT6100_ERR_OPEN_UP_CLK_FREQ; - - if ( f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_133_MHZ ) - return cOCT6100_ERR_OPEN_MEM_CLK_FREQ; - - if ( f_pChipOpen->fEnableMemClkOut != TRUE && - f_pChipOpen->fEnableMemClkOut != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_MEM_CLK_OUT; - - /* Check the image file. */ - if ( f_pChipOpen->ulImageSize < cOCT6100_MIN_IMAGE_SIZE || - f_pChipOpen->ulImageSize > cOCT6100_MAX_IMAGE_SIZE ) - return cOCT6100_ERR_OPEN_IMAGE_SIZE; - - if ( f_pChipOpen->pbyImageFile == NULL ) - return cOCT6100_ERR_OPEN_IMAGE_FILE; - - ulTempVar = Oct6100ApiCheckImageFileHeader(f_pChipOpen); - if (ulTempVar != cOCT6100_ERR_OK) - return ulTempVar; - - /* Check the acoustic echo activation flag. */ - if ( f_pChipOpen->fEnableAcousticEcho != TRUE && - f_pChipOpen->fEnableAcousticEcho != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_ACOUSTIC_ECHO; - - /* Check the tail displacement parameter. */ - if ( f_pChipOpen->ulTailDisplacement > cOCT6100_MAX_TAIL_DISPLACEMENT ) - return cOCT6100_ERR_OPEN_TAIL_DISPLACEMENT; - - /*-----------------------------------------------------------------------------*/ - /* Check TDM bus configuration parameters. */ - for ( i = 0; i < 8; i++ ) - { - if ( f_pChipOpen->aulTdmStreamFreqs[ i ] != cOCT6100_TDM_STREAM_FREQ_2MHZ && - f_pChipOpen->aulTdmStreamFreqs[ i ] != cOCT6100_TDM_STREAM_FREQ_4MHZ && - f_pChipOpen->aulTdmStreamFreqs[ i ] != cOCT6100_TDM_STREAM_FREQ_8MHZ) - return cOCT6100_ERR_OPEN_TDM_STREAM_FREQS; - } - - if ( f_pChipOpen->ulTdmSampling != cOCT6100_TDM_SAMPLE_AT_3_QUARTERS && - f_pChipOpen->ulTdmSampling != cOCT6100_TDM_SAMPLE_AT_RISING_EDGE && - f_pChipOpen->ulTdmSampling != cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE ) - return cOCT6100_ERR_OPEN_TDM_SAMPLING; - - if ( f_pChipOpen->fEnableFastH100Mode != TRUE && - f_pChipOpen->fEnableFastH100Mode != FALSE ) - return cOCT6100_ERR_OPEN_FAST_H100_MODE; - - /*-----------------------------------------------------------------------------*/ - /* Check external memory configuration parameters. */ - if ( f_pChipOpen->ulMemoryType != cOCT6100_MEM_TYPE_SDR && - f_pChipOpen->ulMemoryType != cOCT6100_MEM_TYPE_DDR && - f_pChipOpen->ulMemoryType != cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - return cOCT6100_ERR_OPEN_MEMORY_TYPE; - - if ( f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_8MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_16MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_32MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_64MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_128MB ) - return cOCT6100_ERR_OPEN_MEMORY_CHIP_SIZE; - - if ( f_pChipOpen->ulMemoryChipSize == cOCT6100_MEMORY_CHIP_SIZE_8MB && - f_pChipOpen->ulMemoryType == cOCT6100_MEM_TYPE_DDR ) - return cOCT6100_ERR_OPEN_MEMORY_CHIP_SIZE; - - if ( f_pChipOpen->ulNumMemoryChips < 1 || - f_pChipOpen->ulNumMemoryChips > cOCT6100_MAX_NUM_MEMORY_CHIP ) - return cOCT6100_ERR_OPEN_MEMORY_CHIPS_NUMBER; - - /* Check the total memory size. */ - ulTempVar = f_pChipOpen->ulMemoryChipSize * f_pChipOpen->ulNumMemoryChips; - if ( ulTempVar < cOCT6100_MEMORY_CHIP_SIZE_16MB || - ulTempVar > cOCT6100_MEMORY_CHIP_SIZE_128MB ) - return cOCT6100_ERR_OPEN_TOTAL_MEMORY_SIZE; - - if ( f_pChipOpen->ulMaxTdmStreams != 4 && - f_pChipOpen->ulMaxTdmStreams != 8 && - f_pChipOpen->ulMaxTdmStreams != 16 && - f_pChipOpen->ulMaxTdmStreams != 32 ) - return cOCT6100_ERR_OPEN_MAX_TDM_STREAM; - - if ( f_pChipOpen->ulMaxTdmStreams > 8 && - f_pChipOpen->ulMemClkFreq == cOCT6100_MCLK_FREQ_75_MHZ ) - return cOCT6100_ERR_OPEN_MAX_TDM_STREAM; - - if ( f_pChipOpen->fUseSynchTimestamp != TRUE && - f_pChipOpen->fUseSynchTimestamp != FALSE ) - return cOCT6100_ERR_OPEN_USE_SYNCH_TIMESTAMP; - - if ( f_pChipOpen->fUseSynchTimestamp == TRUE ) - { - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_USE_SYNCH_TIMESTAMP; - } - - /*-----------------------------------------------------------------------------*/ - /* Check soft buffer for tone events size. */ - if ( f_pChipOpen->ulSoftToneEventsBufSize < cOCT6100_NUM_PGSP_EVENT_OUT || - f_pChipOpen->ulSoftToneEventsBufSize > cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT ) - return cOCT6100_ERR_OPEN_SOFT_TONE_EVENT_SIZE; - - if ( f_pChipOpen->fEnableExtToneDetection != TRUE && - f_pChipOpen->fEnableExtToneDetection != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_EXT_TONE_DETECTION; - - if ( f_pChipOpen->fEnable2100StopEvent != TRUE && - f_pChipOpen->fEnable2100StopEvent != FALSE) - return cOCT6100_ERR_OPEN_ENABLE_2100_STOP_EVENT; - - /* Check soft buffer for playout events size. */ - if ( ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) - && ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize < cOCT6100_MIN_BUFFER_PLAYOUT_EVENT || - f_pChipOpen->ulSoftBufferPlayoutEventsBufSize > cOCT6100_MAX_BUFFER_PLAYOUT_EVENT ) ) - return cOCT6100_ERR_OPEN_SOFT_PLAYOUT_STOP_EVENT_SIZE; - - /*-----------------------------------------------------------------------------*/ - /* Check interrupt configuration parameters. */ - if ( f_pChipOpen->ulInterruptPolarity != cOCT6100_ACTIVE_LOW_POLARITY && - f_pChipOpen->ulInterruptPolarity != cOCT6100_ACTIVE_HIGH_POLARITY ) - return cOCT6100_ERR_OPEN_INTERRUPT_POLARITY; - - if ( f_pChipOpen->InterruptConfig.ulFatalGeneralConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_FATAL_GENERAL_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulFatalMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_FATAL_MEMORY_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulErrorMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_ERROR_MEMORY_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulErrorH100Config != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorH100Config != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorH100Config != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_ERROR_H100_CONFIG; - - /* Check the timeout value. */ - if ( f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout < 10 || - f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout > 10000 ) - return cOCT6100_ERR_OPEN_FATAL_MEMORY_TIMEOUT; - - if ( f_pChipOpen->InterruptConfig.ulErrorMemoryTimeout < 10 || - f_pChipOpen->InterruptConfig.ulErrorMemoryTimeout > 10000 ) - return cOCT6100_ERR_OPEN_ERROR_MEMORY_TIMEOUT; - - if ( f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout < 10 || - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout > 10000 ) - return cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_TIMEOUT; - - if ( f_pChipOpen->InterruptConfig.ulErrorH100Timeout < 10 || - f_pChipOpen->InterruptConfig.ulErrorH100Timeout > 10000 ) - return cOCT6100_ERR_OPEN_ERROR_H100_TIMEOUT; - - /*-----------------------------------------------------------------------------*/ - /* Check maximum resources. */ - - switch ( f_pChipOpen->ulMemClkFreq ) - { - case 133000000: - ulTempVar = 672; - break; - case 125000000: - ulTempVar = 624; - break; - case 117000000: - ulTempVar = 576; - break; - case 108000000: - ulTempVar = 528; - break; - case 100000000: - ulTempVar = 480; - break; - case 92000000: - ulTempVar = 432; - break; - case 83000000: - ulTempVar = 384; - break; - case 75000000: - ulTempVar = 336; - break; - default: - return cOCT6100_ERR_FATAL_DA; - } - - if ( f_pChipOpen->ulMaxChannels > ulTempVar ) - return cOCT6100_ERR_OPEN_MAX_ECHO_CHANNELS; - - if ( f_pChipOpen->ulMaxTsiCncts > cOCT6100_MAX_TSI_CNCTS ) - return cOCT6100_ERR_OPEN_MAX_TSI_CNCTS; - - - if ( f_pChipOpen->ulMaxBiDirChannels > 255 ) - return cOCT6100_ERR_OPEN_MAX_BIDIR_CHANNELS; - - if ( f_pChipOpen->ulMaxBiDirChannels > (f_pChipOpen->ulMaxChannels / 2) ) - return cOCT6100_ERR_OPEN_MAX_BIDIR_CHANNELS; - - if ( f_pChipOpen->ulMaxConfBridges > cOCT6100_MAX_CONF_BRIDGE ) - return cOCT6100_ERR_OPEN_MAX_CONF_BRIDGES; - - if ( f_pChipOpen->ulMaxFlexibleConfParticipants > cOCT6100_MAX_FLEX_CONF_PARTICIPANTS ) - return cOCT6100_ERR_OPEN_MAX_FLEXIBLE_CONF_PARTICIPANTS; - - if ( f_pChipOpen->ulMaxPlayoutBuffers > cOCT6100_MAX_PLAYOUT_BUFFERS ) - return cOCT6100_ERR_OPEN_MAX_PLAYOUT_BUFFERS; - - - - if ( f_pChipOpen->ulMaxPhasingTssts > cOCT6100_MAX_PHASING_TSST ) - return cOCT6100_ERR_OPEN_MAX_PHASING_TSSTS; - - if ( f_pChipOpen->ulMaxAdpcmChannels > cOCT6100_MAX_ADPCM_CHANNELS ) - return cOCT6100_ERR_OPEN_MAX_ADPCM_CHANNELS; - - if ( f_pChipOpen->ulMaxRemoteDebugSessions > 256 ) - return cOCT6100_ERR_OPEN_MAX_REMOTE_DEBUG_SESSIONS; - - - - - - /* Check the channel recording flag. */ - if ( f_pChipOpen->fEnableChannelRecording != TRUE && - f_pChipOpen->fEnableChannelRecording != FALSE ) - return cOCT6100_ERR_OPEN_DEBUG_CHANNEL_RECORDING; - - /* Check the enable production BIST flag. */ - if ( ( f_pChipOpen->fEnableProductionBist != TRUE ) - && ( f_pChipOpen->fEnableProductionBist != FALSE ) ) - return cOCT6100_ERR_OPEN_ENABLE_PRODUCTION_BIST; - - /* Check number of loops for the production BIST. */ - if ( f_pChipOpen->fEnableProductionBist == TRUE ) - { - if ( f_pChipOpen->ulNumProductionBistLoops == 0 ) - return cOCT6100_ERR_OPEN_NUM_PRODUCTION_BIST_LOOPS; - - if ( (f_pChipOpen->ulProductionBistMode != cOCT6100_PRODUCTION_BIST_STANDARD) && - (f_pChipOpen->ulProductionBistMode != cOCT6100_PRODUCTION_BIST_SHORT) ) - return cOCT6100_ERR_OPEN_PRODUCTION_BIST_MODE; - } - - /* If the production BIST has been requested, make sure all */ - /* other resources are disabled. */ - if ( f_pChipOpen->fEnableProductionBist == TRUE ) - { - /* All must be disabled. */ - f_pChipOpen->ulMaxChannels = 0; - f_pChipOpen->ulMaxTsiCncts = 0; - f_pChipOpen->fEnableChannelRecording = FALSE; - f_pChipOpen->ulMaxBiDirChannels = 0; - f_pChipOpen->ulMaxConfBridges = 0; - f_pChipOpen->ulMaxPlayoutBuffers = 0; - f_pChipOpen->ulSoftBufferPlayoutEventsBufSize = cOCT6100_INVALID_VALUE; - f_pChipOpen->ulMaxPhasingTssts = 0; - f_pChipOpen->ulMaxAdpcmChannels = 0; - - - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCopyChipConfiguration - -Description: Copies the chip configuration from the user supplied config - structure to the instance structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipOpen Pointer to chip configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCopyChipConfiguration -UINT32 Oct6100ApiCopyChipConfiguration( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - pSharedInfo->ChipConfig.ulUserChipId = f_pChipOpen->ulUserChipId; - pSharedInfo->ChipConfig.fMultiProcessSystem = (UINT8)( f_pChipOpen->fMultiProcessSystem & 0xFF ); - - pSharedInfo->ChipConfig.usMaxRwAccesses = (UINT16)( f_pChipOpen->ulMaxRwAccesses & 0xFFFF ); - - pSharedInfo->ChipConfig.pbyImageFile = f_pChipOpen->pbyImageFile; - pSharedInfo->ChipConfig.ulImageSize = f_pChipOpen->ulImageSize; - - pSharedInfo->ChipConfig.ulMemClkFreq = f_pChipOpen->ulMemClkFreq; - pSharedInfo->ChipConfig.ulUpclkFreq = f_pChipOpen->ulUpclkFreq; - - pSharedInfo->ChipConfig.byMemoryType = (UINT8)( f_pChipOpen->ulMemoryType & 0xFF ); - pSharedInfo->ChipConfig.byNumMemoryChips = (UINT8)( f_pChipOpen->ulNumMemoryChips & 0xFF ); - pSharedInfo->ChipConfig.ulMemoryChipSize = f_pChipOpen->ulMemoryChipSize; - - pSharedInfo->ChipConfig.usTailDisplacement = (UINT16)( f_pChipOpen->ulTailDisplacement & 0xFFFF ); - pSharedInfo->ChipConfig.fEnableAcousticEcho = (UINT8)( f_pChipOpen->fEnableAcousticEcho & 0xFF ); - /* Resource allocation parameters. */ - if ( f_pChipOpen->fEnableChannelRecording == TRUE && f_pChipOpen->ulMaxChannels == 672 ) - pSharedInfo->ChipConfig.usMaxChannels = (UINT16)( ( f_pChipOpen->ulMaxChannels - 1 ) & 0xFFFF ); - else - pSharedInfo->ChipConfig.usMaxChannels = (UINT16)( f_pChipOpen->ulMaxChannels & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxTsiCncts = (UINT16)( f_pChipOpen->ulMaxTsiCncts & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxBiDirChannels = (UINT16)( f_pChipOpen->ulMaxBiDirChannels & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxConfBridges = (UINT16)( f_pChipOpen->ulMaxConfBridges & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants = (UINT16)( f_pChipOpen->ulMaxFlexibleConfParticipants & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxPlayoutBuffers = (UINT16)( f_pChipOpen->ulMaxPlayoutBuffers & 0xFFFF ); - - pSharedInfo->ChipConfig.usMaxPhasingTssts = (UINT16)( f_pChipOpen->ulMaxPhasingTssts & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxAdpcmChannels = (UINT16)( f_pChipOpen->ulMaxAdpcmChannels & 0xFFFF ); - pSharedInfo->ChipConfig.byMaxTdmStreams = (UINT8)( f_pChipOpen->ulMaxTdmStreams & 0xFF ); - pSharedInfo->ChipConfig.fUseSynchTimestamp = (UINT8)( f_pChipOpen->fUseSynchTimestamp & 0xFF ); - for ( i = 0; i < 4; i++ ) - { - pSharedInfo->ChipConfig.ausTimestampTimeslots[ i ] = (UINT16)( f_pChipOpen->aulTimestampTimeslots[ i ] & 0xFFFF ); - pSharedInfo->ChipConfig.ausTimestampStreams[ i ] = (UINT16)( f_pChipOpen->aulTimestampStreams[ i ] & 0xFFFF ); - } - pSharedInfo->ChipConfig.byInterruptPolarity = (UINT8)( f_pChipOpen->ulInterruptPolarity & 0xFF ); - - pSharedInfo->ChipConfig.byTdmSampling = (UINT8)( f_pChipOpen->ulTdmSampling & 0xFF ); - pSharedInfo->ChipConfig.fEnableFastH100Mode = (UINT8)( f_pChipOpen->fEnableFastH100Mode & 0xFF ); - - for ( i = 0; i < cOCT6100_TDM_STREAM_MAX_GROUPS; i++ ) - { - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->ChipConfig.aulTdmStreamFreqs[ i ] = cOCT6100_TDM_STREAM_FREQ_16MHZ; - else - pSharedInfo->ChipConfig.aulTdmStreamFreqs[ i ] = f_pChipOpen->aulTdmStreamFreqs[ i ]; - } - - pSharedInfo->ChipConfig.fEnableFastH100Mode = (UINT8)( f_pChipOpen->fEnableFastH100Mode & 0xFF ); - pSharedInfo->ChipConfig.fEnableMemClkOut = (UINT8)( f_pChipOpen->fEnableMemClkOut & 0xFF ); - - /* Add 1 to the circular buffer such that all user requested events can fit in the circular queue. */ - pSharedInfo->ChipConfig.ulSoftToneEventsBufSize = f_pChipOpen->ulSoftToneEventsBufSize + 1; - pSharedInfo->ChipConfig.fEnableExtToneDetection = (UINT8)( f_pChipOpen->fEnableExtToneDetection & 0xFF ); - pSharedInfo->ChipConfig.fEnable2100StopEvent = (UINT8)( f_pChipOpen->fEnable2100StopEvent & 0xFF ); - - if ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) - pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize = f_pChipOpen->ulSoftBufferPlayoutEventsBufSize + 1; - else - pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize = 0; - pSharedInfo->ChipConfig.usMaxRemoteDebugSessions = (UINT16)( f_pChipOpen->ulMaxRemoteDebugSessions & 0xFFFF ); - - pSharedInfo->ChipConfig.fEnableChannelRecording = (UINT8)( f_pChipOpen->fEnableChannelRecording & 0xFF ); - - - - pSharedInfo->ChipConfig.fEnableProductionBist = (UINT8)( f_pChipOpen->fEnableProductionBist & 0xFF ); - pSharedInfo->ChipConfig.ulProductionBistMode = f_pChipOpen->ulProductionBistMode; - pSharedInfo->ChipConfig.ulNumProductionBistLoops = f_pChipOpen->ulNumProductionBistLoops; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitializeMiscellaneousVariables - -Description: Function where all the various parameters from the API instance - are set to their defaults value. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitializeMiscellaneousVariables -UINT32 Oct6100ApiInitializeMiscellaneousVariables( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 i; - - /* Obtain pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Calculate the total memory available. */ - pSharedInfo->MiscVars.ulTotalMemSize = pSharedInfo->ChipConfig.ulMemoryChipSize * pSharedInfo->ChipConfig.byNumMemoryChips; - - /* Software buffers initialization. */ - - /* Tones */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - pSharedInfo->SoftBufs.ulToneEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulToneEventBufferSize = pSharedInfo->ChipConfig.ulSoftToneEventsBufSize; - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt = 0; - - /* Playout */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize = pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt = 0; - - /* Set the number of conference bridges opened to zero. */ - pSharedInfo->MiscVars.usNumBridgesOpened = 0; - pSharedInfo->MiscVars.usFirstBridge = cOCT6100_INVALID_INDEX; - - /* Set the H.100 slave mode. */ - pSharedInfo->MiscVars.ulH100SlaveMode = cOCT6100_H100_TRACKA; - - /* Save the Mclk value.*/ - pSharedInfo->MiscVars.ulMclkFreq = pSharedInfo->ChipConfig.ulMemClkFreq; - - /* Init the NLP params. */ - pSharedInfo->MiscVars.usCodepoint = 0; - pSharedInfo->MiscVars.usCpuLsuWritePtr = 0; - - /* Pouch counter not present until TLVs are read. */ - pSharedInfo->DebugInfo.fPouchCounter = FALSE; - pSharedInfo->DebugInfo.fIsIsrCalledField = FALSE; - - /* Initialize the image info parameters */ - pSharedInfo->ImageInfo.fAdaptiveNoiseReduction = FALSE; - pSharedInfo->ImageInfo.fSoutNoiseBleaching = FALSE; - pSharedInfo->ImageInfo.fComfortNoise = FALSE; - pSharedInfo->ImageInfo.fBufferPlayout = TRUE; - pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip = FALSE; - pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip = FALSE; - pSharedInfo->ImageInfo.fNlpControl = FALSE; - pSharedInfo->ImageInfo.fRinAutoLevelControl = FALSE; - pSharedInfo->ImageInfo.fSoutAutoLevelControl = FALSE; - pSharedInfo->ImageInfo.fRinHighLevelCompensation = FALSE; - pSharedInfo->ImageInfo.fSoutHighLevelCompensation = FALSE; - pSharedInfo->ImageInfo.fAlcHlcStatus = FALSE; - pSharedInfo->ImageInfo.fRinDcOffsetRemoval = FALSE; - pSharedInfo->ImageInfo.fSilenceSuppression = FALSE; - pSharedInfo->ImageInfo.fSinDcOffsetRemoval = FALSE; - pSharedInfo->ImageInfo.fToneDisabler = FALSE; - pSharedInfo->ImageInfo.fAdpcm = FALSE; - pSharedInfo->ImageInfo.fTailDisplacement = FALSE; - pSharedInfo->ImageInfo.fConferencing = FALSE; - pSharedInfo->ImageInfo.fConferencingNoiseReduction = FALSE; - pSharedInfo->ImageInfo.fDominantSpeakerEnabled = FALSE; - pSharedInfo->ImageInfo.fAecEnabled = FALSE; - pSharedInfo->ImageInfo.fAcousticEcho = FALSE; - pSharedInfo->ImageInfo.fToneRemoval = FALSE; - - pSharedInfo->ImageInfo.fDefaultErl = FALSE; - pSharedInfo->ImageInfo.fMaxEchoPoint = FALSE; - pSharedInfo->ImageInfo.fNonLinearityBehaviorA = FALSE; - pSharedInfo->ImageInfo.fNonLinearityBehaviorB = FALSE; - pSharedInfo->ImageInfo.fPerChannelTailDisplacement = FALSE; - pSharedInfo->ImageInfo.fPerChannelTailLength = FALSE; - pSharedInfo->ImageInfo.fAfTailDisplacement = FALSE; - pSharedInfo->ImageInfo.fMusicProtection = FALSE; - pSharedInfo->ImageInfo.fAftControl = FALSE; - pSharedInfo->ImageInfo.fSinVoiceDetectedStat = FALSE; - pSharedInfo->ImageInfo.fRinAppliedGainStat = FALSE; - pSharedInfo->ImageInfo.fSoutAppliedGainStat = FALSE; - pSharedInfo->ImageInfo.fListenerEnhancement = FALSE; - pSharedInfo->ImageInfo.fRoutNoiseReduction = FALSE; - pSharedInfo->ImageInfo.fRoutNoiseReductionLevel = FALSE; - pSharedInfo->ImageInfo.fAnrSnrEnhancement = FALSE; - pSharedInfo->ImageInfo.fAnrVoiceNoiseSegregation = FALSE; - pSharedInfo->ImageInfo.fRinMute = FALSE; - pSharedInfo->ImageInfo.fSinMute = FALSE; - pSharedInfo->ImageInfo.fToneDisablerVqeActivationDelay = FALSE; - pSharedInfo->ImageInfo.fAecTailLength = FALSE; - pSharedInfo->ImageInfo.fMusicProtectionConfiguration= FALSE; - pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents = FALSE; - pSharedInfo->ImageInfo.fRinEnergyStat = FALSE; - pSharedInfo->ImageInfo.fSoutEnergyStat = FALSE; - pSharedInfo->ImageInfo.fDoubleTalkBehavior = FALSE; - pSharedInfo->ImageInfo.fDoubleTalkBehaviorFieldOfst = FALSE; - pSharedInfo->ImageInfo.fIdleCodeDetection = TRUE; - pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration = FALSE; - pSharedInfo->ImageInfo.fSinLevel = TRUE; - - pSharedInfo->ImageInfo.usMaxNumberOfChannels = 0; - pSharedInfo->ImageInfo.ulToneProfileNumber = cOCT6100_INVALID_VALUE; - pSharedInfo->ImageInfo.ulBuildId = cOCT6100_INVALID_VALUE; - pSharedInfo->ImageInfo.byImageType = cOCT6100_IMAGE_TYPE_WIRELINE; - pSharedInfo->ImageInfo.usMaxTailDisplacement = 0; - pSharedInfo->ImageInfo.usMaxTailLength = cOCT6100_TAIL_LENGTH_128MS; - pSharedInfo->DebugInfo.ulDebugEventSize = 0x100; - pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents = 32; - pSharedInfo->DebugInfo.ulMatrixBaseAddress = cOCT6100_MATRIX_DWORD_BASE; - pSharedInfo->DebugInfo.ulDebugChanStatsByteSize = cOCT6100_DEBUG_CHAN_STATS_EVENT_BYTE_SIZE; - pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize = cOCT6100_DEBUG_CHAN_STATS_LITE_EVENT_BYTE_SIZE; - pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress= cOCT6100_MATRIX_CHAN_SELECT_DWORD_ADD; - pSharedInfo->DebugInfo.ulMatrixTimestampBaseAddress = cOCT6100_MATRIX_TIMESTAMP_DWORD_ADD; - pSharedInfo->DebugInfo.ulMatrixWpBaseAddress = cOCT6100_MATRIX_WRITE_PTR_DWORD_ADD; - pSharedInfo->DebugInfo.ulAfWritePtrByteOffset = 206; - pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize = 4096; - pSharedInfo->DebugInfo.ulAfEventCbByteSize = 0x100000; - - /* Set all tones to invalid. */ - pSharedInfo->ImageInfo.byNumToneDetectors = 0; - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - pSharedInfo->ImageInfo.aToneInfo[ i ].ulToneID = cOCT6100_INVALID_VALUE; - pSharedInfo->ImageInfo.aToneInfo[ i ].ulDetectionPort = cOCT6100_INVALID_PORT; - Oct6100UserMemSet( pSharedInfo->ImageInfo.aToneInfo[ i ].aszToneName, 0x00, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - } - /* Initialize the channel recording info. */ - pSharedInfo->DebugInfo.usRecordChanIndex = pSharedInfo->ChipConfig.usMaxChannels; - pSharedInfo->DebugInfo.usRecordMemIndex = cOCT6100_INVALID_INDEX; - - pSharedInfo->DebugInfo.usCurrentDebugChanIndex = cOCT6100_INVALID_INDEX; - /* Initialize the mixer information. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - - pSharedInfo->MixerInfo.usRecordCopyEventIndex = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usRecordSinEventIndex = cOCT6100_INVALID_INDEX; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCalculateInstanceSizes - -Description: Calculates the amount of memory needed for the instance - structure memory block based on the user's configuration. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pChipOpen Pointer to user chip configuration structure. - -f_pInstSizes Pointer to structure containing the size of memory needed - by all pointers internal to the API instance. The memory - is needed to keep track of the present state of all the - chip's resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCalculateInstanceSizes -UINT32 Oct6100ApiCalculateInstanceSizes( - IN OUT tPOCT6100_CHIP_OPEN f_pChipOpen, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulApiInstProcessSpecific; - UINT32 ulTempVar; - UINT32 ulResult; - - /* Start with all instance sizes set to 0. */ - Oct6100UserMemSet( f_pInstSizes, 0x00, sizeof( tOCT6100_API_INSTANCE_SIZES ) ); - - /* All memory sizes are rounded up to the next multiple of 64 bytes. */ - - /*-----------------------------------------------------------------------------*/ - /* Obtain size of static members of API instance. */ - f_pInstSizes->ulApiInstStatic = sizeof( tOCT6100_SHARED_INFO ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulApiInstStatic, ulTempVar ) - - /* Calculate memory needed by pointers internal to the API instance. */ - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the EC channels. */ - ulResult = Oct6100ApiGetChannelsEchoSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Memory needed by the TSI structures. */ - ulResult = Oct6100ApiGetTsiCnctSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the conference bridges. */ - ulResult = Oct6100ApiGetConfBridgeSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Memory needed by the buffer playout structures. */ - ulResult = Oct6100ApiGetPlayoutBufferSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - /*-----------------------------------------------------------------------------*/ - /* Memory needed by soft Rx Event buffers. */ - ulResult = Oct6100ApiGetEventsSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for phasing tssts. */ - ulResult = Oct6100ApiGetPhasingTsstSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the ADPCM channels. */ - ulResult = Oct6100ApiGetAdpcmChanSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the management of TSSTs. */ - ulResult = Oct6100ApiGetTsstSwSizes( f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the management of the mixer. */ - ulResult = Oct6100ApiGetMixerSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Determine amount of memory needed for memory allocation softwares. These - pieces of software will be responsible for the allocation of the chip's - external memory and API memory. */ - ulResult = Oct6100ApiGetMemorySwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Memory needed for remote debugging sessions. */ - ulResult = Oct6100ApiGetRemoteDebugSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate total memory needed by pointers internal to API instance. The - total contains both the process specific portion of the instance - (tOCT6100_INSTANCE_API) and the shared portion (tOCT6100_SHARED_INFO). The - process specific portion will be used only in the case where the host system - is a single-process one. */ - - ulApiInstProcessSpecific = sizeof( tOCT6100_INSTANCE_API ); - mOCT6100_ROUND_MEMORY_SIZE( ulApiInstProcessSpecific, ulTempVar ) - - f_pInstSizes->ulApiInstTotal = - f_pInstSizes->ulChannelList + - f_pInstSizes->ulChannelAlloc + - f_pInstSizes->ulTsiCnctList + - f_pInstSizes->ulTsiCnctAlloc + - f_pInstSizes->ulSoftToneEventsBuffer + - f_pInstSizes->ulSoftBufPlayoutEventsBuffer + - f_pInstSizes->ulBiDirChannelList + - f_pInstSizes->ulBiDirChannelAlloc + - f_pInstSizes->ulConfBridgeList + - f_pInstSizes->ulConfBridgeAlloc + - f_pInstSizes->ulFlexConfParticipantsList + - f_pInstSizes->ulFlexConfParticipantsAlloc + - f_pInstSizes->ulPlayoutBufList + - f_pInstSizes->ulPlayoutBufAlloc + - f_pInstSizes->ulPlayoutBufMemoryNodeList + - - f_pInstSizes->ulCopyEventList + - f_pInstSizes->ulCopyEventAlloc + - f_pInstSizes->ulMixerEventList + - f_pInstSizes->ulMixerEventAlloc + - f_pInstSizes->ulPhasingTsstList + - f_pInstSizes->ulPhasingTsstAlloc + - f_pInstSizes->ulAdpcmChannelList + - f_pInstSizes->ulAdpcmChannelAlloc + - f_pInstSizes->ulConversionMemoryAlloc + - f_pInstSizes->ulTsiMemoryAlloc + - f_pInstSizes->ulRemoteDebugList + - f_pInstSizes->ulRemoteDebugTree + - f_pInstSizes->ulRemoteDebugPktCache + - f_pInstSizes->ulRemoteDebugDataBuf + - f_pInstSizes->ulTsstEntryList + - f_pInstSizes->ulTsstEntryAlloc + - f_pInstSizes->ulTsstAlloc + - f_pInstSizes->ulApiInstStatic + - ulApiInstProcessSpecific; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAllocateInstanceMemory - -Description: Allocates the API instance memory to the various members of - the structure f_pApiInstance according to the sizes contained - in f_pInstSizes. No initialization of this memory is - performed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pInstSizes Pointer to structure containing the size of memory needed - by all pointers internal to the API instance. The memory - is needed to keep track of the present state of all the - chip's resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAllocateInstanceMemory -UINT32 Oct6100ApiAllocateInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulOffset; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get address of first UINT32 of memory in API instance structure following */ - /* the static members of the API instance structure. */ - ulOffset = f_pInstSizes->ulApiInstStatic; - - /*===================================================================*/ - /* Allocate memory for the echo channels.*/ - pSharedInfo->ulChannelListOfst = ulOffset; - ulOffset += f_pInstSizes->ulChannelList; - pSharedInfo->ulChannelAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulChannelAlloc; - - /*===================================================================*/ - /* Allocate memory for the TSI connections */ - pSharedInfo->ulTsiCnctListOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsiCnctList; - pSharedInfo->ulTsiCnctAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsiCnctAlloc; - pSharedInfo->ulMixerEventListOfst = ulOffset; - ulOffset += f_pInstSizes->ulMixerEventList; - pSharedInfo->ulMixerEventAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulMixerEventAlloc; - - pSharedInfo->ulBiDirChannelListOfst = ulOffset; - ulOffset += f_pInstSizes->ulBiDirChannelList; - pSharedInfo->ulBiDirChannelAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulBiDirChannelAlloc; - pSharedInfo->ulCopyEventListOfst = ulOffset; - ulOffset += f_pInstSizes->ulCopyEventList; - pSharedInfo->ulCopyEventAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulCopyEventAlloc; - - /*===================================================================*/ - /* Allocate memory for the conference bridges */ - pSharedInfo->ulConfBridgeListOfst = ulOffset; - ulOffset += f_pInstSizes->ulConfBridgeList; - pSharedInfo->ulConfBridgeAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulConfBridgeAlloc; - - /*===================================================================*/ - /* Allocate memory for the flexible conferencing participants. */ - pSharedInfo->ulFlexConfParticipantListOfst = ulOffset; - ulOffset += f_pInstSizes->ulFlexConfParticipantsList; - pSharedInfo->ulFlexConfParticipantAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulFlexConfParticipantsAlloc; - - /*===================================================================*/ - /* Allocate memory for the play-out buffers */ - pSharedInfo->ulPlayoutBufListOfst = ulOffset; - ulOffset += f_pInstSizes->ulPlayoutBufList; - pSharedInfo->ulPlayoutBufAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulPlayoutBufAlloc; - pSharedInfo->ulPlayoutBufMemoryNodeListOfst = ulOffset; - ulOffset += f_pInstSizes->ulPlayoutBufMemoryNodeList; - - - - /*===================================================================*/ - /* Allocate memory for the phasing TSSTs */ - pSharedInfo->ulPhasingTsstListOfst = ulOffset; - ulOffset += f_pInstSizes->ulPhasingTsstList; - pSharedInfo->ulPhasingTsstAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulPhasingTsstAlloc; - - /*===================================================================*/ - /* Allocate memory for the ADPCM channel */ - pSharedInfo->ulAdpcmChanAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulAdpcmChannelAlloc; - pSharedInfo->ulAdpcmChanListOfst = ulOffset; - ulOffset += f_pInstSizes->ulAdpcmChannelList; - - /*===================================================================*/ - /* Allocate memory for the conversion memory */ - pSharedInfo->ulConversionMemoryAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulConversionMemoryAlloc; - - /*===================================================================*/ - /* Allocate memory for the TSI chariot memory */ - pSharedInfo->ulTsiMemoryAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsiMemoryAlloc; - - /*===================================================================*/ - /* Allocate memory for the TSST management */ - pSharedInfo->ulTsstAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsstAlloc; - pSharedInfo->ulTsstListOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsstEntryList; - pSharedInfo->ulTsstListAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsstEntryAlloc; - - /*===================================================================*/ - pSharedInfo->SoftBufs.ulToneEventBufferMemOfst = ulOffset; - ulOffset += f_pInstSizes->ulSoftToneEventsBuffer; - - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferMemOfst = ulOffset; - ulOffset += f_pInstSizes->ulSoftBufPlayoutEventsBuffer; - /*===================================================================*/ - pSharedInfo->RemoteDebugInfo.ulSessionListOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugList; - - pSharedInfo->RemoteDebugInfo.ulSessionTreeOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugTree; - - pSharedInfo->RemoteDebugInfo.ulDataBufOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugDataBuf; - - pSharedInfo->RemoteDebugInfo.ulPktCacheOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugPktCache; - /*===================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitializeInstanceMemory - -Description: Initializes the various members of the structure f_pApiInstance - to reflect the current state of the chip and its resources. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitializeInstanceMemory -UINT32 Oct6100ApiInitializeInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - UINT32 ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize API EC channels. */ - ulResult = Oct6100ApiChannelsEchoSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Initialize the API TSI connection structures. */ - ulResult = Oct6100ApiTsiCnctSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Initialize the API conference bridges. */ - ulResult = Oct6100ApiConfBridgeSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the API buffer playout structures. */ - ulResult = Oct6100ApiPlayoutBufferSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the API phasing tssts. */ - ulResult = Oct6100ApiPhasingTsstSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Initialize the API ADPCM channels. */ - ulResult = Oct6100ApiAdpcmChanSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the external memory management structures. */ - ulResult = Oct6100ApiMemorySwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize TSST management stuctures. */ - ulResult = Oct6100ApiTsstSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the mixer management stuctures. */ - ulResult = Oct6100ApiMixerSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the remote debugging session management variables. */ - ulResult = Oct6100ApiRemoteDebuggingSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Configure the interrupt registers. */ - ulResult = Oct6100ApiIsrSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetChipRevisionNum - -Description: Reads the chip's revision number register. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetChipRevisionNum -UINT32 Oct6100ApiGetChipRevisionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the chip revision number. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.ulReadAddress = cOCT6100_CHIP_ID_REVISION_REG; - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save the info in the API miscellaneous structure. */ - pSharedInfo->MiscVars.usChipId = (UINT16)( usReadData & 0xFF ); - pSharedInfo->MiscVars.usChipRevision = (UINT16)( usReadData >> 8 ); - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckImageFileHeader - -Description: This function check if the image loaded is valid - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckImageFileHeader -UINT32 Oct6100ApiCheckImageFileHeader( - IN tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - - PUINT8 pszImageInfoStart = NULL; - UINT32 ulStrLen; - - ulStrLen = Oct6100ApiStrLen( (PUINT8)cOCT6100_IMAGE_START_STRING ); - pszImageInfoStart = (PUINT8) Oct6100ApiStrStr(f_pChipOpen->pbyImageFile,(PUINT8)cOCT6100_IMAGE_START_STRING, - f_pChipOpen->pbyImageFile + ulStrLen); - if (pszImageInfoStart == NULL) - return cOCT6100_ERR_OPEN_IMAGE_FILE; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiDecodeKeyAndBist - -Description: This function decodes the key and runs the automatic BIST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiDecodeKeyAndBist -UINT32 Oct6100ApiDecodeKeyAndBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT16 ausBistData[ 3 ]; - UINT16 usReadData; - UINT32 ulResult; - BOOL fBitEqual; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a local pointer to the chip config structure */ - /* contained in the instance structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Set the process context and user chip ID parameters once and for all. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Write key in CPU internal memory. */ - for(i=0; i<8; i++) - { - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0x0000; - if (( i % 2 ) == 0) - { - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 2]) << 8; - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 3]) << 0; - } - else - { - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 0]) << 8; - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 1]) << 0; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x152; - WriteParams.usWriteData = (UINT16)( 0x8000 | i ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Write one in CPU internal memory. */ - for(i=0; i<8; i++) - { - WriteParams.ulWriteAddress = 0x150; - if (i == 0) - { - WriteParams.usWriteData = 0x0001; - } - else - { - WriteParams.usWriteData = 0x0000; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x152; - WriteParams.usWriteData = (UINT16)( 0x8000 | ( i + 8 )); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Clear memory access registers: */ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x152; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Run BISTs and key decode. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0081; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for the key decode PC to clear. */ - ulResult = Oct6100ApiWaitForPcRegisterBit( f_pApiInstance, 0x160, 0, 0, 100000, &fBitEqual ); - if ( TRUE != fBitEqual ) - return cOCT6100_ERR_FATAL_13; - - /* Read the key valid bit to make sure everything is ok. */ - ReadParams.ulReadAddress = 0x160; - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Either the firmware image was not loaded correctly (from pointer given by user) */ - /* or the channel capacity pins of the chip do not match what the firmware is expecting. */ - if ( ( usReadData & 0x4 ) == 0 ) - return cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS; - - /* Read the result of the internal memory bist. */ - ReadParams.ulReadAddress = 0x110; - ReadParams.pusReadData = &ausBistData[ 0 ]; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress = 0x114; - ReadParams.pusReadData = &ausBistData[ 1 ]; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress = 0x118; - ReadParams.pusReadData = &ausBistData[ 2 ]; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if an error was reported. */ - if (ausBistData[0] != 0x0000 || ausBistData[1] != 0x0000 || ausBistData[2] != 0x0000) - return cOCT6100_ERR_OPEN_INTERNAL_MEMORY_BIST; - - /* Put key decoder in powerdown. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x008A; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootFc2PllReadCap - -Description: Configures the chip's FC2 PLL. Special version for GetcapacityPins. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100ApiBootFc2PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - UINT32 ulFc2PllDivisor = 0; - UINT32 ulMtDivisor = 0; - UINT32 ulFcDivisor = 0; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pGetCapacityPins->pProcessContext; - - WriteParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - /* First put the chip and main registers in soft-reset. */ - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulFc2PllDivisor = 0x1050; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - - /* Setup delay chains. */ - if ( (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR) || (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - /* SDRAM */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x4030; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( cOCT6100_MEM_TYPE_DDR == pChipConfig->byMemoryType ) */ - { - /* DDR */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x201F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* udqs */ - WriteParams.ulWriteAddress = 0x1B8; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BA; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* ldqs */ - WriteParams.ulWriteAddress = 0x1BC; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BE; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12C; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12E; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select fc2pll for fast_clk and mtsclk sources. Select mem_clk_i for afclk. */ - WriteParams.ulWriteAddress = 0x140; - WriteParams.usWriteData = (UINT16)ulMtDivisor; - - if ( f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData |= 0x0001; - else - WriteParams.usWriteData |= 0x0004; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x144; - WriteParams.usWriteData = (UINT16)ulFcDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x13E; - WriteParams.usWriteData = 0x0001; /* Remove reset from above divisors */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select upclk directly as ref source for fc2pll. */ - WriteParams.ulWriteAddress = 0x134; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Setup fc2pll. */ - WriteParams.ulWriteAddress = 0x132; - WriteParams.usWriteData = (UINT16)ulFc2PllDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x02; /* Raise fb divisor reset. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x80; /* Raise IDDTN signal.*/ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc2pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Drive mem_clk_o out on proper interface. */ - if ( TRUE == f_pGetCapacityPins->fEnableMemClkOut ) - { - if ( (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR) || (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - WriteParams.ulWriteAddress = 0x128; - WriteParams.usWriteData = 0x0301; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_DDR || f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - { - WriteParams.ulWriteAddress = 0x12A; - WriteParams.usWriteData = 0x000F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootFc2Pll - -Description: Configures the chip's FC2 PLL. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBootFc2Pll -UINT32 Oct6100ApiBootFc2Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - UINT32 ulFc2PllDivisor = 0; - UINT32 ulMtDivisor = 0; - UINT32 ulFcDivisor = 0; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to chip configuration structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* First put the chip and main registers in soft-reset. */ - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select register configuration based on the memory frequency. */ - switch ( f_pApiInstance->pSharedInfo->ChipConfig.ulMemClkFreq ) - { - case 133000000: - ulFc2PllDivisor = 0x1050; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 672; - pSharedInfo->MiscVars.usMaxH100Speed = 124; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x050B; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0516; - - break; - case 125000000: - ulFc2PllDivisor = 0x0F50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 624; - pSharedInfo->MiscVars.usMaxH100Speed = 116; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x04CA; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x04D4; - - break; - case 117000000: - ulFc2PllDivisor = 0x0E50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 576; - pSharedInfo->MiscVars.usMaxH100Speed = 108; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0489; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0492; - - break; - case 108000000: - ulFc2PllDivisor = 0x0D50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 528; - pSharedInfo->MiscVars.usMaxH100Speed = 99; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0408; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0410; - - break; - case 100000000: - ulFc2PllDivisor = 0x0C50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 480; - pSharedInfo->MiscVars.usMaxH100Speed = 91; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x03C8; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x03D0; - - break; - case 92000000: - ulFc2PllDivisor = 0x0B50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 432; - pSharedInfo->MiscVars.usMaxH100Speed = 83; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0387; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x038E; - - break; - case 83000000: - ulFc2PllDivisor = 0x0A50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 384; - pSharedInfo->MiscVars.usMaxH100Speed = 74; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0346; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x034C; - - break; - case 75000000: - ulFc2PllDivisor = 0x0950; - ulMtDivisor = 0x4200; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 336; - pSharedInfo->MiscVars.usMaxH100Speed = 64; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0306; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x030C; - - break; - default: - return cOCT6100_ERR_FATAL_DB; - } - - /* Verify that the max channel is not too big based on the chip frequency. */ - if ( pSharedInfo->ChipConfig.usMaxChannels > pSharedInfo->MiscVars.usMaxNumberOfChannels ) - return cOCT6100_ERR_OPEN_MAX_ECHO_CHANNELS; - - /* Setup delay chains. */ - if ( (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR) || (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - /* SDRAM */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x4030; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( cOCT6100_MEM_TYPE_DDR == pChipConfig->byMemoryType ) */ - { - /* DDR */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x201F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* udqs */ - WriteParams.ulWriteAddress = 0x1B8; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BA; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* ldqs */ - WriteParams.ulWriteAddress = 0x1BC; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BE; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12C; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12E; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select fc2pll for fast_clk and mtsclk sources. Select mem_clk_i for afclk. */ - WriteParams.ulWriteAddress = 0x140; - WriteParams.usWriteData = (UINT16)ulMtDivisor; - - if ( f_pApiInstance->pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData |= 0x0001; - else - WriteParams.usWriteData |= 0x0004; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x144; - WriteParams.usWriteData = (UINT16)ulFcDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x13E; - WriteParams.usWriteData = 0x0001; /* Remove reset from above divisors */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select upclk directly as ref source for fc2pll. */ - WriteParams.ulWriteAddress = 0x134; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Setup fc2pll. */ - WriteParams.ulWriteAddress = 0x132; - WriteParams.usWriteData = (UINT16)ulFc2PllDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x02; /* Raise fb divisor reset. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x80; /* Raise IDDTN signal.*/ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc2pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Drive mem_clk_o out on proper interface. */ - if ( TRUE == pChipConfig->fEnableMemClkOut ) - { - if ( (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR) || (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - WriteParams.ulWriteAddress = 0x128; - WriteParams.usWriteData = 0x0301; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_DDR || pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - { - WriteParams.ulWriteAddress = 0x12A; - WriteParams.usWriteData = 0x000F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProgramFc1PllReadCap - -Description: Configures the chip's FC1 PLL. Special version for getCapacityPins. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100ApiProgramFc1PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - /* Programm P/Z bits. */ - WriteParams.ulWriteAddress = 0x130; - - if ( f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData = 0x0041; - else - WriteParams.usWriteData = 0x0040; - - WriteParams.usWriteData |= ( f_pGetCapacityPins->ulMemoryType << 8 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise FB divisor. */ - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise IDDTN. */ - WriteParams.usWriteData |= 0x0080; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc1pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable all the clock domains to do reset procedure. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x015F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulWaitTime[ 0 ] = 15000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProgramFc1Pll - -Description: Configures the chip's FC1 PLL. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProgramFc1Pll -UINT32 Oct6100ApiProgramFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to chip configuration structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Programm P/Z bits. */ - WriteParams.ulWriteAddress = 0x130; - - if ( f_pApiInstance->pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData = 0x0041; - else - WriteParams.usWriteData = 0x0040; - - WriteParams.usWriteData |= ( pChipConfig->byMemoryType << 8 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise FB divisor. */ - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise IDDTN. */ - WriteParams.usWriteData |= 0x0080; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc1pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable all the clock domains to do reset procedure. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x015F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulWaitTime[ 0 ] = 15000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootFc1Pll - -Description: Boot the chip's FC1 PLL. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBootFc1Pll -UINT32 Oct6100ApiBootFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to chip configuration structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Force bist_clk also (it too is used on resetable flops). */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0188; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Force all cpu clocks on chariot controllers. */ - WriteParams.ulWriteAddress = 0x182; - WriteParams.usWriteData = 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x184; - WriteParams.usWriteData = 0x0202; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulWaitTime[ 0 ] = 1000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remove the reset on the entire chip and disable CPU access caching. */ - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x2003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remove the bist_clk. It is no longer needed.*/ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0088; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Disable all clks to prepare for bist clock switchover. */ - WriteParams.ulWriteAddress = 0x182; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x184; - WriteParams.usWriteData = 0x0101; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Deassert bist_active */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0008; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Change CPU interface to normal mode (from boot mode). */ - WriteParams.ulWriteAddress = 0x154; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Give a couple of BIST clock cycles to turn off the BIST permanently. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0108; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Turn BIST clock off for the last time. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0008; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reset procedure done! */ - - /* Enable mclk for cpu interface and external memory controller. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x0100; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiLoadImage - -Description: This function writes the firmware image in the external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiLoadImage -UINT32 Oct6100ApiLoadImage( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 ulTempPtr; - UINT32 ulNumWrites; - PUINT16 pusSuperArray; - unsigned char const *pbyImageFile; - UINT32 ulByteCount = 0; - UINT16 usReadData; - UINT32 ulAddressOfst; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Breakdown image into subcomponents. */ - ulTempPtr = cOCT6100_IMAGE_FILE_BASE + cOCT6100_IMAGE_AF_CST_OFFSET; - - for(i=0;iImageRegion[ i ].ulPart1Size = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 0 ]; - pSharedInfo->ImageRegion[ i ].ulPart2Size = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 1 ]; - pSharedInfo->ImageRegion[ i ].ulClockInfo = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 2 ]; - pSharedInfo->ImageRegion[ i ].ulReserved = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 3 ]; - - if (i == 0) /* AF constant. */ - { - pSharedInfo->ImageRegion[ i ].ulPart1BaseAddress = ulTempPtr & 0x07FFFFFF; - pSharedInfo->ImageRegion[ i ].ulPart2BaseAddress = 0; - - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart1Size * 612 ); - } - else if (i == 1) /* NLP image */ - { - pSharedInfo->ImageRegion[ i ].ulPart1BaseAddress = ulTempPtr & 0x07FFFFFF; - pSharedInfo->ImageRegion[ i ].ulPart2BaseAddress = 0; - - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart1Size * 2056 ); - } - else /* Others */ - { - pSharedInfo->ImageRegion[ i ].ulPart1BaseAddress = ulTempPtr & 0x07FFFFFF; - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart1Size * 2064 ); - - pSharedInfo->ImageRegion[ i ].ulPart2BaseAddress = ulTempPtr & 0x07FFFFFF; - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart2Size * 2448 ); - } - } - - /* Write the image in external memory. */ - ulNumWrites = pSharedInfo->ChipConfig.ulImageSize / 2; - - BurstParams.ulWriteAddress = cOCT6100_IMAGE_FILE_BASE; - BurstParams.pusWriteData = pSharedInfo->MiscVars.ausSuperArray; - - pusSuperArray = pSharedInfo->MiscVars.ausSuperArray; - pbyImageFile = pSharedInfo->ChipConfig.pbyImageFile; - - while ( ulNumWrites != 0 ) - { - if ( ulNumWrites >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - BurstParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - BurstParams.ulWriteLength = ulNumWrites; - - for ( i = 0; i < BurstParams.ulWriteLength; i++ ) - { - pusSuperArray[ i ] = ( UINT16 )(( pbyImageFile [ ulByteCount++ ]) << 8); - pusSuperArray[ i ] |= ( UINT16 )pbyImageFile [ ulByteCount++ ]; - } - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.ulWriteAddress += 2 * BurstParams.ulWriteLength; - ulNumWrites -= BurstParams.ulWriteLength; - } - - /* Perform a serie of reads to make sure the image was correclty written into memory. */ - ulAddressOfst = ( pSharedInfo->ChipConfig.ulImageSize / 2 ) & 0xFFFFFFFE; - while ( ulAddressOfst != 0 ) - { - ReadParams.ulReadAddress = cOCT6100_IMAGE_FILE_BASE + ulAddressOfst; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (usReadData >> 8) != pbyImageFile[ ulAddressOfst ] ) - return cOCT6100_ERR_OPEN_IMAGE_WRITE_FAILED; - - ulAddressOfst = (ulAddressOfst / 2) & 0xFFFFFFFE; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCpuRegisterBistReadCap - -Description: Tests the operation of the CPU registers. Special Version for - GetCapacityPins - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100ApiCpuRegisterBistReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins - ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 i; - UINT16 usReadData; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - /* Assign read data pointer that will be used throughout the function. */ - ReadParams.pusReadData = &usReadData; - - /* Start with a walking bit test. */ - for ( i = 0; i < 16; i ++ ) - { - /* Write at address 0x150.*/ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = (UINT16)( 0x1 << i ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180.*/ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = (UINT16)( 0x1 << ( 15 - i ) ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << i ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << ( 15 - i ) ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - } - - /* Write at address 0x150. */ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0xCAFE; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180. */ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = 0xDECA; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xCAFE ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xDECA ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - return cOCT6100_ERR_OK; -} -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCpuRegisterBist - -Description: Tests the operation of the CPU registers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCpuRegisterBist -UINT32 Oct6100ApiCpuRegisterBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 i; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Assign read data pointer that will be used throughout the function. */ - ReadParams.pusReadData = &usReadData; - - /* Start with a walking bit test. */ - for ( i = 0; i < 16; i ++ ) - { - /* Write at address 0x150.*/ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = (UINT16)( 0x1 << i ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180.*/ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = (UINT16)( 0x1 << ( 15 - i ) ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << i ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << ( 15 - i ) ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - } - - /* Write at address 0x150. */ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0xCAFE; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180. */ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = 0xDECA; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xCAFE ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xDECA ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootSdram - -Description: Configure and test the SDRAM. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBootSdram -UINT32 Oct6100ApiBootSdram( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - UINT16 usWriteData23E; - UINT16 usWriteData230; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure.*/ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - usWriteData23E = 0x0000; - usWriteData230 = 0x0000; - - if ( (pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR) || (pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - /* SDRAM: */ - switch( pChipConfig->ulMemoryChipSize ) - { - case cOCT6100_MEMORY_CHIP_SIZE_8MB: - usWriteData230 |= ( cOCT6100_16MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_16MB: - usWriteData230 |= ( cOCT6100_32MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_32MB: - usWriteData230 |= ( cOCT6100_64MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_64MB: - usWriteData230 |= ( cOCT6100_128MB_MEMORY_BANKS << 2 ); - break; - default: - return cOCT6100_ERR_FATAL_16; - } - - usWriteData230 |= 0x0002; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Precharge all banks. */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0010; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program the mode register. */ - usWriteData23E = 0x0030; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Do CBR refresh (twice) */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0040; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* DDR: */ - switch( pChipConfig->ulMemoryChipSize ) - { - case cOCT6100_MEMORY_CHIP_SIZE_16MB: - usWriteData230 |= ( cOCT6100_16MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_32MB: - usWriteData230 |= ( cOCT6100_32MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_64MB: - usWriteData230 |= ( cOCT6100_64MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_128MB: - usWriteData230 |= ( cOCT6100_128MB_MEMORY_BANKS << 2 ); - break; - default: - return cOCT6100_ERR_FATAL_17; - } - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Precharge all banks. */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0010; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program DDR mode register. */ - usWriteData23E = 0x4000; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program SDR mode register. */ - usWriteData23E = 0x0161; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Precharge all banks. */ - usWriteData23E = 0xFFFF; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0010; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Do CBR refresh (twice) */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0040; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle.*/ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program SDR mode register. */ - usWriteData23E = 0x0061; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the refresh frequency. */ - WriteParams.ulWriteAddress = 0x242; - WriteParams.usWriteData = 0x0400; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x244; - WriteParams.usWriteData = 0x0200; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x248; - WriteParams.usWriteData = 0x800; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x246; - WriteParams.usWriteData = 0x0012; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable the SDRAM and refreshes. */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0001; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x246; - WriteParams.usWriteData = 0x0013; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiEnableClocks - -Description: This function will disable clock masking for all the modules - of the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiEnableClocks -UINT32 Oct6100ApiEnableClocks( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Enable tdmie / adpcm mclk clocks. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x015F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the DQS register for the DDR memory */ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = 0xFF00; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable pgsp chariot clocks */ - WriteParams.ulWriteAddress = 0x182; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable af/mt chariot clocks */ - WriteParams.ulWriteAddress = 0x184; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProgramNLP - -Description: This function will write image values to configure the NLP. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProgramNLP -UINT32 Oct6100ApiProgramNLP( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - UINT32 ulResult; - UINT16 usReadData; - UINT16 usReadHighData; - BOOL fBitEqual; - UINT32 ulEgoEntry[4]; - UINT32 ulTempAddress; - UINT32 ulAfCpuUp = FALSE; - UINT32 i; - UINT32 ulLoopCounter = 0; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure.*/ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Initialize the process context and user chip ID once and for all. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - UINT32 ulReadData; - UINT32 ulBitPattern; - UINT32 j, k; - - /* Since the pouch section (256 bytes) will not be tested by the firmware, */ - /* the API has to make sure this section is working correctly. */ - for ( k = 0; k < 2; k ++ ) - { - if ( k == 0 ) - ulBitPattern = 0x1; - else - ulBitPattern = 0xFFFFFFFE; - - for ( j = 0; j < 32; j ++ ) - { - /* Write the DWORDs. */ - for ( i = 0; i < 64; i ++ ) - { - ulResult = Oct6100ApiWriteDword( f_pApiInstance, cOCT6100_POUCH_BASE + i * 4, ulBitPattern << j ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Read the DWORDs. */ - for ( i = 0; i < 64; i ++ ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, cOCT6100_POUCH_BASE + i * 4, &ulReadData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the value matches. */ - if ( ( ulBitPattern << j ) != ulReadData ) - return cOCT6100_ERR_OPEN_PRODUCTION_BIST_POUCH_ERROR; - } - } - } - } - - /* Write the image info in the chip. */ - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE; - WriteParams.usWriteData = (UINT16)( ( pSharedInfo->ImageRegion[ 0 ].ulPart1BaseAddress >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSharedInfo->ImageRegion[ 0 ].ulPart1BaseAddress & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for( i = 0; i < 8; i++ ) - { - if ( pSharedInfo->ImageRegion[ i + 2 ].ulPart1Size != 0 ) - { - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE + 0x4 + ( i * 0xC ); - WriteParams.usWriteData = (UINT16)(( pSharedInfo->ImageRegion[ i + 2 ].ulPart1BaseAddress >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSharedInfo->ImageRegion[ i + 2 ].ulPart1BaseAddress & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pSharedInfo->ImageRegion[ i + 2 ].ulPart2Size != 0 ) - { - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE + 0x4 + ( i * 0xC ) + 4; - WriteParams.usWriteData = (UINT16)(( pSharedInfo->ImageRegion[ i + 2 ].ulPart2BaseAddress >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSharedInfo->ImageRegion[ i + 2 ].ulPart2BaseAddress & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE + 0x4 + ( i * 0xC ) + 8; - WriteParams.usWriteData = 0x0000; - WriteParams.usWriteData |= ( pSharedInfo->ImageRegion[ i + 2 ].ulPart1Size << 8 ); - WriteParams.usWriteData |= pSharedInfo->ImageRegion[ i + 2 ].ulPart2Size; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0x0000; - WriteParams.usWriteData |= ( pSharedInfo->ImageRegion[ i + 2 ].ulClockInfo << 8 ); - WriteParams.usWriteData |= pSharedInfo->ImageRegion[ i + 2 ].ulReserved; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Put NLP in config mode. */ - WriteParams.ulWriteAddress = 0x2C2; - WriteParams.usWriteData = 0x160E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x692; - WriteParams.usWriteData = 0x010A; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Upload the up to 8 NLP pages + 1 AF page (for timing reasons). */ - for ( i = 0; i < pSharedInfo->ImageRegion[ 1 ].ulPart1Size; i++ ) - { - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 1 ].ulPart1BaseAddress + 1028 * ( i * 2 ), 0x1280, 1024, &(ulEgoEntry[0])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 1 ].ulPart1BaseAddress + 1028 * (( i * 2 ) + 1 ), 0x1680, 1024, &(ulEgoEntry[2])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiRunEgo( f_pApiInstance, FALSE, 2, ulEgoEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Shift mt chariot memories. This process will complete by the time */ - /* the next LSU transfer is done. */ - WriteParams.ulWriteAddress = 0x692; - WriteParams.usWriteData = 0x010B; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForPcRegisterBit( f_pApiInstance, 0x692, 0, 0, 100000, &fBitEqual ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - if ( TRUE != fBitEqual ) - return cOCT6100_ERR_FATAL_1A; - } - - /* 1 AF page (for timing reasons). */ - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 0), 0x1280, 512, &(ulEgoEntry[0])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 1), 0x1480, 512, &(ulEgoEntry[2])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiRunEgo( f_pApiInstance, FALSE, 2, ulEgoEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 2), 0x1680, 512, &(ulEgoEntry[0])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 3), 0x1880, 512, &(ulEgoEntry[2])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiRunEgo( f_pApiInstance, FALSE, 2, ulEgoEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write constant memory init context position in channel "672" for pgsp. */ - WriteParams.ulWriteAddress = 0x71A; - WriteParams.usWriteData = 0x8000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set fixed PGSP event_in base address to 800 on a 2k boundary */ - WriteParams.ulWriteAddress = 0x716; - WriteParams.usWriteData = 0x800 >> 11; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set fixed PGSP event_out to 0x2C0000h on a 16k boundary */ - WriteParams.ulWriteAddress = 0x71C; - WriteParams.usWriteData = 0x2C0000 >> 14; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Give chariot control of the chip. */ - WriteParams.ulWriteAddress = 0x712; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x2C0000 + 0xC; - ulTempAddress = 0x300000 + 0x0800; - WriteParams.usWriteData = (UINT16)( ( ulTempAddress >> 16 ) & 0x07FF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x2C0000 + 0xE; - WriteParams.usWriteData = (UINT16)( ( ulTempAddress >> 0 ) & 0xFF00 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the init PGSP event in place. */ - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x800; - WriteParams.usWriteData = 0x0200; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x802; - WriteParams.usWriteData = 0x02A0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Also write the register 710, which tells PGSP how many tones are supported. */ - WriteParams.ulWriteAddress = 0x710; - WriteParams.usWriteData = 0x0000; - WriteParams.usWriteData |= pChipConfig->pbyImageFile[ 0x7FA ] << 8; - WriteParams.usWriteData |= pChipConfig->pbyImageFile[ 0x7FB ] << 0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Start both processors in the NLP. */ - WriteParams.ulWriteAddress = 0x373FE; - WriteParams.usWriteData = 0x00FF; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37BFE; - WriteParams.usWriteData = 0x00FE; /* Tell processor 1 to just go to sleep. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37FC6; - WriteParams.usWriteData = 0x8004; /* First PC.*/ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37FD0; - WriteParams.usWriteData = 0x0002; /* Take out of reset. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37FD2; - WriteParams.usWriteData = 0x0002; /* Take out of reset. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Start processor in the AF. */ - for ( i = 0; i < 16; i ++ ) - { - WriteParams.ulWriteAddress = cOCT6100_POUCH_BASE + ( i * 2 ); - if ( i == 9 ) - { - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - if (pSharedInfo->ChipConfig.ulProductionBistMode == cOCT6100_PRODUCTION_BIST_SHORT) - WriteParams.usWriteData = cOCT6100_PRODUCTION_SHORT_BOOT_TYPE; - else - WriteParams.usWriteData = cOCT6100_PRODUCTION_BOOT_TYPE; - } - else - { - WriteParams.usWriteData = cOCT6100_AF_BOOT_TYPE; - } - } - else - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if the production BIST mode was requested. */ - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - UINT32 ulTotalElements = 3; - UINT32 ulCrcKey; - UINT32 aulMessage[ 4 ]; - UINT32 ulWriteAddress = 0x20 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - - /* Magic key. */ - aulMessage[ 0 ] = 0xCAFECAFE; - /* Memory size. */ - aulMessage[ 1 ] = pSharedInfo->MiscVars.ulTotalMemSize; - /* Loop count. */ - aulMessage[ 2 ] = pSharedInfo->ChipConfig.ulNumProductionBistLoops; - /* CRC initialized. */ - aulMessage[ 3 ] = 0; - - ulResult = Oct6100ApiProductionCrc( f_pApiInstance, aulMessage, ulTotalElements, &ulCrcKey ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulMessage[ 3 ] = ulCrcKey; - - /* Write the message to the external memory. */ - for ( i = 0; i < ulTotalElements + 1; i ++ ) - { - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulWriteAddress + i * 4, aulMessage[ i ] ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - WriteParams.ulWriteAddress = 0xFFFC6; - WriteParams.usWriteData = 0x1284; /* First PC.*/ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0xFFFD0; - WriteParams.usWriteData = 0x0002; /* Take out of reset. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - while ( ulAfCpuUp == FALSE ) - { - if ( ulAfCpuUp == FALSE ) - { - ReadParams.ulReadAddress = cOCT6100_POUCH_BASE; - ReadParams.pusReadData = &usReadHighData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress += 2; - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - /* Should read 0x0007 when bisting. */ - if ( (( usReadHighData & 0xFFFF ) == cOCT6100_PRODUCTION_BOOT_TYPE) || - (( usReadHighData & 0xFFFF ) == cOCT6100_PRODUCTION_SHORT_BOOT_TYPE) ) - { - /* Verify if the bist has started successfully. */ - if ( ( usReadData & 0xFFFF ) == 0x0002 ) - return cOCT6100_ERR_OPEN_PRODUCTION_BIST_CONF_FAILED; - else if ( ( usReadData & 0xFFFF ) != 0xEEEE ) - return cOCT6100_ERR_OPEN_PRODUCTION_BOOT_FAILED; - - ulAfCpuUp = TRUE; - } - } - else /* if ( pSharedInfo->ChipConfig.fEnableProductionBist == FALSE ) */ - { - if ( ( usReadHighData & 0xFFFF ) == cOCT6100_AF_BOOT_TYPE ) - { - /* Verify if the bist succeeded. */ - if ( ( usReadData & 0xFFFF ) != 0x0000 ) - return cOCT6100_ERR_OPEN_FUNCTIONAL_BIST_FAILED; - - ulAfCpuUp = TRUE; - } - } - } - - ulLoopCounter++; - - if ( ulLoopCounter == cOCT6100_MAX_LOOP_CPU_TIMEOUT ) - return cOCT6100_ERR_OPEN_AF_CPU_TIMEOUT; - } - - /* Return NLP in operationnal mode. */ - WriteParams.ulWriteAddress = 0x2C2; - WriteParams.usWriteData = 0x060E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x692; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSetH100Register - -Description: This function will configure the H.100 registers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSetH100Register -UINT32 Oct6100ApiSetH100Register( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - UINT32 i; - UINT32 ulOffset; - BOOL fAllStreamAt2Mhz = TRUE; - const UINT16 ausAdpcmResetContext[32] = { 0x1100, 0x0220, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0100, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0040, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000}; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure. */ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Set the Global OE bit. */ - WriteParams.ulWriteAddress = 0x300; - WriteParams.usWriteData = 0x0004; - - /* Set the number of streams. */ - switch( pChipConfig->byMaxTdmStreams ) - { - case 32: - WriteParams.usWriteData |= ( 0 << 3 ); - break; - case 16: - WriteParams.usWriteData |= ( 1 << 3 ); - break; - case 8: - WriteParams.usWriteData |= ( 2 << 3 ); - break; - case 4: - WriteParams.usWriteData |= ( 3 << 3 ); - break; - default: - break; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the stream frequency. */ - WriteParams.ulWriteAddress = 0x330; - WriteParams.usWriteData = 0x0000; - for ( i = 0; i < (UINT32)(pChipConfig->byMaxTdmStreams / 4); i++) - { - ulOffset = i*2; - switch( pChipConfig->aulTdmStreamFreqs[ i ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - WriteParams.usWriteData |= ( 0x0 << ulOffset ); - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - WriteParams.usWriteData |= ( 0x1 << ulOffset ); - fAllStreamAt2Mhz = FALSE; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - WriteParams.usWriteData |= ( 0x2 << ulOffset ); - fAllStreamAt2Mhz = FALSE; - break; - default: - break; - } - } - - /* Set the stream to 16 MHz if the fast H.100 mode is selected. */ - if ( pChipConfig->fEnableFastH100Mode == TRUE ) - { - fAllStreamAt2Mhz = FALSE; - WriteParams.usWriteData = 0xFFFF; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - { - /* Make the chip track both clock A and B to perform fast H.100 mode. */ - WriteParams.ulWriteAddress = 0x322; - WriteParams.usWriteData = 0x0004; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable the fast H.100 mode. */ - WriteParams.ulWriteAddress = 0x332; - WriteParams.usWriteData = 0x0003; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = 0x376; - WriteParams.usWriteData = (UINT16)( pSharedInfo->MiscVars.usTdmClkBoundary ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select delay for early clock (90 and 110). */ - WriteParams.ulWriteAddress = 0x378; - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData = 0x000A; - else - { - /* Set the TDM sampling. */ - if ( pSharedInfo->ChipConfig.byTdmSampling == cOCT6100_TDM_SAMPLE_AT_RISING_EDGE ) - { - WriteParams.usWriteData = 0x0AF0; - } - else if ( pSharedInfo->ChipConfig.byTdmSampling == cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE ) - { - WriteParams.usWriteData = 0x0A0F; - } - else /* pSharedInfo->ChipConfig.ulTdmSampling == cOCT6100_TDM_SAMPLE_AT_3_QUARTERS */ - { - WriteParams.usWriteData = 0x0A08; - } - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Protect chip by preventing too rapid timeslot arrival (mclk == 133 MHz). */ - WriteParams.ulWriteAddress = 0x37A; - WriteParams.usWriteData = (UINT16)pSharedInfo->MiscVars.usMaxH100Speed; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Allow H.100 TS to progress. */ - WriteParams.ulWriteAddress = 0x382; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set by-pass mode. */ - WriteParams.ulWriteAddress = 0x50E; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* TDMIE bits. */ - WriteParams.ulWriteAddress = 0x500; - WriteParams.usWriteData = 0x0003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write normal ADPCM reset values in ADPCM context 1344. */ - for(i=0;i<32;i++) - { - WriteParams.ulWriteAddress = 0x140000 + ( 0x40 * 1344 ) + ( i * 2 ); - WriteParams.usWriteData = ausAdpcmResetContext[i]; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Make sure delay flops are configured correctly if all streams are at 2 MHz. */ - if ( fAllStreamAt2Mhz == TRUE ) - { - /* Setup H.100 sampling to lowest value. */ - WriteParams.ulWriteAddress = 0x144; - WriteParams.usWriteData = 0x4041; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x378; - WriteParams.usWriteData = 0x0A00; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteMiscellaneousRegisters - -Description: This function will write to various registers to activate the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteMiscellaneousRegisters -UINT32 Oct6100ApiWriteMiscellaneousRegisters( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Free the interrupt pin of the chip (i.e. remove minimum time requirement between interrupts). */ - WriteParams.ulWriteAddress = 0x214; - WriteParams.usWriteData = 0x0000; - if ( f_pApiInstance->pSharedInfo->ChipConfig.byInterruptPolarity == cOCT6100_ACTIVE_HIGH_POLARITY ) - WriteParams.usWriteData |= 0x4000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write MT chariot interval */ - WriteParams.ulWriteAddress = 0x2C2; - if ( f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels > 640 ) - WriteParams.usWriteData = 0x05EA; - else if ( f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels > 513 ) - WriteParams.usWriteData = 0x0672; - else /* if ( f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels <= 513 ) */ - WriteParams.usWriteData = 0x0750; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write set second part5 time. */ - WriteParams.ulWriteAddress = 0x2C4; - WriteParams.usWriteData = 0x04A0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write CPU bucket timer to guarantee 200 cycles between each CPU access. */ - WriteParams.ulWriteAddress = 0x234; - WriteParams.usWriteData = 0x0804; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x236; - WriteParams.usWriteData = 0x0100; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCreateSerializeObjects - -Description: Creates a handle to each serialization object used by the API. - - Note that in a multi-process system the user's process context - structure pointer is needed by this function. Thus, the - pointer must be valid. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulUserChipId User chip ID for this serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCreateSerializeObjects -UINT32 Oct6100ApiCreateSerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulUserChipId ) -{ - tOCT6100_CREATE_SERIALIZE_OBJECT CreateSerObj; - UINT32 ulResult; - CHAR szSerObjName[ 64 ] = "Oct6100ApiXXXXXXXXApiSerObj"; - - - /* Set some parameters of the create structure once and for all. */ - CreateSerObj.pProcessContext = f_pApiInstance->pProcessContext; - CreateSerObj.pszSerialObjName = szSerObjName; - - /*----------------------------------------------------------------------*/ - /* Set the chip ID in the semaphore name. */ - szSerObjName[ 10 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 28 ) & 0xFF ); - szSerObjName[ 11 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 24 ) & 0xFF ); - szSerObjName[ 12 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 20 ) & 0xFF ); - szSerObjName[ 13 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 16 ) & 0xFF ); - szSerObjName[ 14 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 12 ) & 0xFF ); - szSerObjName[ 15 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 8 ) & 0xFF ); - szSerObjName[ 16 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 4 ) & 0xFF ); - szSerObjName[ 17 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 0 ) & 0xFF ); - - ulResult = Oct6100UserCreateSerializeObject( &CreateSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - f_pApiInstance->ulApiSerObj = CreateSerObj.ulSerialObjHndl; - /*----------------------------------------------------------------------*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiDestroySerializeObjects - -Description: Destroy handles to each serialization object used by the API. - - Note that in a multi-process system the user's process context - structure pointer is needed by this function. Thus, the - pointer must be valid. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiDestroySerializeObjects -UINT32 Oct6100ApiDestroySerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_DESTROY_SERIALIZE_OBJECT DestroySerObj; - UINT32 ulResult; - - /* Set some parameters of the create structure once and for all. */ - DestroySerObj.pProcessContext = f_pApiInstance->pProcessContext; - DestroySerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - - ulResult = Oct6100UserDestroySerializeObject( &DestroySerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRunEgo - -Description: Private function used to communicate with the internal processors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_fStoreFlag Type of access performed. (Load or Store) -f_ulNumEntry Number of access. -f_aulEntry Array of access to perform. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRunEgo -UINT32 Oct6100ApiRunEgo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN BOOL f_fStoreFlag, - IN UINT32 f_ulNumEntry, - OUT PUINT32 f_aulEntry ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 aulCpuLsuCmd[ 2 ]; - UINT16 usReadData; - UINT32 i; - BOOL fConditionFlag = TRUE; - UINT32 ulLoopCounter = 0; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure. */ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* No more than 2 entries may be requested. */ - if ( f_ulNumEntry > 2 ) - return cOCT6100_ERR_FATAL_1B; - - /* Write the requested entries at address reserved for CPU. */ - for( i = 0; i < f_ulNumEntry; i++ ) - { - WriteParams.ulWriteAddress = cOCT6100_PART1_API_SCRATCH_PAD + ( 0x8 * i ); - WriteParams.usWriteData = (UINT16)(( f_aulEntry[ i * 2 ] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( f_aulEntry[ i * 2 ] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)(( f_aulEntry[ (i * 2) + 1] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( f_aulEntry[ (i * 2) + 1] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Preincrement code point. */ - pSharedInfo->MiscVars.usCodepoint++; - - /* Create DWORD 0 of command. */ - aulCpuLsuCmd[0] = 0x00000000; - if ( f_fStoreFlag == FALSE ) - aulCpuLsuCmd[0] |= 0xC0000000; /* EGO load. */ - else - aulCpuLsuCmd[0] |= 0xE0000000; /* EGO store. */ - - aulCpuLsuCmd[0] |= (f_ulNumEntry - 1) << 19; - aulCpuLsuCmd[0] |= cOCT6100_PART1_API_SCRATCH_PAD; - - /* Create DWORD 1 of command. */ - aulCpuLsuCmd[1] = 0x00000000; - aulCpuLsuCmd[1] |= ( ( cOCT6100_PART1_API_SCRATCH_PAD + 0x10 ) & 0xFFFF ) << 16; - aulCpuLsuCmd[1] |= pSharedInfo->MiscVars.usCodepoint; - - /* Write the EGO command in the LSU CB. */ - WriteParams.ulWriteAddress = cOCT6100_PART1_CPU_LSU_CB_BASE + ((pSharedInfo->MiscVars.usCpuLsuWritePtr & 0x7) * 0x8 ); - WriteParams.usWriteData = (UINT16)(( aulCpuLsuCmd[ 0 ] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( aulCpuLsuCmd[ 0 ] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)(( aulCpuLsuCmd[ 1 ] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( aulCpuLsuCmd[ 1 ] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Post increment the write pointer. */ - pSharedInfo->MiscVars.usCpuLsuWritePtr++; - - /* Indicate new write pointer position to HW. */ - WriteParams.ulWriteAddress = cOCT6100_PART1_EGO_REG + 0x5A; - WriteParams.usWriteData = (UINT16)( pSharedInfo->MiscVars.usCpuLsuWritePtr & 0x7 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for codepoint to be updated before returning. */ - while( fConditionFlag ) - { - ReadParams.ulReadAddress = cOCT6100_PART1_API_SCRATCH_PAD + 0x12; - usReadData = (UINT16)( pSharedInfo->MiscVars.usCodepoint ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData == pSharedInfo->MiscVars.usCodepoint ) - fConditionFlag = FALSE; - - ulLoopCounter++; - - if ( ulLoopCounter == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_OPEN_EGO_TIMEOUT; - } - - /* CRC error bit must be zero. */ - ReadParams.ulReadAddress = 0x202; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( usReadData & 0x0400 ) != 0 ) - return cOCT6100_ERR_OPEN_CORRUPTED_IMAGE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCreateEgoEntry - -Description: Private function used to create an access structure to be sent - to the internal processors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_ulExternalAddress External memory address for the access. -f_ulInternalAddress Which process should receive the command. -f_ulNumBytes Number of bytes associated to the access. -f_aulEntry Array of access to perform. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCreateEgoEntry -UINT32 Oct6100ApiCreateEgoEntry( - IN UINT32 f_ulExternalAddress, - IN UINT32 f_ulInternalAddress, - IN UINT32 f_ulNumBytes, - OUT UINT32 f_aulEntry[ 2 ] ) -{ - f_aulEntry[0] = 0x80000000; - f_aulEntry[0] |= f_ulExternalAddress & 0x07FFFFFC; - - f_aulEntry[1] = 0x0011C000; - f_aulEntry[1] |= (f_ulNumBytes / 8) << 23; - f_aulEntry[1] |= (f_ulInternalAddress >> 2) & 0x3FFF; - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitChannels - -Description: This function will initialize all the channels to power down. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitChannels -UINT32 Oct6100ApiInitChannels( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 i; - UINT32 ulResult; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT16 ausWriteData[ 4 ]; - UINT16 usLoopCount = 0; - UINT16 usWriteData = 0; - UINT16 usMclkRead; - UINT16 usLastMclkRead; - UINT16 usMclkDiff; - UINT32 ulNumberOfCycleToWait; - UINT32 ulTimeoutCounter; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusWriteData = ausWriteData; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Verify that the image has enough memory to work correctly. */ - if ( ( pSharedInfo->MiscVars.ulTotalMemSize + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) < pSharedInfo->MemoryMap.ulFreeMemBaseAddress ) - return cOCT6100_ERR_OPEN_INSUFFICIENT_EXTERNAL_MEMORY; - - /* Verify that the tail length is supported by the device.*/ - if ( pSharedInfo->ChipConfig.usTailDisplacement > pSharedInfo->ImageInfo.usMaxTailDisplacement ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_TAIL_DISPLACEMENT_VALUE; - - /* Verify that acoustic echo is supported by the device. */ - if ( pSharedInfo->ChipConfig.fEnableAcousticEcho == TRUE && pSharedInfo->ImageInfo.fAcousticEcho == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_ACOUSTIC_ECHO; - - /* Verify that the image supports all the requested channels. */ - if ( pSharedInfo->ChipConfig.usMaxChannels > pSharedInfo->ImageInfo.usMaxNumberOfChannels ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE; - - /* Max number of channels the image supports + 1 for channel recording, if requested */ - if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - && ( pSharedInfo->ImageInfo.usMaxNumberOfChannels < cOCT6100_MAX_ECHO_CHANNELS ) - && ( pSharedInfo->ChipConfig.usMaxChannels == pSharedInfo->ImageInfo.usMaxNumberOfChannels ) ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE; - - /* Initialize the memory for all required channels. */ - for( i = 0; i < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - /*==============================================================================*/ - /* Configure the Global Static Configuration memory of the channel. */ - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( i * cOCT6100_CHANNEL_ROOT_SIZE ) + cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET; - - /* Set the PGSP context base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + cOCT6100_CH_MAIN_PGSP_CONTEXT_OFFSET; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the PGSP init context base address. */ - ulTempData = ( cOCT6100_IMAGE_FILE_BASE + 0x200 ) & 0x07FFFFFF; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_INIT_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the RIN circular buffer base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainRinCBMemOfst; - - /* Set the circular buffer size. */ - ulTempData &= 0xFFFFFF00; - if (( pSharedInfo->MemoryMap.ulChanMainRinCBMemSize & 0xFFFF00FF ) != 0 ) - return cOCT6100_ERR_CHANNEL_INVALID_RIN_CB_SIZE; - ulTempData |= pSharedInfo->MemoryMap.ulChanMainRinCBMemSize >> 8; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_RIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SIN circular buffer base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSinCBMemOfst; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SOUT circular buffer base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSoutCBMemOfst;; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SOUT_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - } - - /* Put all channel in powerdown mode "3". */ - for( i = 0; i < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - WriteParams.ulWriteAddress = 0x014000 + (i*4) + 0; - WriteParams.usWriteData = 0x85FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x014000 + (i*4) + 2; - WriteParams.usWriteData = 0xC5FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the maximum number of channels. */ - WriteParams.ulWriteAddress = 0x690; - if ( pSharedInfo->ImageInfo.usMaxNumberOfChannels < 384 ) - WriteParams.usWriteData = 384; - else - WriteParams.usWriteData = (UINT16)pSharedInfo->ImageInfo.usMaxNumberOfChannels; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set power-dowm TSI chariot memory to silence. */ - for( i = 0; i < 6; i++ ) - { - WriteParams.ulWriteAddress = 0x20000 + ( i * 0x1000 ) + ( 1534 * 2 ); - WriteParams.usWriteData = 0x3EFF; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x20000 + ( i * 0x1000 ) + ( 1535 * 2 ); - WriteParams.usWriteData = 0x3EFF; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove chariot hold. */ - WriteParams.ulWriteAddress = 0x500; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for( usLoopCount = 0; usLoopCount < 4096; usLoopCount++ ) - { - if ( (usLoopCount % 16) < 8 ) - { - usWriteData = (UINT16)((usLoopCount / 16) << 7); - usWriteData |= (UINT16)((usLoopCount % 8)); - } - else - { - usWriteData = (UINT16)((usLoopCount / 16) << 7); - usWriteData |= (UINT16)((usLoopCount % 8)); - usWriteData |= 0x78; - } - - /* Set timeslot pointer. */ - WriteParams.ulWriteAddress = 0x50E; - WriteParams.usWriteData = 0x0003; - WriteParams.usWriteData |= usWriteData << 2; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read the mclk counter. */ - ReadParams.ulReadAddress = 0x30A; - ReadParams.pusReadData = &usLastMclkRead; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reset loop timeout counter. */ - ulTimeoutCounter = 0x0; - - do { - ReadParams.pusReadData = &usMclkRead; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( usLoopCount % 16 ) != 15 ) - { - ulNumberOfCycleToWait = 133; - } - else - { - ulNumberOfCycleToWait = 20000; - } - - /* Evaluate the difference. */ - usMclkDiff = (UINT16)(( usMclkRead - usLastMclkRead ) & 0xFFFF); - - /* Check for loop timeout. Bad mclk? */ - ulTimeoutCounter++; - if ( ulTimeoutCounter == cOCT6100_MAX_LOOP_CPU_TIMEOUT ) - return cOCT6100_ERR_FATAL_EA; - - } while( usMclkDiff <= ulNumberOfCycleToWait ); - } - - /* Back to normal mode. */ - WriteParams.ulWriteAddress = 0x50E; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check for CRC errors. */ - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = 0x202; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (usReadData & 0x400) != 0x0000 ) - return cOCT6100_ERR_OPEN_CRC_ERROR; - - /* Clear the error rol raised by manually moving the clocks. */ - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*======================================================================*/ - /* Write the tail displacement value in external memory. */ - - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchTailDisplOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchTailDisplOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchTailDisplOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set the tail displacement. */ - ulTempData |= (pSharedInfo->ChipConfig.usTailDisplacement << ulFeatureBitOffset ); - - /* Write the DWORD where the field is located. */ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Clear the pouch counter, if present. */ - - if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Clear counter! */ - ulTempData &= (~ulMask); - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* The ISR has not yet been called. Set the appropriate bit in external memory. */ - if ( pSharedInfo->DebugInfo.fIsIsrCalledField == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Read previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Toggle the bit to '1'. */ - ulTempData |= 1 << ulFeatureBitOffset; - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitToneInfo - -Description: This function will parse the software image and retrieve - the information about the tones that it supports. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitToneInfo -UINT32 Oct6100ApiInitToneInfo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - UINT32 ulResult; - - unsigned char const *pszToneInfoStart = NULL; - unsigned char const *pszToneInfoEnd = NULL; - - unsigned char const *pszCurrentInfo; - unsigned char const *pszNextInfo; - - UINT32 ulToneEventNumber; - UINT32 ulTempValue; - UINT32 ulNumCharForValue; - UINT32 ulUniqueToneId; - UINT32 ulToneNameSize; - UINT32 ulOffset = 0; - - UINT32 i; - - /* Init the tone detector parameter. */ - f_pApiInstance->pSharedInfo->ImageInfo.byNumToneDetectors = 0; - - /* Find the start and the end of the tone info section. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize > 4096 ) - { - /* For performance reasons, and since the tone detector information */ - /* is always located at the end of the image file, try to start from the end */ - /* of the buffer. */ - - ulOffset = f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize - 2048; - pszToneInfoStart = Oct6100ApiStrStr( f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + ulOffset, - (PUINT8)cOCT6100_TONE_INFO_START_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - - /* Check if the information was found. */ - if ( pszToneInfoStart == NULL ) - { - /* Try again, but giving a larger string to search. */ - ulOffset = f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize - 4096; - pszToneInfoStart = Oct6100ApiStrStr( f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + ulOffset, - (PUINT8)cOCT6100_TONE_INFO_START_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - - } - } - - if ( pszToneInfoStart == NULL ) - { - /* Travel through the whole file buffer. */ - pszToneInfoStart = Oct6100ApiStrStr( f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile, - (PUINT8)cOCT6100_TONE_INFO_START_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - } - /* We have to return immediatly if no tones are found. */ - if ( pszToneInfoStart == NULL ) - return cOCT6100_ERR_OK; - - /* The end of the tone detector information is after the beginning of the tone information. */ - pszToneInfoEnd = Oct6100ApiStrStr( pszToneInfoStart, - (PUINT8)cOCT6100_TONE_INFO_STOP_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - if ( pszToneInfoEnd == NULL ) - return cOCT6100_ERR_OPEN_TONE_INFO_STOP_TAG_NOT_FOUND; - - /* Find and process all tone events within the region. */ - pszCurrentInfo = Oct6100ApiStrStr( pszToneInfoStart, (PUINT8)cOCT6100_TONE_INFO_EVENT_STRING, pszToneInfoEnd ); - - while ( pszCurrentInfo != NULL ) - { - /* Skip the string. */ - pszCurrentInfo += ( Oct6100ApiStrLen( (PUINT8)cOCT6100_TONE_INFO_EVENT_STRING ) ); - - /* Extract the number of char used to represent the tone event number ( 1 or 2 ). */ - pszNextInfo = Oct6100ApiStrStr( pszCurrentInfo, (PUINT8)",", pszToneInfoEnd ); - ulNumCharForValue = (UINT32)( pszNextInfo - pszCurrentInfo ); - - /* Retreive the event number */ - ulToneEventNumber = 0; - for ( i = ulNumCharForValue; i > 0; i-- ) - { - ulResult = Oct6100ApiAsciiToHex( *pszCurrentInfo, &ulTempValue ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulToneEventNumber |= ( ulTempValue << (( i - 1) * 4 ) ); - pszCurrentInfo++; - } - - if ( ulToneEventNumber >= cOCT6100_MAX_TONE_EVENT ) - return cOCT6100_ERR_OPEN_INVALID_TONE_EVENT; - - /* Skip the comma and the 0x. */ - pszCurrentInfo += 3; - - /*======================================================================*/ - /* Retreive the unique tone id. */ - ulUniqueToneId = 0; - for ( i = 0; i < 8; i++ ) - { - ulResult = Oct6100ApiAsciiToHex( *pszCurrentInfo, &ulTempValue ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulOffset = 28 - ( i * 4 ); - ulUniqueToneId |= ( ulTempValue << ulOffset ); - pszCurrentInfo++; - } - - /*======================================================================*/ - - /* Skip the comma. */ - pszCurrentInfo++; - - /* Find out where the next event info starts */ - pszNextInfo = Oct6100ApiStrStr( pszCurrentInfo,(PUINT8) cOCT6100_TONE_INFO_EVENT_STRING, pszToneInfoEnd ); - if ( pszNextInfo == NULL ) - pszNextInfo = pszToneInfoEnd; - - /* Extract the name size. */ - ulToneNameSize = (UINT32)( pszNextInfo - pszCurrentInfo - 2 ); /* - 2 for 0x0D and 0x0A.*/ - - if ( ulToneNameSize > cOCT6100_TLV_MAX_TONE_NAME_SIZE ) - return cOCT6100_ERR_OPEN_INVALID_TONE_NAME; - - /* Copy the tone name into the image info structure. */ - ulResult = Oct6100UserMemCopy( f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].aszToneName, - pszCurrentInfo, - ulToneNameSize ); - - - - /* Update the tone info into the image info structure. */ - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulToneID = ulUniqueToneId; - /* Find out the port on which this tone detector is associated. */ - switch( (ulUniqueToneId >> 28) & 0xF ) - { - case 1: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_ROUT; - break; - - case 2: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_SIN; - break; - - case 4: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_SOUT; - break; - - case 5: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_ROUT_SOUT; - break; - - default: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_INVALID_PORT; - break; - } - - /* Find out where the next event info starts */ - pszNextInfo = Oct6100ApiStrStr( pszCurrentInfo,(PUINT8) cOCT6100_TONE_INFO_EVENT_STRING, pszToneInfoEnd ); - /* Update the current info pointer. */ - pszCurrentInfo = pszNextInfo; - - f_pApiInstance->pSharedInfo->ImageInfo.byNumToneDetectors++; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiExternalMemoryBist - -Description: Tests the functionality of the external memories. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiExternalMemoryBist -UINT32 Oct6100ApiExternalMemoryBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMemSize = 0; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Test the external memory. */ - switch ( pSharedInfo->ChipConfig.ulMemoryChipSize ) - { - case cOCT6100_MEMORY_CHIP_SIZE_8MB: - ulMemSize = cOCT6100_SIZE_8M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_16MB: - ulMemSize = cOCT6100_SIZE_16M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_32MB: - ulMemSize = cOCT6100_SIZE_32M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_64MB: - ulMemSize = cOCT6100_SIZE_64M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_128MB: - ulMemSize = cOCT6100_SIZE_128M; - break; - default: - return cOCT6100_ERR_FATAL_D9; - } - - ulMemSize *= pSharedInfo->ChipConfig.byNumMemoryChips; - - ulResult = Oct6100ApiRandomMemoryWrite( f_pApiInstance, cOCT6100_EXTERNAL_MEM_BASE_ADDRESS, ulMemSize, 16, 1000, cOCT6100_ERR_OPEN_EXTERNAL_MEM_BIST_FAILED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Make sure the user I/O functions are working as required. */ - ulResult = Oct6100ApiUserIoTest( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGenerateNumber - -Description: Generate a number using an index. Passing the same - index generates the same number. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_ulIndex Index used to generate the random number. -f_ulDataMask Data mask to apply to generated number. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGenerateNumber -UINT16 Oct6100ApiGenerateNumber( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulIndex, - IN UINT32 f_ulDataMask ) -{ - UINT16 usGeneratedNumber; - - usGeneratedNumber = (UINT16)( ( ( ~( f_ulIndex - 1 ) ) & 0xFF00 ) | ( ( f_ulIndex + 1 ) & 0xFF ) ); - - return (UINT16)( usGeneratedNumber & f_ulDataMask ); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRandomMemoryWrite - -Description: Writes to f_ulNumAccesses random locations in the indicated - memory and read back to test the operation of that memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_ulMemBase Base address of the memory access. -f_ulMemSize Size of the memory to be tested. -f_ulNumDataBits Number of data bits. -f_ulNumAccesses Number of random access to be perform. -f_ulErrorCode Error code to be returned if the bist fails. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRandomMemoryWrite -UINT32 Oct6100ApiRandomMemoryWrite( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMemBase, - IN UINT32 f_ulMemSize, - IN UINT32 f_ulNumDataBits, - IN UINT32 f_ulNumAccesses, - IN UINT32 f_ulErrorCode ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulDataMask; - UINT32 ulResult, i, j; - UINT32 ulBistAddress; - UINT16 usReadData; - UINT32 aulBistAddress[20]={0x00000000, 0x00000002, 0x00000004, 0x007FFFFE, - 0x00900000, 0x00900006, 0x00900008, 0x009FFFFE, - 0x01000000, 0x0100000A, 0x0200000C, 0x01FFFFFE, - 0x03000000, 0x03000002, 0x04000004, 0x03FFFFFE, - 0x04000000, 0x05000006, 0x06000008, 0x07FFFFFE}; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Determine mask for number of data bits. */ - ulDataMask = (1 << f_ulNumDataBits) - 1; - - /* Write specific data to specific address */ - WriteParams.ulWriteAddress = f_ulMemBase | 0x00001000; - WriteParams.usWriteData = 0xCAFE; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for(j=0; j<20; j++) - { - /* Change address to test lower and higher part of the 32 bit bus */ - ulBistAddress = aulBistAddress[j]; - ulBistAddress &= f_ulMemSize - 2; - ulBistAddress |= f_ulMemBase; - - /* Bist 16 data pins of this address */ - for ( i = 0; i < 16; i ++) - { - WriteParams.ulWriteAddress = ulBistAddress; - WriteParams.usWriteData = (UINT16)(0x1 << i); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read back the specific data to flush the data bus.*/ - ReadParams.ulReadAddress = f_ulMemBase | 0x00001000; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xCAFE ) - return f_ulErrorCode; - - /* Read back the data written.*/ - ReadParams.ulReadAddress = WriteParams.ulWriteAddress; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != (UINT16)(0x1 << i) ) - return f_ulErrorCode; - } - } - - /* Perform the first write at address 0 + mem base */ - j = 0; - WriteParams.ulWriteAddress = f_ulMemBase; - WriteParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, j, ulDataMask ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Try each address line of the memory. */ - for ( i = 2, j = 1; i < f_ulMemSize; i <<= 1, j++ ) - { - WriteParams.ulWriteAddress = ( f_ulMemBase + i ); - WriteParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, j, ulDataMask ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - for ( i = 0; i < j; i++ ) - { - if ( i > 0 ) - ReadParams.ulReadAddress = ( f_ulMemBase + ( 0x1 << i ) ); - else - ReadParams.ulReadAddress = f_ulMemBase; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != Oct6100ApiGenerateNumber( f_pApiInstance, i, ulDataMask ) ) - return f_ulErrorCode; - } - - /* Write to random addresses of the memory. */ - for ( i = 0; i < f_ulNumAccesses; i++ ) - { - ulBistAddress = (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) << 16; - ulBistAddress |= (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - ulBistAddress &= f_ulMemSize - 2; - ulBistAddress |= f_ulMemBase; - - WriteParams.ulWriteAddress = ulBistAddress; - WriteParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - for ( i = 0; i < f_ulNumAccesses; i++ ) - { - ulBistAddress = (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) << 16; - ulBistAddress |= (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - ulBistAddress &= f_ulMemSize - 2; - ulBistAddress |= f_ulMemBase; - - ReadParams.ulReadAddress = ulBistAddress; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( usReadData & ulDataMask ) != ( Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) & ulDataMask ) ) - return f_ulErrorCode; - } - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUserIoTest - -Description: This function will verify the correct functionality of - the following user functions: - - - Oct6100UserDriverWriteBurstApi - - Oct6100UserDriverWriteSmearApi - - Oct6100UserDriverReadBurstApi - - The Oct6100UserDriverWriteApi and Oct6100UserDriverReadApi - functions do not need to be tested here as this has be done in - the external memory bisting function above. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUserIoTest -UINT32 Oct6100ApiUserIoTest( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS WriteBurstParams; - tOCT6100_WRITE_SMEAR_PARAMS WriteSmearParams; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS ReadBurstParams; - UINT32 ulResult, i; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - /* Test what the user has specified is the maximum that can be used for a burst. */ - WriteBurstParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - WriteBurstParams.pusWriteData = pSharedInfo->MiscVars.ausSuperArray; - - WriteSmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteSmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - /* Test what the user has specified is the maximum that can be used for a smear. */ - WriteSmearParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - /* Test what the user has specified is the maximum that can be used for a burst. */ - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - ReadBurstParams.pusReadData = pSharedInfo->MiscVars.ausSuperArray; - - - /*======================================================================*/ - /* Write burst check. */ - - WriteBurstParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - /* Set the random data to be written. */ - for ( i = 0; i < WriteBurstParams.ulWriteLength; i++ ) - { - WriteBurstParams.pusWriteData[ i ] = Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - } - mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read back pattern using simple read function and make sure we are reading what's expected. */ - ReadParams.ulReadAddress = WriteBurstParams.ulWriteAddress; - for ( i = 0; i < WriteBurstParams.ulWriteLength; i++ ) - { - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the data matches. */ - if ( usReadData != WriteBurstParams.pusWriteData[ i ] ) - { - /* The values do not match. Something seems to be wrong with the WriteBurst user function. */ - return cOCT6100_ERR_OPEN_USER_WRITE_BURST_FAILED; - } - - /* Next address to check. */ - ReadParams.ulReadAddress += 2; - } - - /*======================================================================*/ - - - /*======================================================================*/ - /* Write smear check. */ - - WriteSmearParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + ( WriteBurstParams.ulWriteLength * 2 ); - /* Set the random data to be written. */ - WriteSmearParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, Oct6100ApiRand( 0xFFFF ), 0xFFFF ); - mOCT6100_DRIVER_WRITE_SMEAR_API( WriteSmearParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read back pattern using simple read function and make sure we are reading what's expected. */ - ReadParams.ulReadAddress = WriteSmearParams.ulWriteAddress; - for ( i = 0; i < WriteSmearParams.ulWriteLength; i++ ) - { - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the data matches. */ - if ( usReadData != WriteSmearParams.usWriteData ) - { - /* The values do not match. Something seems to be wrong with the WriteSmear user function. */ - return cOCT6100_ERR_OPEN_USER_WRITE_SMEAR_FAILED; - } - - /* Next address to check. */ - ReadParams.ulReadAddress += 2; - } - - /*======================================================================*/ - - - /*======================================================================*/ - /* Read burst check. */ - - /* First check with what the WriteBurst function wrote. */ - ReadBurstParams.ulReadAddress = WriteBurstParams.ulWriteAddress; - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for ( i = 0; i < ReadBurstParams.ulReadLength; i++ ) - { - /* Check if the data matches. */ - if ( ReadBurstParams.pusReadData[ i ] != Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) ) - { - /* The values do not match. Something seems to be wrong with the ReadBurst user function. */ - return cOCT6100_ERR_OPEN_USER_READ_BURST_FAILED; - } - } - - /* Then check with what the WriteSmear function wrote. */ - ReadBurstParams.ulReadAddress = WriteSmearParams.ulWriteAddress; - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for ( i = 0; i < ReadBurstParams.ulReadLength; i++ ) - { - /* Check if the data matches. */ - if ( ReadBurstParams.pusReadData[ i ] != WriteSmearParams.usWriteData ) - { - /* The values do not match. Something seems to be wrong with the ReadBurst user function. */ - return cOCT6100_ERR_OPEN_USER_READ_BURST_FAILED; - } - } - - /*======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiExternalMemoryInit - -Description: Initialize the external memory before uploading the image. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiExternalMemoryInit -UINT32 Oct6100ApiExternalMemoryInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulTotalWordToWrite; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Clear the first part of the memory. */ - ulTotalWordToWrite = 0x400; - SmearParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - - while ( ulTotalWordToWrite != 0 ) - { - if ( ulTotalWordToWrite >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - SmearParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - SmearParams.ulWriteLength = ulTotalWordToWrite; - - SmearParams.usWriteData = 0x0; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the number of words to write. */ - ulTotalWordToWrite -= SmearParams.ulWriteLength; - /* Update the address. */ - SmearParams.ulWriteAddress += ( SmearParams.ulWriteLength * 2 ); - } - - /* Clear the TLV flag.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, cOCT6100_TLV_BASE, 0x0 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitMixer - -Description: This function will initialize the mixer memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitMixer -UINT32 Oct6100ApiInitMixer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT16 ausWriteData[ 4 ]; - UINT32 ulResult; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusWriteData = ausWriteData; - /*======================================================================*/ - /* Initialize the mixer memory if required. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - /* Modify the mixer pointer by adding the record event into the link list. */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex; - - /* Program the Sin copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordSinEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(cOCT6100_MIXER_TAIL_NODE & 0x7FF); /* Head node.*/ - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the Sout copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(pSharedInfo->MixerInfo.usRecordSinEventIndex & 0x7FF); - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the head node. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE; - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(pSharedInfo->MixerInfo.usRecordCopyEventIndex & 0x7FF); - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Init the mixer pointer */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - } - else - { - /* Configure the head node. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE; - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(cOCT6100_MIXER_TAIL_NODE & 0x7FF); /* Head node. */ - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the tail node. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + 0x10; - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(cOCT6100_MIXER_HEAD_NODE & 0x7FF); /* Head node. */ - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitRecordResources - -Description: This function will initialize the resources required to - perform recording on a debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitRecordResources -UINT32 Oct6100ApiInitRecordResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if recording is enabled. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_OK; - - if ( pSharedInfo->DebugInfo.usRecordMemIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_DEBUG_RECORD; - - /* Check the provided recording memory index within the SSPX. */ - if ( pSharedInfo->DebugInfo.usRecordMemIndex != ( pSharedInfo->ImageInfo.usMaxNumberOfChannels - 1 ) ) - return cOCT6100_ERR_OPEN_DEBUG_MEM_INDEX; - - /* Reserve the TSI entries for the channel. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, &pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, &pSharedInfo->DebugInfo.usRecordSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Open the debug channel. */ - ulResult = Oct6100ApiDebugChannelOpen( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100FreeResourcesSer - -Description: This function closes all opened channels and frees all - specified global resources used by the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pFreeResources Pointer to user structure in which to choose what - to free. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100FreeResourcesSer -UINT32 Oct6100FreeResourcesSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_FREE_RESOURCES f_pFreeResources ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - - UINT32 ulResult; - UINT32 i; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Close all bidirectional channels. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxBiDirChannels; i ++ ) - { - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, i ); - - if ( pBiDirChanEntry->fReserved == TRUE ) - { - tOCT6100_CHANNEL_DESTROY_BIDIR DestroyBidir; - - Oct6100ChannelDestroyBiDirDef( &DestroyBidir ); - - DestroyBidir.ulBiDirChannelHndl = cOCT6100_HNDL_TAG_BIDIR_CHANNEL | (pBiDirChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100ChannelDestroyBiDirSer( f_pApiInstance, &DestroyBidir ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Close all bridge participants. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i ++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, i ); - if ( pChanEntry->fReserved == TRUE && pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - { - /* This channel is on a bridge. */ - tOCT6100_CONF_BRIDGE_CHAN_REMOVE BridgeChanRemove; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - Oct6100ConfBridgeChanRemoveDef( &BridgeChanRemove ); - - /* Obtain a pointer to the conference bridge's list entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pChanEntry->usBridgeIndex ); - - BridgeChanRemove.fRemoveAll = TRUE; - BridgeChanRemove.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pChanEntry->usBridgeIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Close all opened channels. This will bring the broadcast TSSTs with it. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i ++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, i ); - - if ( pChanEntry->fReserved == TRUE ) - { - tOCT6100_CHANNEL_CLOSE ChannelClose; - - /* Generate handle. */ - ChannelClose.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - /* Call serialized close channel function. */ - ulResult = Oct6100ChannelCloseSer( f_pApiInstance, &ChannelClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /* Close all TSI connections. */ - if ( f_pFreeResources->fFreeTsiConnections == TRUE ) - { - tPOCT6100_API_TSI_CNCT pTsiCnct; - tOCT6100_TSI_CNCT_CLOSE TsiCnctClose; - - Oct6100TsiCnctCloseDef( &TsiCnctClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxTsiCncts; i ++ ) - { - /* Obtain a pointer to the TSI connection list entry. */ - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsiCnct, i ); - - if ( pTsiCnct->fReserved == TRUE ) - { - TsiCnctClose.ulTsiCnctHndl = cOCT6100_HNDL_TAG_TSI_CNCT | (pTsiCnct->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100TsiCnctCloseSer( f_pApiInstance, &TsiCnctClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - /* Close all conference bridges. */ - if ( f_pFreeResources->fFreeConferenceBridges == TRUE ) - { - tPOCT6100_API_CONF_BRIDGE pConfBridge; - tOCT6100_CONF_BRIDGE_CLOSE ConfBridgeClose; - - Oct6100ConfBridgeCloseDef( &ConfBridgeClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxConfBridges; i ++ ) - { - /* Obtain a pointer to the conference bridge's list entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pConfBridge, i ); - - if ( pConfBridge->fReserved == TRUE ) - { - ConfBridgeClose.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pConfBridge->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100ConfBridgeCloseSer( f_pApiInstance, &ConfBridgeClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Free all playout buffers loaded in external memory. */ - if ( f_pFreeResources->fFreePlayoutBuffers == TRUE ) - { - tPOCT6100_API_BUFFER pBuffer; - tOCT6100_BUFFER_UNLOAD BufferUnload; - - Oct6100BufferPlayoutUnloadDef( &BufferUnload ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxPlayoutBuffers; i ++ ) - { - - - /* Obtain a pointer to the buffer list entry. */ - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBuffer, i ); - - if ( pBuffer->fReserved == TRUE ) - { - BufferUnload.ulBufferIndex = i; - ulResult = Oct6100BufferUnloadSer( f_pApiInstance, &BufferUnload, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Close all phasing TSSTs. */ - if ( f_pFreeResources->fFreePhasingTssts == TRUE ) - { - tPOCT6100_API_PHASING_TSST pPhasingTsst; - tOCT6100_PHASING_TSST_CLOSE PhasingTsstClose; - - Oct6100PhasingTsstCloseDef( &PhasingTsstClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxPhasingTssts; i ++ ) - { - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingTsst, i ); - - if ( pPhasingTsst->fReserved == TRUE ) - { - PhasingTsstClose.ulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsst->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100PhasingTsstCloseSer( f_pApiInstance, &PhasingTsstClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - /* Close all ADPCM channels. */ - if ( f_pFreeResources->fFreeAdpcmChannels == TRUE ) - { - tPOCT6100_API_ADPCM_CHAN pAdpcmChannel; - tOCT6100_ADPCM_CHAN_CLOSE AdpcmChanClose; - - Oct6100AdpcmChanCloseDef( &AdpcmChanClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxAdpcmChannels; i ++ ) - { - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pAdpcmChannel, i ); - if ( pAdpcmChannel->fReserved == TRUE ) - { - AdpcmChanClose.ulChanHndl = cOCT6100_HNDL_TAG_ADPCM_CHANNEL | (pAdpcmChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100AdpcmChanCloseSer( f_pApiInstance, &AdpcmChanClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ProductionBistSer - -Description: This function returns the instantaneous production BIST status. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pProductionBist Pointer to user structure in which BIST status will - be returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ProductionBistSer -UINT32 Oct6100ProductionBistSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PRODUCTION_BIST f_pProductionBist ) -{ - UINT32 ulCalculatedCrc = cOCT6100_INVALID_VALUE; - UINT32 ulResult; - UINT32 ulLoopCnt = 0x0; - UINT32 i = 1; - UINT32 ulTotalElements = 4; - UINT32 ulReadAddress = cOCT6100_POUCH_BASE; - UINT32 aulMessage[ 5 ]; - - /* Check if the production bist has been activated. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableProductionBist == FALSE ) - return cOCT6100_ERR_PRODUCTION_BIST_DISABLED; - - f_pProductionBist->ulCurrentAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulCurrentLoop = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulCurrentTest = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulFailedAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulReadValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulExpectedValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulBistStatus = cOCT6100_BIST_IN_PROGRESS; - - /* The API knows that the firmware might be writing a status event. */ - /* The firmware does write a status event every 200ms (approximately). */ - /* So the status is read a couple of times to make sure an event was not read while */ - /* it was written. */ - while ( ulLoopCnt != 2 ) - { - /* Read the BIST status in the external memory. */ - for ( i = 0; i < ulTotalElements + 1; i ++ ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, ulReadAddress + i * 4, &aulMessage[ i ] ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Calculate the CRC of this message. */ - ulResult = Oct6100ApiProductionCrc( f_pApiInstance, aulMessage, ulTotalElements, &ulCalculatedCrc ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the CRCs do match, break off the while. We have a valid status event. */ - if ( aulMessage[ i - 1 ] == ulCalculatedCrc ) - break; - - ulLoopCnt++; - } - - /* Check if the CRC matches */ - if ( aulMessage[ i - 1 ] != ulCalculatedCrc ) - { - /* Well, the exchange memory at the base of the external memory is corrupted. */ - /* Something very basic is not working correctly with this chip! */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_STATUS_CRC_FAILED; - } - else - { - /* Check for problems. */ - switch ( aulMessage[ 0 ] & 0xFFFF ) - { - case ( 0x2 ): - - /* The initial configuration failed. */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_CONFIGURATION_FAILED; - break; - - case ( 0x1 ): - - /* A memory location failed. Return useful information to the user. */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_MEMORY_FAILED; - - f_pProductionBist->ulFailedAddress = ( aulMessage[ 1 ] & ( ~0x80000000 ) ) + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - f_pProductionBist->ulReadValue = aulMessage[ 2 ]; - f_pProductionBist->ulExpectedValue = aulMessage[ 3 ]; - break; - - case ( 0xFFFF ): - - /* Bist is completed! */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_SUCCESS; - break; - - default: - /* Bist is in progress. All seems to be working fine up to now. */ - - /* Return progress status. */ - f_pProductionBist->ulCurrentAddress = ( aulMessage[ 1 ] & ( ~0x80000000 ) ) + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - f_pProductionBist->ulCurrentTest = aulMessage[ 2 ]; - f_pProductionBist->ulCurrentLoop = aulMessage[ 3 ]; - break; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProductionCrc - -Description: This function calculates the crc for a production BIST - message. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulMessage Message to be exchanged with the firmware. The CRC - will be calculated on this. -f_ulMessageLength Length of the message to be exchanged. This value - does not include the CRC value at the end -f_pulCrcResult Resulting calculated CRC value. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProductionCrc -UINT32 Oct6100ApiProductionCrc( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulMessage, - IN UINT32 f_ulMessageLength, - OUT PUINT32 f_pulCrcResult ) -{ - UINT32 ulWidth = 32; - UINT32 ulKey, i, j; - UINT32 ulRemainder = 0; - - /* CRC the message. */ - ulRemainder = f_pulMessage[ f_ulMessageLength - 1 ]; - for ( j = f_ulMessageLength - 1; j != 0xFFFFFFFF ; j-- ) - { - for ( i = 0; i < ulWidth; i++ ) - { - if ( ( ( ulRemainder >> 0x1F ) & 0x1 ) == 0x1 ) - { - /* Division is by something meaningful */ - ulKey = 0x8765DCBA; - } - else - { - /* Remainder is less than our divisor */ - ulKey = 0; - } - ulRemainder = ulRemainder ^ ulKey; - - ulRemainder = ulRemainder << 1; - if ( j != 0 ) - { - ulRemainder = ulRemainder | ( ( f_pulMessage[ j - 1 ] ) >> ( 0x1F - i ) ); - } - } - } - - *f_pulCrcResult = ulRemainder; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearInterrupts - -Description: Called only by the Oct6100OpenChip function, this function - writes to all register ROLs to clear them. This is necessary - because some ROLs are set during the startup. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -IN f_pApiInst Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiClearInterrupts -UINT32 Oct6100ApiClearInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.ulWriteAddress = 0x102; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_102H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_202H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x302; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_302H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_502H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x702; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_702H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; - -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c deleted file mode 100644 index 0a51835c..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c +++ /dev/null @@ -1,440 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_stats.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to retreive the OCT6100 chip stats. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 89 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_stats_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_chip_stats_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_chip_stats_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipGetStats - -Description: Retreives the chip statistics and configuration. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipStats Pointer to a tOCT6100_CHIP_STATS structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipGetStatsDef -UINT32 Oct6100ChipGetStatsDef( - tPOCT6100_CHIP_STATS f_pChipStats ) -{ - f_pChipStats->fResetChipStats = FALSE; - - f_pChipStats->ulNumberChannels = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberTsiCncts = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberConfBridges = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberPlayoutBuffers = cOCT6100_INVALID_STAT; - f_pChipStats->ulPlayoutFreeMemSize = cOCT6100_INVALID_STAT; - - f_pChipStats->ulNumberPhasingTssts = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberAdpcmChannels = cOCT6100_INVALID_STAT; - - f_pChipStats->ulH100OutOfSynchCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulH100ClockABadCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulH100FrameABadCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulH100ClockBBadCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulInternalReadTimeoutCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulSdramRefreshTooLateCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulPllJitterErrorCount = cOCT6100_INVALID_STAT; - - f_pChipStats->ulOverflowToneEventsCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulSoftOverflowToneEventsCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulSoftOverflowBufferPlayoutEventsCount = cOCT6100_INVALID_STAT; - - - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ChipGetStats -UINT32 Oct6100ChipGetStats( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_STATS f_pChipStats ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChipGetStatsSer( f_pApiInstance, f_pChipStats ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipGetImageInfo - -Description: Retrieves the chip image information indicating the supported - features and tones. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipImageInfo Pointer to a tPOCT6100_CHIP_IMAGE_INFO structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipGetImageInfoDef -UINT32 Oct6100ChipGetImageInfoDef( - tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo ) -{ - UINT32 i; - - Oct6100UserMemSet( f_pChipImageInfo->szVersionNumber, 0x0, cOCT6100_VERSION_NUMBER_MAX_SIZE ); - - f_pChipImageInfo->fBufferPlayout = FALSE; - f_pChipImageInfo->fAdaptiveNoiseReduction = FALSE; - f_pChipImageInfo->fSoutNoiseBleaching = FALSE; - f_pChipImageInfo->fConferencingNoiseReduction = FALSE; - f_pChipImageInfo->fAutoLevelControl = FALSE; - f_pChipImageInfo->fHighLevelCompensation = FALSE; - f_pChipImageInfo->fSilenceSuppression = FALSE; - - f_pChipImageInfo->fAdpcm = FALSE; - f_pChipImageInfo->fConferencing = FALSE; - f_pChipImageInfo->fDominantSpeaker = FALSE; - f_pChipImageInfo->ulMaxChannels = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulNumTonesAvailable = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulToneProfileNumber = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulMaxTailDisplacement = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulBuildId = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulMaxTailLength = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulDebugEventSize = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulMaxPlayoutEvents = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulImageType = cOCT6100_INVALID_VALUE; - - f_pChipImageInfo->fAcousticEcho = FALSE; - f_pChipImageInfo->fAecTailLength = FALSE; - f_pChipImageInfo->fToneRemoval = FALSE; - - f_pChipImageInfo->fDefaultErl = FALSE; - f_pChipImageInfo->fNonLinearityBehaviorA = FALSE; - f_pChipImageInfo->fNonLinearityBehaviorB = FALSE; - f_pChipImageInfo->fPerChannelTailDisplacement = FALSE; - f_pChipImageInfo->fPerChannelTailLength = FALSE; - f_pChipImageInfo->fListenerEnhancement = FALSE; - f_pChipImageInfo->fRoutNoiseReduction = FALSE; - f_pChipImageInfo->fRoutNoiseReductionLevel = FALSE; - f_pChipImageInfo->fAnrSnrEnhancement = FALSE; - f_pChipImageInfo->fAnrVoiceNoiseSegregation = FALSE; - f_pChipImageInfo->fToneDisablerVqeActivationDelay = FALSE; - f_pChipImageInfo->fMusicProtection = FALSE; - f_pChipImageInfo->fDoubleTalkBehavior = FALSE; - f_pChipImageInfo->fIdleCodeDetection = TRUE; - f_pChipImageInfo->fSinLevel = TRUE; - - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - Oct6100UserMemSet( f_pChipImageInfo->aToneInfo[ i ].aszToneName, 0x00, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - f_pChipImageInfo->aToneInfo[ i ].ulDetectionPort = cOCT6100_INVALID_PORT; - f_pChipImageInfo->aToneInfo[ i ].ulToneID = cOCT6100_INVALID_VALUE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ChipGetImageInfo -UINT32 Oct6100ChipGetImageInfo( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo ) -{ - tPOCT6100_API_IMAGE_INFO pImageInfo; - UINT32 i; - - /* Get local pointer(s). */ - pImageInfo = &f_pApiInstance->pSharedInfo->ImageInfo; - - Oct6100UserMemCopy( f_pChipImageInfo->szVersionNumber, pImageInfo->szVersionNumber, cOCT6100_VERSION_NUMBER_MAX_SIZE ); - - /* Copy the customer info. */ - f_pChipImageInfo->ulBuildId = pImageInfo->ulBuildId; - - /* Copy the features list. */ - f_pChipImageInfo->fBufferPlayout = pImageInfo->fBufferPlayout; - f_pChipImageInfo->fAdaptiveNoiseReduction = pImageInfo->fAdaptiveNoiseReduction; - f_pChipImageInfo->fSoutNoiseBleaching = pImageInfo->fSoutNoiseBleaching; - f_pChipImageInfo->fSilenceSuppression = pImageInfo->fSilenceSuppression; - - f_pChipImageInfo->fAdpcm = pImageInfo->fAdpcm; - f_pChipImageInfo->fConferencing = pImageInfo->fConferencing; - f_pChipImageInfo->fDominantSpeaker = pImageInfo->fDominantSpeakerEnabled; - f_pChipImageInfo->fConferencingNoiseReduction = pImageInfo->fConferencingNoiseReduction; - f_pChipImageInfo->fAcousticEcho = pImageInfo->fAcousticEcho; - f_pChipImageInfo->fAecTailLength = pImageInfo->fAecTailLength; - f_pChipImageInfo->fDefaultErl = pImageInfo->fDefaultErl; - f_pChipImageInfo->fToneRemoval = pImageInfo->fToneRemoval; - - f_pChipImageInfo->fNonLinearityBehaviorA = pImageInfo->fNonLinearityBehaviorA; - f_pChipImageInfo->fNonLinearityBehaviorB = pImageInfo->fNonLinearityBehaviorB; - f_pChipImageInfo->fPerChannelTailDisplacement = pImageInfo->fPerChannelTailDisplacement; - f_pChipImageInfo->fListenerEnhancement = pImageInfo->fListenerEnhancement; - f_pChipImageInfo->fRoutNoiseReduction = pImageInfo->fRoutNoiseReduction; - f_pChipImageInfo->fRoutNoiseReductionLevel = pImageInfo->fRoutNoiseReductionLevel; - f_pChipImageInfo->fAnrSnrEnhancement = pImageInfo->fAnrSnrEnhancement; - f_pChipImageInfo->fAnrVoiceNoiseSegregation = pImageInfo->fAnrVoiceNoiseSegregation; - f_pChipImageInfo->fMusicProtection = pImageInfo->fMusicProtection; - f_pChipImageInfo->fIdleCodeDetection = pImageInfo->fIdleCodeDetection; - f_pChipImageInfo->fSinLevel = pImageInfo->fSinLevel; - f_pChipImageInfo->fDoubleTalkBehavior = pImageInfo->fDoubleTalkBehavior; - f_pChipImageInfo->fHighLevelCompensation = pImageInfo->fRinHighLevelCompensation; - - if ( ( pImageInfo->fRinAutoLevelControl == TRUE ) && ( pImageInfo->fSoutAutoLevelControl == TRUE ) ) - f_pChipImageInfo->fAutoLevelControl = TRUE; - else - f_pChipImageInfo->fAutoLevelControl = FALSE; - - f_pChipImageInfo->ulMaxChannels = pImageInfo->usMaxNumberOfChannels; - f_pChipImageInfo->ulNumTonesAvailable = pImageInfo->byNumToneDetectors; - f_pChipImageInfo->ulToneProfileNumber = pImageInfo->ulToneProfileNumber; - f_pChipImageInfo->ulMaxTailDisplacement = pImageInfo->usMaxTailDisplacement; - f_pChipImageInfo->ulMaxTailLength = pImageInfo->usMaxTailLength; - f_pChipImageInfo->fPerChannelTailLength = pImageInfo->fPerChannelTailLength; - f_pChipImageInfo->ulDebugEventSize = f_pApiInstance->pSharedInfo->DebugInfo.ulDebugEventSize; - f_pChipImageInfo->fToneDisablerVqeActivationDelay = pImageInfo->fToneDisablerVqeActivationDelay; - f_pChipImageInfo->ulMaxPlayoutEvents = pImageInfo->byMaxNumberPlayoutEvents - 1; /* 127 or 31 */ - f_pChipImageInfo->ulImageType = pImageInfo->byImageType; - - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - Oct6100UserMemCopy( f_pChipImageInfo->aToneInfo[ i ].aszToneName, pImageInfo->aToneInfo[ i ].aszToneName, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - f_pChipImageInfo->aToneInfo[ i ].ulDetectionPort = pImageInfo->aToneInfo[ i ].ulDetectionPort; - f_pChipImageInfo->aToneInfo[ i ].ulToneID = pImageInfo->aToneInfo[ i ].ulToneID; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiChipStatsSwInit - -Description: Initializes portions of API instance associated to chip stats. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiChipStatsSwInit -UINT32 Oct6100ApiChipStatsSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Get local pointer to shared portion of API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize chip stats. */ - pSharedInfo->ErrorStats.fFatalChipError = FALSE; - - pSharedInfo->ErrorStats.ulH100ClkABadCnt = 0; - pSharedInfo->ErrorStats.ulH100ClkBBadCnt = 0; - pSharedInfo->ErrorStats.ulH100FrameABadCnt = 0; - pSharedInfo->ErrorStats.ulH100OutOfSyncCnt = 0; - - pSharedInfo->ErrorStats.ulInternalReadTimeoutCnt = 0; - pSharedInfo->ErrorStats.ulSdramRefreshTooLateCnt = 0; - pSharedInfo->ErrorStats.ulPllJitterErrorCnt = 0; - pSharedInfo->ErrorStats.ulOverflowToneEventsCnt = 0; - - - - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt = 0; - - /* Init the chip stats. */ - pSharedInfo->ChipStats.usNumberChannels = 0; - pSharedInfo->ChipStats.usNumberBiDirChannels = 0; - pSharedInfo->ChipStats.usNumberTsiCncts = 0; - pSharedInfo->ChipStats.usNumberConfBridges = 0; - pSharedInfo->ChipStats.usNumberPlayoutBuffers = 0; - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts = 0; - pSharedInfo->ChipStats.ulPlayoutMemUsed = 0; - pSharedInfo->ChipStats.usNumEcChanUsingMixer = 0; - - pSharedInfo->ChipStats.usNumberPhasingTssts = 0; - pSharedInfo->ChipStats.usNumberAdpcmChans = 0; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipGetStatsSer - -Description: Serialized function retreiving the chip statistics. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipStats Pointer to master mode configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipGetStatsSer -UINT32 Oct6100ChipGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHIP_STATS f_pChipStats ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - f_pChipStats->ulNumberChannels = pSharedInfo->ChipStats.usNumberChannels; - f_pChipStats->ulNumberTsiCncts = pSharedInfo->ChipStats.usNumberTsiCncts; - f_pChipStats->ulNumberConfBridges = pSharedInfo->ChipStats.usNumberConfBridges; - f_pChipStats->ulNumberPlayoutBuffers = pSharedInfo->ChipStats.usNumberPlayoutBuffers; - f_pChipStats->ulPlayoutFreeMemSize = ( f_pApiInstance->pSharedInfo->MiscVars.ulTotalMemSize - ( f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress - cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) ) - ( pSharedInfo->ChipStats.ulPlayoutMemUsed ); - - f_pChipStats->ulNumberPhasingTssts = pSharedInfo->ChipStats.usNumberPhasingTssts; - f_pChipStats->ulNumberAdpcmChannels = pSharedInfo->ChipStats.usNumberAdpcmChans; - - /* Check the input parameters. */ - if ( f_pChipStats->fResetChipStats != TRUE && - f_pChipStats->fResetChipStats != FALSE ) - return cOCT6100_ERR_CHIP_STATS_RESET; - - if ( f_pChipStats->fResetChipStats == TRUE ) - { - pSharedInfo->ErrorStats.ulH100OutOfSyncCnt = 0; - pSharedInfo->ErrorStats.ulH100ClkABadCnt = 0; - pSharedInfo->ErrorStats.ulH100FrameABadCnt = 0; - pSharedInfo->ErrorStats.ulH100ClkBBadCnt = 0; - - pSharedInfo->ErrorStats.ulInternalReadTimeoutCnt = 0; - pSharedInfo->ErrorStats.ulPllJitterErrorCnt = 0; - pSharedInfo->ErrorStats.ulSdramRefreshTooLateCnt = 0; - - pSharedInfo->ErrorStats.ulOverflowToneEventsCnt = 0; - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt = 0; - - - } - - f_pChipStats->ulH100OutOfSynchCount = pSharedInfo->ErrorStats.ulH100OutOfSyncCnt; - f_pChipStats->ulH100ClockABadCount = pSharedInfo->ErrorStats.ulH100ClkABadCnt; - f_pChipStats->ulH100FrameABadCount = pSharedInfo->ErrorStats.ulH100FrameABadCnt; - f_pChipStats->ulH100ClockBBadCount = pSharedInfo->ErrorStats.ulH100ClkBBadCnt; - - f_pChipStats->ulInternalReadTimeoutCount = pSharedInfo->ErrorStats.ulInternalReadTimeoutCnt; - f_pChipStats->ulPllJitterErrorCount = pSharedInfo->ErrorStats.ulPllJitterErrorCnt; - f_pChipStats->ulSdramRefreshTooLateCount = pSharedInfo->ErrorStats.ulSdramRefreshTooLateCnt; - - f_pChipStats->ulOverflowToneEventsCount = pSharedInfo->ErrorStats.ulOverflowToneEventsCnt; - f_pChipStats->ulSoftOverflowToneEventsCount = pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt; - f_pChipStats->ulSoftOverflowBufferPlayoutEventsCount = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt; - - - - return cOCT6100_ERR_OK; -} -#endif - diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c deleted file mode 100644 index 63c458af..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c +++ /dev/null @@ -1,7687 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_conf_bridge.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains all functions related to a conference bridge. Procedures - needed to open/close a bridge, add/remove a participant to a conference - bridge, mute/unmute a participant, etc.. are all present in this source - file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 146 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_mixer_inst.h" -#include "oct6100api/oct6100_conf_bridge_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" -#include "oct6100api/oct6100_conf_bridge_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_mixer_priv.h" -#include "oct6100_conf_bridge_priv.h" - - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeOpen - -Description: This function opens a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeOpenDef -UINT32 Oct6100ConfBridgeOpenDef( - tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - f_pConfBridgeOpen->pulConfBridgeHndl = NULL; - f_pConfBridgeOpen->fFlexibleConferencing = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeOpen -UINT32 Oct6100ConfBridgeOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeOpenSer( f_pApiInstance, f_pConfBridgeOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeClose - -Description: This function closes a conference bridge. A conference - bridge can only be closed if no participants are present on - the bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeClose Pointer to conference bridge close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeCloseDef -UINT32 Oct6100ConfBridgeCloseDef( - tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ) -{ - f_pConfBridgeClose->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeClose -UINT32 Oct6100ConfBridgeClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeCloseSer( f_pApiInstance, f_pConfBridgeClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanAdd - -Description: This function adds an echo channel (participant) to a - conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeAdd Pointer to conference bridge channel addition structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanAddDef -UINT32 Oct6100ConfBridgeChanAddDef( - tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ) -{ - f_pConfBridgeAdd->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeAdd->ulInputPort = cOCT6100_CHANNEL_PORT_SOUT; - f_pConfBridgeAdd->ulListenerMaskIndex = cOCT6100_INVALID_VALUE; - f_pConfBridgeAdd->ulListenerMask = 0; - f_pConfBridgeAdd->fMute = FALSE; - f_pConfBridgeAdd->ulTappedChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeChanAdd -UINT32 Oct6100ConfBridgeChanAdd( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanAddSer( f_pApiInstance, f_pConfBridgeAdd ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanRemove - -Description: This function removes an echo channel (participant) from a - conference bridge. All participants can be removed from - the bridge if a special flag (fRemoveAll) is set to TRUE. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeRemove Pointer to conference bridge channel removal structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanRemoveDef -UINT32 Oct6100ConfBridgeChanRemoveDef( - tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ) -{ - f_pConfBridgeRemove->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeRemove->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeRemove->fRemoveAll = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeChanRemove -UINT32 Oct6100ConfBridgeChanRemove( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, f_pConfBridgeRemove ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanMute - -Description: This function mutes a participant present on a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMute Pointer to conference bridge channel mute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanMuteDef -UINT32 Oct6100ConfBridgeChanMuteDef( - tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ) -{ - f_pConfBridgeMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeChanMute -UINT32 Oct6100ConfBridgeChanMute( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanMuteSer( f_pApiInstance, f_pConfBridgeMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanUnMute - -Description: This function unmutes a channel on a bridge. The other member - of the conference will start to hear this participant again. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanUnMuteDef -UINT32 Oct6100ConfBridgeChanUnMuteDef( - tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ) -{ - f_pConfBridgeUnMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ConfBridgeChanUnMute -UINT32 Oct6100ConfBridgeChanUnMute( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanUnMuteSer( f_pApiInstance, f_pConfBridgeUnMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeDominantSpeakerSet - -Description: This function sets a participant present on a conference - bridge as the dominant speaker. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeDominant Pointer to conference bridge dominant speaker - structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeDominantSpeakerSetDef -UINT32 Oct6100ConfBridgeDominantSpeakerSetDef( - tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ) -{ - f_pConfBridgeDominantSpeaker->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeDominantSpeaker->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeDominantSpeakerSet -UINT32 Oct6100ConfBridgeDominantSpeakerSet( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeDominantSpeakerSetSer( f_pApiInstance, f_pConfBridgeDominantSpeaker ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeMaskChange - -Description: This function changes the mask of a flexible bridge participant. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeMaskChange Pointer to conference bridge change of mask - structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeMaskChangeDef -UINT32 Oct6100ConfBridgeMaskChangeDef( - tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ) -{ - f_pConfBridgeMaskChange->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeMaskChange->ulNewListenerMask = 0x0; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeMaskChange -UINT32 Oct6100ConfBridgeMaskChange( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeMaskChangeSer( f_pApiInstance, f_pConfBridgeMaskChange ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeGetStats - -Description: This function returns the stats for a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeStats Pointer to conference bridge channel stats structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeGetStatsDef -UINT32 Oct6100ConfBridgeGetStatsDef( - tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ) -{ - f_pConfBridgeStats->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeStats->ulNumChannels = cOCT6100_INVALID_STAT; - f_pConfBridgeStats->ulNumTappedChannels = cOCT6100_INVALID_STAT; - f_pConfBridgeStats->fFlexibleConferencing = cOCT6100_INVALID_STAT; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeGetStats -UINT32 Oct6100ConfBridgeGetStats( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeGetStatsSer( f_pApiInstance, f_pConfBridgeStats ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetConfBridgeSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of conference bridges. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetConfBridgeSwSizes -UINT32 Oct6100ApiGetConfBridgeSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Calculate memory needed for conference bridge list. */ - if ( f_pOpenChip->ulMaxConfBridges == 0 && f_pOpenChip->fEnableChannelRecording == TRUE ) - f_pOpenChip->ulMaxConfBridges = 1; - f_pInstSizes->ulConfBridgeList = f_pOpenChip->ulMaxConfBridges * sizeof( tOCT6100_API_CONF_BRIDGE ); - - /* Calculate memory needed for conference bridge allocation software. */ - if ( f_pOpenChip->ulMaxConfBridges > 0 ) - { - /* Get size of bridge allocation memory */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxConfBridges, &f_pInstSizes->ulConfBridgeAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1C; - - /* Check if the user wants to build flexible conference bridges. */ - if ( f_pOpenChip->ulMaxFlexibleConfParticipants > 0 ) - { - /* Allocate the lowest quantity according to what the user requested. */ - if ( f_pOpenChip->ulMaxFlexibleConfParticipants < ( f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) ) - f_pInstSizes->ulFlexConfParticipantsList = f_pOpenChip->ulMaxFlexibleConfParticipants * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT ); - else - { - f_pOpenChip->ulMaxFlexibleConfParticipants = f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; - f_pInstSizes->ulFlexConfParticipantsList = f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT ); - } - - /* Get size of flexible conferencing participants allocation memory */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxFlexibleConfParticipants, &f_pInstSizes->ulFlexConfParticipantsAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1C; - } - else - { - f_pInstSizes->ulFlexConfParticipantsList = 0; - f_pInstSizes->ulFlexConfParticipantsAlloc = 0; - } - } - else - { - f_pInstSizes->ulMixerEventList = 0; - f_pInstSizes->ulMixerEventAlloc = 0; - f_pInstSizes->ulConfBridgeAlloc = 0; - - /* Make sure flexible conferencing is not used. */ - f_pInstSizes->ulFlexConfParticipantsList = 0; - f_pInstSizes->ulFlexConfParticipantsAlloc = 0; - } - - /* Calculate memory needed for list and allocation software serialization. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConfBridgeList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConfBridgeAlloc, ulTempVar ) - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulFlexConfParticipantsList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulFlexConfParticipantsAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiConfBridgeSwInit - -Description: Initializes all elements of the instance structure associated - to conference bridges. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiConfBridgeSwInit -UINT32 Oct6100ApiConfBridgeSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CONF_BRIDGE pConfBridgeList; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pFlexConfParticipantList; - PVOID pFlexConfPartipantsAlloc; - UINT32 ulMaxFlexConfParicipants; - PVOID pConfBridgeAlloc; - UINT32 ulMaxConfBridges; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the maximum number of conference bridges. */ - ulMaxConfBridges = pSharedInfo->ChipConfig.usMaxConfBridges; - - /*===================================================================*/ - /* Set all entries in the conference bridge list to unused. */ - - mOCT6100_GET_CONF_BRIDGE_LIST_PNT( pSharedInfo, pConfBridgeList ); - - /* Initialize the conference bridge allocation software to "all free". */ - if ( ulMaxConfBridges > 0 ) - { - /* Clear the bridge memory */ - Oct6100UserMemSet( pConfBridgeList, 0x00, ulMaxConfBridges * sizeof( tOCT6100_API_CONF_BRIDGE )); - - mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( pSharedInfo, pConfBridgeAlloc ) - - ulResult = OctapiLlmAllocInit( &pConfBridgeAlloc, ulMaxConfBridges ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1E; - } - /*===================================================================*/ - - - /*===================================================================*/ - /* Set all entries in the flexible conferencing participant list to unused. */ - - /* Get the maximum number of flexible conferencing participants. */ - ulMaxFlexConfParicipants = pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_LIST_PNT( pSharedInfo, pFlexConfParticipantList ); - - /* Initialize the flexible conferencing allocation software. */ - if ( ulMaxFlexConfParicipants > 0 ) - { - UINT32 i, ulEventIndex; - - /* Clear the participants memory */ - Oct6100UserMemSet( pFlexConfParticipantList, 0x00, ulMaxFlexConfParicipants * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT )); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( pSharedInfo, pFlexConfPartipantsAlloc ) - - ulResult = OctapiLlmAllocInit( &pFlexConfPartipantsAlloc, ulMaxFlexConfParicipants ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1E; - - /* Initialize the conferencing indexes. */ - for ( i = 0; i < ulMaxFlexConfParicipants; i ++ ) - { - for ( ulEventIndex = 0; ulEventIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulEventIndex ++ ) - pFlexConfParticipantList[ i ].ausLoadOrAccumulateEventIndex[ ulEventIndex ] = cOCT6100_INVALID_INDEX; - } - } - - /*===================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeOpenSer - -Description: Open a conference bridge. Note that no chip resources are - allocated until a channel is added to the bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge configuration structure. - The handle identifying the conference bridge in all - future function calls is returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeOpenSer -UINT32 Oct6100ConfBridgeOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - UINT16 usBridgeIndex; - UINT32 ulResult; - - /* Check the user's configuration of the conference bridge for errors. */ - ulResult = Oct6100ApiCheckBridgeParams( f_pApiInstance, f_pConfBridgeOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the conference bridge. */ - ulResult = Oct6100ApiReserveBridgeResources( f_pApiInstance, &usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new conference bridge's entry in the conference bridge list. */ - ulResult = Oct6100ApiUpdateBridgeEntry( f_pApiInstance, f_pConfBridgeOpen, usBridgeIndex); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeParams - -Description: Checks the user's conference bridge open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeParams -UINT32 Oct6100ApiCheckBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeOpen->pulConfBridgeHndl == NULL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fConferencing == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CONF_BRIDGE; - - if ( f_pConfBridgeOpen->fFlexibleConferencing != FALSE - && f_pConfBridgeOpen->fFlexibleConferencing != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBridgeResources - -Description: Reserves all resources needed for the new conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusBridgeIndex Allocated entry in the API conference bridge list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBridgeResources -UINT32 Oct6100ApiReserveBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusBridgeIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the conference bridge list. */ - ulResult = Oct6100ApiReserveBridgeEntry( f_pApiInstance, f_pusBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeEntry - -Description: Updates the new conference bridge's entry in the conference - bridge list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge configuration structure. -f_usBridgeIndex Allocated entry in API conference bridge list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeEntry -UINT32 Oct6100ApiUpdateBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen, - IN UINT16 f_usBridgeIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - - /*================================================================================*/ - /* Obtain a pointer to the new conference bridge's list entry. */ - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ) - - /* No clients are currently connected to the bridge. */ - pBridgeEntry->usNumClients = 0; - /* Nobody is tapped for now. */ - pBridgeEntry->usNumTappedClients = 0; - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX; - - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - - /* Now update the bridge pointer. */ - if ( f_pApiInstance->pSharedInfo->MiscVars.usNumBridgesOpened == 0 ) - { - pBridgeEntry->usNextBridgePtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usPrevBridgePtr = cOCT6100_INVALID_INDEX; - - /* Set the global first bridge to this bridge. */ - f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge = f_usBridgeIndex; - } - else /* Insert this bridge at the head of the bridge list.*/ - { - if ( f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_FATAL_22; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge ) - - if ( pTempBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_FATAL_23; - - /* Modify the old first entry. */ - pTempBridgeEntry->usPrevBridgePtr = f_usBridgeIndex; - - /* Modify current pointer. */ - pBridgeEntry->usPrevBridgePtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usNextBridgePtr = f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge; - - /* Set the new first bridge of the list. */ - f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge = f_usBridgeIndex; - } - - /* Form handle returned to user. */ - *f_pConfBridgeOpen->pulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usBridgeIndex; - - /* Remember whether or not we are a flexible conference bridge. */ - pBridgeEntry->fFlexibleConferencing = (UINT8)( f_pConfBridgeOpen->fFlexibleConferencing & 0xFF ); - - /* Finally, mark the conference bridge as opened. */ - pBridgeEntry->fReserved = TRUE; - - /* Increment the number of conference bridge opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberConfBridges++; - f_pApiInstance->pSharedInfo->MiscVars.usNumBridgesOpened++; - - /*================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeCloseSer - -Description: Closes a conference bridge. Note that no client must be present - on the bridge for the bridge to be closed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeClose Pointer to conference bridge close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeCloseSer -UINT32 Oct6100ConfBridgeCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ) -{ - UINT16 usBridgeIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertBridgeParams( f_pApiInstance, f_pConfBridgeClose, &usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the conference bridge. */ - ulResult = Oct6100ApiReleaseBridgeResources( f_pApiInstance, usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pConfBridgeClose->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertBridgeParams - -Description: Checks the user's conference bridge close configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeClose Pointer to conference bridge close structure. -f_pusBridgeIndex Pointer to API instance conference bridge index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertBridgeParams -UINT32 Oct6100ApiAssertBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose, - OUT PUINT16 f_pusBridgeIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - UINT32 ulEntryOpenCnt; - - /* Check the provided handle. */ - if ( (f_pConfBridgeClose->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeClose->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeClose->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( pBridgeEntry->usNumClients != 0 ) - return cOCT6100_ERR_CONF_BRIDGE_ACTIVE_DEPENDENCIES; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBridgeResources - -Description: Release all resources reserved for the conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBridgeIndex Allocated external memory block for the conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBridgeResources -UINT32 Oct6100ApiReleaseBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Release the entry from the conference bridge list. */ - ulResult = Oct6100ApiReleaseBridgeEntry( f_pApiInstance, f_usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_24; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - /* Remove the bridge entry from the bridge list. */ - if ( pSharedInfo->MiscVars.usNumBridgesOpened == 1 ) - { - /* This bridge was the only one opened. */ - pSharedInfo->MiscVars.usFirstBridge = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MiscVars.usNumBridgesOpened > 1 ) - { - /* There are more then one bridge open, must update the list. */ - if ( pBridgeEntry->usPrevBridgePtr != cOCT6100_INVALID_INDEX ) - { - /* There is a valid entry before this bridge, let's update this entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, pBridgeEntry->usPrevBridgePtr ); - - pTempBridgeEntry->usNextBridgePtr = pBridgeEntry->usNextBridgePtr; - } - - if ( pBridgeEntry->usNextBridgePtr != cOCT6100_INVALID_INDEX ) - { - /* There is a valid entry after this bridge, let's update this entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, pBridgeEntry->usNextBridgePtr ); - - pTempBridgeEntry->usPrevBridgePtr = pBridgeEntry->usPrevBridgePtr; - } - - if ( pSharedInfo->MiscVars.usFirstBridge == f_usBridgeIndex ) - { - /* This entry was the first of the list, make the next one be the first now. */ - pSharedInfo->MiscVars.usFirstBridge = pBridgeEntry->usNextBridgePtr; - } - } - else - { - /* Variable has become out of sync. */ - return cOCT6100_ERR_FATAL_25; - } - - /*=============================================================*/ - /* Update the conference bridge's list entry. */ - - /* Mark the bridge as closed. */ - pBridgeEntry->fFlexibleConferencing = FALSE; - pBridgeEntry->fReserved = FALSE; - pBridgeEntry->byEntryOpenCnt++; - - /* Decrement the number of conference bridges opened. */ - pSharedInfo->MiscVars.usNumBridgesOpened--; - pSharedInfo->ChipStats.usNumberConfBridges--; - - /*=============================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanAddSer - -Description: Adds an echo channel (participant) to a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeAdd Pointer to conference bridge channel add structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanAddSer -UINT32 Oct6100ConfBridgeChanAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ) -{ - UINT16 usBridgeIndex; - UINT16 usChanIndex; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT16 usCopyEventIndex; - UINT32 ulInputPort; - UINT8 fFlexibleConfBridge; - UINT32 ulListenerMaskIndex; - UINT32 ulListenerMask; - UINT16 usTapChanIndex; - UINT16 usTapBridgeIndex; - UINT8 fMute; - UINT8 fTap; - UINT32 ulResult; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckBridgeAddParams( - f_pApiInstance, - f_pConfBridgeAdd, - &usBridgeIndex, - &usChanIndex, - &fMute, - &ulInputPort, - &fFlexibleConfBridge, - &ulListenerMaskIndex, - &ulListenerMask, - &fTap, - &usTapChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the conference bridge. */ - ulResult = Oct6100ApiReserveBridgeAddResources( - f_pApiInstance, - usBridgeIndex, - usChanIndex, - ulInputPort, - fFlexibleConfBridge, - ulListenerMaskIndex, - ulListenerMask, - fTap, - &usLoadEventIndex, - &usSubStoreEventIndex, - &usCopyEventIndex, - &usTapBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the conference bridge. */ - ulResult = Oct6100ApiBridgeEventAdd( - f_pApiInstance, - usBridgeIndex, - usChanIndex, - fFlexibleConfBridge, - usLoadEventIndex, - usSubStoreEventIndex, - usCopyEventIndex, - ulInputPort, - fMute, - ulListenerMaskIndex, - ulListenerMask, - fTap, - usTapBridgeIndex, - usTapChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeAddParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeAdd Pointer to conference bridge channenl add structure. -f_pusBridgeIndex Extracted bridge index where this channel should be - added. -f_pusChannelIndex Extracted channel index related to the channel handle - to be added to the bridge. -f_pfMute Whether to mute this channel in the bridge or not. -f_pulInputPort Input port where the channel signal should be - copied from. -f_pfFlexibleConfBridge If this is a flexible conference bridge. -f_pulListenerMaskIndex Index of the listener in this flexible conference bridge. -f_pulListenerMask Mask of listeners in this flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeAddParams -UINT32 Oct6100ApiCheckBridgeAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfMute, - OUT PUINT32 f_pulInputPort, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT32 f_pulListenerMaskIndex, - OUT PUINT32 f_pulListenerMask, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusTapChannelIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - UINT8 byTapChannelLaw; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 1 && - f_pApiInstance->pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeAdd->ulConfBridgeHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - if ( f_pConfBridgeAdd->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - if( f_pConfBridgeAdd->ulInputPort != cOCT6100_CHANNEL_PORT_SOUT - && f_pConfBridgeAdd->ulInputPort != cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_INPUT_PORT; - - if ( f_pConfBridgeAdd->fMute != TRUE && f_pConfBridgeAdd->fMute != FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MUTE; - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - if ( (f_pConfBridgeAdd->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeAdd->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeAdd->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* When we a flexible conference bridge, more things need to be checked. */ - if ( pBridgeEntry->fFlexibleConferencing == TRUE ) - { - /* Check if flexible conferencing has been activated. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_DISABLED; - - /* Check the number of clients on the bridge. */ - if ( pBridgeEntry->usNumClients >= cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_PARTICIPANT_CNT; - - /* Check if the listener index in a flexible bridge is valid. */ - if ( f_pConfBridgeAdd->ulListenerMaskIndex == cOCT6100_INVALID_VALUE - || f_pConfBridgeAdd->ulListenerMaskIndex >= cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_MASK_INDEX; - } - - if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE ) - { - if ( pBridgeEntry->fFlexibleConferencing == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_TAP_NOT_SUPPORTED; - } - - /*=====================================================================*/ - - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pConfBridgeAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - if ( pEchoChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ALREADY_ON_BRIDGE; - if ( pEchoChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_BIDIR; - /* Law conversion is not allowed on a conference bridge. */ - if ( ( pEchoChanEntry->TdmConfig.usRinTimeslot != cOCT6100_UNASSIGNED ) - && ( pEchoChanEntry->TdmConfig.usRoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - if ( pEchoChanEntry->TdmConfig.byRinPcmLaw != pEchoChanEntry->TdmConfig.byRoutPcmLaw ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION; - } - if ( ( pEchoChanEntry->TdmConfig.usSinTimeslot != cOCT6100_UNASSIGNED ) - && ( pEchoChanEntry->TdmConfig.usSoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - if ( pEchoChanEntry->TdmConfig.bySinPcmLaw != pEchoChanEntry->TdmConfig.bySoutPcmLaw ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION; - } - if ( pEchoChanEntry->fRinRoutCodecActive == TRUE || pEchoChanEntry->fSinSoutCodecActive == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_CODEC_ACTIVE; - if ( pEchoChanEntry->fEnableExtToneDetection == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_EXT_TONE_ENABLED; - if ( pEchoChanEntry->usCopyEventCnt != 0x0 ) - return cOCT6100_ERR_CONF_BRIDGE_COPY_EVENTS; - - /* If the bridge is flexible, few more things need to be checked. */ - if ( pBridgeEntry->fFlexibleConferencing == TRUE ) - { - tPOCT6100_SHARED_INFO pSharedInfo; - UINT16 usChannelIndex; - UINT32 ulResult = cOCT6100_ERR_OK; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if the listener index has been used by another channel in the specified bridge. */ - for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != ( *f_pusChannelIndex ) ) && ( pEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pEchoChanEntry->usBridgeIndex == ( *f_pusBridgeIndex ) ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if this participant has the same listener index. */ - if ( f_pConfBridgeAdd->ulListenerMaskIndex == pCurrentParticipant->ulListenerMaskIndex ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_INDEX_USED; - } - } - } - } - - if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE ) - { - /* For internal logic, make sure the mute flag is set to false. */ - f_pConfBridgeAdd->fMute = FALSE; - - /* Force input port to Sout for logic below. */ - f_pConfBridgeAdd->ulInputPort = cOCT6100_CHANNEL_PORT_SOUT; - - /* Keep law to check for conversion. */ - /* Check if the same law. */ - byTapChannelLaw = pEchoChanEntry->TdmConfig.bySoutPcmLaw; - - /* Check the tap handle. */ - if ( (f_pConfBridgeAdd->ulTappedChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE; - - *f_pusTapChannelIndex = (UINT16)( f_pConfBridgeAdd->ulTappedChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusTapChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusTapChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeAdd->ulTappedChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE; - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_BRIDGE; - if ( pEchoChanEntry->usBridgeIndex != *f_pusBridgeIndex ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_SAME_BRIDGE; - - /* We can only tap a channel added on the Sout port. */ - if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_TAP_SOUT_ONLY; - - /* Check if already tapped. */ - if ( pEchoChanEntry->fBeingTapped == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_ALREADY_TAPPED; - } - - /*=====================================================================*/ - - /* Return the tap flag. */ - if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE ) - { - *f_pfTap = TRUE; - } - else - { - *f_pfTap = FALSE; - } - - /* Return the mute config specified. */ - *f_pfMute = (UINT8)( f_pConfBridgeAdd->fMute & 0xFF ); - - /* Return the input port specified. */ - *f_pulInputPort = f_pConfBridgeAdd->ulInputPort; - - /* Return whether we are in the flexible conference bridge case. */ - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - /* Return the listener mask index as specified. */ - *f_pulListenerMaskIndex = f_pConfBridgeAdd->ulListenerMaskIndex; - - /* Return the listener mask as specified. */ - *f_pulListenerMask = f_pConfBridgeAdd->ulListenerMask; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBridgeAddResources - -Description: Reserves all resources needed for the addition of a channel to - the conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index of the bridge where this channel is added. -f_usChanIndex Channel index of the channel to be added to the bridge. -f_ulInputPort Input port where to copy samples from. -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_ulListenerMaskIndex Index of the listener in this flexible conference bridge. -f_ulListenerMask Mask of listeners in this flexible conference bridge. -f_pusLoadEventIndex Load event index within the API's list of mixer event. -f_pusSubStoreEventIndex Sub-Store event index within the API's list of mixer event. -f_pusCopyEventIndex Copy event index within the API's list of mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBridgeAddResources -UINT32 Oct6100ApiReserveBridgeAddResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fFlexibleConfBridge, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex, - OUT PUINT16 f_pusTapBridgeIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - UINT32 ulResult; - UINT32 ulTempVar; - UINT16 usChannelIndex; - BOOL fLoadEventReserved = FALSE; - BOOL fStoreEventReserved = FALSE; - BOOL fCopyEventReserved = FALSE; - BOOL fExtraSinTsiReserved = FALSE; - BOOL fExtraRinTsiReserved = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Resources must be reserved according to the type of bridge we are adding to. */ - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pNewParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant; - - /*========================================================================*/ - /* If we are in the flexible conferencing case, things are a little */ - /* different. We create a mixer for every participant instead of the */ - /* usual same mixer for everyone. For example, if we have 3 participants */ - /* of type client - agent - coach, we build the mixers as follows: */ - /* */ - /* Client: - Load Agent */ - /* - Store */ - /* */ - /* Agent: - Load Client */ - /* - Accumulate Coach */ - /* - Store */ - /* */ - /* Coach: - Load Client */ - /* - Accumulate Agent */ - /* - Store */ - /* */ - /*========================================================================*/ - - /* First reserve a flexible conferencing participant entry. */ - ulResult = Oct6100ApiReserveFlexConfParticipantEntry( f_pApiInstance, &pChanEntry->usFlexConfParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pNewParticipant, pChanEntry->usFlexConfParticipantIndex ); - - /* Reserve an entry for the store event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusSubStoreEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* If using the SOUT port, we must copy this entry */ - if( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - /* Reserve an entry for the copy event in the Mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fCopyEventReserved = TRUE; - - /* Reserve a SIN copy entry if none were reserved before.*/ - if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve an entry for the extra tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &pChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fExtraSinTsiReserved = TRUE; - } - } - } - else /* if( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - /* Reserve a RIN copy entry if none were reserved before.*/ - if ( pChanEntry->usExtraRinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve an entry for the extra tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &pChanEntry->usExtraRinTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fExtraRinTsiReserved = TRUE; - } - } - - /* Must travel all clients of this conference and reserve a load or accumulate event for */ - /* all participants which can hear us. */ - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must reserve a load or accumulate entry mixer event here! */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Most probably, the hardware is out of mixer events. */ - break; - } - } - - /* Check if this participant can hear us. */ - if ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must reserve a load or accumulate entry mixer event here! */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Most probably, the hardware is out of mixer events. */ - break; - } - } - } - } - } - - /* If an error is returned, make sure everything is cleaned up properly. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the flexible conferencing participant entry. */ - ulTempVar = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pChanEntry->usFlexConfParticipantIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - - /* Release the substore event in the mixer memory. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusSubStoreEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - if ( fCopyEventReserved == TRUE ) - { - /* Release the copy event in the mixer memory. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fExtraSinTsiReserved == TRUE ) - { - /* Release the extra Sin TSI in TSI memory. */ - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraSinTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - if ( fExtraRinTsiReserved == TRUE ) - { - /* Release the extra Rin TSI in TSI memory. */ - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraRinTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - - /* Check this participant can hear us. */ - if ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - } - } - - return ulResult; - } - } - else /* if ( ulResult != cOCT6100_ERR_OK ) */ - { - ulTempVar = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pChanEntry->usFlexConfParticipantIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - - /* Return the error code to the user. The mixer event allocation failed. */ - return ulResult; - } - - /*=======================================================================*/ - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - /*=======================================================================*/ - /* Normal conferencing. */ - - /* Reserve an entry for the load event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusLoadEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fLoadEventReserved = TRUE; - /* Reserve an entry for the substract and store event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusSubStoreEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fStoreEventReserved = TRUE; - - /* If using the SOUT port, we must copy this entry */ - if( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - /* Reserve an entry for the copy event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fCopyEventReserved = TRUE; - - /* Reserve a SIN copy entry if none were reserved before. */ - if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve an entry for the extra tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &pChanEntry->usExtraSinTsiMemIndex ); - - if ( ulResult == cOCT6100_ERR_OK ) - fExtraSinTsiReserved = TRUE; - } - } - } - } - } - - if ( ( ulResult == cOCT6100_ERR_OK ) && ( f_fTap == TRUE ) ) - { - /* Reserve a "tap" bridge. */ - tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen; - UINT32 ulTapBridgeHndl = 0; - - Oct6100ConfBridgeOpenDef( &ConfBridgeOpen ); - - ConfBridgeOpen.pulConfBridgeHndl = &ulTapBridgeHndl; - - ulResult = Oct6100ConfBridgeOpenSer( f_pApiInstance, &ConfBridgeOpen ); - - *f_pusTapBridgeIndex = (UINT16)( ulTapBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( fLoadEventReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusLoadEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fStoreEventReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusSubStoreEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fCopyEventReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fExtraSinTsiReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraSinTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - return ulResult; - } - - /*=======================================================================*/ - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeEventAdd - -Description: Add the event into the global event list of the chip and update - the bridge and channel structures. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. -f_usBridgeIndex Index of the current bridge in the API list. -f_usChanIndex Index of the current channel in the API list. -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_usLoadEventIndex Allocated entry for the Load event of the - channel. -f_usSubStoreEventIndex Allocated entry for the substract and store - event of the channel. -f_usCopyEventIndex Allocated entry for the copy event of the - channel. -f_ulInputPort Input port where to copy samples from. -f_fMute Mute flag indicating if the channel is added in - a mute state. -f_ulListenerMaskIndex Index of the listener in this flexible conference bridge. -f_ulListenerMask Mask of listeners in this flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeEventAdd -UINT32 Oct6100ApiBridgeEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fMute, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - IN UINT16 f_usTapBridgeIndex, - IN UINT16 f_usTapChanIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CHANNEL pTapEchoChanEntry = NULL; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT16 usChannelIndex; - UINT16 usLastSubStoreEventIndex; - UINT16 usLastLoadEventIndex; - - BOOL fAddSinCopy = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get the bridge and channel entries of interest. */ - if ( f_fTap == FALSE ) - { - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - } - else - { - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usTapBridgeIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTapEchoChanEntry, f_usTapChanIndex ); - } - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pNewParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pNewParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones onto this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( pTempEchoChanEntry->fMute == FALSE ) && ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* First create/update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ], - f_usSubStoreEventIndex, - f_usCopyEventIndex, - pCurrentParticipant->ulInputPort, - f_ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if this participant can hear us. */ - if ( ( f_fMute == FALSE ) && ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* Then create/update this channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - f_usBridgeIndex, - f_usChanIndex, - usChannelIndex, - pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ], - pTempEchoChanEntry->usSubStoreEventIndex, - pTempEchoChanEntry->usSinCopyEventIndex, - f_ulInputPort, - pCurrentParticipant->ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( ( pCurrentParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pTempEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - } - } - } - - /* Check if the mixer for the destination channel has been created. */ - if ( pNewParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Save store event index that might be used for next channel added. */ - pEchoChanEntry->usSubStoreEventIndex = f_usSubStoreEventIndex; - } - else - { - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( pEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - - pNewParticipant->ulListenerMaskIndex = f_ulListenerMaskIndex; - pNewParticipant->ulListenerMask = f_ulListenerMask; - - /* Remember this channel's input port. */ - pNewParticipant->ulInputPort = f_ulInputPort; - - /*=======================================================================*/ - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */ - if ( ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( f_fTap == FALSE ) ) - { - if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usSinTsstIndex, - pEchoChanEntry->usExtraSinTsiMemIndex, - pEchoChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the extra sin TSI. */ - if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usExtraSinTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /*=======================================================================*/ - /* Program the Load event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - if ( ( f_fMute == FALSE ) || ( f_fTap == TRUE ) ) - { - if ( pBridgeEntry->usLoadIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - - /* Set the event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - - if ( f_fTap == TRUE ) - return cOCT6100_ERR_FATAL_D1; - } - else /* pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX */ - { - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Modify the bridge entry to show store the new load index.*/ - pBridgeEntry->usLoadIndex = f_usLoadEventIndex; - - /* Set the event type.*/ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - } - - /* Select the TSI memory index according to the source port. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - if ( f_fTap == FALSE ) - { - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else - { - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - UINT16 usTempWriteData; - UINT32 ulTempWriteAddress; - - /* Save temp write data before trying to clear the Rin TSST. */ - usTempWriteData = WriteParams.usWriteData; - ulTempWriteAddress = WriteParams.ulWriteAddress; - - /* Clear the Rin TSST if used. */ - if ( pTapEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pTapEchoChanEntry->usRinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Reassign write data that might have been cleared by write above. */ - WriteParams.usWriteData = usTempWriteData; - WriteParams.ulWriteAddress = ulTempWriteAddress; - WriteParams.usWriteData |= pTapEchoChanEntry->usRinRoutTsiMemIndex; - - /* Remember that this channel is being tapped by us. */ - pTapEchoChanEntry->fBeingTapped = TRUE; - pTapEchoChanEntry->usTapChanIndex = f_usChanIndex; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex ); - - pTempBridgeEntry->usNumTappedClients++; - } - } - else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - } - else /* f_fMute == TRUE */ - { - /* Do not load the sample if the channel is muted. */ - if ( pBridgeEntry->usNumClients == 0 ) - { - /* If the participant to be added is muted, and it would cause the conference to */ - /* be completely muted, load the silence TSI. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */ - - /* We know for sure that the load of the bridge will be the silence one. */ - pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex; - } - else - { - /* Do nothing! */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - - /* Set the event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Substract and store event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - if ( ( f_fMute == FALSE ) && ( f_fTap == FALSE ) ) - { - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - /* Select the TSI memory index and PCM law according to the source port. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - - /* Set the event type. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - } - else /* f_fMute == TRUE */ - { - /* Do not substore the sample if the channel is muted. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* Select the PCM law according to the source port. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - /* Set the event type. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Program the Copy event - if using the SOUT port */ - if ( ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( f_fTap == FALSE ) ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex; - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set add copy event flag. */ - fAddSinCopy = TRUE; - - /* For sure. */ - pEchoChanEntry->fCopyEventCreated = TRUE; - } - else if ( f_fTap == TRUE ) - { - /* Accumulate the tapped channel's voice instead of building a copy event. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - WriteParams.usWriteData |= pTapEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Link to next operation. */ - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = f_usSubStoreEventIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, f_usCopyEventIndex ); - - pTempEntry->usSourceChanIndex = f_usTapChanIndex; - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - pTempEntry->usNextEventPtr = f_usSubStoreEventIndex; - pTempEntry->usDestinationChanIndex = cOCT6100_INVALID_INDEX; - pTempEntry->fReserved = TRUE; - } - /*=======================================================================*/ - - /*=======================================================================*/ - /* Now insert the event into the list.*/ - if ( pBridgeEntry->usNumClients == 0 ) - { - /* This is the first entry for this bridge. Insert the two events at the head - of the list just after the last sub-store event.*/ - if ( f_fTap == FALSE ) - { - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usLastSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_26; - } - } - } - else - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - - /* An Entry was found, now, modify it's value.*/ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex ); - - /* Set the Sub-Store event first.*/ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - pSubStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Program the Sub-Store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = (UINT16)( pSubStoreEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Set the load/accumulate event now.*/ - if ( f_fTap == FALSE ) - { - pLoadEventEntry->usNextEventPtr = f_usSubStoreEventIndex; - } - else - { - /* This is a little tricky, we use the copy event index for accumulating the tapped channel's voice. */ - pLoadEventEntry->usNextEventPtr = f_usCopyEventIndex; - } - - /*=======================================================================*/ - /* Program the load/accumulate event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Now modify the previous last Sub Store event from another bridge. */ - pTempEntry->usNextEventPtr = f_usLoadEventIndex; - - /*=======================================================================*/ - /* Modify the last node of the other bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Set the event pointer info in the bridge stucture. */ - pBridgeEntry->usFirstLoadEventPtr = f_usLoadEventIndex; - pBridgeEntry->usFirstSubStoreEventPtr = f_usSubStoreEventIndex; - pBridgeEntry->usLastSubStoreEventPtr = f_usSubStoreEventIndex; - - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX ) - { - /* This bridge is the first to generate mixer event. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadEventIndex; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex ) - { - /* The two entries were added at the end of the bridge section, */ - /* change only the last pointer. */ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex; - } - else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE || - usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - /* The two entries were added at the start of the bridge section, */ - /* change only the first pointer. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadEventIndex; - } - } - else /* pBridgeEntry->usNumClients != 0 */ - { - /* For sanity. */ - if ( f_fTap == TRUE ) - return cOCT6100_ERR_FATAL_D2; - - /*=======================================================================*/ - /* Program the Load event. */ - - /* Now find the last load entry of this bridge. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, pBridgeEntry->usFirstSubStoreEventPtr, 0, &usLastLoadEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Add the load/accumulate event to the list. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex ); - - /* Set the load event now. */ - pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Modify the previous last load event. */ - - /* Now modify the previous last load event. */ - pTempEntry->usNextEventPtr = f_usLoadEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Program the Sub-Store event. */ - - usLastSubStoreEventIndex = pBridgeEntry->usLastSubStoreEventPtr; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex ); - - /* Set the Sub-Store event first. */ - pSubStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pSubStoreEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Modify the previous last sub store event of the bridge. */ - - /* Now modify the last Load event of the bridge. */ - pTempEntry->usNextEventPtr = f_usSubStoreEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Update the bridge pointers. */ - pBridgeEntry->usLastSubStoreEventPtr = f_usSubStoreEventIndex; - - /* Check if modification to the global mixer pointer are required. */ - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex ) - { - /* We have a new last bridge pointer. */ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex; - } - } - - if ( f_fTap == TRUE ) - { - if ( pEchoChanEntry->usRinTsstIndex == cOCT6100_INVALID_INDEX ) - { - /* Remove the mute on the Rin port. */ - - UINT32 ulTempData; - UINT32 ulMask; - UINT32 ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChanIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Configure the level control. */ - - UINT32 ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.usDwordOffset * 4; - UINT32 ulFeatureBitOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.byBitOffset; - UINT32 ulFeatureFieldLength = pSharedInfo->MemoryMap.RinLevelControlOfst.byFieldSize; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set the DC filter to pass through.*/ - ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset ); - - /* First read the DWORD where the field is located. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the event entries as reserved. */ - pLoadEventEntry->fReserved = TRUE; - pSubStoreEventEntry->fReserved = TRUE; - - /* Store the event indexes into the channel structure. */ - pEchoChanEntry->usLoadEventIndex = f_usLoadEventIndex; - pEchoChanEntry->usSubStoreEventIndex = f_usSubStoreEventIndex; - - /* Check if must insert the Sin copy event in the list. */ - if ( fAddSinCopy == TRUE ) - { - /* Now insert the Sin copy event into the list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usChanIndex ); - } - - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( ( f_fTap == FALSE ) && ( pEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - - /* Configure the RIN copy mixer entry and memory - if using the RIN port. */ - if ( ( f_fFlexibleConfBridge == TRUE ) && ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) ) - { - if ( pEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usExtraRinTsiMemIndex, - pEchoChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - if ( pBridgeEntry->fDominantSpeakerSet == TRUE ) - { - /* Dominant speaker is another channel. Set accordingly for this new conference channel. */ - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, pBridgeEntry->usDominantSpeakerChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* No dominant speaker set on this bridge yet. */ - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Update the bridge entry. */ - pBridgeEntry->usNumClients++; - - /* Store the bridge index into the channel structure. */ - pEchoChanEntry->usBridgeIndex = f_usBridgeIndex; - - /* Store the copy event index into the channel structure. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - pEchoChanEntry->usSinCopyEventIndex = f_usCopyEventIndex; - } - else - { - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - } - - /* Remember if the channel is muted in the conference. */ - pEchoChanEntry->fMute = f_fMute; - - /* Remember if the channel is a tap in a conference. */ - pEchoChanEntry->fTap = f_fTap; - - /* We start by not being tapped. */ - pEchoChanEntry->fBeingTapped = FALSE; - pEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX; - - /* Remember the tap bridge index if necessary. */ - if ( pEchoChanEntry->fTap == TRUE ) - { - pEchoChanEntry->usTapBridgeIndex = f_usTapBridgeIndex; - } - else - { - pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX; - } - - /* Indicate that the extra SIN TSI is currently in used by the conference bridge. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt++; - } - - /* Indicate that the extra RIN TSI is currently in used by the conference bridge. */ - if ( ( f_fFlexibleConfBridge == TRUE ) && ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) ) - { - pEchoChanEntry->usExtraRinTsiDependencyCnt++; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer++; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeAddParticipantToChannel - -Description: Used for the flexible conference bridges. Insert a participant - onto a channel that is on a conference. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index where this channel is located. -f_usSourceChannelIndex Source channel to copy voice from. -f_usDestinationChannelIndex Destination channel to store resulting voice to. -f_usLoadOrAccumulateEventIndex Load or Accumulate allocated event index. -f_usStoreEventIndex Store allocated event index. -f_usCopyEventIndex Copy allocated event index. -f_ulSourceInputPort Source input port of the conference for this channel. -f_ulDestinationInputPort Destination input port of the conference for this channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeAddParticipantToChannel -UINT32 Oct6100ApiBridgeAddParticipantToChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT16 f_usLoadOrAccumulateEventIndex, - IN UINT16 f_usStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulSourceInputPort, - IN UINT32 f_ulDestinationInputPort ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - - tPOCT6100_API_CHANNEL pSourceChanEntry; - tPOCT6100_API_CHANNEL pDestinationChanEntry; - - tPOCT6100_API_FLEX_CONF_PARTICIPANT pSourceParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT16 usLastSubStoreEventIndex; - UINT16 usLastLoadEventIndex; - BOOL fInsertCopy = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex ); - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadOrAccumulateEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, f_usStoreEventIndex ); - - /* Check if we are creating the first event for this channel. */ - if ( pDestinationParticipant->fFlexibleMixerCreated == FALSE ) - { - /*=======================================================================*/ - /* Before creating the participant's flexible mixer, make sure the extra Sin */ - /* mixer event is programmed correctly for sending the voice stream to the right place. */ - - /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */ - if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pDestinationChanEntry->usSinTsstIndex, - pDestinationChanEntry->usExtraSinTsiMemIndex, - pDestinationChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the extra sin TSI. */ - if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usExtraSinTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Program the load event. This is the first event for this new destination channel. */ - - /* First set the TSI buffer where the resulting stream should be written to. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* For sure, we are loading. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Select the TSI memory index according to the source port. */ - if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex; - } - - /* Set the event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Set the source channel index. */ - pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Program the store event. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* Select the TSI memory index and PCM law according to the source port. */ - if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pDestinationChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pDestinationChanEntry->usRinRoutTsiMemIndex; - } - - /* Set the event type. */ - pStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* Set the destination channel index. */ - pStoreEventEntry->usDestinationChanIndex = f_usDestinationChannelIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Program the Copy event - if using the SOUT port */ - - if ( ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pDestinationChanEntry->fCopyEventCreated == FALSE ) ) - { - /* The copy event has not been created, create it once for the life of the participant on the bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pDestinationChanEntry->usExtraSinTsiMemIndex; - WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pDestinationChanEntry->fCopyEventCreated = TRUE; - - /* Set insert copy flag. */ - fInsertCopy = TRUE; - } - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /*=======================================================================*/ - /* Now, insert the events into the current list. */ - /*=======================================================================*/ - /*=======================================================================*/ - - /* This is the first entry for this channel. Insert the two events at the head */ - /* of the list just after the last Sub-Store or Store event. */ - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, f_usLoadOrAccumulateEventIndex, &usLastSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_26; - } - } - - /* An entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex ); - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Link the store event first. */ - - pStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - /* Link the store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = (UINT16)( pStoreEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Link the load event now.*/ - - pLoadEventEntry->usNextEventPtr = f_usStoreEventIndex; - - /* Link the load event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now modify the previous last Sub-Store or Store event from another bridge, */ - /* such that it links to us. */ - - pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex; - - /* Modify the last node of the other bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Set the event pointer info in the bridge stucture. */ - - if ( pBridgeEntry->usFirstLoadEventPtr == cOCT6100_INVALID_INDEX ) - { - /* We only do this once in case of the flexible conference bridges. */ - pBridgeEntry->usFirstLoadEventPtr = f_usLoadOrAccumulateEventIndex; - pBridgeEntry->usFirstSubStoreEventPtr = f_usStoreEventIndex; - } - - pBridgeEntry->usLastSubStoreEventPtr = f_usStoreEventIndex; - - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX ) - { - /* This bridge is the first to generate mixer event. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex ) - { - /* The two entries were added at the end of the bridge section, */ - /* change only the last pointer. */ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex; - } - else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE || - usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - /* The two entries were added at the start of the bridge section, */ - /* change only the first pointer.*/ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Insert the copy event if needed in the mixer's list. */ - - if ( fInsertCopy == TRUE ) - { - /* Now insert the Sin copy event into the list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usDestinationChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the status of the instance structures. */ - - pDestinationParticipant->fFlexibleMixerCreated = TRUE; - - /* Set the event entries as reserved. */ - pLoadEventEntry->fReserved = TRUE; - pStoreEventEntry->fReserved = TRUE; - - /* Store the event indexes into the channel structure. */ - pDestinationChanEntry->usLoadEventIndex = f_usLoadOrAccumulateEventIndex; - pDestinationChanEntry->usSubStoreEventIndex = f_usStoreEventIndex; - - /*=======================================================================*/ - } - else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == TRUE ) */ - { - /*=======================================================================*/ - /* Program the Accumulate event. */ - - /* First set the TSI buffer where the resulting stream should be written to. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* For sure, we are accumulating. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - - /* Select the TSI memory index according to the source port. */ - if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /*=======================================================================*/ - /* Now, insert the Accumulate event into the current list. */ - /*=======================================================================*/ - /*=======================================================================*/ - - /* Use the Load entry of this channel. */ - usLastLoadEventIndex = pDestinationChanEntry->usLoadEventIndex; - - /* Add the Accumulate event to the list. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex ); - - /* Set the accumulate event now. */ - pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Modify the previous Load event. */ - - /* Now modify the previous Load event. */ - pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Update the status of the instance structures. */ - - /* Set the Accumulate event entry as reserved. */ - pLoadEventEntry->fReserved = TRUE; - /* Set the Event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - /* Set the source channel index. */ - pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex; - - /*=======================================================================*/ - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanRemoveSer - -Description: Removes an echo channel from a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeRemove Pointer to conference bridge channel remove structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanRemoveSer -UINT32 Oct6100ConfBridgeChanRemoveSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ) -{ - UINT16 usBridgeIndex; - UINT16 usChanIndex = 0; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT16 usCopyEventIndex; - UINT32 ulResult; - UINT8 fFlexibleConfBridge; - UINT8 fTap; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckChanRemoveParams( - f_pApiInstance, - f_pConfBridgeRemove, - &usBridgeIndex, - &usChanIndex, - &fFlexibleConfBridge, - &fTap, - &usLoadEventIndex, - &usSubStoreEventIndex, - &usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources reserved for the conference bridge. */ - ulResult = Oct6100ApiReleaseChanEventResources( - f_pApiInstance, - f_pConfBridgeRemove, - usBridgeIndex, - usChanIndex, - fFlexibleConfBridge, - usLoadEventIndex, - usSubStoreEventIndex, - usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the memory entry for this channel within the bridge. */ - ulResult = Oct6100ApiBridgeEventRemove( - f_pApiInstance, - f_pConfBridgeRemove, - usBridgeIndex, - usChanIndex, - fFlexibleConfBridge, - usLoadEventIndex, - usSubStoreEventIndex, - usCopyEventIndex, - fTap ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChanRemoveParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeRemove Pointer to conference bridge channenl add structure. -f_pusBridgeIndex Pointer to the bridge index. -f_pfFlexibleConfBridge If this is a flexible conference bridge -f_pusChannelIndex Pointer to the channel index to be added to the bridge. -f_pusLoadEventIndex Pointer to the load mixer event. -f_pusSubStoreEventIndex Pointer to the sub-store mixer event. -f_pusCopyEventIndex Pointer to the copy mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChanRemoveParams -UINT32 Oct6100ApiCheckChanRemoveParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex ) -{ - UINT32 ulEntryOpenCnt; - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - /* Verify if the remove all flag is valid. */ - if ( f_pConfBridgeRemove->fRemoveAll != TRUE && - f_pConfBridgeRemove->fRemoveAll != FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_ALL; - - /* Check the channel handle only if the remove all flag is set to FALSE. */ - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeRemove->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - if ( pEchoChanEntry->fBeingTapped == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY; - - /*=====================================================================*/ - - *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex; - *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex; - *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex; - *f_pusCopyEventIndex = pEchoChanEntry->usSinCopyEventIndex; - - /* Check if the channel is really part of the bridge. */ - if ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Return whether this is a flexible bridge or not. */ - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - /* Return whether this is a tap or not. */ - *f_pfTap = pEchoChanEntry->fTap; - } - else /* f_pConfBridgeRemove->fRemoveAll == TRUE */ - { - /* Check the provided handle. */ - if ( (f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeRemove->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* This information is not currently available. */ - *f_pusLoadEventIndex = cOCT6100_INVALID_INDEX; - *f_pusSubStoreEventIndex = cOCT6100_INVALID_INDEX; - *f_pusCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Return whether this is a flexible bridge or not. */ - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - *f_pfTap = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseChanEventResources - -Description: Release all resources reserved to the channel part of the - conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeRemove Pointer to conference bridge channel add structure. -f_usBridgeIndex Index of the bridge structure within the API's bridge list. -f_usChanIndex Index of the channel structure within the API's channel list -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_usLoadEventIndex Index of the load mixer event. -f_usSubStoreEventIndex Index of the sub-store mixer event. -f_usCopyEventIndex Index of the copy mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseChanEventResources -UINT32 Oct6100ApiReleaseChanEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulResult; - UINT32 i; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Release an entry for the store event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Sout port was used - no need to release. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* Must travel all clients of this conference and release the load or accumulate events for */ - /* all participants which can hear us and vice versa. */ - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, i ); - - /* Channel reserved? */ - if ( ( i != f_usChanIndex ) && pTempEchoChanEntry->fReserved == TRUE ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must release the allocated mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - - /* Check if this participant can hear us. */ - if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must release the allocated mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - } - } - else /* f_pConfBridgeRemove->fRemoveAll == TRUE */ - { - UINT32 ulListenerMaskIndex; - - ulResult = cOCT6100_ERR_OK; - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - /* Channel reserved? */ - if ( pEchoChanEntry->fReserved == TRUE ) - { - /* On current bridge? */ - if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Release an entry for the Store event in the Mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the Mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Sout port was used - no need to release. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* Check if something can be freed. */ - for ( ulListenerMaskIndex = 0; ulListenerMaskIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulListenerMaskIndex ++ ) - { - if ( pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the allocated mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - } - } - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - /* Release the entry for the load event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usLoadEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the substract and store event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the Mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry. */ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - } - else /* f_pConfBridgeRemove->fRemoveAll == TRUE */ - { - /* Search through the list of API channel entry for the ones on to the specified bridge.*/ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) ) - { - /* Release the entry for the load event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - pEchoChanEntry->usLoadEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the substract and store event in the Mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - pEchoChanEntry->usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the Mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - pEchoChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - } - } - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeEventRemove - -Description: Remove the event from the global event list of the chip and - update the bridge and channel structures. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeRemove Pointer to a conference bridge channel remove structure. -f_usBridgeIndex Index of the current bridge in the API list. -f_usChanIndex Index of the current channel in the API list. -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_usLoadEventIndex Allocated entry for the Load event of the channel. -f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel. -f_usCopyEventIndex Allocated entry for the copy event of the channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeEventRemove -UINT32 Oct6100ApiBridgeEventRemove ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT8 f_fTap ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pCopyEventEntry = NULL; - tPOCT6100_API_MIXER_EVENT pTempEntry; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - UINT32 ulResult; - UINT16 usPreviousEventIndex; - UINT16 usTempEventIndex; - UINT32 ulLoopCount = 0; - UINT16 usReadData; - UINT16 usChannelIndex; - UINT32 i; - - BOOL fRemoveSinCopy = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - /* If no client on the bridge, and the remove all option is specified, return here. */ - if ( ( pBridgeEntry->usNumClients == 0 ) && ( f_pConfBridgeRemove->fRemoveAll == TRUE ) ) - return cOCT6100_ERR_OK; - - /* Make sure the dominant speaker feature is disabled first. */ - if ( pBridgeEntry->fDominantSpeakerSet == TRUE ) - { - /* If all channels are to be removed or if the dominant speaker is the current channel to be removed. */ - if ( ( f_pConfBridgeRemove->fRemoveAll == TRUE ) - || ( ( f_pConfBridgeRemove->fRemoveAll == FALSE ) && ( pBridgeEntry->usDominantSpeakerChanIndex == f_usChanIndex ) ) ) - { - /* Disable on all channels part of this conference. */ - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( pTempEchoChanEntry->fReserved == TRUE ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Save this in the conference bridge structure. */ - pBridgeEntry->fDominantSpeakerSet = FALSE; - pBridgeEntry->usDominantSpeakerChanIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Only disable this current channel. */ - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - UINT32 ulMutePortChannelIndex; - - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX; - - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - /* The channel index is valid. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->fMute == FALSE ) ) - { - /* First update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if this participant can hear us. */ - if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - && ( pEchoChanEntry->fMute == FALSE ) ) - { - /* Then update this channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - f_usChanIndex, - usChannelIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex; - break; - } - } - } - } - } - } - - /* Check if must manually clear the Sin copy event. */ - if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - && ( pEchoChanEntry->fCopyEventCreated == TRUE ) ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->fCopyEventCreated = FALSE; - } - - /* Release an entry for the participant. */ - ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /*=======================================================================*/ - /* Update the event and channel API structure */ - pEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Indicate that the extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Indicate that the extra RIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraRinTsiDependencyCnt--; - pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - - pBridgeEntry->usNumClients--; - - /* For sure we have to mute the ports of this channel to be removed. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - f_usChanIndex, - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - } - } - else /* if ( f_pConfBridgeRemove->fRemoveAll == TRUE ) */ - { - UINT16 usMainChannelIndex; - - for ( usMainChannelIndex = 0 ; usMainChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ; usMainChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usMainChannelIndex ); - - /* If this channel is on the bridge we are closing all the channels. */ - if ( ( pEchoChanEntry->fReserved == TRUE ) && ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) ) - { - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usMainChannelIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usMainChannelIndex; - break; - } - } - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = (UINT16)( usMainChannelIndex + 1 ); usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - if ( pTempEchoChanEntry->fReserved == TRUE ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Everyone that we can hear must be removed. */ - if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->fMute == FALSE ) ) - { - /* First update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - usMainChannelIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if this participant can hear us. */ - if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - && ( pEchoChanEntry->fMute == FALSE ) ) - { - /* Then update this channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usMainChannelIndex, - usChannelIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /* Check if must manually clear the Sin copy event. */ - if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - && ( pEchoChanEntry->fCopyEventCreated == TRUE ) ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->fCopyEventCreated = FALSE; - } - - /* Release an entry for the participant. */ - ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /*=======================================================================*/ - /* Update the event and channel API structure */ - - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Indicate that the Extra RIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraRinTsiDependencyCnt--; - pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - } - } - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - - /* Clear the flexible conf bridge participant index. */ - pTempEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - } - - /* No more clients on bridge. */ - pBridgeEntry->usNumClients = 0; - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - /* The channel index is valid. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - if ( f_fTap == TRUE ) - { - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, pEchoChanEntry->usTapBridgeIndex ); - } - - /* Get a pointer to the event entry. */ - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - - /*=======================================================================*/ - /* Check if have to modify the silence load event. */ - - if ( pBridgeEntry->usNumClients != 1 ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex ) - { - /* Make sure the next event becomes the silence event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadEventEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model to remember the silence load. */ - pBridgeEntry->usSilenceLoadEventPtr = pLoadEventEntry->usNextEventPtr; - } - else - { - /* Somebody else is the silence event, no need to worry. */ - } - } - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Load event. */ - - /* First verify if the event to be removed was a load event. */ - if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex ) - { - /* Change the next entry if one is present to a load event to keep the bridge alive. */ - if ( pBridgeEntry->usNumClients == 1 ) - { - /* There is no other entry on the bridge, no need to search for an Accumulate event. */ - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - - /* Clear the silence event, for sure it's invalid. */ - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - } - else - { - /* Search for an accumulate event to tranform into a Load event. */ - usTempEventIndex = pLoadEventEntry->usNextEventPtr; - ulLoopCount = 0; - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Change this entry into a load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set this entry as the load index. */ - pBridgeEntry->usLoadIndex = usTempEventIndex; - - /* Update the software model. */ - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Stop searching. */ - break; - } - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_9B; - } - } - } - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the Copy event - if needed. */ - - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( f_fTap == FALSE ) - { - /* Set remove Sin copy event flag to remove the event from the mixer's list. */ - fRemoveSinCopy = TRUE; - - /* Clear the copy event created flag. */ - pEchoChanEntry->fCopyEventCreated = FALSE; - } - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now remove the event from the event list. */ - - /* Look for the entry that is pointing at the first entry of our bridge. */ - if ( f_fTap == FALSE ) - { - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex ); - } - else - { - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, pEchoChanEntry->usTapBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex ); - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - /* If the entry was not found, we now check for the Sout copy event section/list. */ - if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* No Sout copy, it has to be the head node. */ - usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - /* Use the last Sout copy event. */ - usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_27; - } - } - - if ( pBridgeEntry->usNumClients == 1 ) - { - /* An entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Now modify the previous last Sub Store event from another bridge. */ - pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Modify the last node of the previous bridge to point to the next bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Set the event pointer info in the bridge stucture. */ - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX; - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex && - pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex ) - { - /* There is no more bridge entry in the mixer link list. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pSubStoreEventEntry->usNextEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex ) - { - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - /*=======================================================================*/ - - if ( f_fTap == TRUE ) - { - /* The channel being tapped is not tapped anymore. */ - /* There is no direct way of finding the tap, so loop through all channels and find the */ - /* tapped channel index. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( pTempEchoChanEntry->usTapChanIndex == f_usChanIndex ) - { - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - - pTempEchoChanEntry->fBeingTapped = FALSE; - pTempEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex ); - - pTempBridgeEntry->usNumTappedClients--; - - /* Re-assign Rin TSST for tapped channel. */ - if ( pTempEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usRinRoutTsiMemIndex, - pTempEchoChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - break; - } - } - - /* Check if our model is broken. */ - if ( usChannelIndex == pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_FATAL_D3; - } - } - else /* pBridgeEntry->usNumClients > 1 */ - { - if ( pBridgeEntry->usFirstLoadEventPtr != f_usLoadEventIndex ) - { - /* Now find the load entry of this bridge pointing at this load event */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usLoadEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove the load event to the list. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Now modify the previous last Sub Store event from another bridge. */ - pTempEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Modify the previous node. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Now find the last load entry of this bridge ( the one pointing at the first sub-store event ). */ - if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex ) - { - /* Must start with the first load to get the entry before the first sub store. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* Must start with the first load to get the entry before the first sub store. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstSubStoreEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /* Now modify the last load event of the bridge. */ - pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Modify the last node of the other bridge. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the bridge pointers. */ - - if ( pBridgeEntry->usFirstLoadEventPtr == f_usLoadEventIndex ) - pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr; - - if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex ) - pBridgeEntry->usFirstSubStoreEventPtr = pSubStoreEventEntry->usNextEventPtr; - - if ( pBridgeEntry->usLastSubStoreEventPtr == f_usSubStoreEventIndex ) - pBridgeEntry->usLastSubStoreEventPtr = usPreviousEventIndex; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr; - } - - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex ) - { - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - /*=======================================================================*/ - - } - - /* Check if must remove the Sin copy event from the event list. */ - if ( fRemoveSinCopy == TRUE ) - { - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, f_usCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Get the channel. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released. */ - if ( ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fTap == FALSE ) ) - { - if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usSinTsstIndex, - pEchoChanEntry->usSinSoutTsiMemIndex, - pEchoChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the original sin TSI. */ - if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /* Set the event entries as free. */ - pLoadEventEntry->fReserved = FALSE; - pLoadEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pSubStoreEventEntry->fReserved = FALSE; - pSubStoreEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - if ( pCopyEventEntry != NULL ) - { - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - - pBridgeEntry->usNumClients--; - - /*=======================================================================*/ - /* Update the event and channel API structure */ - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - - if ( f_fTap == TRUE ) - { - /* Can now close the bridge. */ - tOCT6100_CONF_BRIDGE_CLOSE BridgeClose; - - Oct6100ConfBridgeCloseDef( &BridgeClose ); - - BridgeClose.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapBridgeIndex; - - ulResult = Oct6100ConfBridgeCloseSer( f_pApiInstance, &BridgeClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->fTap = FALSE; - } - - /* Check if the Rin port must be muted. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - f_usChanIndex, - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - } - else /* f_ulBridgeChanRemove->fRemoveAll == TRUE ) */ - { - UINT16 usNextEventPtr; - - /* Save the next event pointer before invalidating everything. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pBridgeEntry->usLastSubStoreEventPtr ); - - usNextEventPtr = pSubStoreEventEntry->usNextEventPtr; - - /* Search through the list of API channel entry for the ones on to the specified bridge. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) ) - { - /* Check if we are being tapped. If so, remove the channel that taps us from the conference. */ - /* The removal of the channel will make sure the Rin TSST is re-assigned. */ - if ( pEchoChanEntry->fBeingTapped == TRUE ) - { - tOCT6100_CONF_BRIDGE_CHAN_REMOVE ChanRemove; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, pEchoChanEntry->usTapChanIndex ); - - ulResult = Oct6100ConfBridgeChanRemoveDef( &ChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pTempEchoChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapChanIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &ChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - /* Clear the Load event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the Substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the SIN copy event.*/ - - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get a pointer to the event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pEchoChanEntry->usSinCopyEventIndex ); - - /* Update the next event pointer if required. */ - if ( usNextEventPtr == pEchoChanEntry->usSinCopyEventIndex ) - usNextEventPtr = pCopyEventEntry->usNextEventPtr; - - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the copy event created flag. */ - pEchoChanEntry->fCopyEventCreated = FALSE; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the event and channel API structure */ - - /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released.*/ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usSinTsstIndex, - pEchoChanEntry->usSinSoutTsiMemIndex, - pEchoChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the original Sin TSI. */ - if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, pEchoChanEntry->usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pEchoChanEntry->usSubStoreEventIndex ); - - /* Set the event entries as free. */ - pLoadEventEntry->fReserved = FALSE; - pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pSubStoreEventEntry->fReserved = FALSE; - pSubStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - if ( pCopyEventEntry != NULL ) - { - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - - /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Invalidate the channel entry. */ - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - - /*=======================================================================*/ - } - } - } - - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND == ulResult ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_28; - } - } - - /* An Entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Now modify the previous last Sub Store event from another bridge.*/ - /* It will now point at the next bridge, or copy events. */ - pTempEntry->usNextEventPtr = usNextEventPtr; - - /*=======================================================================*/ - /* Modify the last node of the other bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = pTempEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr && - pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr ) - { - /* This bridge was the only one with event in the list. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr ) - { - /* This bridge was the first bridge. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = usNextEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr ) - { - /* This bridge was the last bridge.*/ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - /*=======================================================================*/ - - /* Set the event pointer info in the bridge stucture. */ - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - - /* Set the number of clients to 0. */ - pBridgeEntry->usNumClients = 0; - - /* Search through the list of API channel entry for the ones on to the specified bridge. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) ) - { - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - - /* Check if the Rin port must be muted. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - (UINT16)( i & 0xFFFF ), - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeRemoveParticipantFromChannel - -Description: This will remove a flexible conference participant from - a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index where this channel is located. -f_usSourceChannelIndex Source channel to copy voice from. -f_usDestinationChannelIndex Destination channel to store resulting voice to. -f_fRemovePermanently Whether to remove permanently this participant. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeRemoveParticipantFromChannel -UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT8 f_fRemovePermanently ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pCopyEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - tPOCT6100_API_MIXER_EVENT pLoadTempEntry; - tPOCT6100_API_MIXER_EVENT pLastEventEntry; - tPOCT6100_API_MIXER_EVENT pLastLoadOrAccumulateEventEntry; - - tPOCT6100_API_CHANNEL pSourceChanEntry; - tPOCT6100_API_CHANNEL pDestinationChanEntry; - - tPOCT6100_API_FLEX_CONF_PARTICIPANT pSourceParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - UINT32 ulResult; - UINT32 ulLoopCount; - UINT16 usLastLoadEventIndex; - UINT16 usLoadOrAccumulateEventIndex; - UINT16 usTempEventIndex; - UINT16 usPreviousEventIndex; - UINT16 usLastEventIndex; - - UINT16 usReadData; - BOOL fLastEvent = FALSE; - BOOL fSoutCopyEvent = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex ); - - /* Check if the mixer has been created on this channel. */ - if ( pDestinationParticipant->fFlexibleMixerCreated == TRUE ) - { - /*=======================================================================*/ - /* Clear the Load or Accumulate event.*/ - - usTempEventIndex = pDestinationChanEntry->usLoadEventIndex; - ulLoopCount = 0; - - /* Find the Load or Accumulate event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usTempEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, pDestinationChanEntry->usSubStoreEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - pLastEventEntry = pLoadEventEntry; - pLastLoadOrAccumulateEventEntry = pLoadEventEntry; - usLastLoadEventIndex = usTempEventIndex; - usLastEventIndex = usTempEventIndex; - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - /* If this is the entry we are looking for. */ - if ( pTempEntry->usSourceChanIndex == f_usSourceChannelIndex ) - { - /* Check if this is a Load or Accumulate event. */ - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD ) - { - /* This is the first entry. Check if next entry is an accumulate. */ - pLoadTempEntry = pTempEntry; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, pTempEntry->usNextEventPtr ); - - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Change this entry into a Load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadTempEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the channel information with this new load event. */ - pDestinationChanEntry->usLoadEventIndex = pLoadTempEntry->usNextEventPtr; - - /* Update the software model. */ - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Get the previous event. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex ); - usLastEventIndex = usPreviousEventIndex; - - /* Stop searching. */ - break; - } - else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - /* Get back the event to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - /* This is the only event on this channel so we can clear everything up. */ - fLastEvent = TRUE; - - /* Get the previous event. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex ); - usLastEventIndex = usPreviousEventIndex; - - /* Stop searching. */ - break; - } - else - { - /* Software model is broken. */ - return cOCT6100_ERR_FATAL_C5; - } - - } - else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Simply remove the entry. */ - - /* Get the previous event. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex ); - usLastEventIndex = usPreviousEventIndex; - - /* Stop searching. */ - break; - } - else - { - /* Software model is broken. */ - return cOCT6100_ERR_FATAL_C6; - } - } - - pLastLoadOrAccumulateEventEntry = pTempEntry; - usLastLoadEventIndex = usTempEventIndex; - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_C8; - } - - /* Check if we found what we were looking for. */ - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE - || pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE ) - { - /* Software model is broken. */ - return cOCT6100_ERR_FATAL_C7; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Store event - if needed. */ - - if ( fLastEvent == TRUE ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Load or Accumulate event. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save this event index. It's the Load or Accumulate we want to remove from the list later. */ - usLoadOrAccumulateEventIndex = usTempEventIndex; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Copy event - if needed. */ - - if ( ( fLastEvent == TRUE ) && ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* The event remove from the list will be done below. */ - - /* Clear the copy event created flag. */ - pDestinationChanEntry->fCopyEventCreated = FALSE; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /*=======================================================================*/ - /* Remove the events from the mixer event list.*/ - /*=======================================================================*/ - /*=======================================================================*/ - - /*=======================================================================*/ - /* Remove the Load or Accumulate event from the event list. */ - - if ( fLastEvent == FALSE ) - { - /*=======================================================================*/ - /* Remove the Accumulate event from the event list. */ - - /* We saved the Load or Accumulate event above. We also saved the previous event. Use those. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usLoadOrAccumulateEventIndex ); - - /* Now modify the previous last event. */ - pLastEventEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr; - - /* Modify the previous node. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = pLastEventEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if this is the first load event on the bridge. */ - if ( pBridgeEntry->usFirstLoadEventPtr == usLoadOrAccumulateEventIndex ) - { - pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr; - } - - /* Check if this was the first load of all bridges. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr; - } - - /*=======================================================================*/ - } - else /* if ( fLastEvent == TRUE ) */ - { - /*=======================================================================*/ - /* Remove the Load event from the event list. */ - - /* Look for the entry that is pointing at the first entry of our mixer. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usLoadOrAccumulateEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* An Entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Check if this is a Sout copy event. */ - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_COPY ) - { - /* No more previous bridges. */ - fSoutCopyEvent = TRUE; - } - - /* Now modify the previous last Store or Sub-Store or Head-Node event from another bridge/channel. */ - pTempEntry->usNextEventPtr = pStoreEventEntry->usNextEventPtr; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Modify the last node of the previous bridge/channel to point to the next bridge. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = pTempEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Set the event pointer info in the bridge stucture. */ - - if ( pBridgeEntry->usFirstLoadEventPtr == pDestinationChanEntry->usLoadEventIndex ) - { - UINT16 usChannelIndex; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - - /* Find the next channel in this conference that could give us valid values. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( ( usChannelIndex != f_usDestinationChannelIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - { - pBridgeEntry->usFirstSubStoreEventPtr = pTempEchoChanEntry->usSubStoreEventIndex; - pBridgeEntry->usFirstLoadEventPtr = pTempEchoChanEntry->usLoadEventIndex; - break; - } - } - } - } - } - - /* Reprogram the TSST entry correctly if the extra SIN TSI entry was released. */ - if ( ( pDestinationChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) ) - { - if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pDestinationChanEntry->usSinTsstIndex, - pDestinationChanEntry->usSinSoutTsiMemIndex, - pDestinationChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the original sin TSI. */ - if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Reprogram the TSST entry correctly if the extra RIN TSI entry was released. */ - if ( ( pDestinationChanEntry->usExtraRinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) ) - { - if ( pDestinationChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pDestinationChanEntry->usRinTsstIndex, - pDestinationChanEntry->usRinRoutTsiMemIndex, - pDestinationChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex && - pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex ) - { - /* There is no more bridge entry in the mixer link list. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pStoreEventEntry->usNextEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex ) - { - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check if must remove the Sin copy event from the list. */ - - if ( ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) ) - { - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pDestinationChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - - /*=======================================================================*/ - - if ( f_fRemovePermanently == TRUE ) - { - /* Set the event entries as free. */ - pLoadEventEntry->fReserved = FALSE; - pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pStoreEventEntry->fReserved = FALSE; - pStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - if ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pDestinationChanEntry->usSinCopyEventIndex ); - - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - } - - /* Flexible mixer for this channel not created anymore. */ - pDestinationParticipant->fFlexibleMixerCreated = FALSE; - - /*=======================================================================*/ - } - - /*=======================================================================*/ - } - else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == FALSE ) */ - { - /* This point should never be reached. */ - return cOCT6100_ERR_FATAL_C9; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanMuteSer - -Description: Mute an echo channel present on a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMute Pointer to conference bridge mute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanMuteSer -UINT32 Oct6100ConfBridgeChanMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ) -{ - UINT16 usChanIndex; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT32 ulResult; - UINT8 fFlexibleConferencing; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckBridgeMuteParams( - f_pApiInstance, - f_pConfBridgeMute, - &usChanIndex, - &usLoadEventIndex, - &usSubStoreEventIndex, - &fFlexibleConferencing ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify all resources needed by the conference bridge. */ - ulResult = Oct6100ApiUpdateBridgeMuteResources( - f_pApiInstance, - usChanIndex, - usLoadEventIndex, - usSubStoreEventIndex, - fFlexibleConferencing ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeMuteParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMute Pointer to conference bridge channel mute structure. -f_pusChannelIndex Pointer to a channel index. -f_pusLoadEventIndex Pointer to a load mixer event index. -f_pusSubStoreEventIndex Pointer to a sub-store mixer event index. -f_pfFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeMuteParams -UINT32 Oct6100ApiCheckBridgeMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeMute->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle.*/ - - if ( (f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge. */ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - /* Check if channel is already muted. */ - if ( pEchoChanEntry->fMute == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_ALREADY_MUTED; - - /* Check if this is a tap channel, which is always mute. */ - if ( pEchoChanEntry->fTap == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - - if ( pBridgeEntry->fFlexibleConferencing == FALSE ) - { - /* Check the event entries.*/ - if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - } - - /*=====================================================================*/ - - /* Return the config of the channel and all other important information. */ - *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex; - *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex; - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeMuteResources - -Description: Modify the conference bridge entry for this channel in order - to mute the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Index of the channel to be muted. -f_usLoadEventIndex Allocated entry for the Load event of the channel. -f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel. -f_fFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeMuteResources -UINT32 Oct6100ApiUpdateBridgeMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - UINT32 ulResult; - UINT16 usTempEventIndex; - UINT32 ulLoopCount; - UINT16 usReadData; - - BOOL fCreateSilenceLoad = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - UINT16 usChannelIndex; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - UINT32 ulMutePortChannelIndex; - - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if this participant can hear us. */ - if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) ) - { - /* Then update this channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - pEchoChanEntry->usBridgeIndex, - f_usChanIndex, - usChannelIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex; - break; - } - } - } - } - } - } - } - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED ) - { - UINT32 ulTempResult; - - /* Cleanup resources, unmute channel... */ - ulTempResult = Oct6100ApiUpdateBridgeUnMuteResources( - f_pApiInstance, - f_usChanIndex, - f_usLoadEventIndex, - f_usSubStoreEventIndex, - TRUE ); - if ( ulTempResult != cOCT6100_ERR_OK ) - return ulTempResult; - else - return ulResult; - } - else - { - return ulResult; - } - } - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /*=======================================================================*/ - /* Program the Load event. */ - - /* Create silence load if this is the first event of the bridge. */ - if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr ) - fCreateSilenceLoad = TRUE; - - /* First check if this event was a load or an accumulate event, if it's a load */ - /* we need to find a new load. */ - if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex ) - { - /* Change the next entry if one is present to a load event to keep the bridge alive. */ - if ( pBridgeEntry->usNumClients == 1 ) - { - /* There is no other entry on the bridge, no need to search for an Accumulate event. */ - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Search for an accumulate event to tranform into a Load event. */ - usTempEventIndex = pLoadEventEntry->usNextEventPtr; - ulLoopCount = 0; - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Change this entry into a load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set this entry as the load index. */ - pBridgeEntry->usLoadIndex = usTempEventIndex; - - /* Update the software model. */ - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Stop searching. */ - break; - } - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_9B; - } - } - } - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* Do not load the sample if the channel is muted. */ - if ( fCreateSilenceLoad == TRUE ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr == cOCT6100_INVALID_INDEX ) - { - /* Instead of No-oping, load the silence TSI, to make sure the other conferences before us are not heard. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */ - - /* Remember the silence load event. */ - pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex; - } - else - { - /* Do nothing. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - } - else - { - /* Do nothing. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* Do not load the sample if the channel is muted. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Sout input. */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - else /* if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX ) */ - { - /* Rin input. */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /*=======================================================================*/ - } - - /* Update the channel entry API structure */ - pEchoChanEntry->fMute = TRUE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanUnMuteSer - -Description: UnMute an echo channel present on a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanUnMuteSer -UINT32 Oct6100ConfBridgeChanUnMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ) -{ - UINT16 usChanIndex; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT8 fFlexibleConfBridge; - UINT32 ulResult; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckBridgeUnMuteParams( - f_pApiInstance, - f_pConfBridgeUnMute, - &usChanIndex, - &usLoadEventIndex, - &usSubStoreEventIndex, - &fFlexibleConfBridge ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify all resources needed by the conference bridge. */ - ulResult = Oct6100ApiUpdateBridgeUnMuteResources( - f_pApiInstance, - usChanIndex, - usLoadEventIndex, - usSubStoreEventIndex, - fFlexibleConfBridge ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeUnMuteParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure. -f_pusChannelIndex Pointer to the channel index fo the channel to be unmuted. -f_pusLoadEventIndex Pointer to the load index of the channel. -f_pusSubStoreEventIndex Pointer to the sub-store event of the channel. -f_pfFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeUnMuteParams -UINT32 Oct6100ApiCheckBridgeUnMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeUnMute->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle.*/ - - if ( (f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeUnMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge.*/ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - /* Check if channel is already muted.*/ - if ( pEchoChanEntry->fMute == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_NOT_MUTED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - - /* Check the event entries.*/ - if ( pBridgeEntry->fFlexibleConferencing == FALSE ) - { - if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - /* Check the event entries.*/ - if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - } - - /*=====================================================================*/ - - /* Return the config of the channel and all other important information.*/ - *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex; - *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex; - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeUnMuteResources - -Description: Modify the conference bridge entry for this channel in order - to un-mute the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Index of the channel to be unmuted. -f_usLoadEventIndex Allocated entry for the Load event of the channel. -f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel. -f_fFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeUnMuteResources -UINT32 Oct6100ApiUpdateBridgeUnMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - UINT32 ulResult; - UINT16 usTempEventIndex; - UINT32 ulLoopCount; - UINT16 usReadData; - - UINT16 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - UINT16 usPreviousLoadIndex = cOCT6100_INVALID_INDEX; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - UINT16 usChannelIndex; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Before doing anything, check if the copy events must be created. */ - if ( ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChanEntry->fCopyEventCreated == FALSE ) ) - { - /* The copy event has not been created, create it once for the life of the participant on the bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex; - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now insert the Sin copy event into the list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - pEchoChanEntry->usSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->fCopyEventCreated = TRUE; - } - - /* Search through the list of API channel entry for the ones onto this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if this participant can hear us. */ - if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Then create/update this channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - pEchoChanEntry->usBridgeIndex, - f_usChanIndex, - usChannelIndex, - pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ], - pTempEchoChanEntry->usSubStoreEventIndex, - pTempEchoChanEntry->usSinCopyEventIndex, - pParticipant->ulInputPort, - pTempParticipant->ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the Rin silence event can be cleared now that the */ - /* channel has unmuted. */ - if ( ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pTempEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - } - } - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /*=======================================================================*/ - /* Program the Load event. */ - - /* Before reactivating this event, check what type of event this event must be. */ - if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr || - pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX ) - { - /* This event must become a Load event. */ - usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - pBridgeEntry->usLoadIndex = f_usLoadEventIndex; - } - - usTempEventIndex = pBridgeEntry->usFirstLoadEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount = 0; - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD ) - { - usPreviousLoadIndex = usTempEventIndex; - } - - /* Check if the previous load event is before or after the event about to be unmuted. */ - if ( pTempEntry->usNextEventPtr == f_usLoadEventIndex ) - { - if ( usPreviousLoadIndex == cOCT6100_INVALID_INDEX ) - { - /* We did not find a load event before our node, this mean this one */ - /* is about to become the new load event. */ - usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - } - } - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_9B; - } - - /* Now program the current event node. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = usLoadEventType; - - /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Sout source */ - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else - { - /* Rin source */ - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software event to reflect the hardware. */ - pLoadEventEntry->usEventType = usLoadEventType; - - /* Check if we need to change another node. */ - if ( usLoadEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD ) - { - if ( usPreviousLoadIndex != cOCT6100_INVALID_INDEX ) - { - /* Now program the old load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousLoadIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software event to reflect the hardware. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousLoadIndex ); - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - } - } - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Sout port source */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else - { - /* Rin port source */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software event to reflect the hardware. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check if have to remove silence load event. */ - - if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex ) - { - /* Clear the silence load event ptr. */ - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - } - } - } - - /* Update the channel entry API structure */ - pEchoChanEntry->fMute = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeDominantSpeakerSetSer - -Description: This function sets the dominant speaker of a bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeDominant Pointer to conference bridge dominant speaker - structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeDominantSpeakerSetSer -UINT32 Oct6100ConfBridgeDominantSpeakerSetSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ) -{ - UINT16 usChanIndex; - UINT16 usBridgeIndex; - UINT32 ulResult; - - /* Check the validity of the channel handle given. */ - ulResult = Oct6100ApiCheckBridgeDominantSpeakerParams( f_pApiInstance, f_pConfBridgeDominantSpeaker, &usChanIndex, &usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify all resources needed by the conference bridge. */ - ulResult = Oct6100ApiUpdateBridgeDominantSpeakerResources( f_pApiInstance, usChanIndex, usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeDominantSpeakerParams - -Description: Check the validity of the channel given for setting the - dominant speaker. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeDominant Pointer to conference bridge channel dominant speaker structure. -f_pusChannelIndex Pointer to a channel index. -f_pusChannelIndex Pointer to a bridge index. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams -UINT32 Oct6100ApiCheckBridgeDominantSpeakerParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - BOOL fCheckEntryOpenCnt = FALSE; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeDominantSpeaker->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( f_pConfBridgeDominantSpeaker->ulChannelHndl != cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL ) - { - if ( (f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge. */ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE; - - /* Check if the NLP is enabled on this channel. */ - if ( pEchoChanEntry->VqeConfig.fEnableNlp == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_NLP_MUST_BE_ENABLED; - - /* Check if conferencing noise reduction is enabled on this channel. */ - if ( pEchoChanEntry->VqeConfig.fSoutConferencingNoiseReduction == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CNR_MUST_BE_ENABLED; - - /* Check if this is a tap channel. If it is, it will never be the dominant speaker! */ - if ( pEchoChanEntry->fTap == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE; - - /* Set the bridge index. */ - *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex; - } - else - { - /* Set this such that there is no dominant speaker on this conference bridge. */ - *f_pusChannelIndex = cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED; - - /* Check the conference bridge handle. */ - if ( (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Set the bridge index. */ - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - fCheckEntryOpenCnt = TRUE; - } - - /*=====================================================================*/ - - /*=====================================================================*/ - - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( fCheckEntryOpenCnt == TRUE ) - { - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - } - - /*=====================================================================*/ - /* Check if dominant speaker is supported in this firmware version. */ - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_DOMINANT_SPEAKER; - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeDominantSpeakerResources - -Description: Modify the conference bridge such that the new dominant - speaker is the one specified by the index. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Index of the channel to be set as the dominant speaker. -f_usBridgeIndex Index of the bridge where this channel is on. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources -UINT32 Oct6100ApiUpdateBridgeDominantSpeakerResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usBridgeIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - UINT16 usChannelIndex; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the bridge entry for this channel. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ) - - /* Set the dominant speaker index for all channels in this conference. */ - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - /* If we are unsetting the dominant speaker, of if it is not our channel index. */ - if ( ( f_usChanIndex == cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ) - || ( f_usChanIndex != usChannelIndex ) ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, f_usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /* Make sure this channel is disabled. */ - if ( f_usChanIndex != cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Save this in the conference bridge structure. */ - /* This will be needed later when removing the channel. */ - pBridgeEntry->fDominantSpeakerSet = TRUE; - pBridgeEntry->usDominantSpeakerChanIndex = f_usChanIndex; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeMaskChangeSer - -Description: This function changes the mask of flexible bridge - participant. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeMaskChange Pointer to conference bridge participant mask - change structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeMaskChangeSer -UINT32 Oct6100ConfBridgeMaskChangeSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ) -{ - UINT16 usChanIndex; - UINT16 usBridgeIndex; - UINT32 ulResult; - UINT32 ulNewParticipantMask; - - /* Check the validity of the channel handle given. */ - ulResult = Oct6100ApiCheckBridgeMaskChangeParams( f_pApiInstance, f_pConfBridgeMaskChange, &usChanIndex, &usBridgeIndex, &ulNewParticipantMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update all resources needed by the new mask. */ - ulResult = Oct6100ApiUpdateMaskModifyResources( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Commit the changes to the chip's internal memories. */ - ulResult = Oct6100ApiBridgeUpdateMask( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeMaskChangeParams - -Description: Check the validity of the channel given for setting the - mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMaskChange Pointer to conference bridge channel mask change structure. -f_pusChannelIndex Pointer to a channel index. -f_pusBridgeIndex Pointer to a bridge index. -f_pulNewParticipantMask New mask to apply for this participant. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeMaskChangeParams -UINT32 Oct6100ApiCheckBridgeMaskChangeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT32 f_pulNewParticipantMask ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeMaskChange->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle.*/ - - if ( (f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeMaskChange->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge. */ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE; - - /* Set the bridge index. */ - *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex; - - /*=====================================================================*/ - - /*=====================================================================*/ - - if ( ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX ) - || ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - - /* Check if this is bridge is a flexible conference bridge. */ - if ( pBridgeEntry->fFlexibleConferencing == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_SIMPLE_BRIDGE; - - /*=====================================================================*/ - - /* Return new mask to apply. */ - *f_pulNewParticipantMask = f_pConfBridgeMaskChange->ulNewListenerMask; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateMaskModifyResources - -Description: Modify/reserve all resources needed for the modification of - the participant's mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBridgeIndex Bridge index of the bridge where this channel is residing. -f_usChanIndex Channel index of the channel to be modified. -f_ulNewListenerMask New mask to apply to the selected participant. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateMaskModifyResources -UINT32 Oct6100ApiUpdateMaskModifyResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - UINT32 ulOldListenerMask; - UINT16 usChannelIndex; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex ); - - /* Must travel all clients of this conference and reserve a load or accumulate event for */ - /* all participants which could not hear us but now can. While at it, check for events that */ - /* could be released, for example a participant that we cannot hear anymore. */ - - ulOldListenerMask = pParticipant->ulListenerMask; - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can now hear this participant, but could not before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) ) - { - /* Must reserve a load or accumulate entry mixer event here! */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Most probably, the hardware is out of mixer events. */ - break; - } - } - - /* Check if we can now NOT hear this participant, but could before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* Must release the load or accumulate entry mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - break; - } - } - } - } - } - - /* If an error is returned, make sure everything is cleaned up properly. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can now hear this participant, but could not before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - - /* Check if we can now NOT hear this participant, but could before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] == cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ) ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - } - } - } - } - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeUpdateMask - -Description: Update the participant's mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index of the bridge where this channel is residing. -f_usChanIndex Channel index of the channel to be modified. -f_ulNewListenerMask New mask to apply to the selected participant. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeUpdateMask -UINT32 Oct6100ApiBridgeUpdateMask( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT32 ulOldListenerMask; - UINT16 usChannelIndex; - - UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - UINT32 ulMutePortChannelIndex; - - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex ); - - ulOldListenerMask = pParticipant->ulListenerMask; - - /* Search through the list of API channel entry for the ones onto this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can now hear this participant, but could not before. */ - if ( ( pTempEchoChanEntry->fMute == FALSE ) - && ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) ) - { - /* First create/update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ], - pChanEntry->usSubStoreEventIndex, - pChanEntry->usSinCopyEventIndex, - pTempParticipant->ulInputPort, - pParticipant->ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pParticipant->fFlexibleMixerCreated == TRUE ) - { - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - } - - /* Check if we can now NOT hear this participant, but could before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->fMute == FALSE ) ) - { - /* First update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == f_usChanIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = f_usChanIndex; - break; - } - } - } - } - - /* Clear the load or accumulate event index for this participant. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - } - } - - /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */ - if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex, - pChanEntry->usExtraSinTsiMemIndex, - pChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the extra sin TSI. */ - if ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pChanEntry->usExtraSinTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure the RIN copy mixer entry and memory - if using the RIN port. */ - if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usRinTsstIndex, - pChanEntry->usExtraRinTsiMemIndex, - pChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Save the new mask permanently in the API instance. */ - pParticipant->ulListenerMask = f_ulNewListenerMask; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeGetStatsSer - -Description: This function returns the statistics from the specified bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeStats Pointer to conference bridge stats structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeGetStatsSer -UINT32 Oct6100ConfBridgeGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - UINT16 usConfBridgeIndex; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - /* Check the provided handle. */ - if ( (f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - usConfBridgeIndex = (UINT16)( f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( usConfBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, usConfBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeStats->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /*=====================================================================*/ - - /* Return the stats.*/ - f_pConfBridgeStats->ulNumChannels = pBridgeEntry->usNumClients; - f_pConfBridgeStats->ulNumTappedChannels = pBridgeEntry->usNumTappedClients; - f_pConfBridgeStats->fFlexibleConferencing = pBridgeEntry->fFlexibleConferencing; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBridgeEntry - -Description: Reserves a free entry in the Bridge list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pusBridgeIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBridgeEntry -UINT32 Oct6100ApiReserveBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusBridgeIndex ) -{ - PVOID pBridgeAlloc; - UINT32 ulResult; - UINT32 ulBridgeIndex; - - mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc ) - - ulResult = OctapiLlmAllocAlloc( pBridgeAlloc, &ulBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CONF_BRIDGE_ALL_BUFFERS_OPEN; - else - return cOCT6100_ERR_FATAL_29; - } - - *f_pusBridgeIndex = (UINT16)( ulBridgeIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBridgeEntry - -Description: Release an entry from the bridge list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBridgeIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBridgeEntry -UINT32 Oct6100ApiReleaseBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex ) -{ - PVOID pBridgeAlloc; - UINT32 ulResult; - - mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc ) - - ulResult = OctapiLlmAllocDealloc( pBridgeAlloc, f_usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2A; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPrevLastSubStoreEvent - -Description: This function will search for the first valid LastSubStoreEvent - in a bridge located before the current bridge in the bridge - link list. - - If the function does not find an event before reaching the end - of the mixers list, then the event head node will be used as the - last Store or SubStore event. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusBridgeEntry Bridge entry. -f_usBridgeFirstLoadEventPtr Load index to check against. -First valid sub store index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPrevLastSubStoreEvent -UINT32 Oct6100ApiGetPrevLastSubStoreEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usBridgeFirstLoadEventPtr, - OUT PUINT16 f_pusLastSubStoreEventIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_MIXER_EVENT pTempMixerEntry; - UINT16 usNextEventPtr; - UINT16 usHeadEventPtr; - UINT16 usLastSubStoreEventPtr; - UINT32 ulLoopCount = 0; - UINT16 usCurrentPtr; - UINT32 ulResult = cOCT6100_ERR_OK; - - /* Get current entry to obtain the link to the previous entry.*/ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - /* Since we have flexible bridges, we have to */ - /* run down the list and check for the appropriate event. */ - - /* Travel down the list for the last Store or Sub/Store event before the bridge. */ - - if ( f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* The only node in the list then is the head node.*/ - usHeadEventPtr = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usHeadEventPtr = f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usHeadEventPtr ); - usLastSubStoreEventPtr = usHeadEventPtr; - usNextEventPtr = pTempMixerEntry->usNextEventPtr; - usCurrentPtr = usHeadEventPtr; - while( usCurrentPtr != f_usBridgeFirstLoadEventPtr ) - { - if ( ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE ) - || ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE ) ) - { - usLastSubStoreEventPtr = usNextEventPtr; - } - - /* Next pointer. */ - usCurrentPtr = usNextEventPtr; - usNextEventPtr = pTempMixerEntry->usNextEventPtr; - - /* Check if next event pointer is valid. */ - if ( ( ( f_usBridgeFirstLoadEventPtr != usCurrentPtr ) - && ( pTempMixerEntry->usNextEventPtr == cOCT6100_INVALID_INDEX ) ) - || ( pTempMixerEntry->usNextEventPtr == cOCT6100_MIXER_HEAD_NODE ) ) - return cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND; - - if ( usNextEventPtr != cOCT6100_INVALID_INDEX ) - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usNextEventPtr ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_CA; - } - - /* Return the result to the user. */ - *f_pusLastSubStoreEventIndex = usLastSubStoreEventPtr; - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPreviousEvent - -Description: This is a recursive function, it requires an entry event index and - will run down the list until it finds the node just before the one - required. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEntryIndex Event entry index. -f_pusBridgeEntry Bridge entry. -f_pusPreviousIndex Previous index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPreviousEvent -UINT32 Oct6100ApiGetPreviousEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEntryIndex, - IN UINT16 f_usSearchedIndex, - IN UINT16 f_usLoopCnt, - OUT PUINT16 f_pusPreviousIndex ) -{ - tPOCT6100_API_MIXER_EVENT pCurrentEntry; - UINT32 ulResult; - - /* Get current entry to obtain the link to the previous entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pCurrentEntry, f_usEntryIndex ); - - /* Avoid stack overflows. */ - if ( f_usLoopCnt == cOCT6100_MAX_MIXER_EVENTS ) - return cOCT6100_ERR_FATAL_E3; - - if ( pCurrentEntry->usNextEventPtr == cOCT6100_INVALID_INDEX ) - { - /* Event not found. */ - ulResult = cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND; - } - else if ( pCurrentEntry->usNextEventPtr == f_usSearchedIndex ) - { - /* We found our node. */ - *f_pusPreviousIndex = f_usEntryIndex; - ulResult = cOCT6100_ERR_OK; - } - else - { - /* Keep searching.*/ - f_usLoopCnt++; - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pCurrentEntry->usNextEventPtr, f_usSearchedIndex, f_usLoopCnt, f_pusPreviousIndex ); - } - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeSetDominantSpeaker - -Description: This function will set the index of the dominant speaker - for the channel index specified. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_usChannelIndex Index of the channel where the API must set the - current dominant speaker for the conference. -f_usDominantSpeakerIndex Index of the channel which is the dominant - speaker in the conference. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeSetDominantSpeaker -UINT32 Oct6100ApiBridgeSetDominantSpeaker( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChannelIndex, - IN UINT16 f_usDominantSpeakerIndex ) -{ - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulMask; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, f_usChannelIndex ); - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst; - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byFieldSize; - - /* Retrieve the current configuration. */ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( f_usDominantSpeakerIndex ) << ulFeatureBitOffset ); - - /* Save the new dominant speaker. */ - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveFlexConfParticipantEntry - -Description: Reserves a free entry in the participant list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pusParticipantIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveFlexConfParticipantEntry -UINT32 Oct6100ApiReserveFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusParticipantIndex ) -{ - PVOID pParticipantAlloc; - UINT32 ulResult; - UINT32 ulParticipantIndex; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc ) - - ulResult = OctapiLlmAllocAlloc( pParticipantAlloc, &ulParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_ALL_BUFFERS_OPEN; - else - return cOCT6100_ERR_FATAL_29; - } - - *f_pusParticipantIndex = (UINT16)( ulParticipantIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseFlexConfParticipantEntry - -Description: Release an entry from the flexible conferencing participant - list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usParticipantIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseFlexConfParticipantEntry -UINT32 Oct6100ApiReleaseFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usParticipantIndex ) -{ - PVOID pParticipantAlloc; - UINT32 ulResult; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc ) - - ulResult = OctapiLlmAllocDealloc( pParticipantAlloc, f_usParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2A; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c deleted file mode 100644 index 1f4de014..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c +++ /dev/null @@ -1,1278 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_debug.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to debug the OCT6100. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 65 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_debug_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_debug_priv.h" -#include "oct6100_version.h" - - -/**************************** PUBLIC FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugSelectChannel - -Description: This function sets the current debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pSelectDebugChan Pointer to select debug channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugSelectChannelDef -UINT32 Oct6100DebugSelectChannelDef( - tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ) -{ - f_pSelectDebugChan->ulChannelHndl = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100DebugSelectChannel -UINT32 Oct6100DebugSelectChannel( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100DebugSelectChannelSer( f_pApiInstance, f_pSelectDebugChan, TRUE ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugGetData - -Description: This function retrieves the last recorded debug data. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pGetData Pointer to debug get data structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugGetDataDef -UINT32 Oct6100DebugGetDataDef( - tPOCT6100_DEBUG_GET_DATA f_pGetData ) -{ - f_pGetData->ulGetDataMode = cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE; - f_pGetData->ulGetDataContent = cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE; - f_pGetData->ulRemainingNumBytes = cOCT6100_INVALID_VALUE; - f_pGetData->ulTotalNumBytes = cOCT6100_INVALID_VALUE; - f_pGetData->ulMaxBytes = cOCT6100_INVALID_VALUE; - f_pGetData->ulValidNumBytes = cOCT6100_INVALID_VALUE; - f_pGetData->pbyData = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100DebugGetData -UINT32 Oct6100DebugGetData( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_DEBUG_GET_DATA f_pGetData ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100DebugGetDataSer( f_pApiInstance, f_pGetData ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugSelectChannelSer - -Description: This function sets the debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pSelectDebugChan Pointer to a tOCT6100_DEBUG_SELECT_CHANNEL structure. -f_fCheckChannelRecording Check if channel recording is enabled or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugSelectChannelSer -UINT32 Oct6100DebugSelectChannelSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan, - IN BOOL f_fCheckChannelRecording ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry = NULL; - tPOCT6100_API_CHANNEL pTempChanEntry; - tOCT6100_CHANNEL_OPEN TempChanOpen; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT16 usChanIndex = 0; - UINT32 ulEntryOpenCnt; - UINT16 ausWriteData[ 2 ]; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusWriteData = ausWriteData; - - /* First release the resources reserved for the channel that was previously debugged. */ - if ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex != cOCT6100_INVALID_INDEX && - pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempChanEntry, pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) - - /* Release the extra TSI memory entry and reprogram the TSST control memory if required. */ - if ( pTempChanEntry->usExtraSinTsiDependencyCnt >= 1 ) - { - /*=======================================================================*/ - /* Clear memcpy operations. */ - - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 2; - - ausWriteData[ 0 ] = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - ausWriteData[ 1 ] = 0x0; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordSinEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* If we are the last dependency using the extra Sin TSI, release it */ - if ( pTempChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pTempChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Do not forget to reprogram the TSST control memory. */ - if ( pTempChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pTempChanEntry->usSinTsstIndex, - pTempChanEntry->usSinSoutTsiMemIndex, - pTempChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - pTempChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - - /* XXX: What about the silence TSI usSinSilenceEventIndex ?? */ - } - - pTempChanEntry->usExtraSinTsiDependencyCnt--; - - } - } - - /* Set the new parameters. */ - if ( f_pSelectDebugChan->ulChannelHndl != cOCT6100_INVALID_HANDLE ) - { - /* Check the provided handle. */ - if ( (f_pSelectDebugChan->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_DEBUG_CHANNEL_INVALID_HANDLE; - - usChanIndex = (UINT16)( f_pSelectDebugChan->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( usChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_DEBUG_CHANNEL_INVALID_HANDLE; - - if ( f_fCheckChannelRecording == TRUE ) - { - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_DEBUG_CHANNEL_RECORDING_DISABLED; - } - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, usChanIndex ); - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pSelectDebugChan->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* First program the mixer entry if the user wants to record. */ - /* Check if the API needs to reserve an extra TSI memory to load the SIN signal. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - /* Reserve the extra Sin TSI memory if it was not already reserved. */ - if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, &pChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reprogram the TSST control memory accordingly. */ - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex, - pChanEntry->usExtraSinTsiMemIndex, - pChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* XXX: What about the silence TSI usSinSilenceEventIndex ?? */ - } - - - /*=======================================================================*/ - /* Program the Sout Copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 2; - - ausWriteData[ 0 ] = cOCT6100_MIXER_CONTROL_MEM_COPY; - ausWriteData[ 0 ] |= pChanEntry->usSinSoutTsiMemIndex; - ausWriteData[ 0 ] |= pChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - ausWriteData[ 1 ] = (UINT16)( pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex ); - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Sin copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordSinEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 2; - - ausWriteData[ 0 ] = cOCT6100_MIXER_CONTROL_MEM_COPY; - ausWriteData[ 0 ] |= pChanEntry->usExtraSinTsiMemIndex; - ausWriteData[ 0 ] |= pChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - ausWriteData[ 1 ] = pChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - pChanEntry->usExtraSinTsiDependencyCnt++; - } - } - else - { - /* Set the index to invalid to deactivate the recording. */ - usChanIndex = cOCT6100_INVALID_INDEX; - } - - /* Set law of newly selected hot channel. */ - if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - && ( f_pSelectDebugChan->ulChannelHndl != cOCT6100_INVALID_HANDLE ) - && ( pChanEntry != NULL ) ) - { - /* Set the PCM law of the debug channel. */ - /* Let's program the channel memory. */ - Oct6100ChannelOpenDef( &TempChanOpen ); - - TempChanOpen.ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_HT_RESET; /* Activate the channel. */ - TempChanOpen.VqeConfig.fEnableNlp = FALSE; - TempChanOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; - TempChanOpen.VqeConfig.fSinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.fRinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.lDefaultErlDb = 0; - - /* Use the law of the channel being recorded. */ - TempChanOpen.TdmConfig.ulRinPcmLaw = pChanEntry->TdmConfig.byRinPcmLaw; - TempChanOpen.TdmConfig.ulSinPcmLaw = pChanEntry->TdmConfig.bySinPcmLaw; - TempChanOpen.TdmConfig.ulRoutPcmLaw = pChanEntry->TdmConfig.byRoutPcmLaw; - TempChanOpen.TdmConfig.ulSoutPcmLaw = pChanEntry->TdmConfig.bySoutPcmLaw; - - ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance, - &TempChanOpen.TdmConfig, - &TempChanOpen.VqeConfig, - &TempChanOpen, - pSharedInfo->DebugInfo.usRecordChanIndex, - pSharedInfo->DebugInfo.usRecordMemIndex, - pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex, - pSharedInfo->DebugInfo.usRecordSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - ausWriteData[ 0 ] = 0x0; - ausWriteData[ 1 ] = (UINT16)(( usChanIndex >> 0) & 0xFFFF); - - /* Write the channel number into the Matrix hot channel field.*/ - BurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - BurstParams.pusWriteData = ausWriteData; - BurstParams.ulWriteLength = 2; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pSharedInfo->DebugInfo.usCurrentDebugChanIndex = usChanIndex; - - /* Cancel data dump request, if there was one. */ - pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE; - pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE; - - /* Call from remote client. */ - if ( f_fCheckChannelRecording == FALSE ) - { - /* If the user has not activated recording, let the remote client know. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_DEBUG_RC_CHANNEL_RECORDING_DISABLED; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugGetDataSer - -Description: This function retrieves the latest recorded debug data. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pGetData Pointer to a tOCT6100_DEBUG_GET_DATA structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugGetDataSer -UINT32 Oct6100DebugGetDataSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ) -{ - - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry = NULL; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_BURST_PARAMS ReadBurstParams; - tOCT6100_WRITE_BURST_PARAMS WriteBurstParams; - - UINT16 ausWriteData[ 2 ]; - UINT16 usReadData; - UINT16 usDebugEventReadPtr; - UINT16 usTempNumEvents; - - UINT32 ulResult; - UINT32 ulToneEventIndex; - UINT32 ulReadPointer; - UINT32 ulUserBufWriteIndex = 0; - UINT32 ulTimestamp; - UINT32 ulDebugEventIndex = 0; - UINT32 ulStreamIndex; - UINT32 ulPcmSampleIndex; - UINT32 ulNumAfEvents; - UINT32 ulNumReads = 0; - UINT32 ulTempIndex; - UINT32 ulCopyIndex; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulStreamIndexMin; - UINT32 ulStreamIndexMax; - UINT32 ulTempData; - UINT32 ulMask; - BOOL fResetRemainingDataFlag = FALSE; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Check all user parameters. */ - - /* Check if channel recording is enabled. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_DEBUG_CHANNEL_RECORDING_DISABLED; - - /* Check if a current debugging channel has been selected. */ - /* If not, the user has not yet called Oct6100DebugSelectChannel. */ - if ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_DEBUG_RECORD_NO_CHAN_SELECTED; - - /* Check that the user supplied a valid max bytes value. */ - if ( f_pGetData->ulMaxBytes == cOCT6100_INVALID_VALUE ) - return cOCT6100_ERR_DEBUG_GET_DATA_MAX_BYTES; - - /* Data buffer must be aligned on 1024 bytes. */ - if ( ( f_pGetData->ulMaxBytes % 1024 ) != 0 ) - return cOCT6100_ERR_DEBUG_GET_DATA_MAX_BYTES; - - /* Check that the user provided the required memory to transfer the information. */ - if ( f_pGetData->pbyData == NULL ) - return cOCT6100_ERR_DEBUG_GET_DATA_PTR_INVALID; - - /* Check dump type. */ - if ( ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) - && ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) - && ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_16S ) - && ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - return cOCT6100_ERR_DEBUG_GET_DATA_MODE; - - /* Check dump content. */ - if ( ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) - && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) - && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) ) - return cOCT6100_ERR_DEBUG_GET_DATA_CONTENT; - - /* Check if can accomodate the 120 seconds dump. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - if ( pSharedInfo->DebugInfo.ulDebugEventSize != 0x100 ) - return cOCT6100_ERR_NOT_SUPPORTED_DEBUG_DATA_MODE_120S; - } - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) - - /* Lets go dump the requested data. */ - - usDebugEventReadPtr = 0; - - /* Check if this is the first time this function is called since the hot channel was set. */ - if ( pSharedInfo->DebugInfo.fDebugDataBeingDumped == FALSE ) - { - /* Check that the channel is not in POWER_DOWN. When the channel is in POWER_DOWN, */ - /* the debug events are not recorded correctly in external memory. */ - if ( pChanEntry->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN ) - return cOCT6100_ERR_DEBUG_CHANNEL_IN_POWER_DOWN; - - pSharedInfo->DebugInfo.fDebugDataBeingDumped = TRUE; - - /* Flag the hot channel that it must stop recording. The data is being transfered. */ - /* This also tells the remote client not to do anything right now. */ - - ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - ReadBurstParams.ulReadLength = 2; - ReadBurstParams.pusReadData = pSharedInfo->DebugInfo.ausHotChannelData; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteBurstParams.pusWriteData = ausWriteData; - WriteBurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - WriteBurstParams.ulWriteLength = 2; - - WriteBurstParams.pusWriteData[ 0 ] = 0xFFFF; - WriteBurstParams.pusWriteData[ 1 ] = 0xFFFF; - - mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get the maximum number of events this firmware supports from the TLVs. */ - pSharedInfo->DebugInfo.usMatrixCBMask = (UINT16)( pSharedInfo->DebugInfo.ulDebugEventSize & 0xFFFF ); - pSharedInfo->DebugInfo.usMatrixCBMask -= 1; - - /* Find out the chip log write pointer. */ - - /* Now get the current write pointer for matrix events. */ - ReadParams.pusReadData = &pSharedInfo->DebugInfo.usChipDebugEventWritePtr; - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixWpBaseAddress + 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.pusReadData = &usReadData; - - /* This write pointer might have wrapped, but we don't know for sure. */ - /* To be confident, the chip frame timestamp is read. */ - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixTimestampBaseAddress; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulTimestamp = usReadData << 16; - - ReadParams.ulReadAddress += 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulTimestamp |= usReadData; - - ulTimestamp >>= 12; /* TDM time for 1 event (512 ms) */ - - /* There is a probability here (once very 6.2 days) that the timestamp is close */ - /* to 0, because it has wrapped. But still, we need a way to workaround the highly */ - /* occuring case of the chip just being opened. This will fix this problem. */ - if ( ulTimestamp < (UINT32)( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) ) - { - if ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr >= 2 ) - { - /* Must trash the first 2 events. The chip is not yet ready. */ - pSharedInfo->DebugInfo.usNumEvents = (UINT16)( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - 2 ); - } - else - { - pSharedInfo->DebugInfo.usNumEvents = 0x0; - } - } - else - { - pSharedInfo->DebugInfo.usNumEvents = (UINT16)( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ); - - /* Account for event being created right now while the chip is running. */ - /* The event at the write pointer will be discarded. */ - if ( pSharedInfo->DebugInfo.usNumEvents > 0 ) - pSharedInfo->DebugInfo.usNumEvents--; - } - - - /* If the user only requested the last 16 seconds, cap the number of events. */ - if ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S - || f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) - { - /* x events to get the last 16 seconds. */ - if ( pSharedInfo->DebugInfo.usNumEvents > ( 16000 / ( pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize / 8 ) ) ) - pSharedInfo->DebugInfo.usNumEvents = (UINT16)( ( 16000 / ( pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize / 8 ) ) & 0xFFFF ); - } - - /* Make sure that all the events are pertaining to the current hot channel. */ - /* Calculate the event read pointer. */ - ulReadPointer = ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) & pSharedInfo->DebugInfo.usMatrixCBMask ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - ulReadPointer %= ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - - /* Travel through the events and throw away the bad events. */ - usTempNumEvents = pSharedInfo->DebugInfo.usNumEvents; - pSharedInfo->DebugInfo.usNumEvents = 0; - for ( ulDebugEventIndex = 0; ulDebugEventIndex < usTempNumEvents; ulDebugEventIndex ++ ) - { - /* The HOT channel index for the event is stored at offset 0xF2 (word offset) */ - - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer; - ReadParams.ulReadAddress += 0xF2 * sizeof(UINT16); - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the current debug index is the same as the one found in the event. */ - if ( usReadData != pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) - pSharedInfo->DebugInfo.usNumEvents = 0; /* As soon as we hit another channel, we reset the number of valid events. */ - else - pSharedInfo->DebugInfo.usNumEvents++; - - /* Increment read pointer to get next event. */ - ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - } - - /* In heavy mode, the AF log pointer is retrieved. */ - if ( ( pSharedInfo->DebugInfo.usNumEvents >= 2 ) - && ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) ) - { - /* The latest AF log write pointer is at the latest matrix event. */ - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr & pSharedInfo->DebugInfo.usMatrixCBMask ) * 1024 ); - - /* To get the AF log write pointer, which is at offset pSharedInfo->ImageInfo.ulAfWritePtrByteOffset. */ - ReadParams.ulReadAddress += pSharedInfo->DebugInfo.ulAfWritePtrByteOffset; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pSharedInfo->DebugInfo.usAfLogWritePtr = usReadData; - - /* The AF event read pointer is the AF write pointer +4096 */ - /* This will make sure we do not get mixed up and fetch events that have */ - /* just been written, but we think are old. */ - - /* To get the exact AF log pointer, the API would have to wait 512 milliseconds to make */ - /* sure logging had stopped. This is not required since missing a few last events is not */ - /* important at this point (the user knows that valid data has already been recorded). */ - pSharedInfo->DebugInfo.usLastAfLogReadPtr = (UINT16)( ( pSharedInfo->DebugInfo.usAfLogWritePtr + 4096 ) & 0xFFFF ); - - /* Note that if the chip has just been booted, some of the AF events might not be initialized. */ - } - else - { - pSharedInfo->DebugInfo.usLastAfLogReadPtr = 0; - pSharedInfo->DebugInfo.usAfLogWritePtr = 0; - } - - /* To be aligned correctly for the bursts. */ - while ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) != 0 ) - pSharedInfo->DebugInfo.usLastAfLogReadPtr++; - - /* Remember the data mode for later checks. Also, the user cannot change this "mode". */ - pSharedInfo->DebugInfo.ulCurrentGetDataMode = f_pGetData->ulGetDataMode; - } - else - { - /* Check that the user did not change the current data mode. */ - if ( pSharedInfo->DebugInfo.ulCurrentGetDataMode != f_pGetData->ulGetDataMode ) - return cOCT6100_ERR_DEBUG_GET_DATA_MODE_CANNOT_CHANGE; - } - - /* Check if this is the first pass here. */ - if ( pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes == cOCT6100_INVALID_VALUE ) - { - /* Calculate how many bytes of data will be returned with respect to the selected data content. */ - - /* Check what content type the user requested. */ - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - /* Remember first AF Event Read Pointer. */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr >> 8 ) & 0xFF ); - - /* Remember the AF Event Write Pointer. */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr >> 8 ) & 0xFF ); - - /* Remember law and hot channel */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex >> 2 ) & 0xFE ) ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySoutPcmLaw ); - - /* Insert light or heavy mode in array. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex - 1 ] |= 0x80; - } - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.byRinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex & 0x1F ) << 3 ) ); - - /* Remember usNumEvents */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents >> 8 ) & 0xFF ); - } - - /* Last indexes set to '0'! */ - pSharedInfo->DebugInfo.usLastDebugEventIndex = 0; - pSharedInfo->DebugInfo.ulLastPcmSampleIndex = 0; - - /* No tone event has been retrieved. */ - pSharedInfo->DebugInfo.usLastToneEventIndex = 0; - - /* The version strings have not yet been copied. */ - pSharedInfo->DebugInfo.fImageVersionCopied = FALSE; - pSharedInfo->DebugInfo.fApiVersionCopied = FALSE; - - /* Estimate the total size of the buffer that will be returned. */ - f_pGetData->ulTotalNumBytes = ulUserBufWriteIndex; - - /* If the full content is requested, add all the debug data. */ - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - /* Add the matrix events. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - /* Heavy mode! Grab everything! */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - } - else - { - /* Lite mode! Only the most important stuff. */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize; - } - - /* Add the PCM samples. */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize * 3; - - /* If requested, add the AF log events. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - f_pGetData->ulTotalNumBytes += (UINT32)( ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF ) * 16; - } - - /* Add the tone events strings. */ - f_pGetData->ulTotalNumBytes += cOCT6100_TLV_MAX_TONE_NAME_SIZE * pSharedInfo->ImageInfo.byNumToneDetectors; - - /* Add the image version string. */ - f_pGetData->ulTotalNumBytes += 512; - - /* Add the API version string. */ - f_pGetData->ulTotalNumBytes += sizeof( cOCT6100_API_VERSION ); - } - else /* if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */ - { - /* Add one PCM stream. */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize; - } - - /* Save this in the instance for further calls. */ - pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = f_pGetData->ulTotalNumBytes; - - /* Calculate remaining bytes. All the bytes for now! */ - f_pGetData->ulRemainingNumBytes = f_pGetData->ulTotalNumBytes; - - /* Save this in the instance for the next calls. */ - pSharedInfo->DebugInfo.ulDebugDataRemainingNumBytes = f_pGetData->ulRemainingNumBytes; - } - else - { - f_pGetData->ulTotalNumBytes = pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes; - } - - /* Calculate the event read pointer. */ - ulReadPointer = ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) & pSharedInfo->DebugInfo.usMatrixCBMask ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - - ulReadPointer += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize * pSharedInfo->DebugInfo.usLastDebugEventIndex; - ulReadPointer %= ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - /* Copy the debug events in the user buffer. */ - for( ulDebugEventIndex = pSharedInfo->DebugInfo.usLastDebugEventIndex; ulDebugEventIndex < pSharedInfo->DebugInfo.usNumEvents; ulDebugEventIndex ++ ) - { - ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer; - - /* Check if we are in light or heavy mode. The burst size is not the same. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) - ulNumReads = pSharedInfo->DebugInfo.ulDebugChanStatsByteSize / 2; - else - break; - } - else - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize ) - ulNumReads = pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize / 2; - else - break; - } - - ulTempIndex = 0; - while ( ulNumReads != 0 ) - { - if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - ReadBurstParams.ulReadLength = ulNumReads; - - /* Set pointer where to write data. */ - ReadBurstParams.pusReadData = pSharedInfo->MiscVars.ausSuperArray; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Copy data byte per byte to avoid endianess problems. */ - for ( ulCopyIndex = 0; ulCopyIndex < ReadBurstParams.ulReadLength; ulCopyIndex ++ ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( ReadBurstParams.pusReadData[ ulCopyIndex ] & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( ReadBurstParams.pusReadData[ ulCopyIndex ] >> 8 ) & 0xFF ); - } - - /* Update indexes, temp variables, addresses. */ - ulNumReads -= ReadBurstParams.ulReadLength; - ulTempIndex += ReadBurstParams.ulReadLength * 2; - ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2; - } - - /* Store register 0x202 in the event structure. */ - f_pGetData->pbyData[ ulUserBufWriteIndex + 255 ] = (UINT8)( pSharedInfo->IntrptManage.usRegister202h & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + 256 ] = (UINT8)( ( pSharedInfo->IntrptManage.usRegister202h >> 8 ) & 0xFF ); - - /* Increment index. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - } - else - { - ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize; - } - - /* Increment read pointer to get next event. */ - ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - - /* Save in the instance that one of the events was dumped. */ - pSharedInfo->DebugInfo.usLastDebugEventIndex ++; - } - } - - /* Check if all debug events have been transfered. */ - if ( ( ulDebugEventIndex == pSharedInfo->DebugInfo.usNumEvents ) - || ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) ) - { - /* Fetch all streams per event. */ - for ( ulPcmSampleIndex = pSharedInfo->DebugInfo.ulLastPcmSampleIndex; ulPcmSampleIndex < ( (UINT32)pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); ulPcmSampleIndex ++ ) - { - /* Check if enough room for this sample. */ - if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 1 ) - break; - } - else /* if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */ - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 3 ) - break; - } - - /* Check if must retrieve data from external memory. */ - if ( ( ulPcmSampleIndex % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE * 2 ) ) == 0x0 ) - { - ulReadPointer = ( ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) & ( pSharedInfo->DebugInfo.usMatrixCBMask * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) ); - ulReadPointer += ( ulPcmSampleIndex / pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize; - ulReadPointer &= ( pSharedInfo->DebugInfo.usMatrixCBMask * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); - ulReadPointer += ulPcmSampleIndex % pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize; - - /* Retrieve more data from external memory. */ - switch ( f_pGetData->ulGetDataContent ) - { - case cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM: - ulStreamIndexMin = 0; - ulStreamIndexMax = 1; - break; - case cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM: - ulStreamIndexMin = 1; - ulStreamIndexMax = 2; - break; - case cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM: - ulStreamIndexMin = 2; - ulStreamIndexMax = 3; - break; - case cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE: - default: - ulStreamIndexMin = 0; - ulStreamIndexMax = 3; - break; - } - - for ( ulStreamIndex = ulStreamIndexMin; ulStreamIndex < ulStreamIndexMax; ulStreamIndex ++ ) - { - ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase; - /* To get right channel information. */ - ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usRecordMemIndex + 2 ) * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->DebugInfo.ulAfEventCbByteSize; - /* To get correct stream. */ - ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize * ulStreamIndex ); - /* PCM sample pointer in that stream. */ - ReadBurstParams.ulReadAddress += ulReadPointer; - - /* As much as we can for the burst. */ - ulTempIndex = 0; - ulNumReads = cOCT6100_INTERNAL_SUPER_ARRAY_SIZE; - while ( ulNumReads != 0 ) - { - if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - ReadBurstParams.ulReadLength = ulNumReads; - - /* Set pointer where to write data. */ - if ( ulStreamIndex == 0 ) - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray[ ulTempIndex ]; - else if ( ulStreamIndex == 1 ) - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray1[ ulTempIndex ]; - else /* if ( ulStreamIndex == 2 ) */ - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray2[ ulTempIndex ]; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update indexes, temp variables, addresses. */ - ulNumReads -= ReadBurstParams.ulReadLength; - ulTempIndex += ReadBurstParams.ulReadLength; - ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2; - } - } - } - - /* We now have the stream data for all streams for 1 event. */ - /* Return what we can to the user. */ - if ( ( ulPcmSampleIndex % 2 ) == 0 ) - { - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF ); - } - else /* if ( ulPcmSampleIndex % 2 == 1 ) */ - { - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF ); - } - - pSharedInfo->DebugInfo.ulLastPcmSampleIndex++; - } - - /* Check if we are done dumping the PCM samples! */ - if ( pSharedInfo->DebugInfo.ulLastPcmSampleIndex == ( (UINT32)pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) ) - { - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - - /* Go for the AF events. The AF events are only copied in heavy mode. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - while ( pSharedInfo->DebugInfo.usLastAfLogReadPtr != pSharedInfo->DebugInfo.usAfLogWritePtr ) - { - /* Check if enough room for an event. */ - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 16 ) - break; - - /* Check if must fill our buffer. */ - if ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) == 0x0 ) - { - ulNumAfEvents = ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF; - - /* Check for the size of the available buffer. */ - if ( ulNumAfEvents > ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) - ulNumAfEvents = ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ); - - /* Start at channel main base address. */ - ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase; - /* To get right channel information. */ - ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usRecordMemIndex + 2 ) * pSharedInfo->MemoryMap.ulChanMainMemSize ); - /* To get the right AF log. */ - ReadBurstParams.ulReadAddress += ( pSharedInfo->DebugInfo.usLastAfLogReadPtr * 16 ); - - ulTempIndex = 0; - ulNumReads = ulNumAfEvents * 8; - - while ( ulNumReads != 0 ) - { - if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - ReadBurstParams.ulReadLength = ulNumReads; - - /* Set pointer where to write data. */ - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray[ ulTempIndex ]; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update indexes, temp variables, addresses. */ - ulNumReads -= ReadBurstParams.ulReadLength; - ulTempIndex += ReadBurstParams.ulReadLength; - ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2; - } - } - - /* Copy data byte per byte to avoid endianess problems. */ - for ( ulCopyIndex = 0; ulCopyIndex < 8; ulCopyIndex ++ ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] >> 8 ) & 0xFF ); - } - - ulUserBufWriteIndex += 16; - - /* Increment AF log read ptr. */ - pSharedInfo->DebugInfo.usLastAfLogReadPtr = (UINT16)(( pSharedInfo->DebugInfo.usLastAfLogReadPtr + 1 ) & 0xFFFF ); - } - } - - /* Check if we are done with the AF events. */ - if ( pSharedInfo->DebugInfo.usLastAfLogReadPtr == pSharedInfo->DebugInfo.usAfLogWritePtr ) - { - /* Insert the tone event information. */ - for ( ulToneEventIndex = pSharedInfo->DebugInfo.usLastToneEventIndex; ulToneEventIndex < pSharedInfo->ImageInfo.byNumToneDetectors; ulToneEventIndex++ ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < cOCT6100_TLV_MAX_TONE_NAME_SIZE ) - break; - - Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.aToneInfo[ ulToneEventIndex ].aszToneName, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - - ulUserBufWriteIndex += cOCT6100_TLV_MAX_TONE_NAME_SIZE; - - pSharedInfo->DebugInfo.usLastToneEventIndex++; - } - - /* If all the tone information has been copied. */ - if ( ulToneEventIndex == pSharedInfo->ImageInfo.byNumToneDetectors ) - { - /* Copy the image version. */ - if ( pSharedInfo->DebugInfo.fImageVersionCopied == FALSE ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= 512 ) - { - Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.szVersionNumber, 512 ); - - /* Get PLL jitter count from external memory. */ - if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Create the mask to retrieve the appropriate value. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Mask data. */ - ulTempData &= ulMask; - /* Move to right position. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] = (UINT8)( ( ulTempData >> 8 ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + 511 ] = (UINT8)( ( ulTempData >> 0 ) & 0xFF ); - } - - /* Add "ISR is not called" bit. */ - if ( pSharedInfo->IntrptManage.fIsrCalled == FALSE ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] |= 0x80; - } - - ulUserBufWriteIndex += 512; - - /* The version has been copied. */ - pSharedInfo->DebugInfo.fImageVersionCopied = TRUE; - } - } - - /* If the image version has been copied, proceed with the API version. */ - if ( pSharedInfo->DebugInfo.fImageVersionCopied == TRUE ) - { - if ( pSharedInfo->DebugInfo.fApiVersionCopied == FALSE ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= sizeof(cOCT6100_API_VERSION) ) - { - Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], cOCT6100_API_VERSION, sizeof(cOCT6100_API_VERSION) ); - ulUserBufWriteIndex += sizeof(cOCT6100_API_VERSION); - - /* The API version has been copied. */ - pSharedInfo->DebugInfo.fApiVersionCopied = TRUE; - } - } - } - } - - /* Check if we are done! */ - if ( pSharedInfo->DebugInfo.fApiVersionCopied == TRUE ) - { - /* Done dumping. */ - - /* Reset data being dumpped flag. */ - pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE; - - /* Reset data recording in the chip. */ - WriteBurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - WriteBurstParams.ulWriteLength = 2; - WriteBurstParams.pusWriteData = pSharedInfo->DebugInfo.ausHotChannelData; - - mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - fResetRemainingDataFlag = TRUE; - } - } - } - else /* if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */ - { - fResetRemainingDataFlag = TRUE; - } - } - } - - /* Return number of valid bytes in buffer to user. */ - f_pGetData->ulValidNumBytes = ulUserBufWriteIndex; - - /* Update remaining bytes. */ - pSharedInfo->DebugInfo.ulDebugDataRemainingNumBytes -= ulUserBufWriteIndex; - - /* Return remaining bytes. */ - f_pGetData->ulRemainingNumBytes = pSharedInfo->DebugInfo.ulDebugDataRemainingNumBytes; - - /* Return total number of bytes. */ - f_pGetData->ulTotalNumBytes = pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes; - - /* Check if we are done dump the requested content. */ - if ( fResetRemainingDataFlag == TRUE ) - pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c deleted file mode 100644 index 7fa36d68..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c +++ /dev/null @@ -1,1380 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_events.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to retrieve tone and playout events. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 81 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_events_inst.h" -#include "oct6100api/oct6100_tone_detection_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_tone_detection_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_tone_detection_priv.h" -#include "oct6100_playout_buf_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100EventGetTone - -Description: Retreives an array of tone events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pEventGetTone Pointer to structure used to store the Tone events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100EventGetToneDef -UINT32 Oct6100EventGetToneDef( - tPOCT6100_EVENT_GET_TONE f_pEventGetTone ) -{ - f_pEventGetTone->pToneEvent = NULL; - f_pEventGetTone->ulMaxToneEvent = 1; - f_pEventGetTone->ulNumValidToneEvent = cOCT6100_INVALID_VALUE; - f_pEventGetTone->fMoreEvents = FALSE; - f_pEventGetTone->fResetBufs = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100EventGetTone -UINT32 Oct6100EventGetTone( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_EVENT_GET_TONE f_pEventGetTone ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100EventGetToneSer( f_pApiInstance, f_pEventGetTone ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutGetEvent - -Description: Retrieves an array of playout stop events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufPlayoutGetEvent Pointer to structure used to store the playout events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutGetEventDef -UINT32 Oct6100BufferPlayoutGetEventDef( - tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ) -{ - f_pBufPlayoutGetEvent->pBufferPlayoutEvent = NULL; - f_pBufPlayoutGetEvent->ulMaxEvent = 1; - f_pBufPlayoutGetEvent->ulNumValidEvent = cOCT6100_INVALID_VALUE; - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - f_pBufPlayoutGetEvent->fResetBufs = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100BufferPlayoutGetEvent -UINT32 Oct6100BufferPlayoutGetEvent( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutGetEventSer( f_pApiInstance, f_pBufPlayoutGetEvent ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetEventsSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the tone events and playout events - software buffers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetEventsSwSizes -UINT32 Oct6100ApiGetEventsSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - - { - UINT32 ulTempVar; - - /* Memory needed by soft tone event buffers. */ - - /* Add 1 to the circular buffer such that all user requested events can fit in the circular queue. */ - f_pInstSizes->ulSoftToneEventsBuffer = ( f_pOpenChip->ulSoftToneEventsBufSize + 1 ) * sizeof( tOCT6100_API_TONE_EVENT ); - - /* Round off the sizes of the soft buffers above. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulSoftToneEventsBuffer, ulTempVar ) - } - - { - UINT32 ulTempVar; - - /* Memory needed by soft playout stop event buffers. */ - if ( f_pOpenChip->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) - { - f_pInstSizes->ulSoftBufPlayoutEventsBuffer = ( f_pOpenChip->ulSoftBufferPlayoutEventsBufSize + 1 ) * sizeof( tOCT6100_API_BUFFER_PLAYOUT_EVENT ); - - /* Round off the sizes of the soft buffers above. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulSoftBufPlayoutEventsBuffer, ulTempVar ) - } - else /* if ( f_pInstSizes->ulSoftBufferPlayoutEventsBufSize == cOCT6100_INVALID_VALUE ) */ - { - f_pInstSizes->ulSoftBufPlayoutEventsBuffer = 0; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100EventGetToneSer - -Description: Retreives an array of tone event from the software event buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pEventGetTone Pointer to structure which will contain the retreived - events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100EventGetToneSer -UINT32 Oct6100EventGetToneSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TONE_EVENT pSoftEvent; - UINT32 ulSoftReadPnt; - UINT32 ulSoftWritePnt; - UINT32 ulSoftBufSize; - UINT32 ulNumEventsReturned; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the parameters given by the user. */ - if ( f_pEventGetTone->fResetBufs != TRUE && - f_pEventGetTone->fResetBufs != FALSE ) - return cOCT6100_ERR_EVENTS_GET_TONE_RESET_BUFS; - - /* Check max tones. */ - if ( f_pEventGetTone->ulMaxToneEvent > pSharedInfo->ChipConfig.ulSoftToneEventsBufSize ) - return cOCT6100_ERR_EVENTS_MAX_TONES; - - if ( f_pEventGetTone->fResetBufs == FALSE ) - { - /* Check if the events need to be fetched from the chip buffer. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulToneEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - if ( ulSoftReadPnt == ulSoftWritePnt ) - { - ulResult = Oct6100ApiTransferToneEvents( f_pApiInstance, f_pEventGetTone->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If there are no events in the soft buffer then there are none in the chip */ - /* either, so return the empty case. Else, return the events in the buffer. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulToneEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - ulSoftBufSize = pSharedInfo->SoftBufs.ulToneEventBufferSize; - - if ( ulSoftReadPnt != ulSoftWritePnt ) - { - ulNumEventsReturned = 0; - - while( (ulSoftReadPnt != ulSoftWritePnt) && ( ulNumEventsReturned != f_pEventGetTone->ulMaxToneEvent) ) - { - /* Get a pointer to the first event in the buffer. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += ulSoftReadPnt; - - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulChannelHndl = pSoftEvent->ulChannelHandle; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulUserChanId = pSoftEvent->ulUserChanId; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulTimestamp = pSoftEvent->ulTimestamp; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulEventType = pSoftEvent->ulEventType; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulToneDetected = pSoftEvent->ulToneDetected; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulExtToneDetectionPort = pSoftEvent->ulExtToneDetectionPort; - - /* Update the pointers of the soft buffer. */ - ulSoftReadPnt++; - if ( ulSoftReadPnt == ulSoftBufSize ) - ulSoftReadPnt = 0; - - ulNumEventsReturned++; - } - - pSharedInfo->SoftBufs.ulToneEventBufferReadPtr = ulSoftReadPnt; - - /* Detemine if there are more events pending in the soft buffer. */ - if ( ulSoftReadPnt != ulSoftWritePnt ) - f_pEventGetTone->fMoreEvents = TRUE; - else /* ( ulSoftReadPnt == ulSoftWritePnt ) */ - { - f_pEventGetTone->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - } - - f_pEventGetTone->ulNumValidToneEvent = ulNumEventsReturned; - } - else - { - /* No valid tone.*/ - f_pEventGetTone->ulNumValidToneEvent = 0; - f_pEventGetTone->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - - return cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY; - } - } - else /* ( f_pEventGetTone->fResetBufs == TRUE ) */ - { - /* Empty the hardware buffer. */ - ulResult = Oct6100ApiTransferToneEvents( f_pApiInstance, f_pEventGetTone->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the buffers are to be reset then update the pointers and full flag. */ - pSharedInfo->SoftBufs.ulToneEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - f_pEventGetTone->fMoreEvents = FALSE; - f_pEventGetTone->ulNumValidToneEvent = 0; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTransferToneEvents - -Description: Transfers all tone events from the PGSP event out chip buffer - to the soft buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulResetBuf Reset flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTransferToneEvents -UINT32 Oct6100ApiTransferToneEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TONE_EVENT pSoftEvent; - tPOCT6100_API_CHANNEL pEchoChannel; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS BurstParams; - UINT32 ulChipBufFill; - UINT32 ulChipWritePtr = 0; - UINT32 ulChipReadPtr = 0; - - UINT32 usChannelIndex; - UINT32 ulBaseTimestamp; - UINT32 ulToneCnt; - UINT32 ulNumWordsToRead; - UINT32 ulEventCode; - - UINT32 ulResult; - UINT32 i, j; - UINT16 usReadData; - UINT16 ausReadData[ cOCT6100_NUM_WORDS_PER_TONE_EVENT ]; - - UINT32 ulExtToneDetectionPort; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* If the buffer is to be reset then clear the overflow flag. */ - if ( f_ulResetBuf == TRUE ) - { - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt = 0; - } - - /* Set some parameters of read struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Get the current read pointer of the chip buffer. */ - ReadParams.ulReadAddress = cOCT6100_TONE_EVENT_READ_PTR_REG; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulChipReadPtr = usReadData; - - /* Now get the current write pointer. */ - ReadParams.ulReadAddress = cOCT6100_TONE_EVENT_WRITE_PTR_REG; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulChipWritePtr = usReadData; - - ulChipBufFill = (( ulChipWritePtr - ulChipReadPtr ) & ( cOCT6100_NUM_PGSP_EVENT_OUT - 1 )); - - /* Set some parameters of write structs. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Read in the tone event one at a time. */ - for ( i = 0; i < ulChipBufFill; i++ ) - { - /* Skip the event processing if the buffer is to be reset. */ - if ( f_ulResetBuf == TRUE ) - { - /* Update the control variables of the buffer. */ - ulChipReadPtr++; - if ( cOCT6100_NUM_PGSP_EVENT_OUT == ulChipReadPtr ) - ulChipReadPtr = 0; - } - else - { - /* Read in the event only if there's enough room in the soft buffer, and */ - /* the chip buffer is NOT to be reset. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - BurstParams.ulReadAddress = cOCT6100_PGSP_EVENT_OUT_BASE + ( ulChipReadPtr * cOCT6100_PGSP_TONE_EVENT_SIZE ); - BurstParams.pusReadData = ausReadData; - - ulNumWordsToRead = cOCT6100_PGSP_TONE_EVENT_SIZE / 2; - - while ( ulNumWordsToRead > 0 ) - { - if ( ulNumWordsToRead > pSharedInfo->ChipConfig.usMaxRwAccesses ) - { - BurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - } - else - { - BurstParams.ulReadLength = ulNumWordsToRead; - } - - mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.pusReadData += BurstParams.ulReadLength; - BurstParams.ulReadAddress += BurstParams.ulReadLength * 2; - - ulNumWordsToRead -= BurstParams.ulReadLength; - } - - /* Verify if the event is valid. */ - if ( ( ausReadData[ 0 ] & cOCT6100_VALID_TONE_EVENT ) == 0x0 ) - return cOCT6100_ERR_FATAL_2D; - - /* First extract the channel number of the tone event. */ - usChannelIndex = ausReadData[ 1 ] & 0x3FF; - - /* Now the timestamp. */ - ulBaseTimestamp = ausReadData[ 2 ] << 16; - ulBaseTimestamp |= ausReadData[ 3 ]; - - /* This timestamp is 256 in adwance, must remove 256 frames. */ - ulBaseTimestamp -= 256; - - /* Fetch the channel stucture to validate which event can be reported. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, usChannelIndex ); - - if ( pEchoChannel->fReserved != TRUE ) - { - /* Update the control variables of the buffer. */ - ulChipReadPtr++; - if ( ulChipReadPtr == cOCT6100_NUM_PGSP_EVENT_OUT ) - ulChipReadPtr = 0; - - /* This channel has been closed since the generation of the event. */ - continue; - } - - /* Extract the extended tone detection port if available. */ - if ( pEchoChannel->ulExtToneChanMode == cOCT6100_API_EXT_TONE_SIN_PORT_MODE ) - { - ulExtToneDetectionPort = cOCT6100_CHANNEL_PORT_SIN; - } - else if ( pEchoChannel->ulExtToneChanMode == cOCT6100_API_EXT_TONE_RIN_PORT_MODE ) - { - ulExtToneDetectionPort = cOCT6100_CHANNEL_PORT_RIN; - - /* Modify the channel index. */ - usChannelIndex = pEchoChannel->usExtToneChanIndex; - - /* Change the channel entry to the original one for statistical purposes. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, usChannelIndex ); - - } - else /* pEchoChannel->ulExtToneChanMode == cOCT6100_API_EXT_TONE_DISABLED */ - { - ulExtToneDetectionPort = cOCT6100_INVALID_VALUE; - } - - ulToneCnt = 0; - /* Verify all the possible events that might have been detected. */ - for ( j = 4; j < cOCT6100_NUM_WORDS_PER_TONE_EVENT; j++ ) - { - ulEventCode = ( ausReadData[ j ] >> 8 ) & 0x7; - - if ( ulEventCode != 0x0 ) - { - /* This tone generated an event, now check if event is masked for the channel. */ - if ((( pEchoChannel->aulToneConf[ ulToneCnt / 32 ] >> ( 31 - ( ulToneCnt % 32 ))) & 0x1) == 1 ) - { - BOOL f2100Tone; - - /* Check if it is a 2100 Tone STOP and if the user wants receive those events*/ - ulResult = Oct6100ApiIs2100Tone(f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &f2100Tone); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (f2100Tone == FALSE) || - ( (f2100Tone == TRUE) && (ulEventCode != 2) ) || - ( (f2100Tone == TRUE) && pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) - { - - /* If enough space. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - /* The tone event is not masked, The API can create a soft tone event. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - /* Decode the event type. */ - switch( ulEventCode ) - { - case 1: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - case 2: - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - break; - case 3: - /* This one is a little tricky. We first */ - /* generate the "PRESENT" event and then generate the "STOP" event. */ - - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } - - break; - case 4: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - default: - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; - /* do not process this packet*/ - continue; - } - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - } - } - } - else - { - BOOL fSSTone; - - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Check if this is a "PRESENT" or "STOP" event */ - switch( ulEventCode ) - { - case 1: - /* This is a signaling system present event. Keep this in the instance memory. */ - pEchoChannel->ulLastSSToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pEchoChannel->ulLastSSToneTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - break; - case 2: - /* This is the "STOP" event, invalidate the last value. The user does not want to know about this. */ - pEchoChannel->ulLastSSToneDetected = cOCT6100_INVALID_VALUE; - pEchoChannel->ulLastSSToneTimestamp = cOCT6100_INVALID_VALUE; - break; - default: - break; - } - } - } - } - ulToneCnt++; - - /* Check the other tone of this word. */ - ulEventCode = ausReadData[ j ] & 0x7; - - if ( ulEventCode != 0x0 ) - { - if ((( pEchoChannel->aulToneConf[ ulToneCnt / 32 ] >> ( 31 - ( ulToneCnt % 32 ))) & 0x1) == 1 ) - { - BOOL f2100Tone; - - /* Check if it is a 2100 Tone STOP and if the user wants receive those events*/ - ulResult = Oct6100ApiIs2100Tone(f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &f2100Tone); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (f2100Tone == FALSE) || - ( (f2100Tone == TRUE) && (ulEventCode != 2) ) || - ( (f2100Tone == TRUE) && pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) - { - - /* If enough space. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - /* The tone event is not masked, The API can create a soft tone event. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - /* Decode the event type. */ - switch( ulEventCode ) - { - case 1: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - case 2: - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - break; - case 3: - /* This one is a little tricky. We first */ - /* generate the "PRESENT" event and then generate the "STOP" event. */ - - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } - - break; - case 4: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - default: - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; - /* Do not process this packet. */ - continue; - } - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - } - } - } - else - { - BOOL fSSTone; - - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Check if this is a "PRESENT" event. */ - switch ( ulEventCode ) - { - case 1: - /* This is a signaling system present event. Keep this in the instance memory. */ - pEchoChannel->ulLastSSToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pEchoChannel->ulLastSSToneTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - break; - case 2: - /* This is the "STOP" event, invalidate the last value. The user does not want to know about this. */ - pEchoChannel->ulLastSSToneDetected = cOCT6100_INVALID_VALUE; - pEchoChannel->ulLastSSToneTimestamp = cOCT6100_INVALID_VALUE; - break; - default: - break; - } - } - } - } - ulToneCnt++; - } - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - } - - /* Update the control variables of the buffer. */ - ulChipReadPtr++; - if ( ulChipReadPtr == cOCT6100_NUM_PGSP_EVENT_OUT ) - ulChipReadPtr = 0; - } - } - - /* Write the value of the new Read pointer.*/ - WriteParams.ulWriteAddress = cOCT6100_TONE_EVENT_READ_PTR_REG; - WriteParams.usWriteData = (UINT16)( ulChipReadPtr ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - return cOCT6100_ERR_OK; -} -#endif - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutGetEventSer - -Description: Retreives an array of buffer playout event from the software - event buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pEventGetPlayoutStop Pointer to structure which will contain the retreived - events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutGetEventSer -UINT32 Oct6100BufferPlayoutGetEventSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_EVENT pSoftEvent; - UINT32 ulSoftReadPnt; - UINT32 ulSoftWritePnt; - UINT32 ulSoftBufSize; - UINT32 ulNumEventsReturned; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the parameters past by the user. */ - if ( f_pBufPlayoutGetEvent->fResetBufs != TRUE && - f_pBufPlayoutGetEvent->fResetBufs != FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_RESET; - - /* Check if software buffer has been allocated and thus enabled. */ - if ( pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_DISABLED; - - /* Checking max playout events. */ - if ( f_pBufPlayoutGetEvent->ulMaxEvent > pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize ) - return cOCT6100_ERR_BUFFER_PLAYOUT_MAX_EVENT; - - if ( f_pBufPlayoutGetEvent->fResetBufs == FALSE ) - { - /* Check if events need to be fetched from the chip. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr; - - if ( ulSoftReadPnt == ulSoftWritePnt ) - { - ulResult = Oct6100BufferPlayoutTransferEvents( f_pApiInstance, f_pBufPlayoutGetEvent->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If there are no events in the soft buffer then there are none in the chip */ - /* either, so return the empty case. Else, return the events in the buffer. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr; - ulSoftBufSize = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize; - - if ( ulSoftReadPnt != ulSoftWritePnt ) - { - ulNumEventsReturned = 0; - - while( (ulSoftReadPnt != ulSoftWritePnt) && ( ulNumEventsReturned != f_pBufPlayoutGetEvent->ulMaxEvent) ) - { - /* Get a pointer to the first event in the buffer. */ - mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += ulSoftReadPnt; - - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulChannelHndl = pSoftEvent->ulChannelHandle; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulUserChanId = pSoftEvent->ulUserChanId; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulChannelPort = pSoftEvent->ulChannelPort; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulUserEventId = pSoftEvent->ulUserEventId; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulEventType = pSoftEvent->ulEventType; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulTimestamp = pSoftEvent->ulTimestamp; - - /* Update the pointers of the soft buffer. */ - ulSoftReadPnt++; - if ( ulSoftReadPnt == ulSoftBufSize ) - ulSoftReadPnt = 0; - - ulNumEventsReturned++; - } - - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr = ulSoftReadPnt; - - /* Detemine if there are more events pending in the soft buffer. */ - if ( ulSoftReadPnt != ulSoftWritePnt ) - f_pBufPlayoutGetEvent->fMoreEvents = TRUE; - else /* ( ulSoftReadPnt == ulSoftWritePnt ) */ - { - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - } - - f_pBufPlayoutGetEvent->ulNumValidEvent = ulNumEventsReturned; - } - else /* if ( ulSoftReadPnt == ulSoftWritePnt ) */ - { - /* No valid buffer playout events. */ - f_pBufPlayoutGetEvent->ulNumValidEvent = 0; - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_BUF_EMPTY; - } - } - else /* ( f_pEventGetPlayoutStop->fResetBufs == TRUE ) */ - { - /* Check with the hardware first. */ - ulResult = Oct6100BufferPlayoutTransferEvents( f_pApiInstance, f_pBufPlayoutGetEvent->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the buffers are to be reset, then update the pointers and full flag. */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr = 0; - - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - f_pBufPlayoutGetEvent->ulNumValidEvent = 0; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutTransferEvents - -Description: Check all channels that are currently playing a buffer and - generate an event if a buffer has stopped playing. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulResetBuf Reset flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutTransferEvents -UINT32 Oct6100BufferPlayoutTransferEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pEchoChannel; - - UINT32 ulChannelIndex; - UINT32 ulResult; - UINT32 ulLastBufPlayoutEventBufferOverflowCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* If the buffer is to be reset then clear the overflow flag. */ - if ( f_ulResetBuf == TRUE ) - { - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt = 0; - /* We are done for now. */ - /* No need to check for new events since the user requested to empty the soft buffer. */ - return cOCT6100_ERR_OK; - } - - /* Check if buffer playout has been activated on some ports. */ - if ( pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts == 0 ) - { - /* Buffer playout has not been activated on any channel, */ - /* let's not waste time here. */ - return cOCT6100_ERR_OK; - } - - /* Save the current overflow count. We want to know if an overflow occured to get out of the loop. */ - ulLastBufPlayoutEventBufferOverflowCnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt; - - /* Search through the list of API channel entry for the ones that need playout event checking. */ - for ( ulChannelIndex = 0; ulChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; ulChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, ulChannelIndex ); - - /* Check if buffer playout is active on this channel, using the optimization flag. */ - /* This flag is redundant of other flags used for playout, but will make the above loop */ - /* much faster. This is needed since this function is called very frequently on systems */ - /* which use buffer playout stop events. */ - if ( pEchoChannel->fBufPlayoutActive == TRUE ) - { - /* Read in the event only if there's enough room in the soft buffer. */ - if ( ulLastBufPlayoutEventBufferOverflowCnt == pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) - { - /* Check Rout buffer playout first. */ - if ( ( pEchoChannel->fRinBufPlayoutNotifyOnStop == TRUE ) - && ( pEchoChannel->fRinBufPlaying == TRUE ) ) - { - ulResult = Oct6100BufferPlayoutCheckForSpecificEvent( f_pApiInstance, ulChannelIndex, cOCT6100_CHANNEL_PORT_ROUT, TRUE, NULL ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ulLastBufPlayoutEventBufferOverflowCnt != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) */ - { - /* Get out of the loop, no more events can be inserted in the soft buffer. */ - break; - } - - /* An overflow might have been detected in the lower level function. */ - /* Check the overflow count once again to make sure there might be room for a next event. */ - if ( ulLastBufPlayoutEventBufferOverflowCnt == pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) - { - /* Check Sout buffer playout. */ - if ( ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == TRUE ) - && ( pEchoChannel->fSoutBufPlaying == TRUE ) ) - { - ulResult = Oct6100BufferPlayoutCheckForSpecificEvent( f_pApiInstance, ulChannelIndex, cOCT6100_CHANNEL_PORT_SOUT, TRUE, NULL ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ulLastBufPlayoutEventBufferOverflowCnt != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) */ - { - /* Get out of the loop, no more events can be inserted in the soft buffer. */ - break; - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutCheckForSpecificEvent - -Description: Check a specific channel/port for playout buffer events. - If asked to, save this event to the software event buffer. - Return a flag specifying whether the event was detected or not. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel to be checked. -f_ulChannelPort Port of the channel to be checked. -f_fSaveToSoftBuffer Save event to software buffer. -f_pfEventDetected Whether or not an event was detected. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutCheckForSpecificEvent -UINT32 Oct6100BufferPlayoutCheckForSpecificEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulChannelPort, - IN BOOL f_fSaveToSoftBuffer, - OUT PBOOL f_pfEventDetected ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_EVENT pSoftEvent; - tPOCT6100_API_CHANNEL pEchoChannel; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_GET_TIME GetTimeParms; - - UINT32 ulResult; - UINT16 usReadData; - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulWritePtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulWritePtrFieldSize; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulTempData; - UINT32 ulReadPtr; - UINT32 ulMask; - UINT32 ulWritePtr; - UINT32 ulUserEventId; - UINT32 ulEventType; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Compare the read and write pointers for matching. If they matched, playout stopped. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_ulChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - if ( f_ulChannelPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check on the Rout port. */ - ulUserEventId = pEchoChannel->ulRinUserBufPlayoutEventId; - ulEventType = pEchoChannel->byRinPlayoutStopEventType; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* if ( f_ulChannelPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - /* Check on the Sout port. */ - ulUserEventId = pEchoChannel->ulSoutUserBufPlayoutEventId; - ulEventType = pEchoChannel->bySoutPlayoutStopEventType; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - /* Retrieve the current write pointer. */ - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulPlayoutBaseAddress + ulWritePtrBytesOfst, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer.*/ - ulWritePtr = ( ulTempData & ulMask ) >> ulWritePtrBitOfst; - - /* Read the read pointer.*/ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( ulReadPtr != ulWritePtr ) - { - /* Still playing -- do not generate an event. */ - if ( f_pfEventDetected != NULL ) - *f_pfEventDetected = FALSE; - } - else - { - /* Buffer stopped playing, generate an event here, if asked. */ - if ( ( f_fSaveToSoftBuffer == TRUE ) - && ( ( pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr ) - && ( ( pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize || pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr != 0 ) ) - { - /* The API can create a soft buffer playout event. */ - mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr; - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_ulChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulUserEventId = ulUserEventId; - pSoftEvent->ulChannelPort = f_ulChannelPort; - /* For now, only this type of event is available. */ - pSoftEvent->ulEventType = ulEventType; - - /* Generate millisecond timestamp. */ - GetTimeParms.pProcessContext = f_pApiInstance->pProcessContext; - ulResult = Oct6100UserGetTime( &GetTimeParms ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pSoftEvent->ulTimestamp = ( GetTimeParms.aulWallTimeUs[ 0 ] / 1000 ); - pSoftEvent->ulTimestamp += ( GetTimeParms.aulWallTimeUs[ 1 ] ) * ( 0xFFFFFFFF / 1000 ); - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr == pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize ) - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some playout events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = TRUE; - } - else if ( f_fSaveToSoftBuffer == TRUE ) - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt++; - } - - /* Update the channel entry to set the playing flag to FALSE. */ - - /* Select the port of interest. */ - if ( f_ulChannelPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Decrement the number of active buffer playout ports. */ - /* No need to check anything here, it's been done in the calling function. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - - pEchoChannel->fRinBufPlaying = FALSE; - pEchoChannel->fRinBufPlayoutNotifyOnStop = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fSoutBufPlaying == FALSE ) - && ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - else /* f_ulChannelPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Decrement the number of active buffer playout ports. */ - /* No need to check anything here, it's been done in the calling function. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - - pEchoChannel->fSoutBufPlaying = FALSE; - pEchoChannel->fSoutBufPlayoutNotifyOnStop = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fRinBufPlaying == FALSE ) - && ( pEchoChannel->fRinBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - - /* Return that an event was detected. */ - if ( f_pfEventDetected != NULL ) - *f_pfEventDetected = TRUE; - } - - return cOCT6100_ERR_OK; -} -#endif - - diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c deleted file mode 100644 index 1a7ebc6c..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c +++ /dev/null @@ -1,2011 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_interrupts.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the API's interrupt service routine and all of its - sub-functions. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 81 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_interrupts_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_interrupts_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptConfigure - -Description: Configure the operation of all possible interrupt sources. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to interrupt configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptConfigureDef -UINT32 Oct6100InterruptConfigureDef( - tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ) -{ - f_pIntrptConfig->ulFatalGeneralConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pIntrptConfig->ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - - f_pIntrptConfig->ulErrorMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pIntrptConfig->ulErrorOverflowToneEventsConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pIntrptConfig->ulErrorH100Config = cOCT6100_INTERRUPT_NO_TIMEOUT; - - f_pIntrptConfig->ulFatalMemoryTimeout = 100; - - f_pIntrptConfig->ulErrorMemoryTimeout = 100; - f_pIntrptConfig->ulErrorOverflowToneEventsTimeout = 100; - f_pIntrptConfig->ulErrorH100Timeout = 100; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100InterruptConfigure -UINT32 Oct6100InterruptConfigure( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulResult; - UINT32 ulFncRes; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Create serialization object for ISR. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulResult = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Call serialized sub-function. */ - ulFncRes = Oct6100InterruptConfigureSer( f_pApiInstance, f_pIntrptConfig, TRUE ); - /* Release serialization object. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulResult = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if an error occured in sub-function. */ - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptServiceRoutine - -Description: The API's interrupt service routine. This function clears all - register ROLs which have generated an interrupt and report the - events in the user supplied structure. Also, the tone event - and/or playout event buffer will be emptied if valid events - are present. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to structure containing event flags returned - to user. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptServiceRoutineDef -UINT32 Oct6100InterruptServiceRoutineDef( - tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - f_pIntFlags->fFatalGeneral = FALSE; - f_pIntFlags->ulFatalGeneralFlags = 0x0; - f_pIntFlags->fFatalReadTimeout = FALSE; - - f_pIntFlags->fErrorRefreshTooLate = FALSE; - f_pIntFlags->fErrorPllJitter = FALSE; - - f_pIntFlags->fErrorOverflowToneEvents = FALSE; - - f_pIntFlags->fErrorH100OutOfSync = FALSE; - f_pIntFlags->fErrorH100ClkA = FALSE; - f_pIntFlags->fErrorH100ClkB = FALSE; - f_pIntFlags->fErrorH100FrameA = FALSE; - - f_pIntFlags->fToneEventsPending = FALSE; - f_pIntFlags->fBufferPlayoutEventsPending = FALSE; - - f_pIntFlags->fApiSynch = FALSE; - - - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100InterruptServiceRoutine -UINT32 Oct6100InterruptServiceRoutine( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulResult; - UINT32 ulFncRes; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize the serialization object for the ISR. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulResult = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Call the serialized sub-function. */ - ulFncRes = Oct6100InterruptServiceRoutineSer( f_pApiInstance, f_pIntFlags ); - } - else - { - return ulResult; - } - - /* Release the serialization object. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulResult = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check for an error in the sub-function. */ - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsrSwInit - -Description: Initializes portions of API instance associated to the API's - interrupt service routine. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIsrSwInit -UINT32 Oct6100ApiIsrSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the state of each interrupt group to disabled. The state will */ - /* be updated to the true configuration once the configure interrupts function is called. */ - pSharedInfo->IntrptManage.byFatalGeneralState = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byFatalMemoryState = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byErrorMemoryState = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byErrorH100State = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byErrorOverflowToneEventsState = cOCT6100_INTRPT_DISABLED; - - /* Indicate that the mclk interrupt is not active at the moment. */ - pSharedInfo->IntrptManage.fMclkIntrptActive = FALSE; - - /* Indicate that no buffer playout events are pending for the moment. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - - /* Indicate that no tone events are pending for the moment. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - - /* The ISR has never been called. */ - pSharedInfo->IntrptManage.fIsrCalled = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsrHwInit - -Description: Initializes the chip's interrupt registers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to structure defining how the interrupts - should be configured. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIsrHwInit -UINT32 Oct6100ApiIsrHwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - /* Enable all the interrupts */ - - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0001; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x1C05; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0xFFFF; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x504; - WriteParams.usWriteData = 0x0002; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0007; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==================================================================================*/ - - /* Calculate the number of mclk cycles in 1 ms. */ - f_pApiInstance->pSharedInfo->IntrptManage.ulNumMclkCyclesIn1Ms = f_pApiInstance->pSharedInfo->MiscVars.ulMclkFreq / 1000; - - /* Configure the interrupt registers as requested by the user. */ - ulResult = Oct6100InterruptConfigureSer( f_pApiInstance, f_pIntrptConfig, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptConfigureSer - -Description: Configure the operation of interrupt groups. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to interrupt configuration structure. -f_fCheckParams Check parameter enable flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptConfigureSer -UINT32 Oct6100InterruptConfigureSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig, - IN BOOL f_fCheckParams ) -{ - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - UINT32 ulResult; - - /* Check for errors. */ - if ( f_fCheckParams == TRUE ) - { - if ( f_pIntrptConfig->ulFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulFatalGeneralConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_FATAL_GENERAL_CONFIG; - if ( f_pIntrptConfig->ulFatalMemoryConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulFatalMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulFatalMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_FATAL_MEMORY_CONFIG; - if ( f_pIntrptConfig->ulErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulErrorMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulErrorMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_CONFIG; - if ( f_pIntrptConfig->ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_CONFIG; - if ( f_pIntrptConfig->ulErrorH100Config != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulErrorH100Config != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulErrorH100Config != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_H100_ERROR_CONFIG; - - if ( f_pIntrptConfig->ulFatalMemoryTimeout < 10 || - f_pIntrptConfig->ulFatalMemoryTimeout > 10000 ) - return cOCT6100_ERR_INTRPTS_FATAL_MEMORY_TIMEOUT; - if ( f_pIntrptConfig->ulErrorMemoryTimeout < 10 || - f_pIntrptConfig->ulErrorMemoryTimeout > 10000 ) - return cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_TIMEOUT; - if ( f_pIntrptConfig->ulErrorOverflowToneEventsTimeout < 10 || - f_pIntrptConfig->ulErrorOverflowToneEventsTimeout > 10000 ) - return cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_TIMEOUT; - if ( f_pIntrptConfig->ulErrorH100Timeout < 10 || - f_pIntrptConfig->ulErrorH100Timeout > 10000 ) - return cOCT6100_ERR_INTRPTS_H100_ERROR_TIMEOUT; - } - - /* Copy the configuration to the API instance. */ - pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - pIntrptConfig->byFatalGeneralConfig = (UINT8)( f_pIntrptConfig->ulFatalGeneralConfig & 0xFF ); - pIntrptConfig->byFatalMemoryConfig = (UINT8)( f_pIntrptConfig->ulFatalMemoryConfig & 0xFF ); - pIntrptConfig->byErrorMemoryConfig = (UINT8)( f_pIntrptConfig->ulErrorMemoryConfig & 0xFF ); - pIntrptConfig->byErrorOverflowToneEventsConfig = (UINT8)( f_pIntrptConfig->ulErrorOverflowToneEventsConfig & 0xFF ); - pIntrptConfig->byErrorH100Config = (UINT8)( f_pIntrptConfig->ulErrorH100Config & 0xFF ); - - f_pIntrptConfig->ulFatalMemoryTimeout = ((f_pIntrptConfig->ulFatalMemoryTimeout + 9) / 10) * 10; - pIntrptConfig->ulFatalMemoryTimeoutMclk = f_pIntrptConfig->ulFatalMemoryTimeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - f_pIntrptConfig->ulErrorMemoryTimeout = ((f_pIntrptConfig->ulErrorMemoryTimeout + 9) / 10) * 10; - pIntrptConfig->ulErrorMemoryTimeoutMclk = f_pIntrptConfig->ulErrorMemoryTimeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - f_pIntrptConfig->ulErrorOverflowToneEventsTimeout = ((f_pIntrptConfig->ulErrorOverflowToneEventsTimeout + 9) / 10) * 10; - pIntrptConfig->ulErrorOverflowToneEventsTimeoutMclk = f_pIntrptConfig->ulErrorOverflowToneEventsTimeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - f_pIntrptConfig->ulErrorH100Timeout = ((f_pIntrptConfig->ulErrorH100Timeout + 9) / 10) * 10; - pIntrptConfig->ulErrorH100TimeoutMclk = f_pIntrptConfig->ulErrorH100Timeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - - /*Clear all interrupts that were already enabled*/ - ulResult = Oct6100ApiClearEnabledInterrupts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Before writing the new configuration to the chip's registers, make sure that any */ - /* interrupts which are either disabled or have no timeout period are not on the */ - /* disabled interrupt list. */ - - /*==================================================================================*/ - if ( pIntrptConfig->byFatalGeneralConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byFatalGeneralState = cOCT6100_INTRPT_DISABLED; - else /* pIntrptConfig->byFatalGeneralConfig == cOCT6100_INTERRUPT_NO_TIMEOUT */ - pIntrptManage->byFatalGeneralState = cOCT6100_INTRPT_ACTIVE; - - /*==================================================================================*/ - if ( pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_ACTIVE; - else /* ( pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_ACTIVE; - } - - /*==================================================================================*/ - if ( pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_ACTIVE; - else /* (pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_ACTIVE; - } - - /*==================================================================================*/ - if ( pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_ACTIVE; - else /* (pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_ACTIVE; - } - - /*==================================================================================*/ - if ( pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_ACTIVE; - else /* (pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_ACTIVE; - } - - - /* Write to the interrupt registers to update the state of each interrupt group. */ - ulResult = Oct6100ApiWriteIeRegs( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearEnabledInterrupts - -Description: Disabled interruption are not reported but still available. This - function will clear the interrupts that were disabled and wish - to enable now. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to interrupt configuration structure. -f_pIntrptManage Pointer to interrupt manager structure. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#if !SKIP_Oct6100ApiClearEnabledInterrupts -UINT32 Oct6100ApiClearEnabledInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy the configuration to the API instance. */ - pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - if ( pIntrptConfig->byFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byFatalGeneralState != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x102; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_102H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = 0x1800; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_502H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pIntrptConfig->byErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_202H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pIntrptConfig->byErrorH100Config != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byErrorH100State != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x302; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_302H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pIntrptConfig->byErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x702; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_702H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - return cOCT6100_ERR_OK; - -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptServiceRoutineSer - -Description: Serialized sub-function of API's interrupt service routine. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to structure containing event flags returned - to user. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptServiceRoutineSer -UINT32 Oct6100InterruptServiceRoutineSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulRegister210h; - UINT32 ulResult; - UINT16 usReadData; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Must update the statistics. Set parameters in read and write structs. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set all the flags to default values to make sure the variables are initialized. */ - f_pIntFlags->fFatalGeneral = FALSE; - f_pIntFlags->ulFatalGeneralFlags = 0x0; - f_pIntFlags->fFatalReadTimeout = FALSE; - - f_pIntFlags->fErrorRefreshTooLate = FALSE; - f_pIntFlags->fErrorPllJitter = FALSE; - - f_pIntFlags->fErrorH100OutOfSync = FALSE; - f_pIntFlags->fErrorH100ClkA = FALSE; - f_pIntFlags->fErrorH100ClkB = FALSE; - f_pIntFlags->fErrorH100FrameA = FALSE; - f_pIntFlags->fApiSynch = FALSE; - - f_pIntFlags->fErrorOverflowToneEvents = FALSE; - - /* Start by reading registers 210h to determine if any modules have flagged an interrupt. */ - ReadParams.ulReadAddress = 0x210; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - ulRegister210h = usReadData; - - /* Update the extended mclk counter. */ - ulResult = Oct6100ApiReadChipMclkTime( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the mclk interrupt is active then check which interrupt timeout periods have expired. */ - ReadParams.ulReadAddress = 0x302; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - if ( (usReadData & 0x1) != 0 && pSharedInfo->IntrptManage.fMclkIntrptActive == TRUE ) - { - /* Update timeout periods. */ - ulResult = Oct6100ApiUpdateIntrptTimeouts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pIntFlags->fApiSynch = TRUE; - - /* Read registers 210h and 212h again to determine if any modules have flagged an interrupt. */ - ReadParams.ulReadAddress = 0x210; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - ulRegister210h = usReadData; - } - - /* Read the interrupt registers to determine what interrupt conditions have occured. */ - ulResult = Oct6100ApiReadIntrptRegs( f_pApiInstance, f_pIntFlags, ulRegister210h ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Empty the tone buffer if any events are pending. */ - ulResult = Oct6100ApiTransferToneEvents( f_pApiInstance, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the tone events pending flag. */ - f_pIntFlags->fToneEventsPending = pSharedInfo->IntrptManage.fToneEventsPending; - - /* Check for buffer playout events and insert in the software queue -- if activated. */ - if ( pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize != 0 ) - { - ulResult = Oct6100BufferPlayoutTransferEvents( f_pApiInstance, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the buffer playout events pending flag. */ - f_pIntFlags->fBufferPlayoutEventsPending = pSharedInfo->IntrptManage.fBufferPlayoutEventsPending; - } - else - { - f_pIntFlags->fBufferPlayoutEventsPending = FALSE; - } - - /* Update the states of each interrupt group. */ - ulResult = Oct6100ApiUpdateIntrptStates( f_pApiInstance, f_pIntFlags ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check the state of the NLP timestamp if required.*/ - ulResult = Oct6100ApiCheckProcessorState( f_pApiInstance, f_pIntFlags ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to the necessary IE registers. */ - ulResult = Oct6100ApiWriteIntrptRegs( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Schedule the next mclk interrupt, if one is needed. */ - ulResult = Oct6100ApiScheduleNextMclkIntrptSer( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Free the interrupt pin of the chip (i.e. remove minimum time requirement between interrupts). */ - WriteParams.ulWriteAddress = 0x214; - WriteParams.usWriteData = 0x0000; - if ( pSharedInfo->ChipConfig.byInterruptPolarity == cOCT6100_ACTIVE_HIGH_POLARITY ) - WriteParams.usWriteData |= 0x4000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Indicate that the interrupt ROLs have been treated. */ - WriteParams.ulWriteAddress = 0x212; - WriteParams.usWriteData = 0x8000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadIntrptRegs - -Description: Reads the interrupt registers of all modules currently - indicating an interrupt condition. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to an interrupt flag structure. -f_ulRegister210h Value of register 0x210. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReadIntrptRegs -UINT32 Oct6100ApiReadIntrptRegs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags, - IN UINT32 f_ulRegister210h ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_ERROR_STATS pErrorStats; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT16 usReadData; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulTempData; - UINT32 ulCounterValue; - UINT32 ulMask; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - pErrorStats = &pSharedInfo->ErrorStats; - pIntrptManage = &pSharedInfo->IntrptManage; - - /* Set some parameters of read struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - - - /* CPU registers. */ - if ( (f_ulRegister210h & 0x00001) != 0 ) - { - /*=======================================================================*/ - /* Read registers of this module. */ - ReadParams.ulReadAddress = 0x102; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupt(s) were set. */ - if ( (usReadData & 0x0001) != 0 ) - { - f_pIntFlags->fFatalReadTimeout = TRUE; - pErrorStats->ulInternalReadTimeoutCnt++; - } - - pIntrptManage->usRegister102h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister102h = 0x0; - } - - /* MAIN registers. */ - if ( (f_ulRegister210h & 0x00002) != 0 ) - { - /*=======================================================================*/ - /* Read registers of this module. */ - ReadParams.ulReadAddress = 0x202; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save current value in instance. */ - pIntrptManage->usRegister202h = usReadData; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0001) != 0 ) - { - f_pIntFlags->fErrorRefreshTooLate = TRUE; - pErrorStats->ulSdramRefreshTooLateCnt++; - } - if ( (usReadData & 0x0800) != 0 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_1; - f_pIntFlags->fFatalGeneral = TRUE; - pErrorStats->fFatalChipError = TRUE; - } - if ( (usReadData & 0x1000) != 0 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_2; - f_pIntFlags->fFatalGeneral = TRUE; - pErrorStats->fFatalChipError = TRUE; - } - if ( (usReadData & 0x0400) != 0 ) - { - f_pIntFlags->fErrorPllJitter = TRUE; - pErrorStats->ulPllJitterErrorCnt++; - - /* Update the PLL jitter error count here. */ - if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Read previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Update counter. */ - ulCounterValue = ulTempData & ulMask; - ulCounterValue = ulCounterValue >> ulFeatureBitOffset; - ulCounterValue ++; - /* Handle wrap around case. */ - ulCounterValue &= ( 1 << ulFeatureFieldLength ) - 1; - - /* Clear old counter value. */ - ulTempData &= (~ulMask); - ulTempData |= ulCounterValue << ulFeatureBitOffset; - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister202h = 0x0; - } - - /* H.100 registers. */ - if ( (f_ulRegister210h & 0x00004) != 0 ) - { - /*=======================================================================*/ - /* Read registers of this module. */ - ReadParams.ulReadAddress = 0x302; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0100) != 0 ) - { - f_pIntFlags->fErrorH100OutOfSync = TRUE; - pErrorStats->ulH100OutOfSyncCnt++; - } - if ( (usReadData & 0x1000) != 0 ) - { - f_pIntFlags->fErrorH100FrameA = TRUE; - pErrorStats->ulH100FrameABadCnt++; - } - if ( (usReadData & 0x4000) != 0 ) - { - f_pIntFlags->fErrorH100ClkA = TRUE; - pErrorStats->ulH100ClkABadCnt++; - } - if ( (usReadData & 0x8000) != 0 ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - { - f_pIntFlags->fErrorH100ClkB = TRUE; - pErrorStats->ulH100ClkBBadCnt++; - } - } - - pIntrptManage->usRegister302h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister302h = 0x0; - } - - /* TDMIE registers. */ - if ( (f_ulRegister210h & 0x00010) != 0 ) - { - /*=======================================================================*/ - /* Read register. */ - ReadParams.ulReadAddress = 0x502; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0002) != 0 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_3; - f_pIntFlags->fFatalGeneral = TRUE; - pErrorStats->fFatalChipError = TRUE; - } - - pIntrptManage->usRegister502h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister502h = 0x0; - } - - /* PGSP registers. */ - if ( (f_ulRegister210h & 0x00080) != 0 ) - { - /*=======================================================================*/ - /* Read register. */ - ReadParams.ulReadAddress = 0x702; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0002) != 0 ) - { - f_pIntFlags->fErrorOverflowToneEvents = TRUE; - pErrorStats->ulOverflowToneEventsCnt++; - } - - pIntrptManage->usRegister702h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister702h = 0x0; - } - - - - /* If this is the first time the ISR is called, clear the ISR is not called bit */ - /* in external memory to signal the remote client that we are called. */ - if ( pSharedInfo->IntrptManage.fIsrCalled == FALSE ) - { - /* Remember that we are being called. */ - pSharedInfo->IntrptManage.fIsrCalled = TRUE; - - if ( pSharedInfo->DebugInfo.fIsIsrCalledField == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Read previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Clear the field. */ - ulTempData &= (~ulMask); - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateIntrptStates - -Description: Updates the state of all interrupt register groups. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Interrupt flags. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateIntrptStates -UINT32 Oct6100ApiUpdateIntrptStates( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - - pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /*-----------------------------------------------------------------------*/ - if ( ( f_pIntFlags->fFatalReadTimeout == TRUE) && - pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulFatalMemoryDisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulFatalMemoryDisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - if ( (f_pIntFlags->fErrorRefreshTooLate == TRUE || - f_pIntFlags->fErrorPllJitter == TRUE ) && - pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulErrorMemoryDisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulErrorMemoryDisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - if ( (f_pIntFlags->fErrorOverflowToneEvents == TRUE) && - pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulErrorOverflowToneEventsDisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulErrorOverflowToneEventsDisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - if ( (f_pIntFlags->fErrorH100OutOfSync == TRUE || - f_pIntFlags->fErrorH100ClkA == TRUE || - f_pIntFlags->fErrorH100ClkB == TRUE || - f_pIntFlags->fErrorH100FrameA == TRUE ) && - pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulErrorH100DisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulErrorH100DisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteIntrptRegs - -Description: Writes to interrupt registers to clear interrupt condition, and - writes to an interrupt's IE register if interrupt is to time - out. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteIntrptRegs -UINT32 Oct6100ApiWriteIntrptRegs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - - /* Get some local pointers. */ - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - - - /*===========================================================================*/ - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister102h & cOCT6100_INTRPT_MASK_REG_102H) != 0 ) - { - WriteParams.ulWriteAddress = 0x102; - WriteParams.usWriteData = pIntrptManage->usRegister102h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_WILL_TIMEOUT || - pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x1800; - - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0401; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister202h & cOCT6100_INTRPT_MASK_REG_202H) != 0 ) - { - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = pIntrptManage->usRegister202h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData |= 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister302h & cOCT6100_INTRPT_MASK_REG_302H) != 0 ) - { - WriteParams.ulWriteAddress = 0x302; - WriteParams.usWriteData = pIntrptManage->usRegister302h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( (pIntrptManage->usRegister502h & cOCT6100_INTRPT_MASK_REG_502H) != 0 ) - { - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = pIntrptManage->usRegister502h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister702h & cOCT6100_INTRPT_MASK_REG_702H) != 0 ) - { - WriteParams.ulWriteAddress = 0x702; - WriteParams.usWriteData = pIntrptManage->usRegister702h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteIeRegs - -Description: Writes the IE field of each interrupt register. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteIeRegs -UINT32 Oct6100ApiWriteIeRegs( - tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - - /* Get some local pointers. */ - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - - /* Set some parameters of read struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x1800; - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0401; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData |= 0x0001; - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x504; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalGeneralState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - - /*==================================================================================*/ - /* Enable the GLOBAL IEs for the interrupt pin. */ - WriteParams.ulWriteAddress = 0x218; - WriteParams.usWriteData = 0x00D7; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadChipMclkTime - -Description: Reads the chip's mclk cycle count to construct a chip time. - The time is used to manage interrupts. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReadChipMclkTime -UINT32 Oct6100ApiReadChipMclkTime( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulCheckData; - UINT32 ulResult; - UINT32 i; - UINT16 usReadData; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - pIntrptManage = &pSharedInfo->IntrptManage; - - /* Assign memory for read data. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Perform reads. */ - for ( i = 0; i < 100; i++ ) - { - ReadParams.ulReadAddress = 0x306; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - pIntrptManage->ulRegMclkTimeHigh = usReadData & 0xFF; - ulCheckData = usReadData; - - ReadParams.ulReadAddress = 0x308; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - pIntrptManage->ulRegMclkTimeLow = (usReadData & 0xFFFF) << 16; - - ReadParams.ulReadAddress = 0x306; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - if ( ulCheckData == usReadData ) - break; - } - - if ( i == 100 ) - return cOCT6100_ERR_FATAL_2F; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateIntrptTimeouts - -Description: Checks which interrupt groups have finished their timeout - period. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateIntrptTimeouts -UINT32 Oct6100ApiUpdateIntrptTimeouts( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulRegMclkTimePlus5MsHigh; - UINT32 ulRegMclkTimePlus5MsLow; - UINT32 ulResult; - BOOL fFatalMemoryChange = FALSE; - BOOL fDataErrMemoryChange = FALSE; - BOOL fErrorOverflowToneEventsChange = FALSE; - BOOL fH100ErrorChange = FALSE; - - /* Get local pointer to interrupt management structure. */ - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /* Calculate mclk time + 5 ms. */ - ulRegMclkTimePlus5MsLow = pIntrptManage->ulRegMclkTimeLow + (5 * pIntrptManage->ulNumMclkCyclesIn1Ms); - if ( ulRegMclkTimePlus5MsLow < pIntrptManage->ulRegMclkTimeLow ) - ulRegMclkTimePlus5MsHigh = pIntrptManage->ulRegMclkTimeHigh + 1; - else /* ( ulRegMclkTimePlus5MsLow >= pIntrptManage->ulRegMclkTimeLow ) */ - ulRegMclkTimePlus5MsHigh = pIntrptManage->ulRegMclkTimeHigh; - - /* Check which interrupts are timed out and need to be reenabled now. */ - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulFatalMemoryDisableMclkHigh, pIntrptManage->ulFatalMemoryDisableMclkLow, pIntrptManage->ulFatalMemoryEnableMclkHigh, pIntrptManage->ulFatalMemoryEnableMclkLow, pIntrptManage->byFatalMemoryState, fFatalMemoryChange ) - } - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulErrorMemoryDisableMclkHigh, pIntrptManage->ulErrorMemoryDisableMclkLow, pIntrptManage->ulErrorMemoryEnableMclkHigh, pIntrptManage->ulErrorMemoryEnableMclkLow, pIntrptManage->byErrorMemoryState, fDataErrMemoryChange ) - } - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulErrorOverflowToneEventsDisableMclkHigh, pIntrptManage->ulErrorOverflowToneEventsDisableMclkLow, pIntrptManage->ulErrorOverflowToneEventsEnableMclkHigh, pIntrptManage->ulErrorOverflowToneEventsEnableMclkLow, pIntrptManage->byErrorOverflowToneEventsState, fErrorOverflowToneEventsChange ) - } - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulErrorH100DisableMclkHigh, pIntrptManage->ulErrorH100DisableMclkLow, pIntrptManage->ulErrorH100EnableMclkHigh, pIntrptManage->ulErrorH100EnableMclkLow, pIntrptManage->byErrorH100State, fH100ErrorChange ) - } - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Write to the IE registers which have changed. */ - - /*==================================================================================*/ - if ( fFatalMemoryChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - /*==================================================================================*/ - if ( fFatalMemoryChange == TRUE || - fDataErrMemoryChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x1800; - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0401; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - /*==================================================================================*/ - if ( pIntrptManage->fMclkIntrptActive == TRUE || - fH100ErrorChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData |= 0x0001; - - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - - /*==================================================================================*/ - if ( fErrorOverflowToneEventsChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiScheduleNextMclkIntrptSer - -Description: Serialized sub-function of Oct6100ApiScheduleNextMclkIntrpt. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiScheduleNextMclkIntrptSer -UINT32 Oct6100ApiScheduleNextMclkIntrptSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulTimeDiff; - UINT32 ulRegMclkTimeHigh; - UINT32 ulRegMclkTimeLow; - UINT32 ulResult; - BOOL fConditionFlag = TRUE; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain temporary pointers to reduce indirection, thus speeding up processing. */ - pIntrptConfig = &pSharedInfo->IntrptConfig; - pIntrptManage = &pSharedInfo->IntrptManage; - ulRegMclkTimeHigh = pIntrptManage->ulRegMclkTimeHigh; - ulRegMclkTimeLow = pIntrptManage->ulRegMclkTimeLow; - - /* First, check if any interrupts have just been disabled. If there are any, */ - /* determine the time at which they should be reenabled. */ - pIntrptManage->ulNextMclkIntrptTimeHigh = cOCT6100_INVALID_VALUE; - pIntrptManage->ulNextMclkIntrptTimeLow = cOCT6100_INVALID_VALUE; - - while ( fConditionFlag ) - { - /* Indicate that no mclk interrupt is needed, yet. */ - ulTimeDiff = cOCT6100_INVALID_VALUE; - - /* Check each interrupt category to see if an mclk interrupt is needed to */ - /* reenable an interrupt at a later time. */ - if ( pIntrptManage->byFatalMemoryState != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byFatalMemoryState != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byFatalMemoryState, pIntrptManage->ulFatalMemoryEnableMclkHigh, pIntrptManage->ulFatalMemoryEnableMclkLow, pIntrptConfig->ulFatalMemoryTimeoutMclk, ulTimeDiff ) - } - if ( pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byErrorMemoryState, pIntrptManage->ulErrorMemoryEnableMclkHigh, pIntrptManage->ulErrorMemoryEnableMclkLow, pIntrptConfig->ulErrorMemoryTimeoutMclk, ulTimeDiff ) - } - if ( pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byErrorOverflowToneEventsState, pIntrptManage->ulErrorOverflowToneEventsEnableMclkHigh, pIntrptManage->ulErrorOverflowToneEventsEnableMclkLow, pIntrptConfig->ulErrorOverflowToneEventsTimeoutMclk, ulTimeDiff ) - } - if ( pIntrptManage->byErrorH100State != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byErrorH100State != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byErrorH100State, pIntrptManage->ulErrorH100EnableMclkHigh, pIntrptManage->ulErrorH100EnableMclkLow, pIntrptConfig->ulErrorH100TimeoutMclk, ulTimeDiff ) - } - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Schedule next mclk interrupt, if any is needed. */ - if ( ulTimeDiff != cOCT6100_INVALID_VALUE ) - { - UINT32 ulMclkTimeTest; - UINT32 ulAlarmTimeTest; - UINT32 ulTimeDiffTest; - BOOL fAlarmTimePassed; - - /* Indicate that an mclk interrupt is scheduled.*/ - pIntrptManage->fMclkIntrptActive = TRUE; - - pIntrptManage->ulNextMclkIntrptTimeLow = ulRegMclkTimeLow + ulTimeDiff; - if ( pIntrptManage->ulNextMclkIntrptTimeLow < ulRegMclkTimeLow ) - pIntrptManage->ulNextMclkIntrptTimeHigh = ulRegMclkTimeHigh + 1; - else /* ( pIntrptManage->ulNextMclkIntrptTimeLow >= ulRegMclkTimeLow ) */ - pIntrptManage->ulNextMclkIntrptTimeHigh = ulRegMclkTimeHigh; - - WriteParams.ulWriteAddress = 0x30C; - WriteParams.usWriteData = (UINT16)( (pIntrptManage->ulNextMclkIntrptTimeLow >> 24) & 0xFF ); - WriteParams.usWriteData |= (UINT16)( (pIntrptManage->ulNextMclkIntrptTimeHigh & 0xFF) << 8 ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x30E; - WriteParams.usWriteData = (UINT16)( (pIntrptManage->ulNextMclkIntrptTimeLow >> 8) & 0xFFFF ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData = 0x0001; - - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Disable the ROL if previously set. */ - WriteParams.ulWriteAddress = 0x302; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if already passed the next interrupt time. */ - ulResult = Oct6100ApiReadChipMclkTime( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulMclkTimeTest = (pIntrptManage->ulRegMclkTimeLow >> 16) & 0xFFFF; - ulAlarmTimeTest = (pIntrptManage->ulNextMclkIntrptTimeLow >> 16) & 0xFFFF; - - /* Update the local Mlck timer values.*/ - ulRegMclkTimeHigh = pIntrptManage->ulRegMclkTimeHigh; - ulRegMclkTimeLow = pIntrptManage->ulRegMclkTimeLow; - - fAlarmTimePassed = FALSE; - - if ( ulMclkTimeTest > ulAlarmTimeTest ) - { - ulTimeDiffTest = ulMclkTimeTest - ulAlarmTimeTest; - if ( ulTimeDiffTest <= 0x8000 ) - fAlarmTimePassed = TRUE; - } - else /* ( ulMclkTimeTest <= ulAlarmTimeTest ) */ - { - ulTimeDiffTest = ulAlarmTimeTest - ulMclkTimeTest; - if ( ulTimeDiffTest > 0x8000 ) - fAlarmTimePassed = TRUE; - } - - if ( fAlarmTimePassed == TRUE ) - { - /* Passed the interrupt time. Schedule next interrupt (if needed). */ - ulResult = Oct6100ApiUpdateIntrptTimeouts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - continue; - } - else - { - fConditionFlag = FALSE; - } - } - else - { - /* Indicate that no mclk interrupt is scheduled. */ - pIntrptManage->fMclkIntrptActive = FALSE; - - /* Insure that the mclk interrupt is not enabled. */ - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - fConditionFlag = FALSE; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckProcessorState - -Description: This function verifies if the NLP and AF processors are operating - correctly. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to a tOCT6100_INTERRUPT_FLAGS structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckProcessorState -UINT32 Oct6100ApiCheckProcessorState( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS ReadBurstParams; - - UINT32 ulNlpTimestamp; - UINT32 ulAfTimestamp; - UINT32 ulTimestampDiff; - - UINT32 ulResult; - UINT32 i; - - UINT16 usReadData; - UINT16 ausReadData[ 2 ]; - - UINT32 aulWaitTime[ 2 ]; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set some parameters of write struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set some parameters of write struct. */ - ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadBurstParams.pusReadData = ausReadData; - - /*-----------------------------------------------------------------------*/ - /* Check if chip is in reset. */ - - /* Read the main control register. */ - ReadParams.ulReadAddress = 0x100; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData == 0x0000 ) - { - /* Chip was resetted. */ - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_4; - f_pIntFlags->fFatalGeneral = TRUE; - pSharedInfo->ErrorStats.fFatalChipError = TRUE; - } - - /*-----------------------------------------------------------------------*/ - - - /*-----------------------------------------------------------------------*/ - /* Reading the AF timestamp.*/ - - for ( i = 0; i < cOCT6100_MAX_LOOP; i++ ) - { - /* Read the timestamp.*/ - ReadBurstParams.ulReadAddress = 0x082E0008; - ReadBurstParams.ulReadLength = 2; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read the high part again to make sure it didn't wrap. */ - ReadParams.ulReadAddress = 0x082E0008; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the low part wrapped. */ - if ( ausReadData[ 0 ] == usReadData ) - break; - } - - if ( i == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_INTRPTS_AF_TIMESTAMP_READ_TIMEOUT; - - /* Save the AF timestamp. */ - ulAfTimestamp = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; - - /*-----------------------------------------------------------------------*/ - - - /*-----------------------------------------------------------------------*/ - /* Reading the NLP timestamp. */ - - for ( i = 0; i < cOCT6100_MAX_LOOP; i++ ) - { - /* Read the timestamp. */ - ReadBurstParams.ulReadAddress = 0x08000008; - ReadBurstParams.ulReadLength = 2; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read the high part again to make sure it didn't wrap. */ - ReadParams.ulReadAddress = 0x08000008; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the low part wrapped. */ - if ( ausReadData[ 0 ] == usReadData ) - break; - } - - if ( i == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_INTRPTS_NLP_TIMESTAMP_READ_TIMEOUT; - - /* Save the NLP timestamp. */ - ulNlpTimestamp = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; - - /*-----------------------------------------------------------------------*/ - - - /*-----------------------------------------------------------------------*/ - /* Check the validity of the timestamp. */ - - if ( ulAfTimestamp > ulNlpTimestamp ) - { - /* The NLP timestamp wrapped. */ - ulTimestampDiff = 0xFFFFFFFF - ulAfTimestamp + 1; - ulTimestampDiff += ulNlpTimestamp; - } - else - ulTimestampDiff = ulNlpTimestamp - ulAfTimestamp; - - if ( ulTimestampDiff > 0x2000 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_5; - f_pIntFlags->fFatalGeneral = TRUE; - pSharedInfo->ErrorStats.fFatalChipError = TRUE; - } - - /*Check if AF and NLP are both stuck*/ - if ( f_pIntFlags->fErrorH100ClkA == FALSE && - f_pIntFlags->fErrorH100ClkB == FALSE && - f_pIntFlags->fErrorH100FrameA == FALSE && - f_pIntFlags->fErrorH100OutOfSync == FALSE ) - - { - if ( ulAfTimestamp == 0 && ulNlpTimestamp == 0 ) - { - /*Give some time to the counters*/ - aulWaitTime[ 0 ] = 250; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*Let's read again the AF timestamp to be sure. Maybe they were at 0 at the same time*/ - ReadBurstParams.ulReadAddress = 0x082E0008; - ReadBurstParams.ulReadLength = 2; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulAfTimestamp = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; - - if ( ulAfTimestamp == 0 ) - { - /*TDM Clocks are ok but NLP and AF timestamps are both at 0*/ - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_9; - f_pIntFlags->fFatalGeneral = TRUE; - pSharedInfo->ErrorStats.fFatalChipError = TRUE; - } - } - - } - - /*-----------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c deleted file mode 100644 index b2c0e8ef..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c +++ /dev/null @@ -1,831 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_memory.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to manage the allocation of memory - blocks in external memory. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 42 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_memory_priv.h" - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetMemorySwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the memories. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetMemorySwSizes -UINT32 Oct6100ApiGetMemorySwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - UINT32 ulNumTsiChariots; - - /*=========================================================================*/ - /* Internal memory */ - - /* Evaluate the number of available TSI memory after reserving the ones used by channels. */ - ulNumTsiChariots = cOCT6100_TOTAL_TSI_CONTROL_MEM_ENTRY - f_pOpenChip->ulMaxPhasingTssts - cOCT6100_TSI_MEM_FOR_TIMESTAMP; - - if ( f_pOpenChip->fEnableExtToneDetection == TRUE ) - ulNumTsiChariots--; - - /* Calculate memory needed for TSI memory allocation. */ - ulResult = OctapiLlmAllocGetSize( ulNumTsiChariots, &f_pInstSizes->ulTsiMemoryAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_94; - - /* Calculate memory needed for conversion memory allocation. */ - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS, &f_pInstSizes->ulConversionMemoryAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B5; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiMemoryAlloc, ulTempVar ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConversionMemoryAlloc, ulTempVar ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMemorySwInit - -Description: Initializes all elements of the instance structure associated - to memories. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMemorySwInit -UINT32 Oct6100ApiMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiMemAlloc; - PVOID pAllocPnt; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*=========================================================================*/ - /* Internal memory */ - - /* Initialize the TSI memory allocation structure. */ - pSharedInfo->MemoryMap.ulNumTsiEntries = cOCT6100_TOTAL_TSI_CONTROL_MEM_ENTRY - pSharedInfo->ChipConfig.usMaxPhasingTssts - cOCT6100_TSI_MEM_FOR_TIMESTAMP; - - if ( pSharedInfo->ChipConfig.fEnableExtToneDetection == TRUE ) - pSharedInfo->MemoryMap.ulNumTsiEntries--; - - mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pTsiMemAlloc ); - - ulResult = OctapiLlmAllocInit( &pTsiMemAlloc, pSharedInfo->MemoryMap.ulNumTsiEntries ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_95; - - /* Initialize the conversion memory allocation structure. */ - mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pAllocPnt ); - - ulResult = OctapiLlmAllocInit( &pAllocPnt, cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B6; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBufferPlayoutMemorySwInit - -Description: Initialize the buffer playout memory allocation working - structures. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBufferPlayoutMemorySwInit -UINT32 Oct6100ApiBufferPlayoutMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNode; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Only if buffer playout will be used. */ - if ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers > 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_LIST_PNT( pSharedInfo, pNode ); - - /* First node contains all free memory at beginning. This node is not used, but represents the memory. */ - pNode->ulSize = ( pSharedInfo->MiscVars.ulTotalMemSize + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) - pSharedInfo->MemoryMap.ulFreeMemBaseAddress; - pNode->ulNext = 0; - pNode->ulPrevious = 0; - pNode->fAllocated = FALSE; - pNode->ulStartAddress = pSharedInfo->MemoryMap.ulFreeMemBaseAddress; - - pNode++; - - /* Now create the first node of the free list, i.e. nodes that can be used later for modeling the memory. */ - pNode->ulSize = 0; - /* Next free. */ - pNode->ulNext = 2; - /* Last. */ - pNode->ulPrevious = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1; - pNode->fAllocated = FALSE; - pNode->ulStartAddress = 0; - - pNode++; - - /* Link all the unused nodes. */ - for( i = 2; i < (UINT32)( ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1 ); i ++ ) - { - pNode->ulNext = i + 1; - pNode->ulPrevious = i - 1; - pNode->ulStartAddress = 0; - pNode->ulSize = 0; - pNode->fAllocated = FALSE; - pNode++; - } - - /* Last node of the unused list. */ - pNode->fAllocated = FALSE; - pNode->ulPrevious = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 2; - /* Free list head. */ - pNode->ulNext = 1; - pNode->ulSize = 0; - pNode->ulStartAddress = 0; - - /* Set roving pointer to first node ( which can be used! ) */ - pSharedInfo->PlayoutInfo.ulRovingNode = 0; - - /* First unused node. */ - pSharedInfo->PlayoutInfo.ulFirstUnusedNode = 1; - - /* Last unused node. */ - pSharedInfo->PlayoutInfo.ulLastUnusedNode = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1; - - /* Number of unused nodes. */ - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1; - } - else - { - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt = 0; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufferPlayoutMemoryNode - -Description: Get a free node from the unused buffer playout node list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulNewNode The index of the node. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufferPlayoutMemoryNode -UINT32 Oct6100ApiReserveBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulNewNode ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNode; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if a free block is left. */ - if ( pSharedInfo->PlayoutInfo.ulUnusedNodeCnt == 0 ) - { - /* This should not happen according to the allocated list from the beginning. */ - return cOCT6100_ERR_FATAL_CC; - } - - /* The new node is the first in the unused list. */ - *f_pulNewNode = pSharedInfo->PlayoutInfo.ulFirstUnusedNode; - - /* Unlink this new node from the unused list. */ - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, *f_pulNewNode ); - - pSharedInfo->PlayoutInfo.ulFirstUnusedNode = pNode->ulNext; - - pNode->ulPrevious = pSharedInfo->PlayoutInfo.ulLastUnusedNode; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, pSharedInfo->PlayoutInfo.ulLastUnusedNode ); - - pNode->ulNext = pSharedInfo->PlayoutInfo.ulFirstUnusedNode; - - /* Update unused node count. */ - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt--; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufferPlayoutMemoryNode - -Description: Release a node that is not used anymore. Insert this node - into the unused list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulOldNode The index of the node. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufferPlayoutMemoryNode -UINT32 Oct6100ApiReleaseBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulOldNode ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNode; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the last unused node. Insert this old node at the end of the unused list. */ - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, pSharedInfo->PlayoutInfo.ulLastUnusedNode ); - - /* Last node points to old node. */ - pNode->ulNext = f_ulOldNode; - - /* Update old node. */ - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, f_ulOldNode ); - - pNode->ulPrevious = pSharedInfo->PlayoutInfo.ulLastUnusedNode; - pNode->ulNext = pSharedInfo->PlayoutInfo.ulFirstUnusedNode; - pSharedInfo->PlayoutInfo.ulLastUnusedNode = f_ulOldNode; - - /* Keep unused node count. */ - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt++; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufferPlayoutMemory - -Description: Try to allocate requested size. - Returns an error if malloc point could not be found. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulSize Needed size. -f_pulMallocAddress Alloc point. This memory can now be used. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufferPlayoutMemory -UINT32 Oct6100ApiReserveBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulSize, - OUT PUINT32 f_pulMallocAddress ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pCurrentNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pTempNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNewNode; - - UINT32 ulCurrentBufferPlayoutMallocNode; - UINT32 ulNewNode; - BOOL fFoundMemory = FALSE; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Requested size must be divisible by 64. */ - if ( f_ulSize % 64 ) - { - f_ulSize = f_ulSize + ( 64 - ( f_ulSize % 64 ) ); - } - - /* Start with roving pointer. */ - ulCurrentBufferPlayoutMallocNode = pSharedInfo->PlayoutInfo.ulRovingNode; - - *f_pulMallocAddress = 0; - - /* Return an error if size requested is zero. */ - if ( f_ulSize == 0 ) - { - return cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_ZERO; - } - - do - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pCurrentNode, ulCurrentBufferPlayoutMallocNode ); - - /* Look for a free node big enough to fulfill user requested size. */ - if ( ( pCurrentNode->fAllocated == FALSE ) && ( pCurrentNode->ulSize >= f_ulSize ) ) - { - /* Use this node! */ - pCurrentNode->fAllocated = TRUE; - - if ( pCurrentNode->ulNext != 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulNext ); - - if( ( pTempNode->fAllocated == TRUE ) && ( pCurrentNode->ulSize > f_ulSize ) ) - { - /* Fragmentation NOW! */ - - /* Allocate new node that will contain free size. */ - ulResult = Oct6100ApiReserveBufferPlayoutMemoryNode( f_pApiInstance, &ulNewNode ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNewNode, ulNewNode ); - - /* Can use this free node. */ - pNewNode->ulSize = pCurrentNode->ulSize - f_ulSize; - pNewNode->ulStartAddress = pCurrentNode->ulStartAddress + f_ulSize; - - /* Link new node into the list. */ - pNewNode->ulNext = pCurrentNode->ulNext; - pNewNode->ulPrevious = ulCurrentBufferPlayoutMallocNode; - pNewNode->fAllocated = FALSE; - pTempNode->ulPrevious = ulNewNode; - pCurrentNode->ulNext = ulNewNode; - } - } - else if ( pCurrentNode->ulSize > f_ulSize ) - { - /* Must allocate a new free node for the rest of the space. */ - ulResult = Oct6100ApiReserveBufferPlayoutMemoryNode( f_pApiInstance, &ulNewNode ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNewNode, ulNewNode ); - - pNewNode->ulNext = pCurrentNode->ulNext; - pCurrentNode->ulNext = ulNewNode; - pNewNode->ulPrevious = ulCurrentBufferPlayoutMallocNode; - pNewNode->fAllocated = FALSE; - pNewNode->ulSize = pCurrentNode->ulSize - f_ulSize; - pNewNode->ulStartAddress = pCurrentNode->ulStartAddress + f_ulSize; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, 0 ); - - /* Check for the head node that would have to be updated. */ - if ( ( ulCurrentBufferPlayoutMallocNode == 0 ) && ( pTempNode->ulPrevious == 0 ) ) - pTempNode->ulPrevious = ulNewNode; - } - else - { - /* Perfect fit. */ - } - pCurrentNode->ulSize = f_ulSize; - - /* Update roving pointer. */ - pSharedInfo->PlayoutInfo.ulRovingNode = ulCurrentBufferPlayoutMallocNode; - *f_pulMallocAddress = pCurrentNode->ulStartAddress; - fFoundMemory = TRUE; - break; - } - - /* Next block! */ - ulCurrentBufferPlayoutMallocNode = pCurrentNode->ulNext; - - } while ( pSharedInfo->PlayoutInfo.ulRovingNode != ulCurrentBufferPlayoutMallocNode ); - - if ( fFoundMemory == FALSE ) - { - return cOCT6100_ERR_BUFFER_PLAYOUT_NO_MEMORY; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufferPlayoutMemory - -Description: Free what was allocated at address. Free is somewhat slower - then Malloc. O(n), must travel through the list looking for - the malloc point. Return an error if alloc point was not found. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulMallocAddress Alloc point. The memory at address will be freed. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufferPlayoutMemory -UINT32 Oct6100ApiReleaseBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMallocAddress ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pCurrentNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pTempNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pOldNode; - - UINT32 ulResult = cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_POINT_NOT_FOUND; - UINT32 ulNodeToMerge; - UINT32 ulNodeToRemove; - UINT32 ulCurrentBufferPlayoutMallocNode; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Start from the beginning and find the alloc node. */ - ulCurrentBufferPlayoutMallocNode = 0; - - do - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pCurrentNode, ulCurrentBufferPlayoutMallocNode ); - - if ( ( pCurrentNode->ulStartAddress == f_ulMallocAddress ) && ( pCurrentNode->fAllocated == TRUE ) ) - { - /* We found the block! */ - pCurrentNode->fAllocated = FALSE; - - /* Check if the next node can be merged. */ - if ( pCurrentNode->ulNext != 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulNext ); - - if ( pTempNode->fAllocated == FALSE ) - { - /* Can merge this block to us. */ - pCurrentNode->ulSize += pTempNode->ulSize; - pTempNode->ulSize = 0; - - /* Unlink unused node. */ - ulNodeToRemove = pCurrentNode->ulNext; - pCurrentNode->ulNext = pTempNode->ulNext; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulNext ); - - pTempNode->ulPrevious = ulCurrentBufferPlayoutMallocNode; - - ulResult = Oct6100ApiReleaseBufferPlayoutMemoryNode( f_pApiInstance, ulNodeToRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move roving pointer if have to. */ - if ( pSharedInfo->PlayoutInfo.ulRovingNode == ulNodeToRemove ) - pSharedInfo->PlayoutInfo.ulRovingNode = ulCurrentBufferPlayoutMallocNode; - } - } - - /* Check if previous node can merge. */ - if ( ulCurrentBufferPlayoutMallocNode != 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulPrevious ); - - if ( pTempNode->fAllocated == FALSE ) - { - ulNodeToMerge = pCurrentNode->ulPrevious; - - /* Can merge us to this node. */ - pTempNode->ulSize += pCurrentNode->ulSize; - pCurrentNode->ulSize = 0; - - /* Unlink unused node. */ - ulNodeToRemove = ulCurrentBufferPlayoutMallocNode; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pOldNode, ulNodeToRemove ); - - pTempNode->ulNext = pOldNode->ulNext; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pTempNode->ulNext ); - - pTempNode->ulPrevious = ulNodeToMerge; - - pOldNode->fAllocated = FALSE; - pOldNode->ulSize = 0; - pOldNode->ulStartAddress = 0; - - /* Move roving pointer if have to. */ - if ( pSharedInfo->PlayoutInfo.ulRovingNode == ulNodeToRemove ) - pSharedInfo->PlayoutInfo.ulRovingNode = ulNodeToMerge; - - /* Release this unused node. */ - ulResult = Oct6100ApiReleaseBufferPlayoutMemoryNode( f_pApiInstance, ulNodeToRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* All's good! */ - ulResult = 0; - break; - } - - /* Next node. */ - ulCurrentBufferPlayoutMallocNode = pCurrentNode->ulNext; - - } while( ulCurrentBufferPlayoutMallocNode != 0 ); - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsiMemEntry - -Description: Reserves a TSI chariot memory entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusTsiMemIndex Resulting index reserved in the TSI chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsiMemEntry -UINT32 Oct6100ApiReserveTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiMemAlloc; - UINT32 ulResult; - UINT32 ulIndex; - UINT32 ulNumTsiB4Timestamp; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pTsiMemAlloc ) - - ulResult = OctapiLlmAllocAlloc( pTsiMemAlloc, &ulIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MEMORY_ALL_TSI_MEM_ENTRY_RESERVED; - else - return cOCT6100_ERR_FATAL_92; - } - - - if ( ulIndex >= cOCT6100_NUM_TSI_B4_PHASING ) - { - /* Evaluate the number of TSI memory before the timestamp TSI. */ - ulNumTsiB4Timestamp = cOCT6100_NUM_TSI_B4_PHASING + cOCT6100_MAX_TSI_B4_TIMESTAMP - pSharedInfo->ChipConfig.usMaxPhasingTssts; - - if ( ulIndex >= ulNumTsiB4Timestamp ) - { - /* + 4 for the timestamp TSI entries.*/ - *f_pusTsiMemIndex = (UINT16)( pSharedInfo->ChipConfig.usMaxPhasingTssts + ulIndex + cOCT6100_TSI_MEM_FOR_TIMESTAMP ); - } - else /* ulIndex < ulNumTsiB4Timestamp */ - { - *f_pusTsiMemIndex = (UINT16)( pSharedInfo->ChipConfig.usMaxPhasingTssts + ulIndex ); - } - } - else /* ulIndex < ulNumTsiB4Timestamp */ - { - *f_pusTsiMemIndex = (UINT16)( ulIndex ); - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsiMemEntry - -Description: Releases a TSI chariot memory entry specified. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usTsiMemIndex Index reserved in the TSI chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsiMemEntry -UINT32 Oct6100ApiReleaseTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiMemAlloc; - UINT32 ulResult; - UINT32 ulIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if the entry programmed is greater then the timestamp entries. */ - if ( f_usTsiMemIndex > cOCT6100_TSST_CONTROL_TIMESTAMP_BASE_ENTRY ) - ulIndex = f_usTsiMemIndex - cOCT6100_TSI_MEM_FOR_TIMESTAMP; - else - ulIndex = f_usTsiMemIndex; - - /* Check if the entry programmed is greater then the phasing TSST entries. */ - if ( ulIndex > cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY ) - ulIndex -= pSharedInfo->ChipConfig.usMaxPhasingTssts; - - mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pTsiMemAlloc ) - - ulResult = OctapiLlmAllocDealloc( pTsiMemAlloc, ulIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_93; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveConversionMemEntry - -Description: Reserves one of the conversion memory entry - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pusConversionMemIndex Resulting index reserved in the conversion memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveConversionMemEntry -UINT32 Oct6100ApiReserveConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusConversionMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pConversionMemAlloc; - UINT32 ulConversionMemIndex; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pConversionMemAlloc ) - - ulResult = OctapiLlmAllocAlloc( pConversionMemAlloc, &ulConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MEMORY_ALL_CONVERSION_MEM_ENTRY_RESERVED; - else - return cOCT6100_ERR_FATAL_B8; - } - - *f_pusConversionMemIndex = (UINT16)( ulConversionMemIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseConversionMemEntry - -Description: Releases the conversion chariot memory entry specified. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_usConversionMemIndex Index reserved in the conversion chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseConversionMemEntry -UINT32 Oct6100ApiReleaseConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pConversionMemAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pConversionMemAlloc ) - - ulResult = OctapiLlmAllocDealloc( pConversionMemAlloc, f_usConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_B7; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c deleted file mode 100644 index 4e5c189f..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c +++ /dev/null @@ -1,640 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_miscellaneous.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains miscellaneous functions used in various files. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 35 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_largmath.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_miscellaneous_priv.h" - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWaitForTime - -Description: Waits for the specified amount of time. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_aulWaitTime[ 2 ] The amout of time to be waited. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWaitForTime -UINT32 Oct6100ApiWaitForTime( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_aulWaitTime[ 2 ] ) -{ - tOCT6100_GET_TIME StartTime; - tOCT6100_GET_TIME CurrentTime; - UINT32 aulTimeDelta[ 2 ]; - UINT32 ulResult; - UINT16 usTempVar; - BOOL fConditionFlag = TRUE; - - /* Copy the process context. */ - StartTime.pProcessContext = f_pApiInstance->pProcessContext; - CurrentTime.pProcessContext = f_pApiInstance->pProcessContext; - - ulResult = Oct6100UserGetTime( &StartTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - while ( fConditionFlag ) - { - ulResult = Oct6100UserGetTime( &CurrentTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = octapi_lm_subtract( - CurrentTime.aulWallTimeUs, 1, - StartTime.aulWallTimeUs, 1, - aulTimeDelta, 1, - &usTempVar ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_37; - - if ( aulTimeDelta[ 1 ] >= f_aulWaitTime[ 1 ] && - aulTimeDelta[ 0 ] >= f_aulWaitTime[ 0 ] ) - fConditionFlag = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWaitForPcRegisterBit - -Description: Polls the specified PC register bit. The function exits once - the bit is cleared by hardware, or when the specified timeout - period has been expired. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulPcRegAdd Address of the register containing the PC bit. -f_ulPcBitNum Number of the PC bit within the register. -f_ulValue Expected value of the bit. -f_ulTimeoutUs The timeout period, in usec. -f_pfBitEqual Pointer to the result of the bit comparison. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWaitForPcRegisterBit -UINT32 Oct6100ApiWaitForPcRegisterBit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulPcRegAdd, - IN UINT32 f_ulPcBitNum, - IN UINT32 f_ulValue, - IN UINT32 f_ulTimeoutUs, - OUT PBOOL f_pfBitEqual ) -{ - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_GET_TIME StartTime; - tOCT6100_GET_TIME TimeoutTime; - tOCT6100_GET_TIME CurrentTime; - UINT32 ulResult; - UINT16 usReadData; - BOOL fConditionFlag = TRUE; - - /* Copy the process context. */ - StartTime.pProcessContext = f_pApiInstance->pProcessContext; - CurrentTime.pProcessContext = f_pApiInstance->pProcessContext; - - /* Get the current system time. */ - ulResult = Oct6100UserGetTime( &StartTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Mark the bit as not being equal, for now. */ - *f_pfBitEqual = FALSE; - - /* Determine the time at which the timeout has expired. */ - ulResult = octapi_lm_add( - StartTime.aulWallTimeUs, 1, - &f_ulTimeoutUs, 0, - TimeoutTime.aulWallTimeUs, 1 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Prepare read structure. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.ulReadAddress = f_ulPcRegAdd; - ReadParams.pusReadData = &usReadData; - - /* Read the PC bit while the timeout period hasn't expired. */ - while ( fConditionFlag ) - { - /* Read the current time again to check for timeout. */ - ulResult = Oct6100UserGetTime( &CurrentTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100UserDriverReadApi( &ReadParams ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( UINT16 )((usReadData >> f_ulPcBitNum) & 0x1) == ( UINT16 )f_ulValue ) - { - /* Mark the bit as being equal. */ - *f_pfBitEqual = TRUE; - fConditionFlag = FALSE; - } - - if ( CurrentTime.aulWallTimeUs[ 1 ] > TimeoutTime.aulWallTimeUs[ 1 ] || - (CurrentTime.aulWallTimeUs[ 1 ] == TimeoutTime.aulWallTimeUs[ 1 ] && - CurrentTime.aulWallTimeUs[ 0 ] >= TimeoutTime.aulWallTimeUs[ 0 ]) ) - fConditionFlag = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadDword - -Description: Read a DWORD at specified address in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulAddress DWORD address where to read. -f_pulReadData Resulting data. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReadDword -UINT32 Oct6100ApiReadDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulReadData ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - - UINT32 ulResult; - UINT32 ulTempData; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*==================================================================================*/ - /* Read the first 16 bits. */ - ReadParams.ulReadAddress = f_ulAddress; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTempData = usReadData << 16; - - /* Read the last 16 bits. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTempData |= usReadData; - - /*==================================================================================*/ - - /* Return the read value.*/ - *f_pulReadData = ulTempData; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteDword - -Description: Write a DWORD at specified address in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulAddress DWORD address where to write. -f_ulWriteData DWORD data to write. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteDword -UINT32 Oct6100ApiWriteDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - IN UINT32 f_ulWriteData ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Write the first 16 bits. */ - WriteParams.ulWriteAddress = f_ulAddress; - WriteParams.usWriteData = (UINT16)((f_ulWriteData >> 16) & 0xFFFF); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the last word. */ - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)(f_ulWriteData & 0xFFFF); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCreateFeatureMask - -Description: - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_ulFieldSize Size of the field, in bits. -f_ulFieldBitOffset Bit offset, from the least significant bit. -f_pulFieldMask Resulting mask. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCreateFeatureMask -VOID Oct6100ApiCreateFeatureMask( - IN UINT32 f_ulFieldSize, - IN UINT32 f_ulFieldBitOffset, - OUT PUINT32 f_pulFieldMask ) -{ - UINT32 ulMask; - UINT32 i; - - ulMask = 0; - - /* Create the mask based on the field size. */ - for ( i = 0; i < f_ulFieldSize; i++ ) - { - ulMask <<= 1; - ulMask |= 1; - } - - /* Once the mask is of the desired size, offset it to fit the field */ - /* within the DWORD read. */ - ulMask <<= f_ulFieldBitOffset; - - /* Return the mask. */ - *f_pulFieldMask = ulMask; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiStrStr - -Description: OCT6100 API version of strstr() - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pszSource Source string to analyze. -f_pszString String to look for. -f_pszLastCharPtr Last character in the source string. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiStrStr -unsigned char const *Oct6100ApiStrStr( - IN unsigned char const *f_pszSource, - IN unsigned char const *f_pszString, - IN unsigned char const *f_pszLastCharPtr ) -{ - UINT32 ulCurrentPos; - UINT32 ulStringLength; - UINT32 ulNumMatchingCharFound = 0; - unsigned char const *pchFirstChar = NULL; - UINT32 ulSourceLength; - - if ( f_pszLastCharPtr < f_pszSource ) - return NULL; - - ulSourceLength = (UINT32)( f_pszLastCharPtr - f_pszSource ); - ulStringLength = Oct6100ApiStrLen( f_pszString ); - - for ( ulCurrentPos = 0; ulCurrentPos < ulSourceLength; ulCurrentPos++ ) - { - /* Check if the character matches. */ - if ( f_pszSource[ ulCurrentPos ] == f_pszString[ ulNumMatchingCharFound ] ) - { - if ( ulNumMatchingCharFound == 0 ) - pchFirstChar = ( f_pszSource + ulCurrentPos ); - - ulNumMatchingCharFound++; - - /* Check if the whole string matched. */ - if ( ulNumMatchingCharFound == ulStringLength ) - break; - } - else if ( ulNumMatchingCharFound != 0 ) - { - ulNumMatchingCharFound = 0; - - /* Reset the search, but take a look at the current character. It might */ - /* be the beginning of the string we are looking for. */ - if ( f_pszSource[ ulCurrentPos ] == f_pszString[ ulNumMatchingCharFound ] ) - { - pchFirstChar = ( f_pszSource + ulCurrentPos ); - ulNumMatchingCharFound++; - - /* Check if the whole string matched. */ - /* This check must be done in case we have the 1 character strstr */ - if ( ulNumMatchingCharFound == ulStringLength ) - break; - } - } - } - - if ( ulCurrentPos == ulSourceLength ) - return NULL; - else - return pchFirstChar; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiStrLen - -Description: OCT6100 API version of strlen() - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pszString Source string to count length of. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiStrLen -UINT32 Oct6100ApiStrLen( - IN unsigned char const *f_pszString ) -{ - UINT32 ulCount = 0; - - while( f_pszString[ ulCount ] != '\0' ) - ulCount++; - - return ulCount; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAsciiToHex - -Description: Convert an ASCII character to an hexadecimal value. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_chCharacter ASCII character to convert. -f_pulValue Resulting hexadecimal value. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAsciiToHex -UINT32 Oct6100ApiAsciiToHex( - IN UINT8 f_chCharacter, - OUT PUINT32 f_pulValue ) -{ - switch ( f_chCharacter ) - { - case '0': - (*f_pulValue) = 0x0; - break; - case '1': - (*f_pulValue) = 0x1; - break; - case '2': - (*f_pulValue) = 0x2; - break; - case '3': - (*f_pulValue) = 0x3; - break; - case '4': - (*f_pulValue) = 0x4; - break; - case '5': - (*f_pulValue) = 0x5; - break; - case '6': - (*f_pulValue) = 0x6; - break; - case '7': - (*f_pulValue) = 0x7; - break; - case '8': - (*f_pulValue) = 0x8; - break; - case '9': - (*f_pulValue) = 0x9; - break; - case 'A': - case 'a': - (*f_pulValue) = 0xA; - break; - case 'B': - case 'b': - (*f_pulValue) = 0xB; - break; - case 'C': - case 'c': - (*f_pulValue) = 0xC; - break; - case 'D': - case 'd': - (*f_pulValue) = 0xD; - break; - case 'E': - case 'e': - (*f_pulValue) = 0xE; - break; - case 'F': - case 'f': - (*f_pulValue) = 0xF; - break; - default: - (*f_pulValue) = 0x0; - return cOCT6100_ERR_MISC_ASCII_CONVERSION_FAILED; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiHexToAscii - -Description: Convert an hexadecimal value to an ASCII character. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_ulNumber Hexadecimal value to convert. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiHexToAscii -UINT8 Oct6100ApiHexToAscii( - IN UINT32 f_ulNumber ) -{ - if ( f_ulNumber >= 0xA ) - return (UINT8)( 55 + f_ulNumber ); /* Hex values from 0xA to 0xF */ - else - return (UINT8)( 48 + f_ulNumber ); /* Hex values from 0x0 to 0x9 */ -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRand - -Description: Random number generator. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_ulRange Range of the random number to be generated. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRand -UINT32 Oct6100ApiRand( - IN UINT32 f_ulRange ) -{ - static UINT32 ulRandomSeed = 0x12345678; - UINT32 ulBit0; - - UINT32 i, j; - UINT16 ulWithinRange = FALSE; - - UINT32 ulResult = cOCT6100_ERR_OK; - UINT16 ulLoop; - - UINT32 ulRangeMask; - UINT32 ulAddedValue; - - - ulRangeMask = 1; - ulLoop = TRUE; - i = 1; - - while ( ulLoop ) - { - - ulAddedValue = 2; - for ( j = 1; j < i; j++ ) - ulAddedValue *= 2; - - ulRangeMask = ulRangeMask + ulAddedValue; - - if ( ulRangeMask >= f_ulRange ) - ulLoop = FALSE; - - i++; - } - - while ( !ulWithinRange ) - { - ulBit0 = ((ulRandomSeed >> 19) & 0x1) ^ ((ulRandomSeed >> 16) & 0x1); - ulRandomSeed = ((ulRandomSeed << 1) & 0xFFFFF) | ulBit0; - - ulResult = ulRandomSeed & ulRangeMask; - - if ( ulResult <= f_ulRange ) - ulWithinRange = TRUE; - } - - return ulResult; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c deleted file mode 100644 index 05aff3b9..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c +++ /dev/null @@ -1,1586 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mixer.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to manage the allocation of mixer - blocks in memories. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 42 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_mixer_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_mixer_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventCreate - -Description: This function creates a mixer copy event used to copy - information from one channel port to another channel port. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a mixer copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventCreateDef -UINT32 Oct6100MixerCopyEventCreateDef( - tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ) -{ - f_pCopyEventCreate->pulCopyEventHndl = NULL; - - f_pCopyEventCreate->ulSourceChanHndl = cOCT6100_INVALID_HANDLE; - f_pCopyEventCreate->ulSourcePort = cOCT6100_INVALID_PORT; - - f_pCopyEventCreate->ulDestinationChanHndl = cOCT6100_INVALID_HANDLE; - f_pCopyEventCreate->ulDestinationPort = cOCT6100_INVALID_PORT; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100MixerCopyEventCreate -UINT32 Oct6100MixerCopyEventCreate( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100MixerCopyEventCreateSer( f_pApiInstance, f_pCopyEventCreate ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventDestroy - -Description: This function destroys a mixer copy event used to copy - information from one channel port to another. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventDestroy Pointer to a destroy copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventDestroyDef -UINT32 Oct6100MixerCopyEventDestroyDef( - tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ) -{ - f_pCopyEventDestroy->ulCopyEventHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100MixerCopyEventDestroy -UINT32 Oct6100MixerCopyEventDestroy( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100MixerCopyEventDestroySer( f_pApiInstance, f_pCopyEventDestroy ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetMixerSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of mixer events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pOpenChip User chip configuration. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetMixerSwSizes -UINT32 Oct6100ApiGetMixerSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Calculate the API memory required for the resource entry lists. */ - f_pInstSizes->ulMixerEventList = cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_MIXER_EVENT ); - - /* Calculate memory needed for mixers entry allocation. */ - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_MIXER_EVENTS, &f_pInstSizes->ulMixerEventAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1D; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulMixerEventList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulMixerEventAlloc, ulTempVar ) - - - f_pInstSizes->ulCopyEventList = cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_COPY_EVENT ); - - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_MIXER_EVENTS, &f_pInstSizes->ulCopyEventAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1D; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulCopyEventList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulCopyEventAlloc, ulTempVar ) - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMixerSwInit - -Description: Initializes all elements of the instance structure associated - to the mixer events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This mixer is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMixerSwInit -UINT32 Oct6100ApiMixerSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_MIXER_EVENT pMixerEventList; - PVOID pMixerEventAlloc; - PVOID pCopyEventAlloc; - UINT32 ulTempVar; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*===================================================================*/ - /* Initialize the mixer event list. */ - mOCT6100_GET_MIXER_EVENT_LIST_PNT( pSharedInfo, pMixerEventList ); - - /* Initialize the mixer event allocation software to "all free". */ - Oct6100UserMemSet( pMixerEventList, 0x00, cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_MIXER_EVENT )); - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocInit( &pMixerEventAlloc, cOCT6100_MAX_MIXER_EVENTS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1F; - - /* Now reserve the first entry as the first node. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulTempVar ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_20; - } - - /* Check that we obtain the first event. */ - if ( ulTempVar != 0 ) - return cOCT6100_ERR_FATAL_21; - - /* Now reserve the tail entry. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulTempVar ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_AA; - } - /* Check that we obtain the first event. */ - if ( ulTempVar != 1 ) - return cOCT6100_ERR_FATAL_AB; - - /* Program the head node. */ - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].fReserved = TRUE; - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usNextEventPtr = cOCT6100_MIXER_TAIL_NODE; - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Program the tail node. */ - pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].fReserved = TRUE; - pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].usNextEventPtr = cOCT6100_INVALID_INDEX; - pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Now reserve the entry used for channel recording if the feature is enabled. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - UINT32 ulAllocIndex; - - /* Reserve an entry to copy the desire SOUT signal to the SIN signal of the recording channel. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulAllocIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_90; - } - - pSharedInfo->MixerInfo.usRecordCopyEventIndex = (UINT16)( ulAllocIndex & 0xFFFF ); - - /* Reserve an entry to copy the saved SIN signal of the debugged channel into it's original location. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulAllocIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_90; - } - - pSharedInfo->MixerInfo.usRecordSinEventIndex = (UINT16)( ulAllocIndex & 0xFFFF ); - - /* Configure the SIN event. */ - pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].fReserved = TRUE; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].usNextEventPtr = cOCT6100_MIXER_TAIL_NODE; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Configure the SOUT copy event. */ - pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].fReserved = TRUE; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].usNextEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Program the head node. */ - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usNextEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex; - } - - /* Initialize the copy event list. */ - mOCT6100_GET_COPY_EVENT_ALLOC_PNT( pSharedInfo, pCopyEventAlloc ) - - ulResult = OctapiLlmAllocInit( &pCopyEventAlloc, cOCT6100_MAX_MIXER_EVENTS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B4; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMixerEventAdd - -Description: This function adds a mixer event event to the list of events - based on the event type passed to the function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -f_usEventIndex Index of the event within the API's mixer event list. -f_usEventType Type of mixer event. -f_usDestinationChanIndex Index of the destination channel within the API's - channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMixerEventAdd -UINT32 Oct6100ApiMixerEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType, - IN UINT16 f_usDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_MIXER_EVENT pCurrentEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT16 usTempEventIndex; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCurrentEventEntry, f_usEventIndex ); - - /* Get a pointer to the destination channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, f_usDestinationChanIndex ); - - /* Now proceed according to the event type. */ - switch ( f_usEventType ) - { - case cOCT6100_EVENT_TYPE_SOUT_COPY: - - /* Now insert the Sin copy event */ - if ( pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* The only node in the list before the point where the node needs to */ - /* be inserted is the head node. */ - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - - /* This node will be the first one in the Sout copy section. */ - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = f_usEventIndex; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = f_usEventIndex; - } - else /* pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr != cOCT6100_INVALID_INDEX */ - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = f_usEventIndex; - } - - break; - - case cOCT6100_EVENT_TYPE_SIN_COPY: - - /* Now insert the Sin copy event. */ - if ( pSharedInfo->MixerInfo.usFirstSinCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* This is the first Sin copy event. We must find the event that comes before */ - /* the event we want to add. First let's check for a bridge event. */ - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == cOCT6100_INVALID_INDEX ) - { - /* No event in the bridge section, now let's check in the Sout copy section. */ - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* The only node in the list then is the head node. */ - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastBridgeEventPtr; - } - - /* This node will be the first one in the Sin copy section. */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = f_usEventIndex; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = f_usEventIndex; - } - else /* pSharedInfo->MixerInfo.usFirstSinCopyEventPtr != cOCT6100_INVALID_INDEX */ - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSinCopyEventPtr; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = f_usEventIndex; - } - - break; - - default: - return cOCT6100_ERR_FATAL_AF; - - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - /*=======================================================================*/ - /* Program the Copy event. */ - - /* Set the Copy event first. */ - pCurrentEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_COPY; - pCurrentEventEntry->usNextEventPtr = pTempEventEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = pCurrentEventEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Modify the previous node. */ - - /* Set the last Sub-store entry. */ - pTempEventEntry->usNextEventPtr = f_usEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = f_usEventIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Save the destination channel index, needed when removing the event from the mixer. */ - pCurrentEventEntry->usDestinationChanIndex = f_usDestinationChanIndex; - - /* Mark the entry as reserved. */ - pCurrentEventEntry->fReserved = TRUE; - - /* Increment the event count on that particular destination channel */ - pDestinationEntry->usMixerEventCnt++; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMixerEventRemove - -Description: This function removes a mixer event event from the list of events based - on the event type passed to the function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEventIndex Index of event within the API's mixer event list. -f_usEventType Type of mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMixerEventRemove -UINT32 Oct6100ApiMixerEventRemove( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_MIXER_EVENT pCurrentEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - tOCT6100_WRITE_BURST_PARAMS BurstWriteParams; - tOCT6100_WRITE_PARAMS WriteParams; - BOOL fFirstSinCopyEvent = FALSE; - UINT32 ulResult; - UINT16 usTempEventIndex; - UINT32 ulLoopCount = 0; - UINT16 ausWriteData[ 4 ] = { 0 }; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - BurstWriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstWriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - BurstWriteParams.pusWriteData = ausWriteData; - BurstWriteParams.ulWriteLength = 4; - - /* Get a pointer to the event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCurrentEventEntry, f_usEventIndex ); - - /* Get the pointer to the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, pCurrentEventEntry->usDestinationChanIndex ); - - /* Now proceed according to the event type. */ - switch ( f_usEventType ) - { - case cOCT6100_EVENT_TYPE_SOUT_COPY: - - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr ) - { - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - /* Now insert the Sin copy event. */ - usTempEventIndex = pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr; - } - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - while( pTempEventEntry->usNextEventPtr != f_usEventIndex ) - { - usTempEventIndex = pTempEventEntry->usNextEventPtr; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_B2; - } - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr ) - { - if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - /* This event was the only of the list.*/ - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - } - else - { - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = pCurrentEventEntry->usNextEventPtr; - } - } - else if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = usTempEventIndex; - } - /*=======================================================================*/ - - break; - - - case cOCT6100_EVENT_TYPE_SIN_COPY: - - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSinCopyEventPtr ) - { - fFirstSinCopyEvent = TRUE; - - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr != cOCT6100_INVALID_INDEX ) - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastBridgeEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr != cOCT6100_INVALID_INDEX ) - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - else - { - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - } - else - { - /* Now insert the Sin copy event. */ - usTempEventIndex = pSharedInfo->MixerInfo.usFirstSinCopyEventPtr; - } - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - /* If we are not the first event of the Sin copy list. */ - if ( fFirstSinCopyEvent == FALSE ) - { - while( pTempEventEntry->usNextEventPtr != f_usEventIndex ) - { - usTempEventIndex = pTempEventEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_B1; - } - } - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSinCopyEventPtr ) - { - if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSinCopyEventPtr ) - { - /* This event was the only of the list. */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = cOCT6100_INVALID_INDEX; - } - else - { - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pCurrentEventEntry->usNextEventPtr; - } - } - else if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSinCopyEventPtr ) - { - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = usTempEventIndex; - } - /*=======================================================================*/ - - break; - - default: - return cOCT6100_ERR_FATAL_B0; - - } - - /*=======================================================================*/ - /* Modify the previous event. */ - - pTempEventEntry->usNextEventPtr = pCurrentEventEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = pTempEventEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the current event. */ - - BurstWriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_WRITE_BURST_API( BurstWriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Decrement the mixer event count active on that channel. */ - pDestinationEntry->usMixerEventCnt--; - - /*=======================================================================*/ - - - /*=======================================================================*/ - - /* This index of this channel is not valid anymore! */ - pCurrentEventEntry->usDestinationChanIndex = cOCT6100_INVALID_INDEX; - - /* Mark this entry as free. */ - pCurrentEventEntry->fReserved = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventCreateSer - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a create copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventCreateSer -UINT32 Oct6100MixerCopyEventCreateSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ) -{ - UINT16 usCopyEventIndex = 0; - UINT16 usMixerEventIndex = 0; - UINT16 usSourceChanIndex; - UINT16 usDestinationChanIndex; - UINT32 ulResult; - - /* Check the user's configuration of the copy event for errors. */ - ulResult = Oct6100ApiCheckCopyEventCreateParams( f_pApiInstance, - f_pCopyEventCreate, - &usSourceChanIndex, - &usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the copy event. */ - ulResult = Oct6100ApiReserveCopyEventCreateResources( f_pApiInstance, - &usCopyEventIndex, - &usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiWriteCopyEventCreateStructs( f_pApiInstance, - f_pCopyEventCreate, - usMixerEventIndex, - usSourceChanIndex, - usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiUpdateCopyEventCreateEntry( f_pApiInstance, - f_pCopyEventCreate, - usCopyEventIndex, - usMixerEventIndex, - usSourceChanIndex, - usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckCopyEventCreateParams - -Description: Checks the user's parameter passed to the create - copy event function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a create copy event structure. -f_pusSourceChanIndex Pointer to the index of the input channel. -f_pusDestinationChanIndex Pointer to the index of the output channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckCopyEventCreateParams -UINT32 Oct6100ApiCheckCopyEventCreateParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - OUT PUINT16 f_pusSourceChanIndex, - OUT PUINT16 f_pusDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pSourceEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - UINT32 ulEntryOpenCnt; - - /* Obtain shared resources pointer. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - if ( f_pCopyEventCreate->pulCopyEventHndl == NULL ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - if ( f_pCopyEventCreate->ulSourceChanHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - if ( f_pCopyEventCreate->ulDestinationChanHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - - if ( f_pCopyEventCreate->ulSourcePort != cOCT6100_CHANNEL_PORT_RIN && - f_pCopyEventCreate->ulSourcePort != cOCT6100_CHANNEL_PORT_SIN ) - return cOCT6100_ERR_MIXER_SOURCE_PORT; - - if ( f_pCopyEventCreate->ulDestinationPort != cOCT6100_CHANNEL_PORT_RIN && - f_pCopyEventCreate->ulDestinationPort != cOCT6100_CHANNEL_PORT_SIN ) - return cOCT6100_ERR_MIXER_DESTINATION_PORT; - - /*=======================================================================*/ - /* Verify the first channel handle. */ - - if ( (f_pCopyEventCreate->ulSourceChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - - *f_pusSourceChanIndex = (UINT16)( f_pCopyEventCreate->ulSourceChanHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusSourceChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSourceEntry, *f_pusSourceChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pCopyEventCreate->ulSourceChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pSourceEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pSourceEntry->byEntryOpenCnt ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - if ( pSourceEntry->CodecConfig.byDecoderPort == f_pCopyEventCreate->ulSourcePort ) - return cOCT6100_ERR_MIXER_SOURCE_ADPCM_RESOURCES_ACTIVATED; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Verify the second channel handle. */ - - if ( (f_pCopyEventCreate->ulDestinationChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - - *f_pusDestinationChanIndex = (UINT16)( f_pCopyEventCreate->ulDestinationChanHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusDestinationChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, *f_pusDestinationChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pCopyEventCreate->ulDestinationChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pDestinationEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pDestinationEntry->byEntryOpenCnt ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - if ( pDestinationEntry->CodecConfig.byDecoderPort == f_pCopyEventCreate->ulDestinationPort ) - return cOCT6100_ERR_MIXER_DEST_ADPCM_RESOURCES_ACTIVATED; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveCopyEventCreateResources - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusCopyEntryIndex Pointer to the index of the copy entry within the API's list. -f_pusCopyEventIndex Pointer to the index of the mixer copy event. -. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveCopyEventCreateResources -UINT32 Oct6100ApiReserveCopyEventCreateResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusCopyEntryIndex, - IN OUT PUINT16 f_pusCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*===============================================================================*/ - /* Verify and reserve the resources that might already be allocated. */ - - ulResult = Oct6100ApiReserveCopyEventEntry( f_pApiInstance, - f_pusCopyEntryIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the source copy event for the first channel. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - f_pusCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Reserve the Sin copy event for the first channel. */ - ulTempVar = Oct6100ApiReleaseCopyEventEntry ( f_pApiInstance, - *f_pusCopyEntryIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteCopyEventCreateStructs - -Description: Performs all the required structure writes to configure the - new copy event - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a create copy event structure. -f_usMixerEventIndex Index of the copy event within the mixer memory. -f_usSourceChanIndex Index of the source channel within the API's channel list. -f_usDestinationChanIndex Index of the destination channel within the API's channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteCopyEventCreateStructs -UINT32 Oct6100ApiWriteCopyEventCreateStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pSourceEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==============================================================================*/ - /* Get a pointer to the two channel entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSourceEntry, f_usSourceChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, f_usDestinationChanIndex ); - - /*==============================================================================*/ - /* Configure the TSST control memory and add the Sin copy event if necessary. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usMixerEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - - if ( f_pCopyEventCreate->ulSourcePort == cOCT6100_CHANNEL_PORT_RIN ) - { - WriteParams.usWriteData |= pSourceEntry->usRinRoutTsiMemIndex; - WriteParams.usWriteData |= pSourceEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - else /* f_pCopyEventCreate->ulSourcePort == cOCT6100_CHANNEL_PORT_SIN */ - { - if ( pSourceEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.usWriteData |= pSourceEntry->usExtraSinTsiMemIndex; - } - else - { - WriteParams.usWriteData |= pSourceEntry->usSinSoutTsiMemIndex; - } - - WriteParams.usWriteData |= pSourceEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - - if ( f_pCopyEventCreate->ulDestinationPort == cOCT6100_CHANNEL_PORT_RIN ) - { - WriteParams.usWriteData = (UINT16)( pDestinationEntry->usRinRoutTsiMemIndex ); - } - else /* f_pCopyEventCreate->ulDestinationPort == cOCT6100_CHANNEL_PORT_SIN */ - { - WriteParams.usWriteData = (UINT16)( pDestinationEntry->usSinSoutTsiMemIndex ); - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Now insert the event into the event list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usMixerEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Increment the copy event count on this channel. */ - pDestinationEntry->usCopyEventCnt++; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateCopyEventCreateEntry - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -f_pCopyEventCreate Pointer to a create copy event structure. -f_usCopyEventIndex Index of the copy event within the API's event list. -f_usMixerEventIndex Index of the copy event within the mixer memory. -f_usSourceChanIndex Index of the source channel within the API's channel list. -f_usDestinationChanIndex Index of the destination channel within the API's channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateCopyEventCreateEntry -UINT32 Oct6100ApiUpdateCopyEventCreateEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_COPY_EVENT pCopyEventEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex ); - - /*=======================================================================*/ - /* Copy the channel's configuration and allocated resources. */ - - /* Save the channel info in the copy event. */ - pCopyEventEntry->usSourceChanIndex = f_usSourceChanIndex; - pCopyEventEntry->bySourcePort = (UINT8)( f_pCopyEventCreate->ulSourcePort & 0xFF ); - - pCopyEventEntry->usDestinationChanIndex = f_usDestinationChanIndex; - pCopyEventEntry->byDestinationPort = (UINT8)( f_pCopyEventCreate->ulDestinationPort & 0xFF ); - - pCopyEventEntry->usMixerEventIndex = f_usMixerEventIndex; - - /*=======================================================================*/ - - /* Form handle returned to user. */ - *f_pCopyEventCreate->pulCopyEventHndl = cOCT6100_HNDL_TAG_COPY_EVENT | (pCopyEventEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usCopyEventIndex; - - /* Finally, mark the event as used. */ - pCopyEventEntry->fReserved = TRUE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventDestroySer - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventDestroy Pointer to a destroy copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventDestroySer -UINT32 Oct6100MixerCopyEventDestroySer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ) -{ - UINT16 usCopyEventIndex; - UINT16 usMixerEventIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertCopyEventDestroyParams( f_pApiInstance, - f_pCopyEventDestroy, - &usCopyEventIndex, - &usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiInvalidateCopyEventStructs( f_pApiInstance, - usCopyEventIndex, - usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiReleaseCopyEventResources( f_pApiInstance, - usCopyEventIndex, - usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pCopyEventDestroy->ulCopyEventHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertCopyEventDestroyParams - -Description: - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventDestroy Pointer to a destroy copy event structure. -f_pusCopyEventIndex Pointer to the index of the copy event in the API. -f_pusMixerEventIndex Pointer to the index of the copy event in the mixer memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertCopyEventDestroyParams -UINT32 Oct6100ApiAssertCopyEventDestroyParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy, - IN OUT PUINT16 f_pusCopyEventIndex, - IN OUT PUINT16 f_pusMixerEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_COPY_EVENT pCopyEventEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pCopyEventDestroy->ulCopyEventHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_COPY_EVENT ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - *f_pusCopyEventIndex = (UINT16)( f_pCopyEventDestroy->ulCopyEventHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusCopyEventIndex >= cOCT6100_MAX_MIXER_EVENTS ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - /*=======================================================================*/ - - mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, *f_pusCopyEventIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pCopyEventDestroy->ulCopyEventHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pCopyEventEntry->fReserved != TRUE ) - return cOCT6100_ERR_MIXER_EVENT_NOT_OPEN; - if ( ulEntryOpenCnt != pCopyEventEntry->byEntryOpenCnt ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - /*=======================================================================*/ - - /* Return the index of the associated event. */ - *f_pusMixerEventIndex = pCopyEventEntry->usMixerEventIndex; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateCopyEventStructs - -Description: Destroy the link between the two channels. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usCopyEventIndex Index of the copy event in the API. -f_usMixerEventIndex Index of the copy event in the mixer memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateCopyEventStructs -UINT32 Oct6100ApiInvalidateCopyEventStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Clear the Copy event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usMixerEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - f_usMixerEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseCopyEventResources - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usCopyEventIndex Index of the copy event in the API. -f_usMixerEventIndex Index of the copy event in the mixer memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseCopyEventResources -UINT32 Oct6100ApiReleaseCopyEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pDestinationEntry; - tPOCT6100_API_COPY_EVENT pCopyEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex ); - - ulResult = Oct6100ApiReleaseCopyEventEntry( f_pApiInstance, f_usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_AC; - - /* Relese the SIN copy event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B3; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, f_usMixerEventIndex ); - - /* Invalidate the entry. */ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, pCopyEventEntry->usDestinationChanIndex ); - - /* Decrement the copy event count on this channel. */ - pDestinationEntry->usCopyEventCnt--; - - /*=======================================================================*/ - - /* Mark the event entry as unused. */ - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->byEntryOpenCnt++; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveMixerEventEntry - -Description: Reserves a free entry in the mixer event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveMixerEventEntry -UINT32 Oct6100ApiReserveMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ) -{ - PVOID pMixerEventAlloc; - UINT32 ulResult; - UINT32 ulEventIndex; - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED; - else - return cOCT6100_ERR_FATAL_2B; - } - - *f_pusEventIndex = (UINT16)( ulEventIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseMixerEventEntry - -Description: Release an entry from the mixer event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseMixerEventEntry -UINT32 Oct6100ApiReleaseMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ) -{ - PVOID pMixerEventAlloc; - UINT32 ulResult; - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocDealloc( pMixerEventAlloc, f_usEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2C; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetFreeMixerEventCnt - -Description: Retrieve the number of events left in the list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pulFreeEventCnt How many events left. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetFreeMixerEventCnt -UINT32 Oct6100ApiGetFreeMixerEventCnt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulFreeEventCnt ) -{ - PVOID pMixerEventAlloc; - UINT32 ulResult; - UINT32 ulAllocatedEvents; - UINT32 ulAvailableEvents; - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocInfo( pMixerEventAlloc, &ulAllocatedEvents, &ulAvailableEvents ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E8; - - /* Return number of free events. */ - *f_pulFreeEventCnt = ulAvailableEvents; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveCopyEventEntry - -Description: Reserves a free entry in the copy event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveCopyEventEntry -UINT32 Oct6100ApiReserveCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ) -{ - PVOID pCopyEventAlloc; - UINT32 ulResult; - UINT32 ulEventIndex; - - mOCT6100_GET_COPY_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pCopyEventAlloc ) - - ulResult = OctapiLlmAllocAlloc( pCopyEventAlloc, &ulEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MIXER_ALL_COPY_EVENT_ENTRY_OPENED; - else - return cOCT6100_ERR_FATAL_AD; - } - - *f_pusEventIndex = (UINT16)( ulEventIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseCopyEventEntry - -Description: Release an entry from the copy event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseCopyEventEntry -UINT32 Oct6100ApiReleaseCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ) -{ - PVOID pCopyEventAlloc; - UINT32 ulResult; - - mOCT6100_GET_COPY_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pCopyEventAlloc ) - - ulResult = OctapiLlmAllocDealloc( pCopyEventAlloc, f_usEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_AE; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c deleted file mode 100644 index 5d27c3c9..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c +++ /dev/null @@ -1,921 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_phasing_tsst.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open and close phasing TSSTs. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 46 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_phasing_tsst_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_phasing_tsst_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_phasing_tsst_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstOpen - -Description: This function opens a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstOpenDef -UINT32 Oct6100PhasingTsstOpenDef( - tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - f_pPhasingTsstOpen->pulPhasingTsstHndl = NULL; - - f_pPhasingTsstOpen->ulTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pPhasingTsstOpen->ulStream = cOCT6100_INVALID_STREAM; - - f_pPhasingTsstOpen->ulPhasingLength = 88; - - - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100PhasingTsstOpen -UINT32 Oct6100PhasingTsstOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100PhasingTsstOpenSer( f_pApiInstance, f_pPhasingTsstOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstClose - -Description: This function closes a phasing TSST - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstClose Pointer to phasing TSST close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstCloseDef -UINT32 Oct6100PhasingTsstCloseDef( - tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) -{ - f_pPhasingTsstClose->ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100PhasingTsstClose -UINT32 Oct6100PhasingTsstClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100PhasingTsstCloseSer( f_pApiInstance, f_pPhasingTsstClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPhasingTsstSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of Phasing TSSTs. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPhasingTsstSwSizes -UINT32 Oct6100ApiGetPhasingTsstSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine the amount of memory required for the API phasing TSST list. */ - f_pInstSizes->ulPhasingTsstList = f_pOpenChip->ulMaxPhasingTssts * sizeof( tOCT6100_API_PHASING_TSST ); - - if ( f_pOpenChip->ulMaxPhasingTssts > 0 ) - { - /* Calculate memory needed for Phasing TSST API memory allocation */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxPhasingTssts, &f_pInstSizes->ulPhasingTsstAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_38; - } - else - { - f_pInstSizes->ulPhasingTsstAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPhasingTsstList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPhasingTsstAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiPhasingTsstSwInit - -Description: Initializes all elements of the instance structure associated - to phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiPhasingTsstSwInit -UINT32 Oct6100ApiPhasingTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_PHASING_TSST pPhasingTsstList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMaxPhasingTssts; - PVOID pPhasingTsstAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the phasing TSST API list. */ - ulMaxPhasingTssts = pSharedInfo->ChipConfig.usMaxPhasingTssts; - - /* Set all entries in the phasing TSST list to unused. */ - mOCT6100_GET_PHASING_TSST_LIST_PNT( pSharedInfo, pPhasingTsstList ) - - /* Clear the memory */ - Oct6100UserMemSet( pPhasingTsstList, 0x00, sizeof(tOCT6100_API_PHASING_TSST) * ulMaxPhasingTssts ); - - /* Initialize the phasing TSST allocation software to "all free". */ - if ( ulMaxPhasingTssts > 0 ) - { - mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingTsstAlloc ) - - ulResult = OctapiLlmAllocInit( &pPhasingTsstAlloc, ulMaxPhasingTssts ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_39; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstOpenSer - -Description: Opens a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstOpenSer -UINT32 Oct6100PhasingTsstOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - UINT16 usPhasingIndex; - UINT16 usTsstIndex; - UINT32 ulResult; - - /* Check the user's configuration of the phasing TSST for errors. */ - ulResult = Oct6100ApiCheckPhasingParams( f_pApiInstance, f_pPhasingTsstOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the phasing TSST. */ - ulResult = Oct6100ApiReservePhasingResources( f_pApiInstance, f_pPhasingTsstOpen, &usPhasingIndex, &usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the phasing TSST. */ - ulResult = Oct6100ApiWritePhasingStructs( f_pApiInstance, f_pPhasingTsstOpen, usPhasingIndex, usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new phasing TSST entry in the API list. */ - ulResult = Oct6100ApiUpdatePhasingEntry( f_pApiInstance, f_pPhasingTsstOpen, usPhasingIndex, usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPhasingParams - -Description: Checks the user's phasing TSST open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPhasingParams -UINT32 Oct6100ApiCheckPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPhasingTssts == 0 ) - return cOCT6100_ERR_PHASING_TSST_DISABLED; - - if ( f_pPhasingTsstOpen->pulPhasingTsstHndl == NULL ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - /* Check the phasing length. */ - if ( f_pPhasingTsstOpen->ulPhasingLength > 240 || - f_pPhasingTsstOpen->ulPhasingLength < 2 ) - return cOCT6100_ERR_PHASING_TSST_PHASING_LENGTH; - - - - /* Check the input TDM streams, timeslots component for errors. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - cOCT6100_NUMBER_TSSTS_1, - f_pPhasingTsstOpen->ulTimeslot, - f_pPhasingTsstOpen->ulStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_PHASING_TSST_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_PHASING_TSST_STREAM; - } - else - { - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReservePhasingResources - -Description: Reserves all resources needed for the new phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST configuration structure. -f_pusPhasingIndex Allocated entry in Phasing TSST API list. -f_pusTsstIndex TSST memory index of the counter. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReservePhasingResources -UINT32 Oct6100ApiReservePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempVar; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the phasing TSST list. */ - ulResult = Oct6100ApiReservePhasingEntry( f_pApiInstance, - f_pusPhasingIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the input TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pPhasingTsstOpen->ulTimeslot, - f_pPhasingTsstOpen->ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - f_pusTsstIndex, - NULL ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the previously reserved entries. */ - ulTempVar = Oct6100ApiReleasePhasingEntry( f_pApiInstance, *f_pusPhasingIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - return ulResult; - } - } - else - { - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWritePhasingStructs - -Description: Performs all the required structure writes to configure the - new phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST configuration structure. -f_usPhasingIndex Allocated entry in phasing TSST API list. -f_usTsstIndex TSST memory index of the counter. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWritePhasingStructs -UINT32 Oct6100ApiWritePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulPhasingTsstChariotMemIndex; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Configure the TSST control memory of the phasing TSST. */ - - /* Find the asociated entry in the chariot memory for the phasing TSST. */ - ulPhasingTsstChariotMemIndex = cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY + f_usPhasingIndex; - - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_INPUT_TSST; - WriteParams.usWriteData |= ulPhasingTsstChariotMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Write the phasing length of the TSST in the ADPCM / MIXER memory. */ - - WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_PHASE_SIZE_BASE_ADD + ( f_usPhasingIndex * 2 ); - WriteParams.usWriteData = (UINT16)( f_pPhasingTsstOpen->ulPhasingLength ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdatePhasingEntry - -Description: Updates the new phasing TSST in the API phasing TSST list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open structure. -f_usPhasingIndex Allocated entry in phasing TSST API list. -f_usTsstIndex TSST memory index of the counter. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdatePhasingEntry -UINT32 Oct6100ApiUpdatePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ) -{ - tPOCT6100_API_PHASING_TSST pPhasingTsstEntry; - - /*================================================================================*/ - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingTsstEntry, f_usPhasingIndex ) - - /* Copy the phasing TSST's configuration and allocated resources. */ - pPhasingTsstEntry->usTimeslot = (UINT16)( f_pPhasingTsstOpen->ulTimeslot & 0xFFFF ); - pPhasingTsstEntry->usStream = (UINT16)( f_pPhasingTsstOpen->ulStream & 0xFFFF ); - - pPhasingTsstEntry->usPhasingLength = (UINT16)( f_pPhasingTsstOpen->ulPhasingLength & 0xFFFF ); - - /* Store hardware related information. */ - pPhasingTsstEntry->usPhasingTsstIndex = f_usTsstIndex; - - /* Form handle returned to user. */ - *f_pPhasingTsstOpen->pulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsstEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usPhasingIndex; - pPhasingTsstEntry->usDependencyCnt = 0; /* Nobody is using the phasing TSST.*/ - - /* Finally, mark the phasing TSST as open. */ - pPhasingTsstEntry->fReserved = TRUE; - - /* Increment the number of phasing TSSTs opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPhasingTssts++; - - /*================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstCloseSer - -Description: Closes a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstClose Pointer to phasing TSST close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstCloseSer -UINT32 Oct6100PhasingTsstCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) -{ - UINT16 usPhasingIndex; - UINT16 usTsstIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertPhasingParams( f_pApiInstance, f_pPhasingTsstClose, &usPhasingIndex, &usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the phasing TSST. */ - ulResult = Oct6100ApiInvalidatePhasingStructs( f_pApiInstance, usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the phasing TSST. */ - ulResult = Oct6100ApiReleasePhasingResources( f_pApiInstance, usPhasingIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pPhasingTsstClose->ulPhasingTsstHndl = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertPhasingParams - -Description: Validate the handle given by the user and verify the state of - the phasing TSST about to be closed. Also returns all - required information to deactivate the phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstClose Pointer to phasing TSST close structure. -f_pusPhasingIndex Index of the phasing TSST structure in the API list. -f_pusTsstIndex Index of the entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertPhasingParams -UINT32 Oct6100ApiAssertPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_PHASING_TSST pPhasingEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pPhasingTsstClose->ulPhasingTsstHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_PHASING_TSST ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - *f_pusPhasingIndex = (UINT16)( f_pPhasingTsstClose->ulPhasingTsstHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusPhasingIndex >= pSharedInfo->ChipConfig.usMaxPhasingTssts ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the phasing TSST's list entry. */ - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingEntry, *f_pusPhasingIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pPhasingTsstClose->ulPhasingTsstHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pPhasingEntry->fReserved != TRUE ) - return cOCT6100_ERR_PHASING_TSST_NOT_OPEN; - if ( pPhasingEntry->usDependencyCnt != 0 ) - return cOCT6100_ERR_PHASING_TSST_ACTIVE_DEPENDENCIES; - if ( ulEntryOpenCnt != pPhasingEntry->byEntryOpenCnt ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - /* Return info needed to close the phasing TSST and release all resources. */ - *f_pusTsstIndex = pPhasingEntry->usPhasingTsstIndex; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidatePhasingStructs - -Description: Closes a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usTsstIndex Index of the entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidatePhasingStructs -UINT32 Oct6100ApiInvalidatePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Deactivate the TSST control memory. */ - - /* Set the input TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleasePhasingResources - -Description: Release and clear the API entry associated to the phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usPhasingIndex Index of the phasing TSST in the API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleasePhasingResources -UINT32 Oct6100ApiReleasePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usPhasingIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_PHASING_TSST pPhasingEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingEntry, f_usPhasingIndex ); - - /* Release the entry in the phasing TSST list. */ - ulResult = Oct6100ApiReleasePhasingEntry( f_pApiInstance, f_usPhasingIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the entry. */ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pPhasingEntry->usTimeslot, - pPhasingEntry->usStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); /* Release the TSST entry */ - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL; - } - } - else - { - return ulResult; - } - - /*=============================================================*/ - /* Update the phasing TSST's list entry. */ - - /* Mark the entry as closed. */ - pPhasingEntry->fReserved = FALSE; - pPhasingEntry->byEntryOpenCnt++; - - /* Decrement the number of phasing TSSTs opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPhasingTssts--; - - /*=============================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReservePhasingEntry - -Description: Reserves a phasing TSST API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusPhasingIndex Resulting index reserved in the phasing TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReservePhasingEntry -UINT32 Oct6100ApiReservePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusPhasingIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pPhasingAlloc; - UINT32 ulResult; - UINT32 ulPhasingIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingAlloc ) - - ulResult = OctapiLlmAllocAlloc( pPhasingAlloc, &ulPhasingIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_PHASING_TSST_ALL_ENTRIES_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_3A; - } - - *f_pusPhasingIndex = (UINT16)( ulPhasingIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleasePhasingEntry - -Description: Releases the specified phasing TSST API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usPhasingIndex Index reserved in the phasing TSST API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleasePhasingEntry -UINT32 Oct6100ApiReleasePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usPhasingIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pPhasingAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingAlloc ) - - ulResult = OctapiLlmAllocDealloc( pPhasingAlloc, f_usPhasingIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_3B; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c deleted file mode 100644 index 57fda7ca..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c +++ /dev/null @@ -1,3350 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_playout_buf.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to manage buffer playout. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 109 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_playout_buf_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutLoad - -Description: This function loads a playout buffer into external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer playout load structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutLoadDef -UINT32 Oct6100BufferPlayoutLoadDef( - tPOCT6100_BUFFER_LOAD f_pBufferLoad ) -{ - f_pBufferLoad->pbyBufferPattern = NULL; - f_pBufferLoad->ulBufferSize = 128; - f_pBufferLoad->ulBufferPcmLaw = cOCT6100_PCM_U_LAW; - - f_pBufferLoad->pulBufferIndex = NULL; - f_pBufferLoad->pulPlayoutFreeMemSize = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutLoad -UINT32 Oct6100BufferPlayoutLoad( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_LOAD f_pBufferLoad ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferLoadSer( f_pApiInstance, f_pBufferLoad, TRUE, cOCT6100_INVALID_INDEX ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutLoadBlockInit - -Description: This function allows the user to initialize loading a buffer - into external memory using blocks. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlockInit Pointer to buffer playout load block init structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutLoadBlockInitDef -UINT32 Oct6100BufferPlayoutLoadBlockInitDef( - tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ) -{ - f_pBufferLoadBlockInit->ulBufferSize = 128; - f_pBufferLoadBlockInit->ulBufferPcmLaw = cOCT6100_PCM_U_LAW; - - f_pBufferLoadBlockInit->pulBufferIndex = NULL; - f_pBufferLoadBlockInit->pulPlayoutFreeMemSize = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutLoadBlockInit -UINT32 Oct6100BufferPlayoutLoadBlockInit( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferLoadBlockInitSer( f_pApiInstance, f_pBufferLoadBlockInit ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutLoadBlock - -Description: This function allows the user to load a buffer block into - external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlock Pointer to buffer playout load block structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutLoadBlockDef -UINT32 Oct6100BufferPlayoutLoadBlockDef( - tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ) -{ - f_pBufferLoadBlock->ulBufferIndex = cOCT6100_INVALID_VALUE; - f_pBufferLoadBlock->ulBlockLength = cOCT6100_INVALID_VALUE; - f_pBufferLoadBlock->ulBlockOffset = cOCT6100_INVALID_VALUE; - - f_pBufferLoadBlock->pbyBufferPattern = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutLoadBlock -UINT32 Oct6100BufferPlayoutLoadBlock( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferLoadBlockSer( f_pApiInstance, f_pBufferLoadBlock ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutUnload - -Description: This function unloads a playout buffer from external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferUnload Pointer to buffer playout unload structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutUnloadDef -UINT32 Oct6100BufferPlayoutUnloadDef( - tPOCT6100_BUFFER_UNLOAD f_pBufferUnload ) -{ - f_pBufferUnload->ulBufferIndex = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutUnload -UINT32 Oct6100BufferPlayoutUnload( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_UNLOAD f_pBufferUnload ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferUnloadSer( f_pApiInstance, f_pBufferUnload, TRUE ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutAdd - -Description: This function adds a buffer to a port's playout list on the - selected channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutAddDef -UINT32 Oct6100BufferPlayoutAddDef( - tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ) -{ - f_pBufferPlayoutAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pBufferPlayoutAdd->ulBufferIndex = cOCT6100_INVALID_VALUE; - - f_pBufferPlayoutAdd->ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - f_pBufferPlayoutAdd->ulMixingMode = cOCT6100_MIXING_MINUS_6_DB; - f_pBufferPlayoutAdd->lGainDb = 0; - - f_pBufferPlayoutAdd->fRepeat = FALSE; - f_pBufferPlayoutAdd->ulRepeatCount = cOCT6100_REPEAT_INFINITELY; - - f_pBufferPlayoutAdd->ulDuration = cOCT6100_INVALID_VALUE; - - f_pBufferPlayoutAdd->ulBufferLength = cOCT6100_AUTO_SELECT; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutAdd -UINT32 Oct6100BufferPlayoutAdd( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutAddSer( f_pApiInstance, f_pBufferPlayoutAdd ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStart - -Description: This function enables playout of the specified buffer on the - requested channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStartDef -UINT32 Oct6100BufferPlayoutStartDef( - tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart ) -{ - f_pBufferPlayoutStart->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pBufferPlayoutStart->ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - f_pBufferPlayoutStart->fNotifyOnPlayoutStop = FALSE; - f_pBufferPlayoutStart->ulUserEventId = cOCT6100_INVALID_VALUE; - f_pBufferPlayoutStart->fAllowStartWhileActive = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutStart -UINT32 Oct6100BufferPlayoutStart( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutStartSer( f_pApiInstance, f_pBufferPlayoutStart, cOCT6100_BUFFER_PLAYOUT_EVENT_STOP ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStop - -Description: This function disables playout of a buffer on the specified - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStopDef -UINT32 Oct6100BufferPlayoutStopDef( - tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ) -{ - f_pBufferPlayoutStop->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pBufferPlayoutStop->ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - f_pBufferPlayoutStop->fStopCleanly = TRUE; - f_pBufferPlayoutStop->pfAlreadyStopped = NULL; - f_pBufferPlayoutStop->pfNotifyOnPlayoutStop = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutStop -UINT32 Oct6100BufferPlayoutStop( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutStopSer( f_pApiInstance, f_pBufferPlayoutStop ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPlayoutBufferSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of playout buffers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPlayoutBufferSwSizes -UINT32 Oct6100ApiGetPlayoutBufferSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Calculate memory needed for playout buffer list. */ - f_pInstSizes->ulPlayoutBufList = f_pOpenChip->ulMaxPlayoutBuffers * sizeof( tOCT6100_API_BUFFER ); - - f_pInstSizes->ulPlayoutBufMemoryNodeList = 0; - - /* Calculate memory needed for playout buffer allocation software. */ - if ( f_pOpenChip->ulMaxPlayoutBuffers > 0 ) - { - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxPlayoutBuffers, &f_pInstSizes->ulPlayoutBufAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3C; - - f_pInstSizes->ulPlayoutBufMemoryNodeList = 2 * f_pOpenChip->ulMaxPlayoutBuffers * sizeof( tOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE ); - } - else - { - f_pInstSizes->ulPlayoutBufAlloc = 0; - } - - /* Calculate memory needed for list and allocation software serialization. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPlayoutBufList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPlayoutBufAlloc, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPlayoutBufMemoryNodeList, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiPlayoutBufferSwInit - -Description: Initializes all elements of the instance structure associated - to playout buffers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiPlayoutBufferSwInit -UINT32 Oct6100ApiPlayoutBufferSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER pBufferList; - PVOID pBufferPlayoutAlloc; - UINT32 ulMaxBufferPlayout; - UINT32 ulResult, i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the maximum number of buffer playout. */ - ulMaxBufferPlayout = pSharedInfo->ChipConfig.usMaxPlayoutBuffers; - - /* Set all entries in the buffer playout list to unused. */ - mOCT6100_GET_BUFFER_LIST_PNT( pSharedInfo, pBufferList ) - - for ( i = 0; i < ulMaxBufferPlayout; i++ ) - { - pBufferList[ i ].fReserved = FALSE; - pBufferList[ i ].ulBufferSize = 0; - pBufferList[ i ].ulBufferBase = cOCT6100_INVALID_VALUE; - pBufferList[ i ].usDependencyCnt = 0; - pBufferList[ i ].byBufferPcmLaw = cOCT6100_PCM_U_LAW; - - } - - /* Initialize the buffer playout allocation software to "all free". */ - if ( ulMaxBufferPlayout > 0 ) - { - mOCT6100_GET_BUFFER_ALLOC_PNT( pSharedInfo, pBufferPlayoutAlloc ) - - ulResult = OctapiLlmAllocInit( &pBufferPlayoutAlloc, ulMaxBufferPlayout ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3D; - } - - /* Initialize the amount of free memory used by playout. */ - f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed = 0; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferLoadSer - -Description: Loads a buffer in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. The handle - identifying the buffer in all future function calls is - returned in this structure. - -f_fReserveListStruct Flag indicating if a list structure should be reserved - or if the structure has been reserved before. If this - is set, the f_ulBufIndex variable must also be set. - -f_ulBufIndex If the f_fReserveListStruct flag is set, this index - will identify the buffer playout list structure - that must be used to load the specified buffer. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferLoadSer -UINT32 Oct6100BufferLoadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex ) -{ - UINT32 ulBufferIndex; - UINT32 ulBufferBase; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiCheckBufferParams( f_pApiInstance, f_pBufferLoad, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the buffer. */ - ulResult = Oct6100ApiReserveBufferResources( f_pApiInstance, f_pBufferLoad, f_fReserveListStruct, f_ulBufIndex, &ulBufferIndex, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the buffer in external memory. */ - ulResult = Oct6100ApiWriteBufferInMemory( f_pApiInstance, ulBufferBase, f_pBufferLoad->ulBufferSize, f_pBufferLoad->pbyBufferPattern ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new buffer's entry in the buffer list. */ - ulResult = Oct6100ApiUpdateBufferEntry( f_pApiInstance, f_pBufferLoad, ulBufferIndex, ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferLoadBlockInitSer - -Description: Reserve resources for loading a buffer into external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlockInit Pointer to buffer configuration structure. The - handle identifying the buffer in all future - function calls is returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferLoadBlockInitSer -UINT32 Oct6100BufferLoadBlockInitSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ) -{ - UINT32 ulBufferIndex; - UINT32 ulBufferBase; - UINT32 ulResult; - tOCT6100_BUFFER_LOAD BufferLoad; - - Oct6100BufferPlayoutLoadDef( &BufferLoad ); - - /* Not to replicate the code, we use the BufferLoad functions directly. */ - BufferLoad.pulBufferIndex = f_pBufferLoadBlockInit->pulBufferIndex; - BufferLoad.pulPlayoutFreeMemSize = f_pBufferLoadBlockInit->pulPlayoutFreeMemSize; - BufferLoad.ulBufferPcmLaw = f_pBufferLoadBlockInit->ulBufferPcmLaw; - BufferLoad.ulBufferSize = f_pBufferLoadBlockInit->ulBufferSize; - BufferLoad.pbyBufferPattern = NULL; /* Must not check this for now */ - - /* Check the user's configuration of the buffer for errors, but do */ - /* not check if the buffer pointer is NULL. It is NULL for sure! */ - ulResult = Oct6100ApiCheckBufferParams( f_pApiInstance, &BufferLoad, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the buffer. */ - ulResult = Oct6100ApiReserveBufferResources( f_pApiInstance, &BufferLoad, TRUE, cOCT6100_INVALID_INDEX, &ulBufferIndex, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new buffer's entry in the buffer list. */ - ulResult = Oct6100ApiUpdateBufferEntry( f_pApiInstance, &BufferLoad, ulBufferIndex, ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferLoadBlockSer - -Description: Loads a buffer in external memory using blocks. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlock Pointer to buffer block to be loaded into external - memory descriptor. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferLoadBlockSer -UINT32 Oct6100BufferLoadBlockSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ) -{ - UINT32 ulBufferBase; - UINT32 ulResult; - - /* Check the user's configuration for errors. */ - ulResult = Oct6100ApiCheckBufferLoadBlockParams( f_pApiInstance, f_pBufferLoadBlock, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the buffer in external memory at the appropriate offset - must do some pointer arithmetic. */ - ulResult = Oct6100ApiWriteBufferInMemory( f_pApiInstance, ulBufferBase + f_pBufferLoadBlock->ulBlockOffset, - f_pBufferLoadBlock->ulBlockLength, f_pBufferLoadBlock->pbyBufferPattern + f_pBufferLoadBlock->ulBlockOffset ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBufferParams - -Description: Checks the user's buffer playout load configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. -f_fCheckBufferPtr Check if the buffer pointer is NULL or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBufferParams -UINT32 Oct6100ApiCheckBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fCheckBufferPtr ) -{ - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fBufferPlayout == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_BUFFER_PLAYOUT; - - if ( f_pBufferLoad->pulBufferIndex == NULL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - if( f_fCheckBufferPtr ) - { - if ( f_pBufferLoad->pbyBufferPattern == NULL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PATTERN; - } - - if ( f_pBufferLoad->ulBufferSize < cOCT6100_MINIMUM_BUFFER_SIZE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_TOO_SMALL; - - if ( ( f_pBufferLoad->ulBufferSize % cOCT6100_BUFFER_SIZE_GRANULARITY ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - - if ( f_pBufferLoad->ulBufferPcmLaw != cOCT6100_PCM_U_LAW && - f_pBufferLoad->ulBufferPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PCM_LAW; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBufferLoadBlockParams - -Description: Checks the user's buffer playout load block configuration for - errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoadBlock Pointer to buffer block descriptor. -f_pulBufferBase Pointer to the base address of the buffer in external - memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBufferLoadBlockParams -UINT32 Oct6100ApiCheckBufferLoadBlockParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock, - OUT PUINT32 f_pulBufferBase ) -{ - /* Check for errors. */ - tPOCT6100_API_BUFFER pBufEntry; - - if ( f_pBufferLoadBlock->ulBufferIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, f_pBufferLoadBlock->ulBufferIndex ) - - if ( pBufEntry->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN; - - if ( ( f_pBufferLoadBlock->ulBlockLength % 2 ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_LENGTH_INVALID; - - if ( ( f_pBufferLoadBlock->ulBlockOffset % 2 ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_OFFSET_INVALID; - - if ( f_pBufferLoadBlock->pbyBufferPattern == NULL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PATTERN; - - /* Check boundaries */ - if ( ( f_pBufferLoadBlock->ulBlockLength + f_pBufferLoadBlock->ulBlockOffset ) > pBufEntry->ulBufferSize ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - - *f_pulBufferBase = pBufEntry->ulBufferBase; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufferResources - -Description: Reserves all resources needed for the new buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. - -f_fReserveListStruct Flag indicating if a list structure should be reserved - or if the structure has been reserved before. - -f_ulBufIndex If the f_fReserveListStruct flag is set, this index - will identifying the buffer playout list structure - that must be used to load the specified buffer. - -f_pulBufferIndex Allocated entry in buffer playout list. - -f_pulBufferBase Allocated external memory block for the buffer. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufferResources -UINT32 Oct6100ApiReserveBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex, - OUT PUINT32 f_pulBufferIndex, - OUT PUINT32 f_pulBufferBase ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the buffer list. */ - if ( f_fReserveListStruct == TRUE ) - { - ulResult = Oct6100ApiReserveBufPlayoutListEntry( f_pApiInstance, f_pulBufferIndex ); - } - else - { - *f_pulBufferIndex = f_ulBufIndex; - } - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Find a free block to store the buffer. */ - ulResult = Oct6100ApiReserveBufferPlayoutMemory( f_pApiInstance, f_pBufferLoad->ulBufferSize, f_pulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the list entry. */ - if ( f_fReserveListStruct == TRUE ) - { - ulTempVar = Oct6100ApiReleaseBufPlayoutListEntry( f_pApiInstance, *f_pulBufferIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - } - } - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteBufferInMemory - -Description: Writes the buffer in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulBufferBase Allocated external memory address for the buffer. - -f_ulBufferLength Length in bytes of the buffer to be copied in memory. - -f_pbyBuffer Address where the buffer should be copied from. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteBufferInMemory -UINT32 Oct6100ApiWriteBufferInMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferBase, - IN UINT32 f_ulBufferLength, - IN PUINT8 f_pbyBuffer ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulNumWrites; - PUINT16 pusSuperArray; - PUINT8 pbyPlayoutBuffer; - UINT32 ulByteCount = 0; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Write the buffer in external memory. */ - ulNumWrites = f_ulBufferLength / 2; - - BurstParams.ulWriteAddress = f_ulBufferBase; - BurstParams.pusWriteData = pSharedInfo->MiscVars.ausSuperArray; - - pusSuperArray = pSharedInfo->MiscVars.ausSuperArray; - pbyPlayoutBuffer = f_pbyBuffer; - - /* Check if we can maximize the bandwidth through the CPU port. */ - if ( f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels == 0 ) - { - WriteParams.ulWriteAddress = 0x234; - WriteParams.usWriteData = 0x08ff; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - while ( ulNumWrites != 0 ) - { - if ( ulNumWrites >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - BurstParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - BurstParams.ulWriteLength = ulNumWrites; - - for ( i = 0; i < BurstParams.ulWriteLength; i++ ) - { - pusSuperArray[ i ] = ( UINT16 )(( pbyPlayoutBuffer [ ulByteCount++ ]) << 8); - pusSuperArray[ i ] |= ( UINT16 )pbyPlayoutBuffer [ ulByteCount++ ]; - } - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.ulWriteAddress += 2 * BurstParams.ulWriteLength; - ulNumWrites -= BurstParams.ulWriteLength; - - } - - /* Make sure we revert back the changes made to the CPU bandwidth register. */ - if ( f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels == 0 ) - { - WriteParams.ulWriteAddress = 0x234; - WriteParams.usWriteData = 0x0804; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBufferEntry - -Description: Updates the new buffer's entry in the buffer playout list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. -f_ulBufferIndex Allocated entry in buffer playout list. -f_ulBufferBase Allocated external memory block for the buffer. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBufferEntry -UINT32 Oct6100ApiUpdateBufferEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN UINT32 f_ulBufferIndex, - IN UINT32 f_ulBufferBase ) -{ - tPOCT6100_API_BUFFER pBufEntry; - UINT32 ulBufferSize = f_pBufferLoad->ulBufferSize; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, f_ulBufferIndex ) - - /* Copy the buffer's configuration and allocated resources. */ - pBufEntry->ulBufferSize = f_pBufferLoad->ulBufferSize; - pBufEntry->byBufferPcmLaw = (UINT8)( f_pBufferLoad->ulBufferPcmLaw & 0xFF ); - pBufEntry->ulBufferBase = f_ulBufferBase; - - /* Update the entries flags. */ - pBufEntry->usDependencyCnt = 0; - - /* Mark the buffer as opened. */ - pBufEntry->fReserved = TRUE; - - /* Increment the number of buffer loaded into the chip.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPlayoutBuffers++; - - /* Refresh the amount of memory used by buffer playout. */ - - /* Reserved size is divisible by 64. */ - if ( ulBufferSize % 64 ) - ulBufferSize = ulBufferSize + ( 64 - ( ulBufferSize % 64 ) ); - f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed += ulBufferSize; - - /* Return the buffer index to the user. */ - *f_pBufferLoad->pulBufferIndex = f_ulBufferIndex; - - /* Return the amount of free memory left in the chip. */ - /* Note that this value does not give the "fragmentation" state of the available memory. */ - /* This value only gives the amount of free memory */ - if( f_pBufferLoad->pulPlayoutFreeMemSize ) - *f_pBufferLoad->pulPlayoutFreeMemSize = ( f_pApiInstance->pSharedInfo->MiscVars.ulTotalMemSize - ( f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress - cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) ) - ( f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferUnloadSer - -Description: Unloads a buffer from external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferUnload Pointer to buffer unload structure. -f_fReleaseListStruct Whether to release the buffer playout list structure - or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferUnloadSer -UINT32 Oct6100BufferUnloadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - IN BOOL f_fReleaseListStruct ) -{ - UINT32 ulBufferIndex; - UINT32 ulBufferBase; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertBufferParams( f_pApiInstance, f_pBufferUnload, &ulBufferIndex, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the unloaded buffer. */ - ulResult = Oct6100ApiReleaseBufferResources( f_pApiInstance, ulBufferIndex, ulBufferBase, f_fReleaseListStruct ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertBufferParams - -Description: Checks the buffer playout unload configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferUnload Pointer to buffer unload structure. -f_pulBufferIndex Pointer to the index of the buffer in the API's buffers list. -f_pulBufferBase Pointer to the base address of the buffer in external memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertBufferParams -UINT32 Oct6100ApiAssertBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - OUT PUINT32 f_pulBufferIndex, - OUT PUINT32 f_pulBufferBase ) -{ - tPOCT6100_API_BUFFER pBufEntry; - - *f_pulBufferIndex = f_pBufferUnload->ulBufferIndex; - - if ( *f_pulBufferIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, *f_pulBufferIndex ) - - /* Check for errors. */ - if ( pBufEntry->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN; - if ( pBufEntry->usDependencyCnt != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ACTIVE_DEPENDENCIES; - - /* Return all info needed to invalidate buffer. */ - *f_pulBufferBase = pBufEntry->ulBufferBase; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufferResources - -Description: Release resources needed by the buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulBufferIndex Allocated entry in buffer playout list. -f_ulBufferBase Allocated external memory block for the buffer. -f_fReleaseListStruct Free the list structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufferResources -UINT32 Oct6100ApiReleaseBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferIndex, - IN UINT32 f_ulBufferBase, - IN BOOL f_fReleaseListStruct ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER pBufEntry; - UINT32 ulResult; - UINT32 ulBufferSize; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Free the external memory reserved for the buffer. */ - ulResult = Oct6100ApiReleaseBufferPlayoutMemory( f_pApiInstance, f_ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3E; - - /* Release the entry from the buffer list. */ - if ( f_fReleaseListStruct == TRUE ) - ulResult = Oct6100ApiReleaseBufPlayoutListEntry( f_pApiInstance, f_ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, f_ulBufferIndex ); - - /* Save buffer size before releasing that entry, will be needed to calculate the amount of */ - /* free memory left for the user. */ - ulBufferSize = pBufEntry->ulBufferSize; - - /* Flag the buffer entry as free. */ - pBufEntry->fReserved = FALSE; - - /* Decrement the number of buffer loaded into the chip. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPlayoutBuffers--; - - /* Refresh the amount of memory used by buffer playout. */ - /* Reserved size is divisible by 64. */ - if ( ulBufferSize % 64 ) - ulBufferSize = ulBufferSize + ( 64 - ( ulBufferSize % 64 ) ); - f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed -= ulBufferSize; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutAddSer - -Description: This function adds a buffer to a channel buffer list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutAddSer -UINT32 Oct6100BufferPlayoutAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ) -{ - UINT32 ulBufferIndex; - UINT32 ulChannelIndex; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiCheckPlayoutAddParams( f_pApiInstance, f_pBufferPlayoutAdd, &ulChannelIndex, &ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to activate buffer playout. */ - ulResult = Oct6100ApiWriteBufferAddStructs( f_pApiInstance, f_pBufferPlayoutAdd, ulChannelIndex, ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPlayoutAddParams - -Description: Check the validity of the channel and buffer requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. -f_pulChannelIndex Pointer to the channel index of the selected channel. -f_pulBufferIndex Pointer to the buffer index within the API's buffer list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPlayoutAddParams -UINT32 Oct6100ApiCheckPlayoutAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex ) -{ - tPOCT6100_API_BUFFER pBufferEntry; - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pBufferPlayoutAdd->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - if ( f_pBufferPlayoutAdd->ulPlayoutPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pBufferPlayoutAdd->ulPlayoutPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT; - - if ( f_pBufferPlayoutAdd->fRepeat != TRUE && f_pBufferPlayoutAdd->fRepeat != FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT; - - if ( f_pBufferPlayoutAdd->fRepeat == TRUE ) - { - if ( f_pBufferPlayoutAdd->ulRepeatCount != cOCT6100_REPEAT_INFINITELY ) - { - if ( f_pBufferPlayoutAdd->ulRepeatCount == 0x0 - || f_pBufferPlayoutAdd->ulRepeatCount > cOCT6100_REPEAT_MAX) - { - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT_COUNT; - } - } - } - - if ( f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_0_DB && - f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_MINUS_6_DB && - f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_MINUS_12_DB && - f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_MUTE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_MIXING; - - if ( ( f_pBufferPlayoutAdd->lGainDb < -24 ) - || ( f_pBufferPlayoutAdd->lGainDb > 24 ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_GAIN_DB; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pBufferPlayoutAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pBufferPlayoutAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pBufferPlayoutAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - /* Check if repeat flag has been used for this port. */ - if ( ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) && ( pEchoChannel->fRinBufPlayoutRepeatUsed == TRUE ) ) - || ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChannel->fSoutBufPlayoutRepeatUsed == TRUE ) ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_REPEAT_USED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check the buffer information. */ - - *f_pulBufferIndex = f_pBufferPlayoutAdd->ulBufferIndex; - if ( *f_pulBufferIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufferEntry, *f_pulBufferIndex ) - - if ( pBufferEntry->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN; - - /* Check if the play length is not larger then the currently uploaded buffer. */ - if ( ( f_pBufferPlayoutAdd->ulBufferLength > pBufferEntry->ulBufferSize ) && - ( f_pBufferPlayoutAdd->ulBufferLength != cOCT6100_AUTO_SELECT ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - - if( f_pBufferPlayoutAdd->ulBufferLength != cOCT6100_AUTO_SELECT ) - { - if ( f_pBufferPlayoutAdd->ulBufferLength < cOCT6100_MINIMUM_BUFFER_SIZE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_TOO_SMALL; - - if ( ( f_pBufferPlayoutAdd->ulBufferLength % cOCT6100_BUFFER_SIZE_GRANULARITY ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - } - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteBufferAddStructs - -Description: Write the buffer playout event in the channel's port playout - circular buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. -f_ulChannelIndex Index of the channel on which the buffer is to be added. -f_ulBufferIndex Index of the buffer structure within the API's buffer list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteBufferAddStructs -UINT32 Oct6100ApiWriteBufferAddStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex ) -{ - tPOCT6100_API_BUFFER pBufferEntry; - tPOCT6100_API_CHANNEL pEchoChannel; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulEventBuffer; - - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulWritePtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulWritePtrFieldSize; - - UINT32 ulWritePtr; - UINT32 ulReadPtr; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulAddress; - UINT32 ulEventIndex; - UINT32 ulMask; - - UINT32 ulRepeatCount = 0; - BOOL fRepeatCountSet = FALSE; - UINT32 ulDurationModulo = 0; - UINT32 ulEventsToCreate = 1; - UINT32 ulBufferDurationMs; - - UINT32 ulBufferLength; - UINT16 usTempData = 0; - - UINT16 usReadData; - UINT32 ulChipWritePtr; - UINT32 ulReadData; - UINT32 ulLoopCnt = 0; - BOOL fStillPlaying = TRUE; - BOOL fCheckHardStop = FALSE; - BOOL fOldBufferPlayoutVersion = FALSE; - - UINT32 aulWaitTime[ 2 ]; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufferEntry, f_ulBufferIndex ); - - /* Select the buffer of interest. */ - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst; - ulWritePtr = pEchoChannel->ulRinBufWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst; - ulWritePtr = pEchoChannel->ulSoutBufWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - /*=======================================================================*/ - /* Calculate the repeat count. */ - - /* The buffer length is either the total buffer size or the value specified by the user */ - if ( f_pBufferPlayoutAdd->ulBufferLength == cOCT6100_AUTO_SELECT ) - { - ulBufferLength = pBufferEntry->ulBufferSize; - } - else - { - ulBufferLength = f_pBufferPlayoutAdd->ulBufferLength; - } - - if ( f_pBufferPlayoutAdd->ulDuration != cOCT6100_INVALID_VALUE ) - { - /* With duration and buffer length, we can find the number of times we must repeat playing this buffer. */ - ulBufferDurationMs = ulBufferLength / cOCT6100_SAMPLES_PER_MS; - ulRepeatCount = f_pBufferPlayoutAdd->ulDuration / ulBufferDurationMs; - fRepeatCountSet = TRUE; - - /* Check if buffer is larger then asked duration. */ - if ( ulRepeatCount != 0x0 ) - { - /* We might have to create more then 1 event to accomodate for the repeat-max limit. */ - ulEventsToCreate = ( ulRepeatCount / cOCT6100_REPEAT_MAX ) + 1; - } - else - { - /* No repeat event. Maybe only the duration modulo! */ - ulEventsToCreate = 0x0; - } - - /* Check if must create a second event for a buffer that cannot be played completely. */ - ulDurationModulo = f_pBufferPlayoutAdd->ulDuration % ulBufferDurationMs; - if ( ulDurationModulo != 0x0 ) - { - ulDurationModulo *= cOCT6100_SAMPLES_PER_MS; - if ( ulDurationModulo / cOCT6100_BUFFER_SIZE_GRANULARITY ) - { - /* Round the modulo to be on a buffer size granularity. */ - /* This will round down. */ - ulDurationModulo = ( ulDurationModulo / cOCT6100_BUFFER_SIZE_GRANULARITY ) * cOCT6100_BUFFER_SIZE_GRANULARITY; - - /* If the event about to be created is smaller then the minimum buffer size, */ - /* round up to the minimum required by the hardware. */ - if ( ulDurationModulo < cOCT6100_MINIMUM_BUFFER_SIZE ) - ulDurationModulo = cOCT6100_MINIMUM_BUFFER_SIZE; - ulEventsToCreate++; - } - else - { - /* The modulo is too small to be played. Skip. */ - ulDurationModulo = 0; - } - } - } - else if ( f_pBufferPlayoutAdd->fRepeat == TRUE - && f_pBufferPlayoutAdd->ulRepeatCount != cOCT6100_REPEAT_INFINITELY ) - { - /* The repeat count is set directly from the user. */ - ulRepeatCount = f_pBufferPlayoutAdd->ulRepeatCount; - fRepeatCountSet = TRUE; - } - - /*=======================================================================*/ - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_ulChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Read the read pointer. */ - ulAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Must read in memory directly since this value is changed by hardware. */ - ulResult = Oct6100ApiReadDword( f_pApiInstance, ulAddress, &ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Compare the pointers... Are they different? If so, there is something already in the list. */ - if ( ulReadPtr != ulWritePtr ) - { - /* Check if there is enough room for the playout events. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* 127 or 31 events image. */ - if ( (UINT8)( ( ulWritePtr - ulReadPtr ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ) ) >= ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - (UINT8)ulEventsToCreate ) ) - fCheckHardStop = TRUE; - } - else - { - /* Old 31 events image. */ - if ( ( ( ulWritePtr - ulReadPtr ) & 0x1F ) >= ( 0x20 - ulEventsToCreate ) ) - fCheckHardStop = TRUE; - - fOldBufferPlayoutVersion = TRUE; - } - - if ( fCheckHardStop == TRUE ) - { - /* Ok. From what was read, the list is full. But we might still have a chance if the hard-stop */ - /* version was used. In this case, some of the buffers in the list might */ - /* become free in a couple of milliseconds, so try to wait for this. */ - - if ( ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) && ( pEchoChannel->fRinHardStop == TRUE ) ) - || ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChannel->fSoutHardStop == TRUE ) ) ) - { - /* Read the 'chip' write pointer in the hardware. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Get the write pointer in the chip. */ - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulReadData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer. */ - ulChipWritePtr = ( ulReadData & ulMask ) >> ulWritePtrBitOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - while( fStillPlaying == TRUE ) - { - /* Read the read pointer until equals to the write pointer. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer.*/ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( ulReadPtr == ulChipWritePtr ) - break; - - ulLoopCnt++; - if ( ulLoopCnt > cOCT6100_MAX_LOOP ) - { - return cOCT6100_ERR_FATAL_E7; - } - - aulWaitTime[ 0 ] = 100; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Clear hard-stop flag. */ - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* No hard stop for now. */ - pEchoChannel->fRinHardStop = FALSE; - } - else /* if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - /* No hard stop for now. */ - pEchoChannel->fSoutHardStop = FALSE; - } - - /* Now check again if the event can be added... */ - if ( fOldBufferPlayoutVersion == FALSE ) - { - if ( (UINT8)( ( ulWritePtr - ulReadPtr ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ) ) >= ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - (UINT8)ulEventsToCreate ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL; - } - else /* if ( fOldBufferPlayoutVersion == TRUE ) */ - { - /* Old 31 events image. */ - if ( ( ( ulWritePtr - ulReadPtr ) & 0x1F ) >= ( 0x20 - ulEventsToCreate ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL; - } - - /* Good, at least another buffer can be added! Add the buffer to the list. */ - } - else - { - /* Well the list is full! */ - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL; - } - } - } - - /*=======================================================================*/ - /* Write the events. */ - - for ( ulEventIndex = 0; ulEventIndex < ulEventsToCreate; ulEventIndex ++ ) - { - /* Set the playout event base address. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* 127 or 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + (f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * (ulWritePtr & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ))); - } - else - { - /* Old 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + (f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * (ulWritePtr & 0x1F)); - } - - /* EVENT BASE + 0 */ - /* Make sure the xIS and xHS bits are cleared. */ - ulTempData = 0; - - /* Set the repeat count. */ - if ( fRepeatCountSet == TRUE ) - { - if ( ( ulRepeatCount != 0x0 ) && ( ulRepeatCount <= cOCT6100_REPEAT_MAX ) ) - { - /* Use repeat count directly. */ - ulTempData |= ulRepeatCount; - - /* Will be used later when creating the duration modulo event. */ - ulRepeatCount = 0; - } - else if ( ulRepeatCount != 0x0 ) - { - /* Get ready for next event. */ - ulRepeatCount -= cOCT6100_REPEAT_MAX; - - /* Set maximum for this event. */ - ulTempData |= cOCT6100_REPEAT_MAX; - } - else - { - /* Duration modulo case. Nothing to set here. */ - } - } - else /* if ( fRepeatCountSet != TRUE ) */ - { - /* Repeat only once. */ - ulTempData |= 0x1; - } - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* EVENT BASE + 4 */ - /* Set the buffer base address and playout configuration. */ - ulAddress += 4; - ulTempData = pBufferEntry->ulBufferBase & 0x07FFFFFF; - - /* Set play indefinitely or loop N times. */ - if ( ( fRepeatCountSet == FALSE ) && ( f_pBufferPlayoutAdd->fRepeat == TRUE ) ) - { - /* Repeat indefinitely. */ - ulTempData |= 0x1 << cOCT6100_PLAYOUT_EVENT_REPEAT_OFFSET; - - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - pEchoChannel->fRinBufPlayoutRepeatUsed = TRUE; - else /* if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - pEchoChannel->fSoutBufPlayoutRepeatUsed = TRUE; - } - - /* Use loop N times feature. */ - ulTempData |= 0x1 << cOCT6100_PLAYOUT_EVENT_LOOP_TIMES_OFFSET; - - /* Set the law.*/ - ulTempData |= ( pBufferEntry->byBufferPcmLaw << cOCT6100_PLAYOUT_EVENT_LAW_OFFSET ); - - /* Set the mixing configuration.*/ - ulTempData |= f_pBufferPlayoutAdd->ulMixingMode << cOCT6100_PLAYOUT_EVENT_MIX_OFFSET; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - /* EVENT BASE + 8 */ - /* Set the buffer size and playout gain. */ - ulAddress += 4; - - /* Check if we are setting the duration modulo. This would be the last event and this */ - /* event is of a very specific size. */ - if ( ( fRepeatCountSet == TRUE ) - && ( ulEventIndex == ( ulEventsToCreate - 1 ) ) - && ( ulDurationModulo != 0x0 ) ) - { - /* The duration modulo variable contains all that is needed here. */ - ulBufferLength = ulDurationModulo; - } - ulTempData = ulBufferLength; - - /* Adjust playout gain. */ - if ( f_pBufferPlayoutAdd->lGainDb != 0 ) - { - /* Convert the dB value into OctFloat format. */ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( f_pBufferPlayoutAdd->lGainDb ); - ulTempData |= ( usTempData & 0xFF00 ) << 16; - } - else - { - ulTempData |= cOCT6100_PLAYOUT_GAIN; - } - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* EVENT BASE + 0xC */ - ulAddress += 4; - ulTempData = ( ulBufferLength - 1 ) & 0xFFFFFFC0; /* Must be multiple of 64 bytes */ - - /* Adjust playout gain. */ - if ( f_pBufferPlayoutAdd->lGainDb != 0 ) - { - ulTempData |= ( usTempData & 0xFF ) << 24; - } - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Next event. */ - ulWritePtr++; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Increment the write pointer to make it point to the next empty entry. */ - - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - pEchoChannel->ulRinBufWritePtr = ( pEchoChannel->ulRinBufWritePtr + ulEventsToCreate ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ); - /* Remember that a buffer was added on the rin port. */ - pEchoChannel->fRinBufAdded = TRUE; - } - else /* f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - pEchoChannel->ulSoutBufWritePtr = ( pEchoChannel->ulSoutBufWritePtr + ulEventsToCreate ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ); - /* Remember that a buffer was added on the sout port. */ - pEchoChannel->fSoutBufAdded = TRUE; - } - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStartSer - -Description: Starts buffer playout on a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. - -f_ulPlayoutStopEventType Playout stop event type to be generated if required. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStartSer -UINT32 Oct6100BufferPlayoutStartSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulPlayoutStopEventType ) -{ - UINT32 ulBufferIndex = 0; - UINT32 ulChannelIndex; - BOOL fNotifyOnPlayoutStop; - UINT32 ulUserEventId; - BOOL fAddToCurrentlyPlayingList; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiCheckPlayoutStartParams( f_pApiInstance, f_pBufferPlayoutStart, &ulChannelIndex, &ulBufferIndex, &fNotifyOnPlayoutStop, &ulUserEventId, &fAddToCurrentlyPlayingList ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to activate buffer playout. */ - ulResult = Oct6100ApiWriteChanPlayoutStructs( f_pApiInstance, f_pBufferPlayoutStart, ulChannelIndex, ulBufferIndex, fNotifyOnPlayoutStop, ulUserEventId, fAddToCurrentlyPlayingList, f_ulPlayoutStopEventType ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPlayoutStartParams - -Description: Check the validity of the channel and buffer requested. - Check the validity of the flags requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. -f_pulChannelIndex Pointer to the channel index of the selected channel. -f_pulBufferIndex Pointer to the buffer index within the API's buffer list. -f_pfNotifyOnPlayoutStop Pointer to the notify on playout stop flag. -f_pulUserEventId Pointer to the user event id specified. -f_pfAllowStartIfActive Pointer to the add to currently playing list flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPlayoutStartParams -UINT32 Oct6100ApiCheckPlayoutStartParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex, - OUT PBOOL f_pfNotifyOnPlayoutStop, - OUT PUINT32 f_pulUserEventId, - OUT PBOOL f_pfAllowStartIfActive ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pBufferPlayoutStart->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - if ( f_pBufferPlayoutStart->ulPlayoutPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pBufferPlayoutStart->ulPlayoutPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT; - - if ( f_pBufferPlayoutStart->fNotifyOnPlayoutStop != FALSE - && f_pBufferPlayoutStart->fNotifyOnPlayoutStop != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOTIFY_ON_STOP; - - if ( f_pBufferPlayoutStart->fAllowStartWhileActive != FALSE - && f_pBufferPlayoutStart->fAllowStartWhileActive != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ALLOW_ACTIVE; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pBufferPlayoutStart->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pBufferPlayoutStart->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pBufferPlayoutStart->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - /* The channel cannot be in POWER_DOWN or HT_FREEZE to start the playout. */ - if ( ( pEchoChannel->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN ) - || ( pEchoChannel->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_HT_FREEZE ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ECHO_OP_MODE; - - /* The channel's NLP must be enabled for playout to occur. */ - if ( pEchoChannel->VqeConfig.fEnableNlp == FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NLP_DISABLED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check if the user activated the buffer playout events. */ - - if ( f_pBufferPlayoutStart->fNotifyOnPlayoutStop == TRUE - && f_pApiInstance->pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_DISABLED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check if there is actually a buffer added in the list. */ - - if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( pEchoChannel->fRinBufAdded == FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_LIST_EMPTY; - } - else /* if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - if ( pEchoChannel->fSoutBufAdded == FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_LIST_EMPTY; - } - - /*=====================================================================*/ - - /* Return the requested information. */ - *f_pfNotifyOnPlayoutStop = f_pBufferPlayoutStart->fNotifyOnPlayoutStop; - *f_pulUserEventId = f_pBufferPlayoutStart->ulUserEventId; - *f_pfAllowStartIfActive = f_pBufferPlayoutStart->fAllowStartWhileActive; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteChanPlayoutStructs - -Description: Write the buffer playout event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulBufferIndex Index of the buffer within the API's buffer list. -f_fNotifyOnPlayoutStop Flag for the notify on playout stop. -f_ulUserEventId User event id passed to the user when a playout event is generated. -f_fAllowStartIfActive Add to currently playing list flag. -f_ulPlayoutStopEventType Playout stop event type to be generated if required. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteChanPlayoutStructs -UINT32 Oct6100ApiWriteChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex, - IN BOOL f_fNotifyOnPlayoutStop, - IN UINT32 f_ulUserEventId, - IN BOOL f_fAllowStartIfActive, - IN UINT32 f_ulPlayoutStopEventType ) -{ - tPOCT6100_API_BUFFER pBufferEntry; - tPOCT6100_API_CHANNEL pEchoChannel; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - - UINT32 ulResult; - - UINT32 ulWritePtr; - UINT32 ulChipWritePtr; - PUINT32 pulSkipPtr; - UINT32 ulWritePtrBytesOfst; - UINT32 ulSkipPtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulSkipPtrBitOfst; - UINT32 ulWritePtrFieldSize; - UINT32 ulSkipPtrFieldSize; - - UINT32 ulIgnoreBytesOfst; - UINT32 ulIgnoreBitOfst; - UINT32 ulIgnoreFieldSize; - - UINT32 ulHardSkipBytesOfst; - UINT32 ulHardSkipBitOfst; - UINT32 ulHardSkipFieldSize; - - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulAddress; - UINT32 ulTempData; - UINT32 ulMask; - UINT32 ulReadData; - UINT32 ulReadPtr; - UINT32 ulLoopCnt = 0; - - UINT16 usReadData; - - BOOL fBufferPlayoutStopDetected; - BOOL fWriteSkipPtr = FALSE; - BOOL fStillPlaying = TRUE; - - UINT32 aulWaitTime[ 2 ]; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufferEntry, f_ulBufferIndex ); - - /* First off, check for buffer playout events, if requested for this channel/port. */ - /* At the same time, if requested, check that the playout has stopped for this channel/port. */ - if ( ( ( pEchoChannel->fRinBufPlaying == TRUE ) - && ( ( pEchoChannel->fRinBufPlayoutNotifyOnStop == TRUE ) || ( f_fAllowStartIfActive == FALSE ) ) - && ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) ) - || ( ( ( pEchoChannel->fSoutBufPlaying == TRUE ) || ( f_fAllowStartIfActive == FALSE ) ) - && ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == TRUE ) - && ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) ) ) - { - /* Buffer playout might still be going on for this channel/port. */ - ulResult = Oct6100BufferPlayoutCheckForSpecificEvent( f_pApiInstance, - f_ulChannelIndex, - f_pBufferPlayoutStart->ulPlayoutPort, - pEchoChannel->fRinBufPlayoutNotifyOnStop, - &fBufferPlayoutStopDetected ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the user requested to only start if playout is over. Return an error if */ - /* buffer playout is still going on on this channel/port. */ - if ( ( f_fAllowStartIfActive == FALSE ) && ( fBufferPlayoutStopDetected == FALSE ) ) - { - /* No go! User should wait for the current list to stop, or call the */ - /* Oct6100BufferPlayoutStop function. */ - return cOCT6100_ERR_BUFFER_PLAYOUT_STILL_ACTIVE; - } - } - - /* Select the buffer of interest. */ - if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulWritePtr = pEchoChannel->ulRinBufWritePtr; - pulSkipPtr = &pEchoChannel->ulRinBufSkipPtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.usDwordOffset * 4; - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.usDwordOffset * 4; - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.usDwordOffset * 4; - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byBitOffset; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byBitOffset; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byBitOffset; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byFieldSize; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byFieldSize; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byFieldSize; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulWritePtr = pEchoChannel->ulSoutBufWritePtr; - pulSkipPtr = &pEchoChannel->ulSoutBufSkipPtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.usDwordOffset * 4; - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.usDwordOffset * 4; - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.usDwordOffset * 4; - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byBitOffset; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byBitOffset; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byBitOffset; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byFieldSize; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byFieldSize; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byFieldSize; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_ulChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Check if we must wait for stop to complete before starting a new list. */ - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - { - if ( ( ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) && ( pEchoChannel->fRinHardStop == TRUE ) ) - || ( ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChannel->fSoutHardStop == TRUE ) ) ) - { - /* Read the read pointer. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Get the write pointer in the chip. */ - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulReadData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer. */ - ulChipWritePtr = ( ulReadData & ulMask ) >> ulWritePtrBitOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - while( fStillPlaying == TRUE ) - { - /* Read the read pointer until equals to the write pointer. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( ulReadPtr == ulChipWritePtr ) - break; - - ulLoopCnt++; - if( ulLoopCnt > cOCT6100_MAX_LOOP ) - { - return cOCT6100_ERR_FATAL_E6; - } - - aulWaitTime[ 0 ] = 100; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Check if must clear the skip bit. */ - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - { - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* Make sure the skip bit is cleared to start playout! */ - ulAddress = ulPlayoutBaseAddress + ulIgnoreBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulTempData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulIgnoreBitOfst, &ulMask ); - - /* Cleared! */ - ulTempData &= ( ~ulMask ); - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Make sure the hard skip bit is cleared to start playout! */ - ulAddress = ulPlayoutBaseAddress + ulHardSkipBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulHardSkipBitOfst, &ulMask ); - - /* Cleared! */ - ulTempData &= ( ~ulMask ); - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Write the skip and write pointer to activate buffer playout. */ - - /* Update the skip pointer. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == FALSE ) - || ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == FALSE ) ) - { - /* Old 31 events image. */ - if ( ( ( ulWritePtr - *pulSkipPtr ) & 0x7F ) > 63 ) - { - *pulSkipPtr = ( ulWritePtr - 63 ) & 0x7F; - fWriteSkipPtr = TRUE; - } - } - else - { - /* No need to update the skip pointer, a bit needs to be set when skipping. */ - /* fWriteSkipPtr set to FALSE from variable declaration. */ - } - - if ( fWriteSkipPtr == TRUE ) - { - /*=======================================================================*/ - /* Fetch and modify the skip pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulSkipPtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulSkipPtrFieldSize, ulSkipPtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= *pulSkipPtr << ulSkipPtrBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - } - - - /*=======================================================================*/ - /* Fetch and modify the write pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= ulWritePtr << ulWritePtrBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now update the state of the channel stating that the buffer playout is activated. */ - - /* Select the buffer of interest.*/ - if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check if the global ports active stat must be incremented. */ - if ( pEchoChannel->fRinBufPlaying == FALSE ) - { - /* Increment the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts++; - } - - pEchoChannel->fRinBufPlaying = TRUE; - /* Keep the new notify on event flag. */ - pEchoChannel->fRinBufPlayoutNotifyOnStop = (UINT8)( f_fNotifyOnPlayoutStop & 0xFF ); - /* Keep the specified user event id. */ - pEchoChannel->ulRinUserBufPlayoutEventId = f_ulUserEventId; - /* Keep type of event to be generated. */ - pEchoChannel->byRinPlayoutStopEventType = (UINT8)( f_ulPlayoutStopEventType & 0xFF ); - /* No hard stop for now. */ - pEchoChannel->fRinHardStop = FALSE; - /* No buffer added in the rin list for now. */ - pEchoChannel->fRinBufAdded = FALSE; - /* Buffer playout is active on this channel. */ - pEchoChannel->fBufPlayoutActive = TRUE; - } - else /* f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Check if the global ports active stat must be incremented. */ - if ( pEchoChannel->fSoutBufPlaying == FALSE ) - { - /* Increment the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts++; - } - - pEchoChannel->fSoutBufPlaying = TRUE; - /* Keep the new notify on event flag. */ - pEchoChannel->fSoutBufPlayoutNotifyOnStop = (UINT8)( f_fNotifyOnPlayoutStop & 0xFF ); - /* Keep the specified user event id. */ - pEchoChannel->ulSoutUserBufPlayoutEventId = f_ulUserEventId; - /* Keep type of event to be generated. */ - pEchoChannel->bySoutPlayoutStopEventType = (UINT8)( f_ulPlayoutStopEventType & 0xFF ); - /* No hard stop for now. */ - pEchoChannel->fSoutHardStop = FALSE; - /* No buffer added in the sout list for now. */ - pEchoChannel->fSoutBufAdded = FALSE; - /* Buffer playout is active on this channel. */ - pEchoChannel->fBufPlayoutActive = TRUE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStopSer - -Description: Stops buffer playout on a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStopSer -UINT32 Oct6100BufferPlayoutStopSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ) -{ - UINT32 ulChannelIndex; - UINT16 usEchoMemIndex; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiAssertPlayoutStopParams( - f_pApiInstance, - f_pBufferPlayoutStop, - &ulChannelIndex, - &usEchoMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to deactivate buffer playout. */ - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - f_pBufferPlayoutStop, - ulChannelIndex, - usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertPlayoutStopParams - -Description: Check the validity of the channel and buffer requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. -f_pulChannelIndex Pointer to the channel index on which playout is to be stopped. -f_pusEchoMemIndex Pointer to the echo mem index on which playout is to be stopped. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertPlayoutStopParams -UINT32 Oct6100ApiAssertPlayoutStopParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT16 f_pusEchoMemIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pBufferPlayoutStop->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - if ( f_pBufferPlayoutStop->ulPlayoutPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pBufferPlayoutStop->ulPlayoutPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT; - - if ( f_pBufferPlayoutStop->fStopCleanly != TRUE && f_pBufferPlayoutStop->fStopCleanly != FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_STOP_CLEANLY; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pBufferPlayoutStop->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pBufferPlayoutStop->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pBufferPlayoutStop->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - /* Return echo memory index. */ - *f_pusEchoMemIndex = pEchoChannel->usEchoMemIndex; - - /* Check if buffer playout is active for the selected port. */ - if ( ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - && ( pEchoChannel->fRinBufPlaying == FALSE ) - && ( pEchoChannel->fRinBufAdded == FALSE ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED; - - if ( ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) - && ( pEchoChannel->fSoutBufPlaying == FALSE ) - && ( pEchoChannel->fSoutBufAdded == FALSE ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED; - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateChanPlayoutStructs - -Description: Write the buffer playout event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. -f_ulChannelIndex Index of the channel within the API's channel list. -f_usEchoMemIndex Index of the echo channel in hardware memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateChanPlayoutStructs -UINT32 Oct6100ApiInvalidateChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - IN UINT32 f_ulChannelIndex, - IN UINT16 f_usEchoMemIndex - - ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - - UINT32 ulWritePtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulWritePtrFieldSize; - UINT32 ulSkipPtrBytesOfst; - UINT32 ulSkipPtrBitOfst; - UINT32 ulSkipPtrFieldSize; - UINT32 ulIgnoreBytesOfst; - UINT32 ulIgnoreBitOfst; - UINT32 ulIgnoreFieldSize; - UINT32 ulHardSkipBytesOfst; - UINT32 ulHardSkipBitOfst; - UINT32 ulHardSkipFieldSize; - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulSkipPtr; - UINT32 ulWritePtr; - UINT32 ulReadPtr = 0; - UINT32 ulCurrentPtr; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulAddress; - UINT32 ulTempData; - UINT32 ulMask; - UINT32 ulReadData; - - UINT16 usReadData; - BOOL fCheckStop = FALSE; - - UINT32 ulEventBuffer; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - - /* Select the port of interest. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulWritePtr = pEchoChannel->ulRinBufWritePtr; - ulSkipPtr = ulWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.usDwordOffset * 4; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byBitOffset; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byFieldSize; - - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.usDwordOffset * 4; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byBitOffset; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byFieldSize; - - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.usDwordOffset * 4; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byBitOffset; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulWritePtr = pEchoChannel->ulSoutBufWritePtr; - ulSkipPtr = ulWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.usDwordOffset * 4; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byBitOffset; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byFieldSize; - - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.usDwordOffset * 4; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byBitOffset; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byFieldSize; - - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.usDwordOffset * 4; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byBitOffset; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Check if something is currently playing. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( pEchoChannel->fRinBufPlaying == TRUE ) - { - /* Check if we are stopping it or if it stopped by itself. */ - fCheckStop = TRUE; - } - else - { - /* Not playing! */ - if ( f_pBufferPlayoutStop->pfAlreadyStopped != NULL ) - *f_pBufferPlayoutStop->pfAlreadyStopped = TRUE; - } - } - else /* if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - if ( pEchoChannel->fSoutBufPlaying == TRUE ) - { - /* Check if we are stopping it or if it stopped by itself. */ - fCheckStop = TRUE; - } - else - { - /* Not playing! */ - if ( f_pBufferPlayoutStop->pfAlreadyStopped != NULL ) - *f_pBufferPlayoutStop->pfAlreadyStopped = TRUE; - } - } - - if ( ( fCheckStop == TRUE ) || ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) ) - { - /* Read the read pointer. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( f_pBufferPlayoutStop->pfAlreadyStopped != NULL ) - { - if ( ulReadPtr != ulWritePtr ) - *f_pBufferPlayoutStop->pfAlreadyStopped = FALSE; - else /* if ( ulReadPtr == ulWritePtr ) */ - *f_pBufferPlayoutStop->pfAlreadyStopped = TRUE; - } - } - - /* If the skip bits are located in the event itself, the playout is stopped by setting the */ - /* skip pointer to the hardware chip write pointer. Read it directly from the NLP configuration. */ - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - if ( ulReadPtr != ulWritePtr ) - { - /* Get the write pointer in the chip. */ - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulReadData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer. */ - ulWritePtr = ( ulReadData & ulMask ) >> ulWritePtrBitOfst; - ulSkipPtr = ulWritePtr; - } - } - - /* Check if must clear repeat bit. */ - if ( ( ( pEchoChannel->fRinBufPlayoutRepeatUsed == TRUE ) && ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) ) - || ( ( pEchoChannel->fSoutBufPlayoutRepeatUsed == TRUE ) && ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) ) ) - { - if ( ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - || ( ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - && ( ulWritePtr != ulReadPtr ) ) ) - { - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst; - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst; - } - - /* Set the playout event base address. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* 127 or 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * ( ( ulWritePtr - 1 ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ))); - } - else - { - /* Old 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * ( ( ulWritePtr - 1 ) & 0x1F)); - } - - /* EVENT BASE + 4 */ - /* Playout configuration. */ - ulAddress += 4; - - ReadParams.ulReadAddress = ulAddress; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read-clear-write the new repeat bit. */ - usReadData &= 0x7FFF; - - WriteParams.ulWriteAddress = ulAddress; - WriteParams.usWriteData = usReadData; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Write the skip to the value of the write pointer to stop buffer playout. */ - - /*=======================================================================*/ - /* First set the ignore skip clean bit if required. */ - - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == FALSE ) - || ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == FALSE ) ) - { - ulAddress = ulPlayoutBaseAddress + ulIgnoreBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulIgnoreBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - - /* Check if the skip need to be clean or not. */ - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - ulTempData |= 0x1 << ulIgnoreBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Fetch and modify the write pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulTempData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= ulWritePtr << ulWritePtrBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Fetch and modify the skip pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulSkipPtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulSkipPtrFieldSize, ulSkipPtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= ulSkipPtr << ulSkipPtrBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* If in the new buffer playout case, things are in a different order. */ - - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - { - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - ulAddress = ulPlayoutBaseAddress + ulHardSkipBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulHardSkipFieldSize, ulHardSkipBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - - /* Check if the skip need to be clean or not. */ - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - ulTempData |= 0x1 << ulHardSkipBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now is the appropriate time to skip! */ - ulAddress = ulPlayoutBaseAddress + ulIgnoreBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulIgnoreBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - - /* Set the skip bit. */ - ulTempData |= 0x1 << ulIgnoreBitOfst; - - mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* The API must set the skip bit in all the events that are queued. */ - - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - if ( fCheckStop == TRUE ) - { - if ( ulReadPtr != ulWritePtr ) - { - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst; - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst; - } - - for ( ulCurrentPtr = ulReadPtr; ulCurrentPtr != ulWritePtr; ) - { - /* Set the playout event base address. */ - - /* 127 or 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + ( cOCT6100_PLAYOUT_EVENT_MEM_SIZE * ulCurrentPtr ); - ulCurrentPtr++; - ulCurrentPtr &= ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ); - - /* EVENT BASE + 0 playout configuration. */ - WriteParams.ulWriteAddress = ulAddress; - - /* Set skip bit + hard-skip bit. */ - WriteParams.usWriteData = 0x8000; - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - WriteParams.usWriteData |= 0x4000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /*=======================================================================*/ - /* If stop immediatly, wait the stop before leaving the function. */ - - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - { - /* Remember that an "hard stop" was used for the next start. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - pEchoChannel->fRinHardStop = TRUE; - else /* if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - pEchoChannel->fSoutHardStop = TRUE; - } - - /*=======================================================================*/ - /* Update the channel entry to set the playing flag to FALSE. */ - - /* Select the port of interest. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check if the global ports active stat must be decremented. */ - if ( pEchoChannel->fRinBufPlaying == TRUE ) - { - /* Decrement the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - } - - pEchoChannel->fRinBufPlaying = FALSE; - - /* Return user information. */ - if ( f_pBufferPlayoutStop->pfNotifyOnPlayoutStop != NULL ) - *f_pBufferPlayoutStop->pfNotifyOnPlayoutStop = pEchoChannel->fRinBufPlayoutNotifyOnStop; - - /* Make sure no new event is recorded for this channel/port. */ - pEchoChannel->fRinBufPlayoutNotifyOnStop = FALSE; - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - pEchoChannel->ulRinBufSkipPtr = ulSkipPtr; - pEchoChannel->ulRinBufWritePtr = ulWritePtr; - } - else /* if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) */ - pEchoChannel->ulRinBufSkipPtr = pEchoChannel->ulRinBufWritePtr; - - /* The repeat flag can now be used. */ - pEchoChannel->fRinBufPlayoutRepeatUsed = FALSE; - - /* For sure, all buffers have now been cleared on the Rin port. */ - pEchoChannel->fRinBufAdded = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fSoutBufPlaying == FALSE ) - && ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Check if the global ports active stat must be decremented. */ - if ( pEchoChannel->fSoutBufPlaying == TRUE ) - { - /* Decrement the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - } - - pEchoChannel->fSoutBufPlaying = FALSE; - - /* Return user information. */ - if ( f_pBufferPlayoutStop->pfNotifyOnPlayoutStop != NULL ) - *f_pBufferPlayoutStop->pfNotifyOnPlayoutStop = pEchoChannel->fSoutBufPlayoutNotifyOnStop; - - /* Make sure no new event is recorded for this channel/port. */ - pEchoChannel->fSoutBufPlayoutNotifyOnStop = FALSE; - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - pEchoChannel->ulSoutBufSkipPtr = ulSkipPtr; - pEchoChannel->ulSoutBufWritePtr = ulWritePtr; - } - else /* if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) */ - pEchoChannel->ulSoutBufSkipPtr = pEchoChannel->ulSoutBufWritePtr; - - /* The repeat flag can now be used. */ - pEchoChannel->fSoutBufPlayoutRepeatUsed = FALSE; - - /* For sure, all buffers have now been cleared on the Sout port. */ - pEchoChannel->fSoutBufAdded = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fRinBufPlaying == FALSE ) - && ( pEchoChannel->fRinBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - - /*=======================================================================*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufPlayoutListEntry - -Description: Reserves a free entry in the Buffer playout list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pulBufferIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufPlayoutListEntry -UINT32 Oct6100ApiReserveBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulBufferIndex ) -{ - PVOID pBufPlayoutAlloc; - UINT32 ulResult; - - mOCT6100_GET_BUFFER_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBufPlayoutAlloc ) - - ulResult = OctapiLlmAllocAlloc( pBufPlayoutAlloc, f_pulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN; - else - return cOCT6100_ERR_FATAL_40; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufPlayoutListEntry - -Description: Release an entry from the Buffer playout list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulBufferIndex List entry to be freed. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufPlayoutListEntry -UINT32 Oct6100ApiReleaseBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferIndex ) -{ - PVOID pBufPlayoutAlloc; - UINT32 ulResult; - - mOCT6100_GET_BUFFER_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBufPlayoutAlloc ) - - ulResult = OctapiLlmAllocDealloc( pBufPlayoutAlloc, f_ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_41; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c deleted file mode 100644 index 8afb2f9b..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c +++ /dev/null @@ -1,1598 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_remote_debug.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the routines used for remote debugging. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 35 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_bt0.h" -#include "apilib/octapi_largmath.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_debug_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_remote_debug_pub.h" - -#include "octrpc/rpc_protocol.h" -#include "octrpc/oct6100_rpc_protocol.h" - -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_chip_open_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_debug_priv.h" -#include "oct6100_remote_debug_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100RemoteDebug - -Description: This function interprets the remote debugging packets received - by the users software. Commands contained in the packet are - executed by the API. In addition, a response packet is - constructed and returned by the function. It is the responsibility - of the users software to transmit the response packet back to - the source of the debugging packet. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pRemoteDebug Pointer to a remote debug structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100RemoteDebugDef -UINT32 Oct6100RemoteDebugDef( - tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ) -{ - f_pRemoteDebug->pulReceivedPktPayload = NULL; - f_pRemoteDebug->ulReceivedPktLength = 0; - f_pRemoteDebug->pulResponsePktPayload = NULL; - f_pRemoteDebug->ulMaxResponsePktLength = 0; - f_pRemoteDebug->ulResponsePktLength = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100RemoteDebug -UINT32 Oct6100RemoteDebug( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ) -{ - tPOCTRPC_OGRDTP_HEADER pOgrdtpHeader; - tPOCTRPC_INTERFACE_HEADER pInterfaceHeader; - tPOCTRPC_COMMAND_HEADER pRspCmndHeader; - PUINT32 pulRcvPktPayload; - PUINT32 pulRspPktPayload; - UINT32 ulPktLengthDword; - UINT32 ulSessionIndex; - UINT32 ulChecksum; - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pRemoteDebug->pulReceivedPktPayload == NULL ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_PAYLOAD; - if ( f_pRemoteDebug->pulResponsePktPayload == NULL ) - return cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_PAYLOAD; - if ( f_pRemoteDebug->ulReceivedPktLength < cOCTRPC_MIN_PACKET_BYTE_LENGTH ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - if ( f_pRemoteDebug->ulReceivedPktLength > cOCTRPC_MAX_PACKET_BYTE_LENGTH ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - if ( f_pRemoteDebug->ulMaxResponsePktLength < f_pRemoteDebug->ulReceivedPktLength ) - return cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_LENGTH; - if ( (f_pRemoteDebug->ulReceivedPktLength % 4) != 0 ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxRemoteDebugSessions == 0 ) - return cOCT6100_ERR_REMOTEDEBUG_DISABLED; - - /* Set response length as received length. */ - f_pRemoteDebug->ulResponsePktLength = f_pRemoteDebug->ulReceivedPktLength; - - /* Typecast the packet payload to local pointers. */ - pOgrdtpHeader = ( tPOCTRPC_OGRDTP_HEADER )f_pRemoteDebug->pulReceivedPktPayload; - pInterfaceHeader = ( tPOCTRPC_INTERFACE_HEADER )(f_pRemoteDebug->pulReceivedPktPayload + (sizeof( tOCTRPC_OGRDTP_HEADER ) / 4)); - - /* Get local pointer to received and response packet payloads. */ - pulRcvPktPayload = f_pRemoteDebug->pulReceivedPktPayload; - pulRspPktPayload = f_pRemoteDebug->pulResponsePktPayload; - - /* Get the length of the packet in UINT32s. */ - ulPktLengthDword = f_pRemoteDebug->ulReceivedPktLength / 4; - - /* Check the endian detection field to determine if the payload must be */ - /* swapped to account for different endian formats. */ - ulResult = Oct6100ApiCheckEndianDetectField( pOgrdtpHeader, ulPktLengthDword ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check the packet's length. */ - if ( pOgrdtpHeader->ulPktByteSize != f_pRemoteDebug->ulReceivedPktLength ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - - /* Perform the sum of each word in the packet and compare to checksum. */ - Oct6100ApiCalculateChecksum( pulRcvPktPayload, ulPktLengthDword, &ulChecksum ); - if ( ulChecksum != pOgrdtpHeader->ulChecksum ) - return cOCT6100_ERR_REMOTEDEBUG_CHECKSUM; - - /* Check if the packet's session number has a corresponding entry in the API table. - If not then close an entry which has timed out, and allocate the entry to the - new session number. */ - ulResult = Oct6100ApiCheckSessionNum( f_pApiInstance, pOgrdtpHeader, &ulSessionIndex ); - if ( ulResult == cOCT6100_ERR_REMOTEDEBUG_ALL_SESSIONS_OPEN ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, cOCT6100_INVALID_VALUE, cOCTRPC_RDBGERR_ALL_SESSIONS_OPEN, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( ulResult == cOCT6100_ERR_REMOTEDEBUG_TRANSACTION_ANSWERED ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, TRUE, FALSE, FALSE, FALSE, ulSessionIndex, cOCT6100_INVALID_VALUE, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Check if an echo packet. If so then there's no need to check the rest of - the packet. Simply copy the packet back to the output buffer, enter the - protocol number supported by this API compilation, and recalculate the - checksum. If the packet is not an echo packet and the protocol version - does not correspond to this compiled version then return the supported - protocol version. */ - if ( pOgrdtpHeader->ulRpcProtocolNum == cOCTRPC_ECHO_PROTOCOL ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, TRUE, FALSE, FALSE, ulSessionIndex, cOCT6100_INVALID_VALUE, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( pOgrdtpHeader->ulRpcProtocolNum != cOCTRPC_PROTOCOL_V1_1 ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, TRUE, FALSE, FALSE, ulSessionIndex, cOCTRPC_RDBGERR_PROTOCOL_NUMBER, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( f_pRemoteDebug->ulReceivedPktLength <= cOCTRPC_FIRST_COMMAND_BYTE_OFFSET ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, ulSessionIndex, cOCTRPC_RDBGERR_NO_COMMAND_HEADER, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - - - /* Check the packet's RPC interface type and version. If either does not match then - return the packet with the supported interface type and version of this compilation. */ - if ( pInterfaceHeader->ulInterfaceVersion != cOCTRPC_INTERFACE_VERSION ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, TRUE, TRUE, ulSessionIndex, cOCTRPC_RDBGERR_INTERFACE_VERSION, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - if ( pInterfaceHeader->ulInterfaceType != cOCTRPC_OCT6100_INTERFACE ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, TRUE, TRUE, ulSessionIndex, cOCTRPC_RDBGERR_INTERFACE_TYPE, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - - /* Check each command header to make sure the indicated command and length agree. If - there is an error in the packet's commands then the response packet will be - constructed by the function. */ - ulResult = Oct6100ApiCheckPktCommands( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulSessionIndex, ulPktLengthDword, ulChecksum ); - if ( ulResult == cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR ) - return cOCT6100_ERR_OK; - - /* The packet's fields are valid. Each command must now be extracted and executed. */ - Oct6100ApiExecutePktCommands( f_pApiInstance, pulRcvPktPayload, ulPktLengthDword ); - - pRspCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )pulRspPktPayload + ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4)); - - /* Verify if the new method of using the protocol is the selected case. */ - /* All commands have been executed. Calculate the packet's new checksum - and copy the packet to user provided buffer for response packet. */ - Oct6100ApiCalculateChecksum( pulRcvPktPayload, ulPktLengthDword, &ulChecksum ); - - /* Send response packet. */ - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, ulSessionIndex, cOCTRPC_RDBGERR_OK, cOCT6100_INVALID_VALUE, ulChecksum ); - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetRemoteDebugSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of remote debugging. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pChipOpen Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetRemoteDebugSwSizes -UINT32 Oct6100ApiGetRemoteDebugSwSizes( - IN tPOCT6100_CHIP_OPEN f_pChipOpen, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Memory needed for remote debugging sessions. */ - if ( f_pChipOpen->ulMaxRemoteDebugSessions > 0 ) - { - f_pInstSizes->ulRemoteDebugList = f_pChipOpen->ulMaxRemoteDebugSessions * sizeof( tOCT6100_API_REMOTE_DEBUG_SESSION ); - - ulResult = octapi_bt0_get_size( f_pChipOpen->ulMaxRemoteDebugSessions, 4, 4, &f_pInstSizes->ulRemoteDebugTree ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_41; - - f_pInstSizes->ulRemoteDebugPktCache = cOCTRPC_MAX_PACKET_BYTE_LENGTH * f_pChipOpen->ulMaxRemoteDebugSessions; - f_pInstSizes->ulRemoteDebugDataBuf = cOCTRPC_MAX_PACKET_BYTE_LENGTH * 4; - } - else - { - f_pInstSizes->ulRemoteDebugList = 0; - f_pInstSizes->ulRemoteDebugTree = 0; - f_pInstSizes->ulRemoteDebugPktCache = 0; - f_pInstSizes->ulRemoteDebugDataBuf = 0; - } - - /* Round off the size. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugTree, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugPktCache, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugDataBuf, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRemoteDebuggingSwInit - -Description: Initializes all portions of the API instance associated to - remote debugging. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRemoteDebuggingSwInit -UINT32 Oct6100ApiRemoteDebuggingSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pSessionTree; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - pSharedInfo->RemoteDebugInfo.ulNumSessionsOpen = 0; - pSharedInfo->RemoteDebugInfo.ulMaxSessionsOpen = pSharedInfo->ChipConfig.usMaxRemoteDebugSessions; - pSharedInfo->RemoteDebugInfo.ulSessionListHead = cOCT6100_INVALID_VALUE; - pSharedInfo->RemoteDebugInfo.ulSessionListTail = cOCT6100_INVALID_VALUE; - - if ( pSharedInfo->ChipConfig.usMaxRemoteDebugSessions > 0 ) - { - mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pSessionTree ) - - ulResult = octapi_bt0_init( ( ( PVOID* )&pSessionTree ), pSharedInfo->ChipConfig.usMaxRemoteDebugSessions, 4, 4 ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_42; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckEndianDetectField - -Description: Checks the endian field of a packet and performs a swap of - the packet data if deemed necessary. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulPktLengthDword Length of the packet in dwords. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckEndianDetectField -UINT32 Oct6100ApiCheckEndianDetectField( - IN OUT tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - IN UINT32 f_ulPktLengthDword ) -{ - PUINT32 pulPktPayload; - UINT32 ulBytePositionW = cOCT6100_INVALID_VALUE; - UINT32 ulBytePositionX = cOCT6100_INVALID_VALUE; - UINT32 ulBytePositionY = cOCT6100_INVALID_VALUE; - UINT32 ulBytePositionZ = cOCT6100_INVALID_VALUE; - UINT32 ulTempVar; - UINT32 i; - - /* Bytes in dword are labeled as Z Y X W. */ - - /* Only swap if necessary. */ - if ( f_pOgrdtpHeader->ulEndianDetect != cOCTRPC_ENDIAN_DETECT ) - { - /* Find the position of each byte. */ - for ( i = 0; i < 4; i++ ) - { - ulTempVar = (f_pOgrdtpHeader->ulEndianDetect >> (8 * i)) & 0xFF; - switch ( ulTempVar ) - { - case cOCTRPC_ENDIAN_DETECT_BYTE_W: - ulBytePositionW = i * 8; - break; - case cOCTRPC_ENDIAN_DETECT_BYTE_X: - ulBytePositionX = i * 8; - break; - case cOCTRPC_ENDIAN_DETECT_BYTE_Y: - ulBytePositionY = i * 8; - break; - case cOCTRPC_ENDIAN_DETECT_BYTE_Z: - ulBytePositionZ = i * 8; - break; - default: - return cOCT6100_ERR_REMOTEDEBUG_INVALID_PACKET; - } - } - - /* Make sure all bytes of the endian detect field were found. */ - if ( ulBytePositionW == cOCT6100_INVALID_VALUE || - ulBytePositionX == cOCT6100_INVALID_VALUE || - ulBytePositionY == cOCT6100_INVALID_VALUE || - ulBytePositionZ == cOCT6100_INVALID_VALUE ) - return cOCT6100_ERR_REMOTEDEBUG_INVALID_PACKET; - - /* Swap the bytes of each dword of the packet. */ - pulPktPayload = ( PUINT32 )f_pOgrdtpHeader; - for ( i = 0; i < f_ulPktLengthDword; i++ ) - { - ulTempVar = pulPktPayload[ i ]; - pulPktPayload[ i ] = ((ulTempVar >> ulBytePositionZ) & 0xFF) << 24; - pulPktPayload[ i ] |= ((ulTempVar >> ulBytePositionY) & 0xFF) << 16; - pulPktPayload[ i ] |= ((ulTempVar >> ulBytePositionX) & 0xFF) << 8; - pulPktPayload[ i ] |= ((ulTempVar >> ulBytePositionW) & 0xFF) << 0; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCalculateChecksum - -Description: Calculates the checksum of the given packet payload. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pulPktPayload Pointer to the payload of the packet. -f_ulPktLengthDword Length of the packet in dwords. -f_pulChecksum Pointer to the checksum of the packet. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCalculateChecksum -VOID Oct6100ApiCalculateChecksum( - IN PUINT32 f_pulPktPayload, - IN UINT32 f_ulPktLengthDword, - OUT PUINT32 f_pulChecksum ) -{ - tPOCTRPC_OGRDTP_HEADER pOgrdtpHeader; - UINT32 i; - - for ( i = 0, *f_pulChecksum = 0; i < f_ulPktLengthDword; i++ ) - { - *f_pulChecksum += (f_pulPktPayload[ i ] >> 16) & 0xFFFF; - *f_pulChecksum += (f_pulPktPayload[ i ] >> 0) & 0xFFFF; - } - - pOgrdtpHeader = ( tPOCTRPC_OGRDTP_HEADER )f_pulPktPayload; - *f_pulChecksum -= (pOgrdtpHeader->ulChecksum >> 16) & 0xFFFF; - *f_pulChecksum -= (pOgrdtpHeader->ulChecksum >> 0) & 0xFFFF; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiFormResponsePkt - -Description: Modifies the values of the indicated receive packet, update - the checksum field, and copy the receive packet to the - response packet. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulRcvPktPayload Pointer to the payload of the received packet. -f_pulRspPktPayload Pointer to the payload of the response packet. -f_ulPktLengthDword Length of the packet in dwords. -f_fRetryPktResponse Flag indicating if the received packet was a retry packet. -f_fReplaceProtocolNum Flag indicating if the protocol number must be replaced. -f_fReplaceInterfaceType Flag indicating if the interface type must be replaced. -f_fReplaceInterfaceVersion Flag indicating if the interface version must be replaced. -f_ulSessionIndex Index of the remote debug session within the API' session list. -f_ulParsingErrorValue Parsing error value. -f_ulPayloadDwordIndex Index in the packet where the payload starts. -f_ulChecksum Checksum of the packet. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiFormResponsePkt -VOID Oct6100ApiFormResponsePkt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulPktLengthDword, - IN BOOL f_fRetryPktResponse, - IN BOOL f_fReplaceProtocolNum, - IN BOOL f_fReplaceInterfaceType, - IN BOOL f_fReplaceInterfaceVersion, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulParsingErrorValue, - IN UINT32 f_ulPayloadDwordIndex, - IN UINT32 f_ulChecksum ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCTRPC_OGRDTP_HEADER pOgrdtpHeader; - tPOCTRPC_INTERFACE_HEADER pInterfaceHeader; - PUINT32 pulPktCache; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Typecast pointer to OGRDTP packet header. */ - pOgrdtpHeader = ( tPOCTRPC_OGRDTP_HEADER )f_pulRcvPktPayload; - - /* Check if a response to a retry packet. */ - if ( f_fRetryPktResponse == TRUE ) - { - mOCT6100_GET_REMOTE_DEBUG_SESSION_PKT_CACHE_PNT( pSharedInfo, pulPktCache, f_ulSessionIndex ) - - Oct6100UserMemCopy( f_pulRspPktPayload, pulPktCache, f_ulPktLengthDword * 4 ); - return; - } - - /* Replace all packet header fields which must be changed. */ - if ( f_ulParsingErrorValue != cOCT6100_INVALID_VALUE ) - { - f_ulChecksum -= (pOgrdtpHeader->ulParsingError >> 16) & 0xFFFF; - f_ulChecksum -= (pOgrdtpHeader->ulParsingError >> 0) & 0xFFFF; - - pOgrdtpHeader->ulParsingError = f_ulParsingErrorValue; - - f_ulChecksum += (pOgrdtpHeader->ulParsingError >> 16) & 0xFFFF; - f_ulChecksum += (pOgrdtpHeader->ulParsingError >> 0) & 0xFFFF; - } - - if ( f_fReplaceProtocolNum == TRUE ) - { - f_ulChecksum -= (pOgrdtpHeader->ulRpcProtocolNum >> 16) & 0xFFFF; - f_ulChecksum -= (pOgrdtpHeader->ulRpcProtocolNum >> 0) & 0xFFFF; - - pOgrdtpHeader->ulRpcProtocolNum = cOCTRPC_PROTOCOL_V1_1; - - f_ulChecksum += (pOgrdtpHeader->ulRpcProtocolNum >> 16) & 0xFFFF; - f_ulChecksum += (pOgrdtpHeader->ulRpcProtocolNum >> 0) & 0xFFFF; - } - - if ( f_fReplaceInterfaceType == TRUE ) - { - pInterfaceHeader = ( tPOCTRPC_INTERFACE_HEADER )(f_pulRcvPktPayload + (sizeof( tOCTRPC_OGRDTP_HEADER ) / 4)); - - f_ulChecksum -= (pInterfaceHeader->ulInterfaceType >> 16) & 0xFFFF; - f_ulChecksum -= (pInterfaceHeader->ulInterfaceType >> 0) & 0xFFFF; - - pInterfaceHeader->ulInterfaceType = cOCTRPC_OCT6100_INTERFACE; - - f_ulChecksum += (pInterfaceHeader->ulInterfaceType >> 16) & 0xFFFF; - f_ulChecksum += (pInterfaceHeader->ulInterfaceType >> 0) & 0xFFFF; - } - - if ( f_fReplaceInterfaceVersion == TRUE ) - { - pInterfaceHeader = ( tPOCTRPC_INTERFACE_HEADER )(f_pulRcvPktPayload + (sizeof( tOCTRPC_OGRDTP_HEADER ) / 4)); - - f_ulChecksum -= (pInterfaceHeader->ulInterfaceVersion >> 16) & 0xFFFF; - f_ulChecksum -= (pInterfaceHeader->ulInterfaceVersion >> 0) & 0xFFFF; - - pInterfaceHeader->ulInterfaceVersion = cOCTRPC_INTERFACE_VERSION; - - f_ulChecksum += (pInterfaceHeader->ulInterfaceVersion >> 16) & 0xFFFF; - f_ulChecksum += (pInterfaceHeader->ulInterfaceVersion >> 0) & 0xFFFF; - } - - if ( f_ulPayloadDwordIndex != cOCT6100_INVALID_VALUE ) - { - f_pulRcvPktPayload += f_ulPayloadDwordIndex; - - f_ulChecksum -= (*f_pulRcvPktPayload >> 16) & 0xFFFF; - f_ulChecksum -= (*f_pulRcvPktPayload >> 0) & 0xFFFF; - - *f_pulRcvPktPayload = cOCTRPC_UNKNOWN_COMMAND_NUM; - - f_ulChecksum += (*f_pulRcvPktPayload >> 16) & 0xFFFF; - f_ulChecksum += (*f_pulRcvPktPayload >> 0) & 0xFFFF; - - f_pulRcvPktPayload -= f_ulPayloadDwordIndex; - } - - /* Replace checksum. */ - pOgrdtpHeader->ulChecksum = f_ulChecksum; - - /* Copy the modified receive packet payload to the response packet. */ - Oct6100UserMemCopy( f_pulRspPktPayload, f_pulRcvPktPayload, f_ulPktLengthDword * 4 ); - - /* Copy the response packet to the session's packet cache. */ - if ( f_ulSessionIndex != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_SESSION_PKT_CACHE_PNT( pSharedInfo, pulPktCache, f_ulSessionIndex ) - - Oct6100UserMemCopy( pulPktCache, f_pulRspPktPayload, f_ulPktLengthDword * 4 ); - } -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPktCommands - -Description: Checks the commands contained in the packet for errors in size. - Also checks for unknown commands. If an error is encountered - then the function will construct the response packet. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulRcvPktPayload Pointer to the payload of the received packet. -f_pulRspPktPayload Pointer to the payload of the response packet. -f_ulPktLengthDword Length of the packet in dwords. -f_ulSessionIndex Index of the remote debug session within the API' session list. -f_ulChecksum Checksum of the packet. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPktCommands -UINT32 Oct6100ApiCheckPktCommands( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulPktLengthDword, - IN UINT32 f_ulChecksum ) -{ - tPOCTRPC_COMMAND_HEADER pCmndHeader; - UINT32 ulNumDwordsLeft; - UINT32 ulNumDwordsNeeded = 0; - UINT32 ulRpcCmndSizeDword; - BOOL fCmndIdentified; - BOOL fCmndHeaderPresent; - - pCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(f_pulRcvPktPayload + ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4)); - ulNumDwordsLeft = f_ulPktLengthDword - ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4); - ulRpcCmndSizeDword = sizeof( tOCTRPC_COMMAND_HEADER ) / 4; - fCmndIdentified = TRUE; - - while ( ulNumDwordsLeft != 0 ) - { - if ( ulNumDwordsLeft < ulRpcCmndSizeDword ) - { - fCmndHeaderPresent = FALSE; - } - else - { - fCmndHeaderPresent = TRUE; - - switch ( pCmndHeader->ulRpcCommandNum ) - { - case cOCT6100_RPC_READ_WORD: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_READ_WORD ) / 4; - } - break; - case cOCT6100_RPC_READ_BURST: - { - tPOCT6100_RPC_READ_BURST pBurstHeader; - - ulNumDwordsNeeded = (sizeof( tOCT6100_RPC_READ_BURST ) - sizeof( UINT32 )) / 4; - pBurstHeader = ( tPOCT6100_RPC_READ_BURST )(( PUINT32 )pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - ulNumDwordsNeeded += (pBurstHeader->ulBurstLength + 1) / 2; - } - break; - case cOCT6100_RPC_WRITE_WORD: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_WRITE_WORD ) / 4; - } - break; - case cOCT6100_RPC_WRITE_SMEAR: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_WRITE_SMEAR ) / 4; - } - break; - case cOCT6100_RPC_WRITE_INC: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_WRITE_INC ) / 4; - } - break; - case cOCT6100_RPC_READ_ARRAY: - { - tPOCT6100_RPC_READ_ARRAY pArrayHeader; - - ulNumDwordsNeeded = (sizeof( tOCT6100_RPC_READ_ARRAY ) - sizeof( UINT32 )) / 4; - pArrayHeader = ( tPOCT6100_RPC_READ_ARRAY )(( PUINT32 )pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - ulNumDwordsNeeded += pArrayHeader->ulArrayLength; - ulNumDwordsNeeded += (pArrayHeader->ulArrayLength + 1) / 2; - } - break; - case cOCT6100_RPC_WRITE_BURST: - { - tPOCT6100_RPC_WRITE_BURST pBurstHeader; - - ulNumDwordsNeeded = (sizeof( tOCT6100_RPC_WRITE_BURST ) - sizeof( UINT32 )) / 4; - pBurstHeader = ( tPOCT6100_RPC_WRITE_BURST )(( PUINT32 )pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - ulNumDwordsNeeded += (pBurstHeader->ulBurstLength + 1) / 2; - } - break; - case cOCT6100_RPC_SET_HOT_CHANNEL: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_SET_HOT_CHANNEL ) / 4; - } - break; - case cOCT6100_RPC_GET_DEBUG_CHAN_INDEX: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_GET_DEBUG_CHAN_INDEX ) / 4; - } - break; - case cOCT6100_RPC_API_DISCONNECT: - { - /* There is no parameter to the disconnect command. */ - ulNumDwordsNeeded = 0; - } - break; - default: - fCmndIdentified = FALSE; - } - - ulNumDwordsNeeded += sizeof( tOCTRPC_COMMAND_HEADER ) / 4; - } - - if ( fCmndHeaderPresent != TRUE ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, f_pulRcvPktPayload, f_pulRspPktPayload, f_ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, f_ulSessionIndex, cOCTRPC_RDBGERR_INVALID_PACKET_LENGTH, cOCT6100_INVALID_VALUE, f_ulChecksum ); - return cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR; - } - if ( fCmndIdentified != TRUE ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, f_pulRcvPktPayload, f_pulRspPktPayload, f_ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, f_ulSessionIndex, cOCTRPC_RDBGERR_INVALID_COMMAND_NUMBER, f_ulPktLengthDword - ulNumDwordsLeft, f_ulChecksum ); - return cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR; - } - - if ( ulNumDwordsNeeded != (pCmndHeader->ulCommandByteSize / 4) || - ulNumDwordsNeeded > ulNumDwordsLeft ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, f_pulRcvPktPayload, f_pulRspPktPayload, f_ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, f_ulSessionIndex, cOCTRPC_RDBGERR_INVALID_COMMAND_LENGTH, cOCT6100_INVALID_VALUE, f_ulChecksum ); - return cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR; - } - - pCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )pCmndHeader + ulNumDwordsNeeded); - ulNumDwordsLeft -= ulNumDwordsNeeded; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiExecutePktCommands - -Description: Executes the commands contained in the received packet. The - received packet payload buffer is modified but NOT copied to - the response packet buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulRcvPktPayload Pointer to the payload of the received packet. -f_ulPktLengthDword Length of the packet in dwords. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiExecutePktCommands -VOID Oct6100ApiExecutePktCommands( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN UINT32 f_ulPktLengthDword ) -{ - tPOCTRPC_COMMAND_HEADER pReqCmndHeader; - tPOCTRPC_OGRDTP_HEADER pReqPktHeader; - UINT32 ulNumDwordsLeft; - UINT32 ulRpcCmndSizeDword; - - pReqPktHeader = ( tPOCTRPC_OGRDTP_HEADER )(f_pulRcvPktPayload); - pReqCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )f_pulRcvPktPayload + ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4)); - ulNumDwordsLeft = f_ulPktLengthDword - ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4); - ulRpcCmndSizeDword = sizeof( tOCTRPC_COMMAND_HEADER ) / 4; - - while ( ulNumDwordsLeft != 0 ) - { - /* Switch on command number. */ - switch ( pReqCmndHeader->ulRpcCommandNum ) - { - case cOCT6100_RPC_READ_WORD: - Oct6100ApiRpcReadWord( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_READ_BURST: - Oct6100ApiRpcReadBurst( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_READ_ARRAY: - Oct6100ApiRpcReadArray( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_WRITE_WORD: - Oct6100ApiRpcWriteWord( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_WRITE_SMEAR: - Oct6100ApiRpcWriteSmear( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_WRITE_BURST: - Oct6100ApiRpcWriteBurst( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_SET_HOT_CHANNEL: - Oct6100ApiRpcSetHotChannel( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_GET_DEBUG_CHAN_INDEX: - Oct6100ApiRpcGetDebugChanIndex( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_API_DISCONNECT: - Oct6100ApiRpcDisconnect( f_pApiInstance, pReqCmndHeader, pReqPktHeader->ulDebugSessionNum ); - break; - default: - pReqCmndHeader->ulFunctionResult = cOCT6100_ERR_REMOTEDEBUG_INVALID_RPC_COMMAND_NUM; - break; - } - - /* Insert the result of the operation in the command header. */ - if ( pReqCmndHeader->ulFunctionResult != cOCT6100_ERR_OK ) - break; - - /* Decrement the number of DWORDs left in the packet. */ - ulNumDwordsLeft -= pReqCmndHeader->ulCommandByteSize / 4; - - /* Point to the next command in the packet. */ - pReqCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )pReqCmndHeader + (pReqCmndHeader->ulCommandByteSize / 4)); - } -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckSessionNum - -Description: Checks if there is a session list entry open for the session - number received. If not, a free one is reserved if one is - available. If none are free, one which has timed-out is - released. If none are timed out then an error is returned. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pOgrdtpHeader Pointer to the header of the packet. -f_pulSessionIndex Pointer to the remote debugging session within the - API's session list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckSessionNum -UINT32 Oct6100ApiCheckSessionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - OUT PUINT32 f_pulSessionIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_REMOTE_DEBUG_INFO pRemoteDebugInfo; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionEntry; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionLink; - tOCT6100_GET_TIME GetTime; - PVOID pSessionTree; - PUINT32 pulTreeData; - UINT32 ulNewSessionIndex; - UINT32 aulTimeDiff[ 2 ]; - UINT32 ulResult; - UINT16 usNegative; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context of GetTime. */ - GetTime.pProcessContext = f_pApiInstance->pProcessContext; - - /* Get the current system time. */ - ulResult = Oct6100UserGetTime( &GetTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get a local pointer to the remote debugging info. */ - pRemoteDebugInfo = &pSharedInfo->RemoteDebugInfo; - - /* Check if the session number has an associated session list entry. */ - mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pSessionTree ) - - ulResult = octapi_bt0_query_node( pSessionTree, ( ( PVOID )(&f_pOgrdtpHeader->ulDebugSessionNum) ), ( ( PVOID* )&pulTreeData ) ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Return session index. */ - *f_pulSessionIndex = *pulTreeData; - - /* A session list entry is associated, so update the entries last packet time, - transaction number and packet retry number, and position in the linked list. */ - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, *pulTreeData, pSessionEntry ) - - pSessionEntry->aulLastPktTime[ 0 ] = GetTime.aulWallTimeUs[ 0 ]; - pSessionEntry->aulLastPktTime[ 1 ] = GetTime.aulWallTimeUs[ 1 ]; - pSessionEntry->ulPktRetryNum = f_pOgrdtpHeader->ulPktRetryNum; - - /* Remove the node from its current place in the linked-list and add it to the end. */ - if ( pRemoteDebugInfo->ulSessionListTail != *pulTreeData ) - { - /* Obtain local pointer to the session list entry to be moved. */ - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, *pulTreeData, pSessionEntry ) - - /* Update link of previous session in list. */ - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = pSessionEntry->ulForwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListHead = pSessionEntry->ulForwardLink; - } - - /* Update link of next session in list. */ - if ( pSessionEntry->ulForwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulForwardLink, pSessionLink ) - pSessionLink->ulBackwardLink = pSessionEntry->ulBackwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListTail = pSessionEntry->ulBackwardLink; - } - - /* Place session at the end of the list. */ - pSessionEntry->ulBackwardLink = pRemoteDebugInfo->ulSessionListTail; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - pRemoteDebugInfo->ulSessionListTail = *pulTreeData; - - if ( pRemoteDebugInfo->ulSessionListHead == cOCT6100_INVALID_VALUE ) - { - pRemoteDebugInfo->ulSessionListHead = *pulTreeData; - } - else - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = *pulTreeData; - } - } - - /* Check if packet should be interpreted based on transaction number. */ - if ( f_pOgrdtpHeader->ulPktRetryNum != 0 && - pSessionEntry->ulTransactionNum == f_pOgrdtpHeader->ulTransactionNum && - pSessionEntry->ulPktByteSize == f_pOgrdtpHeader->ulPktByteSize ) - return cOCT6100_ERR_REMOTEDEBUG_TRANSACTION_ANSWERED; - - /* Update transaction number since packet will be interpreted. */ - pSessionEntry->ulTransactionNum = f_pOgrdtpHeader->ulTransactionNum; - pSessionEntry->ulPktByteSize = f_pOgrdtpHeader->ulPktByteSize; - - return cOCT6100_ERR_OK; - } - else if ( ulResult == OCTAPI_BT0_KEY_NOT_IN_TREE ) - { - /* If there is a free entry in the session list then seize it. Else, try to - find an entry which has timed out. If there are none then return an error. */ - if ( pRemoteDebugInfo->ulNumSessionsOpen < pRemoteDebugInfo->ulMaxSessionsOpen ) - { - ulNewSessionIndex = pRemoteDebugInfo->ulNumSessionsOpen; - } - else /* ( pRemoteDebugInfo->ulNumSessionsOpen == pRemoteDebugInfo->ulMaxSessionsOpen ) */ - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pRemoteDebugInfo->ulSessionListHead, pSessionEntry ) - - ulResult = octapi_lm_subtract( GetTime.aulWallTimeUs, 1, pSessionEntry->aulLastPktTime, 1, aulTimeDiff, 1, &usNegative ); - if ( ulResult != cOCT6100_ERR_OK || usNegative != FALSE ) - return cOCT6100_ERR_FATAL_43; - - /* If there are no session list entries available then return the packet with - a parsing error. */ - if ( aulTimeDiff[ 1 ] == 0 && aulTimeDiff[ 0 ] < (cOCTRPC_SESSION_TIMEOUT * 1000000) ) - return cOCT6100_ERR_REMOTEDEBUG_ALL_SESSIONS_OPEN; - - ulNewSessionIndex = pRemoteDebugInfo->ulSessionListHead; - - /* Remove old session index. */ - ulResult = octapi_bt0_remove_node( pSessionTree, ( ( PVOID )&pSessionEntry->ulSessionNum ) ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_44; - - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = pSessionEntry->ulForwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListHead = pSessionEntry->ulForwardLink; - } - - if ( pSessionEntry->ulForwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulForwardLink, pSessionLink ) - pSessionLink->ulBackwardLink = pSessionEntry->ulBackwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListTail = pSessionEntry->ulBackwardLink; - } - - /* Decrement number of open sessions. */ - pRemoteDebugInfo->ulNumSessionsOpen--; - } - - /* Add new session. */ - ulResult = octapi_bt0_add_node( pSessionTree, ( ( PVOID )&f_pOgrdtpHeader->ulDebugSessionNum ), ( ( PVOID* )&pulTreeData ) ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_45; - *pulTreeData = ulNewSessionIndex; - - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, ulNewSessionIndex, pSessionEntry ) - - pSessionEntry->aulLastPktTime[ 0 ] = GetTime.aulWallTimeUs[ 0 ]; - pSessionEntry->aulLastPktTime[ 1 ] = GetTime.aulWallTimeUs[ 1 ]; - pSessionEntry->ulSessionNum = f_pOgrdtpHeader->ulDebugSessionNum; - pSessionEntry->ulTransactionNum = f_pOgrdtpHeader->ulTransactionNum; - pSessionEntry->ulPktRetryNum = f_pOgrdtpHeader->ulPktRetryNum; - - pSessionEntry->ulBackwardLink = pRemoteDebugInfo->ulSessionListTail; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - pRemoteDebugInfo->ulSessionListTail = ulNewSessionIndex; - if ( pRemoteDebugInfo->ulSessionListHead == cOCT6100_INVALID_VALUE ) - pRemoteDebugInfo->ulSessionListHead = ulNewSessionIndex; - - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = ulNewSessionIndex; - } - - *f_pulSessionIndex = ulNewSessionIndex; - - /* Increment number of open sessions. */ - pRemoteDebugInfo->ulNumSessionsOpen++; - - return cOCT6100_ERR_OK; - } - else - { - return cOCT6100_ERR_FATAL_46; - } -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcReadWord - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_READ_WORD command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcReadWord -VOID Oct6100ApiRpcReadWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_READ_WORD pReadCommand; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Get pointer to command arguments. */ - pReadCommand = ( tPOCT6100_RPC_READ_WORD )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - ReadParams.ulReadAddress = pReadCommand->ulAddress; - - /* Supply memory for read data. */ - ReadParams.pusReadData = &usReadData; - - /* Perform read access. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - - usReadData &= 0xFFFF; - - /* Return read data and result. */ - pReadCommand->ulReadData = (usReadData << 16) | usReadData; - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcReadBurst - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_READ_BURST command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcReadBurst -VOID Oct6100ApiRpcReadBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_READ_BURST pBurstCommand; - tOCT6100_READ_BURST_PARAMS BurstParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - UINT32 i; - PUINT16 pusReadData; - UINT32 ulNumWordsToRead; - - /* Get local pointer to remote debugging read data buffer. */ - mOCT6100_GET_REMOTE_DEBUG_DATA_BUF_PNT( f_pApiInstance->pSharedInfo, pusReadData ) - - /* Get pointer to command arguments. */ - pBurstCommand = ( tPOCT6100_RPC_READ_BURST )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - BurstParams.ulReadAddress = pBurstCommand->ulAddress; - - - /* Supply memory for read data. */ - BurstParams.pusReadData = pusReadData; - - ulNumWordsToRead = pBurstCommand->ulBurstLength; - while( ulNumWordsToRead > 0) - { - if ( ulNumWordsToRead <= f_pApiInstance->pSharedInfo->ChipConfig.usMaxRwAccesses ) - BurstParams.ulReadLength = ulNumWordsToRead; - else - BurstParams.ulReadLength = f_pApiInstance->pSharedInfo->ChipConfig.usMaxRwAccesses; - - /* Perform read access. */ - mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - { - f_pCmndHeader->ulFunctionResult = ulResult; - return; - } - - BurstParams.ulReadAddress += BurstParams.ulReadLength * 2; - BurstParams.pusReadData += BurstParams.ulReadLength; - - /* Update the number of dword to read. */ - ulNumWordsToRead -= BurstParams.ulReadLength; - } - - /* Return read data. */ - ulTempVar = (pBurstCommand->ulBurstLength + 1) / 2; - for ( i = 0; i < ulTempVar; i++ ) - { - pBurstCommand->aulReadData[ i ] = (*pusReadData & 0xFFFF) << 16; - pusReadData++; - pBurstCommand->aulReadData[ i ] |= (*pusReadData & 0xFFFF) << 0; - pusReadData++; - } - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcReadArray - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_READ_ARRAY command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcReadArray -VOID Oct6100ApiRpcReadArray( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_READ_ARRAY pArrayCommand; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 i; - PUINT32 pulAddressArray; - PUINT32 pulDataArray; - UINT16 usReadData; - - - /* Get pointer to command arguments. */ - pArrayCommand = ( tPOCT6100_RPC_READ_ARRAY )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Supply memory for read data. */ - ReadParams.pusReadData = &usReadData; - - /* Get pointers to array of addresses and data. */ - pulAddressArray = pArrayCommand->aulArrayData; - pulDataArray = pArrayCommand->aulArrayData + pArrayCommand->ulArrayLength; - - for ( i = 0; i < pArrayCommand->ulArrayLength; i++ ) - { - /* Copy parameters from packet payload to local read structure. */ - ReadParams.ulReadAddress = pulAddressArray[ i ]; - - /* Perform read access. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - break; - - /* Return read data. */ - if ( (i % 2) == 0 ) - pulDataArray[ i / 2 ] = (usReadData & 0xFFFF) << 16; - else /* ( (i % 2) == 1 ) */ - pulDataArray[ i / 2 ] |= (usReadData & 0xFFFF) << 0; - } - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcWriteWord - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_WRITE_WORD command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcWriteWord -VOID Oct6100ApiRpcWriteWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_WRITE_WORD pWriteCommand; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Get pointer to command arguments. */ - pWriteCommand = ( tPOCT6100_RPC_WRITE_WORD )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - WriteParams.ulWriteAddress = pWriteCommand->ulAddress; - WriteParams.usWriteData = (UINT16)pWriteCommand->ulWriteData; - - /* Perform write access. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcWriteSmear - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_WRITE_SMEAR command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcWriteSmear -VOID Oct6100ApiRpcWriteSmear( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_WRITE_SMEAR pSmearCommand; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulResult; - - /* Get pointer to command arguments. */ - pSmearCommand = ( tPOCT6100_RPC_WRITE_SMEAR )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set the smear structure parameters. */ - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - SmearParams.ulWriteAddress = pSmearCommand->ulAddress; - SmearParams.usWriteData = (UINT16)pSmearCommand->ulWriteData; - SmearParams.ulWriteLength = pSmearCommand->ulSmearLength; - - /* Perform write access. */ - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcWriteBurst - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_WRITE_BURST command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcWriteBurst -VOID Oct6100ApiRpcWriteBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_WRITE_BURST pBurstCommand; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT32 ulResult; - UINT32 ulTempVar; - UINT32 i, j; - PUINT16 pusWriteData; - - /* Get local pointer to remote debugging write data buffer. */ - mOCT6100_GET_REMOTE_DEBUG_DATA_BUF_PNT( f_pApiInstance->pSharedInfo, pusWriteData ) - - /* Get pointer to command arguments. */ - pBurstCommand = ( tPOCT6100_RPC_WRITE_BURST )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - ulTempVar = (pBurstCommand->ulBurstLength + 1) / 2; - for ( i = 0, j = 0; i < ulTempVar; i++ ) - { - pusWriteData[ j++ ] = (UINT16)((pBurstCommand->aulWriteData[ i ] >> 16) & 0xFFFF); - pusWriteData[ j++ ] = (UINT16)((pBurstCommand->aulWriteData[ i ] >> 0) & 0xFFFF); - } - - /* Set some structure parameters. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - BurstParams.ulWriteAddress = pBurstCommand->ulAddress; - BurstParams.ulWriteLength = pBurstCommand->ulBurstLength; - BurstParams.pusWriteData = pusWriteData; - - /* Perform write access. */ - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcSetHotChannel - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_SET_HOT_CHANNEL command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcSetHotChannel -VOID Oct6100ApiRpcSetHotChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_SET_HOT_CHANNEL pHotChanCommand; - tOCT6100_DEBUG_SELECT_CHANNEL DebugSelectChannel; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - - pHotChanCommand = ( tPOCT6100_RPC_SET_HOT_CHANNEL )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Verify if the hot channel index is valid. */ - if ( pHotChanCommand->ulHotChannel >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - { - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_REMOTEDEBUG_INVALID_HOT_CHAN_INDEX; - return; - } - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, pHotChanCommand->ulHotChannel ); - - DebugSelectChannel.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pHotChanCommand->ulHotChannel; - - /* The PCM law parameter is now obsolete. */ - /* The instance knows the law of the channel being recorded! */ - - /* Call the function. */ - ulResult = Oct6100DebugSelectChannelSer( f_pApiInstance, &DebugSelectChannel, FALSE ); - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcGetDebugChanIndex - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_GET_DEBUG_CHAN_INDEX command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcGetDebugChanIndex -VOID Oct6100ApiRpcGetDebugChanIndex( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_GET_DEBUG_CHAN_INDEX pDebugChanCommand; - - pDebugChanCommand = ( tPOCT6100_RPC_GET_DEBUG_CHAN_INDEX )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set the debug channel index of the structure. */ - pDebugChanCommand->ulDebugChanIndex = f_pApiInstance->pSharedInfo->DebugInfo.usRecordMemIndex; - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcDisconnect - -Description: Destroy the current session. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. -f_ulSessionNumber Session number of the current remote debugging session. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcDisconnect -VOID Oct6100ApiRpcDisconnect( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader, - IN UINT32 f_ulSessionNumber ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_REMOTE_DEBUG_INFO pRemoteDebugInfo; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionEntry; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionTempEntry; - PVOID pSessionTree; - UINT32 ulResult; - PUINT32 pulTreeData; - UINT32 ulSessionIndex; - - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_OK; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get a local pointer to the remote debugging info. */ - pRemoteDebugInfo = &pSharedInfo->RemoteDebugInfo; - - /* Check if the session number has an associated session list entry. */ - mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pSessionTree ) - - ulResult = octapi_bt0_query_node( pSessionTree, ( ( PVOID )(&f_ulSessionNumber) ), ( ( PVOID* )&pulTreeData ) ); - if ( ulResult != cOCT6100_ERR_OK ) - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_REMOTEDEBUG_INAVLID_SESSION_NUMBER; - - /* Return session index. */ - ulSessionIndex= *pulTreeData; - - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, ulSessionIndex, pSessionEntry ); - - /* Clear the entry of the session. */ - pSessionEntry->aulLastPktTime[ 0 ] = 0; - pSessionEntry->aulLastPktTime[ 1 ] = 0; - pSessionEntry->ulSessionNum = cOCT6100_INVALID_VALUE; - pSessionEntry->ulTransactionNum = cOCT6100_INVALID_VALUE; - pSessionEntry->ulPktRetryNum = cOCT6100_INVALID_VALUE; - - /* Update the other entry before removing the node. */ - pSessionEntry->ulBackwardLink = pRemoteDebugInfo->ulSessionListTail; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionTempEntry ); - pSessionTempEntry->ulForwardLink = pSessionEntry->ulForwardLink; - } - else /* pSessionEntry->ulBackwardLink == cOCT6100_INVALID_VALUE */ - { - pRemoteDebugInfo->ulSessionListHead = pSessionEntry->ulForwardLink; - } - - if ( pSessionEntry->ulForwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulForwardLink, pSessionTempEntry ); - pSessionTempEntry->ulBackwardLink = pSessionEntry->ulBackwardLink; - } - else /* pSessionEntry->ulForwardLink == cOCT6100_INVALID_VALUE */ - { - pRemoteDebugInfo->ulSessionListTail = pSessionEntry->ulBackwardLink; - } - - /* Invalidate the pointer. */ - pSessionEntry->ulBackwardLink = cOCT6100_INVALID_VALUE; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - /* Remove the session. */ - ulResult = octapi_bt0_remove_node( pSessionTree, ( ( PVOID )&f_ulSessionNumber ) ); - if ( ulResult != cOCT6100_ERR_OK ) - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_FATAL_47; - - /* Increment number of open sessions. */ - pRemoteDebugInfo->ulNumSessionsOpen--; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c deleted file mode 100644 index 7f3182b3..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c +++ /dev/null @@ -1,2055 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tlv.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to read information allowing the - API to know where all the features supported by this API version are - located in the chip's external memory. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 113 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" - -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_tlv_priv.h" - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProcessTlvRegion - -Description: This function will read and interpret the TLV memory of the chip - to obtain memory offsets and features available of the image - loaded into the chip. - - The API will read this region until it finds a TLV type of 0 with - a length of 0. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProcessTlvRegion -UINT32 Oct6100ApiProcessTlvRegion( - tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - UINT32 ulResult; - - UINT32 ulTlvTypeField; - UINT32 ulTlvLengthField; - UINT32 ulTlvWritingTimeoutCount = 0; - UINT32 ulConditionFlag = TRUE; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set the address of the first TLV type. */ - ReadParams.ulReadAddress = cOCT6100_TLV_BASE; - ReadParams.ulReadAddress += 2; - - /* Wait for the TLV configuration to be configured in memory. */ - while ( ulConditionFlag ) - { - /* Read the TLV write done flag. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData & 0x1 ) - break; - - ulTlvWritingTimeoutCount++; - if ( ulTlvWritingTimeoutCount == 0x100000 ) - return cOCT6100_ERR_TLV_TIMEOUT; - } - - /*======================================================================*/ - /* Read the first 16 bits of the TLV type. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField |= usReadData; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Now, read the TLV field length. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField = usReadData << 16; - - /* Read the last word of the TLV length. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField |= usReadData; - - /* Modify the address to point at the TLV value field. */ - ReadParams.ulReadAddress += 2; - - /*======================================================================*/ - - /* Read the TLV value until the end of TLV region is reached. */ - while( !((ulTlvTypeField == 0) && (ulTlvLengthField == 0)) ) - { - ulResult = Oct6100ApiInterpretTlvEntry( f_pApiInstance, - ulTlvTypeField, - ulTlvLengthField, - ReadParams.ulReadAddress ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the address to after the TLV value. */ - ReadParams.ulReadAddress += ulTlvLengthField; - - /*======================================================================*/ - /* Read the first 16 bits of the TLV type. */ - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField |= usReadData; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Now, read the TLV field length. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField = usReadData << 16; - - /* Read the last word of the TLV length. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField |= usReadData; - - ReadParams.ulReadAddress += 2; - - /*======================================================================*/ - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInterpretTlvEntry - -Description: This function will interpret a TLV entry from the chip. All - known TLV types by the API are exhaustively listed here. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulTlvFieldType Type of the TLV field to interpret. -f_ulTlvFieldLength Byte length of the TLV field. -f_ulTlvValueAddress Address where the data of the TLV block starts. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInterpretTlvEntry -UINT32 Oct6100ApiInterpretTlvEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTlvFieldType, - IN UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulTlvValueAddress ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT16 usReadData; - UINT32 i; - UINT32 ulTempValue = 0; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Find out how to interpret the TLV value according to the TLV type. */ - switch( f_ulTlvFieldType ) - { - case cOCT6100_TLV_TYPE_VERSION_NUMBER: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_VERSION_NUMBER, - cOCT6100_TLV_MAX_LENGTH_VERSION_NUMBER ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ReadParams.ulReadAddress = f_ulTlvValueAddress; - - for( i = 0; i < (f_ulTlvFieldLength/2); i++ ) - { - /* Perform the actual read. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pApiInstance->pSharedInfo->ImageInfo.szVersionNumber[ (i * 2) ] = (UINT8)((usReadData >> 8) & 0xFF); - f_pApiInstance->pSharedInfo->ImageInfo.szVersionNumber[ (i * 2) + 1 ] = (UINT8)((usReadData >> 0) & 0xFF); - - /* Modify the address. */ - ReadParams.ulReadAddress += 2; - } - } - break; - - case cOCT6100_TLV_TYPE_CUSTOMER_PROJECT_ID: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CUSTOMER_PROJECT_ID, - cOCT6100_TLV_MAX_LENGTH_CUSTOMER_PROJECT_ID ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Perform the actual read. */ - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->ImageInfo.ulBuildId ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH0_MAIN_BASE_ADDRESS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH0_MAIN_BASE_ADDRESS, - cOCT6100_TLV_MAX_LENGTH_CH0_MAIN_BASE_ADDRESS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase &= 0x0FFFFFFF; - - /* Modify the base address to incorporate the external memory offset. */ - f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase += cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_IO_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_IO_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_IO_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_ZCB_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinCBMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_ZCB_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinCBMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_XCB_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSinCBMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_XCB_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSinCBMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_YCB_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutCBMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_YCB_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutCBMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_FREE_MEM_BASE_ADDRESS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_FREE_MEM_BASE_ADDRESS, - cOCT6100_TLV_MAX_LENGTH_FREE_MEM_BASE_ADDRESS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress &= 0x0FFFFFFF; - - } - break; - - case cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_ROOT_CONF_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_ROOT_CONF_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_ROOT_CONF_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_OFFSET, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_SIZE, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_OFFSET, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_SIZE, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemSize ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_ZWP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZWP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZWP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_ZIS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZIS, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZIS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_ZSP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZSP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZSP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_YWP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YWP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YWP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_YIS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YIS, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YIS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_YSP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YSP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YSP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RO_ZRP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_ZRP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_ZRP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RO_YRP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_YRP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_YRP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_CNR_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CNR_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CNR_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst ); - } - break; - - case cOCT6100_TLV_TYPE_ANR_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ANR_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst ); - } - break; - - case cOCT6100_TLV_TYPE_HZ_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_HZ_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_HZ_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fRinDcOffsetRemoval = TRUE; - break; - - case cOCT6100_TLV_TYPE_HX_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_HX_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_HX_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fSinDcOffsetRemoval = TRUE; - break; - - case cOCT6100_TLV_TYPE_LCA_Z_CONF_BOFF_RW_GAIN: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN, - cOCT6100_TLV_MAX_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinLevelControlOfst ); - } - break; - - case cOCT6100_TLV_TYPE_LCA_Y_CONF_BOFF_RW_GAIN: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN, - cOCT6100_TLV_MAX_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutLevelControlOfst ); - } - break; - - case cOCT6100_TLV_TYPE_CNA_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CNA_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CNA_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ComfortNoiseModeOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fComfortNoise = TRUE; - break; - - case cOCT6100_TLV_TYPE_NOA_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NOA_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_NOA_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.NlpControlFieldOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fNlpControl = TRUE; - break; - - case cOCT6100_TLV_TYPE_VFA_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_VFA_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_VFA_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.VadControlFieldOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fSilenceSuppression = TRUE; - break; - - case cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_TAIL_DISP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP, - cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchTailDisplOfst ); - } - break; - - case cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_INST: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST, - cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchBootInstructionOfst ); - } - break; - - case cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_RESULT: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT, - cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchBootResultOfst ); - } - break; - - case cOCT6100_TLV_TYPE_TDM_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TDM_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_TDM_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ToneDisablerControlOfst ); - } - - f_pApiInstance->pSharedInfo->ImageInfo.fToneDisabler = TRUE; - break; - - case cOCT6100_TLV_TYPE_DIS_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DIS_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_DIS_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.TailDisplEnableOfst ); - } - - f_pApiInstance->pSharedInfo->ImageInfo.fTailDisplacement = TRUE; - break; - - case cOCT6100_TLV_TYPE_NT_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NT_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_NT_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.NlpTrivialFieldOfst ); - } - - break; - - case cOCT6100_TLV_TYPE_DEBUG_CHAN_INDEX_VALUE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_INDEX_VALUE, - cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_INDEX_VALUE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - f_pApiInstance->pSharedInfo->DebugInfo.usRecordMemIndex = (UINT16)( ulTempValue & 0xFFFF ); - - break; - - case cOCT6100_TLV_TYPE_ADPCM_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ADPCM_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ADPCM_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - if ( ulTempValue == 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm = FALSE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm = TRUE; - - break; - - case cOCT6100_TLV_TYPE_CONFERENCING_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CONFERENCING_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CONFERENCING_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - if ( ulTempValue == 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fConferencing = FALSE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fConferencing = TRUE; - - break; - - case cOCT6100_TLV_TYPE_TONE_DETECTOR_PROFILE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TONE_DETECTOR_PROFILE, - cOCT6100_TLV_MIN_LENGTH_TONE_DETECTOR_PROFILE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->ImageInfo.ulToneProfileNumber ); - } - - break; - - case cOCT6100_TLV_TYPE_MAX_TAIL_DISPLACEMENT: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_DISPLACEMENT, - cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_DISPLACEMENT ); - if ( ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulTailDispTempValue; - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTailDispTempValue ); - - ulTailDispTempValue += 1; /* Convert the value into milliseconds.*/ - ulTailDispTempValue *= 16; /* value was given in multiple of 16 ms. */ - - if ( ulTailDispTempValue >= 128 ) - f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailDisplacement = (UINT16)( ulTailDispTempValue - 128 ); - else - f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailDisplacement = 0; - - } - - break; - - case cOCT6100_TLV_TYPE_AEC_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AEC_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_AEC_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AecFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fAecEnabled = TRUE; - - /* Acoustic echo cancellation available! */ - f_pApiInstance->pSharedInfo->ImageInfo.fAcousticEcho = TRUE; - - break; - - case cOCT6100_TLV_TYPE_PCM_LEAK_CONF_BOFF_RW: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_PCM_LEAK_CONF_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_PCM_LEAK_CONF_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PcmLeakFieldOfst ); - } - - f_pApiInstance->pSharedInfo->ImageInfo.fNonLinearityBehaviorA = TRUE; - break; - - case cOCT6100_TLV_TYPE_DEFAULT_ERL_CONF_BOFF_RW: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEFAULT_ERL_CONF_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_DEFAULT_ERL_CONF_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.DefaultErlFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fDefaultErl = TRUE; - - break; - - case cOCT6100_TLV_TYPE_TONE_REM_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ToneRemovalFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fToneRemoval = TRUE; - - break; - - - - case cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT, - cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fMaxEchoPoint = TRUE; - - break; - - case cOCT6100_TLV_TYPE_NLP_CONV_CAP_CONF_BOFF_RW: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.NlpConvCapFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fNonLinearityBehaviorB = TRUE; - - break; - - case cOCT6100_TLV_TYPE_MATRIX_EVENT_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MATRIX_EVENT_SIZE, - cOCT6100_TLV_MAX_LENGTH_MATRIX_EVENT_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulDebugEventSize ); - } - - break; - - case cOCT6100_TLV_TYPE_CNR_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CNR_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CNR_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fConferencingNoiseReduction = (UINT8)( ulTempValue & 0xFF ); - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fConferencingNoiseReduction == TRUE ) - { - /* Set flag indicating that the dominant speaker feature is present. */ - f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled = TRUE; - } - } - - break; - - case cOCT6100_TLV_TYPE_MAX_TAIL_LENGTH_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailLength = (UINT16)( ulTempValue & 0xFFFF ); - } - - break; - - case cOCT6100_TLV_TYPE_MAX_NUMBER_OF_CHANNELS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_NUMBER_OF_CHANNELS, - cOCT6100_TLV_MAX_LENGTH_MAX_NUMBER_OF_CHANNELS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels = (UINT16)( ulTempValue & 0xFFFF ); - } - - break; - - case cOCT6100_TLV_TYPE_PLAYOUT_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_PLAYOUT_ENABLE, - cOCT6100_TLV_MAX_LENGTH_PLAYOUT_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Set flag indicating that the feature is present. */ - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - f_pApiInstance->pSharedInfo->ImageInfo.fBufferPlayout = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_DOMINANT_SPEAKER_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst ); - } - - break; - - case cOCT6100_TLV_TYPE_TAIL_DISP_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fPerChannelTailDisplacement = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ANR_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ANR_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAdaptiveNoiseReduction = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_MUSIC_PROTECTION_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fMusicProtection = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_AEC_DEFAULT_ERL_BOFF: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AecDefaultErlFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAecDefaultErl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Z_ALC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinAutoLevelControl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Y_ALC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutAutoLevelControl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Z_HLC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinHighLevelCompensation = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Y_HLC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutHighLevelCompensation = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ALC_HLC_STATUS_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AlcHlcStatusOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAlcHlcStatus = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Z_PLAYOUT_HARD_SKIP_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Y_PLAYOUT_HARD_SKIP_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_AFT_FIELD_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AFT_FIELD_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_AFT_FIELD_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AftControlOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAftControl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_VOICE_DETECTED_STAT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_VOICE_DETECTED_STAT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_VOICE_DETECTED_STAT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSinVoiceDetectedStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_GAIN_APPLIED_RIN_STAT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinAppliedGainStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_GAIN_APPLIED_SOUT_STAT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutAppliedGainStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_MAX_ADAPT_ALE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_ADAPT_ALE_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_MAX_ADAPT_ALE_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AdaptiveAleOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fListenerEnhancement = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_RIN_ANR_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RIN_ANR_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_RIN_ANR_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAnrOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRoutNoiseReduction = TRUE; - } - - break; - case cOCT6100_TLV_TYPE_RIN_ANR_VALUE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RIN_ANR_VALUE_RW, - cOCT6100_TLV_MAX_LENGTH_RIN_ANR_VALUE_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAnrValOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRoutNoiseReductionLevel = TRUE; - } - - break; - case cOCT6100_TLV_TYPE_RIN_MUTE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RIN_MUTE_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_RIN_MUTE_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinMuteOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinMute = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_SIN_MUTE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_SIN_MUTE_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_SIN_MUTE_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SinMuteOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSinMute = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_NUMBER_PLAYOUT_EVENTS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NUMBER_PLAYOUT_EVENTS, - cOCT6100_TLV_MAX_LENGTH_NUMBER_PLAYOUT_EVENTS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_ANR_SNR_IMPROVEMENT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AnrSnrEnhancementOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAnrSnrEnhancement = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ANR_AGRESSIVITY_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_AGRESSIVITY_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_ANR_AGRESSIVITY_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAnrVoiceNoiseSegregation = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_CHAN_TAIL_LENGTH_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_TAIL_LENGTH_BOFF, - cOCT6100_TLV_MAX_LENGTH_CHAN_TAIL_LENGTH_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fPerChannelTailLength = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_CHAN_VQE_TONE_DISABLING_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_VQE_TONE_DIS_BOFF, - cOCT6100_TLV_MAX_LENGTH_CHAN_VQE_TONE_DIS_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fToneDisablerVqeActivationDelay = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_AF_TAIL_DISP_VALUE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AF_TAIL_DISP_VALUE_BOFF, - cOCT6100_TLV_MAX_LENGTH_AF_TAIL_DISP_VALUE_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAfTailDisplacement = TRUE; - } - - break; - - - case cOCT6100_TLV_TYPE_POUCH_COUNTER_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POUCH_COUNTER_BOFF, - cOCT6100_TLV_MAX_LENGTH_POUCH_COUNTER_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchCounterFieldOfst ); - - f_pApiInstance->pSharedInfo->DebugInfo.fPouchCounter = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_AEC_TAIL_LENGTH_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AEC_TAIL_BOFF, - cOCT6100_TLV_MAX_LENGTH_AEC_TAIL_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AecTailLengthFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAecTailLength = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_MATRIX_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MATRIX_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_MATRIX_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixBaseAddress ); - - /* Mask the upper bits set by the firmware. */ - f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixBaseAddress &= 0x0FFFFFFF; - - /* Modify the base address to incorporate the external memory offset. */ - f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixBaseAddress += cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - } - - break; - - case cOCT6100_TLV_TYPE_DEBUG_CHAN_STATS_BYTE_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_DEBUG_CHAN_LITE_STATS_BYTE_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_HOT_CHANNEL_SELECT_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress ); - } - - break; - - case cOCT6100_TLV_TYPE_MATRIX_TIMESTAMP_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TIMESTAMP_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_TIMESTAMP_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixTimestampBaseAddress ); - } - - break; - - case cOCT6100_TLV_TYPE_MATRIX_WP_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MATRIX_WP_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_MATRIX_WP_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixWpBaseAddress ); - } - - break; - - case cOCT6100_TLV_TYPE_AF_WRITE_PTR_BYTE_OFFSET: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AF_WRITE_PTR_BYTE_OFFSET, - cOCT6100_TLV_MAX_LENGTH_AF_WRITE_PTR_BYTE_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulAfWritePtrByteOffset ); - } - - break; - - case cOCT6100_TLV_TYPE_RECORDED_PCM_EVENT_BYTE_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_IS_ISR_CALLED_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IS_ISR_CALLED_BOFF, - cOCT6100_TLV_MAX_LENGTH_IS_ISR_CALLED_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.IsIsrCalledFieldOfst ); - - f_pApiInstance->pSharedInfo->DebugInfo.fIsIsrCalledField = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_MUSIC_PROTECTION_ENABLE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF, - cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.MusicProtectionFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fMusicProtectionConfiguration = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_ENABLE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION, - cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fIdleCodeDetection = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION_BOFF, - cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_IMAGE_TYPE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IMAGE_TYPE, - cOCT6100_TLV_MAX_LENGTH_IMAGE_TYPE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - /* Check if read image type value is what's expected. */ - if ( ( ulTempValue != cOCT6100_IMAGE_TYPE_WIRELINE ) - && ( ulTempValue != cOCT6100_IMAGE_TYPE_COMBINED ) ) - return cOCT6100_ERR_FATAL_E9; - - f_pApiInstance->pSharedInfo->ImageInfo.byImageType = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_MAX_WIRELINE_CHANNELS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_WIRELINE_CHANNELS, - cOCT6100_TLV_MAX_LENGTH_MAX_WIRELINE_CHANNELS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - break; - - case cOCT6100_TLV_TYPE_AF_EVENT_CB_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AF_EVENT_CB_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_AF_EVENT_CB_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulAfEventCbByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_BUFFER_PLAYOUT_SKIP_IN_EVENTS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS, - cOCT6100_TLV_MAX_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ZZ_ENERGY_CHAN_STATS_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF, - cOCT6100_TLV_MAX_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinEnergyStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_YY_ENERGY_CHAN_STATS_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_YY_ENERGY_CHAN_STATS_BOFF, - cOCT6100_TLV_MAX_LENGTH_YY_ENERGY_CHAN_STATS_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutEnergyStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE, - cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - if ( ulTempValue != 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fDoubleTalkBehavior = TRUE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fDoubleTalkBehavior = FALSE; - - } - - break; - - case cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF, - cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fDoubleTalkBehaviorFieldOfst = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_SOUT_NOISE_BLEACHING: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_SOUT_NOISE_BLEACHING, - cOCT6100_TLV_MAX_LENGTH_SOUT_NOISE_BLEACHING ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - if ( ulTempValue != 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fSoutNoiseBleaching = TRUE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fSoutNoiseBleaching = FALSE; - - } - - break; - - case cOCT6100_TLV_TYPE_NLP_STATISTICS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NLP_STATISTICS, - cOCT6100_TLV_MAX_LENGTH_NLP_STATISTICS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - if ( ulTempValue != 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fSinLevel = TRUE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fSinLevel = FALSE; - - } - - break; - - default: - /* Unknown TLV type field... check default length and nothing else. */ - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEFAULT, - cOCT6100_TLV_MAX_LENGTH_DEFAULT ); - break; - } - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTlvCheckLengthField - -Description: This function validates the TLV length field. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_ulTlvFieldLength Length field read from the TLV. -f_ulMinLengthValue Minimum value supported for the TLV. -f_ulMaxLengthValue Maximum value supported for the TLV. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTlvCheckLengthField -UINT32 Oct6100ApiTlvCheckLengthField( - IN UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulMinLengthValue, - IN UINT32 f_ulMaxLengthValue ) -{ - /* Check if the value is too small. */ - if ( f_ulTlvFieldLength < f_ulMinLengthValue ) - return ( cOCT6100_ERR_FATAL_59 ); - - /* Check if the value is too big. */ - if ( f_ulTlvFieldLength > f_ulMaxLengthValue ) - return ( cOCT6100_ERR_FATAL_5A ); - - /* Check if the value is dword aligned. */ - if ( ( f_ulTlvFieldLength % 4 ) != 0 ) - return ( cOCT6100_ERR_OPEN_INVALID_TLV_LENGTH ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTlvReadBitOffsetStruct - -Description: This function extracts a bit offset structure from the TLV. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulAddress Address where the read the TLV information. -f_pBitOffsetStruct Pointer to a bit offset stucture. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTlvReadBitOffsetStruct -UINT32 Oct6100ApiTlvReadBitOffsetStruct( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT tPOCT6100_TLV_OFFSET f_pBitOffsetStruct ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - - UINT32 ulResult; - UINT32 ulOffsetValue; - UINT32 ulSizeValue; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*======================================================================*/ - /* Read the first 16 bits of the TLV field. */ - - ReadParams.ulReadAddress = f_ulAddress; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulOffsetValue = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulOffsetValue |= usReadData; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Read the first 16 bits of the TLV field. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulSizeValue = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulSizeValue |= usReadData; - - /*======================================================================*/ - - /* Set the structure fields. */ - f_pBitOffsetStruct->usDwordOffset = (UINT16)(ulOffsetValue / 32); - f_pBitOffsetStruct->byBitOffset = (UINT8) (32 - (ulOffsetValue % 32) - ulSizeValue); - f_pBitOffsetStruct->byFieldSize = (UINT8) (ulSizeValue); - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c deleted file mode 100644 index 6d9c82bc..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c +++ /dev/null @@ -1,1088 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tone_detection.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to enable and disable tone detection on - an echo channel. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 51 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_tone_detection_inst.h" -#include "oct6100api/oct6100_events_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_tone_detection_pub.h" -#include "oct6100api/oct6100_events_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_tone_detection_priv.h" -#include "oct6100_events_priv.h" - - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionEnable - -Description: This function enables the generation of event for a selected - tone on the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectEnable Pointer to tone detection enable structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionEnableDef -UINT32 Oct6100ToneDetectionEnableDef( - tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ) -{ - f_pToneDetectEnable->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pToneDetectEnable->ulToneNumber = cOCT6100_INVALID_TONE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ToneDetectionEnable -UINT32 Oct6100ToneDetectionEnable( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ToneDetectionEnableSer( f_pApiInstance, f_pToneDetectEnable ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionDisable - -Description: This function disables the detection of a tone for a specific - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectDisable Pointer to tone detection disable structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionDisableDef -UINT32 Oct6100ToneDetectionDisableDef( - tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ) -{ - f_pToneDetectDisable->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pToneDetectDisable->ulToneNumber = cOCT6100_INVALID_VALUE; - f_pToneDetectDisable->fDisableAll = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ToneDetectionDisable -UINT32 Oct6100ToneDetectionDisable( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ToneDetectionDisableSer( f_pApiInstance, f_pToneDetectDisable ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionEnableSer - -Description: Activate the detection of a tone on the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectEnable Pointer to tone detect enable structure. This structure - contains, among other things, the tone ID to enable - and the channel handle where detection should be - enabled. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionEnableSer -UINT32 Oct6100ToneDetectionEnableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ) -{ - UINT32 ulChanIndex; - UINT32 ulExtToneChanIndex; - UINT32 ulToneEventNumber = 0; - - UINT32 ulResult; - - /* Check the user's configuration of the tone detection for errors. */ - ulResult = Oct6100ApiCheckToneEnableParams( - f_pApiInstance, - f_pToneDetectEnable, - &ulChanIndex, - &ulToneEventNumber, - - &ulExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to enable tone detection. */ - ulResult = Oct6100ApiWriteToneDetectEvent( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - - ulExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the channel entry to indicate that a new tone has been activated. */ - ulResult = Oct6100ApiUpdateChanToneDetectEntry( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - ulExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckToneEnableParams - -Description: Check the validity of the channel and tone requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectEnable Pointer to tone detection enable structure. -f_pulChannelIndex Pointer to the channel index. -f_pulToneEventNumber Pointer to the Index of the tone associated to the requested tone. -f_pulExtToneChanIndex Pointer to the index of the extended channel index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckToneEnableParams -UINT32 Oct6100ApiCheckToneEnableParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - - OUT PUINT32 f_pulExtToneChanIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - UINT32 i; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pToneDetectEnable->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pToneDetectEnable->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pToneDetectEnable->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - /* Set the extended tone detection info if it is activated on the channel. */ - *f_pulExtToneChanIndex = pEchoChannel->usExtToneChanIndex; - - /*=====================================================================*/ - /* Check the tone information. */ - - /* Find out if the tone is present in the build. */ - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - if ( f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ i ].ulToneID == f_pToneDetectEnable->ulToneNumber ) - { - *f_pulToneEventNumber = i; - break; - } - } - - /* Check if tone is present. */ - if ( i == cOCT6100_MAX_TONE_EVENT ) - return cOCT6100_ERR_NOT_SUPPORTED_TONE_NOT_PRESENT_IN_FIRMWARE; - - /* Check if the requested tone is actually detected. */ - if ((( pEchoChannel->aulToneConf[ *f_pulToneEventNumber / 32 ] >> ( 31 - ( *f_pulToneEventNumber % 32 ))) & 0x1) == 1 ) - return cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED; - - - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteToneDetectEvent - -Description: Write the tone detection event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Event number of the tone to be activated. -f_ulExtToneChanIndex Index of the extended tone detection channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteToneDetectEvent -UINT32 Oct6100ApiWriteToneDetectEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - - IN UINT32 f_ulExtToneChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Read the current event config about to be modified. */ - - ReadParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - /* Set the tone event in the channel main memory for the requested direction. */ - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData |= ( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 ))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - /* Also program the extended channel if one is present. */ - - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - /* Read the current event config about to be modified. */ - ReadParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulExtToneChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the tone event in the channel main memory for the requested direction. */ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData |= ( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 ))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateChanToneDetectEntry - -Description: Update the echo channel entry to store the info about the tone - being configured to generate detection events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Enabled tone event number. -f_ulExtToneChanIndex Index of the extended tone detection channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateChanToneDetectEntry -UINT32 Oct6100ApiUpdateChanToneDetectEntry ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulToneEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulChannelIndex ); - - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry |= ( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 ))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - - /* Configure also the extended channel if necessary. */ - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulExtToneChanIndex ); - - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry |= ( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 ))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - } - - /* Check for the SS tone events that could have been generated before. */ - if ( f_ulExtToneChanIndex == cOCT6100_INVALID_INDEX ) - { - BOOL fSSTone; - UINT32 ulResult; - - ulResult = Oct6100ApiIsSSTone( f_pApiInstance, pSharedInfo->ImageInfo.aToneInfo[ f_ulToneEventNumber ].ulToneID, &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Is this a signaling system tone? */ - if ( fSSTone == TRUE ) - { - /* Check if must generate an event for the last detected SS tone. */ - if ( ( pEchoChanEntry->ulLastSSToneDetected != cOCT6100_INVALID_INDEX ) - && ( pEchoChanEntry->ulLastSSToneDetected == pSharedInfo->ImageInfo.aToneInfo[ f_ulToneEventNumber ].ulToneID ) ) - { - /* Must write an event for this. */ - tPOCT6100_API_TONE_EVENT pSoftEvent; - - /* If enough space. */ - if ( ( ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr ) && - ( ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0 ) ) - { - /* Form the event for this captured tone. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_ulChannelIndex; - pSoftEvent->ulUserChanId = pEchoChanEntry->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ f_ulToneEventNumber ].ulToneID; - pSoftEvent->ulTimestamp = pEchoChanEntry->ulLastSSToneTimestamp; - pSoftEvent->ulExtToneDetectionPort = cOCT6100_INVALID_VALUE; - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - } - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionDisableSer - -Description: Disable the generation of events for a selected tone on the - specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectDisable Pointer to tOCT6100_TONE_DETECTION_DISABLE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionDisableSer -UINT32 Oct6100ToneDetectionDisableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ) -{ - UINT32 ulChanIndex; - UINT32 ulExtToneChanIndex; - UINT32 ulToneEventNumber = 0; - UINT32 ulResult; - BOOL fDisableAll; - - - /* Check the user's configuration of the tone detection disable structure for errors. */ - ulResult = Oct6100ApiAssertToneDetectionParams( - f_pApiInstance, - f_pToneDetectDisable, - &ulChanIndex, - &ulToneEventNumber, - &ulExtToneChanIndex, - - &fDisableAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the event to detect the specified tone. */ - ulResult = Oct6100ApiClearToneDetectionEvent( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - ulExtToneChanIndex, - - fDisableAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the channel structure to indicate that the tone is no longer detected. */ - ulResult = Oct6100ApiReleaseToneDetectionEvent( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - ulExtToneChanIndex, - fDisableAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertToneDetectionParams - -Description: Check the validity of the tone detection disable command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectDisable Pointer to tone detection disable structure. -f_pulChannelIndex Pointer to the channel index -f_pulToneEventNumber Pointer to the tone event number. -f_pulExtToneChanIndex Pointer to the extended channel index. -f_pfDisableAll Pointer to the flag specifying whether all tones - should be disabled. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertToneDetectionParams -UINT32 Oct6100ApiAssertToneDetectionParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - OUT PUINT32 f_pulExtToneChanIndex, - - OUT PBOOL f_pfDisableAll ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - UINT32 i; - - /*=====================================================================*/ - /* Check the echo channel handle. */ - - if ( (f_pToneDetectDisable->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pToneDetectDisable->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pToneDetectDisable->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - /* Return the extended channel index. */ - *f_pulExtToneChanIndex = pEchoChannel->usExtToneChanIndex; - - /* Check the disable all flag. */ - if ( f_pToneDetectDisable->fDisableAll != TRUE && f_pToneDetectDisable->fDisableAll != FALSE ) - return cOCT6100_ERR_TONE_DETECTION_DISABLE_ALL; - - /*=====================================================================*/ - /* Check the tone information. */ - - /* Find out if the tone is present in the build. */ - if ( f_pToneDetectDisable->fDisableAll == FALSE ) - { - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - if ( f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ i ].ulToneID == f_pToneDetectDisable->ulToneNumber ) - { - *f_pulToneEventNumber = i; - break; - } - } - - /* Check if tone is present. */ - if ( i == cOCT6100_MAX_TONE_EVENT ) - return cOCT6100_ERR_NOT_SUPPORTED_TONE_NOT_PRESENT_IN_FIRMWARE; - - - - /* Check if the requested tone is actually detected. */ - if ((( pEchoChannel->aulToneConf[ *f_pulToneEventNumber / 32 ] >> ( 31 - ( *f_pulToneEventNumber % 32 ))) & 0x1) == 0 ) - return cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED; - } - - - /*=====================================================================*/ - - /* Return the disable all flag as requested. */ - *f_pfDisableAll = f_pToneDetectDisable->fDisableAll; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearToneDetectionEvent - -Description: Clear the buffer playout event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Tone event number to be deactivated. -f_ulExtToneChanIndex Index of the extended tone detection channel. -f_fDisableAll Clear all activated tones. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiClearToneDetectionEvent -UINT32 Oct6100ApiClearToneDetectionEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - - IN BOOL f_fDisableAll ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulResult; - UINT32 ulToneEventBaseAddress; - UINT16 usReadData; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Read the current event config about to be modified. */ - - ulToneEventBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulToneEventBaseAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - - /* Check if must disable all tone events or not. */ - if ( f_fDisableAll == FALSE ) - { - ReadParams.ulReadAddress = ulToneEventBaseAddress; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the event in the channel main memory.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData &= (~( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 )))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events in the channel main memory. */ - SmearParams.ulWriteLength = 4; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteAddress = ulToneEventBaseAddress; - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - /* Also program the extended channel if one is present. */ - - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - ulToneEventBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulExtToneChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulToneEventBaseAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - - /* Check if must disable all tone events or not. */ - if ( f_fDisableAll == FALSE ) - { - /* Read the current event config about to be modified. */ - ReadParams.ulReadAddress = ulToneEventBaseAddress; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the event in the channel main memory.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData &= (~( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 )))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events in the channel main memory.*/ - SmearParams.ulWriteLength = 4; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteAddress = ulToneEventBaseAddress; - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseToneDetectionEvent - -Description: Clear the entry made for this tone in the channel tone - enable array. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Tone event number to be deactivated. -f_ulExtToneChanIndex Index of the extended tone detection channel. -f_fDisableAll Release all activated tones. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseToneDetectionEvent -UINT32 Oct6100ApiReleaseToneDetectionEvent ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - IN BOOL f_fDisableAll ) -{ - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulToneEntry; - UINT32 ulResult; - UINT32 ulToneEventNumber; - BOOL fSSTone; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulChannelIndex ); - - /* Check if must release all tone events. */ - if ( f_fDisableAll == FALSE ) - { - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry &= (~( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 )))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events. */ - Oct6100UserMemSet( pEchoChanEntry->aulToneConf, 0x00, sizeof( pEchoChanEntry->aulToneConf ) ); - } - - /* Configure also the extended channel if necessary. */ - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulExtToneChanIndex ); - - /* Check if must release all tone events. */ - if ( f_fDisableAll == FALSE ) - { - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry &= (~( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 )))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events. */ - Oct6100UserMemSet( pEchoChanEntry->aulToneConf, 0x00, sizeof( pEchoChanEntry->aulToneConf ) ); - } - } - - /* Re-enable the SS7 tones */ - for ( ulToneEventNumber = 0; ulToneEventNumber < cOCT6100_MAX_TONE_EVENT; ulToneEventNumber++ ) - { - /* Check if the current tone is a SS tone. */ - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Write to all resources needed to activate tone detection on this SS tone. */ - ulResult = Oct6100ApiWriteToneDetectEvent( - f_pApiInstance, - f_ulChannelIndex, - ulToneEventNumber, - - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsSSTone - -Description: Check if specified tone number is a special signaling - system tone. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulToneEventNumber Tone event number to be checked against. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIsSSTone -UINT32 Oct6100ApiIsSSTone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fSSTone ) -{ - *f_fSSTone = FALSE; - - switch( f_ulToneEventNumber ) - { - case cOCT6100_TONE_SIN_SYSTEM7_2000 : - case cOCT6100_TONE_SIN_SYSTEM7_1780 : - case cOCT6100_TONE_ROUT_G168_2100GB_ON : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR : - case cOCT6100_TONE_ROUT_G168_1100GB_ON : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE : - case cOCT6100_TONE_SOUT_G168_2100GB_ON : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR : - case cOCT6100_TONE_SOUT_G168_1100GB_ON : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE : - case cOCT6100_TONE_SIN_SYSTEM5_2400 : - case cOCT6100_TONE_SIN_SYSTEM5_2600 : - case cOCT6100_TONE_SIN_SYSTEM5_2400_2600 : - *f_fSSTone = TRUE; - break; - default: - break; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsSSTone - -Description: Check if specified tone number is a 2100 special signaling - system tone. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulToneEventNumber Tone event number to be checked against. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIs2100Tone -UINT32 Oct6100ApiIs2100Tone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fIs2100Tone ) -{ - *f_fIs2100Tone = FALSE; - - switch( f_ulToneEventNumber ) - { - case cOCT6100_TONE_ROUT_G168_2100GB_ON : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE : - case cOCT6100_TONE_SOUT_G168_2100GB_ON : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE : - *f_fIs2100Tone = TRUE; - break; - default: - break; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c deleted file mode 100644 index e885aa4f..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c +++ /dev/null @@ -1,1023 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsi_cnct.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open and close TSI connections - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 38 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_tsi_cnct_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_tsi_cnct_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_tsi_cnct_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctOpen - -Description: This function opens a TSI connection between two TDM timeslots. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to TSI connection open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctOpenDef -UINT32 Oct6100TsiCnctOpenDef( - tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - f_pTsiCnctOpen->pulTsiCnctHndl = NULL; - - f_pTsiCnctOpen->ulInputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pTsiCnctOpen->ulInputStream = cOCT6100_INVALID_STREAM; - f_pTsiCnctOpen->ulOutputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pTsiCnctOpen->ulOutputStream = cOCT6100_INVALID_STREAM; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100TsiCnctOpen -UINT32 Oct6100TsiCnctOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100TsiCnctOpenSer( f_pApiInstance, f_pTsiCnctOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctClose - -Description: This function closes a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctClose Pointer to TSI connection close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctCloseDef -UINT32 Oct6100TsiCnctCloseDef( - tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ) -{ - f_pTsiCnctClose->ulTsiCnctHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100TsiCnctClose -UINT32 Oct6100TsiCnctClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100TsiCnctCloseSer( f_pApiInstance, f_pTsiCnctClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetTsiCnctSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management the TSI memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetTsiCnctSwSizes -UINT32 Oct6100ApiGetTsiCnctSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine the amount of memory required for the API TSI connection list. */ - f_pInstSizes->ulTsiCnctList = f_pOpenChip->ulMaxTsiCncts * sizeof( tOCT6100_API_TSI_CNCT ); - - if ( f_pOpenChip->ulMaxTsiCncts > 0 ) - { - /* Calculate memory needed for TSI memory allocation. */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxTsiCncts, &f_pInstSizes->ulTsiCnctAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_48; - } - else - { - f_pInstSizes->ulTsiCnctAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiCnctList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiCnctAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTsiCnctSwInit - -Description: Initializes all elements of the instance structure associated - to the TSI memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTsiCnctSwInit -UINT32 Oct6100ApiTsiCnctSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_TSI_CNCT pChannelsTsiList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMaxTsiChannels; - PVOID pTsiChannelsAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the TSI connections API list. */ - ulMaxTsiChannels = pSharedInfo->ChipConfig.usMaxTsiCncts; - - mOCT6100_GET_TSI_CNCT_LIST_PNT( pSharedInfo, pChannelsTsiList ) - - /* Clear the memory. */ - Oct6100UserMemSet( pChannelsTsiList, 0x00, sizeof(tOCT6100_API_TSI_CNCT) * ulMaxTsiChannels ); - - /* Set all entries in the TSI connections list to unused. */ - if ( ulMaxTsiChannels > 0 ) - { - mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChannelsAlloc ) - - ulResult = OctapiLlmAllocInit( &pTsiChannelsAlloc, ulMaxTsiChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_49; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctOpenSer - -Description: Opens a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to a tOCT6100_TSI_CNCT_OPEN structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctOpenSer -UINT32 Oct6100TsiCnctOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - UINT16 usTsiChanIndex; - UINT16 usTsiMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Check the user's configuration of the TSI connection open structure for errors. */ - ulResult = Oct6100ApiCheckTsiParams( f_pApiInstance, f_pTsiCnctOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the TSI connection. */ - ulResult = Oct6100ApiReserveTsiResources( f_pApiInstance, f_pTsiCnctOpen, &usTsiChanIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the TSI connection. */ - ulResult = Oct6100ApiWriteTsiStructs( f_pApiInstance, f_pTsiCnctOpen, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the TSI connection entry in the API list. */ - ulResult = Oct6100ApiUpdateTsiEntry( f_pApiInstance, f_pTsiCnctOpen, usTsiChanIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckTsiParams - -Description: Checks the user's TSI connection open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to TSI connection open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckTsiParams -UINT32 Oct6100ApiCheckTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxTsiCncts == 0 ) - return cOCT6100_ERR_TSI_CNCT_DISABLED; - - if ( f_pTsiCnctOpen->pulTsiCnctHndl == NULL ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - /* Check the input TDM streams, timeslots component for errors. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - cOCT6100_NUMBER_TSSTS_1, - f_pTsiCnctOpen->ulInputTimeslot, - f_pTsiCnctOpen->ulInputStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_TSI_CNCT_INPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_TSI_CNCT_INPUT_STREAM; - } - else - { - return ulResult; - } - } - - /* Check the output TDM streams, timeslots component for errors. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - cOCT6100_NUMBER_TSSTS_1, - f_pTsiCnctOpen->ulOutputTimeslot, - f_pTsiCnctOpen->ulOutputStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_TSI_CNCT_OUTPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_TSI_CNCT_OUTPUT_STREAM; - } - else - { - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsiResources - -Description: Reserves all resources needed for the new TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to tsi channel configuration structure. -f_pusTsiChanIndex Allocated entry in TSI channel list. -f_pusTsiMemIndex Allocated entry in the TSI control memory. -f_pusInputTsstIndex TSST memory index of the input samples. -f_pusOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsiResources -UINT32 Oct6100ApiReserveTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempVar; - BOOL fTsiChanEntry = FALSE; - BOOL fTsiMemEntry = FALSE; - BOOL fInputTsst = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the TSI connection list. */ - ulResult = Oct6100ApiReserveTsiCnctEntry( f_pApiInstance, f_pusTsiChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fTsiChanEntry = TRUE; - - /* Find a TSI memory entry. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, f_pusTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fTsiMemEntry = TRUE; - - /* Reserve the input TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pTsiCnctOpen->ulInputTimeslot, - f_pTsiCnctOpen->ulInputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - f_pusInputTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fInputTsst = TRUE; - - /* Reserve the output TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pTsiCnctOpen->ulOutputTimeslot, - f_pTsiCnctOpen->ulOutputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - f_pusOutputTsstIndex, - NULL ); - } - } - else - { - /* Return an error other then a fatal. */ - ulResult = cOCT6100_ERR_TSI_CNCT_NO_MORE_TSI_AVAILABLE; - } - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - if( fTsiChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiCnctEntry( f_pApiInstance, *f_pusTsiChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, *f_pusTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fInputTsst == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - f_pTsiCnctOpen->ulInputTimeslot, - f_pTsiCnctOpen->ulInputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteTsiStructs - -Description: Performs all the required structure writes to configure the - new TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to tsi connection open structure. -f_usTsiMemIndex Allocated entry in the TSI control memory. -f_usInputTsstIndex TSST memory index of the input samples. -f_usOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteTsiStructs -UINT32 Oct6100ApiWriteTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - /* Configure the TSST control memory.*/ - - /* Set the input TSST control entry.*/ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usInputTsstIndex, - f_usTsiMemIndex, - cOCT6100_PCM_U_LAW ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry. */ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usOutputTsstIndex, - cOCT6100_ADPCM_IN_LOW_BITS, - 1, - f_usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateTsiEntry - -Description: Updates the new TSI connection in the TSI connection list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to TSI connection open configuration structure. -f_usTsiMemIndex Allocated entry in TSI chariot memory. -f_usTsiChanIndex Allocated entry in the TSI channel list. -f_usInputTsstIndex TSST control memory index of the input TSST. -f_usOutputTsstIndex TSST control memory index of the output TSST. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateTsiEntry -UINT32 Oct6100ApiUpdateTsiEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_API_TSI_CNCT pTsiCnctEntry; - - /*================================================================================*/ - /* Obtain a pointer to the new TSI connection's list entry. */ - - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsiCnctEntry, f_usTsiChanIndex ) - - /* Copy the TSI's configuration and allocated resources. */ - pTsiCnctEntry->usInputTimeslot = (UINT16)( f_pTsiCnctOpen->ulInputTimeslot & 0xFFFF ); - pTsiCnctEntry->usInputStream = (UINT16)( f_pTsiCnctOpen->ulInputStream & 0xFFFF ); - - pTsiCnctEntry->usOutputTimeslot = (UINT16)( f_pTsiCnctOpen->ulOutputTimeslot & 0xFFFF ); - pTsiCnctEntry->usOutputStream = (UINT16)( f_pTsiCnctOpen->ulOutputStream & 0xFFFF ); - - /* Store hardware related information. */ - pTsiCnctEntry->usTsiMemIndex = f_usTsiMemIndex; - pTsiCnctEntry->usInputTsstIndex = f_usInputTsstIndex; - pTsiCnctEntry->usOutputTsstIndex = f_usOutputTsstIndex; - - /* Form handle returned to user. */ - *f_pTsiCnctOpen->pulTsiCnctHndl = cOCT6100_HNDL_TAG_TSI_CNCT | (pTsiCnctEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usTsiChanIndex; - - /* Finally, mark the connection as opened. */ - pTsiCnctEntry->fReserved = TRUE; - - /* Increment the number of TSI connection opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberTsiCncts++; - - /*================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctCloseSer - -Description: Closes a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctClose Pointer to TSI connection close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctCloseSer -UINT32 Oct6100TsiCnctCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ) -{ - UINT16 usTsiChanIndex; - UINT16 usTsiMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertTsiParams( f_pApiInstance, f_pTsiCnctClose, &usTsiChanIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the TSI channel. */ - ulResult = Oct6100ApiInvalidateTsiStructs( f_pApiInstance, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the TSI connection. */ - ulResult = Oct6100ApiReleaseTsiResources( f_pApiInstance, usTsiChanIndex, usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pTsiCnctClose->ulTsiCnctHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertTsiParams - -Description: Validate the handle given by the user and verify the state of - the TSI connection about to be closed. - Also returns all required information to deactivate the connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctClose Pointer to TSI connection close structure. -f_pusTsiChanIndex Index of the TSI connection structure in the API list. -f_pusTsiMemIndex Index of the TSI entry within the TSI chariot memory -f_pusInputTsstIndex Index of the input entry in the TSST control memory. -f_pusOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertTsiParams -UINT32 Oct6100ApiAssertTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSI_CNCT pTsiEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pTsiCnctClose->ulTsiCnctHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_TSI_CNCT ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - *f_pusTsiChanIndex = (UINT16)( f_pTsiCnctClose->ulTsiCnctHndl & cOCT6100_HNDL_INDEX_MASK ); - - if ( *f_pusTsiChanIndex >= pSharedInfo->ChipConfig.usMaxTsiCncts ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pTsiEntry, *f_pusTsiChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pTsiCnctClose->ulTsiCnctHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pTsiEntry->fReserved != TRUE ) - return cOCT6100_ERR_TSI_CNCT_NOT_OPEN; - if ( ulEntryOpenCnt != pTsiEntry->byEntryOpenCnt ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - /* Return info needed to close the channel and release all resources. */ - *f_pusInputTsstIndex = pTsiEntry->usInputTsstIndex; - *f_pusOutputTsstIndex = pTsiEntry->usOutputTsstIndex; - *f_pusTsiMemIndex = pTsiEntry->usTsiMemIndex; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateTsiStructs - -Description: This function closes a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usInputTsstIndex Index of the input entry in the TSST control memory. -f_usOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateTsiStructs -UINT32 Oct6100ApiInvalidateTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - /* Deactivate the TSST control memory. */ - - /* Set the input TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usInputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usOutputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsiResources - -Description: Release and clear the API entry associated to the TSI channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usTsiChanIndex Index of the TSI connection in the API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsiResources -UINT32 Oct6100ApiReleaseTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSI_CNCT pTsiEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pTsiEntry, f_usTsiChanIndex ); - - /* Release the entry in the TSI connection list. */ - ulResult = Oct6100ApiReleaseTsiCnctEntry( f_pApiInstance, f_usTsiChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, f_usTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the input entry. */ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTsiEntry->usInputTimeslot, - pTsiEntry->usInputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the output TSST entry. */ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTsiEntry->usOutputTimeslot, - pTsiEntry->usOutputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - } - } - } - - /* Check if an error occured while releasing the reserved resources. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult >= cOCT6100_ERR_FATAL ) - return ulResult; - else - return cOCT6100_ERR_FATAL_4A; - } - - /*=============================================================*/ - /* Update the TSI connection's list entry. */ - - /* Mark the connection as closed. */ - pTsiEntry->fReserved = FALSE; - pTsiEntry->byEntryOpenCnt++; - - /* Decrement the number of TSI connection opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberTsiCncts--; - - /*=============================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsiCnctEntry - -Description: Reserves one of the TSI connection API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusTsiChanIndex Resulting index reserved in the TSI channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsiCnctEntry -UINT32 Oct6100ApiReserveTsiCnctEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiChanAlloc; - UINT32 ulResult; - UINT32 ulTsiIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChanAlloc ) - - ulResult = OctapiLlmAllocAlloc( pTsiChanAlloc, &ulTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_TSI_CNCT_ALL_CHANNELS_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_4B; - } - - *f_pusTsiChanIndex = (UINT16)( ulTsiIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsiCnctEntry - -Description: Releases the specified TSI connection API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usTsiChanIndex Index reserved in the TSI channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsiCnctEntry -UINT32 Oct6100ApiReleaseTsiCnctEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChanAlloc ) - - ulResult = OctapiLlmAllocDealloc( pTsiChanAlloc, f_usTsiChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_4C; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c deleted file mode 100644 index 02fbd8f7..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c +++ /dev/null @@ -1,575 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsst.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to manage the allocation of TSST - control structures in internal memory. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 39 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_tsst_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_tsst_priv.h" - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetTsstSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of TSSTs. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetTsstSwSizes -UINT32 Oct6100ApiGetTsstSwSizes( - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine amount of TSST needed for TSST allocation table. */ - f_pInstSizes->ulTsstAlloc = 4096 / 8; - - /* Calculate the API memory required for the TSST entry list. */ - f_pInstSizes->ulTsstEntryList = cOCT6100_MAX_TSSTS * sizeof( tOCT6100_API_TSST_ENTRY ); - - /* Calculate memory needed for TSST entry allocation. */ - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_TSSTS, &f_pInstSizes->ulTsstEntryAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_4D; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstAlloc, ulTempVar ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstEntryList, ulTempVar ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstEntryAlloc, ulTempVar ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTsstSwInit - -Description: Initializes all elements of the instance structure associated - to the TSST control entries. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTsstSwInit -UINT32 Oct6100ApiTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSST_ENTRY pTsstList; - PUINT32 pulTsstAlloc; - PVOID pTsstListAlloc; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the TSST allocation table to "all free". */ - mOCT6100_GET_TSST_ALLOC_PNT( pSharedInfo, pulTsstAlloc ); - Oct6100UserMemSet( pulTsstAlloc, 0x00, 512 ); - - /* Initialize all the TSST list entries. */ - mOCT6100_GET_TSST_LIST_PNT( pSharedInfo, pTsstList ); - Oct6100UserMemSet( pTsstList, 0xFF, cOCT6100_MAX_TSSTS * sizeof(tOCT6100_API_TSST_ENTRY) ); - - /* Initialize the allocation list to manage the TSST entries.*/ - mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc ) - - ulResult = OctapiLlmAllocInit( &pTsstListAlloc, cOCT6100_MAX_TSSTS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_4E; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiValidateTsst - -Description: Validates a timeslot, stream combination. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -f_ulTimeslot Timeslot component of the TDM TSST. -f_ulStream Stream component of the TDM TSST. -f_ulNumTssts Number of TSST required. -f_ulDirection Direction of the TSST (Input or Output). - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiValidateTsst -UINT32 Oct6100ApiValidateTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulNumTssts, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulDirection ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - PUINT32 pulTsstAlloc; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc ); - - /* Obtain local pointer to chip configuration. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Check the TDM streams, timeslots component for errors. */ - if ( f_ulTimeslot == cOCT6100_UNASSIGNED && - f_ulStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_TSST_TIMESLOT; - - if ( f_ulTimeslot != cOCT6100_UNASSIGNED && - f_ulStream == cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_TSST_STREAM; - - if ( f_ulStream >= pChipConfig->byMaxTdmStreams ) - return cOCT6100_ERR_TSST_STREAM; - - /* Check timeslot value based on the frequenccy of the selected stream. */ - switch ( pChipConfig->aulTdmStreamFreqs[ f_ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - if ( f_ulTimeslot >= 32 ) - return cOCT6100_ERR_TSST_TIMESLOT; - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - if ( f_ulTimeslot >= 64 ) - return cOCT6100_ERR_TSST_TIMESLOT; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - if ( f_ulTimeslot >= 128 ) - return cOCT6100_ERR_TSST_TIMESLOT; - break; - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - if ( f_ulTimeslot >= 256 ) - return cOCT6100_ERR_TSST_TIMESLOT; - - /* Check the stream value based on the direction. */ - if ( f_ulDirection == cOCT6100_INPUT_TSST && f_ulStream >= 16 ) - { - return cOCT6100_ERR_TSST_STREAM; - } - else if( f_ulDirection == cOCT6100_OUTPUT_TSST && f_ulStream < 16 ) - { - return cOCT6100_ERR_TSST_STREAM; - } - - break; - default: - return cOCT6100_ERR_FATAL_DC; - } - - /* Stream must be odd if two TSSTs are required. */ - if ( f_ulNumTssts == 2 && ( ( f_ulStream & 0x1) != 0x1 ) ) - return cOCT6100_ERR_TSST_STREAM; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsst - -Description: Reserves a TSST, only one TSI entry can access a TSST at any one - time. - If the pointer f_pulTsstListIndex is set to NULL, no TSST list - entry will be reserved. - - The index in TSST control memory returned is based on the frequency - of the streams where the TSST is located and on the direction of - the TSST ( input or output ). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -f_ulTimeslot Timeslot component of the TDM TSST. -f_ulNumTssts Number of TSSTs required. -f_ulStream Stream component of the TDM TSST. -f_ulDirection Whether the TSST in and input TSST or output TSST. -f_pusTsstMemIndex Index of the resulting TSST in the TSST control memory. -f_pusTsstListIndex Index in the TSST list of the current entry. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsst -UINT32 Oct6100ApiReserveTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - OUT PUINT16 f_pusTsstMemIndex, - OUT PUINT16 f_pusTsstListIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsstListAlloc; - PUINT32 pulTsstAlloc; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulStream; - UINT32 ulTimeslot; - - /* Get local pointer to shared portion of API instance structure. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc ); - - /*==================================================================================*/ - /* Now make the proper conversion to obtain the TSST value. */ - - /* Save the timeslot and stream value received. */ - ulStream = f_ulStream; - ulTimeslot = f_ulTimeslot; - - /* Set the TSST index associated to this stream, timeslot combination. */ - switch ( f_pApiInstance->pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - if ( f_ulDirection == cOCT6100_INPUT_TSST ) - { - ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16; - ulTimeslot = f_ulTimeslot / 2; - } - else /* f_ulDirection == cOCT6100_OUTPUT_TSST */ - { - ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16; - - if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) ) - { - ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128; - } - else - { - ulTimeslot = f_ulTimeslot / 2 ; - } - } - - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream ); - break; - - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream ); - break; - - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 2 ); - if ( f_ulDirection == cOCT6100_OUTPUT_TSST ) - { - *f_pusTsstMemIndex = (UINT16)( *f_pusTsstMemIndex + ulStream ); - } - else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */ - { - *f_pusTsstMemIndex = (UINT16)( ( 1 * 32 + ulStream ) + *f_pusTsstMemIndex ); - } - break; - - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 4 ); - if ( f_ulDirection == cOCT6100_OUTPUT_TSST ) - { - *f_pusTsstMemIndex = (UINT16)( ulStream + *f_pusTsstMemIndex ); - } - else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */ - { - *f_pusTsstMemIndex = (UINT16)( ( 3 * 32 + ulStream ) + *f_pusTsstMemIndex ); - } - break; - - default: - ulResult = cOCT6100_ERR_FATAL_8B; - } - /*======================================================================*/ - - - /*======================================================================*/ - /* First reserve the TSST. */ - - /* Get local pointer to TSST's entry in allocation table. */ - switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - ulTimeslot *= 4; - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - ulTimeslot *= 2; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - ulTimeslot *= 1; - break; - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - ulTimeslot *= 1; - break; - default: - return cOCT6100_ERR_FATAL_DD; - } - - /* Check if entry is already reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) == 0x1 ) - return cOCT6100_ERR_TSST_TSST_RESERVED; - - /* Check and reserve the associated TSST if required. */ - if ( f_ulNumTsst == 2 ) - { - /* Check if entry is already reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> (ulStream - 1) ) & 0x1) == 0x1 ) - return cOCT6100_ERR_TSST_ASSOCIATED_TSST_RESERVED; - - /* The entry is free, it won't anymore. */ - pulTsstAlloc[ ulTimeslot ] |= (0x1 << (ulStream - 1)); - } - - /* The entry is free, it won't anymore.*/ - pulTsstAlloc[ ulTimeslot ] |= (0x1 << ulStream); - - /*======================================================================*/ - - - /*======================================================================*/ - /* Now reserve a TSST entry if requested. */ - - if ( f_pusTsstListIndex != NULL && ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulTsstListIndex; - - /* Reserve a TSST entry in the API TSST list. */ - mOCT6100_GET_TSST_LIST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pTsstListAlloc ); - - ulResult = OctapiLlmAllocAlloc( pTsstListAlloc, &ulTsstListIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - ulResult = cOCT6100_ERR_TSST_ALL_TSSTS_ARE_OPENED; - else - ulResult = cOCT6100_ERR_FATAL_52; - } - - *f_pusTsstListIndex = (UINT16)( ulTsstListIndex & 0xFFFF ); - } - /*======================================================================*/ - - - /*======================================================================*/ - /* Check the result of the TSST list reservation. */ - - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the previously reserved TSST. */ - if ( f_ulNumTsst == 2 ) - { - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1) ); - - } - - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream); - } - - /*======================================================================*/ - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsst - -Description: Releases a TSST. - - If f_usTsstListIndex is set to cOCT6100_INVALID_INDEX, the API - will assume that no TSST list entry was reserved for this TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -f_ulNumTssts Number of TSSTs to be released. -f_ulStream Stream component of the TDM TSST. -f_ulTimeslot Timeslot component of the TDM TSST. -f_ulDirection Whether the TSST is an input TSST or output TSST. -f_usTsstListIndex Index in the TSST list of the current entry. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsst -UINT32 Oct6100ApiReleaseTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - IN UINT16 f_usTsstListIndex) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PUINT32 pulTsstAlloc; - PVOID pTsstListAlloc; - UINT32 ulResult; - UINT32 ulStream; - UINT32 ulTimeslot; - - /* Get local pointer to shared portion of API instance structure. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - if ( f_usTsstListIndex != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc ) - - ulResult = OctapiLlmAllocDealloc( pTsstListAlloc, f_usTsstListIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_53; - } - } - - mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc ); - - /*==================================================================================*/ - /* Now make the proper conversion to obtain the TSST value. */ - - /* Save the timeslot and stream value received. */ - ulStream = f_ulStream; - ulTimeslot = f_ulTimeslot; - - /* Set the TSST index associated to this stream, timeslot combination. */ - if ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] == cOCT6100_TDM_STREAM_FREQ_16MHZ ) - { - if ( f_ulDirection == cOCT6100_INPUT_TSST ) - { - ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16; - ulTimeslot = f_ulTimeslot / 2; - } - else /* f_ulDirection == cOCT6100_OUTPUT_TSST */ - { - ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16; - - if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) ) - { - ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128; - } - else - { - ulTimeslot = f_ulTimeslot / 2 ; - } - } - } - - /* Get local pointer to TSST's entry in allocation table. */ - switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - ulTimeslot *= 4; - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - ulTimeslot *= 2; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - ulTimeslot *= 1; - break; - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - ulTimeslot *= 1; - break; - default: - return cOCT6100_ERR_FATAL_DE; - } - - /* Check if entry is actualy reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) != 0x1 ) - return cOCT6100_ERR_FATAL_55; - - /*==================================================================================*/ - - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream); - - /* Check and release the associated TSST if required. */ - if ( f_ulNumTsst == 2 ) - { - /* Check if entry is actualy reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> ( ulStream - 1)) & 0x1) != 0x1 ) - return cOCT6100_ERR_FATAL_54; - - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1)); - - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c deleted file mode 100644 index 9d0e3177..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c +++ /dev/null @@ -1,508 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_user.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions provided by the user. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 28 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_errors.h" - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserGetTime - -Description: Returns the system time in us. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pTime Pointer to structure in which the time is returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserGetTime -UINT32 Oct6100UserGetTime( - IN OUT tPOCT6100_GET_TIME f_pTime ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserMemSet - -Description: Sets f_ulLength bytes pointed to by f_pAddress to f_ulPattern. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pAddress Address in host memory where data should be set. -f_ulPattern Pattern to apply at the address. This value will never - exceed 0xFF. -f_ulLength Length in bytes to set. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserMemSet -UINT32 Oct6100UserMemSet( - IN PVOID f_pAddress, - IN UINT32 f_ulPattern, - IN UINT32 f_ulLength ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserMemCopy - -Description: Copy f_ulLength bytes from f_pSource to f_pDestination. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pDestination Host data destination address. -f_pSource Host data source address. -f_ulLength Length in bytes to copy. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserMemCopy -UINT32 Oct6100UserMemCopy( - IN PVOID f_pDestination, - IN const void *f_pSource, - IN UINT32 f_ulLength ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserCreateSerializeObject - -Description: Creates a serialization object. The serialization object is - seized via the Oct6100UserSeizeSerializeObject function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pCreate Pointer to structure in which the serialization object's - handle is returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserCreateSerializeObject -UINT32 Oct6100UserCreateSerializeObject( - IN OUT tPOCT6100_CREATE_SERIALIZE_OBJECT f_pCreate ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDestroySerializeObject - -Description: Destroys the indicated serialization object. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pDestroy Pointer to structure containing the handle of the - serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDestroySerializeObject -UINT32 Oct6100UserDestroySerializeObject( - IN tPOCT6100_DESTROY_SERIALIZE_OBJECT f_pDestroy ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserSeizeSerializeObject - -Description: Seizes the indicated serialization object. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pSeize Pointer to structure containing the handle of the - serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserSeizeSerializeObject -UINT32 Oct6100UserSeizeSerializeObject( - IN tPOCT6100_SEIZE_SERIALIZE_OBJECT f_pSeize ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserReleaseSerializeObject - -Description: Releases the indicated serialization object. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pRelease Pointer to structure containing the handle of the - serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserReleaseSerializeObject -UINT32 Oct6100UserReleaseSerializeObject( - IN tPOCT6100_RELEASE_SERIALIZE_OBJECT f_pRelease ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteApi - -Description: Performs a write access to the chip. This function is - accessible only from the API code entity (i.e. not from the - APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pWriteParams Pointer to structure containing the Params to the - write function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteApi -UINT32 Oct6100UserDriverWriteApi( - IN tPOCT6100_WRITE_PARAMS f_pWriteParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteOs - -Description: Performs a write access to the chip. This function is - accessible only from the APIMI code entity (i.e. not from the - API code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pWriteParams Pointer to structure containing the Params to the - write function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteOs -UINT32 Oct6100UserDriverWriteOs( - IN tPOCT6100_WRITE_PARAMS f_pWriteParams ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteSmearApi - -Description: Performs a series of write accesses to the chip. The same data - word is written to a series of addresses. The writes begin at - the start address, and the address is incremented by the - indicated amount for each subsequent write. This function is - accessible only from the API code entity (i.e. not from the - APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pSmearParams Pointer to structure containing the parameters to the - write smear function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteSmearApi -UINT32 Oct6100UserDriverWriteSmearApi( - IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteSmearOs - -Description: Performs a series of write accesses to the chip. The same data - word is written to a series of addresses. The writes begin at - the start address, and the address is incremented by the - indicated amount for each subsequent write. This function is - accessible only from the APIMI code entity (i.e. not from the - API code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pSmearParams Pointer to structure containing the parameters to the - write smear function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteSmearOs -UINT32 Oct6100UserDriverWriteSmearOs( - IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteBurstApi - -Description: Performs a series of write accesses to the chip. An array of - data words is written to a series of consecutive addresses. - The writes begin at the start address with element 0 of the - provided array as the data word. The address is incremented by - two for each subsequent write. This function is accessible only - from the API code entity (i.e. not from the APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - write burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteBurstApi -UINT32 Oct6100UserDriverWriteBurstApi( - IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteBurstOs - -Description: Performs a series of write accesses to the chip. An array of - data words is written to a series of consecutive addresses. - The writes begin at the start address with element 0 of the - provided array as the data word. The address is incremented by - two for each subsequent write. This function is accessible only - from the API code entity (i.e. not from the APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - write burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteBurstOs -UINT32 Oct6100UserDriverWriteBurstOs( - IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadApi - -Description: Performs a read access to the chip. This function is accessible - only from the API code entity (i.e. not from the APIMI code - entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pReadParams Pointer to structure containing the parameters to the - read function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadApi -UINT32 Oct6100UserDriverReadApi( - IN OUT tPOCT6100_READ_PARAMS f_pReadParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadOs - -Description: Performs a read access to the chip. This function is accessible - only from the APIMI code entity (i.e. not from the API code - entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pReadParams Pointer to structure containing the parameters to the - read function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadOs -UINT32 Oct6100UserDriverReadOs( - IN OUT tPOCT6100_READ_PARAMS f_pReadParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadBurstApi - -Description: Performs a burst of read accesses to the chip. The first read - is performed at the start address, and the address is - incremented by two for each subsequent read. The data is - retunred in an array provided by the user. This function is - accessible only from the API code entity (i.e. not from the - APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - read burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadBurstApi -UINT32 Oct6100UserDriverReadBurstApi( - IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadBurstOs - -Description: Performs a burst of read accesses to the chip. The first read - is performed at the start address, and the address is - incremented by two for each subsequent read. The data is - retunred in an array provided by the user. This function is - accessible only from the APIMI code entity (i.e. not from the - API code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - read burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadBurstOs -UINT32 Oct6100UserDriverReadBurstOs( - IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c deleted file mode 100644 index a93db976..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c +++ /dev/null @@ -1,116 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mask_interrupts.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the mask interrupts function. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 8 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "oct6100api/oct6100_apimi.h" -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_defines.h" - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptMask - -Description: The function is used to mask out the interrupt pin of the chip. - This function is used when a deferred procedure call treats the - interrupt (new interrupts must not be generated until the - signaled interrupt is treated). Which chip is to have its - interrupts masked is determined by the mask structure, - f_pInterruptMask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pInterruptMask Pointer to the interrupt masking structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100InterruptMaskDef( - OUT tPOCT6100_INTERRUPT_MASK f_pInterruptMask ) -{ - f_pInterruptMask->ulUserChipIndex = cOCT6100_INVALID_VALUE; - f_pInterruptMask->pProcessContext = NULL; - - - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100InterruptMask( - IN tPOCT6100_INTERRUPT_MASK f_pInterruptMask ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 result; - UINT16 usReadData; - - /* Determine if the chip's interrupt pin is active.*/ - ReadParams.ulReadAddress = 0x210; - ReadParams.pusReadData = &usReadData; - ReadParams.pProcessContext = f_pInterruptMask->pProcessContext; - - ReadParams.ulUserChipId = f_pInterruptMask->ulUserChipIndex; - - result = Oct6100UserDriverReadOs( &ReadParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - if ( (usReadData & 0xFFFF) != 0 ) - { - /* Chip's interrupt pin is active, so mask interrupt pin. */ - ReadParams.ulReadAddress = 0x214; - result = Oct6100UserDriverReadOs( &ReadParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - /* Determine if the chip's interrupt pin is active. */ - WriteParams.pProcessContext = f_pInterruptMask->pProcessContext; - - WriteParams.ulUserChipId = f_pInterruptMask->ulUserChipIndex; - WriteParams.ulWriteAddress = 0x214; - WriteParams.usWriteData = (UINT16)( (usReadData & 0xC000) | 0x3FFF ); - - result = Oct6100UserDriverWriteOs( &WriteParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - WriteParams.ulWriteAddress = 0x212; - WriteParams.usWriteData = 0x8000; - - result = Oct6100UserDriverWriteOs( &WriteParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - return cOCT6100_ERR_OK; - } - - return cOCT6100_ERR_INTRPTS_NOT_ACTIVE; -} diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h deleted file mode 100644 index cd551913..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h +++ /dev/null @@ -1,529 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_channel_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_channel.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_channel_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 62 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHANNEL_PRIV_H__ -#define __OCT6100_CHANNEL_PRIV_H__ - - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* ECHO channel list pointer macros. */ -#define mOCT6100_GET_CHANNEL_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulChannelListOfst ); - -#define mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulChannelListOfst)) + ulIndex; - -#define mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulChannelAllocOfst); - -#define mOCT6100_GET_BIDIR_CHANNEL_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_BIDIR_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulBiDirChannelListOfst ); - -#define mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_BIDIR_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulBiDirChannelListOfst)) + ulIndex; - -#define mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulBiDirChannelAllocOfst ); - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_ECHO_CHAN_INDEX_ -{ - /* Index of the channel in the API echo channel list.*/ - UINT16 usEchoChanIndex; - - /* TSI chariot memory entry for the Rin/Rout stream. */ - UINT16 usRinRoutTsiMemIndex; - - /* TSI chariot memory entry for the Sin/Sout stream. */ - UINT16 usSinSoutTsiMemIndex; - - /* SSPX memory entry. */ - UINT16 usEchoMemIndex; - - /* TDM sample conversion control memory entry. */ - UINT16 usRinRoutConversionMemIndex; - UINT16 usSinSoutConversionMemIndex; - - /* Internal info for quick access to structures associated to this TSI cnct. */ - UINT16 usRinTsstIndex; - UINT16 usSinTsstIndex; - UINT16 usRoutTsstIndex; - UINT16 usSoutTsstIndex; - - /* Index of the phasing TSST */ - UINT16 usPhasingTsstIndex; - - UINT8 fSinSoutCodecActive; - UINT8 fRinRoutCodecActive; - - - /* Extended Tone Detection resources.*/ - UINT16 usExtToneChanIndex; - UINT16 usExtToneMixerIndex; - UINT16 usExtToneTsiIndex; -} tOCT6100_API_ECHO_CHAN_INDEX, *tPOCT6100_API_ECHO_CHAN_INDEX; - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetChannelsEchoSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiChannelsEchoSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ChannelOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ); - -UINT32 Oct6100ApiCheckChannelParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ApiReserveChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ApiWriteChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ApiUpdateChannelEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ChannelCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose ); - -UINT32 Oct6100ApiAssertChannelParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose, - - IN OUT PUINT16 f_pusChanIndex ); - -UINT32 Oct6100ApiInvalidateChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usChanIndex ); - -UINT32 Oct6100ApiReleaseChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChannelIndex ); - -UINT32 Oct6100ChannelModifySer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify ); - -UINT32 Oct6100ApiCheckChannelModify( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN OUT tPOCT6100_CHANNEL_OPEN f_pTempChanOpen, - OUT PUINT16 f_pusNewPhasingTsstIndex, - OUT PUINT16 f_pusChanIndex ); - -UINT32 Oct6100ApiModifyChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewRinTsstIndex, - OUT PUINT16 f_pusNewSinTsstIndex, - OUT PUINT16 f_pusNewRoutTsstIndex, - OUT PUINT16 f_pusNewSoutTsstIndex ); - -UINT32 Oct6100ApiModifyChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - OUT PUINT8 f_pfSinSoutCodecActive, - OUT PUINT8 f_pfRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_uslNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ); - -UINT32 Oct6100ApiModifyChannelEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - IN UINT8 f_fSinSoutCodecActive, - IN UINT8 f_fRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_usNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ); - -UINT32 Oct6100ChannelBroadcastTsstAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd ); - -UINT32 Oct6100ApiCheckChanTsstAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - OUT PUINT16 f_pusChanIndex ); - -UINT32 Oct6100ApiReserveTsstAddResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewTsstIndex, - OUT PUINT16 f_pusNewTsstEntry ); - -UINT32 Oct6100ApiWriteTsstAddStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex ); - -UINT32 Oct6100ApiUpdateTsstAddChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex, - IN UINT16 f_usNewTsstEntry ); - -UINT32 Oct6100ChannelBroadcastTsstRemoveSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove); - -UINT32 Oct6100ApiAssertChanTsstRemoveParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusTsstIndex, - OUT PUINT16 f_pusTsstEntry, - OUT PUINT16 f_pusPrevTsstEntry ); - -UINT32 Oct6100ApiInvalidateTsstRemoveStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulPort, - IN BOOL f_fRemoveAll ); - -UINT32 Oct6100ApiReleaseTsstRemoveResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsstEntry, - IN UINT16 f_usPrevTsstEntry ); - -UINT32 Oct6100ApiChannelGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ); - -UINT32 Oct6100ApiReserveEchoEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEchoIndex ); - -UINT32 Oct6100ApiReleaseEchoEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoChanIndex ); - -UINT32 Oct6100ApiCheckTdmConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig ); - -UINT32 Oct6100ApiCheckVqeConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN BOOL f_fEnableToneDisabler ); - -UINT32 Oct6100ApiCheckCodecConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_CODEC f_pCodecConfig, - IN UINT32 f_ulDecoderNumTssts, - OUT PUINT16 f_pusPhasingTsstIndex ); - -UINT32 Oct6100ApiWriteInputTsstControlMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulTsstInputLaw ); - -UINT32 Oct6100ApiWriteOutputTsstControlMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT32 f_ulNumTssts, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiWriteEncoderMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulEncoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulEnableSilenceSuppression, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT16 f_usPhasingTsstIndex, - IN UINT32 f_ulPhasingType, - IN UINT32 f_ulPhase ); - -UINT32 Oct6100ApiWriteDecoderMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usDecoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulPcmLaw, - IN UINT32 f_ulAdpcmNibblePosition ); - - -UINT32 Oct6100ApiClearConversionMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ); - -UINT32 Oct6100ApiWriteVqeMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ApiWriteVqeNlpMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ApiWriteVqeAfMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ApiWriteEchoMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ); - -UINT32 Oct6100ApiUpdateOpenStruct( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChanModify, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChanOpen, - IN tPOCT6100_API_CHANNEL f_pChanEntry ); - - - - - -UINT32 Oct6100ApiRetrieveNlpConfDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulConfigDword ); - -UINT32 Oct6100ApiSaveNlpConfDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - IN UINT32 f_ulConfigDword ); - -UINT32 Oct6100ChannelCreateBiDirSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ); - -UINT32 Oct6100ApiCheckChannelCreateBiDirParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - OUT PUINT16 f_pusFirstChanIndex, - OUT PUINT16 f_pusFirstChanExtraTsiIndex, - OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanIndex, - OUT PUINT16 f_pusSecondChanExtraTsiIndex, - OUT PUINT16 f_pusSecondChanSinCopyEventIndex - - ); - -UINT32 Oct6100ApiReserveChannelCreateBiDirResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - OUT PUINT16 f_pusBiDirChanIndex, - IN OUT PUINT16 f_pusFirstChanExtraTsiIndex, - IN OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusFirstChanSoutCopyEventIndex, - IN OUT PUINT16 f_pusSecondChanExtraTsiIndex, - IN OUT PUINT16 f_pusSecondChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanSoutCopyEventIndex ); - -UINT32 Oct6100ApiWriteChannelCreateBiDirStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ); - -UINT32 Oct6100ApiUpdateBiDirChannelEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - IN UINT16 f_usBiDirChanIndex, - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ); - -UINT32 Oct6100ChannelDestroyBiDirSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ); - -UINT32 Oct6100ApiAssertDestroyBiDirChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir, - IN OUT PUINT16 f_pusBiDirChanIndex, - - IN OUT PUINT16 f_pusFirstChanIndex, - IN OUT PUINT16 f_pusSecondChanIndex ); - -UINT32 Oct6100ApiInvalidateBiDirChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ); - -UINT32 Oct6100ApiReleaseBiDirChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBiDirChanIndex, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ); - -UINT32 Oct6100ApiWriteDebugChanMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ); - -UINT32 Oct6100ApiDebugChannelOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiMutePorts( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinTsstIndex, - IN UINT16 f_usSinTsstIndex, - IN BOOL f_fCheckBridgeIndex ); - -UINT32 Oct6100ApiSetChannelLevelControl( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearAlcHlcStatusBit ); - -UINT32 Oct6100ApiSetChannelTailConfiguration( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ChannelMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute ); - -UINT32 Oct6100ApiAssertChannelMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ); - -UINT32 Oct6100ChannelUnMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ); - -UINT32 Oct6100ApiAssertChannelUnMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ); - -UINT32 Oct6100ApiMuteSinWithFeatures( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN BOOL f_fEnableSinWithFeatures ); - -UINT32 Oct6100ApiMuteChannelPorts( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usPortMask, - IN BOOL f_fMute ); - -INT32 Oct6100ApiOctFloatToDbEnergyByte( - IN UINT8 x ); - -INT32 Oct6100ApiOctFloatToDbEnergyHalf( - IN UINT16 x ); - -UINT16 Oct6100ApiDbAmpHalfToOctFloat( - IN INT32 x ); - -#endif /* __OCT6100_CHANNEL_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h deleted file mode 100644 index 46a13e33..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h +++ /dev/null @@ -1,264 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_open_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_chip_open.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_chip_open_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 63 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_OPEN_PRIV_H__ -#define __OCT6100_CHIP_OPEN_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_INSTANCE_SIZES_ -{ - /* Each of the following elements indicates the size of the instance memory */ - /* needed by the corresponding API module. All sizes are in bytes. */ - UINT32 ulChannelList; - UINT32 ulChannelAlloc; - - UINT32 ulTsiCnctList; - UINT32 ulTsiCnctAlloc; - - UINT32 ulMixerEventList; - UINT32 ulMixerEventAlloc; - - UINT32 ulBiDirChannelList; - UINT32 ulBiDirChannelAlloc; - - UINT32 ulAdpcmChannelList; - UINT32 ulAdpcmChannelAlloc; - - UINT32 ulSoftBufPlayoutEventsBuffer; - - UINT32 ulCopyEventList; - UINT32 ulCopyEventAlloc; - - UINT32 ulConfBridgeList; - UINT32 ulConfBridgeAlloc; - - UINT32 ulFlexConfParticipantsList; - UINT32 ulFlexConfParticipantsAlloc; - - UINT32 ulPlayoutBufList; - UINT32 ulPlayoutBufAlloc; - UINT32 ulPlayoutBufMemoryNodeList; - - - - UINT32 ulSoftToneEventsBuffer; - - UINT32 ulPhasingTsstList; - UINT32 ulPhasingTsstAlloc; - - UINT32 ulConversionMemoryAlloc; - - UINT32 ulTsiMemoryAlloc; - UINT32 ulTsstAlloc; - - UINT32 ulTsstEntryList; - UINT32 ulTsstEntryAlloc; - - UINT32 ulRemoteDebugList; - UINT32 ulRemoteDebugTree; - UINT32 ulRemoteDebugPktCache; - UINT32 ulRemoteDebugDataBuf; - - /* Memory consumed by static members of API instance. */ - UINT32 ulApiInstStatic; - - /* Total memory size for API instance. */ - UINT32 ulApiInstTotal; - -} tOCT6100_API_INSTANCE_SIZES, *tPOCT6100_API_INSTANCE_SIZES; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiCheckChipConfiguration( - IN tPOCT6100_CHIP_OPEN f_pOpenChip ); - -UINT32 Oct6100ApiCheckImageFileHeader( - IN tPOCT6100_CHIP_OPEN f_pChipOpen ); - -UINT32 Oct6100ApiCopyChipConfiguration( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHIP_OPEN f_pOpenChip ); - -UINT32 Oct6100ApiInitializeMiscellaneousVariables( - IN OUT tPOCT6100_INSTANCE_API f_pInstance ); - -UINT32 Oct6100ApiCalculateInstanceSizes( - IN OUT tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstanceSizes ); - -UINT32 Oct6100ApiAllocateInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pInstance, - IN tPOCT6100_API_INSTANCE_SIZES f_pInstanceSizes ); - -UINT32 Oct6100ApiInitializeInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pInstance ); - -UINT32 Oct6100ApiGetChipRevisionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiMapExternalMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiDecodeKeyAndBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBootFc2Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiProgramFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBootFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiWriteH100Registers( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiExternalMemoryBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiExternalMemoryInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiLoadImage( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCpuRegisterBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBootSdram( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiEnableClocks( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiProgramNLP( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiSetH100Register( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiWriteMiscellaneousRegisters( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT16 Oct6100ApiGenerateNumber( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulIndex, - IN UINT32 f_ulDataMask ); - -UINT32 Oct6100ApiRandomMemoryWrite( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMemBase, - IN UINT32 f_ulMemSize, - IN UINT32 f_ulNumDataBits, - IN UINT32 f_ulNumAccesses, - IN UINT32 f_ulErrorCode ); - -UINT32 Oct6100ApiUserIoTest( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCreateSerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulUserChipId ); - -UINT32 Oct6100ApiDestroySerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiRunEgo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN BOOL f_fStoreFlag, - IN UINT32 f_ulNumEntry, - OUT PUINT32 f_aulEntry ); - -UINT32 Oct6100ApiCreateEgoEntry( - IN OUT UINT32 f_ulExternalAddress, - IN UINT32 f_ulInternalAddress, - IN UINT32 f_ulNumBytes, - IN UINT32 f_aulEntry[ 2 ] ); - - - - - -UINT32 Oct6100ApiInitChannels( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiInitMixer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiInitRecordResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100FreeResourcesSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_FREE_RESOURCES f_pFreeResources ); - -UINT32 Oct6100ProductionBistSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PRODUCTION_BIST f_pProductionBist ); - -UINT32 Oct6100ApiProductionCrc( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulMessage, - IN UINT32 f_ulMessageLength, - OUT PUINT32 f_pulCrcResult ); - -UINT32 Oct6100ApiReadCapacity( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiCpuRegisterBistReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiBootFc2PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiProgramFc1PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiInitToneInfo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiClearInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); -#endif /* __OCT6100_CHIP_OPEN_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h deleted file mode 100644 index 6c361637..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h +++ /dev/null @@ -1,55 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_stats_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_chip_stats.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_chip_stats_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 8 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_STATS_PRIV_H__ -#define __OCT6100_CHIP_STATS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiChipStatsSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ChipGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHIP_STATS f_pChipStats ); - -#endif /* __OCT6100_CHIP_STATS_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h deleted file mode 100644 index 071e6456..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h +++ /dev/null @@ -1,318 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_conf_bridge_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_conf_bridge.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_conf_bridge_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 30 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CONF_BRIDGE_PRIV_H__ -#define __OCT6100_CONF_BRIDGE_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_CONF_BRIDGE_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_CONF_BRIDGE )(( PUINT8 )pSharedInfo + pSharedInfo->ulConfBridgeListOfst); - -#define mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_CONF_BRIDGE )(( PUINT8 )pSharedInfo + pSharedInfo->ulConfBridgeListOfst)) + ulIndex; - -#define mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulConfBridgeAllocOfst); - -#define mOCT6100_GET_FLEX_CONF_PARTICIPANT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_FLEX_CONF_PARTICIPANT )(( PUINT8 )pSharedInfo + pSharedInfo->ulFlexConfParticipantListOfst); - -#define mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_FLEX_CONF_PARTICIPANT )(( PUINT8 )pSharedInfo + pSharedInfo->ulFlexConfParticipantListOfst)) + ulIndex; - -#define mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulFlexConfParticipantAllocOfst); - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetConfBridgeSwSizes( - IN OUT tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiConfBridgeSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst ); - -UINT32 Oct6100ConfBridgeOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ); - -UINT32 Oct6100ApiCheckBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ); - -UINT32 Oct6100ApiReserveBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT PUINT16 f_pusBridgeIndex ); - -UINT32 Oct6100ApiUpdateBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen, - IN UINT16 f_usBridgeIndex ); - -UINT32 Oct6100ConfBridgeCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ); - -UINT32 Oct6100ApiAssertBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose, - OUT PUINT16 f_pusBridgeIndex ); - -UINT32 Oct6100ApiReleaseBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex ); - -UINT32 Oct6100ConfBridgeChanAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ); - -UINT32 Oct6100ApiCheckBridgeAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfMute, - OUT PUINT32 f_pulInputPort, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT32 f_pulListenerMaskIndex, - OUT PUINT32 f_pulListenerMask, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusTapChannelIndex ); - -UINT32 Oct6100ApiReserveBridgeAddResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fFlexibleConfBridge, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex, - OUT PUINT16 f_pusTapBridgeIndex ); - -UINT32 Oct6100ApiBridgeEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChannelIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fMute, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - IN UINT16 f_usTapBridgeIndex, - IN UINT16 f_usTapChanIndex ); - -UINT32 Oct6100ApiBridgeAddParticipantToChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT16 f_usLoadOrAccumulateEventIndex, - IN UINT16 f_usStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulSourceInputPort, - IN UINT32 f_ulDestinationInputPort ); - -UINT32 Oct6100ConfBridgeChanRemoveSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ); - -UINT32 Oct6100ApiCheckChanRemoveParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex ); - -UINT32 Oct6100ApiReleaseChanEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex ); - -UINT32 Oct6100ApiBridgeEventRemove ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChannelIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT8 f_fTap ); - -UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT8 f_fRemovePermanently ); - -UINT32 Oct6100ConfBridgeChanMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ); - -UINT32 Oct6100ApiUpdateBridgeMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ); - -UINT32 Oct6100ApiCheckBridgeMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ); - -UINT32 Oct6100ConfBridgeChanUnMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ); - -UINT32 Oct6100ApiCheckBridgeUnMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ); - -UINT32 Oct6100ApiUpdateBridgeUnMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ); - -UINT32 Oct6100ConfBridgeDominantSpeakerSetSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ); - -UINT32 Oct6100ApiCheckBridgeDominantSpeakerParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex ); - -UINT32 Oct6100ApiUpdateBridgeDominantSpeakerResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChanIndex, - IN UINT16 f_usBridgeIndex ); - -UINT32 Oct6100ConfBridgeMaskChangeSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ); - -UINT32 Oct6100ApiCheckBridgeMaskChangeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT32 f_pulNewParticipantMask ); - -UINT32 Oct6100ApiUpdateMaskModifyResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ); - -UINT32 Oct6100ApiBridgeUpdateMask( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ); - -UINT32 Oct6100ConfBridgeGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ); - -UINT32 Oct6100ApiReserveBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT PUINT16 f_pusConfBridgeIndex ); - -UINT32 Oct6100ApiReleaseBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usConfBridgeIndex ); - -UINT32 Oct6100ApiGetPrevLastSubStoreEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usBridgeFirstLoadEventPtr, - OUT PUINT16 f_pusLastSubStoreEventIndex ); - -UINT32 Oct6100ApiGetPreviousEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usStartIndex, - IN UINT16 f_usSearchedIndex, - IN UINT16 f_usLoopCnt, - OUT PUINT16 f_pusPreviousIndex ); - -UINT32 Oct6100ApiBridgeSetDominantSpeaker( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChannelIndex, - IN UINT16 f_usDominantSpeakerIndex ); - -UINT32 Oct6100ApiReserveFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT PUINT16 f_pusParticipantIndex ); - -UINT32 Oct6100ApiReleaseFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usParticipantIndex ); - -#endif /* __OCT6100_CONF_BRIDGE_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h deleted file mode 100644 index 44a9a213..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h +++ /dev/null @@ -1,58 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_debug_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_debug.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_debug_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 12 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_DEBUG_PRIV_H__ -#define __OCT6100_DEBUG_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - - -UINT32 Oct6100DebugSelectChannelSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan, - IN BOOL f_fCheckChannelRecording ); - -UINT32 Oct6100DebugGetDataSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); - -#endif /* __OCT6100_DEBUG_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h deleted file mode 100644 index fd3980a2..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h +++ /dev/null @@ -1,82 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_events_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_events.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_events_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_EVENTS_PRIV_H__ -#define __OCT6100_EVENTS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftBuf ) \ - pSoftBuf = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->SoftBufs.ulToneEventBufferMemOfst ); - -#define mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftBuf ) \ - pSoftBuf = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->SoftBufs.ulBufPlayoutEventBufferMemOfst ); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetEventsSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100EventGetToneSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ); - -UINT32 Oct6100ApiTransferToneEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ); - - - -UINT32 Oct6100BufferPlayoutGetEventSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ); - -UINT32 Oct6100BufferPlayoutTransferEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ); - -UINT32 Oct6100BufferPlayoutCheckForSpecificEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulChannelPort, - IN BOOL f_fSaveToSoftBuffer, - OUT PBOOL f_pfEventDetected ); - -#endif /* __OCT6100_EVENTS_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h deleted file mode 100644 index d29f1b0a..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h +++ /dev/null @@ -1,158 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_interrupts_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_interrupts.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_interrupts_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 11 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_INTERRUPTS_PRIV_H__ -#define __OCT6100_INTERRUPTS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_INTRPT_ENABLE_TIME( \ - ulRegMclkTimeHigh, \ - ulRegMclkTimeLow, \ - ulIntrptState, \ - ulIntrptEnableMclkHigh, \ - ulIntrptEnableMclkLow, \ - ulIntrptTimeoutMclk, \ - ulTimeDiff ) \ - if ( ulIntrptState == cOCT6100_INTRPT_WILL_TIMEOUT ) \ - { \ - ulIntrptEnableMclkLow = ulRegMclkTimeLow + ulIntrptTimeoutMclk; \ - if ( ulIntrptEnableMclkLow < ulRegMclkTimeLow ) \ - ulIntrptEnableMclkHigh = (ulRegMclkTimeHigh + 1) & 0xFF; \ - else \ - ulIntrptEnableMclkHigh = ulRegMclkTimeHigh; \ - \ - ulIntrptState = cOCT6100_INTRPT_IN_TIMEOUT; \ - } \ - \ - if ( ulIntrptEnableMclkLow < ulRegMclkTimeLow ) \ - { \ - ulTimeDiff = (cOCT6100_FFFFFFFF - ulRegMclkTimeLow - 1) + ulIntrptEnableMclkLow; \ - } \ - else \ - { \ - ulTimeDiff = ulIntrptEnableMclkLow - ulRegMclkTimeLow; \ - } - -#define mOCT6100_CHECK_INTRPT_TIMEOUT( \ - ulRegMclkTimePlus5MsHigh, \ - ulRegMclkTimePlus5MsLow, \ - ulIntrptDisableMclkHigh, \ - ulIntrptDisableMclkLow, \ - ulIntrptEnableMclkHigh, \ - ulIntrptEnableMclkLow, \ - ulIntrptState, \ - fIntrptChange ) \ - /* Branch depending on whether the disable time is lesser or greater than the timeout time. */ \ - if ( ulIntrptDisableMclkLow < ulIntrptEnableMclkLow ) \ - { \ - /* Disable period is over if mclk is greater than timeout time or less than disabled time. */ \ - if ( ulRegMclkTimePlus5MsLow > ulIntrptEnableMclkLow || \ - ulRegMclkTimePlus5MsLow < ulIntrptDisableMclkLow || \ - ulRegMclkTimePlus5MsHigh != ulIntrptEnableMclkHigh ) \ - { \ - fIntrptChange = TRUE; \ - ulIntrptState = cOCT6100_INTRPT_ACTIVE; \ - } \ - } \ - else \ - { \ - /* Disable period is over if mclk is lesser than disable time and greater than timeout. */ \ - if ( (ulRegMclkTimePlus5MsLow > ulIntrptEnableMclkLow && ulRegMclkTimePlus5MsLow < ulIntrptDisableMclkLow) || \ - (ulRegMclkTimePlus5MsHigh != ulIntrptDisableMclkHigh && ulRegMclkTimePlus5MsHigh != ulIntrptEnableMclkHigh) ) \ - { \ - fIntrptChange = TRUE; \ - ulIntrptState = cOCT6100_INTRPT_ACTIVE; \ - } \ - } - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiIsrSwInit( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiIsrHwInit( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ); - -UINT32 Oct6100InterruptConfigureSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig, - IN BOOL f_fCheckParams ); - -UINT32 Oct6100ApiClearEnabledInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100InterruptServiceRoutineSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -UINT32 Oct6100ApiWriteIeRegs( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiReadIntrptRegs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags, - IN UINT32 f_ulRegister210h ); - -UINT32 Oct6100ApiUpdateIntrptStates( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -UINT32 Oct6100ApiWriteIntrptRegs( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiReadChipMclkTime( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiUpdateIntrptTimeouts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiScheduleNextMclkIntrpt( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulIntrptToSet ); - -UINT32 Oct6100ApiScheduleNextMclkIntrptSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCheckProcessorState( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -#endif /* __OCT6100_INTERRUPTS_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h deleted file mode 100644 index 77eed5e6..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h +++ /dev/null @@ -1,97 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_memory_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_memory.c. All elements defined in this - file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 17 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MEMORY_PRIV_H__ -#define __OCT6100_MEMORY_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* TSI allocation pointer macros. */ -#define mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiMemoryAllocOfst ); - -/* Conversion memory allocation pointer macros. */ -#define mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulConversionMemoryAllocOfst ); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetMemorySwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBufferPlayoutMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiReserveBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulNewNode ); - -UINT32 Oct6100ApiReleaseBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulOldNode ); - -UINT32 Oct6100ApiReserveBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulSize, - OUT PUINT32 f_pulMallocAddress ); - -UINT32 Oct6100ApiReleaseBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMallocAddress ); - -UINT32 Oct6100ApiReserveTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiMemIndex ); - -UINT32 Oct6100ApiReleaseTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiReserveConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusConversionMemIndex ); - -UINT32 Oct6100ApiReleaseConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ); - -#endif /* __OCT6100_MEMORY_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h deleted file mode 100644 index dba94fdf..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h +++ /dev/null @@ -1,431 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_miscellaneous_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_miscellaneous.c. All elements defined in - this file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 20 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MISCELLANEOUS_PRIV_H__ -#define __OCT6100_MISCELLANEOUS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/*---------------------------------------------------------------------------*\ - Macros used to shell the user function calls. These macros are used to - assert that the user does not change any of the members of the function's - parameter structure, as required and indicated in the API specification. - Ofcourse, these macros make the code heavier and thus slower. That is why - there is a compile option for disabling the extra checking. These can be - very helpful tools in debugging. -\*---------------------------------------------------------------------------*/ - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulWriteAddress; \ - UINT16 _usWriteData; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = WriteParams.pProcessContext; \ - _ulUserChipId = WriteParams.ulUserChipId; \ - _ulWriteAddress = WriteParams.ulWriteAddress; \ - _usWriteData = WriteParams.usWriteData; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverWriteApi( &WriteParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( WriteParams.pProcessContext != _pProcessContext || \ - WriteParams.ulUserChipId != _ulUserChipId || \ - WriteParams.ulWriteAddress != _ulWriteAddress || \ - WriteParams.ulWriteAddress != _ulWriteAddress || \ - WriteParams.usWriteData != _usWriteData ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_API; \ -} -#else -#define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \ - ulResult = Oct6100UserDriverWriteApi( &WriteParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulWriteAddress; \ - UINT16 _usWriteData; \ - UINT32 _ulWriteLength; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = SmearParams.pProcessContext; \ - _ulUserChipId = SmearParams.ulUserChipId; \ - _ulWriteAddress = SmearParams.ulWriteAddress; \ - _usWriteData = SmearParams.usWriteData; \ - _ulWriteLength = SmearParams.ulWriteLength; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); \ - \ - /* Check if user changed members of function's paraeter structure. */ \ - if ( SmearParams.pProcessContext != _pProcessContext || \ - SmearParams.ulUserChipId != _ulUserChipId || \ - SmearParams.usWriteData != _usWriteData || \ - SmearParams.ulWriteLength != _ulWriteLength) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_SMEAR_API; \ -} -#else -#define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \ - ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulWriteAddress; \ - PUINT16 _pusWriteData; \ - UINT32 _ulWriteLength; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = BurstParams.pProcessContext; \ - _ulUserChipId = BurstParams.ulUserChipId; \ - _ulWriteAddress = BurstParams.ulWriteAddress; \ - _pusWriteData = BurstParams.pusWriteData; \ - _ulWriteLength = BurstParams.ulWriteLength; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( BurstParams.pProcessContext != _pProcessContext || \ - BurstParams.ulUserChipId != _ulUserChipId || \ - BurstParams.ulWriteAddress != _ulWriteAddress || \ - BurstParams.pusWriteData != _pusWriteData || \ - BurstParams.ulWriteLength != _ulWriteLength ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_BURST_API; \ -} -#else -#define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \ - ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulReadAddress; \ - PUINT16 _pusReadData; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = ReadParams.pProcessContext; \ - _ulUserChipId = ReadParams.ulUserChipId; \ - _ulReadAddress = ReadParams.ulReadAddress; \ - _pusReadData = ReadParams.pusReadData; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverReadApi( &ReadParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( ReadParams.pProcessContext != _pProcessContext || \ - ReadParams.ulUserChipId != _ulUserChipId || \ - ReadParams.ulReadAddress != _ulReadAddress || \ - ReadParams.pusReadData != _pusReadData ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_API; \ -} -#else -#define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \ - ulResult = Oct6100UserDriverReadApi( &ReadParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulReadAddress; \ - PUINT16 _pusReadData; \ - UINT32 _ulReadLength; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = BurstParams.pProcessContext; \ - _ulUserChipId = BurstParams.ulUserChipId; \ - _ulReadAddress = BurstParams.ulReadAddress; \ - _pusReadData = BurstParams.pusReadData; \ - _ulReadLength = BurstParams.ulReadLength; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( BurstParams.pProcessContext != _pProcessContext || \ - BurstParams.ulUserChipId != _ulUserChipId || \ - BurstParams.ulReadAddress != _ulReadAddress || \ - BurstParams.pusReadData != _pusReadData || \ - BurstParams.ulReadLength != _ulReadLength ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_BURST_API; \ -} -#else -#define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \ - ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - -#define mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, Params ) - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: mOCT6100_RETRIEVE_NLP_CONF_DWORD - -Description: This function is used by the API to store on a per channel basis - the various confguration DWORD from the device. The API performs - less read to the chip that way since it is always in synch - with the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -IN f_pApiInst Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -IN f_pChanEntry Pointer to an API channel structure.. -IN f_ulAddress Address that needs to be modified.. -IN f_pulConfigDword Pointer to the content stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#define mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_pulConfigDword, f_ulResult ) \ -{ \ - UINT32 _ulFirstEmptyIndex = 0xFFFFFFFF; \ - UINT32 _i; \ - \ - f_ulResult = cOCT6100_ERR_FATAL_8E; \ - (*f_pulConfigDword) = cOCT6100_INVALID_VALUE; \ - \ - /* Search for the Dword.*/ \ - for ( _i = 0; _i < cOCT6100_MAX_NLP_CONF_DWORD; _i++ ) \ - { \ - if ( ( _ulFirstEmptyIndex == 0xFFFFFFFF ) && ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == 0x0 ) ) \ - _ulFirstEmptyIndex = _i; \ - \ - if ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == f_ulAddress ) \ - { \ - /* We found the matching Dword.*/ \ - (*f_pulConfigDword) = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ]; \ - f_ulResult = cOCT6100_ERR_OK; \ - } \ - } \ - \ - if ( ( _i == cOCT6100_MAX_NLP_CONF_DWORD ) && ( _ulFirstEmptyIndex == 0xFFFFFFFF ) ) \ - { \ - /* Nothing to do here, a fatal error occured, no memory was left. */ \ - } \ - else \ - { \ - if ( f_ulResult != cOCT6100_ERR_OK ) \ - { \ - tOCT6100_READ_PARAMS _ReadParams; \ - UINT16 _usReadData; \ - \ - /* We did not found any entry, let's create a new entry.*/ \ - f_pChanEntry->aulNlpConfDword[ _ulFirstEmptyIndex ][ 0 ] = f_ulAddress; \ - \ - _ReadParams.pProcessContext = f_pApiInst->pProcessContext; \ - mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, _ReadParams ); \ - _ReadParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId; \ - _ReadParams.pusReadData = &_usReadData; \ - \ - /* Read the first 16 bits.*/ \ - _ReadParams.ulReadAddress = f_ulAddress; \ - mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult ); \ - if ( f_ulResult == cOCT6100_ERR_OK ) \ - { \ - /* Save data.*/ \ - (*f_pulConfigDword) = _usReadData << 16; \ - \ - /* Read the last 16 bits .*/ \ - _ReadParams.ulReadAddress += 2; \ - mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult ); \ - if ( f_ulResult == cOCT6100_ERR_OK ) \ - { \ - /* Save data.*/ \ - (*f_pulConfigDword) |= _usReadData; \ - f_ulResult = cOCT6100_ERR_OK; \ - } \ - } \ - } \ - } \ -} - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: mOCT6100_SAVE_NLP_CONF_DWORD - -Description: This function stores a configuration Dword within an API channel - structure and then writes it into the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -IN f_pApiInst Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -IN f_pChanEntry Pointer to an API channel structure.. -IN f_ulAddress Address that needs to be modified.. -IN f_pulConfigDword content to be stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#define mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_ulConfigDword, f_ulResult ) \ -{ \ - UINT32 _i; \ - UINT32 _ulLastValue = 0x0; \ - \ - /* Search for the Dword.*/ \ - for ( _i = 0; _i < cOCT6100_MAX_NLP_CONF_DWORD; _i++ ) \ - { \ - if ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == f_ulAddress ) \ - { \ - /* We found the matching Dword.*/ \ - _ulLastValue = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ]; \ - f_pChanEntry->aulNlpConfDword[ _i ][ 1 ] = f_ulConfigDword; \ - break; \ - } \ - } \ - \ - if ( _i == cOCT6100_MAX_NLP_CONF_DWORD ) \ - { \ - f_ulResult = cOCT6100_ERR_FATAL_8F; \ - } \ - else \ - { \ - /* Write the config DWORD. */ \ - tOCT6100_WRITE_PARAMS _WriteParams; \ - \ - _WriteParams.pProcessContext = f_pApiInst->pProcessContext; \ - mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, _WriteParams ) \ - _WriteParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId; \ - \ - /* Check if it is worth calling the user function. */ \ - if ( ( f_ulConfigDword & 0xFFFF0000 ) != ( _ulLastValue & 0xFFFF0000 ) ) \ - { \ - /* Write the first 16 bits. */ \ - _WriteParams.ulWriteAddress = f_ulAddress; \ - _WriteParams.usWriteData = (UINT16)((f_ulConfigDword >> 16) & 0xFFFF); \ - mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult ); \ - } \ - else \ - { \ - f_ulResult = cOCT6100_ERR_OK; \ - } \ - \ - if ( f_ulResult == cOCT6100_ERR_OK ) \ - { \ - if ( ( f_ulConfigDword & 0x0000FFFF ) != ( _ulLastValue & 0x0000FFFF ) ) \ - { \ - /* Write the last word. */ \ - _WriteParams.ulWriteAddress = f_ulAddress + 2; \ - _WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF); \ - mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult ); \ - } \ - } \ - } \ -} - - -#define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask ) \ -{ \ - (*f_pulFieldMask) = ( 1 << f_ulFieldSize ); \ - (*f_pulFieldMask) --; \ - (*f_pulFieldMask) <<= f_ulFieldBitOffset; \ -} - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiWaitForTime( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_aulWaitTime[ 2 ] ); - -UINT32 Oct6100ApiWaitForPcRegisterBit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulPcRegAdd, - IN UINT32 f_ulPcBitNum, - IN UINT32 f_ulValue, - IN UINT32 f_ulTimeoutUs, - OUT PBOOL f_pfBitEqual ); - -UINT32 Oct6100ApiWriteDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - IN UINT32 f_ulWriteData ); - -UINT32 Oct6100ApiReadDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulReadData ); - -VOID Oct6100ApiCreateFeatureMask( - IN UINT32 f_ulFieldSize, - IN UINT32 f_ulFieldBitOffset, - OUT PUINT32 f_pulFieldMask ); - -unsigned char const *Oct6100ApiStrStr( - IN unsigned char const *f_pszSource, - IN unsigned char const *f_pszString, - IN unsigned char const *f_pszLastCharPtr ); - -UINT32 Oct6100ApiStrLen( - IN unsigned char const *f_pszString ); - -UINT32 Oct6100ApiAsciiToHex( - IN UINT8 f_chCharacter, - IN PUINT32 f_pulValue ); - -UINT8 Oct6100ApiHexToAscii( - IN UINT32 f_ulNumber ); - -UINT32 Oct6100ApiRand( - IN UINT32 f_ulRange ); - -#endif /* __OCT6100_MISCELLANEOUS_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h deleted file mode 100644 index b6a7a341..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h +++ /dev/null @@ -1,150 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mixer_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_mixer.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_mixer_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 18 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MIXER_PRIV_H__ -#define __OCT6100_MIXER_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_MIXER_EVENT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_MIXER_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulMixerEventListOfst); - -#define mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_MIXER_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulMixerEventListOfst)) + ulIndex; - -#define mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulMixerEventAllocOfst); - -#define mOCT6100_GET_COPY_EVENT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_COPY_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulCopyEventListOfst); - -#define mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_COPY_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulCopyEventListOfst)) + ulIndex; - -#define mOCT6100_GET_COPY_EVENT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulCopyEventAllocOfst); - -/***************************** TYPES ***************************************/ - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetMixerSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiMixerSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiMixerEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType, - IN UINT16 f_usDestinationChanIndex ); - -UINT32 Oct6100ApiMixerEventRemove( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType ); - -UINT32 Oct6100MixerCopyEventCreateSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ); - -UINT32 Oct6100ApiCheckCopyEventCreateParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - OUT PUINT16 f_pusSourceChanIndex, - OUT PUINT16 f_pusDestinationChanIndex ); - -UINT32 Oct6100ApiReserveCopyEventCreateResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusCopyEntryIndex, - IN OUT PUINT16 f_pusCopyEventIndex ); - -UINT32 Oct6100ApiWriteCopyEventCreateStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ); - -UINT32 Oct6100ApiUpdateCopyEventCreateEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ); - -UINT32 Oct6100MixerCopyEventDestroySer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ); - -UINT32 Oct6100ApiAssertCopyEventDestroyParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy, - IN OUT PUINT16 f_pusCopyEventIndex, - IN OUT PUINT16 f_pusMixerEventIndex ); - -UINT32 Oct6100ApiInvalidateCopyEventStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ); - -UINT32 Oct6100ApiReleaseCopyEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ); - -UINT32 Oct6100ApiReserveMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ); - -UINT32 Oct6100ApiReleaseMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ); - -UINT32 Oct6100ApiGetFreeMixerEventCnt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulFreeEventCnt ); - -UINT32 Oct6100ApiReserveCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ); - -UINT32 Oct6100ApiReleaseCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ); -#endif /* __OCT6100_MIXER_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h deleted file mode 100644 index e17ab8b1..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h +++ /dev/null @@ -1,114 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_phasing_tsst_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_phasing_tsst.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_phasing_tsst_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 12 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PHASING_TSST_PRIV_H__ -#define __OCT6100_PHASING_TSST_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_PHASING_TSST_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_PHASING_TSST )(( PUINT8 )pSharedInfo + pSharedInfo->ulPhasingTsstListOfst); - -#define mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_PHASING_TSST )(( PUINT8 )pSharedInfo + pSharedInfo->ulPhasingTsstListOfst)) + ulIndex; - -#define mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulPhasingTsstAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetPhasingTsstSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiPhasingTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100PhasingTsstOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); - -UINT32 Oct6100ApiCheckPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); - -UINT32 Oct6100ApiReservePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ); - -UINT32 Oct6100ApiWritePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ); - -UINT32 Oct6100ApiUpdatePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ); - -UINT32 Oct6100PhasingTsstCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ); - -UINT32 Oct6100ApiAssertPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ); - -UINT32 Oct6100ApiInvalidatePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex ); - -UINT32 Oct6100ApiReleasePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT UINT16 f_usPhasingIndex ); - -UINT32 Oct6100ApiReservePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusPhasingIndex ); - -UINT32 Oct6100ApiReleasePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usPhasingIndex ); - -#endif /* #ifndef cOCT6100_REMOVE_PHASING_TSST */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h deleted file mode 100644 index a69e9426..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h +++ /dev/null @@ -1,201 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_playout_buf_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_playout_buf.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_playout_buf_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 22 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PLAYOUT_BUF_PRIV_H__ -#define __OCT6100_PLAYOUT_BUF_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/* Playout buffer list pointer macros. */ -#define mOCT6100_GET_BUFFER_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_BUFFER )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufListOfst ); - -#define mOCT6100_GET_BUFFER_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_BUFFER )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufListOfst)) + ulIndex; - -#define mOCT6100_GET_BUFFER_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetPlayoutBufferSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiPlayoutBufferSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100BufferLoadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex ); - -UINT32 Oct6100BufferLoadBlockInitSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ); - -UINT32 Oct6100BufferLoadBlockSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ); - -UINT32 Oct6100ApiCheckBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fCheckBufferPtr ); - -UINT32 Oct6100ApiCheckBufferLoadBlockParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock, - OUT PUINT32 f_pulBufferBase ); - -UINT32 Oct6100ApiReserveBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex, - OUT PUINT32 f_pulBufIndex, - OUT PUINT32 f_pulBufBase ); - -UINT32 Oct6100ApiWriteBufferInMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferBase, - IN UINT32 f_ulBufferLength, - IN PUINT8 f_pbyBuffer ); - -UINT32 Oct6100ApiUpdateBufferEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN UINT32 f_ulBufIndex, - IN UINT32 f_ulBufBase ); - -UINT32 Oct6100BufferUnloadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - IN BOOL f_fReleaseListStruct ); - -UINT32 Oct6100ApiAssertBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - OUT PUINT32 f_pulBufIndex, - OUT PUINT32 f_pulBufBase ); - -UINT32 Oct6100ApiReleaseBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufIndex, - IN UINT32 f_ulBufBase, - IN BOOL f_fReleaseListStruct ); - -UINT32 Oct6100BufferPlayoutAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ); - -UINT32 Oct6100ApiCheckPlayoutAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex ); - -UINT32 Oct6100ApiWriteBufferAddStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex ); - -UINT32 Oct6100BufferPlayoutStartSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulPlayoutStopEventType ); - -UINT32 Oct6100ApiCheckPlayoutStartParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex, - OUT PBOOL f_pfNotifyOnPlayoutStop, - OUT PUINT32 f_pulUserEventId, - OUT PBOOL f_pfAllowStartIfActive ); - -UINT32 Oct6100ApiWriteChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex, - IN BOOL f_fNotifyOnPlayoutStop, - IN UINT32 f_ulUserEventId, - IN BOOL f_fAllowStartIfActive, - IN UINT32 f_ulPlayoutStopEventType ); - -UINT32 Oct6100ApiUpdateChanPlayoutEntry ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex ); - -UINT32 Oct6100BufferPlayoutStopSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ); - -UINT32 Oct6100ApiAssertPlayoutStopParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT16 f_pusEchoMemIndex ); - -UINT32 Oct6100ApiInvalidateChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - IN UINT32 f_ulChannelIndex, - IN UINT16 f_usEchoMemIndex - - ); - -UINT32 Oct6100ApiReleaseChanPlayoutResources ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - IN UINT32 f_ulChannelIndex ); - -UINT32 Oct6100ApiReserveBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulBufIndex ); - -UINT32 Oct6100ApiReleaseBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufIndex ); - -#endif /* __OCT6100_PLAYOUT_BUF_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h deleted file mode 100644 index c599ee99..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h +++ /dev/null @@ -1,144 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_remote_debug_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_remote_debug.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_remote_debug_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 13 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_REMOTE_DEBUG_PRIV_H__ -#define __OCT6100_REMOTE_DEBUG_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, ulIndex, pEntry ) \ - pEntry = ( tPOCT6100_API_REMOTE_DEBUG_SESSION )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulSessionListOfst) + ulIndex; - -#define mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pList ) \ - pList = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulSessionTreeOfst); - -#define mOCT6100_GET_REMOTE_DEBUG_DATA_BUF_PNT( pSharedInfo, pulDataBuf ) \ - pulDataBuf = ( PUINT16 )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulDataBufOfst); - -#define mOCT6100_GET_REMOTE_DEBUG_SESSION_PKT_CACHE_PNT( pSharedInfo, pulPktCache, ulSessionIndex ) \ - pulPktCache = ( PUINT32 )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulPktCacheOfst) + (ulSessionIndex * (cOCTRPC_MAX_PACKET_BYTE_LENGTH / 4)); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetRemoteDebugSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiRemoteDebuggingSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCheckEndianDetectField( - IN tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - IN UINT32 f_ulPktLengthDword ); - -VOID Oct6100ApiCalculateChecksum( - IN PUINT32 f_pulPktPayload, - IN UINT32 f_ulPktLengthDword, - OUT PUINT32 f_pulChecksum ); - -VOID Oct6100ApiFormResponsePkt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulPktLengthDword, - IN BOOL f_fRetryPktResponse, - IN BOOL f_fReplaceProtocolNum, - IN BOOL f_fReplaceInterfaceType, - IN BOOL f_fReplaceInterfaceVersion, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulParsingErrorValue, - IN UINT32 f_ulPayloadDwordIndex, - IN UINT32 f_ulChecksum ); - -UINT32 Oct6100ApiCheckPktCommands( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulPktLengthDword, - IN UINT32 f_ulChecksum ); - -VOID Oct6100ApiExecutePktCommands( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN UINT32 f_ulPktLengthDword ); - -UINT32 Oct6100ApiCheckSessionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - OUT PUINT32 f_pulSessionIndex ); - -VOID Oct6100ApiRpcReadWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcReadBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcReadArray( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcWriteWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcWriteSmear( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcWriteBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcSetHotChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcGetDebugChanIndex( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcDisconnect( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader, - IN OUT UINT32 f_ulSessionNumber ); - -#endif /* __OCT6100_REMOTE_DEBUG_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h deleted file mode 100644 index e1982bd8..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h +++ /dev/null @@ -1,515 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tlv_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tlv.c. All elements defined in this - file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 58 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TLV_PRIV_H__ -#define __OCT6100_TLV_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* List of TLV types supported by this API. */ -#define cOCT6100_TLV_TYPE_VERSION_NUMBER 0 -#define cOCT6100_TLV_TYPE_CUSTOMER_PROJECT_ID 2 - -#define cOCT6100_TLV_TYPE_POUCH_BASE_ADDRESS 3 -#define cOCT6100_TLV_TYPE_CH0_MAIN_BASE_ADDRESS 4 -#define cOCT6100_TLV_TYPE_CH_MAIN_SIZE 5 -#define cOCT6100_TLV_TYPE_CH_MAIN_IO_OFFSET 6 -#define cOCT6100_TLV_TYPE_CH_MAIN_ZCB_OFFSET 7 -#define cOCT6100_TLV_TYPE_CH_MAIN_ZCB_SIZE 8 -#define cOCT6100_TLV_TYPE_CH_MAIN_XCB_OFFSET 9 -#define cOCT6100_TLV_TYPE_CH_MAIN_XCB_SIZE 10 -#define cOCT6100_TLV_TYPE_CH_MAIN_YCB_OFFSET 11 -#define cOCT6100_TLV_TYPE_CH_MAIN_YCB_SIZE 12 -#define cOCT6100_TLV_TYPE_FREE_MEM_BASE_ADDRESS 13 -#define cOCT6100_TLV_TYPE_CH_ROOT_CONF_OFFSET 14 - -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_OFFSET 15 -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_SIZE 16 -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_OFFSET 17 -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_SIZE 18 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_ZWP 19 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_ZIS 20 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_ZSP 21 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_YWP 22 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_YIS 23 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_YSP 24 -#define cOCT6100_TLV_TYPE_POA_BOFF_RO_ZRP 25 -#define cOCT6100_TLV_TYPE_POA_BOFF_RO_YRP 26 - -#define cOCT6100_TLV_TYPE_CNR_CONF_BOFF_RW_ENABLE 27 -#define cOCT6100_TLV_TYPE_ANR_CONF_BOFF_RW_ENABLE 28 - -#define cOCT6100_TLV_TYPE_HZ_CONF_BOFF_RW_ENABLE 29 -#define cOCT6100_TLV_TYPE_HX_CONF_BOFF_RW_ENABLE 30 - -#define cOCT6100_TLV_TYPE_LCA_Z_CONF_BOFF_RW_GAIN 31 -#define cOCT6100_TLV_TYPE_LCA_Y_CONF_BOFF_RW_GAIN 32 - -#define cOCT6100_TLV_TYPE_CNA_CONF_BOFF_RW_ENABLE 33 - -#define cOCT6100_TLV_TYPE_NOA_CONF_BOFF_RW_ENABLE 34 - -#define cOCT6100_TLV_TYPE_VFA_CONF_BOFF_RW_ENABLE 35 - -#define cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_TAIL_DISP 37 - -#define cOCT6100_TLV_TYPE_STATSA_MAIN_IO_BOFF_RO_EPC 38 -#define cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_INST 39 -#define cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_RESULT 40 - -#define cOCT6100_TLV_TYPE_DIS_CONF_BOFF_RW_ENABLE 41 -#define cOCT6100_TLV_TYPE_TDM_CONF_BOFF_RW_ENABLE 42 -#define cOCT6100_TLV_TYPE_NT_CONF_BOFF_RW_ENABLE 43 -#define cOCT6100_TLV_TYPE_AEC_CONF_BOFF_RW_ENABLE 44 - -#define cOCT6100_TLV_TYPE_PCM_LEAK_CONF_BOFF_RW 45 -#define cOCT6100_TLV_TYPE_DEFAULT_ERL_CONF_BOFF_RW 46 -#define cOCT6100_TLV_TYPE_TONE_REM_CONF_BOFF_RW_ENABLE 47 - -#define cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT 48 - -#define cOCT6100_TLV_TYPE_NLP_CONV_CAP_CONF_BOFF_RW 49 -#define cOCT6100_TLV_TYPE_MATRIX_EVENT_SIZE 50 -#define cOCT6100_TLV_TYPE_CNR_RW_ENABLE 51 -#define cOCT6100_TLV_TYPE_MAX_TAIL_LENGTH_RW_ENABLE 52 - -#define cOCT6100_TLV_TYPE_PLAYOUT_ENABLE 53 -#define cOCT6100_TLV_TYPE_DOMINANT_SPEAKER_BOFF_RW_ENABLE 54 - -#define cOCT6100_TLV_TYPE_ANR_RW_ENABLE 57 -#define cOCT6100_TLV_TYPE_TONE_REMOVAL_ENABLE 58 -#define cOCT6100_TLV_TYPE_MUSIC_PROTECTION_RW_ENABLE 59 -#define cOCT6100_TLV_TYPE_TAIL_DISP_CONF_BOFF_RW_ENABLE 60 -#define cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_ENABLE 62 - -#define cOCT6100_TLV_TYPE_AEC_DEFAULT_ERL_BOFF 64 - -#define cOCT6100_TLV_TYPE_Z_ALC_TARGET_BOFF 65 -#define cOCT6100_TLV_TYPE_Y_ALC_TARGET_BOFF 66 -#define cOCT6100_TLV_TYPE_Z_HLC_TARGET_BOFF 67 -#define cOCT6100_TLV_TYPE_Y_HLC_TARGET_BOFF 68 -#define cOCT6100_TLV_TYPE_ALC_HLC_STATUS_BOFF 69 - -#define cOCT6100_TLV_TYPE_Z_PLAYOUT_HARD_SKIP_BOFF 70 -#define cOCT6100_TLV_TYPE_Y_PLAYOUT_HARD_SKIP_BOFF 71 - -#define cOCT6100_TLV_TYPE_AFT_FIELD_BOFF 72 - -#define cOCT6100_TLV_TYPE_VOICE_DETECTED_STAT_BOFF 73 - -#define cOCT6100_TLV_TYPE_GAIN_APPLIED_RIN_STAT_BOFF 74 -#define cOCT6100_TLV_TYPE_GAIN_APPLIED_SOUT_STAT_BOFF 75 - -#define cOCT6100_TLV_TYPE_MAX_ADAPT_ALE_BOFF 77 -#define cOCT6100_TLV_TYPE_RIN_ANR_BOFF 78 - -#define cOCT6100_TLV_TYPE_NUMBER_PLAYOUT_EVENTS 79 - -#define cOCT6100_TLV_TYPE_RIN_MUTE_BOFF 80 -#define cOCT6100_TLV_TYPE_SIN_MUTE_BOFF 81 - -#define cOCT6100_TLV_TYPE_CHAN_TAIL_LENGTH_BOFF 82 - -#define cOCT6100_TLV_TYPE_CHAN_VQE_TONE_DISABLING_BOFF 83 - -#define cOCT6100_TLV_TYPE_ANR_SNR_IMPROVEMENT_BOFF 84 -#define cOCT6100_TLV_TYPE_ANR_AGRESSIVITY_BOFF 85 - -#define cOCT6100_TLV_TYPE_RIN_TONE_REM_CONF_BOFF_RW_ENABLE 86 -#define cOCT6100_TLV_TYPE_RIN_TONE_REM_COUNTER_BOFF 87 - -#define cOCT6100_TLV_TYPE_AF_TAIL_DISP_VALUE_BOFF 88 - -#define cOCT6100_TLV_TYPE_POUCH_COUNTER_BOFF 89 - -#define cOCT6100_TLV_TYPE_AEC_TAIL_LENGTH_BOFF 90 - -#define cOCT6100_TLV_TYPE_MATRIX_DWORD_BASE 91 -#define cOCT6100_TLV_TYPE_DEBUG_CHAN_STATS_BYTE_SIZE 92 -#define cOCT6100_TLV_TYPE_RECORDED_PCM_EVENT_BYTE_SIZE 93 -#define cOCT6100_TLV_TYPE_HOT_CHANNEL_SELECT_DWORD_BASE 94 -#define cOCT6100_TLV_TYPE_IS_ISR_CALLED_BOFF 95 - -#define cOCT6100_TLV_TYPE_MATRIX_TIMESTAMP_DWORD_BASE 96 - -#define cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_OFFSET 100 -#define cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_SIZE 101 - -#define cOCT6100_TLV_TYPE_AF_WRITE_PTR_BYTE_OFFSET 104 -#define cOCT6100_TLV_TYPE_MATRIX_WP_DWORD_BASE 105 -#define cOCT6100_TLV_TYPE_DEBUG_CHAN_LITE_STATS_BYTE_SIZE 106 - -#define cOCT6100_TLV_TYPE_MUSIC_PROTECTION_ENABLE_BOFF 107 - -#define cOCT6100_TLV_TYPE_IMAGE_TYPE 108 -#define cOCT6100_TLV_TYPE_MAX_WIRELINE_CHANNELS 111 - -#define cOCT6100_TLV_TYPE_AF_EVENT_CB_SIZE 112 - -#define cOCT6100_TLV_TYPE_ZZ_ENERGY_CHAN_STATS_BOFF 116 -#define cOCT6100_TLV_TYPE_YY_ENERGY_CHAN_STATS_BOFF 117 - -#define cOCT6100_TLV_TYPE_BUFFER_PLAYOUT_SKIP_IN_EVENTS 119 - -#define cOCT6100_TLV_TYPE_SOUT_NOISE_BLEACHING 121 - -#define cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE 124 -#define cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE_BOFF 125 - -#define cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_BOFF 136 - -#define cOCT6100_TLV_TYPE_NLP_STATISTICS 138 - -#define cOCT6100_TLV_TYPE_RIN_ANR_VALUE 147 - -#define cOCT6100_TLV_TYPE_ADPCM_ENABLE 150 -#define cOCT6100_TLV_TYPE_NUM_TONE_DETECTOR 151 -#define cOCT6100_TLV_TYPE_CONFERENCING_ENABLE 152 -#define cOCT6100_TLV_TYPE_MAX_NUMBER_OF_CHANNELS 153 -#define cOCT6100_TLV_TYPE_DEBUG_CHAN_INDEX_VALUE 154 -#define cOCT6100_TLV_TYPE_TONE_DETECTOR_PROFILE 155 -#define cOCT6100_TLV_TYPE_TEST_MODE_ENABLE 156 -#define cOCT6100_TLV_TYPE_MAX_TAIL_DISPLACEMENT 157 - - -/* TLV length defines. */ -#define cOCT6100_TLV_MIN_LENGTH_DEFAULT 4 -#define cOCT6100_TLV_MAX_LENGTH_DEFAULT 0xFFFFFFFF - -#define cOCT6100_TLV_MIN_LENGTH_VERSION_NUMBER 4 -#define cOCT6100_TLV_MAX_LENGTH_VERSION_NUMBER 1016 -#define cOCT6100_TLV_MIN_LENGTH_CUSTOMER_PROJECT_ID 4 -#define cOCT6100_TLV_MAX_LENGTH_CUSTOMER_PROJECT_ID 4 - - -#define cOCT6100_TLV_MIN_LENGTH_CH0_MAIN_BASE_ADDRESS 4 -#define cOCT6100_TLV_MAX_LENGTH_CH0_MAIN_BASE_ADDRESS 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_IO_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_IO_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_FREE_MEM_BASE_ADDRESS 4 -#define cOCT6100_TLV_MAX_LENGTH_FREE_MEM_BASE_ADDRESS 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_ROOT_CONF_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_ROOT_CONF_OFFSET 4 - -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZWP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZWP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZIS 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZIS 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZSP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZSP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YWP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YWP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YIS 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YIS 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YSP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YSP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_ZRP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_ZRP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_YRP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_YRP 8 - -#define cOCT6100_TLV_MIN_LENGTH_CNR_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_CNR_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_ANR_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_ANR_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_HZ_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_HZ_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_HX_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_HX_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN 8 -#define cOCT6100_TLV_MAX_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN 8 -#define cOCT6100_TLV_MIN_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN 8 -#define cOCT6100_TLV_MAX_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN 8 - -#define cOCT6100_TLV_MIN_LENGTH_CNA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_CNA_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_NOA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_NOA_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_VFA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_VFA_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP 8 -#define cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP 8 - -#define cOCT6100_TLV_MIN_LENGTH_STATSA_MAIN_IO_BOFF_RO_EPC 8 -#define cOCT6100_TLV_MAX_LENGTH_STATSA_MAIN_IO_BOFF_RO_EPC 8 - -#define cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST 8 -#define cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST 8 -#define cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT 8 -#define cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT 8 - -#define cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_SIZE 4 - -#define cOCT6100_TLV_MIN_LENGTH_CDA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_CDA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_TDM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_TDM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_DIS_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_DIS_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_NT_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_NT_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_AEC_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_AEC_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_PCM_LEAK_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_PCM_LEAK_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_DEFAULT_ERL_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_DEFAULT_ERL_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT 8 -#define cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT 8 - -#define cOCT6100_TLV_MIN_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_AFT_FIELD_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_AFT_FIELD_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_VOICE_DETECTED_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_VOICE_DETECTED_STAT_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_MAX_ADAPT_ALE_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_MAX_ADAPT_ALE_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_ANR_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_ANR_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_ANR_VALUE_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_ANR_VALUE_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_MUTE_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_MUTE_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_SIN_MUTE_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_SIN_MUTE_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_ANR_AGRESSIVITY_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_ANR_AGRESSIVITY_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_CHAN_TAIL_LENGTH_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_TAIL_LENGTH_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_CHAN_VQE_TONE_DIS_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_VQE_TONE_DIS_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_TONE_REM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_TONE_REM_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_TONE_REM_COUNTER_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_TONE_REM_COUNTER_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_AF_TAIL_DISP_VALUE_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_AF_TAIL_DISP_VALUE_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_POUCH_COUNTER_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_POUCH_COUNTER_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_AEC_TAIL_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_AEC_TAIL_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_IS_ISR_CALLED_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_IS_ISR_CALLED_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF 8 -#define cOCT6100_TLV_MIN_LENGTH_YY_ENERGY_CHAN_STATS_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_YY_ENERGY_CHAN_STATS_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_INDEX_VALUE 4 -#define cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_INDEX_VALUE 4 -#define cOCT6100_TLV_MIN_LENGTH_ADPCM_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_ADPCM_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_NUM_TONE_DETECTOR 4 -#define cOCT6100_TLV_MAX_LENGTH_NUM_TONE_DETECTOR 4 -#define cOCT6100_TLV_MIN_LENGTH_CONFERENCING_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_CONFERENCING_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_NUMBER_OF_CHANNELS 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_NUMBER_OF_CHANNELS 4 -#define cOCT6100_TLV_MIN_LENGTH_TONE_DETECTOR_PROFILE 4 -#define cOCT6100_TLV_MAX_LENGTH_TONE_DETECTOR_PROFILE 4 -#define cOCT6100_TLV_MIN_LENGTH_TEST_MODE_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_TEST_MODE_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_DISPLACEMENT 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_DISPLACEMENT 4 -#define cOCT6100_TLV_MIN_LENGTH_MATRIX_EVENT_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_MATRIX_EVENT_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CNR_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_CNR_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_ANR_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_ANR_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_PLAYOUT_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_PLAYOUT_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_TONE_REMOVAL_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_TONE_REMOVAL_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_NUMBER_PLAYOUT_EVENTS 4 -#define cOCT6100_TLV_MAX_LENGTH_NUMBER_PLAYOUT_EVENTS 4 -#define cOCT6100_TLV_MIN_LENGTH_MATRIX_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_MATRIX_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_TIMESTAMP_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_TIMESTAMP_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_AF_WRITE_PTR_BYTE_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_AF_WRITE_PTR_BYTE_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_MATRIX_WP_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_MATRIX_WP_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_IMAGE_TYPE 4 -#define cOCT6100_TLV_MAX_LENGTH_IMAGE_TYPE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_WIRELINE_CHANNELS 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_WIRELINE_CHANNELS 4 -#define cOCT6100_TLV_MIN_LENGTH_AF_EVENT_CB_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_AF_EVENT_CB_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS 4 -#define cOCT6100_TLV_MAX_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS 4 -#define cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE 4 -#define cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE 4 -#define cOCT6100_TLV_MIN_LENGTH_SOUT_NOISE_BLEACHING 4 -#define cOCT6100_TLV_MAX_LENGTH_SOUT_NOISE_BLEACHING 4 -#define cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION 4 -#define cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION 4 -#define cOCT6100_TLV_MIN_LENGTH_NLP_STATISTICS 4 -#define cOCT6100_TLV_MAX_LENGTH_NLP_STATISTICS 4 - - -/***************************** TYPES ***************************************/ - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiProcessTlvRegion( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiInterpretTlvEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTlvFieldType, - IN UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulTlvValueAddress ); - -UINT32 Oct6100ApiTlvCheckLengthField( - IN OUT UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulMinLengthValue, - IN UINT32 f_ulMaxLengthValue ); - -UINT32 Oct6100ApiTlvReadDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulReadData ); - -UINT32 Oct6100ApiTlvReadBitOffsetStruct( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT tPOCT6100_TLV_OFFSET f_pBitOffsetStruct ); - -#endif /* __OCT6100_TLV_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h deleted file mode 100644 index c3192c27..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h +++ /dev/null @@ -1,111 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tone_detection_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tone_detection.c. All elements defined in - this file are for private usage of the API. All public elements are - defined in the oct6100_tone_detection_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TONE_DETECTION_PRIV_H__ -#define __OCT6100_TONE_DETECTION_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ToneDetectionEnableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ); - -UINT32 Oct6100ApiCheckToneEnableParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - - OUT PUINT32 f_pulExtToneChanIndex ); - -UINT32 Oct6100ApiWriteToneDetectEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - - IN UINT32 f_ulExtToneChanIndex ); - -UINT32 Oct6100ApiUpdateChanToneDetectEntry ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex ); - -UINT32 Oct6100ToneDetectionDisableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ); - -UINT32 Oct6100ApiAssertToneDetectionParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - OUT PUINT32 f_pulExtToneChanIndex, - - OUT PBOOL f_pfDisableAll ); - -UINT32 Oct6100ApiClearToneDetectionEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - - IN BOOL f_fDisableAll ); - -UINT32 Oct6100ApiReleaseToneDetectionEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - IN BOOL f_fDisableAll ); - -UINT32 Oct6100ApiIsSSTone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fSSTone ); - -UINT32 Oct6100ApiIs2100Tone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fIs2100Tone ); - -#endif /* __OCT6100_TONE_DETECTION_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h deleted file mode 100644 index b7c57f33..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h +++ /dev/null @@ -1,126 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsi_cnct_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tsi_cnct.c. All elements defined in - this file are for private usage of the API. All public elements are - defined in the oct6100_tsi_cnct_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSI_CNCT_PRIV_H__ -#define __OCT6100_TSI_CNCT_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/* TSI connection list pointer macros. */ -#define mOCT6100_GET_TSI_CNCT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_TSI_CNCT )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiCnctListOfst ); - -#define mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_TSI_CNCT )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiCnctListOfst)) + ulIndex; - -#define mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiCnctAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetTsiCnctSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiTsiCnctSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - - -UINT32 Oct6100TsiCnctOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); - -UINT32 Oct6100ApiCheckTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); - -UINT32 Oct6100ApiReserveTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiWriteTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiUpdateTsiEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - - -UINT32 Oct6100TsiCnctCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ); - -UINT32 Oct6100ApiAssertTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiInvalidateTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiReleaseTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiReserveTsiCnctEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiChanIndex ); - -UINT32 Oct6100ApiReleaseTsiCnctEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex ); - -#endif /* __OCT6100_TSI_CNCT_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h deleted file mode 100644 index ca080b35..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h +++ /dev/null @@ -1,89 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsst_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tsst.c. All elements defined in - this file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSST_PRIV_H__ -#define __OCT6100_TSST_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* TSST allocation and serialization pointer macros. */ -#define mOCT6100_GET_TSST_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PUINT32 )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstAllocOfst); - -#define mOCT6100_GET_TSST_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_TSST_ENTRY )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstListOfst ); - -#define mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_TSST_ENTRY )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstListOfst)) + ulIndex; - -#define mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstListAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetTsstSwSizes( - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiValidateTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulNumTssts, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulDirection ); - -UINT32 Oct6100ApiReserveTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - OUT PUINT16 f_pusTsstMemIndex, - OUT PUINT16 f_pusTsstListIndex ); - -UINT32 Oct6100ApiReleaseTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - IN UINT16 f_usTsstListIndex ); - -#endif /* __OCT6100_TSST_PRIV_H__ */ diff --git a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_version.h b/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_version.h deleted file mode 100644 index 7b3eb5d3..00000000 --- a/zaptel/kernel/oct612x/octdeviceapi/oct6100api/oct6100_version.h +++ /dev/null @@ -1,39 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_version.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the version of API. To obtain that version - number, the user must call the API function Oct6100ApiGetVersion(). - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 52 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_VERSION_H__ -#define __OCT6100_VERSION_H__ - -/* String version of the OCT6100 API.*/ - -#define cOCT6100_API_VERSION "OCT6100API-01.00-PR49" - -#endif /* __OCT6100_VERSION_H__ */ diff --git a/zaptel/kernel/oct612x/test.c b/zaptel/kernel/oct612x/test.c deleted file mode 100644 index 0105e588..00000000 --- a/zaptel/kernel/oct612x/test.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - NOTE: This is not intended to be a functional program. Its only purpose - is to act as a tool to find out what portions of the Octasic API kit we - actually need to link into our drivers. As such, it references every API - call that the actual drivers use, and we let the compiler and linker tell - us what parts of each API module are actually needed to successfully - build this program. - */ -#include "oct6100api/oct6100_api.h" - -int main(int argc, char **argv) -{ - tPOCT6100_INSTANCE_API pApiInstance; - UINT32 ulResult; - tOCT6100_CHANNEL_MODIFY modify; - tOCT6100_INTERRUPT_FLAGS InterruptFlags; - tOCT6100_TONE_EVENT tonefound; - tOCT6100_EVENT_GET_TONE tonesearch; - tOCT6100_CHIP_OPEN ChipOpen; - tOCT6100_GET_INSTANCE_SIZE InstanceSize; - tOCT6100_CHANNEL_OPEN ChannelOpen; - tOCT6100_TONE_DETECTION_ENABLE enable; - tOCT6100_CHIP_CLOSE ChipClose; - tOCT6100_API_GET_CAPACITY_PINS CapacityPins; - - Oct6100ChannelModifyDef(&modify); - ulResult = Oct6100ChannelModify(pApiInstance, &modify); - Oct6100InterruptServiceRoutineDef(&InterruptFlags); - Oct6100InterruptServiceRoutine(pApiInstance, &InterruptFlags); - Oct6100EventGetToneDef(&tonesearch); - ulResult = Oct6100EventGetTone(pApiInstance, &tonesearch); - Oct6100ChipOpenDef(&ChipOpen); - Oct6100GetInstanceSizeDef(&InstanceSize); - ulResult = Oct6100GetInstanceSize(&ChipOpen, &InstanceSize); - ulResult = Oct6100ChipOpen(pApiInstance, &ChipOpen); - Oct6100ChannelOpenDef(&ChannelOpen); - ulResult = Oct6100ChannelOpen(pApiInstance, &ChannelOpen); - Oct6100ToneDetectionEnableDef(&enable); - Oct6100ToneDetectionEnable(pApiInstance, &enable); - Oct6100ChipCloseDef(&ChipClose); - ulResult = Oct6100ChipClose(pApiInstance, &ChipClose); - Oct6100ApiGetCapacityPinsDef(&CapacityPins); - ulResult = Oct6100ApiGetCapacityPins(&CapacityPins); - - return 0; -} diff --git a/zaptel/kernel/pciradio.c b/zaptel/kernel/pciradio.c deleted file mode 100644 index 6ee0ad17..00000000 --- a/zaptel/kernel/pciradio.c +++ /dev/null @@ -1,1935 +0,0 @@ -/* - * PCI RADIO Card Zapata Telephony PCI Quad Radio Interface driver - * - * Written by Jim Dixon - * Based on previous work by Mark Spencer - * Based on previous works, designs, and archetectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001-2007 Jim Dixon / Zapata Telephony. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* - The PCI Radio Interface card interfaces up to 4 two-way radios (either - a base/mobile radio or repeater system) to Zaptel channels. The driver - may work either independent of an application, or with it, through - the driver;s ioctl() interface. This file gives you access to specify - load-time parameters for Radio channels, so that the driver may run - by itself, and just act like a generic Zaptel radio interface. -*/ - -/* Latency tests: - -Without driver: 308496 -With driver: 303826 (1.5 %) - -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif - -#ifdef LINUX26 -#include -#endif - -#define RAD_MAX_IFACES 128 - -#define NUM_CODES 15 - -#define SERIAL_BUFLEN 128 - -#define SRX_TIMEOUT 300 - -#define RAD_CNTL 0x00 -#define RAD_OPER 0x01 -#define RAD_AUXC 0x02 -#define RAD_AUXD 0x03 - #define XPGM 4 - #define XCS 2 - -#define RAD_MASK0 0x04 -#define RAD_MASK1 0x05 -#define RAD_INTSTAT 0x06 -#define RAD_AUXR 0x07 - #define XINIT 8 - #define XDONE 0x10 - -#define RAD_DMAWS 0x08 -#define RAD_DMAWI 0x0c -#define RAD_DMAWE 0x10 -#define RAD_DMARS 0x18 -#define RAD_DMARI 0x1c -#define RAD_DMARE 0x20 - -#define RAD_AUXFUNC 0x2b -#define RAD_SERCTL 0x2d -#define RAD_FSCDELAY 0x2f - -#define RAD_REGBASE 0xc0 - -#define RAD_CTCSSMASK 0xf -#define RAD_CTCSSOTHER 0xf -#define RAD_CTCSSVALID 0x10 - -#define NUM_CHANS 4 - -#define RAD_GOTRX_DEBOUNCE_TIME 75 -#define RAD_CTCSS_ACQUIRE_TIME 10 -#define RAD_CTCSS_TALKOFF_TIME 1000 - -/* -* MX828 Commands -*/ - -#define MX828_GEN_RESET 0x01 /* W */ -#define MX828_SAUDIO_CTRL 0x80 /* W */ -#define MX828_SAUDIO_STATUS 0x81 /* R */ -#define MX828_SAUDIO_SETUP 0x82 /* W */ -#define MX828_TX_TONE 0x83 /* W16 */ -#define MX828_RX_TONE 0x84 /* W16 */ -#define MX828_DCS3 0x85 /* W */ -#define MX828_DCS2 0x86 /* W */ -#define MX828_DCS1 0x87 /* W */ -#define MX828_GEN_CTRL 0x88 /* W */ -#define MX828_GPT 0x8B /* W */ -#define MX828_IRQ_MASK 0x8E /* W */ -#define MX828_SELCALL 0x8D /* W16 */ -#define MX828_AUD_CTRL 0x8A /* W16 */ -#define MX828_IRQ_FLAG 0x8F /* R */ - - -struct encdec -{ - unsigned char state; /* 0 = idle */ - int chan; - unsigned char req[NUM_CHANS]; - unsigned char dcsrx[NUM_CHANS]; - unsigned char ctrx[NUM_CHANS]; - unsigned char dcstx[NUM_CHANS]; - unsigned char cttx[NUM_CHANS]; - unsigned char saudio_ctrl[NUM_CHANS]; - unsigned char saudio_setup[NUM_CHANS]; - unsigned char txcode[NUM_CHANS]; - unsigned long long lastcmd; - int myindex[NUM_CHANS]; - unsigned long waittime; - unsigned char retstate; -} ; - - -struct pciradio { - struct pci_dev *dev; - struct zt_span span; - unsigned char ios; - int usecount; - unsigned int intcount; - int dead; - int pos; - int freeregion; - int nchans; - spinlock_t lock; - int remote_locked; - unsigned char rxbuf[SERIAL_BUFLEN]; - unsigned short rxindex; - unsigned long srxtimer; - unsigned char txbuf[SERIAL_BUFLEN]; - unsigned short txindex; - unsigned short txlen; - unsigned char pasave; - unsigned char pfsave; - volatile unsigned long ioaddr; - dma_addr_t readdma; - dma_addr_t writedma; - volatile unsigned int *writechunk; /* Double-word aligned write memory */ - volatile unsigned int *readchunk; /* Double-word aligned read memory */ - unsigned char saudio_status[NUM_CHANS]; - char gotcor[NUM_CHANS]; - char gotct[NUM_CHANS]; - char newctcssstate[NUM_CHANS]; - char ctcssstate[NUM_CHANS]; - char gotrx[NUM_CHANS]; - char gotrx1[NUM_CHANS]; - char gottx[NUM_CHANS]; - char lasttx[NUM_CHANS]; - int gotrxtimer[NUM_CHANS]; - int ctcsstimer[NUM_CHANS]; - int debouncetime[NUM_CHANS]; - int ctcssacquiretime[NUM_CHANS]; - int ctcsstalkofftime[NUM_CHANS]; - int bursttime[NUM_CHANS]; - int bursttimer[NUM_CHANS]; - unsigned char remmode[NUM_CHANS]; - unsigned short present_code[NUM_CHANS]; - unsigned short last_code[NUM_CHANS]; - unsigned short rxcode[NUM_CHANS][NUM_CODES + 1]; - unsigned short rxclass[NUM_CHANS][NUM_CODES + 1]; - unsigned short txcode[NUM_CHANS][NUM_CODES + 1];; - unsigned char radmode[NUM_CHANS]; -#define RADMODE_INVERTCOR 1 -#define RADMODE_IGNORECOR 2 -#define RADMODE_EXTTONE 4 -#define RADMODE_EXTINVERT 8 -#define RADMODE_IGNORECT 16 -#define RADMODE_NOENCODE 32 - unsigned char corthresh[NUM_CHANS]; - struct zt_chan chans[NUM_CHANS]; - unsigned char mx828_addr; - struct encdec encdec; - unsigned long long lastremcmd; -}; - - -static struct pciradio *ifaces[RAD_MAX_IFACES]; - -static void pciradio_release(struct pciradio *rad); - -static int debug = 0; - -struct tonedef { - int code; - unsigned char b1; - unsigned char b2; -} ; - -#include "radfw.h" - -static struct tonedef cttable_tx [] = { -{0,0,0}, -{670,0xE,0xB1}, -{693,0xE,0x34}, -{719,0xD,0xB1}, -{744,0xD,0x3B}, -{770,0xC,0xC9}, -{797,0xC,0x5A}, -{825,0xB,0xEF}, -{854,0xB,0x87}, -{885,0xB,0x1F}, -{915,0xA,0xC2}, -{948,0xA,0x62}, -{974,0xA,0x1B}, -{1000,0x9,0xD8}, -{1035,0x9,0x83}, -{1072,0x9,0x2F}, -{1109,0x8,0xE0}, -{1148,0x8,0x93}, -{1188,0x8,0x49}, -{1230,0x8,0x1}, -{1273,0x7,0xBC}, -{1318,0x7,0x78}, -{1365,0x7,0x36}, -{1413,0x6,0xF7}, -{1462,0x6,0xBC}, -{1514,0x6,0x80}, -{1567,0x6,0x48}, -{1598,0x6,0x29}, -{1622,0x6,0x12}, -{1679,0x5,0xDD}, -{1738,0x5,0xAA}, -{1799,0x5,0x79}, -{1835,0x5,0x5D}, -{1862,0x5,0x49}, -{1899,0x5,0x2F}, -{1928,0x5,0x1B}, -{1966,0x5,0x2}, -{1995,0x4,0xEF}, -{2035,0x4,0xD6}, -{2065,0x4,0xC4}, -{2107,0x4,0xAC}, -{2181,0x4,0x83}, -{2257,0x4,0x5D}, -{2291,0x4,0x4C}, -{2336,0x4,0x37}, -{2418,0x4,0x12}, -{2503,0x3,0xEF}, -{2541,0x3,0xE0}, -{0,0,0} -} ; - -static struct tonedef cttable_rx [] = { -{0,0,0}, -{670,0x3,0xD8}, -{693,0x4,0x9}, -{719,0x4,0x1B}, -{744,0x4,0x4E}, -{770,0x4,0x83}, -{797,0x4,0x94}, -{825,0x4,0xCB}, -{854,0x5,0x2}, -{885,0x5,0x14}, -{915,0x5,0x4C}, -{948,0x5,0x87}, -{974,0x5,0x94}, -{1000,0x5,0xCB}, -{1035,0x6,0x7}, -{1072,0x6,0x45}, -{1109,0x6,0x82}, -{1148,0x6,0xC0}, -{1188,0x6,0xD1}, -{1230,0x7,0x10}, -{1273,0x7,0x50}, -{1318,0x7,0xC0}, -{1365,0x8,0x2}, -{1413,0x8,0x44}, -{1462,0x8,0x86}, -{1514,0x8,0xC9}, -{1567,0x9,0xC}, -{1598,0x9,0x48}, -{1622,0x9,0x82}, -{1679,0x9,0xC6}, -{1738,0xA,0xB}, -{1799,0xA,0x84}, -{1835,0xA,0xC2}, -{1862,0xA,0xC9}, -{1899,0xB,0x8}, -{1928,0xB,0x44}, -{1966,0xB,0x83}, -{1995,0xB,0x8A}, -{2035,0xB,0xC9}, -{2065,0xC,0x6}, -{2107,0xC,0x46}, -{2181,0xC,0xC3}, -{2257,0xD,0x41}, -{2291,0xD,0x48}, -{2336,0xD,0x89}, -{2418,0xE,0x8}, -{2503,0xE,0x88}, -{2541,0xE,0xC7}, -{0,0,0} -}; - -static struct { - int code; - char b3; - char b2; - char b1; -} dcstable[] = { -{0,0,0,0}, -{23,0x76,0x38,0x13}, -{25,0x6B,0x78,0x15}, -{26,0x65,0xD8,0x16}, -{31,0x51,0xF8,0x19}, -{32,0x5F,0x58,0x1A}, -{43,0x5B,0x68,0x23}, -{47,0x0F,0xD8,0x27}, -{51,0x7C,0xA8,0x29}, -{54,0x6F,0x48,0x2C}, -{65,0x5D,0x18,0x35}, -{71,0x67,0x98,0x39}, -{72,0x69,0x38,0x3A}, -{73,0x2E,0x68,0x3B}, -{74,0x74,0x78,0x3C}, -{114,0x35,0xE8,0x4C}, -{115,0x72,0xB8,0x4D}, -{116,0x7C,0x18,0x4E}, -{125,0x07,0xB8,0x55}, -{131,0x3D,0x38,0x59}, -{132,0x33,0x98,0x5A}, -{134,0x2E,0xD8,0x5C}, -{143,0x37,0xA8,0x63}, -{152,0x1E,0xC8,0x6A}, -{155,0x44,0xD8,0x6D}, -{156,0x4A,0x78,0x6E}, -{162,0x6B,0xC8,0x72}, -{165,0x31,0xD8,0x75}, -{172,0x05,0xF8,0x7A}, -{174,0x18,0xB8,0x7C}, -{205,0x6E,0x98,0x85}, -{223,0x68,0xE8,0x93}, -{226,0x7B,0x08,0x96}, -{243,0x45,0xB8,0xA3}, -{244,0x1F,0xA8,0xA4}, -{245,0x58,0xF8,0xA5}, -{251,0x62,0x78,0xA9}, -{261,0x17,0x78,0xB1}, -{263,0x5E,0x88,0xB3}, -{265,0x43,0xC8,0xB5}, -{271,0x79,0x48,0xB9}, -{306,0x0C,0xF8,0xC6}, -{311,0x38,0xD8,0xC9}, -{315,0x6C,0x68,0xCD}, -{331,0x23,0xE8,0xD9}, -{343,0x29,0x78,0xE3}, -{346,0x3A,0x98,0xE6}, -{351,0x0E,0xB8,0xE9}, -{364,0x68,0x58,0xF4}, -{365,0x2F,0x08,0xF5}, -{371,0x15,0x88,0xF9}, -{411,0x77,0x69,0x09}, -{412,0x79,0xC9,0x0A}, -{413,0x3E,0x99,0x0B}, -{423,0x4B,0x99,0x13}, -{431,0x6C,0x59,0x19}, -{432,0x62,0xF9,0x1A}, -{445,0x7B,0x89,0x25}, -{464,0x27,0xE9,0x34}, -{465,0x60,0xB9,0x35}, -{466,0x6E,0x19,0x36}, -{503,0x3C,0x69,0x43}, -{506,0x2F,0x89,0x46}, -{516,0x41,0xB9,0x4E}, -{532,0x0E,0x39,0x5A}, -{546,0x19,0xE9,0x66}, -{565,0x0C,0x79,0x75}, -{606,0x5D,0x99,0x86}, -{612,0x67,0x19,0x8A}, -{624,0x0F,0x59,0x94}, -{627,0x01,0xF9,0x97}, -{631,0x72,0x89,0x99}, -{632,0x7C,0x29,0x9A}, -{654,0x4C,0x39,0xAC}, -{662,0x24,0x79,0xB2}, -{664,0x39,0x39,0xB4}, -{703,0x22,0xB9,0xC3}, -{712,0x0B,0xD9,0xCA}, -{723,0x39,0x89,0xD3}, -{731,0x1E,0x49,0xD9}, -{732,0x10,0xE9,0xDA}, -{734,0x0D,0xA9,0xDC}, -{743,0x14,0xD9,0xE3}, -{754,0x20,0xF9,0xEC}, -{0,0,0,0} -}; - -static int gettxtone(int code) -{ -int i; - - if (!code) return(0); - for(i = 0; cttable_tx[i].code || (!i); i++) - { - if (cttable_tx[i].code == code) - { - return (i); - } - } - return(-1); -} - -static int getrxtone(int code) -{ -int i; - - if (!code) return(0); - for(i = 0; cttable_rx[i].code || (!i); i++) - { - if (cttable_rx[i].code == code) - { - return (i); - } - } - return(-1); -} - - -static int getdcstone(int code) -{ -int i; - - if (!code) return(0); - for(i = 0; dcstable[i].code || (!i); i++) - { - if (dcstable[i].code == code) - { - return (i); - } - } - return(-1); -} - - -void __pciradio_setcreg(struct pciradio *rad, unsigned char reg, unsigned char val) -{ - outb(val, rad->ioaddr + RAD_REGBASE + ((reg & 0xf) << 2)); -} - -unsigned char __pciradio_getcreg(struct pciradio *rad, unsigned char reg) -{ - return inb(rad->ioaddr + RAD_REGBASE + ((reg & 0xf) << 2)); -} - - -void rbi_out(struct pciradio *rad, int n, unsigned char *rbicmd) -{ -unsigned long flags; -int x; -DECLARE_WAIT_QUEUE_HEAD(mywait); - - - for(;;) - { - spin_lock_irqsave(&rad->lock,flags); - x = rad->remote_locked || (__pciradio_getcreg(rad,0xc) & 2); - if (!x) rad->remote_locked = 1; - spin_unlock_irqrestore(&rad->lock,flags); - if (x) interruptible_sleep_on_timeout(&mywait,2); - else break; - } - spin_lock_irqsave(&rad->lock,flags); - /* enable and address RBI serializer */ - __pciradio_setcreg(rad,0xf,rad->pfsave | (n << 4) | 0x40); - /* output commands */ - for(x = 0; x < 5; x++) __pciradio_setcreg(rad,0xc,rbicmd[x]); - /* output it */ - __pciradio_setcreg(rad,0xb,1); - rad->remote_locked = 0; - spin_unlock_irqrestore(&rad->lock,flags); - return; -} - - -/* -* Output a command to the MX828 over the serial bus -*/ - - -void mx828_command(struct pciradio *rad,int channel, unsigned char command, unsigned char *byte1, unsigned char *byte2) -{ - - if(channel > 3) - return; - - rad->mx828_addr = channel; - __pciradio_setcreg(rad,0,channel); - if (byte1) __pciradio_setcreg(rad,1,*byte1); - if (byte2) __pciradio_setcreg(rad,2,*byte2); - __pciradio_setcreg(rad,3,command); - -} - -void mx828_command_wait(struct pciradio *rad,int channel, unsigned char command, unsigned char *byte1, unsigned char *byte2) -{ -DECLARE_WAIT_QUEUE_HEAD(mywait); -unsigned long flags; - - - spin_lock_irqsave(&rad->lock,flags); - while(rad->encdec.state) - { - spin_unlock_irqrestore(&rad->lock,flags); - interruptible_sleep_on_timeout(&mywait,2); - spin_lock_irqsave(&rad->lock,flags); - } - rad->encdec.lastcmd = jiffies_64 + 1000; - spin_unlock_irqrestore(&rad->lock,flags); - while(__pciradio_getcreg(rad,0xc) & 1); - rad->encdec.lastcmd = jiffies_64 + 1000; - spin_lock_irqsave(&rad->lock,flags); - rad->encdec.lastcmd = jiffies_64 + 1000; - mx828_command(rad,channel,command,byte1,byte2); - spin_unlock_irqrestore(&rad->lock,flags); - rad->encdec.lastcmd = jiffies_64 + 1000; - while(__pciradio_getcreg(rad,0xc) & 1); - rad->encdec.lastcmd = jiffies_64; -} - -static void _do_encdec(struct pciradio *rad) -{ -int i,n; -unsigned char byte1 = 0,byte2 = 0; - - /* return doing nothing if busy */ - if ((rad->encdec.lastcmd + 2) > jiffies_64) return; - if (__pciradio_getcreg(rad,0xc) & 1) return; - n = 0; - byte2 = 0; - switch(rad->encdec.state) - { - case 0: - for(i = 0; i < rad->nchans; i++) - { - n = (unsigned)(i - rad->intcount) % rad->nchans; - if (rad->encdec.req[n]) break; - } - if (i >= rad->nchans) return; - rad->encdec.req[n] = 0; - rad->encdec.dcsrx[n] = 0; - rad->encdec.ctrx[n] = 0; - rad->encdec.dcstx[n] = 0; - rad->encdec.cttx[n] = 0; - rad->encdec.myindex[n] = 0; - rad->encdec.req[n] = 0; - rad->encdec.chan = n; - - /* if something in code 0 for rx, is DCS */ - if (rad->rxcode[n][0]) rad->encdec.dcsrx[n] = 1; - else { /* otherwise, if something in other codes, is CT rx */ - for(i = 1; i <= NUM_CODES; i++) - { - if (rad->rxcode[n][1]) rad->encdec.ctrx[n] = 1; - } - } - /* get index for tx code. Will be 0 if not receiving a CT */ - rad->encdec.myindex[n] = 0; - if (rad->gotrx[n] && rad->encdec.ctrx[n] && (rad->present_code[n])) - rad->encdec.myindex[n] = rad->present_code[n]; - /* get actual tx code from array */ - rad->encdec.txcode[n] = rad->txcode[n][rad->encdec.myindex[n]]; - if (rad->encdec.txcode[n] & 0x8000) rad->encdec.dcstx[n] = 1; - else if (rad->encdec.txcode[n]) rad->encdec.cttx[n] = 1; - if (rad->radmode[n] & RADMODE_NOENCODE) - rad->encdec.dcstx[n] = rad->encdec.cttx[n] = 0; - if ((!rad->gottx[n]) || rad->bursttimer[n]) - rad->encdec.dcstx[n] = rad->encdec.cttx[n] = 0; - rad->encdec.saudio_ctrl[n] = 0; - rad->encdec.saudio_setup[n] = 0; - rad->encdec.state = 1; - break; - case 1: - if (rad->encdec.dcstx[rad->encdec.chan] && (!rad->encdec.dcsrx[rad->encdec.chan])) /* if to transmit DCS */ - { - rad->encdec.saudio_setup[rad->encdec.chan] |= 3; - rad->encdec.saudio_ctrl[rad->encdec.chan] |= 0x80; - byte1 = dcstable[rad->encdec.txcode[rad->encdec.chan] & 0x7fff].b1; - mx828_command(rad,rad->encdec.chan, MX828_DCS1, &byte1, &byte2 ); - rad->encdec.state = 2; - break; - } - rad->encdec.state = 4; - break; - case 2: - byte1 = dcstable[rad->encdec.txcode[rad->encdec.chan] & 0x7fff].b2; - mx828_command(rad,rad->encdec.chan, MX828_DCS2, &byte1, &byte2 ); - rad->encdec.state = 3; - break; - case 3: - byte1 = dcstable[rad->encdec.txcode[rad->encdec.chan] & 0x7fff].b3; - mx828_command(rad,rad->encdec.chan, MX828_DCS3, &byte1, &byte2 ); - rad->encdec.state = 4; - break; - case 4: - byte1 = 0; - byte2 = 0; - if (rad->encdec.cttx[rad->encdec.chan]) - { - rad->encdec.saudio_ctrl[rad->encdec.chan] |= 0x80; - byte1 = cttable_tx[rad->encdec.txcode[rad->encdec.chan]].b1; - byte2 = cttable_tx[rad->encdec.txcode[rad->encdec.chan]].b2; - mx828_command(rad,rad->encdec.chan, MX828_TX_TONE, &byte1, &byte2 ); - } - rad->encdec.state = 5; - break; - case 5: - if (rad->encdec.dcsrx[rad->encdec.chan]) - { - rad->encdec.saudio_setup[rad->encdec.chan] |= 1; - rad->encdec.saudio_ctrl[rad->encdec.chan] |= 0x41; - byte1 = dcstable[rad->rxcode[rad->encdec.chan][0]].b1; - mx828_command(rad,rad->encdec.chan, MX828_DCS1, &byte1, &byte2 ); - rad->encdec.state = 6; - break; - } - rad->encdec.state = 8; - break; - case 6: - byte1 = dcstable[rad->rxcode[rad->encdec.chan][0]].b2; - mx828_command(rad,rad->encdec.chan, MX828_DCS2, &byte1, &byte2 ); - rad->encdec.state = 7; - break; - case 7: - byte1 = dcstable[rad->rxcode[rad->encdec.chan][0]].b3; - mx828_command(rad,rad->encdec.chan, MX828_DCS3, &byte1, &byte2 ); - rad->encdec.state = 8; - break; - case 8: - if (rad->encdec.ctrx[rad->encdec.chan]) - { - rad->encdec.saudio_setup[rad->encdec.chan] |= 0x80; - rad->encdec.saudio_ctrl[rad->encdec.chan] |= 0x60; - } - byte1 = rad->encdec.saudio_setup[rad->encdec.chan]; - mx828_command(rad,rad->encdec.chan, MX828_SAUDIO_SETUP, &byte1, &byte2 ); - rad->encdec.state = 9; - break; - case 9: - byte1 = rad->encdec.saudio_ctrl[rad->encdec.chan]; - mx828_command(rad,rad->encdec.chan, MX828_SAUDIO_CTRL, &byte1, &byte2 ); - rad->encdec.state = 10; - break; - case 10: - rad->encdec.chan = 0; - rad->encdec.state = 0; - break; - } -} - -static inline void pciradio_transmitprep(struct pciradio *rad, unsigned char ints) -{ - volatile unsigned int *writechunk; - int x; - if (ints & 0x01) - /* Write is at interrupt address. Start writing from normal offset */ - writechunk = rad->writechunk; - else - writechunk = rad->writechunk + ZT_CHUNKSIZE; - - /* Calculate Transmission */ - zt_transmit(&rad->span); - - for (x=0;xchans[0].writechunk[x] << 24); - writechunk[x] |= (rad->chans[1].writechunk[x] << 16); - writechunk[x] |= (rad->chans[2].writechunk[x] << 8); - writechunk[x] |= (rad->chans[3].writechunk[x]); - } -} - -static inline void pciradio_receiveprep(struct pciradio *rad, unsigned char ints) -{ - volatile unsigned int *readchunk; - int x; - - if (ints & 0x08) - readchunk = rad->readchunk + ZT_CHUNKSIZE; - else - /* Read is at interrupt address. Valid data is available at normal offset */ - readchunk = rad->readchunk; - for (x=0;xchans[0].readchunk[x] = (readchunk[x] >> 24) & 0xff; - rad->chans[1].readchunk[x] = (readchunk[x] >> 16) & 0xff; - rad->chans[2].readchunk[x] = (readchunk[x] >> 8) & 0xff; - rad->chans[3].readchunk[x] = (readchunk[x]) & 0xff; - } - for (x=0;xnchans;x++) { - zt_ec_chunk(&rad->chans[x], rad->chans[x].readchunk, rad->chans[x].writechunk); - } - zt_receive(&rad->span); -} - -static void pciradio_stop_dma(struct pciradio *rad); -static void pciradio_reset_serial(struct pciradio *rad); -static void pciradio_restart_dma(struct pciradio *rad); - -#ifdef LEAVE_THIS_COMMENTED_OUT -#ifdef LINUX26 -static irqreturn_t pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs) -#else -static void pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs) -#endif -#endif - -ZAP_IRQ_HANDLER(pciradio_interrupt) -{ - struct pciradio *rad = dev_id; - unsigned char ints,byte1,byte2,gotcor,gotctcss,gotslowctcss,ctcss; - int i,x,gotrx; - - ints = inb(rad->ioaddr + RAD_INTSTAT); - outb(ints, rad->ioaddr + RAD_INTSTAT); - - if (!ints) -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - - if (ints & 0x10) { - /* Stop DMA, wait for watchdog */ - printk("RADIO PCI Master abort\n"); - pciradio_stop_dma(rad); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#else - return; -#endif - } - - if (ints & 0x20) { - printk("RADIO PCI Target abort\n"); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#else - return; -#endif - } - - if (ints & 0x0f) { - - rad->intcount++; - x = rad->intcount % rad->nchans; - /* freeze */ - __pciradio_setcreg(rad,0,rad->mx828_addr | 4); - /* read SAUDIO_STATUS for the proper channel */ - byte1 = rad->saudio_status[x] = __pciradio_getcreg(rad,x); - /* thaw */ - __pciradio_setcreg(rad,0,rad->mx828_addr); - /* get COR input */ - byte2 = __pciradio_getcreg(rad,9); - /* get bit for this channel */ - gotcor = byte2 & (1 << x); - if (rad->radmode[x] & RADMODE_INVERTCOR) gotcor = !gotcor; - rad->gotcor[x] = gotcor; - if (rad->radmode[x] & RADMODE_IGNORECOR) gotcor = 1; - gotslowctcss = 0; - if ((byte1 & RAD_CTCSSVALID) && - ((byte1 & RAD_CTCSSMASK) != RAD_CTCSSOTHER)) gotslowctcss = 1; - gotctcss = 1; - ctcss = 0; - /* set ctcss to 1 if decoding ctcss */ - if (!rad->rxcode[x][0]) - { - for(i = 1; i <= NUM_CODES; i++) - { - if (rad->rxcode[x][i]) - { - ctcss = 1; - break; - } - } - } - if (ctcss) - { - if ((!(byte1 & 0x40)) || - ((!rad->gotrx[x]) && (!gotslowctcss))) gotctcss = 0; - } - rad->present_code[x] = 0; - if (rad->rxcode[x][0]) - { - if (byte1 & 0x80) gotctcss = gotslowctcss = 1; else gotctcss = 0; - } else if (gotslowctcss) rad->present_code[x] = (byte1 & RAD_CTCSSMASK) + 1; - if (rad->radmode[x] & RADMODE_EXTTONE) - { - unsigned mask = 1 << (x + 4); /* they're on the UIOB's */ - unsigned char byteuio; - - /* set UIOB as input */ - byteuio = __pciradio_getcreg(rad,0xe); - byteuio |= mask; - __pciradio_setcreg(rad,0xe,byteuio); - /* get UIO input */ - byteuio = __pciradio_getcreg(rad,8); - if (rad->radmode[x] & RADMODE_EXTINVERT) - gotctcss = gotslowctcss = ((byteuio & mask) == 0); - else - gotctcss = gotslowctcss = ((byteuio & mask) != 0); - } - rad->gotct[x] = gotslowctcss; - if ((rad->radmode[x] & RADMODE_IGNORECT) || - ((!(rad->radmode[x] & RADMODE_EXTTONE)) && (!ctcss))) - { - gotctcss = 1; - gotslowctcss = 1; - rad->present_code[x] = 0; - } - if(rad->newctcssstate[x] != gotctcss){ - rad->newctcssstate[x] = gotctcss; - if(rad->newctcssstate[x]) - rad->ctcsstimer[x]=rad->ctcssacquiretime[x]; - else - rad->ctcsstimer[x]=rad->ctcsstalkofftime[x]; - } - else{ - if(!rad->ctcsstimer[x]) - rad->ctcssstate[x] = rad->newctcssstate[x]; - else - rad->ctcsstimer[x]--; - } - gotrx = gotcor && rad->ctcssstate[x]; - if (gotrx != rad->gotrx[x]) - { - rad->gotrxtimer[x] = rad->debouncetime[x]; - } - rad->gotrx[x] = gotrx; - if (rad->present_code[x] != rad->last_code[x]) - { - rad->encdec.req[x] = 1; - rad->last_code[x] = rad->present_code[x]; - } - _do_encdec(rad); - for(x = 0; x < rad->nchans; x++) - { - unsigned char mask = 1 << x; - - if (rad->gottx[x] != rad->lasttx[x]) - { - if (rad->gottx[x]) - { - rad->bursttimer[x] = 0; - rad->pasave |= mask; - __pciradio_setcreg(rad, 0xa, rad->pasave); - } - else - { - if (!rad->bursttime[x]) - { - rad->pasave &= ~mask; - __pciradio_setcreg(rad, 0xa, rad->pasave); - } - else - { - rad->bursttimer[x] = rad->bursttime[x]; - } - } - rad->encdec.req[x] = 1; - rad->lasttx[x] = rad->gottx[x]; - } - if (rad->bursttimer[x]) - { - /* if just getting to zero */ - if (!(--rad->bursttimer[x])) - { - unsigned char mask = 1 << x; - - rad->pasave &= ~mask; - __pciradio_setcreg(rad, 0xa, rad->pasave); - } - } - - /* if timer active */ - if (rad->gotrxtimer[x]) - { - /* if just getting to zero */ - if (!(--rad->gotrxtimer[x])) - { - unsigned char mask; - - mask = 1 << (x + 4); - rad->pasave &= ~mask; - if (gotctcss) rad->pasave |= mask; - __pciradio_setcreg(rad, 0xa, rad->pasave); - - if (rad->gotrx[x] != rad->gotrx1[x]) - { - if (rad->gotrx[x]) { - if (debug) - { - if (rad->present_code[x]) - printk("Chan %d got rx (ctcss code %d)\n",x + 1, - cttable_rx[rad->rxcode[x][rad->present_code[x]]].code); - else - printk("Chan %d got rx\n",x + 1); - } - zt_hooksig(&rad->chans[x],ZT_RXSIG_OFFHOOK); - } else { - if (debug) printk("Chan %d lost rx\n",x + 1); - zt_hooksig(&rad->chans[x],ZT_RXSIG_ONHOOK); - } - rad->encdec.req[x] = 1; - } - rad->gotrx1[x] = rad->gotrx[x]; - } - } - } - /* process serial if any */ - /* send byte if there is one in buffer to send */ - if (rad->txlen && (rad->txlen != rad->txindex)) - { - /* if tx not busy */ - if (!(__pciradio_getcreg(rad,9) & 0x80)) - { - __pciradio_setcreg(rad, 4, rad->txbuf[rad->txindex++]); - } - } - rad->srxtimer++; - /* if something in rx to read */ - while(__pciradio_getcreg(rad,9) & 0x10) - { - unsigned char c = __pciradio_getcreg(rad,4); - rad->srxtimer = 0; - if (rad->rxindex < RAD_SERIAL_BUFLEN) - { - rad->rxbuf[rad->rxindex++] = c; - } - udelay(1); - } - pciradio_receiveprep(rad, ints); - pciradio_transmitprep(rad, ints); - i = 0; - for(x = 0; x < 4; x++) - { - if (rad->gottx[x]) i |= (1 << (x * 2)); - if (rad->gotrx[x]) i |= (2 << (x * 2)); - } - /* output LED's */ - __pciradio_setcreg(rad, 9, i); - } -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif - -} - -static int pciradio_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - int i,mycode; - unsigned long flags; - unsigned char byte1,byte2,mask; - union { - struct zt_radio_stat s; - struct zt_radio_param p; - } stack; - - struct pciradio *rad = chan->pvt; - DECLARE_WAIT_QUEUE_HEAD(mywait); - - switch (cmd) { - case ZT_RADIO_GETPARAM: - if (copy_from_user(&stack.p,(struct zt_radio_param *)data,sizeof(struct zt_radio_param))) return -EFAULT; - spin_lock_irqsave(&rad->lock,flags); - stack.p.data = 0; /* start with 0 value in output */ - switch(stack.p.radpar) { - case ZT_RADPAR_INVERTCOR: - if (rad->radmode[chan->chanpos - 1] & RADMODE_INVERTCOR) - stack.p.data = 1; - break; - case ZT_RADPAR_IGNORECOR: - if (rad->radmode[chan->chanpos - 1] & RADMODE_IGNORECOR) - stack.p.data = 1; - break; - case ZT_RADPAR_IGNORECT: - if (rad->radmode[chan->chanpos - 1] & RADMODE_IGNORECT) - stack.p.data = 1; - break; - case ZT_RADPAR_NOENCODE: - if (rad->radmode[chan->chanpos - 1] & RADMODE_NOENCODE) - stack.p.data = 1; - break; - case ZT_RADPAR_CORTHRESH: - stack.p.data = rad->corthresh[chan->chanpos - 1] & 7; - break; - case ZT_RADPAR_EXTRXTONE: - if (rad->radmode[chan->chanpos - 1] & RADMODE_EXTTONE) - { - stack.p.data = 1; - if (rad->radmode[chan->chanpos - 1] & RADMODE_EXTINVERT) - { - stack.p.data = 2; - } - } - break; - case ZT_RADPAR_NUMTONES: - stack.p.data = NUM_CODES; - break; - case ZT_RADPAR_RXTONE: - if ((stack.p.index < 1) || (stack.p.index > NUM_CODES)) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - stack.p.data = - cttable_rx[rad->rxcode[chan->chanpos - 1][stack.p.index] & 0x7fff].code; - break; - case ZT_RADPAR_RXTONECLASS: - if ((stack.p.index < 1) || (stack.p.index > NUM_CODES)) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - stack.p.data = rad->rxclass[chan->chanpos - 1][stack.p.index] & 0xffff; - break; - case ZT_RADPAR_TXTONE: - if (stack.p.index > NUM_CODES) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - stack.p.data = cttable_tx[rad->txcode[chan->chanpos - 1][stack.p.index] & 0x7fff].code; - /* if a DCS tone, return as such */ - if (rad->txcode[chan->chanpos - 1][stack.p.index] & 0x8000) - stack.p.data |= 0x8000; - break; - case ZT_RADPAR_DEBOUNCETIME: - stack.p.data = rad->debouncetime[chan->chanpos - 1]; - break; - - case ZT_RADPAR_CTCSSACQUIRETIME: - stack.p.data = rad->ctcssacquiretime[chan->chanpos - 1]; - break; - - case ZT_RADPAR_CTCSSTALKOFFTIME: - stack.p.data = rad->ctcsstalkofftime[chan->chanpos - 1]; - break; - - case ZT_RADPAR_BURSTTIME: - stack.p.data = rad->bursttime[chan->chanpos - 1]; - break; - case ZT_RADPAR_UIODATA: - stack.p.data = 0; - byte1 = __pciradio_getcreg(rad,8); - if (byte1 & (1 << (chan->chanpos - 1))) stack.p.data |= 1; - if (byte1 & (1 << (chan->chanpos + 3))) stack.p.data |= 2; - break; - case ZT_RADPAR_UIOMODE: - stack.p.data = 0; - byte1 = __pciradio_getcreg(rad,0xe); - if (byte1 & (1 << (chan->chanpos - 1))) stack.p.data |= 1; - if (byte1 & (1 << (chan->chanpos + 3))) stack.p.data |= 2; - break; - case ZT_RADPAR_REMMODE: - stack.p.data = rad->remmode[chan->chanpos - 1]; - break; - default: - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - spin_unlock_irqrestore(&rad->lock,flags); - if (copy_to_user((struct zt_radio_param *)data,&stack.p,sizeof(struct zt_radio_param))) return -EFAULT; - break; - case ZT_RADIO_SETPARAM: - if (copy_from_user(&stack.p,(struct zt_radio_param *)data,sizeof(struct zt_radio_param))) return -EFAULT; - spin_lock_irqsave(&rad->lock,flags); - switch(stack.p.radpar) { - case ZT_RADPAR_INVERTCOR: - if (stack.p.data) - rad->radmode[chan->chanpos - 1] |= RADMODE_INVERTCOR; - else - rad->radmode[chan->chanpos - 1] &= ~RADMODE_INVERTCOR; - break; - case ZT_RADPAR_IGNORECOR: - if (stack.p.data) - rad->radmode[chan->chanpos - 1] |= RADMODE_IGNORECOR; - else - rad->radmode[chan->chanpos - 1] &= ~RADMODE_IGNORECOR; - break; - case ZT_RADPAR_IGNORECT: - if (stack.p.data) - rad->radmode[chan->chanpos - 1] |= RADMODE_IGNORECT; - else - rad->radmode[chan->chanpos - 1] &= ~RADMODE_IGNORECT; - break; - case ZT_RADPAR_NOENCODE: - if (stack.p.data) - rad->radmode[chan->chanpos - 1] |= RADMODE_NOENCODE; - else - rad->radmode[chan->chanpos - 1] &= ~RADMODE_NOENCODE; - break; - case ZT_RADPAR_CORTHRESH: - if ((stack.p.data < 0) || (stack.p.data > 7)) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - rad->corthresh[chan->chanpos - 1] = stack.p.data; - byte1 = 0xc0 | (rad->corthresh[chan->chanpos - 1] << 2); - spin_unlock_irqrestore(&rad->lock,flags); - mx828_command_wait(rad,chan->chanpos - 1, MX828_GEN_CTRL, &byte1, &byte2); - spin_lock_irqsave(&rad->lock,flags); - break; - case ZT_RADPAR_EXTRXTONE: - if (stack.p.data) - rad->radmode[chan->chanpos - 1] |= RADMODE_EXTTONE; - else - rad->radmode[chan->chanpos - 1] &= ~RADMODE_EXTTONE; - if (stack.p.data > 1) - rad->radmode[chan->chanpos - 1] |= RADMODE_EXTINVERT; - else - rad->radmode[chan->chanpos - 1] &= ~RADMODE_EXTINVERT; - break; - case ZT_RADPAR_INITTONE: - for(i = 0; i <= NUM_CODES; i++) - { - rad->rxcode[chan->chanpos - 1][i] = 0; - rad->rxclass[chan->chanpos - 1][i] = 0; - rad->txcode[chan->chanpos - 1][i] = 0; - } - spin_unlock_irqrestore(&rad->lock,flags); - for(i = 0; i < NUM_CODES; i++) - { - /* set to no encode/decode */ - byte1 = 0; - mx828_command_wait(rad,chan->chanpos - 1, MX828_SAUDIO_CTRL, &byte1, &byte2 ); - /* set rx tone to none */ - byte1 = i << 4; - byte2 = 0; - mx828_command_wait(rad,chan->chanpos - 1, MX828_RX_TONE, &byte1, &byte2 ); - } - spin_lock_irqsave(&rad->lock,flags); - break; - case ZT_RADPAR_RXTONE: - if (!stack.p.index) /* if RX DCS mode */ - { - if ((stack.p.data < 0) || (stack.p.data > 777)) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - mycode = getdcstone(stack.p.data); - if (mycode < 0) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - rad->rxcode[chan->chanpos - 1][0] = mycode; - rad->encdec.req[chan->chanpos - 1] = 1; - break; - } - if ((stack.p.index < 1) || (stack.p.index > NUM_CODES)) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - mycode = getrxtone(stack.p.data); - if (mycode < 0) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - rad->rxcode[chan->chanpos - 1][stack.p.index] = mycode; - byte1 = cttable_rx[mycode].b1 | ((stack.p.index - 1) << 4); - byte2 = cttable_rx[mycode].b2; - spin_unlock_irqrestore(&rad->lock,flags); - mx828_command_wait(rad,chan->chanpos - 1, MX828_RX_TONE, &byte1, &byte2 ); - spin_lock_irqsave(&rad->lock,flags); - /* zot out DCS one if there */ - rad->rxcode[chan->chanpos - 1][0] = 0; - rad->encdec.req[chan->chanpos - 1] = 1; - break; - case ZT_RADPAR_RXTONECLASS: - if ((stack.p.index < 1) || (stack.p.index > NUM_CODES)) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - rad->rxclass[chan->chanpos - 1][stack.p.index] = stack.p.data & 0xffff; - break; - case ZT_RADPAR_TXTONE: - if (stack.p.index > NUM_CODES) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - if (stack.p.data & 0x8000) /* if dcs */ - mycode = getdcstone(stack.p.data & 0x7fff); - else - mycode = gettxtone(stack.p.data); - if (mycode < 0) { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - if (stack.p.data & 0x8000) mycode |= 0x8000; - rad->txcode[chan->chanpos - 1][stack.p.index] = mycode; - rad->encdec.req[chan->chanpos - 1] = 1; - break; - case ZT_RADPAR_DEBOUNCETIME: - rad->debouncetime[chan->chanpos - 1] = stack.p.data; - break; - - case ZT_RADPAR_CTCSSACQUIRETIME: - rad->ctcssacquiretime[chan->chanpos - 1] = stack.p.data; - break; - - case ZT_RADPAR_CTCSSTALKOFFTIME: - rad->ctcsstalkofftime[chan->chanpos - 1] = stack.p.data; - break; - - case ZT_RADPAR_BURSTTIME: - rad->bursttime[chan->chanpos - 1] = stack.p.data; - break; - case ZT_RADPAR_UIODATA: - byte1 = __pciradio_getcreg(rad,8); - byte1 &= ~(1 << (chan->chanpos - 1)); - byte1 &= ~(1 << (chan->chanpos + 3)); - if (stack.p.data & 1) byte1 |= (1 << (chan->chanpos - 1)); - if (stack.p.data & 2) byte1 |= (1 << (chan->chanpos + 3)); - __pciradio_setcreg(rad,8,byte1); - break; - case ZT_RADPAR_UIOMODE: - byte1 = __pciradio_getcreg(rad,0xe); - byte1 &= ~(1 << (chan->chanpos - 1)); - byte1 &= ~(1 << (chan->chanpos + 3)); - if (stack.p.data & 1) byte1 |= (1 << (chan->chanpos - 1)); - if (stack.p.data & 2) byte1 |= (1 << (chan->chanpos + 3)); - __pciradio_setcreg(rad,0xe,byte1); - break; - case ZT_RADPAR_REMMODE: - rad->remmode[chan->chanpos - 1] = stack.p.data; - break; - case ZT_RADPAR_REMCOMMAND: - /* if no remote mode, return an error */ - if (rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_NONE) - { - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - i = 0; - if (rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_RBI1) - { - /* set UIOA and UIOB for output */ - byte1 = __pciradio_getcreg(rad,0xe); - mask = (1 << (chan->chanpos - 1)) | - (1 << (chan->chanpos + 3)); - byte2 = byte1 & (~mask); - i = (byte2 != byte1); - __pciradio_setcreg(rad,0xe,byte2); - byte1 = __pciradio_getcreg(rad,8); - mask = 1 << (chan->chanpos - 1); - byte2 = byte1 | mask; - i = (byte2 != byte1); - __pciradio_setcreg(rad,8,byte2); - spin_unlock_irqrestore(&rad->lock,flags); - if (i || (jiffies_64 < rad->lastremcmd + 10)) - interruptible_sleep_on_timeout(&mywait,10); - rad->lastremcmd = jiffies_64; - rbi_out(rad,chan->chanpos - 1,(unsigned char *)&stack.p.data); - spin_lock_irqsave(&rad->lock,flags); - break; - } - spin_unlock_irqrestore(&rad->lock,flags); - for(;;) - { - int x; - - spin_lock_irqsave(&rad->lock,flags); - x = rad->remote_locked || (__pciradio_getcreg(rad,0xc) & 2); - if (!x) rad->remote_locked = 1; - spin_unlock_irqrestore(&rad->lock,flags); - if (x) interruptible_sleep_on_timeout(&mywait,2); - else break; - } - spin_lock_irqsave(&rad->lock,flags); - /* set UIOA for input and UIOB for output */ - byte1 = __pciradio_getcreg(rad,0xe); - mask = 1 << (chan->chanpos + 3); /* B an output */ - byte2 = byte1 & (~mask); - byte2 |= 1 << (chan->chanpos - 1); /* A in input */ - __pciradio_setcreg(rad,0xe,byte2); - byte1 = __pciradio_getcreg(rad,8); - byte2 = byte1 | mask; - byte2 |= 1 << (chan->chanpos - 1); - byte2 |= 1 << (chan->chanpos + 3); - __pciradio_setcreg(rad,8,byte2); - spin_unlock_irqrestore(&rad->lock,flags); - if (byte1 != byte2) - interruptible_sleep_on_timeout(&mywait,3); - while (jiffies_64 < rad->lastremcmd + 10) - interruptible_sleep_on_timeout(&mywait,10); - rad->lastremcmd = jiffies_64; - for(;;) - { - if (!(__pciradio_getcreg(rad,0xc) & 2)) break; - interruptible_sleep_on_timeout(&mywait,2); - } - spin_lock_irqsave(&rad->lock,flags); - /* enable and address async serializer */ - __pciradio_setcreg(rad,0xf,rad->pfsave | ((chan->chanpos - 1) << 4) | 0x80); - /* copy tx buffer */ - memcpy(rad->txbuf,stack.p.buf,stack.p.index); - rad->txlen = stack.p.index; - rad->txindex = 0; - rad->rxindex = 0; - rad->srxtimer = 0; - memset(stack.p.buf,0,SERIAL_BUFLEN); - stack.p.index = 0; - if (stack.p.data) for(;;) - { - rad->rxbuf[rad->rxindex] = 0; - if ((rad->rxindex < stack.p.data) && - (rad->srxtimer < SRX_TIMEOUT) && - ((rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_SERIAL) || - (!strchr((char *)rad->rxbuf,'\r')))) - { - spin_unlock_irqrestore(&rad->lock,flags); - interruptible_sleep_on_timeout(&mywait,2); - spin_lock_irqsave(&rad->lock,flags); - continue; - } - memset(stack.p.buf,0,SERIAL_BUFLEN); - if (stack.p.data && (rad->rxindex > stack.p.data)) - rad->rxindex = stack.p.data; - if (rad->rxindex) - memcpy(stack.p.buf,rad->rxbuf,rad->rxindex); - stack.p.index = rad->rxindex; - break; - } - /* wait for done if in SERIAL_ASCII mode, or if no Rx aftwards */ - if ((rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_SERIAL_ASCII) || - (!stack.p.data)) - { - /* wait for TX to be done if not already */ - while(rad->txlen && (rad->txindex < rad->txlen)) - { - spin_unlock_irqrestore(&rad->lock,flags); - interruptible_sleep_on_timeout(&mywait,2); - spin_lock_irqsave(&rad->lock,flags); - } - /* disable and un-address async serializer */ - __pciradio_setcreg(rad,0xf,rad->pfsave); - } - rad->remote_locked = 0; - spin_unlock_irqrestore(&rad->lock,flags); - if (rad->remmode[chan->chanpos - 1] == ZT_RADPAR_REM_SERIAL_ASCII) - interruptible_sleep_on_timeout(&mywait,100); - if (copy_to_user((struct zt_radio_stat *)data,&stack.p,sizeof(struct zt_radio_param))) return -EFAULT; - return 0; - default: - spin_unlock_irqrestore(&rad->lock,flags); - return -EINVAL; - } - spin_unlock_irqrestore(&rad->lock,flags); - break; - case ZT_RADIO_GETSTAT: - spin_lock_irqsave(&rad->lock,flags); - /* start with clean object */ - memset(&stack.s,0,sizeof(struct zt_radio_stat)); - /* if we have rx */ - if (rad->gotrx[chan->chanpos - 1]) - { - stack.s.radstat |= ZT_RADSTAT_RX; - if (rad->rxcode[chan->chanpos - 1][0]) - stack.s.ctcode_rx = - dcstable[rad->rxcode[chan->chanpos - 1][0]].code | 0x8000; - else { - stack.s.ctcode_rx = - cttable_rx[rad->rxcode[chan->chanpos - 1][rad->present_code[chan->chanpos - 1]]].code; - stack.s.ctclass = - rad->rxclass[chan->chanpos - 1][rad->present_code[chan->chanpos - 1]]; - } - } - /* if we have tx */ - if (rad->gottx[chan->chanpos - 1]) - { - unsigned short x,myindex; - - stack.s.radstat |= ZT_RADSTAT_TX; - stack.s.radstat |= ZT_RADSTAT_TX; - - myindex = 0; - if ((!rad->rxcode[chan->chanpos - 1][0]) - && (rad->present_code[chan->chanpos - 1])) - myindex = rad->present_code[chan->chanpos - 1]; - x = rad->txcode[chan->chanpos - 1][myindex]; - if (x & 0x8000) - stack.s.ctcode_tx = dcstable[x & 0x7fff].code | 0x8000; - else - stack.s.ctcode_tx = cttable_tx[x].code; - - } - - if (rad->radmode[chan->chanpos - 1] & RADMODE_IGNORECOR) - stack.s.radstat |= ZT_RADSTAT_IGNCOR; - if (rad->radmode[chan->chanpos - 1] & RADMODE_IGNORECT) - stack.s.radstat |= ZT_RADSTAT_IGNCT; - if (rad->radmode[chan->chanpos - 1] & RADMODE_NOENCODE) - stack.s.radstat |= ZT_RADSTAT_NOENCODE; - if (rad->gotcor[chan->chanpos - 1]) - stack.s.radstat |= ZT_RADSTAT_RXCOR; - if (rad->gotct[chan->chanpos - 1]) - stack.s.radstat |= ZT_RADSTAT_RXCT; - spin_unlock_irqrestore(&rad->lock,flags); - if (copy_to_user((struct zt_radio_stat *)data,&stack.s,sizeof(struct zt_radio_stat))) return -EFAULT; - break; - default: - return -ENOTTY; - } - return 0; - -} - -static int pciradio_open(struct zt_chan *chan) -{ - struct pciradio *rad = chan->pvt; - if (rad->dead) - return -ENODEV; - rad->usecount++; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int pciradio_watchdog(struct zt_span *span, int event) -{ - printk("PCI RADIO: Restarting DMA\n"); - pciradio_restart_dma(span->pvt); - return 0; -} - -static int pciradio_close(struct zt_chan *chan) -{ - struct pciradio *rad = chan->pvt; - rad->usecount--; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - /* If we're dead, release us now */ - if (!rad->usecount && rad->dead) - pciradio_release(rad); - return 0; -} - -static int pciradio_hooksig(struct zt_chan *chan, zt_txsig_t txsig) -{ - struct pciradio *rad = chan->pvt; - - switch(txsig) { - case ZT_TXSIG_START: - case ZT_TXSIG_OFFHOOK: - rad->gottx[chan->chanpos - 1] = 1; - break; - case ZT_TXSIG_ONHOOK: - rad->gottx[chan->chanpos - 1] = 0; - break; - default: - printk("pciradio: Can't set tx state to %d\n", txsig); - break; - } - if (debug) - printk("pciradio: Setting Radio hook state to %d on chan %d\n", txsig, chan->chanpos); - return 0; -} - -static int pciradio_initialize(struct pciradio *rad) -{ - int x; - - /* Zapata stuff */ - sprintf(rad->span.name, "PCIRADIO/%d", rad->pos); - sprintf(rad->span.desc, "Board %d", rad->pos + 1); - rad->span.deflaw = ZT_LAW_MULAW; - for (x=0;xnchans;x++) { - sprintf(rad->chans[x].name, "PCIRADIO/%d/%d", rad->pos, x); - rad->chans[x].sigcap = ZT_SIG_SF | ZT_SIG_EM; - rad->chans[x].chanpos = x+1; - rad->chans[x].pvt = rad; - rad->debouncetime[x] = RAD_GOTRX_DEBOUNCE_TIME; - rad->ctcssacquiretime[x] = RAD_CTCSS_ACQUIRE_TIME; - rad->ctcsstalkofftime[x] = RAD_CTCSS_TALKOFF_TIME; - } - rad->span.chans = rad->chans; - rad->span.channels = rad->nchans; - rad->span.hooksig = pciradio_hooksig; - rad->span.open = pciradio_open; - rad->span.close = pciradio_close; - rad->span.flags = ZT_FLAG_RBS; - rad->span.ioctl = pciradio_ioctl; - rad->span.watchdog = pciradio_watchdog; - init_waitqueue_head(&rad->span.maintq); - - rad->span.pvt = rad; - if (zt_register(&rad->span, 0)) { - printk("Unable to register span with zaptel\n"); - return -1; - } - return 0; -} - -static void wait_just_a_bit(int foo) -{ - long newjiffies; - newjiffies = jiffies + foo; - while(jiffies < newjiffies); -} - -static int pciradio_hardware_init(struct pciradio *rad) -{ -unsigned char byte1,byte2; -int x; -unsigned long endjif; - - /* Signal Reset */ - outb(0x01, rad->ioaddr + RAD_CNTL); - - /* Reset PCI Interface chip and registers (and serial) */ - outb(0x06, rad->ioaddr + RAD_CNTL); - /* Setup our proper outputs */ - rad->ios = 0xfe; - outb(rad->ios, rad->ioaddr + RAD_AUXD); - - /* Set all to outputs except AUX 3 & 4, which are inputs */ - outb(0x67, rad->ioaddr + RAD_AUXC); - - /* Select alternate function for AUX0 */ - outb(0x4, rad->ioaddr + RAD_AUXFUNC); - - /* Wait 1/4 of a sec */ - wait_just_a_bit(HZ/4); - - /* attempt to load the Xilinx Chip */ - /* De-assert CS+Write */ - rad->ios |= XCS; - outb(rad->ios, rad->ioaddr + RAD_AUXD); - /* Assert PGM */ - rad->ios &= ~XPGM; - outb(rad->ios, rad->ioaddr + RAD_AUXD); - /* wait for INIT and DONE to go low */ - endjif = jiffies + 10; - while (inb(rad->ioaddr + RAD_AUXR) & (XINIT | XDONE) && (jiffies <= endjif)); - if (endjif < jiffies) { - printk("Timeout waiting for INIT and DONE to go low\n"); - return -1; - } - if (debug) printk("fwload: Init and done gone to low\n"); - /* De-assert PGM */ - rad->ios |= XPGM; - outb(rad->ios, rad->ioaddr + RAD_AUXD); - /* wait for INIT to go high (clearing done */ - endjif = jiffies + 10; - while (!(inb(rad->ioaddr + RAD_AUXR) & XINIT) && (jiffies <= endjif)); - if (endjif < jiffies) { - printk("Timeout waiting for INIT to go high\n"); - return -1; - } - if (debug) printk("fwload: Init went high (clearing done)\nNow loading...\n"); - /* Assert CS+Write */ - rad->ios &= ~XCS; - outb(rad->ios, rad->ioaddr + RAD_AUXD); - for (x = 0; x < sizeof(radfw); x++) - { - /* write the byte */ - outb(radfw[x],rad->ioaddr + RAD_REGBASE); - /* if DONE signal, we're done, exit */ - if (inb(rad->ioaddr + RAD_AUXR) & XDONE) break; - /* if INIT drops, we're screwed, exit */ - if (!(inb(rad->ioaddr + RAD_AUXR) & XINIT)) break; - } - if (debug) printk("fwload: Transferred %d bytes into chip\n",x); - /* Wait for FIFO to clear */ - endjif = jiffies + 2; - while (jiffies < endjif); /* wait */ - printk("Transfered %d bytes into chip\n",x); - /* De-assert CS+Write */ - rad->ios |= XCS; - outb(rad->ios, rad->ioaddr + RAD_AUXD); - if (debug) printk("fwload: Loading done!\n"); - /* Wait for FIFO to clear */ - endjif = jiffies + 2; - while (jiffies < endjif); /* wait */ - if (!(inb(rad->ioaddr + RAD_AUXR) & XINIT)) - { - printk("Drove Init low!! CRC Error!!!\n"); - return -1; - } - if (!(inb(rad->ioaddr + RAD_AUXR) & XDONE)) - { - printk("Did not get DONE signal. Short file maybe??\n"); - return -1; - } - wait_just_a_bit(2); - /* get the thingy started */ - outb(0,rad->ioaddr + RAD_REGBASE); - outb(0,rad->ioaddr + RAD_REGBASE); - printk("Xilinx Chip successfully loaded, configured and started!!\n"); - - wait_just_a_bit(HZ/4); - - - /* Back to normal, with automatic DMA wrap around */ - outb(0x30 | 0x01, rad->ioaddr + RAD_CNTL); - - /* Configure serial port for MSB->LSB operation */ - outb(0xc1, rad->ioaddr + RAD_SERCTL); /* DEBUG set double dlck to 0 SR */ - - rad->pasave = 0; - __pciradio_setcreg(rad,0xa,rad->pasave); - - __pciradio_setcreg(rad,0xf,rad->pfsave); - __pciradio_setcreg(rad,8,0xff); - __pciradio_setcreg(rad,0xe,0xff); - __pciradio_setcreg(rad,9,0); - rad->pfsave = 0; - - /* Delay FSC by 0 so it's properly aligned */ - outb(/* 1 */ 0, rad->ioaddr + RAD_FSCDELAY); - - /* Setup DMA Addresses */ - outl(rad->writedma, rad->ioaddr + RAD_DMAWS); /* Write start */ - outl(rad->writedma + ZT_CHUNKSIZE * 4 - 4, rad->ioaddr + RAD_DMAWI); /* Middle (interrupt) */ - outl(rad->writedma + ZT_CHUNKSIZE * 8 - 4, rad->ioaddr + RAD_DMAWE); /* End */ - - outl(rad->readdma, rad->ioaddr + RAD_DMARS); /* Read start */ - outl(rad->readdma + ZT_CHUNKSIZE * 4 - 4, rad->ioaddr + RAD_DMARI); /* Middle (interrupt) */ - outl(rad->readdma + ZT_CHUNKSIZE * 8 - 4, rad->ioaddr + RAD_DMARE); /* End */ - - /* Clear interrupts */ - outb(0xff, rad->ioaddr + RAD_INTSTAT); - - /* Wait 1/4 of a second more */ - wait_just_a_bit(HZ/4); - - for(x = 0; x < rad->nchans; x++) - { - mx828_command_wait(rad,x, MX828_GEN_RESET, &byte1, &byte2 ); - byte1 = 0x3f; - byte2 = 0x3f; - mx828_command_wait(rad,x, MX828_AUD_CTRL, &byte1, &byte2 ); - byte1 = 0; - mx828_command_wait(rad,x, MX828_SAUDIO_SETUP, &byte1, &byte2 ); - byte1 = 0; - mx828_command_wait(rad,x, MX828_SAUDIO_CTRL, &byte1, &byte2 ); - byte1 = 0xc8; /* default COR thresh is 2 */ - mx828_command_wait(rad,x, MX828_GEN_CTRL, &byte1, &byte2); - rad->corthresh[x] = 2; - } - /* Wait 1/4 of a sec */ - wait_just_a_bit(HZ/4); - - return 0; -} - -static void pciradio_enable_interrupts(struct pciradio *rad) -{ - /* Enable interrupts (we care about all of them) */ - outb(0x3f, rad->ioaddr + RAD_MASK0); - /* No external interrupts */ - outb(0x00, rad->ioaddr + RAD_MASK1); -} - -static void pciradio_restart_dma(struct pciradio *rad) -{ - /* Reset Master and serial */ - outb(0x31, rad->ioaddr + RAD_CNTL); - outb(0x01, rad->ioaddr + RAD_OPER); -} - -static void pciradio_start_dma(struct pciradio *rad) -{ - /* Reset Master and serial */ - outb(0x3f, rad->ioaddr + RAD_CNTL); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - outb(0x31, rad->ioaddr + RAD_CNTL); - outb(0x01, rad->ioaddr + RAD_OPER); -} - -static void pciradio_stop_dma(struct pciradio *rad) -{ - outb(0x00, rad->ioaddr + RAD_OPER); -} - -static void pciradio_reset_serial(struct pciradio *rad) -{ - /* Reset serial */ - outb(0x3f, rad->ioaddr + RAD_CNTL); -} - -static void pciradio_disable_interrupts(struct pciradio *rad) -{ - outb(0x00, rad->ioaddr + RAD_MASK0); - outb(0x00, rad->ioaddr + RAD_MASK1); -} - -static int __devinit pciradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res; - struct pciradio *rad; - int x; - static int initd_ifaces=0; - - if(initd_ifaces){ - memset((void *)ifaces,0,(sizeof(struct pciradio *))*RAD_MAX_IFACES); - initd_ifaces=1; - } - for (x=0;x= RAD_MAX_IFACES) { - printk("Too many interfaces\n"); - return -EIO; - } - - if (pci_enable_device(pdev)) { - res = -EIO; - } else { - rad = kmalloc(sizeof(struct pciradio), GFP_KERNEL); - if (rad) { - int i; - - ifaces[x] = rad; - memset(rad, 0, sizeof(struct pciradio)); - spin_lock_init(&rad->lock); - rad->nchans = 4; - rad->ioaddr = pci_resource_start(pdev, 0); - rad->dev = pdev; - rad->pos = x; - for(i = 0; i < rad->nchans; i++) rad->lasttx[x] = rad->gotrx1[i] = -1; - /* Keep track of whether we need to free the region */ - if (request_region(rad->ioaddr, 0xff, "pciradio")) - rad->freeregion = 1; - - /* Allocate enough memory for two zt chunks, receive and transmit. Each sample uses - 32 bits. Allocate an extra set just for control too */ - rad->writechunk = pci_alloc_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, &rad->writedma); - if (!rad->writechunk) { - printk("pciradio: Unable to allocate DMA-able memory\n"); - if (rad->freeregion) - release_region(rad->ioaddr, 0xff); - return -ENOMEM; - } - - rad->readchunk = rad->writechunk + ZT_MAX_CHUNKSIZE * 2; /* in doublewords */ - rad->readdma = rad->writedma + ZT_MAX_CHUNKSIZE * 8; /* in bytes */ - - if (pciradio_initialize(rad)) { - printk("pciradio: Unable to intialize\n"); - /* Set Reset Low */ - x=inb(rad->ioaddr + RAD_CNTL); - outb((~0x1)&x, rad->ioaddr + RAD_CNTL); - outb(x, rad->ioaddr + RAD_CNTL); - __pciradio_setcreg(rad,8,0xff); - __pciradio_setcreg(rad,0xe,0xff); - /* Free Resources */ - free_irq(pdev->irq, rad); - if (rad->freeregion) - release_region(rad->ioaddr, 0xff); - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)rad->writechunk, rad->writedma); - kfree(rad); - return -EIO; - } - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, rad); - - if (pciradio_hardware_init(rad)) { - unsigned char x; - - /* Set Reset Low */ - x=inb(rad->ioaddr + RAD_CNTL); - outb((~0x1)&x, rad->ioaddr + RAD_CNTL); - outb(x, rad->ioaddr + RAD_CNTL); - __pciradio_setcreg(rad,8,0xff); - __pciradio_setcreg(rad,0xe,0xff); - /* Free Resources */ - free_irq(pdev->irq, rad); - if (rad->freeregion) - release_region(rad->ioaddr, 0xff); - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)rad->writechunk, rad->writedma); - pci_set_drvdata(pdev, NULL); - zt_unregister(&rad->span); - kfree(rad); - return -EIO; - - } - - if (request_irq(pdev->irq, pciradio_interrupt, ZAP_IRQ_SHARED, "pciradio", rad)) { - printk("pciradio: Unable to request IRQ %d\n", pdev->irq); - if (rad->freeregion) - release_region(rad->ioaddr, 0xff); - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)rad->writechunk, rad->writedma); - pci_set_drvdata(pdev, NULL); - kfree(rad); - return -EIO; - } - - /* Enable interrupts */ - pciradio_enable_interrupts(rad); - /* Initialize Write/Buffers to all blank data */ - memset((void *)rad->writechunk,0,ZT_MAX_CHUNKSIZE * 2 * 2 * 4); - - /* Start DMA */ - pciradio_start_dma(rad); - printk("Found a PCI Radio Card\n"); - res = 0; - } else - res = -ENOMEM; - } - return res; -} - -static void pciradio_release(struct pciradio *rad) -{ - zt_unregister(&rad->span); - if (rad->freeregion) - release_region(rad->ioaddr, 0xff); - kfree(rad); - printk("Freed a PCI RADIO card\n"); -} - -static void __devexit pciradio_remove_one(struct pci_dev *pdev) -{ - struct pciradio *rad = pci_get_drvdata(pdev); - if (rad) { - - /* Stop any DMA */ - pciradio_stop_dma(rad); - pciradio_reset_serial(rad); - - /* In case hardware is still there */ - pciradio_disable_interrupts(rad); - - /* Immediately free resources */ - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)rad->writechunk, rad->writedma); - free_irq(pdev->irq, rad); - - /* Reset PCI chip and registers */ - outb(0x3e, rad->ioaddr + RAD_CNTL); - - /* Clear Reset Line */ - outb(0x3f, rad->ioaddr + RAD_CNTL); - - __pciradio_setcreg(rad,8,0xff); - __pciradio_setcreg(rad,0xe,0xff); - - /* Release span, possibly delayed */ - if (!rad->usecount) - pciradio_release(rad); - else - rad->dead = 1; - } -} - -static struct pci_device_id pciradio_pci_tbl[] = { - { 0xe159, 0x0001, 0xe16b, PCI_ANY_ID, 0, 0, (unsigned long)"PCIRADIO" }, - { 0 } -}; - -MODULE_DEVICE_TABLE(pci, pciradio_pci_tbl); - -static struct pci_driver pciradio_driver = { - name: "pciradio", - probe: pciradio_init_one, -#ifdef LINUX26 - remove: __devexit_p(pciradio_remove_one), -#else - remove: pciradio_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: pciradio_pci_tbl, -}; - -static int __init pciradio_init(void) -{ - int res; - - res = zap_pci_module(&pciradio_driver); - if (res) - return -ENODEV; - return 0; -} - -static void __exit pciradio_cleanup(void) -{ - pci_unregister_driver(&pciradio_driver); -} - -#ifdef LINUX26 -module_param(debug, int, 0600); -#else -MODULE_PARM(debug, "i"); -#endif - -MODULE_DESCRIPTION("Zapata Telephony PCI Radio Card Zaptel Driver"); -MODULE_AUTHOR("Jim Dixon "); - -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(pciradio_init); -module_exit(pciradio_cleanup); diff --git a/zaptel/kernel/pciradio.rbt b/zaptel/kernel/pciradio.rbt deleted file mode 100644 index 3cd25178..00000000 --- a/zaptel/kernel/pciradio.rbt +++ /dev/null @@ -1,10531 +0,0 @@ -Xilinx ASCII Bitstream -Created by Bitstream E.33 -Design name: pciradio_xilinx.ncd -Architecture: spartan2 -Part: 2s30vq100 -Date: Sat Mar 12 18:19:05 2005 -Bits: 336768 -11111111111111111111111111111111 -10101010100110010101010101100110 -00110000000000001000000000000001 -00000000000000000000000000000111 -00110000000000010110000000000001 -00000000000000000000000000001000 -00110000000000010010000000000001 -00000000100000000011111100101101 -00110000000000001100000000000001 -00000000000000000000000000000000 -00110000000000001000000000000001 -00000000000000000000000000001001 -00110000000000000010000000000001 -00000000000000000000000000000000 -00110000000000001000000000000001 -00000000000000000000000000000001 -00110000000000000100000000000000 -01010000000000000010010001100011 -00000000000100100010000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000001000000000010010000000 -00000000000000000000000000000000 -00000000000100100010000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010010000000 -00000000000000000000000000000000 -00010000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000000000000000000000000000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000000000000000000000000000 -00000000000100100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010010000000 -00000000000000000000000000000000 -00010000000100100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000001000000000010010000000 -00000000000000000000000000000000 -00010000000100100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000000000 -00000000000000000000000000000000 -11101111000100100000000000001110 -00000000000000111000000000000001 -11100000000000000111100000000000 -00011110000000000000011110000000 -00000001111000000000000001111000 -00000000000111100000000000000101 -00000000000000010100000000000000 -01010000000111111100010000000000 -00000000000000000000000000000000 -11000000000001011111101000000001 -11101111001110000011011111110000 -00001100111100000101001100111100 -00000000111111011000000000110111 -11000100000011001101000000000011 -00110000010000001100111000000000 -00110011100000000000110101000000 -00000011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110101000000000 -11101111010000000010001011000000 -01011101111101000000001000111101 -00010000101110011000001000100011 -11010000100010101000000000000010 -00001000000000001000100010000000 -00100010100101000000100010101000 -00000011001000000000010000110000 -00000000000000000000000000000000 -10001000000001011100010000010001 -10100011001000000010011011001000 -00001000001101000000101000001101 -00000000101110010000000000100100 -11011000000010001001000000000010 -00001000000000001000000100000000 -00100010100000000001100100010000 -01000010011000100000000101110000 -00000000000000000000000000000000 -11000000000101011010000000000000 -10101011000000000010001011000100 -00011001101100000000001000101100 -00000000101110011000000000100010 -11000000000010101001000000000010 -00101000001000001000100000001000 -00100010101100000010100010110000 -10000010001100000000010001100000 -00000000000000000000000000000000 -00000000000101011110101110010000 -11101011000000100011010011101000 -00001100101100000000001100101100 -00000000111100110000000000110110 -11000000010011000001100000001011 -00100111000000001100101001000000 -00110010001000000000110110000100 -00000011010000000000010001110000 -00000000000000000000000000000000 -11100000000000011011101100000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111110 -11000000000011111100000100000011 -11111000100000001111101000100000 -00111110110000000010111101000000 -00001011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010010100000000 -11110011000001010011111011010001 -00001101001100100000001111101100 -00000000110010010001010000110110 -11000000000011001001000100000011 -00101101000000001110000101100000 -00111010000100000000110110101100 -00000011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010000000000100 -10111111000000000010111011000000 -00001000111101000000001011111101 -01000010100010011000010100101111 -11000001000010001001000000001010 -10101000000000001000101001000000 -00100000110101000000100010100000 -00000010101100100000000001000000 -00000000000000000000000000000000 -11100000000001010100100000000000 -10110011000000000010110011000000 -01001000001111010001001001001100 -00000000100000010100100000101110 -11000000100010000011110010000010 -00101000000000001010001001000001 -00101000100000000000100000000000 -00000010101110000000000001010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010111110100000 -00101000011110000000001011001110 -00000000100001011000000000101101 -11100000010010000010100100000010 -10011110000010001000010110000010 -00100001111000000000100001101000 -00000010100110000000000001000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001100001100000000001101001100 -11000000110000110000000000110100 -11000000000011000011000000000011 -00001000000100001110001100000000 -10111000100000000010110000010000 -00000011000100100000001000000000 -00000000000000000000000000000000 -01000000010011011011110000000000 -11111111000000000011110111000000 -01001110111101010000001111111100 -01000000111111110000000000110111 -11000010000011111111000000000011 -11111100010000001111110100010000 -00111111110000000000111011110001 -00000011010100000000011001100000 -00000000000000000000000000000000 -10101000000101011110100100000000 -11111011001000000011110011000000 -00011100101101000000101100101100 -10000001111110110010100000111110 -11000000001011001001000000001011 -00101100000000001100101000000001 -00110010100000000000000010010000 -00000011111010100000000001010000 -00000000000000000000000000000000 -01001000000110011001110100100000 -10110111010010010010110101000000 -00101100001101100000001000011100 -00100101101101110100000000101111 -11001100000010000100000000000010 -00001100000010001000001100000000 -10100001100000000000100000010000 -00000010100100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111010000000 -10110111101000000010111111100000 -00001000011110100001001000011110 -01001000100101111010001000100101 -11101000000010000101100001100010 -00011110000000001000011110000000 -00100001101000000000101001111000 -00000010001100000000000000100000 -00000000000000000000000000000000 -01001000000001001100110000010000 -10110011000000000010111011110000 -00001000001100000000001000001100 -00000000101100110000000000101110 -11000000000010000001100000100010 -00001101001000001000001110010000 -00100010101001000010101000110010 -00000010100100100000010000110000 -00000000000000000000000000000000 -11101000000101011110100000000000 -11111010000000000011111110000000 -00011100101000000000011100101000 -00000000101110100000001000111110 -10000000000011001110101000000011 -00111000000000101100111000000001 -10110011100000000000111011100010 -00101011101110100000010001100000 -00000000000000000000000000000000 -01001000000000011010000000000000 -11111000000000010011111000001100 -01011110100000000000011111000000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11000000000000001111100000000000 -00111110001000000000010110000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001010010000000000 -11110001000000000001001001000000 -00000100100100000010001100100101 -00011000110010010010000000111110 -01000000000011001001000000000010 -00100100000000000100100100000000 -00110010010100000000110000010000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110111001000000 -10111001000000000010001001000000 -00001000100100000000001010100101 -00000010100010111100000100101110 -01000001010010000001110110001010 -00100100000001001000000101100000 -10101010011100000000100010010000 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000100000 -10111001000000000010101001000000 -00101000000100000000001000100101 -00000000100010010000011000101110 -01000001100010001001000000000010 -10100100000000001000100100000000 -00100010010000000010100010011000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000101001000010000000001 -10110001001010001010100001000000 -00001000000100101000001010000100 -10101000000000110000000000101100 -01001010000010001001001000000010 -10000100100000101000000100100000 -00101000110010000000100000010010 -00011000000000100000000100000000 -00000000000000000000000000000000 -10111000000011011110000000000000 -11111000001000000011101000000000 -00001100100001110000001100100001 -11000000010010000000000000011110 -00001000000011000000010100010011 -10100000000000001100100000000001 -00110000000101000000110010000000 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000101011110010000000000 -11111001001010000011011101001011 -00101111100100000000001111100100 -00000000111110010000000000111110 -01001010001011111101000100000011 -01110100111000001011110100010000 -00011111010001000000111111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000101011110010000000001 -11111001001010000011111001000100 -00001110110100000000001100110100 -11100000110010110000000000111110 -01010000000011111001010000000011 -00100100000000001100100100000001 -00110011010100000000100011010000 -10000001001001100000000001110000 -00000000000000000000000000000000 -00111000000110000110000000000101 -10110000001000000010111000001000 -00001000100001001001001000100001 -00000010110010000000000000101110 -00101000000010111000000000000010 -10100000101010001000101000000000 -00110110000000000000100010000100 -00000010000011100000010000110000 -00000000000000000000000000000000 -00001000000001010100110000001000 -10110001001011000010111001001000 -00001010000100110000101000000100 -10010010100000010000000000101100 -01010001000010111001010000000010 -00000101000000001000000101000000 -00100000010100000011101000010000 -00000110000000100000000101110000 -00000000000000000000000000000000 -00011000010001011010010010000000 -10111001000000000000111001000000 -00000000100100000000001000100100 -00010000100010010000000000101110 -01000000000010111001010000000010 -10100100100000001000100100000000 -00100100010000000100101010010100 -00000010000001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010100100000 -10111001000000010011110001111000 -01000010100100000011001100100100 -00000000110010010000010000111110 -01000000000011110001000000000011 -00100100000000101100000101000000 -00110010010000000000111010011000 -00001010001010000000010001110000 -00000000000000000000000000000000 -00101000000000001010011000100000 -11111001000001000011111001100100 -00001111000100001000011111000100 -00000000111110011100000000111110 -01000000000011111011000000000011 -11000100000010001111101100010010 -00111110010000000000110110010010 -00000011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000100000000 -11111000000001010011101000010000 -00001111100000000000001111100000 -00000000111110000000000000110110 -00000000000011111000000000000011 -11100000000000001111100011000000 -10110010000000000000110010000000 -01000011110010100000010000100000 -00000000000000000000000000000000 -00101000000001000010100100001000 -10111010000000000010001010000000 -00001011111001000001001011111000 -00100000100110100101000000101110 -10000001000010111010100000000010 -11101000000000001011101000000000 -00100011101000000000100001100000 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110100000001 -10110011000000001010000011000000 -00001011001111000000001011001100 -00000000101100110000000000100100 -11000000010010110010000001000010 -11001100000000001011001100000100 -00100000111000000010000100010001 -00000010100010100000000001010000 -00000000000000000000000000000000 -00100000000100010001110000000000 -10110111101000100010000111000000 -10001011011100001000001011011000 -00000000100101110000000000101101 -11000000000010110110010000000010 -11011100110000001011001100000000 -00100000110000100000100101010000 -00000010001010000000000001000000 -00000000000000000000000000000000 -00101000000010000001001001000000 -11110111100000010011000111100000 -00011111011110000000001111011110 -00000000111101001000100000110101 -11100000100011110111100000000011 -11011110101000001111011110010010 -00110001011000000000110100011000 -00000011101010100000001000000000 -00000000000000000000000000000000 -00001000000101011010000110010000 -11111011011010000011011011011010 -00011111101100000001001111101000 -00000001110110100110000000111110 -11000000000011111010010000000011 -11101100100000001111101101000000 -00111110000000000110111010010000 -00000011100000100000011001100000 -00000000000000000000000000000000 -01000000010011011111111000000000 -11001111100010000011011111100110 -00000100110110000000000100111110 -01000000110111111000000000111111 -11100000000011001110110000000011 -00111110000000001100111110000000 -00110011111000000000110011011000 -00000011000100000000000001110000 -00000000000000000000000000000000 -10101000000000011001110001000000 -11011111000000000010000111000000 -01001101010100010000001000111000 -00000000110101100000000001101101 -11000000000010000110010000000010 -00011100000010001010011100000000 -00111111110000000000100001010010 -00000010001010100000010001100000 -00000000000000000000000000000000 -00000000000000001011010000000000 -10000111000000000010010111000001 -00001001010100000000001000011100 -00001000100001010000000000101000 -11000000000010000111000000000010 -00011100000000001001011100000000 -00100001110000100000100001010000 -00000010000001100000000000100000 -00000000000000000000000000000000 -01100000000101001100010000000000 -10010011000000000010010011010100 -00001000100100000000101010001000 -00000000100100100000001000101100 -11000000000010000000010000000010 -00001110100000000011001100100000 -00101100101000000010100000011000 -00000010000110000000010000110000 -00000000000000000000000000000000 -10101000000101011010110100000000 -10001111000001000011011111010000 -00001001101000000000001100100100 -00000001110010110000000000111111 -11000000001011001000000100001011 -00111100100010101101101100100000 -00110010111000000010110010011010 -00000010001011100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000100000 -11111011000000000011101011001000 -00101111101000000000001101100000 -00000000111110010000000000111110 -11000000000011111100010001000011 -11001100000000001110101100000000 -00111110110010000000111110010000 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111101000000000 -11111111000000000011111111000000 -00001100101000000000001100111110 -01000000110011001000000001111111 -11000000000011111100001000000011 -00101100000000101100111100000000 -00110011010000000000110001011000 -00000011101000000000010000110000 -00000000000000000000000000000000 -10000001010001000110101000011000 -10111011000001000010110011000000 -00001000101011011000001010101111 -10001000101010001000000000101110 -11000000000010010000110000000010 -00101100000000001000001100000000 -00100010000000000010100010011000 -00100011011000000100000000010000 -00000000000000000000000000000000 -10000000000001010010010010000000 -10111011000000000110111011000000 -00001000101000000000001000000100 -00000000100010110001000000101110 -11000000000010111000000000000010 -00101100000010001000101100000000 -00100000110000000000100010010010 -00000010101000000000000001000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110011000000000110011011000000 -00011010000100000000001010000000 -00000100101000000000000000101100 -11000000000010011000000000001010 -00001100000000011000001110000000 -00100000110000000000100000110000 -00000010010000100000000100000000 -00000000000000000000000000000000 -00000000000001010110010000000000 -11111111000000010011110111000000 -00101100101000000000001100100100 -00000000110010010000010000101110 -11000000000011110000000000000011 -00111100000000001100101100000000 -00110010110000000000110010010000 -00000011101000000000001101010000 -00000000000000000000000000000000 -10100000000101011101010000000000 -10111111000001000011111111000000 -01001101110100000000001111110100 -00000000111111000000000000111111 -11000000000011011100000000000011 -11111100000000001111011000000000 -00111111100000000000111101010000 -00000011101010000000011001110000 -00000000000000000000000000000000 -11000000000001011111010000000100 -10101111001100000011001111010000 -10001101110101000000001111111100 -01000000110011110001000000111111 -01100000000011111111000000000011 -00110110000000001111010010000000 -10110011001000000000111011011001 -00000011111100000000000001110000 -00000000000000000000000000000000 -10000000000100001110011000000000 -10001111000100000010001111010000 -00001000101100000000001011011100 -10000000100011110001010000101110 -01100000000010111111010011000010 -00100110000100001011100010000000 -00100000000010001000111000010000 -00000010111000000000010000110000 -00000000000000000000000000000000 -10001000000001011100010000000000 -10100011001000000010000011001101 -00011001000000100000001011001100 -11000000100000110010000100101100 -11000000000110110011001100000010 -10000100000000001011100000000000 -01100000000000100000101000000010 -00000010111000100000000101110000 -00000000000000000000000000000000 -11000000000101011010010000000011 -10100011000000000010001011000000 -00011000101000001000001011101100 -00000000100010110000000000101110 -11000100000010111011000000000010 -10100110000000001011100000000000 -01100010000001000000101010000001 -00000010111100000000010001100000 -00000000000000000000000000000000 -01000000000101011110011000000000 -11101011000001000011001011000000 -00001101100101000001001111101100 -00000000110010110000000000111110 -01100000000011111011000000001011 -10100100000000001111000001100001 -00110010001010000000111010011000 -00000011110100000000010001110000 -00000000000000000000000000000000 -11100000000000011011011001000100 -11011111000000000011111111000000 -00001111111101000100001111111100 -00000000111111110000000000111111 -01000000000011110111000000000011 -01110100000000001111110000000000 -00111111001000000000111111011000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010011000001000 -11011011000000000011001011000000 -00001100100101000000001111001100 -00000000110010110000000000111110 -11000100000011111011000000000011 -11101100000001001111100001000100 -00110010001000000010110010000000 -00001011000100000000010000100000 -00000000000000000000000000000000 -11001000010001010000010000010000 -10001111000000000010001111000000 -10001010101100000010001011111100 -00000000100011110000000000101110 -11100001000010111111000000000010 -11101101000001001011100000000000 -00100010001100000100100010001000 -00000010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100010000000000 -10010011000000000010001011000000 -00001000001000000000001011001100 -00000000100000110000000000101100 -01101000000010110011000000000010 -11001100001000001011000100000000 -00100100110000100100100000111000 -01000010011110000000000001010000 -00000000000000000000000000000000 -00100000000000010001011000000000 -10010011100000000010000011100100 -00001010011010000010001011011110 -00001000100001111000000001101101 -11100001010010110111100000000010 -11011110000000001011110111000000 -10100101111000000000100001111000 -00000010010010000000000001000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11010011000000000011000011000000 -00001100000000000100001111001100 -00000000110000110000000000111100 -01000000000001110011000000000011 -11001100000000001111000100000000 -00110100110000000000110000100000 -10000011010100100000001000000000 -00000000000000000000000000000000 -01000000000111011001110001000000 -11101111010000100011111111010001 -10001110111000010000001111111100 -00000000111111110000100000111111 -11010000100011111111000000100011 -11111101000010001111110100000000 -00111011110000000000111111101000 -00000011100100000000011001100000 -00000000000000000000000000000000 -10101000000001011110111000000000 -11001011111000000011001011000100 -00001100101100000000001100101101 -10001000111110110110000000111110 -01010100000011111011110101000111 -00100101000000001111100100000000 -00110010110000000000111110110000 -00000011111010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10001111011000101010001111000000 -10001000111100000000001000011101 -00100000101101110001000100101101 -11001000000010110111001010010110 -00010100100000001011010100000001 -00100001110000000000101101110000 -00000010110100100000010001100000 -00000000000000000000000000000000 -11000000010000001000111000010000 -10000111100000000010000111101001 -00001000010110000100001000011110 -10000000101101111010000000101101 -01100000000010110111100001001010 -00011110010000001011010110000101 -10100001111000010000101101101000 -00000010111100000000000000100000 -00000000000000000000000000000000 -01001000000101000100110000000000 -10000011000000000010000011000000 -00111000001100000000001000001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -00001110000000001011000100000000 -00100000110000000000101110100000 -00000010110100100000010000110000 -00000000000000000000000000000000 -11101000000101011010101010000010 -11001010000000000011001010000000 -00001100111001000000101100101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -00101000000000001111001000000000 -00110010100000000100111110100000 -00000011111110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000100011111000000000 -00001111100000100000001111100000 -00000000111110000000000100111110 -00000000010011111000000001000011 -11100001010000001111100001000000 -00111110000000000000111111000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110011100000000 -11111001000000000011111001000000 -00000000100100000000101100100100 -00000000111100010000000000111010 -01000000000011111001000000000011 -11100110000000001111100110000000 -00110010010000000000111110011000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000001010010111001000000 -00001000100100000000001000100100 -00000000101110010000000000100010 -11000000000010111001000000000010 -11101100000000001011100100011000 -00100010010100001000101110011100 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010110001000000 -00001010000100000000001000100100 -00000000101110010000000000100010 -01000000000010111001000000000010 -11100100010000001011100100000000 -10100011010000000100101111010010 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010010100000 -10110001001010100010110001001011 -00101010000100100000101000000100 -10100000101100010010100000100000 -01100000000010110001001010000010 -11000100000000001001100100000000 -00100001011000000000101101011000 -00001010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000010000000 -11111000001000000011111000001000 -00001110100000000010001100100000 -10000000111110000010000000111010 -00000000100011110000001000000011 -11101000000000001111100000000000 -00110010000101000000111111000101 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011111010000010000 -11111001001010000011111001001010 -00001101110100111000001111100100 -10100000111110010010100010111110 -01000000000011111001001010000011 -11100100000000001111010100000000 -00111110010000000000111110010000 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000010011011111011000010000 -11111001010010000011001001000100 -00001101100100010100001100100100 -00100000110010010100100000110010 -01000000000011111001010010000011 -00100100000000001100010100000000 -00110011010000000000110011010100 -00000011110001100000000001110000 -00000000000000000000000000000000 -00111000000000001110000100000000 -10111000011000000010000000001000 -00001000100000100000101000100001 -10000000100010000110010000100010 -00000000000010111000010001000010 -00100000000000001000100000000000 -00100010000010000000110110000000 -00000010110011100000010000110000 -00000000000000000000000000000000 -00001000000001010100010100000000 -10110001000000000010000001010000 -00011011000101000000001000000100 -00100000100000010010000000100000 -01000000000010110001001000001010 -00101100000001001000000100000000 -01100000110000100000100100010000 -00000010110000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000001000 -10111001000000000010000001000000 -10000010100101100000001000100100 -00000000100010010000010010100010 -11001000010010111001000000000010 -00100100100000001000100100000000 -00100010010000000000100010010000 -00000010110001100000010001100000 -00000000000000000000000000000000 -10100000000101011110011000000000 -11111001000000000011001001000000 -00001111100100000000001100100100 -00000000110010010000000000110010 -01000000000011111001000000000011 -00000100000000101100100100000000 -00110010010000000010100110010010 -00000011111010000000010001110000 -00000000000000000000000000000000 -00101000000000011010011100000000 -11110001000000011011111001000000 -00001101000100000000001111000100 -00000010111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -10111110010000001000111110010000 -00000011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000001000 -11101000000000000011111000000000 -00001101100001000000001100100000 -00001100110010000000000000111110 -00000000000011110000000000000011 -00100000001000001111100010000000 -00110010001000000000110010000010 -00000011110010100000010000100000 -00000000000000000000000000000000 -00101000010001010010101000100000 -10001010000000100010111010000000 -00000000101000000000101000101000 -00000000100010100000010000101110 -10000000000010111010000000010010 -00101000000010001011011010001000 -00100011100000000110100011100100 -00000010110010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10100011000000000010110011000000 -01000010001100000100001000001100 -00000010100010110000000000101100 -11000100000010110011000000000010 -00001100000000001011001000000000 -00100110110000000100100000110000 -00000010110010100000000001010000 -00000000000000000000000000000000 -10100000000000010000111000000000 -10000111000000000010110111000000 -00001010011100100000001000011100 -10000000100001110010010000101101 -01000000000010110111001000000010 -00011100000010001011111100000000 -10100101110000000000100001110000 -00000010111010000000000001000000 -00000000000000000000000000000000 -10101000000000000001111000000000 -11100111101100100011110111101010 -00101110001110110001001100111110 -10000000110001111000000000111101 -10100000010011111111101100000011 -00011110000000001111011010000000 -00110111111000000000110001111000 -00000011111010100000001000000000 -00000000000000000000000000000000 -00001000000101011010110000000000 -11111011011000000011111011110000 -00001100101100110000001111101101 -11010000111110110011110100111110 -01011000000011111011010000011011 -11101001001000001111101100000000 -00111010110000000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000011011111111000000000 -11101111100110000011111111100010 -00101100111110000000001111111111 -00010000111111111000000000110111 -11110100000011001111100010000011 -11111010010000001111111110000000 -00111111111000000000111111111000 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000000011001110001000000 -11100111000100000010111111000000 -00001000011100000000001011011100 -01000000101101110001000000100001 -11000100001010000111000000000010 -11011000000000001011011100010000 -00101101110000000000101101110000 -00000010001010100000010001100000 -00000000000000000000000000000000 -00000000000000000001110000000000 -10100111000000000110110111100000 -00001000011100000000001011011100 -00000000101101110000000000100011 -10000010000010010111000000000010 -11010100000000001011011100000000 -00101101110000000000101101110000 -00000010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100110000000001 -10100011000000100010110011000000 -00011000101110010000001011001100 -00000000101100110000000000100000 -11100000000110010011000000000010 -11000000000000001011001100000000 -00101100100000000000101110110100 -00000010000010000000010000110000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11101111000000000011111111000000 -00001100111100000000001111111100 -00001000111111110000000000110110 -11100000000011011111000000000011 -11100100000000001111000100000000 -00101110110000000000111110110000 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000100011111011000000 -00001111101100000000001111101100 -00000000111100110000000000111110 -00010000000011101011000000000011 -11100100000000001111100101000000 -00111110110000000000111110111100 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001101011100001000 -11001111000000000011110111000000 -00000100111100000010011100111100 -00000000111111110000000000110011 -10000000000011111111000000000011 -11111110000000001111110010000000 -00111011110000000000110011111000 -10000011000000000100010000110000 -00000000000000000000000000000000 -10000001010000000110111000000010 -10001011000000000010111011000000 -00001010101100000000001101101100 -00000000101110110000010000100010 -00010000000010111011000000000010 -11101010000001001011100111000000 -00111010111001010000100010010010 -00000010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10001011000000000010111011000000 -00001010101100000000001000101100 -00000000101110110000000000100010 -01100000000110111011000000000010 -11100000100000001011101100101000 -00101000110000000000100010110010 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10000011000000000010110011000000 -00001010001100000100101000001100 -00000100101100110000000100100000 -00000000000010010011000000000010 -11000000000000001011001100000000 -00100000010000010000100000110000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000001010110110000000000 -11001111000000000011111111000000 -00001110111100000000001000111100 -00000000111101110000000000110010 -00000000100011111111000000000011 -11100100000000001111100100000000 -01111010110000010000110000100000 -00000011000000000000001101010000 -00000000000000000000000000000000 -10100000000101011111110000000000 -11111111000000000011111111000001 -01001111111100000000001111111100 -00000000111111110000000000111101 -00000000000011111111000000000011 -11110000000000001111110100000000 -00111011000000000000111111000000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111110001000000 -11001110100000000011011111100000 -10001100111100100000001101111100 -00000000111111110010000000111111 -11000000000011001111000010000011 -00110000000000001100110110000000 -00110011000000000000111111000000 -00001011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001111110100000000 -10001010100000000010001011001010 -00001000101111000000001000111110 -00000000101111110001000100101111 -11000110000011011111011001000010 -00100000000000001000100000000000 -00100010101000010000101110001100 -00000010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011100110001000000 -10101001000000000010011011000000 -00101000001100010000001001001100 -00000000101100110000000000101100 -11000000000010000011000010001010 -00000100000000001000000000000000 -00100000010000000000101100100100 -00000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10101001001000000010001011000000 -00011000101100000100001000101100 -00000000101110110000000000101110 -11000000000010010011000000000010 -00101000000100001000000010000000 -00100010110000000000101110100000 -00000010001100000000010001100000 -00000000000000000000000000000000 -01000000000100011110110000000000 -11101001100000000011010011000110 -00001100001100000100001101101100 -00000000111110110000000000111110 -11000000000011001011000000000011 -00100101000000101100101011000000 -00110010110000000000111110010000 -00000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11011101000001000011111111000001 -10001111101100000000001111101100 -00010000111110110000000000111111 -11000000000011111111000000000011 -11110000000000101111111000000000 -00111111110000000000111111010010 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001000110000000000 -11101001000100000111101011000000 -00001101101100000000001101101100 -01100010110010110000000000110010 -11000000000011001011000000000011 -11001101100000101100101001000000 -10110010110000000000111101111010 -00000011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10000001010100000110001011000000 -00001000111101110100001101111110 -00000000100011110000000000100011 -11000000001010001111000000000011 -10101011100000001000101000000000 -10110010110101000000101110110100 -00000010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10100010100000000010100011000000 -00001001001110000000001000001101 -00000000100000110000000000100010 -11000000000010000011000000000010 -01000001000000001000000010000000 -00100100000000000000101100000000 -00100010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010001111000001001 -10000110100000000010001111100000 -01001001011110000000001001011110 -00000001100001111000000001100001 -11100100000110000111100100000010 -10000010000000001000010011100000 -00100001101000000000101100001000 -00000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000010110000000000 -11100001000000100010100011000000 -00001101001100000000001000001100 -00000000110000110000000010110010 -11000000000011000011000000000011 -11000101000000001100100001001000 -00110100010000000000111100100000 -00001011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011111000100000 -11110101000000000011110111000000 -00001110111100001000001111111100 -00000000111111110000000000111111 -11000000000011111111000011000011 -11111100000000001111110000100000 -00111111110000000000111111100000 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110111000000000 -11000011100000000011011010000000 -00101100101100000000001111101100 -10000000111110110100000000110010 -11001010000011001011101000001011 -00100100000000001100100000000000 -00110010110000000010110010010100 -10000011111010100000000001110000 -00000000000000000000000000000000 -01001000000100011011110010001000 -10000111000000001010001111000000 -00001000011100100001001011011100 -11000000101100110000100000110101 -11000000000010000111001010000010 -00010100010000101000011000000000 -00100001110000000000100001110000 -00000010110100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111000001001 -10000101100000000010000111100000 -00001000011110000000001011011110 -11000000101101111001000000100001 -11100100000010010011101000000010 -00011110000000001000011010000000 -00100000111000000000101001011000 -00000010111100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10000001111000000010000001110000 -00011000001100000000001011001100 -00001000101100110000000000100100 -11000000001010010011000000000010 -00001100000000001000001011100000 -10100000110100000000101000110101 -00000010110100100000010000110000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11001110110000000011001110000000 -00001100101000000000001111001000 -00000000111110100000000000110010 -10000000000011011010000000000011 -00101001000000001100111011001000 -00110011101000000000111000101000 -00000011111110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000010 -11111000000100000011101000001100 -00001111100000000000001111100001 -00000000111110000000001000111100 -00000000000011101000000000000011 -11100000100000001111100001000000 -00111110000011000000010110000000 -10010011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000100000011111001000000 -00101100000100000000001100100110 -00000000110010010000000000110010 -01000000000011001001000000000011 -11101111000000001110100100000100 -00110000010000000000110010110000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000111010000000000 -10111001010000000010111001000000 -00001000100100000000101000100101 -00000000110110010000000000101010 -01000000010010101001000000000010 -11000101000010001000000100100100 -00110110010000000110100010010000 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000000010010010000000000 -10111001000010000010110001000000 -00001000100100001000001000100100 -01000000100000010000000000100010 -01000000010010001001000001000010 -11100101000000001010100110000000 -00100010010000000010100010010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010010000000 -10110001000000000110110001000000 -01001000000100100000001000000100 -10000100100100010010100000101000 -01001010000110100001001011000010 -11000100100000001000100100000000 -00100100010010000000100000010010 -00010010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000101000000 -11111000000000000011111000010100 -00001100100000000000001000101000 -00000000110010000111000100110000 -00001001000011001000001000010011 -11100001010000001110000001010000 -00110010000000000000110010000000 -00001011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011110010100000000 -11111101000000000011111101000000 -00001111100100010000001111100100 -01000000111110010000000000111110 -01001010000011111001001010000011 -11000100010000001111111100000000 -00111111010001000000111110010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010100100000 -11110101000000000011101001010000 -00001100110100101000001111110100 -00100000111110010000000000110010 -01000010000011001001000000000011 -00001101001000001100010100000000 -00110010010000100000110010010000 -10000011110001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000110000000 -10111000000000000010001000000001 -00101000100001000000001110100001 -00000000101110000101000000100010 -00111010000011011000000000001010 -00100001000000101000100000100000 -00100010000100010010100011000100 -00000010110011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010101001001000 -00001000000100000000001011000100 -00000000101100010010100010100000 -01000000000010000001011010100110 -00000100000001001000000100001000 -01100001011000000000100001010000 -00000010110000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111011000000000010001001000010 -00001000100100000100001011100100 -00000000101110010000000000100000 -01000000000110011001000000000110 -00000101000000001000000100000101 -00100010010000000010100011010000 -00000010110001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000001000 -11110001010010000011100001110000 -00001100100100000000001111100100 -00000000111110010000000000110010 -01000000000011001001000000000011 -00100110000000001100100110000000 -00110010010100000000110010010000 -00000011111010000000010001110000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001110010000011111001101000 -01001111100100000000001110100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11101100100000101111100111000000 -10111110010000000000111110011010 -10000011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000010000 -11111000010000100011001000010000 -00001101100000000000011111100000 -01010000110010000000010000111110 -00000001010011001000000000010011 -11100001000000001110100010000000 -00110000000000000000110011000000 -01000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111110010000000010001010000001 -00001000111011000100001011111001 -00000000100010100000000000101110 -10000000001010001010000000010010 -11101000000000001000111010100000 -00111010100000010000100010100000 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000100000010000011000000 -00001001000111011001001011001101 -00101000101010110000000001101100 -11000000000010011011000000100010 -11001101100000001010001110000000 -00100100111000000000100000100000 -00000010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001110011000000 -10111111000000000010001111001000 -01101000010100000100001011011110 -00000000101001110010000000101101 -11000100101110010111000000000010 -11010000000000001000111100000000 -00101001100100000000100001101000 -00000010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000001111010000000 -11110111100000001011000111110000 -00001101010010000000001011001110 -00000010111001111110000000111111 -11101000000011010111110010100001 -11011010000000001110011110000000 -00110100111000000010110000101000 -00001011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000100011110011000010 -00001111100000000000001111101100 -00000000110110110100001000111110 -11010000010011101011011000000011 -11101000001000001111101100000000 -00111110100000000000111110100000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011001111100000 -00001100110110000000001111111110 -00000100111111111100000000111111 -11110000000011101111100100011011 -00111110000000001100110010100000 -00110011011000000000110011111000 -00000011110000000000000001110000 -00000000000000000000000000000000 -10101000000100011001110001000000 -11110111001000000011010111001000 -00001000010100010000001111011100 -00000000111101110000000000111101 -11001000000010000111000000000010 -00010000001000101000011100100000 -00100001000000000000100001110000 -00000010111010100000010001100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000001000010000111000000 -00001000010100000000001011011100 -01000000101101110000000000101101 -11000000010010000011000000000110 -00011100010000001000011100110100 -00100001010000000000101001111000 -10000010110000000000000000100000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10100011000000000010011011010100 -00000000000100000000001010001000 -00000000101000110000000000101000 -11000000001110000011000000000010 -00001011001000001000101110000000 -00100000000000000000101000111000 -00000010110010000000010000110000 -00000000000000000000000000000000 -10101000000101011011110000000000 -10111010000000000011001111010000 -00101100001100000000001011100100 -00000000101111110000000000101111 -11000000000010001111000000000011 -00101111000000101000101101100000 -00110010111000000100111010001000 -00000011111010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000010000 -11111011000000000011111011001000 -00001111100001000001001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11100100000001001111101100100000 -00111100101000000100100110000000 -00000001111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111100000000011001111000000 -00001100111010100000101100011100 -00000000110011110000000000111101 -11000000000011001111000000000011 -11111000000000101100111100000101 -00010010110000000100110011000000 -00000011110000000100010000110000 -00000000000000000000000000000000 -10000001000001000110110000010000 -10110011000000000010001011000000 -00101000100000100000001000101111 -00000000100010110000000100101110 -11000000000010001011000000010010 -11101001001000001000101100000000 -00100010100000000110100010001001 -00000010111000000100000000010000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000100000010001011000000 -10001000101100000000001000101111 -00000000100010110000000000101110 -11000000000010001011000000000010 -11001100000000001000100010000000 -00101010010000000000100010010000 -00000010111000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010000011000001 -00001000001000000000001000001100 -00000000100000110000000000101100 -11000000000010000011000000000010 -11000100000000001000000110000000 -00101000000000000000100000010000 -00000010110000100000000100000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111001000000000011000111000000 -00001100101100000000001100101100 -00000010110011110000000000111101 -11000000000111001111000000000011 -11001100000011011100001000000100 -00111010010000000000110010010000 -00000011110000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11110111000000001011111111000000 -00001111111000000000001111111100 -00000100111111110000000100111111 -11000000000011111111000000000011 -11111100000000011111111100000000 -00110111000000000000111111010000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11101101100000000011111100000100 -00001110111100000000001101110110 -00000100111111110110000000110011 -11001100100011001110000100100011 -10110000010100001100110000000000 -10110011000001000100110011010001 -01000011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001100110000000000 -10001001100001000010110011001000 -00001100101111000000001000100110 -00010000101111110001000000100011 -11001100000010000010000000000111 -10100000100000001000100000000000 -00110010100010000000100010010010 -00000010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011110111000000010 -10100011000000000010110011001001 -00001010001100010000001000000100 -00000000101100110010000000100000 -11000000000010010011001000100010 -10000000100000001000000000000000 -00100100000010010000100000010010 -00000010011000100000000101110000 -00000000000000000000000000000000 -11000000000101011010111000000000 -10101011000000000010111000100000 -00001001101000000000000000100100 -00000000101110110000000000000000 -11000000000010011011000000000010 -10100000000000001000100000000000 -00100010100000000000100010010000 -00000010011100000000010001100000 -00000000000000000000000000000000 -01000000000101011100110000000000 -11101001000000000011111001100000 -00001110100101000000101101101110 -00000000111110110000000010110010 -11000000000011011010000000000011 -10100011000000001100100100010000 -10110110010000000010110010100000 -00001011010100000000010001110000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11011111000010000011110111000000 -00001110111101000100001111111110 -10000000111101110000000100111111 -11000000001011101110000000000011 -11010010010001101111100110000000 -10111111110000000000111101100000 -00000011101110000000000001100000 -00000000000000000000000000000000 -01000000000100001010111000000000 -11101001000000010011111011000000 -01001110001000001000101101101100 -00000000111110110001000010110010 -11000000000011001011000000000011 -00100001000000101100000100001000 -00110000010000000000110010101010 -00000011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10001011000000010000111001000000 -00001000101000000000001000101100 -00000000101111110101000000100011 -11000000000010001011000000000010 -00100000000000001000100101100010 -00100010110000010000100010100100 -00000010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10000001000000000010110011000000 -00001010000110000000001010000111 -10010000101100110000010000101000 -11000000000010000010000000100010 -00001100000000001000001000000000 -10100000000000000000100000010000 -01000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10000101100000000010110111100100 -00001000001010000100101010010110 -00100000101100111000000000101001 -11100000101010000110100000000010 -00001110000000001000011010000000 -00100000101000000010100001011000 -00000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11100011000001000011110011010000 -01001110001100101000101110001100 -10000000111100110010000000111010 -11000000010001000011000100000111 -00001101100001001100001000100000 -01110000000000000000110010010010 -00001011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -10001111111000000000001100111100 -00000000111111110000000000110111 -11000000000011111111000000000011 -11111100000000001111111000000000 -10111111100000000000111111011000 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011100010000000000 -11001001011000000011111010000000 -00001101000000100000001101100110 -11100000110010110010100010111010 -11100000000011001010000000000011 -11101100000000001100101100000000 -00110110010000000100110010100000 -01000011001010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110000000000 -11010111001010010010111111000000 -00000101011000010000101000010100 -00000000100011110000000010100000 -11011100000010000110000000000010 -11011100000001001010011100000000 -10100001110000000100100001100000 -00000010000100100000010001100000 -00000000000000000000000000000000 -11000000000000001011101000000000 -10000101110100000010110111100000 -00001001011010000000001001111110 -10000010100001111001000000101001 -11101001100010000111100000000010 -10001110000000001010001110000000 -00100001011000000000100001101000 -00000010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10010011000000010010110010000000 -00001001001011000000001000001110 -00000000100010110000001010100000 -11000000001010000011000001100010 -11001100000000001010001100000100 -00100000110000000110100000100111 -00001010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011011100000000000 -11001010000000000011111110010000 -00001101101000011000001101101010 -00000000110010100000000010111010 -10000000000011001010000000100011 -10101000000000101110101001000000 -00110010100100000000110011101100 -00001011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110001100000000 -11111000000000000011111000000010 -00001111000000000000001111100001 -01010000111110000000000000111110 -00000000000011110000000001000011 -11100000000000001011000000001000 -00111110000000100000111101000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000010 -11101001001000000011000001000000 -00001100101100000000001100100100 -00000100111110010000000010110010 -01000000000011111001000000000011 -00100100000000001000100100000100 -00110010010000000010110010010000 -00001011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010100100000 -10000011111000000010001001000000 -00001000100100110000001000101100 -00000000101110010000000010100010 -01000000000010111001000000000010 -00100100000000001000100100000000 -00100010010100000000100010010100 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010000011000000000 -10101001000000000010001001000000 -01101000101100000100101000100100 -00000000101110010100000000100010 -01000000100010111001000000000010 -00010100000000001010110100000000 -00100001010000100100100011010000 -11000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010000000010 -10001001000000000010000001001000 -00001000000100100000001000000100 -00000000101100010010100010100000 -01001011000010110001001000001010 -00010100100000101010010100100000 -00100001010010000000100001010010 -00000010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11101000000000000011001000000000 -00001100100000000000001100101000 -00000000111110000111000010110010 -00001000000011111000100000000011 -00100010000000001110100011010000 -00110000001101000000110001001101 -00001011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011111010010100000 -11111001000000001011111101001110 -01001111100100010000001111000100 -00000000111110010000000010011110 -01001010000011111001001110000011 -11100100111000001101100100010000 -10111110010001000100111110010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000000011110110100000000 -11001001000000000011111001010000 -00001110110100000000001110100100 -00000000111111010001001010110010 -01001010100010111001000000000011 -00100101000000101100110101000100 -00110010010000000000110010010010 -00001011000001100000000001110000 -00000000000000000000000000000000 -00111000000100001100001000000100 -10001000000000010010111000010100 -00001000100001000000001000100000 -00000100101110000100000010101010 -00011000000010111000010000000010 -00100001010000001000000001000001 -00100010000100000000100011000110 -10000010000011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010010000000 -10000001000000010010110001001000 -00001010000101000000001010000100 -00000000101100010110000010100000 -01000011000010110001011010000010 -00000100100001001010000101100100 -00100001010110100000100101010001 -00000010000000100000000101110000 -00000000000000000000000000000000 -00011000000101011000010101000010 -10001001000000100010111001001000 -01001000100100001000001000100100 -00000100101100010000000010001010 -01000001010010111001010000001010 -00100100000000001010100100000001 -00100010010000000000100111010000 -00000010000001100000010001100000 -00000000000000000000000000000000 -10100000000101011110011000000000 -11001001000000000011111001101000 -00001110100110000000001110100110 -00000100111110010000000010010010 -01000000000001111001000000000010 -00100100000000001110100100000000 -10110010010000000000100110010000 -00000011001010000000010001110000 -00000000000000000000000000000000 -00101000000000011010111000000000 -11111001100101000011110001100000 -00001111100101000000001111100100 -10010100111110010000000000111110 -01000000000011111001000000000011 -11100100000000101101100100001000 -00111100010000000010111000010000 -00000011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000010 -11001000100000000011111000000000 -10001100000001001000101110100010 -00000000111110000000000010110010 -00000000000011110000000000000011 -00000000000100001100100000000000 -10110010000000000000110011000000 -00000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100001000000 -10001010101000000010111010000000 -00001000111000000000001000101000 -00100000101111101100000010110110 -10000000000010111010000000001010 -00101000000000000000111001001000 -00100010100000010000100011100000 -00000010100010100000000001000000 -00000000000000000000000000000000 -00101000000001010100100100000010 -10000011100000000010110011000000 -10011000001100010000001010001100 -00000000101100010110000000101000 -11000001000010110011000000000010 -00001100000000101000101110000000 -10100000111000000010100000101000 -00000010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001100100000000 -10000111000000000010110011000000 -00111000011100000000001000011100 -00000000101101000000100010101101 -11000000000010110111000000000010 -00001100000000001000010100000000 -00100001110100000000100001100100 -00000010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000001111000000010 -11000111100010000011110111100100 -00001100011010000000001110011110 -00000100111111011000000010111001 -11100100010011111111101010000111 -00011110001000001100011110000010 -00110011101000000010110011111000 -00001011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110110110000 -11111010010000000011111011100100 -10001011001100000000001111101000 -10100000111110000000000000110110 -11000100000011111011010100100011 -11101101110000001111100100000100 -10111110100000000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111001000000000 -11001110100000000011111111100001 -00001111111110000000101110111010 -00000000111111111000000000111011 -11100000000011111111100000000111 -00111110010000001100111010000000 -00110011011000000100110011001000 -01000011000000000000000001110000 -00000000000000000000000000000000 -10101000000100011001000001000010 -10000110000100000010110111000000 -00001011011100101000001000010100 -01000000101101100000000000100001 -11000000010011100111000000000010 -00111100110000001000111100010000 -00100001010001000100100001000001 -10001010001010100000010001100000 -00000000000000000000000000000000 -00000000000000001001010000100010 -10000101000000000010110111100010 -00001011001100000000001011011000 -00000000101101110000000000101101 -11000000000010110011000000001010 -00011100000000001000011000000000 -00100000000000000010100000011000 -00001010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10000000000001000010110011110010 -00001011001101000000001001000000 -00000100101100110000001010100100 -11000000000010100011000000000010 -00001100000000011000101100000000 -00100000001001000000100000010100 -00000010000010000000010000110000 -00000000000000000000000000000000 -10101000000101011000110000000000 -11001001000000000011111111100000 -00001111101100000000001111100100 -00000000111110000000000000111111 -11000000010011111111000000100011 -00111100000000001100101100000000 -00110010110000000000110010101101 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110100000000 -11111001100000000011111011000001 -00001111101101000000001110101100 -00010000111110110100000000111010 -11000000000111111011000000000011 -11101100000000001111100000000000 -00111110110000000000111110100000 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111111000100000 -11011111010000000011111111000000 -00011111111100011000001101110100 -00000000111111000001000010110001 -11000000000001001111000000100011 -11011100000000001000111100000000 -00110001100000000010110001110000 -00001011000000000100010000110000 -00000000000000000000000000000000 -10000001000001000110111101100000 -10001010100000000010111011000000 -10001011001101000000001000101000 -00000100101110110100000010110110 -11000001000010101011000000000010 -11101100000100001101100011001010 -00100010100000010000101010110000 -00000010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010100000000000 -10011000000000000010111011000000 -00011011101100001000001001100010 -00001000101100100000100010100010 -11000000010010101011000001000010 -11101100000000001010100000100000 -00100010010000000000100010000000 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000000001000010100000000000 -10000000000000000010110011000000 -00001011001100000000011000000100 -00000000101100110000000001100100 -11000000000010100011000000000010 -11001100000000001011000000000000 -00000000010000000010100000000000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000011010100100000000000 -11011001000000000011111111000001 -00001011101100000000101101100000 -00000100111100110000000010110011 -11000000000011101111000000000011 -11111100000010001110100000000000 -10110010000000000100110010010000 -00000011000000000000001101010000 -00000000000000000000000000000000 -10100000000110011111100000000000 -11111100000000000011111111000000 -00001111110100000000101111110000 -00000000111111110000000000111111 -11000000000011011111000000000011 -11111100000000001101110000000000 -00111111000000000000111111010000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111110001000000 -11011111000000000011001111000000 -00011110111100100000001100111100 -00000000110011110010000000110011 -00001010000011111101100000000011 -11110100000000001101111000000010 -00110011110000000000111101101000 -00000011011100000000000001110000 -00000000000000000000000000000000 -10000000000110001110110010000000 -10001011001100000011001111011010 -00001101111101000010001000111101 -11101000100011110110100000100010 -00011011000010111001000000000010 -11110110000000001000100010000100 -00110010111000000000100110110000 -00000010001100000000010000110000 -00000000000000000000000000000000 -10001000010001011000110000000100 -10010011000010000010000011010000 -00001000001100010001001010001100 -00000010100000110001000000100000 -00000000000010110001000000000110 -11001100000000001011000000000000 -00101000111000000000101100010000 -00000010001100100000000101110000 -00000000000000000000000000000000 -11000000000001011100110000000000 -10000011000000000010001011000000 -00001001101100000000001010001100 -00000000100010110000000000100010 -00100000000010111010100000000010 -11100110000000001010100010000001 -00101010100000000000100100011000 -00000010001100000000010001100000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11011011000000011011001011000000 -00001100101100000000101110101100 -00000001110010110000000010010010 -00110000000010111001100000010111 -11100110100000001111101010000000 -00101010110000001000111110111000 -00001011010100000000010001110000 -00000000000000000000000000000000 -11100000000000011010110000000000 -11111011000000000011101011000000 -00001111111100000000001101111100 -00000100111111110000000000111110 -11000000000011111101000000000011 -11110100000000001101101100000000 -00110011110000100000111111110000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11101011000000010011010011000000 -01001100001100000001001111101100 -00010000110010110000000000110110 -01000000000011011011000010000011 -10001100000000001101100011000000 -00110010110000001000110010010010 -00000011000101010000010000100000 -00000000000000000000000000000000 -11001000000001010011110000001000 -10001111000000000010001111000000 -01001010111101000000001011111100 -00000011101011110000000010100010 -11000000000010001011110011000010 -10101100000000000000000100000000 -00010110111100000010110010010100 -00000010001100100000000001000000 -00000000000000000000000000000000 -11000000000001000100110000000000 -10100011000000000010010011000000 -01001001001110011000000011001100 -00000000100010110000000001101100 -00000000000110010011100000000010 -01001100000000010001001000000001 -01100000111101000000100100000100 -00010010001110000000000001010000 -00000000000000000000000000000000 -00100000000100000101111000000000 -10000111100000000010000111100000 -01001010011110000000001011011110 -01000000101000111001000001101001 -01100100010110000111100000000010 -11010110000000101000010010010000 -00100100111000000000100001011000 -00010110001011000000000001000000 -00000000000000000000000000000000 -01001000000010000100110000000000 -11100011000000000011010011000000 -00001101001100100000001011101100 -00000000100000110000000000111100 -11010000000011011011000000000011 -11001000000000001101001001000000 -00110000110001000000110100010000 -00001011000100100000001000000000 -00000000000000000000000000000000 -01000000000101011011110000000000 -11111111000000000011111111010100 -00001111111100000000001111111101 -00100010111111110000000000110111 -11000000010011111110000000000010 -10010100000000001111110000000100 -00111011110001000000111111010001 -00000011110100000000011001100000 -00000000000000000000000000000000 -00001000000001011110110001000000 -11111011000000000011111011010100 -00001110101111001000001100101101 -00000000110010110111001000111010 -00000000000011101011100000000011 -00101100000000001101101000000000 -10110010110010100000111100111000 -00100011001010100000000001110000 -00000000000000000000000000000000 -01001000000110010001110010000100 -10110111001000000010110111000000 -00000011011101000100001010001100 -10000000110101110011000000100001 -11000000000010001111000000010010 -00011100010000001010011000000000 -00100001110000001000101101110000 -00000010001100100000010001100000 -00000000000000000000000000000000 -00100000000000000001111000000000 -10110111100100000010110111101000 -00001010001110100000001000011110 -00000000100000111000000000101001 -01100000000110100111100000000010 -00001110000000001000001010000000 -01100001111000000000101111011000 -00000010001000000000000000100000 -00000000000000000000000000000000 -01101000000001001100110000000000 -10111011000000000010111011000000 -00001011001100000000001010001100 -00000000100100110000000000101000 -11000000000010000011001100001010 -00001110000000001010001110100000 -00100000110000101000101100010101 -10000010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011110100000000000 -11111010000000000011111010000000 -00001110101000000000101100101000 -00000000110010100000000000111011 -10001000000011101110000000000011 -00111011100000001100111010100000 -00110010100100001000111111101100 -00001011001110100000010001100000 -00000000000000000000000000000000 -01001000000000011010000000000000 -11111000000000000011111000000000 -01001111100000000000001111100000 -00000000111100000000000000010110 -00100000100011111000000000000011 -11100000001000001110100000000001 -00111110000000000100111110000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001000010000000010 -11001001000000000001001001000000 -01000110100110000000001111100100 -00000000110010010000000000110100 -01000000000011001001000000000011 -11000100000000001000000100000000 -00100010110000001000111110010000 -00000011110000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010000000100 -10001001000000000010001001000000 -00101000100110010000001011100100 -00000010100010010000000010100010 -01000000000010101001010000000010 -11100100000000001000100100000000 -00100010010000000000101110010100 -00000010111000000000000000010000 -00000000000000000000000000000000 -00111000000001010010010000000000 -10001001000000001010101001000000 -00001000100100000000001011000100 -00000000100010010000000000100110 -01000000000010001001000010000010 -11100100000000001010100100000000 -00101010010000000000101110010100 -00000010110001100000000001000000 -00000000000000000000000000000000 -00101000000101000000010010000000 -10000001001010000010100001001001 -00001000000100100000001011000100 -10110000100000010010100000100000 -01001000010010100001000000000010 -11000100100000011010000110100000 -00101000010010010000101100010000 -00000010110000100000000100000000 -00000000000000000000000000000000 -10111000000011000110000000000000 -11001000011100100011101000010100 -00001100100001010000001111100000 -10000000110010000010000000110100 -00000000100011001000010100000011 -11100000000000101110100000000000 -10111010000000000000111110000101 -00000011111011100000001101010000 -00000000000000000000000000000000 -10011000000001011010010011110000 -01111001000000000011011001000100 -00001101100100010000001111100100 -10110000111110010010100000111111 -01001110000011111101000000000011 -11110100010000001101110100010001 -00110110010001001000111111010000 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010100001000 -11111001010000000011111001000000 -00001100110101000000001100100100 -00100000110010011000000000110010 -01001000000011111101010000000011 -00010100000000101100000100000000 -00110010010000101000111100010000 -00100011110001100000000101100000 -00000000000000000000000000000000 -00111000000110001110000100001000 -10111000010000000010111000011110 -00001000100001000000001010000011 -10001000110110001111100000100010 -10011001000010110000001000010011 -01100001000000001000100001000000 -00100011100100000000101110000000 -00000010110011100000010000110000 -00000000000000000000000000000000 -01001000010001011000010110000100 -10110001011001000010110001000000 -00101000000101100000001000000100 -00100000100000010000000000100000 -01010010100010110001000000000110 -00000101000000001000010111000010 -10100001010000000000101100011010 -10000010110100100000000100110000 -00000000000000000000000000000000 -00011000000001001010010000001000 -10111001000000000000110001000000 -00000000100100000000001010100100 -00000000100100010000000000100010 -01000000000010110001011000000110 -01100110001000101000110100000000 -00100111010000000000101110010010 -00000010110001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000010011111001000000 -01000000100100000001001100100100 -00000000110010010000000010110010 -01010000000011111001010000100011 -00100100000000001100100100000010 -00110010010000000000111110011000 -00000011111010000000010001110000 -00000000000000000000000000000000 -01001000000000010010010000000100 -11111001000000000011111001000000 -00001111100100000010001111000100 -00001000111110010000000100111110 -01100100000011111001000000000011 -11000100000000001111000101000100 -00111010010000010000111110110000 -10000011110110100000000001100000 -00000000000000000000000000000000 -00001000000100001010000000000000 -11101000000001000011001000000000 -00001101000000010000001111100000 -00010000110010000000000000110110 -00010000001011001000000000000011 -00100000000000001100100000000000 -00110011000100000100111110000000 -01000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000000001 -10001010000000000010001010000000 -00001001111000000000001011101000 -00000010100010100000010010100010 -10000000000011011110000000000010 -10101000000000101000101000000000 -00100010100000000100101110100000 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000100 -10100011000000100010100011000000 -00001001001110001000001011001100 -00000000100000110000000010100100 -11000000000010000011000000000010 -01000100000000011000001100000000 -10100000100000000000101100110000 -00000010000010100000000001010000 -00000000000000000000000000000000 -10000000000100010001111000000000 -10000111101000000010100111001000 -00011001011000000000001011011100 -10000000100000110001000000100001 -11100100000010000101000000010010 -11010100000000001000010100000000 -00100001100000010000101111111000 -00100010001010000000000001000000 -00000000000000000000000000000000 -10001000000010001011111001000000 -10101111110000000011100111110001 -00001101011110000000001111011111 -00100000110001111010100000110111 -11101000000010000110100000000011 -01010110000000001100011010000000 -00110001101000000000111101111000 -00000011001010100000001000000000 -00000000000000000000000000000000 -00001000000101011010110000000000 -10111011001000001011011011011000 -00001111101000000000001111101100 -00000100111110110000000000111110 -11010000010011111101000000000011 -10100100000000001111100000000000 -00111110100000000000111110110110 -00001011110000100000011001100000 -00000000000000000000000000000000 -00000000000001001111111000100000 -11111111110000000011001111110000 -00001100110110000000001100111110 -00000010110011111000000010110011 -11110000000011111111100100000011 -11110110000000001110111110000000 -00110101101000000000110011111100 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000110001001110000000000 -10110111000000000010000111000100 -00001000010001000000001101111100 -00000000100001110010000000100001 -11000000000010110101001100010010 -11010100010000001000010100000000 -00100001100001000000100001110000 -00000010001010100000010001100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010000111000000 -00001000011100000000001000011100 -00000000100001110000000001100001 -11000000000010110110000000100010 -11010101000000001010011000000000 -00100001101000000000100001110100 -00000010000000000000000000100000 -00000000000000000000000000000000 -00100000000001001100110000001001 -10110011000000000010000011000000 -00001000100000000000001001101100 -00000000100010110000000010100000 -11110100000010110001010100000010 -11000100010000001000000010000000 -10100000100100100000100000110000 -00000010000010000000010000110000 -00000000000000000000000000000000 -10101000000101010011110000000000 -10111111000000001110001111000000 -00101000101100000000001100111100 -00000000110011110000000000110011 -11110000000010111001010000000011 -11100000000000001110101101001000 -00110010010100000000110010110000 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101000000110001111101100 -00000000111110110000000000111110 -11000000000011111001000000000011 -11000000000000001111100100000000 -00111110010000000000111110110100 -00000011111000000000000000110000 -00000000000000000000000000000000 -00100001000100001111110000000000 -11111111000000000001111111000000 -00001111111100000000001100111100 -00000000110011110000000000110011 -11000010000011111100000010000011 -00100000000000001100101000001000 -00111111010000001000111111110000 -00000010000000000100010000110000 -00000000000000000000000000000000 -10100001000001000110110000000000 -10111011000000000010111011000001 -00001011101000000000001010101100 -00000010100010110000000010100010 -11000000000010110001100000000010 -00100001100000001000100000000000 -00101110011000000000101100110000 -00001010001000000000000000010000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011100100000000001000101100 -00000000100010110000000000100010 -11000000000010111001000100100010 -00100000000010001000101100000010 -00101110010001000000101110110100 -00000010101000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -01001001000100000000001010001100 -00000000100000110000000000100000 -11000000000010111001000000000010 -00000000000000001000000100000000 -00101100011000000000101110110000 -00000010100000100000000100000000 -00000000000000000000000000000000 -00000000000011010111110000000000 -11110111000000000011110111000000 -00001111001100000000001100111100 -00000000110001110000000000110011 -11000000000011111000000000001011 -00100000000000001100101000000000 -00111110010000000000111110110000 -00000011100000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111110100000010001111111100 -00000000111111110000001000111111 -11000000000011111101000000000011 -11110000000000101111110000000000 -00111111010000000000111101100000 -00000011011010000000011001110000 -00000000000000000000000000000000 -11000000000001011111100000000000 -11001101100000000011111111001000 -00001111111100110000001000110110 -00000000110011110001000000110011 -00001100001010001101100000000011 -11111100000000001100111110000000 -00110111010000000000110011000000 -00110011111100000000000001110000 -00000000000000000000000000000000 -10000000000100001010010000000100 -10001001100000010010111111001110 -00001011111101100000101000100110 -00000100100000110010000000100010 -00001100100010001011100000000010 -11111101100010001000100110000001 -00100010011000000000110110001000 -00000010111000000000010000110000 -00000000000000000000000000000000 -10001000000001001100000000000001 -10000011000001000010110011000000 -00001011001100110000001010101100 -00000000100000110010000000100000 -10001000000010000001000000000010 -11001100011000001010001100000000 -00101110110000000011100000100000 -00000010111000100000000101110000 -00000000000000000000000000000000 -11000000000101011000010000100011 -10001011001000000010111011000000 -00011011101100000000001010100110 -00000000100010110000000001101010 -00000000000010001011000000010010 -11101100000000001010101111000110 -00101010110000000000100110100000 -10000010111100000000010001100000 -00000000000000000000000000000000 -00000000000101011110000101000000 -11001001000000010011111011000000 -00001111101100000100001110000100 -00000000110010110000000001110010 -01001000000011001001100000000011 -11101100000000000110100110000000 -00111100010100100000110010000100 -00000011110000000000010001110000 -00000000000000000000000000000000 -11100000000000011011011000000000 -11111101000011000011111011000000 -00001111111100000000001101110100 -00010000111101110000000011110111 -00000100010011111111100100000011 -11111100000001101101110100000001 -00110111010001000000111110000100 -00100011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010000100000000 -11101011000000100011111011000000 -00101100001100010000001110101100 -00000000111110110000000000110000 -11000100000011111001000000000011 -11101100000000101110101101001000 -00111110110000100010110010110100 -00001011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010010111010000 -10001011000000000010111111000000 -00001000111101010000001000100100 -10000000101111110000010000100010 -00100000000010111011100000000010 -11111110000000001000001101100000 -00001110110110000000100010111000 -01000000001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100011100000010 -10100001110000000010110011000000 -00011001001110000000001010000100 -00000100101100110000000000000100 -00011000010010110001100000000010 -11101100010000000010000100000000 -00001100000100010000100100010000 -00000010001110000000000001010000 -00000000000000000000000000000000 -01100000000000010000111000000000 -10010101100010110010110111100000 -11001001011110000000011000011110 -00000000101101111000001000100101 -11100000000010110101100010000010 -11011110000000001010010110000010 -00101100001000010100100101011010 -10010010000110000000000001000000 -00000000000000000000000000000000 -01001000000010000000110010001001 -11100001000001000011110011001000 -10011101101100100000001110001100 -00000000111100110000000010110100 -10001000100011110001000000000011 -11101100000000001110001100110000 -00111100110000000000110100000000 -00001001000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011110100000001 -11101101000000000011111111000000 -00011110111101000001001111111101 -00000000111111110001000000111011 -11000000000011111101000100000011 -11111101001000001101111100010000 -00111111110000000000111011000010 -01000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11001011000000000011111011001001 -00001111101100010000001111100100 -10000000111110110001000000111110 -01000000010011111011001100000011 -11101100100000101100100000000000 -00111100010000000010110010110000 -00010011001010100000000001110000 -00000000000000000000000000000000 -01001000000100010000110000000000 -10000111001100000010110111010010 -00001011011100000101001011011100 -00010000101101110000001000101101 -11000000000010110111000010000010 -11011100000000001000010000000010 -00101101010000000000100001110000 -00000010000100100000010001100000 -00000000000000000000000000000000 -11000000010000000001111000000100 -10000111100101000010110111101000 -00001011011110100000001011011110 -01000001101101111000000000101101 -11100000000010110111101000000010 -11001110100000001011011010001000 -00101101011000000000100000111000 -00000010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001100111000000000 -10000011000000000010110011000000 -00001011001100000000001011001100 -00011000101100110000001000101100 -11000000000010110011000100000010 -11101100000000001011001010000010 -00101100111000010000100000111111 -00000010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011010100000100010 -11001010101000000011111010000000 -10001111101000000100001111101000 -00000000111110100000011001101111 -10010001000011111010100000000011 -11101000000010001111111000000100 -00111111101000000000110011100100 -00001011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000010 -11111000000000000011111000000000 -00000011100001000000001111100000 -00000000111110000000000001111110 -00000010010011111000000000000011 -11100000000000000000100000100000 -00111100000001000000111100000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110110001000010 -11001001000000000001001001000000 -10000011000100000010001100100100 -00000000111110010000001001111100 -01000001100011001001100100000011 -11100100000000001100100110000010 -00111110010001100000110010011000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010100000000 -00000011000000000010001001000000 -00001011100100000000001000101101 -00000100101110010000000000101110 -01000000000010001011100000000010 -11100110000010001000100111000000 -00101110010110000000101010011000 -01000011001000000000000000010000 -00000000000000000000000000000000 -00011000000001010000010100000000 -10001001010000100010101001000000 -01011011100100000000001000100101 -00000000101110010000000000101110 -01000000000010001001000000000010 -11100100010000101000100100101000 -00101110010000000010100010010001 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010010100010 -10001001000000000010100001001010 -00001011000100101000001000000100 -00000000101100010010001100101100 -01001000100010000001000000000010 -11000100101000011000000100000000 -00101100010010000000101000010010 -00000010000000100000000100000000 -00000000000000000000000000000000 -10111000000011000110000010010000 -11001000000001000011101000001000 -10001111101001110000001100100000 -00000000111110000000000100101110 -00010100001011001010000000000011 -11100001110000001100100000000100 -00111110000000000000110010000000 -00001011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011010010010100010 -11111001000000011011011001001010 -00001111100100000000101111100100 -00000000111110010011100000111111 -01000100100011111001000000000011 -11100100000000001111110100000000 -00111111010001010010111111010001 -00000011101001100000011001110000 -00000000000000000000000000000000 -10011000000001011010011000000000 -11001001000000000011111001000100 -00001111110100100000001111100100 -00010000111110010110000000111111 -01001011000011000001000000000011 -11110101000000101100110100000100 -00111111010010000100110011010000 -00000011001001100000000001110000 -00000000000000000000000000000000 -00111000000100001110001010000010 -10001000000000000010110000010100 -00001011100000100000001011100000 -00000000101110000101000000101100 -00011001000010001000000000000010 -11100001000010001000100000000010 -00101110000100000100110110000100 -00001010000011100000010000110000 -00000000000000000000000000000000 -00001000000001001100010100100001 -10000001000001000010110001001000 -00011011000101001000001011000100 -00010001101100010010000000101100 -01000010000010000001000000000010 -11000101100001001000000100000100 -00101100011001000010100000010100 -01000010100000100000000101110000 -00000000000000000000000000000000 -00011000000101011000110010010000 -10001001000000000010111001000001 -00011011100100000000001011100100 -10000000101110010000000000101110 -01000001000010001001000000000010 -11100100000000001000100100000110 -00101110010000000000100110010100 -01000010100001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11001001000100000011111001000000 -01001011100100000100001111100100 -00001000111110010000000000111110 -01000000001011001001000000000011 -11100100000000001100100100010000 -00111110011100000000110000010000 -00000011101010000000010001110000 -00000000000000000000000000000000 -00101000000000011010110000111000 -11111001100000000011111001000000 -00001111100100001000001111100100 -00000000111110010000000000111110 -01000100000011111001000000000011 -11100100000010001111100110000010 -00111110011001000100111110010010 -00000011010010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000100 -11001000000000010011111000000000 -10001101100000000000001110100000 -00000000111110000000000011110010 -00000000000011001000000010000011 -00100000000000001101100010000000 -00111110000010000010110010000000 -00000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010101000001010 -10001010000000100010111010000000 -00101000111000000000001000101011 -00000000101110100000000100000011 -10000000000010001010010000100010 -00101000000100001000111000000000 -00101101100100001000101011100000 -00000011100010100000000001000000 -00000000000000000000000000000000 -00101000000001010100111000000000 -10010011000100000010110011000000 -00011000001110000000001010001100 -10000000101100110000000000100010 -11100000000010000011010000000010 -00100100000000001001001100000000 -00101100010000000100100000011000 -00000000010010100000000001010000 -00000000000000000000000000000000 -10100000000000010001110000110000 -10010111000000000010110111101000 -00011000010110001000001000010101 -00000100101101111010001000100001 -11010000000010001111100000000010 -00010100000000011000011100000000 -00101101010000001000101001110100 -00010110101010000000000001000000 -00000000000000000000000000000000 -10101000000010000000101001000000 -11010111100010010011110111101000 -00001100111110000000001110011010 -00000000111111111100001000100001 -11100000001011000111100000001011 -00111110000000001101011110000000 -00111100011000000010110000111000 -00001011011010100000001000000000 -00000000000000000000000000000000 -00001000000011011010100010000000 -11101010001000000011111011000100 -00001110100000000000001111100000 -10000000111110110110100000111110 -11000000000011111001011000010011 -11100100000000001111101100000000 -00111110010000000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -01000000000001011111011001011000 -11101111100100000011111111110000 -00101100111010000000001111111111 -00000000111111111000000000110011 -01100000010011111111110000000011 -11110110000000001100111110000000 -00110001011001000010110011111000 -01000011000100000000000001110000 -00000000000000000000000000000000 -10101000000100011001010011000000 -10000101000000000010110111000000 -00001000010000000000001011010100 -00000000101101110000000000101001 -11000000000010110111000000000010 -11110100100000101101011100000000 -00111101010011000000100001110010 -00100010001010100000010001100000 -00000000000000000000000000000000 -00010000010000001001110000010000 -10000111000000000110110011000000 -00001000011100000000001011011100 -00000000101101110000000000100001 -01000010000010110110000000000010 -11011100000010001000111100000000 -00100001010000000100100001110000 -00000110100000000000000000100000 -00000000000000000000000000000000 -01100000000101001100000100001001 -10000000000000000010111011000001 -00001000000000000000001011000100 -00000001101100110000000000101000 -11100000000010110000000000010000 -11000100000000001000001100000010 -00101000010000000000100000110000 -01100110100110000000010000110000 -00000000000000000000000000000000 -10111000000101011010100100000010 -11001000000000100011111111000000 -10001100101100000000001111101110 -00000000111111110000000000110010 -11110100000011111000100000000001 -11100100000000001000101100000000 -00100010111000000000110000110000 -00000011101011100000010001100000 -00000000000000000000000000000000 -10000000000000001100101100000000 -11111011000000000011111011000000 -00001111101100000000001111101101 -01000000111110110000000000111110 -00010000000011111010000100010011 -11000100000000001111101100010000 -00111110011000000000111110110000 -00000001011000000000000000110000 -00000000000000000000000000000000 -10000000000100001111110000100000 -11011100100000000011111111000000 -00001100111100100000000110111010 -00010000111100110000010000110011 -11000000000011111101000000000011 -11111100000000001100111100000000 -00111111010000000000110011111010 -00000011001000000000010000110000 -00000000000000000000000000000000 -10000101000001000110110000000000 -10001010110000000010111011000000 -00001000101000000010101000101001 -10000000101110110000000000100010 -00101000000010111001100001000010 -11100100000000001000100110000010 -00101100011000000010100010110000 -00000010001001000100000000010000 -00000000000000000000000000000000 -10000000000001010010010000010010 -10001000011000000010111011000000 -00001000000000000000011000100000 -01000000101110110000000000100010 -01001001000010111000000100000010 -11100100000000001000101110000000 -00101110101000100100100010110000 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000010001000000010000000000 -10000001000000100010110011000000 -00101000000000000000001010000000 -00000000101100110000010100100000 -00000000000010110010100000000010 -11000100000000001000001110000000 -00101110010000000000100000110000 -00001010000000100000000100000000 -00000000000000000000000000000000 -10000000000011010100110000000000 -11001000000000000011111111000000 -00001100100100000000001100100000 -00000100111111110000001000110010 -01000000000011111000000000000011 -11101100000000101100101100000000 -00111110010000000100110010110000 -01000011001000000000001101010000 -00000000000000000000000000000000 -10100000000111011111000000000000 -11111100000000000011111111000000 -00001101110000000010001101110000 -00000000111111110000000010111111 -00000000000011111100000000000011 -11110100000000001111010000000000 -00111111010000000000111101110000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000000011111011000000000 -11011111000010000011001111000110 -00001101110110010000001111110000 -00000000111111011000001100001111 -01100000100011001100001100100001 -11110110000000001100110000000010 -00110011110000000100110011110000 -00000000001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110010000000000 -10001011100000010011011111011000 -00001101100100100000001011100001 -00100100101110011000000000101110 -01100000000010001000011100000010 -11100100000010001000100010000100 -00101010111000000000100010010111 -00010010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011110110000000000 -10010011000000000010000011000000 -00001000000100100000001011000000 -11000000101100010000010000100100 -01000000000010000000000000000010 -11000100000000001000000000000000 -00100000101000000000100000010000 -10000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010111000100000 -10001011000000000010010011000000 -00001001100100000000001011100110 -00010000101110111000000000101110 -10100000001010001011100000000010 -11100100100100000000100100000000 -00101010100000010010100000011000 -00100010001100000000010001100000 -00000000000000000000000000000000 -01000000000101010100011100000000 -11011011000000000001001011000000 -00001100100100000000001111100010 -00000000111110011010000000110110 -01100000000011001000110010000011 -11100111000000000100101001010000 -00110010110000000000100010010000 -00000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011010000000000 -11111111000000000011111011000001 -00001111110101000000001111111000 -00101000111111010000000000111111 -01000001000011111101000000000011 -11110100000011001111111000000010 -00111110110100001000111111010000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11101011000000000011111011000000 -00001101100100000000001111100101 -00000000111110110100000000111110 -11001001010011111000010001000011 -00100100001010001100001101001000 -00110010010000000000110010010000 -00000011000100000000010000100000 -00000000000000000000000000000000 -11001000000000010010110000000000 -10110111101000000010111111000000 -00101100100100000000001011101101 -00011000101110110000000001111100 -11100000000010111011110010000010 -10000100000000001000101111100000 -00100000000111000000100010010111 -00000011001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10100011000000010010110011000001 -00001000000100000000001011000011 -00000000101100111000010000101100 -11010100000010110000100010000010 -00000101000100001010000010000000 -00100000110000000010100000010000 -00000010011110000000000001010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100001000010110111100000 -00011000011110000000011011010110 -01000000101101101100010000101001 -11100000000010110100100001000010 -10110110000010001010011110000001 -00100001111010000000100001011001 -01000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11100011000000000011110011000100 -00001100000100000100001111001001 -00100000111100110001100000101100 -11001000000011111001000000000011 -00000101000001001110001000000000 -10110000110000000000110010010000 -00000001010100100000001000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000100011111111000000 -00001111111100000010001111110100 -00010000111111100000000100111111 -10000000000001111111000000000011 -11010100010010001101011100010000 -00111111110010010000111111010000 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000110 -01000011100100000000001111100100 -00000000111010110000000000111110 -11100001000011001011000000010011 -00100110000000000000001100000000 -00100010110000000000110010010000 -00010011001010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111001000 -00001011011100000010000011111100 -00000000100001110000000100111101 -11000000000010000101000001000011 -01010000000000001000011100000001 -00101000110000000000100011010000 -00010010000100100000010001100000 -00000000000000000000000000000000 -11000000010000001001111000010100 -10110111100001000010110111100000 -00011011010110000100001011011111 -00010000101001111100010000101111 -11110000000010010011100000000010 -00011111000000101000011110000100 -00100001111000001010100001011000 -00001010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001100100000000100 -10110011000000000010110011000000 -00011011001100000000001011001110 -00100000100000111000000000101100 -11001000000010011011110000000010 -01000101001000001000001110000000 -00101000010000000000100000010000 -00001010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011011100000000000 -11111010000000000011111010000000 -00001111101000000000001111111001 -00000100111011101000001000111111 -10000000000011011110101100000011 -00111010000000001100111011000000 -10110011100110000010110010100000 -00000011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000100100 -11111000000000000011111000000000 -00001111100000000000001111100001 -00000000111110001000000001111010 -00010000011011101000010000000011 -11100000000000101111000001010000 -00111110000000100000111110000001 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11101001000000000011111001000000 -00001111100100000000011100000100 -00000000110010010000000000111110 -01110000100011111001000100000011 -00100100000001001111100110101000 -00110000011000000000111000010001 -00001011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000100010000000000 -10001001000000000010111001000000 -00001011000100000000001000100100 -00010000101010011000010000101110 -01001000000010111001101000000010 -00100111000000001011100111000010 -10110110010100000000100010011000 -00001010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10101001000000000010111001000000 -00011011100100000000101000100100 -10000000100010010010000000101110 -01000000000110111001000000000010 -10100100010000001011101101000000 -00100010010001100000101010010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000010010000000000 -10000001001000000010110001001001 -00011011100100000000001000000100 -10000000101000011000000000101100 -01000000000010110001001000001010 -00001100000000001011000100100100 -00100100010010000010100000010010 -00000010000000100000000100000000 -00000000000000000000000000000000 -10111000000011000110000101000000 -11101000000010000011111000010100 -00001111100000000000001000101001 -01000000110010000000000000111110 -00000000000011111000010100000011 -10000001010000001111100000000000 -00110010000000010000111010000101 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011011010000000000 -11111001000000000011111001000100 -00001111110100101000001111110100 -01000000111111010000000000111101 -01000000000011111101000100100011 -11110100000000001111110100010000 -00111111010001000000111111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010001000000 -11111101100000000011111001010000 -00001111100101000000001111110101 -00000000010001010000000000111111 -01000000000011110101001000000011 -00110101000000001100110100000110 -00110011010000000010110011010110 -00001011010001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000000000100 -10111000010100000010111000011100 -00001011100000100000000011101001 -00000100110110000000000000101110 -10000000000010111000001011000011 -01100000000000101000100001000000 -00101010000100010000100000000110 -00000010000011100000010000110000 -00000000000000000000000000000000 -00001000010001011100010010010000 -10110001000001000110110001001000 -00011011000100100000001011000101 -10000001100000010000000000101100 -01000000000010110001010000000010 -00000100100001101000000101000000 -01100000010100000100100000010011 -00100010010000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000010000 -10111001000000000010111001000000 -00011011100100000001001011100110 -00000100100110010000000000101110 -01000001000010111011001000010010 -01000101100000001000100100001000 -01101010010010000000100010011000 -00000010000001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010101100000 -11111001000000000011111001000000 -00001111100100000010001111100101 -00000000110010011000000000111110 -01000000000011111001001000000011 -00100101000010001100100111000000 -00110000010010001000100010010000 -00001011011010000000010001110000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000001001111100100 -00000000111110010010000100111110 -01110001000011111001000000000011 -11100110000000001111100100101000 -00111110010000000010111100010000 -10011011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000100000000 -11001000000000000011001000000000 -00001111100000000000001100100001 -00000001110010000000100000110110 -00000010000011111000000010000011 -00100011000010001111100001000000 -00110010000101100000111010000000 -00001011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10001010000000010010101010000000 -00001011101000000001001000111001 -00000000100011100000010000100011 -10101001000010111110010000010010 -00111000000001001011011000100001 -10100011100000000000100011100100 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000010 -10000001000000000010010011000000 -00001011001100000010001000101110 -10000000100000110000000000100100 -11100000000010111011110000100010 -00001100000000011011001010000000 -00100100101000001000101000110000 -00001010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001111011000000 -10000011100000000010110111000100 -00001011011110100000001000001101 -00001000100101111000000000100001 -11000000000010110111010000000010 -00011100000000001011011000000000 -00100101010000000000100001010000 -00010010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000011111000000000 -11000101100000000011010111100010 -01011111111110101000001100011110 -00000010110001101000000000110101 -11100000000011110111100000001011 -00010110000000001111000010000000 -00110100111000001000111001111000 -00000011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011101011011000 -00001111101101110000101111100100 -00010100111010110000000100111110 -11000000100001111001000000000011 -11100100000110001111100000000001 -00111010010000000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111101100000000011111111100000 -00001000111110000010001111110110 -00000000111101111000000100111011 -10100100000000111111101100000011 -00111110000000001111111010000000 -00110011111010000000111111111000 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000100011001110001000000 -10110111000000000010111111000001 -00001101011100100000001011111100 -01000100110001100010000100100001 -11000000000010110110000101000010 -00011100000001001111010001100100 -00110101010000000000101101000001 -10000010101010100000010001100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110101000000000010110111000000 -00001000011100000010001011010000 -00000000101001110000001000101001 -11000000000010110101001000000010 -00010000001000001011110000001000 -01100001010110000000101101110000 -00000010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100110000010000 -10110011000000000010110011000000 -00001001001110000000000011000000 -00000000100000110101100000100000 -11011100000010110000000000000010 -00000011000000001010000010000000 -01100000010000000000101110101000 -00000010100010000000010000110000 -00000000000000000000000000000000 -10101000000101011011110000000000 -11111001000000000011111111000000 -00001100111110001000001111101110 -01000000111010011000000000111010 -11100000000011111001101000001011 -00101100000000001011001011000000 -00100010101100000000111110111000 -00001011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000100000 -11111001000000000011110011000000 -00001111101100000001001111100001 -01000000111110110000000100111110 -01000000000011111001010001000011 -11101001001000001111101000000000 -00111110111000000000111110000000 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111101010000000011111111000000 -00001100111100000000001101011100 -00000000110011110000000000110011 -11000000000011110010000010000010 -00111101000000001000110000001000 -00110011110000000100110010110000 -00000011000000000100010000110000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111001000000010010111011000000 -10101000101100000000001000100011 -00000100101000101100110000100010 -01100000010010111000010000000011 -01001011000000001000100011000100 -00100000111000000000100010100000 -01000010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111001000000000010111011000000 -00001000001100000000001001100111 -00000000100010001000000000100010 -10100000000010111001100000000010 -10101100001000001010101010000000 -00100010111000000000100010110000 -10000010001000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110001000000000010110011000000 -00001000001100000001001000000000 -00000000101010110000000010100000 -01000000000110110000000000000010 -01101000000000001010001000000001 -00100000110000000000100000010000 -00001010000000100000000100000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111001000000000010111111000000 -10001100111100000000001101100000 -00000000110010110000000000110010 -01000000000011111000000000100011 -10101000000001001110100000000000 -10110010010000000000110010110000 -00000011000000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111101000000000011111111000000 -00001111111100000000001111110000 -00000000111111110000000000111111 -01000000010011111100000000010011 -11111000000000000101010100000000 -00111111010000000000111111110000 -01000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011101111000000000 -11011111100100000011001110100000 -00011111111101101010001100111100 -00000000110011010000000000110011 -00000100000011001111000000000001 -01110100000010001101011100000000 -00110011111000000000110001111000 -00000011111100000000000001110000 -00000000000000000000000000000000 -10000000000100001110111000001000 -10000001001000001010001000100000 -00001011111101000000011000111100 -10100010100010011000001000100010 -00001000000011011011100000000010 -00010100000001001010101111010000 -00110010011000000000100010111000 -00000010111000000000000000110000 -00000000000000000000000000000000 -10001000000001011100100000000000 -10111011000000000010000011100000 -00000011001100100000001000001100 -01000000100000010000000010100000 -00000000000010000000000000100010 -01000100000010001001000100000100 -00100110110000000000100000110000 -01000010101000100000000101110000 -00000000000000000000000000000000 -11000000000101011010110001000000 -10001011100000000010001000000000 -00011011101100000000001000101100 -00000100100010010010000000100010 -11000000000010011001010001000010 -00100100000000001010100100000010 -00100010110000000010100010111000 -00000010111100000000010001100000 -00000000000000000000000000000000 -01000000000101011100110000000000 -11011011100010001011001010000100 -00001011101100000100001000101100 -00000000100010100110000000110010 -00100000000111000010100000000011 -01100110000000001101100100000000 -00110100110000000000110010111010 -00000011110100000000010001110000 -00000000000000000000000000000000 -11100000000000011011110000100000 -11111111000000000011111100000000 -00001111101100000000001111111100 -00000000111111000000000000111111 -01101000001011101110101001000011 -11110110010000001111010100000010 -10111111111001000000111111110000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010010001000000 -11011011000000000011111011000000 -00001111101100000011001100001100 -00000001111110100100000000010001 -00000000000011101000000000000011 -10100110000010001100100100100000 -00110010110000100100111110010010 -00001011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10100011000000010010001000000000 -00001011111100000000001000111101 -11000000101101000000001000100010 -11000001010010001000000000010010 -00100101000000001000100110100000 -00100010110000000000111010111100 -10000010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100111000000000 -10010011000000001010110000011000 -00001011101100000001001010001100 -00000000101100110000001100100000 -00000001000010100011000000000010 -00100101100000001000001111000000 -00100000111100000000101100110000 -00000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010011111001001000 -10100111100000000010000101100000 -10001011011110010000001010011110 -00000001101100011000000000100001 -00100000110000000011100100000010 -00010110110000001000011110010000 -00100001111000000000101001111001 -00000010000010000000010001000000 -00000000000000000000000000000000 -01001000000010000000110101000000 -11010011000000000011110011000100 -00001111001100000000001110001100 -00000100101100110000000010110010 -11000000010011100010000000001011 -10001100100000001100000100000000 -01110000110000100000111100110000 -00000011000100100000000000000000 -00000000000000000000000000000000 -01000000000111011011110001000000 -11111111000000000011111111000110 -10001111111100000000001101111100 -00000000111111010000100010111111 -11000000000011111111010001000011 -11111100100000001111110100000000 -10111111110000000000111111110000 -00000011110100000000010001100000 -00000000000000000000000000000000 -10101000010101011100110000001000 -11011010000000010011111000001010 -00001111101111100000001101101101 -00100000111110110000000000111110 -01000000100011110011000000000010 -01101100101000001100100100000000 -00110110110000000100111100110000 -00100011001010100000000001110000 -00000000000000000000000000000000 -01001000000100010001110000000000 -10001111000000000010000101000000 -00001011011100010010001000011100 -10000000101101010010000010100001 -01000100000010110111000000000010 -00001100000000001000010100000000 -00100001110000000000101101110000 -00000010000100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111000100000 -10010111100000000010110111101000 -00001011001110010100001001011110 -01000000101100111100000000100101 -11100000000010110110100000000010 -01011110000001001000010110000000 -00100001111000000000101101111100 -00001010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110100000000 -10000011010000000010000011000000 -00001011001100000010001000101100 -00001000101100011100000000100000 -11000000000010110011010000000010 -00001110000010001000000100000100 -00100000111000000000101100101000 -10000010000100100000010000110000 -00000000000000000000000000000000 -11101000000001011001101000000000 -11011110100001000011111010000000 -00001011101000000000001101101000 -00001000111111100000010000110110 -10010000000011111010000000000111 -01101010100000101100101000100000 -00110011101000010000111111101100 -00000011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000110000000 -11111000000100000011111000000000 -00001111100000000010001111100000 -00000000111110000010000000011110 -00000010000011110000000000000011 -11100000000000001111100000000000 -10111110000001000000111110000100 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000000001110011000001000 -11101001000010000011011001100000 -10001111100100000000001111100100 -00000000010000011010000000110010 -11000000000011101011000010000011 -00000100000000001100000100000000 -00110010011001000000111010011010 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000010001000110010001000000 -10000001000000000010001011000001 -00001011100100000010001011100100 -00000000100010011000000000100010 -01000000000010001001000000000010 -00100100000010001000100101010000 -00100000010000000000100000011100 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000010 -10101001000000000010111001001000 -00001011100100000000001011100101 -00000000101010010000000000100000 -11000000010010101001000000000010 -00100100000000001000100100001000 -10100010010000000100101010010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10001001000000000010100001000000 -00001011000100101000001011000100 -10110110001000010010001000100000 -01001000000010000001001000001010 -00000110100000101000000100100000 -10100000010000000000100000010000 -00001010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11101000000000000011111010000000 -00001111100000100000001111100001 -11000000111010000000000010110010 -00000000010011101000000000001011 -00100001010000101100100000000100 -00110010000000000100111010100000 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011111010000000000 -11111101001010010011011001000000 -00001011100100101000001111100100 -00000000110111010001000000111110 -01001111000011111001000100000011 -11110100010000001111010100010000 -00111111010000000000111111010000 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000000011111010000000000 -11110001010000011011101001000000 -00001111100101100000011111110101 -00000000110001010010000000110110 -01001010010011111101001000000011 -00110101000000101100110100101000 -10110010010000000000111111010000 -00000011000001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000000000100 -10111000000000000010001000000000 -00001111100000000000001011100001 -00000000100010000101000000101010 -10011000000010111000000001000010 -00000001000000001000100001000000 -00100010000000001000101110000000 -00000010100011100000010000110000 -00000000000000000000000000000000 -00001000010001011100011000010000 -10110001001000000010100001000000 -00011011000101100000001011001101 -10000000100000010000000010100100 -01000011000010110001010000100010 -00001101100000001000000100000000 -00100000010000000000101110010000 -00000010000000100000000101110000 -00000000000000000000000000000000 -00011000000100011010011000000000 -10111001000010100010001001000010 -00001010100100000001001011000100 -00000000100010010000000010100010 -01000000000010111001000010010010 -00100100000000001000100100000000 -00100010010000000000101110010100 -00000010100001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001110000000011101001000000 -00001011100100000000001011100100 -00000010100010010000000010110110 -01110000000011111001010000001011 -00100100000001001100100100000000 -10110010010000000000111100010100 -00000010001010000000010001110000 -00000000000000000000000000000000 -00101000000000011010010000000000 -01111001110000000011111001001000 -00001111100100000000001111100100 -00000000111110010000000100111110 -01001001000111111001100100000011 -11100110010100001111000100100000 -00111110111001000000111110010001 -00000011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11011000010000000010001000010000 -00001110100000000000001100100000 -00000000110100000001000000110010 -00010000001011000000011000000011 -00100000000000101110100000010000 -00110110000000000000111110000000 -10000011110010100000010000100000 -00000000000000000000000000000000 -00101000000001010011101100000000 -00001010000000000010001010100100 -00001011101000000000001000111000 -00000000111010100000000000110110 -10000000000010001110110000000011 -01111000000000001000111010000000 -00100010101010000000101111101100 -01000010110010100000000001000000 -00000000000000000000000000000000 -00101000000001010100111110010000 -10011011000000000010000011010000 -10001011001100000000011000001100 -00000001100100110000000001100000 -11000000000010000000100000000010 -00101100000000001010001010000000 -00100100001000000000101100111000 -00000010110010100000000001010000 -00000000000000000000000000000000 -10100000010000010011101000100000 -10001111001000001110000110000010 -00001011011110000000001000010000 -00000000101111110000000000100101 -11101100000010000100000010000010 -01011100000000001000011100000000 -00100001010000000000101101110000 -10000010111010000000000001000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11010111101100000010000111100010 -00001110001110000000101100011110 -00000000110101011000010100110000 -11101010000011000000100000000011 -00011110000000001110011110000000 -00110101001001000000111101111000 -00000011111010100000001000000000 -00000000000000000000000000000000 -00001000000111011000110000000000 -11111011001100000011111010001000 -00001011101101010001001111100100 -00000100111010010000000100111110 -11000000100011111000000000000011 -11101000000000001111001100000000 -00111110110010000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000010001011101111011000100 -11010111100000000011001101100000 -00001111111111000000001110111110 -01000000110011111001000010110011 -11100000000011111110100000000011 -11111110000000001111111010000000 -00110011001000000000111111111000 -00000011100000000000000001110000 -00000000000000000000000000000000 -10101000000000011001110001000000 -11010111001000000011010101000000 -00001110011100000000001000010001 -00000000100001110011000000100001 -11001000000011110110001000000010 -11010100000001001011011100000000 -10100001010000000000101101110000 -00000010111010100000010001100000 -00000000000000000000000000000000 -00000000010000001001110110010100 -10111111000000000010000101000010 -00001010001100000000001011011100 -00000100100100010000000111100001 -11000000000010110110000000000010 -11011100000000001011011100000000 -00101001100000000000101101110000 -00000010100000000000000000100000 -00000000000000000000000000000000 -00100000000101000100110000000001 -10010011000000000010010001100000 -00001010001100000000001001000100 -00000000100100010000000001100000 -11000000000010110010010000000010 -11000000000000001011001100000000 -00101000111000000000101100100100 -10000010110010000000010000110000 -00000000000000000000000000000000 -10101000000101011000110000000000 -11111111111000001011001011100000 -00001110111100000000001111101100 -00000000110110110000000000110011 -11000000000011111001000000000011 -11101100000000001111101100000000 -00111000001000100000111110111010 -00000011101010100000010001100000 -00000000000000000000000000000000 -10000000000000001110111100000000 -11111011000010000011111011010010 -00001110101100000000001110101000 -00000000111000110001000000111100 -11001100000011100001001000000111 -11100100000000001111100100000000 -00100110010000000000111110110000 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000010000 -11011111000000000011011100100100 -00000100111100000010000100101011 -00000000111111011100000000110111 -11000000000001001101100000000011 -00111000100010001110001100000000 -00110011100000001000110011110000 -00000011000000000100010000110000 -00000000000000000000000000000000 -10000001010001000110110000000000 -10000011000000010010000000110000 -00001010101100000000001000101001 -00000000101110010000000000110010 -11000000010010001001010010011010 -00100010000000001011101111000010 -00100010111000000000100000011100 -00000010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010110110010000 -10011011000000100010011011000011 -00011010001100000000001010100100 -00000000101110010000000000100110 -11000000101010101000000100000010 -00101100000001011011101111000000 -00100010000001000000100010111000 -11000010001000000000000001000000 -00000000000000000000000000000000 -00001000010001000010110000000000 -10001011000000000010001011000000 -00011010001100000000001010000000 -00000001101100010000000010100000 -11000000000010100000000000000010 -00000110000000001011001100000000 -10100010010000000000100000110000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000001010110010000000000 -11011111000000000011011000000000 -00011110111100000000101110100000 -00000000111110010000000000110111 -11000000000011101000000000000011 -00101000000001001110101100000000 -10110010100000000000110010110000 -00001011000000000000001101010000 -00000000000000000000000000000000 -10100000000110011111110000001010 -11111111000000000011111100000000 -00001111111100000000001101110000 -00000000111111010000000010111011 -11000000010011011100000000000011 -11110000000000001111111100000000 -00111111110000001010111111110000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011101000001000000 -11001111000110000011111111000000 -00011111110010000000001101110010 -00000000110001011000000000111101 -01100000000011111100001100000011 -00010000000000001100111100010000 -00110011111000000000110011110010 -00000011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110010110001010 -10001111000000000010111111110100 -00000011100000100000001000100010 -00000000000010111000010100101110 -01100000010010111000001000001010 -00100010000000001010111101010000 -00100010110000000000101000100100 -00010010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011100000100000000 -10100011000000100010110011000000 -00011011001000001100001011000000 -00000000100000110000001000101100 -01000000000110110000000100000010 -10001000000000001000001100000010 -00100000110000000000100100101001 -00000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011000000000000000 -10101011000000000010111011000000 -00001011101001100000001010101000 -10000000100010110000100000101110 -10100000010010110011100010000010 -10101010001000001010101100000000 -00100010110000000100101110111000 -00000010001100000000010001100000 -00000000000000000000000000000000 -01000000000101011110001000000000 -11101011000000000011111011000000 -00001011100110000000001111100011 -00100000110010111101000000111110 -01100000000011111000100000000010 -10100010000000001100101100000000 -10100010110000000000110110100000 -00000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011010010000000 -11011111000000010011111111000000 -00001111110000000000001101110010 -00000000111111111000000000111111 -01000001000011111000000000100011 -01010000000001101111111100000100 -00111111111001000100111011100000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010000000000000 -11101011000000000011111011000000 -00001111101101000100001111100101 -10000000111110111010000000110010 -11000000000011011001010000010011 -00100001000000101100101110100000 -00111110110010000000110000110000 -00001011000100000000010000100000 -00000000000000000000000000000000 -11001000000000010010000000000000 -10001111000000000010111111000000 -01001110101000000000001011000011 -10000000101110101100000000100010 -11100010000010001011000000000010 -00101000100000101000111100000100 -00101100111100000000110110110000 -00001010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100000000000000 -00100011000000000010110011100000 -00001011100000000000000011000000 -00000000101100110100000000100000 -11100000000010010000000000100010 -00001001001000001000101101000000 -01101100010101000000100000010000 -00000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010011011000000000 -10000111100000000010110111100010 -00001010011110000000001011011010 -00000100101101111000000000100001 -11100000000010010101100000100110 -00011110010000001000011110010000 -00101101111000000000100101011101 -00000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000000000000000000 -11100011000100000011110011000000 -00001111000000000000001111000100 -10000000101100110001000000110000 -11000000010011010000000000000011 -00001000010000001100001100000000 -00111100010000001000110000010000 -00000011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011000000000000 -11111111010000000011111111000000 -00001111111100010000001111110000 -00000000111111110001011010111111 -10000000000011101111000100000011 -11111100010000101111111101000000 -00111101110000000000111111010000 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110000000000000 -11001011010100010011111011001010 -10001111100100000000001111100000 -00000000111110110000000000101110 -11000000100011101011000000000011 -00100000000000001100101111010001 -10110000010000000000110010110000 -01000011001010100000000001110000 -00000000000000000000000000000000 -01001000000100011000010000000000 -10000111000000000010110111010000 -00001011011100000000001011010000 -00000000101101110000000000101101 -11000001000010001101000000010010 -00011000000000001010111100000000 -00100001110000000000111000110000 -00001010000100100000010001100000 -00000000000000000000000000000000 -11000000000000001001001000000010 -10000111101000000010110111100000 -00001011010110000000001011010010 -00000001101101011000000000101111 -11100000000010000111100000000010 -00010010000000001001011110000000 -00100001111000000000100001111000 -00000010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001110100000000000 -10000011000000000010110011000000 -00001011001100000010001011000001 -00000000101100110000000001101100 -11000000000010000011110000001010 -00001100000000001011001100000001 -00100000111000000000101000111000 -00000010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011011100000000000 -10001010000000000011111010000000 -00001011111000000000001111011000 -00000000111111100001100000111111 -10010010000011001110101000000011 -00011000001000101101101000000000 -00110010101000000000110011101010 -00000011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000001000000 -11110000000000000011110000000000 -00001111100000000000001111100001 -01000000111110000000000100111110 -00000010001011111000000010000011 -11100010000000001110100000000010 -00111110000001000000111010001000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11001001000000000011001001010000 -00001100100100001010001111100100 -01100000110010011000001000111110 -01101000000011000001000000010011 -00100100000000101100100111000000 -00101110011000000000111010010000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10001001000000001010001001100000 -00001010100100000000001011100101 -00100000100010010000000100101100 -01100000001010001001000000100010 -10100101000001001101100110000001 -00101110010000000010100000010000 -00000011011000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000010 -10001001000000000010001001000000 -00001000100100000000001011100100 -00000010100010010001000000101110 -01000000000010001001000000000010 -00100100010000011000100100000000 -00101100010001010000101010010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010010000000 -10000001001000000010000001001000 -01001010000100000000001011100100 -00000000100000010000000001101100 -01000000000010000001001000000010 -10000100100000001001000110100100 -00101100011000000000100010110010 -00000010010000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000101000000 -11001000000000000011001000000000 -00001000100001010100001111100000 -00000000110010000000000000101110 -00000000000011001000010100000011 -00101000000000101100100001010000 -00111110000101000100111010000101 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011111010001000000 -11111001001110000011111001000100 -01001111110100000111001111110100 -00010000111111010000000000001101 -01000000010011111101000100100010 -11010100010000001111100100010000 -00111111010000000000111111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11101001000000000011001101000010 -00001111100100000000001111110100 -00000000111110010000010000110010 -01000000000011111101001000100011 -00110100000001001100110101100000 -10100011010100000000110011010010 -00000011000001100000000001110000 -00000000000000000000000000000000 -00111000000100001110100111000000 -10001000011010000010001000010000 -00001011100000000000001011100000 -00000000101110000000000010100010 -00000000000010111010010000000011 -01100001000001001000100001000000 -00110110000000001000111110000010 -10000010100011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010000100000 -10100001010000001010000001000000 -00001011000100101001011011000100 -00010000101110010000000000100000 -01000000000010100001001111000010 -00000101000000101000000100010001 -00100010010010010000100000010100 -00001010010000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000000100 -10001001000000000010001001000000 -00001011100100000010010011100100 -00000000101110110000100000100010 -01000000010110111001000000000010 -01101100000000101000101100000000 -00100110110000000000101110010000 -00000010110001100000010001100000 -00000000000000000000000000000000 -10100000000100011110011101000000 -11101001000000000011001001000000 -00001111100110000000001111100110 -00110000111100011101000000110010 -01000010000011101001100100010011 -00100100100000001100100100000000 -00110000011000000000110010010010 -00001011011010000000010001110000 -00000000000000000000000000000000 -00101000000000011010010000000000 -01110001000000000011111001000000 -00001111100110010000001111100100 -10001000111110111000000000111110 -11110001000011110001100001000011 -11000111000000001111100100000000 -00111110011010000000111110010000 -00000011100010100000000001100000 -00000000000000000000000000000000 -00101000000100001000000100000010 -11001000000000000011001000000001 -01001111100000000000001111100000 -00010000111110000100000000111110 -00010000000011111000010000000011 -00100001000000001100100000000000 -00110010000000100000110010000100 -00000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10001010000000000010001010100000 -00001011101000000000001111111010 -00100000101110100100010000101110 -10001000100010111010000000000010 -00111001000000101101111010000000 -00111011100000000000100011101001 -10000010100010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10000011000000000010000011000000 -00001011001100000000001011001111 -10000000101100110010000001101100 -00100000000010110011100000100010 -00001100100000001000101100100000 -00100000111000000000100010110100 -00000010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001110010010101 -10000111001000000010000111010000 -00001011011100000000001010011100 -00000000101101000000010000101101 -10000000000110110111010000010010 -00010000000000001001001101000000 -00101101010000100000100001110000 -00000010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000000111001000000 -11001111111100000011000111100000 -00001011011110000000001011011010 -00000000111101011001000000111101 -10100100000011111111100000001011 -00010110000000001100010110000000 -00110001111000000010110000111000 -00001011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110110000000 -11111011000000001011111011000000 -00001111101100010000001111101100 -00000100111110000100000000111110 -10001000000011111011010000000010 -11000000000001001011100100000000 -00111000010000000000111110100000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000100000 -11001111100000000011101111100000 -00001100011110010000001110111110 -01000000111011101001000000111011 -00100000010011001101110000100011 -01111010000000001100111110010000 -00110001101000000000110011111000 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000100011001110001000000 -11010111000000000010000111000000 -00001101011100000001001000011100 -01000000100001000001110000100001 -00000001000010000101000000000010 -00010000000000101000010000110000 -00110101000010100000101011110000 -00000010101010100000010001100000 -00000000000000000000000000000000 -00000000000000001000110000000000 -10000111000000000010100101000000 -00001000111100000000011010111100 -00000001101001000000000000101101 -00000000000010000101100010000010 -00010001010000101000001100000001 -00100001010000000000100001110000 -00000010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100110100100000 -10010011000000000110000001000000 -00001001001101000000001000001110 -00000000100000001100110000100100 -00011000000010000001101000100010 -00000000010000101000100000000000 -00100100000000000000101000100100 -00000010100010000000010000110000 -00000000000000000000000000000000 -10101000000101011011110000000000 -11001111000000000011100011000000 -00001100111100011000001110101101 -00100000111010000100000000111110 -10000000000010001001100000001011 -00000001000000001100101100000000 -00110010110000000000110010110100 -00001011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001100110001000010 -11111011000000000011111001000000 -00001111101100000000001111101100 -10000000111110000000000000111010 -10000100001011111001000000000011 -11100000000000001111101101000000 -00111110010000000000111110110010 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11001111000000000011111011100000 -00001101111100000000001100110000 -00000000011111001000000000111111 -10000000000011001101000100000010 -00110100000000001000110000000010 -00110011011010000010111011110000 -00000011100000000100010000110000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10101011000000000010111001100000 -00001000001100000000001010100110 -00000000101110000100000000101100 -10000000000010001001000000000010 -00100010000000001000100011000000 -10100010010000000100101010101101 -10000010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10001011000000000010111011001000 -00001001101100000000001000101110 -00000000101110000001010000101110 -00001000000010100011000000000010 -10100010000000001010100110000100 -00100000110000001000101000000000 -00000010101000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10100011000000000010110001000000 -00001000101100000000001010000100 -00010000101100000000000001101100 -00000000000010100011000000001010 -10100000000000001010000000000010 -00100000010000000000100000000000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000011010111110000000000 -11000111000000100011111001000000 -00001101101100000000001100100100 -00000000111110000000000000111110 -00000000000011100111000000100011 -10100000000000001110100000000000 -00010010010000000000111010000000 -00000011100000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111101000000 -00001111111100000100001111010100 -00000000111101000000000000111101 -00000000000011011111000000000001 -01010000000001100101110000000000 -00111111010000001000111111000000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111101000000000 -11111111001000000011001101000100 -00001100111010000001001111111010 -00000000111111101000000000111111 -11000100000011111100000000000011 -00111000000000001100110000000000 -00110011000000000000110011100000 -00000011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110101000000000 -10111111110100000010001101000000 -00001000100010000000001011101010 -00000000101110101000000000001111 -11011000000010111010100001000010 -00101110000010001000101010000010 -00100010101000000000100010101000 -00000010101000000000010000110000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010000001001000 -00001010001100000000001011000000 -00000000101100100000000000101100 -11000100000010110001000000001010 -00000000000000001000000000000000 -00100000010000000000100000110000 -00000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010100000010000 -10111011000000000010001001000000 -00101010100000000000011011100000 -00000000101110100000000000101110 -11000000010010111011000000010010 -00101110001000001000101100000000 -00100010110010000000100010110000 -00000010101100000000010001100000 -00000000000000000000000000000000 -01000000000100011110100000000000 -11111011000000000011001001000000 -00001110100001011000001111101001 -00000100111110110100100000111110 -11000000000011111000000000000011 -00101001000000101100100100000000 -00110010000100100100110010001001 -10000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011110001000000 -10111111000000100011111001100100 -00001101110010000000001111111010 -01001000111111111001000000111111 -11000000000011111110000000000011 -11101000000000001111011100000000 -10111101101000000000111100000000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11110011000000000011111111000000 -00101100100100110000001111100101 -00100000111110110100001000111110 -11000000000011100011010000100011 -10000001000000101100101100000000 -00110010010000000000110010010101 -00000011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010111001000000 -10111111000001100010111011000000 -00000000100000000000001111101110 -10000000101110110001100000101111 -11000000000010001011000000000010 -00101000000000001000101100000010 -00110110110010001000100010010000 -00010010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100001100000000 -00110011000000000010111001000000 -00001000001011000000001011000101 -00000000101100101100000000101100 -11000000010010100000000001001010 -01000000000000001000000000000000 -10100000000000000000100000101010 -00000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010001001000100001 -10110111100000000010110101100000 -00001000010110000000001010010110 -00000000101101111000010000101101 -11100000100010000011101100000010 -01010110000000001000001010000000 -00100100111000000000100001101000 -00000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000000010000000000 -11110011000000000011110001000000 -00001100001100000000001011001000 -00000000111100100000000000111110 -11000000000011100001011000000011 -11000000100000001100000000000000 -00110000010000000000110000110000 -00001011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011000000100000 -11111111010000000011111101000000 -10001111110100001001011111111000 -00001000111111110000000000111111 -11010000010011111111001000010011 -10110100000000000111111100000000 -00111111110000000000111111110000 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110100100100000 -11011011101100000011001101001000 -00001111101001100000001111100101 -10001000111110000110000000111110 -11001000000011111000000000000011 -00111010000000001110100100000000 -00110010101000000000110010010000 -00000011001010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110010000000 -10110111001000001010000101000100 -00001011011100001000001011010101 -10100000101101010010101000101101 -11010000000010110011000000000010 -00001100000000001000011100000010 -00100001110000000000100001110000 -00000010000100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10010011100000000010000101100000 -00001011011110000000001011011110 -00000000101101001001000000101101 -11100000000010110111100000001110 -00010010000000001010001110000000 -00100000111000000000100000011000 -00000010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110101100000 -10110011000000000010000001100000 -01011011001100000000001011001100 -00000000101100010010000000101100 -11000000000010110011000000000010 -00001101000000001000001101110000 -10100000111000000010100000111001 -01001010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011010101000001000 -11011010000000000011001010101000 -00001111101000100000001111101000 -10000000111110100000100000111110 -10000000000011111110100000000011 -00111000110000101110011011000000 -00110011101010000000110011100100 -00000011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100001000000001111100010 -00000000111110000000000000111110 -00000000010011110000000100000011 -11100000000000001111100000000000 -00111110000000000000111100000000 -10000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110011010000000 -11111001000000000011111001000000 -00001111100100000000001011100100 -00000000111110011000000000111110 -01000000000011101001000000100011 -00100100000000001111100100000000 -00110010010000000000111110010000 -00000001000000100000010000110000 -00000000000000000000000000000000 -10000000000000000110111000000000 -10111001000000100010111001000000 -00001011101100001000011111101100 -00000000101110111000000000101110 -01000000000010001001100000000010 -00100100000000001011100101000010 -00110010010100000100101110010100 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000001 -10111001000000000010111001000000 -00001011100100000100001011101100 -00000000101110010010000000101100 -01000000000010101001000100000010 -00100100000011001011100100001100 -00100010010000100000101110010000 -10000010100001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001001010010010110001001000 -00001011000100000000001010000100 -00000000101100010000000000101100 -01001010000110000001001000000010 -00000100100000001011000100100000 -00100000010010000000101100010010 -00000010100000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000000000100 -11111000001000100011111000000000 -00001111100000000000001011100000 -00000000111110000000000000111110 -00001000000011101000000000000011 -00100000000000001111100000000000 -10110010000000000000111110000000 -00001011101011100000001101010000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111101001110 -00001111100100000000001111100100 -00000000111110010000000000111110 -01001010010011111101000100001011 -11110100010000001111110100010000 -00111011010001000000111111010001 -00000011011001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000010000011011001000100 -00001111100100000101001111100100 -00000001111110010000001000111110 -01011000000011111001001000000011 -00100100000000001100100100000000 -10110010010010000000110010010010 -00000011110001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000010000000010001000010100 -00001011100000000000001001101000 -00000000101110000000000000101110 -00001000000010111000000000000010 -00100001010000001000100001010000 -00100010000100000000100011000101 -00000010110011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010010001001000 -00001011000110000000001011000100 -00001000101100010000000000101100 -01011000000010110101110000000110 -00010100000000001000010110000000 -00100001011001000000100001011000 -00000010110000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000100100 -10111001000000000010001001000000 -00001011100100000000001001100100 -01000000101110010000000000101110 -01000000010010111001000100010010 -00110100000100001000110110000000 -00100011010000010001100011010000 -00000010110001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010100001000 -11110001000000000011011001000100 -00001111100100000000001111100100 -00000000101110010000000000111110 -01000000000011111001110000000011 -00100110000000001100100100000000 -00110010010100000010110010010100 -00000011111010000000010001110000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111011000010000011111001000000 -00001111100100000000001111100110 -00000000111110010000001000111110 -01000000000011110001000000001011 -11000111000000101111000100000000 -00111110010000000000111110010000 -00000011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000111111000000000 -00001111100000000000001111100001 -00000000111110000000000000111110 -00000000000011001000001000001011 -00100010000000101100100000000000 -00110000000000000000111111000000 -00000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000010000 -10111010100010000110111010000000 -00001011101011100001000011101010 -00100000101110101000000000101110 -10000000100010101010010000010011 -00101000000000001000101000000000 -00100010100000000000101110100000 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110001000000000010110011000000 -00001011001101001000001011001100 -00000000101100110100100000101100 -11000000000010000011000000000010 -01001100000100001000001110000000 -00100000110000000000101100101000 -00000010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001110000000100 -10110101000000000010110111001000 -00001011010100000000001011011100 -00001000101101110000100000101100 -11101100000010100011000000001010 -00011100000000001000011101000000 -00100001010000000000101101101100 -00000010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000001011000100000 -11110101100000000010110111110100 -00001111011110001000001111011110 -01000000111101111000100000111101 -11101010000011000101100000000011 -01001110000000001100001010000000 -10110001101000000000111100111000 -00001011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010010110000000 -01111001011010000011111011000000 -00001111100101100000001111101101 -10000000111110010000000000111110 -11000000000011111001000000000011 -11101100000000001111101000000000 -00111110000000000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11001110100000000011111111100000 -00001100111110000000001100111110 -00000000110011001000000100110011 -11100001000011001110100000000011 -00111010000000001100110110000000 -00111111111000000000111111001000 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000100011001110001010000 -11010110000000000010110111000001 -00001000010000000000001101010100 -00000000110101110000000000110101 -11000000000011010110000100000010 -00011000011010001101010100000010 -00101101010001000000101101000000 -00000010101010100000010001100000 -00000000000000000000000000000000 -00000000000000001011010000000000 -10000110000000000010110111000000 -00001000111100000000001000111100 -00000000100111000000000000100100 -11000000000010000100000000001010 -00011000000000001000010000000000 -00101101100000000000101100011000 -00000010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100010110000100 -10010010000000000010110011000000 -00001000000011000000001001000110 -00000000100100010100010000100100 -11000000000010010000011000001010 -00001001000000001001000001000000 -00101100000100000000101100010001 -00000010100010000000010000110000 -00000000000000000000000000000000 -10101000000101011010100000000000 -11001001000000000011111111000000 -00001100101000100000001100100010 -00000000110110110000000000110111 -11000000000011001011100000000011 -00000111000000001100101110000000 -00111110111000000000111110100000 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110010000000000 -11111001000000000011110011000000 -01001111101000000000001111101100 -01000000111110110010000000111110 -11000000000011111011100000001011 -11100100000000001110101110000001 -00111110011000000000111110100000 -00010011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111100000000000 -11111101000000000011101111000000 -00001101111100001000001111110001 -00000000111111110000000000111111 -11000000000011110001000000000011 -01110100001000001100111000001000 -00111111100000100000111111110000 -00000011110000000100010000110000 -00000000000000000000000000000000 -10000001000001000110011001100100 -10111001100101000010111011000000 -00001010101100000000001011101110 -00100000101110010000000000101110 -11000000000010111001000000000010 -00100100000100001000101000000000 -00101110000000001000101110110000 -00000010111000000100000000010000 -00000000000000000000000000000000 -10000000000001010010100000000000 -10111000000000000010111011000000 -00001001100100100000001011100000 -00000001101110000000000000101110 -11000000000010111010000000000010 -01100010000000001000100100000000 -00101110110000000001101110000000 -00000010111000000000000001000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110000000000000010110011000000 -00001010000010000000001011000100 -00010000101100110000000000101100 -11000000000010110010000000000010 -00000000000000001000000100000000 -00101100010000000000101100000000 -00000010110000100000000100000000 -00000000000000000000000000000000 -00000000000011010110100000010000 -11111000000000000011100111000000 -00001101100100000000001111100000 -00000000111110000000000000111111 -11000000000011111000000000000011 -01100000000100001100100000000000 -00111110100000000000111110010000 -01000011110000000000001101010000 -00000000000000000000000000000000 -10100000000111011101010000000000 -11111100000000010011111111000001 -00001111010000000000001111010100 -00000000111101010000000000111111 -11000001000011111100000000000011 -11010000000000001011110000000000 -00111111000000000000111111010000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111110010000011001111011000 -10000100110010000000001100110010 -00000000101111110000000000110011 -00001000000011101100100000000000 -01110000000000001100010010000000 -00111111001000000000111111011000 -00100011001100000000000001110000 -00000000000000000000000000000000 -10000000000000001110110000000000 -10111111010000000010001111000100 -00001010100110000000001000000000 -00001000101111110000000000100010 -10110000000010001000000000010010 -00100000000000001010100010000000 -00101100000000000000101100010010 -00000010001000000000011000110000 -00000000000000000000000000000000 -10001000000001011000110000000000 -10110011001000000010000011001000 -00001010100100000100101000000000 -00000000101100110000000000100000 -10010000100010100000000000000010 -11001000000100001000000100000010 -01101100000000000000101100100000 -10000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011110110000000000 -10111011000000000010001011000000 -00111010100110000000001000101010 -00100000101110110000000110100010 -10100010010010001000100010000010 -10101010001100001010100100000000 -00001110000000001000101110100000 -00000010001100000000000001100000 -00000000000000000000000000000000 -00000000000001011110110000000001 -11111011000000001011000011000000 -01001100000010100000001100100010 -00000001111110110000000000110000 -10000000000011101000110001000011 -11100000000000001100100000000000 -00111110001000000000101110010000 -00001011000000000000010001110000 -00000000000000000000000000000000 -11100000000100011011110000000000 -11111111000000000011111011000000 -00001101110100000000001111111000 -00000000111101110000010000111111 -10000000000011111100000000000011 -01110000000000001111110000000000 -00111111000100010000111111010000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -01001100100100011000001110100001 -00000000110010110000001000111110 -10010000010011001000010010001011 -00111000010100001110100100000000 -00111010000000100000111010100010 -00001011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111111000001000010111111001000 -10100000100111000000001000101000 -00000000101011110000000000101110 -10100000000010001000110000100011 -01101000000000001000100100000000 -00100010000010010000100010101100 -00000010001100100000000001000000 -00000000000000000000000000000000 -11000000000001000000110000000000 -10111011000000100010110011000000 -10001001001001000000001010001000 -00000000100000110000000000101100 -10001000001010001000110000001010 -00100110100000001010000010010100 -00101100110000000000101010011000 -00000010011100000000000000010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100100 -10001001111110000001001000011010 -00000001101001111010000000101101 -11100101000010001100100000100010 -01011110000000101000010010010000 -00101101111001000000100001011000 -00000010010110000000010000010000 -00000000000000000000000000000000 -01001000010110000000110000001000 -11110011000000100010110011000100 -00001101001100000000001110001000 -00000000110000110001000000111100 -10000110000011000000001010010011 -00101100100000101110000100000000 -00111100110101000000111000100000 -10000011010100100000001000010000 -00000000000000000000000000000000 -01000000000011011011110000000000 -11111111000000010011111111010100 -00001110011100000000001111111000 -00000000111111110111100000001101 -11000100000011110111000000000011 -11111000000000001111110100000001 -00110011110001000000111111101000 -00000011100100000000010001100000 -00000000000000000000000000000000 -00001000000001011110110000000000 -11111011001000000011111011010000 -00101100001010000000001100101010 -00000000110010110100000010110000 -10011010000010011000000000000011 -01100100000100001100000010000000 -00110110110000000000110010010000 -00001011000000100000000001110000 -00000000000000000000000000000000 -01001000000000011001110000000000 -10110111010010000010110111001000 -00101000010100000000001010111100 -00000000110100110010000000100001 -11000000000010001100000000000010 -00011100000000001000010000000000 -00100011110000000000110001010000 -00000010000100100000011001100000 -00000000000000000000000000000000 -00100000000000001001111000000000 -10110111101000000010110111100100 -00011000111011000000001000011010 -00000000100001111000000000100001 -10100010000010010100100000010010 -01111110000010001000010110000000 -00100101111000000001100011101000 -00000010000010000000000000100000 -00000000000000000000000000000000 -01101000000101001100110000000100 -10110011000000000010110011000000 -00001000001101001000001010001111 -00000000100110110000000000100000 -11100000010010000011000000000010 -01001100000000001000000100000000 -00100000110000000000100010100000 -00000010000110100000000000110000 -00000000000000000000000000000000 -11101000000001001010100000000000 -11111010000000000011110010000000 -00101100111011000000001100111010 -11000000110010100000000000110000 -10000000101011010110000000001011 -01111001000000101100101000000000 -00110100100000000010110010100000 -00000011001110100000010001110000 -00000000000000000000000000000000 -01001000000100001010000000000000 -11111000000000000011111000010000 -01101111100001000000001111100000 -00010000111110000000000000111110 -00000001001011111000000000010011 -10000000100001001111100000000000 -00111110000000001000111011000000 -00000011110100100000000001100000 -00000000000000000000000000000000 -00001000000100001010010000000000 -11111001000000000011111001100000 -00001100100100000000001111100100 -00000000111110010000000100110010 -11000000000011001001100000001011 -00100100000000101100100111000000 -00111110010000000000110010010000 -00000011000000100000010000100000 -00000000000000000000000000000000 -10000000000001000010010000001000 -10111001000000000010111001010000 -00101010100111100010001011100100 -00000000101110010000000000101010 -01000001000010001001100100001010 -00100110000010001010100110000000 -00101110010110000000100010010000 -00000010101000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001001000 -00001000100100100000001011100100 -00000000101010010000000100101010 -01000000000010001001000000000010 -00100100100000001000100100000000 -00101111010000000010100011010000 -00000010000011100000000001000000 -00000000000000000000000000000000 -00001000000001001000010000000000 -10110001001000000010110001001000 -00001010000100000000001011000100 -00000000001100010010001000101000 -01101001001010001001000000001110 -00000100100000001000000100000000 -00101111010000000000100001010000 -00001010100010100000010100000000 -00000000000000000000000000000000 -10111000000111010110000101000000 -11111000010100000011110010010100 -00001100100000000100001111100001 -01000000111010000101000000110010 -00000000000011001000010101000011 -00100001010010001100100000000100 -00111110000101000000110011000101 -00000011001011100000001101010000 -00000000000000000000000000000000 -10111000000111011110010000000000 -10111001000100100011111001000100 -00001111110100000000001111110100 -00000100111110010001000000111110 -01000100000011111101000000010011 -11010100010000001111110100000000 -00111110010000000000111100010000 -00000011011001100000010001110000 -00000000000000000000000000000000 -00111000000001011110010000000000 -11111001000000000011001101000110 -00001100110100000000101100100100 -00000000110010010110000000111011 -01000010000011001101010000000001 -11110100010000001100110100000000 -00110001010100000000110011010000 -00000011001001100000000101110000 -00000000000000000000000000000000 -00011000000100001110000010000000 -10111000001000100010000000010000 -10001000100000000000001000100000 -10001000100010000100010000110110 -00010000000011111000001000001010 -00101000000000101000100000000000 -00100010000010000000111100000010 -10001010000011100000011000110000 -00000000000000000000000000000000 -01001000000000001000010000101000 -10110001010010000010000001001000 -00101000100110000000001000100100 -00100000100000010011000100100000 -01000000000010001001001000000110 -11000101100000001000100110000100 -00100000010000000100100100010000 -00001010100100100000000101100000 -00000000000000000000000000000000 -00011000010101001010010000010000 -10110001000000000010001001000000 -00001000101100000000001000100100 -00000010100000010000001000100110 -01000000000010111001000100001110 -00100100000001101000100100000000 -10100010010000000000001010010000 -00000010100001100000000000100000 -00000000000000000000000000000000 -10100000000001001010010000000000 -11111001000000001011001001000000 -00001100100110010000001100000100 -01000000110010010000000000111010 -01000000000011001001000011000011 -11100111000000001100000100000000 -00110010010000000010100110010110 -00000011101010000000010001110000 -00000000000000000000000000000000 -01101000000100001010010000000000 -11111001000000000011111001000000 -10001111100110000001001111100110 -00000000111110010000010000111110 -01001000000011111001100000001011 -11100100010000001111100100000000 -00111110010000000100111110010001 -00000011010100100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11001000000000000011111000000001 -00001100100000000000001111100000 -00000000111010000000000000111100 -00000010000111001000000000000011 -00100011000000001100100000000001 -00111110000000001000110010000100 -00000011000000100000010000100000 -00000000000000000000000000000000 -00001000000001000010100000000000 -10001010000000000010110110000000 -00101000011010000001001011101000 -00000000101110100000000000101111 -10110000000010100110100000000010 -00111000000000001000111000000000 -00101111101000000000100011100000 -00000000000010100000000001000000 -00000000000000000000000000000000 -00001000000001010100110000000000 -10000011000000000010110010100000 -00001010001110100010001011001100 -00000000101000110000000000101100 -11010000000010000011100110000110 -00101110000000001010001100010000 -00101110110001000001101010110000 -01000010000010100000000001010000 -00000000000000000000000000000000 -00100000000100010001111011000000 -10000111001000000010110110010000 -00101010011100001000001011011100 -10000000101101110010010000101101 -10010000000010101111000000000010 -00011001000100001000011100000000 -00101111010000000000101001110000 -00000010001000000000010001000000 -00000000000000000000000000000000 -00101000000010001011111000000010 -11000111101100000011110110100000 -00101110011110000000001111011111 -00000000111001111011000000111100 -11100000010010000111100000001011 -00000110000000101110011110000000 -00111101111000000000111001111000 -00001011001000100000001000000000 -00000000000000000000000000000000 -00001000000101011010110110100000 -11111011000000000011111010000000 -00001101101100000000000111101100 -00101000111110110000000000111110 -10000000000011110011000000000001 -10101000000001001111101100000000 -00111110000000000010110110110000 -00000011110000100000010001100000 -00000000000000000000000000000000 -01100000000001001011111000000000 -11111111100010000011101110100000 -01001100011110000010001100111110 -00000001111111111001100000111001 -11100000010011000101100000000011 -00111010000000001100011110010000 -00110011011000000000111111111000 -00000011000100000000000000100000 -00000000000000000000000000000000 -10101000000100001001110000000000 -10110111000000100010000110000000 -00001000010100000000101000011100 -00000000111101110001000000111101 -00000010000010000100000000001010 -00111000010000001000011100000000 -00100001010001000000101101110000 -10000010001010100000011000100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110011000000000010110110000000 -00001001111101000000001000011100 -00100000101101110000000000101101 -11000000001010001101000100000010 -00010001001000001000111100000000 -00100101010000000000101101110000 -00000010000001000000000000100000 -00000000000000000000000000000000 -01000000000101001000110000010000 -10110011000000000010010010000000 -00000001000100000000001000001111 -00000000101100110000000100101100 -00110000000010000000010101000010 -00101010000000001000001100000000 -00000100000000000000101100111100 -00000010000110000000000000100000 -00000000000000000000000000000000 -10101000000001011011110000000000 -10111111000000000011111000000000 -00001101001110000000001100111111 -00000000111111110000000000111000 -11110000000011001001110000000011 -00101110000000101100100100000000 -00110110110000000100111110110100 -00000011001010100000010001100000 -00000000000000000000000000000000 -10100000000100001110110000000000 -11111011000000000011100000000000 -01001110101110000000001111101100 -10000000111010110000000000111010 -10000000000011111001000001000011 -11101000000000001111100100000000 -00111010110000000000111110000100 -00000011111001000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000000010 -11000111000000000011001111100000 -00001100110100000000001100111100 -00001000101111110000000000111111 -11000010000011011101000010010011 -00110100000000001100110110000000 -00110011111100000000110011110000 -10000011001010000000010000110000 -00000000000000000000000000000000 -10000001000001000110110000001000 -10001011000000000010001011000000 -00101000100110000100101000101100 -00000000101110110000000000101110 -10111000000010100011100000000010 -00101010000001001000000110000100 -00100010101000001000100010001101 -00000010001011000100000000010000 -00000000000000000000000000000000 -10000000000001010000110000000000 -10001011000000000010001000010100 -00001000101110000000001000101100 -00000000101110110000000000101110 -01100000000010011001100000000010 -00100010000000001000100100100000 -11100000010000000000100000110100 -00100010001000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10000011000000000010000010000000 -00001000000100000000001000001100 -00000000101100110000000000101100 -00000000000010001000000000001010 -00000000000001101000000100000000 -00100000010000000000100000000000 -00000010000000100000010100000000 -00000000000000000000000000000000 -00000000000011010111110000000000 -11001111000000001011000011000000 -00001100100100000000001100111100 -00000000111111110000000000111110 -01000000000011011001000000001011 -00100000000010001100100100000001 -00110010010000000010110000110000 -00000011001000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -10001111110000000000001111111100 -00000000111111110000000000111111 -01000000100011111100000000000011 -11110000000100001111111100000000 -00111111000000000000111111000000 -00000011111010000000000001110000 -00000000000000000000000000000000 -11000000000101011101111000000000 -11111110100000010011111110100000 -00001111111100110010001101111100 -11000000111111011000010000110001 -01100000000011001101000000000011 -00110000000001001101110010000000 -00110011101000000000110011110000 -00000011001100000000000001110000 -00000000000000000000000000000000 -11000000000010001110111000000000 -10001010100001000010111000100000 -00001011111100100000101000111100 -01000000101110010000000100100010 -00000000000010101000100000000010 -00100110000000001011100100000010 -00100010110000001100100010000000 -00001010001100000000010000110000 -00000000000000000000000000000000 -11001000000001011100110000000000 -10100011000000000010110010000000 -00001011001100010000001011001100 -00000000101100010010100010101010 -01000000000010000001000000000010 -00000000000010001001000000000000 -10100010110000000000100000110000 -00000010001100100000000101110000 -00000000000000000000000000000000 -11000000000001011010110000000100 -10101010000000000010111000010100 -00001011001100000000001010101100 -00000000101110010000000000100010 -11100000000010101000100000000010 -00101110001000000011000110001000 -00100010110000100000100000111100 -00000000001100000000010001100000 -00000000000000000000000000000000 -10000100000100011110110000000000 -11101010000000000011111010100000 -00001011101100000010001111101100 -00000000111110110000000000110000 -01101000000011001000101000001011 -00100110000000001101100110000000 -00110010110001000000110010111000 -00000001000000000000010001110000 -00000000000000000000000000000000 -11100000000000011011110001000000 -11011110000010000011111100000001 -00001111111100000100101001111100 -00000000111111110000000000011111 -11000000000011110000000000100011 -11100100000000001111111100000010 -00111111110000000000111111000000 -00000000111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11011011000000000011111011010110 -00001110101100000000001100101100 -00000000111110010000000000111110 -01010000000011001011000000000011 -00100100000000001100101101100000 -00111110110100000100110010111100 -00001011000100000000010000100000 -00000000000000000000000000000000 -11011000000001010000111000000000 -00001010000010000010111001010000 -00001011111100000000001101111100 -00000000101110010000000000101110 -11000000000010101010100000010010 -00101110000100001000101101000000 -00101100111000000000100010111000 -01100010001101100000000001000000 -00000000000000000000000000000000 -11000000000001000000110000000000 -10010010110000000010110001010000 -00001011001100000000101010001100 -00000000101110010000000000100100 -01000000000010000001000000010010 -00001110000000000010000100000000 -00101100111000000000100000110000 -00000010101110100000000001010000 -00000000000000000000000000000000 -11110000000000000011011000000001 -10000111100000000010110101100000 -00001011011110010000001001011110 -00000000101101011000010001101111 -11100000000000100111110100000010 -00011110001000001010010110000000 -00101101111000000010100011111000 -00000000101111000000000001000000 -00000000000000000000000000000000 -01001000000110000000110010100010 -11010011000000000111110010000000 -10011111101100000000001110001100 -00000000111100010000000000111100 -01000100000011000001000010000011 -00000000010000001110000100000000 -00111110110000100100110000110000 -00001011100100100000001000000000 -00000000000000000000000000000000 -11000000100111001011110000000000 -11111111000000000011111110000010 -00001111111100000000001101111101 -01000000111111010000000000111111 -11000000000011111111000001001011 -11111100000000101101110100010000 -00111111110001000000111101110000 -00000011010100000000011001100000 -00000000000000000000000000000000 -00001000000001011110110000000000 -11011010010000000011111001010000 -00001111101101110000001100101101 -11000000111110110000000000111110 -01000000010011111001100000000011 -00101100000000001111101100000000 -00111100110000000000110010110000 -00000011001010100000000001110000 -00000000000000000000000000000000 -11001000100000011001110000000000 -10000111001010100010110101001010 -00001011111100110000001000011100 -00000000111001110000000000101101 -11000000000010110101000001000010 -00011100000000001011011100000000 -00101101110000000000100001110000 -00000010001100100000010001100000 -00000000000000000000000000000000 -00100001000000001011111000000000 -10010111100100000010110111100000 -00001011011110000000101000011110 -00000000101001011000000001101101 -01100000000010110011100000000010 -01010110000000001011011110000000 -00101111111000000000100001111000 -00001010001000000000000000100000 -00000000000000000000000000000000 -01101000000101001100110000001000 -10000011000000000010110011000000 -00001011001100000000001000001100 -00000000101000010000000000101100 -11100000000010110011110100000010 -01001101001000001011001111100000 -00101100010111000000100000110000 -00000010000100100000010000110000 -00000000000000000000000000000000 -11100000100001001010101010001000 -11011010000000000011111010010000 -00001011101000000000001100101000 -00000000111010100010000000111111 -10000010000011111110110100000011 -01111001000000001111111011000010 -00111111101100000010110011100000 -00000011001110100000010001100000 -00000000000000000000000000000000 -01001000000100001010000000000000 -11111000010000010011111000010010 -01001111000000000000001111100000 -00000000111010000000000000111110 -00000010100011111000000000001011 -10100001000001001111100000010001 -00111110000000000000111110000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001010010000001010 -11001001000000000011111001000000 -00001111100100000000001100100100 -00010000111110010000000000110010 -01000000000011111001100000000011 -11100100000000001111100100000100 -00110010010000000000110000010000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000001010001000000010000000000 -10001011000000000010111011101000 -00000011100100000100001000100100 -00000000111100010000000000100010 -01000000000010111001100000000010 -11100111100010000011100100000110 -00100000010100001000110110011000 -11000010001000000000000000010000 -00000000000000000000000000000000 -00011000000000010010010000000000 -10001011000000000010111001000100 -00001011100100000000001000100100 -00010000101110010000000000100010 -01000000000010111001001000000110 -11100100010000000001000101100000 -10100010010110000100100010010001 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000010010000010000 -10000011000000010110110001000000 -01001011000100101000001000000100 -10100000101110010000000000100000 -01000000000010110001101000000010 -11000100100000001011000100000000 -00100010010000000000100100010010 -00000010000000100000000100000000 -00000000000000000000000000000000 -10111000000111010110000000000000 -11001000000000000011111000000000 -01001111100000100000101100100000 -10000001101110000000000010110010 -00010100000011111000000000000011 -11100000000000001111100001010000 -00110010000101000000110000000101 -00001011001011100000001101010000 -00000000000000000000000000000000 -11111000100111011101010000000000 -11111001000000000011111001000000 -00011111100100101001101111100100 -10100000111011010010100000111111 -01000000000011111111000100000011 -11110100010010001111110100000000 -10111111010000000000111111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -10111001000011011111010000000000 -11111001000000000011111001000000 -01001111100100101000001101100100 -11000000111110010100000000111100 -01010000000011110101001000000011 -00110100000010001111110100010000 -00111110010000000000110010010010 -00000011001001100000000001110000 -00000000000000000000000000000000 -01011001000000000110000000000100 -11101000000000000010111000000000 -00001110100000100000001010100010 -01000000101110001000000000101110 -00001000000010111000000000010010 -00100001010000001011100000000000 -00101110000010100010100011000110 -10000011000011100000010000110000 -00000000000000000000000000000000 -01001000000000000000010000001000 -10110001100000000010110001000000 -10011011000100101000001011000100 -10000000101100010000000000101100 -01001000000010110001010001000010 -00001110000000001011000100100000 -00101101011000000000100001010001 -00000010010100100000000101110000 -00000000000000000000000000000000 -00011000000101001010010010010000 -10101001000000110010111001000000 -00000010000100000000001010100100 -00000000101110010000000000101110 -01010100000010111011100000010010 -00100100010000001011101100000000 -00101101011000000010100011010010 -00000010000001100000010001100000 -00000000000000000000000000000000 -10100000100001001010011000001000 -11111001000000000011111001111001 -00000111100100000000001111100100 -00000000111110011000000000111110 -01010000000011111001110000001011 -00100110000000001111100110000000 -00111110010000000000110010010010 -00000011011010000000010001110000 -00000000000000000000000000000000 -01101010000100001010011000000000 -11111001000000100011111001100100 -00001111100100000000101111100100 -00000000111110010010000000011110 -01100000000011110001000011000011 -11100110000000001111100101000000 -00111110010000000000111100010000 -00001011110110100000000001100000 -00000000000000000000000000000000 -01101010000100001010000000000000 -11111000000000000011111000010010 -01001111100000000000101110100000 -00011000110010000000000000111110 -00000001100011001000010000000011 -00100010000000001111100000000000 -00110010000000000000110010000100 -00000011000010100000010000100000 -00000000000000000000000000000000 -10000000000001000010101000000000 -10111010100000000010111010101000 -00001011101000000000001010101000 -00010010100010100000011000101110 -10000000011010001110101001000010 -00111000000001001011101000001000 -00100010100000100000100010100000 -00000010000010100000000001000000 -00000000000000000000000000000000 -01001000000001010100011001000000 -10110011100000000010110011000000 -00001011001100000000101010001100 -00000000100000110000000000101100 -11000000000010000010010000000010 -00000100000000001011000100000000 -00100000110000000010100000111000 -00001010000010100000000001010000 -00000000000000000000000000000000 -01100001000000010001110000000000 -10110110000010000010110111000000 -00011011011100000000001010011110 -00001000000001110000010000101111 -11101000000010000101000000001010 -00010100000000001011010010000000 -00100001110000000000100001110000 -10000010001010000000000001000000 -00000000000000000000000000000000 -00101000100000000001011000000000 -11110111100000000011110111100000 -00001111111110010000101110111110 -00000000010001111000010000111101 -11110000000011000101100000000011 -00010110000000001111010110000000 -00110011101000000000110011101000 -00001011001010100000001000000000 -00000000000000000000000000000000 -01001010000101011010110000000001 -10111011011010000011111000000010 -00001111101100000010101111101100 -00000000111110110000001000111110 -11000000000011111001000000010011 -11100100000001001111000000000000 -10111110100000000000111110100110 -00000011110000100000011001100000 -00000000000000000000000000000000 -11100010010001001011111000001101 -11111111100100000010111101100100 -00001101111110001000001110111110 -00010010100011111001000001111111 -11100000000011111110100000000011 -00010110010000001100110110000000 -00110001111000000100110011111100 -00001011010100000000000001110000 -00000000000000000000000000000000 -10101001000000001001110000001000 -11100100000000000010110111010000 -00001101011100010000001000011100 -10000000100001110001000101101101 -11001000000010110101000100000010 -00010100000010001000010000100000 -00100001110000000000101001110001 -00000011111010100000010001100000 -00000000000000000000000000000000 -00010010000000001001110001000000 -10100111000000100010111101000000 -10001000011100000000001011011100 -00000100100001110001010000101101 -11000010000010110101010000000010 -00010100000010001000110100001000 -01100011100100000000100001100000 -00000010000001000000000000100000 -00000000000000000000000000000000 -01000000000101001000110001000100 -10100001010000000010110000000000 -01001001001100000000001001001100 -00000000100000110000000000101110 -11110000000010110001100001000010 -00001101000000001000000011000000 -10100000100000000000101000101101 -00000010110110100000010000110000 -00000000000000000000000000000000 -11111000000000010010011000000000 -11101001000000000011111010000000 -00001100111100000000101111111100 -00000000100011110000000000111111 -11110100000011111010010010000011 -00100110000100001100100110000000 -00110000010000000000110010010100 -00000011001011100000010001100000 -00000000000000000000000000000000 -10100100000100001110110000000000 -11101001010001000011111010010100 -00001111101100000000001110001100 -00000000111110110000000000111110 -11000000000011111001000000001011 -11100110000000001111100101000000 -00111110011000000100111110010000 -00100011111000000000000000110000 -00000000000000000000000000000000 -11000001000100001111010000001100 -11001101010010000011001111000000 -00001111101100000000101100101100 -00000000110011110000000000111111 -11000000000010101111000000000011 -11010000001000001100110100011000 -00110011000100000000110010000100 -10000011001000000000010000110000 -00000000000000000000000000000000 -10000001010000000100110000010000 -10100001010000000010101000010000 -00001110101100000000001101101100 -00001000100010110000001000101110 -11000000000010001001110000000010 -11100001001000101000100000000001 -00100010000000000000100010000000 -00000010001000000000000000010000 -00000000000000000000000000000000 -10000000010001010110110000001001 -10011011010000000010101001000000 -01001011001100000000011000101100 -00000000100010110000000000101110 -11000000000010101011100000000010 -11100100000000001000001100000000 -00100010010000000100100000010000 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001010000000000010110000000000 -10101001000000000010100011000000 -00001011001100000000101001001100 -00000000000000110000000000101100 -11000000000010100001000000000010 -11000100000000001000001100000000 -10100010110000000000100000110000 -00001010000000100000000100000000 -00000000000000000000000000000000 -10000000000110000110110000000001 -11011011000000100011101001000000 -00001111111100000000001100101100 -00000000110010110000010000111110 -11000000000011101001000000000011 -11100100000000001100100100000000 -00110010000000000010110010000000 -00000011001000000000001101010000 -00000000000000000000000000000000 -10100010000111011111110000000000 -11111101000000000011110100000000 -00001110111100000000001111111100 -00000000111111110000001000111111 -11000000000011010101000000000010 -11111100000000001101010000000000 -00111111000000000000111111000000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11000100100000000011001100001000 -00001100011000000000001100111110 -00000000111111110100000000110011 -11000000010011110100100000000010 -00111100000000001100111100111000 -00110011011000000010110011101000 -00000011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110011000000010 -10001000100000000010001010110000 -01001000100001000001001000100110 -00000000101111110111000000101011 -11000000010010111000100000000010 -00111101010000001000111101000100 -00100010110000000000100010011000 -00010010101000000000010000110000 -00000000000000000000000000000000 -10001000000001011110110000000000 -10001010000000001010000010000100 -00001000001001000000001000001100 -00000000101100110000001000100000 -11000000000010110011000000001010 -00001100000000001000001100100000 -00100000010000000010100010010000 -00001010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010010000000000 -10001010000000000010001010100000 -00001000100100000000001000101100 -00010000101110110000000000101010 -11000000000010111001110000101010 -00101100000000001000001100000000 -00100010110000000000100010011000 -00000010101100000000010001100000 -00000000000000000000000000000000 -00000000000101011100110000000000 -10001000000000000011001001100000 -00101000101000001000001100101100 -00000000111110110000000000110010 -11000000010011111000110000001011 -00101100000000001100101100000000 -00110010010000001000110000001000 -00000010000000000000010001110000 -00000000000000000000000000000000 -11100000000000011011010001000000 -11111100010010000011111111000000 -00001111111000000000001111110100 -00000100111111110000001000111111 -11000000000011111100000000000011 -11111100000000001111101100000000 -00111111111100000000111111010000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110010000000 -11111010000000000011001010100000 -00001101101000100000001100101100 -00000000111110110000000000110010 -11000000000011111011100001000000 -00101100001000001100101100000000 -00110010010000100000110010010000 -01000001000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010010100000000 -10110010000000000010000010000000 -00001000001011100000001000101101 -01000000101111110000000000100011 -11000000000010110000100000000010 -00111110000010001000111100000000 -10100010111100000010100010010010 -00000011011100100000000001000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110001000000000010010000000001 -00001000001001000100001000001100 -00000000101110110000000000100000 -11000000000010110000000010000010 -00101101000000001000001110000000 -00100010111000000000100000000000 -01000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -00110100100000000010011100110100 -01001000110010000000001000010110 -00000000101100111000000000100001 -11100000100010110100100100000010 -00011110001000011000011111001000 -00100001111001000010100001011100 -00000010010110000000000001000000 -00000000000000000000000000000000 -01001000010010000000110000000000 -11110001010000001011010000000100 -00001100001000000100001100001100 -00010000111100110001000010100000 -11000001100011110001000000000011 -00101100000000001100001100010011 -00110010110000110000110000010000 -00000011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111100000000000011100100000101 -00101110110000000000001111111100 -00000000111111110100001100111111 -11000000000011111101000000001011 -11111100001000001011111100000000 -00111111110000000010111101010000 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110110111000000 -11111001000000000011110001000000 -00001100101000000000101100101100 -11100000111110110000000000110110 -11110010000011100000000000000000 -10101100100001101100101100101000 -00111110110000000010110010000000 -00000011111010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110010100000 -10110100000000100010110111000000 -01001000011000000000001000010100 -10000000101101110110000000100111 -11010000000010000101000000000010 -00011100001000001000011101000000 -00101111110000000000101001010000 -00010010110100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111010000000 -10110100100000000010111110100000 -00001000011010000000001000011110 -10000000100001111010010001101101 -11100000010010101101100000000110 -10011110100010001000011110000000 -00101101111000000000100101011000 -00000010111100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110000001000 -10110000010010000010110010001000 -00000000001011001000001000001100 -00000000101100110000000001101100 -11000000000010000001000000000010 -00001100000000000000001100000000 -00101110110000000000101100010000 -00000010110100100000010000110000 -00000000000000000000000000000000 -11101000000101011010100000001100 -11111110000000100011111110010000 -00100000111011100000000100101000 -00000000110010100000000000111110 -10000000000011101110010000000011 -10101000000000000100101000000001 -00111110100000000000110111100000 -00000011111110100000010001100000 -00000000000000000000000000000000 -01001000010000001110000100000000 -11111000010001000011110000010100 -01001111000000000000001111100000 -00000000111110000000000000110110 -00000000000011111000001000000011 -11100000000001001111100000000000 -00111110000000000010111010000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010001000000 -11111001000000000011111001000000 -00001100100100000000101100100100 -10000000111110010000000000111110 -01000000000011111001100000000010 -01100110100000000100100100000000 -00100010011000000000100010010000 -00000011110000100000010000110000 -00000000000000000000000000000000 -10000000000001000110110100100000 -10111001010010110010111001010000 -00001000100101000000101000101110 -00000000101110010000000000101110 -01000000010010110001010000000010 -00100110000001001000100100000000 -00100010011101000010100010010000 -00000010111000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000001 -00001000100100001000001000100100 -00000000101110010000000000101110 -01000000000010111001000100000010 -11000100000000101010000100010000 -00101010010000000100101010010000 -00000010110001100000000001000000 -00000000000000000000000000000000 -00001000000001001000010000000000 -10110001000000000010110001001001 -00001000000100100000001000000100 -00000000001100010010010000101100 -01001000000010111001000000000010 -10000100100000001010000100100000 -00101000011000000001101000010000 -00000010110000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111010000000 -00101100100001010000101100100000 -00000000111110000101000000111110 -00010100000011111010000000010011 -11000001010000001110100001010000 -00111010000101000010111010100000 -00100011111011100000001101010000 -00000000000000000000000000000000 -10011000000011011110010000000000 -11111101000000010011111101000100 -00000111010100010000001111100100 -00000000111110010001000000111110 -01000100000011111101000000000010 -01100100010000001101100100010000 -10110111010000000000110111010000 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000000000011011101000000 -00001100010100100000001100100100 -00000100111110010000100000111110 -01000000000011111101000000000011 -10110100010000001100110100010000 -00110011010000000010110011110000 -00000011001001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000010010001000010100 -00001000100001101000000010100000 -00000000101110000100000000101110 -00010100000010111000000000000010 -00100001010000001000000000000000 -00100010000010100000100010100000 -00100010000011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10111001100000000010010001000000 -00001010000100010000001000000100 -00000000101100010010100000101100 -01001010010010110001000000000110 -10000100100000101000000101100100 -00100010010000000000100000110000 -00000010010000100000000101110000 -00000000000000000000000000000000 -00011000010101011010010000000000 -10111001100000000010001001000000 -00001001000100001000001010100100 -00000100101110010000000000001110 -01000000000010111001001000000010 -00100100000000001010000100000000 -10101010010000000100000010110001 -00000010010001100000010001100000 -00000000000000000000000000000000 -10100000000101001010010000010100 -11110001000001000011011001001000 -00001110100101000000001100100110 -01000000101110010000000000011110 -01000000000011110001111000000011 -10100100000100001100100100000000 -00100000010000000000110000011000 -00001011011010000000010001110000 -00000000000000000000000000000000 -00101000010000001010010000100000 -11111011000000100011111001001000 -10101110100100000000001111100110 -00010000111110010000000000111110 -01000000000011111001100010000011 -11100100000000001101100100000000 -00110110010000100000111110011000 -10010011100010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000001000000 -11111000000010000011110000010000 -01001101100001000000101101100000 -01111000111110000000010100111110 -00000000000011001000000100000011 -00000000001000001111100000001000 -00110010000000000000110010000100 -00000011110010100000010000100000 -00000000000000000000000000000000 -00101000000001000010100100000000 -10111010010001000010111110110000 -00101000111000100000001000101011 -00000000101110100000010100101110 -10000000000010001110100000000011 -01111000001001001011111001000000 -00100011101000000000110111100000 -00000010110010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110100000000 -10110011010000000010110010110011 -10101000001000000000001001001101 -00000001101100110000001000101100 -11000000000110000011000000000110 -01001111000000001011000101000000 -00100000111000000100101000110100 -00000010110010100000000001010000 -00000000000000000000000000000000 -00100000000000010001100000000100 -10110111000000000010110110000010 -00001000011000000000001000011000 -00000000101101110010000000101100 -11101000000010000110000000000010 -01011100000000000011010100000000 -10100001110000100000101101110000 -00000010111010000000000001000000 -00000000000000000000000000000000 -00101000000010000001111001000000 -11110111100100010010110010100000 -00101100011110000100001101010110 -00110000101101111010001000111101 -11101100001011000111100000000011 -01011110000000001111011110000000 -00110011111000001000111001111000 -00000011111010100000001000000000 -00000000000000000000000000000000 -00001000000011011010100000010000 -10111011010000000011111011000000 -00001110101001000000001111100000 -00000000111110110110100000011110 -11011100000011110011000000000011 -11101100000000001111100100000000 -00111110010000000000110110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -01000000000001011111111000000000 -11111111100000000011111101100001 -00001100111011010000101100111110 -00000000101111111001100000110011 -11100000000011001111100000000010 -10111010010000101100110110000000 -00110011011000000000110011111000 -00100011110100000000000001110000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110110000000010010110110010000 -10001000010000111000101000011001 -00000000101101110000000000101001 -11000000000010000110000100000010 -00111000010000001000010000000000 -00100011010000000000100001110001 -00010010111010100000010001100000 -00000000000000000000000000000000 -00000000000000001001000000100000 -10110111000100000010110001000000 -10111001011110000100001000011100 -01100000101101110000001000100100 -11000000001010000110000000000010 -10011000000010001001001100000000 -00100001010000000010100101110000 -00000010110001000000000000100000 -00000000000000000000000000000000 -01100000000101001100001000000100 -10110011011000000000110011000000 -00001001000011000000101000001000 -00000001001100110000010000101000 -11000000000000000010000000000010 -00001000000000001001000000000000 -01100010010000000010100100111101 -00000010110110000000010000110000 -00000000000000000000000000000000 -10101000000101011010011000000000 -10111011010000000011111010100000 -00100001101010000000100100101110 -00000001101111110000000001110011 -11000000000011000011110000000011 -10101000000001001101000100000000 -00100010111000000110110110110000 -00100011111011100000010001100000 -00000000000000000000000000000000 -10000000000000001110000000000000 -11111011000000000011111011100000 -10001110001000000000001111101101 -00000101111110110000000001111110 -11000000010011111011111000000011 -11101100000001001110100100000000 -00111110110101000000111010110100 -00000011111000010000000000110000 -00000000000000000000000000000000 -00000001010100001111111001000000 -11111111000000000011111110000000 -00101100111100011000001100110111 -00000000110010110000001000110111 -11000000110011001111000000100011 -01011000000000001100110110100000 -00110011110000000000100011110000 -10000011001000000000010000110000 -00000000000000000000000000000000 -10000001000001000110101000000000 -10111011000000100010110011010001 -00001000101000000010101000000101 -00000000100010110000000000100010 -11000000000010001011110010000010 -00101101010001101000100100000000 -00100010011000000000100000110100 -01001010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010010000000000 -10111011000000000010111001000000 -00001000101000000000001000100000 -00000000100000110000000000100000 -11000000000010001010100000101010 -01101001000000011000100100000000 -10100010111100000000101010111000 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000000101000000010000000000 -00110011100000000010111011000000 -00011000001000000000001000100000 -00000000100000110000000000100000 -11000000000010001000000000000010 -00001000000000011000000000000000 -00100000110000000001101010010000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000011010110000000000000 -11111011000000000011111001000000 -01001100111100000000101100100000 -00000010110011110000000010110111 -11000000000011001010000000000011 -01101000000000001100100100000000 -01110010110000000010111010110000 -00000011001000000000001101010000 -00000000000000000000000000000000 -10100000000101011111000000000001 -11111111000000000011111111000000 -00011111011000000000001111110000 -00001001111111110000001000111111 -11000000001011110110000000000011 -11110000000000001111110000000000 -00111111000000000010110111000000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111110000000000 -11001101100000000011011111001001 -00001100111100100010001100110010 -01000000110001001000001010110011 -11000000000011110100100000000011 -00010010000000001111110010000000 -00111101001000000000110011110000 -00100011001100000000000001110000 -00000000000000000000000000000000 -11000000000110001111111101000000 -10001001100000000000111111100001 -00001000111100101011001000100000 -00000000100010010000001100100011 -11010000000010111001000000000010 -10100010000000001011100010000000 -00101110100000000000101010111100 -00010010101100000000010000110000 -00000000000000000000000000000000 -11001000000001011100110000000001 -10000001000000000010010011010000 -00001000001100110001001000001000 -00000011100010100010100000100000 -11000100000010111000000000010010 -10000000000000011011000000000000 -00101100110000000000100100010100 -00000010001100100000000101110000 -00000000000000000000000000000000 -11000000000001011010110000000000 -10001001110000000010111011000000 -00001000101100000000001000101100 -00000000000010110000000000100010 -11000000000010111001000000000010 -10100011000000011011101000000000 -00101100111000000000101110011000 -00000010101100000000010001100000 -00000000000000000000000000000000 -11000000000101011110110000000000 -11001000100000000011011011000000 -00001100101100000010001100100000 -00010000110010000000000000110010 -11000000100011110001110100000011 -10100010000000001111100010000001 -00111110111000000000110100010000 -00000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011000110000000010 -11111101000000000011110011000001 -00001111111100000000001111110000 -00001000111111000000000000111111 -11000000000011111111000000000011 -11110100000000001111111000010000 -00111111110000011000111011010000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11001000010000000011111011000000 -00001100101100000000001100101000 -00000000111110000000000000110110 -11100010000011001001010000000011 -00100101001000001100100000010000 -00111110111000000000110010110000 -00000011110101010000010000100000 -00000000000000000000000000000000 -11000000000001010011111000010000 -10001001101000000000111111000000 -10001000111100000000001000101100 -00000000101100000000000000100011 -11010000000000001001011000001010 -10100101100000001000101001010000 -00101110110000000000100010111000 -10000010111100100000000001000000 -00000000000000000000000000000000 -11000000000001000100110000001000 -10000000100001000000110011000000 -00001000101100000000001001100100 -00010000101100000000000000100100 -11000000000010000001000000010010 -01000010000000001001000010000000 -00101100100000000000100000010000 -00000010111110000000000001010000 -00000000000000000000000000000000 -10111000000100000101111000000000 -10010110100000000010110111100000 -00001001001110000001101001010110 -00000000101111011000010001100000 -11100000001010000111110100000010 -11011110000000011001010010000000 -00101111101100000010100001011100 -00000010111011000001000001000000 -00000000000000000000000000000000 -01001010000010000100110000100000 -11000011000000000011110011000001 -00001100001100000000001101001000 -00000100111100100000000000110100 -11000000010011000001000000100011 -01000100000000001101001000000000 -00111100110000000000110000110000 -00000011110100100000001000000000 -00000000000000000000000000000000 -11000000000101011011110000100000 -11101111000100000011111111000000 -00001110111100011000101110111101 -01001000111111110000000000111111 -11000000000011111101000000000001 -10111100010000001010111000010000 -00111111110000000000111111110001 -00000011110100000000011001100000 -00000000000000000000000000000000 -00001000000001011110110010100000 -11011011000000000011111011010110 -00001100101101101000001100000111 -00010000110010000000000000111010 -11010010001011000001000000000011 -10100000000000001111001010001000 -00110010111000000000110000010000 -00000011001010100000000001110000 -00000000000000000000000000000000 -11001000100110011000110010000100 -10000101000000000010110111001000 -00001000001100000000101000010100 -00000010100011000000000000101001 -11011000000010000111000000000010 -00011100000000001011011000000000 -00100001110000000000101001010000 -00000010101100100000010001100000 -00000000000000000000000000000000 -00100000000000000001111010000010 -10100111100011000110110111101001 -00111000011110100000001000111010 -00000000100001001000000000101001 -11101000000010101101110000000010 -10010110000000001011111010000000 -00100011110000100010101001111000 -00000010001000000000000000100000 -00000000000000000000000000000000 -01101000000001001100110000000000 -10100011101000000110110011000000 -00001000001100000100011000001100 -00000000100000000100000001101000 -11000000000010110001000000000010 -00001100000010001011001010010000 -00100010111000000000101000110000 -00000010100100100000010000110000 -00000000000000000000000000000000 -11100000000101010110100000000000 -11101110100000100011111010000000 -00001100101000000000001100101000 -00010000110011100010000000111000 -10000000000011101110010000000011 -10111001000000001111101000000000 -10110011100100000000111010100000 -00000011001110100000010001100000 -00000000000000000000000000000000 -01001000000000011010000000010000 -10001000000000000011111000000000 -00001111100000000000001111100000 -00001000111110000000100000110110 -00000000000001001000000001001011 -11100001000000001111100001000000 -00111110000100100000101110000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001000010000000000 -11001001000000000010110001000000 -00001000000100000010011100101100 -00010000111110010000000000110110 -01100000000011001001101010000011 -00100100001010001011101110100000 -00111110010000000010010000010000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000000000110011000000000 -10001001000000000010111001000000 -00001000100100000000001101100100 -00000000101110010000000000100010 -01100000000010000001010000000010 -10100100100000001001100111000000 -00111010010100000000100010010000 -00000010001000000000000000010000 -00000000000000000000000000000000 -00111010000001010010010001000110 -10001001000000000010111001000000 -00001010100100000000101000101100 -00000000101100010000000100100110 -01001000000010001011010000000010 -00100100100000001011100101000000 -00101110010000000000101010010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00101000000101000000010010100000 -10000001000000100010110001001010 -00101010000100101000001000000100 -00000000001100010000000000100000 -01101000001110000001000000000010 -10000100000000011001000100000000 -00101000110000000000101000011010 -00001010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000010000000 -11001000000000000011111000001000 -11001110100000100000001000100000 -00000000111110000101000000110100 -00010100000011001000010100000011 -00100000000011001111100000000000 -00111110000101000000111010000000 -00000011001011100000001101010000 -00000000000000000000000000000000 -11011000100101011110010000000100 -11111101000000000011110001000000 -10000101100100101100101111100100 -10100000111111010000000000111110 -01000100000011111101000000000001 -11110100000001000111100100000000 -00111001110000000100110111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000010000011110010010101000 -11001001000000000011001001000000 -00001000100100000010001100100101 -00010000111110010000011010110011 -01011000000011001101010000000011 -00110100000000001100110100000000 -00111111010100000000110011110010 -00100011000001100000000001110000 -00000000000000000000000000000000 -01111000000110001110000100000000 -10001010000000000010001000000001 -00001000100000100001001000000000 -00000000101110000010100100100010 -00000000000010001000001000000010 -00100000000000001000100000000000 -00101110000000000000110110000100 -00000010100011100000010000110000 -00000000000000000000000000000000 -01001000000000001000010000000000 -10001001000001000010000001010000 -00001000000101001000001000000100 -10000000101100010000000000100000 -01011000000010000001000000001010 -00100100000000001010000100000000 -00101100010010000000100100010001 -00000010000100100000000101110000 -00000000000000000000000000000000 -00011000000001001010010000010010 -10001001000000000010001001000000 -00001000100100000000001000100100 -10000000101100010000000001100000 -01000000000010000001000100000010 -00100101000000001010100100000000 -00101100111000000000100110010010 -00000010100001100000010001100000 -00000000000000000000000000000000 -10100000000100011100010000000000 -11000001000000000011001001000000 -00101100100100000000101100100100 -10000000111110011000000000110010 -01000000010011001001000000000011 -00000100000000001110100100000001 -00111110010100000010110100010000 -00000011001010000000010001110000 -00000000000000000000000000000000 -01001000000000011010110000000000 -11111011100100101011110011000001 -00001111100100000010001111100100 -00000000111110011010000000111110 -01000000001011111001000000000011 -11100100000000101101100111000000 -00111110010000010010111110010000 -00000011110110100000000001100000 -00000000000000000000000000000000 -01001000000100001010000010001000 -11001000010000000011111000001000 -00001100100000000000001100100000 -00000000110010000000010000111110 -00000000000011001000000000000011 -00100000110000001111100000000001 -00111110000100000010110010000001 -00000011110010100000010000100000 -00000000000000000000000000000000 -00101000010001010010100000000000 -10001010010000000010111010100000 -00001000101000000000001101101000 -00000000100010100000010000111111 -10000000000010001110011100010010 -00111000000000001011111000000000 -00101111100000000000100011100000 -00000011100010100000000001000000 -00000000000000000000000000000000 -01101000000001010100110100000010 -10000010001000000010110011110001 -00101011101100000000001001001100 -00000000000100110000000000101100 -01000000001010000011110000010010 -00000110000000000011001100010000 -00101100111000000000100000010000 -00000010110010100000000001010000 -00000000000000000000000000000000 -10000000000100010001010000000001 -10000100000000000010110111000010 -00011011001100000001001001011110 -00000000100101110010000000001000 -01000000000010000111000000000010 -00011100000000001011011100000000 -00101101110100000000100001010000 -00000010101010000000000001000000 -00000000000000000000000000000000 -10001000100010001000011000000010 -11000110100100000011110011100010 -00101111011111110010001101011110 -10000000110101111100010000101101 -10100000000011001111100000001011 -00011110000000001111011110000001 -00111111111000000010110001011000 -00000011111010100000001000000000 -00000000000000000000000000000000 -00001010000101011010010000100100 -11111000010000000011111011001000 -00001100101100100000001111101100 -10110010111010110110000000111110 -00000000000011111001011010001011 -11101100000001001011101100000000 -00111110100000000100111110010000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000010000001001011101000000000 -11001111100100000011111100100000 -00001100111110000000001100111110 -00100000111111111100000000111111 -01100001000011101111100000000011 -00111110000100001111010110010000 -00110011011000000000110011011001 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000110001001000000000010 -10000101000100100010110100011000 -00001000011100010100101000011100 -00000000101101110001000000101101 -01000100000010000111000000000010 -00011100000100001011010100000000 -00110101110001000000100001110000 -00000010101010100000010001100000 -00000000000000000000000000000000 -00000000100000001000000000000010 -10000111010110010010110000000000 -00111000011100000000101001011100 -00000000101101110000000000101101 -10000000000010100111000000000010 -00011000011000001011010100001000 -00100011010000000000100001010000 -00000110000000000000000000100000 -00000000000000000000000000000000 -00100000000001001000000000000000 -10000001000000010010110000000000 -00011000001100000000001001001101 -10000000101100110100000000101100 -00000000000010001001110000000010 -00001011100000001011000110000000 -00100100101000000000100000110000 -00000010100010000000010000110000 -00000000000000000000000000000000 -10101000000100011010110000000000 -11001010010000000011111010000000 -00101100111100000000001101111101 -00010000111111110000000000111110 -00000000000011101001000000000011 -00001111000000001111101100000000 -00110010100000100010110010010000 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110010000000100 -11111000000000010011111010010000 -00001111001100000010001110101100 -00000000111110110010000000111101 -01000000000011111001010100000011 -11101000000000001111101100000000 -00111110010100000000111110010000 -00000011111000000000000000110000 -00000000000000000000000000000000 -00100001000100001101010000001000 -11011110000000000011110110000000 -00001100111100000000001100111100 -00000000111111110000000000111110 -10000000000011001101000010000011 -00111100000000101100111000000001 -00111111101010000000110001010000 -00000011000000000100010000110000 -00000000000000000000000000000000 -10100001010001000110010000000010 -10001000011000000010111010000000 -00001100101100000000001000101100 -00000000101110110000000000101110 -00010000000010101001100000010010 -00101011110000001000100111000000 -00100110000100000000100010001100 -10000010001000000000000000010000 -00000000000000000000000000000000 -10000000000001010010100000000000 -10001010000000000010111000000000 -00001000101100000100101000101100 -00001000101110110000000000101110 -00010000000010001011100010000010 -00101100000010001000100110001001 -00101100000000000000100010011000 -00100010001000000000000001000000 -00000000000000000000000000000000 -00001010000101000000000000000000 -10000000000000000010110000000000 -00001000001100000000111000001100 -00010000101100110000000000101100 -01000000000010100011000000000010 -00001000000001001000000100000100 -00100100010000000010100000010000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000011010110000000000000 -11001010000000000011111000000000 -00101100011100000000001100111100 -00000000111111110000001000111110 -10000000000011000111000000000011 -00101000000000001100100000000000 -00111110000000000000110010010000 -00001011000000000000001101010000 -00000000000000000000000000000000 -10100010000101011111000000000000 -11111100000000000011111100000000 -00001110111100000000001111111100 -00001000111111110000010000111111 -00000000000011111100000000000011 -11111000000010000111110100000000 -00111101000000000000111101000000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011101011000000000 -11111111000000000011001111001000 -00001101110010010001001100111110 -00000000111111110011000000110011 -11001010000011001111100000000011 -11111100111010001111111110000000 -00110011110000000000110011100000 -00000011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110010000000000 -10111011100001000010001111110000 -00001000100010000001001000101110 -00000000101111110011000000111011 -11111010010010001011100000000010 -11111101000100001011101110000010 -00101011111100010000101010101100 -00010010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011100010000000000 -10110011000000000010000011000101 -00101001001000100100001000001100 -00000000101100110000000000100000 -11000000001010000011000000000010 -11001100100000001011101100000000 -00100000110100000000100000000100 -00000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010010000000100 -10111011000000001010001011000000 -01001000100000000000101000101100 -00000000101110110000010000101110 -11000000010010001011000000000010 -11101100000000001011101100000000 -00101010110000000000101010000000 -10000010001100000000010001100000 -00000000000000000000000000000000 -01000000000101011110010000000000 -11111011000000000011001011000000 -01001101100100000000001100100110 -01000000111110110000000000110010 -11000000000010001011000000000011 -11101100000000001111001100000000 -00110010110000000000110010111101 -00000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011010000000000 -11110011000010000011111111000001 -01101111110100010000001111110100 -00001000111101110000000000111011 -11000000000011111111000111000011 -11111100000100001111111110010000 -00111111110000010000111101110000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11101011000000100011001011100000 -00001111101100000010001101100100 -01100000111110110000000000111110 -11000000000011001011000000000011 -11101100000110001111101110000000 -00111110110000000000111110010000 -10000011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10001111000001000010000111010000 -00001011100100000000001011100101 -00000000101111110000010000101111 -11000000000010001011110000010010 -11111100000000001011101100000000 -00101101110000110100101110010100 -00000010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100010000000000 -10100011100100000010000011000010 -00001011100000000000001011001101 -00000000101100110000001000101110 -11000000000010000001010000000010 -01001100000000001011000101100000 -01101100110000001000101100110101 -01000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010011011000010000 -00000111100100000010000111100000 -00001011011110000000001011011110 -01000000101101111000000000101100 -11100000001010000101100010000010 -11011110000000001011010110000000 -00101101111000000000101100111000 -00000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000000010000000000 -11100011000000000011000011000000 -00001111001000000000001111001100 -00000000111100110000000000111100 -11000000000011000001000000000011 -01001100000000001111001100010000 -00111100110000000000111100110000 -00100011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011010000000000 -11111111000010001011111111000000 -00001111111100000000001111111100 -00000000111111110000000001111111 -11000000000011101101000000100011 -11111100011000001111111100000100 -00111111110000000100111111110001 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110010000000000 -11111011000000100011001011001010 -00001011100000000000001111101111 -11000000110110110011100000111110 -11000100000011001011101000000000 -00101110100000001100100101100000 -00111110110010000000111110110000 -00000011111010100000000001110000 -00000000000000000000000000000000 -01001000000100011001010000000000 -10110111001000001010000111010000 -00001011011100000001001011011100 -10110000100001110010000000101101 -11000010000010000111011010000010 -10001100001000001000010101101000 -00101101110100100100101101110000 -00000010110100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110011100000000010000111100000 -00001011011010000001001011111110 -10001000100101111010000000101101 -11100000000010001111100000000010 -00011110100000001000011110000000 -00101101111010000000101101111000 -00000010111100000000000000100000 -00000000000000000000000000000000 -01001000000101001100111000000000 -10110011000000000010000011000000 -00001011001100000000001011001110 -00000000100000110000000000101100 -11000000000010000011100000000010 -10001100000000001000001100000000 -00101100110000000001101100110000 -00100110110100100000010000110000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011001010000001 -00001111011001000000001111101000 -00100000110110100000000000101110 -10000000000011001010101000100011 -00101000000000101100101000000000 -00111110100000000000111111100100 -00000011111110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000001000100 -11111000000000010011111000000000 -01001111100000001000001111100000 -00000000111100000000000000111110 -00000000001011111000000000000011 -11100000000000001111100001000010 -00111110000000010000111110000000 -10000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11110001100100000011001001000000 -00101100100100000000001100100100 -00000000111110010000000000110000 -01000000000011001001000000000011 -11100100000000001111100100000000 -00111100011000000000110000010000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010000001000000 -00001000100100000000001000101110 -01000100101110010000000000100010 -01000001000010001011000000000010 -11100100000000001011101101000001 -00101110010001010000100010010010 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001010000001010001001000000 -00001000101100000000001000100100 -00001000101110010000000000100010 -01000000001010001001000000000010 -11100100000000001011100101000000 -00101110010000000000100010010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001001000000010000001001000 -10001000100100000000001000001100 -00000000101100010010000000100000 -01001000000010000001000000000010 -11000100100000001011000100000000 -00101100010010000010100000010010 -00001010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000101000000 -11111000000000000011001010000000 -00001100100001010000001100100000 -00000000111110000101000010110000 -00010100000011001000000000000011 -11100001010000001111100000000000 -00111110000000000100110010000000 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011111010000000000 -11111001000100000011111001000100 -00001111110100000000101111000100 -00000000101110010001010000111110 -01000100000011110001000001000011 -11100100010000001111100100000100 -00111110010001010100111111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010001000000 -11111001000000000011001101000000 -00001110100100000000001111100100 -00010000111110010000110000110010 -01000010000011111001000000000011 -11100100010000001111100100000010 -00101111010000000000111111010000 -00100001000001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000000001000 -10111000010100000010001000010100 -01001000100000101000001011100000 -00000000101110000000000000101010 -00001010100010111000000000000010 -11000001010000001011100000000000 -00101110000000001000101110000000 -00000010000011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010010000000 -10110001000000001010000001000000 -00001010000100000100001011000100 -00000000101100010000100000100000 -01000000000010110001000000000010 -11000100100000001011000100000000 -00101100010100001101101100010100 -00000010000000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010001001000001 -00001000100100010000001011100100 -00000000101110010000000000101010 -01000000000010111001000000000110 -11100100000000001011100100100010 -01101110010000000001101110010010 -00100010000001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000011001001000000 -10001110100110000000001011100100 -00000000111110010000000000010010 -01000000000010111001000000000011 -11100100000001001111100100000000 -00111110010000000000111110010000 -00000011001010000000010001110000 -00000000000000000000000000000000 -00101000000000011010011001000000 -11110011000000001011111001000000 -01001111100100000000001111100100 -00001000111110010000010000111110 -01000000000011111001000000000011 -11100100000000001111100110000000 -00111110010000010100111110010000 -10001011110010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11001000000010000011110000000000 -00001101100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000101100100000000000 -00111110000000001000110010000001 -00000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10001010000000000010111110000000 -10001000101000000000001011101010 -10000000101110100000000000101110 -10000000000010111010001100000010 -11101000000001001000101000000000 -00101110100000000000100001100100 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10000011100000000010110011000100 -00001001001100000000001011001100 -00000000101110110000000001101100 -11000000010010110011100000000010 -11001100000000001000001100010000 -00101100110001000000100100011100 -00001010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001111011000000 -00000101010000010010110011000000 -00001000011100110000001011011100 -00000100101101110010001000101101 -11001000000010110110000000000010 -11011110100000001000011000000000 -00101101111000000000100100110000 -00000010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000011111010000010 -11000110100010000011110111100000 -00001101011110010001001111011010 -01001000111101111011000000111101 -11111010000011110111100000000011 -11011110000000001100011110001000 -00111100111000000010110101011000 -00000011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110110100000 -11111011011000000011111010000000 -00001111101100100000001111100101 -10000000111110110000000000111110 -11000000100011111010000010000011 -11101100010000001111101100100010 -00111110010000000000111010110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000000000 -10111100100100000011001101100101 -00001100111110000000001110110110 -00000000111111111000100000111111 -11100000000011111101100100000011 -11111111000000001100110110010000 -00111111111000000000101111011001 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110101000100001010000111001100 -00101000011100001000001000011100 -00000000101101110000010000101101 -11000000000010110111000000000010 -11011100000000001000010000000000 -00101101110010010000101101010011 -00001010001010100000010001100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110110000001010010000101000000 -00001000111100000000001011010000 -00000000101101110000000000101101 -11000000000010110101000000100010 -11011100000000001001010100000000 -01101101110000000000101100010000 -00100010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100110000000001 -10110011000000000010000010000000 -00011000001110100000001001000100 -00000000101100110000010000101100 -11000000000010110011000000000010 -11101100000000001001000100000000 -00101100010000000000101100010000 -00000010000010000000010000110000 -00000000000000000000000000000000 -10101000000101011011110000000000 -10111011000000000010001010000000 -00001100111100000000001011101100 -00000000101111110000001000101111 -11000000000011111011000000000011 -11111100000000001101101100000000 -00111110110000000000111110010000 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011010000000011111011000000 -00001111101100000000001100101000 -00000000111110110000000000111110 -11000000000011111000010000000011 -11101100000010001110100001000010 -00111110110000000000111110000100 -00010011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000000010 -11001011001000000011001110000000 -00001111111100000000001100111000 -00000000111111110000000010110011 -11000000000011111111000000000011 -11101100000001001100111010100000 -00111111110000000000111111010000 -00000011000000000100010000110000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10000011110000100010001010100000 -00001011101100000010001000100000 -00000000101110110000000001100010 -11000000000010111000011000000010 -11101100000001001000100000000001 -00101110011000000000101100010000 -00000011011000000100000000010000 -00000000000000000000000000000000 -10000000000001010000110000000000 -10011011000010000010001010100000 -01001011001100000100001000100100 -00001000101100110000001000100010 -11000000000010111000100000000010 -11101100000000001000101101000010 -00101110010001000000101110010110 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10000011000000000010000011100000 -10001011001100000000011000001010 -00000000101100110000000000100000 -11000000000010110000000000000010 -11001100000011001000000000000000 -00101100010000000100101100010000 -00000010010000100000000100000000 -00000000000000000000000000000000 -00000000000011010111110000000000 -11011011000000001011001010000000 -01001111111100000100001100100000 -00000100111111110000000001100011 -11000000000011111000000000000011 -11111100000000001100101000000010 -00011110010000000100111110010000 -00001011000000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -01111111000000000011110110000001 -00001111011100000000101111110000 -00000000111111110000010000111111 -11000000000011111100000000100011 -11111100000000001111110000000000 -00111111010000010100111111010000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011101110010000000 -11111101100000000011101100100000 -00001100110110000000001111110010 -00000100110011110010010000110011 -11000000000011001100010000000011 -10110000000100001100110110000000 -00110011010010000000110011110100 -00100011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001111111101001000 -10111001100000000010001001100000 -10001000100110000010001011100110 -00000000100011110101000100100011 -11010000000010001000001000000010 -10100000001101001000001100001100 -00100010010101100000101011110101 -00010010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10111011000000000000100010000000 -00001000000000000000001011100000 -00000000100000110010100000100000 -11010001000010100000000000010010 -00000100100010001000001100100000 -00100000010010000000100100110010 -00000010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000001000010001011000000 -00101000100110000000001011100100 -00000000100000110000010010100010 -11000000001010100000010000000010 -10100110000000101000101100000000 -00100010010000000000001110110000 -00000010001100000000010001100000 -00000000000000000000000000000000 -01000000000100011110110000000000 -11110001100100000011100000010010 -00001100100011001000001111100010 -00000000110010110000000000110010 -11000000000011101011010100000010 -10100010100100001100101110010001 -00100010010000000010110110011000 -00001011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111101000000000011111101000000 -00001111110000000010001111111110 -10000000111111110000000000111110 -11000000000011011001100000000011 -11110000001000001111111100000000 -10111100010000001010111001011001 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000100 -11001011001001000111111010010001 -10001111100100000000011111100000 -10000000111110110000000000111100 -11000000000011001011010000000011 -00100101000000001111101100001000 -00110010010000000000110010010000 -00001011000100000000010000100000 -00000000000000000000000000000000 -11001000000001010011111000000000 -10001011110000000010111011000000 -00001011100100000000011111001100 -00010000101111110000000000101111 -11000000000000001001111000000001 -00100100000100001011101101000000 -00110011010000001000100010011010 -00000010001100100000000001000000 -00000000000000000000000000000000 -11100000000001010100110000000001 -10000011000100000010110000000000 -00001011000100000010001011001001 -00000001101100110000000000101100 -11000001000010000000001000101010 -00100000000001001011101100000010 -00100000010000010000101000010000 -01000010001110000000000001010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10000111100000000010110100100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000001010000110100101001010 -01010010000000001011011110000000 -00100101011000000000101000011000 -00000010000010000000000001000000 -00000000000000000000000000000000 -01001000000010000000110000100000 -11000011000000000010110011000000 -00001111001000000000001011001000 -01000000111100110000000000111100 -11000110000011000001000100001011 -00000100011000001111001100100000 -10110000010010000010111000010000 -00000011000100100000001000000000 -00000000000000000000000000000000 -01000000000111011011110000100010 -11111111000000000011111111010100 -00001111111100000000001110111101 -00000000111111110000000000111111 -11000001000011111111000100000000 -10110100000000001111111100000000 -00111011010000000000110111011001 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110111010000010 -11001011000000000011110000101000 -00001100101110000000001100100001 -00000000111110110010100000111110 -11010010000011111010000001000011 -00110000000000000011101100000001 -00111110011000010000110010110010 -00000011001010100000000001110000 -00000000000000000000000000000000 -01001000000100011000110011000000 -10000111000000000010110100000000 -00001000010100000001001000011100 -00000100101101110000000000101101 -11011000000010110010000000000010 -00010100000000001011011100000001 -00101101010110000000100000110001 -00000010000100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111010000000 -10000111100000000010111111100000 -00001000111110000000101000010010 -00100000101101111001000000101101 -11101000000010110111110000000010 -00011110000000001011011110000100 -00101100010000000000100001111000 -00000010001100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10000011000000000010110011000000 -10001000001101010000001000001100 -00010000101100110000000000101100 -11000000000010111011110000000010 -00001100100000001011001110010001 -00101100010000000000100000110001 -00000010000100100000010000110000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11001010000000000011111010000000 -00101100111010000000001100101010 -00000000111110100000000000111110 -10000000000011111110100000001011 -00111001000000001111101000000010 -00111110100000000110110010101000 -01001011001110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000010011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000001111000000010000011 -11100000000000001111100000000000 -00111110000000000000111110000100 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001100000000011111011000100 -00011111100100011000001111101101 -00000000111110010000000010110010 -01000000000011111001000000000011 -00000100100000001100100110010001 -00110010010000000000110010010000 -00000011000000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001100000000110111001110000 -00001011100100000000001011100101 -00000000101110010000000000100010 -01000000000010111001000000000011 -01100111100000001101000111100000 -00100010010000000100100010010110 -00000010001000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001001000000010111001000010 -00001011100100000000001011100100 -00000000101100010000001001100010 -01000000000010111001000000000010 -00100100000000001000100100000000 -10100000011000000000100000010000 -00000010000001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010010100000 -10110001000000000010110001000000 -00001011000100000000001011001100 -00000000101100010010100001100000 -01001000000010110001001000000010 -01000100100100001001100100000000 -00100000011010000010100000010010 -00001010000000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000010000000 -11111010000000000010111000000000 -00001011100000000000001111100000 -00000000111110000111000000110010 -00010100000011111000010100000011 -00100001010000001100100001010000 -00110010000101000000110010000101 -00000011001011100000001101010000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111101000000100011111001000000 -00001111010100000000001111100100 -00000000111110010000000000111110 -01000100000011111101000100000011 -11111100010001001111110100000001 -00111111010001000000111111010001 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010010100000 -11111101000001000011111001000000 -00001111100100000010001111100100 -00000000110010010010000000111011 -01001000000011001001001001000011 -00101101000000001100000101000000 -00111110010100100000110010010010 -00000011000001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000100000000 -10111000000000010010111000000000 -00001011100000000000001011100000 -00000000100010000110100000100010 -00011010010010001000011010000011 -00100001110000001000100000100000 -00101110000100000000110111000110 -10000010000011100000010000110000 -00000000000000000000000000000000 -00001000000001011100110000000000 -10110001000000000110110001000000 -00001011001100000000001011000100 -00010000100000010001010000101000 -01000100000010010101010000000010 -01010100100000001000010100000000 -00101111010010000000100001010001 -00000010010000100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001001000010010111001110000 -00001011100110000000001011100100 -00000000100010010000010000100010 -01000000000010010011010000000010 -00011100000000000000110100000001 -00101111110000000000100101010000 -00000010010001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000011111001000000 -00001111100101100000001111000100 -00000000110010010000000000111010 -01000000000011011001000000000011 -01100111000000001100100110000000 -00111100010000000000110010010000 -00000011011010000000010001110000 -00000000000000000000000000000000 -00101000000000011010110000001000 -11111001000000000011111011000001 -01001111101100000000001101101100 -00000010111110010000000010111100 -01000000100011101001000000001011 -11100110010000101111100100100000 -00111110010000100000111110010000 -10000011100010100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000100000011001000010000 -10001111100011000000001111100000 -00000000111110000000000000110010 -00000000000011001000010000000011 -00100000000000001100100000100000 -00110010000001000000111110000000 -00000011000010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000010000 -10111110110000000010001010100000 -00001011101000000010001011101000 -00000000101110100000000000100010 -10001000000010001010010001000010 -00101000000100001000101001001000 -00100010100000000100101110100000 -00000010100010100000000001000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011110010001010010011000000 -00001011001100000000001011001100 -00000000101110110000000000100000 -11100000001010000011100010000010 -00001110000000001010001110000001 -10100000111100010000101100111100 -00000010000010100000000001010000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111100000000010010111010000 -00001011011100000000001011011100 -00000000101100110010000000100001 -11100000000010000111010000000010 -00011101000001001010111110000000 -00100001110000010000101101111100 -00000010101010000000000001000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110101100000000011010110100010 -00001111010110010000001111010110 -00000000111101111010000010110000 -11000000000011001111100000001011 -00111110000000101110011110000000 -00110001111000000000111111110000 -10001011001010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110000100000 -01110011000000000011101010001000 -00001111100101000000001111100001 -00000000111110110101000000111110 -11000001000011111011000000010011 -11101100000000001101101100000000 -00111110110000010000111110110110 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011111111100000 -00001111111010000000001111111111 -00000000111111111100000000110011 -11100001000011001101100000000011 -00110110010000001111111010000100 -00110011101000000000110011001000 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000100011001010000000100 -10110111000000000010110111000100 -00001011011000000011001011011101 -00000100101101110001000000100011 -01000000000010000111000100000010 -00011100110000001011011100011001 -00100001100001000010100001100000 -00000010001010100000010001100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110110000100000010110100010000 -00001011010001000000001011010100 -01100000101100110000000000100001 -11000100000010000001000000000010 -00010101000000001011011000000000 -00100001110000000010100001010000 -00000010000000000000000000100000 -00000000000000000000000000000000 -00100000000101001100010000010000 -10110001000001000010110000000000 -00001011000010010100001011000011 -00000000101100110000000000100010 -01000000000010000011000000000010 -00000100000000001011101010000000 -10100010110000000000100000110000 -00000010000010000000010000110000 -00000000000000000000000000000000 -10101000000101011010000000000000 -11111001000000100011111001000000 -00001111101101000000001111101010 -00000000111111110000010010110010 -11000000000011001010000001001011 -00101000000000001111100100000000 -00110010010000000000110010110000 -00000011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110100000000100 -11111000010000000011111001000000 -00001111101100000000001111101101 -00000000111110110000000000111110 -11000000000011111011010100000011 -11101101000000001111100100000000 -00111110010100000010111100110100 -00000011111000000000000000110000 -00000000000000000000000000000000 -00000001000100001101001000000000 -11001101000000110011111100110000 -00001111111100000000001111110000 -00101000111111110000000000111111 -11000000000011000110101000000011 -00111000000000001100110100010000 -00110010110000000000110010111000 -00000011000000000100010000110000 -00000000000000000000000000000000 -10000001000001000110101000010000 -10001000100000000010111000100000 -00001011101110000100001011100000 -00000000101110110000000000101110 -11000000110010001011010000001010 -00101001000000001000100100000000 -00100010111101000000101010111000 -00000010001000000100000000010000 -00000000000000000000000000000000 -10000000000001010010000001000010 -10001001110000000010111011000000 -00001011100000010001001011101000 -00001000101110110000000000101110 -11000000000010001000000000000010 -00000000000010101000101000000000 -00100010000000001000100010000110 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000000001000000001000000000 -10000001000000000010110011000000 -00001011000000000000001011001100 -00001100101100110000000000101100 -01000000000010000000000000000010 -00001100000000001000001100000000 -10100000000000000000101000000000 -00000010000000100000000100000000 -00000000000000000000000000000000 -00000000000011010110000000000000 -11001000000000000011111000000000 -00001111100000000000001111100000 -00000000111111110000000000111110 -11000000000011001000000000000011 -00100000000000001100000000000000 -00110010000000000010110010000000 -01000011000000000000001101010000 -00000000000000000000000000000000 -10100000000111011111000000000000 -11111101000000000011111100000001 -00001111110000000000001111110000 -00000000111111110000010000111111 -01000000000011111100000000000011 -11110000000000001111110000000000 -00111111000000000000111111000000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000111101111010000 -00001100011100100000001111111100 -00000000010011111000000000111111 -11001000010011001111001100000011 -00111110000000001111111110000000 -00110001111000000000110011011000 -01000011011100000000000001110000 -00000000000000000000000000000000 -10000000000100001110110000000000 -10111111110000000010001011010100 -00001000111111010000001011111101 -10100000101010111000010000101111 -11000100000010000111001000000010 -10100110000101001011101110000001 -01101010111000000000101010011000 -01010010001100000000010000110000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000100000010100011001000 -00001000001100000100000011001101 -00000000100000010000000000101100 -11001010000010000011001100010010 -00001100000000001011101100000000 -00100100110000000000100000010000 -00000010011100100000000101110000 -00000000000000000000000000000000 -11000000000101011010110000010000 -10111011000000000010000011000000 -00001000101100000000001011101100 -00001000101010010000000000101110 -11000000000010001011000000000010 -10100100000000001011101100000000 -00101110110000100000101010010000 -00000010001100000000010001100000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111011000000000010101011000000 -01101000101100000000001111101100 -00000000110010110000000000111110 -11000000001011001011000000000011 -00101110010001001111001100000000 -00100110110100000000110010011000 -00000011010000000000010001110000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111011000000 -00001111111100001000001111011100 -00010000111111111001010000111101 -11000000000011110111000000000011 -11110100000100001111111110010000 -00111011011100000000111111011001 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11110011000000000011001011000001 -01001110101100000000001100101100 -00000001110010010000100000111110 -11000000001011001011000000000011 -10101110000000001111101100001000 -00111110110000000000110010010000 -00000011110101000000010000100000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111111011000010010001111000000 -00001000111101000000001000111100 -00000000101010010000000000101111 -11000000010010001111000000000010 -00100100000000001011101111000000 -00101100110000100000110100011000 -00000010111100100000000001000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011100010000010000011000001 -00101010001110010000001000001100 -00000000101000111100000000101100 -11000000000010000011000000000010 -00001100100000001011000101010000 -00101100110000000000100000011001 -00000010111110100000000001010000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010000111100000 -00001000011110000100001000011110 -01000000101001111000100000101100 -11100000000010000111100000000000 -00011110000000001011011110000000 -00101111111000000000100101011000 -00000010111111000000000001000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011000011000000 -00001110001100000000101100101100 -00000000100000110000001000111100 -11000000000011000011000000000011 -00001100000000001111000100000000 -00111100110000000000110000010000 -00000011110100100000001000000000 -00000000000000000000000000000000 -01000000000111011010110000000000 -11110011000000001001111011000000 -00001111101101000000001111101100 -00000000010110110000000000111110 -11000010000011111011000010000011 -11101101001000001111101101001000 -00111110110000000000111110010001 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011010000000011111011000000 -10001001001101010000001110101111 -01000000110010110011100000101110 -11010010000011111011010000000011 -11101101000000001011100101000000 -00111100110000000100110110010000 -00000001111010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111010010000010110111001000 -00001000011100000100001000001100 -10100000101001110000000000101101 -11000000000010110111001010000010 -11011100000000001011011100000000 -00101101100000000000100001110000 -00000010111100100000010001100000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110011101100 -00001001011110100110001010011110 -00000000100001111000000000101101 -11101000010010110111100000100010 -11011110100000001011010110000001 -00101011111000010000100101011000 -00000010111000000000000000100000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010111011000000 -10001000001100000000001000001100 -00000001101000110000000000101100 -11000000000010111011000000000010 -11001100000001001011001100000000 -00101100111100100101100000111000 -00000010110100100000010000110000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001101101000000000001110101000 -00000000100010100000000100111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111011100000100000110110101010 -00000011111110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111000000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100001000100 -00111110000000000000111110000000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001100100100000000101100100100 -00000000111110011000000000111110 -01000000000011001001000000000011 -00100100000000001100100100010000 -00111110010000000010110010011000 -00000011110000100000010000110000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001010000000010111001000000 -00011000100101000000001000100100 -00000000001110111001000000101110 -01000000010010001001000000000010 -00001100000000001101101101001000 -00101100010000000100100010010000 -00000010111000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -01101000100100000000001000100100 -00000000001110010100000000101100 -01000000000010101001000000000010 -00100100000000001000100100000000 -00101110010010000000100010010001 -00000010110001100000000001000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001001000000010110001001000 -00001000000100100000001000000100 -10000100101100010000000000101100 -01001000000010100001001000000010 -00100110000000001001000100000000 -00001110010000000000100000010000 -00000010110000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000101000000 -11111010000000000011111000010100 -00001000101000000100001100100001 -01000000111110000000000000111110 -00010100001011101000010100000011 -00100000000000001100100000000000 -00111110000000000000110010000000 -00000011111011100000001101010000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000100000010111001000100 -00001111100100010000001111100100 -01000000111110010000000000111110 -01000100000011011001000100001011 -11100100000000001111100100000100 -00111111010000000100111111010000 -00000011111001100000011001110000 -00000000000000000000000000000000 -00011000000001011110010001000000 -11001101000000000011101001000100 -00001101110100100000001111100100 -10000100110010010000000100111110 -01001001000010111001010000000011 -11100100000100000011100100000000 -00111111010000000000110001010000 -00000011111001100000000001110000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10001000010100000010001000010100 -00001000100001000000001011100000 -00010000100010000000000000101110 -00011010000010111000000001000010 -11100000000000001011100000000000 -00101110000000000000101010000000 -00000010110011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010010000000 -10000001000000000010100001001000 -00001000000100010000001011000101 -10100000100000010000000000101100 -01000100000010110001010000000010 -11000100000000001011000100000000 -00101110010000000000100000010000 -00000010110100100000000101110000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10001001000000000010001001000000 -01001000100100000000001011000100 -00000110100010010000000001101110 -01000000000110111001000000000010 -11100100000000001011100100000000 -00101110010000000001101010010000 -00000010110001100000010001100000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11001001000000000011101001000000 -00001100100100000000001111100100 -00000000100010011000000000111110 -01000000100011111001000000000010 -11100100000000001111100100000000 -00111110011001100000110010010000 -00000011111010000000010001110000 -00000000000000000000000000000000 -00101000000000011010010000000010 -11110001000000000010110001000000 -00101110100100001000001111100100 -00000000111110010001000000111110 -01000000000011111001000001000011 -11100100000000001111100100001000 -00111110011000000000111110010000 -00000011110110100000000001100000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000001 -00000000100000000001001111100000 -00000001111110000000000100111110 -00000000001011001000000000000011 -11100000000000001111100000000100 -00111110000000000000110010000000 -00000011100010100000010000100000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111110000110000010111010000000 -00001000111000000000001011101000 -00000000101110100000100000101110 -10000000000010001010000000000010 -11101000000000001011101000000000 -00101100100000000000110110101000 -10000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010110110000000000 -10110011000000000010110011000000 -00101000001101010000001011001100 -00000000101100110000000000101100 -11000000000010010011000000000010 -11001110000000001011001100000000 -00101100111000000000100100110000 -00000010100010100000000001010000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110110000000000010110011001000 -00001000011100000000001011011100 -00000000101101010000000000101101 -11100000000010010111001100000010 -11010000001000001011011100000000 -00101111110000110000100111111000 -01000010001010000000000001000000 -00000000000000000000000000000000 -10101000000010000001111100000000 -11110111100000000011110111100000 -01001100011110000000001111011110 -00000000101101101000001000111111 -11100001010011010111100100010001 -11011110001001001111011110000000 -00111101111000000000110101111000 -00000011101010100000001000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111010000000000011111011011101 -01001111101000000000001111101100 -00000100111110110110100000111110 -11010000000011101011000000000001 -11100000100000001111100001101000 -00111100010000000000111110110000 -00000011110000100000011001100000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011101111110000 -10001100111010010000001111111111 -00100000111111111001000000110011 -11110010000011111111100001000011 -11111110000001001111111010000000 -00111111111000000000110011111000 -00000011110100000000000001110000 -00000000000000000000000000000000 -10101000000100011001110001000000 -10110101000000000010000111000100 -00001000010100000000001011011100 -00000000101101010000000000101001 -11000100000010110111000000000010 -11010000000000001011011100010000 -00101101110001010000101001110001 -00000010111010100000010001100000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110110000000000010100111000000 -00101000011000000000001011011100 -00000000101111000000000001100001 -11000000000010010111000000000010 -11011100000000001011011000000000 -00101111110000000000100001110000 -10000010110001000000000000100000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110000000000000010000011000000 -00001000000000000000000011001100 -00000001101100010000000001101000 -11000000000010110011000000000010 -11000000000000001011000000010000 -00101100010100000000101000111000 -00000010110110000000010000110000 -00000000000000000000000000000000 -10101000000101011011110000000000 -11111001000000000011101111000000 -00000100100100000000001011111100 -00000000111110110000000000110011 -11000000000011011111000000000011 -11101110001000001111100110000000 -00111100111100100001110010110000 -00000011111010100000010001100000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111000000001000011111011000000 -00001111100100000000001111101100 -00000000111110000100000000111110 -11000000000011110011000000000011 -11101100000000001111100100000001 -00111110110010000000111110110000 -00000011111001000000000000110000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111101100000000011110011000000 -10001100010100000000101100111100 -00000000111111100000000000111111 -11000000000011111111000000000011 -00111000000000001111111111000000 -00011111110010000000110011111000 -00000011111000000000010000110000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111000100000000010111011000001 -01001000100000000000001000101100 -00000000101110100000010000101110 -11000000000010111011000000000010 -00101000011001001011100010000000 -00101110011000000000100010111001 -00000010111000010000000000010000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000100000010111011000000 -00001000101000010000001000101100 -00000000101010110100000000101010 -11000000010010111011000000000110 -00100100000000011011100000000000 -00101110010000000000100010110000 -00100010111000000000000001000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110001000000000010110011000000 -00101000000100000000001000001100 -00000000101100000000000000101100 -11000000000010110011000000001000 -00000100000000011011000100000000 -00101110010000000000100000110000 -00000010110000100000000100000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111010000000000011111111000000 -00001100101000000000011100111100 -00000000111010000000000000111011 -11000000000011111111000000000011 -00100000000000001111101000000001 -00111110010000000010110010110000 -00000011111000000000001101010000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11110100000000000011111111000000 -00000111110000000000001111111100 -00000000111101000000000100111111 -11000000000011111111000000000010 -11110000000000001111110000000000 -00111101010000000000111111010000 -00000011111010000000011001110000 -00000000000000000000000000000000 -11000000000001011111001000000000 -11111100100000100011001100100001 -00001100110010000000001111010110 -00010000110011011000000000110001 -01100000100011001100100000000011 -11110000000000001100110000000000 -00110011110001000000110011101000 -00010011001100000000000001110000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000100010001000100000 -00001000101010000000001011100110 -00000000100010000000000000100010 -01000000000010001010100000000010 -11101010000000101000100100000000 -00101011110000001000100010101000 -00000010001000000000010000110000 -00000000000000000000000000000000 -10001000000001011100000000000001 -10110000000000000010000000100000 -00001000000000000000011011000000 -00000000100010000000000000101000 -01000000001010000010000000100010 -11000100000000001000000000000000 -00100000110000000010100000100000 -00001010001000100000000101110000 -00000000000000000000000000000000 -11000000000101011010110000000001 -10111011000000100010001000000000 -01001000101000000000001011100010 -00000000100010011000000000101010 -11000000000010001010100000000010 -11100100000000101000100000000010 -00101010110000000010100010100000 -00000010001100000000010001100000 -00000000000000000000000000000000 -00000000000100011110000100100000 -11111000000000000011001001000000 -01001100100100000000001111100010 -00000000110000011010000000111000 -01000000000011001000110000000011 -11100000100000101100100010010000 -10110010110000000000110000101001 -10000011000100000000010001110000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111110000010100011111100010000 -00001111111000000010001011110100 -00000000111111010000001000110111 -01000000000011111100000000000011 -11101000000000001111011100000000 -00111110110000010000111111110000 -00000011111110000000000001100000 -00000000000000000000000000000000 -01000000000100001010000001000000 -11111001000000000000111011000000 -00001111100101000010001111100100 -11000000110010000000000000111110 -11001000000011001000011000000001 -11001101000001001100100100100000 -10110000110000000010110010110100 -10000011110100000000010000100000 -00000000000000000000000000000000 -11001000000001010010111000010000 -10110011010000010010110010110100 -01001011101000000000001110000100 -00000000100010010000000000001110 -11010000001010001000001000000010 -11101111001000001000101100000000 -00100011110111000010100010111100 -10000010111100100000000001000000 -00000000000000000000000000000000 -11100000000001010100001000000000 -10110000100000000010110010010001 -00001011000000000000001011000101 -00000000100000010000000000101100 -01010100000010000000010000000010 -11000001001000001000001001000000 -00100000110000000000100000001000 -00000010111110000000000001010000 -00000000000000000000000000000000 -01100000000000010001101000000001 -10110111100101000010110111100010 -00001011011110000000001010111110 -00000000100001101000001000101101 -01100100000010000110100000000010 -11011010000000001000010110011000 -00100001111001000000100001001000 -00000010110010000000000001000000 -00000000000000000000000000000000 -01001000000010000000000000000000 -11110000000010000011110010000000 -00001111000001000000001111001100 -00000000110000110000000000111100 -01000100000011000010010100000011 -11000000000000101100101000010001 -01110000110001000100110000100000 -01000011110100100000001000000000 -00000000000000000000000000000000 -01000000000111011011100000000000 -11111111000000000011111111010000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000100000010111110000000000011 -11110000000000001111110000010000 -00111111110001100000111111100100 -00000011110100000000011001100000 -00000000000000000000000000000000 -10101000000001011110010000000000 -11110000110000000011001001001000 -00001111000111100000001100101000 -00000000111110110000000000110010 -01000000010011001000000000000011 -11100100000000101100101000000000 -10110000110010000000110010010110 -00000011111010100000000001110000 -00000000000000000000000000000000 -01001000000100011001110001000000 -10110110000100000010000101000000 -00001011011100001000001000011100 -00000000101111010000000000110111 -01000000000010000110000000000010 -11011100000000001000011100000000 -00100001110011000000100001010000 -00000010110100100000010001100000 -00000000000000000000000000000000 -11000001000000001001011000000001 -10111101100000000010100111110000 -00001011110110000000001001010110 -00100000101101111000000000100001 -11100000000010000110110000000010 -11001110000000001010001110000000 -00100001111010000000100001111000 -00000010111100000000000000100000 -00000000000000000000000000000000 -01001000000101001100110100000000 -10110011000000000010000011000000 -00001011001100000000001001001100 -00100100101110111111000000100100 -11100000000010000011100000000010 -11001110010000001010001101110000 -00100000110000000000100000110000 -00000010110100100000010000110000 -00000000000000000000000000000000 -11101000000101011000100100000000 -11111010010000000011101010000000 -00001111101001000000001101111010 -00000000111111100100000000110010 -10101000001011001110100000000011 -11111001000010001110111011000000 -00110010100000000000110010100100 -00000011111110100000010001100000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000010001011111000110000 -00001111100000001000101110100001 -00000000111110000000000000111110 -00000000001011111000000000000011 -11100000001000000001000000000000 -00111110000000000010111110001000 -00000011110100100000000000110000 -00000000000000000000000000000000 -00001000000100001110110000100000 -11011011010000000011111011000000 -00001111101110000000001111100100 -01000000101110010000000000110010 -01000000000011001001000010000011 -11000110100000001100100100000011 -00110000010000001000110010111000 -00000011110000100000010000110000 -00000000000000000000000000000000 -10000000100001000110010000000000 -10001001010000000010111001011000 -00001011100110000000001011100111 -00000000101110010000001000100000 -01100000000010001001000000000010 -11100110000000101000100101000010 -00100010010000000010100010011100 -00000010111000000000000000010000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10011001000010000010111001000100 -00001011100100100000001011101100 -00000000101110010000000010100010 -01001000000010001001001001000010 -11100101000000001000100101000000 -10100010010000000000100010010010 -00000010110001100000000001000000 -00000000000000000000000000000000 -00001000000001000010010000000000 -10000001000001000010110001000000 -00001011000100000010011011000100 -00000000101100010000000000100010 -01000000000010000001000000000010 -11000100100000101000000100100000 -00100000010010000000100000011000 -00000010110000100000000100000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11011000000000000011111000000000 -00001111100000000000001111101000 -00000100111110000101000000110010 -00010100000011001010000000010011 -11100000000000001100100001010000 -10110010000101000000110010000000 -00100011111011100000001101010000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111110100 -00000000111111010000000000111111 -01000000001011111101000000000011 -11110100010000001111111100010000 -00111110010001000010111111010000 -00000011111001100000011001110000 -00000000000000000000000000000000 -10011001000101011100010000000000 -11111101000000010011111101000000 -00001100100100000000001111110100 -00000000111110010100000000111101 -01000000000011000101000000000011 -00110100001000001100110100000000 -00110011010110100100110010010000 -00000011110001100000000001110000 -00000000000000000000000000000000 -00111001000110001110000000010000 -10111000000000100010111000000000 -10001101100000000000001011101000 -00001000101110000000001000101110 -00000000000010001000000000000010 -00100000000000001000000001100000 -10100010000100000010101010000000 -00000010110011100000010000110000 -00000000000000000000000000000000 -00001000000001011100010000001000 -10110001000000000010111001000000 -00001000000100000010011011000100 -00000000101100010010000000101100 -01001010000010000001100000011010 -00000100000000101000000101001000 -10100000010000000010100000010000 -00000010110000100000000101110000 -00000000000000000000000000000000 -00011000000001011010010000000000 -10111001010000000010111001000000 -00001001100100000000011011100100 -01000000101110010010000100101110 -01001000001010001001000000000010 -00100101000000001000100100000010 -00100010010000000000101010010010 -10000010110001100000010001100000 -00000000000000000000000000000000 -10100000000101001010010000000000 -11111001010000100011111001000001 -00001100100100000000001111100111 -00000000111110010010000000111110 -01000000010011000001010000000011 -00100110000001001100100101000000 -10110010010000000010110010010000 -00000011111010000000010001110000 -00000000000000000000000000000000 -00101010000000001010110000001100 -11111001000000000011111001001000 -00001111101100000000001011100100 -00010000111110011000000000111110 -01100000100011111001001000000011 -11100111000000001111100100001010 -00111110010000000000111110110000 -00000011110010100000000001100000 -00000000000000000000000000000000 -00101010000100001010000000000000 -11001000001000000011111000000000 -00001111100000000000001111100010 -01000000101110000000000000111110 -00000000000011001000000010000011 -00000000000000001111100001000000 -10110000000000000010110010000000 -00000011000010100000010000100000 -00000000000000000000000000000000 -10100000100001000010100000000000 -10001110000000000010110110101000 -00001011101000000000000011111000 -00000000101110100000000000101111 -10100010001010001110010010001010 -00111010010000001011111011000000 -00100011100000001000110110100000 -00000010000010100000000001000000 -00000000000000000000000000000000 -00101000000001010100111001000000 -10000011000000000010110011100010 -01001011001110010000000011001100 -00000000101100110000000000101110 -11100000000010000011010000000110 -00001000010101001011101110000000 -00100000001000000000100000110010 -00100010000010100000000001010000 -00000000000000000000000000000000 -01100001000000010001111000000000 -10000101010000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -01000000000010001111000000000010 -00011100000000001011011101000000 -00100000010100000010100111111000 -00000010001010000000000001000000 -00000000000000000000000000000000 -00101000000010000001111000000000 -11000111100000000011110111100000 -00001111011110000000001111010110 -00000000101101111010001000111101 -11100000000011000111100000000011 -00011110000000001111011110000000 -00110001001000000010110001001000 -00001011001010100000001000000000 -00000000000000000000000000000000 -01001000000111011010110000101010 -11111010000000100011111010000000 -10001111101100000000001111101100 -00000000111110110000000000111110 -01000000000011111001000000000010 -11101100000000001111101000000000 -00111110010000000000111100000000 -10000011110000100000011001100000 -00000000000000000000000000000000 -11000000000001011111011000000000 -11111111100100000011111101100100 -00001111110111010000001111111110 -01000000111111111000100000111111 -11100000000011001111100000000011 -11111110010000001100111010000000 -10110011101000001000110011111000 -00000011000000000000000001110000 -00000000000000000000000000000000 -10101000000000011001110100000000 -10110111000000000010110111000000 -10001011010101000000001011011000 -00000000001101110000000000101111 -11000000000010000111000000000010 -11011100000000001101010100000000 -00110101010000000000101001110000 -00000010101010100000010001100000 -00000000000000000000000000000000 -00011001000000001001010000000000 -10110111000000010010110111000000 -00011011010100000001001011011100 -00000001101101110000000000101101 -11000000000010100110000000000010 -11001100001010001001011000000000 -00100001100000000000100001000000 -00000010000000000000000000100000 -00000000000000000000000000000000 -01100010000101001100110001001001 -10110001111000000010110000010000 -00001011000100100000001011000100 -10000001100100111100000000101100 -11000000000010100000010000000010 -11001110000000001001000000100010 -00100100010000000000101000000000 -10000010100010000000010000110000 -00000000000000000000000000000000 -11111000000101011010100000000000 -11111001000000000011111001000000 -00001111101010100000001111100101 -00000000111111110000000000111110 -10000000001011101011000100000011 -11001110000000001101100101000000 -00110010000000000000110010000000 -00100011001010100000010001100000 -00000000000000000000000000000000 -10000000000000001110000100100000 -11111001010100000011111001010000 -00001111101001000000001111100101 -01000000111110110011000000111110 -01010100100001011010100000000011 -11101101000000001111001100010000 -00111110000100000000111110100100 -00000011111000000000000000110000 -00000000000000000000000000000000 -11000001000100001111101000000000 -11111101000000100011111101000010 -00001111110000000000001100110000 -00000000111111110000000001111111 -00000000000011001111000100000011 -11111100000000001100110110010100 -00110001000000000000110011000000 -00000011000000000100010000110000 -00000000000000000000000000000000 -10000001000001000110001000000000 -10111000110001000010011001100001 -00001011000000000000001000100110 -10000000110010110000001001111100 -01101000001010001000011000000010 -01101111100000001000101010000010 -00100010000100001000100000000000 -00000011001000000100000000010000 -00000000000000000000000000000000 -10000000000000010110000001000000 -10111000110000000010111000100010 -00001011101000100000101000100110 -00000000101110110000010000101110 -10100000000010001001000000000010 -11100110000001001000100000000000 -00100010100000100000100010000110 -00000010001000000000000001000000 -00000000000000000000000000000000 -00001000000000000000000000000000 -10110001000000000110010001000000 -00001011001000000000001000000000 -00001000101000110000001000101000 -11000000000010000000000000000010 -01001100000000001000000100000000 -10100000000000001100100000110000 -00000010000000100000000100000000 -00000000000000000000000000000000 -10000000000000000110000000000000 -11111000000000000011111000000000 -00001111100000000000001100100000 -00000000111110110000000000101110 -00000001000011001000000000000011 -11101100000001001100000000000000 -10110000100000000100110010000000 -00001011000000000000001101010000 -00000000000000000000000000000000 -10100000010110011111000000010000 -11111101000000000011011101000000 -00001111110000000000001111110100 -00001000110011110000000000111111 -01000000000011111100000000000011 -01111100000010000111110000000000 -00111111000000000000111101000000 -00000011101010000000011001110000 -00000000000000000000000000000000 -00000000110001010100000100000011 -01110000010000001001110001010000 -00000111000001000000110111000101 -00000001011100010100000011011100 -00010000001101110000010000001101 -11000101000000110111000101000000 -11011100000100000011011100000100 -00001101110000000011000100000000 -00000000000000000000000000000000 -00000000110001010100010000000101 -01110001000000010101110001000000 -01110111000100000001010111000100 -00000101011100011000000101011100 -01000000010001110001000000010101 -11000100000001010111000100000001 -01011100010000000101011100010000 -00010101110000000011000101010000 -00000000000000000000000000000000 -00000000100000000000001000000001 -00100000100000000100100001100000 -00010010000010000000010010000110 -00000001001000001000000001001000 -00100000000100100000100000000100 -10000010000000010010000110000000 -01001000001000000001001000001000 -00000100100000000010000000000000 -00000000000000000000000000000000 -00000000100000000000000000000001 -01100000000000000101100000000000 -00010110000000000000010110000000 -00000101011000010000000001011000 -00000000000100100000000000000101 -10000100000000010110000000000000 -01011000000000000001011000000000 -00000101100000000010000000000000 -00000000000000000000000000000000 -00000000110001010100100000000101 -01110010000000010101110010000000 -01010111001000000001010111001001 -00000101011100100000000101011100 -10000000010101110011000000010101 -11001010000001010111001000000001 -01011100100000000101011100100000 -00010101110000000011000101010000 -00000000000000000000000000000000 -00000000110001010100000000000000 -01100000000000000001100001000000 -00000110000000000000000110000010 -00000000011000000000000000011000 -00000000000001100000000000000001 -10000000000000000110000101000000 -00011000000000000000011000000000 -00000001100000000011000100000000 -00000000000000000000000000000000 -00000000110001010100100000000100 -00100010000000010000100000100000 -01000010001000000001000010000100 -00000100001000100000000100001000 -10000000010000100011000000010000 -10001000000001000010001110000001 -00001000100000000100001000100000 -00010000100000000011000100000000 -00000000000000000000000000000000 -00000000110001010100111100000101 -01000010100000010101000001110000 -00010100001010000001010100000010 -00000001010000101000000101010000 -10100000010101000010100000010101 -00001010000001010100001010000001 -01010000101100000101010000111100 -00010101000000000011000101010000 -00000000000000000000000000000000 -00000000100000000000111000000001 -00010011000000000101010111000000 -00010001011100000000010101001100 -00000001010100110000000000010101 -11000000000101010111000000000101 -01001100000000010101011100000000 -01000000110000000001000100110000 -00000100010000000010000000000000 -00000000000000000000000000000000 -00000000100000000000010000000000 -00010000000000000001000001000000 -01000001000000000000000100001100 -00000000010000000000000000010000 -00000000000001000001000000000001 -00000000000000000100000100000000 -00000000000000000000000100011000 -00000000010000010010000000000000 -00000000000000000000000000000000 -00000000110001010110000000000010 -00011000000000001000001000000000 -00100001100000000000100000100000 -00000010000010000000000010000010 -00000000001000001000000000001000 -00100000000000100000100000000000 -10000010000000000010000110000000 -00001000010000010011000101010000 -00000000000000000000000000000000 -00000000110001010100000000000101 -01100000000000010101100100000000 -01010110010000000001010110000000 -00000111011000000000000101011001 -00000000010101100100000000010101 -10000000000001010110010000000001 -01001000000000000101011000000000 -00010101100000000011000100000000 -00000000000000000000000000000000 -00000000110001010100000000000011 -01100000000000001101100000000000 -00010110000000000000110110001000 -00000001011000000000000011011000 -00000000001101100000000000001101 -10000000000000110110000000000000 -11011000000000000011011000000000 -00001101100000000011000100000000 -00000000000000000000000000000000 -00000000110001010100001000000100 -00110000100000010000110000100000 -01100011000010000001000011000011 -00000100001100001000000100001100 -00100000010000110000100000010000 -11000010000001000011000010000001 -00001100001000000100001100001000 -00010000110000000011000101010000 -00000000000000000000000000000000 -00000000100000000000000000000000 -00110000000000000000110010000000 -00000011000000000000000011000000 -00000000001100000000000000001100 -00000000000000110000000000000000 -11000000000000000011000000000000 -00001100000000000000001100000000 -00000000110000000010000000000000 -00000000000000000000000000000000 -00000000100000000000001000000001 -00110000100000000100110010110000 -00010011000010000000010011000010 -00000101001100001000000001001100 -00100000000100110000100000000100 -11000010000000010011000010000000 -01001100001000000001001100001000 -00000100110000000010000000000000 -00000000000000000000000000000000 -00000000110001010100001000000101 -01100000100000010101100000110000 -01010111000010000001010110000011 -00000101011000001000000101011000 -00100000010101100000100000010101 -10000010000001010110000010000001 -01011000001000000101011000001000 -00010101100000000011000101010000 -00000000000000000000000000000000 -00000000110001010100001000000000 -00100000100000000000100000100000 -00000110000010000000000010000010 -00000000001100001000000000001000 -00100000000000100000100000000000 -10000010000000000010000010000000 -00001000001000000000001000001000 -00000000100000000011000100000000 -00000000000000000000000000000000 -00000000110001010101001000000100 -01100000100000010001100100100000 -01000010000010000001000110010010 -00000100001100001000000100011000 -00100000010001100100100000010001 -10000010000001000110010010000001 -00011001001000000100011001001000 -00010001100000000011000100000000 -00000000000000000000000000000000 -00000000110001010110000000000101 -01011000000000010101011000000000 -00010001100000000001010101100000 -00000000000110000000000101010110 -00000000010101011000000000010101 -01100000000001010101100000000001 -01010110000000000100010110000000 -00010101010000000011000101010000 -00000000000000000000000000000000 -00000000100000000000011000000001 -01000001100000000101000001100000 -00010100000110000000010100000110 -00000001010000011000000001010000 -01100000000101000001100000000101 -00000110000000010100000110000000 -01010000011000000000010000011000 -00000100000000000010000000000000 -00000000000000000000000000000000 -00000000100000000001001000000001 -00000000100000000100000100100000 -01010000000010000000010000010010 -00000001000000001000000001000000 -00100000000100000100100000000100 -00000010000000010000010010000000 -01000001001000000001000001001000 -00000100000000000010000100000000 -00000000000000000000000000000000 -00000000110001010100011000000011 -01010001100000001101010001100000 -00110101000110000000110101000110 -00000011010100011000000011010100 -01100000001101010001100000001101 -01000110000000110101000110000000 -11010100011000000011010100011000 -00001001010000000011000101010000 -00000000000000000000000000000000 -00000000110001010100011000000101 -01110001100000010101110001100000 -01010111000110000001010111000110 -00000111011100011000000100011100 -01100000010101110001100000010001 -11000110000001010111000110000001 -01011100011000000101011100011000 -00010101110000000011000100000000 -00000000000000000000000000000000 -00000000010001010100011000000011 -01110001100000001101110001100000 -00010111000110000000110111000110 -00000000011100011000000011011100 -01100000001101110001100000001001 -11000110000000110111000110000000 -11011100011000000011011100011000 -00001101110000000001000100000000 -00000000000000000000000000000000 -00000000010001010100011000000101 -01110001100000010101110001100000 -01100111000110000001010111000110 -00000000001100011000000101011100 -01100000010101110001100000010101 -11000110000001010111000110000001 -01011100011000000101011100011000 -00010101110000000001000101010000 -00000000000000000000000000000000 -00000000000000000000001000000001 -00100000100000000100100000100000 -00010010000010000000010010000010 -00000001011100001000000001001000 -00100000000100100000100000000100 -10000010000000010010000010000000 -01001000001000000001001000001000 -00000100100000000000000000000000 -00000000000000000000000000000000 -00000000010000000000011000000001 -01100001100000000101100001100000 -00010010000110000000010110000110 -00000101011000011000000001011000 -01100000000101100001100000000001 -10000110000000010110000110000000 -00011000011000000000011000011000 -00000101100000000000000100000000 -00000000000000000000000000000000 -00000000010001010100000000000101 -01110000000000010101110000000000 -01010111000000000001010111000000 -00000101011100000000000100011100 -00000000010001110000000000010100 -11000000000001010111000000000001 -01001100000000000100011100000000 -00010101110000000001000101010000 -00000000000000000000000000000000 -00000000010001000100001000000000 -01100000100000000001100000100000 -00000110000010000000000110000010 -00000000011000001000000000011000 -00100000000001100000110000000000 -10000010000000000110000011000000 -00001000001000000000011000001000 -00000001100000000001000100000000 -00000000000000000000000000000000 -00000000010001010100001000000100 -00100000100000010000100000100000 -01000010000010000001000010000010 -00000100001000001000000100001000 -00100000010000100000100000010001 -10000010000001000010001010000001 -00011000001000000100001000001000 -00010000100000000001000100000000 -00000000000000000000000000000000 -00000000010001010100001000000101 -01000000100000010101000000100000 -00010100000010000001010100000010 -00000001010000001000000101010000 -00100000010101000000100000010101 -01000010000001010100000010000001 -01010100001000000101010000001000 -00010101000000000001000101010000 -00000000000000000000000000000000 -00000000000000000000001000000001 -01010000110000000101010000100000 -00010101000011000000010101000011 -00000001010100001100000001010100 -00110000000101010000110000000101 -01000011000000010101001010000000 -01010100001100000001010100001000 -00000101010000000000000000000000 -00000000000000000000000000000000 -00000000010000000000100000000000 -01000010000000000001000010000000 -01000100001000000000000100001000 -00000000010000100000000000010000 -10000000000001000000000001000001 -00001000000000000100000000000000 -00010000100000000000010000100000 -00000001000000000000000000000000 -00000000000000000000000000000000 -00000000010001010100001000000010 -00100000100000001000000000100000 -00100000000010000000100000000010 -00000000000000001000000010000000 -00100000001000000010100000001000 -00000010000000100000000010000000 -10000000001100000010000000001000 -00001000000000000001000101010000 -00000000000000000000000000000000 -00000000010001000100000000000101 -01100000000000010101100000000000 -01010110000000000001010110000000 -00000111011000000000000101011000 -00000000010101100000000000010101 -10000000000001010110000000000001 -01011000000000000101011000000000 -00010101100000000001000100000000 -00000000000000000000000000000000 -00000000110001010100000000000011 -01100000000000011101100000000001 -01010010000000000000110110000000 -00000001011100000000000011011000 -00000000001101100000000000001101 -10000000000000010110000000000000 -11011000000000000011011000000000 -00001101100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000100000100 -00110000000000000000110000010000 -01000010000000000001000011000000 -00000100011000000000000100001100 -00000000010000110000000000000000 -11000000000000000011000000000001 -00001100000000000100001100000100 -00010000110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000000110101000000 -00000010000110000000000011010000 -00000000001001000000000000001100 -01000000000000110001000000000000 -11010000000000000011010110000000 -00001100000000000000001100000000 -00000000110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010100000001 -00110001010000010100110001110000 -01010010000101000000010011000101 -00000101001100010100000001001100 -01010000000100110001110000000100 -11000101000000010011000100100000 -01001100010000000001001100010100 -00000100110000000000000000000000 -00000000000000000000000000000000 -00000000000000000010001100000101 -01101000110000000101101000110000 -00010110100011000001010110100011 -00000101011010001100000101011010 -01110000010101101001110000010101 -10100011000001010110100011000001 -01011010001100000101011010001100 -00010101100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000000000100101000000 -00000010000100000000000010010000 -00000000001001000000000000001000 -00010000000000100010000000000000 -10010000000000000010010100000000 -00001000000000000000001000000000 -00000000100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100001000100 -01100010000100000001100010000000 -00000110001000000001000110001000 -01000100011000100001000100011000 -10000000010001100000000110010001 -10001000010001000110000000010001 -00011000100001000100011000100001 -00010001100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000001000101 -01010000000100000101010000000100 -00010101000000010001010101000000 -10000000010100000001000100010100 -00000100010101010000000001010101 -01000000010001010101000000011001 -01010100000001000101010100000001 -00010101010000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000100000 -01000010000010000101000010000010 -00000100001000001000010100001000 -00100001010000100000000001010000 -10000010000101000010000010000101 -01001000000000010100001000000000 -00010100100000100001010000100000 -10000101000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000101000000001 -00000010100000000100000010111110 -01010000001010000000010000001010 -01000001000000101000000001000000 -10100000000100000010100000000000 -00001010000000010000001010000000 -00000000101000000001000000101010 -01000100000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000110010000011 -01010011000000000101010011001110 -00110101001100000000110101001100 -01000011010100110000000011010100 -11000000001101010011000000000000 -01001100000000010101001100100000 -10000100110000000011010100110010 -00001101010000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100010000101 -01110010000000010101110010010000 -01000111001000000001010111001000 -00000110011100100000000101011100 -10000000010101110010000000010101 -11001000000001100111001000001001 -00011100100000000101011100100010 -00010101110000000000000000000000 -00000000000000000000000000000000 -00000000000000000010001100001000 -01001000110001100001000000110000 -00000100000011000110000100100011 -00000000010010001100010000010000 -00110001100001000000110000100001 -00100011000100000100000011000000 -00010010001100001000010010001100 -00100001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -01001111111111111101001111111111 -11110100111111111111110100111111 -11111111010011111111111111010011 -11111111111101001111111111111101 -00111111111111110100111111111111 -11010011111111111111010011111111 -11111101000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010110111111011 -00001011001101101100001001011111 -11110100100100110110110000101100 -10011111010010110011011001000010 -01001101101100001111101001101100 -00101100110110010000111111111110 -01000010110011011011000010110111 -11101100000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011001111111100 -01001100110011110001001101011111 -11110100110101001111000100110010 -10111111010011001100111101000011 -01010011110001001111101011110001 -00110011001111010000111111111111 -01000011001100111100010011001111 -11110001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011101100011110 -01001110110111111001001110010001 -10000100111001011111100100111010 -01111000010011101101111110000011 -10010111111001001000100111111001 -00111011011111100000100011000111 -10000011101100011110010011101100 -01111001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000100000110 -01110000010001011001110001010000 -00110011000001000000110111000101 -00000001011100010100000000011100 -00010000001001110000010000001001 -11000001000000100111000001000001 -00011100000100000110011100010100 -00000001110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000000001 -01110001000000010101110001000000 -00010011000100000001010011000000 -00000111001100000000000101011100 -01000000010101110001000000010101 -11000100000001010111000100000001 -01011100010000000101011100010000 -00000101110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001000000001 -00100000100000000100100000100000 -00010010000010000000000010000010 -00000000001000001000000001001000 -00100000000100100000100000000100 -10000010000000010010000010000000 -01001000001000000001001000001000 -00000100100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -01100000000000010001100101100000 -00000110000000000000000110010010 -00000000011001000000000100011000 -00000000000001100000000000000001 -10000000000000000110000000000000 -00011000000000000100011000010000 -01000001100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100100000000 -01110010000000000001110010000000 -00010010001000000001000111001000 -00000100011100101000000100011100 -10000000010001110010010000010001 -11001000000001000111001000000001 -00011100100000000100011100101000 -00010001110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01100000000000000001100100000000 -01000110000000000000000110010000 -00000000011001000000000000011000 -00000000000001100000000000000001 -10000000000000000110000000000000 -00011000000000000000011000000000 -00000001100000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000000000 -00100010000000000000100100000000 -01000010001000000001000010010000 -00000100001001000000000100001000 -10000000010000100010000000010000 -10001000000001000010010000000001 -00001000100000000100001001100000 -00010000100000000000000000000000 -00000000000000000000000000000000 -00000000000000000010111100000000 -01001010110001000001001000100000 -01000100101010000001000100100011 -00000000010010001000000000010010 -10100000010001001010000000010001 -00101010000001000100100011000001 -00010010101100000000010010101100 -00010001000000000000000000000000 -00000000000000000000000000000000 -00001000110000000000110000000000 -00010010000000000000010010000000 -00000000001100000000000101001000 -00000000000100110000000000010100 -11000000000001010011000000000100 -00001100000000000101001100000000 -01000000110000000000000100110000 -00000000010000000001000000000000 -00000000000000000000000000000000 -00000000110000000000010000000000 -00010001100000000000010101100000 -00000000000000000000000100010110 -00000100000101100000000000011000 -00000000000001000001000000000001 -00000000000000000100010000000001 -00000100000000000000000101000000 -00000000010000000011000000000000 -00000000000000000000000000000000 -00001000110000000100000000000000 -00010000000000001000010000000000 -01100000000000000000100000000000 -00000010000100000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -10000000000000000010000100000000 -00000000010000000011000000000000 -00000000000000000000000000000000 -00001000110000000100000000000100 -01100000000000010001100000000000 -01000010000000000000000110000000 -00000000011000000000000110011000 -00000000010001100000000000010001 -10000000000001000110000000000001 -00011000000000000100011000000000 -00111001100000000011000000000000 -00000000000000000000000000000000 -00010000000000000100000000000000 -01100000000000100001100000000000 -00100110000000000000100110000000 -00000000011000100000000000011000 -00000000001001100000000000001001 -10000000000000100110000000000000 -00011000000000000010011000000000 -00001001100000100000000000000000 -00000000000000000000000000000000 -01000000010001010100001000000000 -00110000100000000000110000100000 -00000011000010000001000011000010 -00010110001100001000000100001100 -00100000010000110000100000010000 -11000010000001000011000010000001 -10001100001000000100001100001000 -00010000110000000001000101010000 -00000000000000000000000000000000 -01000000010000000000000000000000 -00110000000000000000110010000000 -00000011000000000000000011001000 -00000000001100000000000000001100 -00000000000000110000000000000000 -11000000000000000011001000000000 -00001100000000000000001100000000 -00000000110000000001000001000000 -00000000000000000000000000000000 -01000000000000000000001000000000 -00110000100000000000110010110000 -00000011000010000000000011001011 -00000000001100001100000100001100 -00100000000000110000100000000000 -11000010000000000001001011000000 -00001100001000000000001100001000 -00000000110000000000000000000000 -00000000000000000000000000000000 -01000000010001010100000000000100 -01100000000000010001100000011000 -00000011000010000001000110000001 -00000100011100001100000100011000 -00100000010001100000100000010001 -10000010000001000110000011000001 -00011100001000000100011000001000 -00010001100000000001000101010000 -00000000000000000000000000000000 -01000000000000010100001000000000 -00100000100000000000100000100000 -01000010000010000000000010000010 -00000000011000001000000000001100 -00100000000000100000100000000000 -10000010000000000010000010000000 -00011000001000000000001000001000 -00000000100000000000000000000000 -00000000000000000000000000000000 -01010000000000000100001000000100 -01100000100000010001100000100000 -01000010000010000001000110000010 -00000100001000001000000100001100 -00100000010001100000100000010001 -10000010000001000110000010000001 -00001000001000000100011000001000 -00010001100000000000000000000000 -00000000000000000000000000000000 -01000000010001010100000000000100 -01010000000000010001010000000000 -01010001000000000001000101000000 -00000000000100000000000000000100 -00000000010001010000000000010001 -01000000000001000101000000000000 -00000100000000000100010100000000 -00010001010000100001000101010000 -00000000000000000000000000000000 -01001000010000000000011000000000 -01000001100000000001000001100000 -00000100000110000000000100000110 -11000000010000011000000000010000 -01100000000001000001100000000001 -00000110000000000100000110000000 -00010000011000000000010000011000 -00000001000000000000000000000000 -00000000000000000000000000000000 -01001000000000000000001000000001 -00000000101010000100000000101100 -00010000000010000000010000000010 -11010101000000001001000001000000 -00100000000100000000100000000100 -00000010000000010000000010000001 -01000000001000000001000000001000 -00000100000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100011000100001 -01010001101000000101010001100110 -01110001000110000000110101000110 -11000011010100011001000011010100 -01100000001101010001100000001101 -01000110000000110101000110000000 -11010100011000000011010100011000 -00001101010000000001000101010000 -00000000000000000000000000000000 -00000000000000010100011000101110 -01110001100010011001110001000010 -01010011000110000001000111000100 -10100100011100010010000110011100 -01100000010001110001100000010001 -11000110000001000111000110000001 -00011100011000000100011100011000 -00010001110000000000000000000000 -00000000000000000000000000000000 -01000000000000010100011000000010 -01110001100000001001110001100000 -00110111000110000000110111000110 -00000001011100011000000000011100 -01100000001001110001100000001001 -11000110000000100111000110000001 -00011100011000000010011100011000 -00001101110000000000000000000000 -00000000000000000000000000000000 -01010000010001010100011000000101 -01110001100000010101110001100100 -00000111000110000001010010000110 -00000111001100011000010100001100 -01100000010101110001100000010101 -11000110000001010111000110000001 -00001100011000000101011100011000 -00010100110000100001000101010000 -00000000000000000000000000000000 -01000000000000000001001000000001 -00100100100000000100100100100100 -00010010000010000000010010010010 -00000001011000001000000001011100 -00100000000100100100100000000100 -10000010000000010010010010000000 -00001001001000000001001001001000 -00000101100000000000000000000000 -00000000000000000000000000000000 -01000000000000000000011000000000 -01100001100000000001100001100000 -00000010000110000000000110000110 -00000001011000011000000100011000 -01100000000001100001100000000001 -10000110000000000110000110000001 -00001000011000000000011000011000 -00000001100000000000000000000000 -00000000000000000000000000000000 -00000000010001010110000000010100 -01111000000000010001111000000010 -00000011100000000001000111100000 -00000100011110000000000100011110 -00000000010001111000000000010001 -11100000000001000111100000000001 -00011110000000000100011110000000 -00010001110000000001000101010000 -00000000000000000000000000000000 -01000000000000010101001000000000 -01100100100000000001100100101000 -01000010000010000000000110010010 -00000000011000001000000000011000 -00100000000001100100100000000001 -10000010000000000110010010000000 -00011001001000000000011001001000 -00000001100000000000000000000000 -00000000000000000000000000000000 -01000000000000010101001000000100 -00100100100000010000100100101000 -01000110000010000001000010010010 -00000100001000001000000100001000 -00100000010000100000100000010000 -10000010000001000010000010000001 -00001000001000000100001000001000 -00010000100000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001000000100 -01000000100000010001000000011000 -01000101000010000001000100000010 -00000000010000001000000000010000 -00100000010001000000100000010001 -00000010000101000100000010000000 -00010000001000000100010000001000 -00010001000000000001000101010000 -00000000000000000000000000000000 -01000000000000000001001000000000 -01010100100000000001010100100000 -00000101000011000000000101010010 -00000000010100001100000000010100 -00110000000001010000110000000001 -01000011000000000101000010000000 -00010100001000000000010100001000 -00000001010000000000000000000000 -00000000000000000000000000000000 -01000000000000010000100000000000 -01100010000000000001100100000100 -00000110001000000000000100001000 -00000100010000100000000000010000 -10000000000001000010000000000001 -00001000000000000100001000000001 -00010000100000000000010000100000 -00000001000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001000100010 -00000000100010001000000000100110 -00000000000010000000100000000010 -00100010000000001000000010000000 -00100000001000000000100000001000 -00000010000000100000000010000000 -10000000001000000010000000001000 -00001000000000000001000101010000 -00000000000000000000000000000000 -01000000000000010100000010000100 -01100000000000010001100100001100 -01000110000000000000000110000000 -01000100011000000001000110011000 -00000000010001100000000000010001 -10000000000001000110000000000001 -00011000000000000100011000000000 -00010001100000000000000000000000 -00000000000000000000000000000000 -01000000000000010100000010000010 -01100000001000001001100100001100 -00000010000000000000100110000000 -10100000001000000001000000011101 -00000000011001100100000001011001 -10000000000000100110010000000000 -00001000000000000010011000000000 -00001001100000000000000000000000 -00000000000000000000000000000000 -01000000010001010110000010000100 -00111000001000010000111000000110 -00000010100000000001000011100000 -00100110001010000000100100011010 -00000000011000111000000000010000 -11100000000001000011100000000001 -10001010000000000100001110000000 -00010000110000000001000101010000 -00000000000000000000000000000000 -01010000000000000000000100000000 -00110000010000000000110001010100 -00000010000001000000000011000001 -00000000001000000100000000001000 -01010000000000110001010000000000 -11000001000000000011000101000000 -00001000000100000000001100000100 -00000000110000000000000000000000 -00000000000000000000000000000000 -01000000000000000000010000000000 -00110001000000000000110101001000 -00000010000101000000000011000100 -00100000001000010100100100001101 -01010000000000110101010000010000 -11000101000000000011010100000000 -00001000010000000000001100010000 -00000000110000100000000000000000 -00000000000000000000000000000000 -01000000010001010100001100000100 -01100000110000010001100000111000 -00000110000011000001000110000011 -00000100011000001100000100011000 -00110000000001100000110000000001 -10000011000001000110000111000001 -00011000001100000100011000001100 -00010001100000000001000101010000 -00000000000000000000000000000000 -01000000000000010100000000000000 -00100000000000000000100011000000 -01000010000000000000000010000000 -00000000001000000000000000001000 -01000000000000100001000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000000000 -00000000000000000000000000000000 -01000000000000010100100001000100 -01100010000100010001100011000100 -01000110001000010001000110001000 -01000100011000100001000100011000 -10000000000001100010000000000001 -10001000010001000110001000000001 -00011000100001000100011000100001 -00010001100000000000000000000000 -00000000000000000000000000000000 -01000000010001010100000001000100 -01010000000100010001010000000100 -01000101000000010001000101000000 -01000001000000000001000000010100 -00010100000001010000010000000001 -01000000010001000101000100010000 -00010100000001000100010100000001 -00010001010000000001000101010000 -00000000000000000000000000000000 -01000000010000000000100000100000 -01000010000010000001000010001010 -00000101001000001000000100001000 -10100000010000100000100000010000 -10000010000001000010000010000001 -00001000001000000100001000001000 -00010000100000100000010000100000 -00000001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000100101000000001 -00000010100000000100000010100000 -00000000001010000000010000001010 -01000101000000101000100001000000 -10100000000100000010100000000100 -00001010000000010000001010000001 -01000000101000000001000000101000 -00000100000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100110100000011 -01010011010010001101010011010010 -00000001001101000000110101001101 -01000011010100110100000011010100 -11010000001101010011010000001101 -01001101000000110101001101000000 -11010100110100000011010100110100 -00001101010000000001000101010000 -00000000000000000000000000000000 -01000000000000010100100010000000 -01110010000000000001110010000000 -01100111001000000001000111001000 -10000100011100100000000110011100 -10000000010001110010000000010001 -11001000000001000111001000000001 -00011100100000000100011100100000 -00010001110000000000000000000000 -00000000000000000000000000000000 -00000000000000000010001100001000 -01001000110000100001000000110000 -00000100100011000110000100100011 -00000000010010001100010000010000 -00110001100001000000110000100001 -00100011000110000100000011000000 -00010010001100001000010010001100 -00000001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -01001111111111111101001111111111 -11110100111111111111110100111111 -11111111010011111111111111010011 -11111111111101001111111111111101 -00111111111111110100111111111111 -11010011111111111111010011111111 -11111101000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000001000000 -00000000000100000000000010000100 -00100000000000000000000000000000 -01000010000000000000000010000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010110111111011 -00001011011111101100001111111111 -11110100101100110110110000101101 -11111111010010110011011111010010 -01001101101100001001001001101100 -00101100110110110000100100110110 -11000010110011011011000010110011 -01111101000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011001111111100 -01001100111111110001001111111111 -11110100110011001111000100110011 -11111111010011001100111111010011 -01010011110001001101001011110001 -00110011001111000100110101001111 -00010011001100111100010011001100 -11111101000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011101100011110 -01001110110001111001001000110001 -10000100111011011111100100111011 -00011000010011101101111000010011 -10010111111001001110000111111001 -00111011011111100100111001000110 -00010011101100011110010011101100 -01111001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001010000100 -00000000101000010000000000101000 -01000000000010100001000000000010 -10000100000000001010000011001100 -00101000010000000000101000001100 -11000010100001000000000010100001 -00000000001010000100000000001010 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000000100 -00000010000000010000000010000000 -01000000001000000001000000001000 -00000100000000100000000100000000 -10000000010000000010000000010000 -00001000000001000000001000000001 -00000000100000000100000000100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000100 -00000000001000010000000000001000 -01000000000000100001000000000000 -10000100000000000010000100000000 -00001000010000000000001000010000 -00000000100001000000000000100001 -00000000000010000100000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -00000000000000010000000000000000 -01000000000000000001000000000000 -00000100000000000000000100000000 -00000000010000000000000000010000 -00000000000001000000000000000001 -00000000000000000100000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000001000001100110000001000 -00110011000000100000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000001000000000000000 -00100000000000000000100000000000 -00000010000000000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000100010000000 -00000010001000000000000010001000 -00000000001000100000000000001000 -10000000000000100010000000000000 -10001000000000000010001000000000 -00001000100000000000001000100000 -00000000100010000000000000100010 -00000000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000100000000000 -00000010000000001100110010000000 -00110011001000000000000000001000 -00000000000000100000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000101010000100 -00000010101000010000000010101000 -01000000001010100001000000001010 -10000100000000101010000100000000 -10101000010000000010101000010000 -00001010100001000000001010100001 -00000000101010000100000000101010 -00010000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000100000000100 -00000010000000010000000010000000 -01000000001000000001000000001000 -00000100000000100000000100000000 -10000000010000000010000000010000 -00001000000001000000001000000001 -00000000100000000100000000100000 -00010000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000000010000100 -00000000001000010000000000001000 -01000000000000100001000000000000 -10000100000000000010000100000000 -00001000010000000000001000010000 -00000000100001000000000000100001 -00000000000010000100000000000010 -00010000000000100000000000000000 -00000000000000000000000000000000 -00001000000100000000000000000111 -00110000000000011100110000000000 -01110011000000000001110011000000 -00000111001100000000000111001100 -00000000011100110000000000011100 -11000000000001110011000000000001 -11001100000000000111001100000000 -00011100110000100000010000000000 -00000000000000000000000000000000 -00001000000000000000000010000100 -00000000001000010000000000001000 -01110011000000100001000000000000 -10000111001100000010000100000000 -00001000010000000000001000011100 -11000000100001000000000000100001 -00000000000010000100000000000010 -00010000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000001000000000 -00000000100000000000000000100000 -01000000000010000000000000000010 -00000100000000001000000000000000 -00100000000000000000100000010000 -00000010000000000000000010000000 -00000000001000000000000000001000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000001000000000000000001000 -01000000000000100000000000000000 -10000100000000000010000000000000 -00001000000000000000001000010000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100001000000000000000 -00000000000000000000000000000000 -00110011000000000000000000000000 -00000011001100000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000100000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00111100001111000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011110000111100000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001010000100 -00000000101000010000000000101000 -01000000000010100001000000000010 -10000100000000001010000100000000 -00101000010000000000101000010000 -00000010100001000000000010100001 -00000000001010000100000000001010 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -00000000000000010000000000000000 -01000000000000000001000000000000 -00000100000000100000000100000000 -10000000010000000010000000010000 -00001000000001000000001000000001 -00000000100000000100000000100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100010000100 -00000000001000010000000010001000 -01000000001000100001000000001000 -10000100000000100010000100000000 -00001000010000000000001000010000 -00000000100001000000000000100001 -00000000000010000100000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -00000000000000010000000000000000 -01000000000000000001000000000000 -00000100000000000000000100000000 -00000000010000000000000000010000 -00000000000001000000000000000001 -00000000000000000100000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000001000000000000000 -00100000000000000000100000000000 -00000010000000000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000100010000000 -00000010001000000000000010001000 -00000000001000100000000000001000 -10000000000000100010000000000000 -10001000000000000010001000000000 -00001000100000000000001000100000 -00000000100010000000000000100010 -00000000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000000000000000 -00000000000000000000000000000000 -00000000001000000000000000000000 -00000000000000000000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00001000000000000000101010000111 -00110010101000010000000010101000 -01110011001010100001000000001010 -10000100000000101010000100000000 -10101000010000000010101000010000 -00001010100001000000001010100001 -00000000101010000100000000101010 -00011100110000100000000000000000 -00000000000000000000000000000000 -00001000000000000000100000000100 -00000010000000010000000010000000 -01000000001000000001000000001000 -00000100000000100000000100000000 -10000000010000000010000000010000 -00001000000001000000001000000001 -00000000100000000100000000100000 -00010000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000001000010000000000001000 -00000000000000100001000000000000 -10000100000000000010000100000000 -00001000010000000000001000010000 -00000000100001000000000000100001 -00000000000010000100000000000010 -00010000000000100000000000000000 -00000000000000000000000000000000 -00001000000100000000000000000100 -00000000000000011100110000000000 -01000000000000000001110011000000 -00000100000000000000000111001100 -00000000011100110000000000011100 -11000000000001110011000000000001 -11001100000000000111001100000000 -00011100110000100000010000000000 -00000000000000000000000000000000 -00001000000000000000000010000100 -00000000001000010000000000001000 -01000000000000100001000000000000 -10000100000000000010000100000000 -00001000010000000000001000010000 -00000000100001000000000000100001 -00000000000010000100000000000010 -00010000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000001000000000000000 -00100000000000000000100000000000 -00000010000000000000000010000000 -00000000001000000000000000001000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000100000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00111100001111000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011110000111100000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000010000000000001 -00000010000000000000000000000000 -00110000000000000100001001001001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000010000000000001 -00000010000000100000000000000000 -00110000000000000100001001000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000000000000000001 -00000000000000001010001010111110 -00110000000000001000000000000001 -00000000000000000000000000000011 -00110000000000000100000000001001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000001000000000000001 -00000000000000000000000000000101 -00110000000000001010000000000001 -00000000000000000000000000000000 -00110000000000000000000000000001 -00000000000000001100000101111101 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 diff --git a/zaptel/kernel/proslic.h b/zaptel/kernel/proslic.h deleted file mode 100644 index ebd98bfa..00000000 --- a/zaptel/kernel/proslic.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -// ProSlic Header File - -typedef struct { - unsigned char address; - unsigned char altaddr; - char *name; - unsigned short initial; -} alpha; - -typedef struct { - unsigned char chip_number; - unsigned char DTMF_digit; - unsigned char interrupt_line; - unsigned char hook_status; - unsigned long half_pulses[20]; // Contains the time stamps of incomming half pulses. - unsigned char half_pulses_detected; // Contains the number of half pulses detected. - unsigned char Pulse_digit; - unsigned long On_Hook_time; - unsigned long Off_Hook_time; -} chipStruct; - -// Defines -#define LPT 0X378 - -#define IDA_LO 28 -#define IDA_HI 29 - -#define IAA 30 -#define ID_ACCES_STATUS 31 -#define IAS_BIT 1 - -#define I_STATUS 31 - -#define SPI_MODE 0 -#define PCM_MODE 1 -#define PCM_XMIT_START_COUNT_LSB 2 -#define PCM_XMIT_START_COUNT_MSB 3 -#define PCM_RCV_START_COUNT_LSB 4 -#define PCM_RCV_START_COUNT_MSB 5 -#define DIO 6 - -#define AUDIO_LOOPBACK 8 -#define AUDIO_GAIN 9 -#define LINE_IMPEDANCE 10 -#define HYBRID 11 -#define RESERVED12 12 -#define RESERVED13 13 -#define PWR_DOWN1 14 -#define PWR_DOWN2 15 -#define RESERVED16 16 -#define RESERVED17 17 -#define INTRPT_STATUS1 18 -#define INTRPT_STATUS2 19 -#define INTRPT_STATUS3 20 -#define INTRPT_MASK1 21 -#define INTRPT_MASK2 22 -#define INTRPT_MASK3 23 -#define DTMF_DIGIT 24 -#define RESERVED25 25 -#define RESERVED26 26 -#define RESERVED27 27 -#define I_DATA_LOW 28 -#define I_DATA_HIGH 29 -#define I_ADDRESS 30 -#define I_STATUS 31 -#define OSC1 32 -#define OSC2 33 -#define RING_OSC_CTL 34 -#define PULSE_OSC 35 -#define OSC1_ON__LO 36 -#define OSC1_ON_HI 37 -#define OSC1_OFF_LO 38 -#define OSC1_OFF_HI 39 -#define OSC2_ON__LO 40 -#define OSC2_ON_HI 41 -#define OSC2_OFF_LO 42 -#define OSC2_OFF_HI 43 -#define PULSE_ON__LO 44 -#define PULSE_ON_HI 45 -#define PULSE_OFF_LO 46 -#define PULSE_OFF_HI 47 -#define RING_ON__LO 48 -#define RING_ON_HI 49 -#define RING_OFF_LO 50 -#define RING_OFF_HI 51 -#define RESERVED52 52 -#define RESERVED53 53 -#define RESERVED54 54 -#define RESERVED55 55 -#define RESERVED56 56 -#define RESERVED57 57 -#define RESERVED58 58 -#define RESERVED59 59 -#define RESERVED60 60 -#define RESERVED61 61 -#define RESERVED62 62 -#define RESERVED63 63 -#define LINE_STATE 64 -#define ACTIVATE_LINE 0x11 -#define RING_LINE 0x44 -#define BIAS_SQUELCH 65 -#define BAT_FEED 66 -#define AUTO_STATE 67 -#define LOOP_STAT 68 -#define LOOP_DEBOUCE 69 -#define RT_DEBOUCE 70 -#define LOOP_I_LIMIT 71 -#define OFF_HOOK_V 72 -#define COMMON_V 73 -#define BAT_V_HI 74 -#define BAT_V_LO 75 -#define PWR_STAT_DEV 76 -#define PWR_STAT 77 -#define LOOP_V_SENSE 78 -#define LOOP_I_SENSE 79 -#define TIP_V_SENSE 80 -#define RING_V_SENSE 81 -#define BAT_V_HI_SENSE 82 -#define BAT_V_LO_SENSE 83 -#define IQ1 84 -#define IQ2 85 -#define IQ3 86 -#define IQ4 87 -#define IQ5 88 -#define IQ6 89 -#define RESERVED90 90 -#define RESERVED91 91 -#define DCDC_PWM_OFF 92 -#define DCDC 93 -#define DCDC_PW_OFF 94 -#define RESERVED95 95 -#define CALIBR1 96 -#define CALIBRATE_LINE 0x78 -#define NORMAL_CALIBRATION_COMPLETE 0x20 -#define CALIBR2 97 -#define RING_GAIN_CAL 98 -#define TIP_GAIN_CAL 99 -#define DIFF_I_CAL 100 -#define COMMON_I_CAL 101 -#define I_LIMIT_GAIN_CAL 102 -#define ADC_OFFSET_CAL 103 -#define DAC_ADC_OFFSET 104 -#define DAC_OFFSET_CAL 105 -#define COMMON_BAL_CAL 106 -#define DC_PEAK_CAL 107 - -// Indirect Register (decimal) -#define DTMF_ROW_0_PEAK 0 -#define DTMF_ROW_1_PEAK 1 -#define DTMF_ROW2_PEAK 2 -#define DTMF_ROW3_PEAK 3 -#define DTMF_COL1_PEAK 4 -#define DTMF_FWD_TWIST 5 -#define DTMF_RVS_TWIST 6 -#define DTMF_ROW_RATIO_THRESH 7 -#define DTMF_COL_RATIO_THRESH 8 -#define DTMF_ROW_2ND_HARM 9 -#define DTMF_COL_2ND_HARM 10 -#define DTMF_PWR_MIN_THRESH 11 -#define DTMF_HOT_LIM_THRESH 12 -#define OSC1_COEF 13 -#define OSC1X 14 -#define OSC1Y 15 -#define OSC2_COEF 16 -#define OSC2X 17 -#define OSC2Y 18 -#define RING_V_OFF 19 -#define RING_OSC_COEF 20 -#define RING_X 21 -#define RING_Y 22 -#define PULSE_ENVEL 23 -#define PULSE_X 24 -#define PULSE_Y 25 -#define RECV_DIGITAL_GAIN 26 -#define XMIT_DIGITAL_GAIN 27 -#define LOOP_CLOSE_THRESH 28 -#define RING_TRIP_THRESH 29 -#define COMMON_MIN_THRESH 30 -#define COMMON_MAX_THRESH 31 -#define PWR_ALARM_Q1Q2 32 -#define PWR_ALARM_Q3Q4 33 -#define PWR_ALARM_Q5Q6 34 -#define LOOP_CLOSURE_FILTER 35 -#define RING_TRIP_FILTER 36 -#define THERM_LP_POLE_Q1Q2 37 -#define THERM_LP_POLE_Q3Q4 38 -#define THERM_LP_POLE_Q5Q6 39 -#define CM_BIAS_RINGING 40 -#define DCDC_MIN_V 41 -#define DCDC_XTRA 42 diff --git a/zaptel/kernel/sec-2.h b/zaptel/kernel/sec-2.h deleted file mode 100644 index 94ce6abb..00000000 --- a/zaptel/kernel/sec-2.h +++ /dev/null @@ -1,451 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * echo.c - An echo cancellor, suitable for electrical and acoustic - * cancellation. This code does not currently comply with - * any relevant standards (e.g. G.164/5/7/8). One day.... - * - * Written by Steve Underwood - * - * Copyright (C) 2001 Steve Underwood - * - * Based on a bit from here, a bit from there, eye of toad, - * ear of bat, etc - plus, of course, my own 2 cents. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* TODO: - Finish the echo suppressor option, however nasty suppression may be - Add an option to reintroduce side tone at -24dB under appropriate conditions. - Improve double talk detector (iterative!) -*/ - -#ifndef _ZAPTEL_SEC_H -#define _ZAPTEL_SEC_H - -#ifdef __KERNEL__ -#include -#include -#define MALLOC(a) kmalloc((a), GFP_KERNEL) -#define FREE(a) kfree(a) -#else -#include -#include -#include -#include -#define MALLOC(a) malloc(a) -#define FREE(a) free(a) -#endif - -#include "fir.h" - -#ifndef NULL -#define NULL 0 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */ - -struct echo_can_state -{ - int tx_power; - int rx_power; - int clean_rx_power; - - int rx_power_threshold; - int nonupdate_dwell; - - fir16_state_t fir_state; - int16_t *fir_taps16; /* 16-bit version of FIR taps */ - int32_t *fir_taps32; /* 32-bit version of FIR taps */ - - int curr_pos; - - int taps; - int tap_mask; - int use_nlp; - int use_suppressor; - - int32_t supp_test1; - int32_t supp_test2; - int32_t supp1; - int32_t supp2; - - int32_t latest_correction; /* Indication of the magnitude of the latest - adaption, or a code to indicate why adaption - was skipped, for test purposes */ -}; - -static void echo_can_free(struct echo_can_state *ec); -static int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx); - -static void echo_can_init(void) -{ - printk("Zaptel Echo Canceller: STEVE2%s\n", ZAPTEL_ECHO_AGGRESSIVE); -} - -static void echo_can_identify(char *buf, size_t len) -{ - zap_copy_string(buf, "STEVE2", len); -} - -static void echo_can_shutdown(void) -{ -} - -/* - * According to Jim... - */ -#define MIN_TX_POWER_FOR_ADAPTION 512 -#define MIN_RX_POWER_FOR_ADAPTION 64 - -/* - * According to Steve... - */ -/* #define MIN_TX_POWER_FOR_ADAPTION 4096 -#define MIN_RX_POWER_FOR_ADAPTION 64 */ - -static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, - struct echo_can_state **ec) -{ - size_t size; - - if (ecp->param_count > 0) { - printk(KERN_WARNING "SEC-2 echo canceler does not support parameters; failing request\n"); - return -EINVAL; - } - - size = sizeof(**ec) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t); - - if (!(*ec = MALLOC(size))) - return -ENOMEM; - - memset(*ec, 0, size); - - (*ec)->taps = ecp->tap_length; - (*ec)->curr_pos = ecp->tap_length - 1; - (*ec)->tap_mask = ecp->tap_length - 1; - (*ec)->fir_taps32 = (int32_t *) (*ec + sizeof(**ec)); - (*ec)->fir_taps16 = (int16_t *) (*ec + sizeof(**ec) + ecp->tap_length * sizeof(int32_t)); - /* Create FIR filter */ - fir16_create(&(*ec)->fir_state, (*ec)->fir_taps16, (*ec)->taps); - (*ec)->rx_power_threshold = 10000000; - (*ec)->use_suppressor = FALSE; - /* Non-linear processor - a fancy way to say "zap small signals, to avoid - accumulating noise". */ - (*ec)->use_nlp = FALSE; - - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static inline void echo_can_free(struct echo_can_state *ec) -{ - fir16_free(&ec->fir_state); - FREE(ec); -} -/*- End of function --------------------------------------------------------*/ - -static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx) -{ - int offset1; - int offset2; - int32_t echo_value; - int clean_rx; - int nsuppr; - int i; - int correction; - - /* Evaluate the echo - i.e. apply the FIR filter */ - /* Assume the gain of the FIR does not exceed unity. Exceeding unity - would seem like a rather poor thing for an echo cancellor to do :) - This means we can compute the result with a total disregard for - overflows. 16bits x 16bits -> 31bits, so no overflow can occur in - any multiply. While accumulating we may overflow and underflow the - 32 bit scale often. However, if the gain does not exceed unity, - everything should work itself out, and the final result will be - OK, without any saturation logic. */ - /* Overflow is very much possible here, and we do nothing about it because - of the compute costs */ - /* 16 bit coeffs for the LMS give lousy results (maths good, actual sound - bad!), but 32 bit coeffs require some shifting. On balance 32 bit seems - best */ - echo_value = fir16 (&ec->fir_state, tx); - - /* And the answer is..... */ - clean_rx = rx - echo_value; - - /* That was the easy part. Now we need to adapt! */ - if (ec->nonupdate_dwell > 0) - ec->nonupdate_dwell--; - - /* If there is very little being transmitted, any attempt to train is - futile. We would either be training on the far end's noise or signal, - the channel's own noise, or our noise. Either way, this is hardly good - training, so don't do it (avoid trouble). */ - /* If the received power is very low, either we are sending very little or - we are already well adapted. There is little point in trying to improve - the adaption under these circumstanceson, so don't do it (reduce the - compute load). */ - if (ec->tx_power > MIN_TX_POWER_FOR_ADAPTION - && - ec->rx_power > MIN_RX_POWER_FOR_ADAPTION) - { - /* This is a really crude piece of decision logic, but it does OK - for now. */ - if (ec->tx_power > 2*ec->rx_power) - { - /* There is no far-end speech detected */ - if (ec->nonupdate_dwell == 0) - { - /* ... and we are not in the dwell time from previous speech. */ - //nsuppr = saturate((clean_rx << 16)/ec->tx_power); - nsuppr = clean_rx >> 3; - - /* Update the FIR taps */ - offset2 = ec->curr_pos + 1; - offset1 = ec->taps - offset2; - ec->latest_correction = 0; - for (i = ec->taps - 1; i >= offset1; i--) - { - correction = ec->fir_state.history[i - offset1]*nsuppr; - /* Leak to avoid false training on signals with multiple - strong correlations. */ - ec->fir_taps32[i] -= (ec->fir_taps32[i] >> 12); - ec->fir_taps32[i] += correction; - ec->fir_state.coeffs[i] = ec->fir_taps32[i] >> 15; - ec->latest_correction += abs(correction); - } - for ( ; i >= 0; i--) - { - correction = ec->fir_state.history[i + offset2]*nsuppr; - /* Leak to avoid false training on signals with multiple - strong correlations. */ - ec->fir_taps32[i] -= (ec->fir_taps32[i] >> 12); - ec->fir_taps32[i] += correction; - ec->fir_state.coeffs[i] = ec->fir_taps32[i] >> 15; - ec->latest_correction += abs(correction); - } - } - else - { - ec->latest_correction = -1; - } - } - else - { - ec->nonupdate_dwell = NONUPDATE_DWELL_TIME; - ec->latest_correction = -2; - } - } - else - { - ec->nonupdate_dwell = 0; - ec->latest_correction = -3; - } - /* Calculate short term power levels using very simple single pole IIRs */ - /* TODO: Is the nasty modulus approach the fastest, or would a real - tx*tx power calculation actually be faster? */ - ec->tx_power += ((abs(tx) - ec->tx_power) >> 5); - ec->rx_power += ((abs(rx) - ec->rx_power) >> 5); - ec->clean_rx_power += ((abs(clean_rx) - ec->clean_rx_power) >> 5); - -#if defined(XYZZY) - if (ec->use_suppressor) - { - ec->supp_test1 += (ec->fir_state.history[ec->curr_pos] - ec->fir_state.history[(ec->curr_pos - 7) & ec->tap_mask]); - ec->supp_test2 += (ec->fir_state.history[(ec->curr_pos - 24) & ec->tap_mask] - ec->fir_state.history[(ec->curr_pos - 31) & ec->tap_mask]); - if (ec->supp_test1 > 42 && ec->supp_test2 > 42) - supp_change = 25; - else - supp_change = 50; - supp = supp_change + k1*ec->supp1 + k2*ec->supp2; - ec->supp2 = ec->supp1; - ec->supp1 = supp; - clean_rx *= (1 - supp); - } -#endif - - if (ec->use_nlp && ec->rx_power < 32) - clean_rx = 0; - - /* Roll around the rolling buffer */ - if (ec->curr_pos <= 0) - ec->curr_pos = ec->taps; - ec->curr_pos--; - - return clean_rx; -} - -#if 0 -static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx) -{ - int offset; - int limit; - int32_t echo_value; - int clean_rx; - int nsuppr; - int i; - int correction; - - ec->tx_history[ec->curr_pos] = tx; - - /* Evaluate the echo - i.e. apply the FIR filter */ - /* Assume the gain of the FIR does not exceed unity. Exceeding unity - would seem like a rather poor thing for an echo cancellor to do :) - This means we can compute the result with a total disregard for - overflows. 16bits x 16bits -> 31bits, so no overflow can occur in - any multiply. While accumulating we may overflow and underflow the - 32 bit scale often. However, if the gain does not exceed unity, - everything should work itself out, and the final result will be - OK, without any saturation logic. */ - /* Overflow is very much possible here, and we do nothing about it because - of the compute costs */ - /* 16 bit coeffs for the LMS give lousy results (maths good, actual sound - bad!), but 32 bit coeffs require some shifting. On balance 32 bit seems - best */ - offset = ec->curr_pos; - limit = ec->taps - offset; - echo_value = 0; - for (i = 0; i < limit; i++) - echo_value += (ec->fir_taps[i] >> 16)*ec->tx_history[i + offset]; - offset = ec->taps - ec->curr_pos; - for ( ; i < ec->taps; i++) - echo_value += (ec->fir_taps[i] >> 16)*ec->tx_history[i - offset]; - echo_value >>= 16; - - /* And the answer is..... */ - clean_rx = rx - echo_value; - - /* That was the easy part. Now we need to adapt! */ - if (ec->nonupdate_dwell > 0) - ec->nonupdate_dwell--; - - /* If there is very little being transmitted, any attempt to train is - futile. We would either be training on the far end's noise or signal, - the channel's own noise, or our noise. Either way, this is hardly good - training, so don't do it (avoid trouble). */ - /* If the received power is very low, either we are sending very little or - we are already well adapted. There is little point in trying to improve - the adaption under these circumstanceson, so don't do it (reduce the - compute load). */ - if (ec->tx_power > MIN_TX_POWER_FOR_ADAPTION - && - ec->rx_power > MIN_RX_POWER_FOR_ADAPTION) - { - /* This is a really crude piece of decision logic, but it does OK - for now. */ - if (ec->tx_power > 2*ec->rx_power) - { - /* There is no far-end speech detected */ - if (ec->nonupdate_dwell == 0) - { - /* ... and we are not in the dwell time from previous speech. */ - //nsuppr = saturate((clean_rx << 16)/ec->tx_power); - nsuppr = clean_rx >> 3; - - /* Update the FIR taps */ - offset = ec->curr_pos; - limit = ec->taps - offset; - ec->latest_correction = 0; - for (i = 0; i < limit; i++) - { - correction = ec->tx_history[i + offset]*nsuppr; - ec->fir_taps[i] += correction; - //ec->latest_correction += abs(correction); - } - offset = ec->taps - ec->curr_pos; - for ( ; i < ec->taps; i++) - { - correction = ec->tx_history[i - offset]*nsuppr; - ec->fir_taps[i] += correction; - //ec->latest_correction += abs(correction); - } - } - else - { - ec->latest_correction = -3; - } - } - else - { - ec->nonupdate_dwell = NONUPDATE_DWELL_TIME; - ec->latest_correction = -2; - } - } - else - { - ec->nonupdate_dwell = 0; - ec->latest_correction = -1; - } - /* Calculate short term power levels using very simple single pole IIRs */ - /* TODO: Is the nasty modulus approach the fastest, or would a real - tx*tx power calculation actually be faster? */ - ec->tx_power += ((abs(tx) - ec->tx_power) >> 5); - ec->rx_power += ((abs(rx) - ec->rx_power) >> 5); - ec->clean_rx_power += ((abs(clean_rx) - ec->clean_rx_power) >> 5); - -#if defined(XYZZY) - if (ec->use_suppressor) - { - ec->supp_test1 += (ec->tx_history[ec->curr_pos] - ec->tx_history[(ec->curr_pos - 7) & ec->tap_mask]); - ec->supp_test2 += (ec->tx_history[(ec->curr_pos - 24) & ec->tap_mask] - ec->tx_history[(ec->curr_pos - 31) & ec->tap_mask]); - if (ec->supp_test1 > 42 && ec->supp_test2 > 42) - supp_change = 25; - else - supp_change = 50; - supp = supp_change + k1*ec->supp1 + k2*ec->supp2; - ec->supp2 = ec->supp1; - ec->supp1 = supp; - clean_rx *= (1 - supp); - } -#endif - - if (ec->use_nlp && ec->rx_power < 32) - clean_rx = 0; - - /* Roll around the rolling buffer */ - ec->curr_pos = (ec->curr_pos + 1) & ec->tap_mask; - - return clean_rx; -} -/*- End of function --------------------------------------------------------*/ -#endif - -static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) -{ - /* Reset hang counter to avoid adjustments after - initial forced training */ - ec->nonupdate_dwell = ec->taps << 1; - if (pos >= ec->taps) - return 1; - ec->fir_taps32[pos] = val << 17; - ec->fir_taps16[pos] = val << 1; - if (++pos >= ec->taps) - return 1; - return 0; -} - -/*- End of file ------------------------------------------------------------*/ -#endif diff --git a/zaptel/kernel/sec.h b/zaptel/kernel/sec.h deleted file mode 100644 index be31807f..00000000 --- a/zaptel/kernel/sec.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * echo.c - An echo cancellor, suitable for electrical and acoustic - * cancellation. This code does not currently comply with - * any relevant standards (e.g. G.164/5/7/8). One day.... - * - * Written by Steve Underwood - * Various optimizations and improvements by Mark Spencer - * - * Copyright (C) 2001 Steve Underwood - * - * Based on a bit from here, a bit from there, eye of toad, - * ear of bat, etc - plus, of course, my own 2 cents. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* TODO: - Finish the echo suppressor option, however nasty suppression may be - Add an option to reintroduce side tone at -24dB under appropriate conditions. - Improve double talk detector (iterative!) -*/ - -#ifndef _ZAPTEL_SEC_H -#define _ZAPTEL_SEC_H - -#ifdef __KERNEL__ -#include -#include -#define MALLOC(a) kmalloc((a), GFP_KERNEL) -#define FREE(a) kfree(a) -#else -#include -#include -#include -#include -#define MALLOC(a) malloc(a) -#define FREE(a) free(a) -#endif - -#include "arith.h" - -#ifndef NULL -#define NULL 0 -#endif -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE (!FALSE) -#endif - -#define USE_SHORTS - -#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */ - -struct echo_can_state -{ - int tx_power; - int rx_power; - int clean_rx_power; - - int rx_power_threshold; - int nonupdate_dwell; - - int16_t *tx_history; /* Last N tx samples */ - int32_t *fir_taps; /* Echo FIR taps */ - int16_t *fir_taps_short; /* Echo FIR taps, shorts instead of ints */ - - int curr_pos; - - int taps; - int tap_mask; - int use_nlp; - int use_suppressor; - - int32_t supp_test1; - int32_t supp_test2; - int32_t supp1; - int32_t supp2; - - int32_t latest_correction; /* Indication of the magnitude of the latest - adaption, or a code to indicate why adaption - was skipped, for test purposes */ -}; - -static void echo_can_init(void) -{ - printk("Zaptel Echo Canceller: STEVE%s\n", ZAPTEL_ECHO_AGGRESSIVE); -} - -static void echo_can_identify(char *buf, size_t len) -{ - zap_copy_string(buf, "STEVE", len); -} - -static void echo_can_shutdown(void) -{ -} - -static void echo_can_free(struct echo_can_state *ec); -static int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx); - -/* Original parameters : -#define MIN_TX_POWER_FOR_ADAPTION 256 -#define MIN_RX_POWER_FOR_ADAPTION 128 -*/ - -#define MIN_TX_POWER_FOR_ADAPTION 256 -#define MIN_RX_POWER_FOR_ADAPTION 64 - -/* Better ones found by Jim -#define MIN_TX_POWER_FOR_ADAPTION 128 -#define MIN_RX_POWER_FOR_ADAPTION 64 -*/ - -static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, - struct echo_can_state **ec) -{ - size_t size; - - if (ecp->param_count > 0) { - printk(KERN_WARNING "SEC echo canceler does not support parameters; failing request\n"); - return -EINVAL; - } - - size = sizeof(**ec) + ecp->tap_length * sizeof(int32_t) + ecp->tap_length * 3 * sizeof(int16_t); - - if (!(*ec = MALLOC(size))) - return -ENOMEM; - - memset(*ec, 0, size); - - (*ec)->taps = ecp->tap_length; - (*ec)->tap_mask = ecp->tap_length - 1; - (*ec)->tx_history = (int16_t *) (*ec + sizeof(**ec)); - (*ec)->fir_taps = (int32_t *) (*ec + sizeof(**ec) + - ecp->tap_length * 2 * sizeof(int16_t)); - (*ec)->fir_taps_short = (int16_t *) (*ec + sizeof(**ec) + - ecp->tap_length * sizeof(int32_t) + - ecp->tap_length * 2 * sizeof(int16_t)); - (*ec)->rx_power_threshold = 10000000; - (*ec)->use_suppressor = FALSE; - /* Non-linear processor - a fancy way to say "zap small signals, to avoid - accumulating noise". */ - (*ec)->use_nlp = TRUE; - - return 0; -} -/*- End of function --------------------------------------------------------*/ - -static inline void echo_can_free(struct echo_can_state *ec) -{ - FREE(ec); -} -/*- End of function --------------------------------------------------------*/ - -static inline int16_t echo_can_update(struct echo_can_state *ec, int16_t tx, int16_t rx) -{ - int32_t echo_value; - int clean_rx; - int nsuppr; - - ec->tx_history[ec->curr_pos] = tx; - ec->tx_history[ec->curr_pos + ec->taps] = tx; - - /* Evaluate the echo - i.e. apply the FIR filter */ - /* Assume the gain of the FIR does not exceed unity. Exceeding unity - would seem like a rather poor thing for an echo cancellor to do :) - This means we can compute the result with a total disregard for - overflows. 16bits x 16bits -> 31bits, so no overflow can occur in - any multiply. While accumulating we may overflow and underflow the - 32 bit scale often. However, if the gain does not exceed unity, - everything should work itself out, and the final result will be - OK, without any saturation logic. */ - /* Overflow is very much possible here, and we do nothing about it because - of the compute costs */ - /* 16 bit coeffs for the LMS give lousy results (maths good, actual sound - bad!), but 32 bit coeffs require some shifting. On balance 32 bit seems - best */ -#ifdef USE_SHORTS - echo_value = CONVOLVE2(ec->fir_taps_short, ec->tx_history + ec->curr_pos, ec->taps); -#else - echo_value = CONVOLVE(ec->fir_taps, ec->tx_history + ec->curr_pos, ec->taps); -#endif - echo_value >>= 16; - - /* And the answer is..... */ - clean_rx = rx - echo_value; - - /* That was the easy part. Now we need to adapt! */ - if (ec->nonupdate_dwell > 0) - ec->nonupdate_dwell--; - - /* If there is very little being transmitted, any attempt to train is - futile. We would either be training on the far end's noise or signal, - the channel's own noise, or our noise. Either way, this is hardly good - training, so don't do it (avoid trouble). */ - /* If the received power is very low, either we are sending very little or - we are already well adapted. There is little point in trying to improve - the adaption under these circumstanceson, so don't do it (reduce the - compute load). */ - if (ec->tx_power > MIN_TX_POWER_FOR_ADAPTION - && - ec->rx_power > MIN_RX_POWER_FOR_ADAPTION) - { - /* This is a really crude piece of decision logic, but it does OK - for now. */ - if (ec->tx_power > ec->rx_power << 1) - { - /* There is no far-end speech detected */ - if (ec->nonupdate_dwell == 0) - { - /* ... and we are not in the dwell time from previous speech. */ - //nsuppr = saturate((clean_rx << 16)/ec->tx_power); - nsuppr = (clean_rx << 16) / ec->tx_power; - nsuppr >>= 4; - if (nsuppr > 512) - nsuppr = 512; - if (nsuppr < -512) - nsuppr = -512; - - /* Update the FIR taps */ - ec->latest_correction = 0; -#ifdef USE_SHORTS - UPDATE2(ec->fir_taps, ec->fir_taps_short, ec->tx_history + ec->curr_pos, nsuppr, ec->taps); -#else - UPDATE(ec->fir_taps, ec->fir_taps_short, ec->tx_history + ec->curr_pos, nsuppr, ec->taps); -#endif - } else - { - ec->latest_correction = -3; - } - } - else - { - ec->nonupdate_dwell = NONUPDATE_DWELL_TIME; - ec->latest_correction = -2; - } - } - else - { - ec->nonupdate_dwell = 0; - ec->latest_correction = -1; - } - /* Calculate short term power levels using very simple single pole IIRs */ - /* TODO: Is the nasty modulus approach the fastest, or would a real - tx*tx power calculation actually be faster? */ - ec->tx_power += ((abs(tx) - ec->tx_power) >> 5); - ec->rx_power += ((abs(rx) - ec->rx_power) >> 5); - ec->clean_rx_power += ((abs(clean_rx) - ec->clean_rx_power) >> 5); - -#if defined(XYZZY) - if (ec->use_suppressor) - { - ec->supp_test1 += (ec->tx_history[ec->curr_pos] - ec->tx_history[(ec->curr_pos - 7) & ec->tap_mask]); - ec->supp_test2 += (ec->tx_history[(ec->curr_pos - 24) & ec->tap_mask] - ec->tx_history[(ec->curr_pos - 31) & ec->tap_mask]); - if (ec->supp_test1 > 42 && ec->supp_test2 > 42) - supp_change = 25; - else - supp_change = 50; - supp = supp_change + k1*ec->supp1 + k2*ec->supp2; - ec->supp2 = ec->supp1; - ec->supp1 = supp; - clean_rx *= (1 - supp); - } -#endif - - if (ec->use_nlp && ec->rx_power < 32) - clean_rx = 0; - - /* Roll around the rolling buffer */ - ec->curr_pos = (ec->curr_pos - 1) & ec->tap_mask; - - return clean_rx; -} -/*- End of function --------------------------------------------------------*/ - -static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) -{ - /* Reset hang counter to avoid adjustments after - initial forced training */ - ec->nonupdate_dwell = ec->taps << 1; - if (pos >= ec->taps) - return 1; - ec->fir_taps[pos] = val << 17; - ec->fir_taps_short[pos] = val << 1; - if (++pos >= ec->taps) - return 1; - return 0; -} - -/*- End of file ------------------------------------------------------------*/ -#endif diff --git a/zaptel/kernel/tor2-hw.h b/zaptel/kernel/tor2-hw.h deleted file mode 100644 index 3ae186d7..00000000 --- a/zaptel/kernel/tor2-hw.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Tormenta 2 Quad-T1 PCI Driver - * - * Written by Mark Spencer - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _TOR2_HW_H -#define _TOR2_HW_H - -/* - * The Tormenta two consists of the following block architecture: - * - * [ Spartan ] --- [ DS 21Q352 ] -- Xfrms -- Span 1 - * | | | | | | | - * Local Bus +----- Span 2 - * | | | | - * [ PCI 9030 ] +----- Span 3 - * | | | | | | - * PCI BUS +----- Span 4 - * - * All communicatiosn to the framer (21Q352) are performed - * through the PCI 9030 part using memory mapped I/O. - * - * The Tormenta 2 requires a 2 2k wondows memory space - * which is mapped as follows: - * - * First (32 bit) space: - * - * 0x0000 -> 0x07FF: Memory map of Tx and Rx buffers. They are stored - * with increasing channel number, with each span in - * a byte of a 32-bit long word: - * Bits 31-24: Span 1 - * Bits 23-16: Span 2 - * Bits 16- 8: Span 3 - * Bits 7- 0: Span 4 - * - * - * Second (8 bit) space: - * - * 0x0000 -> 0x00FF: Registers for Transceiver 1 - * 0x0100 -> 0x01FF: Registers for Transceiver 2 - * 0x0200 -> 0x02FF: Registers for Transceiver 3 - * 0x0300 -> 0x03FF: Registers for Transceiver 4 - * - * 0x400 Write -> Firmware load location for Xilinx. This is the only valid - * register until the Xilinx is programmed to decode - * the remainder! - * - * 0x400 Write -> clkreg (sync source) - * 0=free run, 1=span 1, 2=span 2, 3=span 3, 4=span 4. - * - * 0x400 Read -> statreg - * bit 0 - Interrupt Enabled - * bit 1 - Interrupt Active - * bit 2 - Dallas Interrupt Active - * - * 0x401 Write -> ctlreg as follows: - * bit 0 - Interrupt Enable - * bit 1 - Drives "TEST1" signal ("Interrupt" outbit) - * bit 2 - Dallas Interrupt Enable (Allows DINT signal to drive INT) - * bit 3 - External Syncronization Enable (MASTER signal). - * bit 4 - Select E1 Divisor Mode (0 for T1, 1 for E1). - * bit 5 - Remote serial loopback (When set to 1, TSER is driven from RSER) - * bit 6 - Local serial loopback (When set to 1, Rx buffers are driven from Tx buffers) - * bit 7 - Interrupt Acknowledge (set to 1 to acknowledge interrupt) - * - * 0x402 Write -> LED register as follows: - * bit 0 - Span 1 Green - * bit 1 - Span 1 Red - * bit 2 - Span 2 Green - * bit 3 - Span 2 Red - * bit 4 - Span 3 Green - * bit 5 - Span 3 Red - * bit 6 - Span 4 Green - * bit 7 - Span 4 Red - * NOTE: turning on both red and green yields yellow. - * - * 0x403 Write -> TEST2, writing to bit 0 drives TEST2 pin. - * - * 0x404 Write -> ctlreg1 as follows: - * bit 0 - Non-REV.A Mode (Set this bit for Dallas chips later then Rev. A) - */ - -#ifdef NEED_PCI_IDS -/* - * Provide routines for identifying a tormenta card - */ - -#define PCI_VENDOR_ID_PLX 0x10b5 - -#ifdef __KERNEL__ -static struct pci_device_id tor2_pci_ids[] = -#else -#define PCI_ANY_ID -1 -static struct tor2_pci_id { - int vendor; - int device; - int subvendor; - int subdevice; - int class; - int classmask; - unsigned long driver_data; -} tor2_pci_ids[] = -#endif /* __KERNEL__ */ -{ - { PCI_VENDOR_ID_PLX, 0x9030, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)"PLX 9030" }, /* PLX 9030 Development board */ - { PCI_VENDOR_ID_PLX, 0x3001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)"PLX Development Board" }, /* PLX 9030 Development board */ - { PCI_VENDOR_ID_PLX, 0xD00D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)"Tormenta 2 Quad T1/PRI or E1/PRA" }, /* Tormenta 2 */ - { PCI_VENDOR_ID_PLX, 0x4000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)"Tormenta 2 Quad T1/E1 (non-Digium clone)" }, /* Tormenta 2 clone */ - { 0, } -}; - -#ifndef __KERNEL__ -/* We provide a simple routine to match the given ID's */ -static inline int tor2_pci_match(int vendorid, int deviceid, char **variant) -{ - /* Returns 1 if this is a tormenta card or 0 if it isn't */ - int x; - for (x = 0; x< sizeof(tor2_pci_ids) / sizeof(tor2_pci_ids[0]); x++) - if (((tor2_pci_ids[x].vendor == PCI_ANY_ID) || - (tor2_pci_ids[x].vendor == vendorid)) && - ((tor2_pci_ids[x].device == PCI_ANY_ID) || - (tor2_pci_ids[x].device == deviceid))) { - *variant = (char *)tor2_pci_ids[x].driver_data; - return 1; - } - if (variant) - *variant = NULL; - return 0; -} -#endif /* __KERNEL__ */ -#endif /* NEED_PCI_IDS */ - -/* - * PLX PCI9030 PCI Configuration Registers - * - * This is not an all-inclusive list, just some interesting ones - * that we need and that are not standard. - * - */ -#define PLX_PCI_VPD_ADDR 0x4e /* Set address here */ -#define PLX_PCI_VPD_DATA 0x50 /* Read/Write data here */ - -#define PLX_LOC_WP_BOUNDARY 0x4e /* Bits 6-0 here */ -#define PLX_LOC_GPIOC 0x54 /* GPIO control register */ - -/* The 4 GPIO data bits we are interested in */ - -#define LOC_GPIOC_GPIO4 0x4000 /* GPIO4 data */ -#define LOC_GPIOC_GPIO5 0x20000 /* GPIO5 data */ -#define LOC_GPIOC_GPIO6 0x100000 /* GPIO6 data */ -#define LOC_GPIOC_GPIO7 0x800000 /* GPIO7 data */ - -/* define the initialization of the GPIOC register */ - -#define LOC_GPIOC_INIT_VALUE 0x2036000 /* GPIO 4&5 in write and - both high and GPIO 8 in write low */ - -/* The defines by what they actually do */ - -#define GPIO_WRITE LOC_GPIOC_GPIO4 -#define GPIO_PROGRAM LOC_GPIOC_GPIO5 -#define GPIO_INIT LOC_GPIOC_GPIO6 -#define GPIO_DONE LOC_GPIOC_GPIO7 - -#endif /* _TOR2_HW_H */ - diff --git a/zaptel/kernel/tor2.c b/zaptel/kernel/tor2.c deleted file mode 100644 index e426ad25..00000000 --- a/zaptel/kernel/tor2.c +++ /dev/null @@ -1,1521 +0,0 @@ -/* - * Tormenta 2 Quad-T1 PCI Driver - * - * Written by Mark Spencer - * Based on previous works, designs, and archetectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "zaptel.h" -#ifdef LINUX26 -#include -#endif -#define NEED_PCI_IDS -#include "tor2-hw.h" -#include "tor2fw.h" - -/* - * Tasklets provide better system interactive response at the cost of the - * possibility of losing a frame of data at very infrequent intervals. If - * you are more concerned with the performance of your machine, enable the - * tasklets. If you are strict about absolutely no drops, then do not enable - * tasklets. - */ - -/* #define ENABLE_TASKLETS */ - -/* this stuff needs to work for 64 bit systems, however using the macro causes - it to take twice as long */ -/* #define FIXTHISFOR64 */ /* as of now, un-comment for 32 bit only system */ - -#define SPANS_PER_CARD 4 -#define MAX_SPANS 16 - -#define FLAG_STARTED (1 << 0) - -#define TYPE_T1 1 /* is a T1 card */ -#define TYPE_E1 2 /* is an E1 card */ - -struct tor2_chan { - /* Private pointer for channel. We want to know our - channel and span */ - struct tor2 *tor; - int span; /* Index from 0 */ -}; - -struct tor2_span { - /* Private pointer for span. We want to know our - span number and pointer to the tor device */ - struct tor2 *tor; - int span; /* Index from 0 */ -}; - -struct tor2 { - /* This structure exists one per card */ - struct pci_dev *pci; /* Pointer to PCI device */ - int num; /* Which card we are */ - int syncsrc; /* active sync source */ - int syncs[SPANS_PER_CARD]; /* sync sources */ - int psyncs[SPANS_PER_CARD]; /* span-relative sync sources */ - int alarmtimer[SPANS_PER_CARD]; /* Alarm timer */ - char *type; /* Type of tormenta 2 card */ - int irq; /* IRQ used by device */ - int order; /* Order */ - int flags; /* Device flags */ - int syncpos[SPANS_PER_CARD]; /* span-relative sync sources */ - int master; /* Are we master */ - unsigned long plx_region; /* phy addr of PCI9030 registers */ - unsigned long plx_len; /* length of PLX window */ - volatile unsigned short *plx; /* Virtual representation of local space */ - unsigned long xilinx32_region; /* 32 bit Region allocated to Xilinx */ - unsigned long xilinx32_len; /* Length of 32 bit Xilinx region */ - volatile unsigned int *mem32; /* Virtual representation of 32 bit Xilinx memory area */ - unsigned long xilinx8_region; /* 8 bit Region allocated to Xilinx */ - unsigned long xilinx8_len; /* Length of 8 bit Xilinx region */ - volatile unsigned char *mem8; /* Virtual representation of 8 bit Xilinx memory area */ - struct zt_span spans[SPANS_PER_CARD]; /* Spans */ - struct tor2_span tspans[SPANS_PER_CARD]; /* Span data */ - struct zt_chan *chans[SPANS_PER_CARD]; /* Pointers to blocks of 24(30/31) contiguous zt_chans for each span */ - struct tor2_chan tchans[32 * SPANS_PER_CARD]; /* Channel user data */ - unsigned char txsigs[SPANS_PER_CARD][16]; /* Copy of tx sig registers */ - int loopupcnt[SPANS_PER_CARD]; /* loop up code counter */ - int loopdowncnt[SPANS_PER_CARD];/* loop down code counter */ - int spansstarted; /* number of spans started */ - spinlock_t lock; /* lock context */ - unsigned char leds; /* copy of LED register */ - unsigned char ec_chunk1[SPANS_PER_CARD][32][ZT_CHUNKSIZE]; /* first EC chunk buffer */ - unsigned char ec_chunk2[SPANS_PER_CARD][32][ZT_CHUNKSIZE]; /* second EC chunk buffer */ -#ifdef ENABLE_TASKLETS - int taskletrun; - int taskletsched; - int taskletpending; - int taskletexec; - int txerrors; - struct tasklet_struct tor2_tlet; -#endif - int cardtype; /* card type, T1 or E1 */ - unsigned int *datxlt; /* pointer to datxlt structure */ - unsigned int passno; /* number of interrupt passes */ -}; - -#define t1out(tor,span,reg,val) tor->mem8[((span - 1) * 0x100) + reg] = val -#define t1in(tor,span,reg) tor->mem8[((span - 1) * 0x100) + reg] - -#ifdef ENABLE_TASKLETS -static void tor2_tasklet(unsigned long data); -#endif - -#define GPIOC (PLX_LOC_GPIOC >> 1) /* word-oriented address for PLX GPIOC reg. (32 bit reg.) */ -#define LAS2BRD (0x30 >> 1) -#define LAS3BRD (0x34 >> 1) -#define INTCSR (0x4c >> 1) /* word-oriented address for PLX INTCSR reg. */ -#define PLX_INTENA 0x43 /* enable, hi-going, level trigger */ - -#define SYNCREG 0x400 -#define CTLREG 0x401 -#define LEDREG 0x402 -#define STATREG 0x400 -#define SWREG 0x401 -#define CTLREG1 0x404 - -#define INTENA (1 + ((loopback & 3) << 5)) -#define OUTBIT (2 + ((loopback & 3) << 5)) -#define E1DIV 0x10 -#define INTACK (0x80 + ((loopback & 3) << 5)) -#define INTACTIVE 2 -#define MASTER (1 << 3) - -/* un-define this if you dont want NON-REV A hardware support */ -/* #define NONREVA 1 */ - -#define SYNCSELF 0 -#define SYNC1 1 -#define SYNC2 2 -#define SYNC3 3 -#define SYNC4 4 -#define SYNCEXTERN 5 - -#define LEDRED 2 -#define LEDGREEN 1 - -#define MAX_TOR_CARDS 64 - -struct tor2 *cards[MAX_TOR_CARDS]; - -/* signalling bits */ -#define TOR_ABIT 8 -#define TOR_BBIT 4 - -static int debug; -static int japan; -static int loopback; -static int highestorder; -static int timingcable; - -static void set_clear(struct tor2 *tor); -static int tor2_startup(struct zt_span *span); -static int tor2_shutdown(struct zt_span *span); -static int tor2_rbsbits(struct zt_chan *chan, int bits); -static int tor2_maint(struct zt_span *span, int cmd); -static int tor2_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data); -ZAP_IRQ_HANDLER(tor2_intr); - -/* translations of data channels for 24 channels in a 32 bit PCM highway */ -unsigned datxlt_t1[] = { - 1 ,2 ,3 ,5 ,6 ,7 ,9 ,10,11,13,14,15,17,18,19,21,22,23,25,26,27,29,30,31 }; - -/* translations of data channels for 30/31 channels in a 32 bit PCM highway */ -unsigned datxlt_e1[] = { - 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, - 25,26,27,28,29,30,31 }; - -static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - int i; - struct tor2_span *p = span->pvt; - - if (debug) - printk("Tor2: Configuring span %d\n", span->spanno); - - span->syncsrc = p->tor->syncsrc; - - /* remove this span number from the current sync sources, if there */ - for (i = 0; i < SPANS_PER_CARD; i++) { - if (p->tor->syncs[i] == span->spanno) { - p->tor->syncs[i] = 0; - p->tor->psyncs[i] = 0; - } - } - p->tor->syncpos[p->span] = lc->sync; - /* if a sync src, put it in the proper place */ - if (lc->sync) { - p->tor->syncs[lc->sync - 1] = span->spanno; - p->tor->psyncs[lc->sync - 1] = p->span + 1; - } - /* If we're already running, then go ahead and apply the changes */ - if (span->flags & ZT_FLAG_RUNNING) - return tor2_startup(span); - - return 0; -} - -static int tor2_chanconfig(struct zt_chan *chan, int sigtype) -{ - int alreadyrunning; - unsigned long flags; - struct tor2_chan *p = chan->pvt; - - alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING; - if (debug) { - if (alreadyrunning) - printk("Tor2: Reconfigured channel %d (%s) sigtype %d\n", chan->channo, chan->name, sigtype); - else - printk("Tor2: Configured channel %d (%s) sigtype %d\n", chan->channo, chan->name, sigtype); - } - /* nothing more to do if an E1 */ - if (p->tor->cardtype == TYPE_E1) return 0; - spin_lock_irqsave(&p->tor->lock, flags); - if (alreadyrunning) - set_clear(p->tor); - spin_unlock_irqrestore(&p->tor->lock, flags); - return 0; -} - -static int tor2_open(struct zt_chan *chan) -{ -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int tor2_close(struct zt_chan *chan) -{ -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - return 0; -} - -static void init_spans(struct tor2 *tor) -{ - int x, y, c; - for (x = 0; x < SPANS_PER_CARD; x++) { - sprintf(tor->spans[x].name, "Tor2/%d/%d", tor->num, x + 1); - snprintf(tor->spans[x].desc, sizeof(tor->spans[x].desc) - 1, - "Tormenta 2 (PCI) Quad %s Card %d Span %d", - (tor->cardtype == TYPE_T1) ? "T1" : "E1", tor->num, x + 1); - tor->spans[x].manufacturer = "Digium"; - zap_copy_string(tor->spans[x].devicetype, tor->type, sizeof(tor->spans[x].devicetype)); - snprintf(tor->spans[x].location, sizeof(tor->spans[x].location) - 1, - "PCI Bus %02d Slot %02d", tor->pci->bus->number, PCI_SLOT(tor->pci->devfn) + 1); - tor->spans[x].spanconfig = tor2_spanconfig; - tor->spans[x].chanconfig = tor2_chanconfig; - tor->spans[x].startup = tor2_startup; - tor->spans[x].shutdown = tor2_shutdown; - tor->spans[x].rbsbits = tor2_rbsbits; - tor->spans[x].maint = tor2_maint; - tor->spans[x].open = tor2_open; - tor->spans[x].close = tor2_close; - if (tor->cardtype == TYPE_T1) { - tor->spans[x].channels = 24; - tor->spans[x].deflaw = ZT_LAW_MULAW; - tor->spans[x].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF; - tor->spans[x].spantype = "T1"; - } else { - tor->spans[x].channels = 31; - tor->spans[x].deflaw = ZT_LAW_ALAW; - tor->spans[x].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4; - tor->spans[x].spantype = "E1"; - } - tor->spans[x].chans = tor->chans[x]; - tor->spans[x].flags = ZT_FLAG_RBS; - tor->spans[x].ioctl = tor2_ioctl; - tor->spans[x].pvt = &tor->tspans[x]; - tor->tspans[x].tor = tor; - tor->tspans[x].span = x; - init_waitqueue_head(&tor->spans[x].maintq); - for (y=0;yspans[x].channels;y++) { - struct zt_chan *mychans = tor->chans[x] + y; - sprintf(mychans->name, "Tor2/%d/%d/%d", tor->num, x + 1, y + 1); - mychans->sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_FXSLS | ZT_SIG_FXSGS | ZT_SIG_FXSKS | - ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_SF | ZT_SIG_EM_E1; - c = (x * tor->spans[x].channels) + y; - mychans->pvt = &tor->tchans[c]; - mychans->chanpos = y + 1; - tor->tchans[c].span = x; - tor->tchans[c].tor = tor; - } - } -} - -static int __devinit tor2_launch(struct tor2 *tor) -{ - if (tor->spans[0].flags & ZT_FLAG_REGISTERED) - return 0; - printk("Tor2: Launching card: %d\n", tor->order); - if (zt_register(&tor->spans[0], 0)) { - printk(KERN_ERR "Unable to register span %s\n", tor->spans[0].name); - return -1; - } - if (zt_register(&tor->spans[1], 0)) { - printk(KERN_ERR "Unable to register span %s\n", tor->spans[1].name); - zt_unregister(&tor->spans[0]); - return -1; - } - if (zt_register(&tor->spans[2], 0)) { - printk(KERN_ERR "Unable to register span %s\n", tor->spans[2].name); - zt_unregister(&tor->spans[0]); - zt_unregister(&tor->spans[1]); - return -1; - } - if (zt_register(&tor->spans[3], 0)) { - printk(KERN_ERR "Unable to register span %s\n", tor->spans[3].name); - zt_unregister(&tor->spans[0]); - zt_unregister(&tor->spans[1]); - zt_unregister(&tor->spans[2]); - return -1; - } - tor->plx[INTCSR] = cpu_to_le16(PLX_INTENA); /* enable PLX interrupt */ -#ifdef ENABLE_TASKLETS - tasklet_init(&tor->tor2_tlet, tor2_tasklet, (unsigned long)tor); -#endif - return 0; -} - -static int __devinit tor2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res,x,f; - struct tor2 *tor; - unsigned long endjif; - volatile unsigned long *gpdata_io,*lasdata_io; - unsigned long gpdata,lasdata; - - res = pci_enable_device(pdev); - if (res) - return res; - tor = kmalloc(sizeof(struct tor2), GFP_KERNEL); - if (!tor) - return -ENOMEM; - memset(tor,0,sizeof(struct tor2)); - spin_lock_init(&tor->lock); - for (x = 0; x < SPANS_PER_CARD; x++) { - tor->chans[x] = kmalloc(sizeof(struct zt_chan) * 31,GFP_KERNEL); - if (!tor->chans[x]) - return -ENOMEM; - memset(tor->chans[x],0,sizeof(struct zt_chan) * 31); - } - /* Load the resources */ - tor->pci = pdev; - tor->irq = pdev->irq; - if (tor->irq < 1) { - printk(KERN_ERR "No IRQ allocated for device\n"); - goto err_out_free_tor; - } - tor->plx_region = pci_resource_start(pdev, 0); - tor->plx_len = pci_resource_len(pdev, 0); - tor->plx = ioremap(tor->plx_region, tor->plx_len); - /* We don't use the I/O space, so we dont do anything with section 1 */ - tor->xilinx32_region = pci_resource_start(pdev, 2); - tor->xilinx32_len = pci_resource_len(pdev, 2); - tor->mem32 = ioremap(tor->xilinx32_region, tor->xilinx32_len); - tor->xilinx8_region = pci_resource_start(pdev, 3); - tor->xilinx8_len = pci_resource_len(pdev, 3); - tor->mem8 = ioremap(tor->xilinx8_region, tor->xilinx8_len); - /* Record what type */ - tor->type = (char *)ent->driver_data; - /* Verify existence and accuracy of resources */ - if (!tor->plx_region || !tor->plx || - (pci_resource_flags(pdev, 0) & IORESOURCE_IO)) { - printk(KERN_ERR "Invalid PLX 9030 Base resource\n"); - goto err_out_free_tor; - } - if (!tor->xilinx32_region || !tor->mem32 || - (pci_resource_flags(pdev, 2) & IORESOURCE_IO)) { - printk(KERN_ERR "Invalid Xilinx 32 bit Base resource\n"); - goto err_out_free_tor; - } - if (!tor->xilinx8_region || !tor->mem8 || - (pci_resource_flags(pdev, 3) & IORESOURCE_IO)) { - printk(KERN_ERR "Invalid Xilinx 8 bit Base resource\n"); - goto err_out_free_tor; - } - /* Request regions */ - if (!request_mem_region(tor->plx_region, tor->plx_len, tor->type)) { - printk(KERN_ERR "Unable to reserve PLX memory %08lx window at %08lx\n", - tor->plx_len, tor->plx_region); - goto err_out_free_tor; - } - if (!request_mem_region(tor->xilinx32_region, tor->xilinx32_len, tor->type)) { - printk(KERN_ERR "Unable to reserve Xilinx 32 bit memory %08lx window at %08lx\n", - tor->xilinx32_len, tor->xilinx32_region); - goto err_out_release_plx_region; - } - if (!request_mem_region(tor->xilinx8_region, tor->xilinx8_len, tor->type)) { - printk(KERN_ERR "Unable to reserve Xilinx memory %08lx window at %08lx\n", - tor->xilinx8_len, tor->xilinx8_region); - goto err_out_release_plx_region; - } - pci_set_drvdata(pdev, tor); - printk("Detected %s at 0x%lx/0x%lx irq %d\n", tor->type, - tor->xilinx32_region, tor->xilinx8_region,tor->irq); - - for (x = 0; x < MAX_TOR_CARDS; x++) { - if (!cards[x]) break; - } - if (x >= MAX_TOR_CARDS) { - printk("No cards[] slot available!!\n"); - goto err_out_release_all; - } - tor->num = x; - cards[x] = tor; - - /* start programming mode */ - gpdata_io = (unsigned long *)&tor->plx[GPIOC]; - gpdata = le32_to_cpu(*gpdata_io); - - gpdata |= GPIO_WRITE; /* make sure WRITE is not asserted */ - *gpdata_io = cpu_to_le32(gpdata); - - gpdata &= ~GPIO_PROGRAM; /* activate the PROGRAM signal */ - *gpdata_io = cpu_to_le32(gpdata); - - /* wait for INIT and DONE to go low */ - endjif = jiffies + 10; - while (le32_to_cpu(*gpdata_io) & (GPIO_INIT | GPIO_DONE) && (jiffies <= endjif)); - - if (endjif < jiffies) { - printk("Timeout waiting for INIT and DONE to go low\n"); - goto err_out_release_all; - } - if (debug) printk("fwload: Init and done gone to low\n"); - gpdata |= GPIO_PROGRAM; - *gpdata_io = cpu_to_le32(gpdata); /* de-activate the PROGRAM signal */ - /* wait for INIT to go high (clearing done */ - endjif = jiffies + 10; - while (!(le32_to_cpu(*gpdata_io) & GPIO_INIT) && (jiffies <= endjif)); - if (endjif < jiffies) { - printk("Timeout waiting for INIT to go high\n"); - goto err_out_release_all; - } - - if (debug) printk("fwload: Init went high (clearing done)\nNow loading...\n"); - /* assert WRITE signal */ - gpdata &= ~GPIO_WRITE; - *gpdata_io = cpu_to_le32(gpdata); - for (x = 0; x < sizeof(tor2fw); x++) - { - /* write the byte */ - *tor->mem8 = tor2fw[x]; - /* if DONE signal, we're done, exit */ - if (le32_to_cpu(*gpdata_io) & GPIO_DONE) break; - /* if INIT drops, we're screwed, exit */ - if (!(le32_to_cpu(*gpdata_io) & GPIO_INIT)) break; - } - if (debug) printk("fwload: Transferred %d bytes into chip\n",x); - /* Wait for FIFO to clear */ - endjif = jiffies + 2; - while (jiffies < endjif); /* wait */ - /* de-assert write signal */ - gpdata |= GPIO_WRITE; - *gpdata_io = cpu_to_le32(gpdata); - if (debug) printk("fwload: Loading done!\n"); - - /* Wait for FIFO to clear */ - endjif = jiffies + 2; - while (jiffies < endjif); /* wait */ - if (!(le32_to_cpu(*gpdata_io) & GPIO_INIT)) - { - printk("Drove Init low!! CRC Error!!!\n"); - goto err_out_release_all; - } - if (!(le32_to_cpu(*gpdata_io) & GPIO_DONE)) - { - printk("Did not get DONE signal. Short file maybe??\n"); - goto err_out_release_all; - } - printk("Xilinx Chip successfully loaded, configured and started!!\n"); - - tor->mem8[SYNCREG] = 0; - tor->mem8[CTLREG] = 0; - tor->mem8[CTLREG1] = 0; - tor->mem8[LEDREG] = 0; - - /* set the LA2BRD register so that we enable block transfer, read - pre-fetch, and set to maximum read pre-fetch size */ - lasdata_io = (unsigned long *)&tor->plx[LAS2BRD]; - lasdata = *lasdata_io; - lasdata |= 0x39; - *lasdata_io = lasdata; - - /* set the LA3BRD register so that we enable block transfer */ - lasdata_io = (unsigned long *)&tor->plx[LAS3BRD]; - lasdata = *lasdata_io; - lasdata |= 1; - *lasdata_io = lasdata; - - /* check part revision data */ - x = t1in(tor,1,0xf) & 15; -#ifdef NONREVA - if (x > 3) - { - tor->mem8[CTLREG1] = NONREVA; - } -#endif - for (x = 0; x < 256; x++) tor->mem32[x] = 0x7f7f7f7f; - - - if (request_irq(tor->irq, tor2_intr, ZAP_IRQ_SHARED_DISABLED, "tor2", tor)) { - printk(KERN_ERR "Unable to request tormenta IRQ %d\n", tor->irq); - goto err_out_release_all; - } - - if (t1in(tor,1,0xf) & 0x80) { - printk("Tormenta 2 Quad E1/PRA Card\n"); - tor->cardtype = TYPE_E1; - tor->datxlt = datxlt_e1; - } else { - printk("Tormenta 2 Quad T1/PRI Card\n"); - tor->cardtype = TYPE_T1; - tor->datxlt = datxlt_t1; - } - init_spans(tor); - - tor->order = tor->mem8[SWREG]; - printk("Detected Card number: %d\n", tor->order); - - /* Launch cards as appropriate */ - x = 0; - for (;;) { - /* Find a card to activate */ - f = 0; - for (x=0;cards[x];x++) { - if (cards[x]->order <= highestorder) { - tor2_launch(cards[x]); - if (cards[x]->order == highestorder) - f = 1; - } - } - /* If we found at least one, increment the highest order and search again, otherwise stop */ - if (f) - highestorder++; - else - break; - } - - return 0; - -err_out_release_all: - release_mem_region(tor->xilinx32_region, tor->xilinx32_len); - release_mem_region(tor->xilinx8_region, tor->xilinx8_len); -err_out_release_plx_region: - release_mem_region(tor->plx_region, tor->plx_len); -err_out_free_tor: - if (tor->plx) iounmap((void *)tor->plx); - if (tor->mem8) iounmap((void *)tor->mem8); - if (tor->mem32) iounmap((void *)tor->mem32); - if (tor) { - for (x = 0; x < 3; x++) kfree(tor->chans[x]); - kfree(tor); - } - return -ENODEV; -} - -static struct pci_driver tor2_driver; - -static void __devexit tor2_remove(struct pci_dev *pdev) -{ - int x; - struct tor2 *tor; - tor = pci_get_drvdata(pdev); - if (!tor) - BUG(); - tor->mem8[SYNCREG] = 0; - tor->mem8[CTLREG] = 0; - tor->mem8[LEDREG] = 0; - tor->plx[INTCSR] = cpu_to_le16(0); - free_irq(tor->irq, tor); - if (tor->spans[0].flags & ZT_FLAG_REGISTERED) - zt_unregister(&tor->spans[0]); - if (tor->spans[1].flags & ZT_FLAG_REGISTERED) - zt_unregister(&tor->spans[1]); - if (tor->spans[2].flags & ZT_FLAG_REGISTERED) - zt_unregister(&tor->spans[2]); - if (tor->spans[3].flags & ZT_FLAG_REGISTERED) - zt_unregister(&tor->spans[3]); - 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); - if (tor->plx) iounmap((void *)tor->plx); - if (tor->mem8) iounmap((void *)tor->mem8); - if (tor->mem32) iounmap((void *)tor->mem32); - - cards[tor->num] = 0; - pci_set_drvdata(pdev, NULL); - for (x = 0; x < 3; x++) - if (tor->chans[x]) - kfree(tor->chans[x]); - kfree(tor); -} - -static struct pci_driver tor2_driver = { - name: "tormenta2", - probe: tor2_probe, -#ifdef LINUX26 - remove: __devexit_p(tor2_remove), -#else - remove: tor2_remove, -#endif - id_table: tor2_pci_ids, -}; - -static int __init tor2_init(void) { - int res; - res = zap_pci_module(&tor2_driver); - printk("Registered Tormenta2 PCI\n"); - return res; -} - -static void __exit tor2_cleanup(void) { - pci_unregister_driver(&tor2_driver); - printk("Unregistered Tormenta2\n"); -} - -static void set_clear(struct tor2 *tor) -{ - int i,j,s; - unsigned short val=0; - for (s = 0; s < SPANS_PER_CARD; s++) { - for (i = 0; i < 24; i++) { - j = (i/8); - if (tor->spans[s].chans[i].flags & ZT_FLAG_CLEAR) - val |= 1 << (i % 8); - - if ((i % 8)==7) { -#if 0 - printk("Putting %d in register %02x on span %d\n", - val, 0x39 + j, 1 + s); -#endif - t1out(tor,1 + s, 0x39 + j, val); - val = 0; - } - } - } - -} - - -static int tor2_rbsbits(struct zt_chan *chan, int bits) -{ - u_char m,c; - int k,n,b; - struct tor2_chan *p = chan->pvt; - unsigned long flags; -#if 0 - printk("Setting bits to %d on channel %s\n", bits, chan->name); -#endif - if (p->tor->cardtype == TYPE_E1) { /* do it E1 way */ - if (chan->chanpos == 16) return 0; - n = chan->chanpos - 1; - if (chan->chanpos > 16) n--; - k = p->span; - b = (n % 15) + 1; - c = p->tor->txsigs[k][b]; - m = (n / 15) * 4; /* nibble selector */ - c &= (15 << m); /* keep the other nibble */ - c |= (bits & 15) << (4 - m); /* put our new nibble here */ - p->tor->txsigs[k][b] = c; - /* output them to the chip */ - t1out(p->tor,k + 1,0x40 + b,c); - return 0; - } - n = chan->chanpos - 1; - k = p->span; - b = (n / 8); /* get byte number */ - m = 1 << (n & 7); /* get mask */ - c = p->tor->txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_ABIT) c |= m; - p->tor->txsigs[k][b] = c; - spin_lock_irqsave(&p->tor->lock, flags); - t1out(p->tor,k + 1,0x70 + b,c); - b += 3; /* now points to b bit stuff */ - /* get current signalling values */ - c = p->tor->txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_BBIT) c |= m; - /* save new signalling values */ - p->tor->txsigs[k][b] = c; - /* output them into the chip */ - t1out(p->tor,k + 1,0x70 + b,c); - b += 3; /* now points to c bit stuff */ - /* get current signalling values */ - c = p->tor->txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_CBIT) c |= m; - /* save new signalling values */ - p->tor->txsigs[k][b] = c; - /* output them into the chip */ - t1out(p->tor,k + 1,0x70 + b,c); - b += 3; /* now points to d bit stuff */ - /* get current signalling values */ - c = p->tor->txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_DBIT) c |= m; - /* save new signalling values */ - p->tor->txsigs[k][b] = c; - /* output them into the chip */ - t1out(p->tor,k + 1,0x70 + b,c); - spin_unlock_irqrestore(&p->tor->lock, flags); - return 0; -} - -static int tor2_shutdown(struct zt_span *span) -{ - int i; - int tspan; - int wasrunning; - unsigned long flags; - struct tor2_span *p = span->pvt; - - tspan = p->span + 1; - if (tspan < 0) { - printk("Tor2: Span '%d' isn't us?\n", span->spanno); - return -1; - } - - spin_lock_irqsave(&p->tor->lock, flags); - wasrunning = span->flags & ZT_FLAG_RUNNING; - - span->flags &= ~ZT_FLAG_RUNNING; - /* Zero out all registers */ - if (p->tor->cardtype == TYPE_E1) { - for (i = 0; i < 192; i++) - t1out(p->tor,tspan, i, 0); - } else { - for (i = 0; i < 160; i++) - t1out(p->tor,tspan, i, 0); - } - if (wasrunning) - p->tor->spansstarted--; - spin_unlock_irqrestore(&p->tor->lock, flags); - if (!(p->tor->spans[0].flags & ZT_FLAG_RUNNING) && - !(p->tor->spans[1].flags & ZT_FLAG_RUNNING) && - !(p->tor->spans[2].flags & ZT_FLAG_RUNNING) && - !(p->tor->spans[3].flags & ZT_FLAG_RUNNING)) - /* No longer in use, disable interrupts */ - p->tor->mem8[CTLREG] = 0; - if (debug) - printk("Span %d (%s) shutdown\n", span->spanno, span->name); - return 0; -} - - -static int tor2_startup(struct zt_span *span) -{ - unsigned long endjif; - int i; - int tspan; - unsigned long flags; - char *coding; - char *framing; - char *crcing; - int alreadyrunning; - struct tor2_span *p = span->pvt; - - tspan = p->span + 1; - if (tspan < 0) { - printk("Tor2: Span '%d' isn't us?\n", span->spanno); - return -1; - } - - spin_lock_irqsave(&p->tor->lock, flags); - - alreadyrunning = span->flags & ZT_FLAG_RUNNING; - - /* initialize the start value for the entire chunk of last ec buffer */ - for (i = 0; i < span->channels; i++) - { - memset(p->tor->ec_chunk1[p->span][i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - memset(p->tor->ec_chunk2[p->span][i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - } - /* Force re-evaluation of the timing source */ - if (timingcable) - p->tor->syncsrc = -1; - - if (p->tor->cardtype == TYPE_E1) { /* if this is an E1 card */ - unsigned char tcr1,ccr1,tcr2; - if (!alreadyrunning) { - p->tor->mem8[SYNCREG] = SYNCSELF; - p->tor->mem8[CTLREG] = E1DIV; - p->tor->mem8[LEDREG] = 0; - /* Force re-evaluation of sync src */ - /* Zero out all registers */ - for (i = 0; i < 192; i++) - t1out(p->tor,tspan, i, 0); - - /* Set up for Interleaved Serial Bus operation in byte mode */ - /* Set up all the spans every time, so we are sure they are - in a consistent state. If we don't, a card without all - its spans configured misbehaves in strange ways. */ - t1out(p->tor,1,0xb5,9); - t1out(p->tor,2,0xb5,8); - t1out(p->tor,3,0xb5,8); - t1out(p->tor,4,0xb5,8); - - t1out(p->tor,tspan,0x1a,4); /* CCR2: set LOTCMC */ - for (i = 0; i <= 8; i++) t1out(p->tor,tspan,i,0); - for (i = 0x10; i <= 0x4f; i++) if (i != 0x1a) t1out(p->tor,tspan,i,0); - t1out(p->tor,tspan,0x10,0x20); /* RCR1: Rsync as input */ - t1out(p->tor,tspan,0x11,6); /* RCR2: Sysclk=2.048 Mhz */ - t1out(p->tor,tspan,0x12,9); /* TCR1: TSiS mode */ - } - ccr1 = 0; - crcing = ""; - tcr1 = 9; /* base TCR1 value: TSis mode */ - tcr2 = 0; - if (span->lineconfig & ZT_CONFIG_CCS) { - ccr1 |= 8; /* CCR1: Rx Sig mode: CCS */ - coding = "CCS"; - } else { - tcr1 |= 0x20; - coding = "CAS"; - } - if (span->lineconfig & ZT_CONFIG_HDB3) { - ccr1 |= 0x44; /* CCR1: TX and RX HDB3 */ - framing = "HDB3"; - } else framing = "AMI"; - if (span->lineconfig & ZT_CONFIG_CRC4) { - ccr1 |= 0x11; /* CCR1: TX and TX CRC4 */ - tcr2 |= 0x02; /* TCR2: CRC4 bit auto */ - crcing = "/CRC4"; - } - t1out(p->tor,tspan,0x12,tcr1); - t1out(p->tor,tspan,0x13,tcr2); - t1out(p->tor,tspan,0x14,ccr1); - t1out(p->tor,tspan, 0x18, 0x20); /* 120 Ohm, normal */ - - if (!alreadyrunning) { - t1out(p->tor,tspan,0x1b,0x8a); /* CCR3: LIRST & TSCLKM */ - t1out(p->tor,tspan,0x20,0x1b); /* TAFR */ - t1out(p->tor,tspan,0x21,0x5f); /* TNAFR */ - t1out(p->tor,tspan,0x40,0xb); /* TSR1 */ - for (i = 0x41; i <= 0x4f; i++) t1out(p->tor,tspan,i,0x55); - for (i = 0x22; i <= 0x25; i++) t1out(p->tor,tspan,i,0xff); - /* Wait 100 ms */ - endjif = jiffies + 10; - spin_unlock_irqrestore(&p->tor->lock, flags); - while (jiffies < endjif); /* wait 100 ms */ - spin_lock_irqsave(&p->tor->lock, flags); - t1out(p->tor,tspan,0x1b,0x9a); /* CCR3: set also ESR */ - t1out(p->tor,tspan,0x1b,0x82); /* CCR3: TSCLKM only now */ - - span->flags |= ZT_FLAG_RUNNING; - p->tor->spansstarted++; - - /* enable interrupts */ - p->tor->mem8[CTLREG] = INTENA | E1DIV; - } - - spin_unlock_irqrestore(&p->tor->lock, flags); - - if (debug) { - if (alreadyrunning) - printk("Tor2: Reconfigured span %d (%s/%s%s) 120 Ohms\n", span->spanno, coding, framing, crcing); - else - printk("Tor2: Startup span %d (%s/%s%s) 120 Ohms\n", span->spanno, coding, framing, crcing); - } - } else { /* is a T1 card */ - - if (!alreadyrunning) { - p->tor->mem8[SYNCREG] = SYNCSELF; - p->tor->mem8[CTLREG] = 0; - p->tor->mem8[LEDREG] = 0; - /* Zero out all registers */ - for (i = 0; i < 160; i++) - t1out(p->tor,tspan, i, 0); - - /* Set up for Interleaved Serial Bus operation in byte mode */ - /* Set up all the spans every time, so we are sure they are - in a consistent state. If we don't, a card without all - its spans configured misbehaves in strange ways. */ - t1out(p->tor,1,0x94,9); - t1out(p->tor,2,0x94,8); - t1out(p->tor,3,0x94,8); - t1out(p->tor,4,0x94,8); - /* Full-on Sync required (RCR1) */ - t1out(p->tor,tspan, 0x2b, 8); - /* RSYNC is an input (RCR2) */ - t1out(p->tor,tspan, 0x2c, 8); - /* RBS enable (TCR1) */ - t1out(p->tor,tspan, 0x35, 0x10); - /* TSYNC to be output (TCR2) */ - t1out(p->tor,tspan, 0x36, 4); - /* Tx & Rx Elastic store, sysclk(s) = 2.048 mhz, loopback controls (CCR1) */ - t1out(p->tor,tspan, 0x37, 0x9c); - /* Set up received loopup and loopdown codes */ - t1out(p->tor,tspan, 0x12, 0x22); - t1out(p->tor,tspan, 0x14, 0x80); - t1out(p->tor,tspan, 0x15, 0x80); - /* Setup japanese mode if appropriate */ - t1out(p->tor,tspan,0x19,(japan ? 0x80 : 0x00)); /* no local loop */ - t1out(p->tor,tspan,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */ - } - /* Enable F bits pattern */ - i = 0x20; - if (span->lineconfig & ZT_CONFIG_ESF) - i = 0x88; - if (span->lineconfig & ZT_CONFIG_B8ZS) - i |= 0x44; - t1out(p->tor,tspan, 0x38, i); - if (i & 0x80) - coding = "ESF"; - else - coding = "SF"; - if (i & 0x40) - framing = "B8ZS"; - else { - framing = "AMI"; - t1out(p->tor,tspan,0x7e,0x1c); /* F bits pattern (0x1c) into FDL register */ - } - t1out(p->tor,tspan, 0x7c, span->txlevel << 5); - - if (!alreadyrunning) { - /* LIRST to reset line interface */ - t1out(p->tor,tspan, 0x0a, 0x80); - - /* Wait 100 ms */ - endjif = jiffies + 10; - - spin_unlock_irqrestore(&p->tor->lock, flags); - - while (jiffies < endjif); /* wait 100 ms */ - - spin_lock_irqsave(&p->tor->lock, flags); - - t1out(p->tor,tspan,0x0a,0x30); /* LIRST back to normal, Resetting elastic stores */ - - span->flags |= ZT_FLAG_RUNNING; - p->tor->spansstarted++; - - /* enable interrupts */ - p->tor->mem8[CTLREG] = INTENA; - } - - set_clear(p->tor); - - spin_unlock_irqrestore(&p->tor->lock, flags); - - if (debug) { - if (alreadyrunning) - printk("Tor2: Reconfigured span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, zt_lboname(span->txlevel)); - else - printk("Tor2: Startup span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, zt_lboname(span->txlevel)); - } - } - if (p->tor->syncs[0] == span->spanno) printk("SPAN %d: Primary Sync Source\n",span->spanno); - if (p->tor->syncs[1] == span->spanno) printk("SPAN %d: Secondary Sync Source\n",span->spanno); - if (p->tor->syncs[2] == span->spanno) printk("SPAN %d: Tertiary Sync Source\n",span->spanno); - if (p->tor->syncs[3] == span->spanno) printk("SPAN %d: Quaternary Sync Source\n",span->spanno); - return 0; -} - -static int tor2_maint(struct zt_span *span, int cmd) -{ - struct tor2_span *p = span->pvt; - - int tspan = p->span + 1; - - if (p->tor->cardtype == TYPE_E1) - { - switch(cmd) { - case ZT_MAINT_NONE: - t1out(p->tor,tspan,0xa8,0); /* no loops */ - break; - case ZT_MAINT_LOCALLOOP: - t1out(p->tor,tspan,0xa8,0x40); /* local loop */ - break; - case ZT_MAINT_REMOTELOOP: - t1out(p->tor,tspan,0xa8,0x80); /* remote loop */ - break; - case ZT_MAINT_LOOPUP: - case ZT_MAINT_LOOPDOWN: - case ZT_MAINT_LOOPSTOP: - return -ENOSYS; - default: - printk("Tor2: Unknown maint command: %d\n", cmd); - break; - } - return 0; - } - switch(cmd) { - case ZT_MAINT_NONE: - t1out(p->tor,tspan,0x19,(japan ? 0x80 : 0x00)); /* no local loop */ - t1out(p->tor,tspan,0x0a,0); /* no remote loop */ - break; - case ZT_MAINT_LOCALLOOP: - t1out(p->tor,tspan,0x19,0x40 | (japan ? 0x80 : 0x00)); /* local loop */ - t1out(p->tor,tspan,0x0a,0); /* no remote loop */ - break; - case ZT_MAINT_REMOTELOOP: - t1out(p->tor,tspan,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */ - t1out(p->tor,tspan,0x0a,0x40); /* remote loop */ - break; - case ZT_MAINT_LOOPUP: - t1out(p->tor,tspan,0x30,2); /* send loopup code */ - t1out(p->tor,tspan,0x12,0x22); /* send loopup code */ - t1out(p->tor,tspan,0x13,0x80); /* send loopup code */ - break; - case ZT_MAINT_LOOPDOWN: - t1out(p->tor,tspan,0x30,2); /* send loopdown code */ - t1out(p->tor,tspan,0x12,0x62); /* send loopdown code */ - t1out(p->tor,tspan,0x13,0x90); /* send loopdown code */ - break; - case ZT_MAINT_LOOPSTOP: - t1out(p->tor,tspan,0x30,0); /* stop sending loopup code */ - break; - default: - printk("Tor2: Unknown maint command: %d\n", cmd); - break; - } - return 0; -} - -static inline void tor2_run(struct tor2 *tor) -{ - int x,y; - for (x = 0; x < SPANS_PER_CARD; x++) { - if (tor->spans[x].flags & ZT_FLAG_RUNNING) { - /* since the Tormenta 2 PCI is double-buffered, you - need to delay the transmit data 2 entire chunks so - that the transmit will be in sync with the receive */ - for (y=0;yspans[x].channels;y++) { - zt_ec_chunk(&tor->spans[x].chans[y], - tor->spans[x].chans[y].readchunk, - tor->ec_chunk2[x][y]); - memcpy(tor->ec_chunk2[x][y],tor->ec_chunk1[x][y], - ZT_CHUNKSIZE); - memcpy(tor->ec_chunk1[x][y], - tor->spans[x].chans[y].writechunk, - ZT_CHUNKSIZE); - } - zt_receive(&tor->spans[x]); - } - } - for (x = 0; x < SPANS_PER_CARD; x++) { - if (tor->spans[x].flags & ZT_FLAG_RUNNING) - zt_transmit(&tor->spans[x]); - } -} - -#ifdef ENABLE_TASKLETS -static void tor2_tasklet(unsigned long data) -{ - struct tor2 *tor = (struct tor2 *)data; - tor->taskletrun++; - if (tor->taskletpending) { - tor->taskletexec++; - tor2_run(tor); - } - tor->taskletpending = 0; -} -#endif - -static int syncsrc = 0; -static int syncnum = 0 /* -1 */; -static int syncspan = 0; -#ifdef DEFINE_SPINLOCK -static DEFINE_SPINLOCK(synclock); -#else -static spinlock_t synclock = SPIN_LOCK_UNLOCKED; -#endif - -static int tor2_findsync(struct tor2 *tor) -{ - int i; - int x; - unsigned long flags; - int p; - int nonzero; - int newsyncsrc = 0; /* Zaptel span number */ - int newsyncnum = 0; /* tor2 card number */ - int newsyncspan = 0; /* span on given tor2 card */ - spin_lock_irqsave(&synclock, flags); -#if 1 - if (!tor->num) { - /* If we're the first card, go through all the motions, up to 8 levels - of sync source */ - p = 1; - while (p < 8) { - nonzero = 0; - for (x=0;cards[x];x++) { - for (i = 0; i < SPANS_PER_CARD; i++) { - if (cards[x]->syncpos[i]) { - nonzero = 1; - if ((cards[x]->syncpos[i] == p) && - !(cards[x]->spans[i].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_LOOPBACK)) && - (cards[x]->spans[i].flags & ZT_FLAG_RUNNING)) { - /* This makes a good sync source */ - newsyncsrc = cards[x]->spans[i].spanno; - newsyncnum = x; - newsyncspan = i + 1; - /* Jump out */ - goto found; - } - } - } - } - if (nonzero) - p++; - else - break; - } -found: - if ((syncnum != newsyncnum) || (syncsrc != newsyncsrc) || (newsyncspan != syncspan)) { - syncnum = newsyncnum; - syncsrc = newsyncsrc; - syncspan = newsyncspan; - if (debug) printk("New syncnum: %d, syncsrc: %d, syncspan: %d\n", syncnum, syncsrc, syncspan); - } - } -#endif - /* update sync src info */ - if (tor->syncsrc != syncsrc) { - tor->syncsrc = syncsrc; - /* Update sync sources */ - for (i = 0; i < SPANS_PER_CARD; i++) { - tor->spans[i].syncsrc = tor->syncsrc; - } - if (syncnum == tor->num) { -#if 1 - /* actually set the sync register */ - tor->mem8[SYNCREG] = syncspan; -#endif - if (debug) printk("Card %d, using sync span %d, master\n", tor->num, syncspan); - tor->master = MASTER; - } else { -#if 1 - /* time from the timing cable */ - tor->mem8[SYNCREG] = SYNCEXTERN; -#endif - tor->master = 0; - if (debug) printk("Card %d, using Timing Bus, NOT master\n", tor->num); - } - } - spin_unlock_irqrestore(&synclock, flags); - return 0; -} - -ZAP_IRQ_HANDLER(tor2_intr) -{ - int n, i, j, k, syncsrc; - unsigned int rxword,txword; - - unsigned char c, rxc; - unsigned char abits, bbits; - struct tor2 *tor = (struct tor2 *) dev_id; - - /* make sure its a real interrupt for us */ - if (!(tor->mem8[STATREG] & INTACTIVE)) /* if not, just return */ - { -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - } - - if (tor->cardtype == TYPE_E1) - /* set outbit, interrupt enable, and ack interrupt */ - tor->mem8[CTLREG] = OUTBIT | INTENA | INTACK | E1DIV | tor->master; - else - /* set outbit, interrupt enable, and ack interrupt */ - tor->mem8[CTLREG] = OUTBIT | INTENA | INTACK | tor->master; - -#if 0 - if (!tor->passno) - printk("Interrupt handler\n"); -#endif - - /* do the transmit output */ - for (n = 0; n < tor->spans[0].channels; n++) { - for (i = 0; i < ZT_CHUNKSIZE; i++) { - /* span 1 */ - txword = tor->spans[0].chans[n].writechunk[i] << 24; - /* span 2 */ - txword |= tor->spans[1].chans[n].writechunk[i] << 16; - /* span 3 */ - txword |= tor->spans[2].chans[n].writechunk[i] << 8; - /* span 4 */ - txword |= tor->spans[3].chans[n].writechunk[i]; - /* write to part */ -#ifdef FIXTHISFOR64 - tor->mem32[tor->datxlt[n] + (32 * i)] = txword; -#else - tor->mem32[tor->datxlt[n] + (32 * i)] = cpu_to_le32(txword); -#endif - } - } - - /* Do the receive input */ - for (n = 0; n < tor->spans[0].channels; n++) { - for (i = 0; i < ZT_CHUNKSIZE; i++) { - /* read from */ -#ifdef FIXTHISFOR64 - rxword = tor->mem32[tor->datxlt[n] + (32 * i)]; -#else - rxword = le32_to_cpu(tor->mem32[tor->datxlt[n] + (32 * i)]); -#endif - /* span 1 */ - tor->spans[0].chans[n].readchunk[i] = rxword >> 24; - /* span 2 */ - tor->spans[1].chans[n].readchunk[i] = (rxword & 0xff0000) >> 16; - /* span 3 */ - tor->spans[2].chans[n].readchunk[i] = (rxword & 0xff00) >> 8; - /* span 4 */ - tor->spans[3].chans[n].readchunk[i] = rxword & 0xff; - } - } - - i = tor->passno & 15; - /* if an E1 card, do rx signalling for it */ - if ((i < 3) && (tor->cardtype == TYPE_E1)) { /* if an E1 card */ - for (j = (i * 5); j < (i * 5) + 5; j++) { - for (k = 1; k <= SPANS_PER_CARD; k++) { - c = t1in(tor,k,0x31 + j); - rxc = c & 15; - if (rxc != tor->spans[k - 1].chans[j + 16].rxsig) { - /* Check for changes in received bits */ - if (!(tor->spans[k - 1].chans[j + 16].sig & ZT_SIG_CLEAR)) - zt_rbsbits(&tor->spans[k - 1].chans[j + 16], rxc); - } - rxc = c >> 4; - if (rxc != tor->spans[k - 1].chans[j].rxsig) { - /* Check for changes in received bits */ - if (!(tor->spans[k - 1].chans[j].sig & ZT_SIG_CLEAR)) - zt_rbsbits(&tor->spans[k - 1].chans[j], rxc); - } - } - } - } - - /* if a T1, do the signalling */ - if ((i < 12) && (tor->cardtype == TYPE_T1)) { - k = (i / 3); /* get span */ - n = (i % 3); /* get base */ - abits = t1in(tor,k + 1, 0x60 + n); - bbits = t1in(tor,k + 1, 0x63 + n); - for (j=0; j< 8; j++) { - /* Get channel number */ - i = (n * 8) + j; - rxc = 0; - if (abits & (1 << j)) rxc |= ZT_ABIT; - if (bbits & (1 << j)) rxc |= ZT_BBIT; - if (tor->spans[k].chans[i].rxsig != rxc) { - /* Check for changes in received bits */ - if (!(tor->spans[k].chans[i].sig & ZT_SIG_CLEAR)) { - zt_rbsbits(&tor->spans[k].chans[i], rxc); - } - } - } - } - - for (i = 0; i < SPANS_PER_CARD; i++) { /* Go thru all the spans */ - /* if alarm timer, and it's timed out */ - if (tor->alarmtimer[i]) { - if (!--tor->alarmtimer[i]) { - /* clear recover status */ - tor->spans[i].alarms &= ~ZT_ALARM_RECOVER; - if (tor->cardtype == TYPE_E1) - t1out(tor,i + 1,0x21,0x5f); /* turn off yel */ - else - t1out(tor,i + 1,0x35,0x10); /* turn off yel */ - zt_alarm_notify(&tor->spans[i]); /* let them know */ - } - } - } - - i = tor->passno & 15; - if ((i >= 10) && (i <= 13) && !(tor->passno & 0x30)) - { - j = 0; /* clear this alarm status */ - i -= 10; - if (tor->cardtype == TYPE_T1) { - c = t1in(tor,i + 1,0x31); /* get RIR2 */ - tor->spans[i].rxlevel = c >> 6; /* get rx level */ - t1out(tor,i + 1,0x20,0xff); - c = t1in(tor,i + 1,0x20); /* get the status */ - /* detect the code, only if we are not sending one */ - if ((!tor->spans[i].mainttimer) && (c & 0x80)) /* if loop-up code detected */ - { - /* set into remote loop, if not there already */ - if ((tor->loopupcnt[i]++ > 80) && - (tor->spans[i].maintstat != ZT_MAINT_REMOTELOOP)) - { - t1out(tor,i + 1,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */ - t1out(tor,i + 1,0x0a,0x40); /* remote loop */ - tor->spans[i].maintstat = ZT_MAINT_REMOTELOOP; - } - } else tor->loopupcnt[i] = 0; - /* detect the code, only if we are not sending one */ - if ((!tor->spans[i].mainttimer) && (c & 0x40)) /* if loop-down code detected */ - { - /* if in remote loop, get out of it */ - if ((tor->loopdowncnt[i]++ > 80) && - (tor->spans[i].maintstat == ZT_MAINT_REMOTELOOP)) - { - t1out(tor,i + 1,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */ - t1out(tor,i + 1,0x0a,0); /* no remote loop */ - tor->spans[i].maintstat = ZT_MAINT_NONE; - } - } else tor->loopdowncnt[i] = 0; - if (c & 3) /* if red alarm */ - { - j |= ZT_ALARM_RED; - } - if (c & 8) /* if blue alarm */ - { - j |= ZT_ALARM_BLUE; - } - } else { /* its an E1 card */ - t1out(tor,i + 1,6,0xff); - c = t1in(tor,i + 1,6); /* get the status */ - if (c & 9) /* if red alarm */ - { - j |= ZT_ALARM_RED; - } - if (c & 2) /* if blue alarm */ - { - j |= ZT_ALARM_BLUE; - } - } - /* only consider previous carrier alarm state */ - tor->spans[i].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); - n = 1; /* set to 1 so will not be in yellow alarm if we dont - care about open channels */ - /* if to have yellow alarm if nothing open */ - if (tor->spans[i].lineconfig & ZT_CONFIG_NOTOPEN) - { - /* go thru all chans, and count # open */ - for (n = 0,k = 0; k < tor->spans[i].channels; k++) - { - if (((tor->chans[i] + k)->flags & ZT_FLAG_OPEN) || - ((tor->chans[i] + k)->flags & ZT_FLAG_NETDEV)) n++; - } - /* if none open, set alarm condition */ - if (!n) j |= ZT_ALARM_NOTOPEN; - } - /* if no more alarms, and we had some */ - if ((!j) && tor->spans[i].alarms) - { - tor->alarmtimer[i] = ZT_ALARMSETTLE_TIME; - } - if (tor->alarmtimer[i]) j |= ZT_ALARM_RECOVER; - /* if going into alarm state, set yellow alarm */ - if ((j) && (!tor->spans[i].alarms)) { - if (tor->cardtype == TYPE_E1) - t1out(tor,i + 1,0x21,0x7f); - else - t1out(tor,i + 1,0x35,0x11); - } - if (c & 4) /* if yellow alarm */ - j |= ZT_ALARM_YELLOW; - if (tor->spans[i].maintstat || tor->spans[i].mainttimer) j |= ZT_ALARM_LOOPBACK; - tor->spans[i].alarms = j; - c = (LEDRED | LEDGREEN) << (2 * i); - tor->leds &= ~c; /* mask out bits for this span */ - /* light LED's if span configured and running */ - if (tor->spans[i].flags & ZT_FLAG_RUNNING) { - if (j & ZT_ALARM_RED) tor->leds |= LEDRED << (2 * i); - else if (j & ZT_ALARM_YELLOW) tor->leds |= (LEDRED | LEDGREEN) << (2 * i); - else tor->leds |= LEDGREEN << (2 * i); - } - tor->mem8[LEDREG] = tor->leds; - zt_alarm_notify(&tor->spans[i]); - } - if (!(tor->passno % 1000)) /* even second boundary */ - { - /* do all spans */ - for (i = 1; i <= SPANS_PER_CARD; i++) - { - if (tor->cardtype == TYPE_E1) - { - /* add this second's BPV count to total one */ - tor->spans[i - 1].bpvcount += t1in(tor,i,1) + (t1in(tor,i,0) << 8); - if (tor->spans[i - 1].lineconfig & ZT_CONFIG_CRC4) - { - tor->spans[i - 1].crc4count += t1in(tor,i,3) + ((t1in(tor,i,2) & 3) << 8); - tor->spans[i - 1].ebitcount += t1in(tor,i,5) + ((t1in(tor,i,4) & 3) << 8); - } - tor->spans[i - 1].fascount += (t1in(tor,i,4) >> 2) + ((t1in(tor,i,2) & 0x3F) << 6); - } - else - { - /* add this second's BPV count to total one */ - tor->spans[i - 1].bpvcount += t1in(tor,i,0x24) + (t1in(tor,i,0x23) << 8); - } - } - } - if (!timingcable) { - /* re-evaluate active sync src (no cable version) */ - tor->syncsrc = 0; - syncsrc = 0; - /* if primary sync specified, see if we can use it */ - if (tor->psyncs[0]) - { - /* if no alarms, use it */ - if (!(tor->spans[tor->psyncs[0] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | - ZT_ALARM_LOOPBACK))) { - tor->syncsrc = tor->psyncs[0]; - syncsrc = tor->syncs[0]; - } - } - /* if any others specified, see if we can use them */ - for (i = 1; i < SPANS_PER_CARD; i++) { - /* if we dont have one yet, and there is one specified at this level, see if we can use it */ - if ((!tor->syncsrc) && (tor->psyncs[i])) { - /* if no alarms, use it */ - if (!(tor->spans[tor->psyncs[i] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | - ZT_ALARM_LOOPBACK))) { - tor->syncsrc = tor->psyncs[i]; - syncsrc = tor->syncs[i]; - } - } - } - /* update sync src info */ - for (i = 0; i < SPANS_PER_CARD; i++) tor->spans[i].syncsrc = syncsrc; - - /* actually set the sync register */ - tor->mem8[SYNCREG] = tor->syncsrc; - } else /* Timing cable version */ - tor2_findsync(tor); - - tor->passno++; - -#ifdef ENABLE_TASKLETS - if (!tor->taskletpending) { - tor->taskletpending = 1; - tor->taskletsched++; - tasklet_hi_schedule(&tor->tor2_tlet); - } else { - tor->txerrors++; - } -#else - tor2_run(tor); -#endif - /* We are not the timing bus master */ - if (tor->cardtype == TYPE_E1) - /* clear OUTBIT and enable interrupts */ - tor->mem8[CTLREG] = INTENA | E1DIV | tor->master; - else - /* clear OUTBIT and enable interrupts */ - tor->mem8[CTLREG] = INTENA | tor->master; -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} - - -static int tor2_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - switch(cmd) { - default: - return -ENOTTY; - } - return 0; -} - -MODULE_AUTHOR("Mark Spencer"); -MODULE_DESCRIPTION("Tormenta 2 PCI Quad T1 or E1 Zaptel Driver"); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -#ifdef LINUX26 -module_param(debug, int, 0600); -module_param(loopback, int, 0600); -module_param(timingcable, int, 0600); -module_param(japan, int, 0600); -#else -MODULE_PARM(debug, "i"); -MODULE_PARM(loopback, "i"); -MODULE_PARM(timingcable, "i"); -MODULE_PARM(japan, "i"); -#endif - -MODULE_DEVICE_TABLE(pci, tor2_pci_ids); - -module_init(tor2_init); -module_exit(tor2_cleanup); diff --git a/zaptel/kernel/torisa.c b/zaptel/kernel/torisa.c deleted file mode 100644 index 4f02147b..00000000 --- a/zaptel/kernel/torisa.c +++ /dev/null @@ -1,1171 +0,0 @@ -/* - * Zapata Telephony "Tormenta" ISA card LINUX driver, version 2.2 11/29/01 - * - * Modified from original tor.c by Mark Spencer - * original by Jim Dixon - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif -#ifdef LINUX26 -#include -#endif - -/* Board address offsets (specified in word (not byte) offsets) */ -#define DDATA 0 /* Data I/O Register */ -#define DADDR 0x100 /* Dallas Card Address Reg., 0x200 in byte offset higher */ -#define CTLREG 0x100 /* Control/Status Reg., 0x200 in byte offset */ - -/* Control register bits */ -#define OUTBIT 8 /* Status output bit (for external measurements) */ -#define INTENA 4 /* Interrupt enable bit */ -#define MASTERVAL 0x41 /* Enable E1 master clock on Rev. B board */ -#define ENA16 0x80 /* 16 bit bus cycle enable bit */ - -#define TYPE_T1 1 /* is a T1 card */ -#define TYPE_E1 2 /* is an E1 card */ - -#define E1SYNCSTABLETHRESH 15000 /* amount of samples needed for E1 Sync stability */ - -static int syncsrc; - -static int syncs[2]; - -static int debug; - -#define MASTERCLOCK (*clockvals) /* value for master clock */ - -/* clock values */ -static u_char clockvals_t1[] = {MASTERVAL,0x12,0x22,MASTERVAL}; -static u_char clockvals_e1[] = {MASTERVAL,0x13,0x23,MASTERVAL}; - -static u_char *clockvals; - -/* translations of data channels for 24 channels in a 32 bit PCM highway */ -unsigned datxlt_t1[] = { 0, - 1 ,2 ,3 ,5 ,6 ,7 ,9 ,10,11,13,14,15,17,18,19,21,22,23,25,26,27,29,30,31 }; - -/* translations of data channels for 30/31 channels in a 32 bit PCM highway */ -unsigned datxlt_e1[] = { 0, - 1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, - 25,26,27,28,29,30,31 }; - -unsigned int *datxlt; - -/* This is the order that the data (audio) channels get -scanned in. This was done in this rather poopy manner because when outputting -(and inputting) a sine wave, such as in the case of TDD, any repeated samples -(because of PCM bus contention) will result in nasty-sounding distortion. The -Mitel STPA chips (MT8920) have a contention mechanism, which results in a -situation where, if the processor accesses a timeslot that is currently -being transmitted or received, it will HOLD the bus until it is done with -the timeslot. This means that there can be cases where we are trying -to write to a timeslot, and its already outputting the same value -as the last one (since we didnt get there in time), and in a sine-wave -output, distortion will occur. In any other output, it will be utterly -un-noticeable. So, what we do is use a pattern that gives us the most -flexibility in how long our interrupt latency is (note: Even with this, -our interrupt latency must be between 4 and 28 microseconds!!!) Essentially -we receive the interrupt just after the 24th channel is read. It will -take us AT LEAST 30 microseconds to read it, but could take as much as -35 microseconds to read all the channels. In any case it's the very -first thing we do in the interrupt handler. Worst case (30 microseconds) -is that the MT8920 has only moved 7 channels. That's where the 6 comes from. -*/ - -static int chseq_t1[] = - { 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,1,2,3,4,5 } ; - -static int chseq_e1[] = - { 6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5 } ; - -static int *chseq; - -struct torisa_pvt { - int span; -}; - -static struct zt_span spans[2]; -static struct zt_chan chans[64]; -static struct torisa_pvt pvts[64]; -static u_char txsigs[2][16]; -static int loopupcnt[2]; -static int loopdowncnt[2]; -static int alarmtimer[2]; - -static int channels_per_span = 24; - -static int card_type = TYPE_T1; - -static int prefmaster = 0; - -static int spansstarted = 0; - -#ifdef DEFINE_RWLOCK -static DEFINE_RWLOCK(torisa); -#else -static rwlock_t torisa = RW_LOCK_UNLOCKED; -#endif - -static u_char readdata[2][64][ZT_MAX_CHUNKSIZE]; -static u_char writedata[2][64][ZT_MAX_CHUNKSIZE]; -static u_char last_ecwrite[2][32]; -static int curread; - -static unsigned long base; -volatile static unsigned short *maddr; - -static int irq; -static unsigned int irqcount = 0; -static unsigned int taskletsched = 0; -static unsigned int taskletrun = 0; -static unsigned int taskletexec = 0; - -/* set the control register */ -static void setctlreg(unsigned char val) -{ -volatile register char *cp; - - cp = (char *) &maddr[CTLREG]; - *cp = val; -} - -/* output a byte to one of the registers in one of the Dallas T-1 chips */ -static void t1out(int spanno, int loc, unsigned char val) -{ -register int n; -volatile register char *cp; - - /* get the memory offset */ - n = spanno << 9; - /* point a char * at the address location */ - cp = (char *) &maddr[DADDR + n]; - *cp = loc; /* set address in T1 chip */ - /* point a char * at the data location */ - cp = (char *) &maddr[DDATA + n]; - *cp = val; /* out the value */ -} - -/* get a byte from one of the registers in one of the Dallas T-1 chips */ -static unsigned char t1in(int spanno, int loc) -{ -register int n; -volatile register char *cp; - - /* get the memory offset */ - n = spanno << 9; - /* point a char * at the address location */ - cp = (char *) &maddr[DADDR + n]; - *cp = loc; /* set address in T1 chip */ - cp = (char *) &maddr[DDATA + n]; - /* point a char * at the data location */ - return(*cp); -} - -/* get input from the status register */ -static unsigned char getctlreg(void) -{ -register char *cp; - - cp = (char *) &maddr[CTLREG]; - return(*cp); -} - -static void set_clear(void) -{ - int i,j,s; - unsigned short val=0; - for (s=0;s<2;s++) { - for (i=0;ipvt; - unsigned long flags; -#if 0 - printk("Setting bits to %x hex on channel %s\n", bits, chan->name); -#endif - if (card_type == TYPE_E1) { /* do it E1 way */ - if (chan->chanpos > 30) return 0; /* cant do this for chan 31 */ - n = chan->chanpos - 1; - k = p->span; - b = (n % 15) + 1; - c = txsigs[k][b]; - m = (n / 15) * 4; /* nibble selector */ - c &= (15 << m); /* keep the other nibble */ - c |= (bits & 15) << (4 - m); /* put our new nibble here */ - txsigs[k][b] = c; - /* output them into the chip */ - t1out(k + 1,0x40 + b,c); - return 0; - } - n = chan->chanpos - 1; - k = p->span; - b = (n / 8); /* get byte number */ - m = 1 << (n & 7); /* get mask */ - c = txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_ABIT) c |= m; - txsigs[k][b] = c; - write_lock_irqsave(&torisa, flags); - t1out(k + 1,0x70 + b,c); - b += 3; /* now points to b bit stuff */ - /* get current signalling values */ - c = txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_BBIT) c |= m; - /* save new signalling values */ - txsigs[k][b] = c; - /* output them into the chip */ - t1out(k + 1,0x70 + b,c); - b += 3; /* now points to c bit stuff */ - /* get current signalling values */ - c = txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_CBIT) c |= m; - /* save new signalling values */ - txsigs[k][b] = c; - /* output them into the chip */ - t1out(k + 1,0x70 + b,c); - b += 3; /* now points to d bit stuff */ - /* get current signalling values */ - c = txsigs[k][b]; - c &= ~m; /* clear mask bit */ - /* set mask bit, if bit is to be set */ - if (bits & ZT_DBIT) c |= m; - /* save new signalling values */ - txsigs[k][b] = c; - /* output them into the chip */ - t1out(k + 1,0x70 + b,c); - write_unlock_irqrestore(&torisa, flags); - return 0; -} - -static inline int getspan(struct zt_span *span) -{ - if (span == spans) - return 1; - if (span == spans + 1) - return 2; - return -1; -} - -static int torisa_shutdown(struct zt_span *span) -{ - int i; - int tspan; - int wasrunning; - unsigned long flags; - - tspan = getspan(span); - if (tspan < 0) { - printk("TorISA: Span '%d' isn't us?\n", span->spanno); - return -1; - } - - write_lock_irqsave(&torisa, flags); - wasrunning = span->flags & ZT_FLAG_RUNNING; - - span->flags &= ~ZT_FLAG_RUNNING; - /* Zero out all registers */ - for (i = 0; i< 0xff; i++) t1out(tspan, i, 0); - if (wasrunning) - spansstarted--; - write_unlock_irqrestore(&torisa, flags); - if (!spans[0].flags & ZT_FLAG_RUNNING && - !spans[1].flags & ZT_FLAG_RUNNING) - /* No longer in use, disable interrupts */ - setctlreg(clockvals[syncsrc]); - - if (debug) - printk("Span %d (%s) shutdown\n", span->spanno, span->name); - return 0; -} - -static int torisa_startup(struct zt_span *span) -{ - unsigned long endjif; - int i; - int tspan; - unsigned long flags; - char *coding; - char *framing; - char *crcing; - int alreadyrunning; - - tspan = getspan(span); - if (tspan < 0) { - printk("TorISA: Span '%d' isn't us?\n", span->spanno); - return -1; - } - - - write_lock_irqsave(&torisa, flags); - - alreadyrunning = span->flags & ZT_FLAG_RUNNING; - - /* initialize the start value for the last ec buffer */ - for(i = 0; i < span->channels; i++) - { - last_ecwrite[tspan - 1][i] = ZT_LIN2X(0,&span->chans[i]); - } - crcing = ""; - if (card_type == TYPE_T1) { /* if its a T1 card */ - if (!alreadyrunning) { - - setctlreg(MASTERCLOCK); - /* Zero out all registers */ - for (i = 0x20; i< 0x40; i++) - t1out(tspan, i, 0); - for (i = 0x60; i< 0x80; i++) - t1out(tspan, i, 0); - - /* Full-on Sync required (RCR1) */ - t1out(tspan, 0x2b, 8); - /* RSYNC is an input (RCR2) */ - t1out(tspan, 0x2c, 8); - /* RBS enable (TCR1) */ - t1out(tspan, 0x35, 0x10); - /* TSYNC to be output (TCR2) */ - t1out(tspan, 0x36, 4); - /* Tx & Rx Elastic store, sysclk = 2.048 mhz, loopback controls (CCR1) */ - t1out(tspan, 0x37, 0x8c); - } - /* Enable F bits pattern */ - i = 0x20; - if (span->lineconfig & ZT_CONFIG_ESF) - i = 0x88; - if (span->lineconfig & ZT_CONFIG_B8ZS) - i |= 0x44; - t1out(tspan, 0x38, i); - if (i & 0x80) - coding = "ESF"; - else - coding = "SF"; - if (i & 0x40) - framing = "B8ZS"; - else { - framing = "AMI"; - t1out(tspan,0x7e,0x1c); /* F bits pattern (0x1c) into FDL register */ - } - t1out(tspan, 0x7c, span->txlevel << 5); - - if (!alreadyrunning) { - /* LIRST to 1 in CCR3 */ - t1out(tspan, 0x30, 1); - - /* Wait 100 ms */ - endjif = jiffies + 10; - write_unlock_irqrestore(&torisa, flags); - - while(jiffies < endjif); /* wait 100 ms */ - - write_lock_irqsave(&torisa, flags); - t1out(tspan,0x30,0x40); /* set CCR3 to 0x40, resetting Elastic Store */ - - span->flags |= ZT_FLAG_RUNNING; - spansstarted++; - -#if 0 - printk("Enabling interrupts: %d\n", clockvals[syncsrc] | INTENA); -#endif - - /* output the clock info and enable interrupts */ - setctlreg(clockvals[syncsrc] | INTENA); - } - set_clear(); /* this only applies to a T1 */ - } else { /* if its an E1 card */ - u_char ccr1 = 0, tcr1 = 0; - - if (!alreadyrunning) { - t1out(tspan,0x1a,4); /* CCR2: set LOTCMC */ - for(i = 0; i <= 8; i++) t1out(tspan,i,0); - for(i = 0x10; i <= 0x4f; i++) if (i != 0x1a) t1out(tspan,i,0); - t1out(tspan,0x10,0x20); /* RCR1: Rsync as input */ - t1out(tspan,0x11,6); /* RCR2: Sysclk=2.048 Mhz */ - t1out(tspan,0x12,8); /* TCR1: TSiS mode */ - } - tcr1 = 8; /* base TCR1 value: TSis mode */ - if (span->lineconfig & ZT_CONFIG_CCS) { - ccr1 |= 8; /* CCR1: Rx Sig mode: CCS */ - coding = "CCS"; - } else { - tcr1 |= 0x20; - coding = "CAS"; - } - if (span->lineconfig & ZT_CONFIG_HDB3) { - ccr1 |= 0x44; /* CCR1: TX and RX HDB3 */ - framing = "HDB3"; - } else framing = "AMI"; - if (span->lineconfig & ZT_CONFIG_CRC4) { - ccr1 |= 0x11; /* CCR1: TX and TX CRC4 */ - crcing = "/CRC4"; - } - t1out(tspan,0x12,tcr1); - t1out(tspan,0x14,ccr1); - t1out(tspan, 0x18, 0x80); - - if (!alreadyrunning) { - t1out(tspan,0x1b,0x8a); /* CCR3: LIRST & TSCLKM */ - t1out(tspan,0x20,0x1b); /* TAFR */ - t1out(tspan,0x21,0x5f); /* TNAFR */ - t1out(tspan,0x40,0xb); /* TSR1 */ - for(i = 0x41; i <= 0x4f; i++) t1out(tspan,i,0x55); - for(i = 0x22; i <= 0x25; i++) t1out(tspan,i,0xff); - /* Wait 100 ms */ - endjif = jiffies + 10; - write_unlock_irqrestore(&torisa, flags); - while(jiffies < endjif); /* wait 100 ms */ - write_lock_irqsave(&torisa, flags); - t1out(tspan,0x1b,0x9a); /* CCR3: set also ESR */ - t1out(tspan,0x1b,0x82); /* CCR3: TSCLKM only now */ - - /* output the clock info and enable interrupts */ - setctlreg(clockvals[syncsrc] | INTENA); - } - - } - - write_unlock_irqrestore(&torisa, flags); - - if (debug) { - if (card_type == TYPE_T1) { - if (alreadyrunning) - printk("TorISA: Reconfigured span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, zt_lboname(span->txlevel)); - else - printk("TorISA: Startup span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, zt_lboname(span->txlevel)); - } else { - if (alreadyrunning) - printk("TorISA: Reconfigured span %d (%s/%s%s) 120 ohms\n", span->spanno, coding, framing, crcing); - else - printk("TorISA: Startup span %d (%s/%s%s) 120 ohms\n", span->spanno, coding, framing, crcing); - } - } - if (syncs[0] == span->spanno) printk("SPAN %d: Primary Sync Source\n",span->spanno); - if (syncs[1] == span->spanno) printk("SPAN %d: Secondary Sync Source\n",span->spanno); - return 0; -} - -static int torisa_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - if (debug) - printk("TorISA: Configuring span %d\n", span->spanno); - - span->syncsrc = syncsrc; - - /* remove this span number from the current sync sources, if there */ - if (syncs[0] == span->spanno) syncs[0] = 0; - if (syncs[1] == span->spanno) syncs[1] = 0; - /* if a sync src, put it in proper place */ - if (lc->sync) syncs[lc->sync - 1] = span->spanno; - - /* If we're already running, then go ahead and apply the changes */ - if (span->flags & ZT_FLAG_RUNNING) - return torisa_startup(span); - - return 0; -} - -static int torisa_chanconfig(struct zt_chan *chan, int sigtype) -{ - int alreadyrunning; - unsigned long flags; - alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING; - if (debug) { - if (alreadyrunning) - printk("TorISA: Reconfigured channel %d (%s) sigtype %d\n", chan->channo, chan->name, sigtype); - else - printk("TorISA: Configured channel %d (%s) sigtype %d\n", chan->channo, chan->name, sigtype); - } - write_lock_irqsave(&torisa, flags); - if (alreadyrunning && (card_type == TYPE_T1)) - set_clear(); - write_unlock_irqrestore(&torisa, flags); - return 0; -} - -static int torisa_open(struct zt_chan *chan) -{ -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int torisa_close(struct zt_chan *chan) -{ -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - return 0; -} - -static int torisa_maint(struct zt_span *span, int cmd) -{ - int tspan = getspan(span); - - switch(cmd) { - case ZT_MAINT_NONE: - t1out(tspan,0x1a,4); /* clear system */ - break; - case ZT_MAINT_LOCALLOOP: - t1out(tspan,0x1a,5); /* local loopback */ - break; - case ZT_MAINT_REMOTELOOP: - t1out(tspan,0x37,6); /* remote loopback */ - break; - case ZT_MAINT_LOOPUP: - if (card_type == TYPE_E1) return -ENOSYS; - t1out(tspan,0x30,2); /* send loopup code */ - break; - case ZT_MAINT_LOOPDOWN: - if (card_type == TYPE_E1) return -ENOSYS; - t1out(tspan,0x30,4); /* send loopdown code */ - break; - case ZT_MAINT_LOOPSTOP: - if (card_type == TYPE_T1) - t1out(tspan,0x30,0); /* stop sending loopup code */ - break; - default: - printk("torisa: Unknown maint command: %d\n", cmd); - break; - } - return 0; -} - -static int taskletpending; - -static struct tasklet_struct torisa_tlet; - -static void torisa_tasklet(unsigned long data) -{ - int x,y; - u_char mychunk[2][ZT_CHUNKSIZE]; - taskletrun++; - if (taskletpending) { - taskletexec++; - /* Perform receive data calculations. Reverse to run most - likely master last */ - if (spans[1].flags & ZT_FLAG_RUNNING) { - /* Perform echo cancellation */ - for (x=0;x> (j * 8)) & 0xff; - readdata[curread][j * channels_per_span + n - 1][passno % ZT_CHUNKSIZE] = rxc; - } - } - - i = passno & 127; - /* if an E1 card, do rx signalling for it */ - if (i < 3 && (card_type == TYPE_E1)) { /* if an E1 card */ - for(j = (i * 3); j < (i * 3) + 5; j++) - { - for(k = 1,x = j; k <= 2; k++,x += channels_per_span) { - c = t1in(k,0x31 + j); - rxc = c & 15; - if (rxc != chans[x + 15].rxsig) { - /* Check for changes in received bits */ - if (!(chans[x + 15].sig & ZT_SIG_CLEAR)) - zt_rbsbits(&chans[x + 15], rxc); - } - rxc = c >> 4; - if (rxc != chans[x].rxsig) { - /* Check for changes in received bits */ - if (!(chans[x].sig & ZT_SIG_CLEAR)) - zt_rbsbits(&chans[x], rxc); - } - } - } - } - /* if a t1 card, do rx signalling for it */ - if ((i < 6) && (card_type == TYPE_T1)) { - k = (i / 3); /* get span */ - n = (i % 3); /* get base */ - abits = t1in(k + 1, 0x60 + n); - bbits = t1in(k + 1, 0x63 + n); - cbits = t1in(k + 1, 0x66 + n); - dbits = t1in(k + 1, 0x69 + n); - for (j=0; j< 8; j++) { - /* Get channel number */ - i = (k * 24) + (n * 8) + j; - rxc = 0; - if (abits & (1 << j)) rxc |= ZT_ABIT; - if (bbits & (1 << j)) rxc |= ZT_BBIT; - if (cbits & (1 << j)) rxc |= ZT_CBIT; - if (dbits & (1 << j)) rxc |= ZT_DBIT; - if (chans[i].rxsig != rxc) { - /* Check for changes in received bits */ - if (!(chans[i].sig & ZT_SIG_CLEAR)) - zt_rbsbits(&chans[i], rxc); - } - } - } - - if (!(passno & 0x7)) { - for(i = 0; i < 2; i++) - { - /* if alarm timer, and it's timed out */ - if (alarmtimer[i]) { - if (!--alarmtimer[i]) - { - /* clear recover status */ - spans[i].alarms &= ~ZT_ALARM_RECOVER; - if (card_type == TYPE_T1) - t1out(i + 1,0x35,0x10); /* turn off yel */ - else - t1out(i + 1,0x21,0x5f); /* turn off remote alarm */ - zt_alarm_notify(&spans[i]); /* let them know */ - } - } - } - } - - i = passno & 511; - if ((i == 100) || (i == 101)) - { - j = 0; /* clear this alarm status */ - i -= 100; - if (card_type == TYPE_T1) { - c = t1in(i + 1,0x31); /* get RIR2 */ - spans[i].rxlevel = c >> 6; /* get rx level */ - t1out(i + 1,0x20,0xff); - c = t1in(i + 1,0x20); /* get the status */ - /* detect the code, only if we are not sending one */ - if ((!spans[i].mainttimer) && (c & 0x80)) /* if loop-up code detected */ - { - /* set into remote loop, if not there already */ - if ((loopupcnt[i]++ > 80) && - (spans[i].maintstat != ZT_MAINT_REMOTELOOP)) - { - t1out(i + 1,0x37,0x9c); /* remote loopback */ - spans[i].maintstat = ZT_MAINT_REMOTELOOP; - } - } else loopupcnt[i] = 0; - /* detect the code, only if we are not sending one */ - if ((!spans[i].mainttimer) && (c & 0x40)) /* if loop-down code detected */ - { - /* if in remote loop, get out of it */ - if ((loopdowncnt[i]++ > 80) && - (spans[i].maintstat == ZT_MAINT_REMOTELOOP)) - { - t1out(i + 1,0x37,0x8c); /* normal */ - spans[i].maintstat = ZT_MAINT_NONE; - } - } else loopdowncnt[i] = 0; - if (c & 3) /* if red alarm */ - { - j |= ZT_ALARM_RED; - } - if (c & 8) /* if blue alarm */ - { - j |= ZT_ALARM_BLUE; - } - } else { /* its an E1 card */ - t1out(i + 1,6,0xff); - c = t1in(i + 1,6); /* get the status */ - if (c & 9) /* if red alarm */ - { - j |= ZT_ALARM_RED; - } - if (c & 2) /* if blue alarm */ - { - j |= ZT_ALARM_BLUE; - } - } - /* only consider previous carrier alarm state */ - spans[i].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); - n = 1; /* set to 1 so will not be in yellow alarm if we dont - care about open channels */ - /* if to have yellow alarm if nothing open */ - if (spans[i].lineconfig & ZT_CONFIG_NOTOPEN) - { - /* go thru all chans, and count # open */ - for(n = 0,k = (i * channels_per_span); k < (i * channels_per_span) + channels_per_span; k++) - { - if ((chans[k].flags & ZT_FLAG_OPEN) || - (chans[k].flags & ZT_FLAG_NETDEV)) n++; - } - /* if none open, set alarm condition */ - if (!n) j |= ZT_ALARM_NOTOPEN; - } - /* if no more alarms, and we had some */ - if ((!j) && spans[i].alarms) - { - alarmtimer[i] = ZT_ALARMSETTLE_TIME; - } - if (alarmtimer[i]) j |= ZT_ALARM_RECOVER; - /* if going into alarm state, set yellow (remote) alarm */ - if ((j) && (!spans[i].alarms)) { - if (card_type == TYPE_T1) t1out(i + 1,0x35,0x11); - else t1out(i + 1,0x21,0x7f); - } - if (c & 4) /* if yellow alarm */ - j |= ZT_ALARM_YELLOW; - if (spans[i].maintstat || spans[i].mainttimer) j |= ZT_ALARM_LOOPBACK; - spans[i].alarms = j; - zt_alarm_notify(&spans[i]); - } - if (!(passno % 8000)) /* even second boundary */ - { - /* do both spans */ - for(i = 1; i <= 2; i++) - { - if (card_type == TYPE_T1) { - /* add this second's BPV count to total one */ - spans[i - 1].bpvcount += t1in(i,0x24) + (t1in(i,0x23) << 8); - } else { - /* add this second's BPV count to total one */ - spans[i - 1].bpvcount += t1in(i,1) + (t1in(i,0) << 8); - } - } - } - /* re-evaluate active sync src */ - mysyncsrc = 0; - /* if primary sync specified, see if we can use it */ - if (syncs[0]) - { - /* if no alarms, use it */ - if (!(spans[syncs[0] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | - ZT_ALARM_LOOPBACK))) mysyncsrc = syncs[0]; - } - /* if we dont have one yet, and there is a secondary, see if we can use it */ - if ((!mysyncsrc) && (syncs[1])) - { - /* if no alarms, use it */ - if (!(spans[syncs[1] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | - ZT_ALARM_LOOPBACK))) mysyncsrc = syncs[1]; - } - /* on the E1 card, the PLL takes a bit of time to lock going - between internal and external clocking. There needs to be some - settle time before actually changing the source, otherwise it will - oscillate between in and out of sync */ - if (card_type == TYPE_E1) - { - /* if stable, add to count */ - if (lastsyncsrc == mysyncsrc) mysynccnt++; else mysynccnt = 0; - lastsyncsrc = mysyncsrc; - /* if stable sufficiently long, change it */ - if (mysynccnt >= E1SYNCSTABLETHRESH) - { - mysynccnt = 0; - syncsrc = mysyncsrc; - } - } - else syncsrc = mysyncsrc; /* otherwise on a T1 card, just use current value */ - /* update sync src info */ - spans[0].syncsrc = spans[1].syncsrc = syncsrc; - /* If this is the last pass, then prepare the next set */ - /* clear outbit, restore interrupt enable */ - setctlreg(clockvals[syncsrc] | INTENA); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} - - -static int torisa_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - struct torisa_debug td; - switch(cmd) { - case TORISA_GETDEBUG: - td.txerrors = txerrors; - td.irqcount = irqcount; - td.taskletsched = taskletsched; - td.taskletrun = taskletrun; - td.taskletexec = taskletexec; - td.span1flags = spans[0].flags; - td.span2flags = spans[1].flags; - if (copy_to_user((struct torisa_debug *)data, &td, sizeof(td))) - return -EFAULT; - return 0; - default: - return -ENOTTY; - } - return 0; -} - -static int __init tor_init(void) -{ - if (!base) { - printk("Specify address with base=0xNNNNN\n"); - return -EIO; - } - if (tor_probe()) { - printk(KERN_ERR "No ISA tormenta card found at %05lx\n", base); - return -EIO; - } - if (request_irq(irq, torisa_intr, ZAP_IRQ_DISABLED, "torisa", NULL)) { - printk(KERN_ERR "Unable to request tormenta IRQ %d\n", irq); - return -EIO; - } - if (!request_mem_region(base, 4096, "Tormenta ISA")) { - printk(KERN_ERR "Unable to request 4k memory window at %lx\n", base); - free_irq(irq, NULL); - return -EIO; - } - - strcpy(spans[0].name, "TorISA/1"); - zap_copy_string(spans[0].desc, "ISA Tormenta Span 1", sizeof(spans[0].desc)); - spans[0].manufacturer = "Digium"; - zap_copy_string(spans[0].devicetype, "Tormenta ISA", sizeof(spans[0].devicetype)); - spans[0].spanconfig = torisa_spanconfig; - spans[0].chanconfig = torisa_chanconfig; - spans[0].startup = torisa_startup; - spans[0].shutdown = torisa_shutdown; - spans[0].rbsbits = torisa_rbsbits; - spans[0].maint = torisa_maint; - spans[0].open = torisa_open; - spans[0].close = torisa_close; - spans[0].channels = channels_per_span; - spans[0].chans = &chans[0]; - spans[0].flags = ZT_FLAG_RBS; - spans[0].ioctl = torisa_ioctl; - spans[0].irq = irq; - - if (card_type == TYPE_E1) { - spans[0].spantype = "E1"; - spans[0].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF; - spans[0].deflaw = ZT_LAW_ALAW; - } else { - spans[0].spantype = "T1"; - spans[0].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4; - spans[0].deflaw = ZT_LAW_MULAW; - } - - spans[1] = spans[0]; - strcpy(spans[1].name, "TorISA/2"); - strcpy(spans[1].desc, "ISA Tormenta Span 2"); - spans[1].chans = &chans[channels_per_span]; - - init_waitqueue_head(&spans[0].maintq); - init_waitqueue_head(&spans[1].maintq); - - make_chans(); - if (zt_register(&spans[0], prefmaster)) { - printk(KERN_ERR "Unable to register span %s\n", spans[0].name); - return -EIO; - } - if (zt_register(&spans[1], 0)) { - printk(KERN_ERR "Unable to register span %s\n", spans[1].name); - zt_unregister(&spans[0]); - return -EIO; - } - tasklet_init(&torisa_tlet, torisa_tasklet, (long)0); - printk("TORISA Loaded\n"); - return 0; -} - - -#if !defined(LINUX26) -static int __init set_tor_base(char *str) -{ - base = simple_strtol(str, NULL, 0); - return 1; -} - -__setup("tor=", set_tor_base); -#endif - -static void __exit tor_exit(void) -{ - free_irq(irq, NULL); - release_mem_region(base, 4096); - if (spans[0].flags & ZT_FLAG_REGISTERED) - zt_unregister(&spans[0]); - if (spans[1].flags & ZT_FLAG_REGISTERED) - zt_unregister(&spans[1]); -} - -MODULE_AUTHOR("Mark Spencer "); -MODULE_DESCRIPTION("Tormenta ISA Zapata Telephony Driver"); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -#ifdef LINUX26 -module_param(prefmaster, int, 0600); -module_param(base, long, 0600); -module_param(irq, int, 0600); -module_param(syncsrc, int, 0600); -module_param(debug, int, 0600); -#else -MODULE_PARM(prefmaster, "i"); -MODULE_PARM(base, "i"); -MODULE_PARM(irq, "i"); -MODULE_PARM(syncsrc, "i"); -MODULE_PARM(debug, "i"); -#endif - -module_init(tor_init); -module_exit(tor_exit); diff --git a/zaptel/kernel/tormenta2.rbt b/zaptel/kernel/tormenta2.rbt deleted file mode 100644 index 9238b8a5..00000000 --- a/zaptel/kernel/tormenta2.rbt +++ /dev/null @@ -1,17482 +0,0 @@ -Xilinx ASCII Bitstream -Created by Bitstream F.23 -Design name: tormenta2.ncd -Architecture: spartan2 -Part: 2s50pq208 -Date: Thu Oct 10 09:00:52 2002 -Bits: 559200 -11111111111111111111111111111111 -10101010100110010101010101100110 -00110000000000001000000000000001 -00000000000000000000000000000111 -00110000000000010110000000000001 -00000000000000000000000000001011 -00110000000000010010000000000001 -00000000100000000011111100101101 -00110000000000001100000000000001 -00000000000000000000000000000000 -00110000000000001000000000000001 -00000000000000000000000000001001 -00110000000000000010000000000001 -00000000000000000000000000000000 -00110000000000001000000000000001 -00000000000000000000000000000001 -00110000000000000100000000000000 -01010000000000000011111000000100 -00000000000100100011000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -10000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100100011000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010000000000100 -10000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -10000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -10000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100100000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010000000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -11111111000100100000000000000000 -00000000000000011000000000000000 -01000000000000000001100000000000 -00000100000000000000000010000000 -00000000011000000000000000011000 -00000000000010100000000000000010 -10000000000000000010000000000000 -00101000000000000000001000000000 -00000000000000000000000000100000 -00000000000010000001111111000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111101000000000 -11111111100000000011111100000000 -10001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111110000 -00000011011111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110001000000000 -10111011100000000010111000110100 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010101011100000000010111011 -10000000001011101110000000001011 -10111000000000101110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100100000000000 -10100011000000000010110010000000 -00001011001100000010011010001100 -00000000101100110000000000101000 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000001101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010000000000000 -10111011000000000010111011000010 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110010 -10000010111011000000000010111011 -00000000001011101100000000011011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110100000000 -11111011000000000011111000010000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110111100 -00000011011011000000000011111011 -00000000001111101100000000001111 -10110000010000111100100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011000001000000 -11111111000000000011111010100100 -00001111111100000000000111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111110111000 -00000011101111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000010011111000010000 -00101100101100000000001111101100 -00000000111110110000000000110110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111100110000 -00000011101011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010000000000000 -10111011000101100010111010000000 -00001000101100000000001011101100 -00000000101110110000000000100110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010001011000000000010111011 -00000000001011101100000000001011 -10111000100000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100010000000000 -10110011000000000010110001000000 -00001000001100000000001001001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100000000 -00000010100011000000000010110011 -00000000001011001100000000001011 -00111110000000101111000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -01100000000000010001001000000000 -10110111100000000010110100100000 -00001000011110000100001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101001000 -00000010000111100000000010110111 -10000000001011011110000000001011 -01111000000000101101100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110001000000 -11110011000000000011110011000000 -00001100001100010010001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100000000 -00000011100011000000000011110011 -00000000001111001100000000001111 -00110000000000111101101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011000000010000 -11111111000000000011111111000100 -00001111111100000000001111111100 -00001000111111110000000000110111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111000000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000011011110010000010000 -11111011000000000011111001000000 -00001100101100000000001111101100 -00001000111110110000000001111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111100000000 -00000011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000011001000000000000 -10110111000000000010110001000000 -00001000011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101000000 -00000010000111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000001000000001001111000000000 -10110111100000000010110111100000 -00011000011110000001001011011110 -00000001101101111000000100101001 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101111000000 -00000010000111100000000010110111 -10000000001011011110000000001011 -01111000000000101111000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000100101001100000000000000 -10110011000000000010110011000000 -00011000001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100000000 -00000010000011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001100000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011011100000000000 -11111010000000000011111110011100 -00101100101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111111100000 -00000011001010000000000011111010 -00000000001111101000000000001111 -00100000000000111111101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000010000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000100000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001100000000011110001000000 -00001101100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000110000001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000100000010111001000000 -00001000100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10011000000010100010000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010110000000000 -10111001000000000010111001000000 -00001000100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010010100000100000011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001100000000010110001001000 -00101000000100000000001011000100 -00000000100100010000000001101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000100100010010 -10000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000100000001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000001010110000000000000 -11111000000000000011111000000000 -00001100100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000010 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000110010111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000101011111010000000000 -11111001000001000011111101000100 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111111010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011110010000000000 -11001001000000000011111001000000 -00001100100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011001001000000000011111001 -00000000001111100100000000001111 -01010000000000111110011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10001000000000000010111000000000 -00001000100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010101000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011110010000000000 -10000001000000000010100001000000 -00001000000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -10000100000000001011000100000000 -00101100010000000000101110010000 -00000010000001000000000010110001 -00000000001011000100000000001011 -00010000000001101100001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10001001000000000010111001001010 -00001000100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010101001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011100010001000010 -11001001000000010011111001000000 -00101100100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111100010000 -00000011001001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010011000000000 -11111011000000010011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11001000000000000011110000000000 -00001100100000000000001111100000 -00000000111110000000000000110110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000100000110000101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000001010010100000000000 -10001010000000000010111010000000 -00001000101000000000001011101000 -00000000101110100000000000100110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -11100000000000100000101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000010 -10000010000001000010110011000000 -00001000001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000100100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010011110000000000 -10000111010000000010110111000000 -00001000011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01111000000000100100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11000100100000010011110011100000 -00101100011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01101000000000110100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011000110000000000 -11111000011000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000110110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000010001111 -10000000000010111000001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111110110000100011001111100000 -00001100111110000000001101111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011001111100000000011111111 -10000000001111111110000000001111 -11111000000000111101000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000100000 -10110111000000000011010111000000 -00001000011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000011110111000000000010110111 -00000000001011011100000000001011 -01100010000000101110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000000000 -10110110000000000010000111000000 -00001000011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010000111000000000010110111 -00000000001011011100000000001011 -01110000000000101100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110010000000000010010011000000 -00001000001100000000001011001100 -00000000101100110000000000100100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00000000000001101101100100000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11111000000101011010110100000000 -11111011000000000011001011000010 -00101100101100000000001101101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011001011000000000011111011 -00000000001111101100000000001111 -10010000000000111110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000100000000001110110000000000 -11111011000000010011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111100110000 -00000011111011000000000011111011 -00000010001111101100000000001111 -10010000000000111110010000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001111110000100000 -11111101100000010011111011000010 -00001111111100000000001110111100 -00000000111111110000000000111111 -11000000000010111111000000000011 -11111100000000001111111100000000 -00111111110000000000111110110000 -00000011001111000000000011111111 -00000000001111111100000000001111 -11101000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000100 -10111000110110000010111011000000 -00001001101100000000001011101100 -00000000101110110000000000101110 -11000000000010011011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010101011000000000010111011 -00000000001011101100000000001011 -10000000000000101110000101100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111001000000000010111011000000 -00001011101100000000001001101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010001011000000000010111011 -00000000001011101100000001001011 -10010010000100101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110001000000000010110011000000 -00001001001100000000001011001100 -00000000101100110000000000101100 -11000000000110010011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011000000000010110011 -00000000001011001100000000001011 -00000000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -11111001000000000011111011000000 -00001111101100000000001110101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11110100000001000011111111000000 -00001101111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11000000000000111110100000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111000000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111110010000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11001000000000110111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011110100010010111011100000 -00001011101110000000001110101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011100010000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10001000000000100010000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10100011000001000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011000000000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00000000000001100110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000010000 -10111011000000000010111011000000 -00001011101100000000001010101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000011011100000001000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000011011 -10110000000000100111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111111000000100011111011000000 -00001111101100000000001011101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000010111011 -00000000001111101100000000001011 -10011001000000110101000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000000111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000100001111111100100000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11000000000000111011100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011001000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111100101000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10010000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111111100000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011100100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -00110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011010000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011000000000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00100010000000101111100100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011010010000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01001000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110001000000 -11110011000010000011110011000000 -00001111001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110001 -00000011110011000000000011110011 -00000000001111001100000000001111 -00100000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000010000 -11111111000000100011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111101000000 -00111111110000000000111111110000 -01000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111111100000000011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101000000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10111000000000110010101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111100000000011010111000000 -00001110011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011000000000 -00101101110000000000101101110000 -00010010110111000000000010110111 -00000000001011011100000000001011 -01000000000000110101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110011100000000010100111100000 -00011011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -01101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000001100011000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001010001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100110000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110010000000100101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011101010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101010000000 -00111110100000010001111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -11100000000000110011101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011011000000000 -00001110100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000100000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111101100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10011100000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001100000000010111001000000 -00001011100100000000001011100100 -00000000101010010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010101000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001101010000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000001000000011111000000000 -00001111100000000000001111100000 -00000000111010000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000011011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111101100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -01010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111101100000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -11010000000000111100011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000010100000010111000000000 -00001110100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10100000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000000111001000000 -00001010100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000011011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000011011 -10010000010000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101010110010000000000 -11111001000000000010111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100110010000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10011000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000100 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100110000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10011001000000111100101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011001000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000100000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111110100001000010001010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -11100000100000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110000000000001010100011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00111000000000101100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110100110000000010100111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01100000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000001000 -11110100100000000011100111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01011000000000111110101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000010011011010110000000000 -11110000000000100011011011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10000000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111110100000000011001111100100 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111011110000000 -00110011111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111001000000110000000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110110000000000010000111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101001110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000100001011 -01100000000010100010101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110110000000000010000111000000 -00011011011100000000001011011100 -00000000101001110000000000101101 -11000000000010110111000000000010 -11011100000000001011111100000000 -00100001110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -11110000100001100000000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110000000000000010000011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101000110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00101100000000100000100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111001000000001011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00110010110000000000111110110000 -00000011111011000000000010111011 -00000000001111101100000000001011 -00110000000000110010101100000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111000010000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11110101000000000011001111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11000100100000110000000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111001000000000010001011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010011011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10001000000000101010000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000010000010001011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10010100000000100010000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110010000000000010000011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010010011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -10010000000000101000001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10000000000000110000100000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000100 -11110101000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011011111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -01000000000000111110000000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111101000000000 -11111100100000000011111111100000 -00001101111110010000001101111110 -01001000110011111000000000110111 -00000000000011111111100000000011 -11111100000000001101111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000100001110011000000000 -10111000100000000010111011100000 -00001011101100000000001000001100 -00001000100010111000000000101110 -10110000000010111011100000000010 -11111110000000001010101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101111000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11001000000001011100100000000000 -10110001000000000010110011000000 -00001011001100100001001001001100 -10000011100000110000000000101100 -00010000000010110011000000000010 -11001100000000001001001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000100011010010100000000 -10111011000000000010111011000000 -00001011001100000000001000001100 -00000000100010110000001000001110 -11000110000010111011000000000010 -11101100000000000010101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011110110000000000 -11111010010000000011111011000000 -01001101101100000001001101101100 -00000000110010110000000000111110 -01100000000010111011000000000011 -11101100000000001101101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101010000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011011100000000 -11111110000000000011111111000000 -00000011111100000000001111111100 -00000000111111110000010000001110 -11100000000011111111000000000011 -11101100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000100000100001010110100000000 -11101001010000000011111011000000 -00001101101100001000001111101100 -11000000110010110000000000111110 -00010000000011001011000000000011 -11001100000100001110101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -11011000000001010010010000000001 -10001011000000000010111011000000 -00001001101111000000001011101111 -00000000110110110000000000101110 -11000000000011011011000000000010 -11111100000000001000101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100000000010000 -10100001000000000010110011000000 -00001011001100000000001011001100 -00000000100100110000000000101100 -00000000010010000011000000000000 -11001100000000001010001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10110000100000010011001000001000 -10000100100000000110110111100001 -00001011011110000000001011011110 -00000000100101111000010000101101 -00100000000010010111100000000010 -11011110000000001010011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101110110000000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000000000000000 -10100001000000000011110011000000 -00001111001100001000001111001100 -00000000110100110001000000111100 -10000000000011000011000000000011 -11001100000000001110001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110001000000111101001000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011001000001000000 -11111110000100000011111111000000 -00001101111100000000001111111100 -00000000111111110000000000111111 -10000000000011111111000000000011 -11111100000000001101111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110100000010000 -11111011001010000001111011000000 -00001111101100000001101100101110 -00000000110010110000000000111110 -01000000000011001011000000000011 -11101100110000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11001000100100011001000000000000 -00110110000000000010110111000000 -00001011011100000000001000111100 -00000000101001110000000000101100 -11000000000010100111000000000010 -11011100010000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101111001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001001101000000000 -10110101110000000010110111100000 -00001011011110000000001000011110 -00000000100001111000000000101101 -01100000000010000111100000000010 -11011110100000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100001110000000 -10110010100000010110110011000000 -00001011101100000000001000001100 -00000000101000110000000000101100 -11111000000010100011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011011100000100000 -11110010000000000011111010000000 -00001111101000000000001100101000 -00000000110010100000000000111111 -10110000000011001010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101100000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111100 -00000100000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000100 -11111011000000100011001001000000 -00001111100110000000001110100110 -00000000111110010000000000111110 -01000000000011001001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010101001000000 -00001011100100000000001000100110 -00000000101110010000000000101110 -01000000000010001001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000100101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111011000000000010001001000000 -00001011100100100000001010100100 -10000000101110010000000000101110 -01000000000010001001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100111000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10111001000000000010100001000000 -00001011000100000000001000000100 -00000000101100010000000000101100 -01001000000010000001000000100010 -11000100101000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100101000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011001000000000 -00001111001001010000001110101001 -01000000111110000000000000111110 -00000000001011001000000000000011 -11100000100000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011111010000000000 -11111001000000000010111001000000 -00001111100100000000001111100100 -00000000111110010000000000111111 -01000100000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011100010000000000 -11111001000000000011111001000000 -00001111110100000000001100110100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01111000000100001110000000000000 -10111000000000100010111000000000 -00001011100000000000001101100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000110 -00110000000000000000000000000000 -00000000000000000000000000000000 -01001000000001011100010000000000 -10110001000000000110110001000000 -00001011000100000000001000000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000110000110111001000000 -00001011100100000000001001100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001100000000011111001000000 -00001111100100000000001100100100 -00000000111110010000000000111110 -01101100000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -01101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000010000111110 -01100000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11101000010000000011111000000000 -00001111100000000000001111100000 -00000000110010000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10001010000000000010111010000000 -00001011111011000000001011111001 -00000000100010100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10100011000000000010110011000000 -00001011101111001000001011001111 -00100000100000110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010011111000000000 -10000111000000000010110111000000 -00001011011100001000001001011011 -00000000100001110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110000000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11100111100000000011110111100000 -00001111011110000000001111111110 -00000010110001111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000011000111110001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000100011111011000000 -00001111101100000000001111100100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000100101111111100100 -00001111110110010000001100110110 -00000000110011111000000000111111 -11100000000011111111100000000011 -11111110000000001110111110000000 -00111111111000000000111111111000 -00000011011111100000000011111111 -10000000001111111110000000001111 -11111000000000111100000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000110110111000000 -00001011110000000000001101010000 -00000000101001110000000000111101 -11000000000010110111000000000010 -11011100000000001000011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110001000000101110101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -01001011010100000010001000011100 -00000000100001110000000000101101 -11000000000010110111000000000010 -11011100000000001010011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110010000000 -10110011010100000010110011000000 -00001011100100000000001000100000 -00000000101000110000000000101000 -11100100000010110011000000000010 -11001100000000001000001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010111110000000 -11111011010000000011111011000000 -00001111101000000010101000101100 -00000000110010110000000000101110 -11010100000011111011000000000011 -11101100000000001110101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000001000111 -10110000001100101110101100000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011001000000011111011000000 -00001111100000000000001111101001 -00000000111110110000000000111110 -11000000000011111011000000000011 -11001100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111010000000001100111000 -00000000110011110000000000111101 -11000000000011001111000000000011 -11101100000000001100111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000000011 -11110000000000111100100001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110110000000000 -10111011000001000010111011000000 -00001011101011010000001010101011 -00100000110110110000000000101110 -11000000000010101011000000000010 -11101100000000001010101100000000 -00101110110000000000101110110000 -00000010011011000000000010111011 -00000000000011101100000000001011 -10110000000000101110100001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000000010010110000000000 -10111011000000000110111011000000 -00001011101101000000001000100100 -01000000100010110000000000101110 -11000000000010001011000000000010 -11101100000000001000101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000000001101100000000001011 -10110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000001 -00001011000000000000001000000000 -00000000100100110000000000100100 -11000000001010000011000000000010 -11001100000000001010001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011111011000000 -01001111100000000000101100000100 -00000000110010110000000000111110 -11000000000011001011000000000011 -11101100000000001100101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000010111111000000 -00001111110000000000001111110000 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000001111110100001000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111001000000011001111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -00111110000000001111111110000000 -00111111111000000000111111110000 -00000011011111100000000011111111 -10000000001111111110000000001111 -11111000000000110011000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10100000000100001110111000000000 -10111111110100000000001011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -10101110000000001011101110000000 -00101110111000000000101111110000 -00000010101011100000000010111011 -10000000001011101110000000001011 -10110000000000101010000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000100 -10110001000001000010000011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010111001000000000010 -00001100000000001011001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000100010001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011010110000000000 -10111000000010000010001011000000 -00001011101100000000001011101100 -00000000101110110000000000100110 -11000000000110111001110000000010 -10101100000000001011101100000000 -00100110110000000000101110110000 -00000010101011000000000010111011 -00000000001011101100000000001011 -10110000000000101011000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110000000000 -11111101000000001011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011110000000011 -00101100000000001111101100000000 -00111110110000000000111110110000 -00000011011011000000000011111011 -00000000001111101100000000001111 -10110000000000110000000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000000011011110000000000 -11110101000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100001000 -00111111110000000000111110110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011101011000000 -00001111101100000000001101101100 -00000000111110110000000000111110 -11000000000011111001000100000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010001011000000 -00001001101100000000001001101100 -00000000101110110000000000101110 -11000000000010110001000000000010 -11101100000000001011101100001000 -00101110110000000000101111110000 -00001010001011000000000010011011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011100100000010100011000000 -00001001001100000000001011001100 -00000000101100110000000000101100 -11000000000010110010000000000010 -11001100000000001011001111000000 -00101100110000000000101110110000 -00000010000011000000000010010011 -00000000001011001100000000001011 -10110000000000101111100000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -01100000000000010001111000000000 -10110111100000000010000111100000 -00001001011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110010000 -00101101111000000000101101111001 -00000010000111100000000010010111 -10000000001011011110000000001011 -01111000000000101101100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110001000000 -11110001000000000011100011000000 -00001101001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011000011000000000011010011 -00000000001111001100000000001111 -00110000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000010100 -11110101100000000011111111000000 -00001101111100000000001101111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000100 -00111111110000000000111111110100 -00000011111111000000000011011111 -00000000001111111100000000001111 -11110000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011110110000000000 -11110001011000000011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -00101100000000001111001110000000 -00110010110000000000111110110001 -00001011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110101000010010000000111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -10011100000000001011011100000000 -00110101110000000000101100110010 -00000010000111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000001000000001001111000000100 -10110111100000100000000111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010111111100000000010 -00011110000000001011011110000000 -00100001111000000000101101111000 -00000010000111100000000010110111 -10000000001011011110000000001011 -01111000000000101111000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011010100001010000011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -10001100000000001011001100000000 -00100100110000000000101100110000 -00000010000011000000000010110011 -00000000001011001100000000001011 -00110000010000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11110110110000000011001010000000 -01001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111110000000000011 -00101000000000001111101000000000 -00110010100000000000111110100000 -00000011001010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000010000 -11111000000010000011111000000000 -00001111100000000000000111100000 -00000000111110000000000000111110 -00000000000011111000100000000011 -11100000000000001111100001000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011001001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001100000000011 -00100100000000001111100100100000 -00111110010000000000111100010000 -00000011001001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000100001000110010000000000 -10111001000000000110001001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010110001100000000011 -01100100000000001011100111001000 -00101110010000000000101110010000 -00000010001001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000001000010001001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001001000000010 -00100100000000001011100100000000 -00101110010000000000101110010000 -00000010001001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10111001001010000010100001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010111001000000000010 -01000100000000001011000100000000 -00101100010000000000101100010010 -10000010000001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000001000001010001000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -00100000000000001111100000000000 -00111110000000000100111110001010 -00001011001000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111101000000000011011001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011110101000000000011 -11100100000000001111100100000000 -00111110010000000000111110010010 -10000011111001000000000011111001 -00000000001111100100000000001111 -10010010100000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011110010000000000 -11111101100000001011001001000000 -00001011100100000000001111100100 -00000000111110010000000000111110 -01000000000011111101000000000011 -11100100000000001111110100000000 -00111110010000000000111110010000 -00000000101001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000010000 -10111000000000000011011000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010101000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001010000001010000001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001100000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010000001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001001000000010011001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000001000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010101001000000000010111001 -00000000001011100100000000000011 -10010000010000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000001000 -11111001001000100011001001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001010000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011001001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11110001100000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001101000000011 -11100100000000001111100100001000 -00111110010000000000111100010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000010000000011001000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000010000 -00111110000000000100111110000000 -00001011001000000001000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000001010010100000000000 -10111010100000001010001010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010101000000010 -11101000000000001011111000000000 -00101110100000000000101110100000 -00000010001010000000000010111010 -00000000001011101000000000001011 -10100000010000101100101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011100000000010000011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110001000000000010 -11001100000000001011001110000000 -00101100110000010000101100110000 -00000010000011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111010000000010000111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011010000000000 -00101101110000000000101101110000 -00000010000111000000000010110111 -00000000001011011100000000001011 -01110010000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110011100000001011000111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000010011110111100000000011 -11011110000000001111010010000000 -00111101111000000000111100111000 -00000011000111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000000111100000000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110001000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011001111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001011110010010000 -00111111111000000000111111111000 -10000011001111100000000011111111 -10000000001111111110000000001011 -11111001000000111101000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110101000000000010000111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011010000000000 -00101101110000000000101101110000 -00000010100111000000000010110111 -00000000001011011100000000001011 -01110000000100101110101000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000000000 -10110011000000000010000111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011010000000010 -00101101110000000000101100110000 -00000010000111000000000010110111 -00000000001011011100000000001011 -01110000001000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110001001000000010000011000000 -00001011001100000000001011001100 -00000000101100110000000001101100 -11000000000010110011010010000010 -11001100000000001011000000000000 -00101100110000000000101110110000 -00000010100011000000000010110011 -00000000001011001100000000001011 -00110000000000101101100000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11111000000101011010110000000000 -11111011000000001011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011010000000011 -11101100000000001111100000000000 -00111110110000000000111111110000 -00000011001011000000000011111011 -00000000001011101100000000001111 -11110000000000111110111000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000100000000001110110000000000 -11111011000000010011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111100001000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001011101100000000001111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001111110000000000 -11110111000000000011001111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111100000000011 -11111100000010001111110000000000 -00111111110000000000111111110000 -00000011001111000000000011111111 -00000000001111111100000101001111 -11110000000100111110000001100100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000001000 -10111011000000000000101011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011100000000010 -11101100000000001011100011100000 -00101110110000000000101110110000 -00000010101011000000000010111011 -00000010001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010001011000000 -00001011101100000000001011101100 -00000000101110110000000000101010 -11000000000010111011000100000010 -11101100000000001011100010000000 -00101110110000000000101110110000 -00000010001011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110001000000000010100011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000011011000000000000 -00101100110000000000101100110000 -00000010100011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -11111011000000001011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111010 -11000000000011111011000000000011 -11101100000000001111100000000000 -00111110110000000000111110110000 -00000011001011000000000011111011 -00000000001111101100000001001111 -10110000000100111110000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000010000 -11111101000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000000111110000000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000011111111100000000001111 -11110000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000011011111111000000000 -11101111100000000011111111100000 -01001111111110000000001100111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111011000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001110111000000000 -10111011100000000010111011100000 -00001011101000100000001000101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101100000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101111000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11001000000001011100110000000000 -10100011000000000010110011000000 -00001011000100001000111001001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001010 -00110000000000101011001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000110111011000000 -00001011000100001000001001101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000010000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10010000000101011110110000000000 -11101011000000000011111011000000 -10001111100100010000001101101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001011101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111000100000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000001000011111111000000 -00001111110000000001001110111100 -00000100111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01010000000100001010110000000000 -11101011000000000011111011000000 -01001111100101100000101100101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000110001010100000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000010000000111011000000 -10001011101101000000001000101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10111000000000100011001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000001000 -10110011111001000000110011000000 -00001011001100010000001001001100 -00000000001100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110011000000100011000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -11110000000000010001111000000100 -10110111100000000010110111100000 -00001011011010010000011001011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000010100011110000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001010000000000000110000000000 -11110011000000000011110011000000 -10011111101100010110001101001100 -00000000111100110001000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000110001101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011011110000000000 -11111111000000000011111111000000 -00001111111000010000001110111100 -00000000111111110000010000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -01110000000001111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00011111100111001000001100101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11001000100100011001110000000000 -10110111000000000010110111000000 -00001011110100000000001000011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001001111000000000 -10110111100000000010110111100000 -00001010010110000001001000011110 -00000000101001111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010100111 -10000000001011011110000000001010 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00011011001100110000001000001100 -00010000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011010100000000000 -11111010000000000011111010000000 -00001110101000000000101100101000 -00000000111010100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00101110100000000000111110100000 -00000011111010000000000011101010 -00000000001111101000000000001110 -10100000000000101111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000100000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011101001000000 -00001111101100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000110000001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10110001000000000010001001000000 -00001011100110010000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -00010000100000101010000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001010000000010001001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000100000011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010000001000000 -10001011001100000000001011000100 -00000000100100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101000001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000100 -11111000000000001011101000000000 -00001111100001010000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000110010111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100110101000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110111100000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011110010000000001 -11111101000000001011001001000000 -00001111110100000000001100100100 -00000000111110010000000000111110 -01000000000111111001000000000011 -11100100000000001111100100010000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -11010000000000111110111000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -01111000000100001110000000000000 -10111000000000000010001000000000 -00001011000000000000001000100000 -00000000101110000000000000101110 -00000000000011111000000000000010 -11100000000000001011100010100000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100011000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -01001000000001011100010000000000 -10110001000000000010010001000000 -00011011000100000000011001000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100100000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000001101101001000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000001 -10111011000000000010011001000000 -00001011001100000000001001100100 -00000000101110010000000000101110 -01000000000010101001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000010011011 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -10111001000000100011011001000000 -01001111100111110000101101100100 -00000000111110010000000000111110 -01000000000010111001000000000011 -11100100000000001011100100000000 -00111110010000000000101110010000 -00000011111001000000000011111001 -00000000001111100100000000001011 -10010000000000111110000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000000011010010000000000 -11111001000000000011101001000000 -00001111100110000000001110100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000100000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000001000011111000000000 -00001111100000011000001100100000 -00000000111110000000000000111110 -00000000000011111000000001000011 -11100000000000001111100000000000 -00110010000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10110110000010010010111010000000 -00001011111010000000001000101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101010100000000000111010100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -11101100000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110000000000000010110011000000 -00001011001111000000001001001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00100000110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00111000000000101100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110101000000000010110111000000 -00001011010000000000001001011100 -00000000101101110000001000101101 -11000000000010110111000000000010 -11011100000000001011011110000000 -00101001110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01100000100000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110100100000000011110111100000 -01001111011110000000101101011110 -00000000101101111000000000111101 -11100000000011110111100000000011 -11011110000000001111111110000000 -00110001111000000000101101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100001000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111000000000000011111011000000 -10001111101000000000001110101100 -00001000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001011111111000000000 -11111110100000000011111111100000 -00011111011110000000001110111110 -00000000111111111001000000111111 -11100100000001111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000101101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -11100111000100000010110111000000 -00001011010100100000001101011100 -00000000101101110000000000111101 -11000000000011110111000000000010 -11011100000000001011011100000000 -00101101110000000000111001110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01000000000000101110101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000000000 -10110110000000000010110111000000 -00001010111100000000001011011100 -00000000101101110000000100101101 -11000000000110110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001010 -01100000000000101100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000101001100110000000000 -10100010000000000010110011000000 -00001011100000000000001000001100 -00000000101100110000000000101000 -11000000000010100011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000000011 -00000000000000101101000100000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10111000000101011010110000000000 -11111000000000000011111011000000 -00001110101100001000001011101100 -00001000111110110000000000101110 -11000000000010111011000000000011 -11101100000000001111111100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10010000000000101110001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11101001010000000011111011000000 -00001111100000001000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10000000001100111110010100000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001111110000000000 -11111100001000000011111111000000 -00001111110110000000001100111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11011000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000000000110110000000000 -10111001110000000010111011000000 -00001011100001000000001111101100 -00000000101110110000000000101110 -11000000000011001011000000000010 -11101100000000001011111100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10010000000000101110000001100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000001000 -10111010000000000010111011000000 -01001011101000100000011000101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110010000000101110100000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000001 -10110001000000000010110011000000 -00001011000000000000101001001100 -00000000101100110000000000100100 -11000000000010000011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00000000000000101100101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -10111010000000000011111011000000 -00001111101100000000001100101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10100000000000111110000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111101000000000011111111000000 -00001111110000000000001110111100 -00000000111111110000000000111111 -11000000000011101111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000001001111 -11000000000000111110100000100110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000011011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111110000000000110011111000 -00000011010100100000001011001111 -10000000001111111100000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001110111000000000 -10111011100000000010111011100000 -00001011101110000000001110101110 -00000000101110111000000000101110 -11100001000010111011100000000010 -11101110000000001011101110000000 -00101111110000000000101000110000 -00000010001000100000000010001011 -10000000001011111110000000001011 -10111000000000101111000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000100100110000 -00000010110010000000000010000011 -00000000001011001100000000001011 -00110000000000101111001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001010101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000010 -00101110110000000000101110110000 -00000010111010000010000010001011 -00000000001011101100000000001011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000100000101011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000110110110000 -00000011111000010000000011001011 -00000000001111101100000000001111 -10110000000000111100000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111100110000000000111011110000 -01000011001101100100000011111111 -00000000001111101100000000001111 -11110000000000111111110000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000010110010110000 -00000011111010000000000011011011 -00000000001111101100000100001110 -10110000000000111101010000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11011000000000010010110000000000 -10111011000000000010111011000000 -00001110101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000010000010 -11101100000000001011101100000000 -00101111110000000000100010110000 -00000010000011000000000010001011 -00000000001011111100000000001000 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001001001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011100000000010 -11001100000000001011001100000000 -00101100110000000000100010110000 -00000010100001000000000010010011 -00000000001011001100000000001010 -00110000000000101111000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -11110000100000010001111000000100 -10110111100000000010110111100000 -00001010011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000100001111001 -00000010001101100000000010000111 -10000000001011011100000000001000 -01111000000001101111110000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000000000000110001000000 -11110011000000000011110011000000 -00001111001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100010000 -00111100110000000000110000110000 -00000011100001000000000011010011 -00000000001111001100010000001110 -00110000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011011110000000000 -11111111000000000011111111000000 -00001110111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000010 -11111100000000001111111100000000 -00111111110001000000111111110000 -01000011101101000000000011111111 -00000000001111111100100000001111 -11110000000000111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000100 -11111011000000100011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110111010100000110010110000 -00000011001010000000000011111011 -00000000001111101100110000001100 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11001000100100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110100000000101001110000 -00000010000111000000000010110111 -00000000001011001100010000001010 -01110000000000101111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000001000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001010011110 -00000000101001111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101110000000000100001110000 -00000010000110100000000010110111 -10000000001011011110100000001000 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000100101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001001001100000000 -00101100110000000000101000110000 -00000010000011110000000010110011 -00000000001011001100000000001010 -00110000010000101101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011010100000001000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000010110010100000 -00000010001110101000000010111010 -00000000001111101000000000001000 -10100000000000101111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000010 -00111100000000000010111110000100 -00000011111000001000000011111000 -00000000001111000000000000001111 -10000000010000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001101100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001100000000011 -11100100000000001111100100000000 -00111110010000000000110110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000001000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001100000000010 -11100100000000001011100100000000 -00101110010000000000110110010110 -00000010111001000000000010111001 -00000000001011100100000000001000 -10010000000000101110100000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001001000000010 -11100100000000001011100100000000 -00101110010000000000100110010000 -00000010111001000000000010111001 -00000000001011100100000000001010 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000110 -11000100000000001011000100000000 -00101100010010100010100100010000 -00000010110001000000000010110001 -00000010011011000100101000001000 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000101110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111100001010000000110110000000 -00000011111000000000000111111000 -00000000001111100000100100011110 -10000000001001111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000001 -11100100000000001111100100000010 -00111110011010100000111100010010 -10000011111101000000000011111001 -00000000001111100100000000001110 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000101011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111101000000000011 -11100100000000001111100100000000 -00111110010000000000110011010000 -00000011001101000000000011111001 -00000000001111100100000000001111 -10010000000000111110111000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -01111000000010001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000111110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000100010000000 -00000010001000000000000010111000 -00000000001011100000000000001011 -10000000000000111100111000000010 -00110000000000000000000000000000 -00000000000000000000000000000000 -01001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000010100000010000 -00000010010001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101010010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000100010010000 -00000010011001000000000010111001 -00000000001011100100000000001011 -10010000010000101000011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000101110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000110010010000 -01000011011001100100000011111001 -00000000001111100100000000001011 -10010000000000101110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011101001100000000011111001 -00000000001111100100000000001111 -10010000000000111101101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000110010000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010100000000010 -11101000000000001011101000000000 -00101110100000000000110101100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110001100000000110 -11001100000000001011001100000000 -00101110110000000000100000000000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000100010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000010000010 -11011100000000001011011100000000 -00101101110000000000100101001000 -00000010110111000000000010110111 -00000000001011011100000001001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000000000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000101101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111111111100000000110001010000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000100001111101100000000 -00111110110010100000111110010000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111001000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111011001000 -00000011000111100000000011001111 -10000000001111111110000000001100 -11111001000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000001 -00101101110000000000100001000000 -00000011010111000100000011010111 -00000000001011011100000000001101 -01110000001000101110101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000001000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101001010000 -00000010001111000000000010000111 -00000000001011011100000000001000 -01110000001000001100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101110110000000000100010010000 -00000010010011000000000010010011 -00000000001011001100000000001001 -00110000000000101101000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011110011000000000011 -11101100000000001111101100000000 -00111111110000000010111010100000 -00000011001011010000000011001011 -00000000001111101100000000001000 -10110000000000111110111000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10010100000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000010011 -11101100000000001111101100000000 -00111110110000000000111110100000 -00000011111011001000000011111011 -00000000001111001100000100001111 -10110000000000111110100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -00111100000000001111111100000000 -00111110110000000000110011110001 -00000011001111000000000011111111 -00000000001111101100000000001100 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011100000000010 -00101100000000001011101100000000 -00101110110000000000100010110000 -01000010101011000000000010111011 -00000000001011101100000000001010 -10110000000000101110010001100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000100000010 -00101100000000001011101100000000 -00101110110000000000100010100000 -00000010001011000000000010111011 -00000000001011101100000000001000 -10110000000100101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -00001100000000001011001100000000 -00101100110000000000100000100000 -00000010100011000000000010110011 -00000000001011001100000000001010 -00110000000000101100001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -00101100000000001111101100000000 -00111111110000000000110000110000 -00010011001011000001000011111011 -00000000001111101100000000001100 -10110000000000111110000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000010011111111000000000011 -11111100000000001111111100000010 -00111111110000000010111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100000100100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000011011111111000000000 -11111111100000000011111111100000 -00001111111110000000011111111110 -01000000111111111000000000110011 -11100000000011111111110000000011 -00111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000010001110111000000000 -10111011100000000010111011100000 -00001011101110000000001011101100 -10000000101110111000000000101010 -11100000000010111011000000000011 -01101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000100001011 -10111000000000101111000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000011011001100 -00000000101100110000000000100000 -11000000000010110011001000000010 -00001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001010 -00110000000000101011001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011010110000000000 -10111011000000000010111011000000 -00001011101100000001001011101100 -00000000101110110000000000101010 -11000000000010111011000000000010 -01101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000010000101111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110000000000 -11111011000000000011111001000100 -00001111101100000000001011101100 -00000000111100110000000000110010 -11000000000011110011000000000011 -00101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000100111100100000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111101100000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111001010000 -00001111101100000000001111101100 -01000000111110110000000000111110 -11000000000011111011001000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101010000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000010 -10001011101100000000001011101111 -01000000101110110110000000101110 -11000000000010111011101000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11000000000001000100110000000000 -10110011000000000010110010100000 -00001001001100000000001011001100 -00000000101100110010000000101100 -11000000000010110011010000100010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01100000000000000101111000000000 -10110111100000000010110111000000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101111110000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000000000100110000000000 -11110011000000000011110010010100 -00001101001100000000001111001100 -00000000111100110000000101111100 -11000000010011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011011110000000000 -11111111000000100011111110000000 -00001111111100000001001111111100 -00000000111111110000000101111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000101011110110000000000 -11111011000000000011111010100000 -00011101101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000011001110000000000 -10110111000000000010110111000000 -00001000011100000000001011011100 -00000001101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00100000000100001001111000000000 -10110111100000000010111101100000 -01001000011110000101001010011110 -00010000101001111000000000101101 -11100000010010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000101001100110000000000 -10110011000000000010110011000000 -00001000001100000000001011001100 -00000100101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011110100000000000 -11111010000000000011111110101100 -00001101101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000011010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100001 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -10000000110010010100000000111110 -01000000000011111001001000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001100000 -00001011100100000000001011100100 -00100010100010011100000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110100000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00111000000001010010010000000000 -10111001000000000010111001000100 -00001011100100000000001011000100 -00000000100010010000000000101110 -01000000000010111001000010000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000100000110000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000001010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100001 -01000000110010000000000000111110 -00000000000011111000010100000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110011000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000101011110010000000000 -11111001000000000011110111000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000101011010010000000000 -11111001000000000011111101000000 -00001111100100000000001111110100 -00000000111111010000000000111110 -01000000000011111101000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110111000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -01001011100000000000001110000000 -00000000111110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000011101000000000000010111000 -00000000001011100000000000001011 -10000000000000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000001001000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000010010110001000000000110 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000000000010010000000000 -10111001000000000010111001000000 -00001011100100000000001010101100 -00000001101010010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010101001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000001011110010000000000 -11111001000000000011111001110000 -00000111100100000000001111100100 -00000000101110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000101110100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000011010010000000000 -11111001000000000011111001110000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011101001000000000011111001 -00000000001111100100000000001111 -10010000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000000001010000000000000 -11111000000000000011111000010000 -00001111100000000000001111100000 -00000000110110000000000000111110 -00000000010011111000100000001011 -00100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000101010010100000000000 -10111010000000000010111010100000 -00001011101000000100001011111011 -00000000110111101000000000101110 -10000000000010111110000000000010 -00101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001101 -00100000100000111000000000101100 -11000000000010110011000100000010 -01001100000000001010001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10000000000100010001110000000000 -10110111000000000010110101010000 -00001011011100000000001011011011 -00000000100101110000100000101101 -11000000000010110101100000000010 -01011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10001000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000110001101000000000111101 -11100000000011111111100000000011 -01011110000000001110011110000000 -00111101111000000000101101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011010110000000000 -11111011000000000011111001000000 -00001111101100000000001111100000 -00000000111110000000000000111110 -11000000000011111011000000000011 -10101100000000001101101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000011111 -10110000000000111100001000000010 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001001011111000000000 -11111111100000000011110111100000 -00001110111110000000001111111110 -00000000110001011000000000110011 -11100000000010111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000110001001110000000000 -10110111000001000010110111000100 -00011000011100000000001110111000 -00000000101001110000000000110101 -11000000000010110100001000000010 -11011100000000001011011100000000 -00101101110000000000111001110000 -00000011110111000000000010110111 -00000000001011011100000000001111 -01110000000000101110001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000000000 -10110111000000000010110101000000 -00001010011100000000001011011100 -00000000100001000000000000100001 -11000000000010110101000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101000011001000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000001001000110000000000 -10110011000000000010110001110000 -00001000001100000000001010101000 -00000000101000000000000000100100 -11000000000010111001000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011000000000010110011 -00000000001011001100000000001010 -00110000000000101101000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011010110000000000 -11111011000000000011110011000010 -00001110101100000000001111100100 -00001000110010110000000000110010 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000010111011000000000010111011 -00000000001111101100000001001011 -10110000000100111110111000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000100000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111100101 -00000100111110100100000000111110 -11000000000011111001010000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000001100111110100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10100000000100001111110000000000 -11111111000000000011111111110010 -00001100111100000000001111111000 -01000000110011110000010000110011 -11000000000011111111100100001011 -00111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10100001000001000110110000000000 -10111011000000000010111011100000 -00001010101100000001001011100000 -00000000100000000110000000101010 -11000000000011111001000000000010 -00101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000011101011 -00000000001011101100000000001011 -10110000001000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001000101100000000001011100100 -00000000100010010000000000101010 -11000000000010111011000010000010 -00101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000101000000110000000000 -10110011000000000010111011000000 -00001010001100000100001011000000 -00000010100000100000000000101000 -11000000000010100001000000000010 -00001100000000001011001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000010001011001100000000001001 -00110000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -10111011000000000011111011000000 -00001100101100000000001111100100 -00001000110010010000000000111010 -11000000000010111011000000000011 -00101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000110 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011111110000000000 -11111111000000000001111111000000 -00001111111100000000001111110000 -00000000111111000000000000111111 -11000000000011111101000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011101111 -00000000001111111100000000001111 -11110000000000111110100000100110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000011011111111000000000 -11111111100000000011111111100000 -00001111111110000000001101111110 -00000000111111111000000000111111 -00000000000011001100000000000011 -11110000000000001100110000000000 -00110011000000000000110011000000 -00000011111101000000000011001111 -10000000011111111110000000011111 -11111000000000111011000000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001110111000000000 -10111011100000000010111011100000 -00001011101100000000001000101110 -00000000101110111000010000101110 -00000001000010001000100000000010 -11100000000000001100100010000000 -00100010001000000000100010001000 -00000010111001100000000010001011 -10000000001011101110000000001011 -10111000000101101111000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000001001001100 -00000000101100110000000000101100 -01000000000010010001000000000010 -11000000000000001001001000000001 -00100100000000000000100000000000 -00000010110001000000000010010011 -00000000001011001100000000001011 -00110000000000101111001000000001 -00110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011001100000000001001101100 -00000000101110110000000000101110 -01000000000010011001000000000010 -11100000011000101000101000000000 -00100110000000000000100010000000 -10000010111001000010000010011011 -00000000001011101100000000001011 -10110000010001101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10010000000101011110110000000000 -11111011000000000010111011000000 -00001111101100000000001101101100 -00000000111110110000000000111110 -10000000001011011000000100010011 -11100011000000101101100100000000 -10110110011000000010110010000101 -00010010111001010100001011011011 -00000000001011101100000000001011 -10110000000000111000100000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000001110111100 -00000000111111110000000000111101 -10000000000011101000100000000011 -11100010000000001111110100000000 -00111011011001000000111110001000 -00000011110001100000000011101111 -00000000001111111100000000001111 -11110000000000111111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001110101100 -00000000111110110000000000111110 -11000000000011101001001000000011 -00000001000000101100001100000000 -00110100010000000000110010000100 -00000011001001010000000011001011 -00000000001111101100000000001111 -10110000001000111101010000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11011000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001000101100 -00000000101110110000000000101110 -11000000000010001001011000000010 -00100000000000001101101100000100 -00100010011100100010100010000000 -00001010001001000000000010001011 -00000000001011101110010000001011 -10110000010000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000001000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000101100 -00000000000010100010110000001010 -00001100000000001000000010000100 -00100000101100100000100000110000 -00001010000010000000001010000011 -00000000001011001101000000001011 -00110000000001101111001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -11110000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001000011110 -00000000101101111000000001101101 -00100000000010000110100000000010 -00011110000000101001010010001000 -00100000101001000000100001111001 -00000010000110100000000010010111 -10000000001011011110001000001011 -01111000000000101111110000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000000000000110000000100 -11110011000000100011110011000000 -00001011101100000000001110001100 -00000000111100110000000000111110 -01000000000011100011000000000011 -00001100000000001100001000000000 -00110100100001000000100000110001 -00000011000010000000000011000011 -00000000001111001100000000001111 -00110000000000111101101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000100101011011110000000000 -11111111000000000011111111000000 -00001111111100000000001110111100 -00000000111111110000000000111111 -01000000000011111111000100000011 -11111100010000001111011000010000 -10111111100001000000111111110001 -00000011111110100100000011101111 -00000000001111111100000000001111 -11110000000000111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -10000000000011011010000000000011 -00101110000000001100100100000000 -00110010110000000000110010111000 -00000011001010000000000011011011 -00000000001111101100000000011111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11001000100100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101111 -10000000000010000110000000000010 -00001100000000001000010100000000 -00110001110000000000100000110000 -00000010000010000000010110000111 -00000000001011011100000000001011 -01110000000000111011001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000001000000001001111000010000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010010011100000000010 -00011110000000001000001110000000 -00100000111000000000100101111000 -00000010000110100000000010000111 -10000000001011011110000000001011 -01111000010000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000100000010000011000000000010 -00001100000000001000001100000000 -00100000110000000000100000110000 -00000010000010000000000010000011 -00000000001011001100000000001011 -00110000000000101001001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001011101000 -00000000111110100000000000111110 -10100000000011011010000000001011 -00101000000000101100101001000000 -10110010100100000010110110100000 -00001011001110000000001011001010 -00000000001011101000000000001011 -10100000000000101111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000010000111100 -00000000000011110000010000000011 -11100000000000001111100000001000 -00111000000000100000111110000000 -00000011110100000000000011111000 -00000000001111100000000000001111 -10000000000000111001001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011001001010000000011 -00100100000000001111000100000000 -00110010010000000000110010010000 -00000011111001000000000011001001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000010000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000010010001001111000000010 -00100100000000001011100100000000 -00100010010000000000100010010000 -00100010111001000000000010001001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010011001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010001101000000000010 -00110100000000001011110100100000 -00100011010101000000100011010000 -00000010111101000000000010001001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000100100010000000000101101 -01001011001010000101001010001010 -00010100101000001011010100101000 -10100001010010100000100001010010 -10000010110101001010000010000001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00001000000011001000001000000011 -00100000100000001111100000100000 -00110010000010000010110010000010 -00000011111100001000001011001000 -00000000001111100000000100011111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100101000001111100100 -00000000111110010000000000111110 -01101010000011111001000000000011 -11100110101000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000001111110111000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001110100100 -00000000111110010000000000111110 -01000000000011010101000000000011 -11100100000000001100110100000000 -00110011010000000000110010010000 -00000011111001000000000011111001 -00000000001111110100000000001111 -10010000000000111110111000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01111000000100001110000000000000 -11111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101100 -00000000000011011000000000000010 -11000000000000001100100000000000 -00100010000000000000110110000000 -00000010111000000000000110111000 -00000000001011100000000000001111 -10000000000000101100011000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -01001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001010000100 -00000000101100010000000000101100 -01000000000010010001000000000010 -11000100000010001001000100000000 -00100000010000000000100000010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10101001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101100 -01010000000010011001010000000010 -11100100000000001000100100100000 -00100010010000000000100110010000 -00000010111001000000000010111001 -00000000001011100100000000001010 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -10111001000000000010111001000000 -00001111100100000000001110100100 -00000000111110010000000000111110 -01000000000011011001000000000011 -11100100000000101101100100000000 -10110010010000000000110010010000 -00000011111001000000000010111001 -00000000001111100100000000001011 -10010000000000111110100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000011111100100000000001111 -10010000000000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011101000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011001000000010000011 -01100000000000001100000000000000 -00111110000000100000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001110 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010001110010000000010 -00101000000000001000101010000000 -00101101101100000000101110100000 -00000010111110000000000010111010 -00000000001011111000011000001000 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010100011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010000001010100000010 -00101100000000001000001110000000 -00101100111100000000101100110000 -00000010110010000000000010110011 -00000000001011001111000000001010 -00110000000000101100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100100000001011011100 -00000000101101110000000000101101 -11000000000010000110100000000010 -00011100000000001000010100001000 -00101101000000100000101101110000 -00000010110110000000000010110111 -00000000001011011110000000001000 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011100111100000 -00001111011110110000001111011110 -00000000111101111000000000111101 -11101000000011000110100000000011 -01011111000000101100010110000000 -00111101001000000000111101111000 -00000011110110100000000011110111 -10000000001111011110000000001110 -01111000000100111100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101101110000001111101100 -00000000111110110000000100111110 -11001100011011111010000000001011 -11101100100000001111100100000000 -00111110000000000000111110110000 -00000011111010000000000011111011 -00000000001111001100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111001000000 -11111111100000000011111111100000 -00001111111110000000001100111110 -00000000111111111000000000111011 -11110000000011000110100000100011 -00111111000001001111110110000010 -00110011001000000000111111111000 -00000011001110100100001011001111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001101011100 -00000000101101110000000000111011 -11001000000011010110011000000010 -00111100000000001010010100000000 -00100001000100000000101101110000 -00000010000110000000000010000111 -00000000001011010000000000011011 -01110000000000111110101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000010000 -10110111000000000010110111000000 -00001011011100000000001001011100 -00000000101101110000000000101001 -11000000100010000110000000000010 -00011100000000001011010100000000 -00100001000000000000101101110000 -00000010000110010000100110000111 -00000000001011011100000000001011 -01110000000000101100010010000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110011000000000010110011000000 -10001011101100000000001001001100 -00000000101100110000000000101010 -11000000001010010010000000001010 -00001100000000001010000100000000 -00100000000000000000101100110000 -00000010000010100000000010000011 -00000000001011000000000000011011 -00110000000000101001100100000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010110000000000 -11111011000000000011111011000000 -00001111111100000000001001101100 -00000000111110110000000000111011 -11000000000010001010000000000011 -00111100000000101111100100000000 -10110010000000000000111110110000 -00001010001010011000000010001011 -00000000001111100000000000001011 -10110000000000101110111000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10010100000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011110010010000000011 -11101100000000001111000100000000 -00111110000100000000111100110000 -00000011110010000000000011111011 -00000000001111100000000000001111 -10110000000000111110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001111110000000000 -11111111000000000011111111000000 -00011111111100000000001100111100 -00000000111111110000000000111111 -11000000000011001110001000000011 -00111100000000001110100100010000 -00110001000000000000110010110000 -00000011001010000000000011001111 -00000000001111110010000000001100 -11110000000000111110010001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001010101100 -00000000101110110000000000100110 -11000000000011011010110000000010 -00101100000000001101100100000000 -00100010001100000010100010110000 -00001010001010000000000010001011 -00000000001011000001000000001010 -10110000001000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000011000101100 -00000000101110110000000000100110 -11000000000010001010000000000010 -00001100000000001010100100000000 -00100010001000000000100010110000 -00000010101010000000000010001011 -00000000001011101101100000001000 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000100100 -11000000000010010010000000000010 -00001100000000001001000100000000 -10100000000000000010100000110000 -00011010100010000000000010000011 -00000000001011000000000000000010 -00110000000000101100101000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -10111011000000000011111011000000 -00001011011100000000001100101100 -00000000111110110000000000110111 -11000000000011001010000000001011 -00111100000000101110100100000000 -00110010000000000000110010110000 -00010011101010000000001011001011 -00000000001111101100000000001100 -10110000000000111110000000100010 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000110111 -11000000000011111110000000000011 -11111100000000001111110100000010 -00111111000000000000111111110000 -00000011011110000000000011111111 -00000000001111110000000000001111 -11110000000100111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111100000000000011001111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000110011111110100001000011 -00111110000000001111111110000000 -00111111111000000000110111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111000110000000010001011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000100010111001100000000010 -00101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101111000000000110 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110000010000001010000011000000 -00001011001100000000001011001100 -00000000101000110000000000101100 -11000000000010111011000000000010 -00001100000010001011001100000000 -00101100110000000000100100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111000000110000010001011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011100000000010 -00101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000000011101100000000001011 -10110000000000101111000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111100110000000011001011000000 -00001111101100000000001111101100 -00000000111010110000000000111110 -11000000000011111010100000000011 -00101100000000001111101100000000 -00111110110000000000110110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101010000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11110000100000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111010011000001011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011001000000011 -10101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101010000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010111000000000 -10111000010000000110001011000000 -00001011101100000000001011101100 -00000000101110110000000000001110 -11000000000010110011000000000011 -01101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011100100000010000011000000 -00000011001100000000001011001100 -00000000101100110000000000001100 -11000000000010110010010000000010 -10001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111100000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010000111100000 -00001001011110000000001001011110 -00000001101101111000000000101101 -11100000000010110111100100000010 -01011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010010111 -10000000001011011110000000001011 -01111000000000101110110000000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000100000 -11110011000000000010000011000000 -00001111001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -10001100010000001111001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101101000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000100000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011110111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111000000000000011001011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011110010000000000011 -00101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110110000000000010000111000000 -00001011011100000000001011011100 -00010000101101110000000000101101 -11000000000010110111000000000010 -10011100000000001011011100000000 -00111101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101111001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110010100000000010010111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -00011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110010011100000010000011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000100000010 -10001100000000001011001100000000 -00101000110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111110000000001011011010000001 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011110110100000000011 -00101000000000001111101000000000 -00101110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000010000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011001001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000001011 -00100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010100000000 -10110001110000000010001001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000100000010 -00100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000001000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010100000000 -10111001001000000010001001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -00100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100111000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110011001000000010000001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110011000000000010 -00000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100101000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000001011001000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -00100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111101000100000011111001000000 -00001111100100000000001111100100 -00000000101110010000000000111110 -01000000000011111101000000000011 -11100100000000001111100100000000 -01111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111101100000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111101000001000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000110 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001010000000010110001000000 -01001011000100000000011011000100 -00000001101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001010000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000010111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001110100000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010110000100000 -11111001010000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000110011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000001000000011 -00100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010101110000000 -10111110101000000010111010000000 -00001011101000000001001011101000 -00000000101110100000000000101110 -10000000000010111110011000000011 -01101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100100100000000 -10110010000000000010110011000000 -00001011001100000000001011001100 -00000001101100110000000000101100 -11000000000010110011000000000010 -00001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001000000000000 -10110100000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111100000000010 -01011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110000000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001101000001000 -11110111100000000010110111100001 -10001111011110000000001111011110 -00000000111101111000000000111101 -11100000010011110111100000100011 -00011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111110001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010000110101000 -11111010000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011110011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001101101100000000001111 -10110000000000111100001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11100100100100000011101111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -10111110010000001111111110010000 -00111111111001000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111100000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001010100000000 -10000100000000000010000111000100 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000001000010110111000000000010 -10011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10100101000000000110100111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010111111010010000010 -00011100000001001011011100000001 -00101101110000000000001101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100010000000000 -10000000100000000110000011000000 -00001011001100000000001011001100 -00000000101100110000000001101100 -11000000000010110011100000000010 -10001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010100000000000 -11100010000010000011101011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011110010010000000011 -10101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110100100000000 -11111000000000000011111011000000 -00001111101100000000001111101100 -00000100111110110000000000111110 -11000000000011111011010000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001011101100000000001111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111111000000000 -11111111000000100011101111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111101000000000011 -00111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000001001111 -11110000000100111100100001000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001010001000110111100000000 -10111011010000000010001011000001 -00001011101100000000001001101100 -00000000101110110000000000111010 -11000000000010111001100000000010 -10101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110100001000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010000001000000 -10111000010000000010101011000000 -00011011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011100010000010 -00101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000000000000000 -10111000000000000010100011000000 -00001011001100000000001001001100 -00000000101100110000000000101000 -11000000000010110011000000000010 -10001100000000001011001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110010000000000 -11111001000000000011101011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -00101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000100011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000110011101010000000000 -11111101000000000011011111000000 -00001111111100000000001111111100 -00000000111111110000000000111011 -11000000000011110111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100100000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000110111 -11100000000011001111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11001000000000111111000000000101 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000000010111011100000 -00001011001100000000001011101110 -00000000101100110000000000100010 -11000000000011011011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10101000000000101110000000000110 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000100100 -11000000000010000011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00010000000000101110001000000001 -00110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000100010 -11000000000010011011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10000100010000101111000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000001000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000110110 -11000000000011001011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10000000000000111100000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -10111111000000000011111111000000 -00001101111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001101111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11100000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001101101100000000001110101100 -00000000111110110000000000111010 -11000000000011101011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110100000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001000101100 -00000000101110110000000000100010 -11000000000010001011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10100000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101110110000000000101010 -11000000000010100011000000000010 -11001100000000001001001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00000000000000101111100000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001000011110 -00000000101101111000000000100001 -11100000000010000111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101101100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001111001100000000001110001100 -00000000111100110000000000111010 -11000000000011100011000000000011 -11001100000000001111001100000000 -00111100110000000000101100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00010000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11010000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111101110000000001101101100 -00000000111110111000000000110010 -11000000001011001011000000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10001000000000110110101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011111100000000001000011100 -00000000101101110000000000100011 -11000000000010000111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000010001011 -01110000000000100001001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001001011110 -00000000101101111000000010100001 -11100000000010000111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -11111000000000100111000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001000001100 -00000000101100110000000000100000 -11000000000010000011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000100001001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001101101000 -00000000111110100000000000110010 -10000000000011001010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -11101000100000110111101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011001001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000001010001001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101100 -01000000000010001001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010000001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111100000000000000111110 -00000000000011001000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100101000001111100100 -00000000111110011010100000111110 -01101010000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -01010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000110010 -01000000000011001001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101000 -00000000000010101000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10100000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000100000 -01000000000010000001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101100010000000000101010 -01000000000010101001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000001000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000110010 -01000000000011001001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -10111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10011010000000111100101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000110010 -00000000000011001000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001001101000000000001001101000 -00000000101110100000000010100010 -10000000001010001010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000100010 -11000000000010000011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001001011100100000001001011100 -00000000101101110001000000100001 -11000000000010000111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000111111111010000000110001 -11100000000011000111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00000101101100011000001001101100 -00000000111110110000100000111110 -11010100000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011011011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001100111110 -00000000111111111000000000111011 -11110000000011011111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001101111110000000001110 -01111000000000110001000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001101011100 -00000000101101110000000000110101 -11000000000010100111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000100000110110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001000011100 -00000000101101110000000000101001 -11000000000010010111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010010111000000000010110111 -00000000001011011100000000001011 -11110000000000100000010010000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011101100000000001001001100 -00000000101110110000000000100100 -11000000000010100011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000010001011 -00111100000000100101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001111111100000000001100101100 -00000000111111110000000000111011 -11000000000011011011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001101101100000000001110 -10111101000000110010101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110010000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001100111100 -00000000111111110000000000110011 -11000000000011001111000000000011 -11111100000000001110111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000000001 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001010101100 -00000000101110110000000000101010 -11000000000010101011000000000010 -11101100000000001001101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000000011101100000001001001 -10110000001000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001010101100 -00000000101110110000000000100000 -11000000000010001011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000001000010111011 -00000000001001101100000000001001 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000101000 -11000000000010100011000000000010 -11001100000000001001001100000000 -00101100110000000000101100110000 -00000000110011000000000010110011 -00000000001011001100000000001001 -00110000000000101100001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011111011000000 -00001111011100000000001100101100 -00000000111101110000000000110001 -11000000000011001011000000000011 -11101100000000001110101100000000 -00111110110000000000111110110000 -00000001111011000000000011111011 -00000000001111101100000000001101 -10110000000000111110000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001011111100 -00000000111111110000001000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000011000001110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11101111100000000011101111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -00111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000000000111011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000010010 -10101110000000001011101110000000 -00101110111000000000111010111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101111000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000110100011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -00001100000010001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -10101100000000001011101100000000 -00101110110000000000100110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11101011000000000011101011000000 -00001111101100000000001011101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -00101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100010000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111011110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011011011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000100 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010110011110100000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000100100110000000000101100 -11000000000010110011000100000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000000001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100001000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101110110000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001111001100000000001111001100 -00000000110100110000000000111100 -11000000000011110011000000000011 -11001100010000001111001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111001011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000000 -11111100000100001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001011111100000000001111 -11110000000000111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000101100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10100111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11101010000000000010111010000000 -00001011101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000001001111101000000010 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000101111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001100000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000100000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000001000111111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111010000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000001 -11111001000000000111111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000001111110111000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11101001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111101000001000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001110 -10010000000000111000111000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10100001000000000010110001000000 -00001011000100000000001010000100 -00000000101100010000000000101100 -01000000000010110001000000100010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001010 -00010000000000101001001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000010000 -10111001000001000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000001000010 -11100100000000001011100100000100 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000010000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11101001000000000011111001000000 -00001011100100000000001110100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001110 -10010000000000111010100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000100111111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11101000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000111111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111110110100000010 -11101000000000001011101000000000 -00101110100000000000100110100000 -00000010111010000000000011101010 -00000000001011101000000000001011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10100011000000000010110011000000 -00001011001100000000011011001100 -00000000101100110000000000101100 -11000000000010110011110000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000010000 -10110111000001000010110111000000 -00001011011100000000001011011100 -00000100101101110000000000101101 -11000000000010110110010000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010100111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11100111100000000011110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000010110101100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000110110110000 -00000011111011000000000011101011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000011111111000000000 -11111111100000010011111111100000 -01001111111110000010001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110001000000 -11110111000100000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111010000000010 -11011100000000001110011100000000 -00111001110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110101000000010 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101001110000000000100101 -11000000000010100111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001010001100000000 -00101000110000000000100100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000110110 -11000000000011101000000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101100000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11101011000000000011111011000000 -00001111101100000000001111101100 -00000100111110110000000000111110 -11000000000011111000000000000011 -11101100000010001111101100000000 -00111110110000000001111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110100000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111011110000000000111111 -11000000000011111101000000000011 -11111100000000001111111100000000 -00111111110000000001111111110000 -00100011111111000000000011111111 -00000000001111111100000001001111 -11110000000100111100000101000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -11101011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111001110000000010 -11101100000000001001101100000000 -00101110110000000001101110110000 -00000010111011000000000011101011 -00000000001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101010 -11000000000010111001100000000110 -11101100000000001011101100000001 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10100011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110001000000000110 -11001100000000001001001100000000 -00101100110000000000101100110000 -00000010110011000000000010100011 -00000000001011001100000000001011 -00110000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111010 -11000000000010111001000000000011 -11101100000000001111101100000000 -00111110110000000000101110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000100110 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111101000000000000 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000010001111111100000000001111 -11110000000000111110100000000011 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11001000000000110011000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000000010111011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10001000000000100011000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10100011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000101000 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011000000000010110011 -00000000001011001100000000001011 -10000000000000100011001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000001001011101100 -00000000101110110000000000100110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000010100011000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10100100100000110000000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011011111000000000011111111 -00000000001111111100000000001111 -11000000000000111111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000100111110110000001000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10100000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000001001011 -00110000000000101111011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001001001100000000001001001100 -00000000101100110000000000100100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00010000000000101111101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01011000000000101111110000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001101001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00000000000000111101101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000011011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111010110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01010000000000101111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101001111000000000101001 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01101000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000001011011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111010100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -11100000100000111111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000110110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000011 -11100100000000001011100100000000 -00101110010000000000100110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010101001000000000010111001 -00000000001011100100000000011011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000100100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -10111000000001010110000000000000 -11111000000000000010111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011101000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000101011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -10100100000000001111100100000000 -00111110010000000000110110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -11010000000000111110111000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -00010000000000111110111000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100011000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010100001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000011011 -10010000100000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010100001000111110100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10011010000000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000100000000110000101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000100000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000100100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000001001011 -00110000000000100100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -11111000000000100100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000110100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000001 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000010001111 -10110000000010111000001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000100001011011100000000001011 -01110010000000101110101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100010010000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000011011 -00111100000000101101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10111000100000111110101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000001001111101100000000001111 -10110000000000111110110000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000100000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000001000010111011 -00000000001011101100000101001011 -10110000001000101110000101000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001001101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000100110 -00000000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000010100111110100000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11101111100000000011111111100000 -00001111111110010000001101110000 -10000000110011111000000000111011 -11100000000011111111000000000011 -00110010000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -11111011100000000011101011100000 -00001011101100000000001000101011 -00000000100010111000000000111010 -11100000000010111011110100000010 -00100000000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000101000000000 -01000100100000110000000001101100 -11000000000010110011000000000110 -00000100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011001100000000001000100001 -00000000100010110000000000101110 -11000000000010111011000001000010 -00100110001000001011101100000000 -00101110110000000000101110111000 -10000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11101011000000000011111011000000 -00001111101100000000001101100110 -01000010110010110000000000111110 -11000000000011111011000000000011 -00100010000000001111101100000000 -00111110110000000000111110111000 -00100011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11101111000000000011101111000000 -00001111111100000000000111111000 -00000000111111110000000000111011 -11000000000011111111000001001011 -11110000000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001110001100 -00000000111110110000000000111110 -11000000000011111011000110000011 -11101101000000001100101100000000 -00111110110001000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101111110000001000101100 -00000000101110110000000000101110 -11000000000010110111000000000010 -11101100000000001010101100000000 -00101110111101000000101110010000 -00000010111011000000000010111011 -00000100001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001000000000 -00001000101100110000000000101100 -11000000000010110011110000000010 -11000000000000001000001100000000 -00101100111000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000000001111000000000 -10110111100000000010110111100000 -00001011011110000100101000011110 -00000000101101111000000000100101 -11100000000010110111100000000010 -11010010000000001010011110000000 -00101101111000000000101101110001 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001111101100000001001110000000 -00000000111100110000000000111100 -11000000000011110011000000000011 -11100000000000001100001100000000 -00111100110000000000111100110000 -00000111110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111001011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111000 -00000000111111110000000000111111 -11000000000011111111000010000011 -11110100000000011111111100000000 -00111111110000000000111111110001 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000101100100100 -00000000110010110000000000111110 -11000000000011111011100000000011 -00100000000000001111101100000000 -00111100111000000000110010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000011001110000000000 -10110111000000000010110111000000 -00001011111100000000001000011100 -00000000110101110000000001101101 -11000000000010110111001000000010 -00011000000000001011011100000000 -00101101110000000000110101100000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001000000110 -00000000100001111000000000101001 -11100000000010110011101000000010 -00011010000000001011011110000000 -00101101111000000000100001111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00011011001100000000001000001110 -00000000100100110000000000101100 -11000000000010110011000001000010 -00101100000000001011001100000000 -00101100110000000000100100111101 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001100111011 -00000000110010100000000000111110 -10000000000011111010000000000011 -00111010100000001111101000000000 -00111110100000000000110011100101 -00000011111010000000010011111010 -00000100001111101000000000001111 -10100000000000111111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -01100000111110000000000000111110 -00000000000011111000000000001011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001100000100 -00000000110010010000000000111110 -01000000000111111001100000000011 -11100110000000001100100100000000 -00111110010000000000111110010000 -00100011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100110010000101000100100 -00000000101010010000000000101110 -01000000000110111001010000000010 -11100110000000001000100100000000 -00101110010100000000101110010000 -00000010111001000000000011111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011000100001000001000100100 -00000000100010010000000000101110 -01000000010010111001000101000010 -11100100010000001000100100000000 -01101110010000100000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001000000100 -10000000101000010000000000101100 -01000000000010110001001000000010 -11000100000000101000000100000000 -01101100010000000000100100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000001000110000000000000 -11111000000000000011111000000000 -00001111100001010000001100100000 -00000000110010000000010000111110 -00000000000010111010000000000011 -11100001010010001100100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111110100 -01000000111110010000000000111110 -01000000000011111001000101000011 -11110100000000001111100100000000 -00111110010000000000111111010000 -00000011111001000000000011101001 -00000000001111100100000000001111 -10010000000000111110111000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000000011110010000000000 -11111001000000000011111001000000 -00001111110100000000001111100100 -00000000110110010000000000111110 -01000000000011111101000000001011 -01110100000000001100100100000000 -00111111010000000000110010010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100111000000101 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001110000000000000001011100000 -00000000110110000000000000101110 -00000000000010111000000000000010 -00100010100000001101100000000000 -00101110000000000000110110000000 -00000011101000000000000010111000 -00000000001011100000000000001011 -10000000000000101100011000000010 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010100001000000 -00001011000100000000011011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -00001110001000001000000100000000 -00101100010000000000100000010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -00011000000100011010010000000000 -10111001000000000010111001000000 -00001010100100000000001011100100 -00000000100110010000000000101110 -01000000000010111001000000000010 -00100100100000001001100100000100 -00101110010000000000100110010100 -00000010101001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000011101001000000 -00001111100100000000001111100111 -00100000111110010000000000111110 -01000000000011111001000000000011 -01100100000000001100100100000000 -00111100010000000000110010010000 -00000011111001000000010011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001110100100000000001111100111 -00000000111010010000000000111110 -01000000000011111001000010000011 -11100100000000001111100100000000 -00111110010000000000111110010100 -00000001111001000000000011111001 -00000000001011100100000000001111 -10010000000000111101101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000100000001100000000 -00000000110110000000000000111110 -00000000000111111000000100000011 -11100000000000001100100000000000 -00111110000010000000111110000100 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011111011000000101000101000 -00000000111110100000000000111010 -10000000000010110110000000000010 -01101000000000101000101000000000 -00101111100110000000111110100000 -00000010111010000000000011101010 -00000000001011101000000000001011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001110000000001001001100 -00000000100000110000000000101100 -11000000000010110011110000000010 -11101100000000001000001100000000 -00101100001000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011010110001000001001001100 -00000000101001110000000000100001 -11000000000010110111000000000110 -01011100000000001000011100000000 -00101101100000000000101001110000 -00000010110111000000000010100111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001101011110 -00000100100001111000000000111101 -11100000000010110110100000000011 -11110110000000001100011110000000 -00111101001000000000101101111000 -00000011110111100000000011110111 -10000000011111011110000000001111 -01111000000000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101000000000001110101100 -00000000111110110000000000111010 -11000000000011111011000001000011 -11100100000000001111101100000000 -00111110100000000000111110110000 -00000011111011000000000011101011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001100111110 -00000000111111111000000000111111 -11100000000011111110100000000011 -00111110000000001100111110000000 -00111111001000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000011110111000000 -00001011110000000000011000011100 -00000000101101110000000000101101 -11000000000010110110000000000011 -01011100000000001101011100000000 -00101101000000000000111001110001 -10000011110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011010100000000001000011100 -00000000101101110000000000101101 -11000000000010110110000000000010 -00110100000000001001011100000000 -00101101010000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010100011000000 -00001011100000000000001000001111 -01001000101100110000000000101100 -11000000000010110010000000000010 -01100101001000001001001100000000 -00101100000000000000101100110000 -00000010100011000000010010110011 -00000000001011001100000000001011 -00110000000000101101000100000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000010111011000000 -00001111101000000000101100101100 -00001000111110110000000000111110 -11000000000011111001000000000011 -00101101000000001101101100000000 -00111110000000000000111110111000 -00000010111011000001000011111011 -00000000001111101100000000001111 -10110000000000111110101100000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101001000000001111101100 -10000100111110110000000000111110 -11000000000011111011000000000011 -11101110000000001111101100000000 -00111110000000000000111010110010 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111111000000001110011100 -00000000110011110000000000111111 -11000000000011111110000000000011 -00110100000000001100111100000000 -00111111000000000000111111110000 -00000011001111000000000011111111 -00000000001111111100000000001111 -11110000000000111100000101000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101000000000101000101100 -00000000100010110000000000101110 -11000000000010110011100000000011 -01110100000000001000101100000000 -00101110001000000000101100110000 -00000011111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011100101000000001000101100 -00000000100010110000000000101110 -11000000000010111010000100000010 -00100110000000001000101100000000 -00101110000001000000101110110000 -00000010001011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001001000000000000001000001100 -00000010100000110000000000101100 -11000000000010110010000000000010 -01000100000000001000001100000000 -00101100000000000000101110110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000010111011000000 -00001111100100000000001110101100 -00000000110010110000000000101110 -11000000000011111010000000000011 -00101100000000001100101100000000 -00111110010000000000111110110000 -00000011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000110 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111110000000000001111111100 -00000000111111110000000000111111 -11000000000011110110000000000011 -11011100000000001111111100000000 -00111111000000000100111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001110111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011001111 -10000000001111111110000000001111 -11111000000000111011000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110111000000000 -10111011100000000010111011100000 -00001011101110000000001100101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000011011011 -10000000001011101110000000001110 -10111000000000101111000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10100011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00100100110000000000101100110000 -00000010110011000000000010000011 -00000000001011001100000000001011 -00110000000000101111001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001010101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010011011 -00000000001011101100000000001010 -10110000000000101111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011110110000000000 -11111011000000000011111011000000 -00001111001100000000001111101100 -00000000111110110000000000111110 -11000000000010111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011110011000000000011001011 -00000000001111101100000000001111 -10110000000000111100100000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000100011011110000000000 -11111111000000000011111111000000 -00001111111100000000001101111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000011111111100000000001111 -11110000000000111111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011101011000000 -00001111101100000000001100101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011101011000100000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001000101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101110001100001011 -10110000000000101111000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11000000000001000000110000000000 -10110011000000000010100011000000 -00001011001110010000001001001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -10001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011110010000010110011 -00000000001011001111001000001011 -00110000000000101111000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000000001111000000000 -10110111100000000010110111100000 -00001011011100000000001001011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000011011 -01111000000000001111111000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000110000000110000000000 -11110011000000000011100011000000 -00001111001100010000001101001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011100011000000000011110011 -00000000001111001100010000001111 -00110000000000111101101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111001011110000000000 -11111111000000000011111111000000 -00001111011100100000001110111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000100011111 -11110000000000111101000000000010 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000101011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111010110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000010011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00100000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000011011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101001111000000000101101111000 -00000010110111100000000110110111 -10000000001011011110000000001011 -01111000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -11101000000001001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000001011011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101001010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111010100000000000111110100000 -00000011110010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10001000000100001010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011011001 -00000000001111100100010000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000010010000000000 -10111001000000000010111001000000 -00001011100100100000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001001000000010001001 -00000000001011100110000000001011 -10010000000000101110000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010101001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010011001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010000001 -00000000001011001100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000111010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011101000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011011000 -00000000001111100000000000001111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10111000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110111100000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000101011110010000000000 -11111001000000000011111001000000 -00001111110100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111101000000000011111001 -00000000001111110100000000001111 -10010000000100111110111000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000000001010000000000000 -10111000000000000011101000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100011000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -01001000000001001000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101000010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101001010010000000000 -10111001000000000010101001000000 -10001011101100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000001001011100100000000001011 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111010010000000000111110010000 -00000011111001000000000011111001 -00000000011111100100000000001111 -10010000000000111110000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000000001010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100001000001111 -10010000000000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011101000000000 -00001111100000001000001110100000 -00000000111110000000000000111110 -00000000000011101000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000010000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000010100000000000 -10111010000000000010111010000000 -00001011111010000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111110000000000010111010 -00000000001011111001000000000011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001010100110000000000 -10110011000000000010100011000000 -00001011001100000000001010001100 -00000000101100110000000000101100 -11000000000010100011000000000010 -10001100000000001011001100000000 -00101000110000000000101100110000 -00000010110011100000000010110011 -00000000001011001110000000001011 -00110000000000101100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100001000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111010000000110110111 -00000000001011010101000000001011 -01110000000000101100000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000110000001111000000000 -11110111100000000011100111100000 -00001111011110000000001110011110 -00000000111101111000000000111101 -11100000000011100111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000010001111 -01111000001000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111010000000000011111011 -00000000001111100000000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01100000000001001011111000000000 -11111111100000000011111111100000 -00001111111010010000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111110100100000011111111 -10000000001111111010000000001100 -11111000000000111101000000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000000001001110000000000 -10110111000000000010110111000000 -00001011010000000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110101000000000011100111 -00000000001011011100000000001101 -01110000000000101110101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011011000000000011011011100 -00000000101001110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110110000000000110110111 -00000000001011010000000000001000 -01110000000000101100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101001000110000000000 -10110011000000000010110011000000 -00001011000000000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000110110000000000000010100011 -00000000001011000000000000011001 -00110000000000101101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011010110000000000 -11111011000000000011111011000000 -00001111100100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111001000000000011111011 -00000000001111001100000000001100 -10110000000000111110101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000100001110110000000000 -11111011000000000011111011000000 -00001111100100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000111101011 -00000010001111100100000000001111 -10110000000000111110110000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111110000000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111101100000000011111111 -00000000001111111100000000101100 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011100011000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111010100000000010111011 -00000000001011100000000000001000 -10110000000000101110010001100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010110110000000000 -10111011000000000010111011000000 -00001011101100010000001011101100 -00000000101110110000000000101110 -11000000000010101011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111000000100000010111011 -00000000001011101000000001001000 -10110000000100101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011000100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110001000000000010110011 -00000000001011001100000000001000 -00110000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000110000110110000000000 -11111011000000000011111011000000 -00001111101000000000001111101100 -00000000111110110000000000111110 -11000000000011101011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111000000000000011111011 -00000000001111100000000000001100 -10110000000000101110100000000110 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011011110000000000 -11111111000000000011111111000000 -00001111110000000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111100000000000011111111 -00000000001111010000000000001111 -11110000000000111110000000100110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111110100000000011 -10111100000000101100110110000000 -00110011111000000000111111111000 -00000011001111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000000010111011100000 -00001011101110000100001011101110 -00011000101110111000001000101110 -11100000000010111010100000000010 -00111110000000101000100100000000 -00100010111000010000101110111000 -00000011011011100000000010111011 -10000000001011101110000000001011 -10111000000000101110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010111010000000000010 -10000100000000001010001100000000 -00100000110000000000101100110000 -00000010000011000000000010110011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111010100010010010 -00100100000000001000100100000000 -00100010110000000000101110110000 -00000010011011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000100111110110000000000111110 -11000000010011111010110000000011 -10111100000000101110100100000000 -00110010110000000000111100110000 -00100011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000100111 -11000000000011111110000000000011 -11101100011000101111111100000000 -10111111110000000000111111110000 -00010011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111010010000000011 -11000100000000001100101100000000 -00111110110000000000110110110010 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000100001011101100 -00000000101110110000000000101110 -11000000000010110010000000000010 -11100101001000101000101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001001001100000000001011001100 -00000000101100110000000000100100 -11000000000010110000100100000010 -11000100000000101000100100000000 -00101100110000000000100100110100 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111100000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100000 -00001001011110000000001011011110 -00000100101101111000000000101101 -11100000000010110100100000000010 -11010110010000001000010110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000000011011110000000001011 -01111000000000101100100000000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001101001100000000001111001100 -00000000111100110000000000111100 -11000000000011110010000000000011 -11001100000000001100001100000000 -00111100110000000000110100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101101000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111100000100000011 -11111111000000001111110100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111001000000000011 -11100101000000001110100100000000 -00111110110000000000111100111000 -00000011001011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000001001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11010100000000001000011100000000 -00101101110000000000101101110000 -00000011010111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001010011111000000 -00101101111000000000101101111000 -00000010000111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000111010010 -11001100000000001000001110000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011110110100000000011 -11101000000000001110101000000001 -00111110100000010000111110100000 -00000011001010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101100000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000100 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001110001000011 -00100100000000001100100100000000 -00111110010000000000111110011001 -00000000111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001100000001010 -00000100000000001000100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -00100110001000101000100100000001 -00101110010000010000101110010000 -10000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100111000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010010001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -00000100100000001000000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100101000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -00100000000000101100100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000010011111101000001000011 -11010100010000101111110100101000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001101100100000000001111 -10010000000000111110011000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111101000000000011 -10110110000000101100100100000000 -00110010010000000000111111010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100011000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -00100000000000001000100010100000 -00110110000000010000101110000000 -00000000111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101000010000000000101100 -01000000000010111001000000000010 -10000101000000001000100100001000 -00100000010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001001000000010 -00100100100000001000100100000100 -00100110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000011111001000000 -00001111100100000000001011100100 -00000000111010010000000000111110 -01000000000011111001100000000011 -10000100000000001100000110000000 -00110010010000000000111110010000 -01000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001100000000011 -11100110001000101111100100100000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -00100000000001001100100000000100 -00111110000000000000111110000001 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010110010100000000011 -01111001000001001010101000000000 -00101110100000000000101111101100 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110001000000000010 -00001000000000001000001100000000 -00101100110000000000101100101100 -10000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001001011100 -00000000101101110000000000101101 -11000000000010111101010000000010 -01011001000000001010011100000000 -00101101110000000000101101100000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000010110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110101100000000011 -00011110000000001100011110000000 -00111101111000000000111101011000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111110001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000100001111101100 -00000000111110110000000000111110 -11000000000011110001000000000011 -11000000000000001111101100000000 -00111110110000000000111110000000 -00000011111011000000000011111011 -00000000001101101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100000000011101111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111101100000000011 -10111010000000001100111110000000 -00111111111000000000111111001000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111100000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000011100111000000 -00001011011100000000001111011100 -00000000101101110000000000111101 -11000000000010110101000000000010 -00011000010000001000011100000000 -00101101110000000000101101000000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010111111000000000010 -10010100000000001000011100001000 -00101101110000000000101101000000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000101000 -11000000000010110011100000000010 -00000000000000101000001110000000 -00101100110000000000101100000000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001011101100 -00000000111110110000000000101110 -11000000000011111011100010000011 -10000000000000101100111110000000 -00111110110000000000111110000000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011101011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111001000000100011 -01100000000000001111101100000000 -00111110110000000000111110000000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11100100000000001100111100000000 -00111111110000000000111111011000 -00000011111111000000000011111111 -00000000001101111100000000001111 -11110000000000111100100001000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000100001011101100 -00000000101110110000001000101110 -11000000000010111001100000010010 -11100010000000101000111100000000 -00101110110000000000101110001001 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110100001000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000100000010 -11100010001000001000101100000000 -00101110110000000000101110000000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011001100000000001001001100 -00000000101100110000000000100100 -11000000000010010001000000000010 -11000000000000001000001100000000 -00101100110000000000101100000000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000010011111011000000000011 -11100000000010001100101100000000 -00111110110000000000111110000000 -00000011111011000000000011111011 -00000000001101101100000000001111 -10110000000000111100000000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000001111110000000001111111 -11000000000011110111000000000011 -11110000000000001111111100000000 -00111111110000000000111111000000 -00000011111111000000000011111111 -00000000001111111100000000001101 -11110000000000111110100000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111100 -10000000001111111110000000001111 -11111000000000111111000000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000100001110111000000000 -10111011100000000010111011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111001 -10000000001011101110000000001011 -10111000000000101110100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011000000000010110010 -00000000001011001100000000001011 -00110000000000101110001000000001 -00110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000100001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000100011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111000 -10000000001111101100000000001111 -10110000000000111100000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000001111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111100 -10010000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111001 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001110101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111001 -00000000001011101100000000001011 -10110000010000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000001 -10110011000000000010110011000000 -00001001001100000000001001001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010010000 -00000000001011001100000000001011 -00110000000000101111100000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000100 -10110111100000000010110111100000 -00001011011110000000001010011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110101 -10000000001011011110000000001011 -01111000000000101101100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001111001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000101100110000 -00000011110011000000000011110010 -00100000001111001100010000001111 -00110000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000011011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000010 -01100000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000011111011000000000011111010 -00000000001111101100000000001111 -10110000000000111110001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110110 -00000000001011011100000000001011 -01110000000000101101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000010001101111000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -11000000001011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111110 -11011000001111101000000000001111 -10100000000000111111101100000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000100011111101 -00000000001111100100000000001111 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00001100001011100100000000001011 -10010000000000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101001010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -11000000001111100100000000001111 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000001010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00100000001111100100000000001111 -10010000000000111100101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001000010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000010001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011110111 -10000000001100111110000000001111 -11111000000100111101000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001101011100000000001011 -01110000000000101110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010111111 -00000000001010011100000000001011 -01110000000000101100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00001000001011001100000000001011 -00110000000000101101100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001110101100000000001111 -10110000000000111110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001001101100000000000111 -10110000000000111110010000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001100111100000001001111 -11110000010100111110000001100100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010110011 -00000000001000101100000000001011 -10110000000000101110000101000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001000101100000001001011 -10110000010000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010111011 -00000000001000001100000000001011 -00110000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000010000110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001100101100000000001111 -10110000000000111110000000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000101111111100000000001111 -11110000000000111110100000000010 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000000011111111000000000 -11111111100000000011111111100000 -00001111110110000001001101111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110111000000000 -10111011100000000010111011100000 -00001011100110000000001000001100 -00100000101110111000000000101110 -11100000000010111011100000000010 -11101110000001001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101110000000000010 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010100011000000 -00001010001100000000001001001100 -10000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000001 -00101100110000000001101100110000 -00000010110011000000000010110011 -00000000001011001100000000001010 -00110000000000101010001000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100001000001000101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111011000000000011111011000000 -00001111101111000000001101101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -10001111111110100000001110111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00010011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101110100010101100101100 -00100010110010110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011001110000000001000101111 -00000000100010110000000000111110 -11000000000010111011000000000010 -11101100000010001011101100000000 -00101110110000000000101110110000 -00000011111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001011000001000000001000001101 -00000000100000110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100000 -00001011011010000000001000011110 -00100000100001111000000000101001 -11100000000010110111100000000010 -11011110000000011011011110000000 -00101101111000000000101101111000 -00000010100111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000000000000110000000000 -11110011000000000011110011000000 -00001111000100000000001100001100 -00000000110000110000010001101100 -11000000000011110011000000000011 -11001100010000001111001100000000 -00111100110000000000111100110000 -00000010110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111011000000000001111111100 -01000000111111110000000000111111 -11000000000011111111000000000011 -11111100000100001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111001010000000001100001100 -00000000110010110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001101011100 -00000000101001110000000000111001 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001010011110000010001000011110 -00000000100001111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100100000101001001100 -00000000000000110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000100100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111111000001000001100101000 -00000010110010100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -10001111100001000000001111100000 -00000000111110000000000000111010 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100111 -00000000110010010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010011001000000 -00001011100111001000001011100111 -00000000100010010000000000101110 -01000000000010111001000001000010 -11100100000000001011100100000000 -00101110010000000000100110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010011001000000 -00001011100110000000001011000101 -00000000100010010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010010001000000 -00001011000100000000001011000100 -00000010101000010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011011000000000 -00001111100000000000001111100001 -01000000110010000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011011001000000 -00001111110100000000001111100100 -00000000110110010000000000111110 -01000000000011111001000000000010 -11100100000000001111100100000000 -00111110010000000000110110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110111100000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11101001000000000011111001000000 -00001111110100000000001111110100 -00000000110010010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100111000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000010100010000000000000101110 -00000000000011111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001110100000000000001011 -10000000000000101100011000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10100001000000000010110001000000 -00001011000100000000001011000100 -00000000100100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100100000001011000100 -00000000100110010000000000101110 -01000000000010101001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001010100100000000001011 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11101001000000000011111001000000 -00001111100101100000001111100100 -00000010110110010000000000111110 -01000000000010111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111010010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001110100100000000001111 -10010000000000111101101100000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100001000000001111100000 -10000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000100 -00011110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011111010001000001011111010 -10000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001101100000001011001110 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011010100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011110111100000 -00001111010110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000101101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100001000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111100100000000001111101000 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011111111000000000 -11111111100000000011111111100000 -00001111011110000000001100110110 -00000000110011111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011101000000001101011100 -00000000100001110000000000111101 -11000000000011110111000000000010 -11011100000000001011011100000000 -00111101110000000000111001110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001010011000000000001001011000 -00000000100001110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001010 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011001000010000101000001000 -00000000100000110000000000001000 -11000000000000100011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011010110000000000 -10111011000000000011111011000000 -00001111000100000000001001101000 -00000010110010110000000000101110 -11000000000010111011000000000011 -11101100000000001111101100000000 -00111110110000000000101110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -10001111100101100000001111101100 -00000000111110110000000000111110 -11000000000111111011000000000011 -11101100000001001111101100000000 -00111010110000000000111010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000000001111110000000000 -11101111000000000011111111000000 -00001111110100000000001100110010 -00000000111111110000000000111111 -11000000000011111111000001000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111100000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011100011000000001010101001 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000100001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011100110000000001000100101 -01000000101010110000000000101110 -11000000000010111011000000000110 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110100000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00001011000100000000101000001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011111011000000 -00001111100000000000001100000000 -00000000111010110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111110000000000001110111000 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000001111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000011011111111000000000 -11111111100000100011111111100000 -00001101111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -11100000000000001110111000000000 -10111011100000000010111011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000010001011101110000000001011 -10111000000000101111000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11001000000001011100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001001001100000000 -00101100110000000000101100110000 -00000010100011000000000010110011 -00000000001011001100000000001011 -00110000000000101111001000000001 -00110000000000000000000000000000 -00000000000000000000000000000000 -11100000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110000000000 -11111011000000000011111011000000 -00001101101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000100001111 -10110000000000111100000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000010000 -11111111000000000011111111000000 -00000111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000001000111111100000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -01010100000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000110110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000001000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010010011000000000010110011 -00000000001011001100000000001001 -00110000000000101111000100000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10110000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101111111000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000000000000110000000000 -11110011000000000011110011000000 -00001111001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000101100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001100000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000010 -00100000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000011110111000000000011110111 -00000000001011011100000000001111 -01110000000000111111001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101001111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011000000000010100011 -00000000001011001100000000001010 -00110000000000101001101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000110110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000000011 -10010000000000101110000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001001100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000111 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000011111100100000000001111 -10010000000000111110111000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000011011110010000000000 -11111001000000000011111001000000 -00001111100100000000001110100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011101001000000000111111001 -00000000001111100100000000001111 -10010000000000111110111000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000000001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000111010000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001111 -10000000000000111100011000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -01001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001010000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010100001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101010010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001010 -10010000000000101000011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101001010010000000000 -11111001000000000011111001000000 -00001111100100000000001110100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011101001000000000010111001 -00000000001111100100000000001011 -10010000000000101110100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01101000000000001010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111010010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000010001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001000010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000011 -10101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -10011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000100101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000000000001111000000000 -11110111100000000010110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -10101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001011111111000000000 -11111111100000000011111111100000 -00001110111110000000001111111110 -00000000111011111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001111 -01110000000000101110101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000000010110111000000 -00001010011100000000001011011100 -00000000101001110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101001110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001010 -00110000000000101101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001110101100000000001011101100 -00000000111010110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111010110000 -00000010111011000000000011111011 -00000000001111101100000000001011 -10110000000000111110101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000010000111110110000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001101 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000111110 -11000000000010111011000000000011 -10101100000000001011101100000000 -00101110110000000000101110110000 -00000011111011000000000010111011 -00000000001011101100000000001011 -10110000010000101110000001100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101000 -11000000000010110011000000000010 -10001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000010000110110000000000 -11111011000000000010111011000000 -00001111101100000000001111101100 -00000000111110110000000000101110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001101 -10110000000000111110000000000110 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000110011111110000000000 -11111111000000000011111111000000 -00001111111100000000011111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011101111000000000011111111 -00000000001111111100000000001111 -11110000001000111110100000100010 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000000011111111000000000 -11111111100000000011111111100000 -00001101111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111100000000001011111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110111000000000 -10111011100000000010111011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11111110000000001011101110000000 -00101110111000000000101110111000 -00000010011011100000000010111011 -10000000001011101110000000001011 -10111000000000101110000000000110 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000001 -00001011001100000100001011001100 -00000000101100110000000000001000 -11000000000010110011000000000010 -11001100000000001001001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001010 -00110000000000101010001000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11111100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111010 -11000000000011111011000000000010 -11101100000000001111101100000000 -00111110110000011000111110110000 -00000001111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011011111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00011111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100001000001111101100000000 -00111110110000000000111110110000 -00000111111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000100010111011000001 -10001011101100000000001011101100 -00001000101110110000000000111110 -11000000000010111011000000000010 -11101111000000001110101100000000 -00101110110000000000101110110000 -00000011111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001101010000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111000000000 -10110111100000000010110111100000 -10011011011110000010001011011110 -00000000101101111000000000101001 -11100000000010110111100000000010 -11011110000000001010011110000000 -00101101111000000000101101111000 -00000010100111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -01001000000000000000110000000000 -11110011000000000011110011000000 -00001011001100000000001111001100 -00000000111100110000000000101100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000010110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111111100000010001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111110000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001110101100000001001111101100 -00000000011110110000000000111110 -11000000000011111011000000000011 -11001100010000001100101100000000 -00111110110000000000101110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00000011011100000000001011011100 -00000001101101110000000000111001 -11000000000010010111000000000010 -11011100100000001010011100000000 -00101101110000000000001101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001010011110 -00000001101001111000000000101101 -11100000000010110111100000000010 -11011110000000001000011110000000 -00101101111000000000101101111000 -00100010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000100001011001100 -00000000101100110000000000101100 -11000000000010010011000000000010 -11001100000000001010001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001100101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000100 -01010000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000001001111100000 -00000100111110000000000000111010 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001100100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000111010010000000000101110 -01000000000010111001000000010010 -11010101000000001000100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000000010010010000000000 -10111001000000000010111001000000 -00011011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001000100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100111000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000110110001000000 -00001011000100000000001011000100 -00000000101000010000000000101100 -01000000000010110001000000000010 -11000100001000101000000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100101000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011000010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11101010100000001100100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000011011110010000000000 -11111001000000000011111001000000 -00001111100100000000001011100100 -00000000111010010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000101110010000000000111110 -01000000000011111001000000000011 -11110110000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000110111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000100101100010000000001101100 -01000000000010110001000000000010 -11000101000000001011000100000000 -00101100010000000000101100010000 -00000000110001000000000010110001 -00000000001011000100000000001010 -00010000000000101101001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000100011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000011011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000001000 -11111001000000000011111001000000 -00001111100100000000001011100100 -00000001101110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000010111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00101000010000011010010000000000 -11111001000000000011111001000000 -00001111100100000010001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000100000001011100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000001001011101000 -00000000111010100000000000101110 -10000000000010111010000000000010 -11111000000000001011101000000000 -00101110100000001000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000001100110000000000001100 -11000000000010110011000000000010 -11000100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11010101000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110000000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000111101111000000001111101 -11100000010011110111100000100011 -11010110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111110001000000010 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000011011010110000001000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111010110000000000111110 -11000000000011111011000000000011 -11100100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001011 -10110000000000111100001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11111111100100000011111111100100 -00001011111110010000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11110110000000001100111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000100001011011100 -01010000101101110000000000101101 -11000000000010110111000000000010 -11010101000000001010011100000000 -00101101110000000000101101110000 -00000001100111000000000010110111 -00000000001011011100000000001011 -01110000000000101110001000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001001110000000000 -10110111000000010010110111000000 -00000010011100000010001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11000100000000001001011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101000000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000100101100110000001000101100 -11000000000010110011000000000010 -11000100000000001011001100000000 -00101100110000000000101100110000 -00000000100011000000000010110011 -00000000001011001100000000000011 -00110000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001011101100 -00000000111110110000000000001110 -11000000000011111011000000000011 -11000100000000001101101100000000 -00111110110000000000101110110000 -00000010111011000000000011111011 -00000000001111101100000000001011 -10110000000000111110101100000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000100111110 -11000000010011111011000000000011 -11101100000000001110101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11110100100000001101111100000000 -00111111110000000001111111110000 -00000011101111000000000011111111 -00000000001111111100000000001111 -11110000000000111100100001000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000111110 -11000000000010111011000000000010 -11101110000000001000101100000000 -00101110110000000000101110110000 -00000011101011000000000010111011 -00000000001011101100000000001011 -10110000000000101110100001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010101011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101000000000001001101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000000 -10110011000000000010110011000000 -00011011001100000000001011001100 -00000001101100110000000000101000 -11000000000010110011000000000010 -11001100000000001000001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000011011 -00110000000000101100001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000011010110110000000000 -11111011000000000011101011000000 -00001111101100000000001111101100 -00000000111110110000000000101110 -11000000000011111011000000000011 -11101100000000001101101100000000 -00111110110000000000101110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000011 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000110011111110000000000 -11111111000000000011111111000000 -00001111111100000000011111111100 -00000000111111110000000001111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000001111111110000 -00000011101111000000000011111111 -00000000001111111100000000011111 -11110000000000111110100000000101 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11101111100000000011111111100001 -10001111111110000000001101111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000000011101011100000 -00001011101110000000001011101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000011111011100000000010111011 -10000000001111101110000000001111 -10111000010000101110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10100011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00100100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010101011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010101011000000000000111011 -00000000001010101100000000001010 -10110000000001101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110000000000 -11101011000000000011111011000000 -00001111101100000000001101101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000010111011000000000011111011 -00000000001011101100000000001011 -10110000000000111100000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00001111111100000000000111111100 -00000000111111110000000000111111 -11000000000001111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000010000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000010001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111100100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -01100000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101101100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001111001100000000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111111100000000011111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000010 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001110101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000001111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001111011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001110011100000000001111 -01110000000000111101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10110111100000000010110111100000 -00001010011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -01000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101111000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000100100110000 -00000010110011000000000010110011 -00000000001010001100000000001010 -00110000000000101001001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111010000000000011111010000000 -00001110101000000000001011101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001011 -10100000000000101111101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001110100000000001001111 -10000000000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000000111001000000 -00001011100100000000001011100100 -00000000100110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -10111000000011000110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000110110010000000000111110 -01000000000011111001000000000010 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -11111000000000000011101000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000001110000000 -00000010111000000000000011111000 -00000000001011100000000000001111 -10000000000000101100111000000100 -00010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10101001000000000010101001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010101001 -00000000001011100100000000001010 -10010000000000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -10111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000010111001 -00000000001111100100000000001011 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000010000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000111111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000001000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001011111111000000000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111101000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110001000000 -10110111000000000010110111000000 -00001011011100000000001110011100 -00000000101101110000000001101101 -11000000000011100111000000000010 -11011100000000011011011100000000 -00101101110000000000101101110000 -00000011110111000000000011110111 -00000000001011011100000000001110 -01110000000000111110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00010000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100010000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001010001100 -00000000101100110000000000101100 -11000000000010100011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010100011000000000010100011 -00000000001011001100000000001010 -00110000000000101001100100000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10111000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000001000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000010111011000000000010111011 -00000000001111101100000000001011 -10110000000000101110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001110101100 -00000000111110110000000000111110 -11000000000011101011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000011001110 -10110000000000111110010100000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10010000000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001110111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000001111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000000011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000001100000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000001110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101010110000000000101110110000 -00000010111011000000000110111011 -00000000001011101100000000001011 -10110000000100101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000011000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -11111011000000000011111011000000 -00001111101100000000001110101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000101110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000010000111111110000 -00000011111111000000000011111111 -00000000001111111100000000011111 -11110000000000111110100000000111 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111011000000000 -11001111100000000011001100000000 -00001000111110000000001100111110 -00000100111111111000010000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110010000000000 -10001010000000000010001010000000 -00001000101100000000101000101110 -00000000101110111000000000101110 -11100000000010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000100010111011 -10000000001011101110000000001011 -10111000000000101110000000000110 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011110110000000010 -10001011000000000010000000000000 -01001000001100000000001000001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000110110011000000000010110011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010011000000000 -10001011000000000010001011010000 -00001000001100000100001000101100 -00000000101110110000000100101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000010000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111000000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000101011110111110000100 -11000010100000001011001000000000 -00101100101100000000001100101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000001001111101100000100001111 -10110000000000111101000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011010000000000 -11111110101000100011111100000000 -00101111111100000010001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000100111111110000 -00010011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110100000000 -11001011000100000011000011010010 -00001000101100000000001011101100 -00000000111110110000000000111110 -11000000010011111011000001000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000010111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010000110010000000 -10001010000000100010001011000011 -00001000101111011000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000001000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100010000000000 -10000011000010010010000001000000 -00101000001110000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001001000000010 -10001110100000000010000111100100 -00001000011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000100010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000010110000000000 -11000011000000010011001000000100 -00101100001100010000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110000000000111100110000 -00000011110011000100000011110011 -00000000001111001100000000001111 -00110000000000111101001000000010 -00010000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000010 -11110100000000101011111110000100 -00001111111100010000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000010 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011100010000000010 -11001011000000000010001001010010 -01001100101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000000111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001010000000000 -10001110000000000010000101000000 -00001000011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000100101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000110 -01000000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001011111000100000 -10000111100000000010000110100010 -00001000011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000001101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100111000000000 -10000000010010001010000011000000 -00001000001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011001100100000000 -11001110010000010011001010010000 -00101100101000000000001111101000 -00010000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00101110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000100000 -11111000000000000011110000010010 -00001111100000000000001111100000 -00000100111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110011000000000 -11001001000100000011001011000100 -00001100100111000100001100100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110011100001000 -10001001110000000010001001110000 -00101000100110000000101000100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000010001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010001000010 -10000011010000000010001001000000 -01001000000100000000001000100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100111000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000010011000000000 -10000001010000001010000011001000 -00001000000101000010101000000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000010010110001 -00000000001011000100000000001011 -00010000000100101100101000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000100000000 -11001000010000010011000000000101 -00001100101001000000001100100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -01111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011111010000100000 -11111101000000000011111001010000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -01000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11001001000000000011001001000000 -00001100100100000000000111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000000111100100000000001111 -10010000000000111100011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001100000000000010 -10001000000000001010001000000000 -00001000110000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010111000 -00000000001011100000000000001011 -10000000000000101100111000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011101010000000010 -10000101000000000010000101000000 -00001000010100000100001001000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001001000100000000 -01101100010000000000001100010000 -00100000110001000000000010110001 -00000000001011000100000000001011 -00010000000000101101001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010011000001000 -10000101000000000010000101000000 -00001000111100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000100110010000 -00000000111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010010000010 -11001001001000000011001001101000 -00101100100100000000001101100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001101100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000100100 -11111001100101000011111001001000 -00001111100100000000001111100100 -00000100111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101001000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000100000000 -11001000110001000011001000100000 -00001111100000000000001100100000 -00001000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000001010011111000 -00000000000111100000000001001111 -10000000010000111100001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010101100000000 -10001010000000000010001010001000 -00001011101000000000001000101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000010001011101000000010 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010110110101000000 -10000011000000000010000011100000 -00001011001110000000001000001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10000111000000001010000111000000 -00001011011111000000001000011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000010 -00101101110000000000101101110000 -01000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101110000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001101000000010 -11001111100000001011000111100000 -00001111111010010000101100011110 -00001000111101111000000000111101 -11100000100011110111100000000011 -11011110000000001111011110000000 -00011101111000000000111101111000 -00000011110111100000100011110111 -10000000001111011110000000001111 -01111000000000111110001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010000000000000 -11111000000000000011111010000000 -00001111101000000010001111101100 -00000000111110110000000000111110 -11000000000011111011000000000010 -11101100000001001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001011101100000000001111 -10110000000000111100001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000001011111111000000000 -11001111100000000011001111100100 -00001100111110000000001010111110 -01000000111111111000001000011111 -11100000100001111111100000000011 -11111110000000001111111110010000 -00111111111000000000111111111001 -00000010111111100100100011111111 -10000000001111111110000000001011 -11111001000000111100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000000011001110000000000 -10000111001010000010000101000010 -00001000011100100000001000011100 -00000000001101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110001 -00010010010111000000000010110111 -00000000001011011100000000001011 -01110000000000101110101000000110 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000100001001100000000000 -10000111000000010110000111000000 -10001000010000000100001000011100 -00000000101101110000000000100101 -11000000000010110111000000000010 -11011100000000001011011100000010 -00101101110000000000101101110000 -00100000110111000000100010110111 -00000000001011011100000000001011 -01110000001000101100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001110001001000000 -10001000000000100100001000110000 -00001000100000000000001000001100 -00000000101100110000000001100100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000010000100100110000 -00000010010011000000000010110011 -00000000001011001100000100001011 -00110000000000101100100100000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000010 -11001001010000010011001011000000 -00001100101100000000100100101100 -00000000111110110000000000110110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000001111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110100000000 -11111011000000000011111011000000 -00001111100000000000001111101100 -00000000111110110000000100111110 -11000000010011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00010011011011000000000011111011 -00000000001111101100000001001111 -10110000000000111110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111110000100000 -11001101000010000011001101000010 -01001100111100000000001101111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111100100001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110010110010000 -10001000010000000010001000010000 -00001000101000000000011000101100 -00000000101110110000000000101110 -11000000000010111011000001000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110100001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010001000000010 -10001000100010000010001010110000 -00001000101110000010001000101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101010110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000000000000010 -10000011000000001010000000000000 -01001000000000000000001000001100 -00000100101100110000000000101100 -11000000000010110011000000010010 -11001100000000001011001100000000 -00001100110000000000101100110000 -00000000110011000000000110110011 -00000000001011001100000001001011 -00110000000000101100001000000101 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000001010100100000000000 -11000000000000000011000011000000 -01001100000100000000101100101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011111000000000000 -11111100000000000011111100000000 -00000111110000000100001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000010000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11111111100000000011111111100000 -00001110111110000000001101111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001101111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10111011100000000010111011100000 -00001011101110000001001011101110 -00000000101110111000000000101110 -11100000100010111011100000000010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00000010111011100000000010111011 -10000000001011101110000000001011 -10111000000000101110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10110011000000000010110011000000 -00001010001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00100100110000001000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000100111011000000000000111011 -00000000001011101100000000001011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110000000000 -11111011000001010011111011000000 -01001110101100000000001101101100 -00000000111110110000000000111110 -11000000000011111011000001000011 -11101100000000001101101100000000 -00111110110000000000111110110000 -00000011111011000001000011111011 -00000000001111101100000000001111 -10110000000000111100100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000000000011111111000000 -00000111111100000000001011111100 -00000000111111110000000000011111 -11000000000001111111000000000011 -11111100000000001111111100000000 -01111111110000000000111111110000 -00010011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001110101100000000001110101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10110011000000000010110011000001 -00000011001100000100000011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000001000000110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -01100000000000010001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000001101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101101100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000000 -00001111001100010000001110001100 -00000000111100110000000001111100 -11000000000011110011000001010011 -11001100000000001111001100000000 -00111100110001000000111100110000 -01000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000000 -11111111000000000011111111000000 -00001111111100000100001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000010000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000011011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000001101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000001000000001001111000000000 -10110111100000000010110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101111000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000100101100110000000000101100 -11000000000010110011000000100010 -11001100000000001011001100000000 -00101100110000000001100100110000 -00000010010011000000000010110011 -00000000001011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000100101011010100000000000 -11111010000000000011111010000000 -00001111101000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000000 -00111110100000000000111110100000 -00000011111010000000000011111010 -00000000001111101000000000001111 -10100000000000111111101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001010000000001110000000000000 -11111000000000010011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000001001111 -10000000000000111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001010000100001110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00100000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000010 -11100100000000001011100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000001 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000000111000000000000010111000 -00000000001011100000000000001011 -10000000010000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000100010111001000000000010 -11100100000000001011100100000000 -00101110010000010000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -10111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100101000010000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100001010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000001000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000100001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010111010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000000000010001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000001000010110111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100000000011110111100000 -00001111011110000000001111011110 -00000000111101111000000000111101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000010 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000001000 -11111111100000000011111111100000 -00001111111110000000001111111110 -00000000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011111111100000000011111111 -10000000000111111110000000001111 -11111000000000111101000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -11101000000100011001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000100101101 -11000000000110110111000000000010 -11011100000001001011011100000000 -00101101110000000000101101110000 -00000010110111000100000010110111 -00000000001011011100000000011011 -01110000000000101110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000000001001110000000000 -10110111000000000010110111000000 -00001011011100000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100010001000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00100000000101001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000001000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000111111011000000000011111011 -00000010001111101100000011001111 -10110000000100111110111000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000010001111101100000100 -00111110110000000000111110110000 -00000011111011000000100011111011 -00000001001111101100000000001111 -10110000001000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -11000000000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001111111100 -00000000111111110000000000111011 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000000010111011000000 -00001011101100000000000011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11101100000000001011101100000001 -00101110110000000000101110110000 -00000010111011000000000010111011 -00000100000001101100000000001011 -10110000000000101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000100 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000100010110011 -00000100001011001100000000001011 -00110000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111010 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110000000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -11100000000111011111110000000000 -11111111000000000011111111000001 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000010000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000000 -11000100100000100011001111100000 -00001100111010000000001111111110 -00000000110011111000000000111111 -11100000000011111111100000000011 -11111110000000001100111110000110 -00111111111000000000111111111000 -00000011111111100000000011001111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10001001100001100010001011100001 -00001000101010000000001011101110 -00000010100010111000000000101110 -11100001100010111011100000000010 -11101110000000101000101110000000 -00101110111000000000101110111000 -01000010111011100000010010001011 -10000000001011101110000000001011 -10111000000000101110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10011010000000000010010011000000 -00001001001000000000001011001100 -00000000100000110000000000101100 -11000000000010110011000000000010 -11001100000000001000001100000000 -00101100110000001000001100110000 -00000010110011000000001010010011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000101011010110000000000 -10011001000000000010011011000000 -01001001101000000010001011101100 -00000000100010110000000000101110 -11000000000010111011000000000010 -11101100000000001000101100000000 -00101110110000010000101110110000 -00000010111011000000000010011011 -00000000001011101100000000001011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101001000110000000000 -11011011100100000011010011000000 -00001101101000000100001111101100 -00000010110010110000000000111110 -11000000000011111011000000000011 -11101100000000001100101100000000 -00111110110000000000101110110000 -00000011111011000000100011011011 -00000000001111101100000000001111 -10110000000000111100000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -11100001000000001011110000001000 -11101100000000010011101111000000 -00001110111000000001001111111100 -00000000111111110000000000110111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000100111111110000 -00010011111111000000000011101111 -00000000001111111100000000001111 -11110000000000111111100000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11001011000000000011001011000000 -00001100101000010010001100101100 -00010000111110110000000000111110 -11000000000011111011000000110011 -11101100000010001111101100000000 -00111110110000000000111110110000 -01100011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001000010110000000100 -10000010000000000010001011000001 -00001000101011000000001000001100 -00000000101110110000000000101110 -11000000000010111011000000000010 -11001100000000001011101100000000 -00101110110000000000101110110000 -00000010110011000000000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000000000 -10000000000000000010010011000000 -00001001001010000000001000001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101111000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001111100000000 -10001100110000000010010111110000 -10001001011011000000001000011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000000 -00101101111000000000101101111000 -00100010110111100000010010110111 -10000000001011011110000000001011 -01111000000000101100100000010100 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11000010000000000011010011000100 -00001101001000010000001100001100 -00000000111100110000000000111100 -11000000100011110011000000000011 -11001100000000001111001100000000 -00111100110001000000111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011000110000000000 -11111010000000100011100011000001 -00001010001000000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000010001111101100000000 -00111110110000001000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011110110000000000 -11110000000000000010001011000000 -00001111101000000100001111101100 -00001000011110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000101110110000 -00000011110011100001001011001011 -00000000001111101100000000001111 -10110000000000111100001000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10110100000000000010000111000000 -00001011011000000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000000 -00101101110000000100101101110000 -00000010110111000000000010000111 -00000000001011011100000000001011 -01110000001000101101001000000100 -01000000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000000 -10111110100000001010000111100000 -00001011011010000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000001 -00101101111000000000001101111000 -00000010110111100000000010000111 -10000000001011011110000000001011 -01111000000000101100100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10110010000000000010000011000000 -00001011001000000000001011001100 -00000000101100110000000001101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000010000101100110000 -00000010110011000000000010000011 -00000000001011001100000000001011 -00110000000000101101101000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11111110000000000011001010000000 -00001111111000000000001111101000 -00000000111110100000000000111110 -10000000000011111010000000000011 -11101000000000001111101000000010 -00111110100000000000111110100000 -00000011111010000000000011001010 -00000000001111101000000000001111 -10100000000000111111101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000001000 -11111000100000001011111000000000 -00001111100000000000001111100000 -00000100111110000000000000111110 -00000000000011111000000000000011 -11100000000010001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111101001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000001011001001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000000110010000000000 -10110001000000000010001001000001 -00001011100100000000001110100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000100 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00011000000001000010011000000001 -10111011100001000010001001100000 -00001011100110000000001011100100 -00000000101110010000000000101010 -01000000000010111001000000000010 -11100100000000001011100100000010 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000010000 -10110001000000000010000001000000 -00001011000100000001001010000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000010011011000100000000 -00101100010000000000101100010000 -00000010110001000000010010110001 -00000000001011000100000000001011 -00010000000100101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000010010110000000000000 -11111000000000000011001000000001 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011111010000000000 -11111101000000000011111001000000 -00001111100100000000001110100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -01000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110111000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -00011000000001011110010000000000 -11111011000000000011001001000000 -00001111100100000000001111110100 -00000000111110010000000000110110 -01000000000011111001000000000011 -11110100000000001111100100000000 -00111110010000000000111110010000 -00000011111101000000000011001001 -00000000001111100100000000001111 -10010000000000111100111000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -00111100000100001110000000000000 -10111000000000000010001000000000 -00001011110000000000001011100000 -00000000001110000000000000101110 -00000000000010111000000000010010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000000010001000 -00000000001011100000000000001011 -10000000000000101100011000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00001000000001011101010000000000 -10111101000000000010010101000001 -00001011010100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000001010000001 -00000000001011000100000000001011 -00010000000000101101001000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111101100000001010011101000000 -00001011110100000000001011100100 -00010000101110010000000000101110 -01000000000110111001000000100010 -11100100000001000011100100000101 -00101110010000000000100110010000 -00000010111001000000000010001001 -00000000011011100100000000001011 -10010000000000101100011000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101001010010000010000 -11111001100000000011011001000000 -00001111100100000000001111100100 -00000000111110010000000100110110 -01000000100011111001000000100011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011001001 -00000000001111100100000010001111 -10010000000000111110100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101010000000001010010000000000 -11111001000000000011101001000000 -00001111100100000000001111100100 -00000100111110010000000000101110 -01000000000011111001000000000001 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111101101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101010000100001010000000000000 -11111000000000000011111000000000 -00001111110000100000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000001001111100000000000 -00111110000000000000011110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000100001000010100000000100 -10110010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000010110010000000000010111010 -00000000001011101000000000001011 -10100000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000000000 -10110011000000100010110011000000 -00001011001000000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000100010110011 -00000000001011001100000000001011 -00110000000000101100001100000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00100000000000010001100000010000 -10110110000000000010110110000000 -00001011011000000000001011011100 -00000000101101110000000000101101 -11000000000010110111000000000010 -11011100000000001011011100000001 -00101101110000000000101101110000 -00000010110111000000000010110111 -00000000001011011100000000001011 -01110000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00111000000010000001011000000000 -11110101100000000011110101100000 -00001111010010000000001111011110 -00000000111101111000001000111101 -11100000000011110111100000100011 -11011110000000001111011110000000 -00111101111000000000111101111000 -00000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111100101000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010000000000000 -11111000000000000011111000000000 -10001111100000000000001111101100 -00010100111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000010 -00111110110000000000111110110000 -01000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001011111111000000010 -11001111100000000011111111100000 -00001111111110010000001111111110 -00000000111111111001000000111111 -11100000000011111111100000000011 -11111110000000001111111110010000 -00111111111001000000111111111000 -00000011110111100000000011001111 -10000000001111111110000000001111 -11111000000000111101100000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001100001010000 -11010110000100000010110110000000 -00001011011100000000001001011100 -00000100111101110000000100101101 -11000000010010110111000100000010 -11011100000000001011011100000000 -00111101110000000000101101110000 -01010010110111000000010010000111 -00000000001011011100000000001011 -01110000000000101110101000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001011010000000000 -10000101000010000010110101000000 -00001011010110000000011001011100 -00000000101001110000000001101101 -11000000000010110111000000000010 -11011100000000001011011100000010 -01100101110000000001101101110000 -00000010110111000000000010000111 -00000000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000101001100000000000010 -10000000100000000010110000000000 -00001011000100000000001001001100 -00000100101100110000000000101100 -11000000000110110011000001000010 -11001100000100000011001100000100 -00101000110000010000101100110000 -00000010110011000001001010000011 -00000100001011001100000100001011 -00110000000000101101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -10101000000101011010110000000000 -10000011110000000011111011000000 -00001111101000000000001101101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001011101100000000 -00101110110000000000111110110000 -00000011111011000001000011001011 -00000000001111101100000000001111 -10110000001100111110101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110100000010000 -11111010000010000011111010000000 -01001111101000000000001101101100 -00000000111010110000000100111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -01111110110000000000111110110000 -00000011111011000000000011111011 -00000010001111101100000001001111 -10110000000000111110100000010100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00000001000100001111010000000000 -11111101000000000011001101000000 -00001111110000000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000100111111110000 -00010011111111000000100011111111 -00000000001111111100000000001111 -11110000000000111100000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11000001000001000110000000010000 -10111000000000000010001000000000 -00001011100000000100001011101100 -00010000101110110000000000101110 -11000001000110111011000000010010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000010111011000001000010111011 -00000000001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -11000000000001010010110000001000 -10111011000000000010001011000000 -00001011101100000000001010101100 -00000000101110110000000000101110 -11000000010010101011000000010010 -11101100000010001011101100000000 -00101110110000000000101110110000 -00000000111011000000000010111011 -00000000001011101100000001001011 -10110000000100101110000000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00001000010000000000100000000000 -10111010000000001010000010000000 -01001011001100000001001011001100 -00000000101100110000000000101100 -11000000000010110011000000010010 -11001100000000001011001100000001 -00101100110000000000101100110000 -00000010110011000000010010110011 -00000000001011001100000001001011 -00110000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000011000110010000000000 -11111001000000000011001001000000 -00001111100100000000001110101100 -00000000111110110000000000111110 -11000000000011101011000000000011 -11101100000010001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000011100000000000110 -00000000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011101000000000000 -01111100000001000011111100000001 -00001111110100000100001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000011111111100000000 -00111111110000010000111111110000 -01000011111111000001000011111111 -00000000001111111100000000001111 -11110000010000111110100000000010 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000001011111111000000010 -11001111100000000011111111100000 -10001111111110000000001101111110 -00001000111111111000000000111111 -11100000000011111111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111000 -00000011011111100000011011001111 -10000000001111111110000000001111 -11111000000000111111000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001110111000000000 -10001011100000000010111011100000 -00001011101110000001001011101110 -00001000101110111000001100101110 -11100000010010111011100000010010 -11101110000000001011101110000000 -00101110111000000000101110111000 -00010010011011100000000010001011 -10000000001011101110000000001011 -10111000000000101110000000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10001000000001011100110000000000 -10000011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101100110000 -00000010110011000000000010000011 -00000000001011001100000000001011 -00110000000000101110001000000001 -01110000000000000000000000000000 -00000000000000000000000000000000 -11000000000100011010110000000000 -10001011000001000010111011000000 -00001011101100000000001011101100 -00000000101110110000000000100110 -11000000000000111011000001000010 -11101100000000001011101100000000 -00101110110000001000101110110000 -00000110011011000000000010001011 -00000000001011101100000000000011 -10110000000000101111000000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00000000000101011110110000000000 -11001011000000000011111011000000 -00001111101100000000001101101100 -00000000111110110000000000111110 -11000001000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011011011000000010011001011 -00000100001111101100000000001111 -10110000000000111101000000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -11100000000000011011110000000000 -11111111000001000011111111000000 -00000111111100000100001111111100 -00000000111111110000000000101111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00010011111111000001000011111111 -00000000001111111100000000001111 -11110000000000111111100000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000100001010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00011000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00010011111011000000010011111011 -00000100001111101100000000001111 -10110000000000111101000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -11001000000001010000110000000000 -10111011000001000010111011000000 -00001011101100000100001011101100 -00000000111110110000010000101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000000101110110000 -00000000110011000001000010111011 -00000000001011101100000000001011 -10110000000000101111001000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -11100000000001010100110000010000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000001100110000 -00000010110011000000000010110011 -00000000001011001100000100000011 -00110000000000101111100000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -01100000010000010001111000000000 -10110111100000000110110111100000 -00001011011110000000001011011110 -00000000101101111000000000101101 -11100000000010110111100000000010 -11011110000000001011011110000100 -00101101111000000000101101111000 -00000010110111100000000010110111 -10000000001011011110000000001011 -01111000000000101100100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01001000000010000000110000000000 -11110011000000000011110011000001 -00001111001100010000001111001100 -00000000111100110000000000111100 -11000000000011110011000000000011 -11001100000000001111001100000000 -00111100110001000100111100110000 -00000011110011000000000011110011 -00000000001111001100000000001111 -00110000000000111101001000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000111011011110000000001 -11111111000000000011111111000000 -00000111111100010100001111111100 -00000000111011110000000001111111 -11000000000011111111000000010011 -11111100010000001111111100010000 -00111111110000000000111111110001 -00010111111111000000000011111111 -00000000001111111100000000001111 -11110000000000111101000000000010 -01100000000000000000000000000000 -00000000000000000000000000000000 -10101000000001011100111000000000 -11001011000000000011111011000000 -00001111101100000000001111001110 -00000000110010110000000000111110 -11000000000011111011000000000011 -11001110000000001100101100000000 -00111110110000001000111110110000 -00000011110011100000000011001011 -00000000001111101100000000001111 -10110000000000111110101000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -01001000000100011001110000000000 -10000111000000000010110111000000 -00001011011100000001001011011100 -00000000100001110000000001101101 -11000000000010110111000000000010 -11011100000000001000011100000100 -00101101110000000000100101110000 -00000010110111000000000010000111 -00000000001011011100000000001011 -01110000000000101101001000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -11000000000000001001111000000010 -10000111100000000010110111100000 -00001011011110000000001011011110 -00010011100101111000000000101101 -11100000000010110111100001100010 -11011110000010101000011110000000 -00101101111000000000101101111000 -00000010110111100000011010000111 -10000100001011011110000000001011 -01111000000000101111000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01001000000101001100110000000000 -10000011000000010010110011000000 -00001011001100000000001011001100 -00000000100100110000000000101100 -11000000000010110011000000000010 -11001100000000001000001100000001 -00101100110000000001100100110000 -00000010110011000000000010000011 -00000000001011001100000000001011 -00110000000000101101001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -11101000000101011010100000000000 -11001010000000000011111010000000 -00001111101000000000001111101000 -00000000110110100000000000111110 -10000000000011111010000000000111 -11101000000000001100101000000000 -00111110100000000000111110100000 -01000011111010000000000011001010 -00000000011111101000000000001111 -10100000000000111111101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -01001000000000001110000000000000 -11111000000000100011111000000000 -00001011100000000000001111100000 -00000000111010000000000000111110 -00000000000011111000000000000111 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000001001111 -10000000000100111101001000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000100001110010000000000 -11111001000000000011101001000000 -00001111100100000000001111100100 -00000000111110010000000000111110 -01000000000011111001000000000011 -11100100000001001111100100000000 -00111110010000000000111110010000 -01100011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100001000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000001000110010000000000 -10111001000000000010111001000000 -00001011100100000000001011100100 -00000000100110010000000000101110 -01000000000010111001000000000010 -11100100000000001011100100000000 -00101110010000000000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101110000000000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -00011000000001010010010000000000 -10111001000000000010111001000001 -00001011100100000000001011100100 -00000000101110010000000000101110 -01000000000010111001000000000010 -10100100000000001011100100000000 -00101110010000000000001110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000010010 -11000100000000001011000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -10111000000011010110000000000000 -11111000000000000011101000000000 -00001111100000000000001111100000 -00000000111110000000000000111110 -00000000000011111000000000000011 -11100000000000001111100000000000 -00111110000000000000111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111110111000000011 -01010000000000000000000000000000 -00000000000000000000000000000000 -10011000000111011110010000000000 -11111001000000000011111001000000 -01001111100100000000001111100100 -00000000110110010000000000111110 -01000000000011111001000000000001 -11100100000001001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110011000000110 -01110000000000000000000000000000 -00000000000000000000000000000000 -10011000000001011111010000000000 -11111001000000000011111001000000 -00001111100100000000001111110100 -00000000111110010000000000110110 -01000000000011111001000000000011 -11110100000000001111100100000000 -00111110010000000000111110010000 -00000011111101000000000011111001 -00000000001111100100000000001111 -10010000000000111100011000000001 -01100000000000000000000000000000 -00000000000000000000000000000000 -00111000000100001110000000000000 -10111000000000000010111000000000 -00001011100000000000001011100000 -00000000101110000000000000101110 -00000000000010111000000000000010 -11100000000000001011100000000000 -00101110000000000000101110000000 -00000010111000000000010010111000 -00000000001011100000000000001011 -10000000000000101100111000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -00001000000000001100010000000000 -10110001000000000010110001000000 -00001011000100000000001011000100 -00000000101100010000000000101100 -01000000000010110001000000000010 -11000100000000001010000100000000 -00101100010000000000101100010000 -00000010110001000000000010110001 -00000000001011000100000000001011 -00010000000000101100001000000001 -00110000000000000000000000000000 -00000000000000000000000000000000 -00011000000101011010010000000000 -10111001000000000010111001000000 -00001011100100000000011011100100 -00000000101110010000000100101110 -01000000000010111001000001000010 -11100100000000001011100100000000 -00101110010000010000101110010000 -00000010111001000000000010111001 -00000000001011100100000000001011 -10010000000000101100011000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10100000000101011110010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00010000111110010000010000110110 -01000000000011111001000000000011 -11100100000000001110100100000000 -00111110010000000000111110010000 -00000010111001000000000011111001 -00000000001111100100000000001111 -10010000000000111110100000000100 -01110000000000000000000000000000 -00000000000000000000000000000000 -00101000000000011010010000000000 -11111001000000000011111001000000 -00001111100100000000001111100100 -00000000111110010000000000101110 -01000000000011111001000000000011 -11100100000000001111100100000000 -00111110010000000000111110010000 -00000011111001000000000011111001 -00000000001111100100000000001111 -10010000000000111100101000000000 -01100000000000000000000000000000 -00000000000000000000000000000000 -00101000000100000010000000000000 -11111000000000000011111000000000 -00001111100000000000001111100000 -00000000111110000000000001111110 -00000001000011111000000000000011 -11100000000000001111100000000000 -00111110000000000001111110000000 -00000011111000000000000011111000 -00000000001111100000000000001111 -10000000000000111100101000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010010100000000000 -10111010000000000010111010000000 -00001011101000000000001011101000 -00000000101110100000000000101110 -10000000000010111010000000000010 -11101000000000001011101000000000 -00101110100000000000101110100000 -00000011101010000000000010111010 -00000000001011101000000000001011 -10100000000000101100101000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00101000000001010100110000010000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000100 -00101100110000000000101100110000 -00000010110011000000000010110011 -00000000001011001100000000001011 -00110000010000101100101000000000 -01010000000000000000000000000000 -00000000000000000000000000000000 -10100000010000010001110000000000 -10110111000000000010110111000000 -00011011011100000000001011011100 -00000000101101110000000000001101 -11000000000010110111000000000010 -11011100000000001011011100000001 -00101101110000000000101101110000 -00000000100111000000000010110111 -00000000001011011100000000001011 -01110000000000101110100000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -10101000000010000001111000000000 -11110111100001000111110111100000 -00001111011110000000001111011110 -00000000111101111000000000101101 -11100000000011110111100000000011 -11011110000000001111011110000000 -00111101111000000000101101111000 -01000011110111100000000011110111 -10000000001111011110000000001111 -01111000000000111110101000000010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000111011010110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000100111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100001000000110 -01100000000000000000000000000000 -00000000000000000000000000000000 -01000000000001011111111000000000 -11111111100000000011111111100100 -00001111111110000000001111111110 -00000000111111111000011000111111 -11100000000011101111100000000011 -11111110000000001111111110000000 -00111111111000000000111111111001 -00000011111111100000000011111111 -00100000001111111110000000001111 -11111000000000111100000000000000 -01110000000000000000000000000000 -00000000000000000000000000000000 -10101000000100011001110000000000 -10110111000100000010110111000000 -00001011011100000000001011011100 -00000000101101110001000000101101 -11000000010010110111000000000010 -11011100000010001011011100000000 -00101101110000000000101101110001 -00000010110111000100000010110111 -00000000001011011100000010001011 -01110000000000101110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -00011000000000001001110000000000 -10110111000000000010110111000001 -00011011011100000000001011011100 -00000000101101110000000000101101 -11000000000010100111000000000010 -11011100000000001011011100000000 -00101101110000000000101101110000 -00000110110111000000000010110111 -00010000001011011100000000001011 -01110000000000101100000000000000 -00100000000000000000000000000000 -00000000000000000000000000000000 -01100000000100001100110000000000 -10110011000000000010110011000000 -00001011001100000000001011001100 -00000101101100110000000000101100 -11000001000010110011000000000010 -11001100000000001011001100000000 -00101100110000000001101100110000 -01000010110011000000000010110011 -00000000001011001100000000001011 -00110000000000101100100000000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10111000000101011010110000000000 -11111011000000000111111011000000 -00001111101100000010001111101100 -00000000111110110000000000111110 -11000000000011101011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111110101000000100 -01100000000000000000000000000000 -00000000000000000000000000000000 -10000000000000001110110000000000 -11111011000000000011111011000000 -00001111101100000000001111101100 -00000000111110110000000000111110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000111110110000 -00000011111011000000000011111011 -00000001001111101100000000000111 -10110000000000111110000000000000 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000000000100001111110000000000 -11111111000000000011111111000000 -00001111111100000000001110111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000000000111111110000 -00000011111111000000000011111111 -00000000001111111100000000001111 -11110000000000111100000001000100 -00110000000000000000000000000000 -00000000000000000000000000000000 -10000001000001000110110000000000 -10111011000000010011101011000000 -00001011101100000000000011101100 -00000000101110110000000001101110 -11000000000010111011000000000010 -11101100000000001011101100000000 -00101110110000000001111010110000 -00000011101011000000110010111011 -00000100001011101100000000001011 -10110000000000101110000001000000 -00010000000000000000000000000000 -00000000000000000000000000000000 -10000000000001010010110000000000 -10111011000000000010111011000000 -00001011101100000000001011101100 -00000000101110110000010000101110 -11000000000010111011000000000110 -11101100000000001011101100000000 -00101110110000010000101110110000 -00000010111011000000000010111011 -00000000001011101100000000001011 -10110000000000101110000000000000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00001000000001000000110000000100 -10110011000000000010100011000001 -00001011001100000000001011001100 -00000000101100110000000000101100 -11000000000010110011000000000010 -11001100000000001011001100000000 -00101100110000000000101000110000 -00010010100011000001100010110011 -00000100001011001100000000001011 -00110000000000101100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -10000000000011010110110000000100 -11111011000000100011111011000000 -10001111101100000000001110101100 -00000000101110110000000000101110 -11000000000011111011000000000011 -11101100000000001111101100000000 -00111110110000000000101110110000 -00000011111011000000000011111011 -00000000001111101100000000001111 -10110000000000111100000000000011 -00010000000000000000000000000000 -00000000000000000000000000000000 -10100000000111011111110000000000 -11111111000000000011111111000001 -00001111111100000000001111111100 -00000000111111110000000000111111 -11000000000011111111000000000011 -11111100000000001111111100000000 -00111111110000010000111011110000 -00000011101111000000000011111111 -00000000001111111100000000001111 -11110000000000111110100100000011 -01110000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010000000000000010 -01110001010000001001110000010000 -00110111000111000101010111000001 -00000011011100000100000010011100 -00010000001101110001010000001101 -11000111000000110111000111000001 -11011100010100000111011100010100 -00010101110000010000000101110000 -01000000010111000001000001010111 -00000100000111011100000000100001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110000010100010000100101 -01110001000000010101110001000000 -01010111000100000001010001000100 -00000101011100010000000001011100 -01000000010101110001000001010101 -11000100000001010011000100000001 -01011100010000000101011100010000 -00011100100001000000010000110001 -00000001110111000100000001010111 -00010000000101011100000000010001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000100001000000001000000001 -00100000100000000100100000100000 -00010010000110000000000010000010 -00000001001000001000000001001000 -00100000000100100000100000000100 -10000010000000000010000010000000 -01001000011000000001001000011000 -00000100100000100000000101110000 -10000000010010000010000000010010 -00001000000001001000000000100000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000100000000000000000000001 -01100000000000000101100000000000 -00010110000000000000010110000000 -00000001011000000000010001010000 -00000000000101100000000000000101 -10000100000000010110000100000000 -01011000000000000001011000001000 -00000001100000000010010101100000 -00000000010110000000000000010110 -00000000000101011000000000110001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000010001010100100101000101 -01110010000000010001110010000000 -01000111001000000000010111001000 -00000101011100100000000000011100 -10000000010101110010000000010101 -11001000000001010111001000000000 -01011100110000000001011100100000 -00000101110010000000010101110010 -00000001010111001000000001000111 -00100000000100011100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100000000000000 -01100000000000000001100000000000 -00000110000000000000000110000000 -00000000011000000000000100011000 -00010000000001100000000000000001 -10000000000000000110000000000000 -00011000000000000000011000000000 -00000000100001000000000001100000 -00000000000110000000000000000110 -00010000000000011000000000110001 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100100000000100 -00100010000000010000100010010000 -01000010000000000000000010001000 -00000100001000000000000100001000 -10000000010000100010000000010000 -10001000000001000010001000000000 -00001000101000000000001000000100 -00000000100001000000010000100000 -00000001000010000000000001000010 -00110000000100001000000000100001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100111100000101 -01000010100000010101000011100000 -01010100000000000000010100001010 -00000101010000001000000101010000 -11100000010101000010110000010101 -00001010000001010100001111000001 -01010000111000000101010000000000 -00000100000000100000000101000000 -11000000010100000010000001000100 -00101100000000010000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000100000000001110100000001 -00010011000000000101010111000000 -00010101011100000001010101011100 -00000001000001110000000001000001 -11000000000100000111000000000100 -01011100000000010101001100000000 -01000101110000000001010100110000 -00000101010111000000000101010011 -00000000010001011100000000010101 -00110000000001000100000000100000 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000100001000000010000000000 -00010000000000000001000001000000 -00000100001110000000000100000000 -00000000000000000000000000000000 -01100001000001000000000000000000 -01000000000000000100000110000000 -00000100010000000000010000110000 -00000001000011000000000001000000 -00000001000001001000000000000100 -00010000000000000100000100100001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000110000010110000000000010 -00011000000000001000001000000000 -00100000100000000000100000100000 -00000010000010000000000110000010 -00000000001000001000000010001000 -01100000000000100000100000000000 -10000110000000000010000010000000 -00001000001001000000001000001000 -00000000100001100000000000100000 -10000000000010000100000100010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010001000000000101 -01100000000000010101100100000000 -01010110010000000000110110010000 -00000001001001000000000001001001 -00000000010101100100000000010101 -10010000000000010110000000000000 -01011001000000000001011000000000 -00011101100100100000011101100000 -00000001010110010000000001110110 -00000000000101011000000000010001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100000000000001 -01100000000000001101100000000000 -00110110001000000000010110000000 -00000111011000000000000011011000 -00000001001101100000000000001101 -10000000000001110110000000000001 -11011000000000000101011000100000 -00010101100010000000010101110000 -00000000010110001000000001010110 -00000000000111011000000000100001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100001000000100 -00110000100001010000110000100000 -01000011000011000001000011000010 -00000100001100001000000000001100 -00100001010000110000100001010000 -11000010000001000011000010000001 -00001100001000000010001100001000 -00000000110000100000010001100000 -10000001100011000010000001100011 -00001000000100001100000000110001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000100000000000000000000000 -00110000000000000000110000000000 -00000011000000000000000011000000 -00000000001100100000000000001100 -00000000000000110000000000000000 -11000000000000000011000000000000 -00001100000000000000001100000000 -00000000110000000000000000100010 -00000000000011000000000000000011 -00000000000000001100000000000001 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000100000000000001000000001 -00110000100000000100110000100000 -00010011000010000001010011000010 -00000101001100101100000001001100 -00100000000100110000100000000100 -11000010000000010011000010000000 -01001100001000000001001100001100 -00000100110000110000000100110010 -11000000010011000011000000010011 -00001000000001001100000000110001 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100001000000101 -01100000100000010101100000100000 -01010110000011000001000110000010 -00000001011000001100000000001000 -00100000010101100000100000010101 -10000010000000010110000010000000 -01011000001000000001011000001100 -00010101100000110000000101100000 -11000001010111000011000001010110 -00001000000001011000000000010000 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100001000000000 -00100000100000000000100000100000 -00000010000010000000000011000010 -00000000011000001000000100001000 -00100000000000100000100000000000 -10000010000000000010000010000000 -00001000001000000000001000001000 -00000000110000100000010000110000 -10000000000110000010000000000011 -00001000000000001000000000110001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010001001000000100 -01100000100000010001100100100000 -01000110010010000001000011010010 -00000000001001001000000100001001 -00100000010001100100100000010001 -10000010000000000110010010000000 -00011001001000000000011001001000 -00010000110100100000010000110100 -10000001000010000010000001000011 -01001000000000011000000000000001 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000010001010110000000000101 -01011000000000010101011000000000 -01000101100000000000000001100000 -00000001010110000000000100000010 -00000000010101011000000000010101 -01100000000001010101100000000001 -01010110000000000001010110000000 -00010100011000000000010100011000 -00000000010001100000000000010001 -10000000000101010100000000000001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000100001000010011000000001 -01000001100000000101000001100000 -00010100000110000000010100000110 -00000001010000011000000001010000 -01100000000101000001100000000101 -00000110000000010100000110000000 -01010000011000000001010000011000 -00000001000000100000000101000001 -10000000010100000110000000010100 -00011000000001010000000000010001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000100000000001001000000001 -00000000100000000100000100100000 -00010000010010000000010000010010 -00000001000001001000000001000001 -00100000000100100100100000000100 -00000010000000010000010010000100 -01000001001000000001000001001000 -00010100000100100000000100000100 -10000001010000000010000000010000 -01001000000001000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100011000000011 -01010001100000001101010001100000 -00110101000110000000110101000110 -00000011010100011000000111000000 -01100000001101010001100000001101 -01000110000000110101000110000000 -11010100011000000001010100011000 -00000101010001100000001101010001 -10000000110101000110000000110101 -00011000000011010100000000110001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100001000000111 -01110001100000010101110001100000 -00010111000110000000110111000110 -00000000011100011000001001011100 -01100000000101110001000000010101 -11000110000000010111000110000000 -01011100011000001110011100011000 -00010101110001100000011101110001 -10000001010111000110000001110111 -00011000000001011100000000010001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000010001010100011000000011 -01110001100000001101110001100000 -01100111000110000101010111000110 -00000010011100011000000011011100 -01100000011101110001100000001101 -11000110000001100111000110000001 -11011100011000000010011100011000 -00010001110001100000010101110001 -10000000010111000110000001010111 -00011000000011011100000000000001 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000010001010100011000000101 -01110001100000010101110001100000 -01010111000110000001000011000110 -00000101011100011000000000011100 -01100001010101110001100000010100 -11000110000101010111000110000001 -01011100011000000101011100011000 -00011000110001100000011001110001 -10000001100111000110000001000011 -00011000000101011100000000000001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001000000001 -00100000100000000100100000100000 -00010010000010000000010111000010 -00000001001000001000000001001000 -00100000000100100000100000000101 -10000010000000010010000010000000 -01001000001000000001001000001000 -00000101110000100000000100110000 -10000000010010000010000000010111 -00001000000001001000000000010000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000010000000000011000000001 -01100001100000000101100001100000 -00010110000110000000010110000110 -00000001011000011000000001001000 -01100000000101100001100000000101 -10000110000001010110000110000001 -00011000011000000001011000011000 -00000101100001100000000101100001 -10000000010010000110000000010110 -00011000000001011000000000100001 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000010001010100000000000101 -01110000000000010101110000000000 -00010011000000000001010011000000 -00000101001100000000000001001100 -00000000000000110000000000010101 -11000000000000010111000000000001 -01011100000000000101011100000000 -00000101110000000000010100110000 -00000001000111000000000000010011 -00000000000101011100000000110001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000010001000100001100000000 -01100000100000000001100000110000 -00000010000010000000000010000010 -00000000001000001000000100011000 -00100000000000100000100000000001 -10000010000000000110000010000000 -00011000001000000000011000001000 -00000000000000100000000000100000 -10000000000110000010000000000010 -00001000000000011000000000000001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000010001000100001000000100 -00100000100000010000100000100000 -00000110000010000001000110001010 -00000100011000001000000100001000 -10100000000001100100100000010000 -10000010000000000010000010000001 -00001000001000000100001000001000 -00000000100000100000010000100000 -10000001000010000010000000000110 -00001000000100001000000000010001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000010001000100001100000101 -01000000100000010101000000100000 -01010101000011000001010101000011 -00000101010100001100000101010100 -00110000010101010000100000010101 -00000010000000010100000010000000 -01010000001000000101010000001000 -00000100000100110000000100000000 -10000000010100000011000001000101 -00001000000101010000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000010000001100000001 -00010000110000000101010000110000 -00010101000011000000010101001010 -00000001010100001000000001010100 -10100000000101010000100000000101 -01000011000000010101000010000000 -01010100001100000001010100001100 -00000101010000110000000101010000 -10000000010101000011000000010101 -00001000000001010100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000010000100000000000 -00010010000000000001000000000000 -00000100000000000000000100000000 -00000000011000000000000000011000 -00000000000001000010000000000001 -00001000000000000100001000000000 -00010000100000000000010000100000 -01000001000100000000000001000010 -00000001000110000000000000000100 -00100000000000010000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000010001000100001100000010 -00010000100000001000000010100000 -00100000001010000000100000000010 -00000010000000001000000110000000 -00100000001000000000100000001000 -00000010000000100000000010000000 -10000000001000000010000000001000 -00001000000110100100001000000000 -10000000100000001010000000100000 -00001000000010000000000000110001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000000001010100000000001001 -01100000000000010101100000000000 -00010110000000000000110110000000 -00000101011000000000001001011000 -00000000000101100100000010010101 -10000000000000010110000000000001 -01011000000000000101011000000000 -00011101100000000000011101100000 -00000001010110000000000010110110 -00000000001001011000000000010001 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110001010100000000000010 -01100000000000011101100000000000 -00010110000000000000010111000000 -00000000011000000000000001001000 -00000000001101100000000000000101 -10000000000000010110000000000000 -10011000000000000011011000000000 -00000101110000000000000101110000 -00000000110010000000000000010111 -00000000000011011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -00110000000000000000110000000000 -01000011000000000000000110000000 -00000100001100000000000000001000 -00000001010000110100000000000000 -11000000000000000011000000000001 -00001100000000000100001100000000 -00010001100000000000010001100000 -00000000100010000000000001000110 -00000000000100001100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000000000 -00110100000000000000110001101000 -00000011010000000001000010000100 -00000000001101000000000000001000 -00000000000000110101000000000000 -11010100000001000011010000000000 -00001101010000000000001101000000 -00000000100101001000000000100100 -00000000000010010000000000000010 -00000000000000001100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000011000000001 -00110001010000010100110001010000 -00010011000101000001010011000110 -10000001001100010000000001001000 -01000000000100110101100000000100 -11000101000000010011000100000000 -01001100010100000001001100010100 -01010100111001011000010100110001 -00000000010010000101000001010011 -00010000000001001100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010001100000101 -01101000110000000101101000110000 -01000110100011000001010100100011 -10000101011010001100000001011010 -00110000010101101101110000010101 -10100011000001010110100011000001 -01011010000100000101001010001100 -00010001101000100000010101101000 -11000001010110100011000001010110 -10001100000100011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000000000 -00100100000000000000100011000000 -00000010011000000000000010000100 -00000000001001000000000100001000 -00000000000000100100000000000000 -10010101000000000010010000000000 -00001001000000000000001001000000 -00000000100111000000000000110100 -00000000000010011000000000000010 -00000000000000001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000000100 -01100010000100000001100000000100 -01000110000000010001000110000000 -01000100011000000001000100011000 -00000100010001100010000000010001 -10001000000001000110001000010001 -00011000100000000100001000100001 -00010001100000000100010000110010 -00010001000110000000010001000110 -00100001000100011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000001000101 -01010000000100000101010000000000 -01000101000000100000000101000000 -01100101010100000001000100010100 -00000100010001010000000100010101 -01000000010101010101000000010001 -00010100000100000100010100000000 -00000101010000010000000100010000 -00010000010101000000010000000101 -00000001000101010100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000100001 -01000010000000000001000010000010 -00010101001000001000000101001000 -00100001010100100000100000010100 -10000010000101010010000000000101 -00001000000000010100001000000000 -01010000100000000001010000100010 -10000101000010000010000101010010 -00001000010100001000001000010101 -00100000100001010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000101000000001 -00000010100000000100000010100000 -01000000001010010000010000001010 -00000100000000101000000100000000 -10100000000100000010100000000100 -00001010000000010000001010000000 -01000000101000000001000000101001 -01000100000010100000000100000010 -10000000010000001010000000000000 -00101000000001000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000110010000011 -01010011000000000101010011000000 -00100001001100000000000101001100 -00000010000100110000000000000100 -11001000001000010011000000000101 -01001100000000010101001100100000 -11010100110000000011010100110001 -00001101010011000000001000010011 -00000000010101001100000000100001 -00110010000011010100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100010000101 -01110010000000010001110010000000 -01010111001000000001010111001000 -00001101011100100000001101011100 -10001000010101100010000000011001 -11001000000001000111001000001001 -01011100100000000100011100100000 -00001001110010000000011101100010 -00000001010111001000000001110111 -00100000100101011100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001100001000 -01001000110001000001000000110000 -10000100000011000000000100000011 -00001000010000001100000000010000 -00110000100001000000110000000001 -00000011000100000100100011000000 -00010000001100000000010010001100 -00000001000000110000000001001000 -11000000000100000011000100000100 -10001100001000010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -01001111111111111101001111111111 -11110100111111111111110100111111 -11111111010011111111111111010011 -11111111111101000111111111011101 -00011111111111110100111111111111 -11010011111111111111010011111111 -11111101001111111111111101001111 -11111111110100111111111111110100 -11111111111111010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111011 -00001011001101111101001111111111 -10110000101101111111110100111110 -11011011000010110011011011000010 -11011111101100000111101101011101 -00011110110111110100101101111111 -11010011111111111111010010110111 -11111101001111111111101100001011 -00110110110000101100110110110000 -10110111111011000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111100 -01001100110011111101001111111111 -11000100110011111111110100111111 -00111100010011001100111100010011 -00111111110001000111110011011101 -00011111001111110100110011111111 -11010011111111111111010011001111 -11111101001111111111110001001100 -11001111000100110011001111000100 -11001111111100010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011101100011110 -01001110110111111001001000110111 -11100100100011011110000100100011 -00011110010010001100011000010010 -00110001111001000110110001011101 -00011011011111100100111011000111 -10010011101101111110010011101101 -11100001001000110111100001001110 -11000110000100100011011110000100 -11101100011110010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000100000010 -01110000010000001001110000010000 -00100111000001000000100111000001 -00000010011100000100000010011100 -00010000001100110000010000001001 -11000001000000100111000001000001 -10011100000100010110011100000100 -00001001110000010000001001110000 -01000000100111000001000001100111 -00000100000110011100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000010000000101 -01110001000000010101110001000000 -01010111000100000001010111000100 -00000101011100010000000101011100 -01000000010100110001000000010101 -11000100000001010111000100000001 -01011100010000000101011100010000 -00010101110001000000010101110001 -00000001010111000100000001010111 -00010000000101011100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001000000001 -00100000100000000100100000100000 -00010010000010000000010010000010 -00000001001000001000000001001000 -00100000000100100000100000000100 -10000010000000010010000010000000 -01001000001000000001001000001000 -00000100100000100000000100100000 -10000000010010000010000000010010 -00001000000001001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01100000000000000001100000000000 -00000110000000000000000110000000 -00000000011000000000000000011000 -00000000000001100000000000000001 -10000000000000000110000000000000 -00011000000000010000011000000000 -00000001100000000001000001100000 -00000000000110000000000000000110 -00000000000000011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000000100 -01110010000000010001110010000000 -01000111001000000001000111001000 -00000100011100100000000100011100 -10000000010001110010000000010001 -11001000000001000111001000000000 -00011100100000000000011100100000 -00010001110010000000010001110010 -00000001000111001000000000000111 -00100000000000011100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01100000000000000001100000000000 -00000110000000000000000110000000 -00000000011000000000000000011000 -00000000000001100000000000000001 -10000000000000000110000000000000 -00011000000000000000011000000000 -00000001100000000000000001100000 -00000000000110000000000000000110 -00000000000000011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000100000000100 -00100010000000010000100010000000 -01000010001000000001000010001000 -00000100001000100000000100001000 -10000000010000100010000000010000 -10001000000001000010001000000000 -00001000100000000000001000100000 -00010000100010000000010000100010 -00000001000010001000000000000010 -00100000000000001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010101000000100 -01001010100000010001001010100000 -01000100101010000001000100101010 -00000100010010101000000100010010 -10100000010001001010100000010001 -00101010000001000100101010000001 -00010010101000000000010010101000 -00010001001010100000010001001010 -10000001000100101010000001000100 -10101000000100010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000110000000000110000000000 -01010011000000000001010011000000 -00000101001100000000000101001100 -00000000010100110000000000010100 -11000000000001010011000000000001 -01001100000000000101001100000000 -00010100110000000100010100110000 -00000001010011000000000001010011 -00000000000101001100000000000101 -00110000000000010100000000010000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000110000000000000000000000 -01000000000000000001000000000000 -00000100000000000000000100000000 -00000000010000000000000000010000 -00000001000001000000000000000001 -00000000000000000100000000000000 -00010000000000000000010000000000 -00000001000000000000000001000000 -00000000000100000000000000000100 -00000000000000010000000000110000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000110000000100000000000010 -00000000000000001000000000000000 -00100000000000000000100000000000 -00000010000000000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000110000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000110000000100000000000100 -01100000000000010001100000000000 -01000110000000000000000110000000 -00000000011000000000000100011000 -00000000010001100000000000010001 -10000000000010000110000000000000 -00011000000000000000011000000000 -00010001100000000000000001100000 -00000001000110000000000000000110 -00000000000000011000000000110000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00010000000000010100000000000010 -01100000000000001001100000000000 -00100110000000000000100110000000 -00010110011000000000000010011000 -00000000001001100000000000001001 -10000000000000100110000000000000 -10011000000000000010011000000000 -00001001100000000000001001100000 -00000000100110000000000000100110 -00000000000010011000001000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001000000100 -00110000100000010000110000100000 -01000011000010000001000011000010 -00000100001100001000000100001100 -00100000010000110000100000010000 -11000010000001000011000010000001 -00001100001000000100001100001000 -00010000110000100000010000110000 -10000001000011000010000001000011 -00001000000100001100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000000000000000000000 -00110000000000000000110000000000 -00000011000000000000000011000000 -00000000001100000000000000001100 -00000000000000110000000000000000 -11000000000000000011000000000000 -00001100000000000000001100000000 -00000000110000000000000000110000 -00000000000011000000000000000011 -00000000000000001100000000110001 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000000000001000000000 -00110000100000000000110000100000 -00000011000010000000000011000010 -00000000001100001000000000001100 -00100000000000110000100000000000 -11000010000000000011000010000000 -00001100001000000000001100001000 -00000000110000100000000000110000 -10000000000011000010000000000011 -00001000000000001100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001000000100 -01100000100000010001100000100000 -01000110000010000001000110000010 -00000000011000001000000100011000 -00100000010001100000100000010001 -10000010000001000110000010000001 -00011000001000000100011000001000 -00010001100000100000010001100000 -10000001000110000010000001000110 -00001000000100011000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100001000000000 -00100000100000000000100000100000 -00000010000010000000000010000010 -00000000001000001000000000001000 -00100000000000100000100000000000 -10000010000000000010000010000000 -00001000001000000000001000001000 -00000000100000100000000000100000 -10000000000010000010000000000010 -00001000000000001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01010000010000010100001000000100 -01100000100000010001100000100000 -01000110000010000001000110000010 -00000000011000001000000100011000 -00100000010001100000100000010001 -10000010000001000110000010000001 -00011000001000000100011000001000 -00010001100000100000010001100000 -10000001000110000010000001000110 -00001000000100011000000000010000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100000000000100 -01010000000000010001010000000000 -01000101000000000001000101000000 -00000000010100000000000100010100 -00000000010001010000000000010001 -01000000000001000101000000000001 -00010100000000000100010100000000 -00010001010000000000010001010000 -00000001000101000000000001000101 -00000000000100010100001000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01001000010000010000011000000000 -01000001100000000001000001100000 -00000100000110000000000100000110 -00000100010000011000000000010000 -01100000000001000001100000000001 -00000110000000000100000110000000 -00010000011000000000010000011000 -00000001000001100000000001000001 -10000000000100000110000000000100 -00011000000000010000000000010000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01001000000001000000001000000001 -00000000100000000100000000100000 -00010000000010000000010000000010 -00000001000000001000000001000000 -00100000000100000000100000000100 -00000010000000010000000010000000 -01000000001000000001000000001000 -00000100000000100000000100000000 -10000000010000000010000000010000 -00001000000001000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100011000000011 -01010001100000001101010001100000 -00110101000110000000110101000110 -00000011010100011000000011010100 -01100000001101010001100000001101 -01000110000000110101000110000000 -11010100011000000011010100011000 -00001101010001100000001101010001 -10000000110101000110000000110101 -00011000000011010100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000010000011000000100 -01110001100000010001110001100000 -01000111000110000001000111000110 -00000100011100011000000100011100 -01100000010001110001100000010001 -11000110000001000111000110000001 -00011100011000000100011100011000 -00010001110001100000010001110001 -10000001000111000110000001000111 -00011000000100011100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100011000000000 -01110001100000001001110001100000 -00100111000110000000100111000110 -00000010011100011000010110011100 -01100000001001110001100000001001 -11000110000000100111000110000000 -10011100011000000010011100011000 -00011001110001100000001001110001 -10000000100111000110000000100111 -00011000000010011100000000010001 -00010000000000000000000000000000 -00000000000000000000000000000000 -01010000010001010100011000000001 -01110001100000010101110001100000 -01010111000110000001010111000110 -00000101011100011000000101011100 -01100000010101110001100000010101 -11000110000001010111000110000001 -01011100011000000101011100011000 -00010101110001100000010101110001 -10000001010111000110000001010111 -00011000000101011100001000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010000001000000001 -00100000100000000100100000100000 -00010010000010000000010010000010 -00000001001000001000000001001000 -00100000000100100000100000000100 -10000010000000010010000010000000 -01001000001000000001001000001000 -00000100100000100000000100100000 -10000000010010000010000000010010 -00001000000001001000000000010001 -01000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000000000011000000000 -01100001100000000001100001100000 -00000110000110000000000110000110 -00000000011000011000000000011000 -01100000000001100001100000000001 -10000110000000000110000110000000 -00011000011000000000011000011000 -00000001100001100000000001100001 -10000000000110000110000000000110 -00011000000000011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000010001010110000000000100 -01111000000000010001111000000000 -01000111100000000001000111100000 -00000100011110000000000000011110 -00000000010001111000000000010001 -11100000000001000111100000000001 -00011110000000000100011110000000 -00000001111000000000010001111000 -00000001000111100000000001000111 -10000000000100011100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100001000000000 -01100000100000000001100000100000 -00000110000010000000000110000010 -00000000011000001000000000011000 -00100000000001100000100000000001 -10000010000000000110000010000000 -00011000001000000000011000001000 -00000001100000100000000001100000 -10000000000110000010000000000110 -00001000000000011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100001000000100 -00100000100000010000100000100000 -01000010000010000001000010000010 -00000100001000001000000000001000 -00100000010000100000100000010000 -10000010000001000010000010000001 -00001000001000000100001000001000 -00000000100000100000010000100000 -10000001000010000010000001000010 -00001000000100001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001000000100 -01000000100000010001000000100000 -01000100000010000001000100000010 -00000100010000001000000100010000 -00100001010001000000100000010001 -00000010000001000100000010000001 -00010000001000000100010000001000 -00010001000000100000010001000000 -10000001000100000010000001000100 -00001000000100010000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000000000001100000001 -00000000110000000001010000110000 -00000101000011000000000101000011 -00000000010100001100000000010100 -00110000000001010000110000000001 -01000011000000000101000011000000 -00010100001100000000010100001100 -00000001010000110000000001010000 -11000000000101000011000000000101 -00001100000000010100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000000000100000000100 -01000010000000000001000010000001 -00000100001000000000000100001000 -00000000010000100000000000010000 -10000000000001000010000000000001 -00001000000000000100001000000000 -00010000100000000000010000100000 -00000000000010000000000001000010 -00000000000100001000000000000100 -00100000000000010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001000000000 -00000000100000001000000000100000 -00100000000010000000100000000010 -00000010000000001000000010000000 -00100000001000000000100000001000 -00000010000000100000000010000000 -10000000001000000010000000001000 -00001000000000100000001000000000 -10000000100000000010000000100000 -00001000000010000000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100000000000100 -01100000000000010001100000000000 -01000110000000000001000110000000 -00000100011000000000000000011000 -00000000010001100000000000010001 -10000000000001000110000000000001 -00011000000000000100011000000000 -00100100100000000000010001100000 -00000001000110000000000001000110 -00000000000100011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100000000000010 -01100000000000001001100000000000 -00000110000000000000100110000000 -00000010011000000000000010011000 -00000000001001100000000000001001 -10000000000100100110000000000000 -10011000000000000110011000000000 -00001001100000000000001001100000 -00000000100110000000000100100110 -00000000000010011000000000000001 -00010000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010110000000000100 -00111000000000010000111000000000 -00000011100000000001000011100000 -00000100001110000000000100001110 -00000000010000111000000000010000 -11100000000000000011100000000001 -00001110000000000100001110000000 -00010000111000000000010000111000 -00000001000011100000000001000011 -10000000000100001100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01010000000000000000000100000000 -00110000010000000000110000010000 -00000011000001000000000011000001 -00000000001100000100000000001100 -00010000000000110000010000000000 -11000001000000000011000001000000 -00001100000100000000001100000100 -00000000110000010000000000110000 -01000000000011000001000000000011 -00000100000000001100000000000001 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000000000010100000000 -00110001010000000000110001010000 -00000011000101000000000011000101 -00010000001100010100000000001100 -01010000000000110001010000000000 -11000101000000000011000101000000 -00001100010100000000001100010100 -00000000110001010000000000110001 -01000000000011000101000000000011 -00010100000000001100001000010000 -01000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100001100000100 -01100000110000010001100000110000 -01000110000011000001000110000011 -00000100011000001100000100011000 -00110000010001100000110000010001 -10000011000001000110000011000001 -00011000001100000000011000001100 -00010001100000110000010001100000 -11000001000110000011000001000110 -00001100000100011000000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100000000000000 -00100000000000000000100000000000 -00000010000000000000000010000000 -00000000001000000000000000001000 -00000000000000100000000000000000 -10000000000000000010000000000000 -00001000000000000000001000000000 -00000000100000000000000000100000 -00000000000010000000000000000010 -00000000000000001000000000110000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010000100001000100 -01100010000100010001100010000100 -01000110001000010001000110001000 -01000100011000100001000100011000 -10000100010001100010000100010001 -10001000010001000110001000010001 -00011000100001000000011000100001 -00010001100010000100010001100010 -00010001000110001000010001000110 -00100001000100011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100000001000100 -01010000000100010001010000000100 -01000101000000010001000101000000 -01000100010100000001000100010100 -00000100010001010000000100010001 -01000000010001000101000000010001 -00010100000001000100010100000001 -00010100000000000100010001010000 -00010001000101000000010001000101 -00000001000100010100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000001010000100000100000 -01000010000010000001000010000010 -00000100001000001000000100001000 -00100000010000100000100000010000 -10000010000001000010000010000001 -00001000001000000100001000001000 -00010000100000100000010000100000 -10000001000010000010000001000010 -00001000000100001000001000000100 -00100000100000010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000101000000001 -00000010100000000100000010100000 -01010000001010000000010000001010 -00000001000000101000010001000000 -10100000000100000010100000000100 -00001010000000010000001010000000 -01000000101000000001000000101000 -00000100000010100000000100000010 -10000000010000001010000000010000 -00101000000001000000000000010001 -01000000000000000000000000000000 -00000000000000000000000000000000 -01000000010001010100110100000011 -01010011010000001101010011010000 -00010101001101000000110101001101 -00000011010100110100000011010100 -11010000001101010011010000001101 -01001101000000010101001101000000 -11010100110100000011010100110100 -00001101010011010000001101010011 -01000000110101001101000000110101 -00110100000011010100000000010001 -01010000000000000000000000000000 -00000000000000000000000000000000 -01000000000000010100100000000100 -01110010000000010001110010000000 -01000111001000000001000111001000 -00000000011100100000000100011100 -10000000010001110010000000010001 -11001000000001000111001000000001 -00011100100000000000011100100000 -00010001110010000000010001110010 -00000001000101001000000001000111 -00100000000100011100000000110001 -00010000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010001100011000 -01001000110001100001001000110001 -10000100100011000110000100100011 -00011000010010001100011000010010 -00110001100001001000110001100001 -00100011000110000100100011000110 -00010010001100011000010010001100 -01100001001000110001100001001000 -11000110000100100011000110000100 -10001100011000010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -01001111111111111101001111111111 -11110100111111111111110100111111 -11111111010011111111111111010011 -11111111111101001111111111111101 -00111111111111110100111111111111 -11010011111111111111010011111111 -11111101001111111111111101001111 -11111111110100111111111111110100 -11111111111111010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010110011011011 -00001011001101101100001011001101 -10110000101100110110110000101100 -11011011000010110011011011000010 -11001101101100001011001101101100 -00101100110110110000101100110110 -11000010110011011011000010110011 -01101100001011001101101100001011 -00110110110000101100110110110000 -10110011011011000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011001100111100 -01001100110011110001001100110011 -11000100110011001111000100110011 -00111100010011001100111100010011 -00110011110001001100110011110001 -00110011001111000100110011001111 -00010011001100111100010011001100 -11110001001100110011110001001100 -11001111000100110011001111000100 -11001100111100010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011101101111110 -01001110110111111001001110110111 -11100100111011011111100100111011 -01111110010011101101111110010011 -10110111111001001110110111111001 -00111011011111100100111011011111 -10010011101101111110010011101101 -11111001001110110111111001001110 -11011111100100111011011111100100 -11101101111110010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000001010000101 -00100000001000010000000100101000 -01000001000010100001000000010010 -10000010001100001010000011000101 -00101000010000000000101000011000 -00010010100001000010000010100001 -00000000001010000111000100001010 -00010100000000001000010000101100 -10100001000000000010010001000010 -00001001000100001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000100 -00010000000100010000010000000000 -01000010001010000001000000111000 -00000110000001000000000100001000 -00000000010100110010000000010100 -00011000000001010011010000000001 -11000000000000000111000100000000 -00010000000000000000010000111000 -00000001000000000010010001000000 -00000000000100000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011000010000101 -00100100100000010000100000000000 -01000011000000100001000010000000 -10000101001000000001000100001000 -00001000011000100000001000011000 -10000000100001110011001000100001 -11001010000010000111001000000010 -00010100000100101000010000100000 -00100001000000110000000001000010 -00000001000100001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000101 -00000000100100010000101100000000 -01000011000000000001000010000000 -00000100001000000001000100001111 -00000000010000110000000000010000 -10000000000001110000010000000001 -10001011000000000101001100000000 -00010100000000000000010000010000 -00000001000000000000000001000010 -00000000000100001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000000 -00010100001000001100110100001000 -00000001000010100000010011000000 -10000001000001000010000011000001 -00001000001100000000001000000000 -00010000100000110001010000100000 -00001000000010000000000000000010 -00000100110100001000000000110000 -00100000000000000000000000000000 -00000010000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000001000000001 -00000000100100000000000000000000 -00000010000000000000010001000010 -00000011000000001000000000001000 -00100000000100000000100000001000 -00000010000000100000000010000000 -00000000001000000000000000001000 -00000100100000100000000100110000 -10000000000000000000000000000000 -00001000000000000000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000001000010000001 -00100010101000000000100110001100 -00000001001000100000100010001000 -10000011000001100010000000001010 -10001000001100000010001000000100 -00001000100000010010111000100000 -00001000100010000000000000100010 -00000000111110001000000100111110 -00100000000010011000110000000010 -00100010000000001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000100000000011 -00000010000000001100110110100000 -00000001001010000000010001001000 -00000010000000100000000000001000 -10000000001000000000000000000000 -00001000000000000010001000000000 -00001010100000000000000000100000 -00001000110010000000001100011010 -00000000000010001010010000000010 -00100000000000001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000011101010000111 -00101010001000010000010010101000 -01000011001000010001000010001000 -10000101000100101010000101000000 -10101000011000000010101000010000 -01001010100001100001001010100001 -10000001101010000100000100101010 -00010100111010001000010100000010 -00100001000000001000100001000000 -00100010000100000000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000001100000000100 -00101110000000010000100010000000 -01000011001010000001000011101000 -00000101000010100000000100000001 -10000000011100000010000000010000 -11101010000001010010011000000001 -00001100100000000100001100100000 -00010100110110100000011100100110 -00000001000001111000000001000001 -00101001000100000000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000000010000100 -00000000101000010000110100000100 -01000011000000100001000010100010 -10000000001010000010000101001010 -00001000011100000000001000010000 -11010000100001100001100000100000 -01001000000010000101001000000010 -00010100100000001000011100110000 -10100001000010100000100001000010 -00000010000100001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000100000000000000000111 -00100000000000010000110000000000 -01000001010010000001000011010010 -00000110000001000000000101001000 -00000000011000110100000000011100 -01110000000001010011010000000001 -01000000000000000101000001000000 -00011100100000100100011000100000 -10000001110001000000000001110001 -00000000000100001000001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000010000010000111 -00000100101000010000100000100000 -01110000010000100001010000010000 -10000101001101000010000111001110 -00001000010100100000001000011100 -01000010100001110000000000100001 -00000001000010000111001110000010 -00011000100000001000011100010000 -00100001110011010000100001000000 -00000001000100001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001001000000001 -00001000000000000000010100000100 -01000010000000000000100010100010 -00000101000110001000000100001000 -00000000001000100100100000010000 -01000000000001000010100010000000 -00000000001000000111000001001000 -00010100100100000000011000100000 -10000001000000000000000000000011 -11000000000000000100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000001 -00100100101000000000100100000000 -01000010010010100000010011000010 -10000111001001000010000100001110 -00001000000100110100001000010000 -10000000100001000011100000100000 -00001000000010000111000001000010 -00010100000000101000010100111000 -10100001000000000000000000000010 -01000010000000001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100001000000000000011 -00100000100000000000000100100100 -00000001100010000000000011000000 -00000001001100000000000011001000 -00100000000100101000000000000000 -00100010000000000010000000000000 -00001001000000000010001100000000 -00001100001000100100000100101000 -00000000110011010010000000000001 -00001000000000001000000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001000000010000 -01000000100000000000000000000000 -00000000000000000001000000010000 -00000000000000000000000000000000 -00000000000100000000000000000000 -10010000000000000000000000000000 -00000000000000000001000000000000 -00000000100100000010000000000000 -00000000000000000000000000000000 -00000000001000001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00111100001111000011000000000000 -10000000100000000000000000000000 -00010000000000000000000000110000 -10000000000000001000000000000000 -00000000000100000010000000010000 -00110000100000000000000010000000 -00000000000000000000000000100000 -00010000001100000000000000000000 -01000000000000000000000000010000 -00000000000000000000111100001111 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000011001 -10000000000110011000000000111111 -11011001101111111101100110000000 -00011001101111111101100100000000 -00011111101100101011100011001111 -10000000000000000001100110100110 -00000000000000011000111101001011 -01101000010000000001100110000000 -00011001110000000011111111011001 -10111111110110011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000001000000000111110 -10111110101111101011111010000000 -00000000000000000010000000000000 -00010010000100101000011010000010 -00010110100000000001011010100000 -00000000000001100000010000000000 -00010000000000000000000000000000 -00000000000000000010100000010000 -00111110100101101100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010001000 -01000100100000010100000110000000 -00000000000000000000000000000000 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000110000000000000000000000 -00000000000000000000000000000000 -00000000000000001000000101111000 -01000001101100010000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111101111111111111111111111 -11000000000000000000000000000000 -00000000001111111111111111101111 -11111101110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000101101 -11111111101011101111111111000000 -00000000000000000000000000000000 -00111111101111111111111111111110 -00000000000000000000000000000000 -00000000001101111111111011111111 -01111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111101 -11111111111111111011111111000000 -00000000000000000000000000000000 -00111111101111111111111111111111 -11000000000000000000000000000000 -00000000001111111111111111111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000001111111111111111111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111100111111 -11000000000000000000000000000000 -00000000001111111111111111111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111101111111111111111000000 -00000000000000000000000000000000 -00111111111111111011111111111111 -11000000000000000000000000000000 -00000000001111111111111100111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000011000111 -00100100101000010000100000001000 -01000001000000100001000010010010 -10000100000000001010000000001000 -00101000010000010000101000011000 -10110010110001010000010010100001 -00001000001010000100000100001010 -00010000101100101000011100000100 -10110001000001000000100001000000 -00000010000100000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000001000111 -00010000100000010000110000000000 -01000011000000000001000001110000 -00000101000010000000000000001001 -00000000010000100000000000011100 -01000000000001100000100000000001 -00000000000000000111001000000000 -00010000001000000000011100101100 -00000001000010000000000001000000 -00000000000100000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001000011000111 -00101000001000010000100100101100 -01000011000010100001000010000000 -10000110000001000010000000001000 -00001000010000010000001100011100 -10000000100001010000010000100001 -00001000000010000101000000000001 -00010000100000001000011100000000 -00000001000011000000010001000000 -00001010000100000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001000000000100 -00101000000000010000010100000000 -01000011000000000001000010000000 -00000100000001000000000000001101 -00000000010000000000000000011000 -00000000000001010000010000000001 -00000010000000000110000100000001 -00010000100000000000010000010000 -00010001000010110010000001000000 -00001000000100000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000010001011000000 -00100000101000000000000100001000 -00000010000000100000000010000000 -10000000000000000010000000000101 -00001000001100100000001000000100 -00100000110000000000000000100000 -10001001000010000010000000000010 -00001100000000000100000000000000 -00110000000000010000010000000000 -00000001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000000001000000 -00000000000000000000010000100000 -00000000000010000000000001000010 -00000000000000001000000000001100 -00100000000100010000100000001000 -00000010000000000000000010000000 -01000000001000000001000000001000 -00001100010000100100000000100000 -10000000000000000010000000000001 -00001000000000000100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001101000000000 -00100110001000000000100110101100 -00000010001000100000010010001000 -10000001000001100010000000001101 -10001000001100100010001100000100 -10011000100000000000011000100000 -10001001100010000010000000100010 -00001100100010000100000000011110 -00100000000010011000000000000010 -00101010000000001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000010100000000000 -00000110100000000000000010000000 -00000010001000000000010000001000 -00000001000000100000000000000010 -10000000001000000010000000000000 -10001000000000000000011000000000 -00001000100000000000000000100000 -00000100000110000100000000001010 -00000000000010001000000000000010 -00100000000000001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000101010000111 -00101010101000010000010110001000 -01000001001010100001000010001010 -10000101000100101010000110000001 -10101000011000000010101000010000 -01101000100001010001001010100001 -01000001101010000100000000101001 -00010100000010100000011100100010 -10000001000001011010000001000001 -00101001000100000000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000010100000000111 -00110010000000010000110010000000 -01010011001000000001000001101000 -00000111000010100000000101000100 -10000000011100100010000000010000 -10101000000001100010001010000001 -10001000100000000100000000100001 -00011000110010000100011100010110 -00000001000010001000010001000010 -00100001000100000100001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000111 -00110000001000010000110100001000 -01000010000000010001000010100000 -10000111001010000010000110001000 -00001000010100010000001000010000 -01000010100001010000100000100001 -01000101000010000101000000000010 -00010100111000001000011100100000 -00100001000001100000000001000001 -00000001000100001000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000100000001000000000111 -00010100000000011100010000100000 -01100011000000000001110001000000 -00000101000111000000000101001100 -00000000010100100000000000011100 -11000010000001110011010000000001 -11001100000000000101000010000000 -00011100010100000100011100010100 -00000001110011000000010001110010 -00000001000111001100001000000100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00001000000000000000001010000100 -00001000001000010000000000001000 -01000010010000010001000010000000 -10000111000000000010000101000010 -00001000010000100000001000010100 -00010000100001110010100010100001 -01001010000010000101000000000010 -00011100000000001000010100100000 -00110001100001100000010001000010 -01000010000100000000001000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001000000000000 -00000100100000000000000100100000 -00000010000010000000000011110010 -00000011000010001000000010001001 -00100000000100100000100000001000 -01100010000001000010000000000000 -10000001001000000011000000001000 -00011000100100100000001000101000 -10000000010010010010000000000010 -00001001000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001000010000000 -00100100001000000000100000101000 -00000011000000100000000010010000 -10000011001001000010000001001100 -00001000000000111100001000000100 -10010010100001000010100000100000 -01001000000010000011000001000001 -00010100100000000100000100101000 -00100000000011000000010000000010 -01000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000100001010001000000000 -00100000000000000000101000000000 -00000010100000010000000011000000 -00000001001000000000000001001000 -00000000001000111000000000000000 -10000000000000110010000010000000 -00000000000000000000000010000001 -00000000100100000000000000110000 -00000000100010000000000000000011 -10000001000000000000000000000100 -00100000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000001000000000000 -01000000000000000000000000000000 -00000000000000000001000000010000 -00000000000000000000000000000000 -00000000000100000000000000000000 -10010000000000000000000000000000 -00000000000000000001000010000000 -00100000100100000000000000000000 -00000000000000000000000000000000 -00000000001000001000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00111100001111000011000000000000 -10100000000000000000000000000000 -00010000000000000000000000110000 -10000000000000001000000000000000 -00000000000000000010000000010000 -10110000100000000000000010000000 -00000000000000000001000000100000 -00010000101100000000000001000000 -11000000000000000000000000010000 -00000000000000000000111100001111 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000100000000111111 -11011001101111111101100110000000 -00100110010110011001100100000000 -00011111001100010111100000011101 -11011001100000000010011001000000 -00000000000010001000001111001000 -01101111100000000001100110000000 -00000000110000000011111111011001 -10111111110110011000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000101000 -00101001001010000010000001000000 -00000000000000000010000010000000 -00000100100001101000010010000110 -00000000000000000000000000100000 -10000000000000101001001000010000 -10000100000000000000000000000000 -00000000100000000010100000000000 -00101000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000010000100 -10000001000000010101000100000000 -00000000000000000000000000000000 -11000000000000000000000000000000 -00000000000000000000000000000000 -00000000100000000000000000000000 -00000000000000000000000000000000 -00000000000000001000000101111000 -01001000101100010100000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000101111 -11111011111111111110111111000000 -00000000000000000000000000000000 -00011111100111111001111111011111 -11000000000000000000000000000000 -00000000001011111111111111111111 -11110111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -01011111010011101111111111000000 -00000000000000000000000000000000 -00101111011011110110111111111101 -01000000000000000000000000000000 -00000000001111110011111101001111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000011111 -11111111101111111111111111000000 -00000000000000000000000000000000 -00101111001111111011111111111111 -11000000000000000000000000000000 -00000000001111110111111110111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000001111111111111011111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111110111111 -11000000000000000000000000000000 -00000000001111111111111111111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000011111111111111 -11111111111111111100000000000000 -00000000000000000000000000111111 -11111111111111111111111111000000 -00000000000000000000000000000000 -00111111111111111111111111111111 -11000000000000000000000000000000 -00000000001111111111111111111111 -11111111110000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000010000000000001 -00000010000000000000000000000000 -00110000000000000100001100001100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000010000000000001 -00000010000000100000000000000000 -00110000000000000100001100000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000000000000000000001 -00000000000000001010100001101000 -00110000000000001000000000000001 -00000000000000000000000000000011 -00110000000000000100000000001100 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00110000000000001000000000000001 -00000000000000000000000000000101 -00110000000000001010000000000001 -00000000000000000000000000000000 -00110000000000000000000000000001 -00000000000000001110000101011010 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 -00000000000000000000000000000000 diff --git a/zaptel/kernel/voicebus.c b/zaptel/kernel/voicebus.c deleted file mode 100644 index 80334b17..00000000 --- a/zaptel/kernel/voicebus.c +++ /dev/null @@ -1,1491 +0,0 @@ -/* - * VoiceBus(tm) Interface Library. - * - * Written by Shaun Ruffell - * and based on previous work by Mark Spencer , - * Matthew Fredrickson , and - * Michael Spiceland - * - * Copyright (C) 2007-2008 Digium, Inc. - * - * All rights reserved. - * - * VoiceBus is a registered trademark of Digium. - * - * \todo Make the client drivers back out gracefully when presented with a - * signal. - * \todo Modify clients to sleep with timeout when waiting for interrupt. - * \todo Check on a 64-bit CPU / Kernel - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "voicebus.h" - -#define assert(__x__) BUG_ON(!(__x__)) - -#define INTERRUPT 0 /* Run the deferred processing in the ISR. */ -#define TASKLET 1 /* Run in a tasklet. */ -#define TIMER 2 /* Run in a system timer. */ -#define WORKQUEUE 3 /* Run in a workqueue. */ -#ifndef VOICEBUS_DEFERRED -#define VOICEBUS_DEFERRED INTERRUPT -#endif -#if VOICEBUS_DEFERRED == WORKQUEUE -#define VOICEBUS_ALLOC_FLAGS GFP_KERNEL -#else -#define VOICEBUS_ALLOC_FLAGS GFP_ATOMIC -#endif - -#if VOICEBUS_DEFERRED == TIMER -#if HZ < 1000 -/* \todo Put an error message here. */ -#endif -#endif - -/*! The number of descriptors in both the tx and rx descriptor ring. */ -#define DRING_SIZE (1 << 5) /* Must be a power of 2 */ -#define DRING_MASK (DRING_SIZE-1) - -/* Interrupt status' reported in SR_CSR5 */ -#define TX_COMPLETE_INTERRUPT 0x00000001 -#define TX_STOPPED_INTERRUPT 0x00000002 -#define TX_UNAVAILABLE_INTERRUPT 0x00000004 -#define TX_JABBER_TIMEOUT_INTERRUPT 0x00000008 -#define TX_UNDERFLOW_INTERRUPT 0x00000020 -#define RX_COMPLETE_INTERRUPT 0x00000040 -#define RX_UNAVAILABLE_INTERRUPT 0x00000080 -#define RX_STOPPED_INTERRUPT 0x00000100 -#define RX_WATCHDOG_TIMEOUT_INTERRUPT 0x00000200 -#define TIMER_INTERRUPT 0x00000800 -#define FATAL_BUS_ERROR_INTERRUPT 0x00002000 -#define ABNORMAL_INTERRUPT_SUMMARY 0x00008000 -#define NORMAL_INTERRUPT_SUMMARY 0x00010000 - -#define SR_CSR5 0x0028 -#define NAR_CSR6 0x0030 - -#define IER_CSR7 0x0038 -#define CSR7_TCIE 0x00000001 /* tx complete */ -#define CSR7_TPSIE 0x00000002 /* tx processor stopped */ -#define CSR7_TDUIE 0x00000004 /* tx desc unavailable */ -#define CSR7_TUIE 0x00000020 /* tx underflow */ -#define CSR7_RCIE 0x00000040 /* rx complete */ -#define CSR7_RUIE 0x00000080 /* rx desc unavailable */ -#define CSR7_RSIE 0x00000100 /* rx processor stopped */ -#define CSR7_FBEIE 0x00002000 /* fatal bus error */ -#define CSR7_AIE 0x00008000 /* abnormal enable */ -#define CSR7_NIE 0x00010000 /* normal enable */ - -#define DEFAULT_INTERRUPTS ( CSR7_TCIE | CSR7_TPSIE | CSR7_TDUIE | \ - CSR7_RUIE | CSR7_RSIE | CSR7_FBEIE | \ - CSR7_AIE | CSR7_NIE) - -#define CSR9 0x0048 -#define CSR9_MDC 0x00010000 -#define CSR9_MDO 0x00020000 -#define CSR9_MMC 0x00040000 -#define CSR9_MDI 0x00080000 - -#define OWN_BIT (1 << 31) - -/* In memory structure shared by the host and the adapter. */ -struct voicebus_descriptor { - u32 des0; - u32 des1; - u32 buffer1; - u32 container; /* Unused */ -} __attribute__((packed)); - -struct voicebus_descriptor_list { - /* Pointer to an array of descriptors to give to hardware. */ - struct voicebus_descriptor* desc; - /* Read completed buffers from the head. */ - unsigned int head; - /* Write ready buffers to the tail. */ - unsigned int tail; - /* Array to save the kernel virtual address of pending buffers. */ - void * pending[DRING_SIZE]; - /* PCI Bus address of the descriptor list. */ - dma_addr_t desc_dma; - /*! either DMA_FROM_DEVICE or DMA_TO_DEVICE */ - unsigned int direction; - /*! The number of buffers currently submitted to the hardware. */ - atomic_t count; - /*! The number of bytes to pad each descriptor for cache alignment. */ - unsigned int padding; -}; - - -/*! * \brief Represents a VoiceBus interface on a Digium telephony card. - */ -struct voicebus { - /*! Name of this card. */ - const char *board_name; - /*! The system pci device for this VoiceBus interface. */ - struct pci_dev *pdev; - /*! Protects access to card registers and this structure. You should - * hold this lock before accessing most of the members of this data - * structure or the card registers. */ - spinlock_t lock; - /*! The size of the transmit and receive buffers for this card. */ - u32 framesize; - /*! The number of u32s in the host system cache line. */ - u8 cache_line_size; - /*! Pool to allocate memory for the tx and rx descriptor rings. */ - struct voicebus_descriptor_list rxd; - struct voicebus_descriptor_list txd; - /*! Level of debugging information. 0=None, 5=Insane. */ - atomic_t debuglevel; - /*! Cache of buffer objects. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - kmem_cache_t *buffer_cache; -#else - struct kmem_cache *buffer_cache; -#endif - /*! Base address of the VoiceBus interface registers in I/O space. */ - u32 iobase; - /*! The IRQ line for this VoiceBus interface. */ - unsigned int irq; -#if VOICEBUS_DEFERRED == WORKQUEUE - /*! Process buffers in the context of this workqueue. */ - struct workqueue_struct *workqueue; - /*! Work item to process tx / rx buffers. */ - struct work_struct workitem; -#elif VOICEBUS_DEFERRED == TASKLET - /*! Process buffers in the context of a tasklet. */ - struct tasklet_struct tasklet; -#elif VOICEBUS_DEFERRED == TIMER - /*! Process buffers in a timer without generating interrupts. */ - struct timer_list timer; -#endif - /*! Callback function to board specific module to process frames. */ - void (*handle_receive)(void *vbb, void *context); - void (*handle_transmit)(void *vbb, void *context); - /*! Data to pass to the receive and transmit callback. */ - void *context; - struct completion stopped_completion; - /*! Flags */ - unsigned long flags; - /* \todo see about removing this... */ - u32 sdi; - /*! Number of tx buffers to queue up before enabling interrupts. */ - unsigned int min_tx_buffer_count; -}; - -/* - * Use the following macros to lock the VoiceBus interface, and it won't - * matter if the deferred processing is running inside the interrupt handler, - * in a tasklet, or in a workqueue. - */ -#if VOICEBUS_DEFERRED == WORKQUEUE -/* - * When the deferred processing is running in a workqueue, voicebus will never - * be locked from the context of the interrupt handler, and therefore we do - * not need to lock interrupts. - */ -#define LOCKS_VOICEBUS -#define LOCKS_FROM_DEFERRED -#define VBLOCK(_vb_) spin_lock(&((_vb_)->lock)) -#define VBUNLOCK(_vb_) spin_unlock(&((_vb_)->lock)) -#define VBLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#define VBUNLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#else -#define LOCKS_VOICEBUS unsigned long _irqflags -#define LOCKS_FROM_DEFERRED -#define VBLOCK(_vb_) spin_lock_irqsave(&((_vb_)->lock), _irqflags) -#define VBUNLOCK(_vb_) spin_unlock_irqrestore(&((_vb_)->lock), _irqflags) -#define VBLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#define VBUNLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#endif - -#define VB_PRINTK(_vb, _lvl, _fmt, _args...) \ - printk(KERN_##_lvl "%s: " _fmt, (_vb)->board_name, ## _args) - -/* Bit definitions for struct voicebus.flags */ -#define TX_UNDERRUN 1 -#define RX_UNDERRUN 2 -#define IN_DEFERRED_PROCESSING 3 -#define STOP 4 - -#if VOICEBUS_DEFERRED == WORKQUEUE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -/*! \brief Make the current task real-time. */ -static void -vb_setup_deferred(void *data) -#else -static void -vb_setup_deferred(struct work_struct *work) -#endif -{ - struct sched_param param = { .sched_priority = 99 }; - sched_setscheduler(current, SCHED_FIFO, ¶m); -} -/*! \brief Schedule a work item to make the voicebus workqueue real-time. */ -static void -vb_set_workqueue_priority(struct voicebus *vb) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - DECLARE_WORK(deferred_setup, vb_setup_deferred, NULL); -#else - DECLARE_WORK(deferred_setup, vb_setup_deferred); -#endif - queue_work(vb->workqueue, &deferred_setup); - flush_workqueue(vb->workqueue); -} -#endif -#endif - -#ifdef DBG -static inline int -assert_in_vb_deferred(struct voicebus *vb) -{ - assert(test_bit(IN_DEFERRED_PROCESSING, &vb->flags)); -} - -static inline void -start_vb_deferred(struct voicebus *vb) -{ - set_bit(IN_DEFERRED_PROCESSING, &vb->flags); -} - -static inline void -stop_vb_deferred(struct voicebus *vb) -{ - clear_bit(IN_DEFERRED_PROCESSING, &vb->flags); -} -#else -#define assert_in_vb_deferred(_x_) do {;} while(0) -#define start_vb_deferred(_x_) do {;} while(0) -#define stop_vb_deferred(_x_) do {;} while(0) -#endif - -static inline struct voicebus_descriptor * -vb_descriptor(struct voicebus_descriptor_list *dl, int index) -{ - struct voicebus_descriptor *d; - d = (struct voicebus_descriptor *)((u8*)dl->desc + - ((sizeof(*d) + dl->padding) * index)); - return d; -} - -static int -vb_initialize_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl, - u32 des1, unsigned int direction) -{ - int i; - struct voicebus_descriptor *d; - const u32 END_OF_RING = 0x02000000; - - assert(dl); - - /* - * Add some padding to each descriptor to ensure that they are - * aligned on host system cache-line boundaries, but only for the - * cache-line sizes that we support. - * - */ - if ((0x08 == vb->cache_line_size) || (0x10 == vb->cache_line_size) || - (0x20 == vb->cache_line_size)) - { - dl->padding = (vb->cache_line_size*sizeof(u32)) - sizeof(*d); - } else { - dl->padding = 0; - } - - dl->desc = pci_alloc_consistent(vb->pdev, - (sizeof(*d) + dl->padding) * DRING_SIZE, &dl->desc_dma); - if (!dl->desc) { - return -ENOMEM; - } - - memset(dl->desc, 0, (sizeof(*d) + dl->padding) * DRING_SIZE); - for ( i = 0; i < DRING_SIZE; ++i) { - d = vb_descriptor(dl, i); - d->des1 = des1; - } - d->des1 |= cpu_to_le32(END_OF_RING); - dl->direction = direction; - atomic_set(&dl->count, 0); - return 0; -} - -static int -vb_initialize_tx_descriptors(struct voicebus *vb) -{ - return vb_initialize_descriptors( - vb, &vb->txd, 0xe4800000 | vb->framesize, DMA_TO_DEVICE); -} - -static int -vb_initialize_rx_descriptors(struct voicebus *vb) -{ - return vb_initialize_descriptors( - vb, &vb->rxd, vb->framesize, DMA_FROM_DEVICE); -} - -/*! \brief Use to set the minimum number of buffers queued to the hardware - * before enabling interrupts. - */ -int -voicebus_set_minlatency(struct voicebus *vb, unsigned int ms) -{ - LOCKS_VOICEBUS; - /* - * One millisecond of latency means that we have 3 buffers pending, - * since two are always going to be waiting in the TX fifo on the - * interface chip. - * - */ -#define MESSAGE "%d ms is an invalid value for minumum latency. Setting to %d ms.\n" - if ( DRING_SIZE < ms ) { - VB_PRINTK(vb, WARNING, MESSAGE, ms, DRING_SIZE); - return -EINVAL; - } else if (VOICEBUS_DEFAULT_LATENCY > ms ) { - VB_PRINTK(vb, WARNING, MESSAGE, ms, VOICEBUS_DEFAULT_LATENCY); - return -EINVAL; - } - VBLOCK(vb); - vb->min_tx_buffer_count = ms; - VBUNLOCK(vb); - return 0; -} - -/*! \brief Returns the number of buffers currently on the transmit queue. */ -int -voicebus_current_latency(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - int latency; - VBLOCK(vb); - latency = vb->min_tx_buffer_count; - VBUNLOCK(vb); - return latency; -} - -/*! - * \brief Read one of the hardware control registers without acquiring locks. - */ -static inline u32 -__vb_getctl(struct voicebus *vb, u32 addr) -{ - return le32_to_cpu(inl(vb->iobase + addr)); -} - -/*! - * \brief Read one of the hardware control registers with locks held. - */ -static inline u32 -vb_getctl(struct voicebus *vb, u32 addr) -{ - LOCKS_VOICEBUS; - u32 val; - VBLOCK(vb); - val = __vb_getctl(vb, addr); - VBUNLOCK(vb); - return val; -} - -/*! - * \brief Returns whether or not the interface is running. - * - * NOTE: Running in this case means whether or not the hardware reports the - * transmit processor in any state but stopped. - * - * \return 1 of the process is stopped, 0 if running. - */ -static int -vb_is_stopped(struct voicebus *vb) -{ - u32 reg; - reg = vb_getctl(vb, SR_CSR5); - reg = (reg >> 17)&0x38; - return (0 == reg) ? 1 : 0; -} - -static void -vb_cleanup_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl) -{ - unsigned int i; - struct voicebus_descriptor *d; - - assert(vb_is_stopped(vb)); - - for (i=0; i < DRING_SIZE; ++i) { - d = vb_descriptor(dl, i); - if (d->buffer1) { - d->buffer1 = 0; - assert(dl->pending[i]); - voicebus_free(vb, dl->pending[i]); - dl->pending[i] = NULL; - } - d->des0 &= ~OWN_BIT; - } - dl->head = 0; - dl->tail = 0; - atomic_set(&dl->count, 0); -} - -static void -vb_free_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl) -{ - if (NULL == dl->desc) { - WARN_ON(1); - return; - } - vb_cleanup_descriptors(vb, dl); - pci_free_consistent( - vb->pdev, - (sizeof(struct voicebus_descriptor)+dl->padding)*DRING_SIZE, - dl->desc, dl->desc_dma); -} - -/*! - * \brief Write one of the hardware control registers without acquiring locks. - */ -static inline void -__vb_setctl(struct voicebus *vb, u32 addr, u32 val) -{ - wmb(); - outl(cpu_to_le32(val), vb->iobase + addr); -} - -/*! - * \brief Write one of the hardware control registers with locks held. - */ -static inline void -vb_setctl(struct voicebus *vb, u32 addr, u32 val) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_setctl(vb, addr, val); - VBUNLOCK(vb); -} - -static int -__vb_sdi_clk(struct voicebus* vb) -{ - unsigned int ret; - vb->sdi &= ~CSR9_MDC; - __vb_setctl(vb, 0x0048, vb->sdi); - ret = __vb_getctl(vb, 0x0048); - vb->sdi |= CSR9_MDC; - __vb_setctl(vb, 0x0048, vb->sdi); - return (ret & CSR9_MDI) ? 1: 0; -} - -static void -__vb_sdi_sendbits(struct voicebus *vb, u32 bits, int count) -{ - vb->sdi &= ~CSR9_MMC; - __vb_setctl(vb, 0x0048, vb->sdi); - while(count--) { - if (bits & (1 << count)) { - vb->sdi |= CSR9_MDO; - } else { - vb->sdi &= ~CSR9_MDO; - } - __vb_sdi_clk(vb); - } -} - -#if 0 /* this function might be useful in the future for debugging. */ -static unsigned int -__vb_sdi_recvbits(struct voicebus *vb, int count) -{ - unsigned int bits=0; - vb->sdi |= CSR9_MMC; - __vb_setctl(vb, 0x0048, vb->sdi); - while(count--) { - bits <<= 1; - if (__vb_sdi_clk(vb)) - bits |= 1; - else - bits &= ~1; - } - return bits; -} -#endif - -static void -vb_setsdi(struct voicebus *vb, int addr, u16 val) -{ - LOCKS_VOICEBUS; - u32 bits; - /* Send preamble */ - bits = 0xffffffff; - VBLOCK(vb); - __vb_sdi_sendbits(vb, bits, 32); - bits = (0x5 << 12) | (1 << 7) | (addr << 2) | 0x2; - __vb_sdi_sendbits(vb, bits, 16); - __vb_sdi_sendbits(vb, val, 16); - VBUNLOCK(vb); -} - -static void -vb_enable_io_access(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - assert(vb->pdev); - VBLOCK(vb); - pci_read_config_dword(vb->pdev, 0x0004, ®); - reg |= 0x00000007; - pci_write_config_dword(vb->pdev, 0x0004, reg); - VBUNLOCK(vb); -} - -/*! \todo Insert comments... - * context: !in_interrupt() - */ -void* -voicebus_alloc(struct voicebus *vb) -{ - void *vbb; - vbb = kmem_cache_alloc(vb->buffer_cache, VOICEBUS_ALLOC_FLAGS); - return vbb; -} - -void -voicebus_setdebuglevel(struct voicebus *vb, u32 level) -{ - atomic_set(&vb->debuglevel, level); -} - -int -voicebus_getdebuglevel(struct voicebus *vb) -{ - return atomic_read(&vb->debuglevel); -} - -/*! \brief Resets the voicebus hardware interface. */ -static int -vb_reset_interface(struct voicebus *vb) -{ - unsigned long timeout; - u32 reg; - u32 pci_access; - const u32 DEFAULT_PCI_ACCESS = 0xfff80002; - BUG_ON(in_interrupt()); - - switch (vb->cache_line_size) { - case 0x08: - pci_access = DEFAULT_PCI_ACCESS | (0x1 << 14); - break; - case 0x10: - pci_access = DEFAULT_PCI_ACCESS | (0x2 << 14); - break; - case 0x20: - pci_access = DEFAULT_PCI_ACCESS | (0x3 << 14); - break; - default: - VB_PRINTK(vb, WARNING, "Host system set a cache size "\ - "of %d which is not supported. " \ - "Disabling memory write line and memory read line.", - vb->cache_line_size); - pci_access = 0xfe584202; - break; - } - - /* The transmit and receive descriptors will have the same padding. */ - pci_access |= ((vb->txd.padding / sizeof(u32)) << 2) & 0x7c; - - vb_setctl(vb, 0x0000, pci_access | 1); - - timeout = jiffies + HZ/10; /* 100ms interval */ - do { - reg = vb_getctl(vb, 0x0000); - } while ((reg & 0x00000001) && time_before(jiffies, timeout)); - - if (reg & 0x00000001) { - VB_PRINTK(vb, ERR, "Hardware did not come out of reset "\ - "within 100ms!"); - return -EIO; - } - - vb_setctl(vb, 0x0000, pci_access); - - vb_cleanup_descriptors(vb, &vb->txd); - vb_cleanup_descriptors(vb, &vb->rxd); - - /* Pass bad packets, runt packets, disable SQE function, - * store-and-forward */ - vb_setctl(vb, 0x0030, 0x00280048); - /* ...disable jabber and the receive watchdog. */ - vb_setctl(vb, 0x0078, 0x00000013); - - /* Tell the card where the descriptors are in host memory. */ - vb_setctl(vb, 0x0020, (u32)vb->txd.desc_dma); - vb_setctl(vb, 0x0018, (u32)vb->rxd.desc_dma); - - reg = vb_getctl(vb, 0x00fc); - vb_setctl(vb, 0x00fc, (reg & ~0x7) | 0x7); - vb_setsdi(vb, 0x00, 0x0100); - vb_setsdi(vb, 0x16, 0x2100); - - reg = vb_getctl(vb, 0x00fc); - - vb_setctl(vb, 0x00fc, (reg & ~0x7) | 0x4); - vb_setsdi(vb, 0x00, 0x0100); - vb_setsdi(vb, 0x16, 0x2100); - reg = vb_getctl(vb, 0x00fc); - - - /* - * The calls to setsdi above toggle the reset line of the CPLD. Wait - * here to give the CPLD time to stabilize after reset. - */ - mdelay(1); - - return ((reg&0x7) == 0x4) ? 0 : -EIO; -} - -#define OWNED(_d_) (((_d_)->des0)&OWN_BIT) -#define SET_OWNED(_d_) do { wmb(); (_d_)->des0 |= OWN_BIT; wmb();} while (0) - -#ifdef DBG -static void -dump_descriptor(struct voicebus *vb, volatile struct voicebus_descriptor *d) -{ - VB_PRINTK(vb, DEBUG, "Displaying descriptor at address %08x\n", (unsigned int)d); - VB_PRINTK(vb, DEBUG, " des0: %08x\n", d->des0); - VB_PRINTK(vb, DEBUG, " des1: %08x\n", d->des1); - VB_PRINTK(vb, DEBUG, " buffer1: %08x\n", d->buffer1); - VB_PRINTK(vb, DEBUG, " container: %08x\n", d->container); -} - -static void -show_buffer(struct voicebus *vb, void *vbb) -{ - int x; - unsigned char *c; - c = vbb; - printk("Packet %d\n", count); - for (x = 1; x <= vb->framesize; ++x) { - printk("%02x ", c[x]); - if (x % 16 == 0) { - printk("\n"); - } - } - printk("\n\n"); -} -#endif - -static inline int -vb_submit(struct voicebus *vb, struct voicebus_descriptor_list *dl, void *vbb) -{ - volatile struct voicebus_descriptor *d; - unsigned int tail = dl->tail; - assert_in_vb_deferred(vb); - - d = vb_descriptor(dl, tail); - - if (unlikely(d->buffer1)) { - /* Do not overwrite a buffer that is still in progress. */ - WARN_ON(1); - voicebus_free(vb, vbb); - return -EBUSY; - } - - dl->pending[tail] = vbb; - dl->tail = (++tail) & DRING_MASK; - d->buffer1 = dma_map_single( - &vb->pdev->dev, vbb, vb->framesize, dl->direction); - SET_OWNED(d); /* That's it until the hardware is done with it. */ - atomic_inc(&dl->count); - return 0; -} - -static inline void* -vb_retrieve(struct voicebus *vb, struct voicebus_descriptor_list *dl) -{ - volatile struct voicebus_descriptor *d; - void *vbb; - unsigned int head = dl->head; - assert_in_vb_deferred(vb); - d = vb_descriptor(dl, head); - if (!OWNED(d)) { - dma_unmap_single(&vb->pdev->dev, d->buffer1, - vb->framesize, dl->direction); - vbb = dl->pending[head]; - dl->head = (++head) & DRING_MASK; - d->buffer1 = 0; - atomic_dec(&dl->count); - return vbb; - } else { - return NULL; - } -} - -/*! - * \brief Give a frame to the hardware to transmit. - * - */ -int -voicebus_transmit(struct voicebus *vb, void *vbb) -{ - return vb_submit(vb, &vb->txd, vbb); -} - -/*! - * \brief Give a frame to the hardware to use for receiving. - * - */ -static inline int -vb_submit_rxb(struct voicebus *vb, void *vbb) -{ - return vb_submit(vb, &vb->rxd, vbb); -} - -/*! - * \brief Remove the next completed transmit buffer (txb) from the tx - * descriptor ring. - * - * NOTE: This function doesn't need any locking because only one instance is - * ever running on the deferred processing routine and it only looks at - * the head pointer. The deferred routine should only ever be running - * on one processor at a time (no multithreaded workqueues allowed!) - * - * Context: Must be called from the voicebus deferred workqueue. - * - * \return Pointer to buffer, or NULL if not available. - */ -static inline void * -vb_get_completed_txb(struct voicebus *vb) -{ - return vb_retrieve(vb, &vb->txd); -} - -static inline void * -vb_get_completed_rxb(struct voicebus *vb) -{ - return vb_retrieve(vb, &vb->rxd); -} - -/*! - * \brief Free a buffer for reuse. - * - */ -void -voicebus_free(struct voicebus *vb, void *vbb) -{ - kmem_cache_free(vb->buffer_cache, vbb); -} - -/*! - * \brief Instruct the hardware to check for a new tx descriptor. - */ -inline static void -__vb_tx_demand_poll(struct voicebus *vb) -{ - __vb_setctl(vb, 0x0008, 0x00000000); -} - -/*! - * \brief Command the hardware to check if it owns the next transmit - * descriptor. - */ -static void -vb_tx_demand_poll(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_tx_demand_poll(vb); - VBUNLOCK(vb); -} - -/*! - * \brief Command the hardware to check if it owns the next receive - * descriptor. - */ -inline static void -__vb_rx_demand_poll(struct voicebus *vb) -{ - __vb_setctl(vb, 0x0010, 0x00000000); -} - -static void -vb_rx_demand_poll(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_rx_demand_poll(vb); - VBUNLOCK(vb); -} - -static void -__vb_enable_interrupts(struct voicebus *vb) -{ - __vb_setctl(vb, IER_CSR7, DEFAULT_INTERRUPTS); -} - -static void -__vb_disable_interrupts(struct voicebus *vb) -{ - __vb_setctl(vb, IER_CSR7, 0); -} - -static void -vb_disable_interrupts(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_disable_interrupts(vb); - VBUNLOCK(vb); -} - -/*! - * \brief Starts the VoiceBus interface. - * - * When the VoiceBus interface is started, it is actively transferring - * frames to and from the backend of the card. This means the card will - * generate interrupts. - * - * This function should only be called from process context, with interrupts - * enabled, since it can sleep while running the self checks. - * - * \return zero on success. -EBUSY if device is already running. - */ -int -voicebus_start(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - int i; - void *vbb; - int ret; - - assert(!in_interrupt()); - - if (!vb_is_stopped(vb)) { - return -EBUSY; - } - - if ((ret=vb_reset_interface(vb))) { - return ret; - } - - /* We must set up a minimum of three buffers to start with, since two - * are immediately read into the TX FIFO, and the descriptor of the - * third is read as soon as the first buffer is done. - */ - - /* - * NOTE: The very first buffer after coming out of reset is used to - * prime the pump and is lost. So we do not want the client driver to - * prepare it, since it will never see the corresponding receive - * buffer. - * NOTE: handle_transmit is normally only called in the context of the - * deferred processing thread. Since the deferred processing thread - * is known to not be running at this point, it is safe to call the - * handle transmit as if it were. - */ - start_vb_deferred(vb); - /* Ensure that all the rx slots are ready for a buffer. */ - for ( i = 0; i < DRING_SIZE; ++i) { - vbb = voicebus_alloc(vb); - if (unlikely(NULL == vbb)) { - BUG_ON(1); - /* \todo I need to make sure the driver can recover - * from this condition. .... */ - } else { - vb_submit_rxb(vb, vbb); - } - } - - for ( i=0; i < vb->min_tx_buffer_count; ++i) { - vbb = voicebus_alloc(vb); - if (unlikely(NULL == vbb)) { - BUG_ON(1); - } else { - vb->handle_transmit(vbb, vb->context); - } - } - stop_vb_deferred(vb); - - VBLOCK(vb); - clear_bit(STOP, &vb->flags); -#if VOICEBUS_DEFERRED == TIMER - vb->timer.expires = jiffies + HZ/1000; - add_timer(&vb->timer); -#else - /* Clear the interrupt status register. */ - __vb_setctl(vb, SR_CSR5, 0xffffffff); - __vb_enable_interrupts(vb); -#endif - /* Start the transmit and receive processors. */ - reg = __vb_getctl(vb, 0x0030); - __vb_setctl(vb, 0x0030, reg|0x00002002); - /* Tell the interface to poll the tx and rx descriptors. */ - __vb_rx_demand_poll(vb); - __vb_tx_demand_poll(vb); - VBUNLOCK(vb); - - assert(!vb_is_stopped(vb)); - - return 0; -} - -static void -vb_clear_start_transmit_bit(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - VBLOCK(vb); - reg = __vb_getctl(vb, NAR_CSR6); - reg &= ~0x00002000; - __vb_setctl(vb, NAR_CSR6, reg); - VBUNLOCK(vb); -} - -static void -vb_clear_start_receive_bit(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - VBLOCK(vb); - reg = __vb_getctl(vb, NAR_CSR6); - reg &= ~0x00000002; - __vb_setctl(vb, NAR_CSR6, reg); - VBUNLOCK(vb); -} - -unsigned long -vb_wait_for_completion_timeout(struct completion *x, unsigned long timeout) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) - /* There is a race condition here. If x->done is reset to 0 - * before the call to wait_for_completion after this thread wakes. - */ - timeout = wait_event_timeout(x->wait, x->done, timeout); - if (timeout) { - wait_for_completion(x); - } - return timeout; -#else - return wait_for_completion_timeout(x, timeout); -#endif -} - -/*! - * \brief Stops the VoiceBus interface. - * - * Stops the VoiceBus interface and waits for any outstanding DMA transactions - * to complete. When this functions returns the VoiceBus interface tx and rx - * states will both be suspended. - * - * Only call this function from process context, with interrupt enabled, - * without any locks held since it sleeps. - * - * \return zero on success, -1 on error. - */ -int -voicebus_stop(struct voicebus *vb) -{ - assert(!in_interrupt()); - if (vb_is_stopped(vb)) { - return 0; - } - INIT_COMPLETION(vb->stopped_completion); - set_bit(STOP, &vb->flags); - vb_clear_start_transmit_bit(vb); - if (vb_wait_for_completion_timeout(&vb->stopped_completion, HZ)) { -#if VOICEBUS_DEFERRED == TIMER - del_timer_sync(&vb->timer); -#else - vb_disable_interrupts(vb); -#endif - assert(vb_is_stopped(vb)); - clear_bit(STOP, &vb->flags); - } - else { - VB_PRINTK(vb, WARNING, "Timeout while waiting for board to "\ - "stop.\n"); - } - return 0; -} - -/*! - * \brief Prepare the interface for module unload. - * - * Stop the interface and free all the resources allocated by the driver. The - * caller should have returned all VoiceBus buffers to the VoiceBus layer - * before calling this function. - * - * context: !in_interrupt() - */ -void -voicebus_release(struct voicebus *vb) -{ - assert(!in_interrupt()); - - /* quiesce the hardware */ - voicebus_stop(vb); -#if VOICEBUS_DEFERRED == WORKQUEUE - destroy_workqueue(vb->workqueue); -#elif VOICEBUS_DEFERRED == TASKLET - tasklet_kill(&vb->tasklet); -#endif - vb_reset_interface(vb); -#if VOICEBUS_DEFERRED != TIMER - free_irq(vb->pdev->irq, vb); -#endif - - /* Cleanup memory and software resources. */ - vb_free_descriptors(vb, &vb->txd); - vb_free_descriptors(vb, &vb->rxd); - kmem_cache_destroy(vb->buffer_cache); - release_region(vb->iobase, 0xff); - pci_disable_device(vb->pdev); - kfree(vb); -} - -void -__vb_increase_latency(struct voicebus *vb) -{ - static int __warn_once = 1; - void *vbb; - int latency; - - assert_in_vb_deferred(vb); - - latency = atomic_read(&vb->txd.count); - if (DRING_SIZE == latency) { - if (__warn_once) { - /* We must subtract two from this number since there - * are always two buffers in the TX FIFO. - */ - VB_PRINTK(vb,ERR, - "ERROR: Unable to service card within %d ms "\ - "and unable to further increase latency.\n", - DRING_SIZE-2); - __warn_once = 0; - } - } else { - /* Because there are 2 buffers in the transmit FIFO on the - * hardware, setting 3 ms of latency means that the host needs - * to be able to service the cards within 1ms. This is because - * the interface will load up 2 buffers into the TX FIFO then - * attempt to read the 3rd descriptor. If the OWN bit isn't - * set, then the hardware will set the TX descriptor not - * available interrupt. - */ - VB_PRINTK(vb, INFO, "Missed interrupt. " \ - "Increasing latency to %d ms in order to compensate.\n", - latency+1); - /* Set the minimum latency in case we're restarted...we don't - * want to wait for the buffer to grow to this depth again in - * that case. - */ - voicebus_set_minlatency(vb, latency+1); - vbb = voicebus_alloc(vb); - if (unlikely(NULL == vbb)) { - BUG_ON(1); - } else { - vb->handle_transmit(vbb, vb->context); - } - } -} - -/*! - * \brief Actually process the completed transmit and receive buffers. - * - * NOTE: This function may be called either from a tasklet, workqueue, or - * directly in the interrupt service routine depending on - * VOICEBUS_DEFERRED. - */ -static inline void -vb_deferred(struct voicebus *vb) -{ - void *vbb; -#ifdef DBG - static int count = 0; -#endif - int stopping = test_bit(STOP, &vb->flags); - int underrun = test_bit(TX_UNDERRUN, &vb->flags); - - - start_vb_deferred(vb); - if (unlikely(stopping)) { - while((vbb = vb_get_completed_txb(vb))) { - voicebus_free(vb, vbb); - } - while((vbb = vb_get_completed_rxb(vb))) { - voicebus_free(vb, vbb); - } - stop_vb_deferred(vb); - return; - } - - if (unlikely(underrun)) { - /* When we've underrun our FIFO, for some reason we're not - * able to keep enough transmit descriptors pending. This can - * happen if either interrupts or this deferred processing - * function is not run soon enough (within 1ms when using the - * default 3 transmit buffers to start). In this case, we'll - * insert an additional transmit buffer onto the descriptor - * list which decreases the sensitivity to latency, but also - * adds more delay to the TDM and SPI data. - */ - __vb_increase_latency(vb); - } - - /* Always handle the transmit buffers first. */ - while ((vbb = vb_get_completed_txb(vb))) { - vb->handle_transmit(vbb, vb->context); - } - - if (unlikely(underrun)) { - vb_rx_demand_poll(vb); - vb_tx_demand_poll(vb); - clear_bit(TX_UNDERRUN, &vb->flags); - } - - while ((vbb = vb_get_completed_rxb(vb))) { - vb->handle_receive(vbb, vb->context); - vb_submit_rxb(vb, vbb); - } - - stop_vb_deferred(vb); -} - - -/*! - * \brief Interrupt handler for VoiceBus interface. - * - * NOTE: This handler is optimized for the case where only a single interrupt - * condition will be generated at a time. - * - * ALSO NOTE: Only access the interrupt status register from this function - * since it doesn't employ any locking on the voicebus interface. - */ -static irqreturn_t -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -vb_isr(int irq, void *dev_id, struct pt_regs *regs) -#else -vb_isr(int irq, void *dev_id) -#endif -{ - struct voicebus *vb = dev_id; - u32 int_status; - - int_status = __vb_getctl(vb, SR_CSR5); - /* Mask out the reserved bits. */ - int_status &= ~(0xfc004010); - int_status &= 0x7fff; - - if (!int_status) { - return IRQ_NONE; - } - - if (likely(int_status & TX_COMPLETE_INTERRUPT)) { - /* ******************************************************** */ - /* NORMAL INTERRUPT CASE */ - /* ******************************************************** */ -# if VOICEBUS_DEFERRED == WORKQUEUE - queue_work(vb->workqueue, &vb->workitem); -# elif VOICEBUS_DEFERRED == TASKLET - tasklet_schedule(&vb->tasklet); -# else - vb_deferred(vb); -# endif - __vb_setctl(vb, SR_CSR5, TX_COMPLETE_INTERRUPT); - } else { - /* ******************************************************** */ - /* ABNORMAL / ERROR CONDITIONS */ - /* ******************************************************** */ - if ((int_status & TX_UNAVAILABLE_INTERRUPT) ) { - /* This can happen if the host fails to service the - * interrupt within the required time interval (1ms - * for each buffer on the queue). Increasing the - * depth of the tx queue (up to a maximum of - * DRING_SIZE) can make the driver / system more - * tolerant of interrupt latency under periods of - * heavy system load, but also increases the general - * latency that the driver adds to the voice - * conversations. - */ - set_bit(TX_UNDERRUN, &vb->flags); -# if VOICEBUS_DEFERRED == WORKQUEUE - queue_work(vb->workqueue, &vb->workitem); -# elif VOICEBUS_DEFERRED == TASKLET - tasklet_schedule(&vb->tasklet); -# else - vb_deferred(vb); -# endif - } - - if (int_status & FATAL_BUS_ERROR_INTERRUPT) { - VB_PRINTK(vb, ERR, "Fatal Bus Error detected!\n"); - } - - if (int_status & TX_STOPPED_INTERRUPT) { - assert(test_bit(STOP, &vb->flags)); - vb_clear_start_receive_bit(vb); - __vb_setctl(vb, SR_CSR5, DEFAULT_INTERRUPTS); - __vb_disable_interrupts(vb); - complete(&vb->stopped_completion); - } - if (int_status & RX_STOPPED_INTERRUPT) { - assert(test_bit(STOP, &vb->flags)); - if (vb_is_stopped(vb)) { - complete(&vb->stopped_completion); - } - } - - /* Clear the interrupt(s) */ - __vb_setctl(vb, SR_CSR5, int_status); - } - - return IRQ_HANDLED; -} - -#if VOICEBUS_DEFERRED == TIMER -/*! \brief Called if the deferred processing is to happen in the context of - * the timer. - */ -static void -vb_timer(unsigned long data) -{ - unsigned long start = jiffies; - struct voicebus *vb = (struct voicebus *)data; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - vb_isr(0, vb, 0); -#else - vb_isr(0, vb); -#endif - if (!vb_is_stopped(vb)) { - vb->timer.expires = start + HZ/1000; - add_timer(&vb->timer); - } -} -#endif - -#if VOICEBUS_DEFERRED == WORKQUEUE -static void -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -vb_workfunc(void *data) -{ - struct voicebus *vb = data; -#else -vb_workfunc(struct work_struct *work) -{ - struct voicebus *vb = container_of(work, struct voicebus, workitem); -#endif - vb_deferred(vb); -} -#elif VOICEBUS_DEFERRED == TASKLET -static void -vb_tasklet(unsigned long data) -{ - struct voicebus *vb = (struct voicebus*)data; - vb_deferred(vb); -} -#endif /* #if VOICEBUS_DEFERRED == WORKQUEUE */ - -/*! - * \brief Initalize the voicebus interface. - * - * This function must be called in process context since it may sleep. - * \todo Complete this description. - */ -int -voicebus_init(struct pci_dev *pdev, u32 framesize, - const char *board_name, - void (*handle_receive)(void *vbb, void *context), - void (*handle_transmit)(void *vbb, void *context), - void *context, - struct voicebus **vbp - ) -{ - int retval = 0; - struct voicebus *vb; - - assert(NULL != pdev); - assert(NULL != board_name); - assert(framesize); - assert(NULL != handle_receive); - assert(NULL != handle_transmit); - - /* ---------------------------------------------------------------- - Initialize the pure software constructs. - ---------------------------------------------------------------- */ - *vbp = NULL; - vb = kmalloc(sizeof(*vb), GFP_KERNEL); - if (NULL == vb) { - VB_PRINTK(vb, DEBUG, "Failed to allocate memory for voicebus "\ - "interface.\n"); - retval = -ENOMEM; - goto cleanup; - } - memset(vb,0,sizeof(*vb)); - /* \todo make sure there is a note that the caller needs to make sure - * board_name stays in memory until voicebus_release is called. - */ - vb->board_name = board_name; - spin_lock_init(&vb->lock); - init_completion(&vb->stopped_completion); - vb->pdev = pdev; - set_bit(STOP, &vb->flags); - clear_bit(IN_DEFERRED_PROCESSING, &vb->flags); - vb->framesize = framesize; - vb->min_tx_buffer_count = VOICEBUS_DEFAULT_LATENCY; - -#if VOICEBUS_DEFERRED == WORKQUEUE - /* NOTE: This workqueue must be single threaded because locking is not - * used when buffers are removed or added to the descriptor list, and - * there should only be one producer / consumer (the hardware or the - * deferred processing function). */ - vb->workqueue = create_singlethread_workqueue(board_name); -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&vb->workitem, vb_workfunc, vb); -# else - INIT_WORK(&vb->workitem, vb_workfunc); -# endif -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - vb_set_workqueue_priority(vb); -# endif -#elif VOICEBUS_DEFERRED == TASKLET - tasklet_init(&vb->tasklet, vb_tasklet, (unsigned long)vb); -#elif VOICEBUS_DEFERRED == TIMER - init_timer(&vb->timer); - vb->timer.function = vb_timer; - vb->timer.data = (unsigned long)vb; -#endif - - vb->handle_receive = handle_receive; - vb->handle_transmit = handle_transmit; - vb->context = context; - - /* \todo This cache should be shared by all instances supported by - * this driver. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - vb->buffer_cache = kmem_cache_create(board_name, vb->framesize, 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); -#else - vb->buffer_cache = kmem_cache_create(board_name, vb->framesize, 0, - SLAB_HWCACHE_ALIGN, NULL); -#endif - if (NULL == vb->buffer_cache) { - VB_PRINTK(vb, ERR, "Failed to allocate buffer cache.\n"); - goto cleanup; - } - - - /* ---------------------------------------------------------------- - Configure the hardware / kernel module interfaces. - ---------------------------------------------------------------- */ - if (pci_read_config_byte(vb->pdev, 0x0c, &vb->cache_line_size)) { - VB_PRINTK(vb, ERR, "Failed read of cache line " \ - "size from PCI configuration space.\n"); - goto cleanup; - } - - if (pci_enable_device(pdev)) { - VB_PRINTK(vb, ERR, "Failed call to pci_enable_device.\n"); - retval = -EIO; - goto cleanup; - } - - /* \todo This driver should be modified to use the memory mapped I/O - as opposed to IO space for portability and performance. */ - if (0 == (pci_resource_flags(pdev, 0)&IORESOURCE_IO)) { - VB_PRINTK(vb, ERR, "BAR0 is not IO Memory.\n"); - retval = -EIO; - goto cleanup; - } - vb->iobase = pci_resource_start(pdev, 0); - if(NULL == request_region(vb->iobase, 0xff, board_name)) { - VB_PRINTK(vb, ERR, "IO Registers are in use by another " \ - "module.\n"); - retval = -EIO; - goto cleanup; - } - - if ((retval = vb_initialize_tx_descriptors(vb))) { - goto cleanup; - } - if ((retval = vb_initialize_rx_descriptors(vb))) { - goto cleanup; - } - - /* ---------------------------------------------------------------- - Configure the hardware interface. - ---------------------------------------------------------------- */ - pci_set_master(pdev); - vb_enable_io_access(vb); - -#if VOICEBUS_DEFERRED != TIMER -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -# define VB_IRQ_SHARED SA_SHIRQ -#else -# define VB_IRQ_SHARED IRQF_SHARED -#endif - if (request_irq(pdev->irq, vb_isr, VB_IRQ_SHARED, vb->board_name, - vb)) { - assert(0); - goto cleanup; - } -#endif - - *vbp = vb; - return retval; -cleanup: - if (NULL == vb) { - return retval; - } -#if VOICEBUS_DEFERRED == WORKQUEUE - if (vb->workqueue) { - destroy_workqueue(vb->workqueue); - } -#elif VOICEBUS_DEFERRED == TASKLET - tasklet_kill(&vb->tasklet); -#endif - /* Cleanup memory and software resources. */ - if (vb->txd.desc) { - vb_free_descriptors(vb, &vb->txd); - } - if (vb->rxd.desc) { - vb_free_descriptors(vb, &vb->rxd); - } - if (vb->buffer_cache) { - kmem_cache_destroy(vb->buffer_cache); - } - if (vb->iobase) { - release_region(vb->iobase, 0xff); - } - if (vb->pdev) { - pci_disable_device(vb->pdev); - } - kfree(vb); - assert(0 != retval); - return retval; -} - - -/*! \brief Return the pci_dev in use by this voicebus interface. */ -struct pci_dev * -voicebus_get_pci_dev(struct voicebus *vb) -{ - return vb->pdev; -} diff --git a/zaptel/kernel/voicebus.h b/zaptel/kernel/voicebus.h deleted file mode 100644 index 9a2d1c7d..00000000 --- a/zaptel/kernel/voicebus.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * VoiceBus(tm) Interface Library. - * - * Written by Shaun Ruffell - * and based on previous work by Mark Spencer , - * Matthew Fredrickson , and - * Michael Spiceland - * - * Copyright (C) 2007-2008 Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef __VOICEBUS_H__ -#define __VOICEBUS_H__ - -struct voicebus; - -#define VOICEBUS_DEFAULT_LATENCY 3 - -void voicebus_setdebuglevel(struct voicebus *vb, u32 level); -int voicebus_getdebuglevel(struct voicebus *vb); -struct pci_dev * voicebus_get_pci_dev(struct voicebus *vb); -int voicebus_init(struct pci_dev* pdev, u32 framesize, - const char *board_name, - void (*handle_receive)(void *buffer, void *context), - void (*handle_transmit)(void *buffer, void *context), - void *context, - struct voicebus **vb_p); -void voicebus_release(struct voicebus *vb); -int voicebus_start(struct voicebus *vb); -int voicebus_stop(struct voicebus *vb); -void * voicebus_alloc(struct voicebus* vb); -void voicebus_free(struct voicebus *vb, void *vbb); -int voicebus_transmit(struct voicebus *vb, void *vbb); -int voicebus_set_minlatency(struct voicebus *vb, unsigned int milliseconds); -int voicebus_current_latency(struct voicebus *vb) ; - -#endif /* __VOICEBUS_H__ */ diff --git a/zaptel/kernel/wcfxo.c b/zaptel/kernel/wcfxo.c deleted file mode 100644 index fd86afda..00000000 --- a/zaptel/kernel/wcfxo.c +++ /dev/null @@ -1,1102 +0,0 @@ -/* - * Wilcard X100P FXO Interface Driver for Zapata Telephony interface - * - * Written by Mark Spencer - * Matthew Fredrickson - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif -#ifdef LINUX26 -#include -#endif - -/* Uncomment to enable tasklet handling in the FXO driver. Not recommended - in general, but may improve interactive performance */ - -/* #define ENABLE_TASKLETS */ - -/* Un-comment the following for POTS line support for Japan */ -/* #define JAPAN */ - -/* Un-comment for lines (eg from and ISDN TA) that remove */ -/* phone power during ringing */ -/* #define ZERO_BATT_RING */ - -#define WC_MAX_IFACES 128 - -#define WC_CNTL 0x00 -#define WC_OPER 0x01 -#define WC_AUXC 0x02 -#define WC_AUXD 0x03 -#define WC_MASK0 0x04 -#define WC_MASK1 0x05 -#define WC_INTSTAT 0x06 - -#define WC_DMAWS 0x08 -#define WC_DMAWI 0x0c -#define WC_DMAWE 0x10 -#define WC_DMARS 0x18 -#define WC_DMARI 0x1c -#define WC_DMARE 0x20 - -#define WC_AUXFUNC 0x2b -#define WC_SERCTL 0x2d -#define WC_FSCDELAY 0x2f - - -/* DAA registers */ -#define WC_DAA_CTL1 1 -#define WC_DAA_CTL2 2 -#define WC_DAA_DCTL1 5 -#define WC_DAA_DCTL2 6 -#define WC_DAA_PLL1_N1 7 -#define WC_DAA_PLL1_M1 8 -#define WC_DAA_PLL2_N2_M2 9 -#define WC_DAA_PLL_CTL 10 -#define WC_DAA_CHIPA_REV 11 -#define WC_DAA_LINE_STAT 12 -#define WC_DAA_CHIPB_REV 13 -#define WC_DAA_DAISY_CTL 14 -#define WC_DAA_TXRX_GCTL 15 -#define WC_DAA_INT_CTL1 16 -#define WC_DAA_INT_CTL2 17 -#define WC_DAA_INT_CTL3 18 -#define WC_DAA_INT_CTL4 19 - - -#define FLAG_EMPTY 0 -#define FLAG_WRITE 1 -#define FLAG_READ 2 - -#ifdef ZERO_BATT_RING /* Need to debounce Off/On hook too */ -#define JAPAN -#endif - -#define RING_DEBOUNCE 64 /* Ringer Debounce (in ms) */ -#ifdef JAPAN -#define BATT_DEBOUNCE 30 /* Battery debounce (in ms) */ -#define OH_DEBOUNCE 350 /* Off/On hook debounce (in ms) */ -#else -#define BATT_DEBOUNCE 80 /* Battery debounce (in ms) */ -#endif - -#define MINPEGTIME 10 * 8 /* 30 ms peak to peak gets us no more than 100 Hz */ -#define PEGTIME 50 * 8 /* 50ms peak to peak gets us rings of 10 Hz or more */ -#define PEGCOUNT 5 /* 5 cycles of pegging means RING */ - -#define wcfxo_printk(level, span, fmt, ...) \ - printk(KERN_ ## level "%s-%s: %s: " fmt, #level, \ - THIS_MODULE->name, (span).name, ## __VA_ARGS__) - -#define wcfxo_notice(span, fmt, ...) \ - wcfxo_printk(NOTICE, span, fmt, ## __VA_ARGS__) - -#define wcfxo_dbg(span, fmt, ...) \ - ((void)((debug) && wcfxo_printk(DEBUG, span, "%s: " fmt, \ - __FUNCTION__, ## __VA_ARGS__) ) ) - -struct reg { - unsigned long flags; - unsigned char index; - unsigned char reg; - unsigned char value; -}; - -static int wecareregs[] = -{ - WC_DAA_DCTL1, WC_DAA_DCTL2, WC_DAA_PLL2_N2_M2, WC_DAA_CHIPA_REV, - WC_DAA_LINE_STAT, WC_DAA_CHIPB_REV, WC_DAA_INT_CTL2, WC_DAA_INT_CTL4, -}; - -struct wcfxo { - struct pci_dev *dev; - char *variety; - struct zt_span span; - struct zt_chan chan; - int usecount; - int dead; - int pos; - unsigned long flags; - int freeregion; - int ring; - int offhook; - int battery; - int wregcount; - int readpos; - int rreadpos; - unsigned int pegtimer; - int pegcount; - int peg; - int battdebounce; - int nobatttimer; - int ringdebounce; -#ifdef JAPAN - int ohdebounce; -#endif - int allread; - int regoffset; /* How far off our registers are from what we expect */ - int alt; - int ignoreread; - int reset; - /* Up to 6 register can be written at a time */ - struct reg regs[ZT_CHUNKSIZE]; - struct reg oldregs[ZT_CHUNKSIZE]; - unsigned char lasttx[ZT_CHUNKSIZE]; - /* Up to 32 registers of whatever we most recently read */ - unsigned char readregs[32]; - unsigned long ioaddr; - dma_addr_t readdma; - dma_addr_t writedma; - volatile int *writechunk; /* Double-word aligned write memory */ - volatile int *readchunk; /* Double-word aligned read memory */ -#ifdef ZERO_BATT_RING - int onhook; -#endif -#ifdef ENABLE_TASKLETS - int taskletrun; - int taskletsched; - int taskletpending; - int taskletexec; - int txerrors; - int ints; - struct tasklet_struct wcfxo_tlet; -#endif -}; - -#define FLAG_INVERTSER (1 << 0) -#define FLAG_USE_XTAL (1 << 1) -#define FLAG_DOUBLE_CLOCK (1 << 2) -#define FLAG_RESET_ON_AUX5 (1 << 3) -#define FLAG_NO_I18N_REGS (1 << 4) /*!< Uses si3035, rather si3034 */ - -struct wcfxo_desc { - char *name; - unsigned long flags; -}; - - -static struct wcfxo_desc wcx100p = { "Wildcard X100P", - FLAG_INVERTSER | FLAG_USE_XTAL | FLAG_DOUBLE_CLOCK }; - -static struct wcfxo_desc wcx101p = { "Wildcard X101P", - FLAG_USE_XTAL | FLAG_DOUBLE_CLOCK }; - -static struct wcfxo_desc generic = { "Generic Clone", - FLAG_USE_XTAL | FLAG_DOUBLE_CLOCK }; - -static struct wcfxo *ifaces[WC_MAX_IFACES]; - -static void wcfxo_release(struct wcfxo *wc); - -static int debug = 0; - -static int monitor = 0; - -static int quiet = 0; - -static int boost = 0; - -static int opermode = 0; - -static struct fxo_mode { - char *name; - int ohs; - int act; - int dct; - int rz; - int rt; - int lim; - int vol; -} fxo_modes[] = -{ - { "FCC", 0, 0, 2, 0, 0, 0, 0 }, /* US */ - { "CTR21", 0, 0, 3, 0, 0, 3, 0 }, /* Austria, Belgium, Denmark, Finland, France, Germany, - Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands, - Norway, Portugal, Spain, Sweden, Switzerland, and UK */ -}; - -static inline void wcfxo_transmitprep(struct wcfxo *wc, unsigned char ints) -{ - volatile int *writechunk; - int x; - int written=0; - unsigned short cmd; - - /* if nothing to transmit, have to do the zt_transmit() anyway */ - if (!(ints & 3)) { - /* Calculate Transmission */ - zt_transmit(&wc->span); - return; - } - - /* Remember what it was we just sent */ - memcpy(wc->lasttx, wc->chan.writechunk, ZT_CHUNKSIZE); - - if (ints & 0x01) { - /* Write is at interrupt address. Start writing from normal offset */ - writechunk = wc->writechunk; - } else { - writechunk = wc->writechunk + ZT_CHUNKSIZE * 2; - } - - zt_transmit(&wc->span); - - for (x=0;xflags & FLAG_INVERTSER) - writechunk[x << 1] = cpu_to_le32( - ~((unsigned short)(ZT_XLAW(wc->chan.writechunk[x], (&wc->chan)))| 0x1) << 16 - ); - else - writechunk[x << 1] = cpu_to_le32( - ((unsigned short)(ZT_XLAW(wc->chan.writechunk[x], (&wc->chan)))| 0x1) << 16 - ); - - /* We always have a command to follow our signal */ - if (!wc->regs[x].flags) { - /* Fill in an empty register command with a read for a potentially useful register */ - wc->regs[x].flags = FLAG_READ; - wc->regs[x].reg = wecareregs[wc->readpos]; - wc->regs[x].index = wc->readpos; - wc->readpos++; - if (wc->readpos >= (sizeof(wecareregs) / sizeof(wecareregs[0]))) { - wc->allread = 1; - wc->readpos = 0; - } - } - - /* Prepare the command to follow it */ - switch(wc->regs[x].flags) { - case FLAG_READ: - cmd = (wc->regs[x].reg | 0x20) << 8; - break; - case FLAG_WRITE: - cmd = (wc->regs[x].reg << 8) | (wc->regs[x].value & 0xff); - written = 1; - /* Wait at least four samples before reading */ - wc->ignoreread = 4; - break; - default: - printk("wcfxo: Huh? No read or write??\n"); - cmd = 0; - } - /* Setup the write chunk */ - if (wc->flags & FLAG_INVERTSER) - writechunk[(x << 1) + 1] = cpu_to_le32(~(cmd << 16)); - else - writechunk[(x << 1) + 1] = cpu_to_le32(cmd << 16); - } - if (written) - wc->readpos = 0; - wc->wregcount = 0; - - for (x=0;xoldregs[x] = wc->regs[x]; - wc->regs[x].flags = FLAG_EMPTY; - } - -} - -static inline void wcfxo_receiveprep(struct wcfxo *wc, unsigned char ints) -{ - volatile int *readchunk; - int x; - int realreg; - int realval; - int sample; - if (ints & 0x04) - /* Read is at interrupt address. Valid data is available at normal offset */ - readchunk = wc->readchunk; - else - readchunk = wc->readchunk + ZT_CHUNKSIZE * 2; - - /* Keep track of how quickly our peg alternates */ - wc->pegtimer+=ZT_CHUNKSIZE; - for (x=0;xoldregs[x].flags == FLAG_READ && !wc->ignoreread) { - realreg = wecareregs[(wc->regs[x].index + wc->regoffset) % - (sizeof(wecareregs) / sizeof(wecareregs[0]))]; - realval = (le32_to_cpu(readchunk[(x << 1) +wc->alt]) >> 16) & 0xff; - if ((realval == 0x89) && (realreg != WC_DAA_PLL2_N2_M2)) { - /* Some sort of slippage, correct for it */ - while(realreg != WC_DAA_PLL2_N2_M2) { - /* Find register 9 */ - realreg = wecareregs[(wc->regs[x].index + ++wc->regoffset) % - (sizeof(wecareregs) / sizeof(wecareregs[0]))]; - wc->regoffset = wc->regoffset % (sizeof(wecareregs) / sizeof(wecareregs[0])); - } - if (debug) - printk("New regoffset: %d\n", wc->regoffset); - } - /* Receive into the proper register */ - wc->readregs[realreg] = realval; - } - /* Look for pegging to indicate ringing */ - sample = (short)(le32_to_cpu(readchunk[(x << 1) + (1 - wc->alt)]) >> 16); - if ((sample > 32000) && (wc->peg != 1)) { - if ((wc->pegtimer < PEGTIME) && (wc->pegtimer > MINPEGTIME)) - wc->pegcount++; - wc->pegtimer = 0; - wc->peg = 1; - } else if ((sample < -32000) && (wc->peg != -1)) { - if ((wc->pegtimer < PEGTIME) && (wc->pegtimer > MINPEGTIME)) - wc->pegcount++; - wc->pegtimer = 0; - wc->peg = -1; - } - wc->chan.readchunk[x] = ZT_LIN2X((sample), (&wc->chan)); - } - if (wc->pegtimer > PEGTIME) { - /* Reset pegcount if our timer expires */ - wc->pegcount = 0; - } - /* Decrement debouncer if appropriate */ - if (wc->ringdebounce) - wc->ringdebounce--; - if (!wc->offhook && !wc->ringdebounce) { - if (!wc->ring && (wc->pegcount > PEGCOUNT)) { - /* It's ringing */ - if (debug) - printk("RING!\n"); - zt_hooksig(&wc->chan, ZT_RXSIG_RING); - wc->ring = 1; - } - if (wc->ring && !wc->pegcount) { - /* No more ring */ - if (debug) - printk("NO RING!\n"); - zt_hooksig(&wc->chan, ZT_RXSIG_OFFHOOK); - wc->ring = 0; - } - } - if (wc->ignoreread) - wc->ignoreread--; - - /* Do the echo cancellation... We are echo cancelling against - what we sent two chunks ago*/ - zt_ec_chunk(&wc->chan, wc->chan.readchunk, wc->lasttx); - - /* Receive the result */ - zt_receive(&wc->span); -} - -#ifdef ENABLE_TASKLETS -static void wcfxo_tasklet(unsigned long data) -{ - struct wcfxo *wc = (struct wcfxo *)data; - wc->taskletrun++; - /* Run tasklet */ - if (wc->taskletpending) { - wc->taskletexec++; - wcfxo_receiveprep(wc, wc->ints); - wcfxo_transmitprep(wc, wc->ints); - } - wc->taskletpending = 0; -} -#endif - -static void wcfxo_stop_dma(struct wcfxo *wc); -static void wcfxo_restart_dma(struct wcfxo *wc); - -ZAP_IRQ_HANDLER(wcfxo_interrupt) -{ - struct wcfxo *wc = dev_id; - unsigned char ints; - unsigned char b; -#ifdef DEBUG_RING - static int oldb = 0; - static int oldcnt = 0; -#endif - - ints = inb(wc->ioaddr + WC_INTSTAT); - - - if (!ints) -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - - outb(ints, wc->ioaddr + WC_INTSTAT); - - if (ints & 0x0c) { /* if there is a rx interrupt pending */ -#ifdef ENABLE_TASKLETS - wc->ints = ints; - if (!wc->taskletpending) { - wc->taskletpending = 1; - wc->taskletsched++; - tasklet_hi_schedule(&wc->wcfxo_tlet); - } else - wc->txerrors++; -#else - wcfxo_receiveprep(wc, ints); - /* transmitprep looks to see if there is anything to transmit - and returns by itself if there is nothing */ - wcfxo_transmitprep(wc, ints); -#endif - } - - if (ints & 0x10) { - printk("FXO PCI Master abort\n"); - /* Stop DMA andlet the watchdog start it again */ - wcfxo_stop_dma(wc); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#else - return; -#endif - } - - if (ints & 0x20) { - printk("PCI Target abort\n"); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#else - return; -#endif - } - if (1 /* !(wc->report % 0xf) */) { - /* Check for BATTERY from register and debounce for 8 ms */ - b = wc->readregs[WC_DAA_LINE_STAT] & 0xf; - if (!b) { - wc->nobatttimer++; -#if 0 - if (wc->battery) - printk("Battery loss: %d (%d debounce)\n", b, wc->battdebounce); -#endif - if (wc->battery && !wc->battdebounce) { - if (debug) - printk("NO BATTERY!\n"); - wc->battery = 0; -#ifdef JAPAN - if ((!wc->ohdebounce) && wc->offhook) { - zt_hooksig(&wc->chan, ZT_RXSIG_ONHOOK); - if (debug) - printk("Signalled On Hook\n"); -#ifdef ZERO_BATT_RING - wc->onhook++; -#endif - } -#else - zt_hooksig(&wc->chan, ZT_RXSIG_ONHOOK); -#endif - wc->battdebounce = BATT_DEBOUNCE; - } else if (!wc->battery) - wc->battdebounce = BATT_DEBOUNCE; - if ((wc->nobatttimer > 5000) && -#ifdef ZERO_BATT_RING - !(wc->readregs[WC_DAA_DCTL1] & 0x04) && -#endif - (!wc->span.alarms)) { - wc->span.alarms = ZT_ALARM_RED; - zt_alarm_notify(&wc->span); - } - } else if (b == 0xf) { - if (!wc->battery && !wc->battdebounce) { - if (debug) - printk("BATTERY!\n"); -#ifdef ZERO_BATT_RING - if (wc->onhook) { - wc->onhook = 0; - zt_hooksig(&wc->chan, ZT_RXSIG_OFFHOOK); - if (debug) - printk("Signalled Off Hook\n"); - } -#else - zt_hooksig(&wc->chan, ZT_RXSIG_OFFHOOK); -#endif - wc->battery = 1; - wc->nobatttimer = 0; - wc->battdebounce = BATT_DEBOUNCE; - if (wc->span.alarms) { - wc->span.alarms = 0; - zt_alarm_notify(&wc->span); - } - } else if (wc->battery) - wc->battdebounce = BATT_DEBOUNCE; - } else { - /* It's something else... */ - wc->battdebounce = BATT_DEBOUNCE; - } - - if (wc->battdebounce) - wc->battdebounce--; -#ifdef JAPAN - if (wc->ohdebounce) - wc->ohdebounce--; -#endif - - } -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} - -static int wcfxo_setreg(struct wcfxo *wc, unsigned char reg, unsigned char value) -{ - int x; - if (wc->wregcount < ZT_CHUNKSIZE) { - x = wc->wregcount; - wc->regs[x].reg = reg; - wc->regs[x].value = value; - wc->regs[x].flags = FLAG_WRITE; - wc->wregcount++; - return 0; - } - printk("wcfxo: Out of space to write register %02x with %02x\n", reg, value); - return -1; -} - -static int wcfxo_open(struct zt_chan *chan) -{ - struct wcfxo *wc = chan->pvt; - if (wc->dead) - return -ENODEV; - wc->usecount++; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int wcfxo_watchdog(struct zt_span *span, int event) -{ - printk("FXO: Restarting DMA\n"); - wcfxo_restart_dma(span->pvt); - return 0; -} - -static int wcfxo_close(struct zt_chan *chan) -{ - struct wcfxo *wc = chan->pvt; - wc->usecount--; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - /* If we're dead, release us now */ - if (!wc->usecount && wc->dead) - wcfxo_release(wc); - return 0; -} - -static int wcfxo_hooksig(struct zt_chan *chan, zt_txsig_t txsig) -{ - struct wcfxo *wc = chan->pvt; - int reg=0; - switch(txsig) { - case ZT_TXSIG_START: - case ZT_TXSIG_OFFHOOK: - /* Take off hook and enable normal mode reception. This must - be done in two steps because of a hardware bug. */ - reg = wc->readregs[WC_DAA_DCTL1] & ~0x08; - wcfxo_setreg(wc, WC_DAA_DCTL1, reg); - - reg = reg | 0x1; - wcfxo_setreg(wc, WC_DAA_DCTL1, reg); - wc->offhook = 1; -#ifdef JAPAN - wc->battery = 1; - wc->battdebounce = BATT_DEBOUNCE; - wc->ohdebounce = OH_DEBOUNCE; -#endif - break; - case ZT_TXSIG_ONHOOK: - /* Put on hook and enable on hook line monitor */ - reg = wc->readregs[WC_DAA_DCTL1] & 0xfe; - wcfxo_setreg(wc, WC_DAA_DCTL1, reg); - - reg = reg | 0x08; - wcfxo_setreg(wc, WC_DAA_DCTL1, reg); - wc->offhook = 0; - /* Don't accept a ring for another 1000 ms */ - wc->ringdebounce = 1000; -#ifdef JAPAN - wc->ohdebounce = OH_DEBOUNCE; -#endif - break; - default: - printk("wcfxo: Can't set tx state to %d\n", txsig); - } - if (debug) - printk("Setting hook state to %d (%02x)\n", txsig, reg); - return 0; -} - -static int wcfxo_initialize(struct wcfxo *wc) -{ - /* Zapata 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"; - zap_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype)); - wc->chan.sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF; - wc->chan.chanpos = 1; - wc->span.chans = &wc->chan; - wc->span.channels = 1; - wc->span.hooksig = wcfxo_hooksig; - wc->span.irq = wc->dev->irq; - wc->span.open = wcfxo_open; - wc->span.close = wcfxo_close; - wc->span.flags = ZT_FLAG_RBS; - wc->span.deflaw = ZT_LAW_MULAW; - wc->span.watchdog = wcfxo_watchdog; -#ifdef ENABLE_TASKLETS - tasklet_init(&wc->wcfxo_tlet, wcfxo_tasklet, (unsigned long)wc); -#endif - init_waitqueue_head(&wc->span.maintq); - - wc->span.pvt = wc; - wc->chan.pvt = wc; - if (zt_register(&wc->span, 0)) { - printk("Unable to register span with zaptel\n"); - return -1; - } - return 0; -} - -static int wcfxo_hardware_init(struct wcfxo *wc) -{ - /* Hardware stuff */ - /* Reset PCI Interface chip and registers */ - outb(0x0e, wc->ioaddr + WC_CNTL); - if (wc->flags & FLAG_RESET_ON_AUX5) { - /* Set hook state to on hook for when we switch. - Make sure reset is high */ - outb(0x34, wc->ioaddr + WC_AUXD); - } else { - /* Set hook state to on hook for when we switch */ - outb(0x24, wc->ioaddr + WC_AUXD); - } - /* Set all to outputs except AUX 4, which is an input */ - outb(0xef, wc->ioaddr + WC_AUXC); - - /* Back to normal, with automatic DMA wrap around */ - outb(0x01, wc->ioaddr + WC_CNTL); - - /* Make sure serial port and DMA are out of reset */ - outb(inb(wc->ioaddr + WC_CNTL) & 0xf9, wc->ioaddr + WC_CNTL); - - /* Configure serial port for MSB->LSB operation */ - if (wc->flags & FLAG_DOUBLE_CLOCK) - outb(0xc1, wc->ioaddr + WC_SERCTL); - else - outb(0xc0, wc->ioaddr + WC_SERCTL); - - if (wc->flags & FLAG_USE_XTAL) { - /* Use the crystal oscillator */ - outb(0x04, wc->ioaddr + WC_AUXFUNC); - } - - /* Delay FSC by 2 so it's properly aligned */ - outb(0x2, wc->ioaddr + WC_FSCDELAY); - - /* Setup DMA Addresses */ - outl(wc->writedma, wc->ioaddr + WC_DMAWS); /* Write start */ - outl(wc->writedma + ZT_CHUNKSIZE * 8 - 4, wc->ioaddr + WC_DMAWI); /* Middle (interrupt) */ - outl(wc->writedma + ZT_CHUNKSIZE * 16 - 4, wc->ioaddr + WC_DMAWE); /* End */ - - outl(wc->readdma, wc->ioaddr + WC_DMARS); /* Read start */ - outl(wc->readdma + ZT_CHUNKSIZE * 8 - 4, wc->ioaddr + WC_DMARI); /* Middle (interrupt) */ - outl(wc->readdma + ZT_CHUNKSIZE * 16 - 4, wc->ioaddr + WC_DMARE); /* End */ - - /* Clear interrupts */ - outb(0xff, wc->ioaddr + WC_INTSTAT); - return 0; -} - -static void wcfxo_enable_interrupts(struct wcfxo *wc) -{ - /* Enable interrupts (we care about all of them) */ - outb(0x3f, wc->ioaddr + WC_MASK0); - /* No external interrupts */ - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static void wcfxo_start_dma(struct wcfxo *wc) -{ - /* Reset Master and TDM */ - outb(0x0f, wc->ioaddr + WC_CNTL); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - outb(0x01, wc->ioaddr + WC_CNTL); - outb(0x01, wc->ioaddr + WC_OPER); -} - -static void wcfxo_restart_dma(struct wcfxo *wc) -{ - /* Reset Master and TDM */ - outb(0x01, wc->ioaddr + WC_CNTL); - outb(0x01, wc->ioaddr + WC_OPER); -} - - -static void wcfxo_stop_dma(struct wcfxo *wc) -{ - outb(0x00, wc->ioaddr + WC_OPER); -} - -static void wcfxo_reset_tdm(struct wcfxo *wc) -{ - /* Reset TDM */ - outb(0x0f, wc->ioaddr + WC_CNTL); -} - -static void wcfxo_disable_interrupts(struct wcfxo *wc) -{ - outb(0x00, wc->ioaddr + WC_MASK0); - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static void wcfxo_set_daa_mode(struct wcfxo *wc) -{ - /* Set country specific parameters (OHS, ACT, DCT, RZ, RT, LIM, VOL) */ - int reg16 = ((fxo_modes[opermode].ohs & 0x1) << 6) | - ((fxo_modes[opermode].act & 0x1) << 5) | - ((fxo_modes[opermode].dct & 0x3) << 2) | - ((fxo_modes[opermode].rz & 0x1) << 1) | - ((fxo_modes[opermode].rt & 0x1) << 0); - int reg17 = ((fxo_modes[opermode].lim & 0x3) << 3); - int reg18 = ((fxo_modes[opermode].vol & 0x3) << 3); - - if (wc->flags & FLAG_NO_I18N_REGS) { - wcfxo_dbg(wc->span, "This card does not support international settings.\n"); - return; - } - - wcfxo_setreg(wc, WC_DAA_INT_CTL1, reg16); - wcfxo_setreg(wc, WC_DAA_INT_CTL2, reg17); - wcfxo_setreg(wc, WC_DAA_INT_CTL3, reg18); - - - /* Wait a couple of jiffies for our writes to finish */ - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1 + (ZT_CHUNKSIZE * HZ) / 800); - - printk("wcfxo: DAA mode is '%s'\n", fxo_modes[opermode].name); -} - -static int wcfxo_init_daa(struct wcfxo *wc) -{ - /* This must not be called in an interrupt */ - /* We let things settle for a bit */ - unsigned char reg15; - int chip_revb; -// set_current_state(TASK_INTERRUPTIBLE); -// schedule_timeout(10); - - /* Soft-reset it */ - wcfxo_setreg(wc, WC_DAA_CTL1, 0x80); - - /* Let the reset go */ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(1 + (ZT_CHUNKSIZE * HZ) / 800); - - /* We have a clock at 18.432 Mhz, so N1=1, M1=2, CGM=0 */ - wcfxo_setreg(wc, WC_DAA_PLL1_N1, 0x0); /* This value is N1 - 1 */ - wcfxo_setreg(wc, WC_DAA_PLL1_M1, 0x1); /* This value is M1 - 1 */ - /* We want to sample at 8khz, so N2 = 9, M2 = 10 (N2-1, M2-1) */ - wcfxo_setreg(wc, WC_DAA_PLL2_N2_M2, 0x89); - - /* Wait until the PLL's are locked. Time is between 100 uSec and 1 mSec */ - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1 + HZ/1000 + (ZT_CHUNKSIZE * HZ) / 800); - - /* No additional ration is applied to the PLL and faster lock times - * are possible */ - wcfxo_setreg(wc, WC_DAA_PLL_CTL, 0x0); - /* Enable off hook pin */ - wcfxo_setreg(wc, WC_DAA_DCTL1, 0x0a); - if (monitor) { - /* Enable ISOcap and external speaker and charge pump if present */ - wcfxo_setreg(wc, WC_DAA_DCTL2, 0x80); - } else { - /* Enable ISOcap and charge pump if present (leave speaker disabled) */ - wcfxo_setreg(wc, WC_DAA_DCTL2, 0xe0); - } - - /* Wait a couple of jiffies for our writes to finish */ - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1 + (ZT_CHUNKSIZE * HZ) / 800); - reg15 = 0x0; - /* Go ahead and attenuate transmit signal by 6 db */ - if (quiet) { - printk("wcfxo: Attenuating transmit signal for quiet operation\n"); - reg15 |= (quiet & 0x3) << 4; - } - if (boost) { - printk("wcfxo: Boosting receive signal\n"); - reg15 |= (boost & 0x3); - } - wcfxo_setreg(wc, WC_DAA_TXRX_GCTL, reg15); - - /* REVB: reg. 13, bits 5:2 */ - chip_revb = (wc->readregs[WC_DAA_CHIPB_REV] >> 2) & 0xF; - wcfxo_dbg(wc->span, "DAA chip REVB is %x\n", chip_revb); - switch(chip_revb) { - case 1: case 2: case 3: - /* This is a si3034. Nothing to do */ - break; - case 4: case 5: case 7: - /* This is 3035. Has no support for international registers */ - wc->flags |= FLAG_NO_I18N_REGS; - break; - default: - wcfxo_notice(wc->span, "Unknown DAA chip revision: REVB=%d\n", - chip_revb); - } - - /* Didn't get it right. Register 9 is still garbage */ - if (wc->readregs[WC_DAA_PLL2_N2_M2] != 0x89) - return -1; -#if 0 - { int x; - int y; - for (y=0;y<100;y++) { - printk(" reg dump ====== %d ======\n", y); - for (x=0;xreadregs[wecareregs[x]]); - } - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(100); - } } -#endif - return 0; -} - -static int __devinit wcfxo_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - struct wcfxo *wc; - struct wcfxo_desc *d = (struct wcfxo_desc *)ent->driver_data; - int x; - - for (x=0;x= WC_MAX_IFACES) { - printk(KERN_ERR "Too many interfaces: Found %d, can only handle %d.\n", - x, WC_MAX_IFACES - 1); - return -EIO; - } - - if (pci_enable_device(pdev)) - return -EIO; - - wc = kmalloc(sizeof(struct wcfxo), GFP_KERNEL); - if (!wc) { - printk(KERN_ERR "wcfxo: Failed initializinf card. Not enough memory."); - return -ENOMEM; - } - - ifaces[x] = wc; - memset(wc, 0, sizeof(struct wcfxo)); - wc->ioaddr = pci_resource_start(pdev, 0); - wc->dev = pdev; - wc->pos = x; - wc->variety = d->name; - wc->flags = d->flags; - /* Keep track of whether we need to free the region */ - if (request_region(wc->ioaddr, 0xff, "wcfxo")) - wc->freeregion = 1; - - /* Allocate enough memory for two zt chunks, receive and transmit. Each sample uses - 32 bits. Allocate an extra set just for control too */ - wc->writechunk = (int *)pci_alloc_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, &wc->writedma); - if (!wc->writechunk) { - printk("wcfxo: Unable to allocate DMA-able memory\n"); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - return -ENOMEM; - } - - wc->readchunk = wc->writechunk + ZT_MAX_CHUNKSIZE * 4; /* in doublewords */ - wc->readdma = wc->writedma + ZT_MAX_CHUNKSIZE * 16; /* in bytes */ - - if (wcfxo_initialize(wc)) { - printk("wcfxo: Unable to intialize modem\n"); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - kfree(wc); - return -EIO; - } - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - - if (request_irq(pdev->irq, wcfxo_interrupt, ZAP_IRQ_SHARED, "wcfxo", wc)) { - printk("wcfxo: Unable to request IRQ %d\n", pdev->irq); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - kfree(wc); - return -EIO; - } - - - wcfxo_hardware_init(wc); - /* Enable interrupts */ - wcfxo_enable_interrupts(wc); - /* Initialize Write/Buffers to all blank data */ - memset((void *)wc->writechunk,0,ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4); - /* Start DMA */ - wcfxo_start_dma(wc); - - /* Initialize DAA (after it's started) */ - if (wcfxo_init_daa(wc)) { - printk("Failed to initailize DAA, giving up...\n"); - wcfxo_stop_dma(wc); - wcfxo_disable_interrupts(wc); - zt_unregister(&wc->span); - free_irq(pdev->irq, wc); - - /* Reset PCI chip and registers */ - outb(0x0e, wc->ioaddr + WC_CNTL); - - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - kfree(wc); - return -EIO; - } - wcfxo_set_daa_mode(wc); - printk("Found a Wildcard FXO: %s\n", wc->variety); - - return 0; -} - -static void wcfxo_release(struct wcfxo *wc) -{ - zt_unregister(&wc->span); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - kfree(wc); - printk("Freed a Wildcard\n"); -} - -static void __devexit wcfxo_remove_one(struct pci_dev *pdev) -{ - struct wcfxo *wc = pci_get_drvdata(pdev); - if (wc) { - - /* Stop any DMA */ - wcfxo_stop_dma(wc); - wcfxo_reset_tdm(wc); - - /* In case hardware is still there */ - wcfxo_disable_interrupts(wc); - - /* Immediately free resources */ - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)wc->writechunk, wc->writedma); - free_irq(pdev->irq, wc); - - /* Reset PCI chip and registers */ - outb(0x0e, wc->ioaddr + WC_CNTL); - - /* Release span, possibly delayed */ - if (!wc->usecount) - wcfxo_release(wc); - else - wc->dead = 1; - } -} - -static struct pci_device_id wcfxo_pci_tbl[] = { - { 0xe159, 0x0001, 0x8084, PCI_ANY_ID, 0, 0, (unsigned long) &generic }, - { 0xe159, 0x0001, 0x8085, PCI_ANY_ID, 0, 0, (unsigned long) &wcx101p }, - { 0xe159, 0x0001, 0x8086, PCI_ANY_ID, 0, 0, (unsigned long) &generic }, - { 0xe159, 0x0001, 0x8087, PCI_ANY_ID, 0, 0, (unsigned long) &generic }, - { 0x1057, 0x5608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcx100p }, - { 0 } -}; - -MODULE_DEVICE_TABLE (pci, wcfxo_pci_tbl); - -static struct pci_driver wcfxo_driver = { - name: "wcfxo", - probe: wcfxo_init_one, -#ifdef LINUX26 - remove: __devexit_p(wcfxo_remove_one), -#else - remove: wcfxo_remove_one, -#endif - id_table: wcfxo_pci_tbl, -}; - -static int __init wcfxo_init(void) -{ - int res; - int x; - if ((opermode >= sizeof(fxo_modes) / sizeof(fxo_modes[0])) || (opermode < 0)) { - printk("Invalid/unknown operating mode specified. Please choose one of:\n"); - for (x=0;x"); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(wcfxo_init); -module_exit(wcfxo_cleanup); diff --git a/zaptel/kernel/wct1xxp.c b/zaptel/kernel/wct1xxp.c deleted file mode 100644 index aee95c16..00000000 --- a/zaptel/kernel/wct1xxp.c +++ /dev/null @@ -1,1438 +0,0 @@ -/* - * Linux Support Services, Inc. Wildcard T100P T1/PRI card Driver - * - * Written by Mark Spencer - * Matthew Fredrickson - * William Meadows - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif -#ifdef LINUX26 -#include -#endif - -#define WC_MAX_CARDS 32 - -/* -#define TEST_REGS -*/ - -/* Define to get more attention-grabbing but slightly more I/O using - alarm status */ -#define FANCY_ALARM - - -#define DELAY 0x0 /* 30 = 15 cycles, 10 = 8 cycles, 0 = 3 cycles */ - -#define WC_CNTL 0x00 -#define WC_OPER 0x01 -#define WC_AUXC 0x02 -#define WC_AUXD 0x03 -#define WC_MASK0 0x04 -#define WC_MASK1 0x05 -#define WC_INTSTAT 0x06 - -#define WC_DMAWS 0x08 -#define WC_DMAWI 0x0c -#define WC_DMAWE 0x10 -#define WC_DMARS 0x18 -#define WC_DMARI 0x1c -#define WC_DMARE 0x20 -#define WC_CURPOS 0x24 - -#define WC_SERC 0x2d -#define WC_FSCDELAY 0x2f - -#define WC_USERREG 0xc0 - -#define WC_CLOCK 0x0 -#define WC_LEDTEST 0x1 -#define WC_VERSION 0x2 - -/* Offset between transmit and receive */ -#define WC_OFFSET 4 - -#define BIT_CS (1 << 7) -#define BIT_ADDR (0xf << 3) - -#define BIT_LED0 (1 << 0) -#define BIT_LED1 (1 << 1) -#define BIT_TEST (1 << 2) - -static char *chips[] = -{ - "DS2152", - "DS21352", - "DS21552", - "Unknown Chip (3)", - "DS2154", - "DS21354", - "DS21554", - "Unknown Chip (7)", -}; - -static int chanmap_t1[] = -{ 2,1,0, - 6,5,4, - 10,9,8, - 14,13,12, - 18,17,16, - 22,21,20, - 26,25,24, - 30,29,28 }; - -static int chanmap_e1[] = -{ 2,1,0, - 7,6,5,4, - 11,10,9,8, - 15,14,13,12, - 19,18,17,16, - 23,22,21,20, - 27,26,25,24, - 31,30,29,28 }; - -#ifdef FANCY_ALARM -static int altab[] = { -0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24, 25, 27, 28, 29, 30, 31, 31, 32, 31, 31, 30, 29, 28, 27, 25, 23, 22, 20, 18, 16, 13, 11, 9, 8, 6, 4, 3, 2, 1, 0, 0, -}; -#endif - -struct t1xxp { - struct pci_dev *dev; - spinlock_t lock; - int ise1; - int num; - /* Our offset for finding channel 1 */ - int offset; - char *variety; - unsigned int intcount; - int usecount; - int clocktimeout; - int sync; - int dead; - int blinktimer; - int alarmtimer; - int loopupcnt; - int loopdowncnt; - int miss; - int misslast; - int *chanmap; -#ifdef FANCY_ALARM - int alarmpos; -#endif - unsigned char ledtestreg; - unsigned char outbyte; - unsigned long ioaddr; - unsigned short canary; - /* T1 signalling */ - unsigned char txsiga[3]; - unsigned char txsigb[3]; - dma_addr_t readdma; - dma_addr_t writedma; - volatile unsigned char *writechunk; /* Double-word aligned write memory */ - volatile unsigned char *readchunk; /* Double-word aligned read memory */ - unsigned char ec_chunk1[31][ZT_CHUNKSIZE]; - unsigned char ec_chunk2[31][ZT_CHUNKSIZE]; - unsigned char tempo[32]; - struct zt_span span; /* Span */ - struct zt_chan chans[31]; /* Channels */ -}; - -#define CANARY 0xca1e - -int debug = 0; /* doesnt do anything */ - -static struct t1xxp *cards[WC_MAX_CARDS]; - -static inline void start_alarm(struct t1xxp *wc) -{ -#ifdef FANCY_ALARM - wc->alarmpos = 0; -#endif - wc->blinktimer = 0; -} - -static inline void stop_alarm(struct t1xxp *wc) -{ -#ifdef FANCY_ALARM - wc->alarmpos = 0; -#endif - wc->blinktimer = 0; -} - -static inline void __select_framer(struct t1xxp *wc, int reg) -{ - /* Top four bits of address from AUX 6-3 */ - wc->outbyte &= ~BIT_CS; - wc->outbyte &= ~BIT_ADDR; - wc->outbyte |= (reg & 0xf0) >> 1; - outb(wc->outbyte, wc->ioaddr + WC_AUXD); -} - -static inline void __select_control(struct t1xxp *wc) -{ - if (!(wc->outbyte & BIT_CS)) { - wc->outbyte |= BIT_CS; - outb(wc->outbyte, wc->ioaddr + WC_AUXD); - } -} - -static int t1xxp_open(struct zt_chan *chan) -{ - struct t1xxp *wc = chan->pvt; - if (wc->dead) - return -ENODEV; - wc->usecount++; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int __t1_get_reg(struct t1xxp *wc, int reg) -{ - unsigned char res; - __select_framer(wc, reg); - /* Get value */ - res = inb(wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return res; -} - -static int __t1_set_reg(struct t1xxp *wc, int reg, unsigned char val) -{ - __select_framer(wc, reg); - /* Send address */ - outb(val, wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return 0; -} - -static int __control_set_reg(struct t1xxp *wc, int reg, unsigned char val) -{ - __select_control(wc); - outb(val, wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return 0; -} - -static int control_set_reg(struct t1xxp *wc, int reg, unsigned char val) -{ - unsigned long flags; - int res; - spin_lock_irqsave(&wc->lock, flags); - res = __control_set_reg(wc, reg, val); - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static int __control_get_reg(struct t1xxp *wc, int reg) -{ - unsigned char res; - /* The following makes UTTERLY no sense, but what was happening - was that reads in some cases were not actually happening - on the physical bus. Why, we dunno. But in debugging, we found - that writing before reading (in this case to an unused position) - seems to get rid of the problem */ - __control_set_reg(wc,3,0x69); /* do magic here */ - /* now get the read byte from the Xilinx part */ - res = inb(wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return res; -} - -static int control_get_reg(struct t1xxp *wc, int reg) -{ - unsigned long flags; - int res; - spin_lock_irqsave(&wc->lock, flags); - res = __control_get_reg(wc, reg); - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static void t1xxp_release(struct t1xxp *wc) -{ - zt_unregister(&wc->span); - kfree(wc); - printk("Freed a Wildcard\n"); -} - -static int t1xxp_close(struct zt_chan *chan) -{ - struct t1xxp *wc = chan->pvt; - wc->usecount--; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - /* If we're dead, release us now */ - if (!wc->usecount && wc->dead) - t1xxp_release(wc); - return 0; -} - -static void t1xxp_enable_interrupts(struct t1xxp *wc) -{ - /* Clear interrupts */ - outb(0xff, wc->ioaddr + WC_INTSTAT); - /* Enable interrupts (we care about all of them) */ - outb(0x3c /* 0x3f */, wc->ioaddr + WC_MASK0); - /* No external interrupts */ - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static void t1xxp_start_dma(struct t1xxp *wc) -{ - /* Reset Master and TDM */ - outb(DELAY | 0x0f, wc->ioaddr + WC_CNTL); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - outb(DELAY | 0x01, wc->ioaddr + WC_CNTL); - outb(0x01, wc->ioaddr + WC_OPER); - if (debug) printk("Started DMA\n"); -} - -static void __t1xxp_stop_dma(struct t1xxp *wc) -{ - outb(0x00, wc->ioaddr + WC_OPER); -} - -static void __t1xxp_disable_interrupts(struct t1xxp *wc) -{ - outb(0x00, wc->ioaddr + WC_MASK0); - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static void __t1xxp_set_clear(struct t1xxp *wc) -{ - /* Setup registers */ - int x,y; - unsigned char b; - - /* No such thing under E1 */ - if (wc->ise1) { - printk("Can't set clear mode on an E1!\n"); - return; - } - - for (x=0;x<3;x++) { - b = 0; - for (y=0;y<8;y++) - if (wc->chans[x * 8 + y].sig & ZT_SIG_CLEAR) - b |= (1 << y); - __t1_set_reg(wc, 0x39 + x, b); - } -} - -static void t1xxp_t1_framer_start(struct t1xxp *wc) -{ - int i; - char *coding, *framing; - unsigned long endjiffies; - int alreadyrunning = wc->span.flags & ZT_FLAG_RUNNING; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - - /* Build up config */ - i = 0x20; - if (wc->span.lineconfig & ZT_CONFIG_ESF) { - coding = "ESF"; - i = 0x88; - } else { - coding = "SF"; - } - if (wc->span.lineconfig & ZT_CONFIG_B8ZS) { - framing = "B8ZS"; - i |= 0x44; - } else { - framing = "AMI"; - } - __t1_set_reg(wc, 0x38, i); - if (!(wc->span.lineconfig & ZT_CONFIG_ESF)) { - /* 1c in FDL bit */ - __t1_set_reg(wc, 0x7e, 0x1c); - } else { - __t1_set_reg(wc, 0x7e, 0x00); - } - - /* Set outgoing LBO */ - __t1_set_reg(wc, 0x7c, wc->span.txlevel << 5); - - printk("Using %s/%s coding/framing\n", coding, framing); - if (!alreadyrunning) { - /* Setup the clear channels */ - __t1xxp_set_clear(wc); - - /* Set LIRST bit to 1 */ - __t1_set_reg(wc, 0x0a, 0x80); - spin_unlock_irqrestore(&wc->lock, flags); - - /* Wait 100ms to give plenty of time for reset */ - endjiffies = jiffies + 10; - while(endjiffies < jiffies); - - spin_lock_irqsave(&wc->lock, flags); - - /* Reset LIRST bit and reset elastic stores */ - __t1_set_reg(wc, 0xa, 0x30); - - wc->span.flags |= ZT_FLAG_RUNNING; - } - spin_unlock_irqrestore(&wc->lock, flags); -} - -static void t1xxp_e1_framer_start(struct t1xxp *wc) -{ - int i; - char *coding, *framing; - unsigned long endjiffies; - int alreadyrunning = wc->span.flags & ZT_FLAG_RUNNING; - unsigned long flags; - char *crcing = ""; - unsigned char ccr1, tcr1, tcr2; - - spin_lock_irqsave(&wc->lock, flags); - - /* Build up config */ - ccr1 = 0; - tcr1 = 8; - tcr2 = 0; - if (wc->span.lineconfig & ZT_CONFIG_CCS) { - coding = "CCS"; /* Receive CCS */ - ccr1 |= 8; - } else { - tcr1 |= 0x20; - coding = "CAS"; - } - if (wc->span.lineconfig & ZT_CONFIG_HDB3) { - ccr1 |= 0x44; /* TX/RX HDB3 */ - framing = "HDB3"; - } else { - framing = "AMI"; - } - if (wc->span.lineconfig & ZT_CONFIG_CRC4) { - ccr1 |= 0x11; - tcr2 |= 0x02; - crcing = " with CRC4"; - } - __t1_set_reg(wc, 0x12, tcr1); - __t1_set_reg(wc, 0x13, tcr2); - __t1_set_reg(wc, 0x14, ccr1); - __t1_set_reg(wc, 0x18, 0x20); /* 120 Ohm */ - - -#if 0 /* XXX Does LBO Matter? XXX */ - /* Set outgoing LBO */ - __t1_set_reg(wc, 0x7c, wc->span.txlevel << 5); -#endif - - printk("Using %s/%s coding/framing%s 120 Ohms\n", coding, framing,crcing); - if (!alreadyrunning) { - - __t1_set_reg(wc,0x1b,0x8a); /* CCR3: LIRST & TSCLKM */ - __t1_set_reg(wc,0x20,0x1b); /* TAFR */ - __t1_set_reg(wc,0x21,0x5f); /* TNAFR */ - __t1_set_reg(wc,0x40,0xb); /* TSR1 */ - for(i = 0x41; i <= 0x4f; i++) __t1_set_reg(wc,i,0x55); - for(i = 0x22; i <= 0x25; i++) __t1_set_reg(wc,i,0xff); - spin_unlock_irqrestore(&wc->lock, flags); - - /* Wait 100ms to give plenty of time for reset */ - endjiffies = jiffies + 10; - while(endjiffies < jiffies); - - spin_lock_irqsave(&wc->lock, flags); - - __t1_set_reg(wc, 0x1b, 0x9a); /* Set ESR */ - __t1_set_reg(wc, 0x1b, 0x82); /* TSCLKM only now */ - - /* Reset LIRST bit and reset elastic stores */ - - wc->span.flags |= ZT_FLAG_RUNNING; - } - spin_unlock_irqrestore(&wc->lock, flags); -} - -static int t1xxp_framer_sanity_check(struct t1xxp *wc) -{ - int res; - int chipid; - unsigned long flags; - int x; - - /* Sanity check */ - spin_lock_irqsave(&wc->lock, flags); - for (x=0x0;x<192;x++) - __t1_set_reg(wc, x, 0); - res = __t1_get_reg(wc, 0x0f); - res = __t1_get_reg(wc, 0x0f); - chipid = ((res & 0x80) >> 5) | ((res & 0x30) >> 4); - wc->ise1 = (res & 0x80) ? (1 << 4) : 0; - spin_unlock_irqrestore(&wc->lock, flags); - - printk("Framer: %s, Revision: %d (%s)\n", chips[chipid], res & 0xf, wc->ise1 ? "E1" : "T1"); - return 0; -} - -static int t1xxp_framer_hard_reset(struct t1xxp *wc) -{ - int x; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - /* Initialize all registers to 0 */ - for (x=0x0;x<192;x++) - __t1_set_reg(wc, x, 0); - - if (wc->ise1) { - /* Set LOTCMC (switch to RCLCK if TCLK fails) */ - __t1_set_reg(wc, 0x1a, 0x04); - - /* RSYNC is an input */ - __t1_set_reg(wc, 0x10, 0x20); - - /* Rx elastic store enabled, 2.048 Mhz (in theory) */ - __t1_set_reg(wc, 0x11, 0x06); - - /* TSYNC is an input, Tsis mode */ - __t1_set_reg(wc, 0x12, 0x08); - - /* Tx elastic store enabled, 2.048 Mhz (in theory) */ - __t1_set_reg(wc, 0x1b, 0x82); - - - - } else { - /* Full-on sync required for T1 */ - __t1_set_reg(wc, 0x2b, 0x08); - /* RSYNC is an input */ - __t1_set_reg(wc, 0x2c, 0x08); - - /* Enable tx RBS bits */ - __t1_set_reg(wc, 0x35, 0x10); - - /* TSYNC is output */ - __t1_set_reg(wc, 0x36, 0x04); - - /* Tx and Rx elastic store enabled, 2.048 Mhz (in theory) */ - __t1_set_reg(wc, 0x37, 0x9c); - - /* Setup Loopup / Loopdown codes */ - __t1_set_reg(wc, 0x12, 0x22); - __t1_set_reg(wc, 0x14, 0x80); - __t1_set_reg(wc, 0x15, 0x80); - } - - spin_unlock_irqrestore(&wc->lock, flags); - return 0; -} - -static int t1xxp_rbsbits(struct zt_chan *chan, int bits) -{ - struct t1xxp *wc = chan->pvt; - unsigned long flags; - int b,o; - unsigned char mask; - - /* Byte offset */ - spin_lock_irqsave(&wc->lock, flags); - if (wc->ise1) { - if (chan->chanpos < 16) { - mask = ((bits << 4) | wc->chans[chan->chanpos - 1 + 16].txsig); - __t1_set_reg(wc, 0x40 + chan->chanpos, mask); - } - else if (chan->chanpos > 16) { - mask = (bits | (wc->chans[chan->chanpos - 1 - 16].txsig << 4)); - __t1_set_reg(wc, 0x40 + chan->chanpos - 16, mask); - } - wc->chans[chan->chanpos - 1].txsig = bits; - } else { - b = (chan->chanpos - 1) / 8; - o = (chan->chanpos - 1) % 8; - - mask = (1 << o); - - if (bits & ZT_ABIT) { - /* Set A-bit */ - wc->txsiga[b] |= mask; - } else { - /* Clear A-bit */ - wc->txsiga[b] &= ~mask; - } - if (bits & ZT_BBIT) { - /* Set B-bit */ - wc->txsigb[b] |= mask; - } else { - wc->txsigb[b] &= ~mask; - } - /* Output new values */ - __t1_set_reg(wc, 0x70 + b, wc->txsiga[b]); - __t1_set_reg(wc, 0x73 + b, wc->txsigb[b]); - __t1_set_reg(wc, 0x76 + b, wc->txsiga[b]); - __t1_set_reg(wc, 0x79 + b, wc->txsigb[b]); - } - spin_unlock_irqrestore(&wc->lock, flags); - return 0; -} - -static int t1xxp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - switch(cmd) { - default: - return -ENOTTY; - } -} - -static int t1xxp_startup(struct zt_span *span) -{ - struct t1xxp *wc = span->pvt; - - int i,alreadyrunning = span->flags & ZT_FLAG_RUNNING; - - /* initialize the start value for the entire chunk of last ec buffer */ - for(i = 0; i < span->channels; i++) - { - memset(wc->ec_chunk1[i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - memset(wc->ec_chunk2[i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - } - - /* Reset framer with proper parameters and start */ - if (wc->ise1) - t1xxp_e1_framer_start(wc); - else - t1xxp_t1_framer_start(wc); - printk("Calling startup (flags is %d)\n", span->flags); - - if (!alreadyrunning) { - /* Only if we're not already going */ - t1xxp_enable_interrupts(wc); - t1xxp_start_dma(wc); - span->flags |= ZT_FLAG_RUNNING; - } - return 0; -} - -static int t1xxp_shutdown(struct zt_span *span) -{ - struct t1xxp *wc = span->pvt; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - __t1xxp_stop_dma(wc); - __t1xxp_disable_interrupts(wc); - span->flags &= ~ZT_FLAG_RUNNING; - spin_unlock_irqrestore(&wc->lock, flags); - - t1xxp_framer_hard_reset(wc); - return 0; -} - -static int t1xxp_maint(struct zt_span *span, int cmd) -{ - struct t1xxp *wc = span->pvt; - int res = 0; - unsigned long flags; - spin_lock_irqsave(&wc->lock, flags); - if (wc->ise1) { - switch(cmd) { - case ZT_MAINT_NONE: - __t1_set_reg(wc,0xa8,0); /* no loops */ - break; - case ZT_MAINT_LOCALLOOP: - __t1_set_reg(wc,0xa8,0x40); /* local loop */ - break; - case ZT_MAINT_REMOTELOOP: - __t1_set_reg(wc,0xa8,0x80); /* remote loop */ - break; - case ZT_MAINT_LOOPUP: - case ZT_MAINT_LOOPDOWN: - case ZT_MAINT_LOOPSTOP: - res = -ENOSYS; - break; - default: - printk("wct1xxp/E1: Unknown maint command: %d\n", cmd); - res = -EINVAL; - break; - } - } else { - switch(cmd) { - case ZT_MAINT_NONE: - __t1_set_reg(wc,0x19,0); /* no local loop */ - __t1_set_reg(wc,0x0a,0); /* no remote loop */ - break; - case ZT_MAINT_LOCALLOOP: - __t1_set_reg(wc,0x19,0x40); /* local loop */ - __t1_set_reg(wc,0x0a,0); /* no remote loop */ - break; - case ZT_MAINT_REMOTELOOP: - __t1_set_reg(wc,0x1e,0); /* no local loop */ - __t1_set_reg(wc,0x0a,0x40); /* remote loop */ - break; - case ZT_MAINT_LOOPUP: - __t1_set_reg(wc,0x30,2); /* send loopup code */ - __t1_set_reg(wc,0x12,0x22); /* send loopup code */ - __t1_set_reg(wc,0x13,0x80); /* send loopup code */ - break; - case ZT_MAINT_LOOPDOWN: - __t1_set_reg(wc,0x30,2); /* send loopdown code */ - __t1_set_reg(wc,0x12,0x62); /* send loopdown code */ - __t1_set_reg(wc,0x13,0x90); /* send loopdown code */ - break; - case ZT_MAINT_LOOPSTOP: - __t1_set_reg(wc,0x30,0); /* stop sending loopup code */ - break; - default: - printk("wct1xxp/T1: Unknown maint command: %d\n", cmd); - res = -EINVAL; - } - } - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static int t1xxp_chanconfig(struct zt_chan *chan, int sigtype) -{ - struct t1xxp *wc = chan->pvt; - unsigned long flags; - int alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING; - - spin_lock_irqsave(&wc->lock, flags); - - if (alreadyrunning && !wc->ise1) - __t1xxp_set_clear(wc); - - spin_unlock_irqrestore(&wc->lock, flags); - return 0; -} - -static int t1xxp_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - struct t1xxp *wc = span->pvt; - - /* Do we want to SYNC on receive or not */ - wc->sync = lc->sync; - /* If already running, apply changes immediately */ - if (span->flags & ZT_FLAG_RUNNING) - return t1xxp_startup(span); - - return 0; -} -static int t1xxp_software_init(struct t1xxp *wc) -{ - int x; - /* Find position */ - for (x=0;x= WC_MAX_CARDS) - return -1; - 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"; - zap_copy_string(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.spanconfig = t1xxp_spanconfig; - wc->span.chanconfig = t1xxp_chanconfig; - wc->span.irq = wc->dev->irq; - wc->span.startup = t1xxp_startup; - wc->span.shutdown = t1xxp_shutdown; - wc->span.rbsbits = t1xxp_rbsbits; - wc->span.maint = t1xxp_maint; - wc->span.open = t1xxp_open; - wc->span.close = t1xxp_close; - wc->span.chans = wc->chans; - wc->span.flags = ZT_FLAG_RBS; - wc->span.ioctl = t1xxp_ioctl; - wc->span.pvt = wc; - if (wc->ise1) { - wc->span.channels = 31; - wc->span.deflaw = ZT_LAW_ALAW; - wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4; - wc->span.spantype = "E1"; - } else { - wc->span.channels = 24; - wc->span.deflaw = ZT_LAW_MULAW; - wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF; - wc->span.spantype = "T1"; - } - init_waitqueue_head(&wc->span.maintq); - for (x=0;xspan.channels;x++) { - sprintf(wc->chans[x].name, "WCT1/%d/%d", wc->num, x + 1); - wc->chans[x].sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_EM_E1 | - ZT_SIG_FXSLS | ZT_SIG_FXSGS | - ZT_SIG_FXSKS | ZT_SIG_FXOLS | ZT_SIG_DACS_RBS | - ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_SF; - wc->chans[x].pvt = wc; - wc->chans[x].chanpos = x + 1; - } - if (zt_register(&wc->span, 0)) { - printk("Unable to register span with zaptel\n"); - return -1; - } - return 0; -} - -static inline void __handle_leds(struct t1xxp *wc) -{ - int oldreg; - wc->blinktimer++; - - if (wc->span.alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE)) { - /* Red/Blue alarm */ -#ifdef FANCY_ALARM - if (wc->blinktimer == (altab[wc->alarmpos] >> 1)) { - wc->ledtestreg = (wc->ledtestreg | BIT_LED1) & ~BIT_LED0; - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } - if (wc->blinktimer == 0xf) { - wc->ledtestreg = wc->ledtestreg & ~(BIT_LED0 | BIT_LED1); - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - wc->blinktimer = -1; - wc->alarmpos++; - if (wc->alarmpos >= (sizeof(altab) / sizeof(altab[0]))) - wc->alarmpos = 0; - } -#else - if (wc->blinktimer == 160) { - wc->ledtestreg = (wc->ledtestreg | BIT_LED1) & ~BIT_LED0; - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } else if (wc->blinktimer == 480) { - wc->ledtestreg = wc->ledtestreg & ~(BIT_LED0 | BIT_LED1); - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - wc->blinktimer = 0; - } -#endif - } else if (wc->span.alarms & ZT_ALARM_YELLOW) { - /* Yellow Alarm */ - if (!(wc->blinktimer % 2)) - wc->ledtestreg = (wc->ledtestreg | BIT_LED1) & ~BIT_LED0; - else - wc->ledtestreg = (wc->ledtestreg | BIT_LED0) & ~BIT_LED1; - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } else { - /* No Alarm */ - oldreg = wc->ledtestreg; - if (wc->span.maintstat != ZT_MAINT_NONE) - wc->ledtestreg |= BIT_TEST; - else - wc->ledtestreg &= ~BIT_TEST; - if (wc->span.flags & ZT_FLAG_RUNNING) - wc->ledtestreg = (wc->ledtestreg | BIT_LED0) & ~BIT_LED1; - else - wc->ledtestreg = wc->ledtestreg & ~(BIT_LED0 | BIT_LED1); - if (oldreg != wc->ledtestreg) - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } -} - -static void t1xxp_transmitprep(struct t1xxp *wc, int ints) -{ - volatile unsigned char *txbuf; - int x,y; - int pos; - if (ints & 0x04 /* 0x01 */) { - /* We just finished sending the first buffer, start filling it - now */ - txbuf = wc->writechunk; - } else { - /* Just finished sending second buffer, fill it now */ - txbuf = wc->writechunk + 32 * ZT_CHUNKSIZE; - } - zt_transmit(&wc->span); - for (x=0;xoffset;x++) - txbuf[x] = wc->tempo[x]; - for (y=0;yspan.channels;x++) { - pos = y * 32 + wc->chanmap[x] + wc->offset; - /* Put channel number as outgoing data */ - if (pos < 32 * ZT_CHUNKSIZE) - txbuf[pos] = wc->chans[x].writechunk[y]; - else - wc->tempo[pos - 32 * ZT_CHUNKSIZE] = wc->chans[x].writechunk[y]; - } - } -} - -static void t1xxp_receiveprep(struct t1xxp *wc, int ints) -{ - volatile unsigned char *rxbuf; - volatile unsigned int *canary; - int x; - int y; - unsigned int oldcan; - if (ints & 0x04) { - /* Just received first buffer */ - rxbuf = wc->readchunk; - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 64 - 4); - } else { - rxbuf = wc->readchunk + ZT_CHUNKSIZE * 32; - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 32 - 4); - } - oldcan = *canary; - if (((oldcan & 0xffff0000) >> 16) != CANARY) { - /* Check top part */ - if (debug) printk("Expecting top %04x, got %04x\n", CANARY, (oldcan & 0xffff0000) >> 16); - wc->span.irqmisses++; - } else if ((oldcan & 0xffff) != ((wc->canary - 1) & 0xffff)) { - if (debug) printk("Expecting bottom %d, got %d\n", wc->canary - 1, oldcan & 0xffff); - wc->span.irqmisses++; - } - for (y=0;yspan.channels;x++) { - /* XXX Optimize, remove * and + XXX */ - /* Must map received channels into appropriate data */ - wc->chans[x].readchunk[y] = - rxbuf[32 * y + ((wc->chanmap[x] + WC_OFFSET + wc->offset) & 0x1f)]; - } - if (!wc->ise1) { - for (x=3;x<32;x+=4) { - if (rxbuf[32 * y + ((x + WC_OFFSET) & 0x1f)] == 0x7f) { - if (wc->offset != (x-3)) { - /* Resync */ - control_set_reg(wc, WC_CLOCK, 0x02 | wc->sync | wc->ise1); - wc->clocktimeout = 100; -#if 1 - if (debug) printk("T1: Lost our place, resyncing\n"); -#endif - } - } - } - } else { - if (!wc->clocktimeout && !wc->span.alarms) { - if ((rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)] & 0x7f) != 0x1b) { - if (wc->miss) { - if (debug) printk("Double miss (%d, %d)...\n", wc->misslast, rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)]); - control_set_reg(wc, WC_CLOCK, 0x02 | wc->sync | wc->ise1); - wc->clocktimeout = 100; - } else { - wc->miss = 1; - wc->misslast = rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)]; - } - } else { - wc->miss = 0; - } - } else { - wc->miss = 0; - } - } - } - /* Store the next canary */ - canary = (unsigned int *)(rxbuf + ZT_CHUNKSIZE * 32 - 4); - *canary = (wc->canary++) | (CANARY << 16); - for (x=0;xspan.channels;x++) { - zt_ec_chunk(&wc->chans[x], wc->chans[x].readchunk, - wc->ec_chunk2[x]); - memcpy(wc->ec_chunk2[x],wc->ec_chunk1[x],ZT_CHUNKSIZE); - memcpy(wc->ec_chunk1[x],wc->chans[x].writechunk,ZT_CHUNKSIZE); - } - zt_receive(&wc->span); -} - -static void t1xxp_check_sigbits(struct t1xxp *wc, int x) -{ - int a,b,i,y,rxs; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - if (wc->ise1) { - /* Read 5 registers at a time, loading 10 channels at a time */ - for (i = (x * 5); i < (x * 5) + 5; i++) { - a = __t1_get_reg(wc, 0x31 + i); - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(wc->chans[i+16].sig & ZT_SIG_CLEAR)) { - if (wc->chans[i+16].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->chans[i+16], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - rxs = (a >> 4) & 0xf; - if (!(wc->chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->chans[i].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->chans[i], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - } - } else { - a = __t1_get_reg(wc, 0x60 + x); - b = __t1_get_reg(wc, 0x63 + x); - for (y=0;y<8;y++) { - i = x * 8 + y; - rxs = 0; - if (a & (1 << y)) - rxs |= ZT_ABIT; - if (b & (1 << y)) - rxs |= ZT_BBIT; - if (!(wc->chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->chans[i].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->chans[i], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - } - } - spin_unlock_irqrestore(&wc->lock, flags); -} - -static void t1xxp_check_alarms(struct t1xxp *wc) -{ - unsigned char c,d; - int alarms; - int x,j; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - - if (wc->ise1) { - __t1_set_reg(wc, 0x06, 0xff); - c = __t1_get_reg(wc, 0x6); - } else { - /* Get RIR2 */ - c = __t1_get_reg(wc, 0x31); - wc->span.rxlevel = c >> 6; - - /* Get status register s*/ - __t1_set_reg(wc, 0x20, 0xff); - c = __t1_get_reg(wc, 0x20); - } - - /* Assume no alarms */ - alarms = 0; - - /* And consider only carrier alarms */ - wc->span.alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); - - if (wc->ise1) { - /* XXX Implement me XXX */ - } else { - /* Detect loopup code if we're not sending one */ - if ((!wc->span.mainttimer) && (c & 0x80)) { - /* Loop-up code detected */ - if ((wc->loopupcnt++ > 80) && (wc->span.maintstat != ZT_MAINT_REMOTELOOP)) { - __t1_set_reg(wc, 0x1e, 0); /* No local loop */ - __t1_set_reg(wc, 0x0a, 0x40); /* Remote Loop */ - wc->span.maintstat = ZT_MAINT_REMOTELOOP; - } - } else { - wc->loopupcnt = 0; - } - /* Same for loopdown code */ - if ((!wc->span.mainttimer) && (c & 0x40)) { - /* Loop-down code detected */ - if ((wc->loopdowncnt++ > 80) && (wc->span.maintstat == ZT_MAINT_REMOTELOOP)) { - __t1_set_reg(wc, 0x1e, 0); /* No local loop */ - __t1_set_reg(wc, 0x0a, 0x0); /* No remote Loop */ - wc->span.maintstat = ZT_MAINT_NONE; - } - } else - wc->loopdowncnt = 0; - } - - if (wc->span.lineconfig & ZT_CONFIG_NOTOPEN) { - for (x=0,j=0;x < wc->span.channels;x++) - if ((wc->chans[x].flags & ZT_FLAG_OPEN) || - (wc->chans[x].flags & ZT_FLAG_NETDEV)) - j++; - if (!j) - alarms |= ZT_ALARM_NOTOPEN; - } - - if (wc->ise1) { - if (c & 0x9) - alarms |= ZT_ALARM_RED; - if (c & 0x2) - alarms |= ZT_ALARM_BLUE; - } else { - /* Check actual alarm status */ - if (c & 0x3) - alarms |= ZT_ALARM_RED; - if (c & 0x8) - alarms |= ZT_ALARM_BLUE; - } - /* Keep track of recovering */ - if ((!alarms) && wc->span.alarms) - wc->alarmtimer = ZT_ALARMSETTLE_TIME; - - /* If receiving alarms, go into Yellow alarm state */ - if (alarms && (!wc->span.alarms)) { -#if 0 - printk("Going into yellow alarm\n"); -#endif - if (wc->ise1) - __t1_set_reg(wc, 0x21, 0x7f); - else - __t1_set_reg(wc, 0x35, 0x11); - } - - if (wc->span.alarms != alarms) { - d = __control_get_reg(wc, WC_CLOCK); - start_alarm(wc); - if (!(alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_LOOPBACK)) && - wc->sync) { - /* Use the recieve signalling */ - wc->span.syncsrc = wc->span.spanno; - d |= 1; - } else { - wc->span.syncsrc = 0; - d &= ~1; - } - __control_set_reg(wc, WC_CLOCK, d); - } - if (wc->alarmtimer) - alarms |= ZT_ALARM_RECOVER; - if (c & 0x4) - alarms |= ZT_ALARM_YELLOW; - - wc->span.alarms = alarms; - - spin_unlock_irqrestore(&wc->lock, flags); - - zt_alarm_notify(&wc->span); -} - -static void t1xxp_do_counters(struct t1xxp *wc) -{ - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - if (wc->alarmtimer) { - if (!--wc->alarmtimer) { - wc->span.alarms &= ~(ZT_ALARM_RECOVER); - /* Clear yellow alarm */ -#if 0 - printk("Coming out of alarm\n"); -#endif - if (wc->ise1) - __t1_set_reg(wc, 0x21, 0x5f); - else - __t1_set_reg(wc, 0x35, 0x10); - spin_unlock_irqrestore(&wc->lock, flags); - zt_alarm_notify(&wc->span); - spin_lock_irqsave(&wc->lock, flags); - } - } - spin_unlock_irqrestore(&wc->lock, flags); -} - -ZAP_IRQ_HANDLER(t1xxp_interrupt) -{ - struct t1xxp *wc = dev_id; - unsigned char ints; - unsigned long flags; - int x; - - ints = inb(wc->ioaddr + WC_INTSTAT); - if (!ints) -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - - outb(ints, wc->ioaddr + WC_INTSTAT); - - if (!wc->intcount) { - if (debug) printk("Got interrupt: 0x%04x\n", ints); - } - wc->intcount++; - - if (wc->clocktimeout && !--wc->clocktimeout) - control_set_reg(wc, WC_CLOCK, 0x00 | wc->sync | wc->ise1); - - if (ints & 0x0f) { - t1xxp_receiveprep(wc, ints); - t1xxp_transmitprep(wc, ints); - } - spin_lock_irqsave(&wc->lock, flags); - -#if 1 - __handle_leds(wc); -#endif - - spin_unlock_irqrestore(&wc->lock, flags); - - /* Count down timers */ - t1xxp_do_counters(wc); - - /* Do some things that we don't have to do very often */ - x = wc->intcount & 15 /* 63 */; - switch(x) { - case 0: - case 1: - case 2: - t1xxp_check_sigbits(wc, x); - break; - case 4: - /* Check alarms 1/4 as frequently */ - if (!(wc->intcount & 0x30)) - t1xxp_check_alarms(wc); - break; - } - - if (ints & 0x10) - printk("PCI Master abort\n"); - - if (ints & 0x20) - printk("PCI Target abort\n"); - -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} - -static int t1xxp_hardware_init(struct t1xxp *wc) -{ - /* Hardware PCI stuff */ - /* Reset chip and registers */ - outb(DELAY | 0x0e, wc->ioaddr + WC_CNTL); - /* Set all outputs to 0 */ - outb(0x00, wc->ioaddr + WC_AUXD); - /* Set all to outputs except AUX1 (TDO). */ - outb(0xfd, wc->ioaddr + WC_AUXC); - /* Configure the serial port: double clock, 20ns width, no inversion, - MSB first */ - outb(0xc8, wc->ioaddr + WC_SERC); - - /* Internally delay FSC by one */ - outb(0x01, wc->ioaddr + WC_FSCDELAY); - - /* Back to normal, with automatic DMA wrap around */ - outb(DELAY | 0x01, wc->ioaddr + WC_CNTL); - - /* Make sure serial port and DMA are out of reset */ - outb(inb(wc->ioaddr + WC_CNTL) & 0xf9, WC_CNTL); - - /* Setup DMA Addresses */ - /* Start at writedma */ - outl(wc->writedma, wc->ioaddr + WC_DMAWS); /* Write start */ - /* First frame */ - outl(wc->writedma + ZT_CHUNKSIZE * 32 - 4, wc->ioaddr + WC_DMAWI); /* Middle (interrupt) */ - /* Second frame */ - outl(wc->writedma + ZT_CHUNKSIZE * 32 * 2 - 4, wc->ioaddr + WC_DMAWE); /* End */ - - outl(wc->readdma, wc->ioaddr + WC_DMARS); /* Read start */ - /* First frame */ - outl(wc->readdma + ZT_CHUNKSIZE * 32 - 4, wc->ioaddr + WC_DMARI); /* Middle (interrupt) */ - /* Second frame */ - outl(wc->readdma + ZT_CHUNKSIZE * 32 * 2 - 4, wc->ioaddr + WC_DMARE); /* End */ - - if (debug) printk("Setting up DMA (write/read = %08lx/%08lx)\n", (long)wc->writedma, (long)wc->readdma); - - /* Check out the controller */ - if (debug) printk("Controller version: %02x\n", control_get_reg(wc, WC_VERSION)); - - - control_set_reg(wc, WC_LEDTEST, 0x00); - - /* Sanity check also determines e1 or t1 */ - if (t1xxp_framer_sanity_check(wc)) - return -1; - if (wc->ise1) - wc->chanmap = chanmap_e1; - else - wc->chanmap = chanmap_t1; - /* Setup clock appropriately */ - control_set_reg(wc, WC_CLOCK, 0x02 | wc->sync | wc->ise1); - wc->clocktimeout = 100; - - /* Reset the T1 and report */ - t1xxp_framer_hard_reset(wc); - start_alarm(wc); - return 0; - -} - -static int __devinit t1xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res; - struct t1xxp *wc; - unsigned int *canary; - - if (pci_enable_device(pdev)) { - res = -EIO; - } else { - wc = kmalloc(sizeof(struct t1xxp), GFP_KERNEL); - if (wc) { - memset(wc, 0x0, sizeof(struct t1xxp)); - spin_lock_init(&wc->lock); - wc->ioaddr = pci_resource_start(pdev, 0); - wc->dev = pdev; - wc->offset = 28; /* And you thought 42 was the answer */ - - wc->writechunk = - /* 32 channels, Double-buffer, Read/Write */ - (unsigned char *)pci_alloc_consistent(pdev, ZT_MAX_CHUNKSIZE * 32 * 2 * 2, &wc->writedma); - if (!wc->writechunk) { - printk("wct1xxp: Unable to allocate DMA-able memory\n"); - return -ENOMEM; - } - - /* Read is after the whole write piece (in bytes) */ - wc->readchunk = wc->writechunk + ZT_CHUNKSIZE * 32 * 2; - - /* Same thing... */ - wc->readdma = wc->writedma + ZT_CHUNKSIZE * 32 * 2; - - /* Initialize Write/Buffers to all blank data */ - memset((void *)wc->writechunk,0x00,ZT_MAX_CHUNKSIZE * 2 * 2 * 32); - /* Initialize canary */ - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 64 - 4); - *canary = (CANARY << 16) | (0xffff); - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - - if (request_irq(pdev->irq, t1xxp_interrupt, ZAP_IRQ_SHARED_DISABLED, "t1xxp", wc)) { - printk("t1xxp: Unable to request IRQ %d\n", pdev->irq); - kfree(wc); - return -EIO; - } - /* Initialize hardware */ - t1xxp_hardware_init(wc); - - /* We now know which version of card we have */ - if (wc->ise1) - wc->variety = "Digium Wildcard E100P E1/PRA"; - else - wc->variety = "Digium Wildcard T100P T1/PRI"; - - /* Misc. software stuff */ - t1xxp_software_init(wc); - - printk("Found a Wildcard: %s\n", wc->variety); - res = 0; - } else - res = -ENOMEM; - } - return res; -} - -static void t1xxp_stop_stuff(struct t1xxp *wc) -{ - /* Kill clock */ - control_set_reg(wc, WC_CLOCK, 0); - - /* Turn off LED's */ - control_set_reg(wc, WC_LEDTEST, 0); - - /* Reset the T1 */ - t1xxp_framer_hard_reset(wc); - -} - -static void __devexit t1xxp_remove_one(struct pci_dev *pdev) -{ - struct t1xxp *wc = pci_get_drvdata(pdev); - if (wc) { - - /* Stop any DMA */ - __t1xxp_stop_dma(wc); - - /* In case hardware is still there */ - __t1xxp_disable_interrupts(wc); - - t1xxp_stop_stuff(wc); - - /* Immediately free resources */ - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 32 * 4, (void *)wc->writechunk, wc->writedma); - free_irq(pdev->irq, wc); - - /* Reset PCI chip and registers */ - outb(DELAY | 0x0e, wc->ioaddr + WC_CNTL); - - /* Release span, possibly delayed */ - if (!wc->usecount) - t1xxp_release(wc); - else - wc->dead = 1; - } -} - -static struct pci_device_id t1xxp_pci_tbl[] = { - { 0xe159, 0x0001, 0x6159, PCI_ANY_ID, 0, 0, (unsigned long) "Digium Wildcard T100P T1/PRI or E100P E1/PRA Board" }, - { 0 } -}; - -MODULE_DEVICE_TABLE(pci,t1xxp_pci_tbl); - -static struct pci_driver t1xxp_driver = { - name: "t1xxp", - probe: t1xxp_init_one, -#ifdef LINUX26 - remove: __devexit_p(t1xxp_remove_one), -#else - remove: t1xxp_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: t1xxp_pci_tbl, -}; - -static int __init t1xxp_init(void) -{ - int res; - res = zap_pci_module(&t1xxp_driver); - if (res) - return -ENODEV; - return 0; -} - -static void __exit t1xxp_cleanup(void) -{ - pci_unregister_driver(&t1xxp_driver); -} - -#ifdef LINUX26 -module_param(debug, int, 0600); -#else -MODULE_PARM(debug, "i"); -#endif -MODULE_DESCRIPTION("Wildcard T100P/E100P Zaptel Driver"); -MODULE_AUTHOR("Mark Spencer "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(t1xxp_init); -module_exit(t1xxp_cleanup); diff --git a/zaptel/kernel/wct4xxp/Kbuild b/zaptel/kernel/wct4xxp/Kbuild deleted file mode 100644 index 96909f42..00000000 --- a/zaptel/kernel/wct4xxp/Kbuild +++ /dev/null @@ -1,27 +0,0 @@ -obj-m += wct4xxp.o - -FIRM_DIR := ../../firmware - -EXTRA_CFLAGS := -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef - -ifeq ($(HOTPLUG_FIRMWARE),yes) - EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE -endif - -wct4xxp-objs := base.o vpm450m.o $(shell $(src)/../oct612x/octasic-helper objects ../oct612x) - -ifneq ($(HOTPLUG_FIRMWARE),yes) -wct4xxp-objs += $(FIRM_DIR)/zaptel-fw-oct6114-064.o $(FIRM_DIR)/zaptel-fw-oct6114-128.o -endif - -$(obj)/$(FIRM_DIR)/zaptel-fw-oct6114-064.o: $(obj)/base.o - $(MAKE) -C $(obj)/$(FIRM_DIR) zaptel-fw-oct6114-064.o - -$(obj)/$(FIRM_DIR)/zaptel-fw-oct6114-128.o: $(obj)/base.o - $(MAKE) -C $(obj)/$(FIRM_DIR) zaptel-fw-oct6114-128.o - -$(obj)/base.o: $(src)/vpm450m.h $(src)/wct4xxp.h -$(obj)/base.o: $(src)/../zaptel.h - -$(obj)/vpm450m.o: $(src)/vpm450m.h -$(obj)/vpm450m.o: $(src)/../oct612x/include/oct6100api/oct6100_api.h diff --git a/zaptel/kernel/wct4xxp/Makefile b/zaptel/kernel/wct4xxp/Makefile deleted file mode 100644 index 4f0961e3..00000000 --- a/zaptel/kernel/wct4xxp/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -ifneq ($(KBUILD_EXTMOD),) -# We only get here on kernels 2.6.0-2.6.9 . -# For newer kernels, Kbuild will be included directly by the kernel -# build system. -include $(src)/Kbuild - -else - -FIRM_DIR := ../../firmware - -OCTASIC_OBJS:=$(shell ../oct612x/octasic-helper objects ../oct612x) -OCTASIC_CFLAGS:=$(shell ../oct612x/octasic-helper cflags ../oct612x) -Wno-undef - -all: wct4xxp.o - -%.o: %.c - $(CC) $(KFLAGS) $(OCTASIC_CFLAGS) -o $@ -c $< - -base.o: ../zaptel.h vpm450m.h wct4xxp.h - -vpm450m.o: vpm450m.h ../oct612x/include/oct6100api/oct6100_api.h - -$(FIRM_DIR)/zaptel-fw-oct6114-064.o: base.o - $(MAKE) -C $(FIRM_DIR) zaptel-fw-oct6114-064.o - -$(FIRM_DIR)/zaptel-fw-oct6114-128.o: base.o - $(MAKE) -C $(FIRM_DIR) zaptel-fw-oct6114-128.o - -wct4xxp.o: base.o vpm450m.o $(OCTASIC_OBJS) $(FIRM_DIR)/zaptel-fw-oct6114-064.o $(FIRM_DIR)/zaptel-fw-oct6114-128.o - $(LD) -r -o $@ $^ - -clean: - rm -f *.o - rm -f $(OCTASIC_OBJS) - -endif diff --git a/zaptel/kernel/wct4xxp/base.c b/zaptel/kernel/wct4xxp/base.c deleted file mode 100644 index e9bc1c29..00000000 --- a/zaptel/kernel/wct4xxp/base.c +++ /dev/null @@ -1,3878 +0,0 @@ -/* - * TE410P Quad-T1/E1 PCI Driver version 0.1, 12/16/02 - * - * Written by Mark Spencer - * Based on previous works, designs, and archetectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001-2005, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "zaptel.h" -#ifdef LINUX26 -#include -#endif - -#include "wct4xxp.h" -#include "vpm450m.h" - -/* Work queues are a way to better distribute load on SMP systems */ -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -/* - * Work queues can significantly improve performance and scalability - * on multi-processor machines, but requires bypassing some kernel - * API's, so it's not guaranteed to be compatible with all kernels. - */ -/* #define ENABLE_WORKQUEUES */ -#endif - -/* Enable prefetching may help performance */ -#define ENABLE_PREFETCH - -/* Support first generation cards? */ -#define SUPPORT_GEN1 - -/* Define to get more attention-grabbing but slightly more I/O using - alarm status */ -#define FANCY_ALARM - -/* Define to support Digium Voice Processing Module expansion card */ -#define VPM_SUPPORT - -#define DEBUG_MAIN (1 << 0) -#define DEBUG_DTMF (1 << 1) -#define DEBUG_REGS (1 << 2) -#define DEBUG_TSI (1 << 3) -#define DEBUG_ECHOCAN (1 << 4) -#define DEBUG_RBS (1 << 5) -#define DEBUG_FRAMER (1 << 6) - -#ifdef ENABLE_WORKQUEUES -#include - -/* XXX UGLY!!!! XXX We have to access the direct structures of the workqueue which - are only defined within workqueue.c because they don't give us a routine to allow us - to nail a work to a particular thread of the CPU. Nailing to threads gives us substantially - higher scalability in multi-CPU environments though! */ - -/* - * The per-CPU workqueue (if single thread, we always use cpu 0's). - * - * The sequence counters are for flush_scheduled_work(). It wants to wait - * until until all currently-scheduled works are completed, but it doesn't - * want to be livelocked by new, incoming ones. So it waits until - * remove_sequence is >= the insert_sequence which pertained when - * flush_scheduled_work() was called. - */ - -struct cpu_workqueue_struct { - - spinlock_t lock; - - long remove_sequence; /* Least-recently added (next to run) */ - long insert_sequence; /* Next to add */ - - struct list_head worklist; - wait_queue_head_t more_work; - wait_queue_head_t work_done; - - struct workqueue_struct *wq; - task_t *thread; - - int run_depth; /* Detect run_workqueue() recursion depth */ -} ____cacheline_aligned; - -/* - * The externally visible workqueue abstraction is an array of - * per-CPU workqueues: - */ -struct workqueue_struct { - /* TODO: Find out exactly where the API changed */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) - struct cpu_workqueue_struct *cpu_wq; -#else - struct cpu_workqueue_struct cpu_wq[NR_CPUS]; -#endif - const char *name; - struct list_head list; /* Empty if single thread */ -}; - -/* Preempt must be disabled. */ -static void __t4_queue_work(struct cpu_workqueue_struct *cwq, - struct work_struct *work) -{ - unsigned long flags; - - spin_lock_irqsave(&cwq->lock, flags); - work->wq_data = cwq; - list_add_tail(&work->entry, &cwq->worklist); - cwq->insert_sequence++; - wake_up(&cwq->more_work); - spin_unlock_irqrestore(&cwq->lock, flags); -} - -/* - * Queue work on a workqueue. Return non-zero if it was successfully - * added. - * - * We queue the work to the CPU it was submitted, but there is no - * guarantee that it will be processed by that CPU. - */ -static inline int t4_queue_work(struct workqueue_struct *wq, struct work_struct *work, int cpu) -{ - int ret = 0; - get_cpu(); - if (!test_and_set_bit(0, &work->pending)) { - BUG_ON(!list_empty(&work->entry)); - __t4_queue_work(wq->cpu_wq + cpu, work); - ret = 1; - } - put_cpu(); - return ret; -} - -#endif - -static int pedanticpci = 1; -static int debug=0; -static int timingcable = 0; -static int highestorder; -static int t1e1override = -1; //0xFF; // -1 = jumper; 0xFF = E1 -static int j1mode = 0; -static int sigmode = FRMR_MODE_NO_ADDR_CMP; -static int loopback = 0; -static int alarmdebounce = 0; -#ifdef VPM_SUPPORT -static int vpmsupport = 1; -/* If set to auto, vpmdtmfsupport is enabled for VPM400M and disabled for VPM450M */ -static int vpmdtmfsupport = -1; /* -1=auto, 0=disabled, 1=enabled*/ -static int vpmspans = 4; -#define VPM_DEFAULT_DTMFTHRESHOLD 1000 -static int dtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD; -static int lastdtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD; -#endif -/* Enabling bursting can more efficiently utilize PCI bus bandwidth, but - can also cause PCI bus starvation, especially in combination with other - aggressive cards. Please note that burst mode has no effect on CPU - utilization / max number of calls / etc. */ -static int noburst = 1; -/* For 56kbps links, set this module parameter to 0x7f */ -static int hardhdlcmode = 0xff; - -#ifdef FANCY_ALARM -static int altab[] = { -0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24, 25, 27, 28, 29, 30, 31, 31, 32, 31, 31, 30, 29, 28, 27, 25, 23, 22, 20, 18, 16, 13, 11, 9, 8, 6, 4, 3, 2, 1, 0, 0, -}; -#endif - -#define MAX_SPANS 16 - -#define FLAG_STARTED (1 << 0) -#define FLAG_NMF (1 << 1) -#define FLAG_SENDINGYELLOW (1 << 2) - - -#define TYPE_T1 1 /* is a T1 card */ -#define TYPE_E1 2 /* is an E1 card */ -#define TYPE_J1 3 /* is a running J1 */ - -#define FLAG_2NDGEN (1 << 3) -#define FLAG_2PORT (1 << 4) -#define FLAG_VPM2GEN (1 << 5) -#define FLAG_OCTOPT (1 << 6) -#define FLAG_3RDGEN (1 << 7) -#define FLAG_BURST (1 << 8) -#define FLAG_EXPRESS (1 << 9) - -#define CANARY 0xc0de - -struct devtype { - char *desc; - unsigned int flags; -}; - -static struct devtype wct4xxp = { "Wildcard TE410P/TE405P (1st Gen)", 0 }; -static struct devtype wct420p4 = { "Wildcard TE420 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_EXPRESS }; -static struct devtype wct410p4 = { "Wildcard TE410P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN }; -static struct devtype wct410p3 = { "Wildcard TE410P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN }; -static struct devtype wct405p4 = { "Wildcard TE405P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN }; -static struct devtype wct405p3 = { "Wildcard TE405P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN }; -static struct devtype wct410p2 = { "Wildcard TE410P (2nd Gen)", FLAG_2NDGEN }; -static struct devtype wct405p2 = { "Wildcard TE405P (2nd Gen)", FLAG_2NDGEN }; -static struct devtype wct220p4 = { "Wildcard TE220 (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT | FLAG_EXPRESS }; -static struct devtype wct205p4 = { "Wildcard TE205P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT }; -static struct devtype wct205p3 = { "Wildcard TE205P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT }; -static struct devtype wct210p4 = { "Wildcard TE210P (4th Gen)", FLAG_BURST | FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT }; -static struct devtype wct210p3 = { "Wildcard TE210P (3rd Gen)", FLAG_2NDGEN | FLAG_3RDGEN | FLAG_2PORT }; -static struct devtype wct205 = { "Wildcard TE205P ", FLAG_2NDGEN | FLAG_2PORT }; -static struct devtype wct210 = { "Wildcard TE210P ", FLAG_2NDGEN | FLAG_2PORT }; - - -struct t4; - -struct t4_span { - struct t4 *owner; - unsigned int *writechunk; /* Double-word aligned write memory */ - unsigned int *readchunk; /* Double-word aligned read memory */ - int spantype; /* card type, T1 or E1 or J1 */ - int sync; - int psync; - int alarmtimer; - int redalarms; - int notclear; - int alarmcount; - int spanflags; - int syncpos; -#ifdef SUPPORT_GEN1 - int e1check; /* E1 check */ -#endif - struct zt_span span; - unsigned char txsigs[16]; /* Transmit sigs */ - int loopupcnt; - int loopdowncnt; -#ifdef SUPPORT_GEN1 - unsigned char ec_chunk1[31][ZT_CHUNKSIZE]; /* first EC chunk buffer */ - unsigned char ec_chunk2[31][ZT_CHUNKSIZE]; /* second EC chunk buffer */ -#endif - int irqmisses; - - /* HDLC controller fields */ - struct zt_chan *sigchan; - unsigned char sigmode; - int sigactive; - int frames_out; - int frames_in; - -#ifdef VPM_SUPPORT - unsigned long dtmfactive; - unsigned long dtmfmask; - unsigned long dtmfmutemask; - short dtmfenergy[31]; - short dtmfdigit[31]; -#endif -#ifdef ENABLE_WORKQUEUES - struct work_struct swork; -#endif - struct zt_chan chans[0]; /* Individual channels */ -}; - -struct t4 { - /* This structure exists one per card */ - struct pci_dev *dev; /* Pointer to PCI device */ - unsigned int intcount; - int num; /* Which card we are */ - int t1e1; /* T1/E1 select pins */ - int globalconfig; /* Whether global setup has been done */ - int syncsrc; /* active sync source */ - struct t4_span *tspans[4]; /* Individual spans */ - int numspans; /* Number of spans on the card */ - int blinktimer; -#ifdef FANCY_ALARM - int alarmpos; -#endif - int irq; /* IRQ used by device */ - int order; /* Order */ - int flags; /* Device flags */ - int master; /* Are we master */ - int ledreg; /* LED Register */ - unsigned int gpio; - unsigned int gpioctl; - int e1recover; /* E1 recovery timer */ - spinlock_t reglock; /* lock register access */ - int spansstarted; /* number of spans started */ - volatile unsigned int *writechunk; /* Double-word aligned write memory */ - volatile unsigned int *readchunk; /* Double-word aligned read memory */ - unsigned short canary; -#ifdef ENABLE_WORKQUEUES - atomic_t worklist; - struct workqueue_struct *workq; -#endif - unsigned int passno; /* number of interrupt passes */ - char *variety; - int last0; /* for detecting double-missed IRQ */ - - /* DMA related fields */ - unsigned int dmactrl; - dma_addr_t readdma; - dma_addr_t writedma; - unsigned long memaddr; /* Base address of card */ - unsigned long memlen; - volatile unsigned int *membase; /* Base address of card */ - - /* Add this for our softlockup protector */ - unsigned int oct_rw_count; - - /* Flags for our bottom half */ - unsigned long checkflag; - struct tasklet_struct t4_tlet; - unsigned int vpm400checkstatus; - -#ifdef VPM_SUPPORT - struct vpm450m *vpm450m; - int vpm; -#endif - -}; - -#define T4_VPM_PRESENT (1 << 28) - - -#ifdef VPM_SUPPORT -static void t4_vpm400_init(struct t4 *wc); -static void t4_vpm450_init(struct t4 *wc); -static void t4_vpm_set_dtmf_threshold(struct t4 *wc, unsigned int threshold); -#endif -static void __set_clear(struct t4 *wc, int span); -static int t4_startup(struct zt_span *span); -static int t4_shutdown(struct zt_span *span); -static int t4_rbsbits(struct zt_chan *chan, int bits); -static int t4_maint(struct zt_span *span, int cmd); -#ifdef SUPPORT_GEN1 -static int t4_reset_dma(struct t4 *wc); -#endif -static void t4_hdlc_hard_xmit(struct zt_chan *chan); -static int t4_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data); -static void t4_tsi_assign(struct t4 *wc, int fromspan, int fromchan, int tospan, int tochan); -static void t4_tsi_unassign(struct t4 *wc, int tospan, int tochan); -static void __t4_set_timing_source(struct t4 *wc, int unit, int master, int slave); -static void t4_check_alarms(struct t4 *wc, int span); -static void t4_check_sigbits(struct t4 *wc, int span); - -#define WC_RDADDR 0 -#define WC_WRADDR 1 -#define WC_COUNT 2 -#define WC_DMACTRL 3 -#define WC_INTR 4 -/* #define WC_GPIO 5 */ -#define WC_VERSION 6 -#define WC_LEDS 7 -#define WC_GPIOCTL 8 -#define WC_GPIO 9 -#define WC_LADDR 10 -#define WC_LDATA 11 -#define WC_LCS (1 << 11) -#define WC_LCS2 (1 << 12) -#define WC_LALE (1 << 13) -#define WC_LFRMR_CS (1 << 10) /* Framer's ChipSelect signal */ -#define WC_ACTIVATE (1 << 12) -#define WC_LREAD (1 << 15) -#define WC_LWRITE (1 << 16) - -#define WC_OFF (0) -#define WC_RED (1) -#define WC_GREEN (2) -#define WC_YELLOW (3) - -#define MAX_T4_CARDS 64 - -static void t4_isr_bh(unsigned long data); - -static struct t4 *cards[MAX_T4_CARDS]; - - -#define MAX_TDM_CHAN 32 -#define MAX_DTMF_DET 16 - -#define HDLC_IMR0_MASK (FRMR_IMR0_RME | FRMR_IMR0_RPF) -#if 0 -#define HDLC_IMR1_MASK (FRMR_IMR1_ALLS | FRMR_IMR1_XDU | FRMR_IMR1_XPR) -#else -#define HDLC_IMR1_MASK (FRMR_IMR1_XDU | FRMR_IMR1_XPR) -#endif - -static inline unsigned int __t4_pci_in(struct t4 *wc, const unsigned int addr) -{ - unsigned int res = readl(&wc->membase[addr]); - return res; -} - -static inline void __t4_pci_out(struct t4 *wc, const unsigned int addr, const unsigned int value) -{ - unsigned int tmp; - writel(value, &wc->membase[addr]); - if (pedanticpci) { - /* Even though we do not support fast back-to-back - * transactions, some host bridges appear to generate them. - * This delay prevents this. - */ - tmp = __t4_pci_in(wc, WC_VERSION); - if ((tmp & 0xffff0000) != 0xc01a0000) - printk("TE4XXP: Version Synchronization Error!\n"); - } -#if 0 - tmp = __t4_pci_in(wc, addr); - if ((value != tmp) && (addr != WC_LEDS) && (addr != WC_LDATA) && - (addr != WC_GPIO) && (addr != WC_INTR)) - printk("Tried to load %08x into %08x, but got %08x instead\n", value, addr, tmp); -#endif -} - -static inline void __t4_gpio_set(struct t4 *wc, unsigned bits, unsigned int val) -{ - unsigned int newgpio; - newgpio = wc->gpio & (~bits); - newgpio |= val; - if (newgpio != wc->gpio) { - wc->gpio = newgpio; - __t4_pci_out(wc, WC_GPIO, wc->gpio); - } -} - -static inline void __t4_gpio_setdir(struct t4 *wc, unsigned int bits, unsigned int val) -{ - unsigned int newgpioctl; - newgpioctl = wc->gpioctl & (~bits); - newgpioctl |= val; - if (newgpioctl != wc->gpioctl) { - wc->gpioctl = newgpioctl; - __t4_pci_out(wc, WC_GPIOCTL, wc->gpioctl); - } -} - -static inline void t4_gpio_setdir(struct t4 *wc, unsigned int bits, unsigned int val) -{ - unsigned long flags; - spin_lock_irqsave(&wc->reglock, flags); - __t4_gpio_setdir(wc, bits, val); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static inline void t4_gpio_set(struct t4 *wc, unsigned int bits, unsigned int val) -{ - unsigned long flags; - spin_lock_irqsave(&wc->reglock, flags); - __t4_gpio_set(wc, bits, val); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static inline void t4_pci_out(struct t4 *wc, const unsigned int addr, const unsigned int value) -{ - unsigned long flags; - spin_lock_irqsave(&wc->reglock, flags); - __t4_pci_out(wc, addr, value); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static inline void __t4_set_led(struct t4 *wc, int span, int color) -{ - int oldreg = wc->ledreg; - wc->ledreg &= ~(0x3 << (span << 1)); - wc->ledreg |= (color << (span << 1)); - if (oldreg != wc->ledreg) - __t4_pci_out(wc, WC_LEDS, wc->ledreg); -} - -static inline void t4_activate(struct t4 *wc) -{ - wc->ledreg |= WC_ACTIVATE; - t4_pci_out(wc, WC_LEDS, wc->ledreg); -} - -static inline unsigned int t4_pci_in(struct t4 *wc, const unsigned int addr) -{ - unsigned int ret; - unsigned long flags; - - spin_lock_irqsave(&wc->reglock, flags); - ret = __t4_pci_in(wc, addr); - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -static inline unsigned int __t4_framer_in(struct t4 *wc, int unit, const unsigned int addr) -{ - unsigned int ret; - unit &= 0x3; - __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | WC_LFRMR_CS | WC_LREAD); - if (pedanticpci) { - __t4_pci_out(wc, WC_VERSION, 0); - } - ret = __t4_pci_in(wc, WC_LDATA); - __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - return ret & 0xff; -} - -static inline unsigned int t4_framer_in(struct t4 *wc, int unit, const unsigned int addr) -{ - unsigned long flags; - unsigned int ret; - spin_lock_irqsave(&wc->reglock, flags); - ret = __t4_framer_in(wc, unit, addr); - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; - -} - -static inline void __t4_framer_out(struct t4 *wc, int unit, const unsigned int addr, const unsigned int value) -{ - unit &= 0x3; - if (unlikely(debug & DEBUG_REGS)) - printk("Writing %02x to address %02x of unit %d\n", value, addr, unit); - __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - __t4_pci_out(wc, WC_LDATA, value); - __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | WC_LFRMR_CS | WC_LWRITE); - __t4_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - if (unlikely(debug & DEBUG_REGS)) printk("Write complete\n"); -#if 0 - if ((addr != FRMR_TXFIFO) && (addr != FRMR_CMDR) && (addr != 0xbc)) - { unsigned int tmp; - tmp = __t4_framer_in(wc, unit, addr); - if (tmp != value) { - printk("Expected %d from unit %d register %d but got %d instead\n", value, unit, addr, tmp); - } } -#endif -} - -static inline void t4_framer_out(struct t4 *wc, int unit, const unsigned int addr, const unsigned int value) -{ - unsigned long flags; - spin_lock_irqsave(&wc->reglock, flags); - __t4_framer_out(wc, unit, addr, value); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -#ifdef VPM_SUPPORT - -static inline void wait_a_little(void) -{ - unsigned long newjiffies=jiffies+2; - while(jiffies < newjiffies); -} - -static inline unsigned int __t4_vpm_in(struct t4 *wc, int unit, const unsigned int addr) -{ - unsigned int ret; - unit &= 0x7; - __t4_pci_out(wc, WC_LADDR, (addr & 0x1ff) | ( unit << 12)); - __t4_pci_out(wc, WC_LADDR, (addr & 0x1ff) | ( unit << 12) | (1 << 11) | WC_LREAD); - ret = __t4_pci_in(wc, WC_LDATA); - __t4_pci_out(wc, WC_LADDR, 0); - return ret & 0xff; -} - -static inline void __t4_raw_oct_out(struct t4 *wc, const unsigned int addr, const unsigned int value) -{ - int octopt = wc->tspans[0]->spanflags & FLAG_OCTOPT; - if (!octopt) - __t4_gpio_set(wc, 0xff, (addr >> 8)); - __t4_pci_out(wc, WC_LDATA, 0x10000 | (addr & 0xffff)); - if (!octopt) - __t4_pci_out(wc, WC_LADDR, (WC_LWRITE)); - __t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE)); - if (!octopt) - __t4_gpio_set(wc, 0xff, (value >> 8)); - __t4_pci_out(wc, WC_LDATA, (value & 0xffff)); - __t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE | WC_LCS)); - __t4_pci_out(wc, WC_LADDR, (0)); -} - -static inline unsigned int __t4_raw_oct_in(struct t4 *wc, const unsigned int addr) -{ - unsigned int ret; - int octopt = wc->tspans[0]->spanflags & FLAG_OCTOPT; - if (!octopt) - __t4_gpio_set(wc, 0xff, (addr >> 8)); - __t4_pci_out(wc, WC_LDATA, 0x10000 | (addr & 0xffff)); - if (!octopt) - __t4_pci_out(wc, WC_LADDR, (WC_LWRITE)); - __t4_pci_out(wc, WC_LADDR, (WC_LWRITE | WC_LALE)); -#ifdef PEDANTIC_OCTASIC_CHECKING - __t4_pci_out(wc, WC_LADDR, (WC_LALE)); -#endif - if (!octopt) { - __t4_gpio_setdir(wc, 0xff, 0x00); - __t4_gpio_set(wc, 0xff, 0x00); - } - __t4_pci_out(wc, WC_LADDR, (WC_LREAD | WC_LALE | WC_LCS)); - if (octopt) { - ret = __t4_pci_in(wc, WC_LDATA) & 0xffff; - } else { - ret = __t4_pci_in(wc, WC_LDATA) & 0xff; - ret |= (__t4_pci_in(wc, WC_GPIO) & 0xff) << 8; - } - __t4_pci_out(wc, WC_LADDR, (0)); - if (!octopt) - __t4_gpio_setdir(wc, 0xff, 0xff); - return ret & 0xffff; -} - -static inline unsigned int __t4_oct_in(struct t4 *wc, unsigned int addr) -{ -#ifdef PEDANTIC_OCTASIC_CHECKING - int count = 1000; -#endif - __t4_raw_oct_out(wc, 0x0008, (addr >> 20)); - __t4_raw_oct_out(wc, 0x000a, (addr >> 4) & ((1 << 16) - 1)); - __t4_raw_oct_out(wc, 0x0000, (((addr >> 1) & 0x7) << 9) | (1 << 8) | (1)); -#ifdef PEDANTIC_OCTASIC_CHECKING - while((__t4_raw_oct_in(wc, 0x0000) & (1 << 8)) && --count); - if (count != 1000) - printk("Yah, read can be slow...\n"); - if (!count) - printk("Read timed out!\n"); -#endif - return __t4_raw_oct_in(wc, 0x0004); -} - -static inline unsigned int t4_oct_in(struct t4 *wc, const unsigned int addr) -{ - unsigned long flags; - unsigned int ret; - - spin_lock_irqsave(&wc->reglock, flags); - ret = __t4_oct_in(wc, addr); - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -static inline unsigned int t4_vpm_in(struct t4 *wc, int unit, const unsigned int addr) -{ - unsigned long flags; - unsigned int ret; - spin_lock_irqsave(&wc->reglock, flags); - ret = __t4_vpm_in(wc, unit, addr); - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -static inline void __t4_vpm_out(struct t4 *wc, int unit, const unsigned int addr, const unsigned int value) -{ - unit &= 0x7; - if (debug & DEBUG_REGS) - printk("Writing %02x to address %02x of ec unit %d\n", value, addr, unit); - __t4_pci_out(wc, WC_LADDR, (addr & 0xff)); - __t4_pci_out(wc, WC_LDATA, value); - __t4_pci_out(wc, WC_LADDR, (unit << 12) | (addr & 0x1ff) | (1 << 11)); - __t4_pci_out(wc, WC_LADDR, (unit << 12) | (addr & 0x1ff) | (1 << 11) | WC_LWRITE); - __t4_pci_out(wc, WC_LADDR, (unit << 12) | (addr & 0x1ff) | (1 << 11)); - __t4_pci_out(wc, WC_LADDR, (unit << 12) | (addr & 0x1ff)); - __t4_pci_out(wc, WC_LADDR, 0); - if (debug & DEBUG_REGS) printk("Write complete\n"); - - -#if 0 - { unsigned int tmp; - tmp = t4_vpm_in(wc, unit, addr); - if (tmp != value) { - printk("Expected %d from unit %d echo register %d but got %d instead\n", value, unit, addr, tmp); - } } -#endif -} - -static inline void __t4_oct_out(struct t4 *wc, unsigned int addr, unsigned int value) -{ -#ifdef PEDANTIC_OCTASIC_CHECKING - int count = 1000; -#endif - __t4_raw_oct_out(wc, 0x0008, (addr >> 20)); - __t4_raw_oct_out(wc, 0x000a, (addr >> 4) & ((1 << 16) - 1)); - __t4_raw_oct_out(wc, 0x0004, value); - __t4_raw_oct_out(wc, 0x0000, (((addr >> 1) & 0x7) << 9) | (1 << 8) | (3 << 12) | 1); -#ifdef PEDANTIC_OCTASIC_CHECKING - while((__t4_raw_oct_in(wc, 0x0000) & (1 << 8)) && --count); - if (count != 1000) - printk("Yah, write can be slow\n"); - if (!count) - printk("Write timed out!\n"); -#endif -} - -static inline void t4_oct_out(struct t4 *wc, const unsigned int addr, const unsigned int value) -{ - unsigned long flags; - - spin_lock_irqsave(&wc->reglock, flags); - __t4_oct_out(wc, addr, value); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static inline void t4_vpm_out(struct t4 *wc, int unit, const unsigned int addr, const unsigned int value) -{ - unsigned long flags; - spin_lock_irqsave(&wc->reglock, flags); - __t4_vpm_out(wc, unit, addr, value); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static const char vpm_digits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', '*', '#'}; - -static void t4_check_vpm450(struct t4 *wc) -{ - int channel, tone, start, span; - - if (vpm450m_checkirq(wc->vpm450m)) { - while(vpm450m_getdtmf(wc->vpm450m, &channel, &tone, &start)) { - span = channel & 0x3; - channel >>= 2; - if (!wc->t1e1) - channel -= 5; - else - channel -= 1; - if (unlikely(debug)) - printk("Got tone %s of '%c' on channel %d of span %d\n", - (start ? "START" : "STOP"), tone, channel, span + 1); - if (test_bit(channel, &wc->tspans[span]->dtmfmask) && (tone != 'u')) { - if (start) { - /* The octasic is supposed to mute us, but... Yah, you - guessed it. */ - if (test_bit(channel, &wc->tspans[span]->dtmfmutemask)) { - unsigned long flags; - struct zt_chan *chan = &wc->tspans[span]->span.chans[channel]; - int y; - spin_lock_irqsave(&chan->lock, flags); - for (y=0;ynumbufs;y++) { - if ((chan->inreadbuf > -1) && (chan->readidx[y])) - memset(chan->readbuf[chan->inreadbuf], ZT_XLAW(0, chan), chan->readidx[y]); - } - spin_unlock_irqrestore(&chan->lock, flags); - } - set_bit(channel, &wc->tspans[span]->dtmfactive); - zt_qevent_lock(&wc->tspans[span]->span.chans[channel], (ZT_EVENT_DTMFDOWN | tone)); - } else { - clear_bit(channel, &wc->tspans[span]->dtmfactive); - zt_qevent_lock(&wc->tspans[span]->span.chans[channel], (ZT_EVENT_DTMFUP | tone)); - } - } - } - } -} - -static void t4_check_vpm400(struct t4 *wc, unsigned int newio) -{ - unsigned int digit, regval = 0; - unsigned int regbyte; - int x, i; - short energy=0; - static unsigned int lastio = 0; - struct t4_span *ts; - - if (debug && (newio != lastio)) - printk("Last was %08x, new is %08x\n", lastio, newio); - - lastio = newio; - - for(x = 0; x < 8; x++) { - if (newio & (1 << (7 - x))) - continue; - ts = wc->tspans[x%4]; - /* Start of DTMF detection process */ - regbyte = t4_vpm_in(wc, x, 0xb8); - t4_vpm_out(wc, x, 0xb8, regbyte); /* Write 1 to clear */ - regval = regbyte << 8; - regbyte = t4_vpm_in(wc, x, 0xb9); - t4_vpm_out(wc, x, 0xb9, regbyte); - regval |= regbyte; - - for(i = 0; (i < MAX_DTMF_DET) && regval; i++) { - if(regval & 0x0001) { - int channel = (i << 1) + (x >> 2); - int base = channel - 1; - - if (!wc->t1e1) - base -= 4; - regbyte = t4_vpm_in(wc, x, 0xa8 + i); - digit = vpm_digits[regbyte]; - if (!(wc->tspans[0]->spanflags & FLAG_VPM2GEN)) { - energy = t4_vpm_in(wc, x, 0x58 + channel); - energy = ZT_XLAW(energy, ts->chans); - ts->dtmfenergy[base] = energy; - } - set_bit(base, &ts->dtmfactive); - if (ts->dtmfdigit[base]) { - if (ts->dtmfmask & (1 << base)) - zt_qevent_lock(&ts->span.chans[base], (ZT_EVENT_DTMFUP | ts->dtmfdigit[base])); - } - ts->dtmfdigit[base] = digit; - if (test_bit(base, &ts->dtmfmask)) - zt_qevent_lock(&ts->span.chans[base], (ZT_EVENT_DTMFDOWN | digit)); - if (test_bit(base, &ts->dtmfmutemask)) { - /* Mute active receive buffer*/ - unsigned long flags; - struct zt_chan *chan = &ts->span.chans[base]; - int y; - spin_lock_irqsave(&chan->lock, flags); - for (y=0;ynumbufs;y++) { - if ((chan->inreadbuf > -1) && (chan->readidx[y])) - memset(chan->readbuf[chan->inreadbuf], ZT_XLAW(0, chan), chan->readidx[y]); - } - spin_unlock_irqrestore(&chan->lock, flags); - } - if (debug) - printk("Digit Seen: %d, Span: %d, channel: %d, energy: %02x, 'channel %d' chip %d\n", digit, x % 4, base + 1, energy, channel, x); - - } - regval = regval >> 1; - } - if (!(wc->tspans[0]->spanflags & FLAG_VPM2GEN)) - continue; - - /* Start of DTMF off detection process */ - regbyte = t4_vpm_in(wc, x, 0xbc); - t4_vpm_out(wc, x, 0xbc, regbyte); /* Write 1 to clear */ - regval = regbyte << 8; - regbyte = t4_vpm_in(wc, x, 0xbd); - t4_vpm_out(wc, x, 0xbd, regbyte); - regval |= regbyte; - - for(i = 0; (i < MAX_DTMF_DET) && regval; i++) { - if(regval & 0x0001) { - int channel = (i << 1) + (x >> 2); - int base = channel - 1; - - if (!wc->t1e1) - base -= 4; - clear_bit(base, &ts->dtmfactive); - if (ts->dtmfdigit[base]) { - if (test_bit(base, &ts->dtmfmask)) - zt_qevent_lock(&ts->span.chans[base], (ZT_EVENT_DTMFUP | ts->dtmfdigit[base])); - } - digit = ts->dtmfdigit[base]; - ts->dtmfdigit[base] = 0; - if (debug) - printk("Digit Gone: %d, Span: %d, channel: %d, energy: %02x, 'channel %d' chip %d\n", digit, x % 4, base + 1, energy, channel, x); - - } - regval = regval >> 1; - } - - } -} -#endif - -static void hdlc_stop(struct t4 *wc, unsigned int span) -{ - struct t4_span *t = wc->tspans[span]; - unsigned char imr0, imr1, mode; - int i = 0; - - if (debug & DEBUG_FRAMER) printk("Stopping HDLC controller on span %d\n", span+1); - - /* Clear receive and transmit timeslots */ - for (i = 0; i < 4; i++) { - t4_framer_out(wc, span, FRMR_RTR_BASE + i, 0x00); - t4_framer_out(wc, span, FRMR_TTR_BASE + i, 0x00); - } - - imr0 = t4_framer_in(wc, span, FRMR_IMR0); - imr1 = t4_framer_in(wc, span, FRMR_IMR1); - - /* Disable HDLC interrupts */ - imr0 |= HDLC_IMR0_MASK; - t4_framer_out(wc, span, FRMR_IMR0, imr0); - - imr1 |= HDLC_IMR1_MASK; - t4_framer_out(wc, span, FRMR_IMR1, imr1); - - mode = t4_framer_in(wc, span, FRMR_MODE); - mode &= ~FRMR_MODE_HRAC; - t4_framer_out(wc, span, FRMR_MODE, mode); - - t->sigactive = 0; -} - -static inline void __t4_framer_cmd(struct t4 *wc, unsigned int span, int cmd) -{ - __t4_framer_out(wc, span, FRMR_CMDR, cmd); -} - -static inline void t4_framer_cmd_wait(struct t4 *wc, unsigned int span, int cmd) -{ - int sis; - int loops = 0; - - /* XXX could be time consuming XXX */ - for (;;) { - sis = t4_framer_in(wc, span, FRMR_SIS); - if (!(sis & 0x04)) - break; - if (!loops++ && (debug & DEBUG_FRAMER)) { - printk("!!!SIS Waiting before cmd %02x\n", cmd); - } - } - if (loops && (debug & DEBUG_FRAMER)) - printk("!!!SIS waited %d loops\n", loops); - - t4_framer_out(wc, span, FRMR_CMDR, cmd); -} - -static int hdlc_start(struct t4 *wc, unsigned int span, struct zt_chan *chan, unsigned char mode) -{ - struct t4_span *t = wc->tspans[span]; - unsigned char imr0, imr1; - int offset = chan->chanpos; - unsigned long flags; - - if (debug & DEBUG_FRAMER) printk("Starting HDLC controller for channel %d span %d\n", offset, span+1); - - if (mode != FRMR_MODE_NO_ADDR_CMP) - return -1; - - mode |= FRMR_MODE_HRAC; - - /* Make sure we're in the right mode */ - t4_framer_out(wc, span, FRMR_MODE, mode); - t4_framer_out(wc, span, FRMR_TSEO, 0x00); - t4_framer_out(wc, span, FRMR_TSBS1, hardhdlcmode); - - /* Set the interframe gaps, etc */ - t4_framer_out(wc, span, FRMR_CCR1, FRMR_CCR1_ITF|FRMR_CCR1_EITS); - - t4_framer_out(wc, span, FRMR_CCR2, FRMR_CCR2_RCRC); - - /* Set up the time slot that we want to tx/rx on */ - t4_framer_out(wc, span, FRMR_TTR_BASE + (offset / 8), (0x80 >> (offset % 8))); - t4_framer_out(wc, span, FRMR_RTR_BASE + (offset / 8), (0x80 >> (offset % 8))); - - imr0 = t4_framer_in(wc, span, FRMR_IMR0); - imr1 = t4_framer_in(wc, span, FRMR_IMR1); - - /* Enable our interrupts again */ - imr0 &= ~HDLC_IMR0_MASK; - t4_framer_out(wc, span, FRMR_IMR0, imr0); - - imr1 &= ~HDLC_IMR1_MASK; - t4_framer_out(wc, span, FRMR_IMR1, imr1); - - /* Reset the signaling controller */ - t4_framer_cmd_wait(wc, span, FRMR_CMDR_SRES); - - spin_lock_irqsave(&wc->reglock, flags); - t->sigchan = chan; - spin_unlock_irqrestore(&wc->reglock, flags); - - t->sigactive = 0; - - return 0; -} - -static void __set_clear(struct t4 *wc, int span) -{ - int i,j; - int oldnotclear; - unsigned short val=0; - struct t4_span *ts = wc->tspans[span]; - - oldnotclear = ts->notclear; - if ((ts->spantype == TYPE_T1) || (ts->spantype == TYPE_J1)) { - for (i=0;i<24;i++) { - j = (i/8); - if (ts->span.chans[i].flags & ZT_FLAG_CLEAR) { - val |= 1 << (7 - (i % 8)); - ts->notclear &= ~(1 << i); - } else - ts->notclear |= (1 << i); - if ((i % 8)==7) { - if (debug) - printk("Putting %d in register %02x on span %d\n", - val, 0x2f + j, span + 1); - __t4_framer_out(wc, span, 0x2f + j, val); - val = 0; - } - } - } else { - for (i=0;i<31;i++) { - if (ts->span.chans[i].flags & ZT_FLAG_CLEAR) - ts->notclear &= ~(1 << i); - else - ts->notclear |= (1 << i); - } - } - if (ts->notclear != oldnotclear) { - unsigned char reg; - reg = __t4_framer_in(wc, span, FRMR_IMR0); - if (ts->notclear) - reg &= ~0x08; - else - reg |= 0x08; - __t4_framer_out(wc, span, FRMR_IMR0, reg); - } -} - -#if 0 -static void set_clear(struct t4 *wc, int span) -{ - unsigned long flags; - spin_lock_irqsave(&wc->reglock, flags); - __set_clear(wc, span); - spin_unlock_irqrestore(&wc->reglock, flags); -} -#endif - -static int t4_dacs(struct zt_chan *dst, struct zt_chan *src) -{ - struct t4 *wc; - struct t4_span *ts; - wc = dst->pvt; - ts = wc->tspans[dst->span->offset]; - if (src && (src->pvt != dst->pvt)) { - if (ts->spanflags & FLAG_2NDGEN) - t4_tsi_unassign(wc, dst->span->offset, dst->chanpos); - wc = src->pvt; - if (ts->spanflags & FLAG_2NDGEN) - t4_tsi_unassign(wc, src->span->offset, src->chanpos); - if (debug) - printk("Unassigning %d/%d by default and...\n", src->span->offset, src->chanpos); - if (debug) - printk("Unassigning %d/%d by default\n", dst->span->offset, dst->chanpos); - return -1; - } - if (src) { - t4_tsi_assign(wc, src->span->offset, src->chanpos, dst->span->offset, dst->chanpos); - if (debug) - printk("Assigning channel %d/%d -> %d/%d!\n", src->span->offset, src->chanpos, dst->span->offset, dst->chanpos); - } else { - t4_tsi_unassign(wc, dst->span->offset, dst->chanpos); - if (debug) - printk("Unassigning channel %d/%d!\n", dst->span->offset, dst->chanpos); - } - return 0; -} - -#ifdef VPM_SUPPORT - -void oct_set_reg(void *data, unsigned int reg, unsigned int val) -{ - struct t4 *wc = data; - t4_oct_out(wc, reg, val); -} - -unsigned int oct_get_reg(void *data, unsigned int reg) -{ - struct t4 *wc = data; - unsigned int ret; - ret = t4_oct_in(wc, reg); - return ret; -} - -static int t4_vpm_unit(int span, int channel) -{ - int unit = 0; - switch(vpmspans) { - case 4: - unit = span; - unit += (channel & 1) << 2; - break; - case 2: - unit = span; - unit += (channel & 0x3) << 1; - break; - case 1: - unit = span; - unit += (channel & 0x7); - } - return unit; -} - -static int t4_echocan(struct zt_chan *chan, int eclen) -{ - struct t4 *wc = chan->pvt; - int channel; - int unit; - - if (!wc->vpm) - return -ENODEV; - - if (chan->span->offset >= vpmspans) - return -ENODEV; - - if (wc->t1e1) - channel = chan->chanpos; - else - channel = chan->chanpos + 4; - if (wc->vpm450m) { - channel = channel << 2; - channel |= chan->span->offset; - if(debug & DEBUG_ECHOCAN) - printk("echocan: Card is %d, Channel is %d, Span is %d, offset is %d length %d\n", - wc->num, chan->chanpos, chan->span->offset, channel, eclen); - vpm450m_setec(wc->vpm450m, channel, eclen); -// Mark msleep(10); -// msleep(100); // longer test - } else { - unit = t4_vpm_unit(chan->span->offset, channel); - if(debug & DEBUG_ECHOCAN) - printk("echocan: Card is %d, Channel is %d, Span is %d, unit is %d, unit offset is %d length %d\n", - wc->num, chan->chanpos, chan->span->offset, unit, channel, eclen); - if (eclen) - t4_vpm_out(wc,unit,channel,0x3e); - else - t4_vpm_out(wc,unit,channel,0x01); - } - return 0; -} -#endif - -static int t4_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - struct t4_regs regs; - int x; - struct t4 *wc = chan->pvt; -#ifdef VPM_SUPPORT - int j; - int channel; - struct t4_span *ts = wc->tspans[chan->span->offset]; -#endif - -#ifdef VPM_SUPPORT - if (dtmfthreshold == 0) - dtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD; - if (lastdtmfthreshold != dtmfthreshold) { - lastdtmfthreshold = dtmfthreshold; - t4_vpm_set_dtmf_threshold(wc, dtmfthreshold); - } -#endif - - switch(cmd) { - case WCT4_GET_REGS: - for (x=0;xspan->offset, x); - if (copy_to_user((struct t4_regs *)data, ®s, sizeof(regs))) - return -EFAULT; - break; -#ifdef VPM_SUPPORT - case ZT_TONEDETECT: - if (get_user(j, (int *)data)) - return -EFAULT; - if (!wc->vpm) - return -ENOSYS; - if (j && (vpmdtmfsupport == 0)) - return -ENOSYS; - if (j & ZT_TONEDETECT_ON) - set_bit(chan->chanpos - 1, &ts->dtmfmask); - else - clear_bit(chan->chanpos - 1, &ts->dtmfmask); - if (j & ZT_TONEDETECT_MUTE) - set_bit(chan->chanpos - 1, &ts->dtmfmutemask); - else - clear_bit(chan->chanpos - 1, &ts->dtmfmutemask); - if (wc->vpm450m) { - channel = (chan->chanpos) << 2; - if (!wc->t1e1) - channel += (4 << 2); - channel |= chan->span->offset; - vpm450m_setdtmf(wc->vpm450m, channel, j & ZT_TONEDETECT_ON, j & ZT_TONEDETECT_MUTE); - } - return 0; -#endif - default: - return -ENOTTY; - } - return 0; -} - -static void inline t4_hdlc_xmit_fifo(struct t4 *wc, unsigned int span, struct t4_span *ts) -{ - int res, i, size = 32; - unsigned char buf[32]; - - res = zt_hdlc_getbuf(ts->sigchan, buf, &size); - if (debug & DEBUG_FRAMER) printk("Got buffer sized %d and res %d for %d\n", size, res, span); - if (size > 0) { - ts->sigactive = 1; - - if (debug & DEBUG_FRAMER) { - printk("TX("); - for (i = 0; i < size; i++) - printk((i ? " %02x" : "%02x"), buf[i]); - printk(")\n"); - } - - for (i = 0; i < size; i++) - t4_framer_out(wc, span, FRMR_TXFIFO, buf[i]); - - if (res) /* End of message */ { - if (debug & DEBUG_FRAMER) printk("transmiting XHF|XME\n"); - t4_framer_cmd_wait(wc, span, FRMR_CMDR_XHF | FRMR_CMDR_XME); -#if 0 - ts->sigactive = (__t4_framer_in(wc, span, FRMR_SIS) & FRMR_SIS_XFW) ? 0 : 1; -#endif - ++ts->frames_out; - if ((debug & DEBUG_FRAMER) && !(ts->frames_out & 0x0f)) - printk("Transmitted %d frames on span %d\n", ts->frames_out, span); - } else { /* Still more to transmit */ - if (debug & DEBUG_FRAMER) printk("transmiting XHF\n"); - t4_framer_cmd_wait(wc, span, FRMR_CMDR_XHF); - } - } - else if (res < 0) - ts->sigactive = 0; -} - -static void t4_hdlc_hard_xmit(struct zt_chan *chan) -{ - struct t4 *wc = chan->pvt; - int span = chan->span->offset; - struct t4_span *ts = wc->tspans[span]; - unsigned long flags; - - spin_lock_irqsave(&wc->reglock, flags); - if (!ts->sigchan) { - printk("t4_hdlc_hard_xmit: Invalid (NULL) signalling channel\n"); - spin_unlock_irqrestore(&wc->reglock, flags); - return; - } - spin_unlock_irqrestore(&wc->reglock, flags); - - if (debug & DEBUG_FRAMER) printk("t4_hdlc_hard_xmit on channel %s (sigchan %s), sigactive=%d\n", chan->name, ts->sigchan->name, ts->sigactive); - - if ((ts->sigchan == chan) && !ts->sigactive) - t4_hdlc_xmit_fifo(wc, span, ts); -} - -static int t4_maint(struct zt_span *span, int cmd) -{ - struct t4_span *ts = span->pvt; - struct t4 *wc = ts->owner; - - if (ts->spantype == TYPE_E1) { - switch(cmd) { - case ZT_MAINT_NONE: - printk("XXX Turn off local and remote loops E1 XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - printk("XXX Turn on local loopback E1 XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - printk("XXX Turn on remote loopback E1 XXX\n"); - break; - case ZT_MAINT_LOOPUP: - printk("XXX Send loopup code E1 XXX\n"); - break; - case ZT_MAINT_LOOPDOWN: - printk("XXX Send loopdown code E1 XXX\n"); - break; - case ZT_MAINT_LOOPSTOP: - printk("XXX Stop sending loop codes E1 XXX\n"); - break; - default: - printk("TE%dXXP: Unknown E1 maint command: %d\n", wc->numspans, cmd); - break; - } - } else { - switch(cmd) { - case ZT_MAINT_NONE: - printk("XXX Turn off local and remote loops T1 XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - printk("XXX Turn on local loop and no remote loop XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - printk("XXX Turn on remote loopup XXX\n"); - break; - case ZT_MAINT_LOOPUP: - t4_framer_out(wc, span->offset, 0x21, 0x50); /* FMR5: Nothing but RBS mode */ - break; - case ZT_MAINT_LOOPDOWN: - t4_framer_out(wc, span->offset, 0x21, 0x60); /* FMR5: Nothing but RBS mode */ - break; - case ZT_MAINT_LOOPSTOP: - t4_framer_out(wc, span->offset, 0x21, 0x40); /* FMR5: Nothing but RBS mode */ - break; - default: - printk("TE%dXXP: Unknown T1 maint command: %d\n", wc->numspans, cmd); - break; - } - } - return 0; -} - -static int t4_rbsbits(struct zt_chan *chan, int bits) -{ - u_char m,c; - int k,n,b; - struct t4 *wc = chan->pvt; - struct t4_span *ts = wc->tspans[chan->span->offset]; - unsigned long flags; - - if(debug & DEBUG_RBS) printk("Setting bits to %d on channel %s\n", bits, chan->name); - spin_lock_irqsave(&wc->reglock, flags); - k = chan->span->offset; - if (ts->spantype == TYPE_E1) { /* do it E1 way */ - if (chan->chanpos == 16) { - spin_unlock_irqrestore(&wc->reglock, flags); - return 0; - } - n = chan->chanpos - 1; - if (chan->chanpos > 15) n--; - b = (n % 15); - c = ts->txsigs[b]; - m = (n / 15) << 2; /* nibble selector */ - c &= (0xf << m); /* keep the other nibble */ - c |= (bits & 0xf) << (4 - m); /* put our new nibble here */ - ts->txsigs[b] = c; - /* output them to the chip */ - __t4_framer_out(wc,k,0x71 + b,c); - } else if (ts->span.lineconfig & ZT_CONFIG_D4) { - n = chan->chanpos - 1; - b = (n/4); - c = ts->txsigs[b]; - m = ((3 - (n % 4)) << 1); /* nibble selector */ - c &= ~(0x3 << m); /* keep the other nibble */ - c |= ((bits >> 2) & 0x3) << m; /* put our new nibble here */ - ts->txsigs[b] = c; - /* output them to the chip */ - __t4_framer_out(wc,k,0x70 + b,c); - __t4_framer_out(wc,k,0x70 + b + 6,c); - } else if (ts->span.lineconfig & ZT_CONFIG_ESF) { - n = chan->chanpos - 1; - b = (n/2); - c = ts->txsigs[b]; - m = ((n % 2) << 2); /* nibble selector */ - c &= (0xf << m); /* keep the other nibble */ - c |= (bits & 0xf) << (4 - m); /* put our new nibble here */ - ts->txsigs[b] = c; - /* output them to the chip */ - __t4_framer_out(wc,k,0x70 + b,c); - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (debug & DEBUG_RBS) - printk("Finished setting RBS bits\n"); - return 0; -} - -static int t4_shutdown(struct zt_span *span) -{ - int tspan; - int wasrunning; - unsigned long flags; - struct t4_span *ts = span->pvt; - struct t4 *wc = ts->owner; - - tspan = span->offset + 1; - if (tspan < 0) { - printk("T%dXXP: Span '%d' isn't us?\n", wc->numspans, span->spanno); - return -1; - } - - if (debug & DEBUG_MAIN) printk("Shutting down span %d (%s)\n", span->spanno, span->name); - - /* Stop HDLC controller if runned */ - if (ts->sigchan) - hdlc_stop(wc, span->offset); - - spin_lock_irqsave(&wc->reglock, flags); - wasrunning = span->flags & ZT_FLAG_RUNNING; - - span->flags &= ~ZT_FLAG_RUNNING; - __t4_set_led(wc, span->offset, WC_OFF); - if (((wc->numspans == 4) && - (!(wc->tspans[0]->span.flags & ZT_FLAG_RUNNING)) && - (!(wc->tspans[1]->span.flags & ZT_FLAG_RUNNING)) && - (!(wc->tspans[2]->span.flags & ZT_FLAG_RUNNING)) && - (!(wc->tspans[3]->span.flags & ZT_FLAG_RUNNING))) - || - ((wc->numspans == 2) && - (!(wc->tspans[0]->span.flags & ZT_FLAG_RUNNING)) && - (!(wc->tspans[1]->span.flags & ZT_FLAG_RUNNING)))) { - /* No longer in use, disable interrupts */ - printk("TE%dXXP: Disabling interrupts since there are no active spans\n", wc->numspans); - set_bit(T4_STOP_DMA, &wc->checkflag); - } else - set_bit(T4_CHECK_TIMING, &wc->checkflag); - - spin_unlock_irqrestore(&wc->reglock, flags); - - /* Wait for interrupt routine to shut itself down */ - msleep(10); - if (wasrunning) - wc->spansstarted--; - - if (debug & DEBUG_MAIN) - printk("Span %d (%s) shutdown\n", span->spanno, span->name); - return 0; -} - -static int t4_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - int i; - struct t4_span *ts = span->pvt; - struct t4 *wc = ts->owner; - - printk("About to enter spanconfig!\n"); - if (debug & DEBUG_MAIN) - printk("TE%dXXP: Configuring span %d\n", wc->numspans, span->spanno); - - if (lc->sync < 0) - lc->sync = 0; - if (lc->sync > 4) - lc->sync = 0; - - /* remove this span number from the current sync sources, if there */ - for(i = 0; i < wc->numspans; i++) { - if (wc->tspans[i]->sync == span->spanno) { - wc->tspans[i]->sync = 0; - wc->tspans[i]->psync = 0; - } - } - wc->tspans[span->offset]->syncpos = lc->sync; - /* if a sync src, put it in proper place */ - if (lc->sync) { - wc->tspans[lc->sync - 1]->sync = span->spanno; - wc->tspans[lc->sync - 1]->psync = span->offset + 1; - } - set_bit(T4_CHECK_TIMING, &wc->checkflag); - - /* Make sure this is clear in case of multiple startup and shutdown - * iterations */ - clear_bit(T4_STOP_DMA, &wc->checkflag); - - /* If we're already running, then go ahead and apply the changes */ - if (span->flags & ZT_FLAG_RUNNING) - return t4_startup(span); - printk("Done with spanconfig!\n"); - return 0; -} - -static int t4_chanconfig(struct zt_chan *chan, int sigtype) -{ - int alreadyrunning; - unsigned long flags; - struct t4 *wc = chan->pvt; - struct t4_span *ts = wc->tspans[chan->span->offset]; - - alreadyrunning = ts->span.flags & ZT_FLAG_RUNNING; - if (debug & DEBUG_MAIN) { - if (alreadyrunning) - printk("TE%dXXP: Reconfigured channel %d (%s) sigtype %d\n", wc->numspans, chan->channo, chan->name, sigtype); - else - printk("TE%dXXP: Configured channel %d (%s) sigtype %d\n", wc->numspans, chan->channo, chan->name, sigtype); - } - - spin_lock_irqsave(&wc->reglock, flags); - - if (alreadyrunning) - __set_clear(wc, chan->span->offset); - - spin_unlock_irqrestore(&wc->reglock, flags); - - /* (re)configure signalling channel */ - if ((sigtype == ZT_SIG_HARDHDLC) || (ts->sigchan == chan)) { - if (debug & DEBUG_FRAMER) - printk("%sonfiguring hardware HDLC on %s\n", ((sigtype == ZT_SIG_HARDHDLC) ? "C" : "Unc"), chan->name); - if (alreadyrunning) { - if (ts->sigchan) - hdlc_stop(wc, ts->sigchan->span->offset); - if (sigtype == ZT_SIG_HARDHDLC) { - if (hdlc_start(wc, chan->span->offset, chan, ts->sigmode)) { - printk("Error initializing signalling controller\n"); - return -1; - } - } else { - spin_lock_irqsave(&wc->reglock, flags); - ts->sigchan = NULL; - spin_unlock_irqrestore(&wc->reglock, flags); - } - - } - else { - spin_lock_irqsave(&wc->reglock, flags); - ts->sigchan = (sigtype == ZT_SIG_HARDHDLC) ? chan : NULL; - spin_unlock_irqrestore(&wc->reglock, flags); - ts->sigactive = 0; - } - } - return 0; -} - -static int t4_open(struct zt_chan *chan) -{ -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - try_module_get(THIS_MODULE); -#endif - - return 0; -} - -static int t4_close(struct zt_chan *chan) -{ -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - return 0; -} - -/* The number of cards we have seen with each - possible 'order' switch setting. -*/ -static unsigned int order_index[16]; - -static void init_spans(struct t4 *wc) -{ - int x,y; - int gen2; - int offset = 1; - struct t4_span *ts; - - gen2 = (wc->tspans[0]->spanflags & FLAG_2NDGEN); - if (!wc->t1e1) - offset += 4; - for (x = 0; x < wc->numspans; x++) { - ts = wc->tspans[x]; - sprintf(ts->span.name, "TE%d/%d/%d", wc->numspans, wc->num, x + 1); - snprintf(ts->span.desc, sizeof(ts->span.desc) - 1, - "T%dXXP (PCI) Card %d Span %d", wc->numspans, wc->num, x+1); - ts->span.manufacturer = "Digium"; - zap_copy_string(ts->span.devicetype, wc->variety, sizeof(ts->span.devicetype)); - if (wc->vpm == T4_VPM_PRESENT) { - if (!wc->vpm450m) - strncat(ts->span.devicetype, " with VPM400M", sizeof(ts->span.devicetype) - 1); - else - strncat(ts->span.devicetype, (wc->numspans > 2) ? " with VPMOCT128" : " with VPMOCT064", - sizeof(ts->span.devicetype) - 1); - } - if (order_index[wc->order] == 1) - snprintf(ts->span.location, sizeof(ts->span.location) - 1, "Board ID Switch %d", wc->order); - else - snprintf(ts->span.location, sizeof(ts->span.location) - 1, - "PCI%s Bus %02d Slot %02d", (ts->spanflags & FLAG_EXPRESS) ? " Express" : " ", - wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1); - switch (ts->spantype) { - case TYPE_T1: - ts->span.spantype = "T1"; - break; - case TYPE_E1: - ts->span.spantype = "E1"; - break; - case TYPE_J1: - ts->span.spantype = "J1"; - break; - } - ts->span.spanconfig = t4_spanconfig; - ts->span.chanconfig = t4_chanconfig; - ts->span.irq = wc->dev->irq; - ts->span.startup = t4_startup; - ts->span.shutdown = t4_shutdown; - ts->span.rbsbits = t4_rbsbits; - ts->span.maint = t4_maint; - ts->span.open = t4_open; - ts->span.close = t4_close; - - /* HDLC Specific init */ - ts->sigchan = NULL; - ts->sigmode = sigmode; - ts->sigactive = 0; - - if (ts->spantype == TYPE_T1 || ts->spantype == TYPE_J1) { - ts->span.channels = 24; - ts->span.deflaw = ZT_LAW_MULAW; - ts->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF; - } else { - ts->span.channels = 31; - ts->span.deflaw = ZT_LAW_ALAW; - ts->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4; - } - ts->span.chans = ts->chans; - ts->span.flags = ZT_FLAG_RBS; - ts->span.ioctl = t4_ioctl; - ts->span.hdlc_hard_xmit = t4_hdlc_hard_xmit; - if (gen2) { -#ifdef VPM_SUPPORT - ts->span.echocan = t4_echocan; -#endif - ts->span.dacs = t4_dacs; - } - ts->span.pvt = ts; - ts->owner = wc; - ts->span.offset = x; - ts->writechunk = (void *)(wc->writechunk + x * 32 * 2); - ts->readchunk = (void *)(wc->readchunk + x * 32 * 2); - init_waitqueue_head(&ts->span.maintq); - for (y=0;ytspans[x]->span.channels;y++) { - struct zt_chan *mychans = ts->chans + y; - sprintf(mychans->name, "TE%d/%d/%d/%d", wc->numspans, wc->num, x + 1, y + 1); - mychans->sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_FXSLS | ZT_SIG_FXSGS | ZT_SIG_FXSKS | ZT_SIG_HARDHDLC | ZT_SIG_MTP2 | - ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_EM_E1 | ZT_SIG_DACS_RBS; - mychans->pvt = wc; - mychans->chanpos = y + 1; - if (gen2) { - mychans->writechunk = (void *)(wc->writechunk + (x * 32 + y + offset) * 2); - mychans->readchunk = (void *)(wc->readchunk + (x * 32 + y + offset) * 2); - } - } - } -} - -static void t4_serial_setup(struct t4 *wc, int unit) -{ - if (!wc->globalconfig) { - wc->globalconfig = 1; - printk("TE%dXXP: Setting up global serial parameters\n", wc->numspans); - t4_framer_out(wc, 0, 0x85, 0xe0); /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */ - t4_framer_out(wc, 0, 0x08, 0x01); /* IPC: Interrupt push/pull active low */ - - /* Global clocks (8.192 Mhz CLK) */ - t4_framer_out(wc, 0, 0x92, 0x00); - t4_framer_out(wc, 0, 0x93, 0x18); - t4_framer_out(wc, 0, 0x94, 0xfb); - t4_framer_out(wc, 0, 0x95, 0x0b); - t4_framer_out(wc, 0, 0x96, 0x00); - t4_framer_out(wc, 0, 0x97, 0x0b); - t4_framer_out(wc, 0, 0x98, 0xdb); - t4_framer_out(wc, 0, 0x99, 0xdf); - } - - /* Configure interrupts */ - t4_framer_out(wc, unit, FRMR_GCR, 0x00); /* GCR: Interrupt on Activation/Deactivation of each */ - - /* Configure system interface */ - t4_framer_out(wc, unit, FRMR_SIC1, 0xc2); /* SIC1: 8.192 Mhz clock/bus, double buffer receive / transmit, byte interleaved */ - t4_framer_out(wc, unit, FRMR_SIC2, 0x20 | (unit << 1)); /* SIC2: No FFS, no center receive eliastic buffer, phase */ - t4_framer_out(wc, unit, FRMR_SIC3, 0x04); /* SIC3: Edges for capture */ - t4_framer_out(wc, unit, FRMR_CMR2, 0x00); /* CMR2: We provide sync and clock for tx and rx. */ - if (!wc->t1e1) { /* T1 mode */ - t4_framer_out(wc, unit, FRMR_XC0, 0x03); /* XC0: Normal operation of Sa-bits */ - t4_framer_out(wc, unit, FRMR_XC1, 0x84); /* XC1: 0 offset */ - if (wc->tspans[unit]->spantype == TYPE_J1) - t4_framer_out(wc, unit, FRMR_RC0, 0x83); /* RC0: Just shy of 1023 */ - else - t4_framer_out(wc, unit, FRMR_RC0, 0x03); /* RC0: Just shy of 1023 */ - t4_framer_out(wc, unit, FRMR_RC1, 0x84); /* RC1: The rest of RC0 */ - } else { /* E1 mode */ - t4_framer_out(wc, unit, FRMR_XC0, 0x00); /* XC0: Normal operation of Sa-bits */ - t4_framer_out(wc, unit, FRMR_XC1, 0x04); /* XC1: 0 offset */ - t4_framer_out(wc, unit, FRMR_RC0, 0x04); /* RC0: Just shy of 1023 */ - t4_framer_out(wc, unit, FRMR_RC1, 0x04); /* RC1: The rest of RC0 */ - } - - /* Configure ports */ - t4_framer_out(wc, unit, 0x80, 0x00); /* PC1: SPYR/SPYX input on RPA/XPA */ - t4_framer_out(wc, unit, 0x81, 0x22); /* PC2: RMFB/XSIG output/input on RPB/XPB */ - t4_framer_out(wc, unit, 0x82, 0x65); /* PC3: Some unused stuff */ - t4_framer_out(wc, unit, 0x83, 0x35); /* PC4: Some more unused stuff */ - t4_framer_out(wc, unit, 0x84, 0x01); /* PC5: XMFS active low, SCLKR is input, RCLK is output */ - if (debug & DEBUG_MAIN) - printk("Successfully initialized serial bus for unit %d\n", unit); -} - -static int syncsrc = 0; -static int syncnum = 0 /* -1 */; -static int syncspan = 0; -#ifdef DEFINE_SPINLOCK -static DEFINE_SPINLOCK(synclock); -#else -static spinlock_t synclock = SPIN_LOCK_UNLOCKED; -#endif - -static void __t4_set_timing_source(struct t4 *wc, int unit, int master, int slave) -{ - unsigned int timing; - int x; - if (unit != wc->syncsrc) { - timing = 0x34; /* CMR1: RCLK unit, 8.192 Mhz TCLK, RCLK is 8.192 Mhz */ - if ((unit > -1) && (unit < 4)) { - timing |= (unit << 6); - for (x=0;xnumspans;x++) /* set all 4 receive reference clocks to unit */ - __t4_framer_out(wc, x, 0x44, timing); - wc->dmactrl |= (1 << 29); - } else { - for (x=0;xnumspans;x++) /* set each receive reference clock to itself */ - __t4_framer_out(wc, x, 0x44, timing | (x << 6)); - wc->dmactrl &= ~(1 << 29); - } - if (slave) - wc->dmactrl |= (1 << 25); - else - wc->dmactrl &= ~(1 << 25); - if (master) - wc->dmactrl |= (1 << 24); - else - wc->dmactrl &= ~(1 << 24); - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - if (!master && !slave) - wc->syncsrc = unit; - if ((unit < 0) || (unit > 3)) - unit = 0; - else - unit++; - if (!master && !slave) { - for (x=0;xnumspans;x++) - wc->tspans[x]->span.syncsrc = unit; - } - } else { - if (debug & DEBUG_MAIN) - printk("TE%dXXP: Timing source already set to %d\n", wc->numspans, unit); - } -#if 0 - printk("wct4xxp: Timing source set to %d\n",unit); -#endif -} - -static inline void __t4_update_timing(struct t4 *wc) -{ - int i; - /* update sync src info */ - if (wc->syncsrc != syncsrc) { - printk("Swapping card %d from %d to %d\n", wc->num, wc->syncsrc, syncsrc); - wc->syncsrc = syncsrc; - /* Update sync sources */ - for (i = 0; i < wc->numspans; i++) { - wc->tspans[i]->span.syncsrc = wc->syncsrc; - } - if (syncnum == wc->num) { - __t4_set_timing_source(wc, syncspan-1, 1, 0); - if (debug) printk("Card %d, using sync span %d, master\n", wc->num, syncspan); - } else { - __t4_set_timing_source(wc, syncspan-1, 0, 1); - if (debug) printk("Card %d, using Timing Bus, NOT master\n", wc->num); - } - } -} - -static int __t4_findsync(struct t4 *wc) -{ - int i; - int x; - unsigned long flags; - int p; - int nonzero; - int newsyncsrc = 0; /* Zaptel span number */ - int newsyncnum = 0; /* wct4xxp card number */ - int newsyncspan = 0; /* span on given wct4xxp card */ - spin_lock_irqsave(&synclock, flags); -#if 1 - if (!wc->num) { - /* If we're the first card, go through all the motions, up to 8 levels - of sync source */ - p = 1; - while (p < 8) { - nonzero = 0; - for (x=0;cards[x];x++) { - for (i = 0; i < wc->numspans; i++) { - if (cards[x]->tspans[i]->syncpos) { - nonzero = 1; - if ((cards[x]->tspans[i]->syncpos == p) && - !(cards[x]->tspans[i]->span.alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_LOOPBACK)) && - (cards[x]->tspans[i]->span.flags & ZT_FLAG_RUNNING)) { - /* This makes a good sync source */ - newsyncsrc = cards[x]->tspans[i]->span.spanno; - newsyncnum = x; - newsyncspan = i + 1; - /* Jump out */ - goto found; - } - } - } - } - if (nonzero) - p++; - else - break; - } -found: - if ((syncnum != newsyncnum) || (syncsrc != newsyncsrc) || (newsyncspan != syncspan)) { - if (debug) printk("New syncnum: %d (was %d), syncsrc: %d (was %d), syncspan: %d (was %d)\n", newsyncnum, syncnum, newsyncsrc, syncsrc, newsyncspan, syncspan); - syncnum = newsyncnum; - syncsrc = newsyncsrc; - syncspan = newsyncspan; - for (x=0;cards[x];x++) { - __t4_update_timing(cards[x]); - } - } - } else - set_bit(T4_CHECK_TIMING, &cards[0]->checkflag); -#endif - spin_unlock_irqrestore(&synclock, flags); - return 0; -} - -static void __t4_set_timing_source_auto(struct t4 *wc) -{ - int x; - printk("timing source auto card %d!\n", wc->num); - clear_bit(T4_CHECK_TIMING, &wc->checkflag); - if (timingcable) { - __t4_findsync(wc); - } else { - for (x=0;xnumspans;x++) { - if (wc->tspans[x]->sync) { - if ((wc->tspans[wc->tspans[x]->psync - 1]->span.flags & ZT_FLAG_RUNNING) && - !(wc->tspans[wc->tspans[x]->psync - 1]->span.alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE) )) { - /* Valid timing source */ - __t4_set_timing_source(wc, wc->tspans[x]->psync - 1, 0, 0); - return; - } - } - } - __t4_set_timing_source(wc, 4, 0, 0); - } -} - -static void __t4_configure_t1(struct t4 *wc, int unit, int lineconfig, int txlevel) -{ - unsigned int fmr4, fmr2, fmr1, fmr0, lim2; - char *framing, *line; - int mytxlevel; - if ((txlevel > 7) || (txlevel < 4)) - mytxlevel = 0; - else - mytxlevel = txlevel - 4; - fmr1 = 0x9c; /* FMR1: Mode 1, T1 mode, CRC on for ESF, 8.192 Mhz system data rate, no XAIS */ - fmr2 = 0x22; /* FMR2: no payload loopback, auto send yellow alarm */ - if (loopback) - fmr2 |= 0x4; - fmr4 = 0x0c; /* FMR4: Lose sync on 2 out of 5 framing bits, auto resync */ - lim2 = 0x21; /* LIM2: 50% peak is a "1", Advanced Loss recovery */ - lim2 |= (mytxlevel << 6); /* LIM2: Add line buildout */ - __t4_framer_out(wc, unit, 0x1d, fmr1); - __t4_framer_out(wc, unit, 0x1e, fmr2); - - /* Configure line interface */ - if (lineconfig & ZT_CONFIG_AMI) { - line = "AMI"; - fmr0 = 0xa0; - } else { - line = "B8ZS"; - fmr0 = 0xf0; - } - if (lineconfig & ZT_CONFIG_D4) { - framing = "D4"; - } else { - framing = "ESF"; - fmr4 |= 0x2; - fmr2 |= 0xc0; - } - __t4_framer_out(wc, unit, 0x1c, fmr0); - __t4_framer_out(wc, unit, 0x20, fmr4); - __t4_framer_out(wc, unit, 0x21, 0x40); /* FMR5: Enable RBS mode */ - - __t4_framer_out(wc, unit, 0x37, 0xf0 ); /* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */ - __t4_framer_out(wc, unit, 0x36, 0x08); /* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */ - - __t4_framer_out(wc, unit, 0x02, 0x50); /* CMDR: Reset the receiver and transmitter line interface */ - __t4_framer_out(wc, unit, 0x02, 0x00); /* CMDR: Reset the receiver and transmitter line interface */ - - __t4_framer_out(wc, unit, 0x3a, lim2); /* LIM2: 50% peak amplitude is a "1" */ - __t4_framer_out(wc, unit, 0x38, 0x0a); /* PCD: LOS after 176 consecutive "zeros" */ - __t4_framer_out(wc, unit, 0x39, 0x15); /* PCR: 22 "ones" clear LOS */ - - /* Generate pulse mask for T1 */ - switch(mytxlevel) { - case 3: - __t4_framer_out(wc, unit, 0x26, 0x07); /* XPM0 */ - __t4_framer_out(wc, unit, 0x27, 0x01); /* XPM1 */ - __t4_framer_out(wc, unit, 0x28, 0x00); /* XPM2 */ - break; - case 2: - __t4_framer_out(wc, unit, 0x26, 0x8c); /* XPM0 */ - __t4_framer_out(wc, unit, 0x27, 0x11); /* XPM1 */ - __t4_framer_out(wc, unit, 0x28, 0x01); /* XPM2 */ - break; - case 1: - __t4_framer_out(wc, unit, 0x26, 0x8c); /* XPM0 */ - __t4_framer_out(wc, unit, 0x27, 0x01); /* XPM1 */ - __t4_framer_out(wc, unit, 0x28, 0x00); /* XPM2 */ - break; - case 0: - default: - __t4_framer_out(wc, unit, 0x26, 0xd7); /* XPM0 */ - __t4_framer_out(wc, unit, 0x27, 0x22); /* XPM1 */ - __t4_framer_out(wc, unit, 0x28, 0x01); /* XPM2 */ - break; - } - - /* Don't mask framer interrupts if hardware HDLC is in use */ - __t4_framer_out(wc, unit, FRMR_IMR0, 0xff & ~((wc->tspans[unit]->sigchan) ? HDLC_IMR0_MASK : 0)); /* IMR0: We care about CAS changes, etc */ - __t4_framer_out(wc, unit, FRMR_IMR1, 0xff & ~((wc->tspans[unit]->sigchan) ? HDLC_IMR1_MASK : 0)); /* IMR1: We care about nothing */ - __t4_framer_out(wc, unit, 0x16, 0x00); /* IMR2: We care about all the alarm stuff! */ - __t4_framer_out(wc, unit, 0x17, 0xf4); /* IMR3: We care about AIS and friends */ - __t4_framer_out(wc, unit, 0x18, 0x3f); /* IMR4: We care about slips on transmit */ - - printk("TE%dXXP: Span %d configured for %s/%s\n", wc->numspans, unit + 1, framing, line); -} - -static void __t4_configure_e1(struct t4 *wc, int unit, int lineconfig) -{ - unsigned int fmr2, fmr1, fmr0; - unsigned int cas = 0; - unsigned int imr3extra=0; - char *crc4 = ""; - char *framing, *line; - fmr1 = 0x44; /* FMR1: E1 mode, Automatic force resync, PCM30 mode, 8.192 Mhz backplane, no XAIS */ - fmr2 = 0x03; /* FMR2: Auto transmit remote alarm, auto loss of multiframe recovery, no payload loopback */ - if (loopback) - fmr2 |= 0x4; - if (lineconfig & ZT_CONFIG_CRC4) { - fmr1 |= 0x08; /* CRC4 transmit */ - fmr2 |= 0xc0; /* CRC4 receive */ - crc4 = "/CRC4"; - } - __t4_framer_out(wc, unit, 0x1d, fmr1); - __t4_framer_out(wc, unit, 0x1e, fmr2); - - /* Configure line interface */ - if (lineconfig & ZT_CONFIG_AMI) { - line = "AMI"; - fmr0 = 0xa0; - } else { - line = "HDB3"; - fmr0 = 0xf0; - } - if (lineconfig & ZT_CONFIG_CCS) { - framing = "CCS"; - imr3extra = 0x28; - } else { - framing = "CAS"; - cas = 0x40; - } - __t4_framer_out(wc, unit, 0x1c, fmr0); - - __t4_framer_out(wc, unit, 0x37, 0xf0 /*| 0x6 */ ); /* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */ - __t4_framer_out(wc, unit, 0x36, 0x08); /* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */ - - __t4_framer_out(wc, unit, 0x02, 0x50); /* CMDR: Reset the receiver and transmitter line interface */ - __t4_framer_out(wc, unit, 0x02, 0x00); /* CMDR: Reset the receiver and transmitter line interface */ - - /* Condition receive line interface for E1 after reset */ - __t4_framer_out(wc, unit, 0xbb, 0x17); - __t4_framer_out(wc, unit, 0xbc, 0x55); - __t4_framer_out(wc, unit, 0xbb, 0x97); - __t4_framer_out(wc, unit, 0xbb, 0x11); - __t4_framer_out(wc, unit, 0xbc, 0xaa); - __t4_framer_out(wc, unit, 0xbb, 0x91); - __t4_framer_out(wc, unit, 0xbb, 0x12); - __t4_framer_out(wc, unit, 0xbc, 0x55); - __t4_framer_out(wc, unit, 0xbb, 0x92); - __t4_framer_out(wc, unit, 0xbb, 0x0c); - __t4_framer_out(wc, unit, 0xbb, 0x00); - __t4_framer_out(wc, unit, 0xbb, 0x8c); - - __t4_framer_out(wc, unit, 0x3a, 0x20); /* LIM2: 50% peak amplitude is a "1" */ - __t4_framer_out(wc, unit, 0x38, 0x0a); /* PCD: LOS after 176 consecutive "zeros" */ - __t4_framer_out(wc, unit, 0x39, 0x15); /* PCR: 22 "ones" clear LOS */ - - __t4_framer_out(wc, unit, 0x20, 0x9f); /* XSW: Spare bits all to 1 */ - __t4_framer_out(wc, unit, 0x21, 0x1c|cas); /* XSP: E-bit set when async. AXS auto, XSIF to 1 */ - - - /* Generate pulse mask for E1 */ - __t4_framer_out(wc, unit, 0x26, 0x54); /* XPM0 */ - __t4_framer_out(wc, unit, 0x27, 0x02); /* XPM1 */ - __t4_framer_out(wc, unit, 0x28, 0x00); /* XPM2 */ - - /* Don't mask framer interrupts if hardware HDLC is in use */ - __t4_framer_out(wc, unit, FRMR_IMR0, 0xff & ~((wc->tspans[unit]->sigchan) ? HDLC_IMR0_MASK : 0)); /* IMR0: We care about CRC errors, CAS changes, etc */ - __t4_framer_out(wc, unit, FRMR_IMR1, 0x3f & ~((wc->tspans[unit]->sigchan) ? HDLC_IMR1_MASK : 0)); /* IMR1: We care about loopup / loopdown */ - __t4_framer_out(wc, unit, 0x16, 0x00); /* IMR2: We care about all the alarm stuff! */ - __t4_framer_out(wc, unit, 0x17, 0xc4 | imr3extra); /* IMR3: We care about AIS and friends */ - __t4_framer_out(wc, unit, 0x18, 0x3f); /* IMR4: We care about slips on transmit */ - - printk("TE%dXXP: Span %d configured for %s/%s%s\n", wc->numspans, unit + 1, framing, line, crc4); -} - -static int t4_startup(struct zt_span *span) -{ -#ifdef SUPPORT_GEN1 - int i; -#endif - int tspan; - unsigned long flags; - int alreadyrunning; - struct t4_span *ts = span->pvt; - struct t4 *wc = ts->owner; - - printk("About to enter startup!\n"); - tspan = span->offset + 1; - if (tspan < 0) { - printk("TE%dXXP: Span '%d' isn't us?\n", wc->numspans, span->spanno); - return -1; - } - - spin_lock_irqsave(&wc->reglock, flags); - - alreadyrunning = span->flags & ZT_FLAG_RUNNING; - -#ifdef SUPPORT_GEN1 - /* initialize the start value for the entire chunk of last ec buffer */ - for(i = 0; i < span->channels; i++) - { - memset(ts->ec_chunk1[i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - memset(ts->ec_chunk2[i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - } -#endif - /* Force re-evaluation fo timing source */ - if (timingcable) - wc->syncsrc = -1; - - if (ts->spantype == TYPE_E1) { /* if this is an E1 card */ - __t4_configure_e1(wc, span->offset, span->lineconfig); - } else { /* is a T1 card */ - __t4_configure_t1(wc, span->offset, span->lineconfig, span->txlevel); - } - - /* Note clear channel status */ - wc->tspans[span->offset]->notclear = 0; - __set_clear(wc, span->offset); - - if (!alreadyrunning) { - span->flags |= ZT_FLAG_RUNNING; - wc->spansstarted++; - /* enable interrupts */ - /* Start DMA, enabling DMA interrupts on read only */ - wc->dmactrl = 1 << 29; -#if 0 - /* Enable framer only interrupts */ - wc->dmactrl |= 1 << 27; -#endif - wc->dmactrl |= (ts->spanflags & FLAG_2NDGEN) ? 0xc0000000 : 0xc0000003; -#ifdef VPM_SUPPORT - wc->dmactrl |= wc->vpm; -#endif - /* Seed interrupt register */ - __t4_pci_out(wc, WC_INTR, 0x0c); - if (noburst && !(ts->spanflags & FLAG_BURST)) - wc->dmactrl |= (1 << 26); - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - - /* Startup HDLC controller too */ - } - - if (ts->sigchan) { - struct zt_chan *sigchan = ts->sigchan; - - spin_unlock_irqrestore(&wc->reglock, flags); - if (hdlc_start(wc, span->offset, sigchan, ts->sigmode)) { - printk("Error initializing signalling controller\n"); - return -1; - } - spin_lock_irqsave(&wc->reglock, flags); - } - - spin_unlock_irqrestore(&wc->reglock, flags); - - t4_check_alarms(wc, span->offset); - t4_check_sigbits(wc, span->offset); - - if (wc->tspans[0]->sync == span->spanno) printk("SPAN %d: Primary Sync Source\n",span->spanno); - if (wc->tspans[1]->sync == span->spanno) printk("SPAN %d: Secondary Sync Source\n",span->spanno); - if (wc->numspans == 4) { - if (wc->tspans[2]->sync == span->spanno) printk("SPAN %d: Tertiary Sync Source\n",span->spanno); - if (wc->tspans[3]->sync == span->spanno) printk("SPAN %d: Quaternary Sync Source\n",span->spanno); - } -#ifdef VPM_SUPPORT - if (!alreadyrunning && !wc->vpm) { - wait_a_little(); - t4_vpm400_init(wc); - if (!wc->vpm) - t4_vpm450_init(wc); - wc->dmactrl |= wc->vpm; - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - } -#endif - printk("Completed startup!\n"); - return 0; -} - -#ifdef SUPPORT_GEN1 -static inline void e1_check(struct t4 *wc, int span, int val) -{ - struct t4_span *ts = wc->tspans[span]; - if ((ts->span.channels > 24) && - (ts->span.flags & ZT_FLAG_RUNNING) && - !(ts->span.alarms) && - (!wc->e1recover)) { - if (val != 0x1b) { - ts->e1check++; - } else - ts->e1check = 0; - if (ts->e1check > 100) { - /* Wait 1000 ms */ - wc->e1recover = 1000 * 8; - wc->tspans[0]->e1check = wc->tspans[1]->e1check = 0; - if (wc->numspans == 4) - wc->tspans[2]->e1check = wc->tspans[3]->e1check = 0; - if (debug & DEBUG_MAIN) - printk("Detected loss of E1 alignment on span %d!\n", span); - t4_reset_dma(wc); - } - } -} - -static void t4_receiveprep(struct t4 *wc, int irq) -{ - volatile unsigned int *readchunk; - int dbl = 0; - int x,y,z; - unsigned int tmp; - int offset=0; - if (!wc->t1e1) - offset = 4; - if (irq & 1) { - /* First part */ - readchunk = wc->readchunk; - if (!wc->last0) - dbl = 1; - wc->last0 = 0; - } else { - readchunk = wc->readchunk + ZT_CHUNKSIZE * 32; - if (wc->last0) - dbl = 1; - wc->last0 = 1; - } - if (dbl) { - for (x=0;xnumspans;x++) - wc->tspans[x]->irqmisses++; - if (debug & DEBUG_MAIN) - printk("TE%dXXP: Double/missed interrupt detected\n", wc->numspans); - } - for (x=0;xnumspans == 4) { - wc->tspans[3]->span.chans[z].readchunk[x] = tmp & 0xff; - wc->tspans[2]->span.chans[z].readchunk[x] = (tmp & 0xff00) >> 8; - } - wc->tspans[1]->span.chans[z].readchunk[x] = (tmp & 0xff0000) >> 16; - wc->tspans[0]->span.chans[z].readchunk[x] = tmp >> 24; - } - if (wc->t1e1) { - if (wc->e1recover > 0) - wc->e1recover--; - tmp = readchunk[0]; - if (wc->numspans == 4) { - e1_check(wc, 3, (tmp & 0x7f)); - e1_check(wc, 2, (tmp & 0x7f00) >> 8); - } - e1_check(wc, 1, (tmp & 0x7f0000) >> 16); - e1_check(wc, 0, (tmp & 0x7f000000) >> 24); - for (z=24;z<31;z++) { - /* Only E1 channels now */ - tmp = readchunk[z+1]; - if (wc->numspans == 4) { - if (wc->tspans[3]->span.channels > 24) - wc->tspans[3]->span.chans[z].readchunk[x] = tmp & 0xff; - if (wc->tspans[2]->span.channels > 24) - wc->tspans[2]->span.chans[z].readchunk[x] = (tmp & 0xff00) >> 8; - } - if (wc->tspans[1]->span.channels > 24) - wc->tspans[1]->span.chans[z].readchunk[x] = (tmp & 0xff0000) >> 16; - if (wc->tspans[0]->span.channels > 24) - wc->tspans[0]->span.chans[z].readchunk[x] = tmp >> 24; - } - } - /* Advance pointer by 4 TDM frame lengths */ - readchunk += 32; - } - for (x=0;xnumspans;x++) { - if (wc->tspans[x]->span.flags & ZT_FLAG_RUNNING) { - for (y=0;ytspans[x]->span.channels;y++) { - /* Echo cancel double buffered data */ - zt_ec_chunk(&wc->tspans[x]->span.chans[y], - wc->tspans[x]->span.chans[y].readchunk, - wc->tspans[x]->ec_chunk2[y]); - memcpy(wc->tspans[x]->ec_chunk2[y],wc->tspans[x]->ec_chunk1[y], - ZT_CHUNKSIZE); - memcpy(wc->tspans[x]->ec_chunk1[y], - wc->tspans[x]->span.chans[y].writechunk, - ZT_CHUNKSIZE); - } - zt_receive(&wc->tspans[x]->span); - } - } -} -#endif - -#if (ZT_CHUNKSIZE != 8) -#error Sorry, nextgen does not support chunksize != 8 -#endif - -static inline void __receive_span(struct t4_span *ts) -{ -#ifdef VPM_SUPPORT - int y; - unsigned long merged; - merged = ts->dtmfactive & ts->dtmfmutemask; - if (merged) { - for (y=0;yspan.channels;y++) { - /* Mute any DTMFs which are supposed to be muted */ - if (test_bit(y, &merged)) { - memset(ts->span.chans[y].readchunk, ZT_XLAW(0, (ts->span.chans + y)), ZT_CHUNKSIZE); - } - } - } -#endif - -#ifdef ENABLE_PREFETCH - prefetch((void *)(ts->readchunk)); - prefetch((void *)(ts->writechunk)); - prefetch((void *)(ts->readchunk + 8)); - prefetch((void *)(ts->writechunk + 8)); - prefetch((void *)(ts->readchunk + 16)); - prefetch((void *)(ts->writechunk + 16)); - prefetch((void *)(ts->readchunk + 24)); - prefetch((void *)(ts->writechunk + 24)); - prefetch((void *)(ts->readchunk + 32)); - prefetch((void *)(ts->writechunk + 32)); - prefetch((void *)(ts->readchunk + 40)); - prefetch((void *)(ts->writechunk + 40)); - prefetch((void *)(ts->readchunk + 48)); - prefetch((void *)(ts->writechunk + 48)); - prefetch((void *)(ts->readchunk + 56)); - prefetch((void *)(ts->writechunk + 56)); -#endif - - zt_ec_span(&ts->span); - zt_receive(&ts->span); -} - -static inline void __transmit_span(struct t4_span *ts) -{ - zt_transmit(&ts->span); -} - -#ifdef ENABLE_WORKQUEUES -static void workq_handlespan(void *data) -{ - struct t4_span *ts = data; - struct t4 *wc = ts->owner; - - __receive_span(ts); - __transmit_span(ts); - atomic_dec(&wc->worklist); - if (!atomic_read(&wc->worklist)) - t4_pci_out(wc, WC_INTR, 0); -} -#else -static void t4_prep_gen2(struct t4 *wc) -{ - int x; - for (x=0;xnumspans;x++) { - if (wc->tspans[x]->span.flags & ZT_FLAG_RUNNING) { - __receive_span(wc->tspans[x]); - __transmit_span(wc->tspans[x]); - } - } -} - -#endif -#ifdef SUPPORT_GEN1 -static void t4_transmitprep(struct t4 *wc, int irq) -{ - volatile unsigned int *writechunk; - int x,y,z; - unsigned int tmp; - int offset=0; - if (!wc->t1e1) - offset = 4; - if (irq & 1) { - /* First part */ - writechunk = wc->writechunk + 1; - } else { - writechunk = wc->writechunk + ZT_CHUNKSIZE * 32 + 1; - } - for (y=0;ynumspans;y++) { - if (wc->tspans[y]->span.flags & ZT_FLAG_RUNNING) - zt_transmit(&wc->tspans[y]->span); - } - - for (x=0;xtspans[3]->span.chans[z].writechunk[x]) | - (wc->tspans[2]->span.chans[z].writechunk[x] << 8) | - (wc->tspans[1]->span.chans[z].writechunk[x] << 16) | - (wc->tspans[0]->span.chans[z].writechunk[x] << 24); - writechunk[z+offset] = tmp; - } - if (wc->t1e1) { - for (z=24;z<31;z++) { - /* Only E1 channels now */ - tmp = 0; - if (wc->numspans == 4) { - if (wc->tspans[3]->span.channels > 24) - tmp |= wc->tspans[3]->span.chans[z].writechunk[x]; - if (wc->tspans[2]->span.channels > 24) - tmp |= (wc->tspans[2]->span.chans[z].writechunk[x] << 8); - } - if (wc->tspans[1]->span.channels > 24) - tmp |= (wc->tspans[1]->span.chans[z].writechunk[x] << 16); - if (wc->tspans[0]->span.channels > 24) - tmp |= (wc->tspans[0]->span.chans[z].writechunk[x] << 24); - writechunk[z] = tmp; - } - } - /* Advance pointer by 4 TDM frame lengths */ - writechunk += 32; - } - -} -#endif - -static void t4_check_sigbits(struct t4 *wc, int span) -{ - int a,i,rxs; - struct t4_span *ts = wc->tspans[span]; - - if (debug & DEBUG_RBS) - printk("Checking sigbits on span %d\n", span + 1); - - if (!(ts->span.flags & ZT_FLAG_RUNNING)) - return; - if (ts->spantype == TYPE_E1) { - for (i = 0; i < 15; i++) { - a = t4_framer_in(wc, span, 0x71 + i); - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(ts->span.chans[i+16].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+16].rxsig != rxs) - zt_rbsbits(&ts->span.chans[i+16], rxs); - } - rxs = (a >> 4) & 0xf; - if (!(ts->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i].rxsig != rxs) - zt_rbsbits(&ts->span.chans[i], rxs); - } - } - } else if (ts->span.lineconfig & ZT_CONFIG_D4) { - for (i = 0; i < 24; i+=4) { - a = t4_framer_in(wc, span, 0x70 + (i>>2)); - /* Get high channel in low bits */ - rxs = (a & 0x3) << 2; - if (!(ts->span.chans[i+3].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+3].rxsig != rxs) - zt_rbsbits(&ts->span.chans[i+3], rxs); - } - rxs = (a & 0xc); - if (!(ts->span.chans[i+2].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+2].rxsig != rxs) - zt_rbsbits(&ts->span.chans[i+2], rxs); - } - rxs = (a >> 2) & 0xc; - if (!(ts->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i+1].rxsig != rxs) - zt_rbsbits(&ts->span.chans[i+1], rxs); - } - rxs = (a >> 4) & 0xc; - if (!(ts->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (ts->span.chans[i].rxsig != rxs) - zt_rbsbits(&ts->span.chans[i], rxs); - } - } - } else { - for (i = 0; i < 24; i+=2) { - a = t4_framer_in(wc, span, 0x70 + (i>>1)); - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(ts->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - /* XXX Not really reset on every trans! XXX */ - if (ts->span.chans[i+1].rxsig != rxs) { - zt_rbsbits(&ts->span.chans[i+1], rxs); - } - } - rxs = (a >> 4) & 0xf; - if (!(ts->span.chans[i].sig & ZT_SIG_CLEAR)) { - /* XXX Not really reset on every trans! XXX */ - if (ts->span.chans[i].rxsig != rxs) { - zt_rbsbits(&ts->span.chans[i], rxs); - } - } - } - } -} - -static void t4_check_alarms(struct t4 *wc, int span) -{ - unsigned char c,d; - int alarms; - int x,j; - struct t4_span *ts = wc->tspans[span]; - unsigned long flags; - - if (!(ts->span.flags & ZT_FLAG_RUNNING)) - return; - - spin_lock_irqsave(&wc->reglock, flags); - - c = __t4_framer_in(wc, span, 0x4c); - d = __t4_framer_in(wc, span, 0x4d); - - /* Assume no alarms */ - alarms = 0; - - /* And consider only carrier alarms */ - ts->span.alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); - - if (ts->spantype == TYPE_E1) { - if (c & 0x04) { - /* No multiframe found, force RAI high after 400ms only if - we haven't found a multiframe since last loss - of frame */ - if (!(ts->spanflags & FLAG_NMF)) { - __t4_framer_out(wc, span, 0x20, 0x9f | 0x20); /* LIM0: Force RAI High */ - ts->spanflags |= FLAG_NMF; - printk("NMF workaround on!\n"); - } - __t4_framer_out(wc, span, 0x1e, 0xc3); /* Reset to CRC4 mode */ - __t4_framer_out(wc, span, 0x1c, 0xf2); /* Force Resync */ - __t4_framer_out(wc, span, 0x1c, 0xf0); /* Force Resync */ - } else if (!(c & 0x02)) { - if ((ts->spanflags & FLAG_NMF)) { - __t4_framer_out(wc, span, 0x20, 0x9f); /* LIM0: Clear forced RAI */ - ts->spanflags &= ~FLAG_NMF; - printk("NMF workaround off!\n"); - } - } - } else { - /* Detect loopup code if we're not sending one */ - if ((!ts->span.mainttimer) && (d & 0x08)) { - /* Loop-up code detected */ - if ((ts->loopupcnt++ > 80) && (ts->span.maintstat != ZT_MAINT_REMOTELOOP)) { - __t4_framer_out(wc, span, 0x36, 0x08); /* LIM0: Disable any local loop */ - __t4_framer_out(wc, span, 0x37, 0xf6 ); /* LIM1: Enable remote loop */ - ts->span.maintstat = ZT_MAINT_REMOTELOOP; - } - } else - ts->loopupcnt = 0; - /* Same for loopdown code */ - if ((!ts->span.mainttimer) && (d & 0x10)) { - /* Loop-down code detected */ - if ((ts->loopdowncnt++ > 80) && (ts->span.maintstat == ZT_MAINT_REMOTELOOP)) { - __t4_framer_out(wc, span, 0x36, 0x08); /* LIM0: Disable any local loop */ - __t4_framer_out(wc, span, 0x37, 0xf0 ); /* LIM1: Disable remote loop */ - ts->span.maintstat = ZT_MAINT_NONE; - } - } else - ts->loopdowncnt = 0; - } - - if (ts->span.lineconfig & ZT_CONFIG_NOTOPEN) { - for (x=0,j=0;x < ts->span.channels;x++) - if ((ts->span.chans[x].flags & ZT_FLAG_OPEN) || - (ts->span.chans[x].flags & ZT_FLAG_NETDEV)) - j++; - if (!j) - alarms |= ZT_ALARM_NOTOPEN; - } - - if (c & 0xa0) { - if (ts->alarmcount >= alarmdebounce) - alarms |= ZT_ALARM_RED; - else - ts->alarmcount++; - } else - ts->alarmcount = 0; - if (c & 0x4) - alarms |= ZT_ALARM_BLUE; - - if (((!ts->span.alarms) && alarms) || - (ts->span.alarms && (!alarms))) - set_bit(T4_CHECK_TIMING, &wc->checkflag); - - /* Keep track of recovering */ - if ((!alarms) && ts->span.alarms) - ts->alarmtimer = ZT_ALARMSETTLE_TIME; - if (ts->alarmtimer) - alarms |= ZT_ALARM_RECOVER; - - /* If receiving alarms, go into Yellow alarm state */ - if (alarms && !(ts->spanflags & FLAG_SENDINGYELLOW)) { - unsigned char fmr4; -#if 1 - printk("wct%dxxp: Setting yellow alarm on span %d\n", wc->numspans, span + 1); -#endif - /* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */ - fmr4 = __t4_framer_in(wc, span, 0x20); - __t4_framer_out(wc, span, 0x20, fmr4 | 0x20); - ts->spanflags |= FLAG_SENDINGYELLOW; - } else if ((!alarms) && (ts->spanflags & FLAG_SENDINGYELLOW)) { - unsigned char fmr4; -#if 1 - printk("wct%dxxp: Clearing yellow alarm on span %d\n", wc->numspans, span + 1); -#endif - /* We manually do yellow alarm to handle RECOVER */ - fmr4 = __t4_framer_in(wc, span, 0x20); - __t4_framer_out(wc, span, 0x20, fmr4 & ~0x20); - ts->spanflags &= ~FLAG_SENDINGYELLOW; - } - - /* Re-check the timing source when we enter/leave alarm, not withstanding - yellow alarm */ - if (c & 0x10) - alarms |= ZT_ALARM_YELLOW; - if (ts->span.mainttimer || ts->span.maintstat) - alarms |= ZT_ALARM_LOOPBACK; - ts->span.alarms = alarms; - spin_unlock_irqrestore(&wc->reglock, flags); - zt_alarm_notify(&ts->span); -} - -static void t4_do_counters(struct t4 *wc) -{ - int span; - for (span=0;spannumspans;span++) { - struct t4_span *ts = wc->tspans[span]; - int docheck=0; - - spin_lock(&wc->reglock); - if (ts->loopupcnt || ts->loopdowncnt) - docheck++; - if (ts->alarmtimer) { - if (!--ts->alarmtimer) { - docheck++; - ts->span.alarms &= ~(ZT_ALARM_RECOVER); - } - } - spin_unlock(&wc->reglock); - if (docheck) { - t4_check_alarms(wc, span); - zt_alarm_notify(&ts->span); - } - } -} - -static inline void __handle_leds(struct t4 *wc) -{ - int x; - - wc->blinktimer++; - for (x=0;xnumspans;x++) { - struct t4_span *ts = wc->tspans[x]; - if (ts->span.flags & ZT_FLAG_RUNNING) { - if (ts->span.alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE)) { -#ifdef FANCY_ALARM - if (wc->blinktimer == (altab[wc->alarmpos] >> 1)) { - __t4_set_led(wc, x, WC_RED); - } - if (wc->blinktimer == 0xf) { - __t4_set_led(wc, x, WC_OFF); - } -#else - if (wc->blinktimer == 160) { - __t4_set_led(wc, x, WC_RED); - } else if (wc->blinktimer == 480) { - __t4_set_led(wc, x, WC_OFF); - } -#endif - } else if (ts->span.alarms & ZT_ALARM_YELLOW) { - /* Yellow Alarm */ - __t4_set_led(wc, x, WC_YELLOW); - } else if (ts->span.mainttimer || ts->span.maintstat) { -#ifdef FANCY_ALARM - if (wc->blinktimer == (altab[wc->alarmpos] >> 1)) { - __t4_set_led(wc, x, WC_GREEN); - } - if (wc->blinktimer == 0xf) { - __t4_set_led(wc, x, WC_OFF); - } -#else - if (wc->blinktimer == 160) { - __t4_set_led(wc, x, WC_GREEN); - } else if (wc->blinktimer == 480) { - __t4_set_led(wc, x, WC_OFF); - } -#endif - } else { - /* No Alarm */ - __t4_set_led(wc, x, WC_GREEN); - } - } else - __t4_set_led(wc, x, WC_OFF); - - } -#ifdef FANCY_ALARM - if (wc->blinktimer == 0xf) { - wc->blinktimer = -1; - wc->alarmpos++; - if (wc->alarmpos >= (sizeof(altab) / sizeof(altab[0]))) - wc->alarmpos = 0; - } -#else - if (wc->blinktimer == 480) - wc->blinktimer = 0; -#endif -} - -static inline void t4_framer_interrupt(struct t4 *wc, int span) -{ - /* Check interrupts for a given span */ - unsigned char gis, isr0, isr1, isr2, isr3, isr4; - int readsize = -1; - struct t4_span *ts = wc->tspans[span]; - struct zt_chan *sigchan; - unsigned long flags; - - if (debug & DEBUG_FRAMER) - printk("framer interrupt span %d:%d!\n", wc->num, span + 1); - - /* 1st gen cards isn't used interrupts */ - gis = t4_framer_in(wc, span, FRMR_GIS); - isr0 = (gis & FRMR_GIS_ISR0) ? t4_framer_in(wc, span, FRMR_ISR0) : 0; - isr1 = (gis & FRMR_GIS_ISR1) ? t4_framer_in(wc, span, FRMR_ISR1) : 0; - isr2 = (gis & FRMR_GIS_ISR2) ? t4_framer_in(wc, span, FRMR_ISR2) : 0; - isr3 = (gis & FRMR_GIS_ISR3) ? t4_framer_in(wc, span, FRMR_ISR3) : 0; - isr4 = (gis & FRMR_GIS_ISR4) ? t4_framer_in(wc, span, FRMR_ISR4) : 0; - - if (debug & DEBUG_FRAMER) - printk("gis: %02x, isr0: %02x, isr1: %02x, isr2: %02x, isr3: %02x, isr4: %02x\n", gis, isr0, isr1, isr2, isr3, isr4); - - if (isr0) - t4_check_sigbits(wc, span); - - if (ts->spantype == TYPE_E1) { - /* E1 checks */ - if ((isr3 & 0x38) || isr2 || isr1) - t4_check_alarms(wc, span); - } else { - /* T1 checks */ - if (isr2 || (isr3 & 0x08)) - t4_check_alarms(wc, span); - } - if (!ts->span.alarms) { - if ((isr3 & 0x3) || (isr4 & 0xc0)) - ts->span.timingslips++; - - if (debug & DEBUG_MAIN) { - if (isr3 & 0x02) - printk("TE%d10P: RECEIVE slip NEGATIVE on span %d\n", wc->numspans, span + 1); - if (isr3 & 0x01) - printk("TE%d10P: RECEIVE slip POSITIVE on span %d\n", wc->numspans, span + 1); - if (isr4 & 0x80) - printk("TE%dXXP: TRANSMIT slip POSITIVE on span %d\n", wc->numspans, span + 1); - if (isr4 & 0x40) - printk("TE%d10P: TRANSMIT slip NEGATIVE on span %d\n", wc->numspans, span + 1); - } - } else - ts->span.timingslips = 0; - - spin_lock_irqsave(&wc->reglock, flags); - /* HDLC controller checks - receive side */ - if (!ts->sigchan) { - spin_unlock_irqrestore(&wc->reglock, flags); - return; - } - - sigchan = ts->sigchan; - spin_unlock_irqrestore(&wc->reglock, flags); - - if (isr0 & FRMR_ISR0_RME) { - readsize = (t4_framer_in(wc, span, FRMR_RBCH) << 8) | t4_framer_in(wc, span, FRMR_RBCL); - if (debug & DEBUG_FRAMER) printk("Received data length is %d (%d)\n", readsize, readsize & FRMR_RBCL_MAX_SIZE); - /* RPF isn't set on last part of frame */ - if ((readsize > 0) && ((readsize &= FRMR_RBCL_MAX_SIZE) == 0)) - readsize = 32; - } else if (isr0 & FRMR_ISR0_RPF) - readsize = 32; - - if (readsize > 0) { - int i; - unsigned char readbuf[readsize]; - - if (debug & DEBUG_FRAMER) printk("Framer %d: Got RPF/RME! readsize is %d\n", sigchan->span->offset, readsize); - - for (i = 0; i < readsize; i++) - readbuf[i] = t4_framer_in(wc, span, FRMR_RXFIFO); - - /* Tell the framer to clear the RFIFO */ - t4_framer_cmd_wait(wc, span, FRMR_CMDR_RMC); - - if (debug & DEBUG_FRAMER) { - printk("RX("); - for (i = 0; i < readsize; i++) - printk((i ? " %02x" : "%02x"), readbuf[i]); - printk(")\n"); - } - - if (isr0 & FRMR_ISR0_RME) { - /* Do checks for HDLC problems */ - unsigned char rsis = readbuf[readsize-1]; -#if 0 - unsigned int olddebug = debug; -#endif - unsigned char rsis_reg = t4_framer_in(wc, span, FRMR_RSIS); - -#if 0 - if ((rsis != 0xA2) || (rsis != rsis_reg)) - debug |= DEBUG_FRAMER; -#endif - - ++ts->frames_in; - if ((debug & DEBUG_FRAMER) && !(ts->frames_in & 0x0f)) - printk("Received %d frames on span %d\n", ts->frames_in, span); - if (debug & DEBUG_FRAMER) printk("Received HDLC frame %d. RSIS = 0x%x (%x)\n", ts->frames_in, rsis, rsis_reg); - if (!(rsis & FRMR_RSIS_CRC16)) { - if (debug & DEBUG_FRAMER) printk("CRC check failed %d\n", span); - zt_hdlc_abort(sigchan, ZT_EVENT_BADFCS); - } else if (rsis & FRMR_RSIS_RAB) { - if (debug & DEBUG_FRAMER) printk("ABORT of current frame due to overflow %d\n", span); - zt_hdlc_abort(sigchan, ZT_EVENT_ABORT); - } else if (rsis & FRMR_RSIS_RDO) { - if (debug & DEBUG_FRAMER) printk("HDLC overflow occured %d\n", span); - zt_hdlc_abort(sigchan, ZT_EVENT_OVERRUN); - } else if (!(rsis & FRMR_RSIS_VFR)) { - if (debug & DEBUG_FRAMER) printk("Valid Frame check failed on span %d\n", span); - zt_hdlc_abort(sigchan, ZT_EVENT_ABORT); - } else { - zt_hdlc_putbuf(sigchan, readbuf, readsize - 1); - zt_hdlc_finish(sigchan); - if (debug & DEBUG_FRAMER) printk("Received valid HDLC frame on span %d\n", span); - } -#if 0 - debug = olddebug; -#endif - } else if (isr0 & FRMR_ISR0_RPF) - zt_hdlc_putbuf(sigchan, readbuf, readsize); - } - - /* Transmit side */ - if (isr1 & FRMR_ISR1_XDU) { - if (debug & DEBUG_FRAMER) printk("XDU: Resetting signal controler!\n"); - t4_framer_cmd_wait(wc, span, FRMR_CMDR_SRES); - } else if (isr1 & FRMR_ISR1_XPR) { - if (debug & DEBUG_FRAMER) - printk("Sigchan %d is %p\n", sigchan->chanpos, sigchan); - - if (debug & DEBUG_FRAMER) printk("Framer %d: Got XPR!\n", sigchan->span->offset); - t4_hdlc_xmit_fifo(wc, span, ts); - } - - if (isr1 & FRMR_ISR1_ALLS) { - if (debug & DEBUG_FRAMER) printk("ALLS received\n"); - } - -} - -#ifdef SUPPORT_GEN1 -ZAP_IRQ_HANDLER(t4_interrupt) -{ - struct t4 *wc = dev_id; - unsigned long flags; - int x; - - unsigned int status; - unsigned int status2; - -#if 0 - if (wc->intcount < 20) - printk("Pre-interrupt\n"); -#endif - - /* Make sure it's really for us */ - status = __t4_pci_in(wc, WC_INTR); - - /* Process framer interrupts */ - status2 = t4_framer_in(wc, 0, FRMR_CIS); - if (status2 & 0x0f) { - for (x = 0; x < wc->numspans; ++x) { - if (status2 & (1 << x)) - t4_framer_interrupt(wc, x); - } - } - - /* Ignore if it's not for us */ - if (!status) -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - - __t4_pci_out(wc, WC_INTR, 0); - - if (!wc->spansstarted) { - printk("Not prepped yet!\n"); -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - } - - wc->intcount++; -#if 0 - if (wc->intcount < 20) - printk("Got interrupt, status = %08x\n", status); -#endif - - if (status & 0x3) { - t4_receiveprep(wc, status); - t4_transmitprep(wc, status); - } - -#if 0 - if ((wc->intcount < 10) || !(wc->intcount % 1000)) { - status2 = t4_framer_in(wc, 0, FRMR_CIS); - printk("Status2: %04x\n", status2); - for (x = 0;x<4;x++) { - status2 = t4_framer_in(wc, x, FRMR_FRS0); - printk("FRS0/%d: %04x\n", x, status2); - } - } -#endif - t4_do_counters(wc); - - x = wc->intcount & 15 /* 63 */; - switch(x) { - case 0: - case 1: - case 2: - case 3: - t4_check_sigbits(wc, x); - break; - case 4: - case 5: - case 6: - case 7: - t4_check_alarms(wc, x - 4); - break; - } - - spin_lock_irqsave(&wc->reglock, flags); - - __handle_leds(wc); - - if (test_bit(T4_CHECK_TIMING, &wc->checkflag)) - __t4_set_timing_source_auto(wc); - - spin_unlock_irqrestore(&wc->reglock, flags); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} -#endif - -static void t4_isr_bh(unsigned long data) -{ - struct t4 *wc = (struct t4 *)data; - -#ifdef VPM_SUPPORT - if (wc->vpm) { - if (test_and_clear_bit(T4_CHECK_VPM, &wc->checkflag)) { - if (wc->vpm450m) { - /* How stupid is it that the octasic can't generate an - interrupt when there's a tone, in spite of what their - documentation says? */ - t4_check_vpm450(wc); - } else - t4_check_vpm400(wc, wc->vpm400checkstatus); - } - } -#endif -} - -ZAP_IRQ_HANDLER(t4_interrupt_gen2) -{ - struct t4 *wc = dev_id; - unsigned int status; - - /* Check this first in case we get a spurious interrupt */ - if (unlikely(test_bit(T4_STOP_DMA, &wc->checkflag))) { - /* Stop DMA cleanly if requested */ - wc->dmactrl = 0x0; - t4_pci_out(wc, WC_DMACTRL, 0x00000000); - /* Acknowledge any pending interrupts */ - t4_pci_out(wc, WC_INTR, 0x00000000); - spin_lock(&wc->reglock); - __t4_set_timing_source(wc, 4, 0, 0); - spin_unlock(&wc->reglock); - return IRQ_RETVAL(1); - } - - /* Make sure it's really for us */ - status = __t4_pci_in(wc, WC_INTR); - - /* Ignore if it's not for us */ - if (!(status & 0x7)) { -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - } - -#ifdef ENABLE_WORKQUEUES - __t4_pci_out(wc, WC_INTR, status & 0x00000008); -#endif - - if (unlikely(!wc->spansstarted)) { - printk("Not prepped yet!\n"); -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - } - - wc->intcount++; - - if (unlikely((wc->intcount < 20) && debug)) - - printk("2G: Got interrupt, status = %08x, CIS = %04x\n", status, t4_framer_in(wc, 0, FRMR_CIS)); - - if (likely(status & 0x2)) { -#ifdef ENABLE_WORKQUEUES - int cpus = num_online_cpus(); - atomic_set(&wc->worklist, wc->numspans); - if (wc->tspans[0]->span.flags & ZT_FLAG_RUNNING) - t4_queue_work(wc->workq, &wc->tspans[0]->swork, 0); - else - atomic_dec(&wc->worklist); - if (wc->tspans[1]->span.flags & ZT_FLAG_RUNNING) - t4_queue_work(wc->workq, &wc->tspans[1]->swork, 1 % cpus); - else - atomic_dec(&wc->worklist); - if (wc->numspans == 4) { - if (wc->tspans[2]->span.flags & ZT_FLAG_RUNNING) - t4_queue_work(wc->workq, &wc->tspans[2]->swork, 2 % cpus); - else - atomic_dec(&wc->worklist); - if (wc->tspans[3]->span.flags & ZT_FLAG_RUNNING) - t4_queue_work(wc->workq, &wc->tspans[3]->swork, 3 % cpus); - else - atomic_dec(&wc->worklist); - } -#else - t4_prep_gen2(wc); -#endif - t4_do_counters(wc); - spin_lock(&wc->reglock); - __handle_leds(wc); - spin_unlock(&wc->reglock); - - } - - if (unlikely(status & 0x1)) { - unsigned char cis; - - cis = t4_framer_in(wc, 0, FRMR_CIS); - if (cis & FRMR_CIS_GIS1) - t4_framer_interrupt(wc, 0); - if (cis & FRMR_CIS_GIS2) - t4_framer_interrupt(wc, 1); - if (cis & FRMR_CIS_GIS3) - t4_framer_interrupt(wc, 2); - if (cis & FRMR_CIS_GIS4) - t4_framer_interrupt(wc, 3); - } - - if (wc->vpm && vpmdtmfsupport) { - if (wc->vpm450m) { - /* How stupid is it that the octasic can't generate an - interrupt when there's a tone, in spite of what their - documentation says? */ - if (!(wc->intcount & 0xf)) { - set_bit(T4_CHECK_VPM, &wc->checkflag); - } - } else if ((status & 0xff00) != 0xff00) { - wc->vpm400checkstatus = (status & 0xff00) >> 8; - set_bit(T4_CHECK_VPM, &wc->checkflag); - } - } - - spin_lock(&wc->reglock); - - if (unlikely(test_bit(T4_CHECK_TIMING, &wc->checkflag))) { - __t4_set_timing_source_auto(wc); - } - - spin_unlock(&wc->reglock); - - if (unlikely(test_bit(T4_CHECK_VPM, &wc->checkflag))) - tasklet_schedule(&wc->t4_tlet); - -#ifndef ENABLE_WORKQUEUES - __t4_pci_out(wc, WC_INTR, 0); -#endif -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} - -#ifdef SUPPORT_GEN1 -static int t4_reset_dma(struct t4 *wc) -{ - /* Turn off DMA and such */ - wc->dmactrl = 0x0; - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - t4_pci_out(wc, WC_COUNT, 0); - t4_pci_out(wc, WC_RDADDR, 0); - t4_pci_out(wc, WC_WRADDR, 0); - t4_pci_out(wc, WC_INTR, 0); - /* Turn it all back on */ - t4_pci_out(wc, WC_RDADDR, wc->readdma); - t4_pci_out(wc, WC_WRADDR, wc->writedma); - t4_pci_out(wc, WC_COUNT, ((ZT_MAX_CHUNKSIZE * 2 * 32 - 1) << 18) | ((ZT_MAX_CHUNKSIZE * 2 * 32 - 1) << 2)); - t4_pci_out(wc, WC_INTR, 0); -#ifdef VPM_SUPPORT - wc->dmactrl = 0xc0000000 | (1 << 29) | wc->vpm; -#else - wc->dmactrl = 0xc0000000 | (1 << 29); -#endif - if (noburst) - wc->dmactrl |= (1 << 26); - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - return 0; -} -#endif - -#ifdef VPM_SUPPORT -static void t4_vpm_set_dtmf_threshold(struct t4 *wc, unsigned int threshold) -{ - unsigned int x; - - for (x = 0; x < 8; x++) { - t4_vpm_out(wc, x, 0xC4, (threshold >> 8) & 0xFF); - t4_vpm_out(wc, x, 0xC5, (threshold & 0xFF)); - } - printk("VPM: DTMF threshold set to %d\n", threshold); -} - -static unsigned int t4_vpm_mask(int chip) -{ - unsigned int mask=0; - switch(vpmspans) { - case 4: - mask = 0x55555555 << (chip >> 2); - break; - case 2: - mask = 0x11111111 << (chip >> 1); - break; - case 1: - mask = 0x01010101 << chip; - break; - } - return mask; -} - -static int t4_vpm_spanno(int chip) -{ - int spanno = 0; - switch(vpmspans) { - case 4: - spanno = chip & 0x3; - break; - case 2: - spanno = chip & 0x1; - break; - /* Case 1 is implicit */ - } - return spanno; -} - -static int t4_vpm_echotail(void) -{ - int echotail = 0x01ff; - switch(vpmspans) { - case 4: - echotail = 0x007f; - break; - case 2: - echotail = 0x00ff; - break; - /* Case 1 is implicit */ - } - return echotail; -} - -static void t4_vpm450_init(struct t4 *wc) -{ - unsigned int check1, check2; - int laws[4] = { 0, }; - int x; - unsigned int vpm_capacity; - struct firmware embedded_firmware; - const struct firmware *firmware = &embedded_firmware; -#if !defined(HOTPLUG_FIRMWARE) - extern void _binary_zaptel_fw_oct6114_064_bin_size; - extern void _binary_zaptel_fw_oct6114_128_bin_size; - extern u8 _binary_zaptel_fw_oct6114_064_bin_start[]; - extern u8 _binary_zaptel_fw_oct6114_128_bin_start[]; -#else - static const char oct064_firmware[] = "zaptel-fw-oct6114-064.bin"; - static const char oct128_firmware[] = "zaptel-fw-oct6114-128.bin"; -#endif - - if (!vpmsupport) { - printk("VPM450: Support Disabled\n"); - return; - } - - /* Turn on GPIO/DATA mux if supported */ - t4_gpio_setdir(wc, (1 << 24), (1 << 24)); - __t4_raw_oct_out(wc, 0x000a, 0x5678); - __t4_raw_oct_out(wc, 0x0004, 0x1234); - check1 = __t4_raw_oct_in(wc, 0x0004); - check2 = __t4_raw_oct_in(wc, 0x000a); - if (debug) - printk("OCT Result: %04x/%04x\n", __t4_raw_oct_in(wc, 0x0004), __t4_raw_oct_in(wc, 0x000a)); - if (__t4_raw_oct_in(wc, 0x0004) != 0x1234) { - printk("VPM450: Not Present\n"); - return; - } - - /* Setup alaw vs ulaw rules */ - for (x = 0;x < wc->numspans; x++) { - if (wc->tspans[x]->span.channels > 24) - laws[x] = 1; - } - - switch ((vpm_capacity = get_vpm450m_capacity(wc))) { - case 64: -#if defined(HOTPLUG_FIRMWARE) - if ((request_firmware(&firmware, oct064_firmware, &wc->dev->dev) != 0) || - !firmware) { - printk("VPM450: firmware %s not available from userspace\n", oct064_firmware); - return; - } -#else - embedded_firmware.data = _binary_zaptel_fw_oct6114_064_bin_start; - /* Yes... this is weird. objcopy gives us a symbol containing - the size of the firmware, not a pointer a variable containing - the size. The only way we can get the value of the symbol - is to take its address, so we define it as a pointer and - then cast that value to the proper type. - */ - embedded_firmware.size = (size_t) &_binary_zaptel_fw_oct6114_064_bin_size; -#endif - break; - case 128: -#if defined(HOTPLUG_FIRMWARE) - if ((request_firmware(&firmware, oct128_firmware, &wc->dev->dev) != 0) || - !firmware) { - printk("VPM450: firmware %s not available from userspace\n", oct128_firmware); - return; - } -#else - embedded_firmware.data = _binary_zaptel_fw_oct6114_128_bin_start; - /* Yes... this is weird. objcopy gives us a symbol containing - the size of the firmware, not a pointer a variable containing - the size. The only way we can get the value of the symbol - is to take its address, so we define it as a pointer and - then cast that value to the proper type. - */ - embedded_firmware.size = (size_t) &_binary_zaptel_fw_oct6114_128_bin_size; -#endif - break; - default: - printk("Unsupported channel capacity found on VPM module (%d).\n", vpm_capacity); - return; - } - - if (!(wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) { - printk("VPM450: Failed to initialize\n"); - if (firmware != &embedded_firmware) - release_firmware(firmware); - return; - } - - if (firmware != &embedded_firmware) - release_firmware(firmware); - - if (vpmdtmfsupport == -1) { - printk("VPM450: hardware DTMF disabled.\n"); - vpmdtmfsupport = 0; - } - - wc->vpm = T4_VPM_PRESENT; - printk("VPM450: Present and operational servicing %d span(s)\n", wc->numspans); - -} - -static void t4_vpm400_init(struct t4 *wc) -{ - unsigned char reg; - unsigned int mask; - unsigned int ver; - unsigned int i, x, y, gen2vpm=0; - - if (!vpmsupport) { - printk("VPM400: Support Disabled\n"); - return; - } - - switch(vpmspans) { - case 4: - case 2: - case 1: - break; - default: - printk("VPM400: %d is not a valid vpmspans value, using 4\n", vpmspans); - vpmspans = 4; - } - - for (x=0;x<8;x++) { - int spanno = t4_vpm_spanno(x); - struct t4_span *ts = wc->tspans[spanno]; - int echotail = t4_vpm_echotail(); - - ver = t4_vpm_in(wc, x, 0x1a0); /* revision */ - if ((ver != 0x26) && (ver != 0x33)) { - printk("VPM400: %s\n", x ? "Inoperable" : "Not Present"); - return; - } - if (ver == 0x33) { - if (x && !gen2vpm) { - printk("VPM400: Inconsistent\n"); - return; - } - ts->spanflags |= FLAG_VPM2GEN; - gen2vpm++; - } else if (gen2vpm) { - printk("VPM400: Inconsistent\n"); - return; - } - - - /* Setup GPIO's */ - for (y=0;y<4;y++) { - t4_vpm_out(wc, x, 0x1a8 + y, 0x00); /* GPIO out */ - t4_vpm_out(wc, x, 0x1ac + y, 0x00); /* GPIO dir */ - t4_vpm_out(wc, x, 0x1b0 + y, 0x00); /* GPIO sel */ - } - - /* Setup TDM path - sets fsync and tdm_clk as inputs */ - reg = t4_vpm_in(wc, x, 0x1a3); /* misc_con */ - t4_vpm_out(wc, x, 0x1a3, reg & ~2); - - /* Setup timeslots */ - t4_vpm_out(wc, x, 0x02f, 0x20 | (spanno << 3)); - - /* Setup Echo length (128 taps) */ - t4_vpm_out(wc, x, 0x022, (echotail >> 8)); - t4_vpm_out(wc, x, 0x023, (echotail & 0xff)); - - /* Setup the tdm channel masks for all chips*/ - mask = t4_vpm_mask(x); - for (i = 0; i < 4; i++) - t4_vpm_out(wc, x, 0x30 + i, (mask >> (i << 3)) & 0xff); - - /* Setup convergence rate */ - reg = t4_vpm_in(wc,x,0x20); - reg &= 0xE0; - if (ts->spantype == TYPE_E1) { - if (x < vpmspans) - printk("VPM400: Span %d A-law mode\n", spanno); - reg |= 0x01; - } else { - if (x < vpmspans) - printk("VPM400: Span %d U-law mode\n", spanno); - reg &= ~0x01; - } - t4_vpm_out(wc,x,0x20,(reg | 0x20)); - - /* Initialize echo cans */ - for (i = 0 ; i < MAX_TDM_CHAN; i++) { - if (mask & (0x00000001 << i)) - t4_vpm_out(wc,x,i,0x00); - } - - wait_a_little(); - - /* Put in bypass mode */ - for (i = 0 ; i < MAX_TDM_CHAN ; i++) { - if (mask & (0x00000001 << i)) { - t4_vpm_out(wc,x,i,0x01); - } - } - - /* Enable bypass */ - for (i = 0 ; i < MAX_TDM_CHAN ; i++) { - if (mask & (0x00000001 << i)) - t4_vpm_out(wc,x,0x78 + i,0x01); - } - - /* set DTMF detection threshold */ - t4_vpm_set_dtmf_threshold(wc, dtmfthreshold); - - /* Enable DTMF detectors (always DTMF detect all spans) */ - for (i = 0; i < MAX_DTMF_DET; i++) { - t4_vpm_out(wc, x, 0x98 + i, 0x40 | (i * 2) | ((x < 4) ? 0 : 1)); - } - for (i = 0x34; i < 0x38; i++) - t4_vpm_out(wc, x, i, 0x00); - for (i = 0x3C; i < 0x40; i++) - t4_vpm_out(wc, x, i, 0x00); - - for (i = 0x48; i < 0x4B; i++) - t4_vpm_out(wc, x, i, 0x00); - for (i = 0x50; i < 0x53; i++) - t4_vpm_out(wc, x, i, 0x00); - for (i = 0xB8; i < 0xBE; i++) - t4_vpm_out(wc, x, i, 0xFF); - if (gen2vpm) { - for (i = 0xBE; i < 0xC0; i++) - t4_vpm_out(wc, x, i, 0xFF); - } else { - for (i = 0xBE; i < 0xC0; i++) - t4_vpm_out(wc, x, i, 0x00); - } - for (i = 0xC0; i < 0xC4; i++) - t4_vpm_out(wc, x, i, (x < 4) ? 0x55 : 0xAA); - - } - if (vpmdtmfsupport == -1) { - printk("VPM400: hardware DTMF enabled.\n"); - vpmdtmfsupport = 0; - } - printk("VPM400%s: Present and operational servicing %d span(s)\n", (gen2vpm ? " (2nd Gen)" : ""), wc->numspans); - wc->vpm = T4_VPM_PRESENT; -} - -#endif - -static void t4_tsi_reset(struct t4 *wc) -{ - int x; - for (x=0;x<128;x++) { - wc->dmactrl &= ~0x00007fff; - wc->dmactrl |= (0x00004000 | (x << 7)); - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - } - wc->dmactrl &= ~0x00007fff; - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); -} - -/* Note that channels here start from 1 */ -static void t4_tsi_assign(struct t4 *wc, int fromspan, int fromchan, int tospan, int tochan) -{ - unsigned long flags; - int fromts, tots; - - fromts = (fromspan << 5) |(fromchan); - tots = (tospan << 5) | (tochan); - - if (!wc->t1e1) { - fromts += 4; - tots += 4; - } - spin_lock_irqsave(&wc->reglock, flags); - wc->dmactrl &= ~0x00007fff; - wc->dmactrl |= (0x00004000 | (tots << 7) | (fromts)); - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - wc->dmactrl &= ~0x00007fff; - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static void t4_tsi_unassign(struct t4 *wc, int tospan, int tochan) -{ - unsigned long flags; - int tots; - - tots = (tospan << 5) | (tochan); - - if (!wc->t1e1) - tots += 4; - spin_lock_irqsave(&wc->reglock, flags); - wc->dmactrl &= ~0x00007fff; - wc->dmactrl |= (0x00004000 | (tots << 7)); - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - if (debug & DEBUG_TSI) - printk("Sending '%08x\n", wc->dmactrl); - wc->dmactrl &= ~0x00007fff; - __t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static int t4_hardware_init_1(struct t4 *wc, unsigned int cardflags) -{ - unsigned int version; - - version = t4_pci_in(wc, WC_VERSION); - printk("TE%dXXP version %08x, burst %s\n", wc->numspans, version, (!(cardflags & FLAG_BURST) && noburst) ? "OFF" : "ON"); -#ifdef ENABLE_WORKQUEUES - printk("TE%dXXP running with work queues.\n", wc->numspans); -#endif - - /* Make sure DMA engine is not running and interrupts are acknowledged */ - wc->dmactrl = 0x0; - t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); - /* Reset Framer and friends */ - t4_pci_out(wc, WC_LEDS, 0x00000000); - - /* Set DMA addresses */ - t4_pci_out(wc, WC_RDADDR, wc->readdma); - t4_pci_out(wc, WC_WRADDR, wc->writedma); - - /* Setup counters, interrupt flags (ignored in Gen2) */ - if (cardflags & FLAG_2NDGEN) { - t4_tsi_reset(wc); - } else { - t4_pci_out(wc, WC_COUNT, ((ZT_MAX_CHUNKSIZE * 2 * 32 - 1) << 18) | ((ZT_MAX_CHUNKSIZE * 2 * 32 - 1) << 2)); - } - - /* Reset pending interrupts */ - t4_pci_out(wc, WC_INTR, 0x00000000); - - /* Read T1/E1 status */ - if (t1e1override > -1) - wc->t1e1 = t1e1override; - else - wc->t1e1 = ((t4_pci_in(wc, WC_LEDS)) & 0x0f00) >> 8; - wc->order = ((t4_pci_in(wc, WC_LEDS)) & 0xf0000000) >> 28; - order_index[wc->order]++; - return 0; -} - -static int t4_hardware_init_2(struct t4 *wc) -{ - int x; - unsigned int falcver; - - if (t4_pci_in(wc, WC_VERSION) >= 0xc01a0165) { - wc->tspans[0]->spanflags |= FLAG_OCTOPT; - printk("Octasic optimized!\n"); - } - /* Setup LEDS, take out of reset */ - t4_pci_out(wc, WC_LEDS, 0x000000ff); - t4_activate(wc); - - t4_framer_out(wc, 0, 0x4a, 0xaa); - falcver = t4_framer_in(wc, 0 ,0x4a); - printk("FALC version: %08x, Board ID: %02x\n", falcver, wc->order); - - for (x=0;x< 11;x++) - printk("Reg %d: 0x%08x\n", x, t4_pci_in(wc, x)); - return 0; -} - -static int __devinit t4_launch(struct t4 *wc) -{ - int x; - unsigned long flags; - if (wc->tspans[0]->span.flags & ZT_FLAG_REGISTERED) - return 0; - printk("TE%dXXP: Launching card: %d\n", wc->numspans, wc->order); - - /* Setup serial parameters and system interface */ - for (x=0;x<4;x++) - t4_serial_setup(wc, x); - - if (zt_register(&wc->tspans[0]->span, 0)) { - printk(KERN_ERR "Unable to register span %s\n", wc->tspans[0]->span.name); - return -1; - } - if (zt_register(&wc->tspans[1]->span, 0)) { - printk(KERN_ERR "Unable to register span %s\n", wc->tspans[1]->span.name); - zt_unregister(&wc->tspans[0]->span); - return -1; - } - - if (wc->numspans == 4) { - if (zt_register(&wc->tspans[2]->span, 0)) { - printk(KERN_ERR "Unable to register span %s\n", wc->tspans[2]->span.name); - zt_unregister(&wc->tspans[0]->span); - zt_unregister(&wc->tspans[1]->span); - return -1; - } - if (zt_register(&wc->tspans[3]->span, 0)) { - printk(KERN_ERR "Unable to register span %s\n", wc->tspans[3]->span.name); - zt_unregister(&wc->tspans[0]->span); - zt_unregister(&wc->tspans[1]->span); - zt_unregister(&wc->tspans[2]->span); - return -1; - } - } - set_bit(T4_CHECK_TIMING, &wc->checkflag); - spin_lock_irqsave(&wc->reglock, flags); - __t4_set_timing_source(wc,4, 0, 0); - spin_unlock_irqrestore(&wc->reglock, flags); - tasklet_init(&wc->t4_tlet, t4_isr_bh, (unsigned long)wc); - return 0; -} - -static int __devinit t4_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res; - struct t4 *wc; - struct devtype *dt; - int x,f; - int basesize; -#if 0 - int y; - unsigned int *canary; -#endif - - - if (pci_enable_device(pdev)) { - res = -EIO; - } else { - wc = kmalloc(sizeof(struct t4), GFP_KERNEL); - if (wc) { - memset(wc, 0x0, sizeof(struct t4)); - spin_lock_init(&wc->reglock); - dt = (struct devtype *)(ent->driver_data); - if (dt->flags & FLAG_2NDGEN) - basesize = ZT_MAX_CHUNKSIZE * 32 * 4; - else - basesize = ZT_MAX_CHUNKSIZE * 32 * 2 * 4; - - if (dt->flags & FLAG_2PORT) - wc->numspans = 2; - else - wc->numspans = 4; - - wc->variety = dt->desc; - - wc->memaddr = pci_resource_start(pdev, 0); - wc->memlen = pci_resource_len(pdev, 0); - wc->membase = ioremap(wc->memaddr, wc->memlen); - /* This rids of the Double missed interrupt message after loading */ - wc->last0 = 1; -#if 0 - if (!request_mem_region(wc->memaddr, wc->memlen, wc->variety)) - printk("wct4: Unable to request memory region :(, using anyway...\n"); -#endif - if (pci_request_regions(pdev, wc->variety)) - printk("wct%dxxp: Unable to request regions\n", wc->numspans); - - printk("Found TE%dXXP at base address %08lx, remapped to %p\n", wc->numspans, wc->memaddr, wc->membase); - - wc->dev = pdev; - - wc->writechunk = - /* 32 channels, Double-buffer, Read/Write, 4 spans */ - (unsigned int *)pci_alloc_consistent(pdev, basesize * 2, &wc->writedma); - if (!wc->writechunk) { - printk("wct%dxxp: Unable to allocate DMA-able memory\n", wc->numspans); - return -ENOMEM; - } - - /* Read is after the whole write piece (in words) */ - wc->readchunk = wc->writechunk + basesize / 4; - - /* Same thing but in bytes... */ - wc->readdma = wc->writedma + basesize; - - /* Initialize Write/Buffers to all blank data */ - memset((void *)wc->writechunk,0x00, basesize); - memset((void *)wc->readchunk,0xff, basesize); -#if 0 - memset((void *)wc->readchunk,0xff,ZT_MAX_CHUNKSIZE * 2 * 32 * 4); - /* Initialize canary */ - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 64 * 4 - 4); - *canary = (CANARY << 16) | (0xffff); -#endif - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - - /* Initialize hardware */ - t4_hardware_init_1(wc, dt->flags); - - for(x = 0; x < MAX_T4_CARDS; x++) { - if (!cards[x]) break; - } - - if (x >= MAX_T4_CARDS) { - printk("No cards[] slot available!!\n"); - return -ENOMEM; - } - - wc->num = x; - cards[x] = wc; - - -#ifdef ENABLE_WORKQUEUES - if (dt->flags & FLAG_2NDGEN) { - char tmp[20]; - sprintf(tmp, "te%dxxp[%d]", wc->numspans, wc->num); - wc->workq = create_workqueue(tmp); - } -#endif - - /* Allocate pieces we need here */ - for (x=0;x<4;x++) { - if (wc->t1e1 & (1 << x)) { - wc->tspans[x] = kmalloc(sizeof(struct t4_span) + sizeof(struct zt_chan) * 31, GFP_KERNEL); - if (wc->tspans[x]) { - memset(wc->tspans[x], 0, sizeof(struct t4_span) + sizeof(struct zt_chan) * 31); - wc->tspans[x]->spantype = TYPE_E1; - } - } else { - wc->tspans[x] = kmalloc(sizeof(struct t4_span) + sizeof(struct zt_chan) * 24, GFP_KERNEL); - if (wc->tspans[x]) { - memset(wc->tspans[x], 0, sizeof(struct t4_span) + sizeof(struct zt_chan) * 24); - if (j1mode) - wc->tspans[x]->spantype = TYPE_J1; - else - wc->tspans[x]->spantype = TYPE_T1; - } - } - if (!wc->tspans[x]) - return -ENOMEM; -#ifdef ENABLE_WORKQUEUES - INIT_WORK(&wc->tspans[x]->swork, workq_handlespan, wc->tspans[x]); -#endif - wc->tspans[x]->spanflags |= dt->flags; - } - - - /* Continue hardware intiialization */ - t4_hardware_init_2(wc); - - -#ifdef SUPPORT_GEN1 - if (request_irq(pdev->irq, (dt->flags & FLAG_2NDGEN) ? t4_interrupt_gen2 :t4_interrupt, ZAP_IRQ_SHARED_DISABLED, (wc->numspans == 2) ? "wct2xxp" : "wct4xxp", wc)) -#else - if (!(wc->tspans[0]->spanflags & FLAG_2NDGEN)) { - printk("This driver does not support 1st gen modules\n"); - kfree(wc); - return -ENODEV; - } - if (request_irq(pdev->irq, t4_interrupt_gen2, ZAP_IRQ_SHARED_DISABLED, "t4xxp", wc)) -#endif - { - printk("t4xxp: Unable to request IRQ %d\n", pdev->irq); - kfree(wc); - return -EIO; - } - - init_spans(wc); - - /* Launch cards as appropriate */ - for (;;) { - /* Find a card to activate */ - f = 0; - for (x=0;cards[x];x++) { - if (cards[x]->order <= highestorder) { - t4_launch(cards[x]); - if (cards[x]->order == highestorder) - f = 1; - } - } - /* If we found at least one, increment the highest order and search again, otherwise stop */ - if (f) - highestorder++; - else - break; - } - - printk("Found a Wildcard: %s\n", wc->variety); - wc->gpio = 0x00000000; - t4_pci_out(wc, WC_GPIO, wc->gpio); - t4_gpio_setdir(wc, (1 << 17), (1 << 17)); - t4_gpio_setdir(wc, (0xff), (0xff)); - -#if 0 - for (x=0;x<0x10000;x++) { - __t4_raw_oct_out(wc, 0x0004, x); - __t4_raw_oct_out(wc, 0x000a, x ^ 0xffff); - if (__t4_raw_oct_in(wc, 0x0004) != x) - printk("Register 4 failed %04x\n", x); - if (__t4_raw_oct_in(wc, 0x000a) != (x ^ 0xffff)) - printk("Register 10 failed %04x\n", x); - } -#endif - res = 0; - } else - res = -ENOMEM; - } - return res; -} - -static int t4_hardware_stop(struct t4 *wc) -{ - - /* Turn off DMA, leave interrupts enabled */ - set_bit(T4_STOP_DMA, &wc->checkflag); - - /* Wait for interrupts to stop */ - msleep(25); - - /* Turn off counter, address, etc */ - if (wc->tspans[0]->spanflags & FLAG_2NDGEN) { - t4_tsi_reset(wc); - } else { - t4_pci_out(wc, WC_COUNT, 0x000000); - } - t4_pci_out(wc, WC_RDADDR, 0x0000000); - t4_pci_out(wc, WC_WRADDR, 0x0000000); - wc->gpio = 0x00000000; - t4_pci_out(wc, WC_GPIO, wc->gpio); - t4_pci_out(wc, WC_LEDS, 0x00000000); - - printk("\nStopped TE%dXXP, Turned off DMA\n", wc->numspans); - return 0; -} - -static void __devexit t4_remove_one(struct pci_dev *pdev) -{ - struct t4 *wc = pci_get_drvdata(pdev); - int x; - if (wc) { - /* Stop hardware */ - t4_hardware_stop(wc); - - /* Release vpm450m */ - if (wc->vpm450m) - release_vpm450m(wc->vpm450m); - wc->vpm450m = NULL; - /* Unregister spans */ - if (wc->tspans[0]->span.flags & ZT_FLAG_REGISTERED) - zt_unregister(&wc->tspans[0]->span); - if (wc->tspans[1]->span.flags & ZT_FLAG_REGISTERED) - zt_unregister(&wc->tspans[1]->span); - if (wc->numspans == 4) { - if (wc->tspans[2]->span.flags & ZT_FLAG_REGISTERED) - zt_unregister(&wc->tspans[2]->span); - if (wc->tspans[3]->span.flags & ZT_FLAG_REGISTERED) - zt_unregister(&wc->tspans[3]->span); - } -#ifdef ENABLE_WORKQUEUES - if (wc->workq) { - flush_workqueue(wc->workq); - destroy_workqueue(wc->workq); - } -#endif - - free_irq(pdev->irq, wc); - - if (wc->membase) - iounmap((void *)wc->membase); - - pci_release_regions(pdev); - - /* Immediately free resources */ - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 32 * 4, (void *)wc->writechunk, wc->writedma); - - order_index[wc->order]--; - - cards[wc->num] = NULL; - pci_set_drvdata(pdev, NULL); - for (x=0;xnumspans;x++) { - if (wc->tspans[x]) - kfree(wc->tspans[x]); - } - kfree(wc); - } -} - - -static struct pci_device_id t4_pci_tbl[] __devinitdata = -{ - { 0x10ee, 0x0314, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)&wct4xxp }, - - { 0xd161, 0x0420, 0x0004, PCI_ANY_ID, 0, 0, (unsigned long)&wct420p4 }, - { 0xd161, 0x0410, 0x0004, PCI_ANY_ID, 0, 0, (unsigned long)&wct410p4 }, - { 0xd161, 0x0405, 0x0004, PCI_ANY_ID, 0, 0, (unsigned long)&wct405p4 }, - { 0xd161, 0x0410, 0x0003, PCI_ANY_ID, 0, 0, (unsigned long)&wct410p3 }, - { 0xd161, 0x0405, 0x0003, PCI_ANY_ID, 0, 0, (unsigned long)&wct405p3 }, - { 0xd161, 0x0410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)&wct410p2 }, - { 0xd161, 0x0405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)&wct405p2 }, - - { 0xd161, 0x0220, 0x0004, PCI_ANY_ID, 0, 0, (unsigned long)&wct220p4 }, - { 0xd161, 0x0205, 0x0004, PCI_ANY_ID, 0, 0, (unsigned long)&wct205p4 }, - { 0xd161, 0x0210, 0x0004, PCI_ANY_ID, 0, 0, (unsigned long)&wct210p4 }, - { 0xd161, 0x0205, 0x0003, PCI_ANY_ID, 0, 0, (unsigned long)&wct205p3 }, - { 0xd161, 0x0210, 0x0003, PCI_ANY_ID, 0, 0, (unsigned long)&wct210p3 }, - { 0xd161, 0x0205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)&wct205 }, - { 0xd161, 0x0210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long)&wct210 }, - { 0, } -}; - -static struct pci_driver t4_driver = { - name: "wct4xxp", - probe: t4_init_one, -#ifdef LINUX26 - remove: __devexit_p(t4_remove_one), -#else - remove: t4_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: t4_pci_tbl, -}; - -static int __init t4_init(void) -{ - int res; - res = zap_pci_module(&t4_driver); - if (res) - return -ENODEV; - return 0; -} - -static void __exit t4_cleanup(void) -{ - pci_unregister_driver(&t4_driver); -} - - -MODULE_AUTHOR("Mark Spencer"); -MODULE_DESCRIPTION("Unified TE4XXP-TE2XXP PCI Driver"); -#if defined(MODULE_ALIAS) -MODULE_ALIAS("wct2xxp"); -#endif -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif -#ifdef LINUX26 -module_param(pedanticpci, int, 0600); -module_param(debug, int, 0600); -module_param(loopback, int, 0600); -module_param(noburst, int, 0600); -module_param(timingcable, int, 0600); -module_param(t1e1override, int, 0600); -module_param(alarmdebounce, int, 0600); -module_param(j1mode, int, 0600); -module_param(sigmode, int, 0600); -#ifdef VPM_SUPPORT -module_param(vpmsupport, int, 0600); -module_param(vpmdtmfsupport, int, 0600); -module_param(vpmspans, int, 0600); -module_param(dtmfthreshold, int, 0600); -#endif -#else -MODULE_PARM(pedanticpci, "i"); -MODULE_PARM(debug, "i"); -MODULE_PARM(loopback, "i"); -MODULE_PARM(noburst, "i"); -MODULE_PARM(hardhdlcmode, "i"); -MODULE_PARM(timingcable, "i"); -MODULE_PARM(t1e1override, "i"); -MODULE_PARM(alarmdebounce, "i"); -MODULE_PARM(j1mode, "i"); -MODULE_PARM(sigmode, "i"); -#ifdef VPM_SUPPORT -MODULE_PARM(vpmsupport, "i"); -MODULE_PARM(vpmdtmfsupport, "i"); -MODULE_PARM(vpmspans, "i"); -MODULE_PARM(dtmfthreshold, "i"); -#endif -#endif - -MODULE_DEVICE_TABLE(pci, t4_pci_tbl); - -module_init(t4_init); -module_exit(t4_cleanup); diff --git a/zaptel/kernel/wct4xxp/vpm450m.c b/zaptel/kernel/wct4xxp/vpm450m.c deleted file mode 100644 index aea71439..00000000 --- a/zaptel/kernel/wct4xxp/vpm450m.c +++ /dev/null @@ -1,590 +0,0 @@ -/* - * Copyright (C) 2005-2006 Digium, Inc. - * - * Mark Spencer - * - * All Rights Reserved - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include - -#include "vpm450m.h" -#include "oct6100api/oct6100_api.h" - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#else -#include -#endif - -/* API for Octasic access */ -UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime) -{ - /* Why couldn't they just take a timeval like everyone else? */ - struct timeval tv; - unsigned long long total_usecs; - unsigned int mask = ~0; - - do_gettimeofday(&tv); - total_usecs = (((unsigned long long)(tv.tv_sec)) * 1000000) + - (((unsigned long long)(tv.tv_usec))); - f_pTime->aulWallTimeUs[0] = (total_usecs & mask); - f_pTime->aulWallTimeUs[1] = (total_usecs >> 32); - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserMemSet(PVOID f_pAddress, UINT32 f_ulPattern, UINT32 f_ulLength) -{ - memset(f_pAddress, f_ulPattern, f_ulLength); - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserMemCopy(PVOID f_pDestination, const void *f_pSource, UINT32 f_ulLength) -{ - memcpy(f_pDestination, f_pSource, f_ulLength); - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserCreateSerializeObject(tPOCT6100_CREATE_SERIALIZE_OBJECT f_pCreate) -{ - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserDestroySerializeObject(tPOCT6100_DESTROY_SERIALIZE_OBJECT f_pDestroy) -{ -#ifdef OCTASIC_DEBUG - printk("I should never be called! (destroy serialize object)\n"); -#endif - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserSeizeSerializeObject(tPOCT6100_SEIZE_SERIALIZE_OBJECT f_pSeize) -{ - /* Not needed */ - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserReleaseSerializeObject(tPOCT6100_RELEASE_SERIALIZE_OBJECT f_pRelease) -{ - /* Not needed */ - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserDriverWriteApi(tPOCT6100_WRITE_PARAMS f_pWriteParams) -{ - oct_set_reg(f_pWriteParams->pProcessContext, f_pWriteParams->ulWriteAddress, f_pWriteParams->usWriteData); - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserDriverWriteSmearApi(tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams) -{ - unsigned int x; - for (x=0;xulWriteLength;x++) { - oct_set_reg(f_pSmearParams->pProcessContext, f_pSmearParams->ulWriteAddress + (x << 1), f_pSmearParams->usWriteData); - } - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserDriverWriteBurstApi(tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams) -{ - unsigned int x; - for (x=0;xulWriteLength;x++) { - oct_set_reg(f_pBurstParams->pProcessContext, f_pBurstParams->ulWriteAddress + (x << 1), f_pBurstParams->pusWriteData[x]); - } - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserDriverReadApi(tPOCT6100_READ_PARAMS f_pReadParams) -{ - *(f_pReadParams->pusReadData) = oct_get_reg(f_pReadParams->pProcessContext, f_pReadParams->ulReadAddress); - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100UserDriverReadBurstApi(tPOCT6100_READ_BURST_PARAMS f_pBurstParams) -{ - unsigned int x; - for (x=0;xulReadLength;x++) { - f_pBurstParams->pusReadData[x] = oct_get_reg(f_pBurstParams->pProcessContext, f_pBurstParams->ulReadAddress + (x << 1)); - } - return cOCT6100_ERR_OK; -} - -#define SOUT_G168_1100GB_ON 0x40000004 -#define SOUT_DTMF_1 0x40000011 -#define SOUT_DTMF_2 0x40000012 -#define SOUT_DTMF_3 0x40000013 -#define SOUT_DTMF_A 0x4000001A -#define SOUT_DTMF_4 0x40000014 -#define SOUT_DTMF_5 0x40000015 -#define SOUT_DTMF_6 0x40000016 -#define SOUT_DTMF_B 0x4000001B -#define SOUT_DTMF_7 0x40000017 -#define SOUT_DTMF_8 0x40000018 -#define SOUT_DTMF_9 0x40000019 -#define SOUT_DTMF_C 0x4000001C -#define SOUT_DTMF_STAR 0x4000001E -#define SOUT_DTMF_0 0x40000010 -#define SOUT_DTMF_POUND 0x4000001F -#define SOUT_DTMF_D 0x4000001D - -#define ROUT_G168_2100GB_ON 0x10000000 -#define ROUT_G168_2100GB_WSPR 0x10000002 -#define ROUT_SOUT_G168_2100HB_END 0x50000003 -#define ROUT_G168_1100GB_ON 0x10000004 - -#define ROUT_DTMF_1 0x10000011 -#define ROUT_DTMF_2 0x10000012 -#define ROUT_DTMF_3 0x10000013 -#define ROUT_DTMF_A 0x1000001A -#define ROUT_DTMF_4 0x10000014 -#define ROUT_DTMF_5 0x10000015 -#define ROUT_DTMF_6 0x10000016 -#define ROUT_DTMF_B 0x1000001B -#define ROUT_DTMF_7 0x10000017 -#define ROUT_DTMF_8 0x10000018 -#define ROUT_DTMF_9 0x10000019 -#define ROUT_DTMF_C 0x1000001C -#define ROUT_DTMF_STAR 0x1000001E -#define ROUT_DTMF_0 0x10000010 -#define ROUT_DTMF_POUND 0x1000001F -#define ROUT_DTMF_D 0x1000001D - -#if 0 -#define cOCT6100_ECHO_OP_MODE_DIGITAL cOCT6100_ECHO_OP_MODE_HT_FREEZE -#else -#define cOCT6100_ECHO_OP_MODE_DIGITAL cOCT6100_ECHO_OP_MODE_POWER_DOWN -#endif - -struct vpm450m { - tPOCT6100_INSTANCE_API pApiInstance; - UINT32 aulEchoChanHndl[ 128 ]; - int chanflags[128]; - int ecmode[128]; - int numchans; -}; - -#define FLAG_DTMF (1 << 0) -#define FLAG_MUTE (1 << 1) -#define FLAG_ECHO (1 << 2) - -static unsigned int tones[] = { - SOUT_DTMF_1, - SOUT_DTMF_2, - SOUT_DTMF_3, - SOUT_DTMF_A, - SOUT_DTMF_4, - SOUT_DTMF_5, - SOUT_DTMF_6, - SOUT_DTMF_B, - SOUT_DTMF_7, - SOUT_DTMF_8, - SOUT_DTMF_9, - SOUT_DTMF_C, - SOUT_DTMF_STAR, - SOUT_DTMF_0, - SOUT_DTMF_POUND, - SOUT_DTMF_D, - SOUT_G168_1100GB_ON, - - ROUT_DTMF_1, - ROUT_DTMF_2, - ROUT_DTMF_3, - ROUT_DTMF_A, - ROUT_DTMF_4, - ROUT_DTMF_5, - ROUT_DTMF_6, - ROUT_DTMF_B, - ROUT_DTMF_7, - ROUT_DTMF_8, - ROUT_DTMF_9, - ROUT_DTMF_C, - ROUT_DTMF_STAR, - ROUT_DTMF_0, - ROUT_DTMF_POUND, - ROUT_DTMF_D, - ROUT_G168_1100GB_ON, -}; - -static void vpm450m_setecmode(struct vpm450m *vpm450m, int channel, int mode) -{ - tOCT6100_CHANNEL_MODIFY *modify; - UINT32 ulResult; - - if (vpm450m->ecmode[channel] == mode) - return; - modify = kmalloc(sizeof(tOCT6100_CHANNEL_MODIFY), GFP_ATOMIC); - if (!modify) { - printk("wct4xxp: Unable to allocate memory for setec!\n"); - return; - } - Oct6100ChannelModifyDef(modify); - modify->ulEchoOperationMode = mode; - modify->ulChannelHndl = vpm450m->aulEchoChanHndl[channel]; - ulResult = Oct6100ChannelModify(vpm450m->pApiInstance, modify); - if (ulResult != GENERIC_OK) { - printk("Failed to apply echo can changes on channel %d!\n", channel); - } else { -#ifdef OCTASIC_DEBUG - printk("Echo can on channel %d set to %d\n", channel, mode); -#endif - vpm450m->ecmode[channel] = mode; - } - kfree(modify); -} - -void vpm450m_setdtmf(struct vpm450m *vpm450m, int channel, int detect, int mute) -{ - tOCT6100_CHANNEL_MODIFY *modify; - UINT32 ulResult; - - modify = kmalloc(sizeof(tOCT6100_CHANNEL_MODIFY), GFP_KERNEL); - if (!modify) { - printk("wct4xxp: Unable to allocate memory for setdtmf!\n"); - return; - } - Oct6100ChannelModifyDef(modify); - modify->ulChannelHndl = vpm450m->aulEchoChanHndl[channel]; - if (mute) { - vpm450m->chanflags[channel] |= FLAG_MUTE; - modify->VqeConfig.fDtmfToneRemoval = TRUE; - } else { - vpm450m->chanflags[channel] &= ~FLAG_MUTE; - modify->VqeConfig.fDtmfToneRemoval = FALSE; - } - if (detect) - vpm450m->chanflags[channel] |= FLAG_DTMF; - else - vpm450m->chanflags[channel] &= ~FLAG_DTMF; - if (vpm450m->chanflags[channel] & (FLAG_DTMF|FLAG_MUTE)) { - if (!(vpm450m->chanflags[channel] & FLAG_ECHO)) { - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_HT_RESET); - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_HT_FREEZE); - } - } else { - if (!(vpm450m->chanflags[channel] & FLAG_ECHO)) - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_DIGITAL); - } - - ulResult = Oct6100ChannelModify(vpm450m->pApiInstance, modify); - if (ulResult != GENERIC_OK) { - printk("Failed to apply dtmf mute changes on channel %d!\n", channel); - } -/* printk("VPM450m: Setting DTMF on channel %d: %s / %s\n", channel, (detect ? "DETECT" : "NO DETECT"), (mute ? "MUTE" : "NO MUTE")); */ - kfree(modify); -} - -void vpm450m_setec(struct vpm450m *vpm450m, int channel, int eclen) -{ - if (eclen) { - vpm450m->chanflags[channel] |= FLAG_ECHO; - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_HT_RESET); - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_NORMAL); - } else { - vpm450m->chanflags[channel] &= ~FLAG_ECHO; - if (vpm450m->chanflags[channel] & (FLAG_DTMF | FLAG_MUTE)) { - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_HT_RESET); - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_HT_FREEZE); - } else - vpm450m_setecmode(vpm450m, channel, cOCT6100_ECHO_OP_MODE_DIGITAL); - } -/* printk("VPM450m: Setting EC on channel %d to %d\n", channel, eclen); */ -} - -int vpm450m_checkirq(struct vpm450m *vpm450m) -{ - tOCT6100_INTERRUPT_FLAGS InterruptFlags; - - Oct6100InterruptServiceRoutineDef(&InterruptFlags); - Oct6100InterruptServiceRoutine(vpm450m->pApiInstance, &InterruptFlags); - - return InterruptFlags.fToneEventsPending ? 1 : 0; -} - -int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start) -{ - tOCT6100_TONE_EVENT tonefound; - tOCT6100_EVENT_GET_TONE tonesearch; - UINT32 ulResult; - - Oct6100EventGetToneDef(&tonesearch); - tonesearch.pToneEvent = &tonefound; - tonesearch.ulMaxToneEvent = 1; - ulResult = Oct6100EventGetTone(vpm450m->pApiInstance, &tonesearch); - if (tonesearch.ulNumValidToneEvent) { - if (channel) - *channel = tonefound.ulUserChanId; - if (tone) { - switch(tonefound.ulToneDetected) { - case SOUT_DTMF_1: - *tone = '1'; - break; - case SOUT_DTMF_2: - *tone = '2'; - break; - case SOUT_DTMF_3: - *tone = '3'; - break; - case SOUT_DTMF_A: - *tone = 'A'; - break; - case SOUT_DTMF_4: - *tone = '4'; - break; - case SOUT_DTMF_5: - *tone = '5'; - break; - case SOUT_DTMF_6: - *tone = '6'; - break; - case SOUT_DTMF_B: - *tone = 'B'; - break; - case SOUT_DTMF_7: - *tone = '7'; - break; - case SOUT_DTMF_8: - *tone = '8'; - break; - case SOUT_DTMF_9: - *tone = '9'; - break; - case SOUT_DTMF_C: - *tone = 'C'; - break; - case SOUT_DTMF_STAR: - *tone = '*'; - break; - case SOUT_DTMF_0: - *tone = '0'; - break; - case SOUT_DTMF_POUND: - *tone = '#'; - break; - case SOUT_DTMF_D: - *tone = 'D'; - break; - case SOUT_G168_1100GB_ON: - *tone = 'f'; - break; - default: -#ifdef OCTASIC_DEBUG - printk("Unknown tone value %08x\n", tonefound.ulToneDetected); -#endif - *tone = 'u'; - break; - } - } - if (start) - *start = (tonefound.ulEventType == cOCT6100_TONE_PRESENT); - return 1; - } - return 0; -} - -unsigned int get_vpm450m_capacity(void *wc) -{ - UINT32 ulResult; - - tOCT6100_API_GET_CAPACITY_PINS CapacityPins; - - Oct6100ApiGetCapacityPinsDef(&CapacityPins); - CapacityPins.pProcessContext = wc; - CapacityPins.ulMemoryType = cOCT6100_MEM_TYPE_DDR; - CapacityPins.fEnableMemClkOut = TRUE; - CapacityPins.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; - - ulResult = Oct6100ApiGetCapacityPins(&CapacityPins); - if (ulResult != cOCT6100_ERR_OK) { - printk("Failed to get chip capacity, code %08x!\n", ulResult); - return 0; - } - - return CapacityPins.ulCapacityValue; -} - -struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware) -{ - tOCT6100_CHIP_OPEN *ChipOpen; - tOCT6100_GET_INSTANCE_SIZE InstanceSize; - tOCT6100_CHANNEL_OPEN *ChannelOpen; - UINT32 ulResult; - struct vpm450m *vpm450m; - int x,y,law; -#ifdef CONFIG_4KSTACKS - unsigned long flags; -#endif - - if (!(vpm450m = kmalloc(sizeof(struct vpm450m), GFP_KERNEL))) - return NULL; - - memset(vpm450m, 0, sizeof(struct vpm450m)); - - if (!(ChipOpen = kmalloc(sizeof(tOCT6100_CHIP_OPEN), GFP_KERNEL))) { - kfree(vpm450m); - return NULL; - } - - memset(ChipOpen, 0, sizeof(tOCT6100_CHIP_OPEN)); - - if (!(ChannelOpen = kmalloc(sizeof(tOCT6100_CHANNEL_OPEN), GFP_KERNEL))) { - kfree(vpm450m); - kfree(ChipOpen); - return NULL; - } - - memset(ChannelOpen, 0, sizeof(tOCT6100_CHANNEL_OPEN)); - - for (x=0;x<128;x++) - vpm450m->ecmode[x] = -1; - - vpm450m->numchans = numspans * 32; - printk("VPM450: echo cancellation for %d channels\n", vpm450m->numchans); - - Oct6100ChipOpenDef(ChipOpen); - - /* Setup Chip Open Parameters */ - ChipOpen->ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; - Oct6100GetInstanceSizeDef(&InstanceSize); - - ChipOpen->pProcessContext = wc; - - ChipOpen->pbyImageFile = firmware->data; - ChipOpen->ulImageSize = firmware->size; - ChipOpen->fEnableMemClkOut = TRUE; - ChipOpen->ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; - ChipOpen->ulMaxChannels = vpm450m->numchans; - 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; -#if 0 - ChipOpen->fEnableAcousticEcho = TRUE; -#endif - - ulResult = Oct6100GetInstanceSize(ChipOpen, &InstanceSize); - if (ulResult != cOCT6100_ERR_OK) { - printk("Failed to get instance size, code %08x!\n", ulResult); - kfree(vpm450m); - kfree(ChipOpen); - kfree(ChannelOpen); - return NULL; - } - - - vpm450m->pApiInstance = vmalloc(InstanceSize.ulApiInstanceSize); - if (!vpm450m->pApiInstance) { - printk("Out of memory (can't allocate %d bytes)!\n", InstanceSize.ulApiInstanceSize); - kfree(vpm450m); - kfree(ChipOpen); - kfree(ChannelOpen); - return NULL; - } - - /* I don't know what to curse more in this comment, the problems caused by - * the 4K kernel stack limit change or the octasic API for being so darn - * stack unfriendly. Stupid, stupid, stupid. So we disable IRQs so we - * don't run the risk of overflowing the stack while we initialize the - * octasic. */ -#ifdef CONFIG_4KSTACKS - local_irq_save(flags); -#endif - ulResult = Oct6100ChipOpen(vpm450m->pApiInstance, ChipOpen); - if (ulResult != cOCT6100_ERR_OK) { - printk("Failed to open chip, code %08x!\n", ulResult); -#ifdef CONFIG_4KSTACKS - local_irq_restore(flags); -#endif - kfree(vpm450m); - kfree(ChipOpen); - kfree(ChannelOpen); - return NULL; - } - for (x=0;x<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)) { - /* span timeslots are interleaved 12341234... - * therefore, the lower 2 bits tell us which span this - * timeslot/channel - */ - if (isalaw[x & 0x03]) - law = cOCT6100_PCM_A_LAW; - else - law = cOCT6100_PCM_U_LAW; - Oct6100ChannelOpenDef(ChannelOpen); - ChannelOpen->pulChannelHndl = &vpm450m->aulEchoChanHndl[x]; - ChannelOpen->ulUserChanId = x; - ChannelOpen->TdmConfig.ulRinPcmLaw = law; - ChannelOpen->TdmConfig.ulRinStream = 0; - ChannelOpen->TdmConfig.ulRinTimeslot = x; - ChannelOpen->TdmConfig.ulSinPcmLaw = law; - ChannelOpen->TdmConfig.ulSinStream = 1; - ChannelOpen->TdmConfig.ulSinTimeslot = x; - ChannelOpen->TdmConfig.ulSoutPcmLaw = law; - ChannelOpen->TdmConfig.ulSoutStream = 2; - ChannelOpen->TdmConfig.ulSoutTimeslot = x; - ChannelOpen->TdmConfig.ulRoutPcmLaw = law; - ChannelOpen->TdmConfig.ulRoutStream = 3; - ChannelOpen->TdmConfig.ulRoutTimeslot = x; - ChannelOpen->VqeConfig.fEnableNlp = TRUE; - ChannelOpen->VqeConfig.fRinDcOffsetRemoval = TRUE; - ChannelOpen->VqeConfig.fSinDcOffsetRemoval = TRUE; - - ChannelOpen->fEnableToneDisabler = TRUE; - ChannelOpen->ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_DIGITAL; - - ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, ChannelOpen); - if (ulResult != GENERIC_OK) { - printk("Failed to open channel %d!\n", x); - } - for (y=0;yaulEchoChanHndl[x]; - enable.ulToneNumber = tones[y]; - if (Oct6100ToneDetectionEnable(vpm450m->pApiInstance, &enable) != GENERIC_OK) - printk("Failed to enable tone detection on channel %d for tone %d!\n", x, y); - } - } - } - -#ifdef CONFIG_4KSTACKS - local_irq_restore(flags); -#endif - kfree(ChipOpen); - kfree(ChannelOpen); - return vpm450m; -} - -void release_vpm450m(struct vpm450m *vpm450m) -{ - UINT32 ulResult; - tOCT6100_CHIP_CLOSE ChipClose; - - Oct6100ChipCloseDef(&ChipClose); - ulResult = Oct6100ChipClose(vpm450m->pApiInstance, &ChipClose); - if (ulResult != cOCT6100_ERR_OK) { - printk("Failed to close chip, code %08x!\n", ulResult); - } - vfree(vpm450m->pApiInstance); - kfree(vpm450m); -} diff --git a/zaptel/kernel/wct4xxp/vpm450m.h b/zaptel/kernel/wct4xxp/vpm450m.h deleted file mode 100644 index 735a2cc7..00000000 --- a/zaptel/kernel/wct4xxp/vpm450m.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2005-2006 Digium, Inc. - * - * Mark Spencer - * - * All Rights Reserved - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _VPM450M_H -#define _VPM450M_H - -#include - -struct vpm450m; - -/* From driver */ -unsigned int oct_get_reg(void *data, unsigned int reg); -void oct_set_reg(void *data, unsigned int reg, unsigned int val); - -/* From vpm450m */ -struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware); -unsigned int get_vpm450m_capacity(void *wc); -void vpm450m_setec(struct vpm450m *instance, int channel, int eclen); -void vpm450m_setdtmf(struct vpm450m *instance, int channel, int dtmfdetect, int dtmfmute); -int vpm450m_checkirq(struct vpm450m *vpm450m); -int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start); -void release_vpm450m(struct vpm450m *instance); - -#endif diff --git a/zaptel/kernel/wct4xxp/wct4xxp-diag.c b/zaptel/kernel/wct4xxp/wct4xxp-diag.c deleted file mode 100644 index cc8b1002..00000000 --- a/zaptel/kernel/wct4xxp/wct4xxp-diag.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "zaptel.h" -#include "wct4xxp.h" - -static struct t4_reg_def { - int reg; - char *name; - int global; -}; -static struct t4_reg_def xreginfo[] = { - { 0x00, "RDADDR" }, - { 0x01, "WRADDR" }, - { 0x02, "COUNT" }, - { 0x03, "DMACTRL" }, - { 0x04, "WCINTR" }, - { 0x06, "VERSION" }, - { 0x07, "LEDS" }, - { 0x08, "GPIOCTL" }, - { 0x09, "GPIO" }, - { 0x0A, "LADDR" }, - { 0x0b, "LDATA" }, -}; - -static struct t4_reg_def reginfo[] = { - { 0x00, "XFIFO" }, - { 0x01, "XFIFO" }, - { 0x02, "CMDR" }, - { 0x03, "MODE" }, - { 0x04, "RAH1" }, - { 0x05, "RAH2" }, - { 0x06, "RAL1" }, - { 0x07, "RAL2" }, - { 0x08, "IPC", 1 }, - { 0x09, "CCR1" }, - { 0x0a, "CCR2" }, - { 0x0c, "RTR1" }, - { 0x0d, "RTR2" }, - { 0x0e, "RTR3" }, - { 0x0f, "RTR4" }, - { 0x10, "TTR1" }, - { 0x11, "TTR2" }, - { 0x12, "TTR3" }, - { 0x13, "TTR4" }, - { 0x14, "IMR0" }, - { 0x15, "IMR1" }, - { 0x16, "IMR2" }, - { 0x17, "IMR3" }, - { 0x18, "IMR4" }, - { 0x1b, "IERR" }, - { 0x1c, "FMR0" }, - { 0x1d, "FMR1" }, - { 0x1e, "FMR2" }, - { 0x1f, "LOOP" }, - { 0x20, "XSW" }, - { 0x21, "XSP" }, - { 0x22, "XC0" }, - { 0x23, "XC1" }, - { 0x24, "RC0" }, - { 0x25, "RC1" }, - { 0x26, "XPM0" }, - { 0x27, "XPM1" }, - { 0x28, "XPM2" }, - { 0x29, "TSWM" }, - { 0x2b, "IDLE" }, - { 0x2c, "XSA4" }, - { 0x2d, "XSA5" }, - { 0x2e, "XSA6" }, - { 0x2f, "XSA7" }, - { 0x30, "XSA8" }, - { 0x31, "FMR3" }, - { 0x32, "ICB1" }, - { 0x33, "ICB2" }, - { 0x34, "ICB3" }, - { 0x35, "ICB4" }, - { 0x36, "LIM0" }, - { 0x37, "LIM1" }, - { 0x38, "PCD" }, - { 0x39, "PCR" }, - { 0x3a, "LIM2" }, - { 0x3b, "LCR1" }, - { 0x3c, "LCR2" }, - { 0x3d, "LCR3" }, - { 0x3e, "SIC1" }, - { 0x3f, "SIC2" }, - { 0x40, "SIC3" }, - { 0x44, "CMR1" }, - { 0x45, "CMR2" }, - { 0x46, "GCR" }, - { 0x47, "ESM" }, - { 0x60, "DEC" }, - { 0x70, "XS1" }, - { 0x71, "XS2" }, - { 0x72, "XS3" }, - { 0x73, "XS4" }, - { 0x74, "XS5" }, - { 0x75, "XS6" }, - { 0x76, "XS7" }, - { 0x77, "XS8" }, - { 0x78, "XS9" }, - { 0x79, "XS10" }, - { 0x7a, "XS11" }, - { 0x7b, "XS12" }, - { 0x7c, "XS13" }, - { 0x7d, "XS14" }, - { 0x7e, "XS15" }, - { 0x7f, "XS16" }, - { 0x80, "PC1" }, - { 0x81, "PC2" }, - { 0x82, "PC3" }, - { 0x83, "PC4" }, - { 0x84, "PC5" }, - { 0x85, "GPC1", 1 }, - { 0x87, "CMDR2" }, - { 0x8d, "CCR5" }, - { 0x92, "GCM1", 1 }, - { 0x93, "GCM2", 1 }, - { 0x94, "GCM3", 1 }, - { 0x95, "GCM4", 1 }, - { 0x96, "GCM5", 1 }, - { 0x97, "GCM6", 1 }, - { 0x98, "GCM7", 1 }, - { 0x99, "GCM8", 1 }, - { 0xa0, "TSEO" }, - { 0xa1, "TSBS1" }, - { 0xa8, "TPC0" }, -}; - -static struct t4_reg_def t1_reginfo[] = { - { 0x00, "XFIFO" }, - { 0x01, "XFIFO" }, - { 0x02, "CMDR" }, - { 0x03, "MODE" }, - { 0x04, "RAH1" }, - { 0x05, "RAH2" }, - { 0x06, "RAL1" }, - { 0x07, "RAL2" }, - { 0x08, "IPC", 1 }, - { 0x09, "CCR1" }, - { 0x0a, "CCR2" }, - { 0x0c, "RTR1" }, - { 0x0d, "RTR2" }, - { 0x0e, "RTR3" }, - { 0x0f, "RTR4" }, - { 0x10, "TTR1" }, - { 0x11, "TTR2" }, - { 0x12, "TTR3" }, - { 0x13, "TTR4" }, - { 0x14, "IMR0" }, - { 0x15, "IMR1" }, - { 0x16, "IMR2" }, - { 0x17, "IMR3" }, - { 0x18, "IMR4" }, - { 0x1b, "IERR" }, - { 0x1c, "FMR0" }, - { 0x1d, "FMR1" }, - { 0x1e, "FMR2" }, - { 0x1f, "LOOP" }, - { 0x20, "FMR4" }, - { 0x21, "FMR5" }, - { 0x22, "XC0" }, - { 0x23, "XC1" }, - { 0x24, "RC0" }, - { 0x25, "RC1" }, - { 0x26, "XPM0" }, - { 0x27, "XPM1" }, - { 0x28, "XPM2" }, - { 0x2b, "IDLE" }, - { 0x2c, "XDL1" }, - { 0x2d, "XDL2" }, - { 0x2e, "XDL3" }, - { 0x2f, "CCB1" }, - { 0x30, "CCB2" }, - { 0x31, "CCB3" }, - { 0x32, "ICB1" }, - { 0x33, "ICB2" }, - { 0x34, "ICB3" }, - { 0x36, "LIM0" }, - { 0x37, "LIM1" }, - { 0x38, "PCD" }, - { 0x39, "PCR" }, - { 0x3a, "LIM2" }, - { 0x3b, "LCR1" }, - { 0x3c, "LCR2" }, - { 0x3d, "LCR3" }, - { 0x3e, "SIC1" }, - { 0x3f, "SIC2" }, - { 0x40, "SIC3" }, - { 0x44, "CMR1" }, - { 0x45, "CMR2" }, - { 0x46, "GCR" }, - { 0x47, "ESM" }, - { 0x60, "DEC" }, - { 0x70, "XS1" }, - { 0x71, "XS2" }, - { 0x72, "XS3" }, - { 0x73, "XS4" }, - { 0x74, "XS5" }, - { 0x75, "XS6" }, - { 0x76, "XS7" }, - { 0x77, "XS8" }, - { 0x78, "XS9" }, - { 0x79, "XS10" }, - { 0x7a, "XS11" }, - { 0x7b, "XS12" }, - { 0x80, "PC1" }, - { 0x81, "PC2" }, - { 0x82, "PC3" }, - { 0x83, "PC4" }, - { 0x84, "PC5" }, - { 0x85, "GPC1", 1 }, - { 0x87, "CMDR2" }, - { 0x8d, "CCR5" }, - { 0x92, "GCM1", 1 }, - { 0x93, "GCM2", 1 }, - { 0x94, "GCM3", 1 }, - { 0x95, "GCM4", 1 }, - { 0x96, "GCM5", 1 }, - { 0x97, "GCM6", 1 }, - { 0x98, "GCM7", 1 }, - { 0x99, "GCM8", 1 }, - { 0xa0, "TSEO" }, - { 0xa1, "TSBS1" }, - { 0xa8, "TPC0" }, -}; - -static struct t4_reg_def t1_sreginfo[] = { - { 0x00, "RFIFO" }, - { 0x01, "RFIFO" }, - { 0x49, "RBD" }, - { 0x4a, "VSTR", 1 }, - { 0x4b, "RES" }, - { 0x4c, "FRS0" }, - { 0x4d, "FRS1" }, - { 0x4e, "FRS2" }, - { 0x4f, "Old FRS1" }, - { 0x50, "FECL" }, - { 0x51, "FECH" }, - { 0x52, "CVCL" }, - { 0x53, "CVCH" }, - { 0x54, "CECL" }, - { 0x55, "CECH" }, - { 0x56, "EBCL" }, - { 0x57, "EBCH" }, - { 0x58, "BECL" }, - { 0x59, "BECH" }, - { 0x5a, "COEC" }, - { 0x5c, "RDL1" }, - { 0x5d, "RDL2" }, - { 0x5e, "RDL3" }, - { 0x62, "RSP1" }, - { 0x63, "RSP2" }, - { 0x64, "SIS" }, - { 0x65, "RSIS" }, - { 0x66, "RBCL" }, - { 0x67, "RBCH" }, - { 0x68, "ISR0" }, - { 0x69, "ISR1" }, - { 0x6a, "ISR2" }, - { 0x6b, "ISR3" }, - { 0x6c, "ISR4" }, - { 0x6e, "GIS" }, - { 0x6f, "CIS", 1 }, - { 0x70, "RS1" }, - { 0x71, "RS2" }, - { 0x72, "RS3" }, - { 0x73, "RS4" }, - { 0x74, "RS5" }, - { 0x75, "RS6" }, - { 0x76, "RS7" }, - { 0x77, "RS8" }, - { 0x78, "RS9" }, - { 0x79, "RS10" }, - { 0x7a, "RS11" }, - { 0x7b, "RS12" }, -}; - -static struct t4_reg_def sreginfo[] = { - { 0x00, "RFIFO" }, - { 0x01, "RFIFO" }, - { 0x49, "RBD" }, - { 0x4a, "VSTR", 1 }, - { 0x4b, "RES" }, - { 0x4c, "FRS0" }, - { 0x4d, "FRS1" }, - { 0x4e, "RSW" }, - { 0x4f, "RSP" }, - { 0x50, "FECL" }, - { 0x51, "FECH" }, - { 0x52, "CVCL" }, - { 0x53, "CVCH" }, - { 0x54, "CEC1L" }, - { 0x55, "CEC1H" }, - { 0x56, "EBCL" }, - { 0x57, "EBCH" }, - { 0x58, "CEC2L" }, - { 0x59, "CEC2H" }, - { 0x5a, "CEC3L" }, - { 0x5b, "CEC3H" }, - { 0x5c, "RSA4" }, - { 0x5d, "RSA5" }, - { 0x5e, "RSA6" }, - { 0x5f, "RSA7" }, - { 0x60, "RSA8" }, - { 0x61, "RSA6S" }, - { 0x62, "RSP1" }, - { 0x63, "RSP2" }, - { 0x64, "SIS" }, - { 0x65, "RSIS" }, - { 0x66, "RBCL" }, - { 0x67, "RBCH" }, - { 0x68, "ISR0" }, - { 0x69, "ISR1" }, - { 0x6a, "ISR2" }, - { 0x6b, "ISR3" }, - { 0x6c, "ISR4" }, - { 0x6e, "GIS" }, - { 0x6f, "CIS", 1 }, - { 0x70, "RS1" }, - { 0x71, "RS2" }, - { 0x72, "RS3" }, - { 0x73, "RS4" }, - { 0x74, "RS5" }, - { 0x75, "RS6" }, - { 0x76, "RS7" }, - { 0x77, "RS8" }, - { 0x78, "RS9" }, - { 0x79, "RS10" }, - { 0x7a, "RS11" }, - { 0x7b, "RS12" }, - { 0x7c, "RS13" }, - { 0x7d, "RS14" }, - { 0x7e, "RS15" }, - { 0x7f, "RS16" }, -}; - -static char *tobin(int x) -{ - static char s[9] = ""; - int y,z=0; - for (y=7;y>=0;y--) { - if (x & (1 << y)) - s[z++] = '1'; - else - s[z++] = '0'; - } - s[z] = '\0'; - return s; -} - -static char *tobin32(unsigned int x) -{ - static char s[33] = ""; - int y,z=0; - for (y=31;y>=0;y--) { - if (x & (1 << y)) - s[z++] = '1'; - else - s[z++] = '0'; - } - s[z] = '\0'; - return s; -} - -int main(int argc, char *argv[]) -{ - int fd; - int x; - char fn[256]; - struct t4_regs regs; - if ((argc < 2) || ((*(argv[1]) != '/') && !atoi(argv[1]))) { - fprintf(stderr, "Usage: wct4xxp-diag \n"); - exit(1); - } - if (*(argv[1]) == '/') - zap_copy_string(fn, argv[1], sizeof(fn)); - else - snprintf(fn, sizeof(fn), "/dev/zap/%d", atoi(argv[1])); - fd = open(fn, O_RDWR); - if (fd <0) { - fprintf(stderr, "Unable to open '%s': %s\n", fn, strerror(errno)); - exit(1); - } - if (ioctl(fd, WCT4_GET_REGS, ®s)) { - fprintf(stderr, "Unable to get registers: %s\n", strerror(errno)); - exit(1); - } - printf("PCI Registers:\n"); - for (x=0;x - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include - -#define FRMR_TTR_BASE 0x10 -#define FRMR_RTR_BASE 0x0c -#define FRMR_TSEO 0xa0 -#define FRMR_TSBS1 0xa1 -#define FRMR_CCR1 0x09 -#define FRMR_CCR1_ITF 0x08 -#define FRMR_CCR1_EITS 0x10 -#define FRMR_CCR2 0x0a -#define FRMR_CCR2_RCRC 0x04 -#define FRMR_CCR2_RADD 0x10 -#define FRMR_MODE 0x03 -#define FRMR_MODE_NO_ADDR_CMP 0x80 -#define FRMR_MODE_SS7 0x20 -#define FRMR_MODE_HRAC 0x08 -#define FRMR_IMR0 0x14 -#define FRMR_IMR0_RME 0x80 -#define FRMR_IMR0_RPF 0x01 -#define FRMR_IMR1 0x15 -#define FRMR_IMR1_ALLS 0x20 -#define FRMR_IMR1_XDU 0x10 -#define FRMR_IMR1_XPR 0x01 -#define FRMR_XC0 0x22 -#define FRMR_XC1 0x23 -#define FRMR_RC0 0x24 -#define FRMR_RC1 0x25 -#define FRMR_SIC1 0x3e -#define FRMR_SIC2 0x3f -#define FRMR_SIC3 0x40 -#define FRMR_CMR1 0x44 -#define FRMR_CMR2 0x45 -#define FRMR_GCR 0x46 -#define FRMR_ISR0 0x68 -#define FRMR_ISR0_RME 0x80 -#define FRMR_ISR0_RPF 0x01 -#define FRMR_ISR1 0x69 -#define FRMR_ISR1_ALLS 0x20 -#define FRMR_ISR1_XDU 0x10 -#define FRMR_ISR1_XPR 0x01 -#define FRMR_ISR2 0x6a -#define FRMR_ISR3 0x6b -#define FRMR_ISR4 0x6c -#define FRMR_GIS 0x6e -#define FRMR_GIS_ISR0 0x01 -#define FRMR_GIS_ISR1 0x02 -#define FRMR_GIS_ISR2 0x04 -#define FRMR_GIS_ISR3 0x08 -#define FRMR_GIS_ISR4 0x10 -#define FRMR_CIS 0x6f -#define FRMR_CIS_GIS1 0x01 -#define FRMR_CIS_GIS2 0x02 -#define FRMR_CIS_GIS3 0x04 -#define FRMR_CIS_GIS4 0x08 -#define FRMR_CMDR 0x02 -#define FRMR_CMDR_SRES 0x01 -#define FRMR_CMDR_XRES 0x10 -#define FRMR_CMDR_RMC 0x80 -#define FRMR_CMDR_XTF 0x04 -#define FRMR_CMDR_XHF 0x08 -#define FRMR_CMDR_XME 0x02 -#define FRMR_RSIS 0x65 -#define FRMR_RSIS_VFR 0x80 -#define FRMR_RSIS_RDO 0x40 -#define FRMR_RSIS_CRC16 0x20 -#define FRMR_RSIS_RAB 0x10 -#define FRMR_RBCL 0x66 -#define FRMR_RBCL_MAX_SIZE 0x1f -#define FRMR_RBCH 0x67 -#define FRMR_RXFIFO 0x00 -#define FRMR_SIS 0x64 -#define FRMR_SIS_XFW 0x40 -#define FRMR_TXFIFO 0x00 - -#define NUM_REGS 0xa9 -#define NUM_PCI 12 - -struct t4_regs { - unsigned int pci[NUM_PCI]; - unsigned char regs[NUM_REGS]; -}; - -#define T4_CHECK_VPM 0 -#define T4_LOADING_FW 1 -#define T4_STOP_DMA 2 -#define T4_CHECK_TIMING 3 - -#define WCT4_GET_REGS _IOW (ZT_CODE, 60, struct t4_regs) - diff --git a/zaptel/kernel/wctc4xxp/Kbuild b/zaptel/kernel/wctc4xxp/Kbuild deleted file mode 100644 index 5783b146..00000000 --- a/zaptel/kernel/wctc4xxp/Kbuild +++ /dev/null @@ -1,20 +0,0 @@ -obj-m += wctc4xxp.o - -FIRM_DIR := ../../firmware - -EXTRA_CFLAGS := -I$(src)/.. -Wno-undef - -ifeq ($(HOTPLUG_FIRMWARE),yes) - EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE -endif - -wctc4xxp-objs := base.o - -ifneq ($(HOTPLUG_FIRMWARE),yes) -wctc4xxp-objs += $(FIRM_DIR)/zaptel-fw-tc400m.o -endif - -$(obj)/base.o: $(src)/../zaptel.h - -$(obj)/$(FIRM_DIR)/zaptel-fw-tc400m.o: $(obj)/base.o - $(MAKE) -C $(obj)/$(FIRM_DIR) zaptel-fw-tc400m.o diff --git a/zaptel/kernel/wctc4xxp/Makefile b/zaptel/kernel/wctc4xxp/Makefile deleted file mode 100644 index 56453cb2..00000000 --- a/zaptel/kernel/wctc4xxp/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -ifneq ($(KBUILD_EXTMOD),) -# We only get here on kernels 2.6.0-2.6.9 . -# For newer kernels, Kbuild will be included directly by the kernel -# build system. -include $(src)/Kbuild -endif diff --git a/zaptel/kernel/wctc4xxp/base.c b/zaptel/kernel/wctc4xxp/base.c deleted file mode 100644 index 5019adb4..00000000 --- a/zaptel/kernel/wctc4xxp/base.c +++ /dev/null @@ -1,3279 +0,0 @@ -/* - * Wildcard TC400B Driver - * - * Copyright (C) 2006-2008, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "zaptel.h" - -/* COMPILE TIME OPTIONS =================================================== */ - -#define INTERRUPT 0 -#define WORKQUEUE 1 -#define TASKLET 2 - -#ifndef DEFERRED_PROCESSING -# define DEFERRED_PROCESSING WORKQUEUE -#endif - -#if DEFERRED_PROCESSING == INTERRUPT -# define ALLOC_FLAGS GFP_ATOMIC -#elif DEFERRED_PROCESSING == TASKLET -# define ALLOC_FLAGS GFP_ATOMIC -#else -# define ALLOC_FLAGS GFP_KERNEL -#endif - -#define WARN() WARN_ON(1) - -#define DTE_PRINTK(_lvl, _fmt, _args...) \ - printk(KERN_##_lvl "%s: %s: " _fmt, THIS_MODULE->name, \ - (wc)->board_name, ## _args) - -#define DTE_DEBUG(_dbgmask, _fmt, _args...) \ - if ((debug & _dbgmask) == (_dbgmask)) { \ - printk(KERN_DEBUG "%s: %s: " _fmt, THIS_MODULE->name, \ - (wc)->board_name, ## _args); \ - } \ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#define WARN_ON_ONCE(__condition) do { \ - static int __once = 1; \ - if (unlikely(__condition)) { \ - if (__once) { \ - __once = 0; \ - WARN_ON(0); \ - } \ - } \ -} while(0) -#endif - -#define INVALID 999 /* Used to mark invalid channels, commands, etc.. */ -#define MAX_CHANNEL_PACKETS 5 /* Never let more than 5 outstanding packets exist for any channel. */ - -#define G729_LENGTH 20 -#define G723_LENGTH 30 - -#define G729_SAMPLES 160 /* G.729 */ -#define G723_SAMPLES 240 /* G.723.1 */ - -#define G729_BYTES 20 /* G.729 */ -#define G723_6K_BYTES 24 /* G.723.1 at 6.3kb/s */ -#define G723_5K_BYTES 20 /* G.723.1 at 5.3kb/s */ -#define G723_SID_BYTES 4 /* G.723.1 SID frame */ - -#define MAX_CAPTURED_PACKETS 5000 - -/* The following bit fields are used to set the various debug levels. */ -#define DTE_DEBUG_GENERAL (1 << 0) /* 1 */ -#define DTE_DEBUG_CHANNEL_SETUP (1 << 1) /* 2 */ -#define DTE_DEBUG_RTP_TX (1 << 2) /* 4 */ -#define DTE_DEBUG_RTP_RX (1 << 3) /* 8 */ -#define DTE_DEBUG_RX_TIMEOUT (1 << 4) /* 16 */ -#define DTE_DEBUG_NETWORK_IF (1 << 5) /* 32 */ -#define DTE_DEBUG_NETWORK_EARLY (1 << 6) /* 64 */ - -int debug; -char *mode; - -static spinlock_t wctc4xxp_list_lock; -static struct list_head wctc4xxp_list; - -#define ETH_P_CSM_ENCAPS 0x889B - -struct rtphdr { -#if defined(__LITTLE_ENDIAN_BITFIELD) - __u8 csrc_count:4; - __u8 extension:1; - __u8 padding:1; - __u8 ver:2; - __u8 type:7; - __u8 marker:1; -#elif defined(__BIG_ENDIAN_BITFIELD) - __u8 ver:2; - __u8 padding:1; - __u8 extension:1; - __u8 csrc_count:4; - __u8 marker:1; - __u8 type:7; -#else -#error "Please fix " -#endif - __be16 seqno; - __be32 timestamp; - __be32 ssrc; -} __attribute__((packed)); - -struct rtp_packet { - struct ethhdr ethhdr; - struct iphdr iphdr; - struct udphdr udphdr; - struct rtphdr rtphdr; - __u8 payload[0]; -}__attribute__((packed)); - -/* Ethernet packet type for communication control information to the DTE. */ -struct csm_encaps_hdr { - struct ethhdr ethhdr; - /* CSM_ENCAPS HEADER */ - __be16 op_code; - __u8 seq_num; - __u8 control; - __be16 channel; - /* COMMON PART OF PAYLOAD HEADER */ - __u8 length; - __u8 index; - __u8 type; - __u8 class; - __le16 function; - __le16 reserved; - __le16 params[0]; -} __attribute__((packed)); - -struct csm_create_channel_cmd { - struct csm_encaps_hdr hdr; - __le16 channel_type; - __le16 timeslot; -} __attribute__((packed)); - -#define CMD_MSG_TDM_SELECT_BUS_MODE_LEN 30 -#define CMD_MSG_TDM_SELECT_BUS_MODE(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x01, 0x00,0x06,0x17,0x04, 0xFF,0xFF, \ - 0x04,0x00 } -#define CMD_MSG_TDM_ENABLE_BUS_LEN 30 -#define CMD_MSG_TDM_ENABLE_BUS(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x02, 0x00,0x06,0x05,0x04, 0xFF,0xFF, \ - 0x04,0x00 } -#define CMD_MSG_SUPVSR_SETUP_TDM_PARMS_LEN 34 -#define CMD_MSG_SUPVSR_SETUP_TDM_PARMS(s,p1,p2,p3) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x10, p1, 0x00,0x06,0x07,0x04, 0xFF,0xFF, \ - p2,0x83, 0x00,0x0C, 0x00,0x00, p3,0x00 } -#define CMD_MSG_TDM_OPT_LEN 30 -#define CMD_MSG_TDM_OPT(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x35,0x04, 0xFF,0xFF, \ - 0x00,0x00 } -#define CMD_MSG_DEVICE_SET_COUNTRY_CODE_LEN 30 -#define CMD_MSG_DEVICE_SET_COUNTRY_CODE(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x1B,0x04, 0xFF,0xFF, \ - 0x00,0x00 } - -/* CPU Commands */ -#define CMD_MSG_SET_ARM_CLK_LEN 32 -#define CMD_MSG_SET_ARM_CLK(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0C, 0x00, 0x00,0x06,0x11,0x04, 0x00,0x00, \ - 0x2C,0x01, 0x00,0x00 } -#define CMD_MSG_SET_SPU_CLK_LEN 32 -#define CMD_MSG_SET_SPU_CLK(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0C, 0x00, 0x00,0x06,0x12,0x04, 0x00,0x00, \ - 0x2C,0x01, 0x00,0x00 } -#define CMD_MSG_SPU_FEATURES_CONTROL_LEN 30 -#define CMD_MSG_SPU_FEATURES_CONTROL(s,p1) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x13,0x00, 0xFF,0xFF, \ - p1,0x00 } -#define CMD_MSG_DEVICE_STATUS_CONFIG_LEN 30 -#define CMD_MSG_DEVICE_STATUS_CONFIG(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x0F,0x04, 0xFF,0xFF, \ - 0x05,0x00 } - -/* General IP/RTP Commands */ -#define CMD_MSG_SET_ETH_HEADER_LEN 44 -#define CMD_MSG_SET_ETH_HEADER(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x18, 0x00, 0x00,0x06,0x00,0x01, 0xFF,0xFF, \ - 0x01,0x00, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x00,0x11,0x22,0x33,0x44,0x55, 0x08,0x00 } -#define CMD_MSG_IP_SERVICE_CONFIG_LEN 30 -#define CMD_MSG_IP_SERVICE_CONFIG(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x02,0x03, 0xFF,0xFF, \ - 0x00,0x02 } -#define CMD_MSG_ARP_SERVICE_CONFIG_LEN 30 -#define CMD_MSG_ARP_SERVICE_CONFIG(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x05,0x01, 0xFF,0xFF, \ - 0x01,0x00 } -#define CMD_MSG_ICMP_SERVICE_CONFIG_LEN 30 -#define CMD_MSG_ICMP_SERVICE_CONFIG(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x04,0x03, 0xFF,0xFF, \ - 0x01,0xFF } -#define CMD_MSG_IP_OPTIONS_LEN 30 -#define CMD_MSG_IP_OPTIONS(s) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x06,0x03, 0xFF,0xFF, \ - 0x02,0x00 } - -#define CONTROL_PACKET_OPCODE 0x0001 -/* Control bits */ -#define LITTLE_ENDIAN 0x01 -#define SUPPRESS_ACK 0x40 -#define MESSAGE_PACKET 0x80 - -#define SUPERVISOR_CHANNEL 0xffff - -/* Supervisor function codes */ -#define SUPVSR_CREATE_CHANNEL 0x0010 - -#define CONFIG_CHANGE_TYPE 0x00 -#define CONFIG_DEVICE_CLASS 0x06 - -#define CMD_MSG_QUERY_CHANNEL_LEN 30 -#define CMD_MSG_QUERY_CHANNEL(s,t) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x01,0x06,0x10,0x00, 0x00,0x00, \ - (t&0x00FF), ((t&0xFF00) >> 8) } - -#define CMD_MSG_TRANS_CONNECT_LEN 38 -#define CMD_MSG_TRANS_CONNECT(s,e,c1,c2,f1,f2) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x12, 0x00, 0x00,0x06,0x22,0x93, 0x00,0x00, \ - e,0x00, (c1&0x00FF),((c1&0xFF00)>>8), f1,0x00, (c2&0x00FF),((c2&0xFF00)>>8), f2,0x00 } -#define CMD_MSG_DESTROY_CHANNEL_LEN 32 -#define CMD_MSG_DESTROY_CHANNEL(s,t) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, 0xFF,0xFF, 0x0A, 0x00, 0x00,0x06,0x11,0x00, 0x00,0x00, \ - (t&0x00FF),((t&0xFF00)>>8), 0x00, 0x00 } - -/* Individual channel config commands */ -#define CMD_MSG_SET_IP_HDR_CHANNEL_LEN 58 -#define CMD_MSG_SET_IP_HDR_CHANNEL(s,c,t2,t1) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00) >> 8),(c&0x00FF), 0x26, 0x00, 0x00,0x02,0x00,0x90, 0x00,0x00, \ - 0x00,0x00, 0x45,0x00, 0x00,0x00, 0x00,0x00, 0x40,0x00, 0x80,0x11, 0x00,0x00, \ - 0xC0,0xA8,0x09,0x03, 0xC0,0xA8,0x09,0x03, \ - ((t2&0xFF00)>>8)+0x50,(t2&0x00FF), ((t1&0xFF00)>>8)+0x50,(t1&0x00FF), 0x00,0x00, 0x00,0x00 } -#define CMD_MSG_VOIP_VCEOPT_LEN 40 -#define CMD_MSG_VOIP_VCEOPT(s,c,l,w) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x12, 0x00, 0x00,0x02,0x01,0x80, 0x00,0x00, \ - 0x21,l, 0x00,0x1C, 0x04,0x00, 0x00,0x00, w,0x00, 0x80,0x11 } -#define CMD_MSG_VOIP_VOPENA_LEN 44 -#define CMD_MSG_VOIP_VOPENA(s,c,f) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x16, 0x00, 0x00,0x02,0x00,0x80, 0x00,0x00, \ - 0x01,0x00, 0x80,f, 0x00,0x00, 0x00,0x00, 0x00,0x00, 0x12,0x34, 0x56,0x78, 0x00,0x00 } -#define CMD_MSG_VOIP_VOPENA_CLOSE_LEN 32 -#define CMD_MSG_VOIP_VOPENA_CLOSE(s,c) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x0A, 0x00, 0x00,0x02,0x00,0x80, 0x00,0x00, \ - 0x00,0x00, 0x00,0x00 } -#define CMD_MSG_VOIP_INDCTRL_LEN 32 -#define CMD_MSG_VOIP_INDCTRL(s,c) {0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x0A, 0x00, 0x00,0x02,0x84,0x80, 0x00,0x00, \ - 0x07,0x00, 0x00,0x00 } -#define CMD_MSG_VOIP_DTMFOPT_LEN 32 -#define CMD_MSG_VOIP_DTMFOPT(s,c) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x0A, 0x00, 0x00,0x02,0x02,0x80, 0x00,0x00, \ - 0x08,0x00, 0x00,0x00 } - -#define CMD_MSG_VOIP_TONECTL_LEN 32 -#define CMD_MSG_VOIP_TONECTL(s,c) { \ - 0x00,0x11,0x22,0x33,0x44,0x55, 0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, 0x88,0x9B, \ - 0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x0A, 0x00, 0x00,0x02,0x5B,0x80, 0x00,0x00, \ - 0x00,0x00, 0x00,0x00 } - -#define SFRAME_SIZE 320 - -/* Transcoder buffer (tcb) */ -struct tcb { - /* First field so that is aligned by default. */ - u8 cmd[SFRAME_SIZE]; - struct list_head node; - unsigned long timeout; - unsigned long retries; - /* NOTE: these flags aren't bit fields because some of the flags are - * combinations of the other ones. */ -#define DO_NOT_AUTO_FREE (1 << 0) -#define TX_COMPLETE (1 << 1) -#define DO_NOT_CAPTURE (1 << 2) -#define __WAIT_FOR_ACK (1 << 3) -#define __WAIT_FOR_RESPONSE (1 << 4) -#define DTE_CMD_TIMEOUT (1 << 5) -#define WAIT_FOR_ACK (__WAIT_FOR_ACK | DO_NOT_AUTO_FREE) -#define WAIT_FOR_RESPONSE (__WAIT_FOR_RESPONSE | DO_NOT_AUTO_FREE) - unsigned long flags; - struct tcb *response; - struct completion complete; - struct timer_list timer; - void *data; - /* The number of bytes available in data. */ - int data_len; -}; - -static inline void *hdr_from_cmd(struct tcb *cmd) { - return cmd->data; -} - -static inline void -initialize_cmd(struct tcb *cmd, unsigned long cmd_flags) -{ - memset(cmd, 0, sizeof(*cmd)); - INIT_LIST_HEAD(&cmd->node); - init_completion(&cmd->complete); - cmd->flags = cmd_flags; - cmd->data = &cmd->cmd[0]; - cmd->data_len = SFRAME_SIZE; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -/*! Used to allocate commands to submit to the dte. */ -kmem_cache_t *cmd_cache; -#else -/*! Used to allocate commands to submit to the dte. */ -struct kmem_cache *cmd_cache; -#endif - -static inline struct tcb * -__alloc_cmd(unsigned alloc_flags, unsigned long cmd_flags) -{ - struct tcb *cmd; - - cmd = kmem_cache_alloc(cmd_cache, alloc_flags); - if (likely(cmd)) { - initialize_cmd(cmd, cmd_flags); - } - return cmd; -} - -static struct tcb * -alloc_cmd(void) -{ - return __alloc_cmd(GFP_KERNEL, 0); -} - -static void -__free_cmd(struct tcb *cmd) -{ - if (cmd->data != &cmd->cmd[0]) { - kfree(cmd->data); - } - kmem_cache_free(cmd_cache, cmd); - return; -} - -static void -free_cmd(struct tcb *cmd) -{ - if (cmd->response) { - __free_cmd(cmd->response); - } - __free_cmd(cmd); -} - -typedef enum { DECODER=0, ENCODER, } encode_t; - -struct channel_stats { - atomic_t packets_sent; - atomic_t packets_received; -}; - -struct channel_pvt { - spinlock_t lock; /* Lock for this structure */ - encode_t encoder; /* If we're an encoder */ - struct wcdte *wc; - - unsigned int timestamp; - unsigned int seqno; - - unsigned int cmd_seqno; - - unsigned int timeslot_in_num; /* DTE channel on which results will be received from */ - unsigned int timeslot_out_num; /* DTE channel to send data to */ - - unsigned int chan_in_num; /* DTE channel on which results will be received from */ - unsigned int chan_out_num; /* DTE channel to send data to */ - - struct channel_stats stats; - - u16 last_dte_seqno; - unsigned int wctc4xxp_seqno_rcv; - - unsigned char ssrc; - struct list_head rx_queue; /* Transcoded packets for this channel. */ -}; - -struct wcdte { - char board_name[40]; - const char *variety; - int pos; - int cards; - struct list_head node; - spinlock_t reglock; - wait_queue_head_t waitq; - struct semaphore chansem; -#define DTE_READY 1 -#define DTE_SHUTDOWN 2 - unsigned long flags; - - spinlock_t cmd_list_lock; - /* This is a device-global list of commands that are waiting to be - * transmited (and did not fit on the transmit descriptor ring) */ - struct list_head cmd_list; - struct list_head waiting_for_response_list; - - unsigned int seq_num; - unsigned char numchannels; - unsigned char complexname[40]; - - /* This section contains the members necessary to communicate with the - * physical interface to the transcoding engine. */ - struct pci_dev *pdev; - unsigned int intmask; - unsigned long iobase; - struct wctc4xxp_descriptor_ring *txd; - struct wctc4xxp_descriptor_ring *rxd; - - struct zt_transcoder *uencode; - struct zt_transcoder *udecode; - struct channel_pvt *encoders; - struct channel_pvt *decoders; - -#if DEFERRED_PROCESSING == WORKQUEUE - struct work_struct deferred_work; -#endif - - /* - * This section contains the members necessary for exporting the - * network interface to the host system. This is only used for - * debugging purposes. - * - */ - struct sk_buff_head captured_packets; - struct net_device *netdev; - struct net_device_stats net_stats; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) - struct napi_struct napi; -#endif - struct timer_list watchdog; - -}; - -static inline void wctc4xxp_set_ready(struct wcdte *wc) { - set_bit(DTE_READY, &wc->flags); -} -static inline int wctc4xxp_is_ready(struct wcdte *wc) { - return test_bit(DTE_READY, &wc->flags); -} - -#if 1 - /* \todo This macro is a candidate for removal. It's still here because of - * how the commands are passed to this zt_send_cmd */ -#define wctc4xxp_send_cmd(wc, command) ({ \ - int __res; \ - u8 _cmd[] = command; \ - struct tcb *cmd; \ - if (!(cmd=__alloc_cmd(GFP_KERNEL, WAIT_FOR_RESPONSE))) \ - return -ENOMEM; \ - BUG_ON(sizeof(_cmd) > SFRAME_SIZE); \ - memcpy(cmd->data, _cmd, sizeof(_cmd)); \ - cmd->data_len = sizeof(_cmd); \ - __res = __wctc4xxp_send_cmd(wc, cmd); \ - __res; \ -}) -#define wctc4xxp_create_cmd(wc, command) ({ \ - u8 _command[] = command; \ - struct tcb *_cmd; \ - if (!(_cmd=__alloc_cmd(GFP_KERNEL, WAIT_FOR_RESPONSE))) \ - return -ENOMEM; \ - BUG_ON(sizeof(_command) > SFRAME_SIZE); \ - memcpy(_cmd->data, _command, sizeof(_command)); \ - _cmd->data_len = sizeof(_command); \ - _cmd; \ -}) -#endif - -#define DTE_FORMAT_ULAW 0x00 -#define DTE_FORMAT_G723_1 0x04 -#define DTE_FORMAT_ALAW 0x08 -#define DTE_FORMAT_G729A 0x12 -#define DTE_FORMAT_UNDEF 0xFF - -static inline u8 wctc4xxp_zapfmt_to_dtefmt(unsigned int fmt) -{ - u8 pt; - - switch(fmt) { - case ZT_FORMAT_G723_1: - pt = DTE_FORMAT_G723_1; - break; - case ZT_FORMAT_ULAW: - pt = DTE_FORMAT_ULAW; - break; - case ZT_FORMAT_ALAW: - pt = DTE_FORMAT_ALAW; - break; - case ZT_FORMAT_G729A: - pt = DTE_FORMAT_G729A; - break; - default: - pt = DTE_FORMAT_UNDEF; - break; - } - - return pt; -} - - -static struct sk_buff * -tcb_to_skb(struct net_device *netdev, const struct tcb *cmd) -{ - struct sk_buff *skb; - skb = alloc_skb(cmd->data_len, in_atomic() ? GFP_ATOMIC : GFP_KERNEL); - if (skb) { - skb->dev = netdev; - skb_put(skb, cmd->data_len); - memcpy(skb->data, cmd->data, cmd->data_len); - skb->protocol = eth_type_trans(skb,netdev); - } - return skb; -} - -/** - * wctc4xxp_skb_to_cmd - Convert a socket buffer (skb) to a tcb - * @wc: The transcoder that we're going to send this command to. - * @skb: socket buffer to convert. - * - */ -static struct tcb * -wctc4xxp_skb_to_cmd(struct wcdte *wc, const struct sk_buff *skb) -{ - const unsigned long alloc_flags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; - struct tcb *cmd; - /* const static char dev_mac[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55}; */ - if ((cmd = __alloc_cmd(alloc_flags, 0))) { - int res; - cmd->data_len = skb->len; - if ((res = skb_copy_bits(skb, 0, cmd->data, cmd->data_len))) { - DTE_PRINTK(WARNING, - "Failed call to skb_copy_bits.\n"); - free_cmd(cmd); - cmd = NULL; - } - /* When we set up our interface we indicated that we do not - * support ARP. Therefore, the destination MAC on packets - * arriving from the kernel networking components are not - * going to be correct. Let's fix that here. - */ - /* \todo let us just use whatever was in the packet already... */ - /* memcpy(&cmd->cmd[6], dev_mac, sizeof(dev_mac)); */ - } - return cmd; -} - -static void -wctc4xxp_net_set_multi(struct net_device *netdev) -{ - struct wcdte *wc = netdev->priv; - DTE_DEBUG(DTE_DEBUG_GENERAL, "%s promiscuity:%d\n", - __FUNCTION__, netdev->promiscuity); -} - -static int -wctc4xxp_net_up(struct net_device *netdev) -{ - struct wcdte *wc = netdev->priv; - DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__); -#if 1 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - netif_poll_enable(netdev); -#else - napi_enable(&wc->napi); -#endif -#endif - return 0; -} - -static int -wctc4xxp_net_down(struct net_device *netdev) -{ - struct wcdte *wc = netdev->priv; - DTE_DEBUG(DTE_DEBUG_GENERAL, "%s\n", __FUNCTION__); -#if 1 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - netif_poll_disable(netdev); -#else - napi_disable(&wc->napi); -#endif -#endif - return 0; -} - -static void wctc4xxp_transmit_cmd(struct wcdte *, struct tcb *); - -static int -wctc4xxp_net_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) -{ - struct wcdte *wc = netdev->priv; - struct tcb *cmd; - - /* We set DO_NOT_CAPTURE because this packet was already captured by - * in code higher up in the networking stack. We don't want to - * capture it twice. - */ - if ((cmd = wctc4xxp_skb_to_cmd(wc, skb))) { - cmd->flags |= DO_NOT_CAPTURE; - wctc4xxp_transmit_cmd(wc, cmd); - } - - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; -} - -static int -wctc4xxp_net_receive(struct wcdte *wc, int max) -{ - int count = 0; - struct sk_buff *skb; - WARN_ON(0 == max); - while ((skb = skb_dequeue(&wc->captured_packets))) { - netif_receive_skb(skb); - if (++count >= max) { - break; - } - } - return count; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -static int -wctc4xxp_poll(struct net_device *netdev, int *budget) -{ - struct wcdte *wc = netdev->priv; - int count = 0; - int quota = min(netdev->quota, *budget); - - count = wctc4xxp_net_receive(wc, quota); - - *budget -= count; - netdev->quota -= count; - - if (!skb_queue_len(&wc->captured_packets)) { - netif_rx_complete(netdev); - return 0; - } else { - return -1; - } -} -#else -static int -wctc4xxp_poll(struct napi_struct *napi, int budget) -{ - struct wcdte *wc = container_of(napi, struct wcdte, napi); - int count; - - count = wctc4xxp_net_receive(wc, budget); - - if (!skb_queue_len(&wc->captured_packets)) { - netif_rx_complete(wc->netdev, &wc->napi); - } - return count; -} -#endif - -static struct net_device_stats * -wctc4xxp_net_get_stats(struct net_device *netdev) -{ - struct wcdte *wc = netdev->priv; - return &wc->net_stats; -} - -/* Wait until this device is put into promiscuous mode, or we timeout. */ -static void -wctc4xxp_net_waitfor_promiscuous(struct wcdte *wc) -{ - unsigned int seconds = 15; - unsigned long start = jiffies; - struct net_device *netdev = wc->netdev; - - DTE_PRINTK(INFO, - "Waiting %d seconds for adapter to be placed in " \ - "promiscuous mode for early trace.\n", seconds); - - while (!netdev->promiscuity) { - if (signal_pending(current)) { - DTE_PRINTK(INFO, - "Aborting wait due to signal.\n"); - break; - } - msleep(100); - if (time_after(jiffies, start + (seconds * HZ))) { - DTE_PRINTK(INFO, - "Aborting wait due to timeout.\n"); - break; - } - } -} - -static int wctc4xxp_turn_off_booted_led(struct wcdte *wc); -static void wctc4xxp_turn_on_booted_led(struct wcdte *wc); - -static int -wctc4xxp_net_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) -{ - struct wcdte *wc = netdev->priv; - switch(cmd) { - case 0x89f0: - down(&wc->chansem); - wctc4xxp_turn_off_booted_led(wc); - break; - case 0x89f1: - wctc4xxp_turn_on_booted_led(wc); - up(&wc->chansem); - break; - default: - return -EOPNOTSUPP; - }; - return 0; -} - -/** - * wctc4xxp_net_register - Register a new network interface. - * @wc: transcoder card to register the interface for. - * - * The network interface is primarily used for debugging in order to watch the - * traffic between the transcoder and the host. - * - */ -static int -wctc4xxp_net_register(struct wcdte *wc) -{ - int res; - struct net_device *netdev; - const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; - - if (!(netdev = alloc_netdev(0, wc->board_name, ether_setup))) { - return -ENOMEM; - } - - memcpy(netdev->dev_addr, our_mac, sizeof(our_mac)); - netdev->priv = wc; - netdev->set_multicast_list = &wctc4xxp_net_set_multi; - netdev->open = &wctc4xxp_net_up; - netdev->stop = &wctc4xxp_net_down; - netdev->hard_start_xmit = &wctc4xxp_net_hard_start_xmit; - netdev->get_stats = &wctc4xxp_net_get_stats; - netdev->do_ioctl = &wctc4xxp_net_ioctl; - netdev->promiscuity = 0; - netdev->flags |= IFF_NOARP; -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - netdev->poll = &wctc4xxp_poll; - netdev->weight = 64; -# else - netif_napi_add(netdev, &wc->napi, &wctc4xxp_poll, 64); -# endif - - if ((res = register_netdev(netdev))) { - DTE_PRINTK(WARNING, - "Failed to register network device %s.\n", - wc->board_name); - goto error_sw; - } - - wc->netdev = netdev; - skb_queue_head_init(&wc->captured_packets); - - if (debug & DTE_DEBUG_NETWORK_EARLY) { - wctc4xxp_net_waitfor_promiscuous(wc); - } - - DTE_PRINTK(DEBUG, - "Created network device %s for debug.\n", wc->board_name); - return 0; - -error_sw: - if (netdev) free_netdev(netdev); - return res; -} - -static void -wctc4xxp_net_unregister(struct wcdte *wc) -{ - struct sk_buff *skb; - if (!wc->netdev) { - return; - } - - unregister_netdev(wc->netdev); - - while ((skb = skb_dequeue(&wc->captured_packets))) { - kfree_skb(skb); - } - - free_netdev(wc->netdev); - wc->netdev = NULL; -} - - -/** - * wctc4xxp_net_capture_cmd - Send a tcb to the network stack. - * @wc: transcoder that received the command. - * @cmd: command to send to network stack. - * - */ -static void -wctc4xxp_net_capture_cmd(struct wcdte *wc, const struct tcb *cmd) -{ - struct sk_buff *skb; - struct net_device *netdev = wc->netdev; - - if (!netdev) { - return; - } - - /* No need to capture if there isn't anyone listening. */ - if (!(netdev->flags & IFF_UP)) { - return; - } - - if (skb_queue_len(&wc->captured_packets) > MAX_CAPTURED_PACKETS) { - WARN_ON_ONCE(1); - return; - } - - if (!(skb = tcb_to_skb(netdev, cmd))) { - return; - } - - skb_queue_tail(&wc->captured_packets, skb); -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - netif_rx_schedule(netdev); -# else - netif_rx_schedule(netdev, &wc->napi); -# endif - return; -} - - -/*! In-memory structure shared by the host and the adapter. */ -struct wctc4xxp_descriptor { - __le32 des0; - __le32 des1; - __le32 buffer1; - __le32 container; /* Unused */ -} __attribute__((packed)); - -#define DRING_SIZE (1 << 3) /* Must be a power of two */ -#define DRING_MASK (DRING_SIZE-1) -#define MIN_PACKET_LEN 64 - -struct wctc4xxp_descriptor_ring { - /* Pointer to an array of descriptors to give to hardware. */ - struct wctc4xxp_descriptor* desc; - /* Read completed buffers from the head. */ - unsigned int head; - /* Write ready buffers to the tail. */ - unsigned int tail; - /* Array to save the kernel virtual address of pending commands. */ - struct tcb *pending[DRING_SIZE]; - /* PCI Bus address of the descriptor list. */ - dma_addr_t desc_dma; - /*! either DMA_FROM_DEVICE or DMA_TO_DEVICE */ - unsigned int direction; - /*! The number of buffers currently submitted to the hardware. */ - unsigned int count; - /*! The number of bytes to pad each descriptor for cache alignment. */ - unsigned int padding; - /*! Protects this structure from concurrent access. */ - spinlock_t lock; - /*! PCI device for the card associated with this ring. */ - struct pci_dev *pdev; -}; - -/** - * wctc4xxp_descriptor - Returns the desriptor at index. - * @dr: The descriptor ring we're using. - * @index: index of the descriptor we want. - * - * We need this function because we do not know what the padding on the - * descriptors will be. Otherwise, we would just use an array. - */ -static inline struct wctc4xxp_descriptor * -wctc4xxp_descriptor(struct wctc4xxp_descriptor_ring *dr, int index) -{ - return (struct wctc4xxp_descriptor *)((u8*)dr->desc + - ((sizeof(*dr->desc) + dr->padding) * index)); -} - -static int -wctc4xxp_initialize_descriptor_ring(struct pci_dev *pdev, struct wctc4xxp_descriptor_ring *dr, - u32 des1, unsigned int direction) -{ - int i; - const u32 END_OF_RING = 0x02000000; - u8 cache_line_size = 0; - struct wctc4xxp_descriptor *d; - - BUG_ON(!pdev); - BUG_ON(!dr); - - if (pci_read_config_byte(pdev, 0x0c, &cache_line_size)) { - /* \todo Print an error message... */ - return -EIO; - } - - memset(dr, 0, sizeof(*dr)); - - /* - * Add some padding to each descriptor to ensure that they are - * aligned on host system cache-line boundaries, but only for the - * cache-line sizes that we support. - * - */ - if ((0x08 == cache_line_size) || (0x10 == cache_line_size) || - (0x20 == cache_line_size)) - { - dr->padding = (cache_line_size*sizeof(u32)) - sizeof(*d); - } - - dr->desc = pci_alloc_consistent(pdev, - (sizeof(*d)+dr->padding)*DRING_SIZE, &dr->desc_dma); - - if (!dr->desc) { - return -ENOMEM; - } - - memset(dr->desc, 0, (sizeof(*d) + dr->padding) * DRING_SIZE); - for (i = 0; i < DRING_SIZE; ++i) { - d = wctc4xxp_descriptor(dr, i); - d->des1 = cpu_to_le32(des1); - } - - d->des1 |= cpu_to_le32(END_OF_RING); - dr->direction = direction; - spin_lock_init(&dr->lock); - return 0; -} - -#define OWN_BIT cpu_to_le32(0x80000000) -#define OWNED(_d_) (((_d_)->des0)&OWN_BIT) -#define SET_OWNED(_d_) do { wmb(); (_d_)->des0 |= OWN_BIT; wmb();} while (0) - -const unsigned int BUFFER1_SIZE_MASK = 0x7ff; - -static int -wctc4xxp_submit(struct wctc4xxp_descriptor_ring* dr, struct tcb *c) -{ - volatile struct wctc4xxp_descriptor *d; - unsigned int len; - - WARN_ON(!c); - len = (c->data_len < MIN_PACKET_LEN) ? MIN_PACKET_LEN : c->data_len; - if (c->data_len > 1518) { - WARN_ON_ONCE(!"Invalid command length passed\n"); - c->data_len = 1518; - } - - spin_lock_bh(&dr->lock); - d = wctc4xxp_descriptor(dr, dr->tail); - WARN_ON(!d); - if (d->buffer1) { - spin_unlock_bh(&dr->lock); - /* Do not overwrite a buffer that is still in progress. */ - return -EBUSY; - } - d->des1 &= cpu_to_le32(~(BUFFER1_SIZE_MASK)); - d->des1 |= cpu_to_le32(len & BUFFER1_SIZE_MASK); - d->buffer1 = pci_map_single(dr->pdev, c->data, - SFRAME_SIZE, dr->direction); - - SET_OWNED(d); /* That's it until the hardware is done with it. */ - dr->pending[dr->tail] = c; - dr->tail = ++dr->tail & DRING_MASK; - ++dr->count; - spin_unlock_bh(&dr->lock); - return 0; -} - -static inline struct tcb* -wctc4xxp_retrieve(struct wctc4xxp_descriptor_ring *dr) -{ - volatile struct wctc4xxp_descriptor *d; - struct tcb *c; - unsigned int head = dr->head; - spin_lock_bh(&dr->lock); - d = wctc4xxp_descriptor(dr, head); - if (d->buffer1 && !OWNED(d)) { - pci_unmap_single(dr->pdev, d->buffer1, - SFRAME_SIZE, dr->direction); - c = dr->pending[head]; - WARN_ON(!c); - dr->head = (++head) & DRING_MASK; - d->buffer1 = 0; - --dr->count; - WARN_ON(!c); - c->data_len = (d->des0 >> 16) & BUFFER1_SIZE_MASK; - c->flags |= TX_COMPLETE; - } else { - c = NULL; - } - spin_unlock_bh(&dr->lock); - return c; -} - -static inline int wctc4xxp_getcount(struct wctc4xxp_descriptor_ring *dr) -{ - int count; - spin_lock_bh(&dr->lock); - count = dr->count; - spin_unlock_bh(&dr->lock); - return count; -} - -static inline void -__wctc4xxp_setctl(struct wcdte *wc, unsigned int addr, unsigned int val) -{ - outl(val, wc->iobase + addr); -} - -static inline unsigned int -__wctc4xxp_getctl(struct wcdte *wc, unsigned int addr) -{ - return inl(wc->iobase + addr); -} - -static inline void -wctc4xxp_setctl(struct wcdte *wc, unsigned int addr, unsigned int val) -{ - spin_lock_bh(&wc->reglock); - __wctc4xxp_setctl(wc, addr, val); - spin_unlock_bh(&wc->reglock); -} - -static inline void -wctc4xxp_receive_demand_poll(struct wcdte *wc) -{ - __wctc4xxp_setctl(wc, 0x0010, 0x00000000); -} - -static inline void -wctc4xxp_transmit_demand_poll(struct wcdte *wc) -{ - __wctc4xxp_setctl(wc, 0x0008, 0x00000000); - - /* \todo Investigate why this register needs to be written twice in - * order to get it to poll reliably. So far, most of the problems - * I've seen with timeouts had more to do with an untransmitted - * packet sitting in the outbound descriptor list as opposed to any - * problem with the dte firmware. - */ - __wctc4xxp_setctl(wc, 0x0008, 0x00000000); -} - -/* Returns the size, in bytes, of a CSM_ENCAPS packet, given the number of - * parameters used. */ -#define SIZE_WITH_N_PARAMETERS(__n) (sizeof(struct csm_encaps_hdr) + ((__n) * (sizeof(u16)))) - -/* There are 20 bytes in the ethernet header and the common CSM_ENCAPS header - * that we don't want in the length of the actual CSM_ENCAPS command */ -#define LENGTH_WITH_N_PARAMETERS(__n) (SIZE_WITH_N_PARAMETERS(__n) - 20) - -static const u8 dst_mac[6] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55}; -static const u8 src_mac[6] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}; - -static void -setup_common_header(struct wcdte *wc, struct csm_encaps_hdr *hdr) -{ - memcpy(hdr->ethhdr.h_dest, dst_mac, sizeof(dst_mac)); - memcpy(hdr->ethhdr.h_source, src_mac, sizeof(src_mac)); - hdr->ethhdr.h_proto = cpu_to_be16(ETH_P_CSM_ENCAPS); -} - -static void -setup_supervisor_header(struct wcdte *wc, struct csm_encaps_hdr *hdr) -{ - setup_common_header(wc, hdr); - - hdr->op_code = cpu_to_be16(CONTROL_PACKET_OPCODE); - hdr->control = LITTLE_ENDIAN; - hdr->seq_num = (wc->seq_num++)&0xf; - hdr->channel = cpu_to_be16(SUPERVISOR_CHANNEL); -} - -static void -__wctc4xxp_create_channel_cmd(struct wcdte *wc, struct tcb *cmd, u16 timeslot) -{ - struct csm_create_channel_cmd *c; - c = hdr_from_cmd(cmd); - - BUG_ON(timeslot > 0x01ff); - - setup_supervisor_header(wc, &c->hdr); - - c->hdr.length = LENGTH_WITH_N_PARAMETERS(2); - c->hdr.index = 0x0; - c->hdr.type = CONFIG_CHANGE_TYPE; - c->hdr.class = CONFIG_DEVICE_CLASS; - c->hdr.function = cpu_to_le16(SUPVSR_CREATE_CHANNEL); - c->hdr.reserved = 0x0000; - - c->channel_type = cpu_to_le16(0x0002); /* Channel type is VoIP */ - c->timeslot = cpu_to_le16(timeslot); - - cmd->flags |= WAIT_FOR_RESPONSE; - cmd->data_len = sizeof(*c); -} - -struct tcb * -wctc4xxp_create_channel_cmd(struct wcdte *wc, u16 timeslot) -{ - struct tcb *cmd; - if (!(cmd = alloc_cmd())) { - return NULL; - } - __wctc4xxp_create_channel_cmd(wc, cmd, timeslot); - return cmd; -} - -void -__wctc4xxp_create_set_arm_clk_cmd(struct wcdte *wc, struct tcb *cmd) -{ - struct csm_encaps_hdr *hdr = cmd->data; - BUG_ON(SIZE_WITH_N_PARAMETERS(2) > cmd->data_len); - - setup_supervisor_header(wc, hdr); - - hdr->length = LENGTH_WITH_N_PARAMETERS(2); - hdr->index = 0x0; - hdr->type = CONFIG_CHANGE_TYPE; - hdr->class = CONFIG_DEVICE_CLASS; - hdr->function = cpu_to_le16(0x0411); - hdr->reserved = 0x0000; - hdr->params[0] = cpu_to_le16(0x012c); - hdr->params[1] = cpu_to_le16(0x0000); - - cmd->flags |= WAIT_FOR_RESPONSE; - cmd->data_len = SIZE_WITH_N_PARAMETERS(2); - return; -} - -struct tcb * -wctc4xxp_create_rtp_cmd(struct wcdte *wc, struct zt_transcoder_channel *dtc, size_t inbytes) -{ - const struct channel_pvt *cpvt = dtc->pvt; - struct rtp_packet *packet; - struct tcb *cmd; - - if (!(cmd = alloc_cmd())) { - return NULL; - } - - packet = cmd->data; - - BUG_ON(cmd->data_len < sizeof(*packet)); - - /* setup the ethernet header */ - memcpy(packet->ethhdr.h_dest, dst_mac, sizeof(dst_mac)); - memcpy(packet->ethhdr.h_source, src_mac, sizeof(src_mac)); - packet->ethhdr.h_proto = cpu_to_be16(ETH_P_IP); - - /* setup the IP header */ - packet->iphdr.ihl = 5; - packet->iphdr.version = 4; - packet->iphdr.tos = 0; - packet->iphdr.tot_len = cpu_to_be16(inbytes+40); - packet->iphdr.id = cpu_to_be16(cpvt->seqno); - packet->iphdr.frag_off= cpu_to_be16(0x4000); - packet->iphdr.ttl = 64; - packet->iphdr.protocol= 0x11; /* UDP */ - packet->iphdr.check = 0; - packet->iphdr.saddr = cpu_to_be32(0xc0a80903); - packet->iphdr.daddr = cpu_to_be32(0xc0a80903); - packet->iphdr.check = ip_fast_csum((void*)&packet->iphdr, sizeof(struct iphdr)); - - /* setup the UDP header */ - packet->udphdr.source = cpu_to_be16(cpvt->timeslot_out_num + 0x5000); - packet->udphdr.dest = cpu_to_be16(cpvt->timeslot_in_num + 0x5000); - packet->udphdr.len = cpu_to_be16(inbytes + sizeof(struct rtphdr) + sizeof(struct udphdr)); - packet->udphdr.check = 0; - - /* Setup the RTP header */ - packet->rtphdr.ver = 2; - packet->rtphdr.padding = 0; - packet->rtphdr.extension = 0; - packet->rtphdr.csrc_count = 0; - packet->rtphdr.marker = 0; - packet->rtphdr.type = wctc4xxp_zapfmt_to_dtefmt(dtc->srcfmt); - packet->rtphdr.seqno = cpu_to_be16(cpvt->seqno); - packet->rtphdr.timestamp = cpu_to_be32(cpvt->timestamp); - packet->rtphdr.ssrc = cpu_to_be32(cpvt->ssrc); - - cmd->data_len = sizeof(*packet) + inbytes; - - return cmd; -} -static void -wctc4xxp_cleanup_descriptor_ring(struct wctc4xxp_descriptor_ring *dr) -{ - int i; - struct wctc4xxp_descriptor *d; - - /* NOTE: The DTE must be in the stopped state. */ - spin_lock_bh(&dr->lock); - for (i = 0; i < DRING_SIZE; ++i) { - d = wctc4xxp_descriptor(dr, i); - if (d->buffer1) { - dma_unmap_single(&dr->pdev->dev, d->buffer1, - SFRAME_SIZE, dr->direction); - d->buffer1 = 0; - /* Commands will also be sitting on the waiting for - * response list, so we want to make sure to delete - * them from that list as well. */ - list_del_init(&(dr->pending[i])->node); - free_cmd(dr->pending[i]); - dr->pending[i] = NULL; - } - } - dr->head = 0; - dr->tail = 0; - dr->count = 0; - spin_unlock_bh(&dr->lock); - pci_free_consistent(dr->pdev, (sizeof(*d)+dr->padding) * DRING_SIZE, - dr->desc, dr->desc_dma); -} - -static void wctc4xxp_cleanup_command_list(struct wcdte *wc) -{ - struct tcb *cmd; - LIST_HEAD(local_list); - - spin_lock_bh(&wc->cmd_list_lock); - list_splice_init(&wc->cmd_list, &local_list); - list_splice_init(&wc->waiting_for_response_list, &local_list); - spin_unlock_bh(&wc->cmd_list_lock); - - while(!list_empty(&local_list)) { - cmd = list_entry(local_list.next, struct tcb, node); - list_del_init(&cmd->node); - free_cmd(cmd); - } -} - -/** - * The command list is used to store commands that couldn't fit in the tx - * descriptor list when they were requested. - */ -static void -wctc4xxp_add_to_command_list(struct wcdte *wc, struct tcb *cmd) -{ - spin_lock_bh(&wc->cmd_list_lock); - list_add_tail(&cmd->node, &wc->cmd_list); - spin_unlock_bh(&wc->cmd_list_lock); -} - -static void -wctc4xxp_add_to_response_list(struct wcdte *wc, struct tcb *cmd) -{ - spin_lock_bh(&wc->cmd_list_lock); - list_add_tail(&cmd->node, &wc->waiting_for_response_list); - spin_unlock_bh(&wc->cmd_list_lock); -} - -static void -wctc4xxp_remove_from_response_list(struct wcdte *wc, struct tcb *cmd) -{ - spin_lock_bh(&wc->cmd_list_lock); - list_del_init(&cmd->node); - spin_unlock_bh(&wc->cmd_list_lock); -} - -static void -wctc4xxp_transmit_cmd(struct wcdte *wc, struct tcb *cmd) -{ - int res; - - if (cmd->data_len < MIN_PACKET_LEN) { - memset((u8*)(cmd->data) + cmd->data_len, 0, - MIN_PACKET_LEN-cmd->data_len); - cmd->data_len = MIN_PACKET_LEN; - } - WARN_ON(cmd->response); - WARN_ON(cmd->flags & TX_COMPLETE); - cmd->timeout = jiffies + HZ/4; - if (cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE)) { - if (cmd->flags & __WAIT_FOR_RESPONSE) { - /* We don't need both an ACK and a response. Let's - * tell the DTE not to generate an ACK, and we'll just - * retry if we do not get the response within the - * timeout period. */ - struct csm_encaps_hdr *hdr = cmd->data; - hdr->control |= SUPPRESS_ACK; - } - WARN_ON(!list_empty(&cmd->node)); - wctc4xxp_add_to_response_list(wc, cmd); - mod_timer(&wc->watchdog, jiffies + HZ/2); - } - if (!(cmd->flags & DO_NOT_CAPTURE)) wctc4xxp_net_capture_cmd(wc, cmd); - if ((res=wctc4xxp_submit(wc->txd, cmd))) { - if (-EBUSY == res) { - /* Looks like we're out of room in the descriptor - * ring. We'll add this command to the pending list - * and the interrupt service routine will pull from - * this list as it clears up room in the descriptor - * ring. */ - wctc4xxp_remove_from_response_list(wc, cmd); - wctc4xxp_add_to_command_list(wc, cmd); - } else { - /* Unknown return value... */ - WARN_ON(1); - } - } else { - wctc4xxp_transmit_demand_poll(wc); - } -} - -static int -wctc4xxp_transmit_cmd_and_wait(struct wcdte *wc, struct tcb *cmd) -{ - cmd->flags |= DO_NOT_AUTO_FREE; - wctc4xxp_transmit_cmd(wc, cmd); - wait_for_completion(&cmd->complete); - if (cmd->flags & DTE_CMD_TIMEOUT) { - DTE_DEBUG(DTE_DEBUG_GENERAL, "Timeout waiting for command.\n"); - return -EIO; - } - return 0; -} - -static int wctc4xxp_create_channel_pair(struct wcdte *wc, - struct channel_pvt *cpvt, u8 simple, u8 complicated); -static int wctc4xxp_destroy_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt); -static int __wctc4xxp_setup_channels(struct wcdte *wc); - -static int -__wctc4xxp_send_cmd(struct wcdte *wc, struct tcb *cmd) -{ - int ret = 0; - wctc4xxp_transmit_cmd(wc, cmd); - wait_for_completion(&cmd->complete); - if (cmd->flags & DTE_CMD_TIMEOUT) { - ret = -EIO; - } - free_cmd(cmd); - return ret; -} - -static void -wctc4xxp_init_state(struct channel_pvt *cpvt, encode_t encoder, - unsigned int channel, struct wcdte *wc) -{ - memset(cpvt, 0, sizeof(*cpvt)); - cpvt->encoder = encoder; - cpvt->wc = wc; - - cpvt->chan_in_num = INVALID; - cpvt->chan_out_num = INVALID; - - cpvt->ssrc = 0x78; - - cpvt->timeslot_in_num = channel* 2; - cpvt->timeslot_out_num = channel * 2; - - if (ENCODER == encoder) { - cpvt->timeslot_out_num++; - } else { - cpvt->timeslot_in_num++; - } - spin_lock_init(&cpvt->lock); - INIT_LIST_HEAD(&cpvt->rx_queue); -} - -static unsigned int -wctc4xxp_getctl(struct wcdte *wc, unsigned int addr) -{ - unsigned int val; - spin_lock_bh(&wc->reglock); - val = __wctc4xxp_getctl(wc, addr); - spin_unlock_bh(&wc->reglock); - return val; -} - -static void -wctc4xxp_cleanup_channel_private(struct wcdte *wc, struct channel_pvt *cpvt) -{ - struct tcb *cmd, *temp; - LIST_HEAD(local_list); - - spin_lock_bh(&cpvt->lock); - list_splice_init(&cpvt->rx_queue, &local_list); - spin_unlock_bh(&cpvt->lock); - - list_for_each_entry_safe(cmd, temp, &local_list, node) { - list_del(&cmd->node); - free_cmd(cmd); - } -} - -static int -wctc4xxp_mark_channel_complement_built(struct wcdte *wc, - struct zt_transcoder_channel *dtc) -{ - int index; - struct channel_pvt *cpvt = dtc->pvt; - struct zt_transcoder_channel *compl_dtc; - struct channel_pvt *compl_cpvt; - - BUG_ON(!cpvt); - index = cpvt->timeslot_in_num/2; - BUG_ON(index >= wc->numchannels); - if (cpvt->encoder == 1) { - compl_dtc = &(wc->udecode->channels[index]); - } else { - compl_dtc = &(wc->uencode->channels[index]); - } - - /* It shouldn't already have been built... */ - WARN_ON(zt_tc_is_built(compl_dtc)); - compl_dtc->built_fmts = dtc->dstfmt | dtc->srcfmt; - compl_cpvt = compl_dtc->pvt; - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "dtc: %p is the complement to %p\n", compl_dtc, dtc); - compl_cpvt->chan_in_num = cpvt->chan_out_num; - compl_cpvt->chan_out_num = cpvt->chan_in_num; - zt_tc_set_built(compl_dtc); - wctc4xxp_cleanup_channel_private(wc, compl_cpvt); - - return 0; -} - -static int -do_channel_allocate(struct zt_transcoder_channel *dtc) -{ - struct channel_pvt *cpvt = dtc->pvt; - struct wcdte *wc = cpvt->wc; - u8 wctc4xxp_srcfmt; /* Digium Transcoder Engine Source Format */ - u8 wctc4xxp_dstfmt; /* Digium Transcoder Engine Dest Format */ - int res; - - down(&wc->chansem); - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, - "Entering %s for channel %p.\n", __FUNCTION__, dtc); - /* Anything on the rx queue now is old news... */ - zt_tc_clear_data_waiting(dtc); - wctc4xxp_cleanup_channel_private(wc, cpvt); - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Allocating a new channel: %p.\n", dtc); - wctc4xxp_srcfmt = wctc4xxp_zapfmt_to_dtefmt(dtc->srcfmt); - wctc4xxp_dstfmt = wctc4xxp_zapfmt_to_dtefmt(dtc->dstfmt); - res = wctc4xxp_create_channel_pair(wc, cpvt, wctc4xxp_srcfmt, - wctc4xxp_dstfmt); - if (res) { - /* There was a problem creating the channel.... */ - up(&wc->chansem); - return res; - } - /* Mark this channel as built */ - zt_tc_set_built(dtc); - dtc->built_fmts = dtc->dstfmt | dtc->srcfmt; - /* Mark the channel complement (other half of encoder/decoder pair) as built */ - res = wctc4xxp_mark_channel_complement_built(wc, dtc); - up(&wc->chansem); - zt_transcoder_alert(dtc); - return res; -} - -static int -wctc4xxp_operation_allocate(struct zt_transcoder_channel *dtc) -{ - struct wcdte *wc = ((struct channel_pvt*)(dtc->pvt))->wc; - - if (unlikely(test_bit(DTE_SHUTDOWN, &wc->flags))) { - /* The shudown flags can also be set if there is a - * catastrophic failure. */ - return -EIO; - } - - if (zt_tc_is_built(dtc)) { - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, - "Allocating channel %p which is already built.\n", dtc); - return 0; - } - return do_channel_allocate(dtc); -} - -static int -wctc4xxp_operation_release(struct zt_transcoder_channel *dtc) -{ - int res; - int index; - /* This is the 'complimentary channel' to dtc. I.e., if dtc is an - * encoder, compl_dtc is the decoder and vice-versa */ - struct zt_transcoder_channel *compl_dtc; - struct channel_pvt *compl_cpvt; - struct channel_pvt *cpvt = dtc->pvt; - struct wcdte *wc = cpvt->wc; - - BUG_ON(!cpvt); - BUG_ON(!wc); - - if (unlikely(test_bit(DTE_SHUTDOWN, &wc->flags))) { - /* The shudown flags can also be set if there is a - * catastrophic failure. */ - return -EIO; - } - - /* !!!SRR!!! change this back to down after troubleshooting */ - if (down_interruptible(&wc->chansem)) { - return -EINTR; - } - /* Remove any packets that are waiting on the outbound queue. */ - wctc4xxp_cleanup_channel_private(wc, cpvt); - index = cpvt->timeslot_in_num/2; - BUG_ON(index >= wc->numchannels); - if (ENCODER == cpvt->encoder) { - compl_dtc = &(wc->udecode->channels[index]); - } else { - compl_dtc = &(wc->uencode->channels[index]); - } - BUG_ON(!compl_dtc); - if (!zt_tc_is_built(compl_dtc)) { - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, - "Releasing a channel that was never built.\n"); - res = 0; - goto error_exit; - } - /* If the channel complement (other half of the encoder/decoder pair) is - * being used... */ - if (zt_tc_is_busy(compl_dtc)) { - res = -EBUSY; - goto error_exit; - } - if ((res = wctc4xxp_destroy_channel_pair(wc, cpvt))) { - goto error_exit; - } - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "Releasing channel: %p\n", dtc); - /* Mark this channel as not built */ - zt_tc_clear_built(dtc); - dtc->built_fmts = 0; - cpvt->chan_in_num = INVALID; - cpvt->chan_out_num = INVALID; - /* Mark the channel complement as not built */ - zt_tc_clear_built(compl_dtc); - compl_dtc->built_fmts = 0; - compl_cpvt = compl_dtc->pvt; - compl_cpvt->chan_in_num = INVALID; - compl_cpvt->chan_out_num = INVALID; - cpvt->wctc4xxp_seqno_rcv = 0; -error_exit: - up(&wc->chansem); - return res; -} - -static inline struct tcb* -get_ready_cmd(struct zt_transcoder_channel *dtc) -{ - struct channel_pvt *cpvt = dtc->pvt; - struct tcb *cmd; - spin_lock_bh(&cpvt->lock); - if (!list_empty(&cpvt->rx_queue)) { - WARN_ON(!zt_tc_is_data_waiting(dtc)); - cmd = list_entry(cpvt->rx_queue.next, struct tcb, node); - list_del_init(&cmd->node); - } else { - cmd = NULL; - } - if (list_empty(&cpvt->rx_queue)) { - zt_tc_clear_data_waiting(dtc); - } - spin_unlock_bh(&cpvt->lock); - return cmd; -} - -/* Called with a buffer in which to copy a transcoded frame. */ -static ssize_t -wctc4xxp_read(struct file *file, char __user *frame, size_t count, loff_t *ppos) -{ - ssize_t ret; - struct zt_transcoder_channel *dtc = file->private_data; - struct channel_pvt *cpvt = dtc->pvt; - struct wcdte *wc = cpvt->wc; - struct tcb *cmd; - struct rtp_packet *packet; - ssize_t payload_bytes; - u16 rtp_eseq; - - BUG_ON(!dtc); - BUG_ON(!cpvt); - - if (unlikely(test_bit(DTE_SHUTDOWN, &wc->flags))) { - /* The shudown flags can also be set if there is a - * catastrophic failure. */ - return -EIO; - } - - if (!(cmd = get_ready_cmd(dtc))) { - if (file->f_flags & O_NONBLOCK) { - return -EAGAIN; - } else { - ret = wait_event_interruptible(dtc->ready, - zt_tc_is_data_waiting(dtc)); - if (-ERESTARTSYS == ret) { - /* Signal interrupted the wait */ - return -EINTR; - } else { - /* List went not empty. */ - cmd = get_ready_cmd(dtc); - } - } - } - - BUG_ON(!cmd); - packet = cmd->data; - - payload_bytes = be16_to_cpu(packet->udphdr.len) - sizeof(struct rtphdr) - - sizeof(struct udphdr); - - if (count < payload_bytes) { - DTE_PRINTK(ERR, "Insufficient room to copy read data. Dropping packet.\n"); - free_cmd(cmd); - return -EFBIG; - } - - atomic_inc(&cpvt->stats.packets_received); - - if (0 == cpvt->wctc4xxp_seqno_rcv) { - cpvt->wctc4xxp_seqno_rcv = 1; - cpvt->last_dte_seqno = be16_to_cpu(packet->rtphdr.seqno); - } else { - rtp_eseq = ++cpvt->last_dte_seqno; - if ( be16_to_cpu(packet->rtphdr.seqno) != rtp_eseq ) - DTE_DEBUG(DTE_DEBUG_GENERAL, - "Bad seqno from DTE! [%04X][%d][%d][%d]\n", - be16_to_cpu(packet->rtphdr.seqno), - (be16_to_cpu(packet->udphdr.dest) - 0x5000), - be16_to_cpu(packet->rtphdr.seqno), - rtp_eseq); - - cpvt->last_dte_seqno = be16_to_cpu(packet->rtphdr.seqno); - } - - if (unlikely(copy_to_user(frame, &packet->payload[0], payload_bytes))) { - DTE_PRINTK(ERR, "Failed to copy data in %s\n", __FUNCTION__); - free_cmd(cmd); - return -EFAULT; - } - - free_cmd(cmd); - - return payload_bytes; -} - -/* Called with a frame in the srcfmt that is to be transcoded into the dstfmt. */ -static ssize_t -wctc4xxp_write(struct file *file, const char __user *frame, size_t count, loff_t *ppos) -{ - struct zt_transcoder_channel *dtc = file->private_data; - struct channel_pvt *cpvt = dtc->pvt; - struct wcdte *wc = cpvt->wc; - struct tcb *cmd; - - BUG_ON(!cpvt); - BUG_ON(!wc); - - if (unlikely(test_bit(DTE_SHUTDOWN, &wc->flags))) { - /* The shudown flags can also be set if there is a - * catastrophic failure. */ - return -EIO; - } - - if (!test_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags)) { - return -EAGAIN; - } - - if (count < 2) { - DTE_DEBUG(DTE_DEBUG_GENERAL, - "Cannot request to transcode a packet that is less than 2 bytes.\n"); - return -EINVAL; - } - - if (unlikely(count > SFRAME_SIZE - sizeof(struct rtp_packet))) { - DTE_DEBUG(DTE_DEBUG_GENERAL, - "Cannot transcode packet of %Zu bytes. This exceeds the " \ - "maximum size of %Zu bytes.\n", count, - SFRAME_SIZE - sizeof(struct rtp_packet)); - return -EINVAL; - } - - if (ZT_FORMAT_G723_1 == dtc->srcfmt) { - if ((G723_5K_BYTES != count) && (G723_6K_BYTES != count)) { - DTE_DEBUG(DTE_DEBUG_GENERAL, - "Trying to transcode packet into G723 format " \ - "that is %Zu bytes instead of the expected " \ - "%d/%d bytes.\n", count, G723_5K_BYTES, G723_6K_BYTES); - return -EINVAL; - } - cpvt->timestamp += G723_SAMPLES; - } else { - /* Same for ulaw and alaw */ - cpvt->timestamp += G729_SAMPLES; - } - - if (!(cmd = wctc4xxp_create_rtp_cmd(wc, dtc, count))) { - return -ENOMEM; - } - /* Copy the data directly from user space into the command buffer. */ - if (copy_from_user(&((struct rtp_packet*)(cmd->data))->payload[0], frame, count)) { - DTE_PRINTK(ERR, "Failed to copy packet from userspace.\n"); - free_cmd(cmd); - return -EFAULT; - } - cpvt->seqno += 1; - - DTE_DEBUG(DTE_DEBUG_RTP_TX, - "Sending packet of %Zu byte on channel (%p).\n", count, dtc); - - wctc4xxp_transmit_cmd(wc, cmd); - atomic_inc(&cpvt->stats.packets_sent); - - return count; -} - -static void -wctc4xxp_send_ack(struct wcdte *wc, u8 seqno, __be16 channel) -{ - struct tcb *cmd; - struct csm_encaps_hdr *hdr; - if (!(cmd = __alloc_cmd(ALLOC_FLAGS, 0))) { - WARN_ON(1); - return; - } - hdr = cmd->data; - BUG_ON(sizeof(*hdr) > cmd->data_len); - setup_common_header(wc, hdr); - hdr->op_code = cpu_to_be16(0x0001); - hdr->seq_num = seqno; - hdr->control = 0xe0; - hdr->channel = channel; - - cmd->data_len = sizeof(*hdr); - wctc4xxp_transmit_cmd(wc, cmd); -} - -static void -do_rx_response_packet(struct wcdte *wc, struct tcb *cmd) -{ - const struct csm_encaps_hdr *listhdr; - const struct csm_encaps_hdr *rxhdr; - struct tcb *pos; - struct tcb *temp; - - rxhdr = cmd->data; - spin_lock_bh(&wc->cmd_list_lock); - list_for_each_entry_safe(pos, temp, &wc->waiting_for_response_list, node) { - listhdr = pos->data; - if ((listhdr->function == rxhdr->function) && - (listhdr->channel == rxhdr->channel)) { - list_del_init(&pos->node); - pos->flags &= ~(__WAIT_FOR_RESPONSE); - WARN_ON(pos->response); - pos->response = cmd; - complete(&pos->complete); - break; - } - } - spin_unlock_bh(&wc->cmd_list_lock); -} - -static void -do_rx_ack_packet(struct wcdte *wc, struct tcb *cmd) -{ - const struct csm_encaps_hdr *listhdr; - const struct csm_encaps_hdr *rxhdr; - struct tcb *pos; - struct tcb *temp; - - rxhdr = cmd->data; - - spin_lock_bh(&wc->cmd_list_lock); - list_for_each_entry_safe(pos, temp, &wc->waiting_for_response_list, node) { - listhdr = pos->data; - if (cpu_to_be16(0xefed) == listhdr->ethhdr.h_proto) { - wc->seq_num = (rxhdr->seq_num + 1) & 0xff; - WARN_ON(!(pos->flags & DO_NOT_AUTO_FREE)); - list_del_init(&pos->node); - complete(&pos->complete); - } else if ((listhdr->seq_num == rxhdr->seq_num) && - (listhdr->channel == rxhdr->channel)) { - if (pos->flags & __WAIT_FOR_RESPONSE) { - pos->flags &= ~(__WAIT_FOR_ACK); - } else { - list_del_init(&pos->node); - - if (pos->flags & DO_NOT_AUTO_FREE) { - complete(&pos->complete); - } else { - free_cmd(pos); - } - } - break; - } - } - spin_unlock_bh(&wc->cmd_list_lock); - - /* There is never a reason to store up the ack packets. */ - free_cmd(cmd); -} - -static inline int -is_response(const struct csm_encaps_hdr *hdr) -{ - return ((0x02 == hdr->type) || (0x04 == hdr->type)) ? 1 : 0; -} - -static void -receive_csm_encaps_packet(struct wcdte *wc, struct tcb *cmd) -{ - const struct csm_encaps_hdr *hdr = cmd->data; - - if (!(hdr->control & MESSAGE_PACKET)) { - - if (!(hdr->control & SUPPRESS_ACK)) { - wctc4xxp_send_ack(wc, hdr->seq_num, hdr->channel); - } - - if (is_response(hdr)) { - do_rx_response_packet(wc, cmd); - } else if (0xc1 == hdr->type) { - if (0x75 == hdr->class) { - DTE_PRINTK(WARNING, - "Received alert (0x%04x) from dsp\n", - le16_to_cpu(hdr->params[0])); - } - free_cmd(cmd); - } else if (0xd4 == hdr->type) { - if (hdr->params[0] != le16_to_cpu(0xffff)) { - DTE_PRINTK(WARNING, - "DTE Failed self test (%04x).\n", - le16_to_cpu(hdr->params[0])); - } else if (hdr->params[1] != le16_to_cpu(0x000c)) { - DTE_PRINTK(WARNING, - "Unexpected ERAM status (%04x).\n", - le16_to_cpu(hdr->params[1])); - } else { - wctc4xxp_set_ready(wc); - wake_up(&wc->waitq); - } - free_cmd(cmd); - } else { - DTE_PRINTK(WARNING, "Unknown command type received. %02x\n", hdr->type); - free_cmd(cmd); - } - } else { - do_rx_ack_packet(wc, cmd); - } -} - -static void -queue_rtp_packet(struct wcdte *wc, struct tcb *cmd) -{ - int index; - struct zt_transcoder_channel *dtc; - struct channel_pvt *cpvt; - struct rtp_packet *packet = cmd->data; - - index = (be16_to_cpu(packet->udphdr.dest) - 0x5000) / 2; - if (unlikely(index >= wc->numchannels)) { - DTE_PRINTK(ERR, "Invalid channel number in response from DTE.\n"); - free_cmd(cmd); - return; - } - - switch (packet->rtphdr.type) { - case 0x00: - case 0x08: - dtc = &(wc->udecode->channels[index]); - break; - case 0x04: - case 0x12: - dtc = &(wc->uencode->channels[index]); - break; - default: - DTE_PRINTK(ERR, "Unknown codec in packet (0x%02x).\n",\ - packet->rtphdr.type); - free_cmd(cmd); - return; - } - - cpvt = dtc->pvt; - spin_lock_bh(&cpvt->lock); - list_add_tail(&cmd->node, &cpvt->rx_queue); - spin_unlock_bh(&cpvt->lock); - zt_tc_set_data_waiting(dtc); - zt_transcoder_alert(dtc); - return; -} - -static inline void -wctc4xxp_receiveprep(struct wcdte *wc, struct tcb *cmd) -{ - const struct ethhdr *ethhdr = (const struct ethhdr*)(cmd->data); - - if (cpu_to_be16(ETH_P_IP) == ethhdr->h_proto) { - queue_rtp_packet(wc, cmd); - } else if (cpu_to_be16(ETH_P_CSM_ENCAPS) == ethhdr->h_proto) { - receive_csm_encaps_packet(wc, cmd); - } else { - DTE_PRINTK(WARNING, - "Unknown packet protocol recieved: %04x.\n", - be16_to_cpu(ethhdr->h_proto)); - free_cmd(cmd); - } -} - -static inline void service_dte(struct wcdte *wc) -{ - struct tcb *cmd; - - /* - * Process the received packets - */ - while((cmd = wctc4xxp_retrieve(wc->rxd))) { - struct tcb *newcmd; - - wctc4xxp_net_capture_cmd(wc, cmd); - - if(!(newcmd = __alloc_cmd(ALLOC_FLAGS, 0))) { - DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__); - } else { - newcmd->data = kmalloc(1518, ALLOC_FLAGS); - if (!newcmd->data) { - DTE_PRINTK(ERR, "out of memory in %s " \ - "again.\n", __FUNCTION__); - } - newcmd->data_len = 1518; - if (wctc4xxp_submit(wc->rxd, newcmd)) { - DTE_PRINTK(ERR, "Failed submit in %s\n", __FUNCTION__); - free_cmd(newcmd); - } - wctc4xxp_receive_demand_poll(wc); - } - wctc4xxp_receiveprep(wc, cmd); - } - wctc4xxp_receive_demand_poll(wc); - - /* - * Process the transmit packets - */ - while((cmd = wctc4xxp_retrieve(wc->txd))) { - if (!(cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE))) { - spin_lock_bh(&wc->cmd_list_lock); - list_del_init(&cmd->node); - spin_unlock_bh(&wc->cmd_list_lock); - if (DO_NOT_AUTO_FREE & cmd->flags) { - complete(&cmd->complete); - } else { - free_cmd(cmd); - } - } - /* We've freed up a spot in the hardware ring buffer. If - * another packet is queued up, let's submit it to the - * hardware. */ - spin_lock_bh(&wc->cmd_list_lock); - if (!list_empty(&wc->cmd_list)) { - cmd = list_entry(wc->cmd_list.next, struct tcb, node); - list_del_init(&cmd->node); - } else { - cmd = NULL; - } - spin_unlock_bh(&wc->cmd_list_lock); - - if (cmd) { - wctc4xxp_transmit_cmd(wc, cmd); - } - } -} - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void deferred_work_func(void *param) -{ - struct wcdte *wc = param; -#else -static void deferred_work_func(struct work_struct *work) -{ - struct wcdte *wc = container_of(work, struct wcdte, deferred_work); -#endif - service_dte(wc); -} - -ZAP_IRQ_HANDLER(wctc4xxp_interrupt) -{ - struct wcdte *wc = dev_id; - u32 ints; - u32 reg; -#define TX_COMPLETE_INTERRUPT 0x00000001 -#define RX_COMPLETE_INTERRUPT 0x00000040 -#define NORMAL_INTERRUPTS (TX_COMPLETE_INTERRUPT | RX_COMPLETE_INTERRUPT) - - /* Read and clear interrupts */ - ints = __wctc4xxp_getctl(wc, 0x0028); - - ints &= wc->intmask; - - if (!ints) - return IRQ_NONE; - - if (likely(ints & NORMAL_INTERRUPTS)) { - reg = 0; - if (ints & TX_COMPLETE_INTERRUPT) { - reg |= TX_COMPLETE_INTERRUPT; - } - if (ints & RX_COMPLETE_INTERRUPT) { - reg |= RX_COMPLETE_INTERRUPT; - } -#if DEFERRED_PROCESSING == WORKQUEUE - schedule_work(&wc->deferred_work); -#elif DEFERRED_PROCESSING == INTERRUPT -#error "You will need to change the locks if you want to run the processing in the interrupt handler." -#else -#error "Define a deferred processing function in kernel/wctc4xxp/wctc4xxp.h" -#endif - __wctc4xxp_setctl(wc, 0x0028, reg); - } else { - if ((ints & 0x00008000) && debug) - DTE_PRINTK(INFO, "Abnormal Interrupt.\n"); - - if ((ints & 0x00002000) && debug) - DTE_PRINTK(INFO, "Fatal Bus Error INT\n"); - - if ((ints & 0x00000100) && debug) - DTE_PRINTK(INFO, "Receive Stopped INT\n"); - - if ((ints & 0x00000080) && debug) { - DTE_PRINTK(INFO, "Receive Desciptor Unavailable INT " \ - "(%d)\n", wctc4xxp_getcount(wc->rxd)); - } - - if ((ints & 0x00000020) && debug) - DTE_PRINTK(INFO, "Transmit Under-flow INT\n"); - - if ((ints & 0x00000008) && debug) - DTE_PRINTK(INFO, "Jabber Timer Time-out INT\n"); - - if ((ints & 0x00000004) && debug) - ; // printk("wcdte: Transmit Descriptor Unavailable INT\n"); - - if ((ints & 0x00000002) && debug) - DTE_PRINTK(INFO, "Transmit Processor Stopped INT\n"); - - /* Clear all the pending interrupts. */ - __wctc4xxp_setctl(wc, 0x0028, ints); - } - return IRQ_HANDLED; -} - -static int -wctc4xxp_hardware_init(struct wcdte *wc) -{ - /* Hardware stuff */ - u32 reg; - unsigned long newjiffies; - u8 cache_line_size; - const u32 DEFAULT_PCI_ACCESS = 0xfff80000; - - /* Enable I/O Access */ - pci_read_config_dword(wc->pdev, 0x0004, ®); - reg |= 0x00000007; - pci_write_config_dword(wc->pdev, 0x0004, reg); - - if (pci_read_config_byte(wc->pdev, 0x0c, &cache_line_size)) { - /* \todo Print an error message... */ - return -EIO; - } - switch (cache_line_size) { - case 0x08: - reg = DEFAULT_PCI_ACCESS | (0x1 << 14); - break; - case 0x10: - reg = DEFAULT_PCI_ACCESS | (0x2 << 14); - break; - case 0x20: - reg = DEFAULT_PCI_ACCESS | (0x3 << 14); - break; - default: - reg = 0xfe584202; - break; - } - - reg |= ((wc->txd->padding / sizeof(u32)) << 2) & 0x7c; - - /* Reset the DTE... */ - wctc4xxp_setctl(wc, 0x0000, reg | 1); - newjiffies = jiffies + HZ; /* One second timeout */ - /* ...and wait for it to come out of reset. */ - while(((wctc4xxp_getctl(wc,0x0000)) & 0x00000001) && (newjiffies > jiffies)) { - msleep(1); - } - - wctc4xxp_setctl(wc, 0x0000, reg); - - /* Configure watchdogs, access, etc */ - wctc4xxp_setctl(wc, 0x0030, 0x00280048); - wctc4xxp_setctl(wc, 0x0078, 0x00000013 /* | (1 << 28) */); - - reg = wctc4xxp_getctl(wc, 0x00fc); - wctc4xxp_setctl(wc, 0x00fc, (reg & ~0x7) | 0x7); - - reg = wctc4xxp_getctl(wc, 0x00fc); - - return 0; -} - -static void -wctc4xxp_setintmask(struct wcdte *wc, unsigned int intmask) -{ - wc->intmask = intmask; - wctc4xxp_setctl(wc, 0x0038, intmask); -} - -static void -wctc4xxp_enable_interrupts(struct wcdte *wc) -{ - wctc4xxp_setintmask(wc, 0x000180c1); - // wctc4xxp_setintmask(wc, 0xffffffff); -} - -static void -wctc4xxp_start_dma(struct wcdte *wc) -{ - int res; - int i; - u32 reg; - struct tcb *cmd; - - for (i = 0; i < DRING_SIZE; ++i) { - if (!(cmd = alloc_cmd())) { - WARN(); - return; - } - cmd->data_len = SFRAME_SIZE; - if ((res=wctc4xxp_submit(wc->rxd, cmd))) { - /* When we're starting the DMA, we should always be - * able to fill the ring....so something is wrong - * here. */ - WARN(); - free_cmd(cmd); - break; - } - } - wmb(); - wctc4xxp_setctl(wc, 0x0020, wc->txd->desc_dma); - wctc4xxp_setctl(wc, 0x0018, wc->rxd->desc_dma); - - /* Start receiver/transmitter */ - reg = wctc4xxp_getctl(wc, 0x0030); - wctc4xxp_setctl(wc, 0x0030, reg | 0x00002002); /* Start XMT and RCD */ - wctc4xxp_receive_demand_poll(wc); - reg = wctc4xxp_getctl(wc, 0x0028); - wctc4xxp_setctl(wc, 0x0028, reg); - -} - -static void -wctc4xxp_stop_dma(struct wcdte *wc) -{ - /* Disable interrupts and reset */ - unsigned int reg; - unsigned long newjiffies; - /* Disable interrupts */ - wctc4xxp_setintmask(wc, 0x00000000); - wctc4xxp_setctl(wc, 0x0084, 0x00000000); - wctc4xxp_setctl(wc, 0x0048, 0x00000000); - /* Reset the part to be on the safe side */ - reg = wctc4xxp_getctl(wc, 0x0000); - reg |= 0x00000001; - wctc4xxp_setctl(wc, 0x0000, reg); - - newjiffies = jiffies + HZ; /* One second timeout */ - /* We'll wait here for the part to come out of reset */ - while(((wctc4xxp_getctl(wc,0x0000)) & 0x00000001) && (newjiffies > jiffies)) { - msleep(1); - } -} - -static void -wctc4xxp_disable_interrupts(struct wcdte *wc) -{ - /* Disable interrupts */ - wctc4xxp_setintmask(wc, 0x00000000); - wctc4xxp_setctl(wc, 0x0084, 0x00000000); -} - -#define MDIO_SHIFT_CLK 0x10000 -#define MDIO_DATA_WRITE1 0x20000 -#define MDIO_ENB 0x00000 -#define MDIO_ENB_IN 0x40000 -#define MDIO_DATA_READ 0x80000 - -static int -wctc4xxp_read_phy(struct wcdte *wc, int location) -{ - int i; - long mdio_addr = 0x0048; - int read_cmd = (0xf6 << 10) | (1 << 5) | location; - int retval = 0; - - /* Establish sync by sending at least 32 logic ones. */ - for (i = 32; i >= 0; i--) { - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | MDIO_DATA_WRITE1); - wctc4xxp_getctl(wc, mdio_addr); - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK); - wctc4xxp_getctl(wc, mdio_addr); - } - - /* Shift the read command bits out. */ - for (i = 17; i >= 0; i--) { - int dataval = (read_cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; - - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | dataval); - wctc4xxp_getctl(wc, mdio_addr); - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | dataval | MDIO_SHIFT_CLK); - wctc4xxp_getctl(wc, mdio_addr); - } - - /* Read the two transition, 16 data, and wire-idle bits. */ - for (i = 19; i > 0; i--) { - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB_IN); - wctc4xxp_getctl(wc, mdio_addr); - retval = (retval << 1) | ((wctc4xxp_getctl(wc, mdio_addr) & MDIO_DATA_READ) ? 1 : 0); - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB_IN | MDIO_SHIFT_CLK); - wctc4xxp_getctl(wc, mdio_addr); - } - retval = (retval>>1) & 0xffff; - return retval; -} - -static void -wctc4xxp_write_phy(struct wcdte *wc, int location, int value) -{ - int i; - int cmd = (0x5002 << 16) | (1 << 23) | (location<<18) | value; - long mdio_addr = 0x0048; - - /* Establish sync by sending 32 logic ones. */ - for (i = 32; i >= 0; i--) { - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | MDIO_DATA_WRITE1); - wctc4xxp_getctl(wc, mdio_addr); - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK); - wctc4xxp_getctl(wc, mdio_addr); - } - /* Shift the command bits out. */ - for (i = 31; i >= 0; i--) { - int dataval = (cmd & (1 << i)) ? MDIO_DATA_WRITE1 : 0; - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | dataval); - wctc4xxp_getctl(wc, mdio_addr); - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB | dataval | MDIO_SHIFT_CLK); - wctc4xxp_getctl(wc, mdio_addr); - } - /* Clear out extra bits. */ - for (i = 2; i > 0; i--) { - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB_IN); - wctc4xxp_getctl(wc, mdio_addr); - wctc4xxp_setctl(wc, mdio_addr, MDIO_ENB_IN | MDIO_SHIFT_CLK); - wctc4xxp_getctl(wc, mdio_addr); - } - return; -} - -static int -wctc4xxp_wait_for_link(struct wcdte *wc) -{ - int reg; - unsigned int delay_count = 0; - do { - reg = wctc4xxp_getctl(wc, 0x00fc); - mdelay(2); - delay_count++; - - if (delay_count >= 5000) { - DTE_PRINTK(ERR, "Failed to link to DTE processor!\n"); - return -EIO; - } - } while ((reg & 0xE0000000) != 0xE0000000); - return 0; -} - -static int -wctc4xxp_load_firmware(struct wcdte *wc, const struct firmware *firmware) -{ - unsigned int byteloc; - unsigned int last_byteloc; - unsigned int length; - struct tcb *cmd; - - byteloc = 17; - - if (!(cmd = alloc_cmd())) { - return -ENOMEM; - } - if (1518 > cmd->data_len) { - cmd->data = kmalloc(1518, GFP_KERNEL); - if (!(cmd->data)) { - free_cmd(cmd); - return -ENOMEM; - } - cmd->data_len = 1518; - } - while (byteloc < (firmware->size-20)) { - last_byteloc = byteloc; - length = (firmware->data[byteloc] << 8) | firmware->data[byteloc+1]; - byteloc += 2; - cmd->data_len = length; - BUG_ON(length > cmd->data_len); - memcpy(cmd->data, &firmware->data[byteloc], length); - byteloc += length; - cmd->flags = WAIT_FOR_ACK; - wctc4xxp_transmit_cmd(wc, cmd); - wait_for_completion(&cmd->complete); - if (cmd->flags & DTE_CMD_TIMEOUT) { - free_cmd(cmd); - DTE_PRINTK(ERR, "Failed to load firmware.\n"); - return -EIO; - } - } - free_cmd(cmd); - if (!wait_event_timeout(wc->waitq, wctc4xxp_is_ready(wc), 15*HZ)) { - DTE_PRINTK(ERR, "Failed to boot firmware.\n"); - return -EIO; - } - return 0; -} - -static int -wctc4xxp_turn_off_booted_led(struct wcdte *wc) -{ - int ret = 0; - int reg; - /* Turn off auto negotiation */ - wctc4xxp_write_phy(wc, 0, 0x2100); - DTE_DEBUG(DTE_DEBUG_GENERAL, "PHY register 0 = %X\n", - wctc4xxp_read_phy(wc, 0)); - - /* Set reset */ - wctc4xxp_setctl(wc, 0x00A0, 0x04000000); - - /* Wait 4 ms to ensure processor reset */ - mdelay(4); - - /* Clear reset */ - wctc4xxp_setctl(wc, 0x00A0, 0x04080000); - - /* Wait for the ethernet link */ - if ((ret = wctc4xxp_wait_for_link(wc))) { - return ret; - } - - /* Turn off booted LED */ - wctc4xxp_setctl(wc, 0x00A0, 0x04084000); - reg = wctc4xxp_getctl(wc, 0x00fc); - DTE_DEBUG(DTE_DEBUG_GENERAL, "LINK STATUS: reg(0xfc) = %X\n", reg); - - reg = wctc4xxp_getctl(wc, 0x00A0); - - return ret; -} - -static void -wctc4xxp_turn_on_booted_led(struct wcdte *wc) -{ - wctc4xxp_setctl(wc, 0x00A0, 0x04080000); -} - -static int -wctc4xxp_boot_processor(struct wcdte *wc, const struct firmware *firmware) -{ - int ret; - - wctc4xxp_turn_off_booted_led(wc); - - if ((ret = wctc4xxp_load_firmware(wc, firmware))) { - return ret; - } - - wctc4xxp_turn_on_booted_led(wc); - - DTE_DEBUG(DTE_DEBUG_GENERAL, "Successfully booted DTE processor.\n"); - return 0; -} - -static int -wctc4xxp_create_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt, - u8 simple, u8 complicated) -{ - int res; - int length; - u8 chan1, chan2; - struct zt_transcoder_channel *dtc1, *dtc2; - struct channel_pvt *cpvt1, *cpvt2; - /* \todo what do these part variable names mean? */ - unsigned int timeslot; - unsigned int part2_id; - struct tcb *cmd; - const struct csm_encaps_hdr *hdr; - - - BUG_ON(!wc || !cpvt); - if (cpvt->encoder) { - timeslot = cpvt->timeslot_in_num; - part2_id = cpvt->timeslot_out_num; - } else { - u8 temp; - timeslot = cpvt->timeslot_out_num; - part2_id = cpvt->timeslot_in_num; - temp = simple; - simple = complicated; - complicated = temp; - } - - length = (DTE_FORMAT_G729A == complicated) ? G729_LENGTH : - (DTE_FORMAT_G723_1 == complicated) ? G723_LENGTH : 0; - - if (!(cmd = wctc4xxp_create_channel_cmd(wc, timeslot))) { - return -ENOMEM; - } - if ((res=wctc4xxp_transmit_cmd_and_wait(wc, cmd))) { - free_cmd(cmd); - return res; - } - free_cmd(cmd); - - cmd = wctc4xxp_create_cmd(wc, CMD_MSG_QUERY_CHANNEL(wc->seq_num++, timeslot)); - if ((res=wctc4xxp_transmit_cmd_and_wait(wc,cmd))) { - free_cmd(cmd); - return res; - } - WARN_ON(!cmd->response); - hdr = (const struct csm_encaps_hdr*)cmd->response->data; - chan1 = le16_to_cpu(hdr->params[0]);; - free_cmd(cmd); - - if (!(cmd = wctc4xxp_create_channel_cmd(wc, part2_id))) { - return -ENOMEM; - } - if ((res = __wctc4xxp_send_cmd(wc, cmd))) { - return res; - } - cmd = wctc4xxp_create_cmd(wc, CMD_MSG_QUERY_CHANNEL(wc->seq_num++, part2_id)); - cmd->flags |= WAIT_FOR_RESPONSE; - if ((res=wctc4xxp_transmit_cmd_and_wait(wc,cmd))) { - return res; - } - WARN_ON(!cmd->response); - hdr = (const struct csm_encaps_hdr*)cmd->response->data; - chan2 = le16_to_cpu(hdr->params[0]);; - free_cmd(cmd); - - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, - "DTE is using the following channels chan1: %d chan2: %d\n", chan1, chan2); - - BUG_ON(timeslot/2 >= wc->numchannels); - BUG_ON(part2_id/2 >= wc->numchannels); - dtc1 = &(wc->uencode->channels[timeslot/2]); - dtc2 = &(wc->udecode->channels[part2_id/2]); - cpvt1 = dtc1->pvt; - cpvt2 = dtc2->pvt; - BUG_ON(!cpvt1); - BUG_ON(!cpvt2); - - /* Configure complex channel */ - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SET_IP_HDR_CHANNEL(cpvt1->cmd_seqno++, chan1, part2_id, timeslot)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_VCEOPT(cpvt1->cmd_seqno++, chan1, length, 0)))) { - return res; - } - /* Configure simple channel */ - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SET_IP_HDR_CHANNEL(cpvt2->cmd_seqno++, chan2, timeslot, part2_id)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_VCEOPT(cpvt2->cmd_seqno++, chan2, length, 0)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_TONECTL(cpvt1->cmd_seqno++, chan1)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_DTMFOPT(cpvt1->cmd_seqno++, chan1)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_TONECTL(cpvt2->cmd_seqno++, chan2)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_DTMFOPT(cpvt2->cmd_seqno++, chan2)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_INDCTRL(cpvt1->cmd_seqno++, chan1)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_INDCTRL(cpvt2->cmd_seqno++, chan2)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_TRANS_CONNECT(wc->seq_num++, 1, chan1, chan2, complicated, simple)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_VOPENA(cpvt1->cmd_seqno++, chan1, complicated)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_VOPENA(cpvt2->cmd_seqno++, chan2, simple)))) { - return res; - } - - DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, - "DTE has completed setup and connected the two channels together.\n"); - - - /* Save off the channels returned from the DTE so we can use then when - * sending the RTP packets. */ - if (ENCODER == cpvt->encoder) { - cpvt->chan_in_num = chan1; - cpvt->chan_out_num = chan2; - } else { - cpvt->chan_out_num = chan1; - cpvt->chan_in_num = chan2; - } - - return 0; -} - -static int -wctc4xxp_destroy_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt) -{ - struct zt_transcoder_channel *dtc1, *dtc2; - struct channel_pvt *cpvt1, *cpvt2; - int chan1, chan2; - int res; - - if (cpvt->encoder) { - chan1 = cpvt->chan_in_num; - chan2 = cpvt->chan_out_num; - } else { - chan1 = cpvt->chan_out_num; - chan2 = cpvt->chan_in_num; - } - - if (chan1/2 >= wc->numchannels || chan2/2 >= wc->numchannels) { - DTE_PRINTK(WARNING, - "Invalid channel numbers in %s. chan1:%d chan2: %d\n", - __FUNCTION__, chan1/2, chan2/2); - return 0; - } - - dtc1 = &(wc->uencode->channels[chan1/2]); - dtc2 = &(wc->udecode->channels[chan2/2]); - cpvt1 = dtc1->pvt; - cpvt2 = dtc2->pvt; - - /* Turn off both channels */ - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_VOPENA_CLOSE(cpvt1->cmd_seqno++, chan1)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_VOIP_VOPENA_CLOSE(cpvt2->cmd_seqno++, chan2)))) { - return res; - } - - /* Disconnect the channels */ - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_TRANS_CONNECT(wc->seq_num++, 0, chan1, chan2, 0, 0)))) { - return res; - } - - /* Remove the channels */ - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan1)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_DESTROY_CHANNEL(wc->seq_num++, chan2)))) { - return res; - } - - return 0; -} - - -static int -__wctc4xxp_setup_channels(struct wcdte *wc) -{ - int res; - struct tcb *cmd; - - if (!(cmd = alloc_cmd())) { - return -ENOMEM; - } - - __wctc4xxp_create_set_arm_clk_cmd(wc, cmd); - res = wctc4xxp_transmit_cmd_and_wait(wc, cmd); - free_cmd(cmd); - if (res) { - return res; - } - - cmd = wctc4xxp_create_cmd(wc, CMD_MSG_SET_SPU_CLK(wc->seq_num++)); - res = wctc4xxp_transmit_cmd_and_wait(wc, cmd); - free_cmd(cmd); - if (res) { - return res; - } - - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_TDM_SELECT_BUS_MODE(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_TDM_ENABLE_BUS(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SUPVSR_SETUP_TDM_PARMS(wc->seq_num++, 0x03, 0x20, 0x00)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SUPVSR_SETUP_TDM_PARMS(wc->seq_num++, 0x04, 0x80, 0x04)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SUPVSR_SETUP_TDM_PARMS(wc->seq_num++, 0x05, 0x20, 0x08)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SUPVSR_SETUP_TDM_PARMS(wc->seq_num++, 0x06, 0x80, 0x0C)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SET_ETH_HEADER(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_IP_SERVICE_CONFIG(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_ARP_SERVICE_CONFIG(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_ICMP_SERVICE_CONFIG(wc->seq_num++)))) { - return res; - } - - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_DEVICE_SET_COUNTRY_CODE(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SPU_FEATURES_CONTROL(wc->seq_num++, 0x02)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_IP_OPTIONS(wc->seq_num++)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_SPU_FEATURES_CONTROL(wc->seq_num++, 0x04)))) { - return res; - } - if ((res=wctc4xxp_send_cmd(wc, CMD_MSG_TDM_OPT(wc->seq_num++)))) { - return res; - } - return 0; -} - -static int -wctc4xxp_setup_channels(struct wcdte *wc) -{ - int ret; - if ((ret=down_interruptible(&wc->chansem))) { - WARN(); - return ret; - } - ret = __wctc4xxp_setup_channels(wc); - up(&wc->chansem); - - return ret; -} - -static void wctc4xxp_setup_file_operations(struct file_operations *fops) -{ - fops->owner = THIS_MODULE; - fops->read = wctc4xxp_read; - fops->write = wctc4xxp_write; -} - -static int -initialize_channel_pvt(struct wcdte *wc, encode_t type, - struct channel_pvt **cpvt) -{ - int chan; - *cpvt = kmalloc(sizeof(struct channel_pvt) * wc->numchannels, GFP_KERNEL); - if (!(*cpvt)) { - return -ENOMEM; - } - for (chan = 0; chan < wc->numchannels; ++chan) { - wctc4xxp_init_state((*cpvt) + chan, type, chan, wc); - } - return 0; -} - -static int -initialize_transcoder(struct wcdte *wc, unsigned int srcfmts, - unsigned int dstfmts, struct channel_pvt *pvts, - struct zt_transcoder **zt) -{ - int chan; - *zt = zt_transcoder_alloc(wc->numchannels); - if (!(*zt)) { - return -ENOMEM; - } - (*zt)->srcfmts = srcfmts; - (*zt)->dstfmts = dstfmts; - (*zt)->allocate = wctc4xxp_operation_allocate; - (*zt)->release = wctc4xxp_operation_release; - wctc4xxp_setup_file_operations(&((*zt)->fops)); - for (chan = 0; chan < wc->numchannels; ++chan) { - (*zt)->channels[chan].pvt = &pvts[chan]; - } - return 0; -} - -static int initialize_encoders(struct wcdte *wc, unsigned int complexfmts) -{ - int res; - if ((res = initialize_channel_pvt(wc, ENCODER, &wc->encoders))) { - return res; - } - if ((res = initialize_transcoder(wc, - ZT_FORMAT_ULAW | ZT_FORMAT_ALAW, - complexfmts, - wc->encoders, - &wc->uencode))) - { - return res; - } - sprintf(wc->uencode->name, "DTE Encoder"); - return res; -} - -static int -initialize_decoders(struct wcdte *wc, unsigned int complexfmts) -{ - int res; - if ((res = initialize_channel_pvt(wc, DECODER, &wc->decoders))) { - return res; - } - if ((res = initialize_transcoder(wc, - complexfmts, - ZT_FORMAT_ULAW | ZT_FORMAT_ALAW, - wc->decoders, - &wc->udecode))) - { - return res; - } - - sprintf(wc->udecode->name, "DTE Decoder"); - return res; -} - -static void -wctc4xxp_send_commands(struct wcdte *wc, struct list_head *to_send) -{ - struct tcb *cmd; - while (!list_empty(to_send)) { - cmd = container_of(to_send->next, struct tcb, node); - list_del_init(&cmd->node); - wctc4xxp_transmit_cmd(wc, cmd); - } -} - -static void -wctc4xxp_watchdog(unsigned long data) -{ - struct wcdte *wc = (struct wcdte *)data; - struct tcb *cmd, *temp; - LIST_HEAD(cmds_to_retry); - const int MAX_RETRIES = 5; - - spin_lock(&wc->cmd_list_lock); - /* Go through the list of messages that are waiting for responses from - * the DTE, and complete or retry any that have timed out. */ - list_for_each_entry_safe(cmd, temp, &wc->waiting_for_response_list, node) { - if (time_after(jiffies, cmd->timeout)) { - if (++cmd->retries > MAX_RETRIES) { - if (!(cmd->flags & TX_COMPLETE)) { - set_bit(DTE_SHUTDOWN, &wc->flags); - spin_unlock(&wc->cmd_list_lock); - wctc4xxp_stop_dma(wc); - DTE_PRINTK(ERR, "Board malfunctioning. Halting operation.\n"); - return; - } - /* ERROR: We've retried the command and haven't - * received the ACK or the response. */ - cmd->flags |= DTE_CMD_TIMEOUT; - list_del_init(&cmd->node); - complete(&cmd->complete); - } else if (cmd->flags & TX_COMPLETE) { - /* Move this to the local list because we're - * going to resend it once we free the locks */ - list_move_tail(&cmd->node, &cmds_to_retry); - } else { - /* The command is still sitting on the tx - * descriptor ring. We don't want to move it - * off any lists, lets just reset the timeout - * and tell the hardware to look for another - * command . */ - DTE_PRINTK(WARNING, "Retrying command that was " \ - "still on descriptor list.\n"); - cmd->timeout = jiffies + HZ/4; - wctc4xxp_transmit_demand_poll(wc); - } - } - } - spin_unlock(&wc->cmd_list_lock); - - wctc4xxp_send_commands(wc, &cmds_to_retry); -} - -/** - * Insert an struct wcdte on the global list in sorted order - * - */ -static int __devinit -wctc4xxp_add_to_device_list(struct wcdte *wc) -{ - struct wcdte *cur; - int pos = 0; - INIT_LIST_HEAD(&wc->node); - spin_lock(&wctc4xxp_list_lock); - list_for_each_entry(cur, &wctc4xxp_list, node) { - if (cur->pos != pos) { - /* Add the new entry before the one here */ - list_add_tail(&wc->node, &cur->node); - break; - } - else { - ++pos; - } - } - if (list_empty(&wc->node)) { - list_add_tail(&wc->node, &wctc4xxp_list); - } - spin_unlock(&wctc4xxp_list_lock); - return pos; -} - -struct wctc4xxp_desc { - const char *short_name; - const char *long_name; - int flags; -}; - -static struct wctc4xxp_desc wctc400p = { - .short_name = "tc400b", - .long_name = "Wildcard TC400P+TC400M", - .flags = 0, -}; - -static struct wctc4xxp_desc wctce400 = { - .short_name = "tce400", - .long_name = "Wildcard TCE400+TC400M", - .flags = 0, -}; - -static int __devinit -wctc4xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res, reg, position_on_list; - struct wcdte *wc = NULL; - struct wctc4xxp_desc *d = (struct wctc4xxp_desc *)ent->driver_data; - unsigned char g729_numchannels, g723_numchannels, min_numchannels; - unsigned char wctc4xxp_firmware_ver, wctc4xxp_firmware_ver_minor; - unsigned int complexfmts; - struct firmware embedded_firmware; - const struct firmware *firmware = &embedded_firmware; -#if !defined(HOTPLUG_FIRMWARE) - extern void _binary_zt_fw_tc400m_bin_size; - extern u8 _binary_zt_fw_tc400m_bin_start[]; -#else - static const char tc400m_firmware[] = "zaptel-fw-tc400m.bin"; -#endif - - /* ------------------------------------------------------------------ - * Setup the pure software constructs internal to this driver. - * --------------------------------------------------------------- */ - - if (!(wc = kmalloc(sizeof(*wc), GFP_KERNEL))) { - return -ENOMEM; - } - memset(wc, 0, sizeof(*wc)); - - position_on_list = wctc4xxp_add_to_device_list(wc); - snprintf(wc->board_name, sizeof(wc->board_name)-1, "%s%d", - d->short_name, position_on_list); - wc->iobase = pci_resource_start(pdev, 0); - wc->pdev = pdev; - wc->pos = position_on_list; - wc->variety = d->long_name; - - init_MUTEX(&wc->chansem); - spin_lock_init(&wc->reglock); - spin_lock_init(&wc->cmd_list_lock); - INIT_LIST_HEAD(&wc->cmd_list); - INIT_LIST_HEAD(&wc->waiting_for_response_list); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&wc->deferred_work, deferred_work_func, wc); -#else - INIT_WORK(&wc->deferred_work, deferred_work_func); -#endif - DTE_PRINTK(INFO, "Attached to device at %s.\n", pci_name(wc->pdev)); - - /* Keep track of whether we need to free the region */ - if (!request_region(wc->iobase, 0xff, wc->board_name)) { - /* \todo put in error message. */ - DTE_PRINTK(WARNING, - "Failed to reserve the I/O ports for this device.\n"); - return -EIO; - } - - init_waitqueue_head(&wc->waitq); - - if (pci_set_dma_mask(wc->pdev, DMA_32BIT_MASK)) { - release_region(wc->iobase, 0xff); - DTE_PRINTK(WARNING, "No suitable DMA available.\n"); - return -EIO; - } - - if (!(wc->txd = kmalloc(sizeof(*wc->txd), GFP_KERNEL))) { - res = -ENOMEM; - goto error_exit_swinit; - } - - if ((res = wctc4xxp_initialize_descriptor_ring(wc->pdev, wc->txd, - 0xe0800000, - DMA_TO_DEVICE))) { - goto error_exit_swinit; - } - - if (!(wc->rxd = kmalloc(sizeof(*wc->rxd), GFP_KERNEL))) { - res = -ENOMEM; - goto error_exit_swinit; - } - - if ((res = wctc4xxp_initialize_descriptor_ring(wc->pdev, wc->rxd, 0, - DMA_FROM_DEVICE))) { - goto error_exit_swinit; - } - -#if defined(HOTPLUG_FIRMWARE) - if ((res = request_firmware(&firmware, tc400m_firmware, &wc->pdev->dev)) || - !firmware) { - DTE_PRINTK(ERR, "Firmware %s not available from userspace. (%d)\n", tc400m_firmware, res); - goto error_exit_swinit; - } -#else - embedded_firmware.data = _binary_zt_fw_tc400m_bin_start; - embedded_firmware.size = (size_t) &_binary_zt_fw_tc400m_bin_size; -#endif - - wctc4xxp_firmware_ver = firmware->data[0]; - wctc4xxp_firmware_ver_minor = firmware->data[16]; - g729_numchannels = firmware->data[1]; - g723_numchannels = firmware->data[2]; - - min_numchannels = min(g723_numchannels, g729_numchannels); - - if (!mode || strlen(mode) < 4) { - sprintf(wc->complexname, "G.729a / G.723.1"); - complexfmts = ZT_FORMAT_G729A | ZT_FORMAT_G723_1; - wc->numchannels = min_numchannels; - } else if (mode[3] == '9') { /* "G.729" */ - sprintf(wc->complexname, "G.729a"); - complexfmts = ZT_FORMAT_G729A; - wc->numchannels = g729_numchannels; - } else if (mode[3] == '3') { /* "G.723.1" */ - sprintf(wc->complexname, "G.723.1"); - complexfmts = ZT_FORMAT_G723_1; - wc->numchannels = g723_numchannels; - } else { - sprintf(wc->complexname, "G.729a / G.723.1"); - complexfmts = ZT_FORMAT_G729A | ZT_FORMAT_G723_1; - wc->numchannels = min_numchannels; - } - - if ((res = initialize_encoders(wc, complexfmts))) { - goto error_exit_swinit; - } - if ((res = initialize_decoders(wc, complexfmts))) { - goto error_exit_swinit; - } - - if (DTE_DEBUG_NETWORK_IF & debug) { - if ((res = wctc4xxp_net_register(wc))) { - goto error_exit_swinit; - } - } - - setup_timer(&wc->watchdog, wctc4xxp_watchdog, (unsigned long)wc); - - /* ------------------------------------------------------------------ - * Load the firmware and start the DTE. - * --------------------------------------------------------------- */ - - if ((res = pci_enable_device(pdev))) { - DTE_PRINTK(ERR, "Failed to enable device.\n"); - goto error_exit_swinit;; - } - pci_set_master(pdev); - pci_set_drvdata(pdev, wc); - if ((res = request_irq(pdev->irq, wctc4xxp_interrupt, ZAP_IRQ_SHARED, wc->board_name, wc))) { - DTE_PRINTK(ERR, "Unable to request IRQ %d\n", pdev->irq); - if (firmware != &embedded_firmware) { - release_firmware(firmware); - } - goto error_exit_hwinit; - } - if ((res = wctc4xxp_hardware_init(wc))) { - if (firmware != &embedded_firmware) { - release_firmware(firmware); - } - goto error_exit_hwinit; - } - wctc4xxp_enable_interrupts(wc); - wctc4xxp_start_dma(wc); - res = wctc4xxp_boot_processor(wc, firmware); - if (firmware != &embedded_firmware) { - release_firmware(firmware); - } - if (res) { - goto error_exit_hwinit; - } - - if ((res = wctc4xxp_setup_channels(wc))) { - goto error_exit_hwinit; - } - - /* \todo Read firmware version directly from tc400b.*/ - DTE_PRINTK(INFO, "(%s) Transcoder support LOADED " \ - "(firm ver = %d.%d)\n", wc->complexname, wctc4xxp_firmware_ver, - wctc4xxp_firmware_ver_minor); - - reg = wctc4xxp_getctl(wc, 0x00fc); - - DTE_DEBUG(DTE_DEBUG_GENERAL, - "debug: (post-boot) Reg fc is %08x\n", reg); - - DTE_PRINTK(INFO, "Installed a Wildcard TC: %s \n", wc->variety); - DTE_DEBUG(DTE_DEBUG_GENERAL, "Operating in DEBUG mode.\n"); - zt_transcoder_register(wc->uencode); - zt_transcoder_register(wc->udecode); - - return 0; - -error_exit_hwinit: - wctc4xxp_stop_dma(wc); - wctc4xxp_cleanup_command_list(wc); - free_irq(pdev->irq, wc); - pci_set_drvdata(pdev, NULL); -error_exit_swinit: - wctc4xxp_net_unregister(wc); - if (wc->encoders) kfree(wc->encoders); - if (wc->decoders) kfree(wc->decoders); - if (wc->uencode) zt_transcoder_free(wc->uencode); - if (wc->udecode) zt_transcoder_free(wc->udecode); - if (wc->txd) { - if (wc->txd->desc) { - wctc4xxp_cleanup_descriptor_ring(wc->txd); - } - kfree(wc->txd); - } - if (wc->rxd) { - if (wc->rxd && wc->rxd->desc) { - wctc4xxp_cleanup_descriptor_ring(wc->rxd); - } - kfree(wc->rxd); - } - release_region(wc->iobase, 0xff); - spin_lock(&wctc4xxp_list_lock); - list_del(&wc->node); - spin_unlock(&wctc4xxp_list_lock); - kfree(wc); - return res; -} - -static void wctc4xxp_cleanup_channels(struct wcdte *wc) -{ - int i; - struct zt_transcoder_channel *dtc_en, *dtc_de; - struct channel_pvt *cpvt; - - for(i = 0; i < wc->numchannels; i++) { - dtc_en = &(wc->uencode->channels[i]); - cpvt = dtc_en->pvt; - wctc4xxp_cleanup_channel_private(wc, cpvt); - - dtc_de = &(wc->udecode->channels[i]); - cpvt = dtc_de->pvt; - wctc4xxp_cleanup_channel_private(wc, cpvt); - } -} - -static void __devexit wctc4xxp_remove_one(struct pci_dev *pdev) -{ - int i; - struct wcdte *wc = pci_get_drvdata(pdev); - struct zt_transcoder_channel *dtc_en, *dtc_de; - struct channel_pvt *cpvt; - - if (!wc) { - /* \todo print warning message here. */ - return; - } - - spin_lock(&wctc4xxp_list_lock); - list_del(&wc->node); - spin_unlock(&wctc4xxp_list_lock); - - set_bit(DTE_SHUTDOWN, &wc->flags); - if (del_timer_sync(&wc->watchdog)) { - /* Just delete the timer twice in case the timer had already - * checked DTE_SHUTDOWN and rescheduled itself the first time. - */ - del_timer_sync(&wc->watchdog); - } - - wctc4xxp_net_unregister(wc); - - if (debug) { - for(i = 0; i < wc->numchannels; i++) { - dtc_en = &(wc->uencode->channels[i]); - cpvt = dtc_en->pvt; - DTE_DEBUG(DTE_DEBUG_GENERAL, - "encoder[%d] snt = %d, rcv = %d [%d]\n", i, - atomic_read(&cpvt->stats.packets_sent), - atomic_read(&cpvt->stats.packets_received), - atomic_read(&cpvt->stats.packets_sent) - atomic_read(&cpvt->stats.packets_received)); - - dtc_de = &(wc->udecode->channels[i]); - cpvt = dtc_de->pvt; - DTE_DEBUG(DTE_DEBUG_GENERAL, - "decoder[%d] snt = %d, rcv = %d [%d]\n", i, - atomic_read(&cpvt->stats.packets_sent), - atomic_read(&cpvt->stats.packets_received), - atomic_read(&cpvt->stats.packets_sent) - atomic_read(&cpvt->stats.packets_received)); - } - } - - /* Stop any DMA */ - wctc4xxp_stop_dma(wc); - - /* In case hardware is still there */ - wctc4xxp_disable_interrupts(wc); - - free_irq(pdev->irq, wc); - - /* There isn't anything that would run in the workqueue that will wait - * on an interrupt. */ - - zt_transcoder_unregister(wc->udecode); - zt_transcoder_unregister(wc->uencode); - - /* Free Resources */ - release_region(wc->iobase, 0xff); - spin_lock_bh(&wc->cmd_list_lock); - if (wc->txd) { - if (wc->txd->desc) wctc4xxp_cleanup_descriptor_ring(wc->txd); - kfree(wc->txd); - } - if (wc->rxd) { - if (wc->rxd && wc->rxd->desc) wctc4xxp_cleanup_descriptor_ring(wc->rxd); - kfree(wc->rxd); - } - spin_unlock_bh(&wc->cmd_list_lock); - wctc4xxp_cleanup_command_list(wc); - wctc4xxp_cleanup_channels(wc); - - pci_set_drvdata(pdev, NULL); - - zt_transcoder_free(wc->uencode); - zt_transcoder_free(wc->udecode); - kfree(wc->encoders); - kfree(wc->decoders); - kfree(wc); -} - -static struct pci_device_id wctc4xxp_pci_tbl[] = { - { 0xd161, 0x3400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctc400p }, /* Digium board */ - { 0xd161, 0x8004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctce400 }, /* Digium board */ - { 0 } -}; - -MODULE_DEVICE_TABLE(pci, wctc4xxp_pci_tbl); - -static struct pci_driver wctc4xxp_driver = { - name: "wctc4xxp", - probe: wctc4xxp_init_one, - remove: __devexit_p(wctc4xxp_remove_one), - suspend: NULL, - resume: NULL, - id_table: wctc4xxp_pci_tbl, -}; - -int __init wctc4xxp_init(void) -{ - int res; -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - cmd_cache = kmem_cache_create(THIS_MODULE->name, sizeof(struct tcb), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); -# else - cmd_cache = kmem_cache_create(THIS_MODULE->name, sizeof(struct tcb), 0, - SLAB_HWCACHE_ALIGN, NULL); -# endif - - if (!cmd_cache) { - return -ENOMEM; - } - spin_lock_init(&wctc4xxp_list_lock); - INIT_LIST_HEAD(&wctc4xxp_list); - res = zap_pci_module(&wctc4xxp_driver); - if (res) - return -ENODEV; - return 0; -} - -void __exit wctc4xxp_cleanup(void) -{ - pci_unregister_driver(&wctc4xxp_driver); - kmem_cache_destroy(cmd_cache); -} - -module_param(debug, int, S_IRUGO | S_IWUSR); -MODULE_DESCRIPTION("Wildcard TC400P+TC400M Driver"); -MODULE_AUTHOR("Digium Incorporated "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(wctc4xxp_init); -module_exit(wctc4xxp_cleanup); diff --git a/zaptel/kernel/wctdm.c b/zaptel/kernel/wctdm.c deleted file mode 100644 index 1ec6dc50..00000000 --- a/zaptel/kernel/wctdm.c +++ /dev/null @@ -1,2560 +0,0 @@ -/* - * Wilcard TDM400P TDM FXS/FXO Interface Driver for Zapata Telephony interface - * - * Written by Mark Spencer - * Matthew Fredrickson - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "proslic.h" -#include "wctdm.h" -/* - * Define for audio vs. register based ring detection - * - */ -/* #define AUDIO_RINGCHECK */ - -/* - Experimental max loop current limit for the proslic - Loop current limit is from 20 mA to 41 mA in steps of 3 - (according to datasheet) - So set the value below to: - 0x00 : 20mA (default) - 0x01 : 23mA - 0x02 : 26mA - 0x03 : 29mA - 0x04 : 32mA - 0x05 : 35mA - 0x06 : 37mA - 0x07 : 41mA -*/ -static int loopcurrent = 20; - -static int reversepolarity = 0; - -static alpha indirect_regs[] = -{ -{0,255,"DTMF_ROW_0_PEAK",0x55C2}, -{1,255,"DTMF_ROW_1_PEAK",0x51E6}, -{2,255,"DTMF_ROW2_PEAK",0x4B85}, -{3,255,"DTMF_ROW3_PEAK",0x4937}, -{4,255,"DTMF_COL1_PEAK",0x3333}, -{5,255,"DTMF_FWD_TWIST",0x0202}, -{6,255,"DTMF_RVS_TWIST",0x0202}, -{7,255,"DTMF_ROW_RATIO_TRES",0x0198}, -{8,255,"DTMF_COL_RATIO_TRES",0x0198}, -{9,255,"DTMF_ROW_2ND_ARM",0x0611}, -{10,255,"DTMF_COL_2ND_ARM",0x0202}, -{11,255,"DTMF_PWR_MIN_TRES",0x00E5}, -{12,255,"DTMF_OT_LIM_TRES",0x0A1C}, -{13,0,"OSC1_COEF",0x7B30}, -{14,1,"OSC1X",0x0063}, -{15,2,"OSC1Y",0x0000}, -{16,3,"OSC2_COEF",0x7870}, -{17,4,"OSC2X",0x007D}, -{18,5,"OSC2Y",0x0000}, -{19,6,"RING_V_OFF",0x0000}, -{20,7,"RING_OSC",0x7EF0}, -{21,8,"RING_X",0x0160}, -{22,9,"RING_Y",0x0000}, -{23,255,"PULSE_ENVEL",0x2000}, -{24,255,"PULSE_X",0x2000}, -{25,255,"PULSE_Y",0x0000}, -//{26,13,"RECV_DIGITAL_GAIN",0x4000}, // playback volume set lower -{26,13,"RECV_DIGITAL_GAIN",0x2000}, // playback volume set lower -{27,14,"XMIT_DIGITAL_GAIN",0x4000}, -//{27,14,"XMIT_DIGITAL_GAIN",0x2000}, -{28,15,"LOOP_CLOSE_TRES",0x1000}, -{29,16,"RING_TRIP_TRES",0x3600}, -{30,17,"COMMON_MIN_TRES",0x1000}, -{31,18,"COMMON_MAX_TRES",0x0200}, -{32,19,"PWR_ALARM_Q1Q2",0x07C0}, -{33,20,"PWR_ALARM_Q3Q4",0x2600}, -{34,21,"PWR_ALARM_Q5Q6",0x1B80}, -{35,22,"LOOP_CLOSURE_FILTER",0x8000}, -{36,23,"RING_TRIP_FILTER",0x0320}, -{37,24,"TERM_LP_POLE_Q1Q2",0x008C}, -{38,25,"TERM_LP_POLE_Q3Q4",0x0100}, -{39,26,"TERM_LP_POLE_Q5Q6",0x0010}, -{40,27,"CM_BIAS_RINGING",0x0C00}, -{41,64,"DCDC_MIN_V",0x0C00}, -{42,255,"DCDC_XTRA",0x1000}, -{43,66,"LOOP_CLOSE_TRES_LOW",0x1000}, -}; - -#include "zaptel.h" - -#include "fxo_modes.h" - -#ifdef LINUX26 -#include -#endif - -#define NUM_FXO_REGS 60 - -#define WC_MAX_IFACES 128 - -#define WC_CNTL 0x00 -#define WC_OPER 0x01 -#define WC_AUXC 0x02 -#define WC_AUXD 0x03 -#define WC_MASK0 0x04 -#define WC_MASK1 0x05 -#define WC_INTSTAT 0x06 -#define WC_AUXR 0x07 - -#define WC_DMAWS 0x08 -#define WC_DMAWI 0x0c -#define WC_DMAWE 0x10 -#define WC_DMARS 0x18 -#define WC_DMARI 0x1c -#define WC_DMARE 0x20 - -#define WC_AUXFUNC 0x2b -#define WC_SERCTL 0x2d -#define WC_FSCDELAY 0x2f - -#define WC_REGBASE 0xc0 - -#define WC_SYNC 0x0 -#define WC_TEST 0x1 -#define WC_CS 0x2 -#define WC_VER 0x3 - -#define BIT_CS (1 << 2) -#define BIT_SCLK (1 << 3) -#define BIT_SDI (1 << 4) -#define BIT_SDO (1 << 5) - -#define FLAG_EMPTY 0 -#define FLAG_WRITE 1 -#define FLAG_READ 2 - -#define DEFAULT_RING_DEBOUNCE 64 /* Ringer Debounce (64 ms) */ - -#define POLARITY_DEBOUNCE 64 /* Polarity debounce (64 ms) */ - -#define OHT_TIMER 6000 /* How long after RING to retain OHT */ - -#define FLAG_3215 (1 << 0) - -#define NUM_CARDS 4 - -#define MAX_ALARMS 10 - -#define MOD_TYPE_FXS 0 -#define MOD_TYPE_FXO 1 - -#define MINPEGTIME 10 * 8 /* 30 ms peak to peak gets us no more than 100 Hz */ -#define PEGTIME 50 * 8 /* 50ms peak to peak gets us rings of 10 Hz or more */ -#define PEGCOUNT 5 /* 5 cycles of pegging means RING */ - -#define NUM_CAL_REGS 12 - -struct calregs { - unsigned char vals[NUM_CAL_REGS]; -}; - -enum proslic_power_warn { - PROSLIC_POWER_UNKNOWN = 0, - PROSLIC_POWER_ON, - PROSLIC_POWER_WARNED, -}; - -enum battery_state { - BATTERY_UNKNOWN = 0, - BATTERY_PRESENT, - BATTERY_LOST, -}; - -struct wctdm { - struct pci_dev *dev; - char *variety; - struct zt_span span; - unsigned char ios; - int usecount; - unsigned int intcount; - int dead; - int pos; - int flags[NUM_CARDS]; - int freeregion; - int alt; - int curcard; - int cardflag; /* Bit-map of present cards */ - enum proslic_power_warn proslic_power; - spinlock_t lock; - - union { - struct fxo { -#ifdef AUDIO_RINGCHECK - unsigned int pegtimer; - int pegcount; - int peg; - int ring; -#else - int wasringing; - int lastrdtx; -#endif - int ringdebounce; - int offhook; - unsigned int battdebounce; - unsigned int battalarm; - enum battery_state battery; - int lastpol; - int polarity; - int polaritydebounce; - } fxo; - struct fxs { - int oldrxhook; - int debouncehook; - int lastrxhook; - int debounce; - int ohttimer; - int idletxhookstate; /* IDLE changing hook state */ - int lasttxhook; - int palarms; - struct calregs calregs; - } fxs; - } mod[NUM_CARDS]; - - /* Receive hook state and debouncing */ - int modtype[NUM_CARDS]; - unsigned char reg0shadow[NUM_CARDS]; - unsigned char reg1shadow[NUM_CARDS]; - - unsigned long ioaddr; - dma_addr_t readdma; - dma_addr_t writedma; - volatile unsigned int *writechunk; /* Double-word aligned write memory */ - volatile unsigned int *readchunk; /* Double-word aligned read memory */ - struct zt_chan chans[NUM_CARDS]; -}; - - -struct wctdm_desc { - char *name; - int flags; -}; - -static struct wctdm_desc wctdm = { "Wildcard S400P Prototype", 0 }; -static struct wctdm_desc wctdme = { "Wildcard TDM400P REV E/F", 0 }; -static struct wctdm_desc wctdmh = { "Wildcard TDM400P REV H", 0 }; -static struct wctdm_desc wctdmi = { "Wildcard TDM400P REV I", 0 }; -static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 }; - -static struct wctdm *ifaces[WC_MAX_IFACES]; - -static void wctdm_release(struct wctdm *wc); - -static unsigned int battdebounce; -static unsigned int battalarm; -static unsigned int battthresh; -static int ringdebounce = DEFAULT_RING_DEBOUNCE; -static int fwringdetect = 0; -static int debug = 0; -static int robust = 0; -static int timingonly = 0; -static int lowpower = 0; -static int boostringer = 0; -static int fastringer = 0; -static int _opermode = 0; -static char *opermode = "FCC"; -static int fxshonormode = 0; -static int alawoverride = 0; -static int fastpickup = 0; -static int fxotxgain = 0; -static int fxorxgain = 0; -static int fxstxgain = 0; -static int fxsrxgain = 0; - -static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane); - -static inline void wctdm_transmitprep(struct wctdm *wc, unsigned char ints) -{ - volatile unsigned int *writechunk; - int x; - if (ints & 0x01) - /* Write is at interrupt address. Start writing from normal offset */ - writechunk = wc->writechunk; - else - writechunk = wc->writechunk + ZT_CHUNKSIZE; - /* Calculate Transmission */ - zt_transmit(&wc->span); - - for (x=0;xcardflag & (1 << 3)) - writechunk[x] |= (wc->chans[3].writechunk[x]); - if (wc->cardflag & (1 << 2)) - writechunk[x] |= (wc->chans[2].writechunk[x] << 8); - if (wc->cardflag & (1 << 1)) - writechunk[x] |= (wc->chans[1].writechunk[x] << 16); - if (wc->cardflag & (1 << 0)) - writechunk[x] |= (wc->chans[0].writechunk[x] << 24); -#else - if (wc->cardflag & (1 << 3)) - writechunk[x] |= (wc->chans[3].writechunk[x] << 24); - if (wc->cardflag & (1 << 2)) - writechunk[x] |= (wc->chans[2].writechunk[x] << 16); - if (wc->cardflag & (1 << 1)) - writechunk[x] |= (wc->chans[1].writechunk[x] << 8); - if (wc->cardflag & (1 << 0)) - writechunk[x] |= (wc->chans[0].writechunk[x]); -#endif - } - -} - -#ifdef AUDIO_RINGCHECK -static inline void ring_check(struct wctdm *wc, int card) -{ - int x; - short sample; - if (wc->modtype[card] != MOD_TYPE_FXO) - return; - wc->mod[card].fxo.pegtimer += ZT_CHUNKSIZE; - for (x=0;xchans[card].readchunk[x], (&(wc->chans[card]))); - if ((sample > 10000) && (wc->mod[card].fxo.peg != 1)) { - if (debug > 1) printk("High peg!\n"); - if ((wc->mod[card].fxo.pegtimer < PEGTIME) && (wc->mod[card].fxo.pegtimer > MINPEGTIME)) - wc->mod[card].fxo.pegcount++; - wc->mod[card].fxo.pegtimer = 0; - wc->mod[card].fxo.peg = 1; - } else if ((sample < -10000) && (wc->mod[card].fxo.peg != -1)) { - if (debug > 1) printk("Low peg!\n"); - if ((wc->mod[card].fxo.pegtimer < (PEGTIME >> 2)) && (wc->mod[card].fxo.pegtimer > (MINPEGTIME >> 2))) - wc->mod[card].fxo.pegcount++; - wc->mod[card].fxo.pegtimer = 0; - wc->mod[card].fxo.peg = -1; - } - } - if (wc->mod[card].fxo.pegtimer > PEGTIME) { - /* Reset pegcount if our timer expires */ - wc->mod[card].fxo.pegcount = 0; - } - /* Decrement debouncer if appropriate */ - if (wc->mod[card].fxo.ringdebounce) - wc->mod[card].fxo.ringdebounce--; - if (!wc->mod[card].fxo.offhook && !wc->mod[card].fxo.ringdebounce) { - if (!wc->mod[card].fxo.ring && (wc->mod[card].fxo.pegcount > PEGCOUNT)) { - /* It's ringing */ - if (debug) - printk("RING on %d/%d!\n", wc->span.spanno, card + 1); - if (!wc->mod[card].fxo.offhook) - zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); - wc->mod[card].fxo.ring = 1; - } - if (wc->mod[card].fxo.ring && !wc->mod[card].fxo.pegcount) { - /* No more ring */ - if (debug) - printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - wc->mod[card].fxo.ring = 0; - } - } -} -#endif -static inline void wctdm_receiveprep(struct wctdm *wc, unsigned char ints) -{ - volatile unsigned int *readchunk; - int x; - - if (ints & 0x08) - readchunk = wc->readchunk + ZT_CHUNKSIZE; - else - /* Read is at interrupt address. Valid data is available at normal offset */ - readchunk = wc->readchunk; - for (x=0;xcardflag & (1 << 3)) - wc->chans[3].readchunk[x] = (readchunk[x]) & 0xff; - if (wc->cardflag & (1 << 2)) - wc->chans[2].readchunk[x] = (readchunk[x] >> 8) & 0xff; - if (wc->cardflag & (1 << 1)) - wc->chans[1].readchunk[x] = (readchunk[x] >> 16) & 0xff; - if (wc->cardflag & (1 << 0)) - wc->chans[0].readchunk[x] = (readchunk[x] >> 24) & 0xff; -#else - if (wc->cardflag & (1 << 3)) - wc->chans[3].readchunk[x] = (readchunk[x] >> 24) & 0xff; - if (wc->cardflag & (1 << 2)) - wc->chans[2].readchunk[x] = (readchunk[x] >> 16) & 0xff; - if (wc->cardflag & (1 << 1)) - wc->chans[1].readchunk[x] = (readchunk[x] >> 8) & 0xff; - if (wc->cardflag & (1 << 0)) - wc->chans[0].readchunk[x] = (readchunk[x]) & 0xff; -#endif - } -#ifdef AUDIO_RINGCHECK - for (x=0;xcards;x++) - ring_check(wc, x); -#endif - /* XXX We're wasting 8 taps. We should get closer :( */ - for (x = 0; x < NUM_CARDS; x++) { - if (wc->cardflag & (1 << x)) - zt_ec_chunk(&wc->chans[x], wc->chans[x].readchunk, wc->chans[x].writechunk); - } - zt_receive(&wc->span); -} - -static void wctdm_stop_dma(struct wctdm *wc); -static void wctdm_reset_tdm(struct wctdm *wc); -static void wctdm_restart_dma(struct wctdm *wc); - -static inline void __write_8bits(struct wctdm *wc, unsigned char bits) -{ - /* Drop chip select */ - int x; - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - wc->ios &= ~BIT_CS; - outb(wc->ios, wc->ioaddr + WC_AUXD); - for (x=0;x<8;x++) { - /* Send out each bit, MSB first, drop SCLK as we do so */ - if (bits & 0x80) - wc->ios |= BIT_SDI; - else - wc->ios &= ~BIT_SDI; - wc->ios &= ~BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Now raise SCLK high again and repeat */ - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - bits <<= 1; - } - /* Finally raise CS back high again */ - wc->ios |= BIT_CS; - outb(wc->ios, wc->ioaddr + WC_AUXD); - -} - -static inline void __reset_spi(struct wctdm *wc) -{ - /* Drop chip select and clock once and raise and clock once */ - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - wc->ios &= ~BIT_CS; - outb(wc->ios, wc->ioaddr + WC_AUXD); - wc->ios |= BIT_SDI; - wc->ios &= ~BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Now raise SCLK high again and repeat */ - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Finally raise CS back high again */ - wc->ios |= BIT_CS; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Clock again */ - wc->ios &= ~BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Now raise SCLK high again and repeat */ - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - -} - -static inline unsigned char __read_8bits(struct wctdm *wc) -{ - unsigned char res=0, c; - int x; - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Drop chip select */ - wc->ios &= ~BIT_CS; - outb(wc->ios, wc->ioaddr + WC_AUXD); - for (x=0;x<8;x++) { - res <<= 1; - /* Get SCLK */ - wc->ios &= ~BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - /* Read back the value */ - c = inb(wc->ioaddr + WC_AUXR); - if (c & BIT_SDO) - res |= 1; - /* Now raise SCLK high again */ - wc->ios |= BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - } - /* Finally raise CS back high again */ - wc->ios |= BIT_CS; - outb(wc->ios, wc->ioaddr + WC_AUXD); - wc->ios &= ~BIT_SCLK; - outb(wc->ios, wc->ioaddr + WC_AUXD); - - /* And return our result */ - return res; -} - -static void __wctdm_setcreg(struct wctdm *wc, unsigned char reg, unsigned char val) -{ - outb(val, wc->ioaddr + WC_REGBASE + ((reg & 0xf) << 2)); -} - -static unsigned char __wctdm_getcreg(struct wctdm *wc, unsigned char reg) -{ - return inb(wc->ioaddr + WC_REGBASE + ((reg & 0xf) << 2)); -} - -static inline void __wctdm_setcard(struct wctdm *wc, int card) -{ - if (wc->curcard != card) { - __wctdm_setcreg(wc, WC_CS, (1 << card)); - wc->curcard = card; - } -} - -static void __wctdm_setreg(struct wctdm *wc, int card, unsigned char reg, unsigned char value) -{ - __wctdm_setcard(wc, card); - if (wc->modtype[card] == MOD_TYPE_FXO) { - __write_8bits(wc, 0x20); - __write_8bits(wc, reg & 0x7f); - } else { - __write_8bits(wc, reg & 0x7f); - } - __write_8bits(wc, value); -} - -static void wctdm_setreg(struct wctdm *wc, int card, unsigned char reg, unsigned char value) -{ - unsigned long flags; - spin_lock_irqsave(&wc->lock, flags); - __wctdm_setreg(wc, card, reg, value); - spin_unlock_irqrestore(&wc->lock, flags); -} - -static unsigned char __wctdm_getreg(struct wctdm *wc, int card, unsigned char reg) -{ - __wctdm_setcard(wc, card); - if (wc->modtype[card] == MOD_TYPE_FXO) { - __write_8bits(wc, 0x60); - __write_8bits(wc, reg & 0x7f); - } else { - __write_8bits(wc, reg | 0x80); - } - return __read_8bits(wc); -} - -static inline void reset_spi(struct wctdm *wc, int card) -{ - unsigned long flags; - spin_lock_irqsave(&wc->lock, flags); - __wctdm_setcard(wc, card); - __reset_spi(wc); - __reset_spi(wc); - spin_unlock_irqrestore(&wc->lock, flags); -} - -static unsigned char wctdm_getreg(struct wctdm *wc, int card, unsigned char reg) -{ - unsigned long flags; - unsigned char res; - spin_lock_irqsave(&wc->lock, flags); - res = __wctdm_getreg(wc, card, reg); - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static int __wait_access(struct wctdm *wc, int card) -{ - unsigned char data = 0; - long origjiffies; - int count = 0; - - #define MAX 6000 /* attempts */ - - - origjiffies = jiffies; - /* Wait for indirect access */ - while (count++ < MAX) - { - data = __wctdm_getreg(wc, card, I_STATUS); - - if (!data) - return 0; - - } - - if(count > (MAX-1)) printk(" ##### Loop error (%02x) #####\n", data); - - return 0; -} - -static unsigned char translate_3215(unsigned char address) -{ - int x; - for (x=0;xflags[card] & FLAG_3215) { - address = translate_3215(address); - if (address == 255) - return 0; - } - spin_lock_irqsave(&wc->lock, flags); - if(!__wait_access(wc, card)) { - __wctdm_setreg(wc, card, IDA_LO,(unsigned char)(data & 0xFF)); - __wctdm_setreg(wc, card, IDA_HI,(unsigned char)((data & 0xFF00)>>8)); - __wctdm_setreg(wc, card, IAA,address); - res = 0; - }; - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static int wctdm_proslic_getreg_indirect(struct wctdm *wc, int card, unsigned char address) -{ - unsigned long flags; - int res = -1; - char *p=NULL; - /* Translate 3215 addresses */ - if (wc->flags[card] & FLAG_3215) { - address = translate_3215(address); - if (address == 255) - return 0; - } - spin_lock_irqsave(&wc->lock, flags); - if (!__wait_access(wc, card)) { - __wctdm_setreg(wc, card, IAA, address); - if (!__wait_access(wc, card)) { - unsigned char data1, data2; - data1 = __wctdm_getreg(wc, card, IDA_LO); - data2 = __wctdm_getreg(wc, card, IDA_HI); - res = data1 | (data2 << 8); - } else - p = "Failed to wait inside"; - } else - p = "failed to wait"; - spin_unlock_irqrestore(&wc->lock, flags); - if (p) - printk("%s\n",p); - return res; -} - -static int wctdm_proslic_init_indirect_regs(struct wctdm *wc, int card) -{ - unsigned char i; - - for (i=0; iflags[card] & FLAG_3215) || (indirect_regs[i].altaddr != 255))) - { - printk("!!!!!!! %s iREG %X = %X should be %X\n", - indirect_regs[i].name,indirect_regs[i].address,j,initial ); - passed = 0; - } - } - - if (passed) { - if (debug) - printk("Init Indirect Registers completed successfully.\n"); - } else { - printk(" !!!!! Init Indirect Registers UNSUCCESSFULLY.\n"); - return -1; - } - return 0; -} - -static inline void wctdm_proslic_recheck_sanity(struct wctdm *wc, int card) -{ - int res; - /* Check loopback */ - res = wc->reg1shadow[card]; - if (!res && (res != wc->mod[card].fxs.lasttxhook)) { - res = wctdm_getreg(wc, card, 8); - if (res) { - printk("Ouch, part reset, quickly restoring reality (%d)\n", card); - wctdm_init_proslic(wc, card, 1, 0, 1); - } else { - if (wc->mod[card].fxs.palarms++ < MAX_ALARMS) { - printk("Power alarm on module %d, resetting!\n", card + 1); - if (wc->mod[card].fxs.lasttxhook == 4) - wc->mod[card].fxs.lasttxhook = 1; - wctdm_setreg(wc, card, 64, wc->mod[card].fxs.lasttxhook); - } else { - if (wc->mod[card].fxs.palarms == MAX_ALARMS) - printk("Too many power alarms on card %d, NOT resetting!\n", card + 1); - } - } - } -} - -static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) -{ -#define MS_PER_CHECK_HOOK 16 - -#ifndef AUDIO_RINGCHECK - unsigned char res; -#endif - signed char b; - int poopy = 0; - struct fxo *fxo = &wc->mod[card].fxo; - - /* Try to track issues that plague slot one FXO's */ - b = wc->reg0shadow[card]; - if ((b & 0x2) || !(b & 0x8)) { - /* Not good -- don't look at anything else */ - if (debug) - printk("Poopy (%02x) on card %d!\n", b, card + 1); - poopy++; - } - b &= 0x9b; - if (fxo->offhook) { - if (b != 0x9) - wctdm_setreg(wc, card, 5, 0x9); - } else { - if (b != 0x8) - wctdm_setreg(wc, card, 5, 0x8); - } - if (poopy) - return; - if (!fxo->offhook) { - if (fwringdetect) { - res = wc->reg0shadow[card] & 0x60; - if (fxo->ringdebounce--) { - if (res && (res != fxo->lastrdtx) && - (fxo->battery == BATTERY_PRESENT)) { - if (!fxo->wasringing) { - fxo->wasringing = 1; - if (debug) - printk("RING on %d/%d!\n", wc->span.spanno, card + 1); - zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); - } - fxo->lastrdtx = res; - fxo->ringdebounce = 10; - } else if (!res) { - if ((fxo->ringdebounce == 0) && fxo->wasringing) { - fxo->wasringing = 0; - if (debug) - printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - } - } - } else if (res && (fxo->battery == BATTERY_PRESENT)) { - fxo->lastrdtx = res; - fxo->ringdebounce = 10; - } - } else { - res = wc->reg0shadow[card]; - if ((res & 0x60) && (fxo->battery == BATTERY_PRESENT)) { - fxo->ringdebounce += (ZT_CHUNKSIZE * 16); - if (fxo->ringdebounce >= ZT_CHUNKSIZE * ringdebounce) { - if (!fxo->wasringing) { - fxo->wasringing = 1; - zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); - if (debug) - printk("RING on %d/%d!\n", wc->span.spanno, card + 1); - } - fxo->ringdebounce = ZT_CHUNKSIZE * ringdebounce; - } - } else { - fxo->ringdebounce -= ZT_CHUNKSIZE * 4; - if (fxo->ringdebounce <= 0) { - if (fxo->wasringing) { - fxo->wasringing = 0; - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (debug) - printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); - } - fxo->ringdebounce = 0; - } - } - } - } - - b = wc->reg1shadow[card]; - - if (abs(b) < battthresh) { - /* possible existing states: - battery lost, no debounce timer - battery lost, debounce timer (going to battery present) - battery present or unknown, no debounce timer - battery present or unknown, debounce timer (going to battery lost) - */ - - if (fxo->battery == BATTERY_LOST) { - if (fxo->battdebounce) { - /* we were going to BATTERY_PRESENT, but battery was lost again, - so clear the debounce timer */ - fxo->battdebounce = 0; - } - } else { - if (fxo->battdebounce) { - /* going to BATTERY_LOST, see if we are there yet */ - if (--fxo->battdebounce == 0) { - fxo->battery = BATTERY_LOST; - if (debug) - printk("NO BATTERY on %d/%d!\n", wc->span.spanno, card + 1); -#ifdef JAPAN - if (!wc->ohdebounce && wc->offhook) { - zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK); - if (debug) - printk("Signalled On Hook\n"); -#ifdef ZERO_BATT_RING - wc->onhook++; -#endif - } -#else - zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK); - /* set the alarm timer, taking into account that part of its time - period has already passed while debouncing occurred */ - fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK; -#endif - } - } else { - /* start the debounce timer to verify that battery has been lost */ - fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK; - } - } - } else { - /* possible existing states: - battery lost or unknown, no debounce timer - battery lost or unknown, debounce timer (going to battery present) - battery present, no debounce timer - battery present, debounce timer (going to battery lost) - */ - - if (fxo->battery == BATTERY_PRESENT) { - if (fxo->battdebounce) { - /* we were going to BATTERY_LOST, but battery appeared again, - so clear the debounce timer */ - fxo->battdebounce = 0; - } - } else { - if (fxo->battdebounce) { - /* going to BATTERY_PRESENT, see if we are there yet */ - if (--fxo->battdebounce == 0) { - fxo->battery = BATTERY_PRESENT; - if (debug) - printk("BATTERY on %d/%d (%s)!\n", wc->span.spanno, card + 1, - (b < 0) ? "-" : "+"); -#ifdef ZERO_BATT_RING - if (wc->onhook) { - wc->onhook = 0; - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (debug) - printk("Signalled Off Hook\n"); - } -#else - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); -#endif - /* set the alarm timer, taking into account that part of its time - period has already passed while debouncing occurred */ - fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK; - } - } else { - /* start the debounce timer to verify that battery has appeared */ - fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK; - } - } - } - - if (fxo->lastpol >= 0) { - if (b < 0) { - fxo->lastpol = -1; - fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK; - } - } - if (fxo->lastpol <= 0) { - if (b > 0) { - fxo->lastpol = 1; - fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK; - } - } - - if (fxo->battalarm) { - if (--fxo->battalarm == 0) { - /* the alarm timer has expired, so update the battery alarm state - for this channel */ - zt_alarm_channel(&wc->chans[card], fxo->battery == BATTERY_LOST ? ZT_ALARM_RED : ZT_ALARM_NONE); - } - } - - if (fxo->polaritydebounce) { - if (--fxo->polaritydebounce == 0) { - if (fxo->lastpol != fxo->polarity) { - if (debug) - printk("%lu Polarity reversed (%d -> %d)\n", jiffies, - fxo->polarity, - fxo->lastpol); - if (fxo->polarity) - zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY); - fxo->polarity = fxo->lastpol; - } - } - } -#undef MS_PER_CHECK_HOOK -} - -static inline void wctdm_proslic_check_hook(struct wctdm *wc, int card) -{ - char res; - int hook; - - /* For some reason we have to debounce the - hook detector. */ - - res = wc->reg0shadow[card]; - hook = (res & 1); - if (hook != wc->mod[card].fxs.lastrxhook) { - /* Reset the debounce (must be multiple of 4ms) */ - wc->mod[card].fxs.debounce = 8 * (4 * 8); -#if 0 - printk("Resetting debounce card %d hook %d, %d\n", card, hook, wc->mod[card].fxs.debounce); -#endif - } else { - if (wc->mod[card].fxs.debounce > 0) { - wc->mod[card].fxs.debounce-= 16 * ZT_CHUNKSIZE; -#if 0 - printk("Sustaining hook %d, %d\n", hook, wc->mod[card].fxs.debounce); -#endif - if (!wc->mod[card].fxs.debounce) { -#if 0 - printk("Counted down debounce, newhook: %d...\n", hook); -#endif - wc->mod[card].fxs.debouncehook = hook; - } - if (!wc->mod[card].fxs.oldrxhook && wc->mod[card].fxs.debouncehook) { - /* Off hook */ -#if 1 - if (debug) -#endif - printk("wctdm: Card %d Going off hook\n", card); - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (robust) - wctdm_init_proslic(wc, card, 1, 0, 1); - wc->mod[card].fxs.oldrxhook = 1; - - } else if (wc->mod[card].fxs.oldrxhook && !wc->mod[card].fxs.debouncehook) { - /* On hook */ -#if 1 - if (debug) -#endif - printk("wctdm: Card %d Going on hook\n", card); - zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK); - wc->mod[card].fxs.oldrxhook = 0; - } - } - } - wc->mod[card].fxs.lastrxhook = hook; -} - -ZAP_IRQ_HANDLER(wctdm_interrupt) -{ - struct wctdm *wc = dev_id; - unsigned char ints; - int x; - int mode; - - ints = inb(wc->ioaddr + WC_INTSTAT); - - if (!ints) -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - - outb(ints, wc->ioaddr + WC_INTSTAT); - - if (ints & 0x10) { - /* Stop DMA, wait for watchdog */ - printk("TDM PCI Master abort\n"); - wctdm_stop_dma(wc); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#else - return; -#endif - } - - if (ints & 0x20) { - printk("PCI Target abort\n"); -#ifdef LINUX26 - return IRQ_RETVAL(1); -#else - return; -#endif - } - - for (x=0;x<4;x++) { - if (wc->cardflag & (1 << x) && - (wc->modtype[x] == MOD_TYPE_FXS)) { - if (wc->mod[x].fxs.lasttxhook == 0x4) { - /* RINGing, prepare for OHT */ - wc->mod[x].fxs.ohttimer = OHT_TIMER << 3; - if (reversepolarity) - wc->mod[x].fxs.idletxhookstate = 0x6; /* OHT mode when idle */ - else - wc->mod[x].fxs.idletxhookstate = 0x2; - } else { - if (wc->mod[x].fxs.ohttimer) { - wc->mod[x].fxs.ohttimer-= ZT_CHUNKSIZE; - if (!wc->mod[x].fxs.ohttimer) { - if (reversepolarity) - wc->mod[x].fxs.idletxhookstate = 0x5; /* Switch to active */ - else - wc->mod[x].fxs.idletxhookstate = 0x1; - if ((wc->mod[x].fxs.lasttxhook == 0x2) || (wc->mod[x].fxs.lasttxhook == 0x6)) { - /* Apply the change if appropriate */ - if (reversepolarity) - wc->mod[x].fxs.lasttxhook = 0x5; - else - wc->mod[x].fxs.lasttxhook = 0x1; - wctdm_setreg(wc, x, 64, wc->mod[x].fxs.lasttxhook); - } - } - } - } - } - } - - if (ints & 0x0f) { - wc->intcount++; - x = wc->intcount & 0x3; - mode = wc->intcount & 0xc; - if (wc->cardflag & (1 << x)) { - switch(mode) { - case 0: - /* Rest */ - break; - case 4: - /* Read first shadow reg */ - if (wc->modtype[x] == MOD_TYPE_FXS) - wc->reg0shadow[x] = wctdm_getreg(wc, x, 68); - else if (wc->modtype[x] == MOD_TYPE_FXO) - wc->reg0shadow[x] = wctdm_getreg(wc, x, 5); - break; - case 8: - /* Read second shadow reg */ - if (wc->modtype[x] == MOD_TYPE_FXS) - wc->reg1shadow[x] = wctdm_getreg(wc, x, 64); - else if (wc->modtype[x] == MOD_TYPE_FXO) - wc->reg1shadow[x] = wctdm_getreg(wc, x, 29); - break; - case 12: - /* Perform processing */ - if (wc->modtype[x] == MOD_TYPE_FXS) { - wctdm_proslic_check_hook(wc, x); - if (!(wc->intcount & 0xf0)) - wctdm_proslic_recheck_sanity(wc, x); - } else if (wc->modtype[x] == MOD_TYPE_FXO) { - wctdm_voicedaa_check_hook(wc, x); - } - break; - } - } - if (!(wc->intcount % 10000)) { - /* Accept an alarm once per 10 seconds */ - for (x=0;x<4;x++) - if (wc->modtype[x] == MOD_TYPE_FXS) { - if (wc->mod[x].fxs.palarms) - wc->mod[x].fxs.palarms--; - } - } - wctdm_receiveprep(wc, ints); - wctdm_transmitprep(wc, ints); - } -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif - -} - -static int wctdm_voicedaa_insane(struct wctdm *wc, int card) -{ - int blah; - blah = wctdm_getreg(wc, card, 2); - if (blah != 0x3) - return -2; - blah = wctdm_getreg(wc, card, 11); - if (debug) - printk("VoiceDAA System: %02x\n", blah & 0xf); - return 0; -} - -static int wctdm_proslic_insane(struct wctdm *wc, int card) -{ - int blah,insane_report; - insane_report=0; - - blah = wctdm_getreg(wc, card, 0); - if (debug) - printk("ProSLIC on module %d, product %d, version %d\n", card, (blah & 0x30) >> 4, (blah & 0xf)); - -#if 0 - if ((blah & 0x30) >> 4) { - printk("ProSLIC on module %d is not a 3210.\n", card); - return -1; - } -#endif - if (((blah & 0xf) == 0) || ((blah & 0xf) == 0xf)) { - /* SLIC not loaded */ - return -1; - } - if ((blah & 0xf) < 2) { - printk("ProSLIC 3210 version %d is too old\n", blah & 0xf); - return -1; - } - if (wctdm_getreg(wc, card, 1) & 0x80) - /* ProSLIC 3215, not a 3210 */ - wc->flags[card] |= FLAG_3215; - - blah = wctdm_getreg(wc, card, 8); - if (blah != 0x2) { - printk("ProSLIC on module %d insane (1) %d should be 2\n", card, blah); - return -1; - } else if ( insane_report) - printk("ProSLIC on module %d Reg 8 Reads %d Expected is 0x2\n",card,blah); - - blah = wctdm_getreg(wc, card, 64); - if (blah != 0x0) { - printk("ProSLIC on module %d insane (2)\n", card); - return -1; - } else if ( insane_report) - printk("ProSLIC on module %d Reg 64 Reads %d Expected is 0x0\n",card,blah); - - blah = wctdm_getreg(wc, card, 11); - if (blah != 0x33) { - printk("ProSLIC on module %d insane (3)\n", card); - return -1; - } else if ( insane_report) - printk("ProSLIC on module %d Reg 11 Reads %d Expected is 0x33\n",card,blah); - - /* Just be sure it's setup right. */ - wctdm_setreg(wc, card, 30, 0); - - if (debug) - printk("ProSLIC on module %d seems sane.\n", card); - return 0; -} - -static int wctdm_proslic_powerleak_test(struct wctdm *wc, int card) -{ - unsigned long origjiffies; - unsigned char vbat; - - /* Turn off linefeed */ - wctdm_setreg(wc, card, 64, 0); - - /* Power down */ - wctdm_setreg(wc, card, 14, 0x10); - - /* Wait for one second */ - origjiffies = jiffies; - - while((vbat = wctdm_getreg(wc, card, 82)) > 0x6) { - if ((jiffies - origjiffies) >= (HZ/2)) - break;; - } - - if (vbat < 0x06) { - printk("Excessive leakage detected on module %d: %d volts (%02x) after %d ms\n", card, - 376 * vbat / 1000, vbat, (int)((jiffies - origjiffies) * 1000 / HZ)); - return -1; - } else if (debug) { - printk("Post-leakage voltage: %d volts\n", 376 * vbat / 1000); - } - return 0; -} - -static int wctdm_powerup_proslic(struct wctdm *wc, int card, int fast) -{ - unsigned char vbat; - unsigned long origjiffies; - int lim; - - /* Set period of DC-DC converter to 1/64 khz */ - wctdm_setreg(wc, card, 92, 0xff /* was 0xff */); - - /* Wait for VBat to powerup */ - origjiffies = jiffies; - - /* Disable powerdown */ - wctdm_setreg(wc, card, 14, 0); - - /* If fast, don't bother checking anymore */ - if (fast) - return 0; - - while((vbat = wctdm_getreg(wc, card, 82)) < 0xc0) { - /* Wait no more than 500ms */ - if ((jiffies - origjiffies) > HZ/2) { - break; - } - } - - if (vbat < 0xc0) { - if (wc->proslic_power == PROSLIC_POWER_UNKNOWN) - printk("ProSLIC on module %d failed to powerup within %d ms (%d mV only)\n\n -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM400P??\n", - card, (int)(((jiffies - origjiffies) * 1000 / HZ)), - vbat * 375); - wc->proslic_power = PROSLIC_POWER_WARNED; - return -1; - } else if (debug) { - printk("ProSLIC on module %d powered up to -%d volts (%02x) in %d ms\n", - card, vbat * 376 / 1000, vbat, (int)(((jiffies - origjiffies) * 1000 / HZ))); - } - wc->proslic_power = PROSLIC_POWER_ON; - - /* Proslic max allowed loop current, reg 71 LOOP_I_LIMIT */ - /* If out of range, just set it to the default value */ - lim = (loopcurrent - 20) / 3; - if ( loopcurrent > 41 ) { - lim = 0; - if (debug) - printk("Loop current out of range! Setting to default 20mA!\n"); - } - else if (debug) - printk("Loop current set to %dmA!\n",(lim*3)+20); - wctdm_setreg(wc,card,LOOP_I_LIMIT,lim); - - /* Engage DC-DC converter */ - wctdm_setreg(wc, card, 93, 0x19 /* was 0x19 */); -#if 0 - origjiffies = jiffies; - while(0x80 & wctdm_getreg(wc, card, 93)) { - if ((jiffies - origjiffies) > 2 * HZ) { - printk("Timeout waiting for DC-DC calibration on module %d\n", card); - return -1; - } - } - -#if 0 - /* Wait a full two seconds */ - while((jiffies - origjiffies) < 2 * HZ); - - /* Just check to be sure */ - vbat = wctdm_getreg(wc, card, 82); - printk("ProSLIC on module %d powered up to -%d volts (%02x) in %d ms\n", - card, vbat * 376 / 1000, vbat, (int)(((jiffies - origjiffies) * 1000 / HZ))); -#endif -#endif - return 0; - -} - -static int wctdm_proslic_manual_calibrate(struct wctdm *wc, int card){ - unsigned long origjiffies; - unsigned char i; - - wctdm_setreg(wc, card, 21, 0);//(0) Disable all interupts in DR21 - wctdm_setreg(wc, card, 22, 0);//(0)Disable all interupts in DR21 - wctdm_setreg(wc, card, 23, 0);//(0)Disable all interupts in DR21 - wctdm_setreg(wc, card, 64, 0);//(0) - - wctdm_setreg(wc, card, 97, 0x18); //(0x18)Calibrations without the ADC and DAC offset and without common mode calibration. - wctdm_setreg(wc, card, 96, 0x47); //(0x47) Calibrate common mode and differential DAC mode DAC + ILIM - - origjiffies=jiffies; - while( wctdm_getreg(wc,card,96)!=0 ){ - if((jiffies-origjiffies)>80) - return -1; - } -//Initialized DR 98 and 99 to get consistant results. -// 98 and 99 are the results registers and the search should have same intial conditions. - -/*******************************The following is the manual gain mismatch calibration****************************/ -/*******************************This is also available as a function *******************************************/ - // Delay 10ms - origjiffies=jiffies; - while((jiffies-origjiffies)<1); - wctdm_proslic_setreg_indirect(wc, card, 88,0); - wctdm_proslic_setreg_indirect(wc,card,89,0); - wctdm_proslic_setreg_indirect(wc,card,90,0); - wctdm_proslic_setreg_indirect(wc,card,91,0); - wctdm_proslic_setreg_indirect(wc,card,92,0); - wctdm_proslic_setreg_indirect(wc,card,93,0); - - wctdm_setreg(wc, card, 98,0x10); // This is necessary if the calibration occurs other than at reset time - wctdm_setreg(wc, card, 99,0x10); - - for ( i=0x1f; i>0; i--) - { - wctdm_setreg(wc, card, 98,i); - origjiffies=jiffies; - while((jiffies-origjiffies)<4); - if((wctdm_getreg(wc,card,88)) == 0) - break; - } // for - - for ( i=0x1f; i>0; i--) - { - wctdm_setreg(wc, card, 99,i); - origjiffies=jiffies; - while((jiffies-origjiffies)<4); - if((wctdm_getreg(wc,card,89)) == 0) - break; - }//for - -/*******************************The preceding is the manual gain mismatch calibration****************************/ -/**********************************The following is the longitudinal Balance Cal***********************************/ - wctdm_setreg(wc,card,64,1); - while((jiffies-origjiffies)<10); // Sleep 100? - - wctdm_setreg(wc, card, 64, 0); - wctdm_setreg(wc, card, 23, 0x4); // enable interrupt for the balance Cal - wctdm_setreg(wc, card, 97, 0x1); // this is a singular calibration bit for longitudinal calibration - wctdm_setreg(wc, card, 96,0x40); - - wctdm_getreg(wc,card,96); /* Read Reg 96 just cause */ - - wctdm_setreg(wc, card, 21, 0xFF); - wctdm_setreg(wc, card, 22, 0xFF); - wctdm_setreg(wc, card, 23, 0xFF); - - /**The preceding is the longitudinal Balance Cal***/ - return(0); - -} -#if 1 -static int wctdm_proslic_calibrate(struct wctdm *wc, int card) -{ - unsigned long origjiffies; - int x; - /* Perform all calibrations */ - wctdm_setreg(wc, card, 97, 0x1f); - - /* Begin, no speedup */ - wctdm_setreg(wc, card, 96, 0x5f); - - /* Wait for it to finish */ - origjiffies = jiffies; - while(wctdm_getreg(wc, card, 96)) { - if ((jiffies - origjiffies) > 2 * HZ) { - printk("Timeout waiting for calibration of module %d\n", card); - return -1; - } - } - - if (debug) { - /* Print calibration parameters */ - printk("Calibration Vector Regs 98 - 107: \n"); - for (x=98;x<108;x++) { - printk("%d: %02x\n", x, wctdm_getreg(wc, card, x)); - } - } - return 0; -} -#endif - -static void wait_just_a_bit(int foo) -{ - long newjiffies; - newjiffies = jiffies + foo; - while(jiffies < newjiffies); -} - -/********************************************************************* - * Set the hwgain on the analog modules - * - * card = the card position for this module (0-23) - * gain = gain in dB x10 (e.g. -3.5dB would be gain=-35) - * tx = (0 for rx; 1 for tx) - * - *******************************************************************/ -static int wctdm_set_hwgain(struct wctdm *wc, int card, __s32 gain, __u32 tx) -{ - if (!(wc->modtype[card] == MOD_TYPE_FXO)) { - printk("Cannot adjust gain. Unsupported module type!\n"); - return -1; - } - if (tx) { - if (debug) - printk("setting FXO tx gain for card=%d to %d\n", card, gain); - if (gain >= -150 && gain <= 0) { - wctdm_setreg(wc, card, 38, 16 + (gain/-10)); - wctdm_setreg(wc, card, 40, 16 + (-gain%10)); - } else if (gain <= 120 && gain > 0) { - wctdm_setreg(wc, card, 38, gain/10); - wctdm_setreg(wc, card, 40, (gain%10)); - } else { - printk("FXO tx gain is out of range (%d)\n", gain); - return -1; - } - } else { /* rx */ - if (debug) - printk("setting FXO rx gain for card=%d to %d\n", card, gain); - if (gain >= -150 && gain <= 0) { - wctdm_setreg(wc, card, 39, 16+ (gain/-10)); - wctdm_setreg(wc, card, 41, 16 + (-gain%10)); - } else if (gain <= 120 && gain > 0) { - wctdm_setreg(wc, card, 39, gain/10); - wctdm_setreg(wc, card, 41, (gain%10)); - } else { - printk("FXO rx gain is out of range (%d)\n", gain); - return -1; - } - } - - return 0; -} - -static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, int sane) -{ - unsigned char reg16=0, reg26=0, reg30=0, reg31=0; - long newjiffies; - wc->modtype[card] = MOD_TYPE_FXO; - /* Sanity check the ProSLIC */ - reset_spi(wc, card); - if (!sane && wctdm_voicedaa_insane(wc, card)) - return -2; - - /* Software reset */ - wctdm_setreg(wc, card, 1, 0x80); - - /* Wait just a bit */ - wait_just_a_bit(HZ/10); - - /* Enable PCM, ulaw */ - if (alawoverride) - wctdm_setreg(wc, card, 33, 0x20); - else - wctdm_setreg(wc, card, 33, 0x28); - - /* Set On-hook speed, Ringer impedence, and ringer threshold */ - reg16 |= (fxo_modes[_opermode].ohs << 6); - reg16 |= (fxo_modes[_opermode].rz << 1); - reg16 |= (fxo_modes[_opermode].rt); - wctdm_setreg(wc, card, 16, reg16); - - if(fwringdetect) { - /* Enable ring detector full-wave rectifier mode */ - wctdm_setreg(wc, card, 18, 2); - wctdm_setreg(wc, card, 24, 0); - } else { - /* Set to the device defaults */ - wctdm_setreg(wc, card, 18, 0); - wctdm_setreg(wc, card, 24, 0x19); - } - - /* Set DC Termination: - Tip/Ring voltage adjust, minimum operational current, current limitation */ - reg26 |= (fxo_modes[_opermode].dcv << 6); - reg26 |= (fxo_modes[_opermode].mini << 4); - reg26 |= (fxo_modes[_opermode].ilim << 1); - wctdm_setreg(wc, card, 26, reg26); - - /* Set AC Impedence */ - reg30 = (fxo_modes[_opermode].acim); - wctdm_setreg(wc, card, 30, reg30); - - /* Misc. DAA parameters */ - if (fastpickup) - reg31 = 0xb3; - else - reg31 = 0xa3; - - reg31 |= (fxo_modes[_opermode].ohs2 << 3); - wctdm_setreg(wc, card, 31, reg31); - - /* Set Transmit/Receive timeslot */ - wctdm_setreg(wc, card, 34, (3-card) * 8); - wctdm_setreg(wc, card, 35, 0x00); - wctdm_setreg(wc, card, 36, (3-card) * 8); - wctdm_setreg(wc, card, 37, 0x00); - - /* Enable ISO-Cap */ - wctdm_setreg(wc, card, 6, 0x00); - - if (fastpickup) - wctdm_setreg(wc, card, 17, wctdm_getreg(wc, card, 17) | 0x20); - - /* Wait 1000ms for ISO-cap to come up */ - newjiffies = jiffies; - newjiffies += 2 * HZ; - while((jiffies < newjiffies) && !(wctdm_getreg(wc, card, 11) & 0xf0)) - wait_just_a_bit(HZ/10); - - if (!(wctdm_getreg(wc, card, 11) & 0xf0)) { - printk("VoiceDAA did not bring up ISO link properly!\n"); - return -1; - } - if (debug) - printk("ISO-Cap is now up, line side: %02x rev %02x\n", - wctdm_getreg(wc, card, 11) >> 4, - (wctdm_getreg(wc, card, 13) >> 2) & 0xf); - /* Enable on-hook line monitor */ - wctdm_setreg(wc, card, 5, 0x08); - - /* Take values for fxotxgain and fxorxgain and apply them to module */ - wctdm_set_hwgain(wc, card, fxotxgain, 1); - wctdm_set_hwgain(wc, card, fxorxgain, 0); - - /* NZ -- crank the tx gain up by 7 dB */ - if (!strcmp(fxo_modes[_opermode].name, "NEWZEALAND")) { - printk("Adjusting gain\n"); - wctdm_set_hwgain(wc, card, 7, 1); - } - - if(debug) - printk("DEBUG fxotxgain:%i.%i fxorxgain:%i.%i\n", (wctdm_getreg(wc, card, 38)/16)?-(wctdm_getreg(wc, card, 38) - 16) : wctdm_getreg(wc, card, 38), (wctdm_getreg(wc, card, 40)/16)? -(wctdm_getreg(wc, card, 40) - 16):wctdm_getreg(wc, card, 40), (wctdm_getreg(wc, card, 39)/16)? -(wctdm_getreg(wc, card, 39) - 16) : wctdm_getreg(wc, card, 39),(wctdm_getreg(wc, card, 41)/16)?-(wctdm_getreg(wc, card, 41) - 16):wctdm_getreg(wc, card, 41)); - - return 0; - -} - -static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual, int sane) -{ - - unsigned short tmp[5]; - unsigned char r19,r9; - int x; - int fxsmode=0; - - /* Sanity check the ProSLIC */ - if (!sane && wctdm_proslic_insane(wc, card)) - return -2; - - /* By default, don't send on hook */ - if (reversepolarity) - wc->mod[card].fxs.idletxhookstate = 5; - else - wc->mod[card].fxs.idletxhookstate = 1; - - if (sane) { - /* Make sure we turn off the DC->DC converter to prevent anything from blowing up */ - wctdm_setreg(wc, card, 14, 0x10); - } - - if (wctdm_proslic_init_indirect_regs(wc, card)) { - printk(KERN_INFO "Indirect Registers failed to initialize on module %d.\n", card); - return -1; - } - - /* Clear scratch pad area */ - wctdm_proslic_setreg_indirect(wc, card, 97,0); - - /* Clear digital loopback */ - wctdm_setreg(wc, card, 8, 0); - - /* Revision C optimization */ - wctdm_setreg(wc, card, 108, 0xeb); - - /* Disable automatic VBat switching for safety to prevent - Q7 from accidently turning on and burning out. */ - wctdm_setreg(wc, card, 67, 0x07); /* Note, if pulse dialing has problems at high REN loads - change this to 0x17 */ - - /* Turn off Q7 */ - wctdm_setreg(wc, card, 66, 1); - - /* Flush ProSLIC digital filters by setting to clear, while - saving old values */ - for (x=0;x<5;x++) { - tmp[x] = wctdm_proslic_getreg_indirect(wc, card, x + 35); - wctdm_proslic_setreg_indirect(wc, card, x + 35, 0x8000); - } - - /* Power up the DC-DC converter */ - if (wctdm_powerup_proslic(wc, card, fast)) { - printk("Unable to do INITIAL ProSLIC powerup on module %d\n", card); - return -1; - } - - if (!fast) { - - /* Check for power leaks */ - if (wctdm_proslic_powerleak_test(wc, card)) { - printk("ProSLIC module %d failed leakage test. Check for short circuit\n", card); - } - /* Power up again */ - if (wctdm_powerup_proslic(wc, card, fast)) { - printk("Unable to do FINAL ProSLIC powerup on module %d\n", card); - return -1; - } -#ifndef NO_CALIBRATION - /* Perform calibration */ - if(manual) { - if (wctdm_proslic_manual_calibrate(wc, card)) { - //printk("Proslic failed on Manual Calibration\n"); - if (wctdm_proslic_manual_calibrate(wc, card)) { - printk("Proslic Failed on Second Attempt to Calibrate Manually. (Try -DNO_CALIBRATION in Makefile)\n"); - return -1; - } - printk("Proslic Passed Manual Calibration on Second Attempt\n"); - } - } - else { - if(wctdm_proslic_calibrate(wc, card)) { - //printk("ProSlic died on Auto Calibration.\n"); - if (wctdm_proslic_calibrate(wc, card)) { - printk("Proslic Failed on Second Attempt to Auto Calibrate\n"); - return -1; - } - printk("Proslic Passed Auto Calibration on Second Attempt\n"); - } - } - /* Perform DC-DC calibration */ - wctdm_setreg(wc, card, 93, 0x99); - r19 = wctdm_getreg(wc, card, 107); - if ((r19 < 0x2) || (r19 > 0xd)) { - printk("DC-DC cal has a surprising direct 107 of 0x%02x!\n", r19); - wctdm_setreg(wc, card, 107, 0x8); - } - - /* Save calibration vectors */ - for (x=0;xmod[card].fxs.calregs.vals[x] = wctdm_getreg(wc, card, 96 + x); -#endif - - } else { - /* Restore calibration registers */ - for (x=0;xmod[card].fxs.calregs.vals[x]); - } - /* Calibration complete, restore original values */ - for (x=0;x<5;x++) { - wctdm_proslic_setreg_indirect(wc, card, x + 35, tmp[x]); - } - - if (wctdm_proslic_verify_indirect_regs(wc, card)) { - printk(KERN_INFO "Indirect Registers failed verification.\n"); - return -1; - } - - -#if 0 - /* Disable Auto Power Alarm Detect and other "features" */ - wctdm_setreg(wc, card, 67, 0x0e); - blah = wctdm_getreg(wc, card, 67); -#endif - -#if 0 - if (wctdm_proslic_setreg_indirect(wc, card, 97, 0x0)) { // Stanley: for the bad recording fix - printk(KERN_INFO "ProSlic IndirectReg Died.\n"); - return -1; - } -#endif - - if (alawoverride) - wctdm_setreg(wc, card, 1, 0x20); - else - wctdm_setreg(wc, card, 1, 0x28); - // U-Law 8-bit interface - wctdm_setreg(wc, card, 2, (3-card) * 8); // Tx Start count low byte 0 - wctdm_setreg(wc, card, 3, 0); // Tx Start count high byte 0 - wctdm_setreg(wc, card, 4, (3-card) * 8); // Rx Start count low byte 0 - wctdm_setreg(wc, card, 5, 0); // Rx Start count high byte 0 - wctdm_setreg(wc, card, 18, 0xff); // clear all interrupt - wctdm_setreg(wc, card, 19, 0xff); - wctdm_setreg(wc, card, 20, 0xff); - wctdm_setreg(wc, card, 73, 0x04); - if (fxshonormode) { - fxsmode = acim2tiss[fxo_modes[_opermode].acim]; - wctdm_setreg(wc, card, 10, 0x08 | fxsmode); - if (fxo_modes[_opermode].ring_osc) - wctdm_proslic_setreg_indirect(wc, card, 20, fxo_modes[_opermode].ring_osc); - if (fxo_modes[_opermode].ring_x) - wctdm_proslic_setreg_indirect(wc, card, 21, fxo_modes[_opermode].ring_x); - } - if (lowpower) - wctdm_setreg(wc, card, 72, 0x10); - -#if 0 - wctdm_setreg(wc, card, 21, 0x00); // enable interrupt - wctdm_setreg(wc, card, 22, 0x02); // Loop detection interrupt - wctdm_setreg(wc, card, 23, 0x01); // DTMF detection interrupt -#endif - -#if 0 - /* Enable loopback */ - wctdm_setreg(wc, card, 8, 0x2); - wctdm_setreg(wc, card, 14, 0x0); - wctdm_setreg(wc, card, 64, 0x0); - wctdm_setreg(wc, card, 1, 0x08); -#endif - - if (fastringer) { - /* Speed up Ringer */ - wctdm_proslic_setreg_indirect(wc, card, 20, 0x7e6d); - wctdm_proslic_setreg_indirect(wc, card, 21, 0x01b9); - /* Beef up Ringing voltage to 89V */ - if (boostringer) { - wctdm_setreg(wc, card, 74, 0x3f); - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x247)) - return -1; - printk("Boosting fast ringer on slot %d (89V peak)\n", card + 1); - } else if (lowpower) { - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x14b)) - return -1; - printk("Reducing fast ring power on slot %d (50V peak)\n", card + 1); - } else - printk("Speeding up ringer on slot %d (25Hz)\n", card + 1); - } else { - /* Beef up Ringing voltage to 89V */ - if (boostringer) { - wctdm_setreg(wc, card, 74, 0x3f); - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x1d1)) - return -1; - printk("Boosting ringer on slot %d (89V peak)\n", card + 1); - } else if (lowpower) { - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x108)) - return -1; - printk("Reducing ring power on slot %d (50V peak)\n", card + 1); - } - } - - if(fxstxgain || fxsrxgain) { - r9 = wctdm_getreg(wc, card, 9); - switch (fxstxgain) { - - case 35: - r9+=8; - break; - case -35: - r9+=4; - break; - case 0: - break; - } - - switch (fxsrxgain) { - - case 35: - r9+=2; - break; - case -35: - r9+=1; - break; - case 0: - break; - } - wctdm_setreg(wc,card,9,r9); - } - - if(debug) - printk("DEBUG: fxstxgain:%s fxsrxgain:%s\n",((wctdm_getreg(wc, card, 9)/8) == 1)?"3.5":(((wctdm_getreg(wc,card,9)/4) == 1)?"-3.5":"0.0"),((wctdm_getreg(wc, card, 9)/2) == 1)?"3.5":((wctdm_getreg(wc,card,9)%2)?"-3.5":"0.0")); - - wctdm_setreg(wc, card, 64, 0x01); - return 0; -} - - -static int wctdm_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - struct wctdm_stats stats; - struct wctdm_regs regs; - struct wctdm_regop regop; - struct wctdm_echo_coefs echoregs; - struct zt_hwgain hwgain; - struct wctdm *wc = chan->pvt; - int x; - switch (cmd) { - case ZT_ONHOOKTRANSFER: - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) - return -EINVAL; - if (get_user(x, (int *)data)) - return -EFAULT; - wc->mod[chan->chanpos - 1].fxs.ohttimer = x << 3; - if (reversepolarity) - wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 0x6; /* OHT mode when idle */ - else - wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 0x2; - if (wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x1 || wc->mod[chan->chanpos - 1].fxs.lasttxhook == 0x5) { - /* Apply the change if appropriate */ - if (reversepolarity) - wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x6; - else - wc->mod[chan->chanpos - 1].fxs.lasttxhook = 0x2; - wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook); - } - break; - case ZT_SETPOLARITY: - if (get_user(x, (int *)data)) - return -EFAULT; - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) - return -EINVAL; - /* Can't change polarity while ringing or when open */ - if ((wc->mod[chan->chanpos -1 ].fxs.lasttxhook == 0x04) || - (wc->mod[chan->chanpos -1 ].fxs.lasttxhook == 0x00)) - return -EINVAL; - - if ((x && !reversepolarity) || (!x && reversepolarity)) - wc->mod[chan->chanpos - 1].fxs.lasttxhook |= 0x04; - else - wc->mod[chan->chanpos - 1].fxs.lasttxhook &= ~0x04; - wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos - 1].fxs.lasttxhook); - break; - case WCTDM_GET_STATS: - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) { - stats.tipvolt = wctdm_getreg(wc, chan->chanpos - 1, 80) * -376; - stats.ringvolt = wctdm_getreg(wc, chan->chanpos - 1, 81) * -376; - stats.batvolt = wctdm_getreg(wc, chan->chanpos - 1, 82) * -376; - } else if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { - stats.tipvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; - stats.ringvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; - stats.batvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; - } else - return -EINVAL; - if (copy_to_user((struct wctdm_stats *)data, &stats, sizeof(stats))) - return -EFAULT; - break; - case WCTDM_GET_REGS: - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) { - for (x=0;xchanpos -1, x); - for (x=0;xchanpos - 1, x); - } else { - memset(®s, 0, sizeof(regs)); - for (x=0;xchanpos - 1, x); - } - if (copy_to_user((struct wctdm_regs *)data, ®s, sizeof(regs))) - return -EFAULT; - break; - case WCTDM_SET_REG: - if (copy_from_user(®op, (struct wctdm_regop *)data, sizeof(regop))) - return -EFAULT; - if (regop.indirect) { - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) - return -EINVAL; - printk("Setting indirect %d to 0x%04x on %d\n", regop.reg, regop.val, chan->chanpos); - wctdm_proslic_setreg_indirect(wc, chan->chanpos - 1, regop.reg, regop.val); - } else { - regop.val &= 0xff; - printk("Setting direct %d to %04x on %d\n", regop.reg, regop.val, chan->chanpos); - wctdm_setreg(wc, chan->chanpos - 1, regop.reg, regop.val); - } - break; - case WCTDM_SET_ECHOTUNE: - printk("-- Setting echo registers: \n"); - if (copy_from_user(&echoregs, (struct wctdm_echo_coefs*)data, sizeof(echoregs))) - return -EFAULT; - - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { - /* Set the ACIM register */ - wctdm_setreg(wc, chan->chanpos - 1, 30, echoregs.acim); - - /* Set the digital echo canceller registers */ - wctdm_setreg(wc, chan->chanpos - 1, 45, echoregs.coef1); - wctdm_setreg(wc, chan->chanpos - 1, 46, echoregs.coef2); - wctdm_setreg(wc, chan->chanpos - 1, 47, echoregs.coef3); - wctdm_setreg(wc, chan->chanpos - 1, 48, echoregs.coef4); - wctdm_setreg(wc, chan->chanpos - 1, 49, echoregs.coef5); - wctdm_setreg(wc, chan->chanpos - 1, 50, echoregs.coef6); - wctdm_setreg(wc, chan->chanpos - 1, 51, echoregs.coef7); - wctdm_setreg(wc, chan->chanpos - 1, 52, echoregs.coef8); - - printk("-- Set echo registers successfully\n"); - - break; - } else { - return -EINVAL; - - } - break; - case ZT_SET_HWGAIN: - if (copy_from_user(&hwgain, (struct zt_hwgain*) data, sizeof(hwgain))) - return -EFAULT; - - wctdm_set_hwgain(wc, chan->chanpos-1, hwgain.newgain, hwgain.tx); - - if (debug) - printk("Setting hwgain on channel %d to %d for %s direction\n", - chan->chanpos-1, hwgain.newgain, hwgain.tx ? "tx" : "rx"); - break; - default: - return -ENOTTY; - } - return 0; - -} - -static int wctdm_open(struct zt_chan *chan) -{ - struct wctdm *wc = chan->pvt; - if (!(wc->cardflag & (1 << (chan->chanpos - 1)))) - return -ENODEV; - if (wc->dead) - return -ENODEV; - wc->usecount++; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - try_module_get(THIS_MODULE); -#endif - return 0; -} - -static int wctdm_watchdog(struct zt_span *span, int event) -{ - printk("TDM: Restarting DMA\n"); - wctdm_restart_dma(span->pvt); - return 0; -} - -static int wctdm_close(struct zt_chan *chan) -{ - struct wctdm *wc = chan->pvt; - wc->usecount--; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) { - if (reversepolarity) - wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 5; - else - wc->mod[chan->chanpos - 1].fxs.idletxhookstate = 1; - } - /* If we're dead, release us now */ - if (!wc->usecount && wc->dead) - wctdm_release(wc); - return 0; -} - -static int wctdm_hooksig(struct zt_chan *chan, zt_txsig_t txsig) -{ - struct wctdm *wc = chan->pvt; - int reg=0; - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { - /* XXX Enable hooksig for FXO XXX */ - switch(txsig) { - case ZT_TXSIG_START: - case ZT_TXSIG_OFFHOOK: - wc->mod[chan->chanpos - 1].fxo.offhook = 1; - wctdm_setreg(wc, chan->chanpos - 1, 5, 0x9); - break; - case ZT_TXSIG_ONHOOK: - wc->mod[chan->chanpos - 1].fxo.offhook = 0; - wctdm_setreg(wc, chan->chanpos - 1, 5, 0x8); - break; - default: - printk("wcfxo: Can't set tx state to %d\n", txsig); - } - } else { - switch(txsig) { - case ZT_TXSIG_ONHOOK: - switch(chan->sig) { - case ZT_SIG_EM: - case ZT_SIG_FXOKS: - case ZT_SIG_FXOLS: - wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate; - break; - case ZT_SIG_FXOGS: - wc->mod[chan->chanpos-1].fxs.lasttxhook = 3; - break; - } - break; - case ZT_TXSIG_OFFHOOK: - switch(chan->sig) { - case ZT_SIG_EM: - wc->mod[chan->chanpos-1].fxs.lasttxhook = 5; - break; - default: - wc->mod[chan->chanpos-1].fxs.lasttxhook = wc->mod[chan->chanpos-1].fxs.idletxhookstate; - break; - } - break; - case ZT_TXSIG_START: - wc->mod[chan->chanpos-1].fxs.lasttxhook = 4; - break; - case ZT_TXSIG_KEWL: - wc->mod[chan->chanpos-1].fxs.lasttxhook = 0; - break; - default: - printk("wctdm: Can't set tx state to %d\n", txsig); - } - if (debug) - printk("Setting FXS hook state to %d (%02x)\n", txsig, reg); - -#if 1 - wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mod[chan->chanpos-1].fxs.lasttxhook); -#endif - } - return 0; -} - -static int wctdm_initialize(struct wctdm *wc) -{ - int x; - - /* Zapata 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"; - zap_copy_string(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype)); - if (alawoverride) { - printk("ALAW override parameter detected. Device will be operating in ALAW\n"); - wc->span.deflaw = ZT_LAW_ALAW; - } else - wc->span.deflaw = ZT_LAW_MULAW; - for (x = 0; x < NUM_CARDS; x++) { - sprintf(wc->chans[x].name, "WCTDM/%d/%d", wc->pos, x); - wc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM | ZT_SIG_CLEAR; - wc->chans[x].sigcap |= ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF | ZT_SIG_CLEAR; - wc->chans[x].chanpos = x+1; - wc->chans[x].pvt = wc; - } - wc->span.chans = wc->chans; - wc->span.channels = NUM_CARDS; - wc->span.hooksig = wctdm_hooksig; - wc->span.irq = wc->dev->irq; - wc->span.open = wctdm_open; - wc->span.close = wctdm_close; - wc->span.flags = ZT_FLAG_RBS; - wc->span.ioctl = wctdm_ioctl; - wc->span.watchdog = wctdm_watchdog; - init_waitqueue_head(&wc->span.maintq); - - wc->span.pvt = wc; - if (zt_register(&wc->span, 0)) { - printk("Unable to register span with zaptel\n"); - return -1; - } - return 0; -} - -static void wctdm_post_initialize(struct wctdm *wc) -{ - int x; - - /* Finalize signalling */ - for (x = 0; x < NUM_CARDS; x++) { - if (wc->cardflag & (1 << x)) { - if (wc->modtype[x] == MOD_TYPE_FXO) - wc->chans[x].sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF | ZT_SIG_CLEAR; - else - wc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM | ZT_SIG_CLEAR; - } else if (!(wc->chans[x].sigcap & ZT_SIG_BROKEN)) { - wc->chans[x].sigcap = 0; - } - } -} - -static int wctdm_hardware_init(struct wctdm *wc) -{ - /* Hardware stuff */ - unsigned char ver; - unsigned char x,y; - int failed; - - /* Signal Reset */ - outb(0x01, wc->ioaddr + WC_CNTL); - - /* Check Freshmaker chip */ - x=inb(wc->ioaddr + WC_CNTL); - ver = __wctdm_getcreg(wc, WC_VER); - failed = 0; - if (ver != 0x59) { - printk("Freshmaker version: %02x\n", ver); - for (x=0;x<255;x++) { - /* Test registers */ - if (ver >= 0x70) { - __wctdm_setcreg(wc, WC_CS, x); - y = __wctdm_getcreg(wc, WC_CS); - } else { - __wctdm_setcreg(wc, WC_TEST, x); - y = __wctdm_getcreg(wc, WC_TEST); - } - if (x != y) { - printk("%02x != %02x\n", x, y); - failed++; - } - } - if (!failed) { - printk("Freshmaker passed register test\n"); - } else { - printk("Freshmaker failed register test\n"); - return -1; - } - /* Go to half-duty FSYNC */ - __wctdm_setcreg(wc, WC_SYNC, 0x01); - y = __wctdm_getcreg(wc, WC_SYNC); - } else { - printk("No freshmaker chip\n"); - } - - /* Reset PCI Interface chip and registers (and serial) */ - outb(0x06, wc->ioaddr + WC_CNTL); - /* Setup our proper outputs for when we switch for our "serial" port */ - wc->ios = BIT_CS | BIT_SCLK | BIT_SDI; - - outb(wc->ios, wc->ioaddr + WC_AUXD); - - /* Set all to outputs except AUX 5, which is an input */ - outb(0xdf, wc->ioaddr + WC_AUXC); - - /* Select alternate function for AUX0 */ - outb(0x4, wc->ioaddr + WC_AUXFUNC); - - /* Wait 1/4 of a sec */ - wait_just_a_bit(HZ/4); - - /* Back to normal, with automatic DMA wrap around */ - outb(0x30 | 0x01, wc->ioaddr + WC_CNTL); - - /* Make sure serial port and DMA are out of reset */ - outb(inb(wc->ioaddr + WC_CNTL) & 0xf9, wc->ioaddr + WC_CNTL); - - /* Configure serial port for MSB->LSB operation */ - outb(0xc1, wc->ioaddr + WC_SERCTL); - - /* Delay FSC by 0 so it's properly aligned */ - outb(0x0, wc->ioaddr + WC_FSCDELAY); - - /* Setup DMA Addresses */ - outl(wc->writedma, wc->ioaddr + WC_DMAWS); /* Write start */ - outl(wc->writedma + ZT_CHUNKSIZE * 4 - 4, wc->ioaddr + WC_DMAWI); /* Middle (interrupt) */ - outl(wc->writedma + ZT_CHUNKSIZE * 8 - 4, wc->ioaddr + WC_DMAWE); /* End */ - - outl(wc->readdma, wc->ioaddr + WC_DMARS); /* Read start */ - outl(wc->readdma + ZT_CHUNKSIZE * 4 - 4, wc->ioaddr + WC_DMARI); /* Middle (interrupt) */ - outl(wc->readdma + ZT_CHUNKSIZE * 8 - 4, wc->ioaddr + WC_DMARE); /* End */ - - /* Clear interrupts */ - outb(0xff, wc->ioaddr + WC_INTSTAT); - - /* Wait 1/4 of a second more */ - wait_just_a_bit(HZ/4); - - for (x = 0; x < NUM_CARDS; x++) { - int sane=0,ret=0,readi=0; -#if 1 - /* Init with Auto Calibration */ - if (!(ret=wctdm_init_proslic(wc, x, 0, 0, sane))) { - wc->cardflag |= (1 << x); - if (debug) { - readi = wctdm_getreg(wc,x,LOOP_I_LIMIT); - printk("Proslic module %d loop current is %dmA\n",x, - ((readi*3)+20)); - } - printk("Module %d: Installed -- AUTO FXS/DPO\n",x); - } else { - if(ret!=-2) { - sane=1; - /* Init with Manual Calibration */ - if (!wctdm_init_proslic(wc, x, 0, 1, sane)) { - wc->cardflag |= (1 << x); - if (debug) { - readi = wctdm_getreg(wc,x,LOOP_I_LIMIT); - printk("Proslic module %d loop current is %dmA\n",x, - ((readi*3)+20)); - } - printk("Module %d: Installed -- MANUAL FXS\n",x); - } else { - printk("Module %d: FAILED FXS (%s)\n", x, fxshonormode ? fxo_modes[_opermode].name : "FCC"); - wc->chans[x].sigcap = __ZT_SIG_FXO | ZT_SIG_BROKEN; - } - } else if (!(ret = wctdm_init_voicedaa(wc, x, 0, 0, sane))) { - wc->cardflag |= (1 << x); - printk("Module %d: Installed -- AUTO FXO (%s mode)\n",x, fxo_modes[_opermode].name); - } else - printk("Module %d: Not installed\n", x); - } -#endif - } - - /* Return error if nothing initialized okay. */ - if (!wc->cardflag && !timingonly) - return -1; - __wctdm_setcreg(wc, WC_SYNC, (wc->cardflag << 1) | 0x1); - return 0; -} - -static void wctdm_enable_interrupts(struct wctdm *wc) -{ - /* Enable interrupts (we care about all of them) */ - outb(0x3f, wc->ioaddr + WC_MASK0); - /* No external interrupts */ - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static void wctdm_restart_dma(struct wctdm *wc) -{ - /* Reset Master and TDM */ - outb(0x01, wc->ioaddr + WC_CNTL); - outb(0x01, wc->ioaddr + WC_OPER); -} - -static void wctdm_start_dma(struct wctdm *wc) -{ - /* Reset Master and TDM */ - outb(0x0f, wc->ioaddr + WC_CNTL); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - outb(0x01, wc->ioaddr + WC_CNTL); - outb(0x01, wc->ioaddr + WC_OPER); -} - -static void wctdm_stop_dma(struct wctdm *wc) -{ - outb(0x00, wc->ioaddr + WC_OPER); -} - -static void wctdm_reset_tdm(struct wctdm *wc) -{ - /* Reset TDM */ - outb(0x0f, wc->ioaddr + WC_CNTL); -} - -static void wctdm_disable_interrupts(struct wctdm *wc) -{ - outb(0x00, wc->ioaddr + WC_MASK0); - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res; - struct wctdm *wc; - struct wctdm_desc *d = (struct wctdm_desc *)ent->driver_data; - int x; - int y; - - for (x=0;x= WC_MAX_IFACES) { - printk("Too many interfaces\n"); - return -EIO; - } - - if (pci_enable_device(pdev)) { - res = -EIO; - } else { - wc = kmalloc(sizeof(struct wctdm), GFP_KERNEL); - if (wc) { - int cardcount = 0; - - ifaces[x] = wc; - memset(wc, 0, sizeof(struct wctdm)); - spin_lock_init(&wc->lock); - wc->curcard = -1; - wc->ioaddr = pci_resource_start(pdev, 0); - wc->dev = pdev; - wc->pos = x; - wc->variety = d->name; - for (y=0;yflags[y] = d->flags; - /* Keep track of whether we need to free the region */ - if (request_region(wc->ioaddr, 0xff, "wctdm")) - wc->freeregion = 1; - - /* Allocate enough memory for two zt chunks, receive and transmit. Each sample uses - 32 bits. Allocate an extra set just for control too */ - wc->writechunk = pci_alloc_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, &wc->writedma); - if (!wc->writechunk) { - printk("wctdm: Unable to allocate DMA-able memory\n"); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - return -ENOMEM; - } - - wc->readchunk = wc->writechunk + ZT_MAX_CHUNKSIZE * 2; /* in doublewords */ - wc->readdma = wc->writedma + ZT_MAX_CHUNKSIZE * 8; /* in bytes */ - - if (wctdm_initialize(wc)) { - printk("wctdm: Unable to intialize FXS\n"); - /* Set Reset Low */ - x=inb(wc->ioaddr + WC_CNTL); - outb((~0x1)&x, wc->ioaddr + WC_CNTL); - /* Free Resources */ - free_irq(pdev->irq, wc); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)wc->writechunk, wc->writedma); - kfree(wc); - return -EIO; - } - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - - if (request_irq(pdev->irq, wctdm_interrupt, ZAP_IRQ_SHARED, "wctdm", wc)) { - printk("wctdm: Unable to request IRQ %d\n", pdev->irq); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)wc->writechunk, wc->writedma); - pci_set_drvdata(pdev, NULL); - kfree(wc); - return -EIO; - } - - - if (wctdm_hardware_init(wc)) { - unsigned char x; - - /* Set Reset Low */ - x=inb(wc->ioaddr + WC_CNTL); - outb((~0x1)&x, wc->ioaddr + WC_CNTL); - /* Free Resources */ - free_irq(pdev->irq, wc); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)wc->writechunk, wc->writedma); - pci_set_drvdata(pdev, NULL); - zt_unregister(&wc->span); - kfree(wc); - return -EIO; - - } - - wctdm_post_initialize(wc); - - /* Enable interrupts */ - wctdm_enable_interrupts(wc); - /* Initialize Write/Buffers to all blank data */ - memset((void *)wc->writechunk,0,ZT_MAX_CHUNKSIZE * 2 * 2 * 4); - - /* Start DMA */ - wctdm_start_dma(wc); - - for (x = 0; x < NUM_CARDS; x++) { - if (wc->cardflag & (1 << x)) - cardcount++; - } - - printk("Found a Wildcard TDM: %s (%d modules)\n", wc->variety, cardcount); - res = 0; - } else - res = -ENOMEM; - } - return res; -} - -static void wctdm_release(struct wctdm *wc) -{ - zt_unregister(&wc->span); - if (wc->freeregion) - release_region(wc->ioaddr, 0xff); - kfree(wc); - printk("Freed a Wildcard\n"); -} - -static void __devexit wctdm_remove_one(struct pci_dev *pdev) -{ - struct wctdm *wc = pci_get_drvdata(pdev); - if (wc) { - - /* Stop any DMA */ - wctdm_stop_dma(wc); - wctdm_reset_tdm(wc); - - /* In case hardware is still there */ - wctdm_disable_interrupts(wc); - - /* Immediately free resources */ - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, (void *)wc->writechunk, wc->writedma); - free_irq(pdev->irq, wc); - - /* Reset PCI chip and registers */ - outb(0x0e, wc->ioaddr + WC_CNTL); - - /* Release span, possibly delayed */ - if (!wc->usecount) - wctdm_release(wc); - else - wc->dead = 1; - } -} - -static struct pci_device_id wctdm_pci_tbl[] = { - { 0xe159, 0x0001, 0xa159, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm }, - { 0xe159, 0x0001, 0xe159, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm }, - { 0xe159, 0x0001, 0xb100, PCI_ANY_ID, 0, 0, (unsigned long) &wctdme }, - { 0xe159, 0x0001, 0xb1d9, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmi }, - { 0xe159, 0x0001, 0xb118, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmi }, - { 0xe159, 0x0001, 0xb119, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmi }, - { 0xe159, 0x0001, 0xa9fd, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, - { 0xe159, 0x0001, 0xa8fd, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, - { 0xe159, 0x0001, 0xa800, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, - { 0xe159, 0x0001, 0xa801, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, - { 0xe159, 0x0001, 0xa908, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, - { 0xe159, 0x0001, 0xa901, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, -#ifdef TDM_REVH_MATCHALL - { 0xe159, 0x0001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctdmh }, -#endif - { 0 } -}; - -MODULE_DEVICE_TABLE(pci, wctdm_pci_tbl); - -static struct pci_driver wctdm_driver = { - name: "wctdm", - probe: wctdm_init_one, -#ifdef LINUX26 - remove: __devexit_p(wctdm_remove_one), -#else - remove: wctdm_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: wctdm_pci_tbl, -}; - -static int __init wctdm_init(void) -{ - int res; - int x; - - for (x = 0; x < (sizeof(fxo_modes) / sizeof(fxo_modes[0])); x++) { - if (!strcmp(fxo_modes[x].name, opermode)) - break; - } - if (x < sizeof(fxo_modes) / sizeof(fxo_modes[0])) { - _opermode = x; - } else { - printk("Invalid/unknown operating mode '%s' specified. Please choose one of:\n", opermode); - for (x = 0; x < sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++) - printk(" %s\n", fxo_modes[x].name); - printk("Note this option is CASE SENSITIVE!\n"); - return -ENODEV; - } - - if (!strcmp(opermode, "AUSTRALIA")) { - boostringer = 1; - fxshonormode = 1; - } - - /* for the voicedaa_check_hook defaults, if the user has not overridden - them by specifying them as module parameters, then get the values - from the selected operating mode - */ - if (battdebounce == 0) { - battdebounce = fxo_modes[_opermode].battdebounce; - } - if (battalarm == 0) { - battalarm = fxo_modes[_opermode].battalarm; - } - if (battthresh == 0) { - battthresh = fxo_modes[_opermode].battthresh; - } - - res = zap_pci_module(&wctdm_driver); - if (res) - return -ENODEV; - return 0; -} - -static void __exit wctdm_cleanup(void) -{ - pci_unregister_driver(&wctdm_driver); -} - -#ifdef LINUX26 -module_param(debug, int, 0600); -module_param(loopcurrent, int, 0600); -module_param(reversepolarity, int, 0600); -module_param(robust, int, 0600); -module_param(opermode, charp, 0600); -module_param(timingonly, int, 0600); -module_param(lowpower, int, 0600); -module_param(boostringer, int, 0600); -module_param(fastringer, int, 0600); -module_param(fxshonormode, int, 0600); -module_param(battdebounce, uint, 0600); -module_param(battalarm, uint, 0600); -module_param(battthresh, uint, 0600); -module_param(ringdebounce, int, 0600); -module_param(fwringdetect, int, 0600); -module_param(alawoverride, int, 0600); -module_param(fastpickup, int, 0600); -module_param(fxotxgain, int, 0600); -module_param(fxorxgain, int, 0600); -module_param(fxstxgain, int, 0600); -module_param(fxsrxgain, int, 0600); -#else -MODULE_PARM(debug, "i"); -MODULE_PARM(loopcurrent, "i"); -MODULE_PARM(reversepolarity, "i"); -MODULE_PARM(robust, "i"); -MODULE_PARM(opermode, "s"); -MODULE_PARM(timingonly, "i"); -MODULE_PARM(lowpower, "i"); -MODULE_PARM(boostringer, "i"); -MODULE_PARM(fastringer, "i"); -MODULE_PARM(fxshonormode, "i"); -MODULE_PARM(battdebounce, "i"); -MODULE_PARM(battalarm, "i"); -MODULE_PARM(battthresh, "i"); -MODULE_PARM(ringdebounce, "i"); -MODULE_PARM(fwringdetect, "i"); -MODULE_PARM(alawoverride, "i"); -MODULE_PARM(fastpickup, "i"); -MODULE_PARM(fxotxgain, "i"); -MODULE_PARM(fxorxgain, "i"); -MODULE_PARM(fxstxgain, "i"); -MODULE_PARM(fxsrxgain, "i"); -#endif -MODULE_DESCRIPTION("Wildcard TDM400P Zaptel Driver"); -MODULE_AUTHOR("Mark Spencer "); -#if defined(MODULE_ALIAS) -MODULE_ALIAS("wcfxs"); -#endif -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(wctdm_init); -module_exit(wctdm_cleanup); diff --git a/zaptel/kernel/wctdm.h b/zaptel/kernel/wctdm.h deleted file mode 100644 index 86d591a2..00000000 --- a/zaptel/kernel/wctdm.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Wilcard S100P FXS Interface Driver for Zapata Telephony interface - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _WCTDM_H -#define _WCTDM_H - -#include - -#define NUM_REGS 109 -#define NUM_INDIRECT_REGS 105 - -struct wctdm_stats { - int tipvolt; /* TIP voltage (mV) */ - int ringvolt; /* RING voltage (mV) */ - int batvolt; /* VBAT voltage (mV) */ -}; - -struct wctdm_regs { - unsigned char direct[NUM_REGS]; - unsigned short indirect[NUM_INDIRECT_REGS]; -}; - -struct wctdm_regop { - int indirect; - unsigned char reg; - unsigned short val; -}; - -struct wctdm_echo_coefs { - unsigned char acim; - unsigned char coef1; - unsigned char coef2; - unsigned char coef3; - unsigned char coef4; - unsigned char coef5; - unsigned char coef6; - unsigned char coef7; - unsigned char coef8; -}; - -#define WCTDM_GET_STATS _IOR (ZT_CODE, 60, struct wctdm_stats) -#define WCTDM_GET_REGS _IOR (ZT_CODE, 61, struct wctdm_regs) -#define WCTDM_SET_REG _IOW (ZT_CODE, 62, struct wctdm_regop) -#define WCTDM_SET_ECHOTUNE _IOW (ZT_CODE, 63, struct wctdm_echo_coefs) - - -#endif /* _WCTDM_H */ diff --git a/zaptel/kernel/wctdm24xxp/GpakApi.c b/zaptel/kernel/wctdm24xxp/GpakApi.c deleted file mode 100644 index 78d06815..00000000 --- a/zaptel/kernel/wctdm24xxp/GpakApi.c +++ /dev/null @@ -1,1630 +0,0 @@ -/* - * Copyright (c) 2005, Adaptive Digital Technologies, Inc. - * - * File Name: GpakApi.c - * - * Description: - * This file contains user API functions to communicate with DSPs executing - * G.PAK software. The file is integrated into the host processor connected - * to C55X G.PAK DSPs via a Host Port Interface. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * 11/15/2006 - 24 TDM-TDM Channels EC release - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif - -#include "zaptel.h" - -#include "GpakHpi.h" -#include "GpakCust.h" -#include "GpakApi.h" -#include "gpakenum.h" - -/* DSP to Host interface block offsets. */ -#define REPLY_MSG_PNTR_OFFSET 0 /* I/F blk offset to Reply Msg Pointer */ -#define CMD_MSG_PNTR_OFFSET 2 /* I/F blk offset to Command Msg Pointer */ -#define EVENT_MSG_PNTR_OFFSET 4 /* I/F blk offset to Event Msg Pointer */ -#define PKT_BUFR_MEM_OFFSET 6 /* I/F blk offset to Packet Buffer memory */ -#define DSP_STATUS_OFFSET 8 /* I/F blk offset to DSP Status */ -#define VERSION_ID_OFFSET 9 /* I/F blk offset to G.PAK Version Id */ -#define MAX_CMD_MSG_LEN_OFFSET 10 /* I/F blk offset to Max Cmd Msg Length */ -#define CMD_MSG_LEN_OFFSET 11 /* I/F blk offset to Command Msg Length */ -#define REPLY_MSG_LEN_OFFSET 12 /* I/F blk offset to Reply Msg Length */ -#define NUM_CHANNELS_OFFSET 13 /* I/F blk offset to Num Built Channels */ -#define NUM_PKT_CHANNELS_OFFSET 14 /* I/F blk offset to Num Pkt Channels */ -#define NUM_CONFERENCES_OFFSET 15 /* I/F blk offset to Num Conferences */ -//#define CPU_USAGE_OFFSET_1MS 16 /* I/F blk offset to CPU Usage statistics */ -#define CPU_USAGE_OFFSET 18 /* I/F blk offset to CPU Usage statistics */ -//#define CPU_USAGE_OFFSET_10MS 20 /* I/F blk offset to CPU Usage statistics */ -#define FRAMING_STATS_OFFSET 22 /* I/F blk offset to Framing statistics */ - -//#define GPAK_RELEASE_Rate rate10ms -// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -// Macro to reconstruct a 32-bit value from two 16-bit values. -// Parameter p32: 32-bit-wide destination -// Parameter p16: 16-bit-wide source array of length 2 words -#define RECONSTRUCT_LONGWORD(p32, p16) p32 = (DSP_ADDRESS)p16[0]<<16; \ - p32 |= (unsigned long)p16[1] -// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - -/* DSP Status value definitions. */ -#define DSP_INIT_STATUS 0x5555 /* DSP Initialized status value */ -#define HOST_INIT_STATUS 0xAAAA /* Host Initialized status value */ - -/* Circular packet buffer information structure offsets. */ -#define CB_BUFR_BASE 0 /* pointer to base of circular buffer */ -#define CB_BUFR_SIZE 2 /* size of buffer (words) */ -#define CB_BUFR_PUT_INDEX 3 /* offset in buffer for next write */ -#define CB_BUFR_TAKE_INDEX 4 /* offset in buffer for next read */ -#define CIRC_BUFFER_INFO_STRUCT_SIZE 6 - -/* Miscellaneous definitions. */ -#define MSG_BUFFER_SIZE 100 /* size (words) of Host msg buffer */ -#define WORD_BUFFER_SIZE 84 /* size of DSP Word buffer (words) */ - -#ifdef __TMS320C55XX__ // debug sections if not on host -#pragma DATA_SECTION(pDspIfBlk,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(MaxCmdMsgLen,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(MaxChannels,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(DlByteBufr,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(DlWordBufr,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(pEventFifoAddress,"GPAKAPIDEBUG_SECT") -#endif - -/* Host variables related to Host to DSP interface. */ -static DSP_ADDRESS pDspIfBlk[MAX_DSP_CORES]; /* DSP address of I/F block */ -static DSP_WORD MaxCmdMsgLen[MAX_DSP_CORES]; /* max Cmd msg length (octets) */ -static unsigned short int MaxChannels[MAX_DSP_CORES]; /* max num channels */ - -//static unsigned short int MaxPktChannels[MAX_DSP_CORES]; /* max num pkt channels */ -//static unsigned short int MaxConfs[MAX_DSP_CORES]; /* max num conferences */ -//static DSP_ADDRESS pPktInBufr[MAX_DSP_CORES][MAX_PKT_CHANNELS]; /* Pkt In buffer */ -//static DSP_ADDRESS pPktOutBufr[MAX_DSP_CORES][MAX_PKT_CHANNELS]; /* Pkt Out buffer */ -static DSP_ADDRESS pEventFifoAddress[MAX_DSP_CORES]; /* event fifo */ - -static unsigned char DlByteBufr[DOWNLOAD_BLOCK_SIZE * 2]; /* Dowload byte buf */ -static DSP_WORD DlWordBufr[DOWNLOAD_BLOCK_SIZE]; /* Dowload word buffer */ - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * CheckDspReset - Check if the DSP was reset. - * - * FUNCTION - * This function determines if the DSP was reset and is ready. If reset - * occurred, it reads interface parameters and calculates DSP addresses. - * - * RETURNS - * -1 = DSP is not ready. - * 0 = Reset did not occur. - * 1 = Reset occurred. - * - */ -static int CheckDspReset( - int DspId /* DSP Identifier (0 to MaxDSPCores-1) */ - ) -{ - DSP_ADDRESS IfBlockPntr; /* Interface Block pointer */ - DSP_WORD DspStatus; /* DSP Status */ - DSP_WORD DspChannels; /* number of DSP channels */ - DSP_WORD Temp[2]; -#if 0 - DSP_WORD DspConfs; /* number of DSP conferences */ - DSP_ADDRESS PktBufrMem; /* address of Packet Buffer */ - unsigned short int i; /* loop index / counter */ -#endif - - /* Read the pointer to the Interface Block. */ - gpakReadDspMemory(DspId, DSP_IFBLK_ADDRESS, 2, Temp); - RECONSTRUCT_LONGWORD(IfBlockPntr, Temp); - - /* If the pointer is zero, return with an indication the DSP is not - ready. */ - if (IfBlockPntr == 0) - return (-1); - - /* Read the DSP's Status. */ - gpakReadDspMemory(DspId, IfBlockPntr + DSP_STATUS_OFFSET, 1, &DspStatus); - - /* If status indicates the DSP was reset, read the DSP's interface - parameters and calculate DSP addresses. */ - if (DspStatus == DSP_INIT_STATUS || - ((DspStatus == HOST_INIT_STATUS) && (pDspIfBlk[DspId] == 0))) - { - /* Save the address of the DSP's Interface Block. */ - pDspIfBlk[DspId] = IfBlockPntr; - - /* Read the DSP's interface parameters. */ - gpakReadDspMemory(DspId, IfBlockPntr + MAX_CMD_MSG_LEN_OFFSET, 1, - &(MaxCmdMsgLen[DspId])); - - /* read the number of configured DSP channels */ - gpakReadDspMemory(DspId, IfBlockPntr + NUM_CHANNELS_OFFSET, 1, - &DspChannels); - if (DspChannels > MAX_CHANNELS) - MaxChannels[DspId] = MAX_CHANNELS; - else - MaxChannels[DspId] = (unsigned short int) DspChannels; -#if 0 - /* read the number of configured DSP conferences */ - gpakReadDspMemory(DspId, IfBlockPntr + NUM_CONFERENCES_OFFSET, 1, - &DspConfs); - if (DspConfs > MAX_CONFS) - MaxConfs[DspId] = MAX_CONFS; - else - MaxConfs[DspId] = (unsigned short int) DspConfs; - - - /* read the number of configured DSP packet channels */ - gpakReadDspMemory(DspId, IfBlockPntr + NUM_PKT_CHANNELS_OFFSET, 1, - &DspChannels); - if (DspChannels > MAX_PKT_CHANNELS) - MaxPktChannels[DspId] = MAX_PKT_CHANNELS; - else - MaxPktChannels[DspId] = (unsigned short int) DspChannels; - - - /* read the pointer to the circular buffer infor struct table */ - gpakReadDspMemory(DspId, IfBlockPntr + PKT_BUFR_MEM_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(PktBufrMem, Temp); - - - /* Determine the addresses of each channel's Packet buffers. */ - for (i = 0; i < MaxPktChannels[DspId]; i++) - { - pPktInBufr[DspId][i] = PktBufrMem; - pPktOutBufr[DspId][i] = PktBufrMem + CIRC_BUFFER_INFO_STRUCT_SIZE; - PktBufrMem += (CIRC_BUFFER_INFO_STRUCT_SIZE*2); - } -#endif - - /* read the pointer to the event fifo info struct */ - gpakReadDspMemory(DspId, IfBlockPntr + EVENT_MSG_PNTR_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(pEventFifoAddress[DspId], Temp); - - /* Set the DSP Status to indicate the host recognized the reset. */ - DspStatus = HOST_INIT_STATUS; - gpakWriteDspMemory(DspId, IfBlockPntr + DSP_STATUS_OFFSET, 1, - &DspStatus); - - /* Return with an indication that a reset occurred. */ - return (1); - } - - /* If status doesn't indicate the host recognized a reset, return with an - indication the DSP is not ready. */ - if ((DspStatus != HOST_INIT_STATUS) || (pDspIfBlk[DspId] == 0)) - return (-1); - - /* Return with an indication that a reset did not occur. */ - return (0); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * WriteDspCmdMessage - Write a Host Command/Request message to DSP. - * - * FUNCTION - * This function writes a Host Command/Request message into DSP memory and - * informs the DSP of the presence of the message. - * - * RETURNS - * -1 = Unable to write message (msg len or DSP Id invalid or DSP not ready) - * 0 = Temporarily unable to write message (previous Cmd Msg busy) - * 1 = Message written successfully - * - */ -static int WriteDspCmdMessage( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_WORD *pMessage, /* pointer to Command message */ - DSP_WORD MsgLength /* length of message (octets) */ - ) -{ - DSP_WORD CmdMsgLength; /* current Cmd message length */ - DSP_WORD Temp[2]; - DSP_ADDRESS BufferPointer; /* message buffer pointer */ - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (-1); - - /* Make sure the message length is valid. */ - if ((MsgLength < 1) || (MsgLength > MaxCmdMsgLen[DspId])) - return (-1); - - /* Make sure a previous Command message is not in use by the DSP. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_LEN_OFFSET, 1, - &CmdMsgLength); - if (CmdMsgLength != 0) - return (0); - - /* Purge any previous Reply message that wasn't read. */ - gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1, - &CmdMsgLength); - - /* Copy the Command message into DSP memory. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_PNTR_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(BufferPointer, Temp); - gpakWriteDspMemory(DspId, BufferPointer, (MsgLength + 1) / 2, pMessage); - - /* Store the message length in DSP's Command message length (flags DSP that - a Command message is ready). */ - CmdMsgLength = MsgLength; - gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_LEN_OFFSET, 1, - &CmdMsgLength); - - /* Return with an indication the message was written. */ - return (1); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ReadDspReplyMessage - Read a DSP Reply message from DSP. - * - * FUNCTION - * This function reads a DSP Reply message from DSP memory. - * - * RETURNS - * -1 = Unable to write message (msg len or DSP Id invalid or DSP not ready) - * 0 = No message available (DSP Reply message empty) - * 1 = Message read successfully (message and length stored in variables) - * - */ -static int ReadDspReplyMessage( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_WORD *pMessage, /* pointer to Reply message buffer */ - DSP_WORD *pMsgLength /* pointer to msg length var (octets) */ - ) -{ - DSP_WORD MsgLength; /* message length */ - DSP_ADDRESS BufferPointer; /* message buffer pointer */ - DSP_WORD Temp[2]; - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (-1); - - /* Check if a Reply message is ready. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1, - &MsgLength); - if (MsgLength == 0) - return (0); - - /* Make sure the message length is valid. */ - if (MsgLength > *pMsgLength) - return (-1); - - /* Copy the Reply message from DSP memory. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_PNTR_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(BufferPointer, Temp); - gpakReadDspMemory(DspId, BufferPointer, (MsgLength + 1) / 2, pMessage); - - /* Store the message length in the message length variable. */ - *pMsgLength = MsgLength; - - /* Indicate a Reply message is not ready. */ - MsgLength = 0; - gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1, - &MsgLength); - - /* Return with an indication the message was read. */ - return (1); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ReadCircBuffer - Read from a DSP circular buffer. - * - * FUNCTION - * This function reads a block of words from a DSP circular buffer. The Take - * address is incremented by the number of words read adjusting for buffer - * wrap. - * - * RETURNS - * nothing - * - */ -static void ReadCircBuffer( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_ADDRESS BufrBaseAddress, /* address of base of circular buffer */ - DSP_ADDRESS BufrLastAddress, /* address of last word in buffer */ - DSP_ADDRESS *TakeAddress, /* pointer to address in buffer for read */ - DSP_WORD *pWordBuffer, /* pointer to buffer for words read */ - DSP_WORD NumWords /* number of words to read */ - ) -{ - DSP_WORD WordsTillEnd; /* number of words until end of buffer */ - - /* Determine the number of words from the start address until the end of the - buffer. */ - WordsTillEnd = BufrLastAddress - *TakeAddress + 1; - - /* If a buffer wrap will occur, read the first part at the end of the - buffer followed by the second part at the beginning of the buffer. */ - if (NumWords > WordsTillEnd) - { - gpakReadDspMemory(DspId, *TakeAddress, WordsTillEnd, pWordBuffer); - gpakReadDspMemory(DspId, BufrBaseAddress, NumWords - WordsTillEnd, - &(pWordBuffer[WordsTillEnd])); - *TakeAddress = BufrBaseAddress + NumWords - WordsTillEnd; - } - - /* If a buffer wrap will not occur, read all words starting at the current - take address in the buffer. */ - else - { - gpakReadDspMemory(DspId, *TakeAddress, NumWords, pWordBuffer); - if (NumWords == WordsTillEnd) - *TakeAddress = BufrBaseAddress; - else - *TakeAddress = *TakeAddress + NumWords; - } - return; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * VerifyReply - Verify the reply message is correct for the command sent. - * - * FUNCTION - * This function verifies correct reply message content for the command that - * was just sent. - * - * RETURNS - * 0 = Incorrect - * 1 = Correct - * - */ -static int VerifyReply( - DSP_WORD *pMsgBufr, /* pointer to Reply message buffer */ - int CheckType, /* reply check type */ - DSP_WORD CheckValue /* reply check value */ - ) -{ - - /* Verify Channel or Conference Id. */ - if (CheckType == 1) - { - if (((pMsgBufr[1] >> 8) & 0xFF) != CheckValue) - return (0); - } - - /* Verify Test Mode Id. */ - else if (CheckType == 2) - { - if (pMsgBufr[1] != CheckValue) - return (0); - } - - /* Return with an indication of correct reply. */ - return (1); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * TransactCmd - Send a command to the DSP and receive it's reply. - * - * FUNCTION - * This function sends the specified command to the DSP and receives the DSP's - * reply. - * - * RETURNS - * Length of reply message (0 = Failure) - * - */ -static unsigned int TransactCmd( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_WORD *pMsgBufr, /* pointer to Cmd/Reply message buffer */ - DSP_WORD CmdLength, /* length of command message (octets) */ - DSP_WORD ReplyType, /* required type of reply message */ - DSP_WORD ReplyLength, /* required length of reply message (octets) */ - int ReplyCheckType, /* reply check type */ - DSP_WORD ReplyCheckValue /* reply check value */ - ) -{ - int FuncStatus; /* function status */ - int LoopCount; /* wait loop counter */ - DSP_WORD RcvReplyLength; /* received Reply message length */ - DSP_WORD RcvReplyType; /* received Reply message type code */ - DSP_WORD RetValue; /* return value */ - - /* Default the return value to indicate a failure. */ - RetValue = 0; - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Attempt to write the command message to the DSP. */ - LoopCount = 0; - while ((FuncStatus = WriteDspCmdMessage(DspId, pMsgBufr, CmdLength)) != 1) - { - if (FuncStatus == -1) - break; - if (++LoopCount > MAX_WAIT_LOOPS) - break; - gpakHostDelay(); - } - - /* Attempt to read the reply message from the DSP if the command message was - sent successfully. */ - if (FuncStatus == 1) - { - for (LoopCount = 0; LoopCount < MAX_WAIT_LOOPS; LoopCount++) - { - RcvReplyLength = MSG_BUFFER_SIZE * 2; - FuncStatus = ReadDspReplyMessage(DspId, pMsgBufr, &RcvReplyLength); - if (FuncStatus == 1) - { - RcvReplyType = (pMsgBufr[0] >> 8) & 0xFF; - if ((RcvReplyLength >= ReplyLength) && - (RcvReplyType == ReplyType) && - VerifyReply(pMsgBufr, ReplyCheckType, ReplyCheckValue)) - { - RetValue = RcvReplyLength; - break; - } - else if (RcvReplyType == MSG_NULL_REPLY) - break; - } - else if (FuncStatus == -1) - break; - gpakHostDelay(); - } - } - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Return the length of the reply message (0 = failure). */ - return (RetValue); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakConfigurePorts - Configure a DSP's serial ports. - * - * FUNCTION - * This function configures a DSP's serial ports. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakConfigPortStatus_t gpakConfigurePorts( - unsigned short int DspId, /* DSP Id (0 to MaxDSPCores-1) */ - GpakPortConfig_t *pPortConfig, /* pointer to Port Config info */ - GPAK_PortConfigStat_t *pStatus /* pointer to Port Config Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (CpsInvalidDsp); - - /* Build the Configure Serial Ports message. */ - MsgBuffer[0] = MSG_CONFIGURE_PORTS << 8; - MsgBuffer[1] = (DSP_WORD) - ((pPortConfig->SlotsSelect1 << 12) | - ((pPortConfig->FirstBlockNum1 << 8) & 0x0F00) | - ((pPortConfig->SecBlockNum1 << 4) & 0x00F0)); - MsgBuffer[2] = (DSP_WORD) pPortConfig->FirstSlotMask1; - MsgBuffer[3] = (DSP_WORD) pPortConfig->SecSlotMask1; - MsgBuffer[4] = (DSP_WORD) - ((pPortConfig->SlotsSelect2 << 12) | - ((pPortConfig->FirstBlockNum2 << 8) & 0x0F00) | - ((pPortConfig->SecBlockNum2 << 4) & 0x00F0)); - MsgBuffer[5] = (DSP_WORD) pPortConfig->FirstSlotMask2; - MsgBuffer[6] = (DSP_WORD) pPortConfig->SecSlotMask2; - MsgBuffer[7] = (DSP_WORD) - ((pPortConfig->SlotsSelect3 << 12) | - ((pPortConfig->FirstBlockNum3 << 8) & 0x0F00) | - ((pPortConfig->SecBlockNum3 << 4) & 0x00F0)); - MsgBuffer[8] = (DSP_WORD) pPortConfig->FirstSlotMask3; - MsgBuffer[9] = (DSP_WORD) pPortConfig->SecSlotMask3; - - MsgBuffer[10] = (DSP_WORD) - (((pPortConfig->DxDelay1 << 11) & 0x0800) | - ((pPortConfig->RxDataDelay1 << 9) & 0x0600) | - ((pPortConfig->TxDataDelay1 << 7) & 0x0180) | - ((pPortConfig->RxClockPolarity1 << 6) & 0x0040) | - ((pPortConfig->TxClockPolarity1 << 5) & 0x0020) | - ((pPortConfig->RxFrameSyncPolarity1 << 4) & 0x0010) | - ((pPortConfig->TxFrameSyncPolarity1 << 3) & 0x0008) | - ((pPortConfig->CompandingMode1 << 1) & 0x0006) | - (pPortConfig->SerialWordSize1 & 0x0001)); - - MsgBuffer[11] = (DSP_WORD) - (((pPortConfig->DxDelay2 << 11) & 0x0800) | - ((pPortConfig->RxDataDelay2 << 9) & 0x0600) | - ((pPortConfig->TxDataDelay2 << 7) & 0x0180) | - ((pPortConfig->RxClockPolarity2 << 6) & 0x0040) | - ((pPortConfig->TxClockPolarity2 << 5) & 0x0020) | - ((pPortConfig->RxFrameSyncPolarity2 << 4) & 0x0010) | - ((pPortConfig->TxFrameSyncPolarity2 << 3) & 0x0008) | - ((pPortConfig->CompandingMode2 << 1) & 0x0006) | - (pPortConfig->SerialWordSize1 & 0x0001)); - - MsgBuffer[12] = (DSP_WORD) - (((pPortConfig->DxDelay3 << 11) & 0x0800) | - ((pPortConfig->RxDataDelay3 << 9) & 0x0600) | - ((pPortConfig->TxDataDelay3 << 7) & 0x0180) | - ((pPortConfig->RxClockPolarity3 << 6) & 0x0040) | - ((pPortConfig->TxClockPolarity3 << 5) & 0x0020) | - ((pPortConfig->RxFrameSyncPolarity3 << 4) & 0x0010) | - ((pPortConfig->TxFrameSyncPolarity3 << 3) & 0x0008) | - ((pPortConfig->CompandingMode3 << 1) & 0x0006) | - (pPortConfig->SerialWordSize3 & 0x0001)); - - MsgBuffer[13] = (DSP_WORD) pPortConfig->ThirdSlotMask1; - MsgBuffer[14] = (DSP_WORD) pPortConfig->FouthSlotMask1; - MsgBuffer[15] = (DSP_WORD) pPortConfig->FifthSlotMask1; - MsgBuffer[16] = (DSP_WORD) pPortConfig->SixthSlotMask1; - MsgBuffer[17] = (DSP_WORD) pPortConfig->SevenSlotMask1; - MsgBuffer[18] = (DSP_WORD) pPortConfig->EightSlotMask1; - - MsgBuffer[19] = (DSP_WORD) pPortConfig->ThirdSlotMask2;; - MsgBuffer[20] = (DSP_WORD) pPortConfig->FouthSlotMask2; - MsgBuffer[21] = (DSP_WORD) pPortConfig->FifthSlotMask2;; - MsgBuffer[22] = (DSP_WORD) pPortConfig->SixthSlotMask2; - MsgBuffer[23] = (DSP_WORD) pPortConfig->SevenSlotMask2;; - MsgBuffer[24] = (DSP_WORD) pPortConfig->EightSlotMask2; - - MsgBuffer[25] = (DSP_WORD) pPortConfig->ThirdSlotMask3;; - MsgBuffer[26] = (DSP_WORD) pPortConfig->FouthSlotMask3; - MsgBuffer[27] = (DSP_WORD) pPortConfig->FifthSlotMask3;; - MsgBuffer[28] = (DSP_WORD) pPortConfig->SixthSlotMask3; - MsgBuffer[29] = (DSP_WORD) pPortConfig->SevenSlotMask3;; - MsgBuffer[30] = (DSP_WORD) pPortConfig->EightSlotMask3; - - - /* Attempt to send the Configure Serial Ports message to the DSP and receive - it's reply. */ - if (!TransactCmd(DspId, MsgBuffer, 62, MSG_CONFIG_PORTS_REPLY, 4, 0, 0)) - return (CpsDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_PortConfigStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Pc_Success) - return (CpsSuccess); - else - return (CpsParmError); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakConfigureChannel - Configure a DSP's Channel. - * - * FUNCTION - * This function configures a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakConfigChanStatus_t gpakConfigureChannel( - unsigned short int DspId, /* DSP Id (0 to MaxDSPCores-1) */ - unsigned short int ChannelId, /* Channel Id (0 to MaxChannels-1) */ - GpakChanType ChannelType, /* Channel Type */ - GpakChannelConfig_t *pChanConfig, /* pointer to Channel Config info */ - GPAK_ChannelConfigStat_t *pStatus /* pointer to Channel Config Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD MsgLength; /* message length */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (CcsInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (CcsInvalidChannel); - - /* Build the Configure Channel message based on the Channel Type. */ - switch (ChannelType) - { - - /* PCM to Packet channel type. */ - case tdmToTdm: - - MsgBuffer[2] = (DSP_WORD) - ((pChanConfig->PcmInPortA << 8) | - (pChanConfig->PcmInSlotA & 0xFF)); - MsgBuffer[3] = (DSP_WORD) - ((pChanConfig->PcmOutPortA << 8) | - (pChanConfig->PcmOutSlotA & 0xFF)); - - MsgBuffer[4] = (DSP_WORD) - ((pChanConfig->PcmInPortB << 8) | - (pChanConfig->PcmInSlotB & 0xFF)); - MsgBuffer[5] = (DSP_WORD) - ((pChanConfig->PcmOutPortB << 8) | - (pChanConfig->PcmOutSlotB & 0xFF)); - - MsgBuffer[6] = (DSP_WORD) - ( - ((pChanConfig->FaxCngDetB <<11) & 0x0800) | - ((pChanConfig->FaxCngDetA <<10) & 0x0400) | - ((pChanConfig->MuteToneB << 9) & 0x0200) | - ((pChanConfig->MuteToneA << 8) & 0x0100) | - ((pChanConfig->FrameRate << 6) & 0x00C0) | - ((pChanConfig->ToneTypesB << 5) & 0x0020) | - ((pChanConfig->ToneTypesA << 4) & 0x0010) | - ((pChanConfig->SoftwareCompand & 3) << 2) | - (pChanConfig->EcanEnableB << 1) | - (pChanConfig->EcanEnableA & 1) - ); - - MsgBuffer[7] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanTapLength; - MsgBuffer[8] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpType; - MsgBuffer[9] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanAdaptEnable; - MsgBuffer[10] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanG165DetEnable; - MsgBuffer[11] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanDblTalkThresh; - MsgBuffer[12] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpThreshold; - MsgBuffer[13] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpConv; - MsgBuffer[14] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpUnConv; - MsgBuffer[15] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpMaxSuppress; - - MsgBuffer[16] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanCngThreshold; - MsgBuffer[17] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanAdaptLimit; - MsgBuffer[18] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanCrossCorrLimit; - MsgBuffer[19] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNumFirSegments; - MsgBuffer[20] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanFirSegmentLen; - - MsgBuffer[21] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanTapLength; - MsgBuffer[22] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpType; - MsgBuffer[23] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanAdaptEnable; - MsgBuffer[24] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanG165DetEnable; - MsgBuffer[25] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanDblTalkThresh; - MsgBuffer[26] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpThreshold; - MsgBuffer[27] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpConv; - MsgBuffer[28] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpUnConv; - MsgBuffer[29] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpMaxSuppress; - MsgBuffer[30] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanCngThreshold; - MsgBuffer[31] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanAdaptLimit; - MsgBuffer[32] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanCrossCorrLimit; - MsgBuffer[33] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNumFirSegments; - MsgBuffer[34] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanFirSegmentLen; - - MsgLength = 70; // byte number == 35*2 - break; - - - /* Unknown (invalid) channel type. */ - default: - *pStatus = Cc_InvalidChannelType; - return (CcsParmError); - } - - MsgBuffer[0] = MSG_CONFIGURE_CHANNEL << 8; - MsgBuffer[1] = (DSP_WORD) ((ChannelId << 8) | (ChannelType & 0xFF)); - - /* Attempt to send the Configure Channel message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, MsgLength, MSG_CONFIG_CHAN_REPLY, 4, 1, - (DSP_WORD) ChannelId)) - return (CcsDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_ChannelConfigStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Cc_Success) - return (CcsSuccess); - else - return (CcsParmError); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakTearDownChannel - Tear Down a DSP's Channel. - * - * FUNCTION - * This function tears down a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakTearDownStatus_t gpakTearDownChannel( - unsigned short int DspId, /* DSP Id (0 to MaxDSPCores-1) */ - unsigned short int ChannelId, /* Channel Id (0 to MaxChannels-1) */ - GPAK_TearDownChanStat_t *pStatus /* pointer to Tear Down Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (TdsInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (TdsInvalidChannel); - - /* Build the Tear Down Channel message. */ - MsgBuffer[0] = MSG_TEAR_DOWN_CHANNEL << 8; - MsgBuffer[1] = (DSP_WORD) (ChannelId << 8); - - /* Attempt to send the Tear Down Channel message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 3, MSG_TEAR_DOWN_REPLY, 4, 1, - (DSP_WORD) ChannelId)) - return (TdsDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_TearDownChanStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Td_Success) - return (TdsSuccess); - else - return (TdsError); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakAlgControl - Control an Algorithm. - * - * FUNCTION - * This function controls an Algorithm - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakAlgControlStat_t gpakAlgControl( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakAlgCtrl_t ControlCode, // algorithm control code - GPAK_AlgControlStat_t *pStatus // pointer to return status - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (AcInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (AcInvalidChannel); - - MsgBuffer[0] = MSG_ALG_CONTROL << 8; - MsgBuffer[1] = (DSP_WORD) ((ChannelId << 8) | (ControlCode & 0xFF)); - - /* Attempt to send the Tear Down Channel message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 4, MSG_ALG_CONTROL_REPLY, 4, 1, - (DSP_WORD) ChannelId)) - return (AcDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_AlgControlStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Ac_Success) - return (AcSuccess); - else - return (AcParmError); - -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadEventFIFOMessage - read from the event fifo - * - * FUNCTION - * This function reads a single event from the event fifo if one is available - * - * RETURNS - * Status code indicating success or a specific error. - * - * Notes: This function should be called in a loop until the return status - * indicates that the fifo is empty. - * - * If the event code equals "EventLoopbackTeardownComplete", then the - * contents of *pChannelId hold the coderBlockId that was assigned to - * the loopback coder that was torn down. - */ -gpakReadEventFIFOMessageStat_t gpakReadEventFIFOMessage( - unsigned short int DspId, // DSP identifier - unsigned short int *pChannelId, // pointer to channel identifier - GpakAsyncEventCode_t *pEventCode, // pointer to Event Code - GpakAsyncEventData_t *pEventData // pointer to Event Data Struct - ) -{ - DSP_WORD WordBuffer[WORD_BUFFER_SIZE]; /* DSP words buffer */ - GpakAsyncEventCode_t EventCode; /* DSP's event code */ - DSP_WORD EventDataLength; /* Length of event to read */ - DSP_WORD ChannelId; /* DSP's channel Id */ - DSP_ADDRESS EventInfoAddress; /* address of EventFIFO info structure */ - DSP_ADDRESS BufrBaseAddress; /* base address of EventFIFO buffer */ - DSP_ADDRESS BufrLastAddress; /* last address of EventFIFO buffer */ - DSP_ADDRESS TakeAddress; /* current take address in fifo buffer */ - DSP_WORD BufrSize; /* size (in words) of event FIFO buffer */ - DSP_WORD PutIndex; /* event fifo put index */ - DSP_WORD TakeIndex; /* event fifo take index */ - DSP_WORD WordsReady; /* number words ready for read out of event fifo */ - DSP_WORD EventError; /* flag indicating error with event fifo msg */ -#if 0 - DSP_WORD *pDebugData; /* debug data buffer pointer in event data struct */ -#endif - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RefInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - { - gpakUnlockAccess(DspId); - return (RefDspCommFailure); - } - - /* Check if an event message is ready in the DSP. */ - EventInfoAddress = pEventFifoAddress[DspId]; - gpakReadDspMemory(DspId, EventInfoAddress, CIRC_BUFFER_INFO_STRUCT_SIZE, - WordBuffer); - RECONSTRUCT_LONGWORD(BufrBaseAddress, ((DSP_WORD *)&WordBuffer[CB_BUFR_BASE])); - BufrSize = WordBuffer[CB_BUFR_SIZE]; - PutIndex = WordBuffer[CB_BUFR_PUT_INDEX]; - TakeIndex = WordBuffer[CB_BUFR_TAKE_INDEX]; - if (PutIndex >= TakeIndex) - WordsReady = PutIndex - TakeIndex; - else - WordsReady = PutIndex + BufrSize - TakeIndex; - - if (WordsReady < 2) - { - gpakUnlockAccess(DspId); - return (RefNoEventAvail); - } - - /* Read the event header from the DSP's Event FIFO. */ - TakeAddress = BufrBaseAddress + TakeIndex; - BufrLastAddress = BufrBaseAddress + BufrSize - 1; - ReadCircBuffer(DspId, BufrBaseAddress, BufrLastAddress, &TakeAddress, - WordBuffer, 2); - TakeIndex += 2; - if (TakeIndex >= BufrSize) - TakeIndex -= BufrSize; - - ChannelId = (WordBuffer[0] >> 8) & 0xFF; - EventCode = (GpakAsyncEventCode_t)(WordBuffer[0] & 0xFF); - EventDataLength = WordBuffer[1]; - EventError = 0; - - switch (EventCode) - { - case EventToneDetect: - if (EventDataLength > WORD_BUFFER_SIZE) - { - gpakUnlockAccess(DspId); -#if 0 - printk("EventDataLength > WORD_BUFFER_SIZE (%d)\n", EventDataLength); -#endif - return (RefInvalidEvent); - } - ReadCircBuffer(DspId, BufrBaseAddress, BufrLastAddress, &TakeAddress, - WordBuffer, EventDataLength); - pEventData->toneEvent.ToneCode = (GpakToneCodes_t) - (WordBuffer[0] & 0xFF); - pEventData->toneEvent.ToneDuration = WordBuffer[1]; - pEventData->toneEvent.Direction = WordBuffer[2]; - pEventData->toneEvent.DebugToneStatus = WordBuffer[3]; - TakeIndex += EventDataLength; - if (TakeIndex >= BufrSize) - TakeIndex -= BufrSize; - if (EventDataLength != 4) { -#if 0 - printk("EventDataLength != 4 it's %d\n", EventDataLength); -#endif - EventError = 1; - } - break; - - default: -#if 0 - printk("Event Code not in switch\n"); -#endif - EventError = 1; - break; - }; - - /* Update the Take index in the DSP's Packet Out buffer information. */ - gpakWriteDspMemory(DspId, EventInfoAddress + CB_BUFR_TAKE_INDEX, 1, - &TakeIndex); - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - if (EventError) - return(RefInvalidEvent); - - *pChannelId = ChannelId; - *pEventCode = EventCode; - return(RefEventAvail); - -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakPingDsp - ping the DSP to see if it's alive - * - * FUNCTION - * This function checks if the DSP is still communicating with the host - * and returns the DSP SW version - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakPingDspStat_t gpakPingDsp( - unsigned short int DspId, // DSP identifier - unsigned short int *pDspSwVersion // DSP software version - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (PngInvalidDsp); - - /* send value of 1, DSP increments it */ - MsgBuffer[0] = (MSG_PING << 8); - - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 1, MSG_PING_REPLY, 6, 0, 0)) - return (PngDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - { - *pDspSwVersion = MsgBuffer[2]; - return (PngSuccess); - } - else - return (PngDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakSerialTxFixedValue - transmit a fixed value on a timeslot - * - * FUNCTION - * This function controls transmission of a fixed value out onto a serial - * port's timeslot. - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakSerialTxFixedValueStat_t gpakSerialTxFixedValue( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakSerialPort_t PcmOutPort, // PCM Output Serial Port Id - unsigned short int PcmOutSlot, // PCM Output Time Slot - unsigned short int Value, // 16-bit value - GpakActivation State // activation state - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (TfvInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (TfvInvalidChannel); - - - /* Build the message. */ - MsgBuffer[0] = MSG_SERIAL_TXVAL << 8; - MsgBuffer[1] = (DSP_WORD) ((ChannelId << 8) | (State & 0xFF)); - MsgBuffer[2] = (DSP_WORD) ((PcmOutPort << 8) | (PcmOutSlot & 0xFF)); - MsgBuffer[3] = (DSP_WORD) Value; - - /* Attempt to send the message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 8, MSG_SERIAL_TXVAL_REPLY, 4, - 1, ChannelId)) - return (TfvDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (TfvSuccess); - else - return (TfvDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakControlTdmLoopBack - control a serial port's loopback state - * - * FUNCTION - * This function enables/disables the tdm input to output looback mode on a - * serial port - * - * RETURNS - * Status code indicating success or a specific error. - */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -gpakControlTdmLoopBackStat_t gpakControlTdmLoopBack( - unsigned short int DspId, // DSP identifier - GpakSerialPort_t SerialPort, // Serial Port Id - GpakActivation LoopBackState // Loopback State - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (ClbInvalidDsp); - - /* Build the message. */ - MsgBuffer[0] = MSG_TDM_LOOPBACK << 8; - MsgBuffer[1] = (DSP_WORD) ((SerialPort << 8) | (LoopBackState & 0xFF)); - - /* Attempt to send the message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 4, MSG_TDM_LOOPBACK_REPLY, 4, 0, 0)) - return (ClbDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (ClbSuccess); - else - return (ClbDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadCpuUsage - Read CPU usage statistics from a DSP. - * - * FUNCTION - * This function reads the CPU usage statistics from a DSP's memory. The - * average CPU usage in units of .1 percent are obtained for each of the frame - * rates. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakReadCpuUsageStat_t gpakReadCpuUsage( - unsigned short int DspId, // Dsp Identifier - unsigned short int *pPeakUsage, // pointer to peak usage variable - unsigned short int *pPrev1SecPeakUsage // peak usage over previous 1 second - ) -{ - DSP_WORD ReadBuffer[2]; /* DSP read buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RcuInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (RcuDspCommFailure); - - /* Read the CPU Usage statistics from the DSP. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CPU_USAGE_OFFSET, 2, - ReadBuffer); - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Store the usage statistics in the specified variables. */ - *pPrev1SecPeakUsage = ReadBuffer[0]; - *pPeakUsage = ReadBuffer[1]; - - /* Return with an indication the usage staistics were read successfully. */ - return (RcuSuccess); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetCpuUsageStats - reset the cpu usage statistics - * - * FUNCTION - * This function resets the cpu utilization statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakResetCpuUsageStat_t gpakResetCpuUsageStats( - unsigned short int DspId // DSP identifier - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RstcInvalidDsp); - - MsgBuffer[0] = (MSG_RESET_USAGE_STATS << 8); - - /* Attempt to send the message to the DSP and receive it's reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 2, MSG_RESET_USAGE_STATS_REPLY, 4, 0, 0)) - return (RstcDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (RstcSuccess); - else - return (RstcDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFramingStats - * - * FUNCTION - * This function reads a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakReadFramingStatsStatus_t gpakReadFramingStats( - unsigned short int DspId, // DSP identifier - unsigned short int *pFramingError1Count, // port 1 Framing error count - unsigned short int *pFramingError2Count, // port 2 Framing error count - unsigned short int *pFramingError3Count, // port 3 Framing error count - unsigned short int *pDmaStopErrorCount, // DMA-stoppage error count - unsigned short int *pDmaSlipStatsBuffer // DMA slips count - ) -{ - DSP_WORD ReadBuffer[10]; /* DSP read buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RfsInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (RfsDspCommFailure); - - /* Read the framing interrupt statistics from the DSP. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + FRAMING_STATS_OFFSET, 10, - ReadBuffer); - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Store the framing statistics in the specified variables. */ - *pFramingError1Count = ReadBuffer[0]; - *pFramingError2Count = ReadBuffer[1]; - *pFramingError3Count = ReadBuffer[2]; - *pDmaStopErrorCount = ReadBuffer[3]; - - if(pDmaSlipStatsBuffer != 0) - // If users want to get the DMA slips count - { - pDmaSlipStatsBuffer[0] = ReadBuffer[4]; - pDmaSlipStatsBuffer[1] = ReadBuffer[5]; - pDmaSlipStatsBuffer[2] = ReadBuffer[6]; - pDmaSlipStatsBuffer[3] = ReadBuffer[7]; - pDmaSlipStatsBuffer[4] = ReadBuffer[8]; - pDmaSlipStatsBuffer[5] = ReadBuffer[9]; - - } - /* Return with an indication the statistics were read successfully. */ - return (RfsSuccess); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetFramingStats - reset a DSP's framing interrupt statistics - * - * FUNCTION - * This function resets a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakResetFramingStatsStatus_t gpakResetFramingStats( - unsigned short int DspId // DSP identifier - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RstfInvalidDsp); - - MsgBuffer[0] = (MSG_RESET_FRAME_STATS << 8); - - /* Attempt to send the message to the DSP and receive it's reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 2, MSG_RESET_FRAME_STATS_REPLY, 4, 0, 0)) - return (RstfDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (RstfSuccess); - else - return (RstfDspCommFailure); -} - -/* - * gpakDownloadDsp - Download a DSP's Program and initialized Data memory. - * - * FUNCTION - * This function reads a DSP's Program and Data memory image from the - * specified file and writes the image to the DSP's memory. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakDownloadStatus_t gpakDownloadDsp( - unsigned short DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - GPAK_FILE_ID FileId /* G.PAK Download File Identifier */ - ) -{ - gpakDownloadStatus_t RetStatus; /* function return status */ - int NumRead; /* number of file bytes read */ - DSP_ADDRESS Address; /* DSP address */ - unsigned int WordCount; /* number of words in record */ - unsigned int NumWords; /* number of words to read/write */ - unsigned int i; /* loop index / counter */ - unsigned int j; /* loop index */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (GdlInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - RetStatus = GdlSuccess; - while (RetStatus == GdlSuccess) - { - - /* Read a record header from the file. */ - NumRead = gpakReadFile(FileId, DlByteBufr, 6); - if (NumRead == -1) - { - RetStatus = GdlFileReadError; - break; - } - if (NumRead != 6) - { - RetStatus = GdlInvalidFile; - break; - } - Address = (((DSP_ADDRESS) DlByteBufr[1]) << 16) | - (((DSP_ADDRESS) DlByteBufr[2]) << 8) | - ((DSP_ADDRESS) DlByteBufr[3]); - WordCount = (((unsigned int) DlByteBufr[4]) << 8) | - ((unsigned int) DlByteBufr[5]); - - /* Check for the End Of File record. */ - if (DlByteBufr[0] == 0xFF) - break; - - /* Verify the record is for a valid memory type. */ - if ((DlByteBufr[0] != 0x00) && (DlByteBufr[0] != 0x01)) - { - RetStatus = GdlInvalidFile; - break; - } - - /* Read a block of words at a time from the file and write to the - DSP's memory .*/ - while (WordCount != 0) - { - if (WordCount < DOWNLOAD_BLOCK_SIZE) - NumWords = WordCount; - else - NumWords = DOWNLOAD_BLOCK_SIZE; - WordCount -= NumWords; - NumRead = gpakReadFile(FileId, DlByteBufr, NumWords * 2); - if (NumRead == -1) - { - RetStatus = GdlFileReadError; - break; - } - if (NumRead != (NumWords * 2)) - { - RetStatus = GdlInvalidFile; - break; - } - for (i = 0, j = 0; i < NumWords; i++, j += 2) - DlWordBufr[i] = (((DSP_WORD) DlByteBufr[j]) << 8) | - ((DSP_WORD) DlByteBufr[j + 1]); - gpakWriteDspMemory(DspId, Address, NumWords, DlWordBufr); - Address += ((DSP_ADDRESS) NumWords); - } - } - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Return with an indication of success or failure. */ - return (RetStatus); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadCpuUsage - Read CPU usage statistics from a DSP. - * - * FUNCTION - * This function reads the memory map register section of DSP memory. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakReadDSPMemoryStat_t gpakReadDSPMemoryMap( - unsigned short int DspId, // Dsp Identifier - unsigned short int *pDest, // Buffer on host to hold DSP memory map - DSP_ADDRESS BufrBaseAddress, // DSP memory users want to read out - unsigned short int MemoryLength_Word16 // Length of memory section read out, unit is 16-bit word - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP reply's status */ - int i; /* loop index / counter */ - - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RmmInvalidDsp); - - /* Verify the message buffer is large enough */ - if (MSG_BUFFER_SIZE < MemoryLength_Word16 ) - return (RmmSizeTooBig); - - MsgBuffer[0] = MSG_READ_DSP_MEMORY << 8; - MsgBuffer[1] = (DSP_WORD) ((BufrBaseAddress >> 16) & 0xFFFF); - MsgBuffer[2] = (DSP_WORD) (BufrBaseAddress & 0xFFFF); - MsgBuffer[3] = (DSP_WORD) MemoryLength_Word16; - - /* Attempt to send the Read memory section message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 8, MSG_READ_DSP_MEMORY_REPLY, - (MemoryLength_Word16+2)*2, 0, 0) ) - return (RmmInvalidAddress); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus != 0) - return (RmmFailure); - - for (i = 0; i < MemoryLength_Word16; i++) - pDest[i] = (short int) MsgBuffer[2 + i]; - - - return (RmmSuccess); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakAccessGPIO - change Direction/read/write the GPIO on DSP - * - * FUNCTION - * This function read/write GPIO and change the GPIO direction - * - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakAccessGPIOStat_t gpakAccessGPIO( - unsigned short int DspId, // DSP identifier - GpakGPIOCotrol_t gpakControlGPIO,// select oeration, changeDIR/write/read - unsigned short int *pGPIOValue // DSP software version - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (GPIOInvalidDsp); - - /* send value of 1, DSP increments it */ - MsgBuffer[0] = (MSG_ACCESSGPIO << 8); - MsgBuffer[1] = (DSP_WORD) ((gpakControlGPIO << 8) | (*pGPIOValue & 0xFF) ); - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 4, MSG_ACCESSGPIO_REPLY, 6, 0, 0)) - return (GPIODspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - { - *pGPIOValue = MsgBuffer[2]; - return (GPIOSuccess); - } - else - return (GPIODspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakWriteSystemParms - Write a DSP's System Parameters. - * - * FUNCTION - * This function writes a DSP's System Parameters information. - * - * Note: - * Or-together the desired bit-mask #defines that are listed below. Only - * those algorithm parameters whose bit-mask is selected in the UpdateBits - * function parameter will be updated. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ - -gpakWriteSysParmsStatus_t gpakWriteSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms, /* pointer to System Parms info var */ - unsigned short int UpdateBits, /* input: flags indicating which parms to update */ - GPAK_SysParmsStat_t *pStatus /* pointer to Write System Parms Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (WspInvalidDsp); - - /* Build the Write System Parameters message. */ - MsgBuffer[0] = MSG_WRITE_SYS_PARMS << 8; - - if (UpdateBits & DTMF_UPDATE_MASK) - { - MsgBuffer[1] |= DTMF_UPDATE_MASK; - MsgBuffer[8] = (DSP_WORD) pSysParms->MinSigLevel; - MsgBuffer[9] = (DSP_WORD) (pSysParms->FreqDeviation & 0xff); - if (pSysParms->SNRFlag) - MsgBuffer[9] |= (1<<8); - } - - MsgBuffer[10] = (DSP_WORD) 0; - if (UpdateBits & DTMF_TWIST_UPDATE_MASK) - { - MsgBuffer[1] |= DTMF_TWIST_UPDATE_MASK; - MsgBuffer[10] |= (DSP_WORD) (pSysParms->DtmfFwdTwist & 0x000f); - MsgBuffer[10] |= (DSP_WORD) ((pSysParms->DtmfRevTwist << 4) & 0x00f0); - } - - - if (UpdateBits & DTMF_VALID_MASK) - { - MsgBuffer[1] |= DTMF_VALID_MASK; - MsgBuffer[11] = (DSP_WORD) (pSysParms->DtmfValidityMask & 0x00ff); - } - - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 24, MSG_WRITE_SYS_PARMS_REPLY, 6, 0, 0)) - return (WspDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_SysParmsStat_t) (MsgBuffer[2] ); - - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (WspSuccess); - else - return (WspDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadSystemParms - Read a DSP's System Parameters. - * - * FUNCTION - * This function reads a DSP's System Parameters information. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakReadSysParmsStatus_t gpakReadSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms /* pointer to System Parms info var */ - ) -{ - - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RspInvalidDsp); - - /* Build the Read System Parameters message. */ - MsgBuffer[0] = MSG_READ_SYS_PARMS << 8; - - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 2, MSG_READ_SYS_PARMS_REPLY, 22, 0, 0)) - return (RspDspCommFailure); - - /* Extract the System Parameters information from the message. */ - pSysParms->DtmfValidityMask = (short int)(MsgBuffer[7]) ; - - pSysParms->MinSigLevel = (short int)MsgBuffer[8]; - pSysParms->SNRFlag = (short int)((MsgBuffer[9]>>8) & 0x1); - pSysParms->FreqDeviation = (short int)(MsgBuffer[9] & 0xff); - pSysParms->DtmfFwdTwist = (short int)MsgBuffer[10] & 0x000f; - pSysParms->DtmfRevTwist = (short int)(MsgBuffer[10] >> 4) & 0x000f; - - /* Return with an indication that System Parameters info was obtained. */ - return (RspSuccess); -} diff --git a/zaptel/kernel/wctdm24xxp/GpakApi.h b/zaptel/kernel/wctdm24xxp/GpakApi.h deleted file mode 100644 index 2e55e644..00000000 --- a/zaptel/kernel/wctdm24xxp/GpakApi.h +++ /dev/null @@ -1,636 +0,0 @@ -/* - * Copyright (c) 2005 , Adaptive Digital Technologies, Inc. - * - * File Name: GpakApi.h - * - * Description: - * This file contains the function prototypes and data types for the user - * API functions that communicate with DSPs executing G.PAK software. The - * file is used by application software in the host processor connected to - * C55X G.PAK DSPs via a Host Port Interface. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * 11/15/2006 - 24 TDM-TDM Channels EC release - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKAPI_H /* prevent multiple inclusion */ -#define _GPAKAPI_H -#include "gpakErrs.h" -#include "gpakenum.h" - -// Bit masks to select which algorithm's parameters to update: Or-together the -// desired masks into the UpdateBits function parameter. -#define DTMF_UPDATE_MASK 0x0010 // update DTMF params, MinLevel, SNRFlag and Freq -#define DTMF_TWIST_UPDATE_MASK 0x0020 // update DTMF TWIST system params -#define DTMF_VALID_MASK 0x0080 // update DTMF ValidMask params - -#define DSP_DEBUG_BUFF_SIZE 42 // units of 16-bit words - -/* Definition of an Asynchronous Event Data Structure */ -typedef union -{ - struct - { - GpakToneCodes_t ToneCode; // detected tone code - unsigned short int ToneDuration; // tone duration - GpakTdmDirection Direction; // detected on A r B side - short int DebugToneStatus;// reserved for debug info - } toneEvent; - -} GpakAsyncEventData_t; - -/* Definition of an Echo Canceller Parameters information structure. */ -typedef struct -{ - short int EcanTapLength; // Echo Can Num Taps (tail length) - short int EcanNlpType; // Echo Can NLP Type - short int EcanAdaptEnable; // Echo Can Adapt Enable flag - short int EcanG165DetEnable; // Echo Can G165 Detect Enable flag - short int EcanDblTalkThresh; // Echo Can Double Talk threshold - short int EcanNlpThreshold; // Echo Can NLP threshold - short int EcanNlpConv; // Dynamic NLP control, NLP limit when EC about to converged - short int EcanNlpUnConv;// Dynamic NLP control, NLP limit when EC not converged yet - short int EcanNlpMaxSuppress; // suppression level for NLP_SUPP mode - short int EcanCngThreshold; // Echo Can CNG Noise threshold - short int EcanAdaptLimit; // Echo Can Max Adapts per frame - short int EcanCrossCorrLimit; // Echo Can Cross Correlation limit - short int EcanNumFirSegments; // Echo Can Num FIR Segments - short int EcanFirSegmentLen; // Echo Can FIR Segment Length -} GpakEcanParms_t; - -/* Definition of a Channel Configuration information structure. */ -typedef struct -{ - GpakSerialPort_t PcmInPortA; // A side PCM Input Serial Port Id - unsigned short int PcmInSlotA; // A side PCM Input Time Slot - GpakSerialPort_t PcmOutPortA; // A side PCM Output Serial Port Id - unsigned short int PcmOutSlotA; // A side PCM Output Time Slot - GpakSerialPort_t PcmInPortB; // B side PCM Input Serial Port Id - unsigned short int PcmInSlotB; // B side PCM Input Time Slot - GpakSerialPort_t PcmOutPortB; // B side PCM Output Serial Port Id - unsigned short int PcmOutSlotB; // B side PCM Output Time Slot - GpakToneTypes ToneTypesA; // A side Tone Detect Types - GpakToneTypes ToneTypesB; // B side Tone Detect Types - GpakActivation EcanEnableA; // Echo Cancel A Enabled - GpakActivation EcanEnableB; // Echo Cancel B Enabled - GpakEcanParms_t EcanParametersA; // Echo Cancel parameters - GpakEcanParms_t EcanParametersB; // Echo Cancel parameters - GpakCompandModes SoftwareCompand; // software companding - GpakRate_t FrameRate; // Gpak Frame Rate - GpakActivation MuteToneA; // A side mute DTMF Enabled - GpakActivation MuteToneB; // B side mute DTMF Enabled - GpakActivation FaxCngDetA; // A side FaxCng Tone Detector Enabled - GpakActivation FaxCngDetB; // B side FaxCng Tone Detector Enabled - -} GpakChannelConfig_t; - - -/* Definition of a Serial Port Configuration Structure */ -typedef struct -{ - GpakSlotCfg_t SlotsSelect1; // port 1 Slot selection - unsigned short int FirstBlockNum1; // port 1 first group Block Number - unsigned short int FirstSlotMask1; // port 1 first group Slot Mask - unsigned short int SecBlockNum1; // port 1 second group Block Number - unsigned short int SecSlotMask1; // port 1 second group Slot Mask - - GpakSerWordSize_t SerialWordSize1; // port 1 serial word size - GpakCompandModes CompandingMode1; // port 1 companding mode - GpakSerFrameSyncPol_t TxFrameSyncPolarity1; // port 1 Tx Frame Sync Polarity - GpakSerFrameSyncPol_t RxFrameSyncPolarity1; // port 1 Rx Frame Sync Polarity - GpakSerClockPol_t TxClockPolarity1; // port 1 Tx Clock Polarity - GpakSerClockPol_t RxClockPolarity1; // port 1 Rx Clock Polarity - GpakSerDataDelay_t TxDataDelay1; // port 1 Tx data delay - GpakSerDataDelay_t RxDataDelay1; // port 1 Rx data delay - GpakActivation DxDelay1; // port 1 DX Delay - - unsigned short int ThirdSlotMask1; // port 1 3rd group Slot Mask - unsigned short int FouthSlotMask1; // port 1 4th group Slot Mask - unsigned short int FifthSlotMask1; // port 1 5th group Slot Mask - unsigned short int SixthSlotMask1; // port 1 6th group Slot Mask - unsigned short int SevenSlotMask1; // port 1 7th group Slot Mask - unsigned short int EightSlotMask1; // port 1 8th group Slot Mask - - - GpakSlotCfg_t SlotsSelect2; // port 2 Slot selection - unsigned short int FirstBlockNum2; // port 2 first group Block Number - unsigned short int FirstSlotMask2; // port 2 first group Slot Mask - unsigned short int SecBlockNum2; // port 2 second group Block Number - unsigned short int SecSlotMask2; // port 2 second group Slot Mask - GpakSerWordSize_t SerialWordSize2; // port 2 serial word size - GpakCompandModes CompandingMode2; // port 2 companding mode - GpakSerFrameSyncPol_t TxFrameSyncPolarity2; // port 2 Tx Frame Sync Polarity - GpakSerFrameSyncPol_t RxFrameSyncPolarity2; // port 2 Rx Frame Sync Polarity - GpakSerClockPol_t TxClockPolarity2; // port 2 Tx Clock Polarity - GpakSerClockPol_t RxClockPolarity2; // port 2 Rx Clock Polarity - GpakSerDataDelay_t TxDataDelay2; // port 2 Tx data delay - GpakSerDataDelay_t RxDataDelay2; // port 2 Rx data delay - GpakActivation DxDelay2; // port 2 DX Delay - - unsigned short int ThirdSlotMask2; // port 2 3rd group Slot Mask - unsigned short int FouthSlotMask2; // port 2 4th group Slot Mask - unsigned short int FifthSlotMask2; // port 2 5th group Slot Mask - unsigned short int SixthSlotMask2; // port 2 6th group Slot Mask - unsigned short int SevenSlotMask2; // port 2 7th group Slot Mask - unsigned short int EightSlotMask2; // port 2 8th group Slot Mask - - GpakSlotCfg_t SlotsSelect3; // port 3 Slot selection - unsigned short int FirstBlockNum3; // port 3 first group Block Number - unsigned short int FirstSlotMask3; // port 3 first group Slot Mask - unsigned short int SecBlockNum3; // port 3 second group Block Number - unsigned short int SecSlotMask3; // port 3 second group Slot Mask - GpakSerWordSize_t SerialWordSize3; // port 3 serial word size - GpakCompandModes CompandingMode3; // port 3 companding mode - GpakSerFrameSyncPol_t TxFrameSyncPolarity3; // port 3 Tx Frame Sync Polarity - GpakSerFrameSyncPol_t RxFrameSyncPolarity3; // port 3 Rx Frame Sync Polarity - GpakSerClockPol_t TxClockPolarity3; // port 3 Tx Clock Polarity - GpakSerClockPol_t RxClockPolarity3; // port 3 Rx Clock Polarity - GpakSerDataDelay_t TxDataDelay3; // port 3 Tx data delay - GpakSerDataDelay_t RxDataDelay3; // port 3 Rx data delay - GpakActivation DxDelay3; // port 3 DX Delay - - unsigned short int ThirdSlotMask3; // port 3 3rd group Slot Mask - unsigned short int FouthSlotMask3; // port 3 4th group Slot Mask - unsigned short int FifthSlotMask3; // port 3 5th group Slot Mask - unsigned short int SixthSlotMask3; // port 3 6th group Slot Mask - unsigned short int SevenSlotMask3; // port 3 7th group Slot Mask - unsigned short int EightSlotMask3; // port 3 8th group Slot Mask - -} GpakPortConfig_t; - -/* Definition of a Tone Generation Parameter Structure */ -/* -typedef struct -{ - GpakToneGenType_t ToneType; // Tone Type - unsigned short int Frequency[4]; // Frequency (Hz) - short int Level[4]; // Frequency's Level (1 dBm) - unsigned short int OnTime[4]; // On Times (msecs) - unsigned short int OffTime[4]; // Off Times (msecs) -} GpakToneGenParms_t; -*/ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakConfigureChannel return status. */ -typedef enum -{ - CcsSuccess = 0, /* Channel Configured successfully */ - CcsParmError = 1, /* Channel Config Parameter error */ - CcsInvalidChannel = 2, /* invalid channel */ - CcsInvalidDsp = 3, /* invalid DSP */ - CcsDspCommFailure = 4 /* failed to communicate with DSP */ -} gpakConfigChanStatus_t; - -/* - * gpakConfigureChannel - Configure a DSP's Channel. - * - * FUNCTION - * This function configures a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakConfigChanStatus_t gpakConfigureChannel( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakChanType ChannelType, // channel type - GpakChannelConfig_t *pChanConfig, // pointer to channel config info - GPAK_ChannelConfigStat_t *pStatus // pointer to Channel Config Status - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakTearDownChannel return status. */ -typedef enum -{ - TdsSuccess = 0, /* Channel Tear Down successful */ - TdsError = 1, /* Channel Tear Down error */ - TdsInvalidChannel = 2, /* invalid channel */ - TdsInvalidDsp = 3, /* invalid DSP */ - TdsDspCommFailure = 4 /* failed to communicate with DSP */ -} gpakTearDownStatus_t; - -/* - * gpakTearDownChannel - Tear Down a DSP's Channel. - * - * FUNCTION - * This function tears down a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ - -extern gpakTearDownStatus_t gpakTearDownChannel( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GPAK_TearDownChanStat_t *pStatus // pointer to Tear Down Status - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakAlgControl return status. */ -typedef enum -{ - AcSuccess = 0, /* control successful */ - AcInvalidChannel = 1, /* invalid channel identifier */ - AcInvalidDsp = 2, /* invalid DSP */ - AcParmError = 3, /* invalid control parameter */ - AcDspCommFailure = 4 /* failed to communicate with DSP */ -} gpakAlgControlStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakAlgControl - Control an Algorithm. - * - * FUNCTION - * This function controls an Algorithm - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakAlgControlStat_t gpakAlgControl( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakAlgCtrl_t ControlCode, // algorithm control code - GPAK_AlgControlStat_t *pStatus // pointer to return status - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakConfigurePorts return status. */ -typedef enum -{ - CpsSuccess = 0, /* Serial Ports configured successfully */ - CpsParmError = 1, /* Configure Ports Parameter error */ - CpsInvalidDsp = 2, /* invalid DSP */ - CpsDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakConfigPortStatus_t; - -/* - * gpakConfigurePorts - Configure a DSP's serial ports. - * - * FUNCTION - * This function configures a DSP's serial ports. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakConfigPortStatus_t gpakConfigurePorts( - unsigned short int DspId, // DSP identifier - GpakPortConfig_t *pPortConfig, // pointer to Port Config info - GPAK_PortConfigStat_t *pStatus // pointer to Port Config Status - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakDownloadDsp return status. */ -typedef enum -{ - GdlSuccess = 0, /* DSP download successful */ - GdlFileReadError = 1, /* error reading Download file */ - GdlInvalidFile = 2, /* invalid Download file content */ - GdlInvalidDsp = 3 /* invalid DSP */ -} gpakDownloadStatus_t; - -/* - * gpakDownloadDsp - Download a DSP's Program and initialized Data memory. - * - * FUNCTION - * This function reads a DSP's Program and Data memory image from the - * specified file and writes the image to the DSP's memory. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakDownloadStatus_t gpakDownloadDsp( - unsigned short int DspId, // DSP identifier - GPAK_FILE_ID FileId // G.PAK download file identifier - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakReadEventFIFOMessage return status */ -typedef enum -{ - RefEventAvail = 0, /* an event was successfully read from the fifo */ - RefNoEventAvail = 1, /* no event was in the fifo */ - RefInvalidDsp = 2, /* invalid DSP identifier */ - RefInvalidEvent = 3, /* invalid event */ - RefDspCommFailure = 4 /* error communicating with DSP */ -} gpakReadEventFIFOMessageStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadEventFIFOMessage - read from the event fifo - * - * FUNCTION - * This function reads a single event from the event fifo if one is available - * - * RETURNS - * Status code indicating success or a specific error. - * - * Note: This function should be called in a loop until the return status - * indicates that the fifo is empty. - */ -extern gpakReadEventFIFOMessageStat_t gpakReadEventFIFOMessage( - unsigned short int DspId, // DSP identifier - unsigned short int *pChannelId, // pointer to channel identifier - GpakAsyncEventCode_t *pEventCode, // pointer to Event Code - GpakAsyncEventData_t *pEventData // pointer to Event Data Struct - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakPingDsp return status values */ -typedef enum -{ - PngSuccess = 0, /* DSP responded successfully */ - PngInvalidDsp = 1, /* invalid DSP identifier */ - PngDspCommFailure = 2 /* error communicating with DSP */ -} gpakPingDspStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakPingDsp - ping the DSP to see if it's alive - * - * FUNCTION - * This function checks if the DSP is still communicating with the host - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakPingDspStat_t gpakPingDsp( - unsigned short int DspId, // DSP identifier - unsigned short int *pDspSwVersion // DSP software version - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakSerialTxFixedValue return status values */ -typedef enum -{ - TfvSuccess = 0, /* operation successful */ - TfvInvalidChannel = 1, /* invalid channel identifier */ - TfvInvalidDsp = 2, /* invalid DSP identifier */ - TfvDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakSerialTxFixedValueStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakSerialTxFixedValue - transmit a fixed value on a timeslot - * - * FUNCTION - * This function controls transmission of a fixed value out onto a serial - * port's timeslot. - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakSerialTxFixedValueStat_t gpakSerialTxFixedValue( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakSerialPort_t PcmOutPort, // PCM Output Serial Port Id - unsigned short int PcmOutSlot, // PCM Output Time Slot - unsigned short int Value, // 16-bit value - GpakActivation State // activation state - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakControlTdmLoopBack return status values */ -typedef enum -{ - ClbSuccess = 0, /* operation successful */ - ClbSerPortInactive = 1, /* serial port is inactive */ - ClbInvalidDsp = 2, /* invalid DSP identifier */ - ClbDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakControlTdmLoopBackStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakControlTdmLoopBack - control a serial port's loopback state - * - * FUNCTION - * This function enables/disables the tdm input to output looback mode on a - * serial port - * - * RETURNS - * Status code indicating success or a specific error. - */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -gpakControlTdmLoopBackStat_t gpakControlTdmLoopBack( - unsigned short int DspId, // DSP identifier - GpakSerialPort_t SerialPort, // Serial Port Id - GpakActivation LoopBackState // Loopback State - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakReadCpuUsage return status values */ -typedef enum -{ - RcuSuccess = 0, /* operation successful */ - RcuInvalidDsp = 1, /* invalid DSP identifier */ - RcuDspCommFailure = 2 /* communication failure */ -} gpakReadCpuUsageStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadCpuUsage - read the cpu usage statistics - * - * FUNCTION - * This function reads cpu utilization from the DSP. - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakReadCpuUsageStat_t gpakReadCpuUsage( - unsigned short int DspId, // DSP identifier - unsigned short int *pPeakUsage, // pointer to peak usage variable - unsigned short int *pPrev1SecPeakUsage // peak usage over previous 1 second - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakResetCpuUsageStats return status values */ -typedef enum -{ - RstcSuccess = 0, /* operation successful */ - RstcInvalidDsp = 1, /* invalid DSP identifier */ - RstcDspCommFailure = 2 /* communication failure */ -} gpakResetCpuUsageStat_t; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetCpuUsageStats - reset the cpu usage statistics - * - * FUNCTION - * This function resets the cpu utilization statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakResetCpuUsageStat_t gpakResetCpuUsageStats( - unsigned short int DspId // DSP identifier - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakReadFramingStats return status values */ -typedef enum -{ - RfsSuccess = 0, /* operation successful */ - RfsInvalidDsp = 1, /* invalid DSP identifier */ - RfsDspCommFailure = 2 /* communication failure */ -} gpakReadFramingStatsStatus_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFramingStats - * - * FUNCTION - * This function reads a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakReadFramingStatsStatus_t gpakReadFramingStats( - unsigned short int DspId, // DSP identifier - unsigned short int *pFramingError1Count, // port 1 Framing error count - unsigned short int *pFramingError2Count, // port 2 Framing error count - unsigned short int *pFramingError3Count, // port 3 Framing error count - unsigned short int *pDmaStopErrorCount, // DMA-stoppage error count - unsigned short int *pDmaSlipStatsBuffer // DMA slips count - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakResetFramingStats return values */ -typedef enum -{ - RstfSuccess = 0, /* operation successful */ - RstfInvalidDsp = 1, /* invalid DSP identifier */ - RstfDspCommFailure = 2 /* communication failure */ -} gpakResetFramingStatsStatus_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetFramingStats - reset a DSP's framing interrupt statistics - * - * FUNCTION - * This function resets a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakResetFramingStatsStatus_t gpakResetFramingStats( - unsigned short int DspId // DSP identifier - ); - - -typedef enum -{ - RmmSuccess =0, - RmmInvalidDsp = 1, - RmmSizeTooBig = 2, - RmmFailure = 3, - RmmInvalidAddress = 4 - -} gpakReadDSPMemoryStat_t; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetFramingStats - read a section of DSP memory - * to get access DSP registers, since 0x00--0x60 not HPI-accessable - * - * FUNCTION - * This function resets a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ - -extern gpakReadDSPMemoryStat_t gpakReadDSPMemoryMap( - unsigned short int DspId, // Dsp Identifier - unsigned short int *pDest, // Buffer on host to hold DSP memory map - DSP_ADDRESS BufrBaseAddress, // DSP memory users want to read out - unsigned short int MemoryLength_Word16 // Length of memory section read out, unit is 16-bit word - ); - -typedef enum -{ - GPIOSuccess =0, - GPIOInvalidDsp = 1, - GPIODspCommFailure = 2 -}gpakAccessGPIOStat_t; - -extern gpakAccessGPIOStat_t gpakAccessGPIO( - unsigned short int DspId, // DSP identifier - GpakGPIOCotrol_t gpakControlGPIO,// select oeration, changeDIR/write/read - unsigned short int *pGPIOValue // pointer for the read/write value or DIR mask - ); - -/* gpakWriteSystemParms return status. */ -typedef enum -{ - WspSuccess = 0, /* System Parameters written successfully */ - WspParmError = 1, /* Write System Parms's Parameter error */ - WspInvalidDsp = 2, /* invalid DSP */ - WspDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakWriteSysParmsStatus_t; - -/* Definition of a System Parameters information structure. */ -typedef struct -{ - /* DTMF Parameters */ - short int MinSigLevel; /* 0 = Disabled, Min Sig Power Level for detection */ - short int SNRFlag; /* 0 = Disabled, relax SNR tolerances */ - short int FreqDeviation; /* 0 = Disabled, X Percent Deviation times 10 (e.g. 1.7% is entered as 17) */ - short int DtmfFwdTwist; /* 0 to 8 db */ - short int DtmfRevTwist; /* 0 to 8 db */ - - short int DtmfValidityMask; /* This flag allows users to relax the trailing conditions of the tone */ - -} GpakSystemParms_t; -/* gpakReadSystemParms return status. */ -typedef enum -{ - RspSuccess = 0, /* System Parameters read successfully */ - RspInvalidDsp = 1, /* invalid DSP */ - RspDspCommFailure = 2 /* failed to communicate with DSP */ -} gpakReadSysParmsStatus_t; - -extern gpakReadSysParmsStatus_t gpakReadSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms /* pointer to System Parms info var */ - ); - -extern gpakWriteSysParmsStatus_t gpakWriteSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms, /* pointer to System Parms info var */ - unsigned short int UpdateBits, /* input: flags indicating which parms to update */ - GPAK_SysParmsStat_t *pStatus /* pointer to Write System Parms Status */ - ); - -#endif // end multiple inclusion - diff --git a/zaptel/kernel/wctdm24xxp/GpakCust.c b/zaptel/kernel/wctdm24xxp/GpakCust.c deleted file mode 100644 index fe294589..00000000 --- a/zaptel/kernel/wctdm24xxp/GpakCust.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (c) 2005, Adaptive Digital Technologies, Inc. - * - * File Name: GpakCust.c - * - * Description: - * This file contains host system dependent functions to support generic - * G.PAK API functions. The file is integrated into the host processor - * connected to C55x G.PAK DSPs via a Host Port Interface. - * - * Note: This file needs to be modified by the G.PAK system integrator. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif - -#include "zaptel.h" -#include "wctdm24xxp.h" -#include "GpakCust.h" - -char vpm150mtone_to_zaptone(GpakToneCodes_t tone) -{ - switch (tone) { - case DtmfDigit0: - return '0'; - case DtmfDigit1: - return '1'; - case DtmfDigit2: - return '2'; - case DtmfDigit3: - return '3'; - case DtmfDigit4: - return '4'; - case DtmfDigit5: - return '5'; - case DtmfDigit6: - return '6'; - case DtmfDigit7: - return '7'; - case DtmfDigit8: - return '8'; - case DtmfDigit9: - return '9'; - case DtmfDigitPnd: - return '#'; - case DtmfDigitSt: - return '*'; - case DtmfDigitA: - return 'A'; - case DtmfDigitB: - return 'B'; - case DtmfDigitC: - return 'C'; - case DtmfDigitD: - return 'D'; - case EndofCngDigit: - return 'f'; - default: - return 0; - } -} - -static inline struct wctdm * wc_find_iface(unsigned short dspid) -{ - int i; - struct wctdm *ret = NULL; - unsigned long flags; - - spin_lock_irqsave(&ifacelock, flags); - for (i = 0; i < WC_MAX_IFACES; i++) - if (ifaces[i] && ifaces[i]->vpm150m && (ifaces[i]->vpm150m->dspid == dspid)) - ret = ifaces[i]; - spin_unlock_irqrestore(&ifacelock, flags); - - return ret; -} - -static inline struct vpm150m_cmd * vpm150m_empty_slot(struct wctdm *wc) -{ - int x; - - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) - if (!wc->vpm150m->cmdq[x].desc) { - return &wc->vpm150m->cmdq[x]; - } - return NULL; -} - -/* Wait for any outstanding commands to be completed. */ -static inline int vpm150m_io_wait(struct wctdm *wc) -{ - int x; - int ret=0; - for (x=0; x < VPM150M_MAX_COMMANDS;) { - if (wc->vpm150m->cmdq[x].desc) { - if ((ret=schluffen(&wc->regq))) { - return ret; - } - x=0; - } - else { - ++x; - } - } - return ret; -} - -int wctdm_vpm150m_getreg_full_async(struct wctdm *wc, int pagechange, unsigned int len, - unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p) -{ - int ret=0; - unsigned long flags; - BUG_ON(!hit_p); - spin_lock_irqsave(&wc->reglock, flags); - (*hit_p) = vpm150m_empty_slot(wc); - if (*hit_p) { - (*hit_p)->desc = __VPM150M_RD; - if (pagechange) { - (*hit_p)->desc |= __VPM150M_RWPAGE; - } - (*hit_p)->datalen = len; - (*hit_p)->addr = addr; - memset((*hit_p)->data, 0, len*sizeof(outbuf[0])); - } - else { - ret = -EBUSY; - } - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -int wctdm_vpm150m_getreg_full_return(struct wctdm *wc, int pagechange, unsigned int len, - unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p) -{ - int ret = 0; - unsigned long flags; - BUG_ON(!hit_p); - spin_lock_irqsave(&wc->reglock, flags); - do { - if ((*hit_p)->desc & __VPM150M_FIN) { - memcpy(outbuf, (*hit_p)->data, len*(sizeof(outbuf[0]))); - (*hit_p)->desc = 0; - (*hit_p) = NULL; - ret = 0; - } - else { - spin_unlock_irqrestore(&wc->reglock, flags); - if ((ret=schluffen(&wc->regq))) { - return ret; - } - spin_lock_irqsave(&wc->reglock, flags); - ret = -EBUSY; - } - } while (-EBUSY == ret); - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -int wctdm_vpm150m_getreg_full(struct wctdm *wc, int pagechange, unsigned int len, unsigned short addr, unsigned short *outbuf) -{ - struct vpm150m_cmd *hit = 0; - int ret = 0; - do { - ret = wctdm_vpm150m_getreg_full_async(wc, pagechange, len, addr, outbuf, &hit); - if (!hit) { - if ( -EBUSY == ret ) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - BUG_ON(0 != ret); - } - } while (!hit); - ret = wctdm_vpm150m_getreg_full_return(wc, pagechange, len, addr, outbuf, &hit); - return ret; -} - -int wctdm_vpm150m_setreg_full(struct wctdm *wc, int pagechange, unsigned int len, unsigned int addr, unsigned short *data) -{ - unsigned long flags; - struct vpm150m_cmd *hit; - int ret, i; - do { - spin_lock_irqsave(&wc->reglock, flags); - hit = vpm150m_empty_slot(wc); - if (hit) { - hit->desc = __VPM150M_WR; - if (pagechange) - hit->desc |= __VPM150M_RWPAGE; - hit->addr = addr; - hit->datalen = len; - for (i = 0; i < len; i++) - hit->data[i] = data[i]; - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (!hit) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (!hit); - return (hit) ? 0 : -1; -} - -int wctdm_vpm150m_setpage(struct wctdm *wc, unsigned short addr) -{ - addr &= 0xf; - /* Let's optimize this a little bit */ - if (wc->vpm150m->curpage == addr) - return 0; - else { - wc->vpm150m->curpage = addr; - } - - return wctdm_vpm150m_setreg_full(wc, 1, 1, 0, &addr); -} - -unsigned char wctdm_vpm150m_getpage(struct wctdm *wc) -{ - unsigned short res; - wctdm_vpm150m_getreg_full(wc, 1, 1, 0, &res); - return res; -} - -unsigned short wctdm_vpm150m_getreg(struct wctdm *wc, unsigned int len, unsigned int addr, unsigned short *data) -{ - unsigned short res; - wctdm_vpm150m_setpage(wc, addr >> 16); - if ((addr >> 16) != ((addr + len) >> 16)) - printk("getreg: You found it!\n"); - res = wctdm_vpm150m_getreg_full(wc, 0, len, addr & 0xffff, data); - return res; -} - -int wctdm_vpm150m_setreg(struct wctdm *wc, unsigned int len, unsigned int addr, unsigned short *data) -{ - int res; - wctdm_vpm150m_setpage(wc, addr >> 16); - if ((addr >> 16) != ((addr + len) >> 16)) - printk("getreg: You found it!\n"); - res = wctdm_vpm150m_setreg_full(wc, 0, len, addr & 0xffff, data); - return res; -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadDspMemory - Read DSP memory. - * - * FUNCTION - * This function reads a contiguous block of words from DSP memory starting at - * the specified address. - * - * RETURNS - * nothing - * - */ -void gpakReadDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to read */ - DSP_WORD *pWordValues /* pointer to array of word values variable */ - ) -{ - struct wctdm *wc = wc_find_iface(DspId); - int i; - int transcount; - int ret; - - vpm150m_io_wait(wc); - if ( NumWords < VPM150M_MAX_COMMANDS ) { - struct vpm150m_cmd* cmds[VPM150M_MAX_COMMANDS] = {0}; - wctdm_vpm150m_setpage(wc, DspAddress >> 16); - DspAddress &= 0xffff; - for (i=0; i < NumWords; ++i) { - ret = wctdm_vpm150m_getreg_full_async(wc,0,1,DspAddress+i,&pWordValues[i], - &cmds[i]); - if (0 != ret) { - return; - } - } - for (i=NumWords-1; i >=0; --i) { - ret = wctdm_vpm150m_getreg_full_return(wc,0,1,DspAddress+i,&pWordValues[i], - &cmds[i]); - if (0 != ret) { - return; - } - } - } - else { - for (i = 0; i < NumWords;) { - if ((NumWords - i) > VPM150M_MAX_DATA) - transcount = VPM150M_MAX_DATA; - else - transcount = NumWords - i; - wctdm_vpm150m_getreg(wc, transcount, DspAddress + i, &pWordValues[i]); - i += transcount; - } - } - return; -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakWriteDspMemory - Write DSP memory. - * - * FUNCTION - * This function writes a contiguous block of words to DSP memory starting at - * the specified address. - * - * RETURNS - * nothing - * - */ -void gpakWriteDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to write */ - DSP_WORD *pWordValues /* pointer to array of word values to write */ - ) -{ - - struct wctdm *wc = wc_find_iface(DspId); - int i; - int transcount; - - //printk("Writing %d words to memory\n", NumWords); - if (wc && wc->vpm150m) { - for (i = 0; i < NumWords;) { - if ((NumWords - i) > VPM150M_MAX_DATA) - transcount = VPM150M_MAX_DATA; - else - transcount = NumWords - i; - - wctdm_vpm150m_setreg(wc, transcount, DspAddress + i, &pWordValues[i]); - i += transcount; - } -#if 0 - for (i = 0; i < NumWords; i++) { - if (wctdm_vpm150m_getreg(wc, DspAddress + i) != pWordValues[i]) { - printk("Error in write. Address %x is not %x\n", DspAddress + i, pWordValues[i]); - } - } -#endif - } - return; - -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakHostDelay - Delay for a fixed time interval. - * - * FUNCTION - * This function delays for a fixed time interval before returning. The time - * interval is the Host Port Interface sampling period when polling a DSP for - * replies to command messages. - * - * RETURNS - * nothing - * - */ -void gpakHostDelay(void) -{ -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakLockAccess - Lock access to the specified DSP. - * - * FUNCTION - * This function aquires exclusive access to the specified DSP. - * - * RETURNS - * nothing - * - */ -void gpakLockAccess(unsigned short DspId) -{ - struct wctdm *wc; - - wc = wc_find_iface(DspId); - - if (wc) { - struct vpm150m *vpm = wc->vpm150m; - - if (vpm) - down_interruptible(&vpm->sem); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakUnlockAccess - Unlock access to the specified DSP. - * - * FUNCTION - * This function releases exclusive access to the specified DSP. - * - * RETURNS - * nothing - * - */ -void gpakUnlockAccess(unsigned short DspId) -{ - struct wctdm *wc; - - wc = wc_find_iface(DspId); - - if (wc) { - struct vpm150m *vpm = wc->vpm150m; - - if (vpm) - up(&vpm->sem); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFile - Read a block of bytes from a G.PAK Download file. - * - * FUNCTION - * This function reads a contiguous block of bytes from a G.PAK Download file - * starting at the current file position. - * - * RETURNS - * The number of bytes read from the file. - * -1 indicates an error occurred. - * 0 indicates all bytes have been read (end of file) - * - */ -int gpakReadFile( - GPAK_FILE_ID FileId, /* G.PAK Download File Identifier */ - unsigned char *pBuffer, /* pointer to buffer for storing bytes */ - unsigned int NumBytes /* number of bytes to read */ - ) -{ -#ifdef VPM150M_SUPPORT - struct wctdm_firmware *fw = FileId; - unsigned int i, count; - - if (!fw || !fw->fw) - return -1; - - if (NumBytes > (fw->fw->size - fw->offset)) - count = fw->fw->size - fw->offset; - else - count = NumBytes; - - for (i = 0; i < count; i++) - pBuffer[i] = fw->fw->data[fw->offset + i]; - - fw->offset += count; - - return count; -#endif -} diff --git a/zaptel/kernel/wctdm24xxp/GpakCust.h b/zaptel/kernel/wctdm24xxp/GpakCust.h deleted file mode 100644 index 6ac2088a..00000000 --- a/zaptel/kernel/wctdm24xxp/GpakCust.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2005, Adaptive Digital Technologies, Inc. - * - * File Name: GpakCust.h - * - * Description: - * This file contains host system dependent definitions and prototypes of - * functions to support generic G.PAK API functions. The file is used when - * integrating G.PAK API functions in a specific host processor environment. - * - * Note: This file may need to be modified by the G.PAK system integrator. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKCUST_H /* prevent multiple inclusion */ -#define _GPAKCUST_H - -#include "wctdm24xxp.h" -#ifdef VPM150M_SUPPORT -#include -#include -#endif -#include "gpakenum.h" - - -struct wctdm_firmware { - const struct firmware *fw; - unsigned int offset; -}; - -/* Host and DSP system dependent related definitions. */ -#define MAX_DSP_CORES 128 /* maximum number of DSP cores */ -//#define MAX_CONFS 1 /* maximum number of conferences */ -//#define MAX_PKT_CHANNELS 8 /* maximum number of packet channels */ -#define MAX_CHANNELS 32 /* maximum number of channels */ -#define MAX_WAIT_LOOPS 50 /* max number of wait delay loops */ -#define DSP_IFBLK_ADDRESS 0x0100 /* DSP address of I/F block pointer */ -#define DOWNLOAD_BLOCK_SIZE 512 /* download block size (DSP words) */ -//#define MAX_CIDPAYLOAD_BYTES 512 /* max size of a CID payload (octets) */ -typedef unsigned short DSP_WORD; /* 16 bit DSP word */ -typedef unsigned int DSP_ADDRESS; /* 32 bit DSP address */ -typedef struct wctdm_firmware* GPAK_FILE_ID; /* G.PAK Download file identifier */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadDspMemory - Read DSP memory. - * - * FUNCTION - * This function reads a contiguous block of words from DSP memory starting at - * the specified address. - * - * RETURNS - * nothing - * - */ -extern void gpakReadDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to read */ - DSP_WORD *pWordValues /* pointer to array of word values variable */ - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakWriteDspMemory - Write DSP memory. - * - * FUNCTION - * This function writes a contiguous block of words to DSP memory starting at - * the specified address. - * - * RETURNS - * nothing - * - */ -extern void gpakWriteDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to write */ - DSP_WORD *pWordValues /* pointer to array of word values to write */ - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakHostDelay - Delay for a fixed time interval. - * - * FUNCTION - * This function delays for a fixed time interval before returning. The time - * interval is the Host Port Interface sampling period when polling a DSP for - * replies to command messages. - * - * RETURNS - * nothing - * - */ -extern void gpakHostDelay(void); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakLockAccess - Lock access to the specified DSP. - * - * FUNCTION - * This function aquires exclusive access to the specified DSP. - * - * RETURNS - * nothing - * - */ -extern void gpakLockAccess( - unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakUnlockAccess - Unlock access to the specified DSP. - * - * FUNCTION - * This function releases exclusive access to the specified DSP. - * - * RETURNS - * nothing - * - */ -extern void gpakUnlockAccess( - unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFile - Read a block of bytes from a G.PAK Download file. - * - * FUNCTION - * This function reads a contiguous block of bytes from a G.PAK Download file - * starting at the current file position. - * - * RETURNS - * The number of bytes read from the file. - * -1 indicates an error occurred. - * 0 indicates all bytes have been read (end of file) - * - */ -extern int gpakReadFile( - GPAK_FILE_ID FileId, /* G.PAK Download File Identifier */ - unsigned char *pBuffer, /* pointer to buffer for storing bytes */ - unsigned int NumBytes /* number of bytes to read */ - ); - - -unsigned char wctdm_vpm150m_getpage(struct wctdm *wc); - -int wctdm_vpm150m_setpage(struct wctdm *wc, unsigned short addr); - -int wctdm_vpm150m_setreg(struct wctdm *wc, unsigned int len, unsigned int addr, unsigned short *data); - -unsigned short wctdm_vpm150m_getreg(struct wctdm *wc, unsigned int len, unsigned int addr, unsigned short *data); - -char vpm150mtone_to_zaptone(GpakToneCodes_t tone); - -#endif /* prevent multiple inclusion */ - - diff --git a/zaptel/kernel/wctdm24xxp/GpakHpi.h b/zaptel/kernel/wctdm24xxp/GpakHpi.h deleted file mode 100644 index 7a07cac2..00000000 --- a/zaptel/kernel/wctdm24xxp/GpakHpi.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2001, Adaptive Digital Technologies, Inc. - * - * File Name: GpakHpi.h - * - * Description: - * This file contains common definitions related to the G.PAK interface - * between a host processor and a DSP processor via the Host Port Interface. - * - * Version: 1.0 - * - * Revision History: - * 10/17/01 - Initial release. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKHPI_H /* prevent multiple inclusion */ -#define _GPAKHPI_H - - -/* Definition of G.PAK Command/Reply message type codes. */ -#define MSG_NULL_REPLY 0 /* Null Reply (unsupported Command) */ -#define MSG_SYS_CONFIG_RQST 1 /* System Configuration Request */ -#define MSG_SYS_CONFIG_REPLY 2 /* System Configuration Reply */ -#define MSG_READ_SYS_PARMS 3 /* Read System Parameters */ -#define MSG_READ_SYS_PARMS_REPLY 4 /* Read System Parameters Reply */ -#define MSG_WRITE_SYS_PARMS 5 /* Write System Parameters */ -#define MSG_WRITE_SYS_PARMS_REPLY 6 /* Write System Parameters Reply */ -#define MSG_CONFIGURE_PORTS 7 /* Configure Serial Ports */ -#define MSG_CONFIG_PORTS_REPLY 8 /* Configure Serial Ports Reply */ -#define MSG_CONFIGURE_CHANNEL 9 /* Configure Channel */ -#define MSG_CONFIG_CHAN_REPLY 10 /* Configure Channel Reply */ -#define MSG_TEAR_DOWN_CHANNEL 11 /* Tear Down Channel */ -#define MSG_TEAR_DOWN_REPLY 12 /* Tear Down Channel Reply */ -#define MSG_CHAN_STATUS_RQST 13 /* Channel Status Request */ -#define MSG_CHAN_STATUS_REPLY 14 /* Channel Status Reply */ - -#define MSG_TEST_MODE 17 /* Configure/Perform Test Mode */ -#define MSG_TEST_REPLY 18 /* Configure/Perform Test Mode Reply */ - -#define MSG_ALG_CONTROL 27 /* algorithm control */ -#define MSG_ALG_CONTROL_REPLY 28 /* algorithm control reply */ -#define MSG_GET_TXCID_ADDRESS 29 /* get tx cid buffer start address */ -#define MSG_GET_TXCID_ADDRESS_REPLY 30 /* get tx cid buffer start addr reply */ - -#define MSG_PING 35 /* ping command */ -#define MSG_PING_REPLY 36 /* ping command reply */ -#define MSG_SERIAL_TXVAL 37 /* transmit serial fixed value */ -#define MSG_SERIAL_TXVAL_REPLY 38 /* transmit serial fixed value reply */ -#define MSG_TDM_LOOPBACK 39 /* tdm loopback control */ -#define MSG_TDM_LOOPBACK_REPLY 40 /* tdm loopback control reply */ -#define MSG_RESET_USAGE_STATS 41 /* reset cpu usage stats */ -#define MSG_RESET_USAGE_STATS_REPLY 42 /* reset cpu usage stats reply */ - -#define MSG_RESET_FRAME_STATS 47 /* reset framing stats */ -#define MSG_RESET_FRAME_STATS_REPLY 48 /* reset framing stats reply */ - -#define MSG_READ_DSP_MEMORY 49 /* read small section of DSP's memory */ -#define MSG_READ_DSP_MEMORY_REPLY 50 /* read memory reply */ - -#define MSG_ACCESSGPIO 51 -#define MSG_ACCESSGPIO_REPLY 52 -#endif /* prevent multiple inclusion */ diff --git a/zaptel/kernel/wctdm24xxp/Kbuild b/zaptel/kernel/wctdm24xxp/Kbuild deleted file mode 100644 index bfa35138..00000000 --- a/zaptel/kernel/wctdm24xxp/Kbuild +++ /dev/null @@ -1,25 +0,0 @@ -obj-m += wctdm24xxp.o - -FIRM_DIR := ../../firmware - -EXTRA_CFLAGS := -I$(src)/.. -Wno-undef - -ifeq ($(HOTPLUG_FIRMWARE),yes) - EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE -endif - -wctdm24xxp-objs := base.o GpakCust.o GpakApi.o voicebus.o - -ifneq ($(HOTPLUG_FIRMWARE),yes) -wctdm24xxp-objs += $(FIRM_DIR)/zaptel-fw-vpmadt032.o -endif - -$(obj)/$(FIRM_DIR)/zaptel-fw-vpmadt032.o: $(obj)/base.o - $(MAKE) -C $(obj)/$(FIRM_DIR) zaptel-fw-vpmadt032.o - -$(obj)/base.o: $(src)/GpakCust.h $(src)/wctdm24xxp.h -$(obj)/base.o: $(src)/../zaptel.h - -$(obj)/GpakCust.o: $(src)/GpakCust.h - -$(obj)/GpakApi.o: $(src)/GpakApi.h diff --git a/zaptel/kernel/wctdm24xxp/Makefile b/zaptel/kernel/wctdm24xxp/Makefile deleted file mode 100644 index 9c4cd514..00000000 --- a/zaptel/kernel/wctdm24xxp/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -ifneq ($(KBUILD_EXTMOD),) -# We only get here on kernels 2.6.0-2.6.9 . -# For newer kernels, Kbuild will be included directly by the kernel -# build system. -include $(src)/Kbuild - -else - -all: wctdm24xxp.o - -%.o: %.c - $(CC) $(KFLAGS) -o $@ -c $< - -base.o: ../zaptel.h GpakCust.h ../wctdm.h - -GpakCust.o: GpakCust.h - -../firmware/zaptel-fw-vpmadt032.o: base.o - $(MAKE) -C ../firmware zaptel-fw-vpmadt032.o - -wctdm24xxp.o: base.o GpakCust.o GpakApi.o ../firmware/zaptel-fw-vpmadt032.o - $(LD) -r -o $@ $^ - -clean: - rm -f *.o - -endif diff --git a/zaptel/kernel/wctdm24xxp/base.c b/zaptel/kernel/wctdm24xxp/base.c deleted file mode 100644 index 82a60510..00000000 --- a/zaptel/kernel/wctdm24xxp/base.c +++ /dev/null @@ -1,4167 +0,0 @@ -/* - * Wildcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface - * - * Written by Mark Spencer - * Support for TDM800P and VPM150M by Matthew Fredrickson - * - * Copyright (C) 2005 - 2008 Digium, Inc. - * All rights reserved. - * - * Sections for QRV cards written by Jim Dixon - * Copyright (C) 2006, Jim Dixon and QRV Communications - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* For QRV DRI cards, gain is signed short, expressed in hundredths of -db (in reference to 1v Peak @ 1000Hz) , as follows: - -Rx Gain: -11.99 to 15.52 db -Tx Gain - No Pre-Emphasis: -35.99 to 12.00 db -Tx Gain - W/Pre-Emphasis: -23.99 to 0.00 db -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif - -#ifdef LINUX26 -#include -#endif - -#include "zaptel.h" -#include "proslic.h" -#include "wctdm.h" - -#include "wctdm24xxp.h" - -#ifdef VPM150M_SUPPORT -#include "adt_lec.h" -#endif - -#include "GpakCust.h" -#include "GpakApi.h" - -/* - Experimental max loop current limit for the proslic - Loop current limit is from 20 mA to 41 mA in steps of 3 - (according to datasheet) - So set the value below to: - 0x00 : 20mA (default) - 0x01 : 23mA - 0x02 : 26mA - 0x03 : 29mA - 0x04 : 32mA - 0x05 : 35mA - 0x06 : 37mA - 0x07 : 41mA -*/ -static int loopcurrent = 20; - -static alpha indirect_regs[] = -{ -{0,255,"DTMF_ROW_0_PEAK",0x55C2}, -{1,255,"DTMF_ROW_1_PEAK",0x51E6}, -{2,255,"DTMF_ROW2_PEAK",0x4B85}, -{3,255,"DTMF_ROW3_PEAK",0x4937}, -{4,255,"DTMF_COL1_PEAK",0x3333}, -{5,255,"DTMF_FWD_TWIST",0x0202}, -{6,255,"DTMF_RVS_TWIST",0x0202}, -{7,255,"DTMF_ROW_RATIO_TRES",0x0198}, -{8,255,"DTMF_COL_RATIO_TRES",0x0198}, -{9,255,"DTMF_ROW_2ND_ARM",0x0611}, -{10,255,"DTMF_COL_2ND_ARM",0x0202}, -{11,255,"DTMF_PWR_MIN_TRES",0x00E5}, -{12,255,"DTMF_OT_LIM_TRES",0x0A1C}, -{13,0,"OSC1_COEF",0x7B30}, -{14,1,"OSC1X",0x0063}, -{15,2,"OSC1Y",0x0000}, -{16,3,"OSC2_COEF",0x7870}, -{17,4,"OSC2X",0x007D}, -{18,5,"OSC2Y",0x0000}, -{19,6,"RING_V_OFF",0x0000}, -{20,7,"RING_OSC",0x7EF0}, -{21,8,"RING_X",0x0160}, -{22,9,"RING_Y",0x0000}, -{23,255,"PULSE_ENVEL",0x2000}, -{24,255,"PULSE_X",0x2000}, -{25,255,"PULSE_Y",0x0000}, -//{26,13,"RECV_DIGITAL_GAIN",0x4000}, // playback volume set lower -{26,13,"RECV_DIGITAL_GAIN",0x2000}, // playback volume set lower -{27,14,"XMIT_DIGITAL_GAIN",0x4000}, -//{27,14,"XMIT_DIGITAL_GAIN",0x2000}, -{28,15,"LOOP_CLOSE_TRES",0x1000}, -{29,16,"RING_TRIP_TRES",0x3600}, -{30,17,"COMMON_MIN_TRES",0x1000}, -{31,18,"COMMON_MAX_TRES",0x0200}, -{32,19,"PWR_ALARM_Q1Q2",0x07C0}, -{33,20,"PWR_ALARM_Q3Q4", 0x4C00 /* 0x2600 */}, -{34,21,"PWR_ALARM_Q5Q6",0x1B80}, -{35,22,"LOOP_CLOSURE_FILTER",0x8000}, -{36,23,"RING_TRIP_FILTER",0x0320}, -{37,24,"TERM_LP_POLE_Q1Q2",0x008C}, -{38,25,"TERM_LP_POLE_Q3Q4",0x0100}, -{39,26,"TERM_LP_POLE_Q5Q6",0x0010}, -{40,27,"CM_BIAS_RINGING",0x0C00}, -{41,64,"DCDC_MIN_V",0x0C00}, -{42,255,"DCDC_XTRA",0x1000}, -{43,66,"LOOP_CLOSE_TRES_LOW",0x1000}, -}; - -#ifdef FANCY_ECHOCAN -static char ectab[] = { -0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24, 25, 27, 28, 29, 30, 31, 31, 32, -32, 32, 32, 32, 32, 32, 32, 32, 32, 32 ,32 ,32, 32, -32, 32, 32, 32, 32, 32, 32, 32, 32, 32 ,32 ,32, 32, -32, 32, 32, 32, 32, 32, 32, 32, 32, 32 ,32 ,32, 32, -31, 31, 30, 29, 28, 27, 25, 23, 22, 20, 18, 16, 13, 11, 9, 8, 6, 4, 3, 2, 1, 0, 0, -}; -static int ectrans[4] = { 0, 1, 3, 2 }; -#define EC_SIZE (sizeof(ectab)) -#define EC_SIZE_Q (sizeof(ectab) / 4) -#endif - -/* Undefine to enable Power alarm / Transistor debug -- note: do not - enable for normal operation! */ -/* #define PAQ_DEBUG */ - -#define DEBUG_CARD (1 << 0) -#define DEBUG_ECHOCAN (1 << 1) - -#include "fxo_modes.h" - -struct wctdm_desc { - char *name; - int flags; - int ports; -}; - -static struct wctdm_desc wctdm2400 = { "Wildcard TDM2400P", 0, 24 }; -static struct wctdm_desc wctdm800 = { "Wildcard TDM800P", 0, 8 }; -static struct wctdm_desc wctdm410 = { "Wildcard TDM410P", 0, 4 }; -static struct wctdm_desc wcaex2400 = { "Wildcard AEX2400", FLAG_EXPRESS, 24 }; -static struct wctdm_desc wcaex800 = { "Wildcard AEX800", FLAG_EXPRESS, 8 }; -static struct wctdm_desc wcaex410 = { "Wildcard AEX410", FLAG_EXPRESS, 4 }; - -static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 }; - -struct wctdm *ifaces[WC_MAX_IFACES]; -spinlock_t ifacelock = SPIN_LOCK_UNLOCKED; - -static void wctdm_release(struct wctdm *wc); - -static int fxovoltage = 0; -static unsigned int battdebounce; -static unsigned int battalarm; -static unsigned int battthresh; -static int debug = 0; -static int robust = 0; -static int lowpower = 0; -static int boostringer = 0; -static int fastringer = 0; -static int _opermode = 0; -static char *opermode = "FCC"; -static int fxshonormode = 0; -static int alawoverride = 0; -static int fxo_addrs[4] = { 0x00, 0x08, 0x04, 0x0c }; -static int fxotxgain = 0; -static int fxorxgain = 0; -static int fxstxgain = 0; -static int fxsrxgain = 0; -static int nativebridge = 0; -static int ringdebounce = DEFAULT_RING_DEBOUNCE; -static int fwringdetect = 0; -static int latency = VOICEBUS_DEFAULT_LATENCY; - -#define MS_PER_HOOKCHECK (1) -#define NEONMWI_ON_DEBOUNCE (100/MS_PER_HOOKCHECK) - -static int neonmwi_monitor = 0; /* Note: this causes use of full wave ring detect */ -static int neonmwi_level = 75; /* neon mwi trip voltage */ -static int neonmwi_envelope = 10; -static int neonmwi_offlimit = 16000; /* Time in milliseconds the monitor is checked before saying no message is waiting */ - -static int neonmwi_offlimit_cycles; /* Time in milliseconds the monitor is checked before saying no message is waiting */ - -#ifdef VPM_SUPPORT -static int vpmsupport = 1; -static int vpmdtmfsupport = 0; -#define VPM_DEFAULT_DTMFTHRESHOLD 1250 -static int dtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD; -/* - * This parameter is used to adjust the NLP type used. The options are: - * 0 : None - * 1 : Mute - * 2 : Random Noise - * 3 : Hoth Noise - * 4 : Suppression NLP - In order to use this, you must set the vpmnlpmaxsupp parameter to - * some value in order to give the amount of dB to suppress to the suppressor - */ -static int vpmnlptype = 1; -/* This is the threshold (in dB) for enabling and disabling of the NLP */ -static int vpmnlpthresh = 24; -/* See vpmnlptype = 4 for more info */ -static int vpmnlpmaxsupp = 0; -#endif - -static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane); - -static inline int CMD_BYTE(int card, int bit, int altcs) -{ - /* Let's add some trickery to make the TDM410 work */ - if (altcs == 3) { - if (card == 2) { - card = 4; - altcs = 0; - } else if (card == 3) { - card = 5; - altcs = 2; - } - } - - return (((((card) & 0x3) * 3 + (bit)) * 7) \ - + ((card) >> 2) + (altcs) + ((altcs) ? -21 : 0)); -} - -/* sleep in user space until woken up. Equivilant of tsleep() in BSD */ -int schluffen(wait_queue_head_t *q) -{ - DECLARE_WAITQUEUE(wait, current); - add_wait_queue(q, &wait); - current->state = TASK_INTERRUPTIBLE; - if (!signal_pending(current)) schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(q, &wait); - if (signal_pending(current)) return -ERESTARTSYS; - return(0); -} - -static inline int empty_slot(struct wctdm *wc, int card) -{ - int x; - for (x=0;xcmdq[card].cmds[x]) - return x; - } - return -1; -} - -#ifdef VPM_SUPPORT -static inline void cmd_dequeue_vpm150m(struct wctdm *wc, volatile unsigned char *writechunk, int whichframe) -{ - unsigned long flags; - struct vpm150m_cmd *curcmd = NULL; - struct vpm150m *vpm150m = wc->vpm150m; - int x; - unsigned char leds = ~((wc->intcount / 1000) % 8) & 0x7; - - /* Skip audio */ - writechunk += 24; - - spin_lock_irqsave(&wc->reglock, flags); - - if (test_bit(VPM150M_SPIRESET, &vpm150m->control) || test_bit(VPM150M_HPIRESET, &vpm150m->control)) { - if (debug & DEBUG_ECHOCAN) - printk("HW Resetting VPMADT032...\n"); - for (x = 24; x < 28; x++) { - if (x == 24) { - if (test_and_clear_bit(VPM150M_SPIRESET, &vpm150m->control)) - writechunk[CMD_BYTE(x, 0, 0)] = 0x08; - else if (test_and_clear_bit(VPM150M_HPIRESET, &vpm150m->control)) - writechunk[CMD_BYTE(x, 0, 0)] = 0x0b; - } else - writechunk[CMD_BYTE(x, 0, 0)] = 0x00 | leds; - writechunk[CMD_BYTE(x, 1, 0)] = 0; - writechunk[CMD_BYTE(x, 2, 0)] = 0x00; - } - spin_unlock_irqrestore(&wc->reglock, flags); - return; - } - - - /* Search for something waiting to transmit */ - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) { - if ((vpm150m->cmdq[x].desc & (__VPM150M_RD | __VPM150M_WR)) && - !(vpm150m->cmdq[x].desc & (__VPM150M_FIN | __VPM150M_TX))) { - curcmd = &vpm150m->cmdq[x]; - curcmd->txident = wc->txident; - curcmd->desc |= __VPM150M_TX; - break; - } - } - if (curcmd) { -#if 0 - printk("Found command txident = %d, desc = 0x%x, addr = 0x%x, data = 0x%x\n", curcmd->txident, curcmd->desc, curcmd->addr, curcmd->data); -#endif - if (curcmd->desc & __VPM150M_RWPAGE) { - /* Set CTRL access to page*/ - writechunk[CMD_BYTE(24, 0, 0)] = (0x8 << 4); - writechunk[CMD_BYTE(24, 1, 0)] = 0; - writechunk[CMD_BYTE(24, 2, 0)] = 0x20; - - /* Do a page write */ - if (curcmd->desc & __VPM150M_WR) - writechunk[CMD_BYTE(25, 0, 0)] = ((0x8 | 0x4) << 4); - else - writechunk[CMD_BYTE(25, 0, 0)] = ((0x8 | 0x4 | 0x1) << 4); - writechunk[CMD_BYTE(25, 1, 0)] = 0; - if (curcmd->desc & __VPM150M_WR) - writechunk[CMD_BYTE(25, 2, 0)] = curcmd->data[0] & 0xf; - else - writechunk[CMD_BYTE(25, 2, 0)] = 0; - - /* Clear XADD */ - writechunk[CMD_BYTE(26, 0, 0)] = (0x8 << 4); - writechunk[CMD_BYTE(26, 1, 0)] = 0; - writechunk[CMD_BYTE(26, 2, 0)] = 0; - - /* Fill in to buffer to size */ - writechunk[CMD_BYTE(27, 0, 0)] = 0; - writechunk[CMD_BYTE(27, 1, 0)] = 0; - writechunk[CMD_BYTE(27, 2, 0)] = 0; - - } else { - /* Set address */ - writechunk[CMD_BYTE(24, 0, 0)] = ((0x8 | 0x4) << 4); - writechunk[CMD_BYTE(24, 1, 0)] = (curcmd->addr >> 8) & 0xff; - writechunk[CMD_BYTE(24, 2, 0)] = curcmd->addr & 0xff; - - /* Send/Get our data */ - if (curcmd->desc & __VPM150M_WR) { - if (curcmd->datalen > 1) - writechunk[CMD_BYTE(25, 0, 0)] = ((0x8 | (0x1 << 1)) << 4); - else - writechunk[CMD_BYTE(25, 0, 0)] = ((0x8 | (0x3 << 1)) << 4); - } else - if (curcmd->datalen > 1) - writechunk[CMD_BYTE(25, 0, 0)] = ((0x8 | (0x1 << 1) | 0x1) << 4); - else - writechunk[CMD_BYTE(25, 0, 0)] = ((0x8 | (0x3 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(25, 1, 0)] = (curcmd->data[0] >> 8) & 0xff; - writechunk[CMD_BYTE(25, 2, 0)] = curcmd->data[0] & 0xff; - - if (curcmd->datalen > 1) { - if (curcmd->desc & __VPM150M_WR) - writechunk[CMD_BYTE(26, 0, 0)] = ((0x8 | (0x1 << 1)) << 4); - else - writechunk[CMD_BYTE(26, 0, 0)] = ((0x8 | (0x1 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(26, 1, 0)] = (curcmd->data[1] >> 8) & 0xff; - writechunk[CMD_BYTE(26, 2, 0)] = curcmd->data[1] & 0xff; - } else { - /* Fill in the rest */ - writechunk[CMD_BYTE(26, 0, 0)] = 0; - writechunk[CMD_BYTE(26, 1, 0)] = 0; - writechunk[CMD_BYTE(26, 2, 0)] = 0; - } - - if (curcmd->datalen > 2) { - if (curcmd->desc & __VPM150M_WR) - writechunk[CMD_BYTE(27, 0, 0)] = ((0x8 | (0x1 << 1)) << 4); - else - writechunk[CMD_BYTE(27, 0, 0)] = ((0x8 | (0x1 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(27, 1, 0)] = (curcmd->data[2] >> 8) & 0xff; - writechunk[CMD_BYTE(27, 2, 0)] = curcmd->data[2] & 0xff; - } else { - /* Fill in the rest */ - writechunk[CMD_BYTE(27, 0, 0)] = 0; - writechunk[CMD_BYTE(27, 1, 0)] = 0; - writechunk[CMD_BYTE(27, 2, 0)] = 0; - } - - - } - } else if (test_and_clear_bit(VPM150M_SWRESET, &vpm150m->control)) { - printk("Booting VPMADT032\n"); - for (x = 24; x < 28; x++) { - if (x == 24) - writechunk[CMD_BYTE(x, 0, 0)] = (0x8 << 4); - else - writechunk[CMD_BYTE(x, 0, 0)] = 0x00; - writechunk[CMD_BYTE(x, 1, 0)] = 0; - if (x == 24) - writechunk[CMD_BYTE(x, 2, 0)] = 0x01; - else - writechunk[CMD_BYTE(x, 2, 0)] = 0x00; - } - } else { - for (x = 24; x < 28; x++) { - writechunk[CMD_BYTE(x, 0, 0)] = 0x00; - writechunk[CMD_BYTE(x, 1, 0)] = 0x00; - writechunk[CMD_BYTE(x, 2, 0)] = 0x00; - } - } - -#ifdef VPM150M_SUPPORT - /* Add our leds in */ - for (x = 24; x < 28; x++) - writechunk[CMD_BYTE(x, 0, 0)] |= leds; - - /* Now let's figure out if we need to check for DTMF */ - if (test_bit(VPM150M_ACTIVE, &vpm150m->control) && !whichframe && !(wc->intcount % 100)) - queue_work(vpm150m->wq, &vpm150m->work); -#endif - - spin_unlock_irqrestore(&wc->reglock, flags); -} -#endif /* VPM_SUPPORT */ - -static inline void cmd_dequeue(struct wctdm *wc, volatile unsigned char *writechunk, int card, int pos) -{ - unsigned long flags; - unsigned int curcmd=0; - int x; - int subaddr = card & 0x3; -#ifdef FANCY_ECHOCAN - int ecval; - ecval = wc->echocanpos; - ecval += EC_SIZE_Q * ectrans[(card & 0x3)]; - ecval = ecval % EC_SIZE; -#endif - - /* if a QRV card, map it to its first channel */ - if ((wc->modtype[card] == MOD_TYPE_QRV) && (card & 3)) - { - return; - } - if (wc->altcs[card]) - subaddr = 0; - - - - /* Skip audio */ - writechunk += 24; - spin_lock_irqsave(&wc->reglock, flags); - /* Search for something waiting to transmit */ - if (pos) { - for (x=0;xcmdq[card].cmds[x] & (__CMD_RD | __CMD_WR)) && - !(wc->cmdq[card].cmds[x] & (__CMD_TX | __CMD_FIN))) { - curcmd = wc->cmdq[card].cmds[x]; -#if 0 - printk("Transmitting command '%08x' in slot %d\n", wc->cmdq[card].cmds[x], wc->txident); -#endif - wc->cmdq[card].cmds[x] |= (wc->txident << 24) | __CMD_TX; - break; - } - } - } - if (!curcmd) { - /* If nothing else, use filler */ - if (wc->modtype[card] == MOD_TYPE_FXS) - curcmd = CMD_RD(64); - else if (wc->modtype[card] == MOD_TYPE_FXO) - curcmd = CMD_RD(12); - else if (wc->modtype[card] == MOD_TYPE_QRV) - curcmd = CMD_RD(3); - else if (wc->modtype[card] == MOD_TYPE_VPM) { -#ifdef FANCY_ECHOCAN - if (wc->blinktimer >= 0xf) { - curcmd = CMD_WR(0x1ab, 0x0f); - } else if (wc->blinktimer == (ectab[ecval] >> 1)) { - curcmd = CMD_WR(0x1ab, 0x00); - } else -#endif - curcmd = CMD_RD(0x1a0); - } - } - if (wc->modtype[card] == MOD_TYPE_FXS) { - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = (1 << (subaddr)); - if (curcmd & __CMD_WR) - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = (curcmd >> 8) & 0x7f; - else - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = 0x80 | ((curcmd >> 8) & 0x7f); - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = curcmd & 0xff; - } else if (wc->modtype[card] == MOD_TYPE_FXO) { - if (curcmd & __CMD_WR) - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = 0x20 | fxo_addrs[subaddr]; - else - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = 0x60 | fxo_addrs[subaddr]; - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = (curcmd >> 8) & 0xff; - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = curcmd & 0xff; - } else if (wc->modtype[card] == MOD_TYPE_FXSINIT) { - /* Special case, we initialize the FXS's into the three-byte command mode then - switch to the regular mode. To send it into thee byte mode, treat the path as - 6 two-byte commands and in the last one we initialize register 0 to 0x80. All modules - read this as the command to switch to daisy chain mode and we're done. */ - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = 0x00; - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = 0x00; - if ((card & 0x1) == 0x1) - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = 0x80; - else - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = 0x00; -#ifdef VPM_SUPPORT - } else if (wc->modtype[card] == MOD_TYPE_VPM) { - if (curcmd & __CMD_WR) - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = ((card & 0x3) << 4) | 0xc | ((curcmd >> 16) & 0x1); - else - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = ((card & 0x3) << 4) | 0xa | ((curcmd >> 16) & 0x1); - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = (curcmd >> 8) & 0xff; - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = curcmd & 0xff; - } else if (wc->modtype[card] == MOD_TYPE_VPM150M) { -#endif - } else if (wc->modtype[card] == MOD_TYPE_QRV) { - - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = 0x00; - if (!curcmd) - { - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = 0x00; - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = 0x00; - } - else - { - if (curcmd & __CMD_WR) - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = 0x40 | ((curcmd >> 8) & 0x3f); - else - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = 0xc0 | ((curcmd >> 8) & 0x3f); - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = curcmd & 0xff; - } - } else if (wc->modtype[card] == MOD_TYPE_NONE) { - writechunk[CMD_BYTE(card, 0, wc->altcs[card])] = 0x00; - writechunk[CMD_BYTE(card, 1, wc->altcs[card])] = 0x00; - writechunk[CMD_BYTE(card, 2, wc->altcs[card])] = 0x00; - } -#if 0 - /* XXX */ - if (cmddesc < 40) - printk("Pass %d, card = %d (modtype=%d), pos = %d, CMD_BYTES = %d,%d,%d, (%02x,%02x,%02x) curcmd = %08x\n", cmddesc, card, wc->modtype[card], pos, CMD_BYTE(card, 0), CMD_BYTE(card, 1), CMD_BYTE(card, 2), writechunk[CMD_BYTE(card, 0)], writechunk[CMD_BYTE(card, 1)], writechunk[CMD_BYTE(card, 2)], curcmd); -#endif - spin_unlock_irqrestore(&wc->reglock, flags); -#if 0 - /* XXX */ - cmddesc++; -#endif -} - -#ifdef VPM_SUPPORT -static inline void cmd_decifer_vpm150m(struct wctdm *wc, volatile unsigned char *readchunk) -{ - unsigned long flags; - unsigned char ident; - int x, i; - - /* Skip audio */ - readchunk += 24; - spin_lock_irqsave(&wc->reglock, flags); - /* Search for any pending results */ - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) { - if ((wc->vpm150m->cmdq[x].desc & (__VPM150M_RD | __VPM150M_WR)) && - (wc->vpm150m->cmdq[x].desc & (__VPM150M_TX)) && - !(wc->vpm150m->cmdq[x].desc & (__VPM150M_FIN))) { - ident = wc->vpm150m->cmdq[x].txident; - if (ident == wc->rxident) { - /* Store result */ - for (i = 0; i < wc->vpm150m->cmdq[x].datalen; i++) { - wc->vpm150m->cmdq[x].data[i] = (0xff & readchunk[CMD_BYTE((25 + i), 1, 0)]) << 8; - wc->vpm150m->cmdq[x].data[i] |= readchunk[CMD_BYTE((25 + i), 2, 0)]; - } - if (wc->vpm150m->cmdq[x].desc & __VPM150M_WR) { - /* Go ahead and clear out writes since they need no acknowledgement */ - wc->vpm150m->cmdq[x].desc = 0; - } else - wc->vpm150m->cmdq[x].desc |= __VPM150M_FIN; - break; - } - } - } - spin_unlock_irqrestore(&wc->reglock, flags); -} -#endif /* VPM_SUPPORT */ - -static inline void cmd_decifer(struct wctdm *wc, volatile unsigned char *readchunk, int card) -{ - unsigned long flags; - unsigned char ident; - int x; - - /* if a QRV card, map it to its first channel */ - if ((wc->modtype[card] == MOD_TYPE_QRV) && (card & 3)) - { - return; - } - /* Skip audio */ - readchunk += 24; - spin_lock_irqsave(&wc->reglock, flags); - /* Search for any pending results */ - for (x=0;xcmdq[card].cmds[x] & (__CMD_RD | __CMD_WR)) && - (wc->cmdq[card].cmds[x] & (__CMD_TX)) && - !(wc->cmdq[card].cmds[x] & (__CMD_FIN))) { - ident = (wc->cmdq[card].cmds[x] >> 24) & 0xff; - if (ident == wc->rxident) { - /* Store result */ - wc->cmdq[card].cmds[x] |= readchunk[CMD_BYTE(card, 2, wc->altcs[card])]; - wc->cmdq[card].cmds[x] |= __CMD_FIN; - if (wc->cmdq[card].cmds[x] & __CMD_WR) { - /* Go ahead and clear out writes since they need no acknowledgement */ - wc->cmdq[card].cmds[x] = 0x00000000; - } else if (x >= USER_COMMANDS) { - /* Clear out ISR reads */ - wc->cmdq[card].isrshadow[x - USER_COMMANDS] = wc->cmdq[card].cmds[x] & 0xff; - wc->cmdq[card].cmds[x] = 0x00000000; - } - break; - } - } - } -#if 0 - /* XXX */ - if (!pos && (cmddesc < 256)) - printk("Card %d: Command '%08x' => %02x\n",card, wc->cmdq[card].lasttx[pos], wc->cmdq[card].lastrd[pos]); -#endif - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static inline void cmd_checkisr(struct wctdm *wc, int card) -{ - if (!wc->cmdq[card].cmds[USER_COMMANDS + 0]) { - if (wc->sethook[card]) { - wc->cmdq[card].cmds[USER_COMMANDS + 0] = wc->sethook[card]; - wc->sethook[card] = 0; - } else if (wc->modtype[card] == MOD_TYPE_FXS) { - wc->cmdq[card].cmds[USER_COMMANDS + 0] = CMD_RD(68); /* Hook state */ - } else if (wc->modtype[card] == MOD_TYPE_FXO) { - wc->cmdq[card].cmds[USER_COMMANDS + 0] = CMD_RD(5); /* Hook/Ring state */ - } else if (wc->modtype[card] == MOD_TYPE_QRV) { - wc->cmdq[card & 0xfc].cmds[USER_COMMANDS + 0] = CMD_RD(3); /* COR/CTCSS state */ -#ifdef VPM_SUPPORT - } else if (wc->modtype[card] == MOD_TYPE_VPM) { - wc->cmdq[card].cmds[USER_COMMANDS + 0] = CMD_RD(0xb9); /* DTMF interrupt */ -#endif - } - } - if (!wc->cmdq[card].cmds[USER_COMMANDS + 1]) { - if (wc->modtype[card] == MOD_TYPE_FXS) { -#ifdef PAQ_DEBUG - wc->cmdq[card].cmds[USER_COMMANDS + 1] = CMD_RD(19); /* Transistor interrupts */ -#else - wc->cmdq[card].cmds[USER_COMMANDS + 1] = CMD_RD(64); /* Battery mode */ -#endif - } else if (wc->modtype[card] == MOD_TYPE_FXO) { - wc->cmdq[card].cmds[USER_COMMANDS + 1] = CMD_RD(29); /* Battery */ - } else if (wc->modtype[card] == MOD_TYPE_QRV) { - wc->cmdq[card & 0xfc].cmds[USER_COMMANDS + 1] = CMD_RD(3); /* Battery */ -#ifdef VPM_SUPPORT - } else if (wc->modtype[card] == MOD_TYPE_VPM) { - wc->cmdq[card].cmds[USER_COMMANDS + 1] = CMD_RD(0xbd); /* DTMF interrupt */ -#endif - } - } -} - -static inline void wctdm_transmitprep(struct wctdm *wc, unsigned char *writechunk) -{ - int x,y; - - /* Calculate Transmission */ - if (likely(wc->initialized)) { - zt_transmit(&wc->span); - } - - for (x=0;xcards;y++) { - if (!x) { - cmd_checkisr(wc, y); - } - - if (likely(wc->initialized)) { - if (y < wc->type) - writechunk[y] = wc->chans[y].writechunk[x]; - } - cmd_dequeue(wc, writechunk, y, x); - } -#ifdef VPM_SUPPORT - if (!x) - wc->blinktimer++; - if (wc->vpm) { - for (y=24;y<28;y++) { - if (!x) { - cmd_checkisr(wc, y); - } - cmd_dequeue(wc, writechunk, y, x); - } -#ifdef FANCY_ECHOCAN - if (wc->vpm && wc->blinktimer >= 0xf) { - wc->blinktimer = -1; - wc->echocanpos++; - } -#endif - } else if (wc->vpm150m) { - cmd_dequeue_vpm150m(wc, writechunk, x); - } -#endif - if (x < ZT_CHUNKSIZE - 1) { - writechunk[EFRAME_SIZE] = wc->ctlreg; - writechunk[EFRAME_SIZE + 1] = wc->txident++; -#if 1 - if ((wc->type == 4) && ((wc->ctlreg & 0x10) || (wc->modtype[NUM_CARDS] == MOD_TYPE_NONE))) { - writechunk[EFRAME_SIZE + 2] = 0; - for (y = 0; y < 4; y++) { - if (wc->modtype[y] == MOD_TYPE_NONE) - writechunk[EFRAME_SIZE + 2] |= (1 << y); - } - } else - writechunk[EFRAME_SIZE + 2] = 0xf; -#endif - } - writechunk += (EFRAME_SIZE + EFRAME_GAP); - } -} - -static inline int wctdm_setreg_full(struct wctdm *wc, int card, int addr, int val, int inisr) -{ - unsigned long flags; - int hit=0; - int ret; - - /* if a QRV card, use only its first channel */ - if (wc->modtype[card] == MOD_TYPE_QRV) - { - if (card & 3) return(0); - } - do { - spin_lock_irqsave(&wc->reglock, flags); - hit = empty_slot(wc, card); - if (hit > -1) { - wc->cmdq[card].cmds[hit] = CMD_WR(addr, val); - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (inisr) - break; - if (hit < 0) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit < 0); - return (hit > -1) ? 0 : -1; -} - -static inline int wctdm_setreg_intr(struct wctdm *wc, int card, int addr, int val) -{ - return wctdm_setreg_full(wc, card, addr, val, 1); -} -static inline int wctdm_setreg(struct wctdm *wc, int card, int addr, int val) -{ - return wctdm_setreg_full(wc, card, addr, val, 0); -} - -static inline int wctdm_getreg(struct wctdm *wc, int card, int addr) -{ - unsigned long flags; - int hit; - int ret=0; - - /* if a QRV card, use only its first channel */ - if (wc->modtype[card] == MOD_TYPE_QRV) - { - if (card & 3) return(0); - } - do { - spin_lock_irqsave(&wc->reglock, flags); - hit = empty_slot(wc, card); - if (hit > -1) { - wc->cmdq[card].cmds[hit] = CMD_RD(addr); - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (hit < 0) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit < 0); - do { - spin_lock_irqsave(&wc->reglock, flags); - if (wc->cmdq[card].cmds[hit] & __CMD_FIN) { - ret = wc->cmdq[card].cmds[hit] & 0xff; - wc->cmdq[card].cmds[hit] = 0x00000000; - hit = -1; - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (hit > -1) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit > -1); - return ret; -} - -#ifdef VPM_SUPPORT -static inline unsigned char wctdm_vpm_in(struct wctdm *wc, int unit, const unsigned int addr) -{ - return wctdm_getreg(wc, unit + NUM_CARDS, addr); -} - -static inline void wctdm_vpm_out(struct wctdm *wc, int unit, const unsigned int addr, const unsigned char val) -{ - wctdm_setreg(wc, unit + NUM_CARDS, addr, val); -} - -static inline void cmd_vpm150m_retransmit(struct wctdm *wc) -{ - unsigned long flags; - int x; - - spin_lock_irqsave(&wc->reglock, flags); - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) { - if (!(wc->vpm150m->cmdq[x].desc & __VPM150M_FIN)) { - //printk("Retransmit!\n"); - wc->vpm150m->cmdq[x].desc &= ~(__VPM150M_TX); - } - } - spin_unlock_irqrestore(&wc->reglock, flags); - -} -#endif - -static inline void cmd_retransmit(struct wctdm *wc) -{ - int x,y; - unsigned long flags; - /* Force retransmissions */ - spin_lock_irqsave(&wc->reglock, flags); - for (x=0;xcards;y++) { - if (!(wc->cmdq[y].cmds[x] & __CMD_FIN)) - wc->cmdq[y].cmds[x] &= ~(__CMD_TX | (0xff << 24)); - } - } - spin_unlock_irqrestore(&wc->reglock, flags); -#ifdef VPM_SUPPORT - if (wc->vpm150m) - cmd_vpm150m_retransmit(wc); -#endif -} - -static inline void wctdm_receiveprep(struct wctdm *wc, unsigned char *readchunk) -{ - int x,y; - unsigned char expected; - - BUG_ON(NULL == readchunk); - - for (x=0;xrxident+1; - wc->rxident = readchunk[EFRAME_SIZE + 1]; - if (wc->rxident != expected) { - wc->span.irqmisses++; - cmd_retransmit(wc); - } - } - for (y=0;y < wc->cards;y++) { - if (likely(wc->initialized)) { - if (y < wc->type) { - wc->chans[y].readchunk[x] = readchunk[y]; - } - } - cmd_decifer(wc, readchunk, y); - } -#ifdef VPM_SUPPORT - if (wc->vpm) { - for (y=NUM_CARDS;y < NUM_CARDS + NUM_EC; y++) - cmd_decifer(wc, readchunk, y); - } else if (wc->vpm150m) - cmd_decifer_vpm150m(wc, readchunk); -#endif - - readchunk += (EFRAME_SIZE + EFRAME_GAP); - } - /* XXX We're wasting 8 taps. We should get closer :( */ - if (likely(wc->initialized)) { - for (x=0;xtype;x++) { - if (wc->cardflag & (1 << x)) - zt_ec_chunk(&wc->chans[x], wc->chans[x].readchunk, wc->chans[x].writechunk); - } - zt_receive(&wc->span); - } - /* Wake up anyone sleeping to read/write a new register */ - wake_up_interruptible(&wc->regq); -} - -static int wait_access(struct wctdm *wc, int card) -{ - unsigned char data=0; - long origjiffies; - int count = 0; - - #define MAX 10 /* attempts */ - - - origjiffies = jiffies; - /* Wait for indirect access */ - while (count++ < MAX) - { - data = wctdm_getreg(wc, card, I_STATUS); - - if (!data) - return 0; - - } - - if(count > (MAX-1)) printk(" ##### Loop error (%02x) #####\n", data); - - return 0; -} - -static unsigned char translate_3215(unsigned char address) -{ - int x; - for (x=0;xflags[card] & FLAG_3215) { - address = translate_3215(address); - if (address == 255) - return 0; - } - if(!wait_access(wc, card)) { - wctdm_setreg(wc, card, IDA_LO,(unsigned char)(data & 0xFF)); - wctdm_setreg(wc, card, IDA_HI,(unsigned char)((data & 0xFF00)>>8)); - wctdm_setreg(wc, card, IAA,address); - res = 0; - }; - return res; -} - -static int wctdm_proslic_getreg_indirect(struct wctdm *wc, int card, unsigned char address) -{ - int res = -1; - char *p=NULL; - /* Translate 3215 addresses */ - if (wc->flags[card] & FLAG_3215) { - address = translate_3215(address); - if (address == 255) - return 0; - } - if (!wait_access(wc, card)) { - wctdm_setreg(wc, card, IAA, address); - if (!wait_access(wc, card)) { - unsigned char data1, data2; - data1 = wctdm_getreg(wc, card, IDA_LO); - data2 = wctdm_getreg(wc, card, IDA_HI); - res = data1 | (data2 << 8); - } else - p = "Failed to wait inside"; - } else - p = "failed to wait"; - if (p) - printk("%s\n",p); - return res; -} - -static int wctdm_proslic_init_indirect_regs(struct wctdm *wc, int card) -{ - unsigned char i; - - for (i=0; iflags[card] & FLAG_3215) || (indirect_regs[i].altaddr != 255))) - { - printk("!!!!!!! %s iREG %X = %X should be %X\n", - indirect_regs[i].name,indirect_regs[i].address,j,initial ); - passed = 0; - } - } - - if (passed) { - if (debug & DEBUG_CARD) - printk("Init Indirect Registers completed successfully.\n"); - } else { - printk(" !!!!! Init Indirect Registers UNSUCCESSFULLY.\n"); - return -1; - } - return 0; -} - -static inline void wctdm_proslic_recheck_sanity(struct wctdm *wc, int card) -{ - int res; -#ifdef PAQ_DEBUG - res = wc->cmdq[card].isrshadow[1]; - res &= ~0x3; - if (res) { - wc->cmdq[card].isrshadow[1]=0; - wc->mods[card].fxs.palarms++; - if (wc->mods[card].fxs.palarms < MAX_ALARMS) { - printk("Power alarm (%02x) on module %d, resetting!\n", res, card + 1); - if (wc->mods[card].fxs.lasttxhook == 4) - wc->mods[card].fxs.lasttxhook = 0x11; - wc->sethook[card] = CMD_WR(19, res); -#if 0 - wc->sethook[card] = CMD_WR(64, wc->mods[card].fxs.lasttxhook); -#endif - - /* wctdm_setreg_intr(wc, card, 64, wc->mods[card].fxs.lasttxhook); */ - /* Update shadow register to avoid extra power alarms until next read */ - wc->cmdq[card].isrshadow[1] = 0; - } else { - if (wc->mods[card].fxs.palarms == MAX_ALARMS) - printk("Too many power alarms on card %d, NOT resetting!\n", card + 1); - } - } -#else - res = wc->cmdq[card].isrshadow[1]; - /* This makes sure the lasthook was put in reg 64 the linefeed reg */ - if (((res & 0x0f) | 0x10) == wc->mods[card].fxs.lasttxhook) - wc->mods[card].fxs.lasttxhook &= 0x0f; - - res = !res && /* reg 64 has to be zero at last isr read */ - !(wc->mods[card].fxs.lasttxhook & 0x10 ) && /* not a transition */ - wc->mods[card].fxs.lasttxhook; /* not an intended zero */ - - if (res) { - wc->mods[card].fxs.palarms++; - if (wc->mods[card].fxs.palarms < MAX_ALARMS) { - printk("Power alarm on module %d, resetting!\n", card + 1); - if (wc->mods[card].fxs.lasttxhook == 4) - wc->mods[card].fxs.lasttxhook = 0x11; - wc->mods[card].fxs.lasttxhook |= 0x10; - wc->sethook[card] = CMD_WR(64, wc->mods[card].fxs.lasttxhook); - - /* wctdm_setreg_intr(wc, card, 64, wc->mods[card].fxs.lasttxhook); */ - /* Update shadow register to avoid extra power alarms until next read */ - wc->cmdq[card].isrshadow[1] = wc->mods[card].fxs.lasttxhook; - } else { - if (wc->mods[card].fxs.palarms == MAX_ALARMS) - printk("Too many power alarms on card %d, NOT resetting!\n", card + 1); - } - } -#endif -} - -static inline void wctdm_qrvdri_check_hook(struct wctdm *wc, int card) -{ - signed char b,b1; - int qrvcard = card & 0xfc; - - - if (wc->qrvdebtime[card] >= 2) wc->qrvdebtime[card]--; - b = wc->cmdq[qrvcard].isrshadow[0]; /* Hook/Ring state */ - b &= 0xcc; /* use bits 3-4 and 6-7 only */ - - if (wc->radmode[qrvcard] & RADMODE_IGNORECOR) b &= ~4; - else if (!(wc->radmode[qrvcard] & RADMODE_INVERTCOR)) b ^= 4; - if (wc->radmode[qrvcard + 1] | RADMODE_IGNORECOR) b &= ~0x40; - else if (!(wc->radmode[qrvcard + 1] | RADMODE_INVERTCOR)) b ^= 0x40; - - if ((wc->radmode[qrvcard] & RADMODE_IGNORECT) || - (!(wc->radmode[qrvcard] & RADMODE_EXTTONE))) b &= ~8; - else if (!(wc->radmode[qrvcard] & RADMODE_EXTINVERT)) b ^= 8; - if ((wc->radmode[qrvcard + 1] & RADMODE_IGNORECT) || - (!(wc->radmode[qrvcard + 1] & RADMODE_EXTTONE))) b &= ~0x80; - else if (!(wc->radmode[qrvcard + 1] & RADMODE_EXTINVERT)) b ^= 0x80; - /* now b & MASK should be zero, if its active */ - /* check for change in chan 0 */ - if ((!(b & 0xc)) != wc->qrvhook[qrvcard + 2]) - { - wc->qrvdebtime[qrvcard] = wc->debouncetime[qrvcard]; - wc->qrvhook[qrvcard + 2] = !(b & 0xc); - } - /* if timed-out and ready */ - if (wc->qrvdebtime[qrvcard] == 1) - { - b1 = wc->qrvhook[qrvcard + 2]; -if (debug) printk("QRV channel %d rx state changed to %d\n",qrvcard,wc->qrvhook[qrvcard + 2]); - zt_hooksig(&wc->chans[qrvcard], - (b1) ? ZT_RXSIG_OFFHOOK : ZT_RXSIG_ONHOOK); - wc->qrvdebtime[card] = 0; - } - /* check for change in chan 1 */ - if ((!(b & 0xc0)) != wc->qrvhook[qrvcard + 3]) - { - wc->qrvdebtime[qrvcard + 1] = QRV_DEBOUNCETIME; - wc->qrvhook[qrvcard + 3] = !(b & 0xc0); - } - if (wc->qrvdebtime[qrvcard + 1] == 1) - { - b1 = wc->qrvhook[qrvcard + 3]; -if (debug) printk("QRV channel %d rx state changed to %d\n",qrvcard + 1,wc->qrvhook[qrvcard + 3]); - zt_hooksig(&wc->chans[qrvcard + 1], - (b1) ? ZT_RXSIG_OFFHOOK : ZT_RXSIG_ONHOOK); - wc->qrvdebtime[card] = 0; - } - return; -} - -static inline void wctdm_voicedaa_check_hook(struct wctdm *wc, int card) -{ -#define MS_PER_CHECK_HOOK 1 - - unsigned char res; - signed char b; - struct fxo *fxo = &wc->mods[card].fxo; - unsigned int abs_voltage; - - /* Try to track issues that plague slot one FXO's */ - b = wc->cmdq[card].isrshadow[0]; /* Hook/Ring state */ - b &= 0x9b; - if (fxo->offhook) { - if (b != 0x9) - wctdm_setreg_intr(wc, card, 5, 0x9); - } else { - if (b != 0x8) - wctdm_setreg_intr(wc, card, 5, 0x8); - } - if (!fxo->offhook) { - if(fwringdetect || neonmwi_monitor) { - /* Look for ring status bits (Ring Detect Signal Negative and - * Ring Detect Signal Positive) to transition back and forth - * some number of times to indicate that a ring is occurring. - * Provide some number of samples to allow for the transitions - * to occur before ginving up. - * NOTE: neon mwi voltages will trigger one of these bits to go active - * but not to have transitions between the two bits (i.e. no negative - * to positive or positive to negative transversals ) - */ - res = wc->cmdq[card].isrshadow[0] & 0x60; - if (0 == wc->mods[card].fxo.wasringing) { - if (res) { - /* Look for positive/negative crossings in ring status reg */ - fxo->wasringing = 2; - fxo->ringdebounce = ringdebounce /16; - fxo->lastrdtx = res; - fxo->lastrdtx_count = 0; - } - } else if (2 == fxo->wasringing) { - /* If ring detect signal has transversed */ - if (res && res != fxo->lastrdtx) { - /* if there are at least 3 ring polarity transversals */ - if(++fxo->lastrdtx_count >= 2) { - fxo->wasringing = 1; - if (debug) - printk("FW RING on %d/%d!\n", wc->span.spanno, card + 1); - zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); - fxo->ringdebounce = ringdebounce / 16; - } else { - fxo->lastrdtx = res; - fxo->ringdebounce = ringdebounce / 16; - } - /* ring indicator (positve or negative) has not transitioned, check debounce count */ - } else if (--fxo->ringdebounce == 0) { - fxo->wasringing = 0; - } - } else { /* I am in ring state */ - if (res) { /* If any ringdetect bits are still active */ - fxo->ringdebounce = ringdebounce / 16; - } else if (--fxo->ringdebounce == 0) { - fxo->wasringing = 0; - if (debug) - printk("FW NO RING on %d/%d!\n", wc->span.spanno, card + 1); - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - } - } - } else { - res = wc->cmdq[card].isrshadow[0]; - if ((res & 0x60) && (fxo->battery == BATTERY_PRESENT)) { - fxo->ringdebounce += (ZT_CHUNKSIZE * 16); - if (fxo->ringdebounce >= ZT_CHUNKSIZE * ringdebounce) { - if (!fxo->wasringing) { - fxo->wasringing = 1; - zt_hooksig(&wc->chans[card], ZT_RXSIG_RING); - if (debug) - printk("RING on %d/%d!\n", wc->span.spanno, card + 1); - } - fxo->ringdebounce = ZT_CHUNKSIZE * ringdebounce; - } - } else { - fxo->ringdebounce -= ZT_CHUNKSIZE * 4; - if (fxo->ringdebounce <= 0) { - if (fxo->wasringing) { - fxo->wasringing = 0; - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (debug) - printk("NO RING on %d/%d!\n", wc->span.spanno, card + 1); - } - fxo->ringdebounce = 0; - } - - } - } - } - - b = wc->cmdq[card].isrshadow[1]; /* Voltage */ - abs_voltage = abs(b); - - if (fxovoltage) { - if (!(wc->intcount % 100)) { - printk("Port %d: Voltage: %d Debounce %d\n", card + 1, - b, fxo->battdebounce); - } - } - - if (abs_voltage < battthresh) { - /* possible existing states: - battery lost, no debounce timer - battery lost, debounce timer (going to battery present) - battery present or unknown, no debounce timer - battery present or unknown, debounce timer (going to battery lost) - */ - - if (fxo->battery == BATTERY_LOST) { - if (fxo->battdebounce) { - /* we were going to BATTERY_PRESENT, but battery was lost again, - so clear the debounce timer */ - fxo->battdebounce = 0; - } - } else { - if (fxo->battdebounce) { - /* going to BATTERY_LOST, see if we are there yet */ - if (--fxo->battdebounce == 0) { - fxo->battery = BATTERY_LOST; - if (debug) - printk("NO BATTERY on %d/%d!\n", wc->span.spanno, card + 1); -#ifdef JAPAN - if (!wc->ohdebounce && wc->offhook) { - zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK); - if (debug) - printk("Signalled On Hook\n"); -#ifdef ZERO_BATT_RING - wc->onhook++; -#endif - } -#else - zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK); - /* set the alarm timer, taking into account that part of its time - period has already passed while debouncing occurred */ - fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK; -#endif - } - } else { - /* start the debounce timer to verify that battery has been lost */ - fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK; - } - } - } else { - /* possible existing states: - battery lost or unknown, no debounce timer - battery lost or unknown, debounce timer (going to battery present) - battery present, no debounce timer - battery present, debounce timer (going to battery lost) - */ - - if (fxo->battery == BATTERY_PRESENT) { - if (fxo->battdebounce) { - /* we were going to BATTERY_LOST, but battery appeared again, - so clear the debounce timer */ - fxo->battdebounce = 0; - } - } else { - if (fxo->battdebounce) { - /* going to BATTERY_PRESENT, see if we are there yet */ - if (--fxo->battdebounce == 0) { - fxo->battery = BATTERY_PRESENT; - if (debug) - printk("BATTERY on %d/%d (%s)!\n", wc->span.spanno, card + 1, - (b < 0) ? "-" : "+"); -#ifdef ZERO_BATT_RING - if (wc->onhook) { - wc->onhook = 0; - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (debug) - printk("Signalled Off Hook\n"); - } -#else - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); -#endif - /* set the alarm timer, taking into account that part of its time - period has already passed while debouncing occurred */ - fxo->battalarm = (battalarm - battdebounce) / MS_PER_CHECK_HOOK; - } - } else { - /* start the debounce timer to verify that battery has appeared */ - fxo->battdebounce = battdebounce / MS_PER_CHECK_HOOK; - } - } - - if (fxo->lastpol >= 0) { - if (b < 0) { - fxo->lastpol = -1; - fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK; - } - } - if (fxo->lastpol <= 0) { - if (b > 0) { - fxo->lastpol = 1; - fxo->polaritydebounce = POLARITY_DEBOUNCE / MS_PER_CHECK_HOOK; - } - } - } - - if (fxo->battalarm) { - if (--fxo->battalarm == 0) { - /* the alarm timer has expired, so update the battery alarm state - for this channel */ - zt_alarm_channel(&wc->chans[card], fxo->battery == BATTERY_LOST ? ZT_ALARM_RED : ZT_ALARM_NONE); - } - } - - if (fxo->polaritydebounce) { - fxo->polaritydebounce--; - if (fxo->polaritydebounce < 1) { - if (fxo->lastpol != fxo->polarity) { - if (debug & DEBUG_CARD) - printk("%lu Polarity reversed (%d -> %d)\n", jiffies, - fxo->polarity, - fxo->lastpol); - if (fxo->polarity) - zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY); - fxo->polarity = fxo->lastpol; - } - } - } - - /* Look for neon mwi pulse */ - if (neonmwi_monitor && !wc->mods[card].fxo.offhook) { - /* Look for NEONMWI_ON_DEBOUNCE mS of consecutive voltage readings - * where the voltage is over the neon limit butdoes not vary greatly - * from the last reading - */ - if (fxo->battery == 1 && - abs_voltage > neonmwi_level && - (0 == fxo->neonmwi_last_voltage || - (b >= fxo->neonmwi_last_voltage - neonmwi_envelope && - b <= fxo->neonmwi_last_voltage + neonmwi_envelope ))) { - fxo->neonmwi_last_voltage = b; - if (NEONMWI_ON_DEBOUNCE == fxo->neonmwi_debounce) { - fxo->neonmwi_offcounter = neonmwi_offlimit_cycles; - if(0 == fxo->neonmwi_state) { - zt_qevent_lock(&wc->chans[card], ZT_EVENT_NEONMWI_ACTIVE); - fxo->neonmwi_state = 1; - if (debug) - printk("NEON MWI active for card %d\n", card+1); - } - fxo->neonmwi_debounce++; /* terminate the processing */ - } else if (NEONMWI_ON_DEBOUNCE > fxo->neonmwi_debounce) { - fxo->neonmwi_debounce++; - } else { /* Insure the count gets reset */ - fxo->neonmwi_offcounter = neonmwi_offlimit_cycles; - } - } else { - fxo->neonmwi_debounce = 0; - fxo->neonmwi_last_voltage = 0; - } - /* If no neon mwi pulse for given period of time, indicte no neon mwi state */ - if (fxo->neonmwi_state && 0 < fxo->neonmwi_offcounter ) { - fxo->neonmwi_offcounter--; - if (0 == fxo->neonmwi_offcounter) { - zt_qevent_lock(&wc->chans[card], ZT_EVENT_NEONMWI_INACTIVE); - fxo->neonmwi_state = 0; - if (debug) - printk("NEON MWI cleared for card %d\n", card+1); - } - } - } -#undef MS_PER_CHECK_HOOK -} - -static inline void wctdm_proslic_check_hook(struct wctdm *wc, int card) -{ - char res; - int hook; - - /* For some reason we have to debounce the - hook detector. */ - - res = wc->cmdq[card].isrshadow[0]; /* Hook state */ - hook = (res & 1); - - if (hook != wc->mods[card].fxs.lastrxhook) { - /* Reset the debounce (must be multiple of 4ms) */ - wc->mods[card].fxs.debounce = 8 * (4 * 8); -#if 0 - printk("Resetting debounce card %d hook %d, %d\n", card, hook, wc->mods[card].fxs.debounce); -#endif - } else { - if (wc->mods[card].fxs.debounce > 0) { - wc->mods[card].fxs.debounce-= 4 * ZT_CHUNKSIZE; -#if 0 - printk("Sustaining hook %d, %d\n", hook, wc->mods[card].fxs.debounce); -#endif - if (!wc->mods[card].fxs.debounce) { -#if 0 - printk("Counted down debounce, newhook: %d...\n", hook); -#endif - wc->mods[card].fxs.debouncehook = hook; - } - if (!wc->mods[card].fxs.oldrxhook && wc->mods[card].fxs.debouncehook) { - /* Off hook */ - if (debug & DEBUG_CARD) - printk("wctdm: Card %d Going off hook\n", card); - zt_hooksig(&wc->chans[card], ZT_RXSIG_OFFHOOK); - if (robust) - wctdm_init_proslic(wc, card, 1, 0, 1); - wc->mods[card].fxs.oldrxhook = 1; - - } else if (wc->mods[card].fxs.oldrxhook && !wc->mods[card].fxs.debouncehook) { - /* On hook */ - if (debug & DEBUG_CARD) - printk("wctdm: Card %d Going on hook\n", card); - zt_hooksig(&wc->chans[card], ZT_RXSIG_ONHOOK); - wc->mods[card].fxs.oldrxhook = 0; - } - } - } - wc->mods[card].fxs.lastrxhook = hook; -} - - -#ifdef VPM_SUPPORT -static inline void wctdm_vpm_check(struct wctdm *wc, int x) -{ - if (wc->cmdq[x].isrshadow[0]) { - if (debug & DEBUG_ECHOCAN) - printk("VPM: Detected dtmf ON channel %02x on chip %d!\n", wc->cmdq[x].isrshadow[0], x - NUM_CARDS); - wc->sethook[x] = CMD_WR(0xb9, wc->cmdq[x].isrshadow[0]); - wc->cmdq[x].isrshadow[0] = 0; - /* Cancel most recent lookup, if there is one */ - wc->cmdq[x].cmds[USER_COMMANDS+0] = 0x00000000; - } else if (wc->cmdq[x].isrshadow[1]) { - if (debug & DEBUG_ECHOCAN) - printk("VPM: Detected dtmf OFF channel %02x on chip %d!\n", wc->cmdq[x].isrshadow[1], x - NUM_CARDS); - wc->sethook[x] = CMD_WR(0xbd, wc->cmdq[x].isrshadow[1]); - wc->cmdq[x].isrshadow[1] = 0; - /* Cancel most recent lookup, if there is one */ - wc->cmdq[x].cmds[USER_COMMANDS+1] = 0x00000000; - } -} - -#include "adt_lec.c" - -static int wctdm_echocan_with_params(struct zt_chan *chan, struct zt_echocanparams *ecp, struct zt_echocanparam *p) -{ - struct wctdm *wc = chan->pvt; - - if (wc->vpm) { - int channel; - int unit; - - channel = (chan->chanpos - 1); - unit = (chan->chanpos - 1) & 0x3; - if (wc->vpm < 2) - channel >>= 2; - - if(debug & DEBUG_ECHOCAN) - printk("echocan: Unit is %d, Channel is %d length %d\n", - unit, channel, ecp->tap_length); - if (ecp->tap_length) - wctdm_vpm_out(wc,unit,channel,0x3e); - else - wctdm_vpm_out(wc,unit,channel,0x01); - - return 0; -#ifdef VPM150M_SUPPORT - } else if (wc->vpm150m) { - struct vpm150m *vpm150m = wc->vpm150m; - unsigned int ret; - int channo = chan->chanpos - 1; - - if ((ret = adt_lec_parse_params(&vpm150m->desiredecstate[channo], ecp, p))) - return ret; - - vpm150m->desiredecstate[channo].tap_length = ecp->tap_length; - - if (memcmp(&vpm150m->curecstate[channo], &vpm150m->desiredecstate[channo], sizeof(vpm150m->curecstate[channo])) - && test_bit(VPM150M_ACTIVE, &vpm150m->control)) - queue_work(vpm150m->wq, &vpm150m->work); - - return 0; -#endif - } else - return -ENODEV; -} -#endif - -static inline void wctdm_isr_misc(struct wctdm *wc) -{ - int x; - - if (unlikely(!wc->initialized)) { - return; - } - - for (x=0;xcards;x++) { - if (wc->cardflag & (1 << x)) { - if (wc->modtype[x] == MOD_TYPE_FXS) { - if (!(wc->intcount % 10000)) { - /* Accept an alarm once per 10 seconds */ - if (wc->mods[x].fxs.palarms) - wc->mods[x].fxs.palarms--; - } - wctdm_proslic_check_hook(wc, x); - if (!(wc->intcount & 0xfc)) - wctdm_proslic_recheck_sanity(wc, x); - if (wc->mods[x].fxs.lasttxhook == 0x4) { - /* RINGing, prepare for OHT */ - wc->mods[x].fxs.ohttimer = OHT_TIMER << 3; - wc->mods[x].fxs.idletxhookstate = 0x2; /* OHT mode when idle */ - } else { - if (wc->mods[x].fxs.ohttimer) { - wc->mods[x].fxs.ohttimer-= ZT_CHUNKSIZE; - if (!wc->mods[x].fxs.ohttimer) { - wc->mods[x].fxs.idletxhookstate = 0x1; /* Switch to active */ - if (wc->mods[x].fxs.lasttxhook == 0x2) { - /* Apply the change if appropriate */ - wc->mods[x].fxs.lasttxhook = 0x11; - wc->sethook[x] = CMD_WR(64, wc->mods[x].fxs.lasttxhook); - /* wctdm_setreg_intr(wc, x, 64, wc->mods[x].fxs.lasttxhook); */ - } - } - } - } - } else if (wc->modtype[x] == MOD_TYPE_FXO) { - wctdm_voicedaa_check_hook(wc, x); - } else if (wc->modtype[x] == MOD_TYPE_QRV) { - wctdm_qrvdri_check_hook(wc, x); - } - } - } -#ifdef VPM_SUPPORT - if (wc->vpm > 0) { - for (x=NUM_CARDS;xrxints++; - wctdm_receiveprep(wc, vbb); -} - -void handle_transmit(void* vbb, void* context) -{ - struct wctdm *wc = context; - memset(vbb, 0, SFRAME_SIZE); - wc->txints++; - wctdm_transmitprep(wc, vbb); - wctdm_isr_misc(wc); - wc->intcount++; - voicebus_transmit(wc->vb, vbb); -} - -static int wctdm_voicedaa_insane(struct wctdm *wc, int card) -{ - int blah; - blah = wctdm_getreg(wc, card, 2); - if (blah != 0x3) - return -2; - blah = wctdm_getreg(wc, card, 11); - if (debug & DEBUG_CARD) - printk("VoiceDAA System: %02x\n", blah & 0xf); - return 0; -} - -static int wctdm_proslic_insane(struct wctdm *wc, int card) -{ - int blah,insane_report; - insane_report=0; - - blah = wctdm_getreg(wc, card, 0); - if (debug & DEBUG_CARD) - printk("ProSLIC on module %d, product %d, version %d\n", card, (blah & 0x30) >> 4, (blah & 0xf)); - -#if 0 - if ((blah & 0x30) >> 4) { - printk("ProSLIC on module %d is not a 3210.\n", card); - return -1; - } -#endif - if (((blah & 0xf) == 0) || ((blah & 0xf) == 0xf)) { - /* SLIC not loaded */ - return -1; - } - if ((blah & 0xf) < 2) { - printk("ProSLIC 3210 version %d is too old\n", blah & 0xf); - return -1; - } - if (wctdm_getreg(wc, card, 1) & 0x80) - /* ProSLIC 3215, not a 3210 */ - wc->flags[card] |= FLAG_3215; - - blah = wctdm_getreg(wc, card, 8); - if (blah != 0x2) { - printk("ProSLIC on module %d insane (1) %d should be 2\n", card, blah); - return -1; - } else if ( insane_report) - printk("ProSLIC on module %d Reg 8 Reads %d Expected is 0x2\n",card,blah); - - blah = wctdm_getreg(wc, card, 64); - if (blah != 0x0) { - printk("ProSLIC on module %d insane (2)\n", card); - return -1; - } else if ( insane_report) - printk("ProSLIC on module %d Reg 64 Reads %d Expected is 0x0\n",card,blah); - - blah = wctdm_getreg(wc, card, 11); - if (blah != 0x33) { - printk("ProSLIC on module %d insane (3)\n", card); - return -1; - } else if ( insane_report) - printk("ProSLIC on module %d Reg 11 Reads %d Expected is 0x33\n",card,blah); - - /* Just be sure it's setup right. */ - wctdm_setreg(wc, card, 30, 0); - - if (debug & DEBUG_CARD) - printk("ProSLIC on module %d seems sane.\n", card); - return 0; -} - -static int wctdm_proslic_powerleak_test(struct wctdm *wc, int card) -{ - unsigned long origjiffies; - unsigned char vbat; - - /* Turn off linefeed */ - wctdm_setreg(wc, card, 64, 0); - - /* Power down */ - wctdm_setreg(wc, card, 14, 0x10); - - /* Wait for one second */ - origjiffies = jiffies; - - while((vbat = wctdm_getreg(wc, card, 82)) > 0x6) { - if ((jiffies - origjiffies) >= (HZ/2)) - break;; - } - - if (vbat < 0x06) { - printk("Excessive leakage detected on module %d: %d volts (%02x) after %d ms\n", card, - 376 * vbat / 1000, vbat, (int)((jiffies - origjiffies) * 1000 / HZ)); - return -1; - } else if (debug & DEBUG_CARD) { - printk("Post-leakage voltage: %d volts\n", 376 * vbat / 1000); - } - return 0; -} - -static int wctdm_powerup_proslic(struct wctdm *wc, int card, int fast) -{ - unsigned char vbat; - unsigned long origjiffies; - int lim; - - /* Set period of DC-DC converter to 1/64 khz */ - wctdm_setreg(wc, card, 92, 0xc0 /* was 0xff */); - - /* Wait for VBat to powerup */ - origjiffies = jiffies; - - /* Disable powerdown */ - wctdm_setreg(wc, card, 14, 0); - - /* If fast, don't bother checking anymore */ - if (fast) - return 0; - - while((vbat = wctdm_getreg(wc, card, 82)) < 0xc0) { - /* Wait no more than 500ms */ - if ((jiffies - origjiffies) > HZ/2) { - break; - } - } - - if (vbat < 0xc0) { - printk("ProSLIC on module %d failed to powerup within %d ms (%d mV only)\n\n -- DID YOU REMEMBER TO PLUG IN THE HD POWER CABLE TO THE TDM CARD??\n", - card, (int)(((jiffies - origjiffies) * 1000 / HZ)), - vbat * 375); - return -1; - } else if (debug & DEBUG_CARD) { - printk("ProSLIC on module %d powered up to -%d volts (%02x) in %d ms\n", - card, vbat * 376 / 1000, vbat, (int)(((jiffies - origjiffies) * 1000 / HZ))); - } - - /* Proslic max allowed loop current, reg 71 LOOP_I_LIMIT */ - /* If out of range, just set it to the default value */ - lim = (loopcurrent - 20) / 3; - if ( loopcurrent > 41 ) { - lim = 0; - if (debug & DEBUG_CARD) - printk("Loop current out of range! Setting to default 20mA!\n"); - } - else if (debug & DEBUG_CARD) - printk("Loop current set to %dmA!\n",(lim*3)+20); - wctdm_setreg(wc,card,LOOP_I_LIMIT,lim); - - /* Engage DC-DC converter */ - wctdm_setreg(wc, card, 93, 0x19 /* was 0x19 */); -#if 0 - origjiffies = jiffies; - while(0x80 & wctdm_getreg(wc, card, 93)) { - if ((jiffies - origjiffies) > 2 * HZ) { - printk("Timeout waiting for DC-DC calibration on module %d\n", card); - return -1; - } - } - -#if 0 - /* Wait a full two seconds */ - while((jiffies - origjiffies) < 2 * HZ); - - /* Just check to be sure */ - vbat = wctdm_getreg(wc, card, 82); - printk("ProSLIC on module %d powered up to -%d volts (%02x) in %d ms\n", - card, vbat * 376 / 1000, vbat, (int)(((jiffies - origjiffies) * 1000 / HZ))); -#endif -#endif - return 0; - -} - -static int wctdm_proslic_manual_calibrate(struct wctdm *wc, int card) -{ - unsigned long origjiffies; - unsigned char i; - - wctdm_setreg(wc, card, 21, 0);//(0) Disable all interupts in DR21 - wctdm_setreg(wc, card, 22, 0);//(0)Disable all interupts in DR21 - wctdm_setreg(wc, card, 23, 0);//(0)Disable all interupts in DR21 - wctdm_setreg(wc, card, 64, 0);//(0) - - wctdm_setreg(wc, card, 97, 0x18); //(0x18)Calibrations without the ADC and DAC offset and without common mode calibration. - wctdm_setreg(wc, card, 96, 0x47); //(0x47) Calibrate common mode and differential DAC mode DAC + ILIM - - origjiffies=jiffies; - while( wctdm_getreg(wc,card,96)!=0 ){ - if((jiffies-origjiffies)>80) - return -1; - } -//Initialized DR 98 and 99 to get consistant results. -// 98 and 99 are the results registers and the search should have same intial conditions. - -/*******************************The following is the manual gain mismatch calibration****************************/ -/*******************************This is also available as a function *******************************************/ - // Delay 10ms - origjiffies=jiffies; - while((jiffies-origjiffies)<1); - wctdm_proslic_setreg_indirect(wc, card, 88,0); - wctdm_proslic_setreg_indirect(wc,card,89,0); - wctdm_proslic_setreg_indirect(wc,card,90,0); - wctdm_proslic_setreg_indirect(wc,card,91,0); - wctdm_proslic_setreg_indirect(wc,card,92,0); - wctdm_proslic_setreg_indirect(wc,card,93,0); - - wctdm_setreg(wc, card, 98,0x10); // This is necessary if the calibration occurs other than at reset time - wctdm_setreg(wc, card, 99,0x10); - - for ( i=0x1f; i>0; i--) - { - wctdm_setreg(wc, card, 98,i); - origjiffies=jiffies; - while((jiffies-origjiffies)<4); - if((wctdm_getreg(wc,card,88)) == 0) - break; - } // for - - for ( i=0x1f; i>0; i--) - { - wctdm_setreg(wc, card, 99,i); - origjiffies=jiffies; - while((jiffies-origjiffies)<4); - if((wctdm_getreg(wc,card,89)) == 0) - break; - }//for - -/*******************************The preceding is the manual gain mismatch calibration****************************/ -/**********************************The following is the longitudinal Balance Cal***********************************/ - wctdm_setreg(wc,card,64,1); - while((jiffies-origjiffies)<10); // Sleep 100? - - wctdm_setreg(wc, card, 64, 0); - wctdm_setreg(wc, card, 23, 0x4); // enable interrupt for the balance Cal - wctdm_setreg(wc, card, 97, 0x1); // this is a singular calibration bit for longitudinal calibration - wctdm_setreg(wc, card, 96,0x40); - - wctdm_getreg(wc,card,96); /* Read Reg 96 just cause */ - - wctdm_setreg(wc, card, 21, 0xFF); - wctdm_setreg(wc, card, 22, 0xFF); - wctdm_setreg(wc, card, 23, 0xFF); - - /**The preceding is the longitudinal Balance Cal***/ - return(0); - -} - -static int wctdm_proslic_calibrate(struct wctdm *wc, int card) -{ - unsigned long origjiffies; - int x; - /* Perform all calibrations */ - wctdm_setreg(wc, card, 97, 0x1f); - - /* Begin, no speedup */ - wctdm_setreg(wc, card, 96, 0x5f); - - /* Wait for it to finish */ - origjiffies = jiffies; - while(wctdm_getreg(wc, card, 96)) { - if ((jiffies - origjiffies) > 2 * HZ) { - printk("Timeout waiting for calibration of module %d\n", card); - return -1; - } - } - - if (debug & DEBUG_CARD) { - /* Print calibration parameters */ - printk("Calibration Vector Regs 98 - 107: \n"); - for (x=98;x<108;x++) { - printk("%d: %02x\n", x, wctdm_getreg(wc, card, x)); - } - } - return 0; -} - -static void wait_just_a_bit(int foo) -{ - long newjiffies; - newjiffies = jiffies + foo; - while(jiffies < newjiffies); -} - -/********************************************************************* - * Set the hwgain on the analog modules - * - * card = the card position for this module (0-23) - * gain = gain in dB x10 (e.g. -3.5dB would be gain=-35) - * tx = (0 for rx; 1 for tx) - * - *******************************************************************/ -static int wctdm_set_hwgain(struct wctdm *wc, int card, __s32 gain, __u32 tx) -{ - if (!(wc->modtype[card] == MOD_TYPE_FXO)) { - printk("Cannot adjust gain. Unsupported module type!\n"); - return -1; - } - if (tx) { - if (debug) - printk("setting FXO tx gain for card=%d to %d\n", card, gain); - if (gain >= -150 && gain <= 0) { - wctdm_setreg(wc, card, 38, 16 + (gain/-10)); - wctdm_setreg(wc, card, 40, 16 + (-gain%10)); - } else if (gain <= 120 && gain > 0) { - wctdm_setreg(wc, card, 38, gain/10); - wctdm_setreg(wc, card, 40, (gain%10)); - } else { - printk("FXO tx gain is out of range (%d)\n", gain); - return -1; - } - } else { /* rx */ - if (debug) - printk("setting FXO rx gain for card=%d to %d\n", card, gain); - if (gain >= -150 && gain <= 0) { - wctdm_setreg(wc, card, 39, 16+ (gain/-10)); - wctdm_setreg(wc, card, 41, 16 + (-gain%10)); - } else if (gain <= 120 && gain > 0) { - wctdm_setreg(wc, card, 39, gain/10); - wctdm_setreg(wc, card, 41, (gain%10)); - } else { - printk("FXO rx gain is out of range (%d)\n", gain); - return -1; - } - } - - return 0; -} - -static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, int sane) -{ - unsigned char reg16=0, reg26=0, reg30=0, reg31=0; - long newjiffies; - - if (wc->modtype[card & 0xfc] == MOD_TYPE_QRV) return -2; - - wc->modtype[card] = MOD_TYPE_NONE; - /* Wait just a bit */ - wait_just_a_bit(HZ/10); - - wc->modtype[card] = MOD_TYPE_FXO; - wait_just_a_bit(HZ/10); - - if (!sane && wctdm_voicedaa_insane(wc, card)) - return -2; - - /* Software reset */ - wctdm_setreg(wc, card, 1, 0x80); - - /* Wait just a bit */ - wait_just_a_bit(HZ/10); - - /* Enable PCM, ulaw */ - if (alawoverride) - wctdm_setreg(wc, card, 33, 0x20); - else - wctdm_setreg(wc, card, 33, 0x28); - - /* Set On-hook speed, Ringer impedence, and ringer threshold */ - reg16 |= (fxo_modes[_opermode].ohs << 6); - reg16 |= (fxo_modes[_opermode].rz << 1); - reg16 |= (fxo_modes[_opermode].rt); - wctdm_setreg(wc, card, 16, reg16); - - if(fwringdetect || neonmwi_monitor) { - /* Enable ring detector full-wave rectifier mode */ - wctdm_setreg(wc, card, 18, 2); - wctdm_setreg(wc, card, 24, 0); - } else { - /* Set to the device defaults */ - wctdm_setreg(wc, card, 18, 0); - wctdm_setreg(wc, card, 24, 0x19); - } - - /* Enable ring detector full-wave rectifier mode */ - wctdm_setreg(wc, card, 18, 2); - wctdm_setreg(wc, card, 24, 0); - - /* Set DC Termination: - Tip/Ring voltage adjust, minimum operational current, current limitation */ - reg26 |= (fxo_modes[_opermode].dcv << 6); - reg26 |= (fxo_modes[_opermode].mini << 4); - reg26 |= (fxo_modes[_opermode].ilim << 1); - wctdm_setreg(wc, card, 26, reg26); - - /* Set AC Impedence */ - reg30 = (fxo_modes[_opermode].acim); - wctdm_setreg(wc, card, 30, reg30); - - /* Misc. DAA parameters */ - reg31 = 0xa3; - reg31 |= (fxo_modes[_opermode].ohs2 << 3); - wctdm_setreg(wc, card, 31, reg31); - - /* Set Transmit/Receive timeslot */ - wctdm_setreg(wc, card, 34, (card * 8) & 0xff); - wctdm_setreg(wc, card, 35, (card * 8) >> 8); - wctdm_setreg(wc, card, 36, (card * 8) & 0xff); - wctdm_setreg(wc, card, 37, (card * 8) >> 8); - - /* Enable ISO-Cap */ - wctdm_setreg(wc, card, 6, 0x00); - - /* Wait 1000ms for ISO-cap to come up */ - newjiffies = jiffies; - newjiffies += 2 * HZ; - while((jiffies < newjiffies) && !(wctdm_getreg(wc, card, 11) & 0xf0)) - wait_just_a_bit(HZ/10); - - if (!(wctdm_getreg(wc, card, 11) & 0xf0)) { - printk("VoiceDAA did not bring up ISO link properly!\n"); - return -1; - } - if (debug & DEBUG_CARD) - printk("ISO-Cap is now up, line side: %02x rev %02x\n", - wctdm_getreg(wc, card, 11) >> 4, - (wctdm_getreg(wc, card, 13) >> 2) & 0xf); - /* Enable on-hook line monitor */ - wctdm_setreg(wc, card, 5, 0x08); - - /* Take values for fxotxgain and fxorxgain and apply them to module */ - wctdm_set_hwgain(wc, card, fxotxgain, 1); - wctdm_set_hwgain(wc, card, fxorxgain, 0); - - if(debug) - printk("DEBUG fxotxgain:%i.%i fxorxgain:%i.%i\n", (wctdm_getreg(wc, card, 38)/16) ? -(wctdm_getreg(wc, card, 38) - 16) : wctdm_getreg(wc, card, 38), (wctdm_getreg(wc, card, 40)/16) ? -(wctdm_getreg(wc, card, 40) - 16) : wctdm_getreg(wc, card, 40), (wctdm_getreg(wc, card, 39)/16) ? -(wctdm_getreg(wc, card, 39) - 16): wctdm_getreg(wc, card, 39), (wctdm_getreg(wc, card, 41)/16)?-(wctdm_getreg(wc, card, 41) - 16) : wctdm_getreg(wc, card, 41)); - - return 0; - -} - -static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual, int sane) -{ - - unsigned short tmp[5]; - unsigned char r19,r9; - int x; - int fxsmode=0; - - if (wc->modtype[card & 0xfc] == MOD_TYPE_QRV) return -2; - - /* Sanity check the ProSLIC */ - if (!sane && wctdm_proslic_insane(wc, card)) - return -2; - - /* By default, don't send on hook */ - wc->mods[card].fxs.idletxhookstate = 1; - wc->mods[card].fxs.lasttxhook = 0x10; - - if (sane) { - /* Make sure we turn off the DC->DC converter to prevent anything from blowing up */ - wctdm_setreg(wc, card, 14, 0x10); - } - - if (wctdm_proslic_init_indirect_regs(wc, card)) { - printk(KERN_INFO "Indirect Registers failed to initialize on module %d.\n", card); - return -1; - } - - /* Clear scratch pad area */ - wctdm_proslic_setreg_indirect(wc, card, 97,0); - - /* Clear digital loopback */ - wctdm_setreg(wc, card, 8, 0); - - /* Revision C optimization */ - wctdm_setreg(wc, card, 108, 0xeb); - - /* Disable automatic VBat switching for safety to prevent - Q7 from accidently turning on and burning out. */ - wctdm_setreg(wc, card, 67, 0x07); /* If pulse dialing has trouble at high REN - loads change this to 0x17 */ - - /* Turn off Q7 */ - wctdm_setreg(wc, card, 66, 1); - - /* Flush ProSLIC digital filters by setting to clear, while - saving old values */ - for (x=0;x<5;x++) { - tmp[x] = wctdm_proslic_getreg_indirect(wc, card, x + 35); - wctdm_proslic_setreg_indirect(wc, card, x + 35, 0x8000); - } - - /* Power up the DC-DC converter */ - if (wctdm_powerup_proslic(wc, card, fast)) { - printk("Unable to do INITIAL ProSLIC powerup on module %d\n", card); - return -1; - } - - if (!fast) { - - /* Check for power leaks */ - if (wctdm_proslic_powerleak_test(wc, card)) { - printk("ProSLIC module %d failed leakage test. Check for short circuit\n", card); - } - /* Power up again */ - if (wctdm_powerup_proslic(wc, card, fast)) { - printk("Unable to do FINAL ProSLIC powerup on module %d\n", card); - return -1; - } -#ifndef NO_CALIBRATION - /* Perform calibration */ - if(manual) { - if (wctdm_proslic_manual_calibrate(wc, card)) { - //printk("Proslic failed on Manual Calibration\n"); - if (wctdm_proslic_manual_calibrate(wc, card)) { - printk("Proslic Failed on Second Attempt to Calibrate Manually. (Try -DNO_CALIBRATION in Makefile)\n"); - return -1; - } - printk("Proslic Passed Manual Calibration on Second Attempt\n"); - } - } - else { - if(wctdm_proslic_calibrate(wc, card)) { - //printk("ProSlic died on Auto Calibration.\n"); - if (wctdm_proslic_calibrate(wc, card)) { - printk("Proslic Failed on Second Attempt to Auto Calibrate\n"); - return -1; - } - printk("Proslic Passed Auto Calibration on Second Attempt\n"); - } - } - /* Perform DC-DC calibration */ - wctdm_setreg(wc, card, 93, 0x99); - r19 = wctdm_getreg(wc, card, 107); - if ((r19 < 0x2) || (r19 > 0xd)) { - printk("DC-DC cal has a surprising direct 107 of 0x%02x!\n", r19); - wctdm_setreg(wc, card, 107, 0x8); - } - - /* Save calibration vectors */ - for (x=0;xmods[card].fxs.calregs.vals[x] = wctdm_getreg(wc, card, 96 + x); -#endif - - } else { - /* Restore calibration registers */ - for (x=0;xmods[card].fxs.calregs.vals[x]); - } - /* Calibration complete, restore original values */ - for (x=0;x<5;x++) { - wctdm_proslic_setreg_indirect(wc, card, x + 35, tmp[x]); - } - - if (wctdm_proslic_verify_indirect_regs(wc, card)) { - printk(KERN_INFO "Indirect Registers failed verification.\n"); - return -1; - } - - -#if 0 - /* Disable Auto Power Alarm Detect and other "features" */ - wctdm_setreg(wc, card, 67, 0x0e); - blah = wctdm_getreg(wc, card, 67); -#endif - -#if 0 - if (wctdm_proslic_setreg_indirect(wc, card, 97, 0x0)) { // Stanley: for the bad recording fix - printk(KERN_INFO "ProSlic IndirectReg Died.\n"); - return -1; - } -#endif - - if (alawoverride) - wctdm_setreg(wc, card, 1, 0x20); - else - wctdm_setreg(wc, card, 1, 0x28); - // U-Law 8-bit interface - wctdm_setreg(wc, card, 2, (card * 8) & 0xff); // Tx Start count low byte 0 - wctdm_setreg(wc, card, 3, (card * 8) >> 8); // Tx Start count high byte 0 - wctdm_setreg(wc, card, 4, (card * 8) & 0xff); // Rx Start count low byte 0 - wctdm_setreg(wc, card, 5, (card * 8) >> 8); // Rx Start count high byte 0 - wctdm_setreg(wc, card, 18, 0xff); // clear all interrupt - wctdm_setreg(wc, card, 19, 0xff); - wctdm_setreg(wc, card, 20, 0xff); - wctdm_setreg(wc, card, 22, 0xff); - wctdm_setreg(wc, card, 73, 0x04); - if (fxshonormode) { - fxsmode = acim2tiss[fxo_modes[_opermode].acim]; - wctdm_setreg(wc, card, 10, 0x08 | fxsmode); - if (fxo_modes[_opermode].ring_osc) - wctdm_proslic_setreg_indirect(wc, card, 20, fxo_modes[_opermode].ring_osc); - if (fxo_modes[_opermode].ring_x) - wctdm_proslic_setreg_indirect(wc, card, 21, fxo_modes[_opermode].ring_x); - } - if (lowpower) - wctdm_setreg(wc, card, 72, 0x10); - -#if 0 - wctdm_setreg(wc, card, 21, 0x00); // enable interrupt - wctdm_setreg(wc, card, 22, 0x02); // Loop detection interrupt - wctdm_setreg(wc, card, 23, 0x01); // DTMF detection interrupt -#endif - -#if 0 - /* Enable loopback */ - wctdm_setreg(wc, card, 8, 0x2); - wctdm_setreg(wc, card, 14, 0x0); - wctdm_setreg(wc, card, 64, 0x0); - wctdm_setreg(wc, card, 1, 0x08); -#endif - - if (fastringer) { - /* Speed up Ringer */ - wctdm_proslic_setreg_indirect(wc, card, 20, 0x7e6d); - wctdm_proslic_setreg_indirect(wc, card, 21, 0x01b9); - /* Beef up Ringing voltage to 89V */ - if (boostringer) { - wctdm_setreg(wc, card, 74, 0x3f); - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x247)) - return -1; - printk("Boosting fast ringer on slot %d (89V peak)\n", card + 1); - } else if (lowpower) { - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x14b)) - return -1; - printk("Reducing fast ring power on slot %d (50V peak)\n", card + 1); - } else - printk("Speeding up ringer on slot %d (25Hz)\n", card + 1); - } else { - /* Beef up Ringing voltage to 89V */ - if (boostringer) { - wctdm_setreg(wc, card, 74, 0x3f); - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x1d1)) - return -1; - printk("Boosting ringer on slot %d (89V peak)\n", card + 1); - } else if (lowpower) { - if (wctdm_proslic_setreg_indirect(wc, card, 21, 0x108)) - return -1; - printk("Reducing ring power on slot %d (50V peak)\n", card + 1); - } - } - - if (fxstxgain || fxsrxgain) { - r9 = wctdm_getreg(wc, card, 9); - switch (fxstxgain) { - - case 35: - r9+=8; - break; - case -35: - r9+=4; - break; - case 0: - break; - } - - switch (fxsrxgain) { - - case 35: - r9+=2; - break; - case -35: - r9+=1; - break; - case 0: - break; - } - wctdm_setreg(wc, card, 9, r9); - } - - if (debug) - printk("DEBUG: fxstxgain:%s fxsrxgain:%s\n",((wctdm_getreg(wc, card, 9)/8) == 1)?"3.5":(((wctdm_getreg(wc,card,9)/4) == 1)?"-3.5":"0.0"),((wctdm_getreg(wc, card, 9)/2) == 1)?"3.5":((wctdm_getreg(wc,card,9)%2)?"-3.5":"0.0")); - - wc->mods[card].fxs.lasttxhook = 0x11; - wctdm_setreg(wc, card, 64, 0x01); - return 0; -} - -static int wctdm_init_qrvdri(struct wctdm *wc, int card) -{ - unsigned char x,y; - unsigned long endjif; - - /* have to set this, at least for now */ - wc->modtype[card] = MOD_TYPE_QRV; - if (!(card & 3)) /* if at base of card, reset and write it */ - { - wctdm_setreg(wc,card,0,0x80); - wctdm_setreg(wc,card,0,0x55); - wctdm_setreg(wc,card,1,0x69); - wc->qrvhook[card] = wc->qrvhook[card + 1] = 0; - wc->qrvhook[card + 2] = wc->qrvhook[card + 3] = 0xff; - wc->debouncetime[card] = wc->debouncetime[card + 1] = QRV_DEBOUNCETIME; - wc->qrvdebtime[card] = wc->qrvdebtime[card + 1] = 0; - wc->radmode[card] = wc->radmode[card + 1] = 0; - wc->txgain[card] = wc->txgain[card + 1] = 3599; - wc->rxgain[card] = wc->rxgain[card + 1] = 1199; - } else { /* channel is on same card as base, no need to test */ - if (wc->modtype[card & 0x7c] == MOD_TYPE_QRV) - { - /* only lower 2 are valid */ - if (!(card & 2)) return 0; - } - wc->modtype[card] = MOD_TYPE_NONE; - return 1; - } - x = wctdm_getreg(wc,card,0); - y = wctdm_getreg(wc,card,1); - /* if not a QRV card, return as such */ - if ((x != 0x55) || (y != 0x69)) - { - wc->modtype[card] = MOD_TYPE_NONE; - return 1; - } - for(x = 0; x < 0x30; x++) - { - if ((x >= 0x1c) && (x <= 0x1e)) wctdm_setreg(wc,card,x,0xff); - else wctdm_setreg(wc,card,x,0); - } - wctdm_setreg(wc,card,0,0x80); - endjif = jiffies + (HZ/10); - while(endjif > jiffies); - wctdm_setreg(wc,card,0,0x10); - wctdm_setreg(wc,card,0,0x10); - endjif = jiffies + (HZ/10); - while(endjif > jiffies); - /* set up modes */ - wctdm_setreg(wc,card,0,0x1c); - /* set up I/O directions */ - wctdm_setreg(wc,card,1,0x33); - wctdm_setreg(wc,card,2,0x0f); - wctdm_setreg(wc,card,5,0x0f); - /* set up I/O to quiescent state */ - wctdm_setreg(wc,card,3,0x11); /* D0-7 */ - wctdm_setreg(wc,card,4,0xa); /* D8-11 */ - wctdm_setreg(wc,card,7,0); /* CS outputs */ - /* set up timeslots */ - wctdm_setreg(wc,card,0x13,card + 0x80); /* codec 2 tx, ts0 */ - wctdm_setreg(wc,card,0x17,card + 0x80); /* codec 0 rx, ts0 */ - wctdm_setreg(wc,card,0x14,card + 0x81); /* codec 1 tx, ts1 */ - wctdm_setreg(wc,card,0x18,card + 0x81); /* codec 1 rx, ts1 */ - /* set up for max gains */ - wctdm_setreg(wc,card,0x26,0x24); - wctdm_setreg(wc,card,0x27,0x24); - wctdm_setreg(wc,card,0x0b,0x01); /* "Transmit" gain codec 0 */ - wctdm_setreg(wc,card,0x0c,0x01); /* "Transmit" gain codec 1 */ - wctdm_setreg(wc,card,0x0f,0xff); /* "Receive" gain codec 0 */ - wctdm_setreg(wc,card,0x10,0xff); /* "Receive" gain codec 1 */ - return 0; -} - -static void qrv_dosetup(struct zt_chan *chan,struct wctdm *wc) -{ -int qrvcard; -unsigned char r; -long l; - - /* actually do something with the values */ - qrvcard = (chan->chanpos - 1) & 0xfc; - if (debug) printk("@@@@@ radmodes: %d,%d rxgains: %d,%d txgains: %d,%d\n", - wc->radmode[qrvcard],wc->radmode[qrvcard + 1], - wc->rxgain[qrvcard],wc->rxgain[qrvcard + 1], - wc->txgain[qrvcard],wc->txgain[qrvcard + 1]); - r = 0; - if (wc->radmode[qrvcard] & RADMODE_DEEMP) r |= 4; - if (wc->radmode[qrvcard + 1] & RADMODE_DEEMP) r |= 8; - if (wc->rxgain[qrvcard] < 1200) r |= 1; - if (wc->rxgain[qrvcard + 1] < 1200) r |= 2; - wctdm_setreg(wc, qrvcard, 7, r); - if (debug) printk("@@@@@ setting reg 7 to %02x hex\n",r); - r = 0; - if (wc->radmode[qrvcard] & RADMODE_PREEMP) r |= 3; - else if (wc->txgain[qrvcard] >= 3600) r |= 1; - else if (wc->txgain[qrvcard] >= 1200) r |= 2; - if (wc->radmode[qrvcard + 1] & RADMODE_PREEMP) r |= 0xc; - else if (wc->txgain[qrvcard + 1] >= 3600) r |= 4; - else if (wc->txgain[qrvcard + 1] >= 1200) r |= 8; - wctdm_setreg(wc, qrvcard, 4, r); - if (debug) printk("@@@@@ setting reg 4 to %02x hex\n",r); - r = 0; - if (wc->rxgain[qrvcard] >= 2400) r |= 1; - if (wc->rxgain[qrvcard + 1] >= 2400) r |= 2; - wctdm_setreg(wc, qrvcard, 0x25, r); - if (debug) printk("@@@@@ setting reg 0x25 to %02x hex\n",r); - r = 0; - if (wc->txgain[qrvcard] < 2400) r |= 1; else r |= 4; - if (wc->txgain[qrvcard + 1] < 2400) r |= 8; else r |= 0x20; - wctdm_setreg(wc, qrvcard, 0x26, r); - if (debug) printk("@@@@@ setting reg 0x26 to %02x hex\n",r); - l = ((long)(wc->rxgain[qrvcard] % 1200) * 10000) / 46875; - if (l == 0) l = 1; - if (wc->rxgain[qrvcard] >= 2400) l += 181; - wctdm_setreg(wc, qrvcard, 0x0b, (unsigned char)l); - if (debug) printk("@@@@@ setting reg 0x0b to %02x hex\n",(unsigned char)l); - l = ((long)(wc->rxgain[qrvcard + 1] % 1200) * 10000) / 46875; - if (l == 0) l = 1; - if (wc->rxgain[qrvcard + 1] >= 2400) l += 181; - wctdm_setreg(wc, qrvcard, 0x0c, (unsigned char)l); - if (debug) printk("@@@@@ setting reg 0x0c to %02x hex\n",(unsigned char)l); - l = ((long)(wc->txgain[qrvcard] % 1200) * 10000) / 46875; - if (l == 0) l = 1; - wctdm_setreg(wc, qrvcard, 0x0f, (unsigned char)l); - if (debug) printk("@@@@@ setting reg 0x0f to %02x hex\n", (unsigned char)l); - l = ((long)(wc->txgain[qrvcard + 1] % 1200) * 10000) / 46875; - if (l == 0) l = 1; - wctdm_setreg(wc, qrvcard, 0x10,(unsigned char)l); - if (debug) printk("@@@@@ setting reg 0x10 to %02x hex\n",(unsigned char)l); - return; -} - -static int wctdm_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - struct wctdm_stats stats; - struct wctdm_regs regs; - struct wctdm_regop regop; - struct wctdm_echo_coefs echoregs; - struct zt_hwgain hwgain; - struct wctdm *wc = chan->pvt; - int x; - union { - struct zt_radio_stat s; - struct zt_radio_param p; - } stack; - - switch (cmd) { - case ZT_ONHOOKTRANSFER: - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) - return -EINVAL; - if (get_user(x, (int *)data)) - return -EFAULT; - wc->mods[chan->chanpos - 1].fxs.ohttimer = x << 3; - wc->mods[chan->chanpos - 1].fxs.idletxhookstate = 0x2; /* OHT mode when idle */ - if (wc->mods[chan->chanpos - 1].fxs.lasttxhook == 0x1) { - /* Apply the change if appropriate */ - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x12; - wc->sethook[chan->chanpos - 1] = CMD_WR(64, wc->mods[chan->chanpos - 1].fxs.lasttxhook); - /* wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mods[chan->chanpos - 1].fxs.lasttxhook); */ - } - break; - case WCTDM_GET_STATS: - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) { - stats.tipvolt = wctdm_getreg(wc, chan->chanpos - 1, 80) * -376; - stats.ringvolt = wctdm_getreg(wc, chan->chanpos - 1, 81) * -376; - stats.batvolt = wctdm_getreg(wc, chan->chanpos - 1, 82) * -376; - } else if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { - stats.tipvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; - stats.ringvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; - stats.batvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000; - } else - return -EINVAL; - if (copy_to_user((struct wctdm_stats *)data, &stats, sizeof(stats))) - return -EFAULT; - break; - case WCTDM_GET_REGS: - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXS) { - for (x=0;xchanpos -1, x); - for (x=0;xchanpos - 1, x); - } else if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_QRV) { - memset(®s, 0, sizeof(regs)); - for (x=0;x<0x32;x++) - regs.direct[x] = wctdm_getreg(wc, chan->chanpos - 1, x); - } else { - memset(®s, 0, sizeof(regs)); - for (x=0;xchanpos - 1, x); - } - if (copy_to_user((struct wctdm_regs *)data, ®s, sizeof(regs))) - return -EFAULT; - break; - case WCTDM_SET_REG: - if (copy_from_user(®op, (struct wctdm_regop *)data, sizeof(regop))) - return -EFAULT; - if (regop.indirect) { - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS) - return -EINVAL; - printk("Setting indirect %d to 0x%04x on %d\n", regop.reg, regop.val, chan->chanpos); - wctdm_proslic_setreg_indirect(wc, chan->chanpos - 1, regop.reg, regop.val); - } else { - regop.val &= 0xff; - if (regop.reg == 64) - wc->mods[chan->chanpos-1].fxs.lasttxhook = (regop.val & 0x0f) | 0x10; - - printk("Setting direct %d to %04x on %d\n", regop.reg, regop.val, chan->chanpos); - wctdm_setreg(wc, chan->chanpos - 1, regop.reg, regop.val); - } - break; - case WCTDM_SET_ECHOTUNE: - printk("-- Setting echo registers: \n"); - if (copy_from_user(&echoregs, (struct wctdm_echo_coefs*)data, sizeof(echoregs))) - return -EFAULT; - - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { - /* Set the ACIM register */ - wctdm_setreg(wc, chan->chanpos - 1, 30, echoregs.acim); - - /* Set the digital echo canceller registers */ - wctdm_setreg(wc, chan->chanpos - 1, 45, echoregs.coef1); - wctdm_setreg(wc, chan->chanpos - 1, 46, echoregs.coef2); - wctdm_setreg(wc, chan->chanpos - 1, 47, echoregs.coef3); - wctdm_setreg(wc, chan->chanpos - 1, 48, echoregs.coef4); - wctdm_setreg(wc, chan->chanpos - 1, 49, echoregs.coef5); - wctdm_setreg(wc, chan->chanpos - 1, 50, echoregs.coef6); - wctdm_setreg(wc, chan->chanpos - 1, 51, echoregs.coef7); - wctdm_setreg(wc, chan->chanpos - 1, 52, echoregs.coef8); - - printk("-- Set echo registers successfully\n"); - - break; - } else { - return -EINVAL; - - } - break; - case ZT_SET_HWGAIN: - if (copy_from_user(&hwgain, (struct zt_hwgain*) data, sizeof(hwgain))) - return -EFAULT; - - wctdm_set_hwgain(wc, chan->chanpos-1, hwgain.newgain, hwgain.tx); - - if (debug) - printk("Setting hwgain on channel %d to %d for %s direction\n", - chan->chanpos-1, hwgain.newgain, hwgain.tx ? "tx" : "rx"); - break; -#ifdef VPM_SUPPORT - case ZT_TONEDETECT: - if (get_user(x, (int *) data)) - return -EFAULT; - if (!wc->vpm && !wc->vpm150m) - return -ENOSYS; - if ((wc->vpm || wc->vpm150m) && (x && !vpmdtmfsupport)) - return -ENOSYS; - if (x & ZT_TONEDETECT_ON) { - set_bit(chan->chanpos - 1, &wc->dtmfmask); - } else { - clear_bit(chan->chanpos - 1, &wc->dtmfmask); - } - if (x & ZT_TONEDETECT_MUTE) { - if (wc->vpm150m) { - set_bit(chan->chanpos - 1, &wc->vpm150m->desireddtmfmutestate); - } - } else { - if (wc->vpm150m) { - clear_bit(chan->chanpos - 1, &wc->vpm150m->desireddtmfmutestate); - } - } - return 0; -#endif - case ZT_RADIO_GETPARAM: - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_QRV) - return -ENOTTY; - if (copy_from_user(&stack.p,(struct zt_radio_param *)data,sizeof(struct zt_radio_param))) return -EFAULT; - stack.p.data = 0; /* start with 0 value in output */ - switch(stack.p.radpar) { - case ZT_RADPAR_INVERTCOR: - if (wc->radmode[chan->chanpos - 1] & RADMODE_INVERTCOR) - stack.p.data = 1; - break; - case ZT_RADPAR_IGNORECOR: - if (wc->radmode[chan->chanpos - 1] & RADMODE_IGNORECOR) - stack.p.data = 1; - break; - case ZT_RADPAR_IGNORECT: - if (wc->radmode[chan->chanpos - 1] & RADMODE_IGNORECT) - stack.p.data = 1; - break; - case ZT_RADPAR_EXTRXTONE: - stack.p.data = 0; - if (wc->radmode[chan->chanpos - 1] & RADMODE_EXTTONE) - { - stack.p.data = 1; - if (wc->radmode[chan->chanpos - 1] & RADMODE_EXTINVERT) - { - stack.p.data = 2; - } - } - break; - case ZT_RADPAR_DEBOUNCETIME: - stack.p.data = wc->debouncetime[chan->chanpos - 1]; - break; - case ZT_RADPAR_RXGAIN: - stack.p.data = wc->rxgain[chan->chanpos - 1] - 1199; - break; - case ZT_RADPAR_TXGAIN: - stack.p.data = wc->txgain[chan->chanpos - 1] - 3599; - break; - case ZT_RADPAR_DEEMP: - stack.p.data = 0; - if (wc->radmode[chan->chanpos - 1] & RADMODE_DEEMP) - { - stack.p.data = 1; - } - break; - case ZT_RADPAR_PREEMP: - stack.p.data = 0; - if (wc->radmode[chan->chanpos - 1] & RADMODE_PREEMP) - { - stack.p.data = 1; - } - break; - default: - return -EINVAL; - } - if (copy_to_user((struct zt_radio_param *)data,&stack.p,sizeof(struct zt_radio_param))) return -EFAULT; - break; - case ZT_RADIO_SETPARAM: - if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_QRV) - return -ENOTTY; - if (copy_from_user(&stack.p,(struct zt_radio_param *)data,sizeof(struct zt_radio_param))) return -EFAULT; - switch(stack.p.radpar) { - case ZT_RADPAR_INVERTCOR: - if (stack.p.data) - wc->radmode[chan->chanpos - 1] |= RADMODE_INVERTCOR; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_INVERTCOR; - return 0; - case ZT_RADPAR_IGNORECOR: - if (stack.p.data) - wc->radmode[chan->chanpos - 1] |= RADMODE_IGNORECOR; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_IGNORECOR; - return 0; - case ZT_RADPAR_IGNORECT: - if (stack.p.data) - wc->radmode[chan->chanpos - 1] |= RADMODE_IGNORECT; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_IGNORECT; - return 0; - case ZT_RADPAR_EXTRXTONE: - if (stack.p.data) - wc->radmode[chan->chanpos - 1] |= RADMODE_EXTTONE; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_EXTTONE; - if (stack.p.data > 1) - wc->radmode[chan->chanpos - 1] |= RADMODE_EXTINVERT; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_EXTINVERT; - return 0; - case ZT_RADPAR_DEBOUNCETIME: - wc->debouncetime[chan->chanpos - 1] = stack.p.data; - return 0; - case ZT_RADPAR_RXGAIN: - /* if out of range */ - if ((stack.p.data <= -1200) || (stack.p.data > 1552)) - { - return -EINVAL; - } - wc->rxgain[chan->chanpos - 1] = stack.p.data + 1199; - break; - case ZT_RADPAR_TXGAIN: - /* if out of range */ - if (wc->radmode[chan->chanpos -1] & RADMODE_PREEMP) - { - if ((stack.p.data <= -2400) || (stack.p.data > 0)) - { - return -EINVAL; - } - } - else - { - if ((stack.p.data <= -3600) || (stack.p.data > 1200)) - { - return -EINVAL; - } - } - wc->txgain[chan->chanpos - 1] = stack.p.data + 3599; - break; - case ZT_RADPAR_DEEMP: - if (stack.p.data) - wc->radmode[chan->chanpos - 1] |= RADMODE_DEEMP; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_DEEMP; - wc->rxgain[chan->chanpos - 1] = 1199; - break; - case ZT_RADPAR_PREEMP: - if (stack.p.data) - wc->radmode[chan->chanpos - 1] |= RADMODE_PREEMP; - else - wc->radmode[chan->chanpos - 1] &= ~RADMODE_PREEMP; - wc->txgain[chan->chanpos - 1] = 3599; - break; - default: - return -EINVAL; - } - qrv_dosetup(chan,wc); - return 0; - default: - return -ENOTTY; - } - return 0; -} - -static int wctdm_open(struct zt_chan *chan) -{ - struct wctdm *wc = chan->pvt; - int channo = chan->chanpos - 1; - unsigned long flags; - - if (!(wc->cardflag & (1 << (chan->chanpos - 1)))) - return -ENODEV; - if (wc->dead) - return -ENODEV; - wc->usecount++; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - try_module_get(THIS_MODULE); -#endif - /* Reset the mwi indicators */ - spin_lock_irqsave(&wc->reglock, flags); - wc->mods[channo].fxo.neonmwi_debounce = 0; - wc->mods[channo].fxo.neonmwi_offcounter = 0; - wc->mods[channo].fxo.neonmwi_state = 0; - spin_unlock_irqrestore(&wc->reglock, flags); - - return 0; -} - -static int wctdm_watchdog(struct zt_span *span, int event) -{ - printk("TDM: Called watchdog\n"); - return 0; -} - -static int wctdm_close(struct zt_chan *chan) -{ - struct wctdm *wc = chan->pvt; - int x; - signed char reg; - wc->usecount--; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - for (x=0;xcards;x++) { - if (wc->modtype[x] == MOD_TYPE_FXS) - wc->mods[x].fxs.idletxhookstate = 1; - if (wc->modtype[x] == MOD_TYPE_QRV) - { - int qrvcard = x & 0xfc; - - wc->qrvhook[x] = 0; - wc->qrvhook[x + 2] = 0xff; - wc->debouncetime[x] = QRV_DEBOUNCETIME; - wc->qrvdebtime[x] = 0; - wc->radmode[x] = 0; - wc->txgain[x] = 3599; - wc->rxgain[x] = 1199; - reg = 0; - if (!wc->qrvhook[qrvcard]) reg |= 1; - if (!wc->qrvhook[qrvcard + 1]) reg |= 0x10; - wc->sethook[qrvcard] = CMD_WR(3, reg); - qrv_dosetup(chan,wc); - } - } - /* If we're dead, release us now */ - if (!wc->usecount && wc->dead) - wctdm_release(wc); - return 0; -} - -static int wctdm_hooksig(struct zt_chan *chan, zt_txsig_t txsig) -{ - struct wctdm *wc = chan->pvt; - int reg=0,qrvcard; - if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_QRV) { - qrvcard = (chan->chanpos - 1) & 0xfc; - switch(txsig) { - case ZT_TXSIG_START: - case ZT_TXSIG_OFFHOOK: - wc->qrvhook[chan->chanpos - 1] = 1; - break; - case ZT_TXSIG_ONHOOK: - wc->qrvhook[chan->chanpos - 1] = 0; - break; - default: - printk("wctdm24xxp: Can't set tx state to %d\n", txsig); - } - reg = 0; - if (!wc->qrvhook[qrvcard]) reg |= 1; - if (!wc->qrvhook[qrvcard + 1]) reg |= 0x10; - wc->sethook[qrvcard] = CMD_WR(3, reg); - /* wctdm_setreg(wc, qrvcard, 3, reg); */ - } else if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) { - switch(txsig) { - case ZT_TXSIG_START: - case ZT_TXSIG_OFFHOOK: - wc->mods[chan->chanpos - 1].fxo.offhook = 1; - wc->sethook[chan->chanpos - 1] = CMD_WR(5, 0x9); - /* wctdm_setreg(wc, chan->chanpos - 1, 5, 0x9); */ - break; - case ZT_TXSIG_ONHOOK: - wc->mods[chan->chanpos - 1].fxo.offhook = 0; - wc->sethook[chan->chanpos - 1] = CMD_WR(5, 0x8); - /* wctdm_setreg(wc, chan->chanpos - 1, 5, 0x8); */ - break; - default: - printk("wctdm24xxp: Can't set tx state to %d\n", txsig); - } - } else { - switch(txsig) { - case ZT_TXSIG_ONHOOK: - switch(chan->sig) { - case ZT_SIG_EM: - case ZT_SIG_FXOKS: - case ZT_SIG_FXOLS: - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | - wc->mods[chan->chanpos - 1].fxs.idletxhookstate; - break; - case ZT_SIG_FXOGS: - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x13; - break; - } - break; - case ZT_TXSIG_OFFHOOK: - switch(chan->sig) { - case ZT_SIG_EM: - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x15; - break; - default: - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10 | - wc->mods[chan->chanpos - 1].fxs.idletxhookstate; - break; - } - break; - case ZT_TXSIG_START: - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x14; - break; - case ZT_TXSIG_KEWL: - wc->mods[chan->chanpos - 1].fxs.lasttxhook = 0x10; - break; - default: - printk("wctdm24xxp: Can't set tx state to %d\n", txsig); - } - if (debug & DEBUG_CARD) - printk("Setting FXS hook state to %d (%02x)\n", txsig, reg); - - - wc->sethook[chan->chanpos - 1] = CMD_WR(64, wc->mods[chan->chanpos - 1].fxs.lasttxhook); - /* wctdm_setreg(wc, chan->chanpos - 1, 64, wc->mods[chan->chanpos - 1].fxs.lasttxhook); */ - } - return 0; -} - -static void wctdm_dacs_connect(struct wctdm *wc, int srccard, int dstcard) -{ - - if (wc->dacssrc[dstcard] > - 1) { - printk("wctdm_dacs_connect: Can't have double sourcing yet!\n"); - return; - } - if (!((wc->modtype[srccard] == MOD_TYPE_FXS)||(wc->modtype[srccard] == MOD_TYPE_FXO))){ - printk("wctdm_dacs_connect: Unsupported modtype for card %d\n", srccard); - return; - } - if (!((wc->modtype[dstcard] == MOD_TYPE_FXS)||(wc->modtype[dstcard] == MOD_TYPE_FXO))){ - printk("wctdm_dacs_connect: Unsupported modtype for card %d\n", dstcard); - return; - } - if (debug) - printk("connect %d => %d\n", srccard, dstcard); - wc->dacssrc[dstcard] = srccard; - - /* make srccard transmit to srccard+24 on the TDM bus */ - if (wc->modtype[srccard] == MOD_TYPE_FXS) { - /* proslic */ - wctdm_setreg(wc, srccard, PCM_XMIT_START_COUNT_LSB, ((srccard+24) * 8) & 0xff); - wctdm_setreg(wc, srccard, PCM_XMIT_START_COUNT_MSB, ((srccard+24) * 8) >> 8); - } else if(wc->modtype[srccard] == MOD_TYPE_FXO) { - /* daa */ - wctdm_setreg(wc, srccard, 34, ((srccard+24) * 8) & 0xff); /* TX */ - wctdm_setreg(wc, srccard, 35, ((srccard+24) * 8) >> 8); /* TX */ - } - - /* have dstcard receive from srccard+24 on the TDM bus */ - if (wc->modtype[dstcard] == MOD_TYPE_FXS) { - /* proslic */ - wctdm_setreg(wc, dstcard, PCM_RCV_START_COUNT_LSB, ((srccard+24) * 8) & 0xff); - wctdm_setreg(wc, dstcard, PCM_RCV_START_COUNT_MSB, ((srccard+24) * 8) >> 8); - } else if(wc->modtype[dstcard] == MOD_TYPE_FXO) { - /* daa */ - wctdm_setreg(wc, dstcard, 36, ((srccard+24) * 8) & 0xff); /* RX */ - wctdm_setreg(wc, dstcard, 37, ((srccard+24) * 8) >> 8); /* RX */ - } - -} - -static void wctdm_dacs_disconnect(struct wctdm *wc, int card) -{ - if (wc->dacssrc[card] > -1) { - if (debug) - printk("wctdm_dacs_disconnect: restoring TX for %d and RX for %d\n",wc->dacssrc[card], card); - - /* restore TX (source card) */ - if(wc->modtype[wc->dacssrc[card]] == MOD_TYPE_FXS){ - wctdm_setreg(wc, wc->dacssrc[card], PCM_XMIT_START_COUNT_LSB, (wc->dacssrc[card] * 8) & 0xff); - wctdm_setreg(wc, wc->dacssrc[card], PCM_XMIT_START_COUNT_MSB, (wc->dacssrc[card] * 8) >> 8); - } else if(wc->modtype[wc->dacssrc[card]] == MOD_TYPE_FXO){ - wctdm_setreg(wc, card, 34, (card * 8) & 0xff); - wctdm_setreg(wc, card, 35, (card * 8) >> 8); - } else { - printk("WARNING: wctdm_dacs_disconnect() called on unsupported modtype\n"); - } - - /* restore RX (this card) */ - if(wc->modtype[card] == MOD_TYPE_FXS){ - wctdm_setreg(wc, card, PCM_RCV_START_COUNT_LSB, (card * 8) & 0xff); - wctdm_setreg(wc, card, PCM_RCV_START_COUNT_MSB, (card * 8) >> 8); - } else if(wc->modtype[card] == MOD_TYPE_FXO){ - wctdm_setreg(wc, card, 36, (card * 8) & 0xff); - wctdm_setreg(wc, card, 37, (card * 8) >> 8); - } else { - printk("WARNING: wctdm_dacs_disconnect() called on unsupported modtype\n"); - } - - wc->dacssrc[card] = -1; - } -} - -static int wctdm_dacs(struct zt_chan *dst, struct zt_chan *src) -{ - struct wctdm *wc; - - if(!nativebridge) - return 0; /* should this return -1 since unsuccessful? */ - - wc = dst->pvt; - - if(src) { - wctdm_dacs_connect(wc, src->chanpos - 1, dst->chanpos - 1); - if (debug) - printk("dacs connecct: %d -> %d!\n\n", src->chanpos, dst->chanpos); - } else { - wctdm_dacs_disconnect(wc, dst->chanpos - 1); - if (debug) - printk("dacs disconnect: %d!\n", dst->chanpos); - } - return 0; -} - -static int wctdm_initialize(struct wctdm *wc) -{ - int x; - struct pci_dev *pdev = voicebus_get_pci_dev(wc->vb); - - /* Zapata 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%s Bus %02d Slot %02d", (wc->flags[0] & FLAG_EXPRESS) ? " Express" : "", - pdev->bus->number, PCI_SLOT(pdev->devfn) + 1); - wc->span.manufacturer = "Digium"; - strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1); - if (alawoverride) { - printk("ALAW override parameter detected. Device will be operating in ALAW\n"); - wc->span.deflaw = ZT_LAW_ALAW; - } else - wc->span.deflaw = ZT_LAW_MULAW; - for (x=0;xcards;x++) { - sprintf(wc->chans[x].name, "WCTDM/%d/%d", wc->pos, x); - wc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM | ZT_SIG_CLEAR; - wc->chans[x].sigcap |= ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF | ZT_SIG_CLEAR; - wc->chans[x].chanpos = x+1; - wc->chans[x].pvt = wc; - } - wc->span.chans = wc->chans; - wc->span.channels = wc->type; - wc->span.irq = pdev->irq; - wc->span.hooksig = wctdm_hooksig; - wc->span.open = wctdm_open; - wc->span.close = wctdm_close; - wc->span.flags = ZT_FLAG_RBS; - wc->span.ioctl = wctdm_ioctl; - wc->span.watchdog = wctdm_watchdog; - wc->span.dacs= wctdm_dacs; -#ifdef VPM_SUPPORT - wc->span.echocan_with_params = wctdm_echocan_with_params; -#endif - init_waitqueue_head(&wc->span.maintq); - - wc->span.pvt = wc; - return 0; -} - -static void wctdm_post_initialize(struct wctdm *wc) -{ - int x; - - /* Finalize signalling */ - for (x = 0; x cards; x++) { - if (wc->cardflag & (1 << x)) { - if (wc->modtype[x] == MOD_TYPE_FXO) - wc->chans[x].sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF | ZT_SIG_CLEAR; - else if (wc->modtype[x] == MOD_TYPE_FXS) - wc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM | ZT_SIG_CLEAR; - else if (wc->modtype[x] == MOD_TYPE_QRV) - wc->chans[x].sigcap = ZT_SIG_SF | ZT_SIG_EM | ZT_SIG_CLEAR; - } else if (!(wc->chans[x].sigcap & ZT_SIG_BROKEN)) { - wc->chans[x].sigcap = 0; - } - } - - if (wc->vpm) - strncat(wc->span.devicetype, " with VPM100M", sizeof(wc->span.devicetype) - 1); - else if (wc->vpm150m) - strncat(wc->span.devicetype, " with VPMADT032", sizeof(wc->span.devicetype) - 1); -} - -#ifdef VPM_SUPPORT - -#ifdef VPM150M_SUPPORT - -void vpm150m_set_chanconfig_from_state(struct adt_lec_params * parms, int channum, GpakChannelConfig_t *chanconfig) -{ - chanconfig->PcmInPortA = 3; - chanconfig->PcmInSlotA = channum; - chanconfig->PcmOutPortA = SerialPortNull; - chanconfig->PcmOutSlotA = channum; - chanconfig->PcmInPortB = 2; - chanconfig->PcmInSlotB = channum; - chanconfig->PcmOutPortB = 3; - chanconfig->PcmOutSlotB = channum; - if (vpmdtmfsupport) { - chanconfig->ToneTypesA = DTMF_tone; - chanconfig->MuteToneA = Enabled; - chanconfig->FaxCngDetA = Enabled; - } else { - chanconfig->ToneTypesA = Null_tone; - chanconfig->MuteToneA = Disabled; - chanconfig->FaxCngDetA = Disabled; - } - chanconfig->ToneTypesB = Null_tone; - chanconfig->EcanEnableA = Enabled; - chanconfig->EcanEnableB = Disabled; - chanconfig->MuteToneB = Disabled; - chanconfig->FaxCngDetB = Disabled; - - if (alawoverride) - chanconfig->SoftwareCompand = cmpPCMA; - else - chanconfig->SoftwareCompand = cmpPCMU; - - chanconfig->FrameRate = rate2ms; - chanconfig->EcanParametersA.EcanTapLength = 1024; - chanconfig->EcanParametersA.EcanNlpType = parms->nlp_type; - chanconfig->EcanParametersA.EcanAdaptEnable = 1; - chanconfig->EcanParametersA.EcanG165DetEnable = 1; - chanconfig->EcanParametersA.EcanDblTalkThresh = 6; - chanconfig->EcanParametersA.EcanNlpThreshold = parms->nlp_threshold; - chanconfig->EcanParametersA.EcanNlpConv = 0; - chanconfig->EcanParametersA.EcanNlpUnConv = 0; - chanconfig->EcanParametersA.EcanNlpMaxSuppress = parms->nlp_max_suppress; - chanconfig->EcanParametersA.EcanCngThreshold = 43; - chanconfig->EcanParametersA.EcanAdaptLimit = 50; - chanconfig->EcanParametersA.EcanCrossCorrLimit = 15; - chanconfig->EcanParametersA.EcanNumFirSegments = 3; - chanconfig->EcanParametersA.EcanFirSegmentLen = 64; - - chanconfig->EcanParametersB.EcanTapLength = 1024; - chanconfig->EcanParametersB.EcanNlpType = parms->nlp_type; - chanconfig->EcanParametersB.EcanAdaptEnable = 1; - chanconfig->EcanParametersB.EcanG165DetEnable = 1; - chanconfig->EcanParametersB.EcanDblTalkThresh = 6; - chanconfig->EcanParametersB.EcanNlpThreshold = parms->nlp_threshold; - chanconfig->EcanParametersB.EcanNlpConv = 0; - chanconfig->EcanParametersB.EcanNlpUnConv = 0; - chanconfig->EcanParametersB.EcanNlpMaxSuppress = parms->nlp_max_suppress; - chanconfig->EcanParametersB.EcanCngThreshold = 43; - chanconfig->EcanParametersB.EcanAdaptLimit = 50; - chanconfig->EcanParametersB.EcanCrossCorrLimit = 15; - chanconfig->EcanParametersB.EcanNumFirSegments = 3; - chanconfig->EcanParametersB.EcanFirSegmentLen = 64; -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void vpm150m_bh(void *data) -{ - struct vpm150m *vpm150m = data; -#else -static void vpm150m_bh(struct work_struct *data) -{ - struct vpm150m *vpm150m = container_of(data, struct vpm150m, work); -#endif - struct wctdm *wc = vpm150m->wc; - int i; - - for (i = 0; i < wc->type; i++) { - int enable = -1; - if (test_bit(i, &vpm150m->desireddtmfmutestate)) { - if (!test_bit(i, &vpm150m->curdtmfmutestate)) { - enable = 1; - } - } else { - if (test_bit(i, &vpm150m->curdtmfmutestate)) { - enable = 0; - } - } - if (enable > -1) { - unsigned int start = wc->intcount; - GPAK_AlgControlStat_t pstatus; - int res; - - if (enable) { - res = gpakAlgControl(vpm150m->dspid, i, EnableDTMFMuteA, &pstatus); - if (debug & DEBUG_ECHOCAN) - printk("DTMF mute enable took %d ms\n", wc->intcount - start); - } else { - res = gpakAlgControl(vpm150m->dspid, i, DisableDTMFMuteA, &pstatus); - if (debug & DEBUG_ECHOCAN) - printk("DTMF mute disable took %d ms\n", wc->intcount - start); - } - if (!res) - change_bit(i, &vpm150m->curdtmfmutestate); - } - } - - if (test_bit(VPM150M_DTMFDETECT, &vpm150m->control)) { - unsigned short channel; - GpakAsyncEventCode_t eventcode; - GpakAsyncEventData_t eventdata; - gpakReadEventFIFOMessageStat_t res; - unsigned int start = wc->intcount; - - do { - res = gpakReadEventFIFOMessage(vpm150m->dspid, &channel, &eventcode, &eventdata); - - if (debug & DEBUG_ECHOCAN) - printk("ReadEventFIFOMessage took %d ms\n", wc->intcount - start); - - if (res == RefInvalidEvent || res == RefDspCommFailure) { - printk("VPM Comm Error\n"); - continue; - } - - if (res == RefNoEventAvail) { - continue; - } - - if (eventcode == EventToneDetect) { - GpakToneCodes_t tone = eventdata.toneEvent.ToneCode; - int duration = eventdata.toneEvent.ToneDuration; - char zaptone = vpm150mtone_to_zaptone(tone); - - if (debug & DEBUG_ECHOCAN) - printk("Channel %d: Detected DTMF tone %d of duration %d!!!\n", channel + 1, tone, duration); - - if (test_bit(channel, &wc->dtmfmask) && (eventdata.toneEvent.ToneDuration > 0)) { - struct zt_chan *chan = &wc->chans[channel]; - - if ((tone != EndofMFDigit) && (zaptone != 0)) { - vpm150m->curtone[channel] = tone; - - if (test_bit(channel, &vpm150m->curdtmfmutestate)) { - unsigned long flags; - int y; - - /* Mute the audio data buffers */ - spin_lock_irqsave(&chan->lock, flags); - for (y = 0; y < chan->numbufs; y++) { - if ((chan->inreadbuf > -1) && (chan->readidx[y])) - memset(chan->readbuf[chan->inreadbuf], ZT_XLAW(0, chan), chan->readidx[y]); - } - spin_unlock_irqrestore(&chan->lock, flags); - } - if (!test_bit(channel, &wc->dtmfactive)) { - if (debug & DEBUG_ECHOCAN) - printk("Queuing DTMFDOWN %c\n", zaptone); - set_bit(channel, &wc->dtmfactive); - zt_qevent_lock(chan, (ZT_EVENT_DTMFDOWN | zaptone)); - } - } else if ((tone == EndofMFDigit) && test_bit(channel, &wc->dtmfactive)) { - if (debug & DEBUG_ECHOCAN) - printk("Queuing DTMFUP %c\n", vpm150mtone_to_zaptone(vpm150m->curtone[channel])); - zt_qevent_lock(chan, (ZT_EVENT_DTMFUP | vpm150mtone_to_zaptone(vpm150m->curtone[channel]))); - clear_bit(channel, &wc->dtmfactive); - } - } - } - } while ((res != RefNoEventAvail) && (res != RefInvalidEvent) && (res != RefDspCommFailure)); - } - - for (i = 0; i < wc->type; i++) { - unsigned int start = wc->intcount; - GPAK_AlgControlStat_t pstatus; - int res = 1; - - if ((vpm150m->desiredecstate[i].nlp_type != vpm150m->curecstate[i].nlp_type) - || (vpm150m->desiredecstate[i].nlp_threshold != vpm150m->curecstate[i].nlp_threshold) - || (vpm150m->desiredecstate[i].nlp_max_suppress != vpm150m->curecstate[i].nlp_max_suppress)) { - - GPAK_ChannelConfigStat_t cstatus; - GPAK_TearDownChanStat_t tstatus; - GpakChannelConfig_t chanconfig; - - if (debug & DEBUG_ECHOCAN) - printk("Reconfiguring chan %d for nlp %d, nlp_thresh %d, and max_supp %d\n", i + 1, vpm150m->desiredecstate[i].nlp_type, - vpm150m->desiredecstate[i].nlp_threshold, vpm150m->desiredecstate[i].nlp_max_suppress); - - vpm150m_set_chanconfig_from_state(&vpm150m->desiredecstate[i], i, &chanconfig); - - if ((res = gpakTearDownChannel(vpm150m->dspid, i, &tstatus))) { - goto vpm_bh_out; - } - - if ((res = gpakConfigureChannel(vpm150m->dspid, i, tdmToTdm, &chanconfig, &cstatus))) { - goto vpm_bh_out; - } - - if (!vpm150m->desiredecstate[i].tap_length) - res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &pstatus); - - } else if (vpm150m->desiredecstate[i].tap_length != vpm150m->curecstate[i].tap_length) { - if (vpm150m->desiredecstate[i].tap_length) { - res = gpakAlgControl(vpm150m->dspid, i, EnableEcanA, &pstatus); - if (debug & DEBUG_ECHOCAN) - printk("Echocan enable took %d ms\n", wc->intcount - start); - } else { - res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &pstatus); - if (debug & DEBUG_ECHOCAN) - printk("Echocan disable took %d ms\n", wc->intcount - start); - } - } - -vpm_bh_out: - if (!res) - vpm150m->curecstate[i] = vpm150m->desiredecstate[i]; - } - - return; -} - -static int vpm150m_config_hw(struct wctdm *wc) -{ - struct vpm150m *vpm150m = wc->vpm150m; - gpakConfigPortStatus_t configportstatus; - GpakPortConfig_t portconfig; - GPAK_PortConfigStat_t pstatus; - GpakChannelConfig_t chanconfig; - GPAK_ChannelConfigStat_t cstatus; - GPAK_AlgControlStat_t algstatus; - - int res, i; - - memset(&portconfig, 0, sizeof(GpakPortConfig_t)); - - /* First Serial Port config */ - portconfig.SlotsSelect1 = SlotCfgNone; - portconfig.FirstBlockNum1 = 0; - portconfig.FirstSlotMask1 = 0x0000; - portconfig.SecBlockNum1 = 1; - portconfig.SecSlotMask1 = 0x0000; - portconfig.SerialWordSize1 = SerWordSize8; - portconfig.CompandingMode1 = cmpNone; - portconfig.TxFrameSyncPolarity1 = FrameSyncActHigh; - portconfig.RxFrameSyncPolarity1 = FrameSyncActHigh; - portconfig.TxClockPolarity1 = SerClockActHigh; - portconfig.RxClockPolarity1 = SerClockActHigh; - portconfig.TxDataDelay1 = DataDelay0; - portconfig.RxDataDelay1 = DataDelay0; - portconfig.DxDelay1 = Disabled; - portconfig.ThirdSlotMask1 = 0x0000; - portconfig.FouthSlotMask1 = 0x0000; - portconfig.FifthSlotMask1 = 0x0000; - portconfig.SixthSlotMask1 = 0x0000; - portconfig.SevenSlotMask1 = 0x0000; - portconfig.EightSlotMask1 = 0x0000; - - /* Second Serial Port config */ - portconfig.SlotsSelect2 = SlotCfg2Groups; - portconfig.FirstBlockNum2 = 0; - portconfig.FirstSlotMask2 = 0xffff; - portconfig.SecBlockNum2 = 1; - portconfig.SecSlotMask2 = 0xffff; - portconfig.SerialWordSize2 = SerWordSize8; - portconfig.CompandingMode2 = cmpNone; - portconfig.TxFrameSyncPolarity2 = FrameSyncActHigh; - portconfig.RxFrameSyncPolarity2 = FrameSyncActHigh; - portconfig.TxClockPolarity2 = SerClockActHigh; - portconfig.RxClockPolarity2 = SerClockActLow; - portconfig.TxDataDelay2 = DataDelay0; - portconfig.RxDataDelay2 = DataDelay0; - portconfig.DxDelay2 = Disabled; - portconfig.ThirdSlotMask2 = 0x0000; - portconfig.FouthSlotMask2 = 0x0000; - portconfig.FifthSlotMask2 = 0x0000; - portconfig.SixthSlotMask2 = 0x0000; - portconfig.SevenSlotMask2 = 0x0000; - portconfig.EightSlotMask2 = 0x0000; - - /* Third Serial Port Config */ - portconfig.SlotsSelect3 = SlotCfg2Groups; - portconfig.FirstBlockNum3 = 0; - portconfig.FirstSlotMask3 = 0xffff; - portconfig.SecBlockNum3 = 1; - portconfig.SecSlotMask3 = 0xffff; - portconfig.SerialWordSize3 = SerWordSize8; - portconfig.CompandingMode3 = cmpNone; - portconfig.TxFrameSyncPolarity3 = FrameSyncActHigh; - portconfig.RxFrameSyncPolarity3 = FrameSyncActHigh; - portconfig.TxClockPolarity3 = SerClockActHigh; - portconfig.RxClockPolarity3 = SerClockActLow; - portconfig.TxDataDelay3 = DataDelay0; - portconfig.RxDataDelay3 = DataDelay0; - portconfig.DxDelay3 = Disabled; - portconfig.ThirdSlotMask3 = 0x0000; - portconfig.FouthSlotMask3 = 0x0000; - portconfig.FifthSlotMask3 = 0x0000; - portconfig.SixthSlotMask3 = 0x0000; - portconfig.SevenSlotMask3 = 0x0000; - portconfig.EightSlotMask3 = 0x0000; - - if ((configportstatus = gpakConfigurePorts(vpm150m->dspid, &portconfig, &pstatus))) { - printk("Configuration of ports failed (%d)!\n", configportstatus); - return -1; - } else { - if (debug & DEBUG_ECHOCAN) - printk("Configured McBSP ports successfully\n"); - } - - if ((res = gpakPingDsp(vpm150m->dspid, &vpm150m->version))) { - printk("Error pinging DSP (%d)\n", res); - return -1; - } - - for (i = 0; i < wc->type; i++) { - vpm150m->curecstate[i].tap_length = 0; - vpm150m->curecstate[i].nlp_type = vpmnlptype; - vpm150m->curecstate[i].nlp_threshold = vpmnlpthresh; - vpm150m->curecstate[i].nlp_max_suppress = vpmnlpmaxsupp; - - vpm150m->desiredecstate[i].tap_length = 0; - vpm150m->desiredecstate[i].nlp_type = vpmnlptype; - vpm150m->desiredecstate[i].nlp_threshold = vpmnlpthresh; - vpm150m->desiredecstate[i].nlp_max_suppress = vpmnlpmaxsupp; - - vpm150m_set_chanconfig_from_state(&vpm150m->curecstate[i], i, &chanconfig); - - if ((res = gpakConfigureChannel(vpm150m->dspid, i, tdmToTdm, &chanconfig, &cstatus))) { - printk("Unable to configure channel (%d)\n", res); - if (res == 1) { - printk("Reason %d\n", cstatus); - } - - return -1; - } - - if ((res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &algstatus))) { - printk("Unable to disable echo can on channel %d (reason %d:%d)\n", i + 1, res, algstatus); - return -1; - } - - if (vpmdtmfsupport) { - if ((res = gpakAlgControl(vpm150m->dspid, i, DisableDTMFMuteA, &algstatus))) { - printk("Unable to disable dtmf muting on channel %d (reason %d:%d)\n", i + 1, res, algstatus); - return -1; - } - } - } - - if ((res = gpakPingDsp(vpm150m->dspid, &vpm150m->version))) { - printk("Error pinging DSP (%d)\n", res); - return -1; - } - - vpm150m->wq = create_singlethread_workqueue("wctdm24xxp"); - vpm150m->wc = wc; - - if (!vpm150m->wq) { - printk("Unable to create work queue!\n"); - return -1; - } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&vpm150m->work, vpm150m_bh, vpm150m); -#else - INIT_WORK(&vpm150m->work, vpm150m_bh); -#endif - - /* Turn on DTMF detection */ - if (vpmdtmfsupport) - set_bit(VPM150M_DTMFDETECT, &vpm150m->control); - - set_bit(VPM150M_ACTIVE, &vpm150m->control); - - return 0; -} -#endif /* VPM150M_SUPPORT */ - -enum vpmadt032_init_result { - VPMADT032_SUCCESS, - VPMADT032_NOT_FOUND, - VPMADT032_FAILED, - VPMADT032_DISABLED, -}; - -static enum vpmadt032_init_result wctdm_vpm150m_init(struct wctdm *wc) -{ - unsigned short i; - struct vpm150m *vpm150m; - unsigned short reg; - unsigned long flags; - struct pci_dev* pdev = voicebus_get_pci_dev(wc->vb); - enum vpmadt032_init_result res = VPMADT032_FAILED; - -#ifdef VPM150M_SUPPORT - struct wctdm_firmware fw; - struct firmware embedded_firmware; - const struct firmware *firmware = &embedded_firmware; -#if !defined(HOTPLUG_FIRMWARE) - extern void _binary_zaptel_fw_vpmadt032_bin_size; - extern u8 _binary_zaptel_fw_vpmadt032_bin_start[]; -#else - static const char vpmadt032_firmware[] = "zaptel-fw-vpmadt032.bin"; -#endif - gpakDownloadStatus_t downloadstatus; - gpakPingDspStat_t pingstatus; -#endif - - if (!vpmsupport) { - printk("VPM: Support Disabled\n"); - wc->vpm150m = NULL; - return VPMADT032_DISABLED; - } - - vpm150m = kmalloc(sizeof(struct vpm150m), GFP_KERNEL); - - if (!vpm150m) { - printk("Unable to allocate VPM150M!\n"); - return VPMADT032_FAILED; - } - - memset(vpm150m, 0, sizeof(struct vpm150m)); - - /* Init our vpm150m struct */ - sema_init(&vpm150m->sem, 1); - vpm150m->curpage = 0x80; - - for (i = 0; i < WC_MAX_IFACES; i++) { - if (ifaces[i] == wc) - vpm150m->dspid = i; - } - - if (debug & DEBUG_ECHOCAN) - printk("Setting VPMADT032 DSP ID to %d\n", vpm150m->dspid); - - spin_lock_irqsave(&wc->reglock, flags); - wc->vpm150m = vpm150m; - spin_unlock_irqrestore(&wc->reglock, flags); - - for (i = 0; i < 10; i++) - schluffen(&wc->regq); - - if (debug & DEBUG_ECHOCAN) - printk("VPMADT032 Testing page access: "); - for (i = 0; i < 0xf; i++) { - int x; - for (x = 0; x < 3; x++) { - wctdm_vpm150m_setpage(wc, i); - reg = wctdm_vpm150m_getpage(wc); - if (reg != i) { - if (debug & DEBUG_ECHOCAN) - printk("Failed: Sent %x != %x VPMADT032 Failed HI page test\n", i, reg); - res = VPMADT032_NOT_FOUND; - goto failed_exit; - } - } - } - if (debug & DEBUG_ECHOCAN) - printk("Passed\n"); - - /* Set us up to page 0 */ - wctdm_vpm150m_setpage(wc, 0); - if (debug & DEBUG_ECHOCAN) - printk("VPMADT032 now doing address test: "); - for (i = 0; i < 16; i++) { - int x; - for (x = 0; x < 2; x++) { - wctdm_vpm150m_setreg(wc, 1, 0x1000, &i); - wctdm_vpm150m_getreg(wc, 1, 0x1000, ®); - if (reg != i) { - printk("VPMADT032 Failed address test\n"); - goto failed_exit; - } - - } - } - if (debug & DEBUG_ECHOCAN) - printk("Passed\n"); - -#ifndef VPM150M_SUPPORT - printk("Found VPMADT032 module but it is not able to function in anything less than a version 2.6 kernel\n"); - printk("Please update your kernel to a 2.6 or later kernel to enable it\n"); - goto failed_exit; -#else - -#if 0 - /* Load the firmware */ - set_bit(VPM150M_SPIRESET, &vpm150m->control); - - /* Wait for it to boot */ - msleep(7000); - - pingstatus = gpakPingDsp(vpm150m->dspid, &version); - - if (pingstatus || (version != 0x106)) { -#endif -#if defined(HOTPLUG_FIRMWARE) - if ((request_firmware(&firmware, vpmadt032_firmware, &pdev->dev) != 0) || - !firmware) { - printk("VPMADT032: firmware %s not available from userspace\n", vpmadt032_firmware); - goto failed_exit; - } -#else - embedded_firmware.data = _binary_zaptel_fw_vpmadt032_bin_start; - embedded_firmware.size = (size_t) &_binary_zaptel_fw_vpmadt032_bin_size; -#endif - fw.fw = firmware; - fw.offset = 0; - - set_bit(VPM150M_HPIRESET, &vpm150m->control); - - while (test_bit(VPM150M_HPIRESET, &vpm150m->control)) - schluffen(&wc->regq); - - printk("VPMADT032 Loading firwmare... "); - downloadstatus = gpakDownloadDsp(vpm150m->dspid, &fw); - - if (firmware != &embedded_firmware) - release_firmware(firmware); - - if (downloadstatus != 0) { - printk("Unable to download firmware to VPMADT032 with cause %d\n", downloadstatus); - goto failed_exit; - } else { - printk("Success\n"); - } - - set_bit(VPM150M_SWRESET, &vpm150m->control); - - while (test_bit(VPM150M_SWRESET, &vpm150m->control)) - schluffen(&wc->regq); - -#if 0 - } -#endif - - pingstatus = gpakPingDsp(vpm150m->dspid, &vpm150m->version); - - if (!pingstatus) { - if (debug & DEBUG_ECHOCAN) - printk("Version of DSP is %x\n", vpm150m->version); - } else { - printk("VPMADT032 Failed! Unable to ping the DSP (%d)!\n", pingstatus); - goto failed_exit; - } - - if (vpm150m_config_hw(wc)) { - goto failed_exit; - } - - return VPMADT032_SUCCESS; -#endif /* VPM150M_SUPPORT */ - -failed_exit: - spin_lock_irqsave(&wc->reglock, flags); - wc->vpm150m = NULL; - spin_unlock_irqrestore(&wc->reglock, flags); - kfree(vpm150m); - - return res; -} - -static void wctdm_vpm_set_dtmf_threshold(struct wctdm *wc, unsigned int threshold) -{ - unsigned int x; - - for (x = 0; x < 4; x++) { - wctdm_vpm_out(wc, x, 0xC4, (threshold >> 8) & 0xFF); - wctdm_vpm_out(wc, x, 0xC5, (threshold & 0xFF)); - } - printk("VPM: DTMF threshold set to %d\n", threshold); -} - -static void wctdm_vpm_init(struct wctdm *wc) -{ - unsigned char reg; - unsigned int mask; - unsigned int ver; - unsigned char vpmver=0; - unsigned int i, x, y; - - if (!vpmsupport) { - printk("VPM: Support Disabled\n"); - wc->vpm = 0; - return; - } - - for (x=0;xvpm = 0; - return; - } - - if (!x) { - vpmver = wctdm_vpm_in(wc, x, 0x1a6) & 0xf; - printk("VPM Revision: %02x\n", vpmver); - } - - - /* Setup GPIO's */ - for (y=0;y<4;y++) { - wctdm_vpm_out(wc, x, 0x1a8 + y, 0x00); /* GPIO out */ - if (y == 3) - wctdm_vpm_out(wc, x, 0x1ac + y, 0x00); /* GPIO dir */ - else - wctdm_vpm_out(wc, x, 0x1ac + y, 0xff); /* GPIO dir */ - wctdm_vpm_out(wc, x, 0x1b0 + y, 0x00); /* GPIO sel */ - } - - /* Setup TDM path - sets fsync and tdm_clk as inputs */ - reg = wctdm_vpm_in(wc, x, 0x1a3); /* misc_con */ - wctdm_vpm_out(wc, x, 0x1a3, reg & ~2); - - /* Setup Echo length (256 taps) */ - wctdm_vpm_out(wc, x, 0x022, 0); - - /* Setup timeslots */ - if (vpmver == 0x01) { - wctdm_vpm_out(wc, x, 0x02f, 0x00); - wctdm_vpm_out(wc, x, 0x023, 0xff); - mask = 0x11111111 << x; - } else { - wctdm_vpm_out(wc, x, 0x02f, 0x20 | (x << 3)); - wctdm_vpm_out(wc, x, 0x023, 0x3f); - mask = 0x0000003f; - } - - /* Setup the tdm channel masks for all chips*/ - for (i = 0; i < 4; i++) - wctdm_vpm_out(wc, x, 0x33 - i, (mask >> (i << 3)) & 0xff); - - /* Setup convergence rate */ - reg = wctdm_vpm_in(wc,x,0x20); - reg &= 0xE0; - if (alawoverride) { - if (!x) - printk("VPM: A-law mode\n"); - reg |= 0x01; - } else { - if (!x) - printk("VPM: U-law mode\n"); - reg &= ~0x01; - } - wctdm_vpm_out(wc,x,0x20,(reg | 0x20)); - - /* Initialize echo cans */ - for (i = 0 ; i < MAX_TDM_CHAN; i++) { - if (mask & (0x00000001 << i)) - wctdm_vpm_out(wc,x,i,0x00); - } - - for (i=0;i<30;i++) - schluffen(&wc->regq); - - /* Put in bypass mode */ - for (i = 0 ; i < MAX_TDM_CHAN ; i++) { - if (mask & (0x00000001 << i)) { - wctdm_vpm_out(wc,x,i,0x01); - } - } - - /* Enable bypass */ - for (i = 0 ; i < MAX_TDM_CHAN ; i++) { - if (mask & (0x00000001 << i)) - wctdm_vpm_out(wc,x,0x78 + i,0x01); - } - - /* Enable DTMF detectors (always DTMF detect all spans) */ - for (i = 0; i < 6; i++) { - if (vpmver == 0x01) - wctdm_vpm_out(wc, x, 0x98 + i, 0x40 | (i << 2) | x); - else - wctdm_vpm_out(wc, x, 0x98 + i, 0x40 | i); - } - - for (i = 0xB8; i < 0xC0; i++) - wctdm_vpm_out(wc, x, i, 0xFF); - for (i = 0xC0; i < 0xC4; i++) - wctdm_vpm_out(wc, x, i, 0xff); - - } - /* set DTMF detection threshold */ - wctdm_vpm_set_dtmf_threshold(wc, dtmfthreshold); - - if (vpmver == 0x01) - wc->vpm = 2; - else - wc->vpm = 1; - - printk("Enabling VPM100 gain adjustments on any FXO ports found\n"); - for (i = 0; i < wc->type; i++) { - if (wc->modtype[i] == MOD_TYPE_FXO) { - /* Apply negative Tx gain of 4.5db to DAA */ - wctdm_setreg(wc, i, 38, 0x14); /* 4db */ - wctdm_setreg(wc, i, 40, 0x15); /* 0.5db */ - - /* Apply negative Rx gain of 4.5db to DAA */ - wctdm_setreg(wc, i, 39, 0x14); /* 4db */ - wctdm_setreg(wc, i, 41, 0x15); /* 0.5db */ - } - } - -} - -#endif - -static int wctdm_locate_modules(struct wctdm *wc) -{ - int x; - unsigned long flags; - unsigned int startinglatency = voicebus_current_latency(wc->vb); - wc->ctlreg = 0x00; - - /* Make sure all units go into daisy chain mode */ - spin_lock_irqsave(&wc->reglock, flags); - wc->span.irqmisses = 0; - for (x=0;xcards;x++) - wc->modtype[x] = MOD_TYPE_FXSINIT; -#ifdef VPM_SUPPORT - wc->vpm = -1; - for (x = wc->cards; x < wc->cards+NUM_EC; x++) - wc->modtype[x] = MOD_TYPE_VPM; -#endif - spin_unlock_irqrestore(&wc->reglock, flags); - /* Wait just a bit */ - for (x=0;x<10;x++) - schluffen(&wc->regq); - spin_lock_irqsave(&wc->reglock, flags); - for (x=0;xcards;x++) - wc->modtype[x] = MOD_TYPE_FXS; - spin_unlock_irqrestore(&wc->reglock, flags); - -#if 0 - /* XXX */ - cmddesc = 0; -#endif - /* Now that all the cards have been reset, we can stop checking them all if there aren't as many */ - spin_lock_irqsave(&wc->reglock, flags); - wc->cards = wc->type; - spin_unlock_irqrestore(&wc->reglock, flags); - - /* Reset modules */ - for (x=0;xcards;x++) { - int sane=0,ret=0,readi=0; -retry: - if (voicebus_current_latency(wc->vb) > startinglatency) { - return -EAGAIN; - } - /* Init with Auto Calibration */ - if (!(ret = wctdm_init_proslic(wc, x, 0, 0, sane))) { - wc->cardflag |= (1 << x); - if (debug & DEBUG_CARD) { - readi = wctdm_getreg(wc,x,LOOP_I_LIMIT); - printk("Proslic module %d loop current is %dmA\n",x, - ((readi*3)+20)); - } - printk("Port %d: Installed -- AUTO FXS/DPO\n", x + 1); - } else { - if(ret!=-2) { - sane=1; - /* Init with Manual Calibration */ - if (!wctdm_init_proslic(wc, x, 0, 1, sane)) { - wc->cardflag |= (1 << x); - if (debug & DEBUG_CARD) { - readi = wctdm_getreg(wc,x,LOOP_I_LIMIT); - printk("Proslic module %d loop current is %dmA\n",x, - ((readi*3)+20)); - } - printk("Port %d: Installed -- MANUAL FXS\n",x + 1); - } else { - printk("Port %d: FAILED FXS (%s)\n", x + 1, fxshonormode ? fxo_modes[_opermode].name : "FCC"); - wc->chans[x].sigcap = ZT_SIG_BROKEN | __ZT_SIG_FXO; - } - } else if (!(ret = wctdm_init_voicedaa(wc, x, 0, 0, sane))) { - wc->cardflag |= (1 << x); - printk("Port %d: Installed -- AUTO FXO (%s mode)\n",x + 1, fxo_modes[_opermode].name); - } else if (!wctdm_init_qrvdri(wc,x)) { - wc->cardflag |= 1 << x; - printk("Port %d: Installed -- QRV DRI card\n",x + 1); - } else { - if ((wc->type != 24) && ((x & 0x3) == 1) && !wc->altcs[x]) { - spin_lock_irqsave(&wc->reglock, flags); - wc->altcs[x] = 2; - if (wc->type == 4) { - wc->altcs[x+1] = 3; - wc->altcs[x+2] = 3; - } - wc->modtype[x] = MOD_TYPE_FXSINIT; - spin_unlock_irqrestore(&wc->reglock, flags); - - schluffen(&wc->regq); - schluffen(&wc->regq); - spin_lock_irqsave(&wc->reglock, flags); - wc->modtype[x] = MOD_TYPE_FXS; - spin_unlock_irqrestore(&wc->reglock, flags); - if (debug & DEBUG_CARD) - printk("Trying port %d with alternate chip select\n", x + 1); - goto retry; - } else { - printk("Port %d: Not installed\n", x + 1); - wc->modtype[x] = MOD_TYPE_NONE; - wc->cardflag |= (1 << x); - } - } - } - } -#ifdef VPM_SUPPORT - wctdm_vpm_init(wc); - if (wc->vpm) { - printk("VPM: Present and operational (Rev %c)\n", 'A' + wc->vpm - 1); - wc->ctlreg |= 0x10; - } else { - enum vpmadt032_init_result res; - spin_lock_irqsave(&wc->reglock, flags); - for (x = NUM_CARDS; x < NUM_CARDS + NUM_EC; x++) - wc->modtype[x] = MOD_TYPE_NONE; - spin_unlock_irqrestore(&wc->reglock, flags); - res = wctdm_vpm150m_init(wc); - /* In case there was an error while we were loading the VPM module. */ - if (voicebus_current_latency(wc->vb) > startinglatency) { - return -EAGAIN; - } - switch (res) { - case VPMADT032_SUCCESS: - printk("VPMADT032: Present and operational (Firmware version %x)\n", wc->vpm150m->version); - wc->ctlreg |= 0x10; - break; - case VPMADT032_DISABLED: - case VPMADT032_NOT_FOUND: - /* nothing */ - break; - default: - return -EIO; - } - } -#endif - /* In case there was an error while we were loading the VPM module. */ - if (voicebus_current_latency(wc->vb) > startinglatency) { - return -EAGAIN; - } - return 0; -} - -static struct pci_driver wctdm_driver; - -static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - struct wctdm *wc; - struct wctdm_desc *d = (struct wctdm_desc *)ent->driver_data; - int i; - int y; - int ret; - - neonmwi_offlimit_cycles = neonmwi_offlimit /MS_PER_HOOKCHECK; - -retry: - wc = kmalloc(sizeof(struct wctdm), GFP_KERNEL); - if (!wc) { - /* \todo Print debug message. */ - return -ENOMEM; - } - memset(wc, 0, sizeof(*wc)); - spin_lock(&ifacelock); - /* \todo this is a candidate for removal... */ - for (i = 0; i < WC_MAX_IFACES; ++i) { - if (!ifaces[i]) { - ifaces[i] = wc; - break; - } - } - spin_unlock(&ifacelock); - - snprintf(wc->board_name, sizeof(wc->board_name)-1, "%s%d", - wctdm_driver.name, i); - ret = voicebus_init(pdev, SFRAME_SIZE, wc->board_name, - handle_receive, handle_transmit, wc, &wc->vb); - if (ret) { - kfree(wc); - return ret; - } - BUG_ON(!wc->vb); - - if (VOICEBUS_DEFAULT_LATENCY != latency) { - voicebus_set_minlatency(wc->vb, latency); - } - - spin_lock_init(&wc->reglock); - wc->curcard = -1; - wc->cards = NUM_CARDS; - wc->type = d->ports; - wc->pos = i; - wc->variety = d->name; - wc->txident = 1; - for (y=0;yflags[y] = d->flags; - wc->dacssrc[y] = -1; - } - - init_waitqueue_head(&wc->regq); - - if (wctdm_initialize(wc)) { - voicebus_release(wc->vb); - wc->vb = NULL; - kfree(wc); - return -EIO; - } - - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - - /* Start the hardware processing. */ - if (voicebus_start(wc->vb)) { - BUG_ON(1); - } - - /* Now track down what modules are installed */ - ret = wctdm_locate_modules(wc); - if (-EAGAIN == ret ) { - /* The voicebus library increased the latency during - * initialization. There is a chance that the hardware is in - * an inconsistent state, so lets increase the default latency - * and start the initialization over. - */ - printk(KERN_NOTICE "%s: Restarting board initialization " \ - "after increasing latency.\n", wc->board_name); - latency = voicebus_current_latency(wc->vb); - wctdm_release(wc); - goto retry; - } - - /* Final initialization */ - wctdm_post_initialize(wc); - - /* We should be ready for zaptel to come in now. */ - if (zt_register(&wc->span, 0)) { - printk("Unable to register span with zaptel\n"); - return -1; - } - - wc->initialized = 1; - - printk("Found a Wildcard TDM: %s (%d modules)\n", wc->variety, wc->type); - ret = 0; - - return ret; -} - -static void wctdm_release(struct wctdm *wc) -{ - int i; - - if (wc->initialized) { - zt_unregister(&wc->span); - } - - voicebus_release(wc->vb); - wc->vb = NULL; - - spin_lock(&ifacelock); - for (i = 0; i < WC_MAX_IFACES; i++) - if (ifaces[i] == wc) - break; - ifaces[i] = NULL; - spin_unlock(&ifacelock); - - kfree(wc); -} - -static void __devexit wctdm_remove_one(struct pci_dev *pdev) -{ - struct wctdm *wc = pci_get_drvdata(pdev); - -#ifdef VPM150M_SUPPORT - unsigned long flags; - struct vpm150m *vpm150m = wc->vpm150m; -#endif - - if (wc) { - -#ifdef VPM150M_SUPPORT - if (vpm150m) { - clear_bit(VPM150M_DTMFDETECT, &vpm150m->control); - clear_bit(VPM150M_ACTIVE, &vpm150m->control); - flush_workqueue(vpm150m->wq); - destroy_workqueue(vpm150m->wq); - } -#endif - voicebus_stop(wc->vb); - -#ifdef VPM150M_SUPPORT - if (vpm150m) { - spin_lock_irqsave(&wc->reglock, flags); - wc->vpm150m = NULL; - vpm150m->wc = NULL; - spin_unlock_irqrestore(&wc->reglock, flags); - kfree(wc->vpm150m); - } -#endif - /* Release span, possibly delayed */ - if (!wc->usecount) { - wctdm_release(wc); - printk("Freed a Wildcard\n"); - } - else - wc->dead = 1; - } -} - -static struct pci_device_id wctdm_pci_tbl[] = { - { 0xd161, 0x2400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm2400 }, - { 0xd161, 0x0800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm800 }, - { 0xd161, 0x8002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcaex800 }, - { 0xd161, 0x8003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcaex2400 }, - { 0xd161, 0x8005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wctdm410 }, - { 0xd161, 0x8006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &wcaex410 }, - { 0 } -}; - -MODULE_DEVICE_TABLE(pci, wctdm_pci_tbl); - -static struct pci_driver wctdm_driver = { - name: "wctdm24xxp", - probe: wctdm_init_one, -#ifdef LINUX26 - remove: __devexit_p(wctdm_remove_one), -#else - remove: wctdm_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: wctdm_pci_tbl, -}; - -static int __init wctdm_init(void) -{ - int res; - int x; - - for (x = 0; x < (sizeof(fxo_modes) / sizeof(fxo_modes[0])); x++) { - if (!strcmp(fxo_modes[x].name, opermode)) - break; - } - if (x < sizeof(fxo_modes) / sizeof(fxo_modes[0])) { - _opermode = x; - } else { - printk("Invalid/unknown operating mode '%s' specified. Please choose one of:\n", opermode); - for (x = 0; x < sizeof(fxo_modes) / sizeof(fxo_modes[0]); x++) - printk(" %s\n", fxo_modes[x].name); - printk("Note this option is CASE SENSITIVE!\n"); - return -ENODEV; - } - - if (!strcmp(opermode, "AUSTRALIA")) { - boostringer = 1; - fxshonormode = 1; - } - - /* for the voicedaa_check_hook defaults, if the user has not overridden - them by specifying them as module parameters, then get the values - from the selected operating mode - */ - if (battdebounce == 0) { - battdebounce = fxo_modes[_opermode].battdebounce; - } - if (battalarm == 0) { - battalarm = fxo_modes[_opermode].battalarm; - } - if (battthresh == 0) { - battthresh = fxo_modes[_opermode].battthresh; - } - - res = zap_pci_module(&wctdm_driver); - if (res) - return -ENODEV; - return 0; -} - -static void __exit wctdm_cleanup(void) -{ - pci_unregister_driver(&wctdm_driver); -} - -#ifdef LINUX26 -module_param(debug, int, 0600); -module_param(fxovoltage, int, 0600); -module_param(loopcurrent, int, 0600); -module_param(robust, int, 0600); -module_param(opermode, charp, 0600); -module_param(lowpower, int, 0600); -module_param(boostringer, int, 0600); -module_param(fastringer, int, 0600); -module_param(fxshonormode, int, 0600); -module_param(battdebounce, uint, 0600); -module_param(battalarm, uint, 0600); -module_param(battthresh, uint, 0600); -module_param(alawoverride, int, 0600); -module_param(nativebridge, int, 0600); -module_param(fxotxgain, int, 0600); -module_param(fxorxgain, int, 0600); -module_param(fxstxgain, int, 0600); -module_param(fxsrxgain, int, 0600); -module_param(ringdebounce, int, 0600); -module_param(fwringdetect, int, 0600); -module_param(latency, int, 0600); -module_param(neonmwi_monitor, int, 0600); -module_param(neonmwi_level, int, 0600); -module_param(neonmwi_envelope, int, 0600); -module_param(neonmwi_offlimit, int, 0600); -#ifdef VPM_SUPPORT -module_param(vpmsupport, int, 0600); -module_param(vpmdtmfsupport, int, 0600); -module_param(dtmfthreshold, int, 0600); -module_param(vpmnlptype, int, 0600); -module_param(vpmnlpthresh, int, 0600); -module_param(vpmnlpmaxsupp, int, 0600); -#endif -#else -MODULE_PARM(debug, "i"); -MODULE_PARM(fxovoltage, "i"); -MODULE_PARM(loopcurrent, "i"); -MODULE_PARM(robust, "i"); -MODULE_PARM(opermode, "s"); -MODULE_PARM(lowpower, "i"); -MODULE_PARM(boostringer, "i"); -MODULE_PARM(fastringer, "i"); -MODULE_PARM(fxshonormode, "i"); -MODULE_PARM(battdebounce, "i"); -MODULE_PARM(battalarm, "i"); -MODULE_PARM(battthresh, "i"); -MODULE_PARM(alawoverride, "i"); -MODULE_PARM(nativebridge, "i"); -MODULE_PARM(fxotxgain, "i"); -MODULE_PARM(fxorxgain, "i"); -MODULE_PARM(fxstxgain, "i"); -MODULE_PARM(fxsrxgain, "i"); -MODULE_PARM(ringdebounce, "i"); -MODULE_PARM(fwringdetect, "i"); -MODULE_PARM(neonmwi_monitor, "i"); -MODULE_PARM(neonmwi_level, "i"); -MODULE_PARM(neonmwi_envelope, "i"); -MODULE_PARM(neonmwi_offlimit, "i"); -#ifdef VPM_SUPPORT -MODULE_PARM(vpmsupport, "i"); -MODULE_PARM(vpmdtmfsupport, "i"); -MODULE_PARM(dtmfthreshold, "i"); -MODULE_PARM(vpmnlptype, "i"); -MODULE_PARM(vpmnlpthresh, "i"); -MODULE_PARM(vpmnlpmaxsupp, "i"); -#endif -#endif -MODULE_DESCRIPTION("Wildcard TDM2400P/TDM800P Zaptel Driver"); -MODULE_AUTHOR("Mark Spencer "); -#if defined(MODULE_ALIAS) -MODULE_ALIAS("wctdm8xxp"); -#endif -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(wctdm_init); -module_exit(wctdm_cleanup); diff --git a/zaptel/kernel/wctdm24xxp/gpakErrs.h b/zaptel/kernel/wctdm24xxp/gpakErrs.h deleted file mode 100644 index 2f5083bb..00000000 --- a/zaptel/kernel/wctdm24xxp/gpakErrs.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2002 - 2004, Adaptive Digital Technologies, Inc. - * - * File Name: GpakErrs.h - * - * Description: - * This file contains DSP reply status codes used by G.PAK API functions to - * indicate specific errors. - * - * Version: 1.0 - * - * Revision History: - * 10/17/01 - Initial release. - * 07/03/02 - Updates for conferencing. - * 06/15/04 - Tone type updates. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKERRS_H /* prevent multiple inclusion */ -#define _GPAKERRS_H - -/* Configure Serial Ports reply status codes. */ -typedef enum -{ - Pc_Success = 0, /* serial ports configured successfully */ - Pc_ChannelsActive = 1, /* unable to configure while channels active */ - Pc_TooManySlots1 = 2, /* too many slots selected for port 1 */ - Pc_InvalidBlockCombo1 = 3, /* invalid combination of blocks for port 1 */ - Pc_NoSlots1 = 4, /* no slots selected for port 1 */ - Pc_InvalidSlots1 = 5, /* invalid slot (> max) selected for port 1 */ - Pc_TooManySlots2 = 6, /* too many slots selected for port 2 */ - Pc_InvalidBlockCombo2 = 7, /* invalid combination of blocks for port 2 */ - Pc_NoSlots2 = 8, /* no slots selected for port 2 */ - Pc_InvalidSlots2 = 9, /* invalid slot (> max) selected for port 2 */ - Pc_TooManySlots3 = 10, /* too many slots selected for port 3 */ - Pc_InvalidBlockCombo3 = 11, /* invalid combination of blocks for port 3 */ - Pc_NoSlots3 = 12, /* no slots selected for port 3 */ - Pc_InvalidSlots3 = 13 /* invalid slot (> max) selected for port 3 */ -} GPAK_PortConfigStat_t; - -/* Configure Channel reply status codes. */ -typedef enum -{ - Cc_Success = 0, /* channel configured successfully */ - Cc_InvalidChannelType = 1, /* invalid Channel Type */ - Cc_InvalidChannel = 2, /* invalid Channel A Id */ - Cc_ChannelActiveA = 3, /* Channel A is currently active */ - Cc_InvalidInputPortA = 4, /* invalid Input A Port */ - Cc_InvalidInputSlotA = 5, /* invalid Input A Slot */ - Cc_BusyInputSlotA = 6, /* busy Input A Slot */ - Cc_InvalidOutputPortA = 7, /* invalid Output A Port */ - Cc_InvalidOutputSlotA = 8, /* invalid Output A Slot */ - Cc_BusyOutputSlotA = 9, /* busy Output A Slot */ - Cc_InvalidInputPortB = 10, /* invalid Input B Port */ - Cc_InvalidInputSlotB = 11, /* invalid Input B Slot */ - Cc_BusyInputSlotB = 12, /* busy Input B Slot */ - Cc_InvalidPktInCodingA = 13, /* invalid Packet In A Coding */ - Cc_InvalidPktOutCodingA = 14, /* invalid Packet Out A Coding */ - Cc_InvalidPktInSizeA = 15, /* invalid Packet In A Frame Size */ - Cc_InvalidPktOutSizeA = 16, /* invalid Packet Out A Frame Size */ - - Cc_ChanTypeNotConfigured = 21, /* channel type was not configured */ - Cc_InsuffECResources = 22, /* insufficient ecan resources avail. */ - Cc_InsuffTDMResources = 23, /* insufficient tdm block resources avail. */ - - Cc_InsuffPktBufResources = 25, /* insufficient pkt buffer resources avail. */ - Cc_InsuffPcmBufResources = 26, /* insufficient pcm buffer resources avail. */ - - Cc_BadPcmEcNlpType = 30, /* invalid EC Nlp type */ - Cc_BadPcmEcTapLength = 31, /* invalid EC tap length */ - Cc_BadPcmEcDblTalkThresh = 32, /* invalid EC double-talk threshold */ - Cc_BadPcmEcNlpThreshold = 33, /* invalid EC Nlp threshold */ - Cc_BadPcmEcCngThreshold = 34, /* invalid EC Cng threshold */ - Cc_BadPcmEcAdaptLimit = 35, /* invalid EC Adapt Limit */ - Cc_BadPcmEcCrossCorrLim = 36, /* invalid EC Cross Correlation Limit */ - Cc_BadPcmEcNumFirSegs = 37, /* invalid EC Number of FirSegments */ - Cc_BadPcmEcFirSegLen = 38, /* invalid EC Fir Segment Length */ - - /*Cc_InvalidNumEcsEnabled = 48, */ /* more than 1 Ec enabled on channel */ - Cc_InvalidFrameRate = 49, /* invalid gpak frame rate */ - Cc_InvalidSoftCompand = 50, /* invalid softCompanding type */ - - Cc_InvalidMuteToneA = 51, /* invalid MuteToneA set, no detector */ - Cc_InvalidMuteToneB = 52, /* invalid MuteToneB set, no detector */ - Cc_InsuffFaxCngDetResources = 53 /* insufficient tdm block resources avail. */ - -} GPAK_ChannelConfigStat_t; - -/* Tear Down Channel reply status codes. */ -typedef enum -{ - Td_Success = 0, /* channel torn down successfully */ - Td_InvalidChannel = 1, /* invalid Channel Id */ - Td_ChannelNotActive = 2 /* channel is not active */ -} GPAK_TearDownChanStat_t; - - -typedef enum -{ - Ac_Success = 0, /* algorithm control is successfull */ - Ac_InvalidChannel = 1, /* invalid channel identifier */ - Ac_InvalidCode = 2, /* invalid algorithm control code */ - Ac_ECNotEnabled = 3, /* echo canceller was not allocated */ - Ac_InvalidSoftComp = 4, /* invalid softcompanding, 'cause serial port not in companding mode */ - Ac_InvalidDTMFMuteA = 5, /* A side invalid Mute, since no dtmf detector */ - Ac_InvalidDTMFMuteB = 6, /* B side invalid Mute, since no dtmf detector */ - Ac_InvalidFaxCngA = 7, /* A side FAXCNG detector not available */ - Ac_InvalidFaxCngB = 8, /* B side FAXCNG detector not available */ - Ac_InvalidSysConfig = 9 /* No new system parameters (DTMF config) wrriten yet */ -} GPAK_AlgControlStat_t; - -/* Write System Parameters reply status codes. */ -typedef enum -{ - Sp_Success = 0, /* System Parameters written successfully */ - Sp_BadTwistThresh = 29 /* invalid twist threshold */ - -} GPAK_SysParmsStat_t; - -#endif /* prevent multiple inclusion */ - - - - - - - - - - - - - - - - - - - diff --git a/zaptel/kernel/wctdm24xxp/gpakenum.h b/zaptel/kernel/wctdm24xxp/gpakenum.h deleted file mode 100644 index f488a81c..00000000 --- a/zaptel/kernel/wctdm24xxp/gpakenum.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2005, Adaptive Digital Technologies, Inc. - * - * File Name: gpakenum.h - * - * Description: - * This file contains common enumerations related to G.PAK application - * software. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKENUM_H /* prevent multiple inclusion */ -#define _GPAKENUM_H - -/* G.PAK Serial Port Word Size */ -typedef enum -{ - SerWordSize8 = 0, // 8-bit seial word - SerWordSize16 = 1 // 16-bit serial word -} GpakSerWordSize_t; - -/* G.PAK Serial Port FrameSync Polarity */ -typedef enum -{ - FrameSyncActLow = 0, // active low frame sync signal - FrameSyncActHigh = 1 // active high frame sync signal -} GpakSerFrameSyncPol_t; - -/* G.PAK Serial Port Clock Polarity */ -typedef enum -{ - SerClockActLow = 0, // active low serial clock - SerClockActHigh = 1 // active high serial clock -} GpakSerClockPol_t; - -/* G.PAK Serial Port Data Delay */ -typedef enum -{ - DataDelay0 = 0, // no data delay - DataDelay1 = 1, // 1-bit data delay - DataDelay2 = 2 // 2-bit data delay -} GpakSerDataDelay_t; - -/* G.PAK Serial Port Ids. */ -typedef enum -{ - SerialPortNull = 0, // null serial port - SerialPort1 = 1, // first PCM serial stream port (McBSP0) - SerialPort2 = 2, // second PCM serial stream port (McBSP1) - SerialPort3 = 3 // third PCM serial stream port (McBSP2) -} GpakSerialPort_t; - -/* G.PAK serial port Slot Configuration selection codes. */ -typedef enum -{ - SlotCfgNone = 0, // no time slots used - SlotCfg2Groups = 2, // 2 groups of 16 time slots used, 32 Channels system - SlotCfg8Groups = 8 // 8-partition mode for 128-channel system -} GpakSlotCfg_t; - -/* G.PAK serial port Companding Mode codes. */ -typedef enum -{ - cmpPCMU=0, // u-Law - cmpPCMA=1, // A-Law - cmpNone=2 // none -} GpakCompandModes; - -/* G.PAK Active/Inactive selection codes. */ -typedef enum -{ - Disabled=0, // Inactive - Enabled=1 // Active -} GpakActivation; - -/* G.PAK Channel Type codes. */ -typedef enum -{ - inactive=0, // channel inactive - tdmToTdm=1 // tdmToTdm -} GpakChanType; - -/* G.PAK Algorithm control commands */ -typedef enum -{ - EnableEcanA = 0, // Enable A side echo canceller - BypassEcanA = 1, // Bypass A side echo canceller - ResetEcanA = 2, // Reset A side echo canceller - EnableEcanB = 3, // Enable B side echo canceller - BypassEcanB = 4, // Bypass B side echo canceller - ResetEcanB = 5, // Reset B side echo canceller - - EnableMuLawSwCompanding = 6,// Enable Mu-law Software companding - EnableALawSwCompanding = 7, // Enable Mu-law Software companding - BypassSwCompanding = 8, // Bypass Software companding - EnableDTMFMuteA = 9, // Mute A side Dtmf digit after tone detected - DisableDTMFMuteA = 10, // Do not mute A side Dtmf digit once tone detected - EnableDTMFMuteB = 11, // Mute B side Dtmf digit after tone detected - DisableDTMFMuteB = 12, // Do not mute B side Dtmf digit once tone detected - EnableFaxCngDetectA = 13, // Enable A side Fax CNG detector, channel must be configed already - DisableFaxCngDetectA = 14, // Disable A side Fax CNG detector, channel must be configed already - EnableFaxCngDetectB = 15, // Enable B side Fax CNG detector, channel must be configed already - DisableFaxCngDetectB = 16 // Disable B side Fax CNG detector, channel must be configed already -} GpakAlgCtrl_t; - -/* G.PAK Tone types. */ -typedef enum -{ - Null_tone = 0, // no tone detection - DTMF_tone = 1 // DTMF tone -} GpakToneTypes; - -/* G.PAK direction. */ -typedef enum -{ - TDMAToB = 0, // A to B - TDMBToA = 1 // B to A -} GpakTdmDirection; - - -typedef enum -{ - rate1ms=0, - rate2ms=1, - rate10ms=2 -} GpakRate_t; - -/* G.PAK Asynchronous Event Codes */ -typedef enum -{ - EventToneDetect = 0, // Tone detection event - EventDSPDebug = 7 // DSP debug data event -} GpakAsyncEventCode_t; - -/* G.PAK MF Tone Code Indices */ -typedef enum -{ - DtmfDigit1 = 0, // DTMF Digit 1 - DtmfDigit2 = 1, // DTMF Digit 2 - DtmfDigit3 = 2, // DTMF Digit 3 - DtmfDigitA = 3, // DTMF Digit A - DtmfDigit4 = 4, // DTMF Digit 4 - DtmfDigit5 = 5, // DTMF Digit 5 - DtmfDigit6 = 6, // DTMF Digit 6 - DtmfDigitB = 7, // DTMF Digit B - DtmfDigit7 = 8, // DTMF Digit 7 - DtmfDigit8 = 9, // DTMF Digit 8 - DtmfDigit9 = 10, // DTMF Digit 9 - DtmfDigitC = 11, // DTMF Digit C - DtmfDigitSt = 12, // DTMF Digit * - DtmfDigit0 = 13, // DTMF Digit 0 - DtmfDigitPnd = 14, // DTMF Digit # - DtmfDigitD = 15, // DTMF Digit D - - FaxCngDigit = 90, // Fax Calling Tone (1100 Hz) - - EndofMFDigit = 100, // End of MF digit - EndofCngDigit = 101 // End of Cng Digit -} GpakToneCodes_t; - -/* GPIO control code*/ -typedef enum -{ - GPIO_READ = 0, - GPIO_WRITE = 1, - GPIO_DIR = 2 -} GpakGPIOCotrol_t; - - -#endif // end multiple inclusion diff --git a/zaptel/kernel/wctdm24xxp/voicebus.c b/zaptel/kernel/wctdm24xxp/voicebus.c deleted file mode 100644 index 80334b17..00000000 --- a/zaptel/kernel/wctdm24xxp/voicebus.c +++ /dev/null @@ -1,1491 +0,0 @@ -/* - * VoiceBus(tm) Interface Library. - * - * Written by Shaun Ruffell - * and based on previous work by Mark Spencer , - * Matthew Fredrickson , and - * Michael Spiceland - * - * Copyright (C) 2007-2008 Digium, Inc. - * - * All rights reserved. - * - * VoiceBus is a registered trademark of Digium. - * - * \todo Make the client drivers back out gracefully when presented with a - * signal. - * \todo Modify clients to sleep with timeout when waiting for interrupt. - * \todo Check on a 64-bit CPU / Kernel - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "voicebus.h" - -#define assert(__x__) BUG_ON(!(__x__)) - -#define INTERRUPT 0 /* Run the deferred processing in the ISR. */ -#define TASKLET 1 /* Run in a tasklet. */ -#define TIMER 2 /* Run in a system timer. */ -#define WORKQUEUE 3 /* Run in a workqueue. */ -#ifndef VOICEBUS_DEFERRED -#define VOICEBUS_DEFERRED INTERRUPT -#endif -#if VOICEBUS_DEFERRED == WORKQUEUE -#define VOICEBUS_ALLOC_FLAGS GFP_KERNEL -#else -#define VOICEBUS_ALLOC_FLAGS GFP_ATOMIC -#endif - -#if VOICEBUS_DEFERRED == TIMER -#if HZ < 1000 -/* \todo Put an error message here. */ -#endif -#endif - -/*! The number of descriptors in both the tx and rx descriptor ring. */ -#define DRING_SIZE (1 << 5) /* Must be a power of 2 */ -#define DRING_MASK (DRING_SIZE-1) - -/* Interrupt status' reported in SR_CSR5 */ -#define TX_COMPLETE_INTERRUPT 0x00000001 -#define TX_STOPPED_INTERRUPT 0x00000002 -#define TX_UNAVAILABLE_INTERRUPT 0x00000004 -#define TX_JABBER_TIMEOUT_INTERRUPT 0x00000008 -#define TX_UNDERFLOW_INTERRUPT 0x00000020 -#define RX_COMPLETE_INTERRUPT 0x00000040 -#define RX_UNAVAILABLE_INTERRUPT 0x00000080 -#define RX_STOPPED_INTERRUPT 0x00000100 -#define RX_WATCHDOG_TIMEOUT_INTERRUPT 0x00000200 -#define TIMER_INTERRUPT 0x00000800 -#define FATAL_BUS_ERROR_INTERRUPT 0x00002000 -#define ABNORMAL_INTERRUPT_SUMMARY 0x00008000 -#define NORMAL_INTERRUPT_SUMMARY 0x00010000 - -#define SR_CSR5 0x0028 -#define NAR_CSR6 0x0030 - -#define IER_CSR7 0x0038 -#define CSR7_TCIE 0x00000001 /* tx complete */ -#define CSR7_TPSIE 0x00000002 /* tx processor stopped */ -#define CSR7_TDUIE 0x00000004 /* tx desc unavailable */ -#define CSR7_TUIE 0x00000020 /* tx underflow */ -#define CSR7_RCIE 0x00000040 /* rx complete */ -#define CSR7_RUIE 0x00000080 /* rx desc unavailable */ -#define CSR7_RSIE 0x00000100 /* rx processor stopped */ -#define CSR7_FBEIE 0x00002000 /* fatal bus error */ -#define CSR7_AIE 0x00008000 /* abnormal enable */ -#define CSR7_NIE 0x00010000 /* normal enable */ - -#define DEFAULT_INTERRUPTS ( CSR7_TCIE | CSR7_TPSIE | CSR7_TDUIE | \ - CSR7_RUIE | CSR7_RSIE | CSR7_FBEIE | \ - CSR7_AIE | CSR7_NIE) - -#define CSR9 0x0048 -#define CSR9_MDC 0x00010000 -#define CSR9_MDO 0x00020000 -#define CSR9_MMC 0x00040000 -#define CSR9_MDI 0x00080000 - -#define OWN_BIT (1 << 31) - -/* In memory structure shared by the host and the adapter. */ -struct voicebus_descriptor { - u32 des0; - u32 des1; - u32 buffer1; - u32 container; /* Unused */ -} __attribute__((packed)); - -struct voicebus_descriptor_list { - /* Pointer to an array of descriptors to give to hardware. */ - struct voicebus_descriptor* desc; - /* Read completed buffers from the head. */ - unsigned int head; - /* Write ready buffers to the tail. */ - unsigned int tail; - /* Array to save the kernel virtual address of pending buffers. */ - void * pending[DRING_SIZE]; - /* PCI Bus address of the descriptor list. */ - dma_addr_t desc_dma; - /*! either DMA_FROM_DEVICE or DMA_TO_DEVICE */ - unsigned int direction; - /*! The number of buffers currently submitted to the hardware. */ - atomic_t count; - /*! The number of bytes to pad each descriptor for cache alignment. */ - unsigned int padding; -}; - - -/*! * \brief Represents a VoiceBus interface on a Digium telephony card. - */ -struct voicebus { - /*! Name of this card. */ - const char *board_name; - /*! The system pci device for this VoiceBus interface. */ - struct pci_dev *pdev; - /*! Protects access to card registers and this structure. You should - * hold this lock before accessing most of the members of this data - * structure or the card registers. */ - spinlock_t lock; - /*! The size of the transmit and receive buffers for this card. */ - u32 framesize; - /*! The number of u32s in the host system cache line. */ - u8 cache_line_size; - /*! Pool to allocate memory for the tx and rx descriptor rings. */ - struct voicebus_descriptor_list rxd; - struct voicebus_descriptor_list txd; - /*! Level of debugging information. 0=None, 5=Insane. */ - atomic_t debuglevel; - /*! Cache of buffer objects. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - kmem_cache_t *buffer_cache; -#else - struct kmem_cache *buffer_cache; -#endif - /*! Base address of the VoiceBus interface registers in I/O space. */ - u32 iobase; - /*! The IRQ line for this VoiceBus interface. */ - unsigned int irq; -#if VOICEBUS_DEFERRED == WORKQUEUE - /*! Process buffers in the context of this workqueue. */ - struct workqueue_struct *workqueue; - /*! Work item to process tx / rx buffers. */ - struct work_struct workitem; -#elif VOICEBUS_DEFERRED == TASKLET - /*! Process buffers in the context of a tasklet. */ - struct tasklet_struct tasklet; -#elif VOICEBUS_DEFERRED == TIMER - /*! Process buffers in a timer without generating interrupts. */ - struct timer_list timer; -#endif - /*! Callback function to board specific module to process frames. */ - void (*handle_receive)(void *vbb, void *context); - void (*handle_transmit)(void *vbb, void *context); - /*! Data to pass to the receive and transmit callback. */ - void *context; - struct completion stopped_completion; - /*! Flags */ - unsigned long flags; - /* \todo see about removing this... */ - u32 sdi; - /*! Number of tx buffers to queue up before enabling interrupts. */ - unsigned int min_tx_buffer_count; -}; - -/* - * Use the following macros to lock the VoiceBus interface, and it won't - * matter if the deferred processing is running inside the interrupt handler, - * in a tasklet, or in a workqueue. - */ -#if VOICEBUS_DEFERRED == WORKQUEUE -/* - * When the deferred processing is running in a workqueue, voicebus will never - * be locked from the context of the interrupt handler, and therefore we do - * not need to lock interrupts. - */ -#define LOCKS_VOICEBUS -#define LOCKS_FROM_DEFERRED -#define VBLOCK(_vb_) spin_lock(&((_vb_)->lock)) -#define VBUNLOCK(_vb_) spin_unlock(&((_vb_)->lock)) -#define VBLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#define VBUNLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#else -#define LOCKS_VOICEBUS unsigned long _irqflags -#define LOCKS_FROM_DEFERRED -#define VBLOCK(_vb_) spin_lock_irqsave(&((_vb_)->lock), _irqflags) -#define VBUNLOCK(_vb_) spin_unlock_irqrestore(&((_vb_)->lock), _irqflags) -#define VBLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#define VBUNLOCK_FROM_DEFERRED(_vb_) spin_lock(&((_vb_)->lock)) -#endif - -#define VB_PRINTK(_vb, _lvl, _fmt, _args...) \ - printk(KERN_##_lvl "%s: " _fmt, (_vb)->board_name, ## _args) - -/* Bit definitions for struct voicebus.flags */ -#define TX_UNDERRUN 1 -#define RX_UNDERRUN 2 -#define IN_DEFERRED_PROCESSING 3 -#define STOP 4 - -#if VOICEBUS_DEFERRED == WORKQUEUE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -/*! \brief Make the current task real-time. */ -static void -vb_setup_deferred(void *data) -#else -static void -vb_setup_deferred(struct work_struct *work) -#endif -{ - struct sched_param param = { .sched_priority = 99 }; - sched_setscheduler(current, SCHED_FIFO, ¶m); -} -/*! \brief Schedule a work item to make the voicebus workqueue real-time. */ -static void -vb_set_workqueue_priority(struct voicebus *vb) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - DECLARE_WORK(deferred_setup, vb_setup_deferred, NULL); -#else - DECLARE_WORK(deferred_setup, vb_setup_deferred); -#endif - queue_work(vb->workqueue, &deferred_setup); - flush_workqueue(vb->workqueue); -} -#endif -#endif - -#ifdef DBG -static inline int -assert_in_vb_deferred(struct voicebus *vb) -{ - assert(test_bit(IN_DEFERRED_PROCESSING, &vb->flags)); -} - -static inline void -start_vb_deferred(struct voicebus *vb) -{ - set_bit(IN_DEFERRED_PROCESSING, &vb->flags); -} - -static inline void -stop_vb_deferred(struct voicebus *vb) -{ - clear_bit(IN_DEFERRED_PROCESSING, &vb->flags); -} -#else -#define assert_in_vb_deferred(_x_) do {;} while(0) -#define start_vb_deferred(_x_) do {;} while(0) -#define stop_vb_deferred(_x_) do {;} while(0) -#endif - -static inline struct voicebus_descriptor * -vb_descriptor(struct voicebus_descriptor_list *dl, int index) -{ - struct voicebus_descriptor *d; - d = (struct voicebus_descriptor *)((u8*)dl->desc + - ((sizeof(*d) + dl->padding) * index)); - return d; -} - -static int -vb_initialize_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl, - u32 des1, unsigned int direction) -{ - int i; - struct voicebus_descriptor *d; - const u32 END_OF_RING = 0x02000000; - - assert(dl); - - /* - * Add some padding to each descriptor to ensure that they are - * aligned on host system cache-line boundaries, but only for the - * cache-line sizes that we support. - * - */ - if ((0x08 == vb->cache_line_size) || (0x10 == vb->cache_line_size) || - (0x20 == vb->cache_line_size)) - { - dl->padding = (vb->cache_line_size*sizeof(u32)) - sizeof(*d); - } else { - dl->padding = 0; - } - - dl->desc = pci_alloc_consistent(vb->pdev, - (sizeof(*d) + dl->padding) * DRING_SIZE, &dl->desc_dma); - if (!dl->desc) { - return -ENOMEM; - } - - memset(dl->desc, 0, (sizeof(*d) + dl->padding) * DRING_SIZE); - for ( i = 0; i < DRING_SIZE; ++i) { - d = vb_descriptor(dl, i); - d->des1 = des1; - } - d->des1 |= cpu_to_le32(END_OF_RING); - dl->direction = direction; - atomic_set(&dl->count, 0); - return 0; -} - -static int -vb_initialize_tx_descriptors(struct voicebus *vb) -{ - return vb_initialize_descriptors( - vb, &vb->txd, 0xe4800000 | vb->framesize, DMA_TO_DEVICE); -} - -static int -vb_initialize_rx_descriptors(struct voicebus *vb) -{ - return vb_initialize_descriptors( - vb, &vb->rxd, vb->framesize, DMA_FROM_DEVICE); -} - -/*! \brief Use to set the minimum number of buffers queued to the hardware - * before enabling interrupts. - */ -int -voicebus_set_minlatency(struct voicebus *vb, unsigned int ms) -{ - LOCKS_VOICEBUS; - /* - * One millisecond of latency means that we have 3 buffers pending, - * since two are always going to be waiting in the TX fifo on the - * interface chip. - * - */ -#define MESSAGE "%d ms is an invalid value for minumum latency. Setting to %d ms.\n" - if ( DRING_SIZE < ms ) { - VB_PRINTK(vb, WARNING, MESSAGE, ms, DRING_SIZE); - return -EINVAL; - } else if (VOICEBUS_DEFAULT_LATENCY > ms ) { - VB_PRINTK(vb, WARNING, MESSAGE, ms, VOICEBUS_DEFAULT_LATENCY); - return -EINVAL; - } - VBLOCK(vb); - vb->min_tx_buffer_count = ms; - VBUNLOCK(vb); - return 0; -} - -/*! \brief Returns the number of buffers currently on the transmit queue. */ -int -voicebus_current_latency(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - int latency; - VBLOCK(vb); - latency = vb->min_tx_buffer_count; - VBUNLOCK(vb); - return latency; -} - -/*! - * \brief Read one of the hardware control registers without acquiring locks. - */ -static inline u32 -__vb_getctl(struct voicebus *vb, u32 addr) -{ - return le32_to_cpu(inl(vb->iobase + addr)); -} - -/*! - * \brief Read one of the hardware control registers with locks held. - */ -static inline u32 -vb_getctl(struct voicebus *vb, u32 addr) -{ - LOCKS_VOICEBUS; - u32 val; - VBLOCK(vb); - val = __vb_getctl(vb, addr); - VBUNLOCK(vb); - return val; -} - -/*! - * \brief Returns whether or not the interface is running. - * - * NOTE: Running in this case means whether or not the hardware reports the - * transmit processor in any state but stopped. - * - * \return 1 of the process is stopped, 0 if running. - */ -static int -vb_is_stopped(struct voicebus *vb) -{ - u32 reg; - reg = vb_getctl(vb, SR_CSR5); - reg = (reg >> 17)&0x38; - return (0 == reg) ? 1 : 0; -} - -static void -vb_cleanup_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl) -{ - unsigned int i; - struct voicebus_descriptor *d; - - assert(vb_is_stopped(vb)); - - for (i=0; i < DRING_SIZE; ++i) { - d = vb_descriptor(dl, i); - if (d->buffer1) { - d->buffer1 = 0; - assert(dl->pending[i]); - voicebus_free(vb, dl->pending[i]); - dl->pending[i] = NULL; - } - d->des0 &= ~OWN_BIT; - } - dl->head = 0; - dl->tail = 0; - atomic_set(&dl->count, 0); -} - -static void -vb_free_descriptors(struct voicebus *vb, struct voicebus_descriptor_list *dl) -{ - if (NULL == dl->desc) { - WARN_ON(1); - return; - } - vb_cleanup_descriptors(vb, dl); - pci_free_consistent( - vb->pdev, - (sizeof(struct voicebus_descriptor)+dl->padding)*DRING_SIZE, - dl->desc, dl->desc_dma); -} - -/*! - * \brief Write one of the hardware control registers without acquiring locks. - */ -static inline void -__vb_setctl(struct voicebus *vb, u32 addr, u32 val) -{ - wmb(); - outl(cpu_to_le32(val), vb->iobase + addr); -} - -/*! - * \brief Write one of the hardware control registers with locks held. - */ -static inline void -vb_setctl(struct voicebus *vb, u32 addr, u32 val) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_setctl(vb, addr, val); - VBUNLOCK(vb); -} - -static int -__vb_sdi_clk(struct voicebus* vb) -{ - unsigned int ret; - vb->sdi &= ~CSR9_MDC; - __vb_setctl(vb, 0x0048, vb->sdi); - ret = __vb_getctl(vb, 0x0048); - vb->sdi |= CSR9_MDC; - __vb_setctl(vb, 0x0048, vb->sdi); - return (ret & CSR9_MDI) ? 1: 0; -} - -static void -__vb_sdi_sendbits(struct voicebus *vb, u32 bits, int count) -{ - vb->sdi &= ~CSR9_MMC; - __vb_setctl(vb, 0x0048, vb->sdi); - while(count--) { - if (bits & (1 << count)) { - vb->sdi |= CSR9_MDO; - } else { - vb->sdi &= ~CSR9_MDO; - } - __vb_sdi_clk(vb); - } -} - -#if 0 /* this function might be useful in the future for debugging. */ -static unsigned int -__vb_sdi_recvbits(struct voicebus *vb, int count) -{ - unsigned int bits=0; - vb->sdi |= CSR9_MMC; - __vb_setctl(vb, 0x0048, vb->sdi); - while(count--) { - bits <<= 1; - if (__vb_sdi_clk(vb)) - bits |= 1; - else - bits &= ~1; - } - return bits; -} -#endif - -static void -vb_setsdi(struct voicebus *vb, int addr, u16 val) -{ - LOCKS_VOICEBUS; - u32 bits; - /* Send preamble */ - bits = 0xffffffff; - VBLOCK(vb); - __vb_sdi_sendbits(vb, bits, 32); - bits = (0x5 << 12) | (1 << 7) | (addr << 2) | 0x2; - __vb_sdi_sendbits(vb, bits, 16); - __vb_sdi_sendbits(vb, val, 16); - VBUNLOCK(vb); -} - -static void -vb_enable_io_access(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - assert(vb->pdev); - VBLOCK(vb); - pci_read_config_dword(vb->pdev, 0x0004, ®); - reg |= 0x00000007; - pci_write_config_dword(vb->pdev, 0x0004, reg); - VBUNLOCK(vb); -} - -/*! \todo Insert comments... - * context: !in_interrupt() - */ -void* -voicebus_alloc(struct voicebus *vb) -{ - void *vbb; - vbb = kmem_cache_alloc(vb->buffer_cache, VOICEBUS_ALLOC_FLAGS); - return vbb; -} - -void -voicebus_setdebuglevel(struct voicebus *vb, u32 level) -{ - atomic_set(&vb->debuglevel, level); -} - -int -voicebus_getdebuglevel(struct voicebus *vb) -{ - return atomic_read(&vb->debuglevel); -} - -/*! \brief Resets the voicebus hardware interface. */ -static int -vb_reset_interface(struct voicebus *vb) -{ - unsigned long timeout; - u32 reg; - u32 pci_access; - const u32 DEFAULT_PCI_ACCESS = 0xfff80002; - BUG_ON(in_interrupt()); - - switch (vb->cache_line_size) { - case 0x08: - pci_access = DEFAULT_PCI_ACCESS | (0x1 << 14); - break; - case 0x10: - pci_access = DEFAULT_PCI_ACCESS | (0x2 << 14); - break; - case 0x20: - pci_access = DEFAULT_PCI_ACCESS | (0x3 << 14); - break; - default: - VB_PRINTK(vb, WARNING, "Host system set a cache size "\ - "of %d which is not supported. " \ - "Disabling memory write line and memory read line.", - vb->cache_line_size); - pci_access = 0xfe584202; - break; - } - - /* The transmit and receive descriptors will have the same padding. */ - pci_access |= ((vb->txd.padding / sizeof(u32)) << 2) & 0x7c; - - vb_setctl(vb, 0x0000, pci_access | 1); - - timeout = jiffies + HZ/10; /* 100ms interval */ - do { - reg = vb_getctl(vb, 0x0000); - } while ((reg & 0x00000001) && time_before(jiffies, timeout)); - - if (reg & 0x00000001) { - VB_PRINTK(vb, ERR, "Hardware did not come out of reset "\ - "within 100ms!"); - return -EIO; - } - - vb_setctl(vb, 0x0000, pci_access); - - vb_cleanup_descriptors(vb, &vb->txd); - vb_cleanup_descriptors(vb, &vb->rxd); - - /* Pass bad packets, runt packets, disable SQE function, - * store-and-forward */ - vb_setctl(vb, 0x0030, 0x00280048); - /* ...disable jabber and the receive watchdog. */ - vb_setctl(vb, 0x0078, 0x00000013); - - /* Tell the card where the descriptors are in host memory. */ - vb_setctl(vb, 0x0020, (u32)vb->txd.desc_dma); - vb_setctl(vb, 0x0018, (u32)vb->rxd.desc_dma); - - reg = vb_getctl(vb, 0x00fc); - vb_setctl(vb, 0x00fc, (reg & ~0x7) | 0x7); - vb_setsdi(vb, 0x00, 0x0100); - vb_setsdi(vb, 0x16, 0x2100); - - reg = vb_getctl(vb, 0x00fc); - - vb_setctl(vb, 0x00fc, (reg & ~0x7) | 0x4); - vb_setsdi(vb, 0x00, 0x0100); - vb_setsdi(vb, 0x16, 0x2100); - reg = vb_getctl(vb, 0x00fc); - - - /* - * The calls to setsdi above toggle the reset line of the CPLD. Wait - * here to give the CPLD time to stabilize after reset. - */ - mdelay(1); - - return ((reg&0x7) == 0x4) ? 0 : -EIO; -} - -#define OWNED(_d_) (((_d_)->des0)&OWN_BIT) -#define SET_OWNED(_d_) do { wmb(); (_d_)->des0 |= OWN_BIT; wmb();} while (0) - -#ifdef DBG -static void -dump_descriptor(struct voicebus *vb, volatile struct voicebus_descriptor *d) -{ - VB_PRINTK(vb, DEBUG, "Displaying descriptor at address %08x\n", (unsigned int)d); - VB_PRINTK(vb, DEBUG, " des0: %08x\n", d->des0); - VB_PRINTK(vb, DEBUG, " des1: %08x\n", d->des1); - VB_PRINTK(vb, DEBUG, " buffer1: %08x\n", d->buffer1); - VB_PRINTK(vb, DEBUG, " container: %08x\n", d->container); -} - -static void -show_buffer(struct voicebus *vb, void *vbb) -{ - int x; - unsigned char *c; - c = vbb; - printk("Packet %d\n", count); - for (x = 1; x <= vb->framesize; ++x) { - printk("%02x ", c[x]); - if (x % 16 == 0) { - printk("\n"); - } - } - printk("\n\n"); -} -#endif - -static inline int -vb_submit(struct voicebus *vb, struct voicebus_descriptor_list *dl, void *vbb) -{ - volatile struct voicebus_descriptor *d; - unsigned int tail = dl->tail; - assert_in_vb_deferred(vb); - - d = vb_descriptor(dl, tail); - - if (unlikely(d->buffer1)) { - /* Do not overwrite a buffer that is still in progress. */ - WARN_ON(1); - voicebus_free(vb, vbb); - return -EBUSY; - } - - dl->pending[tail] = vbb; - dl->tail = (++tail) & DRING_MASK; - d->buffer1 = dma_map_single( - &vb->pdev->dev, vbb, vb->framesize, dl->direction); - SET_OWNED(d); /* That's it until the hardware is done with it. */ - atomic_inc(&dl->count); - return 0; -} - -static inline void* -vb_retrieve(struct voicebus *vb, struct voicebus_descriptor_list *dl) -{ - volatile struct voicebus_descriptor *d; - void *vbb; - unsigned int head = dl->head; - assert_in_vb_deferred(vb); - d = vb_descriptor(dl, head); - if (!OWNED(d)) { - dma_unmap_single(&vb->pdev->dev, d->buffer1, - vb->framesize, dl->direction); - vbb = dl->pending[head]; - dl->head = (++head) & DRING_MASK; - d->buffer1 = 0; - atomic_dec(&dl->count); - return vbb; - } else { - return NULL; - } -} - -/*! - * \brief Give a frame to the hardware to transmit. - * - */ -int -voicebus_transmit(struct voicebus *vb, void *vbb) -{ - return vb_submit(vb, &vb->txd, vbb); -} - -/*! - * \brief Give a frame to the hardware to use for receiving. - * - */ -static inline int -vb_submit_rxb(struct voicebus *vb, void *vbb) -{ - return vb_submit(vb, &vb->rxd, vbb); -} - -/*! - * \brief Remove the next completed transmit buffer (txb) from the tx - * descriptor ring. - * - * NOTE: This function doesn't need any locking because only one instance is - * ever running on the deferred processing routine and it only looks at - * the head pointer. The deferred routine should only ever be running - * on one processor at a time (no multithreaded workqueues allowed!) - * - * Context: Must be called from the voicebus deferred workqueue. - * - * \return Pointer to buffer, or NULL if not available. - */ -static inline void * -vb_get_completed_txb(struct voicebus *vb) -{ - return vb_retrieve(vb, &vb->txd); -} - -static inline void * -vb_get_completed_rxb(struct voicebus *vb) -{ - return vb_retrieve(vb, &vb->rxd); -} - -/*! - * \brief Free a buffer for reuse. - * - */ -void -voicebus_free(struct voicebus *vb, void *vbb) -{ - kmem_cache_free(vb->buffer_cache, vbb); -} - -/*! - * \brief Instruct the hardware to check for a new tx descriptor. - */ -inline static void -__vb_tx_demand_poll(struct voicebus *vb) -{ - __vb_setctl(vb, 0x0008, 0x00000000); -} - -/*! - * \brief Command the hardware to check if it owns the next transmit - * descriptor. - */ -static void -vb_tx_demand_poll(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_tx_demand_poll(vb); - VBUNLOCK(vb); -} - -/*! - * \brief Command the hardware to check if it owns the next receive - * descriptor. - */ -inline static void -__vb_rx_demand_poll(struct voicebus *vb) -{ - __vb_setctl(vb, 0x0010, 0x00000000); -} - -static void -vb_rx_demand_poll(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_rx_demand_poll(vb); - VBUNLOCK(vb); -} - -static void -__vb_enable_interrupts(struct voicebus *vb) -{ - __vb_setctl(vb, IER_CSR7, DEFAULT_INTERRUPTS); -} - -static void -__vb_disable_interrupts(struct voicebus *vb) -{ - __vb_setctl(vb, IER_CSR7, 0); -} - -static void -vb_disable_interrupts(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - VBLOCK(vb); - __vb_disable_interrupts(vb); - VBUNLOCK(vb); -} - -/*! - * \brief Starts the VoiceBus interface. - * - * When the VoiceBus interface is started, it is actively transferring - * frames to and from the backend of the card. This means the card will - * generate interrupts. - * - * This function should only be called from process context, with interrupts - * enabled, since it can sleep while running the self checks. - * - * \return zero on success. -EBUSY if device is already running. - */ -int -voicebus_start(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - int i; - void *vbb; - int ret; - - assert(!in_interrupt()); - - if (!vb_is_stopped(vb)) { - return -EBUSY; - } - - if ((ret=vb_reset_interface(vb))) { - return ret; - } - - /* We must set up a minimum of three buffers to start with, since two - * are immediately read into the TX FIFO, and the descriptor of the - * third is read as soon as the first buffer is done. - */ - - /* - * NOTE: The very first buffer after coming out of reset is used to - * prime the pump and is lost. So we do not want the client driver to - * prepare it, since it will never see the corresponding receive - * buffer. - * NOTE: handle_transmit is normally only called in the context of the - * deferred processing thread. Since the deferred processing thread - * is known to not be running at this point, it is safe to call the - * handle transmit as if it were. - */ - start_vb_deferred(vb); - /* Ensure that all the rx slots are ready for a buffer. */ - for ( i = 0; i < DRING_SIZE; ++i) { - vbb = voicebus_alloc(vb); - if (unlikely(NULL == vbb)) { - BUG_ON(1); - /* \todo I need to make sure the driver can recover - * from this condition. .... */ - } else { - vb_submit_rxb(vb, vbb); - } - } - - for ( i=0; i < vb->min_tx_buffer_count; ++i) { - vbb = voicebus_alloc(vb); - if (unlikely(NULL == vbb)) { - BUG_ON(1); - } else { - vb->handle_transmit(vbb, vb->context); - } - } - stop_vb_deferred(vb); - - VBLOCK(vb); - clear_bit(STOP, &vb->flags); -#if VOICEBUS_DEFERRED == TIMER - vb->timer.expires = jiffies + HZ/1000; - add_timer(&vb->timer); -#else - /* Clear the interrupt status register. */ - __vb_setctl(vb, SR_CSR5, 0xffffffff); - __vb_enable_interrupts(vb); -#endif - /* Start the transmit and receive processors. */ - reg = __vb_getctl(vb, 0x0030); - __vb_setctl(vb, 0x0030, reg|0x00002002); - /* Tell the interface to poll the tx and rx descriptors. */ - __vb_rx_demand_poll(vb); - __vb_tx_demand_poll(vb); - VBUNLOCK(vb); - - assert(!vb_is_stopped(vb)); - - return 0; -} - -static void -vb_clear_start_transmit_bit(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - VBLOCK(vb); - reg = __vb_getctl(vb, NAR_CSR6); - reg &= ~0x00002000; - __vb_setctl(vb, NAR_CSR6, reg); - VBUNLOCK(vb); -} - -static void -vb_clear_start_receive_bit(struct voicebus *vb) -{ - LOCKS_VOICEBUS; - u32 reg; - VBLOCK(vb); - reg = __vb_getctl(vb, NAR_CSR6); - reg &= ~0x00000002; - __vb_setctl(vb, NAR_CSR6, reg); - VBUNLOCK(vb); -} - -unsigned long -vb_wait_for_completion_timeout(struct completion *x, unsigned long timeout) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) - /* There is a race condition here. If x->done is reset to 0 - * before the call to wait_for_completion after this thread wakes. - */ - timeout = wait_event_timeout(x->wait, x->done, timeout); - if (timeout) { - wait_for_completion(x); - } - return timeout; -#else - return wait_for_completion_timeout(x, timeout); -#endif -} - -/*! - * \brief Stops the VoiceBus interface. - * - * Stops the VoiceBus interface and waits for any outstanding DMA transactions - * to complete. When this functions returns the VoiceBus interface tx and rx - * states will both be suspended. - * - * Only call this function from process context, with interrupt enabled, - * without any locks held since it sleeps. - * - * \return zero on success, -1 on error. - */ -int -voicebus_stop(struct voicebus *vb) -{ - assert(!in_interrupt()); - if (vb_is_stopped(vb)) { - return 0; - } - INIT_COMPLETION(vb->stopped_completion); - set_bit(STOP, &vb->flags); - vb_clear_start_transmit_bit(vb); - if (vb_wait_for_completion_timeout(&vb->stopped_completion, HZ)) { -#if VOICEBUS_DEFERRED == TIMER - del_timer_sync(&vb->timer); -#else - vb_disable_interrupts(vb); -#endif - assert(vb_is_stopped(vb)); - clear_bit(STOP, &vb->flags); - } - else { - VB_PRINTK(vb, WARNING, "Timeout while waiting for board to "\ - "stop.\n"); - } - return 0; -} - -/*! - * \brief Prepare the interface for module unload. - * - * Stop the interface and free all the resources allocated by the driver. The - * caller should have returned all VoiceBus buffers to the VoiceBus layer - * before calling this function. - * - * context: !in_interrupt() - */ -void -voicebus_release(struct voicebus *vb) -{ - assert(!in_interrupt()); - - /* quiesce the hardware */ - voicebus_stop(vb); -#if VOICEBUS_DEFERRED == WORKQUEUE - destroy_workqueue(vb->workqueue); -#elif VOICEBUS_DEFERRED == TASKLET - tasklet_kill(&vb->tasklet); -#endif - vb_reset_interface(vb); -#if VOICEBUS_DEFERRED != TIMER - free_irq(vb->pdev->irq, vb); -#endif - - /* Cleanup memory and software resources. */ - vb_free_descriptors(vb, &vb->txd); - vb_free_descriptors(vb, &vb->rxd); - kmem_cache_destroy(vb->buffer_cache); - release_region(vb->iobase, 0xff); - pci_disable_device(vb->pdev); - kfree(vb); -} - -void -__vb_increase_latency(struct voicebus *vb) -{ - static int __warn_once = 1; - void *vbb; - int latency; - - assert_in_vb_deferred(vb); - - latency = atomic_read(&vb->txd.count); - if (DRING_SIZE == latency) { - if (__warn_once) { - /* We must subtract two from this number since there - * are always two buffers in the TX FIFO. - */ - VB_PRINTK(vb,ERR, - "ERROR: Unable to service card within %d ms "\ - "and unable to further increase latency.\n", - DRING_SIZE-2); - __warn_once = 0; - } - } else { - /* Because there are 2 buffers in the transmit FIFO on the - * hardware, setting 3 ms of latency means that the host needs - * to be able to service the cards within 1ms. This is because - * the interface will load up 2 buffers into the TX FIFO then - * attempt to read the 3rd descriptor. If the OWN bit isn't - * set, then the hardware will set the TX descriptor not - * available interrupt. - */ - VB_PRINTK(vb, INFO, "Missed interrupt. " \ - "Increasing latency to %d ms in order to compensate.\n", - latency+1); - /* Set the minimum latency in case we're restarted...we don't - * want to wait for the buffer to grow to this depth again in - * that case. - */ - voicebus_set_minlatency(vb, latency+1); - vbb = voicebus_alloc(vb); - if (unlikely(NULL == vbb)) { - BUG_ON(1); - } else { - vb->handle_transmit(vbb, vb->context); - } - } -} - -/*! - * \brief Actually process the completed transmit and receive buffers. - * - * NOTE: This function may be called either from a tasklet, workqueue, or - * directly in the interrupt service routine depending on - * VOICEBUS_DEFERRED. - */ -static inline void -vb_deferred(struct voicebus *vb) -{ - void *vbb; -#ifdef DBG - static int count = 0; -#endif - int stopping = test_bit(STOP, &vb->flags); - int underrun = test_bit(TX_UNDERRUN, &vb->flags); - - - start_vb_deferred(vb); - if (unlikely(stopping)) { - while((vbb = vb_get_completed_txb(vb))) { - voicebus_free(vb, vbb); - } - while((vbb = vb_get_completed_rxb(vb))) { - voicebus_free(vb, vbb); - } - stop_vb_deferred(vb); - return; - } - - if (unlikely(underrun)) { - /* When we've underrun our FIFO, for some reason we're not - * able to keep enough transmit descriptors pending. This can - * happen if either interrupts or this deferred processing - * function is not run soon enough (within 1ms when using the - * default 3 transmit buffers to start). In this case, we'll - * insert an additional transmit buffer onto the descriptor - * list which decreases the sensitivity to latency, but also - * adds more delay to the TDM and SPI data. - */ - __vb_increase_latency(vb); - } - - /* Always handle the transmit buffers first. */ - while ((vbb = vb_get_completed_txb(vb))) { - vb->handle_transmit(vbb, vb->context); - } - - if (unlikely(underrun)) { - vb_rx_demand_poll(vb); - vb_tx_demand_poll(vb); - clear_bit(TX_UNDERRUN, &vb->flags); - } - - while ((vbb = vb_get_completed_rxb(vb))) { - vb->handle_receive(vbb, vb->context); - vb_submit_rxb(vb, vbb); - } - - stop_vb_deferred(vb); -} - - -/*! - * \brief Interrupt handler for VoiceBus interface. - * - * NOTE: This handler is optimized for the case where only a single interrupt - * condition will be generated at a time. - * - * ALSO NOTE: Only access the interrupt status register from this function - * since it doesn't employ any locking on the voicebus interface. - */ -static irqreturn_t -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -vb_isr(int irq, void *dev_id, struct pt_regs *regs) -#else -vb_isr(int irq, void *dev_id) -#endif -{ - struct voicebus *vb = dev_id; - u32 int_status; - - int_status = __vb_getctl(vb, SR_CSR5); - /* Mask out the reserved bits. */ - int_status &= ~(0xfc004010); - int_status &= 0x7fff; - - if (!int_status) { - return IRQ_NONE; - } - - if (likely(int_status & TX_COMPLETE_INTERRUPT)) { - /* ******************************************************** */ - /* NORMAL INTERRUPT CASE */ - /* ******************************************************** */ -# if VOICEBUS_DEFERRED == WORKQUEUE - queue_work(vb->workqueue, &vb->workitem); -# elif VOICEBUS_DEFERRED == TASKLET - tasklet_schedule(&vb->tasklet); -# else - vb_deferred(vb); -# endif - __vb_setctl(vb, SR_CSR5, TX_COMPLETE_INTERRUPT); - } else { - /* ******************************************************** */ - /* ABNORMAL / ERROR CONDITIONS */ - /* ******************************************************** */ - if ((int_status & TX_UNAVAILABLE_INTERRUPT) ) { - /* This can happen if the host fails to service the - * interrupt within the required time interval (1ms - * for each buffer on the queue). Increasing the - * depth of the tx queue (up to a maximum of - * DRING_SIZE) can make the driver / system more - * tolerant of interrupt latency under periods of - * heavy system load, but also increases the general - * latency that the driver adds to the voice - * conversations. - */ - set_bit(TX_UNDERRUN, &vb->flags); -# if VOICEBUS_DEFERRED == WORKQUEUE - queue_work(vb->workqueue, &vb->workitem); -# elif VOICEBUS_DEFERRED == TASKLET - tasklet_schedule(&vb->tasklet); -# else - vb_deferred(vb); -# endif - } - - if (int_status & FATAL_BUS_ERROR_INTERRUPT) { - VB_PRINTK(vb, ERR, "Fatal Bus Error detected!\n"); - } - - if (int_status & TX_STOPPED_INTERRUPT) { - assert(test_bit(STOP, &vb->flags)); - vb_clear_start_receive_bit(vb); - __vb_setctl(vb, SR_CSR5, DEFAULT_INTERRUPTS); - __vb_disable_interrupts(vb); - complete(&vb->stopped_completion); - } - if (int_status & RX_STOPPED_INTERRUPT) { - assert(test_bit(STOP, &vb->flags)); - if (vb_is_stopped(vb)) { - complete(&vb->stopped_completion); - } - } - - /* Clear the interrupt(s) */ - __vb_setctl(vb, SR_CSR5, int_status); - } - - return IRQ_HANDLED; -} - -#if VOICEBUS_DEFERRED == TIMER -/*! \brief Called if the deferred processing is to happen in the context of - * the timer. - */ -static void -vb_timer(unsigned long data) -{ - unsigned long start = jiffies; - struct voicebus *vb = (struct voicebus *)data; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - vb_isr(0, vb, 0); -#else - vb_isr(0, vb); -#endif - if (!vb_is_stopped(vb)) { - vb->timer.expires = start + HZ/1000; - add_timer(&vb->timer); - } -} -#endif - -#if VOICEBUS_DEFERRED == WORKQUEUE -static void -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -vb_workfunc(void *data) -{ - struct voicebus *vb = data; -#else -vb_workfunc(struct work_struct *work) -{ - struct voicebus *vb = container_of(work, struct voicebus, workitem); -#endif - vb_deferred(vb); -} -#elif VOICEBUS_DEFERRED == TASKLET -static void -vb_tasklet(unsigned long data) -{ - struct voicebus *vb = (struct voicebus*)data; - vb_deferred(vb); -} -#endif /* #if VOICEBUS_DEFERRED == WORKQUEUE */ - -/*! - * \brief Initalize the voicebus interface. - * - * This function must be called in process context since it may sleep. - * \todo Complete this description. - */ -int -voicebus_init(struct pci_dev *pdev, u32 framesize, - const char *board_name, - void (*handle_receive)(void *vbb, void *context), - void (*handle_transmit)(void *vbb, void *context), - void *context, - struct voicebus **vbp - ) -{ - int retval = 0; - struct voicebus *vb; - - assert(NULL != pdev); - assert(NULL != board_name); - assert(framesize); - assert(NULL != handle_receive); - assert(NULL != handle_transmit); - - /* ---------------------------------------------------------------- - Initialize the pure software constructs. - ---------------------------------------------------------------- */ - *vbp = NULL; - vb = kmalloc(sizeof(*vb), GFP_KERNEL); - if (NULL == vb) { - VB_PRINTK(vb, DEBUG, "Failed to allocate memory for voicebus "\ - "interface.\n"); - retval = -ENOMEM; - goto cleanup; - } - memset(vb,0,sizeof(*vb)); - /* \todo make sure there is a note that the caller needs to make sure - * board_name stays in memory until voicebus_release is called. - */ - vb->board_name = board_name; - spin_lock_init(&vb->lock); - init_completion(&vb->stopped_completion); - vb->pdev = pdev; - set_bit(STOP, &vb->flags); - clear_bit(IN_DEFERRED_PROCESSING, &vb->flags); - vb->framesize = framesize; - vb->min_tx_buffer_count = VOICEBUS_DEFAULT_LATENCY; - -#if VOICEBUS_DEFERRED == WORKQUEUE - /* NOTE: This workqueue must be single threaded because locking is not - * used when buffers are removed or added to the descriptor list, and - * there should only be one producer / consumer (the hardware or the - * deferred processing function). */ - vb->workqueue = create_singlethread_workqueue(board_name); -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&vb->workitem, vb_workfunc, vb); -# else - INIT_WORK(&vb->workitem, vb_workfunc); -# endif -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) - vb_set_workqueue_priority(vb); -# endif -#elif VOICEBUS_DEFERRED == TASKLET - tasklet_init(&vb->tasklet, vb_tasklet, (unsigned long)vb); -#elif VOICEBUS_DEFERRED == TIMER - init_timer(&vb->timer); - vb->timer.function = vb_timer; - vb->timer.data = (unsigned long)vb; -#endif - - vb->handle_receive = handle_receive; - vb->handle_transmit = handle_transmit; - vb->context = context; - - /* \todo This cache should be shared by all instances supported by - * this driver. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - vb->buffer_cache = kmem_cache_create(board_name, vb->framesize, 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); -#else - vb->buffer_cache = kmem_cache_create(board_name, vb->framesize, 0, - SLAB_HWCACHE_ALIGN, NULL); -#endif - if (NULL == vb->buffer_cache) { - VB_PRINTK(vb, ERR, "Failed to allocate buffer cache.\n"); - goto cleanup; - } - - - /* ---------------------------------------------------------------- - Configure the hardware / kernel module interfaces. - ---------------------------------------------------------------- */ - if (pci_read_config_byte(vb->pdev, 0x0c, &vb->cache_line_size)) { - VB_PRINTK(vb, ERR, "Failed read of cache line " \ - "size from PCI configuration space.\n"); - goto cleanup; - } - - if (pci_enable_device(pdev)) { - VB_PRINTK(vb, ERR, "Failed call to pci_enable_device.\n"); - retval = -EIO; - goto cleanup; - } - - /* \todo This driver should be modified to use the memory mapped I/O - as opposed to IO space for portability and performance. */ - if (0 == (pci_resource_flags(pdev, 0)&IORESOURCE_IO)) { - VB_PRINTK(vb, ERR, "BAR0 is not IO Memory.\n"); - retval = -EIO; - goto cleanup; - } - vb->iobase = pci_resource_start(pdev, 0); - if(NULL == request_region(vb->iobase, 0xff, board_name)) { - VB_PRINTK(vb, ERR, "IO Registers are in use by another " \ - "module.\n"); - retval = -EIO; - goto cleanup; - } - - if ((retval = vb_initialize_tx_descriptors(vb))) { - goto cleanup; - } - if ((retval = vb_initialize_rx_descriptors(vb))) { - goto cleanup; - } - - /* ---------------------------------------------------------------- - Configure the hardware interface. - ---------------------------------------------------------------- */ - pci_set_master(pdev); - vb_enable_io_access(vb); - -#if VOICEBUS_DEFERRED != TIMER -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -# define VB_IRQ_SHARED SA_SHIRQ -#else -# define VB_IRQ_SHARED IRQF_SHARED -#endif - if (request_irq(pdev->irq, vb_isr, VB_IRQ_SHARED, vb->board_name, - vb)) { - assert(0); - goto cleanup; - } -#endif - - *vbp = vb; - return retval; -cleanup: - if (NULL == vb) { - return retval; - } -#if VOICEBUS_DEFERRED == WORKQUEUE - if (vb->workqueue) { - destroy_workqueue(vb->workqueue); - } -#elif VOICEBUS_DEFERRED == TASKLET - tasklet_kill(&vb->tasklet); -#endif - /* Cleanup memory and software resources. */ - if (vb->txd.desc) { - vb_free_descriptors(vb, &vb->txd); - } - if (vb->rxd.desc) { - vb_free_descriptors(vb, &vb->rxd); - } - if (vb->buffer_cache) { - kmem_cache_destroy(vb->buffer_cache); - } - if (vb->iobase) { - release_region(vb->iobase, 0xff); - } - if (vb->pdev) { - pci_disable_device(vb->pdev); - } - kfree(vb); - assert(0 != retval); - return retval; -} - - -/*! \brief Return the pci_dev in use by this voicebus interface. */ -struct pci_dev * -voicebus_get_pci_dev(struct voicebus *vb) -{ - return vb->pdev; -} diff --git a/zaptel/kernel/wctdm24xxp/wctdm24xxp.h b/zaptel/kernel/wctdm24xxp/wctdm24xxp.h deleted file mode 100644 index 1d41e302..00000000 --- a/zaptel/kernel/wctdm24xxp/wctdm24xxp.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Wildcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface - * - * Written by Mark Spencer - * Support for TDM800P and VPM150M by Matthew Fredrickson - * - * Copyright (C) 2005, 2006, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _WCTDM24XXP_H -#define _WCTDM24XXP_H - -#include "../zaptel.h" -#include "../voicebus.h" -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif - -#define NUM_FXO_REGS 60 - -#define WC_MAX_IFACES 128 - -/*! - * \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 */ - -#define FLAG_3215 (1 << 0) -#define FLAG_EXPRESS (1 << 1) - -#define EFRAME_SIZE 108 -#define ERING_SIZE 16 /* Maximum ring size */ -#define EFRAME_GAP 20 -#define SFRAME_SIZE ((EFRAME_SIZE * ZT_CHUNKSIZE) + (EFRAME_GAP * (ZT_CHUNKSIZE - 1))) - -#define MAX_ALARMS 10 - -#define MOD_TYPE_NONE 0 -#define MOD_TYPE_FXS 1 -#define MOD_TYPE_FXO 2 -#define MOD_TYPE_FXSINIT 3 -#define MOD_TYPE_VPM 4 -#define MOD_TYPE_QRV 5 -#define MOD_TYPE_VPM150M 6 - -#define MINPEGTIME 10 * 8 /* 30 ms peak to peak gets us no more than 100 Hz */ -#define PEGTIME 50 * 8 /* 50ms peak to peak gets us rings of 10 Hz or more */ -#define PEGCOUNT 5 /* 5 cycles of pegging means RING */ - -#define SDI_CLK (0x00010000) -#define SDI_DOUT (0x00020000) -#define SDI_DREAD (0x00040000) -#define SDI_DIN (0x00080000) - -#define PCI_WINDOW_SIZE ((2 * 2 * 2 * SFRAME_SIZE) + (2 * ERING_SIZE * 4)) - -#define __CMD_RD (1 << 20) /* Read Operation */ -#define __CMD_WR (1 << 21) /* Write Operation */ -#define __CMD_FIN (1 << 22) /* Has finished receive */ -#define __CMD_TX (1 << 23) /* Has been transmitted */ - -#define CMD_WR(a,b) (((a) << 8) | (b) | __CMD_WR) -#define CMD_RD(a) (((a) << 8) | __CMD_RD) - -#if 0 -#define CMD_BYTE(card,bit,altcs) (((((card) & 0x3) * 3 + (bit)) * 7) \ - + ((card) >> 2) + (altcs) + ((altcs) ? -21 : 0)) -#endif -#define NUM_CARDS 24 -#define NUM_EC 4 -#define NUM_SLOTS 6 -#define MAX_TDM_CHAN 31 - -#define NUM_CAL_REGS 12 - -#define USER_COMMANDS 8 -#define ISR_COMMANDS 2 -#define QRV_DEBOUNCETIME 20 - -#define MAX_COMMANDS (USER_COMMANDS + ISR_COMMANDS) - -#define __VPM150M_RWPAGE (1 << 4) -#define __VPM150M_RD (1 << 3) -#define __VPM150M_WR (1 << 2) -#define __VPM150M_FIN (1 << 1) -#define __VPM150M_TX (1 << 0) - -#define VPM150M_HPI_CONTROL 0x00 -#define VPM150M_HPI_ADDRESS 0x02 -#define VPM150M_HPI_DATA 0x03 - -#define VPM150M_MAX_COMMANDS 8 - -/* Some Bit ops for different operations */ -#define VPM150M_SPIRESET 0 -#define VPM150M_HPIRESET 1 -#define VPM150M_SWRESET 2 -#define VPM150M_DTMFDETECT 3 -#define VPM150M_ACTIVE 4 - -#define VPM150M_MAX_DATA 1 - -#define VPM_SUPPORT - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#define VPM150M_SUPPORT -#endif - -#ifdef VPM_SUPPORT - -/* Define to get more attention-grabbing but slightly more CPU using echocan status */ -#define FANCY_ECHOCAN - -#endif - -#ifdef VPM150M_SUPPORT -#include "adt_lec.h" -#endif - -struct vpm150m_cmd { - unsigned int addr; - unsigned char datalen; - unsigned char desc; - unsigned char txident; - unsigned short data[VPM150M_MAX_DATA]; -}; - -struct vpm150m { -#ifdef VPM150M_SUPPORT - struct workqueue_struct *wq; - struct work_struct work; -#endif - struct wctdm *wc; - - int dspid; - struct semaphore sem; - unsigned long control; - unsigned char curpage; - unsigned short version; - struct adt_lec_params curecstate[24]; - struct adt_lec_params desiredecstate[24]; - unsigned long curdtmfmutestate; - unsigned long desireddtmfmutestate; - struct vpm150m_cmd cmdq[VPM150M_MAX_COMMANDS]; - unsigned char curtone[24]; -}; - -struct calregs { - unsigned char vals[NUM_CAL_REGS]; -}; - -struct cmdq { - unsigned int cmds[MAX_COMMANDS]; - unsigned char isrshadow[ISR_COMMANDS]; -}; - -enum battery_state { - BATTERY_UNKNOWN = 0, - BATTERY_PRESENT, - BATTERY_LOST, -}; - -struct wctdm { - char *variety; - char board_name[80]; - struct zt_span span; - unsigned char ios; - unsigned int sdi; - int usecount; - unsigned int intcount; - unsigned int rxints; - unsigned int txints; - unsigned char txident; - unsigned char rxident; - int dead; - int pos; - int flags[NUM_CARDS]; - int alt; - int curcard; - unsigned char ctlreg; - int cards; - int cardflag; /* Bit-map of present cards */ - int altcs[NUM_CARDS + NUM_EC]; - char qrvhook[NUM_CARDS]; - unsigned short qrvdebtime[NUM_CARDS]; - int radmode[NUM_CARDS]; -#define RADMODE_INVERTCOR 1 -#define RADMODE_IGNORECOR 2 -#define RADMODE_EXTTONE 4 -#define RADMODE_EXTINVERT 8 -#define RADMODE_IGNORECT 16 -#define RADMODE_PREEMP 32 -#define RADMODE_DEEMP 64 - unsigned short debouncetime[NUM_CARDS]; - signed short rxgain[NUM_CARDS]; - signed short txgain[NUM_CARDS]; - spinlock_t reglock; - wait_queue_head_t regq; - /* FXO Stuff */ - union { - struct fxo { - int wasringing; - int lastrdtx; - int lastrdtx_count; - int ringdebounce; - int offhook; - int battdebounce; - int battalarm; - enum battery_state battery; - int lastpol; - int polarity; - int polaritydebounce; - int neonmwi_state; - int neonmwi_last_voltage; - unsigned int neonmwi_debounce; - unsigned int neonmwi_offcounter; - } fxo; - struct fxs { - int oldrxhook; - int debouncehook; - int lastrxhook; - int debounce; - int ohttimer; - int idletxhookstate; /* IDLE changing hook state */ - int lasttxhook; - int palarms; - struct calregs calregs; - } fxs; - } mods[NUM_CARDS]; - struct cmdq cmdq[NUM_CARDS + NUM_EC]; - /* Receive hook state and debouncing */ - int modtype[NUM_CARDS + NUM_EC]; - /* Set hook */ - int sethook[NUM_CARDS + NUM_EC]; - int dacssrc[NUM_CARDS]; - int type; - -#ifdef VPM_SUPPORT - int vpm; - unsigned long dtmfactive; - unsigned long dtmfmask; - unsigned long dtmfmutemask; - short dtmfenergy[NUM_CARDS]; - short dtmfdigit[NUM_CARDS]; - - struct vpm150m *vpm150m; -#ifdef FANCY_ECHOCAN - int echocanpos; - int blinktimer; -#endif -#endif - struct voicebus *vb; - struct zt_chan chans[NUM_CARDS]; - int initialized; -}; - - -int schluffen(wait_queue_head_t *q); - -extern spinlock_t ifacelock; -extern struct wctdm *ifaces[WC_MAX_IFACES]; - -#endif diff --git a/zaptel/kernel/wcte11xp.c b/zaptel/kernel/wcte11xp.c deleted file mode 100644 index 1d5bd51a..00000000 --- a/zaptel/kernel/wcte11xp.c +++ /dev/null @@ -1,1644 +0,0 @@ -/* - * Digium, Inc. Wildcard TE110P T1/PRI card Driver - * - * Written by Mark Spencer - * Matthew Fredrickson - * William Meadows - * - * Copyright (C) 2004, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "zaptel.h" -#ifdef LINUX26 -#include -#endif - -/* XXX: fix this */ -#include "wct4xxp/wct4xxp.h" /* For certain definitions */ - -#define WC_MAX_CARDS 32 - -/* -#define TEST_REGS -*/ - -/* Define to get more attention-grabbing but slightly more I/O using - alarm status */ -#define FANCY_ALARM - -/* Define to enable the V2.1 errata register settings */ -#if 0 -#define TRUST_INFINEON_ERRATA -#endif - -#define DELAY 0x0 /* 30 = 15 cycles, 10 = 8 cycles, 0 = 3 cycles */ - -#define WC_CNTL 0x00 -#define WC_OPER 0x01 -#define WC_AUXC 0x02 -#define WC_AUXD 0x03 -#define WC_MASK0 0x04 -#define WC_MASK1 0x05 -#define WC_INTSTAT 0x06 - -#define WC_DMAWS 0x08 -#define WC_DMAWI 0x0c -#define WC_DMAWE 0x10 -#define WC_DMARS 0x18 -#define WC_DMARI 0x1c -#define WC_DMARE 0x20 -#define WC_CURPOS 0x24 - -#define WC_SERC 0x2d -#define WC_FSCDELAY 0x2f - -#define WC_USERREG 0xc0 - -#define WC_CLOCK 0x0 -#define WC_LEDTEST 0x1 -#define WC_VERSION 0x2 - -/* Offset between transmit and receive */ -#define WC_OFFSET 4 - -#define BIT_CS (1 << 7) -#define BIT_ADDR (0xf << 3) - -#define BIT_LED1 (1 << 0) -#define BIT_LED0 (1 << 1) -#define BIT_TEST (1 << 2) - -#define FLAG_STARTED (1 << 0) -#define FLAG_NMF (1 << 1) -#define FLAG_SENDINGYELLOW (1 << 2) -#define FLAG_FALC12 (1 << 3) - -#define TYPE_T1 1 /* is a T1 card */ -#define TYPE_E1 2 /* is an E1 card */ - -static int chanmap_t1[] = -{ 2,1,0, - 6,5,4, - 10,9,8, - 14,13,12, - 18,17,16, - 22,21,20, - 26,25,24, - 30,29,28 }; - -static int chanmap_e1[] = -{ 2,1,0, - 7,6,5,4, - 11,10,9,8, - 15,14,13,12, - 19,18,17,16, - 23,22,21,20, - 27,26,25,24, - 31,30,29,28 }; - -static int chanmap_e1uc[] = -{ 3,2,1,0, - 7,6,5,4, - 11,10,9,8, - 15,14,13,12, - 19,18,17,16, - 23,22,21,20, - 27,26,25,24, - 31,30,29,28 }; - - -#ifdef FANCY_ALARM -static int altab[] = { -0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24, 25, 27, 28, 29, 30, 31, 31, 32, 31, 31, 30, 29, 28, 27, 25, 23, 22, 20, 18, 16, 13, 11, 9, 8, 6, 4, 3, 2, 1, 0, 0, -}; -#endif - -struct t1 { - struct pci_dev *dev; - spinlock_t lock; - int spantype; - int spanflags; /* Span flags */ - unsigned char txsigs[16]; /* Copy of tx sig registers */ - int num; - int alarmcount; /* How much red alarm we've seen */ - int alarmdebounce; - /* Our offset for finding channel 1 */ - int offset; - char *variety; - unsigned int intcount; - int usecount; - int clocktimeout; - int sync; - int dead; - int blinktimer; - int alarmtimer; - int checktiming; /* Set >0 to cause the timing source to be checked */ - int loopupcnt; - int loopdowncnt; - int miss; - int misslast; - int *chanmap; -#ifdef FANCY_ALARM - int alarmpos; -#endif - unsigned char ledtestreg; - unsigned char outbyte; - unsigned long ioaddr; - unsigned short canary; - /* T1 signalling */ - dma_addr_t readdma; - dma_addr_t writedma; - volatile unsigned char *writechunk; /* Double-word aligned write memory */ - volatile unsigned char *readchunk; /* Double-word aligned read memory */ - unsigned char ec_chunk1[32][ZT_CHUNKSIZE]; - unsigned char ec_chunk2[32][ZT_CHUNKSIZE]; - unsigned char tempo[33]; - struct zt_span span; /* Span */ - struct zt_chan chans[32]; /* Channels */ -}; - -#define CANARY 0xca1e - -static int debug = 0; /* doesnt do anything */ -static int j1mode = 0; -static int alarmdebounce = 0; -static int loopback = 0; -static int clockextra = 0; -static int t1e1override = -1; -static int unchannelized = 0; - -static struct t1 *cards[WC_MAX_CARDS]; - -static inline void start_alarm(struct t1 *wc) -{ -#ifdef FANCY_ALARM - wc->alarmpos = 0; -#endif - wc->blinktimer = 0; -} - -static inline void stop_alarm(struct t1 *wc) -{ -#ifdef FANCY_ALARM - wc->alarmpos = 0; -#endif - wc->blinktimer = 0; -} - -static inline void __select_framer(struct t1 *wc, int reg) -{ - /* Top four bits of address from AUX 6-3 */ - wc->outbyte &= ~BIT_CS; - wc->outbyte &= ~BIT_ADDR; - wc->outbyte |= (reg & 0xf0) >> 1; - outb(wc->outbyte, wc->ioaddr + WC_AUXD); -} - -static inline void __select_control(struct t1 *wc) -{ - if (!(wc->outbyte & BIT_CS)) { - wc->outbyte |= BIT_CS; - outb(wc->outbyte, wc->ioaddr + WC_AUXD); - } -} - -static int t1xxp_open(struct zt_chan *chan) -{ - struct t1 *wc = chan->pvt; - if (wc->dead) - return -ENODEV; - wc->usecount++; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - try_module_get(THIS_MODULE); -#endif - return 0; -} - -static int __control_set_reg(struct t1 *wc, int reg, unsigned char val) -{ - __select_control(wc); - outb(val, wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return 0; -} - -static int control_set_reg(struct t1 *wc, int reg, unsigned char val) -{ - unsigned long flags; - int res; - spin_lock_irqsave(&wc->lock, flags); - res = __control_set_reg(wc, reg, val); - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static int __control_get_reg(struct t1 *wc, int reg) -{ - unsigned char res; - /* The following makes UTTERLY no sense, but what was happening - was that reads in some cases were not actually happening - on the physical bus. Why, we dunno. But in debugging, we found - that writing before reading (in this case to an unused position) - seems to get rid of the problem */ - __control_set_reg(wc,3,0x69); /* do magic here */ - /* now get the read byte from the Xilinx part */ - res = inb(wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return res; -} - -static int control_get_reg(struct t1 *wc, int reg) -{ - unsigned long flags; - int res; - spin_lock_irqsave(&wc->lock, flags); - res = __control_get_reg(wc, reg); - spin_unlock_irqrestore(&wc->lock, flags); - return res; -} - -static inline unsigned int __t1_framer_in(struct t1 *wc, const unsigned int reg) -{ - unsigned char res; - __select_framer(wc, reg); - /* Get value */ - res = inb(wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); - return res; -#if 0 - unsigned int ret; - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | ( 1 << 10) | WC_LREAD); - ret = __t1_pci_in(wc, WC_LDATA); - __t1_pci_out(wc, WC_LADDR, 0); - return ret & 0xff; -#endif -} - -static inline unsigned int t1_framer_in(struct t1 *wc, const unsigned int addr) -{ - unsigned long flags; - unsigned int ret; - spin_lock_irqsave(&wc->lock, flags); - ret = __t1_framer_in(wc, addr); - spin_unlock_irqrestore(&wc->lock, flags); - return ret; - -} - -static inline void __t1_framer_out(struct t1 *wc, const unsigned int reg, const unsigned int val) -{ - if (debug > 1) - printk("Writing %02x to address %02x\n", val, reg); - __select_framer(wc, reg); - /* Send address */ - outb(val, wc->ioaddr + WC_USERREG + ((reg & 0xf) << 2)); -#if 0 - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - __t1_pci_out(wc, WC_LDATA, value); - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | (1 << 10)); - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | (1 << 10) | WC_LWRITE); - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff) | (1 << 10)); - __t1_pci_out(wc, WC_LADDR, (unit << 8) | (addr & 0xff)); - __t1_pci_out(wc, WC_LADDR, 0); - if (debug) printk("Write complete\n"); -#endif -#if 0 - { unsigned int tmp; - tmp = t1_framer_in(wc, unit, addr); - if (tmp != value) { - printk("Expected %d from unit %d register %d but got %d instead\n", value, unit, addr, tmp); - } } -#endif -} - -static inline void t1_framer_out(struct t1 *wc, const unsigned int addr, const unsigned int value) -{ - unsigned long flags; - spin_lock_irqsave(&wc->lock, flags); - __t1_framer_out(wc, addr, value); - spin_unlock_irqrestore(&wc->lock, flags); -} - -static void t1xxp_release(struct t1 *wc) -{ - zt_unregister(&wc->span); - kfree(wc); - printk("Freed a Wildcard\n"); -} - -static int t1xxp_close(struct zt_chan *chan) -{ - struct t1 *wc = chan->pvt; - wc->usecount--; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - /* If we're dead, release us now */ - if (!wc->usecount && wc->dead) - t1xxp_release(wc); - return 0; -} - -static void t1xxp_enable_interrupts(struct t1 *wc) -{ - /* Clear interrupts */ - outb(0xff, wc->ioaddr + WC_INTSTAT); - /* Enable interrupts (we care about all of them) */ - outb(0x3c /* 0x3f */, wc->ioaddr + WC_MASK0); - /* No external interrupts */ - outb(0x00, wc->ioaddr + WC_MASK1); - if (debug) printk("Enabled interrupts!\n"); -} - -static void t1xxp_start_dma(struct t1 *wc) -{ - /* Reset Master and TDM */ - outb(DELAY | 0x0f, wc->ioaddr + WC_CNTL); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); - outb(DELAY | 0x01, wc->ioaddr + WC_CNTL); - outb(0x01, wc->ioaddr + WC_OPER); - if (debug) printk("Started DMA\n"); - outb(0x03, wc->ioaddr + WC_OPER); - outb(0x01, wc->ioaddr + WC_OPER); -} - -static void __t1xxp_stop_dma(struct t1 *wc) -{ - outb(0x00, wc->ioaddr + WC_OPER); -} - -static void __t1xxp_disable_interrupts(struct t1 *wc) -{ - outb(0x00, wc->ioaddr + WC_MASK0); - outb(0x00, wc->ioaddr + WC_MASK1); -} - -static void __t1xxp_set_clear(struct t1 *wc) -{ - int i,j; - unsigned short val=0; - for (i=0;i<24;i++) { - j = (i/8); - if (wc->span.chans[i].flags & ZT_FLAG_CLEAR) - val |= 1 << (7 - (i % 8)); - if ((i % 8)==7) { - if (debug > 1) - printk("Putting %d in register %02x\n", - val, 0x2f + j); - __t1_framer_out(wc, 0x2f + j, val); - val = 0; - } - } -} - -static int t1xxp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - struct t4_regs regs; - int x; - struct t1 *wc; - switch(cmd) { - case WCT4_GET_REGS: - wc = chan->pvt; - for (x=0;xioaddr + (x << 2))) | - (inb(wc->ioaddr + (x << 2) + 1) << 8) | - (inb(wc->ioaddr + (x << 2) + 2) << 16) | - (inb(wc->ioaddr + (x << 2) + 3) << 24); -#else - regs.pci[x] = (inb(wc->ioaddr + x)); -#endif - - for (x=0;xpvt; - - if (wc->spantype == TYPE_E1) { - switch(cmd) { - case ZT_MAINT_NONE: - printk("XXX Turn off local and remote loops E1 XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - printk("XXX Turn on local loopback E1 XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - printk("XXX Turn on remote loopback E1 XXX\n"); - break; - case ZT_MAINT_LOOPUP: - printk("XXX Send loopup code E1 XXX\n"); - break; - case ZT_MAINT_LOOPDOWN: - printk("XXX Send loopdown code E1 XXX\n"); - break; - case ZT_MAINT_LOOPSTOP: - printk("XXX Stop sending loop codes E1 XXX\n"); - break; - default: - printk("TE110P: Unknown E1 maint command: %d\n", cmd); - break; - } - } else { - switch(cmd) { - case ZT_MAINT_NONE: - printk("XXX Turn off local and remote loops T1 XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - printk("XXX Turn on local loop and no remote loop XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - printk("XXX Turn on remote loopup XXX\n"); - break; - case ZT_MAINT_LOOPUP: - t1_framer_out(wc, 0x21, 0x50); /* FMR5: Nothing but RBS mode */ - break; - case ZT_MAINT_LOOPDOWN: - t1_framer_out(wc, 0x21, 0x60); /* FMR5: Nothing but RBS mode */ - break; - case ZT_MAINT_LOOPSTOP: - t1_framer_out(wc, 0x21, 0x40); /* FMR5: Nothing but RBS mode */ - break; - default: - printk("TE110P: Unknown T1 maint command: %d\n", cmd); - break; - } - } - return 0; -} - -static int t1xxp_rbsbits(struct zt_chan *chan, int bits) -{ - u_char m,c; - int n,b; - struct t1 *wc = chan->pvt; - unsigned long flags; - - if(debug > 1) printk("Setting bits to %d on channel %s\n", bits, chan->name); - spin_lock_irqsave(&wc->lock, flags); - if (wc->spantype == TYPE_E1) { /* do it E1 way */ - if (chan->chanpos == 16) { - spin_unlock_irqrestore(&wc->lock, flags); - return 0; - } - n = chan->chanpos - 1; - if (chan->chanpos > 15) n--; - b = (n % 15); - c = wc->txsigs[b]; - m = (n / 15) << 2; /* nibble selector */ - c &= (0xf << m); /* keep the other nibble */ - c |= (bits & 0xf) << (4 - m); /* put our new nibble here */ - wc->txsigs[b] = c; - /* output them to the chip */ - __t1_framer_out(wc,0x71 + b,c); - } else if (wc->span.lineconfig & ZT_CONFIG_D4) { - n = chan->chanpos - 1; - b = (n/4); - c = wc->txsigs[b]; - m = ((3 - (n % 4)) << 1); /* nibble selector */ - c &= ~(0x3 << m); /* keep the other nibble */ - c |= ((bits >> 2) & 0x3) << m; /* put our new nibble here */ - wc->txsigs[b] = c; - /* output them to the chip */ - __t1_framer_out(wc,0x70 + b,c); - __t1_framer_out(wc,0x70 + b + 6,c); - } else if (wc->span.lineconfig & ZT_CONFIG_ESF) { - n = chan->chanpos - 1; - b = (n/2); - c = wc->txsigs[b]; - m = ((n % 2) << 2); /* nibble selector */ - c &= (0xf << m); /* keep the other nibble */ - c |= (bits & 0xf) << (4 - m); /* put our new nibble here */ - wc->txsigs[b] = c; - /* output them to the chip */ - __t1_framer_out(wc,0x70 + b,c); - } - spin_unlock_irqrestore(&wc->lock, flags); - if (debug > 1) - printk("Finished setting RBS bits\n"); - return 0; -} - -static void t1_check_sigbits(struct t1 *wc) -{ - int a,i,rxs; - unsigned long flags; - - if (!(wc->span.flags & ZT_FLAG_RUNNING)) - return; - - spin_lock_irqsave(&wc->lock, flags); - - if (wc->spantype == TYPE_E1) { - for (i = 0; i < 15; i++) { - a = __t1_framer_in(wc, 0x71 + i); - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(wc->span.chans[i+16].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+16].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i+16], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - rxs = (a >> 4) & 0xf; - if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - } - } else if (wc->span.lineconfig & ZT_CONFIG_D4) { - for (i = 0; i < 24; i+=4) { - a = __t1_framer_in(wc, 0x70 + (i>>2)); - /* Get high channel in low bits */ - rxs = (a & 0x3) << 2; - if (!(wc->span.chans[i+3].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+3].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i+3], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - rxs = (a & 0xc); - if (!(wc->span.chans[i+2].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+2].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i+2], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - rxs = (a >> 2) & 0xc; - if (!(wc->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+1].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i+1], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - rxs = (a >> 4) & 0xc; - if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - } - } else { - for (i = 0; i < 24; i+=2) { - a = __t1_framer_in(wc, 0x70 + (i>>1)); - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(wc->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+1].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i+1], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - rxs = (a >> 4) & 0xf; - if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i].rxsig != rxs) { - spin_unlock_irqrestore(&wc->lock, flags); - zt_rbsbits(&wc->span.chans[i], rxs); - spin_lock_irqsave(&wc->lock, flags); - } - } - } - } - spin_unlock_irqrestore(&wc->lock, flags); -} - -static void t4_serial_setup(struct t1 *wc) -{ - printk("TE110P: Setting up global serial parameters for %s %s\n", - wc->spantype == TYPE_E1 ? (unchannelized ? "Unchannelized E1" : "E1") : "T1", - wc->spanflags & FLAG_FALC12 ? "FALC V1.2" : "FALC V2.2"); - t1_framer_out(wc, 0x85, 0xe0); /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */ - t1_framer_out(wc, 0x08, 0x05); /* IPC: Interrupt push/pull active low */ - if (wc->spanflags & FLAG_FALC12) { - t1_framer_out(wc, 0x92, 0x00); - t1_framer_out(wc, 0x93, 0x58); - t1_framer_out(wc, 0x94, 0xd2); - t1_framer_out(wc, 0x95, 0xc2); - t1_framer_out(wc, 0x96, 0x03); - t1_framer_out(wc, 0x97, 0x10); - } else { - /* Global clocks (8.192 Mhz CLK) */ - t1_framer_out(wc, 0x92, 0x00); - t1_framer_out(wc, 0x93, 0x18); - t1_framer_out(wc, 0x94, 0xfb); - t1_framer_out(wc, 0x95, 0x0b); - t1_framer_out(wc, 0x96, 0x00); - t1_framer_out(wc, 0x97, 0x0b); - t1_framer_out(wc, 0x98, 0xdb); - t1_framer_out(wc, 0x99, 0xdf); - } - /* Configure interrupts */ - t1_framer_out(wc, 0x46, 0x40); /* GCR: Interrupt on Activation/Deactivation of AIX, LOS */ - - /* Configure system interface */ - t1_framer_out(wc, 0x3e, 0x02); /* SIC1: 4.096 Mhz clock/bus, double buffer receive / transmit, byte interleaved */ - t1_framer_out(wc, 0x3f, 0x00); /* SIC2: No FFS, no center receive eliastic buffer, phase 0 */ - t1_framer_out(wc, 0x40, 0x04); /* SIC3: Edges for capture */ - t1_framer_out(wc, 0x44, 0x30); /* CMR1: RCLK is at 8.192 Mhz dejittered */ - t1_framer_out(wc, 0x45, 0x00); /* CMR2: We provide sync and clock for tx and rx. */ - t1_framer_out(wc, 0x22, 0x00); /* XC0: Normal operation of Sa-bits */ - t1_framer_out(wc, 0x23, 0x04); /* XC1: 0 offset */ - t1_framer_out(wc, 0x24, 0x07); /* RC0: Just shy of 255 */ - if (wc->spanflags & FLAG_FALC12) - t1_framer_out(wc, 0x25, 0x04); /* RC1: The rest of RC0 */ - else - t1_framer_out(wc, 0x25, 0x05); /* RC1: The rest of RC0 */ - - /* Configure ports */ - t1_framer_out(wc, 0x80, 0x00); /* PC1: SPYR/SPYX input on RPA/XPA */ - t1_framer_out(wc, 0x81, 0x22); /* PC2: RMFB/XSIG output/input on RPB/XPB */ - t1_framer_out(wc, 0x82, 0x65); /* PC3: Some unused stuff */ - t1_framer_out(wc, 0x83, 0x35); /* PC4: Some more unused stuff */ - t1_framer_out(wc, 0x84, 0x31); /* PC5: XMFS active low, SCLKR is input, RCLK is output */ - t1_framer_out(wc, 0x86, 0x03); /* PC6: CLK1 is Tx Clock output, CLK2 is 8.192 Mhz from DCO-R */ - t1_framer_out(wc, 0x3b, 0x00); /* Clear LCR1 */ - printk("TE110P: Successfully initialized serial bus for card\n"); -} - -static void __t1_configure_t1(struct t1 *wc, int lineconfig, int txlevel) -{ - unsigned int fmr4, fmr2, fmr1, fmr0, lim2; - char *framing, *line; - int mytxlevel; - if ((txlevel > 7) || (txlevel < 4)) - mytxlevel = 0; - else - mytxlevel = txlevel - 4; - fmr1 = 0x1c; /* FMR1: Mode 0, T1 mode, CRC on for ESF, 2.048 Mhz system data rate, no XAIS */ - fmr2 = 0x22; /* FMR2: no payload loopback, auto send yellow alarm */ - if (loopback) - fmr2 |= 0x4; - - if (j1mode) - fmr4 = 0x1c; - else - fmr4 = 0x0c; /* FMR4: Lose sync on 2 out of 5 framing bits, auto resync */ - - - lim2 = 0x21; /* LIM2: 50% peak is a "1", Advanced Loss recovery */ - lim2 |= (mytxlevel << 6); /* LIM2: Add line buildout */ - __t1_framer_out(wc, 0x1d, fmr1); - __t1_framer_out(wc, 0x1e, fmr2); - - /* Configure line interface */ - if (lineconfig & ZT_CONFIG_AMI) { - line = "AMI"; - fmr0 = 0xa0; - } else { - line = "B8ZS"; - fmr0 = 0xf0; - } - if (lineconfig & ZT_CONFIG_D4) { - framing = "D4"; - } else { - framing = "ESF"; - fmr4 |= 0x2; - fmr2 |= 0xc0; - } - __t1_framer_out(wc, 0x1c, fmr0); - - __t1_framer_out(wc, 0x20, fmr4); - __t1_framer_out(wc, 0x21, 0x40); /* FMR5: Enable RBS mode */ - - __t1_framer_out(wc, 0x37, 0xf8); /* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */ - __t1_framer_out(wc, 0x36, 0x08); /* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */ - - __t1_framer_out(wc, 0x02, 0x50); /* CMDR: Reset the receiver and transmitter line interface */ - __t1_framer_out(wc, 0x02, 0x00); /* CMDR: Reset the receiver and transmitter line interface */ - - __t1_framer_out(wc, 0x3a, lim2); /* LIM2: 50% peak amplitude is a "1" */ - __t1_framer_out(wc, 0x38, 0x0a); /* PCD: LOS after 176 consecutive "zeros" */ - __t1_framer_out(wc, 0x39, 0x15); /* PCR: 22 "ones" clear LOS */ - - if (j1mode) - __t1_framer_out(wc, 0x24, 0x80); /* J1 overide */ - - /* Generate pulse mask for T1 */ - switch(mytxlevel) { - case 3: - __t1_framer_out(wc, 0x26, 0x07); /* XPM0 */ - __t1_framer_out(wc, 0x27, 0x01); /* XPM1 */ - __t1_framer_out(wc, 0x28, 0x00); /* XPM2 */ - break; - case 2: - __t1_framer_out(wc, 0x26, 0x8c); /* XPM0 */ - __t1_framer_out(wc, 0x27, 0x11); /* XPM1 */ - __t1_framer_out(wc, 0x28, 0x01); /* XPM2 */ - break; - case 1: - __t1_framer_out(wc, 0x26, 0x8c); /* XPM0 */ - __t1_framer_out(wc, 0x27, 0x01); /* XPM1 */ - __t1_framer_out(wc, 0x28, 0x00); /* XPM2 */ - break; - case 0: - default: - __t1_framer_out(wc, 0x26, 0xd7); /* XPM0 */ - __t1_framer_out(wc, 0x27, 0x22); /* XPM1 */ - __t1_framer_out(wc, 0x28, 0x01); /* XPM2 */ - break; - } - printk("TE110P: Span configured for %s/%s\n", framing, line); -} - -static void __t1_configure_e1(struct t1 *wc, int lineconfig) -{ - unsigned int fmr2, fmr1, fmr0; - unsigned int cas = 0; - char *crc4 = ""; - char *framing, *line; - fmr1 = 0x44; /* FMR1: E1 mode, Automatic force resync, PCM30 mode, 8.192 Mhz backplane, no XAIS */ - fmr2 = 0x03; /* FMR2: Auto transmit remote alarm, auto loss of multiframe recovery, no payload loopback */ - if (unchannelized) - fmr2 |= 0x30; - if (loopback) - fmr2 |= 0x4; - if (lineconfig & ZT_CONFIG_CRC4) { - fmr1 |= 0x08; /* CRC4 transmit */ - fmr2 |= 0xc0; /* CRC4 receive */ - crc4 = "/CRC4"; - } - __t1_framer_out(wc, 0x1d, fmr1); - __t1_framer_out(wc, 0x1e, fmr2); - - /* Configure line interface */ - if (lineconfig & ZT_CONFIG_AMI) { - line = "AMI"; - fmr0 = 0xa0; - } else { - line = "HDB3"; - fmr0 = 0xf0; - } - if (lineconfig & ZT_CONFIG_CCS) { - framing = "CCS"; - } else { - framing = "CAS"; - cas = 0x40; - } - __t1_framer_out(wc, 0x1c, fmr0); - - if (unchannelized) - __t1_framer_out(wc, 0x1f, 0x40); - - __t1_framer_out(wc, 0x37, 0xf0 /*| 0x6 */ ); /* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */ - __t1_framer_out(wc, 0x36, 0x08); /* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */ - - __t1_framer_out(wc, 0x02, 0x50); /* CMDR: Reset the receiver and transmitter line interface */ - __t1_framer_out(wc, 0x02, 0x00); /* CMDR: Reset the receiver and transmitter line interface */ - - /* Condition receive line interface for E1 after reset */ - __t1_framer_out(wc, 0xbb, 0x17); - __t1_framer_out(wc, 0xbc, 0x55); - __t1_framer_out(wc, 0xbb, 0x97); - __t1_framer_out(wc, 0xbb, 0x11); - __t1_framer_out(wc, 0xbc, 0xaa); - __t1_framer_out(wc, 0xbb, 0x91); - __t1_framer_out(wc, 0xbb, 0x12); - __t1_framer_out(wc, 0xbc, 0x55); - __t1_framer_out(wc, 0xbb, 0x92); - __t1_framer_out(wc, 0xbb, 0x0c); - __t1_framer_out(wc, 0xbb, 0x00); - __t1_framer_out(wc, 0xbb, 0x8c); - - __t1_framer_out(wc, 0x3a, 0x20); /* LIM2: 50% peak amplitude is a "1" */ - __t1_framer_out(wc, 0x38, 0x0a); /* PCD: LOS after 176 consecutive "zeros" */ - __t1_framer_out(wc, 0x39, 0x15); /* PCR: 22 "ones" clear LOS */ - - __t1_framer_out(wc, 0x20, 0x9f); /* XSW: Spare bits all to 1 */ - if (unchannelized) - __t1_framer_out(wc, 0x21, 0x3c); - else - __t1_framer_out(wc, 0x21, 0x1c|cas); /* XSP: E-bit set when async. AXS auto, XSIF to 1 */ - - - /* Generate pulse mask for E1 */ - __t1_framer_out(wc, 0x26, 0x54); /* XPM0 */ - __t1_framer_out(wc, 0x27, 0x02); /* XPM1 */ - __t1_framer_out(wc, 0x28, 0x00); /* XPM2 */ - printk("TE110P: Span configured for %s/%s%s\n", framing, line, crc4); -} - -static void t1xxp_framer_start(struct t1 *wc, struct zt_span *span) -{ - int alreadyrunning = wc->span.flags & ZT_FLAG_RUNNING; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - - if (wc->spantype == TYPE_E1) { /* if this is an E1 card */ - __t1_configure_e1(wc, span->lineconfig); - } else { /* is a T1 card */ - __t1_configure_t1(wc, span->lineconfig, span->txlevel); - __t1xxp_set_clear(wc); - } - - if (!alreadyrunning) - wc->span.flags |= ZT_FLAG_RUNNING; - - spin_unlock_irqrestore(&wc->lock, flags); -} - - -static int t1xxp_startup(struct zt_span *span) -{ - struct t1 *wc = span->pvt; - - int i,alreadyrunning = span->flags & ZT_FLAG_RUNNING; - - /* initialize the start value for the entire chunk of last ec buffer */ - for(i = 0; i < span->channels; i++) - { - memset(wc->ec_chunk1[i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - memset(wc->ec_chunk2[i], - ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE); - } - - /* Reset framer with proper parameters and start */ - t1xxp_framer_start(wc, span); - printk("Calling startup (flags is %d)\n", span->flags); - - if (!alreadyrunning) { - /* Only if we're not already going */ - t1xxp_enable_interrupts(wc); - t1xxp_start_dma(wc); - span->flags |= ZT_FLAG_RUNNING; - } - return 0; -} - -static int t1xxp_shutdown(struct zt_span *span) -{ - struct t1 *wc = span->pvt; - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - __t1_framer_out(wc, 0x46, 0x41); /* GCR: Interrupt on Activation/Deactivation of AIX, LOS */ - __t1xxp_stop_dma(wc); - __t1xxp_disable_interrupts(wc); - span->flags &= ~ZT_FLAG_RUNNING; - spin_unlock_irqrestore(&wc->lock, flags); - return 0; -} - - -static int t1xxp_chanconfig(struct zt_chan *chan, int sigtype) -{ - struct t1 *wc = chan->pvt; - unsigned long flags; - int alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING; - - spin_lock_irqsave(&wc->lock, flags); - - if (alreadyrunning && (wc->spantype != TYPE_E1)) - __t1xxp_set_clear(wc); - - spin_unlock_irqrestore(&wc->lock, flags); - return 0; -} - -static int t1xxp_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - struct t1 *wc = span->pvt; - - /* Do we want to SYNC on receive or not */ - wc->sync = lc->sync; - /* If already running, apply changes immediately */ - if (span->flags & ZT_FLAG_RUNNING) - return t1xxp_startup(span); - - return 0; -} - -static int t1xxp_software_init(struct t1 *wc) -{ - int x; - /* Find position */ - for (x=0;x= WC_MAX_CARDS) - return -1; - 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"; - zap_copy_string(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.spanconfig = t1xxp_spanconfig; - wc->span.chanconfig = t1xxp_chanconfig; - wc->span.irq = wc->dev->irq; - wc->span.startup = t1xxp_startup; - wc->span.shutdown = t1xxp_shutdown; - wc->span.rbsbits = t1xxp_rbsbits; - wc->span.maint = t1xxp_maint; - wc->span.open = t1xxp_open; - wc->span.close = t1xxp_close; - if (wc->spantype == TYPE_E1) { - if (unchannelized) - wc->span.channels = 32; - else - wc->span.channels = 31; - wc->span.deflaw = ZT_LAW_ALAW; - wc->span.spantype = "E1"; - wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4; - } else { - wc->span.channels = 24; - wc->span.deflaw = ZT_LAW_MULAW; - wc->span.spantype = "T1"; - wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF; - } - wc->span.chans = wc->chans; - wc->span.flags = ZT_FLAG_RBS; - wc->span.ioctl = t1xxp_ioctl; - wc->span.pvt = wc; - init_waitqueue_head(&wc->span.maintq); - for (x=0;xspan.channels;x++) { - sprintf(wc->chans[x].name, "WCT1/%d/%d", wc->num, x + 1); - wc->chans[x].sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_EM_E1 | - ZT_SIG_FXSLS | ZT_SIG_FXSGS | ZT_SIG_MTP2 | - ZT_SIG_FXSKS | ZT_SIG_FXOLS | ZT_SIG_DACS_RBS | - ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_SF; - wc->chans[x].pvt = wc; - wc->chans[x].chanpos = x + 1; - } - if (zt_register(&wc->span, 0)) { - printk("Unable to register span with zaptel\n"); - return -1; - } - return 0; -} - -static inline void __handle_leds(struct t1 *wc) -{ - int oldreg; - - if (wc->span.alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE)) { - /* Red/Blue alarm */ - wc->blinktimer++; -#ifdef FANCY_ALARM - if (wc->blinktimer == (altab[wc->alarmpos] >> 1)) { - wc->ledtestreg = (wc->ledtestreg | BIT_LED1) & ~BIT_LED0; - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } - if (wc->blinktimer >= 0xf) { - wc->ledtestreg = wc->ledtestreg & ~(BIT_LED0 | BIT_LED1); - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - wc->blinktimer = -1; - wc->alarmpos++; - if (wc->alarmpos >= (sizeof(altab) / sizeof(altab[0]))) - wc->alarmpos = 0; - } -#else - if (wc->blinktimer == 160) { - wc->ledtestreg = (wc->ledtestreg | BIT_LED1) & ~BIT_LED0; - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } else if (wc->blinktimer == 480) { - wc->ledtestreg = wc->ledtestreg & ~(BIT_LED0 | BIT_LED1); - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - wc->blinktimer = 0; - } -#endif - } else if (wc->span.alarms & ZT_ALARM_YELLOW) { - /* Yellow Alarm */ - if (!(wc->blinktimer % 2)) - wc->ledtestreg = (wc->ledtestreg | BIT_LED1) & ~BIT_LED0; - else - wc->ledtestreg = (wc->ledtestreg | BIT_LED0) & ~BIT_LED1; - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } else { - /* No Alarm */ - oldreg = wc->ledtestreg; - if (wc->span.maintstat != ZT_MAINT_NONE) - wc->ledtestreg |= BIT_TEST; - else - wc->ledtestreg &= ~BIT_TEST; - if (wc->span.flags & ZT_FLAG_RUNNING) - wc->ledtestreg = (wc->ledtestreg | BIT_LED0) & ~BIT_LED1; - else - wc->ledtestreg = wc->ledtestreg & ~(BIT_LED0 | BIT_LED1); - if (oldreg != wc->ledtestreg) - __control_set_reg(wc, WC_LEDTEST, wc->ledtestreg); - } -} - -static void t1xxp_transmitprep(struct t1 *wc, int ints) -{ - volatile unsigned char *txbuf; - int x,y; - int pos; - if (ints & 0x04 /* 0x01 */) { - /* We just finished sending the first buffer, start filling it - now */ - txbuf = wc->writechunk; - } else { - /* Just finished sending second buffer, fill it now */ - txbuf = wc->writechunk + 32 * ZT_CHUNKSIZE; - } - zt_transmit(&wc->span); - for (x=0;xoffset;x++) - txbuf[x] = wc->tempo[x]; - for (y=0;yspan.channels;x++) { - pos = y * 32 + wc->chanmap[x] + wc->offset; - /* Put channel number as outgoing data */ - if (pos < 32 * ZT_CHUNKSIZE) - txbuf[pos] = wc->chans[x].writechunk[y]; - else - wc->tempo[pos - 32 * ZT_CHUNKSIZE] = wc->chans[x].writechunk[y]; - } - } -} - -static void t1xxp_receiveprep(struct t1 *wc, int ints) -{ - volatile unsigned char *rxbuf; - volatile unsigned int *canary; - int x; - int y; - unsigned int oldcan; - if (ints & 0x04) { - /* Just received first buffer */ - rxbuf = wc->readchunk; - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 64 - 4); - } else { - rxbuf = wc->readchunk + ZT_CHUNKSIZE * 32; - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 32 - 4); - } - oldcan = *canary; - if (((oldcan & 0xffff0000) >> 16) != CANARY) { - /* Check top part */ - if (debug) printk("Expecting top %04x, got %04x\n", CANARY, (oldcan & 0xffff0000) >> 16); - wc->span.irqmisses++; - } else if ((oldcan & 0xffff) != ((wc->canary - 1) & 0xffff)) { - if (debug) printk("Expecting bottom %d, got %d\n", wc->canary - 1, oldcan & 0xffff); - wc->span.irqmisses++; - } - for (y=0;yspan.channels;x++) { - /* XXX Optimize, remove * and + XXX */ - /* Must map received channels into appropriate data */ - wc->chans[x].readchunk[y] = - rxbuf[32 * y + ((wc->chanmap[x] + WC_OFFSET + wc->offset) & 0x1f)]; - } - if (wc->spantype != TYPE_E1) { - for (x=3;x<32;x+=4) { - if (rxbuf[32 * y + ((x + WC_OFFSET) & 0x1f)] == 0x7f) { - if (wc->offset != (x-3)) { - /* Resync */ - control_set_reg(wc, WC_CLOCK, 0x06 | wc->sync | clockextra); - wc->clocktimeout = 100; -#if 1 - if (debug) printk("T1: Lost our place, resyncing\n"); -#endif - } - } - } - } else if (!unchannelized) { - if (!wc->clocktimeout && !wc->span.alarms) { - if ((rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)] & 0x7f) != 0x1b) { - if (wc->miss) { - if (debug) printk("Double miss (%d, %d)...\n", wc->misslast, rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)]); - control_set_reg(wc, WC_CLOCK, 0x06 | wc->sync | clockextra); - wc->clocktimeout = 100; - } else { - wc->miss = 1; - wc->misslast = rxbuf[32 * y + ((3 + WC_OFFSET + wc->offset) & 0x1f)]; - } - } else { - wc->miss = 0; - } - } else { - wc->miss = 0; - } - } - } - /* Store the next canary */ - canary = (unsigned int *)(rxbuf + ZT_CHUNKSIZE * 32 - 4); - *canary = (wc->canary++) | (CANARY << 16); - for (x=0;xspan.channels;x++) { - zt_ec_chunk(&wc->chans[x], wc->chans[x].readchunk, - wc->ec_chunk2[x]); - memcpy(wc->ec_chunk2[x],wc->ec_chunk1[x],ZT_CHUNKSIZE); - memcpy(wc->ec_chunk1[x],wc->chans[x].writechunk,ZT_CHUNKSIZE); - } - zt_receive(&wc->span); -} - -static void t1_check_alarms(struct t1 *wc) -{ - unsigned char c,d; - int alarms; - int x,j; - unsigned long flags; - - if (!(wc->span.flags & ZT_FLAG_RUNNING)) - return; - - spin_lock_irqsave(&wc->lock, flags); - - c = __t1_framer_in(wc, 0x4c); - if (wc->spanflags & FLAG_FALC12) - d = __t1_framer_in(wc, 0x4f); - else - d = __t1_framer_in(wc, 0x4d); - - /* Assume no alarms */ - alarms = 0; - - /* And consider only carrier alarms */ - wc->span.alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); - - if (wc->spantype == TYPE_E1) { - if (c & 0x04) { - /* No multiframe found, force RAI high after 400ms only if - we haven't found a multiframe since last loss - of frame */ - if (!(wc->spanflags & FLAG_NMF)) { - __t1_framer_out(wc, 0x20, 0x9f | 0x20); /* LIM0: Force RAI High */ - wc->spanflags |= FLAG_NMF; - printk("NMF workaround on!\n"); - } - __t1_framer_out(wc, 0x1e, 0xc3); /* Reset to CRC4 mode */ - __t1_framer_out(wc, 0x1c, 0xf2); /* Force Resync */ - __t1_framer_out(wc, 0x1c, 0xf0); /* Force Resync */ - } else if (!(c & 0x02)) { - if ((wc->spanflags & FLAG_NMF)) { - __t1_framer_out(wc, 0x20, 0x9f); /* LIM0: Clear forced RAI */ - wc->spanflags &= ~FLAG_NMF; - printk("NMF workaround off!\n"); - } - } - } else { - /* Detect loopup code if we're not sending one */ - if ((!wc->span.mainttimer) && (d & 0x08)) { - /* Loop-up code detected */ - if ((wc->loopupcnt++ > 80) && (wc->span.maintstat != ZT_MAINT_REMOTELOOP)) { - __t1_framer_out(wc, 0x36, 0x08); /* LIM0: Disable any local loop */ - __t1_framer_out(wc, 0x37, 0xf6 ); /* LIM1: Enable remote loop */ - wc->span.maintstat = ZT_MAINT_REMOTELOOP; - } - } else - wc->loopupcnt = 0; - /* Same for loopdown code */ - if ((!wc->span.mainttimer) && (d & 0x10)) { - /* Loop-down code detected */ - if ((wc->loopdowncnt++ > 80) && (wc->span.maintstat == ZT_MAINT_REMOTELOOP)) { - __t1_framer_out(wc, 0x36, 0x08); /* LIM0: Disable any local loop */ - __t1_framer_out(wc, 0x37, 0xf0 ); /* LIM1: Disable remote loop */ - wc->span.maintstat = ZT_MAINT_NONE; - } - } else - wc->loopdowncnt = 0; - } - - if (wc->span.lineconfig & ZT_CONFIG_NOTOPEN) { - for (x=0,j=0;x < wc->span.channels;x++) - if ((wc->span.chans[x].flags & ZT_FLAG_OPEN) || - (wc->span.chans[x].flags & ZT_FLAG_NETDEV)) - j++; - if (!j) - alarms |= ZT_ALARM_NOTOPEN; - } - - if (c & 0xa0) { - if (wc->alarmcount >= alarmdebounce) { - if (!unchannelized) - alarms |= ZT_ALARM_RED; - } else - wc->alarmcount++; - } else - wc->alarmcount = 0; - if (c & 0x4) - alarms |= ZT_ALARM_BLUE; - - if (((!wc->span.alarms) && alarms) || - (wc->span.alarms && (!alarms))) - wc->checktiming = 1; - - /* Keep track of recovering */ - if ((!alarms) && wc->span.alarms) - wc->alarmtimer = ZT_ALARMSETTLE_TIME; - if (wc->alarmtimer) - alarms |= ZT_ALARM_RECOVER; - - /* If receiving alarms, go into Yellow alarm state */ - if (alarms && !(wc->spanflags & FLAG_SENDINGYELLOW)) { - unsigned char fmr4; -#if 1 - printk("wcte1xxp: Setting yellow alarm\n"); -#endif - /* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */ - fmr4 = __t1_framer_in(wc, 0x20); - __t1_framer_out(wc, 0x20, fmr4 | 0x20); - wc->spanflags |= FLAG_SENDINGYELLOW; - } else if ((!alarms) && (wc->spanflags & FLAG_SENDINGYELLOW)) { - unsigned char fmr4; -#if 1 - printk("wcte1xxp: Clearing yellow alarm\n"); -#endif - /* We manually do yellow alarm to handle RECOVER */ - fmr4 = __t1_framer_in(wc, 0x20); - __t1_framer_out(wc, 0x20, fmr4 & ~0x20); - wc->spanflags &= ~FLAG_SENDINGYELLOW; - } - - /* Re-check the timing source when we enter/leave alarm, not withstanding - yellow alarm */ - if ((c & 0x10) && !unchannelized) - alarms |= ZT_ALARM_YELLOW; - if (wc->span.mainttimer || wc->span.maintstat) - alarms |= ZT_ALARM_LOOPBACK; - wc->span.alarms = alarms; - spin_unlock_irqrestore(&wc->lock, flags); - zt_alarm_notify(&wc->span); -} - - -static void t1_do_counters(struct t1 *wc) -{ - unsigned long flags; - - spin_lock_irqsave(&wc->lock, flags); - if (wc->alarmtimer) { - if (!--wc->alarmtimer) { - wc->span.alarms &= ~(ZT_ALARM_RECOVER); - spin_unlock_irqrestore(&wc->lock, flags); - zt_alarm_notify(&wc->span); - spin_lock_irqsave(&wc->lock, flags); - } - } - spin_unlock_irqrestore(&wc->lock, flags); -} - -ZAP_IRQ_HANDLER(t1xxp_interrupt) -{ - struct t1 *wc = dev_id; - unsigned char ints; - unsigned long flags; - int x; - - ints = inb(wc->ioaddr + WC_INTSTAT); - if (!ints) -#ifdef LINUX26 - return IRQ_NONE; -#else - return; -#endif - - outb(ints, wc->ioaddr + WC_INTSTAT); - - if (!wc->intcount) { - if (debug) printk("Got interrupt: 0x%04x\n", ints); - } - wc->intcount++; - - if (wc->clocktimeout && !--wc->clocktimeout) - control_set_reg(wc, WC_CLOCK, 0x04 | wc->sync | clockextra); - - if (ints & 0x0f) { - t1xxp_receiveprep(wc, ints); - t1xxp_transmitprep(wc, ints); - } - spin_lock_irqsave(&wc->lock, flags); - -#if 1 - __handle_leds(wc); -#endif - - spin_unlock_irqrestore(&wc->lock, flags); - - /* Count down timers */ - t1_do_counters(wc); - - /* Do some things that we don't have to do very often */ - x = wc->intcount & 15 /* 63 */; - switch(x) { - case 0: - case 1: - break; - case 2: - t1_check_sigbits(wc); - break; - case 4: - /* Check alarms 1/4 as frequently */ - if (!(wc->intcount & 0x30)) - t1_check_alarms(wc); - break; - } - - if (ints & 0x10) - printk("PCI Master abort\n"); - - if (ints & 0x20) - printk("PCI Target abort\n"); - -#ifdef LINUX26 - return IRQ_RETVAL(1); -#endif -} - -static int t1xxp_hardware_init(struct t1 *wc) -{ - unsigned int falcver; - unsigned int x; - /* Hardware PCI stuff */ - /* Reset chip and registers */ - outb(DELAY | 0x0e, wc->ioaddr + WC_CNTL); - /* Set all outputs to 0 */ - outb(0x00, wc->ioaddr + WC_AUXD); - /* Set all to outputs except AUX1 (TDO). */ - outb(0xfd, wc->ioaddr + WC_AUXC); - /* Configure the serial port: double clock, 20ns width, no inversion, - MSB first */ - outb(0xc8, wc->ioaddr + WC_SERC); - - /* Internally delay FSC by one */ - outb(0x01, wc->ioaddr + WC_FSCDELAY); - - /* Back to normal, with automatic DMA wrap around */ - outb(DELAY | 0x01, wc->ioaddr + WC_CNTL); - - /* Make sure serial port and DMA are out of reset */ - outb(inb(wc->ioaddr + WC_CNTL) & 0xf9, WC_CNTL); - - /* Setup DMA Addresses */ - /* Start at writedma */ - outl(wc->writedma, wc->ioaddr + WC_DMAWS); /* Write start */ - /* First frame */ - outl(wc->writedma + ZT_CHUNKSIZE * 32 - 4, wc->ioaddr + WC_DMAWI); /* Middle (interrupt) */ - /* Second frame */ - outl(wc->writedma + ZT_CHUNKSIZE * 32 * 2 - 4, wc->ioaddr + WC_DMAWE); /* End */ - - outl(wc->readdma, wc->ioaddr + WC_DMARS); /* Read start */ - /* First frame */ - outl(wc->readdma + ZT_CHUNKSIZE * 32 - 4, wc->ioaddr + WC_DMARI); /* Middle (interrupt) */ - /* Second frame */ - outl(wc->readdma + ZT_CHUNKSIZE * 32 * 2 - 4, wc->ioaddr + WC_DMARE); /* End */ - - if (debug) printk("Setting up DMA (write/read = %08lx/%08lx)\n", (long)wc->writedma, (long)wc->readdma); - - if (t1e1override > -1) { - if (t1e1override) - wc->spantype = TYPE_E1; - else - wc->spantype = TYPE_T1; - } else { - if (control_get_reg(wc, WC_CLOCK) & 0x20) - wc->spantype = TYPE_T1; - else - wc->spantype = TYPE_E1; - } - - /* Check out the controller */ - if (debug) printk("Controller version: %02x\n", control_get_reg(wc, WC_VERSION)); - - - control_set_reg(wc, WC_LEDTEST, 0x00); - - if (wc->spantype == TYPE_E1) { - if (unchannelized) - wc->chanmap = chanmap_e1uc; - else - wc->chanmap = chanmap_e1; - } else - wc->chanmap = chanmap_t1; - /* Setup clock appropriately */ - control_set_reg(wc, WC_CLOCK, 0x06 | wc->sync | clockextra); - wc->clocktimeout = 100; - - /* Perform register test on FALC */ - for (x=0;x<256;x++) { - t1_framer_out(wc, 0x14, x); - if ((falcver = t1_framer_in(wc, 0x14)) != x) - printk("Wrote '%x' but read '%x'\n", x, falcver); - } - - t1_framer_out(wc, 0x4a, 0xaa); - falcver = t1_framer_in(wc ,0x4a); - printk("FALC version: %08x\n", falcver); - if (!falcver) - wc->spanflags |= FLAG_FALC12; - - - start_alarm(wc); - return 0; - -} - -static int __devinit t1xxp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) -{ - int res; - struct t1 *wc; - unsigned int *canary; - - if (pci_enable_device(pdev)) { - res = -EIO; - } else { - wc = kmalloc(sizeof(struct t1), GFP_KERNEL); - if (wc) { - memset(wc, 0x0, sizeof(struct t1)); - spin_lock_init(&wc->lock); - wc->ioaddr = pci_resource_start(pdev, 0); - wc->dev = pdev; - wc->offset = 28; /* And you thought 42 was the answer */ - - wc->writechunk = - /* 32 channels, Double-buffer, Read/Write */ - (unsigned char *)pci_alloc_consistent(pdev, ZT_MAX_CHUNKSIZE * 32 * 2 * 2, &wc->writedma); - if (!wc->writechunk) { - printk("wcte11xp: Unable to allocate DMA-able memory\n"); - return -ENOMEM; - } - - /* Read is after the whole write piece (in bytes) */ - wc->readchunk = wc->writechunk + ZT_CHUNKSIZE * 32 * 2; - - /* Same thing... */ - wc->readdma = wc->writedma + ZT_CHUNKSIZE * 32 * 2; - - /* Initialize Write/Buffers to all blank data */ - memset((void *)wc->writechunk,0x00,ZT_MAX_CHUNKSIZE * 2 * 2 * 32); - /* Initialize canary */ - canary = (unsigned int *)(wc->readchunk + ZT_CHUNKSIZE * 64 - 4); - *canary = (CANARY << 16) | (0xffff); - - /* Enable bus mastering */ - pci_set_master(pdev); - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - - if (request_irq(pdev->irq, t1xxp_interrupt, ZAP_IRQ_SHARED_DISABLED, "wcte11xp", wc)) { - printk("wcte11xp: Unable to request IRQ %d\n", pdev->irq); - kfree(wc); - return -EIO; - } - /* Initialize hardware */ - t1xxp_hardware_init(wc); - - /* We now know which version of card we have */ - wc->variety = "Digium Wildcard TE110P T1/E1"; - - /* Misc. software stuff */ - t1xxp_software_init(wc); - - printk("Found a Wildcard: %s\n", wc->variety); - res = 0; - } else - res = -ENOMEM; - } - return res; -} - -static void t1xxp_stop_stuff(struct t1 *wc) -{ - /* Kill clock */ - control_set_reg(wc, WC_CLOCK, 0); - - /* Turn off LED's */ - control_set_reg(wc, WC_LEDTEST, 0); - -} - -static void __devexit t1xxp_remove_one(struct pci_dev *pdev) -{ - struct t1 *wc = pci_get_drvdata(pdev); - if (wc) { - - /* Stop any DMA */ - __t1xxp_stop_dma(wc); - - /* In case hardware is still there */ - __t1xxp_disable_interrupts(wc); - - t1xxp_stop_stuff(wc); - - /* Immediately free resources */ - pci_free_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 32 * 4, (void *)wc->writechunk, wc->writedma); - free_irq(pdev->irq, wc); - - /* Reset PCI chip and registers */ - outb(DELAY | 0x0e, wc->ioaddr + WC_CNTL); - - /* Release span, possibly delayed */ - if (!wc->usecount) - t1xxp_release(wc); - else - wc->dead = 1; - } -} - -static struct pci_device_id t1xxp_pci_tbl[] = { - { 0xe159, 0x0001, 0x71fe, PCI_ANY_ID, 0, 0, (unsigned long) "Digium Wildcard TE110P T1/E1 Board" }, - { 0xe159, 0x0001, 0x79fe, PCI_ANY_ID, 0, 0, (unsigned long) "Digium Wildcard TE110P T1/E1 Board" }, - { 0xe159, 0x0001, 0x795e, PCI_ANY_ID, 0, 0, (unsigned long) "Digium Wildcard TE110P T1/E1 Board" }, - { 0xe159, 0x0001, 0x79de, PCI_ANY_ID, 0, 0, (unsigned long) "Digium Wildcard TE110P T1/E1 Board" }, - { 0xe159, 0x0001, 0x797e, PCI_ANY_ID, 0, 0, (unsigned long) "Digium Wildcard TE110P T1/E1 Board" }, - { 0 } -}; - -MODULE_DEVICE_TABLE(pci,t1xxp_pci_tbl); - -static struct pci_driver t1xxp_driver = { - name: "wcte11xp", - probe: t1xxp_init_one, -#ifdef LINUX26 - remove: __devexit_p(t1xxp_remove_one), -#else - remove: t1xxp_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: t1xxp_pci_tbl, -}; - -static int __init t1xxp_init(void) -{ - int res; - res = zap_pci_module(&t1xxp_driver); - if (res) - return -ENODEV; - return 0; -} - -static void __exit t1xxp_cleanup(void) -{ - pci_unregister_driver(&t1xxp_driver); -} - -#ifdef LINUX26 -module_param(alarmdebounce, int, 0600); -module_param(loopback, int, 0600); -module_param(t1e1override, int, 0600); -module_param(unchannelized, int, 0600); -module_param(clockextra, int, 0600); -module_param(debug, int, 0600); -module_param(j1mode, int, 0600); -#else -MODULE_PARM(alarmdebounce, "i"); -MODULE_PARM(loopback, "i"); -MODULE_PARM(t1e1override, "i"); -MODULE_PARM(unchannelized, "i"); -MODULE_PARM(clockextra, "i"); -MODULE_PARM(debug, "i"); -MODULE_PARM(j1mode, "i"); -#endif -MODULE_DESCRIPTION("Wildcard TE110P Zaptel Driver"); -MODULE_AUTHOR("Mark Spencer "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(t1xxp_init); -module_exit(t1xxp_cleanup); diff --git a/zaptel/kernel/wcte12xp/GpakApi.c b/zaptel/kernel/wcte12xp/GpakApi.c deleted file mode 100644 index 78c4687f..00000000 --- a/zaptel/kernel/wcte12xp/GpakApi.c +++ /dev/null @@ -1,1616 +0,0 @@ -/* - * Copyright (c) 2005, Adaptive Digital Technologies, Inc. - * - * File Name: GpakApi.c - * - * Description: - * This file contains user API functions to communicate with DSPs executing - * G.PAK software. The file is integrated into the host processor connected - * to C55X G.PAK DSPs via a Host Port Interface. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * 11/15/2006 - 24 TDM-TDM Channels EC release - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include "zaptel.h" - -#include "GpakHpi.h" -#include "vpmadt032.h" -#include "GpakApi.h" -#include "gpakenum.h" - -#ifdef VPM_SUPPORT - -/* DSP to Host interface block offsets. */ -#define REPLY_MSG_PNTR_OFFSET 0 /* I/F blk offset to Reply Msg Pointer */ -#define CMD_MSG_PNTR_OFFSET 2 /* I/F blk offset to Command Msg Pointer */ -#define EVENT_MSG_PNTR_OFFSET 4 /* I/F blk offset to Event Msg Pointer */ -#define PKT_BUFR_MEM_OFFSET 6 /* I/F blk offset to Packet Buffer memory */ -#define DSP_STATUS_OFFSET 8 /* I/F blk offset to DSP Status */ -#define VERSION_ID_OFFSET 9 /* I/F blk offset to G.PAK Version Id */ -#define MAX_CMD_MSG_LEN_OFFSET 10 /* I/F blk offset to Max Cmd Msg Length */ -#define CMD_MSG_LEN_OFFSET 11 /* I/F blk offset to Command Msg Length */ -#define REPLY_MSG_LEN_OFFSET 12 /* I/F blk offset to Reply Msg Length */ -#define NUM_CHANNELS_OFFSET 13 /* I/F blk offset to Num Built Channels */ -#define NUM_PKT_CHANNELS_OFFSET 14 /* I/F blk offset to Num Pkt Channels */ -#define NUM_CONFERENCES_OFFSET 15 /* I/F blk offset to Num Conferences */ -//#define CPU_USAGE_OFFSET_1MS 16 /* I/F blk offset to CPU Usage statistics */ -#define CPU_USAGE_OFFSET 18 /* I/F blk offset to CPU Usage statistics */ -//#define CPU_USAGE_OFFSET_10MS 20 /* I/F blk offset to CPU Usage statistics */ -#define FRAMING_STATS_OFFSET 22 /* I/F blk offset to Framing statistics */ - -//#define GPAK_RELEASE_Rate rate10ms -// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -// Macro to reconstruct a 32-bit value from two 16-bit values. -// Parameter p32: 32-bit-wide destination -// Parameter p16: 16-bit-wide source array of length 2 words -#define RECONSTRUCT_LONGWORD(p32, p16) p32 = (DSP_ADDRESS)p16[0]<<16; \ - p32 |= (unsigned long)p16[1] -// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - -/* DSP Status value definitions. */ -#define DSP_INIT_STATUS 0x5555 /* DSP Initialized status value */ -#define HOST_INIT_STATUS 0xAAAA /* Host Initialized status value */ - -/* Circular packet buffer information structure offsets. */ -#define CB_BUFR_BASE 0 /* pointer to base of circular buffer */ -#define CB_BUFR_SIZE 2 /* size of buffer (words) */ -#define CB_BUFR_PUT_INDEX 3 /* offset in buffer for next write */ -#define CB_BUFR_TAKE_INDEX 4 /* offset in buffer for next read */ -#define CIRC_BUFFER_INFO_STRUCT_SIZE 6 - -/* Miscellaneous definitions. */ -#define MSG_BUFFER_SIZE 100 /* size (words) of Host msg buffer */ -#define WORD_BUFFER_SIZE 84 /* size of DSP Word buffer (words) */ - -#ifdef __TMS320C55XX__ // debug sections if not on host -#pragma DATA_SECTION(pDspIfBlk,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(MaxCmdMsgLen,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(MaxChannels,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(DlByteBufr,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(DlWordBufr,"GPAKAPIDEBUG_SECT") -#pragma DATA_SECTION(pEventFifoAddress,"GPAKAPIDEBUG_SECT") -#endif - -/* Host variables related to Host to DSP interface. */ -static DSP_ADDRESS pDspIfBlk[MAX_DSP_CORES]; /* DSP address of I/F block */ -static DSP_WORD MaxCmdMsgLen[MAX_DSP_CORES]; /* max Cmd msg length (octets) */ -static unsigned short int MaxChannels[MAX_DSP_CORES]; /* max num channels */ - -//static unsigned short int MaxPktChannels[MAX_DSP_CORES]; /* max num pkt channels */ -//static unsigned short int MaxConfs[MAX_DSP_CORES]; /* max num conferences */ -//static DSP_ADDRESS pPktInBufr[MAX_DSP_CORES][MAX_PKT_CHANNELS]; /* Pkt In buffer */ -//static DSP_ADDRESS pPktOutBufr[MAX_DSP_CORES][MAX_PKT_CHANNELS]; /* Pkt Out buffer */ -static DSP_ADDRESS pEventFifoAddress[MAX_DSP_CORES]; /* event fifo */ - -static unsigned char DlByteBufr[DOWNLOAD_BLOCK_SIZE * 2]; /* Dowload byte buf */ -static DSP_WORD DlWordBufr[DOWNLOAD_BLOCK_SIZE]; /* Dowload word buffer */ - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * CheckDspReset - Check if the DSP was reset. - * - * FUNCTION - * This function determines if the DSP was reset and is ready. If reset - * occurred, it reads interface parameters and calculates DSP addresses. - * - * RETURNS - * -1 = DSP is not ready. - * 0 = Reset did not occur. - * 1 = Reset occurred. - * - */ -static int CheckDspReset( - int DspId /* DSP Identifier (0 to MaxDSPCores-1) */ - ) -{ - DSP_ADDRESS IfBlockPntr; /* Interface Block pointer */ - DSP_WORD DspStatus; /* DSP Status */ - DSP_WORD DspChannels; /* number of DSP channels */ - DSP_WORD Temp[2]; -#if 0 - DSP_WORD DspConfs; /* number of DSP conferences */ - DSP_ADDRESS PktBufrMem; /* address of Packet Buffer */ - unsigned short int i; /* loop index / counter */ -#endif - - /* Read the pointer to the Interface Block. */ - gpakReadDspMemory(DspId, DSP_IFBLK_ADDRESS, 2, Temp); - RECONSTRUCT_LONGWORD(IfBlockPntr, Temp); - - /* If the pointer is zero, return with an indication the DSP is not - ready. */ - if (IfBlockPntr == 0) - return (-1); - - /* Read the DSP's Status. */ - gpakReadDspMemory(DspId, IfBlockPntr + DSP_STATUS_OFFSET, 1, &DspStatus); - - /* If status indicates the DSP was reset, read the DSP's interface - parameters and calculate DSP addresses. */ - if (DspStatus == DSP_INIT_STATUS || - ((DspStatus == HOST_INIT_STATUS) && (pDspIfBlk[DspId] == 0))) - { - /* Save the address of the DSP's Interface Block. */ - pDspIfBlk[DspId] = IfBlockPntr; - - /* Read the DSP's interface parameters. */ - gpakReadDspMemory(DspId, IfBlockPntr + MAX_CMD_MSG_LEN_OFFSET, 1, - &(MaxCmdMsgLen[DspId])); - - /* read the number of configured DSP channels */ - gpakReadDspMemory(DspId, IfBlockPntr + NUM_CHANNELS_OFFSET, 1, - &DspChannels); - if (DspChannels > MAX_CHANNELS) - MaxChannels[DspId] = MAX_CHANNELS; - else - MaxChannels[DspId] = (unsigned short int) DspChannels; -#if 0 - /* read the number of configured DSP conferences */ - gpakReadDspMemory(DspId, IfBlockPntr + NUM_CONFERENCES_OFFSET, 1, - &DspConfs); - if (DspConfs > MAX_CONFS) - MaxConfs[DspId] = MAX_CONFS; - else - MaxConfs[DspId] = (unsigned short int) DspConfs; - - - /* read the number of configured DSP packet channels */ - gpakReadDspMemory(DspId, IfBlockPntr + NUM_PKT_CHANNELS_OFFSET, 1, - &DspChannels); - if (DspChannels > MAX_PKT_CHANNELS) - MaxPktChannels[DspId] = MAX_PKT_CHANNELS; - else - MaxPktChannels[DspId] = (unsigned short int) DspChannels; - - - /* read the pointer to the circular buffer infor struct table */ - gpakReadDspMemory(DspId, IfBlockPntr + PKT_BUFR_MEM_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(PktBufrMem, Temp); - - - /* Determine the addresses of each channel's Packet buffers. */ - for (i = 0; i < MaxPktChannels[DspId]; i++) - { - pPktInBufr[DspId][i] = PktBufrMem; - pPktOutBufr[DspId][i] = PktBufrMem + CIRC_BUFFER_INFO_STRUCT_SIZE; - PktBufrMem += (CIRC_BUFFER_INFO_STRUCT_SIZE*2); - } -#endif - - /* read the pointer to the event fifo info struct */ - gpakReadDspMemory(DspId, IfBlockPntr + EVENT_MSG_PNTR_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(pEventFifoAddress[DspId], Temp); - - /* Set the DSP Status to indicate the host recognized the reset. */ - DspStatus = HOST_INIT_STATUS; - gpakWriteDspMemory(DspId, IfBlockPntr + DSP_STATUS_OFFSET, 1, - &DspStatus); - - /* Return with an indication that a reset occurred. */ - return (1); - } - - /* If status doesn't indicate the host recognized a reset, return with an - indication the DSP is not ready. */ - if ((DspStatus != HOST_INIT_STATUS) || (pDspIfBlk[DspId] == 0)) - return (-1); - - /* Return with an indication that a reset did not occur. */ - return (0); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * WriteDspCmdMessage - Write a Host Command/Request message to DSP. - * - * FUNCTION - * This function writes a Host Command/Request message into DSP memory and - * informs the DSP of the presence of the message. - * - * RETURNS - * -1 = Unable to write message (msg len or DSP Id invalid or DSP not ready) - * 0 = Temporarily unable to write message (previous Cmd Msg busy) - * 1 = Message written successfully - * - */ -static int WriteDspCmdMessage( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_WORD *pMessage, /* pointer to Command message */ - DSP_WORD MsgLength /* length of message (octets) */ - ) -{ - DSP_WORD CmdMsgLength; /* current Cmd message length */ - DSP_WORD Temp[2]; - DSP_ADDRESS BufferPointer; /* message buffer pointer */ - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (-1); - - /* Make sure the message length is valid. */ - if ((MsgLength < 1) || (MsgLength > MaxCmdMsgLen[DspId])) - return (-1); - - /* Make sure a previous Command message is not in use by the DSP. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_LEN_OFFSET, 1, - &CmdMsgLength); - if (CmdMsgLength != 0) - return (0); - - /* Purge any previous Reply message that wasn't read. */ - gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1, - &CmdMsgLength); - - /* Copy the Command message into DSP memory. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_PNTR_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(BufferPointer, Temp); - gpakWriteDspMemory(DspId, BufferPointer, (MsgLength + 1) / 2, pMessage); - - /* Store the message length in DSP's Command message length (flags DSP that - a Command message is ready). */ - CmdMsgLength = MsgLength; - gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + CMD_MSG_LEN_OFFSET, 1, - &CmdMsgLength); - - /* Return with an indication the message was written. */ - return (1); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ReadDspReplyMessage - Read a DSP Reply message from DSP. - * - * FUNCTION - * This function reads a DSP Reply message from DSP memory. - * - * RETURNS - * -1 = Unable to write message (msg len or DSP Id invalid or DSP not ready) - * 0 = No message available (DSP Reply message empty) - * 1 = Message read successfully (message and length stored in variables) - * - */ -static int ReadDspReplyMessage( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_WORD *pMessage, /* pointer to Reply message buffer */ - DSP_WORD *pMsgLength /* pointer to msg length var (octets) */ - ) -{ - DSP_WORD MsgLength; /* message length */ - DSP_ADDRESS BufferPointer; /* message buffer pointer */ - DSP_WORD Temp[2]; - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (-1); - - /* Check if a Reply message is ready. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1, - &MsgLength); - if (MsgLength == 0) - return (0); - - /* Make sure the message length is valid. */ - if (MsgLength > *pMsgLength) - return (-1); - - /* Copy the Reply message from DSP memory. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_PNTR_OFFSET, 2, Temp); - RECONSTRUCT_LONGWORD(BufferPointer, Temp); - gpakReadDspMemory(DspId, BufferPointer, (MsgLength + 1) / 2, pMessage); - - /* Store the message length in the message length variable. */ - *pMsgLength = MsgLength; - - /* Indicate a Reply message is not ready. */ - MsgLength = 0; - gpakWriteDspMemory(DspId, pDspIfBlk[DspId] + REPLY_MSG_LEN_OFFSET, 1, - &MsgLength); - - /* Return with an indication the message was read. */ - return (1); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * ReadCircBuffer - Read from a DSP circular buffer. - * - * FUNCTION - * This function reads a block of words from a DSP circular buffer. The Take - * address is incremented by the number of words read adjusting for buffer - * wrap. - * - * RETURNS - * nothing - * - */ -static void ReadCircBuffer( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_ADDRESS BufrBaseAddress, /* address of base of circular buffer */ - DSP_ADDRESS BufrLastAddress, /* address of last word in buffer */ - DSP_ADDRESS *TakeAddress, /* pointer to address in buffer for read */ - DSP_WORD *pWordBuffer, /* pointer to buffer for words read */ - DSP_WORD NumWords /* number of words to read */ - ) -{ - DSP_WORD WordsTillEnd; /* number of words until end of buffer */ - - /* Determine the number of words from the start address until the end of the - buffer. */ - WordsTillEnd = BufrLastAddress - *TakeAddress + 1; - - /* If a buffer wrap will occur, read the first part at the end of the - buffer followed by the second part at the beginning of the buffer. */ - if (NumWords > WordsTillEnd) - { - gpakReadDspMemory(DspId, *TakeAddress, WordsTillEnd, pWordBuffer); - gpakReadDspMemory(DspId, BufrBaseAddress, NumWords - WordsTillEnd, - &(pWordBuffer[WordsTillEnd])); - *TakeAddress = BufrBaseAddress + NumWords - WordsTillEnd; - } - - /* If a buffer wrap will not occur, read all words starting at the current - take address in the buffer. */ - else - { - gpakReadDspMemory(DspId, *TakeAddress, NumWords, pWordBuffer); - if (NumWords == WordsTillEnd) - *TakeAddress = BufrBaseAddress; - else - *TakeAddress = *TakeAddress + NumWords; - } - return; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * VerifyReply - Verify the reply message is correct for the command sent. - * - * FUNCTION - * This function verifies correct reply message content for the command that - * was just sent. - * - * RETURNS - * 0 = Incorrect - * 1 = Correct - * - */ -static int VerifyReply( - DSP_WORD *pMsgBufr, /* pointer to Reply message buffer */ - int CheckType, /* reply check type */ - DSP_WORD CheckValue /* reply check value */ - ) -{ - - /* Verify Channel or Conference Id. */ - if (CheckType == 1) - { - if (((pMsgBufr[1] >> 8) & 0xFF) != CheckValue) - return (0); - } - - /* Verify Test Mode Id. */ - else if (CheckType == 2) - { - if (pMsgBufr[1] != CheckValue) - return (0); - } - - /* Return with an indication of correct reply. */ - return (1); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * TransactCmd - Send a command to the DSP and receive it's reply. - * - * FUNCTION - * This function sends the specified command to the DSP and receives the DSP's - * reply. - * - * RETURNS - * Length of reply message (0 = Failure) - * - */ -static unsigned int TransactCmd( - int DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - DSP_WORD *pMsgBufr, /* pointer to Cmd/Reply message buffer */ - DSP_WORD CmdLength, /* length of command message (octets) */ - DSP_WORD ReplyType, /* required type of reply message */ - DSP_WORD ReplyLength, /* required length of reply message (octets) */ - int ReplyCheckType, /* reply check type */ - DSP_WORD ReplyCheckValue /* reply check value */ - ) -{ - int FuncStatus; /* function status */ - int LoopCount; /* wait loop counter */ - DSP_WORD RcvReplyLength; /* received Reply message length */ - DSP_WORD RcvReplyType; /* received Reply message type code */ - DSP_WORD RetValue; /* return value */ - - /* Default the return value to indicate a failure. */ - RetValue = 0; - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Attempt to write the command message to the DSP. */ - LoopCount = 0; - while ((FuncStatus = WriteDspCmdMessage(DspId, pMsgBufr, CmdLength)) != 1) - { - if (FuncStatus == -1) - break; - if (++LoopCount > MAX_WAIT_LOOPS) - break; - gpakHostDelay(); - } - - /* Attempt to read the reply message from the DSP if the command message was - sent successfully. */ - if (FuncStatus == 1) - { - for (LoopCount = 0; LoopCount < MAX_WAIT_LOOPS; LoopCount++) - { - RcvReplyLength = MSG_BUFFER_SIZE * 2; - FuncStatus = ReadDspReplyMessage(DspId, pMsgBufr, &RcvReplyLength); - if (FuncStatus == 1) - { - RcvReplyType = (pMsgBufr[0] >> 8) & 0xFF; - if ((RcvReplyLength >= ReplyLength) && - (RcvReplyType == ReplyType) && - VerifyReply(pMsgBufr, ReplyCheckType, ReplyCheckValue)) - { - RetValue = RcvReplyLength; - break; - } - else if (RcvReplyType == MSG_NULL_REPLY) - break; - } - else if (FuncStatus == -1) - break; - gpakHostDelay(); - } - } - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Return the length of the reply message (0 = failure). */ - return (RetValue); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakConfigurePorts - Configure a DSP's serial ports. - * - * FUNCTION - * This function configures a DSP's serial ports. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakConfigPortStatus_t gpakConfigurePorts( - unsigned short int DspId, /* DSP Id (0 to MaxDSPCores-1) */ - GpakPortConfig_t *pPortConfig, /* pointer to Port Config info */ - GPAK_PortConfigStat_t *pStatus /* pointer to Port Config Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (CpsInvalidDsp); - - /* Build the Configure Serial Ports message. */ - MsgBuffer[0] = MSG_CONFIGURE_PORTS << 8; - MsgBuffer[1] = (DSP_WORD) - ((pPortConfig->SlotsSelect1 << 12) | - ((pPortConfig->FirstBlockNum1 << 8) & 0x0F00) | - ((pPortConfig->SecBlockNum1 << 4) & 0x00F0)); - MsgBuffer[2] = (DSP_WORD) pPortConfig->FirstSlotMask1; - MsgBuffer[3] = (DSP_WORD) pPortConfig->SecSlotMask1; - MsgBuffer[4] = (DSP_WORD) - ((pPortConfig->SlotsSelect2 << 12) | - ((pPortConfig->FirstBlockNum2 << 8) & 0x0F00) | - ((pPortConfig->SecBlockNum2 << 4) & 0x00F0)); - MsgBuffer[5] = (DSP_WORD) pPortConfig->FirstSlotMask2; - MsgBuffer[6] = (DSP_WORD) pPortConfig->SecSlotMask2; - MsgBuffer[7] = (DSP_WORD) - ((pPortConfig->SlotsSelect3 << 12) | - ((pPortConfig->FirstBlockNum3 << 8) & 0x0F00) | - ((pPortConfig->SecBlockNum3 << 4) & 0x00F0)); - MsgBuffer[8] = (DSP_WORD) pPortConfig->FirstSlotMask3; - MsgBuffer[9] = (DSP_WORD) pPortConfig->SecSlotMask3; - - MsgBuffer[10] = (DSP_WORD) - (((pPortConfig->DxDelay1 << 11) & 0x0800) | - ((pPortConfig->RxDataDelay1 << 9) & 0x0600) | - ((pPortConfig->TxDataDelay1 << 7) & 0x0180) | - ((pPortConfig->RxClockPolarity1 << 6) & 0x0040) | - ((pPortConfig->TxClockPolarity1 << 5) & 0x0020) | - ((pPortConfig->RxFrameSyncPolarity1 << 4) & 0x0010) | - ((pPortConfig->TxFrameSyncPolarity1 << 3) & 0x0008) | - ((pPortConfig->CompandingMode1 << 1) & 0x0006) | - (pPortConfig->SerialWordSize1 & 0x0001)); - - MsgBuffer[11] = (DSP_WORD) - (((pPortConfig->DxDelay2 << 11) & 0x0800) | - ((pPortConfig->RxDataDelay2 << 9) & 0x0600) | - ((pPortConfig->TxDataDelay2 << 7) & 0x0180) | - ((pPortConfig->RxClockPolarity2 << 6) & 0x0040) | - ((pPortConfig->TxClockPolarity2 << 5) & 0x0020) | - ((pPortConfig->RxFrameSyncPolarity2 << 4) & 0x0010) | - ((pPortConfig->TxFrameSyncPolarity2 << 3) & 0x0008) | - ((pPortConfig->CompandingMode2 << 1) & 0x0006) | - (pPortConfig->SerialWordSize1 & 0x0001)); - - MsgBuffer[12] = (DSP_WORD) - (((pPortConfig->DxDelay3 << 11) & 0x0800) | - ((pPortConfig->RxDataDelay3 << 9) & 0x0600) | - ((pPortConfig->TxDataDelay3 << 7) & 0x0180) | - ((pPortConfig->RxClockPolarity3 << 6) & 0x0040) | - ((pPortConfig->TxClockPolarity3 << 5) & 0x0020) | - ((pPortConfig->RxFrameSyncPolarity3 << 4) & 0x0010) | - ((pPortConfig->TxFrameSyncPolarity3 << 3) & 0x0008) | - ((pPortConfig->CompandingMode3 << 1) & 0x0006) | - (pPortConfig->SerialWordSize3 & 0x0001)); - - MsgBuffer[13] = (DSP_WORD) pPortConfig->ThirdSlotMask1; - MsgBuffer[14] = (DSP_WORD) pPortConfig->FouthSlotMask1; - MsgBuffer[15] = (DSP_WORD) pPortConfig->FifthSlotMask1; - MsgBuffer[16] = (DSP_WORD) pPortConfig->SixthSlotMask1; - MsgBuffer[17] = (DSP_WORD) pPortConfig->SevenSlotMask1; - MsgBuffer[18] = (DSP_WORD) pPortConfig->EightSlotMask1; - - MsgBuffer[19] = (DSP_WORD) pPortConfig->ThirdSlotMask2;; - MsgBuffer[20] = (DSP_WORD) pPortConfig->FouthSlotMask2; - MsgBuffer[21] = (DSP_WORD) pPortConfig->FifthSlotMask2;; - MsgBuffer[22] = (DSP_WORD) pPortConfig->SixthSlotMask2; - MsgBuffer[23] = (DSP_WORD) pPortConfig->SevenSlotMask2;; - MsgBuffer[24] = (DSP_WORD) pPortConfig->EightSlotMask2; - - MsgBuffer[25] = (DSP_WORD) pPortConfig->ThirdSlotMask3;; - MsgBuffer[26] = (DSP_WORD) pPortConfig->FouthSlotMask3; - MsgBuffer[27] = (DSP_WORD) pPortConfig->FifthSlotMask3;; - MsgBuffer[28] = (DSP_WORD) pPortConfig->SixthSlotMask3; - MsgBuffer[29] = (DSP_WORD) pPortConfig->SevenSlotMask3;; - MsgBuffer[30] = (DSP_WORD) pPortConfig->EightSlotMask3; - - - /* Attempt to send the Configure Serial Ports message to the DSP and receive - it's reply. */ - if (!TransactCmd(DspId, MsgBuffer, 62, MSG_CONFIG_PORTS_REPLY, 4, 0, 0)) - return (CpsDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_PortConfigStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Pc_Success) - return (CpsSuccess); - else - return (CpsParmError); -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakConfigureChannel - Configure a DSP's Channel. - * - * FUNCTION - * This function configures a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakConfigChanStatus_t gpakConfigureChannel( - unsigned short int DspId, /* DSP Id (0 to MaxDSPCores-1) */ - unsigned short int ChannelId, /* Channel Id (0 to MaxChannels-1) */ - GpakChanType ChannelType, /* Channel Type */ - GpakChannelConfig_t *pChanConfig, /* pointer to Channel Config info */ - GPAK_ChannelConfigStat_t *pStatus /* pointer to Channel Config Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD MsgLength; /* message length */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (CcsInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (CcsInvalidChannel); - - /* Build the Configure Channel message based on the Channel Type. */ - switch (ChannelType) - { - - /* PCM to Packet channel type. */ - case tdmToTdm: - - MsgBuffer[2] = (DSP_WORD) - ((pChanConfig->PcmInPortA << 8) | - (pChanConfig->PcmInSlotA & 0xFF)); - MsgBuffer[3] = (DSP_WORD) - ((pChanConfig->PcmOutPortA << 8) | - (pChanConfig->PcmOutSlotA & 0xFF)); - - MsgBuffer[4] = (DSP_WORD) - ((pChanConfig->PcmInPortB << 8) | - (pChanConfig->PcmInSlotB & 0xFF)); - MsgBuffer[5] = (DSP_WORD) - ((pChanConfig->PcmOutPortB << 8) | - (pChanConfig->PcmOutSlotB & 0xFF)); - - MsgBuffer[6] = (DSP_WORD) - ( - ((pChanConfig->FaxCngDetB <<11) & 0x0800) | - ((pChanConfig->FaxCngDetA <<10) & 0x0400) | - ((pChanConfig->MuteToneB << 9) & 0x0200) | - ((pChanConfig->MuteToneA << 8) & 0x0100) | - ((pChanConfig->FrameRate << 6) & 0x00C0) | - ((pChanConfig->ToneTypesB << 5) & 0x0020) | - ((pChanConfig->ToneTypesA << 4) & 0x0010) | - ((pChanConfig->SoftwareCompand & 3) << 2) | - (pChanConfig->EcanEnableB << 1) | - (pChanConfig->EcanEnableA & 1) - ); - - MsgBuffer[7] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanTapLength; - MsgBuffer[8] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpType; - MsgBuffer[9] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanAdaptEnable; - MsgBuffer[10] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanG165DetEnable; - MsgBuffer[11] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanDblTalkThresh; - MsgBuffer[12] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpThreshold; - MsgBuffer[13] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpConv; - MsgBuffer[14] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpUnConv; - MsgBuffer[15] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNlpMaxSuppress; - - MsgBuffer[16] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanCngThreshold; - MsgBuffer[17] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanAdaptLimit; - MsgBuffer[18] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanCrossCorrLimit; - MsgBuffer[19] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanNumFirSegments; - MsgBuffer[20] = (DSP_WORD) - pChanConfig->EcanParametersA.EcanFirSegmentLen; - - MsgBuffer[21] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanTapLength; - MsgBuffer[22] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpType; - MsgBuffer[23] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanAdaptEnable; - MsgBuffer[24] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanG165DetEnable; - MsgBuffer[25] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanDblTalkThresh; - MsgBuffer[26] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpThreshold; - MsgBuffer[27] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpConv; - MsgBuffer[28] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpUnConv; - MsgBuffer[29] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNlpMaxSuppress; - MsgBuffer[30] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanCngThreshold; - MsgBuffer[31] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanAdaptLimit; - MsgBuffer[32] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanCrossCorrLimit; - MsgBuffer[33] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanNumFirSegments; - MsgBuffer[34] = (DSP_WORD) - pChanConfig->EcanParametersB.EcanFirSegmentLen; - - MsgLength = 70; // byte number == 35*2 - break; - - - /* Unknown (invalid) channel type. */ - default: - *pStatus = Cc_InvalidChannelType; - return (CcsParmError); - } - - MsgBuffer[0] = MSG_CONFIGURE_CHANNEL << 8; - MsgBuffer[1] = (DSP_WORD) ((ChannelId << 8) | (ChannelType & 0xFF)); - - /* Attempt to send the Configure Channel message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, MsgLength, MSG_CONFIG_CHAN_REPLY, 4, 1, - (DSP_WORD) ChannelId)) - return (CcsDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_ChannelConfigStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Cc_Success) - return (CcsSuccess); - else - return (CcsParmError); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakTearDownChannel - Tear Down a DSP's Channel. - * - * FUNCTION - * This function tears down a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakTearDownStatus_t gpakTearDownChannel( - unsigned short int DspId, /* DSP Id (0 to MaxDSPCores-1) */ - unsigned short int ChannelId, /* Channel Id (0 to MaxChannels-1) */ - GPAK_TearDownChanStat_t *pStatus /* pointer to Tear Down Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (TdsInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (TdsInvalidChannel); - - /* Build the Tear Down Channel message. */ - MsgBuffer[0] = MSG_TEAR_DOWN_CHANNEL << 8; - MsgBuffer[1] = (DSP_WORD) (ChannelId << 8); - - /* Attempt to send the Tear Down Channel message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 3, MSG_TEAR_DOWN_REPLY, 4, 1, - (DSP_WORD) ChannelId)) - return (TdsDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_TearDownChanStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Td_Success) - return (TdsSuccess); - else - return (TdsError); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakAlgControl - Control an Algorithm. - * - * FUNCTION - * This function controls an Algorithm - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakAlgControlStat_t gpakAlgControl( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakAlgCtrl_t ControlCode, // algorithm control code - GPAK_AlgControlStat_t *pStatus // pointer to return status - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (AcInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (AcInvalidChannel); - - MsgBuffer[0] = MSG_ALG_CONTROL << 8; - MsgBuffer[1] = (DSP_WORD) ((ChannelId << 8) | (ControlCode & 0xFF)); - - /* Attempt to send the Tear Down Channel message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 4, MSG_ALG_CONTROL_REPLY, 4, 1, - (DSP_WORD) ChannelId)) - return (AcDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_AlgControlStat_t) (MsgBuffer[1] & 0xFF); - if (*pStatus == Ac_Success) - return (AcSuccess); - else - return (AcParmError); - -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadEventFIFOMessage - read from the event fifo - * - * FUNCTION - * This function reads a single event from the event fifo if one is available - * - * RETURNS - * Status code indicating success or a specific error. - * - * Notes: This function should be called in a loop until the return status - * indicates that the fifo is empty. - * - * If the event code equals "EventLoopbackTeardownComplete", then the - * contents of *pChannelId hold the coderBlockId that was assigned to - * the loopback coder that was torn down. - */ -gpakReadEventFIFOMessageStat_t gpakReadEventFIFOMessage( - unsigned short int DspId, // DSP identifier - unsigned short int *pChannelId, // pointer to channel identifier - GpakAsyncEventCode_t *pEventCode, // pointer to Event Code - GpakAsyncEventData_t *pEventData // pointer to Event Data Struct - ) -{ - DSP_WORD WordBuffer[WORD_BUFFER_SIZE]; /* DSP words buffer */ - GpakAsyncEventCode_t EventCode; /* DSP's event code */ - DSP_WORD EventDataLength; /* Length of event to read */ - DSP_WORD ChannelId; /* DSP's channel Id */ - DSP_ADDRESS EventInfoAddress; /* address of EventFIFO info structure */ - DSP_ADDRESS BufrBaseAddress; /* base address of EventFIFO buffer */ - DSP_ADDRESS BufrLastAddress; /* last address of EventFIFO buffer */ - DSP_ADDRESS TakeAddress; /* current take address in fifo buffer */ - DSP_WORD BufrSize; /* size (in words) of event FIFO buffer */ - DSP_WORD PutIndex; /* event fifo put index */ - DSP_WORD TakeIndex; /* event fifo take index */ - DSP_WORD WordsReady; /* number words ready for read out of event fifo */ - DSP_WORD EventError; /* flag indicating error with event fifo msg */ -#if 0 - DSP_WORD *pDebugData; /* debug data buffer pointer in event data struct */ -#endif - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RefInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - { - gpakUnlockAccess(DspId); - return (RefDspCommFailure); - } - - /* Check if an event message is ready in the DSP. */ - EventInfoAddress = pEventFifoAddress[DspId]; - gpakReadDspMemory(DspId, EventInfoAddress, CIRC_BUFFER_INFO_STRUCT_SIZE, - WordBuffer); - RECONSTRUCT_LONGWORD(BufrBaseAddress, ((DSP_WORD *)&WordBuffer[CB_BUFR_BASE])); - BufrSize = WordBuffer[CB_BUFR_SIZE]; - PutIndex = WordBuffer[CB_BUFR_PUT_INDEX]; - TakeIndex = WordBuffer[CB_BUFR_TAKE_INDEX]; - if (PutIndex >= TakeIndex) - WordsReady = PutIndex - TakeIndex; - else - WordsReady = PutIndex + BufrSize - TakeIndex; - - if (WordsReady < 2) - { - gpakUnlockAccess(DspId); - return (RefNoEventAvail); - } - - /* Read the event header from the DSP's Event FIFO. */ - TakeAddress = BufrBaseAddress + TakeIndex; - BufrLastAddress = BufrBaseAddress + BufrSize - 1; - ReadCircBuffer(DspId, BufrBaseAddress, BufrLastAddress, &TakeAddress, - WordBuffer, 2); - TakeIndex += 2; - if (TakeIndex >= BufrSize) - TakeIndex -= BufrSize; - - ChannelId = (WordBuffer[0] >> 8) & 0xFF; - EventCode = (GpakAsyncEventCode_t)(WordBuffer[0] & 0xFF); - EventDataLength = WordBuffer[1]; - EventError = 0; - - switch (EventCode) - { - case EventToneDetect: - if (EventDataLength > WORD_BUFFER_SIZE) - { - gpakUnlockAccess(DspId); - return (RefInvalidEvent); - } - ReadCircBuffer(DspId, BufrBaseAddress, BufrLastAddress, &TakeAddress, - WordBuffer, EventDataLength); - pEventData->toneEvent.ToneCode = (GpakToneCodes_t) - (WordBuffer[0] & 0xFF); - pEventData->toneEvent.ToneDuration = WordBuffer[1]; - pEventData->toneEvent.Direction = WordBuffer[2]; - pEventData->toneEvent.DebugToneStatus = WordBuffer[3]; - TakeIndex += EventDataLength; - if (TakeIndex >= BufrSize) - TakeIndex -= BufrSize; - if (EventDataLength != 4) - EventError = 1; - break; - - default: - EventError = 1; - break; - }; - - /* Update the Take index in the DSP's Packet Out buffer information. */ - gpakWriteDspMemory(DspId, EventInfoAddress + CB_BUFR_TAKE_INDEX, 1, - &TakeIndex); - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - if (EventError) - return(RefInvalidEvent); - - *pChannelId = ChannelId; - *pEventCode = EventCode; - return(RefEventAvail); - -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakPingDsp - ping the DSP to see if it's alive - * - * FUNCTION - * This function checks if the DSP is still communicating with the host - * and returns the DSP SW version - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakPingDspStat_t gpakPingDsp( - unsigned short int DspId, // DSP identifier - unsigned short int *pDspSwVersion // DSP software version - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (PngInvalidDsp); - - /* send value of 1, DSP increments it */ - MsgBuffer[0] = (MSG_PING << 8); - - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 1, MSG_PING_REPLY, 6, 0, 0)) - return (PngDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - { - *pDspSwVersion = MsgBuffer[2]; - return (PngSuccess); - } - else - return (PngDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakSerialTxFixedValue - transmit a fixed value on a timeslot - * - * FUNCTION - * This function controls transmission of a fixed value out onto a serial - * port's timeslot. - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakSerialTxFixedValueStat_t gpakSerialTxFixedValue( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakSerialPort_t PcmOutPort, // PCM Output Serial Port Id - unsigned short int PcmOutSlot, // PCM Output Time Slot - unsigned short int Value, // 16-bit value - GpakActivation State // activation state - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (TfvInvalidDsp); - - /* Make sure the Channel Id is valid. */ - if (ChannelId >= MaxChannels[DspId]) - return (TfvInvalidChannel); - - - /* Build the message. */ - MsgBuffer[0] = MSG_SERIAL_TXVAL << 8; - MsgBuffer[1] = (DSP_WORD) ((ChannelId << 8) | (State & 0xFF)); - MsgBuffer[2] = (DSP_WORD) ((PcmOutPort << 8) | (PcmOutSlot & 0xFF)); - MsgBuffer[3] = (DSP_WORD) Value; - - /* Attempt to send the message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 8, MSG_SERIAL_TXVAL_REPLY, 4, - 1, ChannelId)) - return (TfvDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (TfvSuccess); - else - return (TfvDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakControlTdmLoopBack - control a serial port's loopback state - * - * FUNCTION - * This function enables/disables the tdm input to output looback mode on a - * serial port - * - * RETURNS - * Status code indicating success or a specific error. - */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -gpakControlTdmLoopBackStat_t gpakControlTdmLoopBack( - unsigned short int DspId, // DSP identifier - GpakSerialPort_t SerialPort, // Serial Port Id - GpakActivation LoopBackState // Loopback State - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (ClbInvalidDsp); - - /* Build the message. */ - MsgBuffer[0] = MSG_TDM_LOOPBACK << 8; - MsgBuffer[1] = (DSP_WORD) ((SerialPort << 8) | (LoopBackState & 0xFF)); - - /* Attempt to send the message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 4, MSG_TDM_LOOPBACK_REPLY, 4, 0, 0)) - return (ClbDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (ClbSuccess); - else - return (ClbDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadCpuUsage - Read CPU usage statistics from a DSP. - * - * FUNCTION - * This function reads the CPU usage statistics from a DSP's memory. The - * average CPU usage in units of .1 percent are obtained for each of the frame - * rates. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakReadCpuUsageStat_t gpakReadCpuUsage( - unsigned short int DspId, // Dsp Identifier - unsigned short int *pPeakUsage, // pointer to peak usage variable - unsigned short int *pPrev1SecPeakUsage // peak usage over previous 1 second - ) -{ - DSP_WORD ReadBuffer[2]; /* DSP read buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RcuInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (RcuDspCommFailure); - - /* Read the CPU Usage statistics from the DSP. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + CPU_USAGE_OFFSET, 2, - ReadBuffer); - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Store the usage statistics in the specified variables. */ - *pPrev1SecPeakUsage = ReadBuffer[0]; - *pPeakUsage = ReadBuffer[1]; - - /* Return with an indication the usage staistics were read successfully. */ - return (RcuSuccess); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetCpuUsageStats - reset the cpu usage statistics - * - * FUNCTION - * This function resets the cpu utilization statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakResetCpuUsageStat_t gpakResetCpuUsageStats( - unsigned short int DspId // DSP identifier - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RstcInvalidDsp); - - MsgBuffer[0] = (MSG_RESET_USAGE_STATS << 8); - - /* Attempt to send the message to the DSP and receive it's reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 2, MSG_RESET_USAGE_STATS_REPLY, 4, 0, 0)) - return (RstcDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (RstcSuccess); - else - return (RstcDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFramingStats - * - * FUNCTION - * This function reads a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakReadFramingStatsStatus_t gpakReadFramingStats( - unsigned short int DspId, // DSP identifier - unsigned short int *pFramingError1Count, // port 1 Framing error count - unsigned short int *pFramingError2Count, // port 2 Framing error count - unsigned short int *pFramingError3Count, // port 3 Framing error count - unsigned short int *pDmaStopErrorCount, // DMA-stoppage error count - unsigned short int *pDmaSlipStatsBuffer // DMA slips count - ) -{ - DSP_WORD ReadBuffer[10]; /* DSP read buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RfsInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - /* Check if the DSP was reset and is ready. */ - if (CheckDspReset(DspId) == -1) - return (RfsDspCommFailure); - - /* Read the framing interrupt statistics from the DSP. */ - gpakReadDspMemory(DspId, pDspIfBlk[DspId] + FRAMING_STATS_OFFSET, 10, - ReadBuffer); - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Store the framing statistics in the specified variables. */ - *pFramingError1Count = ReadBuffer[0]; - *pFramingError2Count = ReadBuffer[1]; - *pFramingError3Count = ReadBuffer[2]; - *pDmaStopErrorCount = ReadBuffer[3]; - - if(pDmaSlipStatsBuffer != 0) - // If users want to get the DMA slips count - { - pDmaSlipStatsBuffer[0] = ReadBuffer[4]; - pDmaSlipStatsBuffer[1] = ReadBuffer[5]; - pDmaSlipStatsBuffer[2] = ReadBuffer[6]; - pDmaSlipStatsBuffer[3] = ReadBuffer[7]; - pDmaSlipStatsBuffer[4] = ReadBuffer[8]; - pDmaSlipStatsBuffer[5] = ReadBuffer[9]; - - } - /* Return with an indication the statistics were read successfully. */ - return (RfsSuccess); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetFramingStats - reset a DSP's framing interrupt statistics - * - * FUNCTION - * This function resets a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakResetFramingStatsStatus_t gpakResetFramingStats( - unsigned short int DspId // DSP identifier - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RstfInvalidDsp); - - MsgBuffer[0] = (MSG_RESET_FRAME_STATS << 8); - - /* Attempt to send the message to the DSP and receive it's reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 2, MSG_RESET_FRAME_STATS_REPLY, 4, 0, 0)) - return (RstfDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (RstfSuccess); - else - return (RstfDspCommFailure); -} - -/* - * gpakDownloadDsp - Download a DSP's Program and initialized Data memory. - * - * FUNCTION - * This function reads a DSP's Program and Data memory image from the - * specified file and writes the image to the DSP's memory. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakDownloadStatus_t gpakDownloadDsp( - unsigned short DspId, /* DSP Identifier (0 to MaxDSPCores-1) */ - GPAK_FILE_ID FileId /* G.PAK Download File Identifier */ - ) -{ - gpakDownloadStatus_t RetStatus; /* function return status */ - int NumRead; /* number of file bytes read */ - DSP_ADDRESS Address; /* DSP address */ - unsigned int WordCount; /* number of words in record */ - unsigned int NumWords; /* number of words to read/write */ - unsigned int i; /* loop index / counter */ - unsigned int j; /* loop index */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (GdlInvalidDsp); - - /* Lock access to the DSP. */ - gpakLockAccess(DspId); - - RetStatus = GdlSuccess; - while (RetStatus == GdlSuccess) - { - - /* Read a record header from the file. */ - NumRead = gpakReadFile(FileId, DlByteBufr, 6); - if (NumRead == -1) - { - RetStatus = GdlFileReadError; - break; - } - if (NumRead != 6) - { - RetStatus = GdlInvalidFile; - break; - } - Address = (((DSP_ADDRESS) DlByteBufr[1]) << 16) | - (((DSP_ADDRESS) DlByteBufr[2]) << 8) | - ((DSP_ADDRESS) DlByteBufr[3]); - WordCount = (((unsigned int) DlByteBufr[4]) << 8) | - ((unsigned int) DlByteBufr[5]); - - /* Check for the End Of File record. */ - if (DlByteBufr[0] == 0xFF) - break; - - /* Verify the record is for a valid memory type. */ - if ((DlByteBufr[0] != 0x00) && (DlByteBufr[0] != 0x01)) - { - RetStatus = GdlInvalidFile; - break; - } - - /* Read a block of words at a time from the file and write to the - DSP's memory .*/ - while (WordCount != 0) - { - if (WordCount < DOWNLOAD_BLOCK_SIZE) - NumWords = WordCount; - else - NumWords = DOWNLOAD_BLOCK_SIZE; - WordCount -= NumWords; - NumRead = gpakReadFile(FileId, DlByteBufr, NumWords * 2); - if (NumRead == -1) - { - RetStatus = GdlFileReadError; - break; - } - if (NumRead != (NumWords * 2)) - { - RetStatus = GdlInvalidFile; - break; - } - for (i = 0, j = 0; i < NumWords; i++, j += 2) - DlWordBufr[i] = (((DSP_WORD) DlByteBufr[j]) << 8) | - ((DSP_WORD) DlByteBufr[j + 1]); - gpakWriteDspMemory(DspId, Address, NumWords, DlWordBufr); - Address += ((DSP_ADDRESS) NumWords); - } - } - - /* Unlock access to the DSP. */ - gpakUnlockAccess(DspId); - - /* Return with an indication of success or failure. */ - return (RetStatus); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadCpuUsage - Read CPU usage statistics from a DSP. - * - * FUNCTION - * This function reads the memory map register section of DSP memory. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakReadDSPMemoryStat_t gpakReadDSPMemoryMap( - unsigned short int DspId, // Dsp Identifier - unsigned short int *pDest, // Buffer on host to hold DSP memory map - DSP_ADDRESS BufrBaseAddress, // DSP memory users want to read out - unsigned short int MemoryLength_Word16 // Length of memory section read out, unit is 16-bit word - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP reply's status */ - int i; /* loop index / counter */ - - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RmmInvalidDsp); - - /* Verify the message buffer is large enough */ - if (MSG_BUFFER_SIZE < MemoryLength_Word16 ) - return (RmmSizeTooBig); - - MsgBuffer[0] = MSG_READ_DSP_MEMORY << 8; - MsgBuffer[1] = (DSP_WORD) ((BufrBaseAddress >> 16) & 0xFFFF); - MsgBuffer[2] = (DSP_WORD) (BufrBaseAddress & 0xFFFF); - MsgBuffer[3] = (DSP_WORD) MemoryLength_Word16; - - /* Attempt to send the Read memory section message to the DSP and receive it's - reply. */ - //need_reply_len; - if (!TransactCmd(DspId, MsgBuffer, 8, MSG_READ_DSP_MEMORY_REPLY, - (MemoryLength_Word16+2)*2, 0, 0) ) - return (RmmInvalidAddress); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus != 0) - return (RmmFailure); - - for (i = 0; i < MemoryLength_Word16; i++) - pDest[i] = (short int) MsgBuffer[2 + i]; - - - return (RmmSuccess); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakAccessGPIO - change Direction/read/write the GPIO on DSP - * - * FUNCTION - * This function read/write GPIO and change the GPIO direction - * - * - * RETURNS - * Status code indicating success or a specific error. - */ -gpakAccessGPIOStat_t gpakAccessGPIO( - unsigned short int DspId, // DSP identifier - GpakGPIOCotrol_t gpakControlGPIO,// select oeration, changeDIR/write/read - unsigned short int *pGPIOValue // DSP software version - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (GPIOInvalidDsp); - - /* send value of 1, DSP increments it */ - MsgBuffer[0] = (MSG_ACCESSGPIO << 8); - MsgBuffer[1] = (DSP_WORD) ((gpakControlGPIO << 8) | (*pGPIOValue & 0xFF) ); - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 4, MSG_ACCESSGPIO_REPLY, 6, 0, 0)) - return (GPIODspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - { - *pGPIOValue = MsgBuffer[2]; - return (GPIOSuccess); - } - else - return (GPIODspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakWriteSystemParms - Write a DSP's System Parameters. - * - * FUNCTION - * This function writes a DSP's System Parameters information. - * - * Note: - * Or-together the desired bit-mask #defines that are listed below. Only - * those algorithm parameters whose bit-mask is selected in the UpdateBits - * function parameter will be updated. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ - -gpakWriteSysParmsStatus_t gpakWriteSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms, /* pointer to System Parms info var */ - unsigned short int UpdateBits, /* input: flags indicating which parms to update */ - GPAK_SysParmsStat_t *pStatus /* pointer to Write System Parms Status */ - ) -{ - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - DSP_WORD DspStatus; /* DSP's reply status */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (WspInvalidDsp); - - /* Build the Write System Parameters message. */ - MsgBuffer[0] = MSG_WRITE_SYS_PARMS << 8; - - if (UpdateBits & DTMF_UPDATE_MASK) - { - MsgBuffer[1] |= DTMF_UPDATE_MASK; - MsgBuffer[8] = (DSP_WORD) pSysParms->MinSigLevel; - MsgBuffer[9] = (DSP_WORD) (pSysParms->FreqDeviation & 0xff); - if (pSysParms->SNRFlag) - MsgBuffer[9] |= (1<<8); - } - - MsgBuffer[10] = (DSP_WORD) 0; - if (UpdateBits & DTMF_TWIST_UPDATE_MASK) - { - MsgBuffer[1] |= DTMF_TWIST_UPDATE_MASK; - MsgBuffer[10] |= (DSP_WORD) (pSysParms->DtmfFwdTwist & 0x000f); - MsgBuffer[10] |= (DSP_WORD) ((pSysParms->DtmfRevTwist << 4) & 0x00f0); - } - - - if (UpdateBits & DTMF_VALID_MASK) - { - MsgBuffer[1] |= DTMF_VALID_MASK; - MsgBuffer[11] = (DSP_WORD) (pSysParms->DtmfValidityMask & 0x00ff); - } - - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 24, MSG_WRITE_SYS_PARMS_REPLY, 6, 0, 0)) - return (WspDspCommFailure); - - /* Return with an indication of success or failure based on the return - status in the reply message. */ - *pStatus = (GPAK_SysParmsStat_t) (MsgBuffer[2] ); - - DspStatus = (MsgBuffer[1] & 0xFF); - if (DspStatus == 0) - return (WspSuccess); - else - return (WspDspCommFailure); -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadSystemParms - Read a DSP's System Parameters. - * - * FUNCTION - * This function reads a DSP's System Parameters information. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -gpakReadSysParmsStatus_t gpakReadSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms /* pointer to System Parms info var */ - ) -{ - - DSP_WORD MsgBuffer[MSG_BUFFER_SIZE]; /* message buffer */ - - /* Make sure the DSP Id is valid. */ - if (DspId >= MAX_DSP_CORES) - return (RspInvalidDsp); - - /* Build the Read System Parameters message. */ - MsgBuffer[0] = MSG_READ_SYS_PARMS << 8; - - /* Attempt to send the ping message to the DSP and receive it's - reply. */ - if (!TransactCmd(DspId, MsgBuffer, 2, MSG_READ_SYS_PARMS_REPLY, 22, 0, 0)) - return (RspDspCommFailure); - - /* Extract the System Parameters information from the message. */ - pSysParms->DtmfValidityMask = (short int)(MsgBuffer[7]) ; - - pSysParms->MinSigLevel = (short int)MsgBuffer[8]; - pSysParms->SNRFlag = (short int)((MsgBuffer[9]>>8) & 0x1); - pSysParms->FreqDeviation = (short int)(MsgBuffer[9] & 0xff); - pSysParms->DtmfFwdTwist = (short int)MsgBuffer[10] & 0x000f; - pSysParms->DtmfRevTwist = (short int)(MsgBuffer[10] >> 4) & 0x000f; - - /* Return with an indication that System Parameters info was obtained. */ - return (RspSuccess); -} -#endif diff --git a/zaptel/kernel/wcte12xp/GpakApi.h b/zaptel/kernel/wcte12xp/GpakApi.h deleted file mode 100644 index ebd440ed..00000000 --- a/zaptel/kernel/wcte12xp/GpakApi.h +++ /dev/null @@ -1,636 +0,0 @@ -/* - * Copyright (c) 2005 , Adaptive Digital Technologies, Inc. - * - * File Name: GpakApi.h - * - * Description: - * This file contains the function prototypes and data types for the user - * API functions that communicate with DSPs executing G.PAK software. The - * file is used by application software in the host processor connected to - * C55X G.PAK DSPs via a Host Port Interface. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * 11/15/2006 - 24 TDM-TDM Channels EC release - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKAPI_H /* prevent multiple inclusion */ -#define _GPAKAPI_H -#include "GpakErrs.h" -#include "gpakenum.h" - -// Bit masks to select which algorithm's parameters to update: Or-together the -// desired masks into the UpdateBits function parameter. -#define DTMF_UPDATE_MASK 0x0010 // update DTMF params, MinLevel, SNRFlag and Freq -#define DTMF_TWIST_UPDATE_MASK 0x0020 // update DTMF TWIST system params -#define DTMF_VALID_MASK 0x0080 // update DTMF ValidMask params - -#define DSP_DEBUG_BUFF_SIZE 42 // units of 16-bit words - -/* Definition of an Asynchronous Event Data Structure */ -typedef union -{ - struct - { - GpakToneCodes_t ToneCode; // detected tone code - unsigned short int ToneDuration; // tone duration - GpakTdmDirection Direction; // detected on A r B side - short int DebugToneStatus;// reserved for debug info - } toneEvent; - -} GpakAsyncEventData_t; - -/* Definition of an Echo Canceller Parameters information structure. */ -typedef struct -{ - short int EcanTapLength; // Echo Can Num Taps (tail length) - short int EcanNlpType; // Echo Can NLP Type - short int EcanAdaptEnable; // Echo Can Adapt Enable flag - short int EcanG165DetEnable; // Echo Can G165 Detect Enable flag - short int EcanDblTalkThresh; // Echo Can Double Talk threshold - short int EcanNlpThreshold; // Echo Can NLP threshold - short int EcanNlpConv; // Dynamic NLP control, NLP limit when EC about to converged - short int EcanNlpUnConv;// Dynamic NLP control, NLP limit when EC not converged yet - short int EcanNlpMaxSuppress; // suppression level for NLP_SUPP mode - short int EcanCngThreshold; // Echo Can CNG Noise threshold - short int EcanAdaptLimit; // Echo Can Max Adapts per frame - short int EcanCrossCorrLimit; // Echo Can Cross Correlation limit - short int EcanNumFirSegments; // Echo Can Num FIR Segments - short int EcanFirSegmentLen; // Echo Can FIR Segment Length -} GpakEcanParms_t; - -/* Definition of a Channel Configuration information structure. */ -typedef struct -{ - GpakSerialPort_t PcmInPortA; // A side PCM Input Serial Port Id - unsigned short int PcmInSlotA; // A side PCM Input Time Slot - GpakSerialPort_t PcmOutPortA; // A side PCM Output Serial Port Id - unsigned short int PcmOutSlotA; // A side PCM Output Time Slot - GpakSerialPort_t PcmInPortB; // B side PCM Input Serial Port Id - unsigned short int PcmInSlotB; // B side PCM Input Time Slot - GpakSerialPort_t PcmOutPortB; // B side PCM Output Serial Port Id - unsigned short int PcmOutSlotB; // B side PCM Output Time Slot - GpakToneTypes ToneTypesA; // A side Tone Detect Types - GpakToneTypes ToneTypesB; // B side Tone Detect Types - GpakActivation EcanEnableA; // Echo Cancel A Enabled - GpakActivation EcanEnableB; // Echo Cancel B Enabled - GpakEcanParms_t EcanParametersA; // Echo Cancel parameters - GpakEcanParms_t EcanParametersB; // Echo Cancel parameters - GpakCompandModes SoftwareCompand; // software companding - GpakRate_t FrameRate; // Gpak Frame Rate - GpakActivation MuteToneA; // A side mute DTMF Enabled - GpakActivation MuteToneB; // B side mute DTMF Enabled - GpakActivation FaxCngDetA; // A side FaxCng Tone Detector Enabled - GpakActivation FaxCngDetB; // B side FaxCng Tone Detector Enabled - -} GpakChannelConfig_t; - - -/* Definition of a Serial Port Configuration Structure */ -typedef struct -{ - GpakSlotCfg_t SlotsSelect1; // port 1 Slot selection - unsigned short int FirstBlockNum1; // port 1 first group Block Number - unsigned short int FirstSlotMask1; // port 1 first group Slot Mask - unsigned short int SecBlockNum1; // port 1 second group Block Number - unsigned short int SecSlotMask1; // port 1 second group Slot Mask - - GpakSerWordSize_t SerialWordSize1; // port 1 serial word size - GpakCompandModes CompandingMode1; // port 1 companding mode - GpakSerFrameSyncPol_t TxFrameSyncPolarity1; // port 1 Tx Frame Sync Polarity - GpakSerFrameSyncPol_t RxFrameSyncPolarity1; // port 1 Rx Frame Sync Polarity - GpakSerClockPol_t TxClockPolarity1; // port 1 Tx Clock Polarity - GpakSerClockPol_t RxClockPolarity1; // port 1 Rx Clock Polarity - GpakSerDataDelay_t TxDataDelay1; // port 1 Tx data delay - GpakSerDataDelay_t RxDataDelay1; // port 1 Rx data delay - GpakActivation DxDelay1; // port 1 DX Delay - - unsigned short int ThirdSlotMask1; // port 1 3rd group Slot Mask - unsigned short int FouthSlotMask1; // port 1 4th group Slot Mask - unsigned short int FifthSlotMask1; // port 1 5th group Slot Mask - unsigned short int SixthSlotMask1; // port 1 6th group Slot Mask - unsigned short int SevenSlotMask1; // port 1 7th group Slot Mask - unsigned short int EightSlotMask1; // port 1 8th group Slot Mask - - - GpakSlotCfg_t SlotsSelect2; // port 2 Slot selection - unsigned short int FirstBlockNum2; // port 2 first group Block Number - unsigned short int FirstSlotMask2; // port 2 first group Slot Mask - unsigned short int SecBlockNum2; // port 2 second group Block Number - unsigned short int SecSlotMask2; // port 2 second group Slot Mask - GpakSerWordSize_t SerialWordSize2; // port 2 serial word size - GpakCompandModes CompandingMode2; // port 2 companding mode - GpakSerFrameSyncPol_t TxFrameSyncPolarity2; // port 2 Tx Frame Sync Polarity - GpakSerFrameSyncPol_t RxFrameSyncPolarity2; // port 2 Rx Frame Sync Polarity - GpakSerClockPol_t TxClockPolarity2; // port 2 Tx Clock Polarity - GpakSerClockPol_t RxClockPolarity2; // port 2 Rx Clock Polarity - GpakSerDataDelay_t TxDataDelay2; // port 2 Tx data delay - GpakSerDataDelay_t RxDataDelay2; // port 2 Rx data delay - GpakActivation DxDelay2; // port 2 DX Delay - - unsigned short int ThirdSlotMask2; // port 2 3rd group Slot Mask - unsigned short int FouthSlotMask2; // port 2 4th group Slot Mask - unsigned short int FifthSlotMask2; // port 2 5th group Slot Mask - unsigned short int SixthSlotMask2; // port 2 6th group Slot Mask - unsigned short int SevenSlotMask2; // port 2 7th group Slot Mask - unsigned short int EightSlotMask2; // port 2 8th group Slot Mask - - GpakSlotCfg_t SlotsSelect3; // port 3 Slot selection - unsigned short int FirstBlockNum3; // port 3 first group Block Number - unsigned short int FirstSlotMask3; // port 3 first group Slot Mask - unsigned short int SecBlockNum3; // port 3 second group Block Number - unsigned short int SecSlotMask3; // port 3 second group Slot Mask - GpakSerWordSize_t SerialWordSize3; // port 3 serial word size - GpakCompandModes CompandingMode3; // port 3 companding mode - GpakSerFrameSyncPol_t TxFrameSyncPolarity3; // port 3 Tx Frame Sync Polarity - GpakSerFrameSyncPol_t RxFrameSyncPolarity3; // port 3 Rx Frame Sync Polarity - GpakSerClockPol_t TxClockPolarity3; // port 3 Tx Clock Polarity - GpakSerClockPol_t RxClockPolarity3; // port 3 Rx Clock Polarity - GpakSerDataDelay_t TxDataDelay3; // port 3 Tx data delay - GpakSerDataDelay_t RxDataDelay3; // port 3 Rx data delay - GpakActivation DxDelay3; // port 3 DX Delay - - unsigned short int ThirdSlotMask3; // port 3 3rd group Slot Mask - unsigned short int FouthSlotMask3; // port 3 4th group Slot Mask - unsigned short int FifthSlotMask3; // port 3 5th group Slot Mask - unsigned short int SixthSlotMask3; // port 3 6th group Slot Mask - unsigned short int SevenSlotMask3; // port 3 7th group Slot Mask - unsigned short int EightSlotMask3; // port 3 8th group Slot Mask - -} GpakPortConfig_t; - -/* Definition of a Tone Generation Parameter Structure */ -/* -typedef struct -{ - GpakToneGenType_t ToneType; // Tone Type - unsigned short int Frequency[4]; // Frequency (Hz) - short int Level[4]; // Frequency's Level (1 dBm) - unsigned short int OnTime[4]; // On Times (msecs) - unsigned short int OffTime[4]; // Off Times (msecs) -} GpakToneGenParms_t; -*/ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakConfigureChannel return status. */ -typedef enum -{ - CcsSuccess = 0, /* Channel Configured successfully */ - CcsParmError = 1, /* Channel Config Parameter error */ - CcsInvalidChannel = 2, /* invalid channel */ - CcsInvalidDsp = 3, /* invalid DSP */ - CcsDspCommFailure = 4 /* failed to communicate with DSP */ -} gpakConfigChanStatus_t; - -/* - * gpakConfigureChannel - Configure a DSP's Channel. - * - * FUNCTION - * This function configures a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakConfigChanStatus_t gpakConfigureChannel( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakChanType ChannelType, // channel type - GpakChannelConfig_t *pChanConfig, // pointer to channel config info - GPAK_ChannelConfigStat_t *pStatus // pointer to Channel Config Status - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakTearDownChannel return status. */ -typedef enum -{ - TdsSuccess = 0, /* Channel Tear Down successful */ - TdsError = 1, /* Channel Tear Down error */ - TdsInvalidChannel = 2, /* invalid channel */ - TdsInvalidDsp = 3, /* invalid DSP */ - TdsDspCommFailure = 4 /* failed to communicate with DSP */ -} gpakTearDownStatus_t; - -/* - * gpakTearDownChannel - Tear Down a DSP's Channel. - * - * FUNCTION - * This function tears down a DSP's Channel. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ - -extern gpakTearDownStatus_t gpakTearDownChannel( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GPAK_TearDownChanStat_t *pStatus // pointer to Tear Down Status - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakAlgControl return status. */ -typedef enum -{ - AcSuccess = 0, /* control successful */ - AcInvalidChannel = 1, /* invalid channel identifier */ - AcInvalidDsp = 2, /* invalid DSP */ - AcParmError = 3, /* invalid control parameter */ - AcDspCommFailure = 4 /* failed to communicate with DSP */ -} gpakAlgControlStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakAlgControl - Control an Algorithm. - * - * FUNCTION - * This function controls an Algorithm - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakAlgControlStat_t gpakAlgControl( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakAlgCtrl_t ControlCode, // algorithm control code - GPAK_AlgControlStat_t *pStatus // pointer to return status - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakConfigurePorts return status. */ -typedef enum -{ - CpsSuccess = 0, /* Serial Ports configured successfully */ - CpsParmError = 1, /* Configure Ports Parameter error */ - CpsInvalidDsp = 2, /* invalid DSP */ - CpsDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakConfigPortStatus_t; - -/* - * gpakConfigurePorts - Configure a DSP's serial ports. - * - * FUNCTION - * This function configures a DSP's serial ports. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakConfigPortStatus_t gpakConfigurePorts( - unsigned short int DspId, // DSP identifier - GpakPortConfig_t *pPortConfig, // pointer to Port Config info - GPAK_PortConfigStat_t *pStatus // pointer to Port Config Status - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakDownloadDsp return status. */ -typedef enum -{ - GdlSuccess = 0, /* DSP download successful */ - GdlFileReadError = 1, /* error reading Download file */ - GdlInvalidFile = 2, /* invalid Download file content */ - GdlInvalidDsp = 3 /* invalid DSP */ -} gpakDownloadStatus_t; - -/* - * gpakDownloadDsp - Download a DSP's Program and initialized Data memory. - * - * FUNCTION - * This function reads a DSP's Program and Data memory image from the - * specified file and writes the image to the DSP's memory. - * - * RETURNS - * Status code indicating success or a specific error. - * - */ -extern gpakDownloadStatus_t gpakDownloadDsp( - unsigned short int DspId, // DSP identifier - GPAK_FILE_ID FileId // G.PAK download file identifier - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -/* gpakReadEventFIFOMessage return status */ -typedef enum -{ - RefEventAvail = 0, /* an event was successfully read from the fifo */ - RefNoEventAvail = 1, /* no event was in the fifo */ - RefInvalidDsp = 2, /* invalid DSP identifier */ - RefInvalidEvent = 3, /* invalid event */ - RefDspCommFailure = 4 /* error communicating with DSP */ -} gpakReadEventFIFOMessageStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadEventFIFOMessage - read from the event fifo - * - * FUNCTION - * This function reads a single event from the event fifo if one is available - * - * RETURNS - * Status code indicating success or a specific error. - * - * Note: This function should be called in a loop until the return status - * indicates that the fifo is empty. - */ -extern gpakReadEventFIFOMessageStat_t gpakReadEventFIFOMessage( - unsigned short int DspId, // DSP identifier - unsigned short int *pChannelId, // pointer to channel identifier - GpakAsyncEventCode_t *pEventCode, // pointer to Event Code - GpakAsyncEventData_t *pEventData // pointer to Event Data Struct - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakPingDsp return status values */ -typedef enum -{ - PngSuccess = 0, /* DSP responded successfully */ - PngInvalidDsp = 1, /* invalid DSP identifier */ - PngDspCommFailure = 2 /* error communicating with DSP */ -} gpakPingDspStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakPingDsp - ping the DSP to see if it's alive - * - * FUNCTION - * This function checks if the DSP is still communicating with the host - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakPingDspStat_t gpakPingDsp( - unsigned short int DspId, // DSP identifier - unsigned short int *pDspSwVersion // DSP software version - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakSerialTxFixedValue return status values */ -typedef enum -{ - TfvSuccess = 0, /* operation successful */ - TfvInvalidChannel = 1, /* invalid channel identifier */ - TfvInvalidDsp = 2, /* invalid DSP identifier */ - TfvDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakSerialTxFixedValueStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakSerialTxFixedValue - transmit a fixed value on a timeslot - * - * FUNCTION - * This function controls transmission of a fixed value out onto a serial - * port's timeslot. - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakSerialTxFixedValueStat_t gpakSerialTxFixedValue( - unsigned short int DspId, // DSP identifier - unsigned short int ChannelId, // channel identifier - GpakSerialPort_t PcmOutPort, // PCM Output Serial Port Id - unsigned short int PcmOutSlot, // PCM Output Time Slot - unsigned short int Value, // 16-bit value - GpakActivation State // activation state - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakControlTdmLoopBack return status values */ -typedef enum -{ - ClbSuccess = 0, /* operation successful */ - ClbSerPortInactive = 1, /* serial port is inactive */ - ClbInvalidDsp = 2, /* invalid DSP identifier */ - ClbDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakControlTdmLoopBackStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakControlTdmLoopBack - control a serial port's loopback state - * - * FUNCTION - * This function enables/disables the tdm input to output looback mode on a - * serial port - * - * RETURNS - * Status code indicating success or a specific error. - */ - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -gpakControlTdmLoopBackStat_t gpakControlTdmLoopBack( - unsigned short int DspId, // DSP identifier - GpakSerialPort_t SerialPort, // Serial Port Id - GpakActivation LoopBackState // Loopback State - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakReadCpuUsage return status values */ -typedef enum -{ - RcuSuccess = 0, /* operation successful */ - RcuInvalidDsp = 1, /* invalid DSP identifier */ - RcuDspCommFailure = 2 /* communication failure */ -} gpakReadCpuUsageStat_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadCpuUsage - read the cpu usage statistics - * - * FUNCTION - * This function reads cpu utilization from the DSP. - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakReadCpuUsageStat_t gpakReadCpuUsage( - unsigned short int DspId, // DSP identifier - unsigned short int *pPeakUsage, // pointer to peak usage variable - unsigned short int *pPrev1SecPeakUsage // peak usage over previous 1 second - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakResetCpuUsageStats return status values */ -typedef enum -{ - RstcSuccess = 0, /* operation successful */ - RstcInvalidDsp = 1, /* invalid DSP identifier */ - RstcDspCommFailure = 2 /* communication failure */ -} gpakResetCpuUsageStat_t; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetCpuUsageStats - reset the cpu usage statistics - * - * FUNCTION - * This function resets the cpu utilization statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakResetCpuUsageStat_t gpakResetCpuUsageStats( - unsigned short int DspId // DSP identifier - ); - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakReadFramingStats return status values */ -typedef enum -{ - RfsSuccess = 0, /* operation successful */ - RfsInvalidDsp = 1, /* invalid DSP identifier */ - RfsDspCommFailure = 2 /* communication failure */ -} gpakReadFramingStatsStatus_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFramingStats - * - * FUNCTION - * This function reads a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakReadFramingStatsStatus_t gpakReadFramingStats( - unsigned short int DspId, // DSP identifier - unsigned short int *pFramingError1Count, // port 1 Framing error count - unsigned short int *pFramingError2Count, // port 2 Framing error count - unsigned short int *pFramingError3Count, // port 3 Framing error count - unsigned short int *pDmaStopErrorCount, // DMA-stoppage error count - unsigned short int *pDmaSlipStatsBuffer // DMA slips count - ); - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - -/* gpakResetFramingStats return values */ -typedef enum -{ - RstfSuccess = 0, /* operation successful */ - RstfInvalidDsp = 1, /* invalid DSP identifier */ - RstfDspCommFailure = 2 /* communication failure */ -} gpakResetFramingStatsStatus_t; - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetFramingStats - reset a DSP's framing interrupt statistics - * - * FUNCTION - * This function resets a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ -extern gpakResetFramingStatsStatus_t gpakResetFramingStats( - unsigned short int DspId // DSP identifier - ); - - -typedef enum -{ - RmmSuccess =0, - RmmInvalidDsp = 1, - RmmSizeTooBig = 2, - RmmFailure = 3, - RmmInvalidAddress = 4 - -} gpakReadDSPMemoryStat_t; -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakResetFramingStats - read a section of DSP memory - * to get access DSP registers, since 0x00--0x60 not HPI-accessable - * - * FUNCTION - * This function resets a DSP's framing interrupt statistics - * - * RETURNS - * Status code indicating success or a specific error. - */ - -extern gpakReadDSPMemoryStat_t gpakReadDSPMemoryMap( - unsigned short int DspId, // Dsp Identifier - unsigned short int *pDest, // Buffer on host to hold DSP memory map - DSP_ADDRESS BufrBaseAddress, // DSP memory users want to read out - unsigned short int MemoryLength_Word16 // Length of memory section read out, unit is 16-bit word - ); - -typedef enum -{ - GPIOSuccess =0, - GPIOInvalidDsp = 1, - GPIODspCommFailure = 2 -}gpakAccessGPIOStat_t; - -extern gpakAccessGPIOStat_t gpakAccessGPIO( - unsigned short int DspId, // DSP identifier - GpakGPIOCotrol_t gpakControlGPIO,// select oeration, changeDIR/write/read - unsigned short int *pGPIOValue // pointer for the read/write value or DIR mask - ); - -/* gpakWriteSystemParms return status. */ -typedef enum -{ - WspSuccess = 0, /* System Parameters written successfully */ - WspParmError = 1, /* Write System Parms's Parameter error */ - WspInvalidDsp = 2, /* invalid DSP */ - WspDspCommFailure = 3 /* failed to communicate with DSP */ -} gpakWriteSysParmsStatus_t; - -/* Definition of a System Parameters information structure. */ -typedef struct -{ - /* DTMF Parameters */ - short int MinSigLevel; /* 0 = Disabled, Min Sig Power Level for detection */ - short int SNRFlag; /* 0 = Disabled, relax SNR tolerances */ - short int FreqDeviation; /* 0 = Disabled, X Percent Deviation times 10 (e.g. 1.7% is entered as 17) */ - short int DtmfFwdTwist; /* 0 to 8 db */ - short int DtmfRevTwist; /* 0 to 8 db */ - - short int DtmfValidityMask; /* This flag allows users to relax the trailing conditions of the tone */ - -} GpakSystemParms_t; -/* gpakReadSystemParms return status. */ -typedef enum -{ - RspSuccess = 0, /* System Parameters read successfully */ - RspInvalidDsp = 1, /* invalid DSP */ - RspDspCommFailure = 2 /* failed to communicate with DSP */ -} gpakReadSysParmsStatus_t; - -extern gpakReadSysParmsStatus_t gpakReadSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms /* pointer to System Parms info var */ - ); - -extern gpakWriteSysParmsStatus_t gpakWriteSystemParms( - unsigned short int DspId, // DSP identifier - GpakSystemParms_t *pSysParms, /* pointer to System Parms info var */ - unsigned short int UpdateBits, /* input: flags indicating which parms to update */ - GPAK_SysParmsStat_t *pStatus /* pointer to Write System Parms Status */ - ); - -#endif // end multiple inclusion - diff --git a/zaptel/kernel/wcte12xp/GpakErrs.h b/zaptel/kernel/wcte12xp/GpakErrs.h deleted file mode 100644 index 2f5083bb..00000000 --- a/zaptel/kernel/wcte12xp/GpakErrs.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2002 - 2004, Adaptive Digital Technologies, Inc. - * - * File Name: GpakErrs.h - * - * Description: - * This file contains DSP reply status codes used by G.PAK API functions to - * indicate specific errors. - * - * Version: 1.0 - * - * Revision History: - * 10/17/01 - Initial release. - * 07/03/02 - Updates for conferencing. - * 06/15/04 - Tone type updates. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKERRS_H /* prevent multiple inclusion */ -#define _GPAKERRS_H - -/* Configure Serial Ports reply status codes. */ -typedef enum -{ - Pc_Success = 0, /* serial ports configured successfully */ - Pc_ChannelsActive = 1, /* unable to configure while channels active */ - Pc_TooManySlots1 = 2, /* too many slots selected for port 1 */ - Pc_InvalidBlockCombo1 = 3, /* invalid combination of blocks for port 1 */ - Pc_NoSlots1 = 4, /* no slots selected for port 1 */ - Pc_InvalidSlots1 = 5, /* invalid slot (> max) selected for port 1 */ - Pc_TooManySlots2 = 6, /* too many slots selected for port 2 */ - Pc_InvalidBlockCombo2 = 7, /* invalid combination of blocks for port 2 */ - Pc_NoSlots2 = 8, /* no slots selected for port 2 */ - Pc_InvalidSlots2 = 9, /* invalid slot (> max) selected for port 2 */ - Pc_TooManySlots3 = 10, /* too many slots selected for port 3 */ - Pc_InvalidBlockCombo3 = 11, /* invalid combination of blocks for port 3 */ - Pc_NoSlots3 = 12, /* no slots selected for port 3 */ - Pc_InvalidSlots3 = 13 /* invalid slot (> max) selected for port 3 */ -} GPAK_PortConfigStat_t; - -/* Configure Channel reply status codes. */ -typedef enum -{ - Cc_Success = 0, /* channel configured successfully */ - Cc_InvalidChannelType = 1, /* invalid Channel Type */ - Cc_InvalidChannel = 2, /* invalid Channel A Id */ - Cc_ChannelActiveA = 3, /* Channel A is currently active */ - Cc_InvalidInputPortA = 4, /* invalid Input A Port */ - Cc_InvalidInputSlotA = 5, /* invalid Input A Slot */ - Cc_BusyInputSlotA = 6, /* busy Input A Slot */ - Cc_InvalidOutputPortA = 7, /* invalid Output A Port */ - Cc_InvalidOutputSlotA = 8, /* invalid Output A Slot */ - Cc_BusyOutputSlotA = 9, /* busy Output A Slot */ - Cc_InvalidInputPortB = 10, /* invalid Input B Port */ - Cc_InvalidInputSlotB = 11, /* invalid Input B Slot */ - Cc_BusyInputSlotB = 12, /* busy Input B Slot */ - Cc_InvalidPktInCodingA = 13, /* invalid Packet In A Coding */ - Cc_InvalidPktOutCodingA = 14, /* invalid Packet Out A Coding */ - Cc_InvalidPktInSizeA = 15, /* invalid Packet In A Frame Size */ - Cc_InvalidPktOutSizeA = 16, /* invalid Packet Out A Frame Size */ - - Cc_ChanTypeNotConfigured = 21, /* channel type was not configured */ - Cc_InsuffECResources = 22, /* insufficient ecan resources avail. */ - Cc_InsuffTDMResources = 23, /* insufficient tdm block resources avail. */ - - Cc_InsuffPktBufResources = 25, /* insufficient pkt buffer resources avail. */ - Cc_InsuffPcmBufResources = 26, /* insufficient pcm buffer resources avail. */ - - Cc_BadPcmEcNlpType = 30, /* invalid EC Nlp type */ - Cc_BadPcmEcTapLength = 31, /* invalid EC tap length */ - Cc_BadPcmEcDblTalkThresh = 32, /* invalid EC double-talk threshold */ - Cc_BadPcmEcNlpThreshold = 33, /* invalid EC Nlp threshold */ - Cc_BadPcmEcCngThreshold = 34, /* invalid EC Cng threshold */ - Cc_BadPcmEcAdaptLimit = 35, /* invalid EC Adapt Limit */ - Cc_BadPcmEcCrossCorrLim = 36, /* invalid EC Cross Correlation Limit */ - Cc_BadPcmEcNumFirSegs = 37, /* invalid EC Number of FirSegments */ - Cc_BadPcmEcFirSegLen = 38, /* invalid EC Fir Segment Length */ - - /*Cc_InvalidNumEcsEnabled = 48, */ /* more than 1 Ec enabled on channel */ - Cc_InvalidFrameRate = 49, /* invalid gpak frame rate */ - Cc_InvalidSoftCompand = 50, /* invalid softCompanding type */ - - Cc_InvalidMuteToneA = 51, /* invalid MuteToneA set, no detector */ - Cc_InvalidMuteToneB = 52, /* invalid MuteToneB set, no detector */ - Cc_InsuffFaxCngDetResources = 53 /* insufficient tdm block resources avail. */ - -} GPAK_ChannelConfigStat_t; - -/* Tear Down Channel reply status codes. */ -typedef enum -{ - Td_Success = 0, /* channel torn down successfully */ - Td_InvalidChannel = 1, /* invalid Channel Id */ - Td_ChannelNotActive = 2 /* channel is not active */ -} GPAK_TearDownChanStat_t; - - -typedef enum -{ - Ac_Success = 0, /* algorithm control is successfull */ - Ac_InvalidChannel = 1, /* invalid channel identifier */ - Ac_InvalidCode = 2, /* invalid algorithm control code */ - Ac_ECNotEnabled = 3, /* echo canceller was not allocated */ - Ac_InvalidSoftComp = 4, /* invalid softcompanding, 'cause serial port not in companding mode */ - Ac_InvalidDTMFMuteA = 5, /* A side invalid Mute, since no dtmf detector */ - Ac_InvalidDTMFMuteB = 6, /* B side invalid Mute, since no dtmf detector */ - Ac_InvalidFaxCngA = 7, /* A side FAXCNG detector not available */ - Ac_InvalidFaxCngB = 8, /* B side FAXCNG detector not available */ - Ac_InvalidSysConfig = 9 /* No new system parameters (DTMF config) wrriten yet */ -} GPAK_AlgControlStat_t; - -/* Write System Parameters reply status codes. */ -typedef enum -{ - Sp_Success = 0, /* System Parameters written successfully */ - Sp_BadTwistThresh = 29 /* invalid twist threshold */ - -} GPAK_SysParmsStat_t; - -#endif /* prevent multiple inclusion */ - - - - - - - - - - - - - - - - - - - diff --git a/zaptel/kernel/wcte12xp/GpakHpi.h b/zaptel/kernel/wcte12xp/GpakHpi.h deleted file mode 100644 index c9b769b5..00000000 --- a/zaptel/kernel/wcte12xp/GpakHpi.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2001, Adaptive Digital Technologies, Inc. - * - * File Name: GpakHpi.h - * - * Description: - * This file contains common definitions related to the G.PAK interface - * between a host processor and a DSP processor via the Host Port Interface. - * - * Version: 1.0 - * - * Revision History: - * 10/17/01 - Initial release. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKHPI_H /* prevent multiple inclusion */ -#define _GPAKHPI_H - - -/* Definition of G.PAK Command/Reply message type codes. */ -#define MSG_NULL_REPLY 0 /* Null Reply (unsupported Command) */ -#define MSG_SYS_CONFIG_RQST 1 /* System Configuration Request */ -#define MSG_SYS_CONFIG_REPLY 2 /* System Configuration Reply */ -#define MSG_READ_SYS_PARMS 3 /* Read System Parameters */ -#define MSG_READ_SYS_PARMS_REPLY 4 /* Read System Parameters Reply */ -#define MSG_WRITE_SYS_PARMS 5 /* Write System Parameters */ -#define MSG_WRITE_SYS_PARMS_REPLY 6 /* Write System Parameters Reply */ -#define MSG_CONFIGURE_PORTS 7 /* Configure Serial Ports */ -#define MSG_CONFIG_PORTS_REPLY 8 /* Configure Serial Ports Reply */ -#define MSG_CONFIGURE_CHANNEL 9 /* Configure Channel */ -#define MSG_CONFIG_CHAN_REPLY 10 /* Configure Channel Reply */ -#define MSG_TEAR_DOWN_CHANNEL 11 /* Tear Down Channel */ -#define MSG_TEAR_DOWN_REPLY 12 /* Tear Down Channel Reply */ -#define MSG_CHAN_STATUS_RQST 13 /* Channel Status Request */ -#define MSG_CHAN_STATUS_REPLY 14 /* Channel Status Reply */ - -#define MSG_TEST_MODE 17 /* Configure/Perform Test Mode */ -#define MSG_TEST_REPLY 18 /* Configure/Perform Test Mode Reply */ - -#define MSG_ALG_CONTROL 27 /* algorithm control */ -#define MSG_ALG_CONTROL_REPLY 28 /* algorithm control reply */ -#define MSG_GET_TXCID_ADDRESS 29 /* get tx cid buffer start address */ -#define MSG_GET_TXCID_ADDRESS_REPLY 30 /* get tx cid buffer start addr reply */ - -#define MSG_PING 35 /* ping command */ -#define MSG_PING_REPLY 36 /* ping command reply */ -#define MSG_SERIAL_TXVAL 37 /* transmit serial fixed value */ -#define MSG_SERIAL_TXVAL_REPLY 38 /* transmit serial fixed value reply */ -#define MSG_TDM_LOOPBACK 39 /* tdm loopback control */ -#define MSG_TDM_LOOPBACK_REPLY 40 /* tdm loopback control reply */ -#define MSG_RESET_USAGE_STATS 41 /* reset cpu usage stats */ -#define MSG_RESET_USAGE_STATS_REPLY 42 /* reset cpu usage stats reply */ - -#define MSG_RESET_FRAME_STATS 47 /* reset framing stats */ -#define MSG_RESET_FRAME_STATS_REPLY 48 /* reset framing stats reply */ - -#define MSG_READ_DSP_MEMORY 49 /* read small section of DSP's memory */ -#define MSG_READ_DSP_MEMORY_REPLY 50 /* read memory reply */ - -#define MSG_ACCESSGPIO 51 -#define MSG_ACCESSGPIO_REPLY 52 -#endif /* prevent multiple inclusion */ diff --git a/zaptel/kernel/wcte12xp/Kbuild b/zaptel/kernel/wcte12xp/Kbuild deleted file mode 100644 index 569e70c7..00000000 --- a/zaptel/kernel/wcte12xp/Kbuild +++ /dev/null @@ -1,25 +0,0 @@ -obj-m += wcte12xp.o - -FIRM_DIR := ../../firmware - -EXTRA_CFLAGS := -I$(src)/.. -Wno-undef - -ifeq ($(HOTPLUG_FIRMWARE),yes) - EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE -endif - -wcte12xp-objs := base.o vpmadt032.o GpakApi.o voicebus.o - -ifneq ($(HOTPLUG_FIRMWARE),yes) -wcte12xp-objs += $(FIRM_DIR)/zaptel-fw-vpmadt032.o -endif - -$(obj)/$(FIRM_DIR)/zaptel-fw-vpmadt032.o: $(obj)/base.o - $(MAKE) -C $(obj)/$(FIRM_DIR) zaptel-fw-vpmadt032.o - -$(obj)/base.o: $(src)/vpmadt032.h $(src)/wcte12xp.h -$(obj)/base.o: $(src)/../zaptel.h - -$(obj)/vpmadt032.o: $(src)/vpmadt032.h - -$(obj)/GpakApi.o: $(src)/GpakApi.h diff --git a/zaptel/kernel/wcte12xp/Makefile b/zaptel/kernel/wcte12xp/Makefile deleted file mode 100644 index fb0fbc53..00000000 --- a/zaptel/kernel/wcte12xp/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -ifneq ($(KBUILD_EXTMOD),) -# We only get here on kernels 2.6.0-2.6.9 . -# For newer kernels, Kbuild will be included directly by the kernel -# build system. -include $(src)/Kbuild - -else - -# building for 2.4 kernels means no VPM support, so none of the VPM support -# modules are included in the Makefile rules - -all: wcte12xp.o - -%.o: %.c - $(CC) $(KFLAGS) -o $@ -c $< - -base.o: ../zaptel.h - -wcte12xp.o: base.o - $(LD) -r -o $@ $^ - -clean: - rm -f *.o - -endif diff --git a/zaptel/kernel/wcte12xp/base.c b/zaptel/kernel/wcte12xp/base.c deleted file mode 100644 index eff9ee16..00000000 --- a/zaptel/kernel/wcte12xp/base.c +++ /dev/null @@ -1,1762 +0,0 @@ -/* - * Digium, Inc. Wildcard TE12xP T1/E1 card Driver - * - * Written by Michael Spiceland - * - * Adapted from the wctdm24xxp and wcte11xp drivers originally - * written by Mark Spencer - * Matthew Fredrickson - * William Meadows - * - * Copyright (C) 2007-2008, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef LINUX26 -#include -#endif - -#include "zaptel.h" - -#include "../wct4xxp/wct4xxp.h" /* For certain definitions */ - -#include "../voicebus.h" -#include "wcte12xp.h" - -#if defined(VPM_SUPPORT) -#include "vpmadt032.h" -#include "GpakApi.h" -#endif - -struct pci_driver te12xp_driver; - -static int chanmap_t1[] = -{ 2,1,0, - 6,5,4, - 10,9,8, - 14,13,12, - 18,17,16, - 22,21,20, - 26,25,24, - 30,29,28 }; - -static int chanmap_e1[] = -{ 2,1,0, - 7,6,5,4, - 11,10,9,8, - 15,14,13,12, - 19,18,17,16, - 23,22,21,20, - 27,26,25,24, - 31,30,29,28 }; - -static int chanmap_e1uc[] = -{ 3,2,1,0, - 7,6,5,4, - 11,10,9,8, - 15,14,13,12, - 19,18,17,16, - 23,22,21,20, - 27,26,25,24, - 31,30,29,28 }; - -int debug = 0; -static int j1mode = 0; -static int alarmdebounce = 0; -static int loopback = 0; -static int t1e1override = -1; -static int unchannelized = 0; -static int latency = VOICEBUS_DEFAULT_LATENCY; -#ifdef VPM_SUPPORT -int vpmsupport = 1; -int vpmdtmfsupport = 0; -int vpmtsisupport = 0; -int vpmnlptype = 1; -int vpmnlpthresh = 24; -int vpmnlpmaxsupp = 0; -#endif - -struct t1 *ifaces[WC_MAX_IFACES]; -spinlock_t ifacelock = SPIN_LOCK_UNLOCKED; - -struct t1_desc { - char *name; - int flags; -}; - -static struct t1_desc te120p = { "Wildcard TE120P", 0 }; -static struct t1_desc te122 = { "Wildcard TE122", 0 }; -static struct t1_desc te121 = { "Wildcard TE121", 0 }; - -int schluffen(wait_queue_head_t *q) -{ - DECLARE_WAITQUEUE(wait, current); - add_wait_queue(q, &wait); - current->state = TASK_INTERRUPTIBLE; - if (!signal_pending(current)) schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(q, &wait); - if (signal_pending(current)) return -ERESTARTSYS; - return(0); -} - -static inline int empty_slot(struct t1 *wc) -{ - unsigned int x; - - for (x = 0; x < sizeof(wc->cmdq.cmds) / sizeof(wc->cmdq.cmds[0]); x++) { - if (!wc->cmdq.cmds[x].flags && !wc->cmdq.cmds[x].address) - return x; - } - return -1; -} - -static inline void cmd_dequeue(struct t1 *wc, volatile unsigned char *writechunk, int eframe, int slot) -{ - struct command *curcmd=NULL; - unsigned int x; - - /* Skip audio */ - writechunk += 66; - /* Search for something waiting to transmit */ - if ((slot < 6) && (eframe) && (eframe < ZT_CHUNKSIZE - 1)) { - /* only 6 useable cs slots per */ - - /* framer */ - for (x = 0; x < sizeof(wc->cmdq.cmds) / sizeof(wc->cmdq.cmds[0]); x++) { - if ((wc->cmdq.cmds[x].flags & (__CMD_RD | __CMD_WR | __CMD_LEDS | __CMD_PINS)) && - !(wc->cmdq.cmds[x].flags & (__CMD_TX | __CMD_FIN))) { - curcmd = &wc->cmdq.cmds[x]; - wc->cmdq.cmds[x].flags |= __CMD_TX; - wc->cmdq.cmds[x].ident = wc->txident; - break; - } - } - if (!curcmd) { - curcmd = &wc->dummy; - /* If nothing else, use filler */ - curcmd->address = 0x4a; - curcmd->data = 0x00; - curcmd->flags = __CMD_RD; - } - curcmd->cs_slot = slot; - if (curcmd->flags & __CMD_WR) - writechunk[CMD_BYTE(slot,0,0)] = 0x0c; /* 0c write command */ - else if (curcmd->flags & __CMD_LEDS) - writechunk[CMD_BYTE(slot,0,0)] = 0x10 | ((curcmd->address) & 0x0E); /* led set command */ - else if (curcmd->flags & __CMD_PINS) - writechunk[CMD_BYTE(slot,0,0)] = 0x30; /* CPLD2 pin state */ - else - writechunk[CMD_BYTE(slot,0,0)] = 0x0a; /* read command */ - writechunk[CMD_BYTE(slot,1,0)] = curcmd->address; - writechunk[CMD_BYTE(slot,2,0)] = curcmd->data; - } - -} - -static inline void cmd_decipher(struct t1 *wc, volatile unsigned char *readchunk) -{ - unsigned char ident, cs_slot; - unsigned int x; - unsigned int is_vpm = 0; - - /* Skip audio */ - readchunk += 66; - /* Search for any pending results */ - for (x = 0; x < sizeof(wc->cmdq.cmds) / sizeof(wc->cmdq.cmds[0]); x++) { - if ((wc->cmdq.cmds[x].flags & (__CMD_RD | __CMD_WR | __CMD_LEDS | __CMD_PINS)) && - (wc->cmdq.cmds[x].flags & (__CMD_TX)) && - !(wc->cmdq.cmds[x].flags & (__CMD_FIN))) { - ident = wc->cmdq.cmds[x].ident; - cs_slot = wc->cmdq.cmds[x].cs_slot; - - if (ident == wc->rxident) { - /* Store result */ - wc->cmdq.cmds[x].data |= readchunk[CMD_BYTE(cs_slot,2,is_vpm)]; - /*printk("answer in rxident=%d cs_slot=%d is %d CMD_BYTE=%d jiffies=%d\n", ident, cs_slot, last_read_command, CMD_BYTE(cs_slot, 2), jiffies); */ - wc->cmdq.cmds[x].flags |= __CMD_FIN; - if (wc->cmdq.cmds[x].flags & (__CMD_WR | __CMD_LEDS)) - /* clear out writes (and leds) since they need no ack */ - memset(&wc->cmdq.cmds[x], 0, sizeof(wc->cmdq.cmds[x])); - } - } - } -} - -static inline int t1_setreg_full(struct t1 *wc, int addr, int val, int inisr, int vpm_num) -{ - unsigned long flags; - int hit; - int ret; - - - do { - if (!inisr) - spin_lock_irqsave(&wc->reglock, flags); - hit = empty_slot(wc); - if (hit > -1) { - wc->cmdq.cmds[hit].address = addr; - wc->cmdq.cmds[hit].data = val; - wc->cmdq.cmds[hit].flags |= __CMD_WR; - if(vpm_num >= 0) { - wc->cmdq.cmds[hit].flags |= __CMD_VPM; - wc->cmdq.cmds[hit].vpm_num = vpm_num; - } - } - if (inisr) - break; - - spin_unlock_irqrestore(&wc->reglock, flags); - if (hit < 0) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit < 0); - - return (hit > -1) ? 0 : -1; -} - -static inline int t1_setreg(struct t1 *wc, int addr, int val) -{ - return t1_setreg_full(wc, addr, val, 0, NOT_VPM); -} - -/*************************************************************************** - * clean_leftovers() - * - * Check for unconsumed isr register reads and clean them up. - **************************************************************************/ -static inline void clean_leftovers(struct t1 *wc) -{ - unsigned int x; - int count = 0; - - /* find our requested command */ - for (x = 0; x < sizeof(wc->cmdq.cmds) / sizeof(wc->cmdq.cmds[0]); x++) { - if ((wc->cmdq.cmds[x].flags & __CMD_RD) && - (wc->cmdq.cmds[x].flags & __CMD_ISR) && - !(wc->cmdq.cmds[x].flags & __CMD_FIN)) { - debug_printk(1,"leftover isr read! %d", count); - memset(&wc->cmdq.cmds[x], 0, sizeof(wc->cmdq.cmds[x])); - } - } -} - -/******************************************************************** - * t1_getreg_isr() - * - * Called in interrupt context to retrieve a value already requested - * by the normal t1_getreg(). - *******************************************************************/ -static inline int t1_getreg_isr(struct t1 *wc, int addr) -{ - int hit=-1; - int ret; - unsigned int x; - - /* find our requested command */ - for (x = 0;x < sizeof(wc->cmdq.cmds) / sizeof(wc->cmdq.cmds[0]); x++) { - if ((wc->cmdq.cmds[x].flags & __CMD_RD) && - (wc->cmdq.cmds[x].address==addr)) - { - if (wc->cmdq.cmds[x].flags & __CMD_FIN) { - hit = x; - break; - } - else { - /* still in progress. */ - return -1; - } - } - } - - if (hit < 0) { - debug_printk(2, "t1_getreg_isr() no addr=%02x\n", addr); - return -1; /* oops, couldn't find it */ - } - - ret = wc->cmdq.cmds[hit].data; - memset(&wc->cmdq.cmds[hit], 0, sizeof(struct command)); - - return ret; -} - -static inline int t1_getreg_full(struct t1 *wc, int addr, int inisr, int vpm_num) -{ - unsigned long flags; - int hit; - int ret = 0; - - do { - if (!inisr) { - spin_lock_irqsave(&wc->reglock, flags); - } - hit = empty_slot(wc); - if (hit > -1) { - wc->cmdq.cmds[hit].address = addr; - wc->cmdq.cmds[hit].data = 0x00; - wc->cmdq.cmds[hit].flags |= __CMD_RD; - if(vpm_num >= 0) { - wc->cmdq.cmds[hit].flags |= __CMD_VPM; - wc->cmdq.cmds[hit].vpm_num = vpm_num; - } - if (inisr) - wc->cmdq.cmds[hit].flags |= __CMD_ISR; - } - if (inisr) /* must be requested in t1_getreg_isr() */ - return (hit > -1) ? 0 : -1; - else { - spin_unlock_irqrestore(&wc->reglock, flags); - } - if (hit < 0) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit < 0); - - do { - spin_lock_irqsave(&wc->reglock, flags); - if (wc->cmdq.cmds[hit].flags & __CMD_FIN) { - ret = wc->cmdq.cmds[hit].data; - memset(&wc->cmdq.cmds[hit], 0, sizeof(wc->cmdq.cmds[hit])); - hit = -1; - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (hit > -1) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit > -1); - - return ret; -} - -static inline int t1_getreg(struct t1 *wc, int addr, int inisr) -{ - return t1_getreg_full(wc, addr, inisr, NOT_VPM); -} - -static inline int t1_setleds(struct t1 *wc, int leds, int inisr) -{ - unsigned long flags; - int hit; - int ret = 0; - - leds = ~leds & 0x0E; /* invert the LED bits (3 downto 1)*/ - - do { - if (!inisr) { - spin_lock_irqsave(&wc->reglock, flags); - } - hit = empty_slot(wc); - if (hit > -1) { - wc->cmdq.cmds[hit].flags |= __CMD_LEDS; - wc->cmdq.cmds[hit].address = leds; - } - if (inisr) { - break; - } else { - spin_unlock_irqrestore(&wc->reglock, flags); - } - if (hit < 0) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit < 0); - - return (hit > -1) ? 0 : -1; -} - -static inline int t1_getpins(struct t1 *wc, int inisr) -{ - unsigned long flags; - int hit; - int ret = 0; - - do { - spin_lock_irqsave(&wc->reglock, flags); - hit = empty_slot(wc); - if (hit > -1) { - wc->cmdq.cmds[hit].address = 0x00; - wc->cmdq.cmds[hit].data = 0x00; - wc->cmdq.cmds[hit].flags |= __CMD_PINS; - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (inisr) - return (hit > -1) ? 0 : -1; - if (hit < 0) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit < 0); - - do { - spin_lock_irqsave(&wc->reglock, flags); - if (wc->cmdq.cmds[hit].flags & __CMD_FIN) { - ret = wc->cmdq.cmds[hit].data; - memset(&wc->cmdq.cmds[hit], 0, sizeof(wc->cmdq.cmds[hit])); - hit = -1; - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (hit > -1) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (hit > -1); - - return ret; -} - -static void __t1xxp_set_clear(struct t1 *wc, int channo) -{ - int i,j; - int ret; - unsigned short val=0; - - for (i = 0; i < 24; i++) { - j = (i / 8); - if (wc->span.chans[i].flags & ZT_FLAG_CLEAR) - val |= 1 << (7 - (i % 8)); - if (((i % 8)==7) && /* write byte every 8 channels */ - ((channo < 0) || /* channo=-1 means all channels */ - (j == (channo-1)/8) )) { /* only the register for this channo */ - ret = t1_setreg_full(wc, 0x2f + j, val, 1, NOT_VPM); - if (ret < 0) - module_printk("set_clear failed for chan %d!\n",i); - val = 0; - } - } -} - -static void t1_release(struct t1 *wc) -{ - zt_unregister(&wc->span); - kfree(wc); - printk("Freed a Wildcard TE12xP\n"); -} - -static void t4_serial_setup(struct t1 *wc) -{ - module_printk("Setting up global serial parameters for %s\n", - wc->spantype == TYPE_E1 ? (unchannelized ? "Unchannelized 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 */ - - /* Global clocks (8.192 Mhz CLK) */ - t1_setreg(wc, 0x92, 0x00); - t1_setreg(wc, 0x93, 0x18); - t1_setreg(wc, 0x94, 0xfb); - t1_setreg(wc, 0x95, 0x0b); - t1_setreg(wc, 0x96, 0x00); - t1_setreg(wc, 0x97, 0x0b); - t1_setreg(wc, 0x98, 0xdb); - t1_setreg(wc, 0x99, 0xdf); - - /* Configure interrupts */ - t1_setreg(wc, 0x46, 0xc0); /* GCR: Interrupt on Activation/Deactivation of AIX, LOS */ - - /* Configure system interface */ - t1_setreg(wc, 0x3e, 0x0a /* 0x02 */); /* SIC1: 4.096 Mhz clock/bus, double buffer receive / transmit, byte interleaved */ - t1_setreg(wc, 0x3f, 0x00); /* SIC2: No FFS, no center receive eliastic buffer, phase 0 */ - t1_setreg(wc, 0x40, 0x04); /* SIC3: Edges for capture */ - t1_setreg(wc, 0x44, 0x30); /* CMR1: RCLK is at 8.192 Mhz dejittered */ - t1_setreg(wc, 0x45, 0x00); /* CMR2: We provide sync and clock for tx and rx. */ - t1_setreg(wc, 0x22, 0x00); /* XC0: Normal operation of Sa-bits */ - t1_setreg(wc, 0x23, 0x04); /* XC1: 0 offset */ - t1_setreg(wc, 0x24, 0x00); /* RC0: Just shy of 255 */ - t1_setreg(wc, 0x25, 0x05); /* RC1: The rest of RC0 */ - - /* Configure ports */ - t1_setreg(wc, 0x80, 0x00); /* PC1: SPYR/SPYX input on RPA/XPA */ - t1_setreg(wc, 0x81, 0x22); /* PC2: RMFB/XSIG output/input on RPB/XPB */ - t1_setreg(wc, 0x82, 0x65); /* PC3: Some unused stuff */ - t1_setreg(wc, 0x83, 0x35); /* PC4: Some more unused stuff */ - t1_setreg(wc, 0x84, 0x31); /* PC5: XMFS active low, SCLKR is input, RCLK is output */ - t1_setreg(wc, 0x86, 0x03); /* PC6: CLK1 is Tx Clock output, CLK2 is 8.192 Mhz from DCO-R */ - t1_setreg(wc, 0x3b, 0x00); /* Clear LCR1 */ -} - -static void t1_configure_t1(struct t1 *wc, int lineconfig, int txlevel) -{ - unsigned int fmr4, fmr2, fmr1, fmr0, lim2; - char *framing, *line; - int mytxlevel; - - if ((txlevel > 7) || (txlevel < 4)) - mytxlevel = 0; - else - mytxlevel = txlevel - 4; - fmr1 = 0x9e; /* FMR1: Mode 0, T1 mode, CRC on for ESF, 2.048 Mhz system data rate, no XAIS */ - fmr2 = 0x22; /* FMR2: no payload loopback, auto send yellow alarm */ - if (loopback) - fmr2 |= 0x4; - - if (j1mode) - fmr4 = 0x1c; - else - fmr4 = 0x0c; /* FMR4: Lose sync on 2 out of 5 framing bits, auto resync */ - - lim2 = 0x21; /* LIM2: 50% peak is a "1", Advanced Loss recovery */ - lim2 |= (mytxlevel << 6); /* LIM2: Add line buildout */ - t1_setreg(wc, 0x1d, fmr1); - t1_setreg(wc, 0x1e, fmr2); - - /* Configure line interface */ - if (lineconfig & ZT_CONFIG_AMI) { - line = "AMI"; - fmr0 = 0xa0; - } else { - line = "B8ZS"; - fmr0 = 0xf0; - } - if (lineconfig & ZT_CONFIG_D4) { - framing = "D4"; - } else { - framing = "ESF"; - fmr4 |= 0x2; - fmr2 |= 0xc0; - } - t1_setreg(wc, 0x1c, fmr0); - - t1_setreg(wc, 0x20, fmr4); - t1_setreg(wc, 0x21, 0x40); /* FMR5: Enable RBS mode */ - - t1_setreg(wc, 0x37, 0xf8); /* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */ - t1_setreg(wc, 0x36, 0x08); /* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */ - - t1_setreg(wc, 0x02, 0x50); /* CMDR: Reset the receiver and transmitter line interface */ - t1_setreg(wc, 0x02, 0x00); /* CMDR: Reset the receiver and transmitter line interface */ - - t1_setreg(wc, 0x3a, lim2); /* LIM2: 50% peak amplitude is a "1" */ - t1_setreg(wc, 0x38, 0x0a); /* PCD: LOS after 176 consecutive "zeros" */ - t1_setreg(wc, 0x39, 0x15); /* PCR: 22 "ones" clear LOS */ - - if (j1mode) - t1_setreg(wc, 0x24, 0x80); /* J1 overide */ - - /* Generate pulse mask for T1 */ - switch (mytxlevel) { - case 3: - t1_setreg(wc, 0x26, 0x07); /* XPM0 */ - t1_setreg(wc, 0x27, 0x01); /* XPM1 */ - t1_setreg(wc, 0x28, 0x00); /* XPM2 */ - break; - case 2: - t1_setreg(wc, 0x26, 0x8c); /* XPM0 */ - t1_setreg(wc, 0x27, 0x11); /* XPM1 */ - t1_setreg(wc, 0x28, 0x01); /* XPM2 */ - break; - case 1: - t1_setreg(wc, 0x26, 0x8c); /* XPM0 */ - t1_setreg(wc, 0x27, 0x01); /* XPM1 */ - t1_setreg(wc, 0x28, 0x00); /* XPM2 */ - break; - case 0: - default: - t1_setreg(wc, 0x26, 0xd7); /* XPM0 */ - t1_setreg(wc, 0x27, 0x22); /* XPM1 */ - t1_setreg(wc, 0x28, 0x01); /* XPM2 */ - break; - } - - module_printk("Span configured for %s/%s\n", framing, line); -} - -static void t1_configure_e1(struct t1 *wc, int lineconfig) -{ - unsigned int fmr2, fmr1, fmr0; - unsigned int cas = 0; - char *crc4 = ""; - char *framing, *line; - - fmr1 = 0x46; /* FMR1: E1 mode, Automatic force resync, PCM30 mode, 8.192 Mhz backplane, no XAIS */ - fmr2 = 0x03; /* FMR2: Auto transmit remote alarm, auto loss of multiframe recovery, no payload loopback */ - if (unchannelized) - fmr2 |= 0x30; - if (loopback) - fmr2 |= 0x4; - if (lineconfig & ZT_CONFIG_CRC4) { - fmr1 |= 0x08; /* CRC4 transmit */ - fmr2 |= 0xc0; /* CRC4 receive */ - crc4 = "/CRC4"; - } - t1_setreg(wc, 0x1d, fmr1); - t1_setreg(wc, 0x1e, fmr2); - - /* Configure line interface */ - if (lineconfig & ZT_CONFIG_AMI) { - line = "AMI"; - fmr0 = 0xa0; - } else { - line = "HDB3"; - fmr0 = 0xf0; - } - if (lineconfig & ZT_CONFIG_CCS) { - framing = "CCS"; - } else { - framing = "CAS"; - cas = 0x40; - } - t1_setreg(wc, 0x1c, fmr0); - - if (unchannelized) - t1_setreg(wc, 0x1f, 0x40); - - t1_setreg(wc, 0x37, 0xf0 /*| 0x6 */ ); /* LIM1: Clear data in case of LOS, Set receiver threshold (0.5V), No remote loop, no DRS */ - t1_setreg(wc, 0x36, 0x08); /* LIM0: Enable auto long haul mode, no local loop (must be after LIM1) */ - - t1_setreg(wc, 0x02, 0x50); /* CMDR: Reset the receiver and transmitter line interface */ - t1_setreg(wc, 0x02, 0x00); /* CMDR: Reset the receiver and transmitter line interface */ - - /* Condition receive line interface for E1 after reset */ - t1_setreg(wc, 0xbb, 0x17); - t1_setreg(wc, 0xbc, 0x55); - t1_setreg(wc, 0xbb, 0x97); - t1_setreg(wc, 0xbb, 0x11); - t1_setreg(wc, 0xbc, 0xaa); - t1_setreg(wc, 0xbb, 0x91); - t1_setreg(wc, 0xbb, 0x12); - t1_setreg(wc, 0xbc, 0x55); - t1_setreg(wc, 0xbb, 0x92); - t1_setreg(wc, 0xbb, 0x0c); - t1_setreg(wc, 0xbb, 0x00); - t1_setreg(wc, 0xbb, 0x8c); - - t1_setreg(wc, 0x3a, 0x20); /* LIM2: 50% peak amplitude is a "1" */ - t1_setreg(wc, 0x38, 0x0a); /* PCD: LOS after 176 consecutive "zeros" */ - t1_setreg(wc, 0x39, 0x15); /* PCR: 22 "ones" clear LOS */ - - t1_setreg(wc, 0x20, 0x9f); /* XSW: Spare bits all to 1 */ - if (unchannelized) - t1_setreg(wc, 0x21, 0x3c); - else - t1_setreg(wc, 0x21, 0x1c|cas); /* XSP: E-bit set when async. AXS auto, XSIF to 1 */ - - - /* Generate pulse mask for E1 */ - t1_setreg(wc, 0x26, 0x54); /* XPM0 */ - t1_setreg(wc, 0x27, 0x02); /* XPM1 */ - t1_setreg(wc, 0x28, 0x00); /* XPM2 */ - module_printk("Span configured for %s/%s%s\n", framing, line, crc4); -} - -static void t1xxp_framer_start(struct t1 *wc, struct zt_span *span) -{ - int alreadyrunning = wc->span.flags & ZT_FLAG_RUNNING; - unsigned long flags; - - if (wc->spantype == TYPE_E1) { /* if this is an E1 card */ - t1_configure_e1(wc, span->lineconfig); - } else { /* is a T1 card */ - t1_configure_t1(wc, span->lineconfig, span->txlevel); - __t1xxp_set_clear(wc, -1); - } - - spin_lock_irqsave(&wc->reglock, flags); - if (!alreadyrunning) - wc->span.flags |= ZT_FLAG_RUNNING; - spin_unlock_irqrestore(&wc->reglock, flags); -} - -static int t1xxp_startup(struct zt_span *span) -{ - struct t1 *wc = span->pvt; - int i; - - /* initialize the start value for the entire chunk of last ec buffer */ - for (i = 0; i < span->channels; i++) { - memset(wc->ec_chunk1[i], ZT_LIN2X(0, &span->chans[i]), ZT_CHUNKSIZE); - memset(wc->ec_chunk2[i], ZT_LIN2X(0, &span->chans[i]), ZT_CHUNKSIZE); - } - - /* Reset framer with proper parameters and start */ - t1xxp_framer_start(wc, span); - debug_printk(1, "Calling startup (flags is %d)\n", span->flags); - - return 0; -} - -static int t1xxp_shutdown(struct zt_span *span) -{ - struct t1 *wc = span->pvt; - unsigned long flags; - - t1_setreg(wc, 0x46, 0x41); /* GCR: Interrupt on Activation/Deactivation of AIX, LOS */ - spin_lock_irqsave(&wc->reglock, flags); - span->flags &= ~ZT_FLAG_RUNNING; - spin_unlock_irqrestore(&wc->reglock, flags); - return 0; -} - -static int t1xxp_chanconfig(struct zt_chan *chan, int sigtype) -{ - struct t1 *wc = chan->pvt; - int alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING; - - if (alreadyrunning && (wc->spantype != TYPE_E1)) - __t1xxp_set_clear(wc, chan->channo); - - return 0; -} - -static int t1xxp_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - struct t1 *wc = span->pvt; - - /* Do we want to SYNC on receive or not */ - wc->sync = lc->sync; - if (wc->sync) - wc->ctlreg |= 0x80; - else - wc->ctlreg &= ~0x80; - - /* If already running, apply changes immediately */ - if (span->flags & ZT_FLAG_RUNNING) - return t1xxp_startup(span); - - return 0; -} - -static int t1xxp_rbsbits(struct zt_chan *chan, int bits) -{ - u_char m,c; - int n,b; - struct t1 *wc = chan->pvt; - unsigned long flags; - - debug_printk(2, "Setting bits to %d on channel %s\n", bits, chan->name); - if (wc->spantype == TYPE_E1) { /* do it E1 way */ - if (chan->chanpos == 16) - return 0; - - n = chan->chanpos - 1; - if (chan->chanpos > 15) n--; - b = (n % 15); - spin_lock_irqsave(&wc->reglock, flags); - c = wc->txsigs[b]; - m = (n / 15) << 2; /* nibble selector */ - c &= (0xf << m); /* keep the other nibble */ - c |= (bits & 0xf) << (4 - m); /* put our new nibble here */ - wc->txsigs[b] = c; - spin_unlock_irqrestore(&wc->reglock, flags); - /* output them to the chip */ - t1_setreg_full(wc,0x71 + b,c,1,NOT_VPM); - } else if (wc->span.lineconfig & ZT_CONFIG_D4) { - n = chan->chanpos - 1; - b = (n / 4); - spin_lock_irqsave(&wc->reglock, flags); - c = wc->txsigs[b]; - m = ((3 - (n % 4)) << 1); /* nibble selector */ - c &= ~(0x3 << m); /* keep the other nibble */ - c |= ((bits >> 2) & 0x3) << m; /* put our new nibble here */ - wc->txsigs[b] = c; - spin_unlock_irqrestore(&wc->reglock, flags); - /* output them to the chip */ - t1_setreg_full(wc,0x70 + b,c,1,NOT_VPM); - t1_setreg_full(wc,0x70 + b + 6,c,1,NOT_VPM); - } else if (wc->span.lineconfig & ZT_CONFIG_ESF) { - n = chan->chanpos - 1; - b = (n / 2); - spin_lock_irqsave(&wc->reglock, flags); - c = wc->txsigs[b]; - m = ((n % 2) << 2); /* nibble selector */ - c &= (0xf << m); /* keep the other nibble */ - c |= (bits & 0xf) << (4 - m); /* put our new nibble here */ - wc->txsigs[b] = c; - spin_unlock_irqrestore(&wc->reglock, flags); - /* output them to the chip */ - t1_setreg_full(wc,0x70 + b,c,1,NOT_VPM); - } - debug_printk(2,"Finished setting RBS bits\n"); - - return 0; -} - -static inline void __t1_check_sigbits_reads(struct t1 *wc) -{ - int i; - - if (!(wc->span.flags & ZT_FLAG_RUNNING)) - return; - if (wc->spantype == TYPE_E1) { - for (i = 0; i < 15; i++) { - if (t1_getreg(wc, 0x71 + i, 1)) - wc->isrreaderrors++; - } - } else if (wc->span.lineconfig & ZT_CONFIG_D4) { - for (i = 0; i < 24; i+=4) { - if (t1_getreg(wc, 0x70 + (i >> 2), 1)) - wc->isrreaderrors++; - } - } else { - for (i = 0; i < 24; i+=2) { - if (t1_getreg(wc, 0x70 + (i >> 1), 1)) - wc->isrreaderrors++; - } - } -} - -static inline void __t1_check_sigbits(struct t1 *wc) -{ - int a,i,rxs; - - if (!(wc->span.flags & ZT_FLAG_RUNNING)) - return; - if (wc->spantype == TYPE_E1) { - for (i = 0; i < 15; i++) { - a = t1_getreg_isr(wc, 0x71 + i); - if (a > -1) { - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(wc->span.chans[i+16].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+16].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i+16], rxs); - spin_lock(&wc->reglock); - } - } - rxs = (a >> 4) & 0xf; - if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i], rxs); - spin_lock(&wc->reglock); - } - } - } - } - } else if (wc->span.lineconfig & ZT_CONFIG_D4) { - for (i = 0; i < 24; i+=4) { - a = t1_getreg_isr(wc, 0x70 + (i>>2)); - if (a > -1) { - /* Get high channel in low bits */ - rxs = (a & 0x3) << 2; - if (!(wc->span.chans[i+3].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+3].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i+3], rxs); - spin_lock(&wc->reglock); - } - } - rxs = (a & 0xc); - if (!(wc->span.chans[i+2].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+2].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i+2], rxs); - spin_lock(&wc->reglock); - } - } - rxs = (a >> 2) & 0xc; - if (!(wc->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+1].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i+1], rxs); - spin_lock(&wc->reglock); - } - } - rxs = (a >> 4) & 0xc; - if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i], rxs); - spin_lock(&wc->reglock); - } - } - } - } - } else { - for (i = 0; i < 24; i+=2) { - a = t1_getreg_isr(wc, 0x70 + (i>>1)); - if (a > -1) { - /* Get high channel in low bits */ - rxs = (a & 0xf); - if (!(wc->span.chans[i+1].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i+1].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i+1], rxs); - spin_lock(&wc->reglock); - } - } - rxs = (a >> 4) & 0xf; - if (!(wc->span.chans[i].sig & ZT_SIG_CLEAR)) { - if (wc->span.chans[i].rxsig != rxs) { - spin_unlock(&wc->reglock); - zt_rbsbits(&wc->span.chans[i], rxs); - spin_lock(&wc->reglock); - } - } - } - } - } -} - -static int t1xxp_maint(struct zt_span *span, int cmd) -{ - struct t1 *wc = span->pvt; - - if (wc->spantype == TYPE_E1) { - switch (cmd) { - case ZT_MAINT_NONE: - module_printk("XXX Turn off local and remote loops E1 XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - module_printk("XXX Turn on local loopback E1 XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - module_printk("XXX Turn on remote loopback E1 XXX\n"); - break; - case ZT_MAINT_LOOPUP: - module_printk("XXX Send loopup code E1 XXX\n"); - break; - case ZT_MAINT_LOOPDOWN: - module_printk("XXX Send loopdown code E1 XXX\n"); - break; - case ZT_MAINT_LOOPSTOP: - module_printk("XXX Stop sending loop codes E1 XXX\n"); - break; - default: - module_printk("Unknown E1 maint command: %d\n", cmd); - break; - } - } else { - switch (cmd) { - case ZT_MAINT_NONE: - module_printk("XXX Turn off local and remote loops T1 XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - module_printk("XXX Turn on local loop and no remote loop XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - module_printk("XXX Turn on remote loopup XXX\n"); - break; - case ZT_MAINT_LOOPUP: - t1_setreg(wc, 0x21, 0x50); /* FMR5: Nothing but RBS mode */ - break; - case ZT_MAINT_LOOPDOWN: - t1_setreg(wc, 0x21, 0x60); /* FMR5: Nothing but RBS mode */ - break; - case ZT_MAINT_LOOPSTOP: - t1_setreg(wc, 0x21, 0x40); /* FMR5: Nothing but RBS mode */ - break; - default: - module_printk("Unknown T1 maint command: %d\n", cmd); - break; - } - } - - return 0; -} - -static int t1xxp_open(struct zt_chan *chan) -{ - struct t1 *wc = chan->pvt; - - if (wc->dead) - return -ENODEV; - wc->usecount++; - -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - try_module_get(THIS_MODULE); -#endif - - return 0; -} - -static int t1xxp_close(struct zt_chan *chan) -{ - struct t1 *wc = chan->pvt; - - wc->usecount--; - -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - - /* If we're dead, release us now */ - if (!wc->usecount && wc->dead) - t1_release(wc); - - return 0; -} - -static int t1xxp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) -{ - unsigned int x; - struct t1 *wc = chan->pvt; - - switch (cmd) { - case WCT4_GET_REGS: - /* Since all register access was moved into the voicebus - * module....this was removed. Although...why does the client - * library need access to the registers (debugging)? \todo .. - */ - WARN_ON(1); - return -ENOSYS; - break; -#ifdef VPM_SUPPORT - case ZT_TONEDETECT: - if (get_user(x, (int *) data)) - return -EFAULT; - if (!wc->vpm150m) - return -ENOSYS; - if (wc->vpm150m && (x && !vpmdtmfsupport)) - return -ENOSYS; - if (x & ZT_TONEDETECT_ON) { - set_bit(chan->chanpos - 1, &wc->dtmfmask); - module_printk("turning on tone detection\n"); - } else { - clear_bit(chan->chanpos - 1, &wc->dtmfmask); - module_printk("turning off tone detection\n"); - } - if (x & ZT_TONEDETECT_MUTE) { - if(wc->vpm150m) - set_bit(chan->chanpos - 1, &wc->vpm150m->desireddtmfmutestate); - } else { - if(wc->vpm150m) - clear_bit(chan->chanpos - 1, &wc->vpm150m->desireddtmfmutestate); - } - return 0; -#endif - default: - return -ENOTTY; - } - return 0; -} - -#ifdef VPM_SUPPORT - -#include "adt_lec.c" - -static int t1xxp_echocan_with_params(struct zt_chan *chan, struct zt_echocanparams *ecp, struct zt_echocanparam *p) -{ - struct adt_lec_params params; - struct t1 *wc = chan->pvt; - struct vpm150m *vpm150m = wc->vpm150m; - unsigned long flags; - struct vpm150m_workentry *work; - unsigned int ret; - - if (!wc->vpm150m) - return -ENODEV; - - adt_lec_init_defaults(¶ms, 32); - - if ((ret = adt_lec_parse_params(¶ms, ecp, p))) - return ret; - - /* we can't really control the tap length, but the value is used - to control whether the ec is on or off, so translate it */ - params.tap_length = ecp->tap_length ? 1 : 0; - - if (!(work = kmalloc(sizeof(*work), GFP_KERNEL))) - return -ENOMEM; - - work->params = params; - work->wc = wc; - work->chan = chan; - spin_lock_irqsave(&vpm150m->lock, flags); - list_add_tail(&work->list, &vpm150m->worklist); - spin_unlock_irqrestore(&vpm150m->lock, flags); - - /* we must do this later since we cannot sleep in the echocan function */ - if (test_bit(VPM150M_ACTIVE, &vpm150m->control)) - queue_work(vpm150m->wq, &vpm150m->work_echocan); - - return 0; /* how do I return the status since it is done later by the workqueue? */ -} -#endif - -static int t1_software_init(struct t1 *wc) -{ - int x; - struct pci_dev* dev; - - dev = voicebus_get_pci_dev(wc->vb); - - /* Find position */ - for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) { - if (ifaces[x] == wc) { - debug_printk(1, "software init for card %d\n",x); - break; - } - } - - if (x == sizeof(ifaces) / sizeof(ifaces[0])) - return -1; - - 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"; - strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1); - -#if defined(VPM_SUPPORT) - if (wc->vpm150m) - strncat(wc->span.devicetype, " with VPMADT032", sizeof(wc->span.devicetype) - 1); -#endif - - snprintf(wc->span.location, sizeof(wc->span.location) - 1, - "PCI Bus %02d Slot %02d", dev->bus->number, PCI_SLOT(dev->devfn) + 1); - - wc->span.spanconfig = t1xxp_spanconfig; - wc->span.chanconfig = t1xxp_chanconfig; - wc->span.irq = dev->irq; - wc->span.startup = t1xxp_startup; - wc->span.shutdown = t1xxp_shutdown; - wc->span.rbsbits = t1xxp_rbsbits; - wc->span.maint = t1xxp_maint; - wc->span.open = t1xxp_open; - wc->span.close = t1xxp_close; - wc->span.ioctl = t1xxp_ioctl; -#ifdef VPM_SUPPORT - wc->span.echocan_with_params = t1xxp_echocan_with_params; -#endif - - if (wc->spantype == TYPE_E1) { - if (unchannelized) - wc->span.channels = 32; - else - wc->span.channels = 31; - wc->span.spantype = "E1"; - wc->span.linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4; - wc->span.deflaw = ZT_LAW_ALAW; - } else { - wc->span.channels = 24; - wc->span.spantype = "T1"; - wc->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF; - wc->span.deflaw = ZT_LAW_MULAW; - } - wc->span.chans = wc->chans; - wc->span.flags = ZT_FLAG_RBS; - wc->span.pvt = wc; - init_waitqueue_head(&wc->span.maintq); - for (x = 0; x < wc->span.channels; x++) { - sprintf(wc->chans[x].name, "WCT1/%d/%d", wc->num, x + 1); - wc->chans[x].sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_EM_E1 | - ZT_SIG_FXSLS | ZT_SIG_FXSGS | ZT_SIG_MTP2 | - ZT_SIG_FXSKS | ZT_SIG_FXOLS | ZT_SIG_DACS_RBS | - ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_SF; - wc->chans[x].pvt = wc; - wc->chans[x].chanpos = x + 1; - } - if (zt_register(&wc->span, 0)) { - module_printk("Unable to register span with Zaptel\n"); - return -1; - } - wc->initialized = 1; - - return 0; -} - -#ifdef VPM_SUPPORT -static inline unsigned char t1_vpm_in(struct t1 *wc, int unit, const unsigned int addr) -{ - return t1_getreg_full(wc, addr, 0, unit); -} - -static inline unsigned char t1_vpm_out(struct t1 *wc, int unit, const unsigned int addr, const unsigned char val) -{ - return t1_setreg_full(wc, addr, val, 0, unit); -} - -#endif - -static int t1_hardware_post_init(struct t1 *wc) -{ - unsigned int reg; - int x; - - /* T1 or E1 */ - if (t1e1override > -1) { - if (t1e1override) - wc->spantype = TYPE_E1; - else - wc->spantype = TYPE_T1; - } else { - if (t1_getpins(wc,0) & 0x01) /* returns 1 for T1 mode */ - wc->spantype = TYPE_T1; - else - wc->spantype = TYPE_E1; - } - debug_printk(1, "spantype: %s\n", wc->spantype==1 ? "T1" : "E1"); - - if (wc->spantype == TYPE_E1) { - if (unchannelized) - wc->chanmap = chanmap_e1uc; - else - wc->chanmap = chanmap_e1; - } else - wc->chanmap = chanmap_t1; - /* what version of the FALC are we using? */ - reg = t1_setreg(wc, 0x4a, 0xaa); - reg = t1_getreg(wc, 0x4a, 0); - debug_printk(1, "FALC version: %08x\n", reg); - - /* make sure reads and writes work */ - for (x = 0; x < 256; x++) { - t1_setreg(wc, 0x14, x); - if ((reg = t1_getreg(wc, 0x14, 0)) != x) - module_printk("Wrote '%x' but read '%x'\n", x, reg); - } - - /* all LED's blank */ - wc->ledtestreg = UNSET_LED_ORANGE(wc->ledtestreg); - wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg); - t1_setleds(wc, wc->ledtestreg, 0); - -#ifdef VPM_SUPPORT - t1_vpm150m_init(wc); - if (wc->vpm150m) { - module_printk("VPM present and operational (Firmware version %x)\n", wc->vpm150m->version); - wc->ctlreg |= 0x10; /* turn on vpm (RX audio from vpm module) */ - if (vpmtsisupport) { - debug_printk(1, "enabling VPM TSI pin\n"); - wc->ctlreg |= 0x01; /* turn on vpm timeslot interchange pin */ - } - } -#endif - - return 0; -} - -static inline void __t1_check_alarms_reads(struct t1 *wc) -{ - if (!(wc->span.flags & ZT_FLAG_RUNNING)) - return; - - if (t1_getreg(wc, 0x4c, 1)) - wc->isrreaderrors++; - if (t1_getreg(wc, 0x20, 1)) - wc->isrreaderrors++; - if (t1_getreg(wc, 0x4d, 1)) - wc->isrreaderrors++; -} - -static inline void __t1_check_alarms(struct t1 *wc) -{ - unsigned char c,d; - int alarms; - int x,j; - unsigned char fmr4; /* must read this always */ - - if (!(wc->span.flags & ZT_FLAG_RUNNING)) - return; - - c = t1_getreg_isr(wc, 0x4c); - fmr4 = t1_getreg_isr(wc, 0x20); /* must read this even if we don't use it */ - d = t1_getreg_isr(wc, 0x4d); - - /* Assume no alarms */ - alarms = 0; - - /* And consider only carrier alarms */ - wc->span.alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN); - - if (wc->spantype == TYPE_E1) { - if (c & 0x04) { - /* No multiframe found, force RAI high after 400ms only if - we haven't found a multiframe since last loss - of frame */ - if (!wc->flags.nmf) { - t1_setreg_full(wc, 0x20, 0x9f | 0x20, 1, NOT_VPM); /* LIM0: Force RAI High */ - wc->flags.nmf = 1; - module_printk("NMF workaround on!\n"); - } - t1_setreg_full(wc, 0x1e, 0xc3, 1, NOT_VPM); /* Reset to CRC4 mode */ - t1_setreg_full(wc, 0x1c, 0xf2, 1, NOT_VPM); /* Force Resync */ - t1_setreg_full(wc, 0x1c, 0xf0, 1, NOT_VPM); /* Force Resync */ - } else if (!(c & 0x02)) { - if (wc->flags.nmf) { - t1_setreg_full(wc, 0x20, 0x9f, 1, NOT_VPM); /* LIM0: Clear forced RAI */ - wc->flags.nmf = 0; - module_printk("NMF workaround off!\n"); - } - } - } else { - /* Detect loopup code if we're not sending one */ - if ((!wc->span.mainttimer) && (d & 0x08)) { - /* Loop-up code detected */ - if ((wc->loopupcnt++ > 80) && (wc->span.maintstat != ZT_MAINT_REMOTELOOP)) { - t1_setreg_full(wc, 0x36, 0x08, 1, NOT_VPM); /* LIM0: Disable any local loop */ - t1_setreg_full(wc, 0x37, 0xf6, 1, NOT_VPM); /* LIM1: Enable remote loop */ - wc->span.maintstat = ZT_MAINT_REMOTELOOP; - } - } else - wc->loopupcnt = 0; - /* Same for loopdown code */ - if ((!wc->span.mainttimer) && (d & 0x10)) { - /* Loop-down code detected */ - if ((wc->loopdowncnt++ > 80) && (wc->span.maintstat == ZT_MAINT_REMOTELOOP)) { - t1_setreg_full(wc, 0x36, 0x08, 1, NOT_VPM); /* LIM0: Disable any local loop */ - t1_setreg_full(wc, 0x37, 0xf0, 1, NOT_VPM); /* LIM1: Disable remote loop */ - wc->span.maintstat = ZT_MAINT_NONE; - } - } else - wc->loopdowncnt = 0; - } - - if (wc->span.lineconfig & ZT_CONFIG_NOTOPEN) { - for (x=0,j=0;x < wc->span.channels;x++) - if ((wc->span.chans[x].flags & ZT_FLAG_OPEN) || - (wc->span.chans[x].flags & ZT_FLAG_NETDEV)) - j++; - if (!j) - alarms |= ZT_ALARM_NOTOPEN; - } - - if (c & 0xa0) { - if (wc->alarmcount >= alarmdebounce) { - if (!unchannelized) - alarms |= ZT_ALARM_RED; - } else - wc->alarmcount++; - } else - wc->alarmcount = 0; - if (c & 0x4) - alarms |= ZT_ALARM_BLUE; - - /* Keep track of recovering */ - if ((!alarms) && wc->span.alarms) - wc->alarmtimer = ZT_ALARMSETTLE_TIME; - if (wc->alarmtimer) - alarms |= ZT_ALARM_RECOVER; - - /* If receiving alarms, go into Yellow alarm state */ - if (alarms && !wc->flags.sendingyellow) { - module_printk("Setting yellow alarm\n"); - - /* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */ - t1_setreg_full(wc, 0x20, fmr4 | 0x20, 1, NOT_VPM); - wc->flags.sendingyellow = 1; - } else if (!alarms && wc->flags.sendingyellow) { - module_printk("Clearing yellow alarm\n"); - /* We manually do yellow alarm to handle RECOVER */ - t1_setreg_full(wc, 0x20, fmr4 & ~0x20, 1, NOT_VPM); - wc->flags.sendingyellow = 0; - } - - if ((c & 0x10) && !unchannelized) - alarms |= ZT_ALARM_YELLOW; - if (wc->span.mainttimer || wc->span.maintstat) - alarms |= ZT_ALARM_LOOPBACK; - wc->span.alarms = alarms; - spin_unlock(&wc->reglock); - zt_alarm_notify(&wc->span); - spin_lock(&wc->reglock); -} - -static inline void __handle_leds(struct t1 *wc) -{ - if (wc->span.alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE)) { - wc->blinktimer++; - if (wc->blinktimer == 160) - wc->ledtestreg = SET_LED_RED(wc->ledtestreg); - if (wc->blinktimer == 480) { - wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg); - wc->blinktimer = 0; - } - } else if (wc->span.alarms & ZT_ALARM_YELLOW) { - wc->yellowtimer++; - if (!(wc->yellowtimer % 2)) - wc->ledtestreg = SET_LED_RED(wc->ledtestreg); - else - wc->ledtestreg = SET_LED_GREEN(wc->ledtestreg); - } else { - if (wc->span.maintstat != ZT_MAINT_NONE) - wc->ledtestreg = SET_LED_ORANGE(wc->ledtestreg); - else - wc->ledtestreg = UNSET_LED_ORANGE(wc->ledtestreg); - if (wc->span.flags & ZT_FLAG_RUNNING) - wc->ledtestreg = SET_LED_GREEN(wc->ledtestreg); - else - wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg); - } - - if (wc->ledtestreg != wc->ledlastvalue) { - t1_setleds(wc, wc->ledtestreg, 1); - wc->ledlastvalue = wc->ledtestreg; - } -} - - -static void __t1_do_counters(struct t1 *wc) -{ - if (wc->alarmtimer) { - if (!--wc->alarmtimer) { - wc->span.alarms &= ~(ZT_ALARM_RECOVER); - zt_alarm_notify(&wc->span); - } - } -} - -static inline void t1_isr_misc(struct t1 *wc) -{ - const unsigned int x = wc->intcount & 0x3f; - int buffer_count = voicebus_current_latency(wc->vb); - - if (unlikely(!wc->initialized)) return; - - __handle_leds(wc); - - __t1_do_counters(wc); - - if ( 0 == x ) { - __t1_check_sigbits_reads(wc); - } - else if ( 1 == x ) { - if (!(wc->intcount & 0x30)) { - __t1_check_alarms_reads(wc); - wc->alarms_read=1; - } - } - else if ( x == buffer_count*2) { - __t1_check_sigbits(wc); - } - else if ( x == (buffer_count*2)+1 ) { - if (wc->alarms_read) { - __t1_check_alarms(wc); - wc->alarms_read=0; - } - } - else if ( x == (buffer_count*2)+2) { - clean_leftovers(wc); - } -} - -static inline void t1_transmitprep(struct t1 *wc, unsigned char* writechunk) -{ - int x; - int y; - int chan; - - /* Calculate Transmission */ - if (likely(wc->initialized)) { - spin_unlock(&wc->reglock); - zt_transmit(&wc->span); - spin_lock(&wc->reglock); - } - - for (x = 0; x < ZT_CHUNKSIZE; x++) { - if (likely(wc->initialized)) { - for (chan = 0; chan < wc->span.channels; chan++) - writechunk[(chan+1)*2] = wc->chans[chan].writechunk[x]; - } - - /* process the command queue */ - for (y = 0; y < 7; y++) { - cmd_dequeue(wc, writechunk, x, y); - } -#ifdef VPM_SUPPORT - if(likely(wc->vpm150m)) { - vpm150m_cmd_dequeue(wc, writechunk, x); - } -#endif - - if (x < ZT_CHUNKSIZE - 1) { - writechunk[EFRAME_SIZE] = wc->ctlreg; - writechunk[EFRAME_SIZE + 1] = wc->txident++; - } - writechunk += (EFRAME_SIZE + EFRAME_GAP); - } -} - -static inline void cmd_retransmit(struct t1 *wc) -{ - unsigned int x; - - for (x = 0; x < sizeof(wc->cmdq.cmds) / sizeof(wc->cmdq.cmds[0]); x++) { - if (!(wc->cmdq.cmds[x].flags & __CMD_FIN)) { - wc->cmdq.cmds[x].flags &= ~(__CMD_TX) ; /* clear __CMD_TX */ - wc->cmdq.cmds[x].ident = 0; - } - } -} - -static inline void t1_receiveprep(struct t1 *wc, unsigned char* readchunk) -{ - int x,chan; - unsigned char expected; - - for (x = 0; x < ZT_CHUNKSIZE; x++) { - if (likely(wc->initialized)) { - for (chan = 0; chan < wc->span.channels; chan++) { - wc->chans[chan].readchunk[x]= readchunk[(chan+1)*2]; - } - } - if (x < ZT_CHUNKSIZE - 1) { - expected = wc->rxident+1; - wc->rxident = readchunk[EFRAME_SIZE + 1]; - wc->statreg = readchunk[EFRAME_SIZE + 2]; - if (wc->rxident != expected) { - wc->span.irqmisses++; - cmd_retransmit(wc); - if (unlikely(debug && wc->initialized)) - module_printk("oops: rxident=%d expected=%d x=%d\n", wc->rxident, expected, x); - } - } - cmd_decipher(wc, readchunk); -#ifdef VPM_SUPPORT - if(wc->vpm150m) - vpm150m_cmd_decipher(wc, readchunk); -#endif - readchunk += (EFRAME_SIZE + EFRAME_GAP); - } - - /* echo cancel */ - if (likely(wc->initialized)) { - spin_unlock(&wc->reglock); - for (x = 0; x < wc->span.channels; x++) { - zt_ec_chunk(&wc->chans[x], wc->chans[x].readchunk, wc->ec_chunk2[x]); - memcpy(wc->ec_chunk2[x],wc->ec_chunk1[x],ZT_CHUNKSIZE); - memcpy(wc->ec_chunk1[x],wc->chans[x].writechunk,ZT_CHUNKSIZE); - } - zt_receive(&wc->span); - spin_lock(&wc->reglock); - } - - /* Wake up anyone sleeping to read/write a new register */ - wake_up_interruptible(&wc->regq); -} - -static void -t1_handle_transmit(void* vbb, void* context) -{ - struct t1* wc = context; - /* Either this function is called from within interrupt context, or - * the reglock will never be acquired from interrupt context, so it's - * safe to grab it without locking interrupt. - */ - memset(vbb, 0, SFRAME_SIZE); - spin_lock(&wc->reglock); - wc->txints++; - t1_transmitprep(wc, vbb); - wc->intcount++; - t1_isr_misc(wc); - spin_unlock(&wc->reglock); - voicebus_transmit(wc->vb, vbb); -} - -static void -t1_handle_receive(void* vbb, void* context) -{ - struct t1* wc = context; - wc->rxints++; - /* Either this function is called from within interrupt context, or - * the reglock will never be acquired from interrupt context, so it's - * safe to grab it without locking interrupt. - */ - spin_lock(&wc->reglock); - t1_receiveprep(wc, vbb); - spin_unlock(&wc->reglock); -} - -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; - unsigned int x; - int res; - int startinglatency; - - for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) - if (!ifaces[x]) break; - - if (x >= sizeof(ifaces) / sizeof(ifaces[0])) { - module_printk("Too many interfaces\n"); - return -EIO; - } - -retry: - wc = kmalloc(sizeof(*wc), GFP_KERNEL); - if (!wc) - return -ENOMEM; - - ifaces[x] = wc; - memset(wc, 0, sizeof(*wc)); - spin_lock_init(&wc->reglock); - wc->variety = d->name; - wc->txident = 1; - - init_waitqueue_head(&wc->regq); - snprintf(wc->name, sizeof(wc->name)-1, "wcte12xp%d", x); - if ((res=voicebus_init(pdev, SFRAME_SIZE, wc->name, - t1_handle_receive, t1_handle_transmit, wc, &wc->vb))) - { - WARN_ON(1); - kfree(wc); - return res; - } - - /* Keep track of which device we are */ - pci_set_drvdata(pdev, wc); - if (VOICEBUS_DEFAULT_LATENCY != latency) { - voicebus_set_minlatency(wc->vb, latency); - } - voicebus_start(wc->vb); - startinglatency = voicebus_current_latency(wc->vb); - t1_hardware_post_init(wc); - t1_software_init(wc); - if (voicebus_current_latency(wc->vb) > startinglatency) { - /* The voicebus library increased the latency during - * initialization because the host wasn't able to service the - * interrupts from the adapter quickly enough. In this case, - * we'll increase our latency and restart the initialization. - */ - printk(KERN_NOTICE "%s: Restarting board initialization " \ - "after increasing latency.\n", wc->name); - latency = voicebus_current_latency(wc->vb); - zt_unregister(&wc->span); - voicebus_release(wc->vb); - wc->vb = NULL; - kfree(wc); - wc = NULL; - goto retry; - } - module_printk("Found a %s\n", wc->variety); - - return 0; -} - -static void __devexit te12xp_remove_one(struct pci_dev *pdev) -{ - struct t1 *wc = pci_get_drvdata(pdev); -#ifdef VPM_SUPPORT - unsigned long flags; - struct vpm150m *vpm150m = wc->vpm150m; -#endif - if (!wc) - return; - -#ifdef VPM_SUPPORT - if(vpm150m) { - clear_bit(VPM150M_DTMFDETECT, &vpm150m->control); - clear_bit(VPM150M_ACTIVE, &vpm150m->control); - flush_workqueue(vpm150m->wq); - destroy_workqueue(vpm150m->wq); - } -#endif - - BUG_ON(!wc->vb); - voicebus_release(wc->vb); - wc->vb = NULL; - - if (debug && wc->isrreaderrors) - debug_printk(1, "isrreaderrors=%d\n", wc->isrreaderrors); - -#ifdef VPM_SUPPORT - if(vpm150m) { - spin_lock_irqsave(&wc->reglock, flags); - wc->vpm150m = NULL; - vpm150m->wc = NULL; - spin_unlock_irqrestore(&wc->reglock, flags); - kfree(wc->vpm150m); - } -#endif - /* Release span, possibly delayed */ - if (!wc->usecount) - t1_release(wc); - else - wc->dead = 1; -} - -static struct pci_device_id te12xp_pci_tbl[] = { - { 0xd161, 0x0120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &te120p}, - { 0xd161, 0x8000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &te121}, - { 0xd161, 0x8001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (unsigned long) &te122}, - { 0 } -}; - -MODULE_DEVICE_TABLE(pci, te12xp_pci_tbl); - -struct pci_driver te12xp_driver = { - name: "wcte12xp", - probe: te12xp_init_one, -#ifdef LINUX26 - remove: __devexit_p(te12xp_remove_one), -#else - remove: te12xp_remove_one, -#endif - suspend: NULL, - resume: NULL, - id_table: te12xp_pci_tbl, -}; - -static int __init te12xp_init(void) -{ - int res; - - res = zap_pci_module(&te12xp_driver); - - return res ? -ENODEV : 0; -} - - -static void __exit te12xp_cleanup(void) -{ - pci_unregister_driver(&te12xp_driver); -} - -#ifdef LINUX26 -module_param(debug, int, S_IRUGO | S_IWUSR); -module_param(loopback, int, S_IRUGO | S_IWUSR); -module_param(t1e1override, int, S_IRUGO | S_IWUSR); -module_param(j1mode, int, S_IRUGO | S_IWUSR); -module_param(alarmdebounce, int, S_IRUGO | S_IWUSR); -module_param(latency, int, S_IRUGO | S_IWUSR); -#ifdef VPM_SUPPORT -module_param(vpmsupport, int, S_IRUGO | S_IWUSR); -module_param(vpmdtmfsupport, int, S_IRUGO | S_IWUSR); -module_param(vpmtsisupport, int, S_IRUGO | S_IWUSR); -#endif -#else -MODULE_PARM(debug, "i"); -MODULE_PARM(loopback, "i"); -MODULE_PARM(t1e1override, "i"); -MODULE_PARM(j1mode, "i"); -MODULE_PARM(alarmdebounce, "i"); -#ifdef VPM_SUPPORT -MODULE_PARM(vpmsupport, "i"); -MODULE_PARM(vpmdtmfsupport, "i"); -MODULE_PARM(vpmtsisupport, "i"); -MODULE_PARM(vpmnlptype, "i"); -MODULE_PARM(vpmnlpthresh, "i"); -MODULE_PARM(vpmnlpmaxsupp, "i"); -#endif -#endif - -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(te12xp_init); -module_exit(te12xp_cleanup); diff --git a/zaptel/kernel/wcte12xp/gpakenum.h b/zaptel/kernel/wcte12xp/gpakenum.h deleted file mode 100644 index c2a51757..00000000 --- a/zaptel/kernel/wcte12xp/gpakenum.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2005, Adaptive Digital Technologies, Inc. - * - * File Name: gpakenum.h - * - * Description: - * This file contains common enumerations related to G.PAK application - * software. - * - * Version: 1.0 - * - * Revision History: - * 06/15/05 - Initial release. - * - * This program has been released under the terms of the GPL version 2 by - * permission of Adaptive Digital Technologies, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _GPAKENUM_H /* prevent multiple inclusion */ -#define _GPAKENUM_H - -/* G.PAK Serial Port Word Size */ -typedef enum -{ - SerWordSize8 = 0, // 8-bit seial word - SerWordSize16 = 1 // 16-bit serial word -} GpakSerWordSize_t; - -/* G.PAK Serial Port FrameSync Polarity */ -typedef enum -{ - FrameSyncActLow = 0, // active low frame sync signal - FrameSyncActHigh = 1 // active high frame sync signal -} GpakSerFrameSyncPol_t; - -/* G.PAK Serial Port Clock Polarity */ -typedef enum -{ - SerClockActLow = 0, // active low serial clock - SerClockActHigh = 1 // active high serial clock -} GpakSerClockPol_t; - -/* G.PAK Serial Port Data Delay */ -typedef enum -{ - DataDelay0 = 0, // no data delay - DataDelay1 = 1, // 1-bit data delay - DataDelay2 = 2 // 2-bit data delay -} GpakSerDataDelay_t; - -/* G.PAK Serial Port Ids. */ -typedef enum -{ - SerialPortNull = 0, // null serial port - SerialPort1 = 1, // first PCM serial stream port (McBSP0) - SerialPort2 = 2, // second PCM serial stream port (McBSP1) - SerialPort3 = 3 // third PCM serial stream port (McBSP2) -} GpakSerialPort_t; - -/* G.PAK serial port Slot Configuration selection codes. */ -typedef enum -{ - SlotCfgNone = 0, // no time slots used - SlotCfg2Groups = 2, // 2 groups of 16 time slots used, 32 Channels system - SlotCfg8Groups = 8 // 8-partition mode for 128-channel system -} GpakSlotCfg_t; - -/* G.PAK serial port Companding Mode codes. */ -typedef enum -{ - cmpPCMU=0, // u-Law - cmpPCMA=1, // A-Law - cmpNone=2 // none -} GpakCompandModes; - -/* G.PAK Active/Inactive selection codes. */ -typedef enum -{ - Disabled=0, // Inactive - Enabled=1 // Active -} GpakActivation; - -/* G.PAK Channel Type codes. */ -typedef enum -{ - inactive=0, // channel inactive - tdmToTdm=1 // tdmToTdm -} GpakChanType; - -/* G.PAK Algorithm control commands */ -typedef enum -{ - EnableEcanA = 0, // Enable A side echo canceller - BypassEcanA = 1, // Bypass A side echo canceller - ResetEcanA = 2, // Reset A side echo canceller - EnableEcanB = 3, // Enable B side echo canceller - BypassEcanB = 4, // Bypass B side echo canceller - ResetEcanB = 5, // Reset B side echo canceller - - EnableMuLawSwCompanding = 6,// Enable Mu-law Software companding - EnableALawSwCompanding = 7, // Enable Mu-law Software companding - BypassSwCompanding = 8, // Bypass Software companding - EnableDTMFMuteA = 9, // Mute A side Dtmf digit after tone detected - DisableDTMFMuteA = 10, // Do not mute A side Dtmf digit once tone detected - EnableDTMFMuteB = 11, // Mute B side Dtmf digit after tone detected - DisableDTMFMuteB = 12, // Do not mute B side Dtmf digit once tone detected - EnableFaxCngDetectA = 13, // Enable A side Fax CNG detector, channel must be configed already - DisableFaxCngDetectA = 14, // Disable A side Fax CNG detector, channel must be configed already - EnableFaxCngDetectB = 15, // Enable B side Fax CNG detector, channel must be configed already - DisableFaxCngDetectB = 16 // Disable B side Fax CNG detector, channel must be configed already -} GpakAlgCtrl_t; - -/* G.PAK Tone types. */ -typedef enum -{ - Null_tone = 0, // no tone detection - DTMF_tone = 1 // DTMF tone -} GpakToneTypes; - -/* G.PAK direction. */ -typedef enum -{ - TDMAToB = 0, // A to B - TDMBToA = 1 // B to A -} GpakTdmDirection; - - -typedef enum -{ - rate1ms=0, - rate2ms=1, - rate10ms=2 -} GpakRate_t; - -/* G.PAK Asynchronous Event Codes */ -typedef enum -{ - EventToneDetect = 0, // Tone detection event - EventDSPDebug = 7 // DSP debug data event -} GpakAsyncEventCode_t; - -/* G.PAK MF Tone Code Indices */ -typedef enum -{ - DtmfDigit1 = 0, // DTMF Digit 1 - DtmfDigit2 = 1, // DTMF Digit 2 - DtmfDigit3 = 2, // DTMF Digit 3 - DtmfDigitA = 3, // DTMF Digit A - DtmfDigit4 = 4, // DTMF Digit 4 - DtmfDigit5 = 5, // DTMF Digit 5 - DtmfDigit6 = 6, // DTMF Digit 6 - DtmfDigitB = 7, // DTMF Digit B - DtmfDigit7 = 8, // DTMF Digit 7 - DtmfDigit8 = 9, // DTMF Digit 8 - DtmfDigit9 = 10, // DTMF Digit 9 - DtmfDigitC = 11, // DTMF Digit C - DtmfDigitSt = 12, // DTMF Digit * - DtmfDigit0 = 13, // DTMF Digit 0 - DtmfDigitPnd = 14, // DTMF Digit # - DtmfDigitD = 15, // DTMF Digit D - - FaxCngDigit = 90, // Fax Calling Tone (1100 Hz) - - EndofMFDigit = 100, // End of MF digit - EndofCngDigit = 101 // End of Cng Digit -} GpakToneCodes_t; - -/* GPIO control code*/ -typedef enum -{ - GPIO_READ = 0, - GPIO_WRITE = 1, - GPIO_DIR = 2 -} GpakGPIOCotrol_t; - -#endif // end multiple inclusion diff --git a/zaptel/kernel/wcte12xp/voicebus.c b/zaptel/kernel/wcte12xp/voicebus.c deleted file mode 120000 index 66536197..00000000 --- a/zaptel/kernel/wcte12xp/voicebus.c +++ /dev/null @@ -1 +0,0 @@ -../voicebus.c \ No newline at end of file diff --git a/zaptel/kernel/wcte12xp/vpmadt032.c b/zaptel/kernel/wcte12xp/vpmadt032.c deleted file mode 100644 index e989b9b1..00000000 --- a/zaptel/kernel/wcte12xp/vpmadt032.c +++ /dev/null @@ -1,1311 +0,0 @@ -/* - * Digium, Inc. Wildcard TE12xP T1/E1 card Driver - * - * Written by Michael Spiceland - * - * Adapted from the wctdm24xxp and wcte11xp drivers originally - * written by Mark Spencer - * Matthew Fredrickson - * William Meadows - * - * Copyright (C) 2007, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif -#include -#include -#include - -#include "zaptel.h" -#include "voicebus.h" - -#include "wcte12xp.h" -#include "vpmadt032.h" -#include "GpakApi.h" - -extern struct t1 *ifaces[WC_MAX_IFACES]; - -extern int vpmnlptype; -extern int vpmnlpthresh; -extern int vpmnlpmaxsupp; - -#ifdef VPM_SUPPORT - -inline void vpm150m_cmd_dequeue(struct t1 *wc, volatile unsigned char *writechunk, int whichframe) -{ - struct vpm150m_cmd *curcmd = NULL; - struct vpm150m *vpm150m = wc->vpm150m; - int x; - unsigned char leds = ~((wc->intcount / 1000) % 8) & 0x7; - - /* Skip audio */ - writechunk += 66; - - if (test_bit(VPM150M_SPIRESET, &vpm150m->control) || test_bit(VPM150M_HPIRESET, &vpm150m->control)) { - debug_printk(1, "HW Resetting VPMADT032 ...\n"); - for (x = 0; x < 4; x++) { - if (!x) { - if (test_and_clear_bit(VPM150M_SPIRESET, &vpm150m->control)) - writechunk[CMD_BYTE(x, 0, 1)] = 0x08; - else if (test_and_clear_bit(VPM150M_HPIRESET, &vpm150m->control)) - writechunk[CMD_BYTE(x, 0, 1)] = 0x0b; - } else - writechunk[CMD_BYTE(x, 0, 1)] = 0x00 | leds; - writechunk[CMD_BYTE(x, 1, 1)] = 0; - writechunk[CMD_BYTE(x, 2, 1)] = 0x00; - } - return; - } - - /* Search for something waiting to transmit */ - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) { - if ((vpm150m->cmdq[x].flags & (__VPM150M_RD | __VPM150M_WR)) && - !(vpm150m->cmdq[x].flags & (__VPM150M_FIN | __VPM150M_TX))) { - curcmd = &vpm150m->cmdq[x]; - curcmd->ident = wc->txident; - curcmd->flags |= __VPM150M_TX; - break; - } - } - if (curcmd) { -#if 0 - printk("Found command txident = %d, desc = 0x%x, addr = 0x%x, data = 0x%x\n", curcmd->txident, curcmd->desc, curcmd->addr, curcmd->data); -#endif - if (curcmd->flags & __VPM150M_RWPAGE) { - /* Set CTRL access to page*/ - writechunk[CMD_BYTE(0, 0, 1)] = (0x8 << 4); - writechunk[CMD_BYTE(0, 1, 1)] = 0; - writechunk[CMD_BYTE(0, 2, 1)] = 0x20; - - /* Do a page write */ - if (curcmd->flags & __VPM150M_WR) - writechunk[CMD_BYTE(1, 0, 1)] = ((0x8 | 0x4) << 4); - else - writechunk[CMD_BYTE(1, 0, 1)] = ((0x8 | 0x4 | 0x1) << 4); - writechunk[CMD_BYTE(1, 1, 1)] = 0; - if (curcmd->flags & __VPM150M_WR) - writechunk[CMD_BYTE(1, 2, 1)] = curcmd->data[0] & 0xf; - else - writechunk[CMD_BYTE(1, 2, 1)] = 0; - - if (curcmd->flags & __VPM150M_WR) { - /* Fill in buffer to size */ - writechunk[CMD_BYTE(2, 0, 1)] = 0; - writechunk[CMD_BYTE(2, 1, 1)] = 0; - writechunk[CMD_BYTE(2, 2, 1)] = 0; - } else { - /* Do reads twice b/c of vpmadt032 bug */ - writechunk[CMD_BYTE(2, 0, 1)] = ((0x8 | 0x4 | 0x1) << 4); - writechunk[CMD_BYTE(2, 1, 1)] = 0; - writechunk[CMD_BYTE(2, 2, 1)] = 0; - } - - /* Clear XADD */ - writechunk[CMD_BYTE(3, 0, 1)] = (0x8 << 4); - writechunk[CMD_BYTE(3, 1, 1)] = 0; - writechunk[CMD_BYTE(3, 2, 1)] = 0; - - /* Fill in buffer to size */ - writechunk[CMD_BYTE(4, 0, 1)] = 0; - writechunk[CMD_BYTE(4, 1, 1)] = 0; - writechunk[CMD_BYTE(4, 2, 1)] = 0; - - } else { - /* Set address */ - writechunk[CMD_BYTE(0, 0, 1)] = ((0x8 | 0x4) << 4); - writechunk[CMD_BYTE(0, 1, 1)] = (curcmd->address >> 8) & 0xff; - writechunk[CMD_BYTE(0, 2, 1)] = curcmd->address & 0xff; - - /* Send/Get our data */ - if (curcmd->flags & __VPM150M_WR) { - if (curcmd->datalen > 1) - writechunk[CMD_BYTE(1, 0, 1)] = ((0x8 | (0x1 << 1)) << 4); - else - writechunk[CMD_BYTE(1, 0, 1)] = ((0x8 | (0x3 << 1)) << 4); - } else - if (curcmd->datalen > 1) - writechunk[CMD_BYTE(1, 0, 1)] = ((0x8 | (0x1 << 1) | 0x1) << 4); - else - writechunk[CMD_BYTE(1, 0, 1)] = ((0x8 | (0x3 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(1, 1, 1)] = (curcmd->data[0] >> 8) & 0xff; - writechunk[CMD_BYTE(1, 2, 1)] = curcmd->data[0] & 0xff; - - if (curcmd->flags & __VPM150M_WR) { - /* Fill in */ - writechunk[CMD_BYTE(2, 0, 1)] = 0; - writechunk[CMD_BYTE(2, 1, 1)] = 0; - writechunk[CMD_BYTE(2, 2, 1)] = 0; - } else { - /* Do this again for reads b/c of the bug in vpmadt032 */ - writechunk[CMD_BYTE(2, 0, 1)] = ((0x8 | (0x3 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(2, 1, 1)] = (curcmd->data[0] >> 8) & 0xff; - writechunk[CMD_BYTE(2, 2, 1)] = curcmd->data[0] & 0xff; - } - - if (curcmd->datalen > 1) { - if (curcmd->flags & __VPM150M_WR) - writechunk[CMD_BYTE(3, 0, 1)] = ((0x8 | (0x1 << 1)) << 4); - else - writechunk[CMD_BYTE(3, 0, 1)] = ((0x8 | (0x1 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(3, 1, 1)] = (curcmd->data[1] >> 8) & 0xff; - writechunk[CMD_BYTE(3, 2, 1)] = curcmd->data[1] & 0xff; - } else { - /* Fill in the rest */ - writechunk[CMD_BYTE(3, 0, 1)] = 0; - writechunk[CMD_BYTE(3, 1, 1)] = 0; - writechunk[CMD_BYTE(3, 2, 1)] = 0; - } - - if (curcmd->datalen > 2) { - if (curcmd->flags & __VPM150M_WR) - writechunk[CMD_BYTE(4, 0, 1)] = ((0x8 | (0x1 << 1)) << 4); - else - writechunk[CMD_BYTE(4, 0, 1)] = ((0x8 | (0x1 << 1) | 0x1) << 4); - writechunk[CMD_BYTE(4, 1, 1)] = (curcmd->data[2] >> 8) & 0xff; - writechunk[CMD_BYTE(4, 2, 1)] = curcmd->data[2] & 0xff; - } else { - /* Fill in the rest */ - writechunk[CMD_BYTE(4, 0, 1)] = 0; - writechunk[CMD_BYTE(4, 1, 1)] = 0; - writechunk[CMD_BYTE(4, 2, 1)] = 0; - } - } - } else if (test_and_clear_bit(VPM150M_SWRESET, &vpm150m->control)) { - debug_printk(1, "Booting VPMADT032\n"); - for (x = 0; x < 7; x++) { - if (x == 0) - writechunk[CMD_BYTE(x, 0, 1)] = (0x8 << 4); - else - writechunk[CMD_BYTE(x, 0, 1)] = 0x00; - writechunk[CMD_BYTE(x, 1, 1)] = 0; - if (x == 0) - writechunk[CMD_BYTE(x, 2, 1)] = 0x01; - else - writechunk[CMD_BYTE(x, 2, 1)] = 0x00; - } - } else { - for (x = 0; x < 7; x++) { - writechunk[CMD_BYTE(x, 0, 1)] = 0x00; - writechunk[CMD_BYTE(x, 1, 1)] = 0x00; - writechunk[CMD_BYTE(x, 2, 1)] = 0x00; - } - } - - /* Add our leds in */ - for (x = 0; x < 7; x++) - writechunk[CMD_BYTE(x, 0, 1)] |= leds; - -#if 0 - int y; - for (x = 0; x < 7; x++) { - for (y = 0; y < 3; y++) { - if (writechunk[CMD_BYTE(x, y, 1)] & 0x2) { - module_printk("the test bit is high for byte %d\n", y); - } - } - } -#endif - - /* Now let's figure out if we need to check for DTMF */ - /* polling */ - if (test_bit(VPM150M_ACTIVE, &vpm150m->control) && !whichframe && !(wc->intcount % 100)) - queue_work(vpm150m->wq, &vpm150m->work_dtmf); - -#if 0 - /* This may be needed sometime in the future to troubleshoot ADT related issues. */ - if (test_bit(VPM150M_ACTIVE, &vpm150m->control) && !whichframe && !(wc->intcount % 10000)) - queue_work(vpm150m->wq, &vpm150m->work_debug); -#endif -} - -inline void vpm150m_cmd_decipher(struct t1 *wc, volatile unsigned char *readchunk) -{ - unsigned char ident; - int x, i; - - /* Skip audio */ - readchunk += 66; - /* Search for any pending results */ - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) { - if ((wc->vpm150m->cmdq[x].flags & (__VPM150M_RD | __VPM150M_WR)) && - (wc->vpm150m->cmdq[x].flags & (__VPM150M_TX)) && - !(wc->vpm150m->cmdq[x].flags & (__VPM150M_FIN))) { - ident = wc->vpm150m->cmdq[x].ident; - if (ident == wc->rxident) { - /* Store result */ - for (i = 0; i < wc->vpm150m->cmdq[x].datalen; i++) { - wc->vpm150m->cmdq[x].data[i] = (0xff & readchunk[CMD_BYTE((2 + i), 1, 1)]) << 8; - wc->vpm150m->cmdq[x].data[i] |= readchunk[CMD_BYTE((2 + i), 2, 1)]; - } - if (wc->vpm150m->cmdq[x].flags & __VPM150M_WR) { - /* Go ahead and clear out writes since they need no acknowledgement */ - wc->vpm150m->cmdq[x].flags = 0; - } else - wc->vpm150m->cmdq[x].flags |= __VPM150M_FIN; - break; - } - } - } -} - -static inline struct t1 * wc_find_iface(unsigned short dspid) -{ - int i; - struct t1 *ret = NULL; - unsigned long flags; - - spin_lock_irqsave(&ifacelock, flags); - for (i = 0; i < WC_MAX_IFACES; i++) - if (ifaces[i] && ifaces[i]->vpm150m && (ifaces[i]->vpm150m->dspid == dspid)) - ret = ifaces[i]; - spin_unlock_irqrestore(&ifacelock, flags); - - return ret; -} - -static struct vpm150m_cmd * vpm150m_empty_slot(struct t1 *wc) -{ - unsigned int x; - - for (x = 0; x < VPM150M_MAX_COMMANDS; x++) { - if (!wc->vpm150m->cmdq[x].flags) { - return &wc->vpm150m->cmdq[x]; - } - } - return NULL; -} - -/* Wait for any outstanding commands to be completed. */ -static inline int vpm150m_io_wait(struct t1 *wc) -{ - int x; - int ret=0; - for (x=0; x < VPM150M_MAX_COMMANDS;) { - if (wc->vpm150m->cmdq[x].flags) { - if ((ret=schluffen(&wc->regq))) { - return ret; - } - x=0; - } - else { - ++x; - } - } - return ret; -} - -int t1_vpm150m_getreg_full_async(struct t1 *wc, int pagechange, unsigned int len, - unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p) -{ - int ret=0; - unsigned long flags; - BUG_ON(!hit_p); - spin_lock_irqsave(&wc->reglock, flags); - (*hit_p) = vpm150m_empty_slot(wc); - if (*hit_p) { - (*hit_p)->flags = __VPM150M_RD; - if (pagechange) { - (*hit_p)->flags |= __VPM150M_RWPAGE; - } - (*hit_p)->datalen = len; - (*hit_p)->address = addr; - memset((*hit_p)->data, 0, len*sizeof(outbuf[0])); - } - else { - ret = -EBUSY; - } - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -int t1_vpm150m_getreg_full_return(struct t1 *wc, int pagechange, unsigned int len, - unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p) -{ - int ret = 0; - unsigned long flags; - BUG_ON(!hit_p); - spin_lock_irqsave(&wc->reglock, flags); - do { - if ((*hit_p)->flags & __VPM150M_FIN) { - memcpy(outbuf, (*hit_p)->data, len*(sizeof(outbuf[0]))); - (*hit_p)->flags = 0; - (*hit_p) = NULL; - ret = 0; - } - else { - spin_unlock_irqrestore(&wc->reglock, flags); - if ((ret=schluffen(&wc->regq))) { - return ret; - } - spin_lock_irqsave(&wc->reglock, flags); - ret = -EBUSY; - } - } while (-EBUSY == ret); - spin_unlock_irqrestore(&wc->reglock, flags); - return ret; -} - -int t1_vpm150m_getreg_full(struct t1 *wc, int pagechange, unsigned int len, unsigned short addr, unsigned short *outbuf) -{ - struct vpm150m_cmd *hit = 0; - int ret = 0; - do { - ret = t1_vpm150m_getreg_full_async(wc, pagechange, len, addr, outbuf, &hit); - if (!hit) { - if ( -EBUSY == ret ) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - BUG_ON( 0 != ret); - } - } while (!hit); - - ret = t1_vpm150m_getreg_full_return(wc, pagechange, len, addr, outbuf, &hit); - return ret; -} - -int t1_vpm150m_setreg_full(struct t1 *wc, int pagechange, unsigned int len, unsigned int addr, unsigned short *data) -{ - unsigned long flags; - struct vpm150m_cmd *hit; - int ret, i; - do { - spin_lock_irqsave(&wc->reglock, flags); - hit = vpm150m_empty_slot(wc); - if (hit) { - hit->flags = __VPM150M_WR; - if (pagechange) - hit->flags |= __VPM150M_RWPAGE; - hit->address = addr; - hit->datalen = len; - for (i = 0; i < len; i++) - hit->data[i] = data[i]; - } - spin_unlock_irqrestore(&wc->reglock, flags); - if (!hit) { - if ((ret = schluffen(&wc->regq))) - return ret; - } - } while (!hit); - return (hit) ? 0 : -1; -} - -int t1_vpm150m_setpage(struct t1 *wc, unsigned short addr) -{ - addr &= 0xf; - /* Let's optimize this a little bit */ - if (wc->vpm150m->curpage == addr) - return 0; - else { - wc->vpm150m->curpage = addr; - } - - return t1_vpm150m_setreg_full(wc, 1, 1, 0, &addr); -} - -unsigned char t1_vpm150m_getpage(struct t1 *wc) -{ - unsigned short res; - t1_vpm150m_getreg_full(wc, 1, 1, 0, &res); - return res; -} - -int t1_vpm150m_setreg(struct t1 *wc, unsigned int len, unsigned int addr, unsigned short *data) -{ - int res; - t1_vpm150m_setpage(wc, addr >> 16); - if ((addr >> 16) != ((addr + len) >> 16)) - module_printk("setreg: You found it!\n"); - res = t1_vpm150m_setreg_full(wc, 0, len, addr & 0xffff, data); - return res; -} - -unsigned short t1_vpm150m_getreg(struct t1 *wc, unsigned int len, unsigned int addr, unsigned short *data) -{ - unsigned short res; - t1_vpm150m_setpage(wc, addr >> 16); - if ((addr >> 16) != ((addr + len) >> 16)) - module_printk("getreg: You found it!\n"); - res = t1_vpm150m_getreg_full(wc, 0, len, addr & 0xffff, data); - return res; -} - -static char vpm150mtone_to_zaptone(GpakToneCodes_t tone) -{ - switch (tone) { - case DtmfDigit0: - return '0'; - case DtmfDigit1: - return '1'; - case DtmfDigit2: - return '2'; - case DtmfDigit3: - return '3'; - case DtmfDigit4: - return '4'; - case DtmfDigit5: - return '5'; - case DtmfDigit6: - return '6'; - case DtmfDigit7: - return '7'; - case DtmfDigit8: - return '8'; - case DtmfDigit9: - return '9'; - case DtmfDigitPnd: - return '#'; - case DtmfDigitSt: - return '*'; - case DtmfDigitA: - return 'A'; - case DtmfDigitB: - return 'B'; - case DtmfDigitC: - return 'C'; - case DtmfDigitD: - return 'D'; - case EndofCngDigit: - return 'f'; - default: - return 0; - } -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void vpm150m_echocan_bh(void *data) -{ - struct vpm150m *vpm150m = data; -#else -static void vpm150m_echocan_bh(struct work_struct *data) -{ - struct vpm150m *vpm150m = container_of(data, struct vpm150m, work_echocan); -#endif - struct t1 *wc = vpm150m->wc; - struct list_head *task; - struct list_head *next_task; - unsigned long flags; - - list_for_each_safe(task, next_task, &vpm150m->worklist) { - struct vpm150m_workentry *we = list_entry(task, struct vpm150m_workentry, list); - struct zt_chan *chan = we->chan; - int deflaw; - int res; - GPAK_AlgControlStat_t pstatus; - - if (we->params.tap_length) { - /* configure channel for the ulaw/alaw */ - unsigned int start = wc->intcount; - - if (memcmp(&we->params, &vpm150m->chan_params[chan->chanpos - 1], sizeof(we->params))) { - /* set parameters */ - vpm150m->chan_params[chan->chanpos - 1] = we->params; - } - - deflaw = chan->span->deflaw; - debug_printk(1, "Enabling EC on channel %d (law %d)\n", chan->chanpos, deflaw); - if (deflaw == 2) /* alaw */ - res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, EnableALawSwCompanding, &pstatus); - else if (deflaw == 1) /* alaw */ - res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, EnableMuLawSwCompanding, &pstatus); - else { - module_printk("Undefined law for channel %d.\n", chan->chanpos); - res = -1; - } - - if (res) { - module_printk("Unable to set SW Companding on channel %d (reason %d)\n", chan->chanpos, res); - } - - res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, EnableEcanA, &pstatus); - debug_printk(2, "Echo can enable took %d ms\n", wc->intcount - start); - } else { - unsigned int start = wc->intcount; - debug_printk(1, "Disabling EC on channel %d\n", chan->chanpos); - res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, BypassSwCompanding, &pstatus); - if (res) - module_printk("Unable to disable sw companding on echo cancellation channel %d (reason %d)\n", chan->chanpos, res); - res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, BypassEcanA, &pstatus); - if (res) - module_printk("Unable to disable echo can on channel %d (reason %d)\n", chan->chanpos, res); - debug_printk(2, "Echocan disable took %d ms\n", wc->intcount - start); - } - if (res) { - module_printk("Unable to toggle echo cancellation on channel %d (reason %d)\n", chan->chanpos, res); - } - - spin_lock_irqsave(&vpm150m->lock, flags); - list_del(task); - spin_unlock_irqrestore(&vpm150m->lock, flags); - kfree(we); - } -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void vpm150m_debug_bh(void *data) -{ - struct vpm150m *vpm150m = data; -#else -static void vpm150m_debug_bh(struct work_struct *data) -{ - struct vpm150m *vpm150m = container_of(data, struct vpm150m, work_debug); -#endif - unsigned short int FrammingError1Count, FramingError2Count, FramingError3Count, - DmaStopErrorCount, DmaSlipStatsBuffer; - - if (gpakReadFramingStats(vpm150m->dspid, &FrammingError1Count, &FramingError2Count, &FramingError3Count, - &DmaStopErrorCount, &DmaSlipStatsBuffer)) - { - module_printk("There was an error getting framing stats.\n"); - } - if (FrammingError1Count||FramingError2Count||FramingError3Count||DmaStopErrorCount||DmaSlipStatsBuffer) - { - module_printk("FramingStats Error: %d %d %d %d %d\n", - FrammingError1Count, FramingError2Count, FramingError3Count, DmaStopErrorCount, DmaSlipStatsBuffer); - } -} - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void vpm150m_dtmf_bh(void *data) -{ - struct vpm150m *vpm150m = data; -#else -static void vpm150m_dtmf_bh(struct work_struct *data) -{ - struct vpm150m *vpm150m = container_of(data, struct vpm150m, work_dtmf); -#endif - struct t1 *wc = vpm150m->wc; - int i; - - for (i = 0; i < wc->span.channels; i++) { - int enable = -1; - if (test_bit(i, &vpm150m->desireddtmfmutestate)) { - if (!test_bit(i, &vpm150m->curdtmfmutestate)) { - enable = 1; - } - } else { - if (test_bit(i, &vpm150m->curdtmfmutestate)) { - enable = 0; - } - } - if (enable > -1) { - unsigned int start = wc->intcount; - GPAK_AlgControlStat_t pstatus; - int res; - - if (enable) { - res = gpakAlgControl(vpm150m->dspid, i, EnableDTMFMuteA, &pstatus); - debug_printk(2, "DTMF mute enable took %d ms\n", wc->intcount - start); - } else { - res = gpakAlgControl(vpm150m->dspid, i, DisableDTMFMuteA, &pstatus); - debug_printk(2, "DTMF mute disable took %d ms\n", wc->intcount - start); - } - if (!res) - change_bit(i, &vpm150m->curdtmfmutestate); - } - } - - if (test_bit(VPM150M_DTMFDETECT, &vpm150m->control)) { - unsigned short channel; - GpakAsyncEventCode_t eventcode; - GpakAsyncEventData_t eventdata; - gpakReadEventFIFOMessageStat_t res; - unsigned int start = wc->intcount; - - do { - res = gpakReadEventFIFOMessage(vpm150m->dspid, &channel, &eventcode, &eventdata); - debug_printk(3, "ReadEventFIFOMessage took %d ms\n", wc->intcount - start); - - if (res == RefInvalidEvent || res == RefDspCommFailure) { - module_printk("Uh oh (%d)\n", res); - continue; - } - - if (eventcode == EventToneDetect) { - GpakToneCodes_t tone = eventdata.toneEvent.ToneCode; - int duration = eventdata.toneEvent.ToneDuration; - char zaptone = vpm150mtone_to_zaptone(tone); - - debug_printk(1, "Channel %d: Detected DTMF tone %d of duration %d\n", channel + 1, tone, duration); - - if (test_bit(channel, &wc->dtmfmask) && (eventdata.toneEvent.ToneDuration > 0)) { - struct zt_chan *chan = &wc->chans[channel]; - - module_printk("DTMF detected channel=%d tone=%d duration=%d\n", channel + 1, tone, duration); - - if ((tone != EndofMFDigit) && (zaptone != 0)) { - vpm150m->curtone[channel] = tone; - - if (test_bit(channel, &vpm150m->curdtmfmutestate)) { - unsigned long flags; - int y; - - /* Mute the audio data buffers */ - spin_lock_irqsave(&chan->lock, flags); - for (y = 0; y < chan->numbufs; y++) { - if ((chan->inreadbuf > -1) && (chan->readidx[y])) - memset(chan->readbuf[chan->inreadbuf], ZT_XLAW(0, chan), chan->readidx[y]); - } - spin_unlock_irqrestore(&chan->lock, flags); - } - if (!test_bit(channel, &wc->dtmfactive)) { - debug_printk(1,"Queuing DTMFDOWN %c\n", zaptone); - set_bit(channel, &wc->dtmfactive); - zt_qevent_lock(chan, (ZT_EVENT_DTMFDOWN | zaptone)); - } - } else if ((tone == EndofMFDigit) && test_bit(channel, &wc->dtmfactive)) { - debug_printk(1,"Queuing DTMFUP %c\n", vpm150mtone_to_zaptone(vpm150m->curtone[channel])); - zt_qevent_lock(chan, (ZT_EVENT_DTMFUP | vpm150mtone_to_zaptone(vpm150m->curtone[channel]))); - clear_bit(channel, &wc->dtmfactive); - } - } - } - } while ((res == RefEventAvail)); - } - - return; -} - -void t1_vpm150m_init(struct t1 *wc) { - struct vpm150m *vpm150m; - unsigned short i; - unsigned short reg; - unsigned long flags; - gpakPingDspStat_t pingstatus; - gpakDownloadStatus_t downloadstatus; - struct t1_firmware fw; - struct firmware embedded_firmware; - const struct firmware *firmware = &embedded_firmware; -#if !defined(HOTPLUG_FIRMWARE) - extern void _binary_zaptel_fw_vpmadt032_bin_size; - extern u8 _binary_zaptel_fw_vpmadt032_bin_start[]; -#else - static const char vpmadt032_firmware[] = "zaptel-fw-vpmadt032.bin"; - struct pci_dev* pdev = voicebus_get_pci_dev(wc->vb); -#endif - -#if 0 - unsigned short omsg[4] = { 0xdead, 0xbeef, 0x1111, 0x2222}; - unsigned short imsg[4]; -#endif - - if (!vpmsupport) { - module_printk("VPM Support Disabled\n"); - wc->vpm150m = NULL; - return; - } - - vpm150m = kmalloc(sizeof(struct vpm150m), GFP_KERNEL); - - if (!vpm150m) { - module_printk("Unable to allocate VPMADT032!\n"); - return; - } - memset(vpm150m, 0, sizeof(struct vpm150m)); - - /* Init our vpm150m struct */ - sema_init(&vpm150m->sem, 1); - vpm150m->curpage = 0x80; - - for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++) { - if (ifaces[i] == wc) - vpm150m->dspid = i; - } - - debug_printk(1, "Setting VPMADT032 DSP ID to %d\n", vpm150m->dspid); - spin_lock_irqsave(&wc->reglock, flags); - wc->vpm150m = vpm150m; - spin_unlock_irqrestore(&wc->reglock, flags); - - for (i = 0; i < 10; i++) - schluffen(&wc->regq); - - debug_printk(1, "Looking for VPMADT032 by testing page access: "); - for (i = 0; i < 0xf; i++) { - int x; - for (x = 0; x < 3; x++) { - t1_vpm150m_setpage(wc, i); - reg = t1_vpm150m_getpage(wc); - if (reg != i) { - /* If they have debug turned on we want them to be able to - * report where in the code the module failed to come up. */ - debug_printk(1, "Either no VPMADT032 module present or the module failed VPM page access test (%x != %x)\n", i, reg); - goto failed_exit; - } - } - } - debug_printk(1, "Passed\n"); - - set_bit(VPM150M_HPIRESET, &vpm150m->control); - msleep(2000); - - /* Set us up to page 0 */ - t1_vpm150m_setpage(wc, 0); - debug_printk(1, "VPMADT032 now doing address test: "); - for (i = 0; i < 16; i++) { - int x; - for (x = 0; x < 2; x++) { - t1_vpm150m_setreg(wc, 1, 0x1000, &i); - t1_vpm150m_getreg(wc, 1, 0x1000, ®); - if (reg != i) { - module_printk("VPMADT032 Failed address test: sent %x != %x on try %d\n", i, reg, x); - goto failed_exit; - } - } - } - debug_printk(1, "Passed\n"); - -#define TEST_SIZE 2 - if (debug) { - int i; - unsigned short msg[TEST_SIZE]; - - set_bit(VPM150M_HPIRESET, &vpm150m->control); - msleep(2000); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - for (i = 0; i< TEST_SIZE; i++) - msg[i] = 0xdead; - gpakWriteDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - gpakWriteDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - for (i = 0; i< TEST_SIZE; i++) - msg[i] = 0xbeef; - gpakWriteDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - for (i = 0; i< TEST_SIZE; i++) - msg[i] = 0x1111; - gpakWriteDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - for (i = 0; i< TEST_SIZE; i++) - msg[i] = 0x2222; - gpakWriteDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - gpakReadDspMemory(vpm150m->dspid, 0x1000, TEST_SIZE, msg); - for (i = 0; i< TEST_SIZE; i++) - printk("%x ", msg[i]); - printk("\n"); - } - -#if defined(HOTPLUG_FIRMWARE) - if ((request_firmware(&firmware, vpmadt032_firmware, &pdev->dev) != 0) || - !firmware) { - printk("VPMADT032: firmware %s not available from userspace\n", vpmadt032_firmware); - goto failed_exit; - } -#else - embedded_firmware.data = _binary_zaptel_fw_vpmadt032_bin_start; - embedded_firmware.size = (size_t) &_binary_zaptel_fw_vpmadt032_bin_size; -#endif - fw.fw = firmware; - fw.offset = 0; - - set_bit(VPM150M_HPIRESET, &vpm150m->control); - - while (test_bit(VPM150M_HPIRESET, &vpm150m->control)) - schluffen(&wc->regq); - - module_printk("VPMADT032 Loading firwmare... "); - downloadstatus = gpakDownloadDsp(vpm150m->dspid, &fw); - - if (firmware != &embedded_firmware) - release_firmware(firmware); - - if (downloadstatus != 0) { - module_printk("Unable to download firmware to VPMADT032 with cause %d\n", downloadstatus); - goto failed_exit; - } else { - module_printk("Success\n"); - } - - set_bit(VPM150M_SWRESET, &vpm150m->control); - - while (test_bit(VPM150M_SWRESET, &vpm150m->control)) - schluffen(&wc->regq); - - msleep(700); -#if 0 - } -#endif - - pingstatus = gpakPingDsp(vpm150m->dspid, &vpm150m->version); - - if (!pingstatus) { - debug_printk(1, "Version of DSP is %x\n", vpm150m->version); - } else { - module_printk("Unable to ping the DSP (%d)!\n", pingstatus); - goto failed_exit; - } - - /* workqueue for DTMF and wc->span functions that cannot sleep */ - spin_lock_init(&vpm150m->lock); - vpm150m->wq = create_singlethread_workqueue("wcte12xp"); - vpm150m->wc = wc; - if (!vpm150m->wq) { - module_printk("Unable to create work queue!\n"); - goto failed_exit; - } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&vpm150m->work_echocan, vpm150m_echocan_bh, vpm150m); - INIT_WORK(&vpm150m->work_dtmf, vpm150m_dtmf_bh, vpm150m); - INIT_WORK(&vpm150m->work_debug, vpm150m_debug_bh, vpm150m); -#else - INIT_WORK(&vpm150m->work_echocan, vpm150m_echocan_bh); - INIT_WORK(&vpm150m->work_dtmf, vpm150m_dtmf_bh); - INIT_WORK(&vpm150m->work_debug, vpm150m_debug_bh); -#endif - INIT_LIST_HEAD(&wc->vpm150m->worklist); /* list of echocan tasks */ - - if (vpm150m_config_hw(wc)) { - goto failed_exit; - } - - return; - -failed_exit: - if (vpm150m->wq) { - destroy_workqueue(vpm150m->wq); - } - spin_lock_irqsave(&wc->reglock, flags); - wc->vpm150m = NULL; - spin_unlock_irqrestore(&wc->reglock, flags); - kfree(vpm150m); - - return; -} - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadDspMemory - Read DSP memory. - * - * FUNCTION - * This function reads a contiguous block of words from DSP memory starting at - * the specified address. - * - * RETURNS - * nothing - * - */ -void gpakReadDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to read */ - DSP_WORD *pWordValues /* pointer to array of word values variable */ - ) -{ - struct t1 *wc = wc_find_iface(DspId); - int i; - int transcount; - int ret; - - vpm150m_io_wait(wc); - if ( NumWords < VPM150M_MAX_COMMANDS ) { - struct vpm150m_cmd* cmds[VPM150M_MAX_COMMANDS] = {0}; - t1_vpm150m_setpage(wc, DspAddress >> 16); - DspAddress &= 0xffff; - for (i=0; i < NumWords; ++i) { - ret = t1_vpm150m_getreg_full_async(wc,0,1,DspAddress+i,&pWordValues[i], - &cmds[i]); - if (0 != ret) { - return; - } - } - for (i=NumWords-1; i >=0; --i) { - ret = t1_vpm150m_getreg_full_return(wc,0,1,DspAddress+i,&pWordValues[i], - &cmds[i]); - if (0 != ret) { - return; - } - } - } - else { - for (i = 0; i < NumWords;) { - if ((NumWords - i) > VPM150M_MAX_DATA) - transcount = VPM150M_MAX_DATA; - else - transcount = NumWords - i; - t1_vpm150m_getreg(wc, transcount, DspAddress + i, &pWordValues[i]); - i += transcount; - } - } - return; -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakWriteDspMemory - Write DSP memory. - * - * FUNCTION - * This function writes a contiguous block of words to DSP memory starting at - * the specified address. - * - * RETURNS - * nothing - * - */ -void gpakWriteDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to write */ - DSP_WORD *pWordValues /* pointer to array of word values to write */ - ) -{ - - struct t1 *wc = wc_find_iface(DspId); - int i; - int transcount; - - if (wc && wc->vpm150m) { - for (i = 0; i < NumWords;) { - if ((NumWords - i) > VPM150M_MAX_DATA) - transcount = VPM150M_MAX_DATA; - else - transcount = NumWords - i; - t1_vpm150m_setreg(wc, transcount, DspAddress + i, &pWordValues[i]); - i += transcount; - } - } - return; - -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakHostDelay - Delay for a fixed time interval. - * - * FUNCTION - * This function delays for a fixed time interval before returning. The time - * interval is the Host Port Interface sampling period when polling a DSP for - * replies to command messages. - * - * RETURNS - * nothing - * - */ -void gpakHostDelay(void) -{ -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakLockAccess - Lock access to the specified DSP. - * - * FUNCTION - * This function aquires exclusive access to the specified DSP. - * - * RETURNS - * nothing - * - */ -void gpakLockAccess(unsigned short DspId) -{ - struct t1 *wc; - - wc = wc_find_iface(DspId); - - if (wc) { - struct vpm150m *vpm = wc->vpm150m; - - if (vpm) - down_interruptible(&vpm->sem); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakUnlockAccess - Unlock access to the specified DSP. - * - * FUNCTION - * This function releases exclusive access to the specified DSP. - * - * RETURNS - * nothing - * - */ -void gpakUnlockAccess(unsigned short DspId) -{ - struct t1 *wc; - - wc = wc_find_iface(DspId); - - if (wc) { - struct vpm150m *vpm = wc->vpm150m; - - if (vpm) - up(&vpm->sem); - } -} - - -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * gpakReadFile - Read a block of bytes from a G.PAK Download file. - * - * FUNCTION - * This function reads a contiguous block of bytes from a G.PAK Download file - * starting at the current file position. - * - * RETURNS - * The number of bytes read from the file. - * -1 indicates an error occurred. - * 0 indicates all bytes have been read (end of file) - * - */ -int gpakReadFile( - GPAK_FILE_ID FileId, /* G.PAK Download File Identifier */ - unsigned char *pBuffer, /* pointer to buffer for storing bytes */ - unsigned int NumBytes /* number of bytes to read */ - ) -{ - struct t1_firmware *fw = FileId; - unsigned int i, count; - - if (!fw || !fw->fw) - return -1; - - if (NumBytes > (fw->fw->size - fw->offset)) - count = fw->fw->size - fw->offset; - else - count = NumBytes; - - for (i = 0; i < count; i++) - pBuffer[i] = fw->fw->data[fw->offset + i]; - - fw->offset += count; - - return count; -} - -int vpm150m_config_hw(struct t1 *wc) -{ - struct vpm150m *vpm150m = wc->vpm150m; - gpakConfigPortStatus_t configportstatus; - GpakPortConfig_t portconfig; - GPAK_PortConfigStat_t pstatus; - GpakChannelConfig_t chanconfig; - GPAK_ChannelConfigStat_t cstatus; - GPAK_AlgControlStat_t algstatus; - - int res, i; - - memset(&portconfig, 0, sizeof(GpakPortConfig_t)); - - /* First Serial Port config */ - portconfig.SlotsSelect1 = SlotCfgNone; - portconfig.FirstBlockNum1 = 0; - portconfig.FirstSlotMask1 = 0x0000; - portconfig.SecBlockNum1 = 1; - portconfig.SecSlotMask1 = 0x0000; - portconfig.SerialWordSize1 = SerWordSize8; - portconfig.CompandingMode1 = cmpNone; - portconfig.TxFrameSyncPolarity1 = FrameSyncActHigh; - portconfig.RxFrameSyncPolarity1 = FrameSyncActHigh; - portconfig.TxClockPolarity1 = SerClockActHigh; - portconfig.RxClockPolarity1 = SerClockActHigh; - portconfig.TxDataDelay1 = DataDelay0; - portconfig.RxDataDelay1 = DataDelay0; - portconfig.DxDelay1 = Disabled; - portconfig.ThirdSlotMask1 = 0x0000; - portconfig.FouthSlotMask1 = 0x0000; - portconfig.FifthSlotMask1 = 0x0000; - portconfig.SixthSlotMask1 = 0x0000; - portconfig.SevenSlotMask1 = 0x0000; - portconfig.EightSlotMask1 = 0x0000; - - /* Second Serial Port config */ - portconfig.SlotsSelect2 = SlotCfg8Groups; - portconfig.FirstBlockNum2 = 0; - portconfig.FirstSlotMask2 = 0x5554; - portconfig.SecBlockNum2 = 1; - portconfig.SecSlotMask2 = 0x5555; - portconfig.ThirdSlotMask2 = 0x5555; - portconfig.FouthSlotMask2 = 0x5555; - portconfig.SerialWordSize2 = SerWordSize8; - portconfig.CompandingMode2 = cmpNone; - portconfig.TxFrameSyncPolarity2 = FrameSyncActHigh; - portconfig.RxFrameSyncPolarity2 = FrameSyncActHigh; - portconfig.TxClockPolarity2 = SerClockActHigh; - portconfig.RxClockPolarity2 = SerClockActHigh; - portconfig.TxDataDelay2 = DataDelay0; - portconfig.RxDataDelay2 = DataDelay0; - portconfig.DxDelay2 = Disabled; - portconfig.FifthSlotMask2 = 0x0001; - portconfig.SixthSlotMask2 = 0x0000; - portconfig.SevenSlotMask2 = 0x0000; - portconfig.EightSlotMask2 = 0x0000; - - /* Third Serial Port Config */ - portconfig.SlotsSelect3 = SlotCfg8Groups; - portconfig.FirstBlockNum3 = 0; - portconfig.FirstSlotMask3 = 0x5554; - portconfig.SecBlockNum3 = 1; - portconfig.SecSlotMask3 = 0x5555; - portconfig.SerialWordSize3 = SerWordSize8; - portconfig.CompandingMode3 = cmpNone; - portconfig.TxFrameSyncPolarity3 = FrameSyncActHigh; - portconfig.RxFrameSyncPolarity3 = FrameSyncActHigh; - portconfig.TxClockPolarity3 = SerClockActHigh; - portconfig.RxClockPolarity3 = SerClockActLow; - portconfig.TxDataDelay3 = DataDelay0; - portconfig.RxDataDelay3 = DataDelay0; - portconfig.DxDelay3 = Disabled; - portconfig.ThirdSlotMask3 = 0x5555; - portconfig.FouthSlotMask3 = 0x5555; - portconfig.FifthSlotMask3 = 0x0001; - portconfig.SixthSlotMask3 = 0x0000; - portconfig.SevenSlotMask3 = 0x0000; - portconfig.EightSlotMask3 = 0x0000; - - if ((configportstatus = gpakConfigurePorts(vpm150m->dspid, &portconfig, &pstatus))) { - module_printk("Configuration of ports failed (%d)!\n", configportstatus); - return -1; - } else { - debug_printk(1, "Configured McBSP ports successfully\n"); - } - - if ((res = gpakPingDsp(vpm150m->dspid, &vpm150m->version))) { - module_printk("Error pinging DSP (%d)\n", res); - return -1; - } - - for (i = 0; i < 32; i++) { - /* Let's configure a channel */ - chanconfig.PcmInPortA = 3; - chanconfig.PcmInSlotA = (i + 1) * 2; - chanconfig.PcmOutPortA = 2; - chanconfig.PcmOutSlotA = (i + 1) * 2; - chanconfig.PcmInPortB = 2; - chanconfig.PcmInSlotB = (i + 1) * 2; - chanconfig.PcmOutPortB = 3; - chanconfig.PcmOutSlotB = (i + 1) * 2; - if (vpmdtmfsupport) { - chanconfig.ToneTypesA = DTMF_tone; - chanconfig.MuteToneA = Enabled; - chanconfig.FaxCngDetA = Enabled; - } else { - chanconfig.ToneTypesA = Null_tone; - chanconfig.MuteToneA = Disabled; - chanconfig.FaxCngDetA = Disabled; - } - chanconfig.ToneTypesB = Null_tone; - chanconfig.EcanEnableA = Enabled; - chanconfig.EcanEnableB = Disabled; - chanconfig.MuteToneB = Disabled; - chanconfig.FaxCngDetB = Disabled; - - chanconfig.SoftwareCompand = cmpNone; - - chanconfig.FrameRate = rate10ms; - - chanconfig.EcanParametersA.EcanTapLength = 1024; - chanconfig.EcanParametersA.EcanNlpType = vpmnlptype; - chanconfig.EcanParametersA.EcanAdaptEnable = 1; - chanconfig.EcanParametersA.EcanG165DetEnable = 1; - chanconfig.EcanParametersA.EcanDblTalkThresh = 6; - chanconfig.EcanParametersA.EcanNlpThreshold = vpmnlpthresh; - chanconfig.EcanParametersA.EcanNlpConv = 0; - chanconfig.EcanParametersA.EcanNlpUnConv = 0; - chanconfig.EcanParametersA.EcanNlpMaxSuppress = vpmnlpmaxsupp; - chanconfig.EcanParametersA.EcanCngThreshold = 43; - chanconfig.EcanParametersA.EcanAdaptLimit = 50; - chanconfig.EcanParametersA.EcanCrossCorrLimit = 15; - chanconfig.EcanParametersA.EcanNumFirSegments = 3; - chanconfig.EcanParametersA.EcanFirSegmentLen = 64; - - chanconfig.EcanParametersB.EcanTapLength = 1024; - chanconfig.EcanParametersB.EcanNlpType = vpmnlptype; - chanconfig.EcanParametersB.EcanAdaptEnable = 1; - chanconfig.EcanParametersB.EcanG165DetEnable = 1; - chanconfig.EcanParametersB.EcanDblTalkThresh = 6; - chanconfig.EcanParametersB.EcanNlpThreshold = vpmnlpthresh; - chanconfig.EcanParametersB.EcanNlpConv = 0; - chanconfig.EcanParametersB.EcanNlpUnConv = 0; - chanconfig.EcanParametersB.EcanNlpMaxSuppress = vpmnlpmaxsupp; - chanconfig.EcanParametersB.EcanCngThreshold = 43; - chanconfig.EcanParametersB.EcanAdaptLimit = 50; - chanconfig.EcanParametersB.EcanCrossCorrLimit = 15; - chanconfig.EcanParametersB.EcanNumFirSegments = 3; - chanconfig.EcanParametersB.EcanFirSegmentLen = 64; - - if ((res = gpakConfigureChannel(vpm150m->dspid, i, tdmToTdm, &chanconfig, &cstatus))) { - module_printk("Unable to configure channel (%d)\n", res); - if (res == 1) { - module_printk("Reason %d\n", cstatus); - } - - return -1; - } - - if ((res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &algstatus))) { - module_printk("Unable to disable echo can on channel %d (reason %d:%d)\n", i + 1, res, algstatus); - return -1; - } - - if (vpmdtmfsupport) { - if ((res = gpakAlgControl(vpm150m->dspid, i, DisableDTMFMuteA, &algstatus))) { - module_printk("Unable to disable dtmf muting on channel %d (reason %d:%d)\n", i + 1, res, algstatus); - return -1; - } - } - } - - if ((res = gpakPingDsp(vpm150m->dspid, &vpm150m->version))) { - module_printk("Error pinging DSP (%d)\n", res); - return -1; - } - - /* Turn on DTMF detection */ - if (vpmdtmfsupport) - set_bit(VPM150M_DTMFDETECT, &vpm150m->control); - set_bit(VPM150M_ACTIVE, &vpm150m->control); - - return 0; -} - -#endif diff --git a/zaptel/kernel/wcte12xp/vpmadt032.h b/zaptel/kernel/wcte12xp/vpmadt032.h deleted file mode 100644 index 1bcdd3e5..00000000 --- a/zaptel/kernel/wcte12xp/vpmadt032.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Digium, Inc. Wildcard TE12xP T1/E1 card Driver - * - * Written by Michael Spiceland - * - * Adapted from the wctdm24xxp and wcte11xp drivers originally - * written by Mark Spencer - * Matthew Fredrickson - * William Meadows - * - * Copyright (C) 2007, Digium, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _VPM150M_H -#define _VPM150M_H - -#include "wcte12xp.h" -#include "adt_lec.h" - -struct t1_firmware { - const struct firmware *fw; - unsigned int offset; -}; - -/* Host and DSP system dependent related definitions. */ -#define MAX_DSP_CORES 128 /* maximum number of DSP cores */ -//#define MAX_CONFS 1 /* maximum number of conferences */ -//#define MAX_PKT_CHANNELS 8 /* maximum number of packet channels */ -#define MAX_CHANNELS 32 /* maximum number of channels */ -#define MAX_WAIT_LOOPS 50 /* max number of wait delay loops */ -#define DSP_IFBLK_ADDRESS 0x0100 /* DSP address of I/F block pointer */ -#define DOWNLOAD_BLOCK_SIZE 512 /* download block size (DSP words) */ -//#define MAX_CIDPAYLOAD_BYTES 512 /* max size of a CID payload (octets) */ -typedef unsigned short DSP_WORD; /* 16 bit DSP word */ -typedef unsigned int DSP_ADDRESS; /* 32 bit DSP address */ -typedef struct t1_firmware* GPAK_FILE_ID; /* G.PAK Download file identifier */ - -#define __VPM150M_RWPAGE (1 << 4) -#define __VPM150M_RD (1 << 3) -#define __VPM150M_WR (1 << 2) -#define __VPM150M_FIN (1 << 1) -#define __VPM150M_TX (1 << 0) - -#define VPM150M_HPI_CONTROL 0x00 -#define VPM150M_HPI_ADDRESS 0x02 -#define VPM150M_HPI_DATA 0x03 - -#define VPM150M_MAX_COMMANDS 8 - -/* Some Bit ops for different operations */ -#define VPM150M_SPIRESET 0 -#define VPM150M_HPIRESET 1 -#define VPM150M_SWRESET 2 -#define VPM150M_DTMFDETECT 3 -#define VPM150M_ACTIVE 4 -#define VPM150M_MAX_DATA 1 - -struct vpm150m_cmd { - unsigned short address; - unsigned short data[VPM150M_MAX_DATA]; - unsigned char ident; - unsigned char datalen; - unsigned int flags; - unsigned char cs_slot; -}; - -struct vpm150m { - unsigned short dspid; - unsigned long control; - unsigned char curpage; - unsigned short version; - struct vpm150m_cmd cmdq[VPM150M_MAX_COMMANDS]; - spinlock_t lock; /* control access to list of bottom half tasks */ - struct semaphore sem; - struct workqueue_struct *wq; - struct work_struct work_dtmf; - struct work_struct work_debug; - struct work_struct work_echocan; - struct list_head worklist; - unsigned char curtone[32]; - unsigned long curdtmfmutestate; - unsigned long desireddtmfmutestate; - struct adt_lec_params chan_params[32]; - struct t1 *wc; -}; - -/* linked list for vpm echocan workqueue*/ -struct vpm150m_workentry { - struct list_head list; - struct t1 *wc; /* what card are we dealing with? */ - struct zt_chan *chan; /* what channels are we going to deal with? */ - struct adt_lec_params params; /* how should we behave? */ -}; - -extern int debug; -extern int vpmsupport; -extern int vpmdtmfsupport; -extern struct pci_driver te12xp_driver; - -void t1_vpm150m_init(struct t1 *wc); -void vpm150m_cmd_dequeue(struct t1 *wc, volatile unsigned char *writechunk, int whichframe); -void vpm150m_cmd_decipher(struct t1 *wc, volatile unsigned char *readchunk); -int vpm150m_config_hw(struct t1 *wc); - -/* gpak API functions */ -void gpakReadDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to read */ - DSP_WORD *pWordValues /* pointer to array of word values variable */ - ); -void gpakWriteDspMemory( - unsigned short int DspId, /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - DSP_ADDRESS DspAddress, /* DSP's memory address of first word */ - unsigned int NumWords, /* number of contiguous words to write */ - DSP_WORD *pWordValues /* pointer to array of word values to write */ - ); -void gpakHostDelay(void); -void gpakLockAccess( - unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - ); -void gpakUnlockAccess( - unsigned short int DspId /* DSP Identifier (0 to MAX_DSP_CORES-1) */ - ); -int gpakReadFile( - GPAK_FILE_ID FileId, /* G.PAK Download File Identifier */ - unsigned char *pBuffer, /* pointer to buffer for storing bytes */ - unsigned int NumBytes /* number of bytes to read */ - ); - -#endif diff --git a/zaptel/kernel/wcte12xp/wcte12xp.h b/zaptel/kernel/wcte12xp/wcte12xp.h deleted file mode 100644 index 92578e73..00000000 --- a/zaptel/kernel/wcte12xp/wcte12xp.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Digium, Inc. Wildcard TE12xP T1/E1 card Driver - * - * Written by Michael Spiceland - * - * Adapted from the wctdm24xxp and wcte11xp drivers originally - * written by Mark Spencer - * Matthew Fredrickson - * William Meadows - * - * Copyright (C) 2007, Digium, Inc. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _WCTE12XP_H -#define _WCTE12XP_H - -#ifdef LINUX26 -/* Comment to disable VPM support */ -#define VPM_SUPPORT 1 -#endif - -#define WC_MAX_IFACES 8 - -#ifdef VPM_SUPPORT -#define MAX_TDM_CHAN 31 -#endif - -#define SDI_CLK (0x00010000) -#define SDI_DOUT (0x00020000) -#define SDI_DREAD (0x00040000) -#define SDI_DIN (0x00080000) - -#define EFRAME_SIZE 108 -#define ERING_SIZE 16 /* Maximum ring size */ -#define EFRAME_GAP 20 -#define SFRAME_SIZE ((EFRAME_SIZE * ZT_CHUNKSIZE) + (EFRAME_GAP * (ZT_CHUNKSIZE - 1))) - -#define PCI_WINDOW_SIZE ((2 * 2 * 2 * SFRAME_SIZE) + (2 * ERING_SIZE * 4)) - -#define MAX_COMMANDS 7*7*2*2 /* 42 bytes /3 (cntl,addr,data) /2 (cs) */ - -#define NUM_EC 4 - -#define __CMD_VPM (1 << 16) /* flag for VPM action */ -#define __CMD_ISR (1 << 17) /* flag for ISR reads */ -#define __CMD_PINS (1 << 18) /* CPLD pin read */ -#define __CMD_LEDS (1 << 19) /* LED Operation */ -#define __CMD_RD (1 << 20) /* Read Operation */ -#define __CMD_WR (1 << 21) /* Write Operation */ -#define __CMD_FIN (1 << 22) /* Has finished receive */ -#define __CMD_TX (1 << 23) /* Has been transmitted */ - -#define __LED_ORANGE (1<<3) -#define __LED_GREEN (1<<2) -#define __LED_RED (1<<1) - -#define SET_LED_ORANGE(a) a | __LED_ORANGE -#define SET_LED_RED(a) (a | __LED_RED) & ~__LED_GREEN -#define SET_LED_GREEN(a) (a | __LED_GREEN) & ~__LED_RED - -#define UNSET_LED_ORANGE(a) a & ~__LED_ORANGE -#define UNSET_LED_REDGREEN(a) a | __LED_RED | __LED_GREEN - -#define CMD_WR(a,b) (((a) << 8) | (b) | __CMD_WR) -#define CMD_RD(a) (((a) << 8) | __CMD_RD) -#define CMD_LEDS(a) (((a) << 8) | __CMD_LEDS) -//#define CMD_BYTE(slot, a) (slot*6)+(a*2) /* only even slots */ -#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 - -#define NOT_VPM -1 - -#define module_printk(fmt, args...) printk("%s: " fmt, te12xp_driver.name, ## args) -#define debug_printk(level, fmt, args...) if (debug >= level) printk("%s (%s): " fmt, te12xp_driver.name, __FUNCTION__, ## args) -extern spinlock_t ifacelock; - -struct command { - unsigned short address; - unsigned char data; - unsigned char ident; - unsigned int flags; - unsigned char cs_slot; - unsigned char vpm_num; /* ignored for all but vpm commmands */ -}; - -struct cmdq { - struct command cmds[MAX_COMMANDS]; -}; - -struct vpm150m; - -struct t1 { - spinlock_t reglock; - unsigned char txident; - unsigned char rxident; - unsigned char statreg; /* bit 0 = vpmadt032 int */ - int spantype; - struct { - unsigned int nmf:1; - unsigned int sendingyellow:1; - } flags; - unsigned char txsigs[16]; /* Copy of tx sig registers */ - int num; - int alarmcount; /* How much red alarm we've seen */ - int alarmdebounce; - char *variety; - char name[80]; - unsigned int intcount; - int sync; - int dead; - int blinktimer; - int alarmtimer; - int yellowtimer; - int ledlastvalue; - int alarms_read; - int checktiming; /* Set >0 to cause the timing source to be checked */ - int loopupcnt; - int loopdowncnt; - int initialized; - int *chanmap; - unsigned char ledtestreg; - unsigned char ec_chunk1[32][ZT_CHUNKSIZE]; - unsigned char ec_chunk2[32][ZT_CHUNKSIZE]; - struct zt_span span; /* Span */ - struct zt_chan chans[32]; /* Channels */ - wait_queue_head_t regq; - struct cmdq cmdq; - struct command dummy; /* preallocate for dummy noop command */ - unsigned char ctlreg; - unsigned int rxints; - unsigned int txints; - int usecount; - struct voicebus* vb; - unsigned int isrreaderrors; -#ifdef VPM_SUPPORT - int vpm; - struct vpm150m *vpm150m; - unsigned long dtmfactive; - unsigned long dtmfmask; - unsigned long dtmfmutemask; -#endif -}; - -int schluffen(wait_queue_head_t *q); - -#endif diff --git a/zaptel/kernel/wcusb.c b/zaptel/kernel/wcusb.c deleted file mode 100644 index b1985d99..00000000 --- a/zaptel/kernel/wcusb.c +++ /dev/null @@ -1,1489 +0,0 @@ -/* - * Wildcard S100U USB FXS Interface Zapata Telephony Driver - * - * Written by Mark Spencer - * Matthew Fredrickson - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* Save power at the expense of not always being able to transmit on hook. If - this is set, we only transit on hook for some time after a ring - (POWERSAVE_TIMEOUT) */ - -/* #define PROSLIC_POWERSAVE */ -#define POWERSAVE_TIME 4000 - -#include -#include -#include -#include -#include -#include -#include - -#include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19) -#define USB2420 -#endif - -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif /* STANDALONE_ZAPATA */ - -#include "wcusb.h" -#include "proslic.h" - -#ifndef FILL_CONTROL_URB -#define FILL_CONTROL_URB usb_fill_control_urb -#endif - -#ifdef DEBUG_WILDCARD -#define DPRINTK(x) printk x -#else -#define DPRINTK(x) -#endif - -// Function prototypes -static int readProSlicDirectReg(struct usb_device *dev, unsigned char address, unsigned char* data); -static int initializeIndirectRegisters(struct usb_device *dev); -static int verifyIndirectRegisters(struct usb_device *dev); -static int writeProSlicDirectReg(struct usb_device *dev, unsigned char address, unsigned char data); -static int writeProSlicInDirectReg(struct usb_device *dev, unsigned char address, unsigned short data); -static int readProSlicInDirectReg(struct usb_device *dev, unsigned char address, unsigned short *data); -static int writeProSlicInDirectReg(struct usb_device *dev, unsigned char address, unsigned short data); - -static alpha indirect_regs[] = -{ -{0,255,"DTMF_ROW_0_PEAK",0x55C2}, -{1,255,"DTMF_ROW_1_PEAK",0x51E6}, -{2,255,"DTMF_ROW2_PEAK",0x4B85}, -{3,255,"DTMF_ROW3_PEAK",0x4937}, -{4,255,"DTMF_COL1_PEAK",0x3333}, -{5,255,"DTMF_FWD_TWIST",0x0202}, -{6,255,"DTMF_RVS_TWIST",0x0202}, -{7,255,"DTMF_ROW_RATIO_TRES",0x0198}, -{8,255,"DTMF_COL_RATIO_TRES",0x0198}, -{9,255,"DTMF_ROW_2ND_ARM",0x0611}, -{10,255,"DTMF_COL_2ND_ARM",0x0202}, -{11,255,"DTMF_PWR_MIN_TRES",0x00E5}, -{12,255,"DTMF_OT_LIM_TRES",0x0A1C}, -{13,0,"OSC1_COEF",0x7B30}, -{14,1,"OSC1X",0x0063}, -{15,2,"OSC1Y",0x0000}, -{16,3,"OSC2_COEF",0x7870}, -{17,4,"OSC2X",0x007D}, -{18,5,"OSC2Y",0x0000}, -{19,6,"RING_V_OFF",0x0000}, -{20,7,"RING_OSC",0x7EF0}, -{21,8,"RING_X",0x0160}, -{22,9,"RING_Y",0x0000}, -{23,255,"PULSE_ENVEL",0x2000}, -{24,255,"PULSE_X",0x2000}, -{25,255,"PULSE_Y",0x0000}, -//{26,"RECV_DIGITAL_GAIN",0x4000}, // playback volume set lower -{26,13,"RECV_DIGITAL_GAIN",0x2000}, // playback volume set lower -{27,14,"XMIT_DIGITAL_GAIN",0x4000}, -//{27,"XMIT_DIGITAL_GAIN",0x2000}, -{28,15,"LOOP_CLOSE_TRES",0x1000}, -{29,16,"RING_TRIP_TRES",0x3600}, -{30,17,"COMMON_MIN_TRES",0x1000}, -{31,18,"COMMON_MAX_TRES",0x0200}, -{32,19,"PWR_ALARM_Q1Q2",0x07C0}, -{33,20,"PWR_ALARM_Q3Q4",0x2600}, -{34,21,"PWR_ALARM_Q5Q6",0x1B80}, -{35,22,"LOOP_CLOSURE_FILTER",0x8000}, -{36,23,"RING_TRIP_FILTER",0x0320}, -{37,24,"TERM_LP_POLE_Q1Q2",0x008C}, -{38,25,"TERM_LP_POLE_Q3Q4",0x0100}, -{39,26,"TERM_LP_POLE_Q5Q6",0x0010}, -{40,27,"CM_BIAS_RINGING",0x0C00}, -{41,64,"DCDC_MIN_V",0x0C00}, -{42,255,"DCDC_XTRA",0x1000}, -{43,66,"LOOP_CLOSE_TRES_LOW",0x1000}, -}; - -static int debug = 0; - -#define FLAG_FLIP_RELAYS (1 << 0) - -static struct wc_usb_desc wcusb = { "Wildcard S100U USB FXS Interface" }; -static struct wc_usb_desc wcusb2 = { "Wildcard S110U USB FXS Interface", FLAG_FLIP_RELAYS }; -static struct wc_usb_desc wc_usb_phone = { "Wildcard Phone Test driver" }; -static struct wc_usb_pvt *ifaces[WC_MAX_IFACES]; - - - -static void wcusb_check_keypad(struct wc_usb_pvt *p); -static int set_aux_ctrl(struct wc_usb_pvt *p, char auxpins, int on); - - - -static int Wcusb_WriteWcRegs(struct usb_device *dev, unsigned char index, - unsigned char *data, int len) -{ - unsigned int pipe = usb_sndctrlpipe(dev, 0); - int requesttype; - int res; - - requesttype = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - - res = usb_control_msg(dev, pipe, REQUEST_NORMAL, requesttype, - 0, index, data, len, CONTROL_TIMEOUT_JIFFIES); - if (res == -ETIMEDOUT) { - printk("wcusb: timeout on vendor write\n"); - return -1; - } else if (res < 0) { - printk("wcusb: Error executing control: status=%d\n", le32_to_cpu(res)); - return -1; - } - return 0; -} - -static int Wcusb_ReadWcRegs(struct usb_device *dev, unsigned char index, - unsigned char *data, int len) -{ - unsigned int pipe = usb_rcvctrlpipe(dev, 0); - int requesttype; - int res; - - requesttype = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - - res = usb_control_msg(dev, pipe, REQUEST_NORMAL, requesttype, - 0, index, data, len, CONTROL_TIMEOUT_JIFFIES); - if (res == -ETIMEDOUT) { - printk("wcusb: timeout on vendor write\n"); - return -1; - } else if (res < 0) { - printk("wcusb: Error executing control: status=%d\n", le32_to_cpu(res)); - return -1; - } else { - DPRINTK(("wcusb: Executed read, result = %d (data = %04x)\n", le32_to_cpu(res), (int) *data)); - } - return 0; -} - -#ifdef USB2420 -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs)); -static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs)); -static void wcusb_async_control(struct urb *urb, struct pt_regs *regs); -#else -static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb)); -static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb)); -static void wcusb_async_control(struct urb *urb); -#endif /* LINUX26 */ -#else -static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb)); -static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb)); -static void wcusb_async_control(urb_t *urb); -#endif - -static void proslic_read_direct_async(struct wc_usb_pvt *p, unsigned char address) -{ - p->wcregindex = address; - p->wcregbuf[0] = address | 0x80; - p->wcregbuf[1] = 0; - p->wcregbuf[2] = 0; - p->wcregbuf[3] = 0x67; - wcusb_async_write(p, WCUSB_SPORT0, p->wcregbuf, 4, STATE_WCREAD_WRITEREG, wcusb_async_control); -} - -static void proslic_write_direct_async(struct wc_usb_pvt *p, unsigned char address, unsigned char val) -{ - p->wcregindex = address; - p->wcregbuf[0] = address & 0x7f; - p->wcregbuf[1] = val; - p->wcregbuf[2] = 0; - p->wcregbuf[3] = 0x27; - wcusb_async_write(p, WCUSB_SPORT0, p->wcregbuf, 4, STATE_WCWRITE_WRITERES, wcusb_async_control); -} - -#ifdef USB2420 -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static void wcusb_async_control(struct urb *urb, struct pt_regs *regs) -#else -static void wcusb_async_control(struct urb *urb) -#endif -#else -static void wcusb_async_control(urb_t *urb) -#endif -{ - struct wc_usb_pvt *p = urb->context; - p->urbcount--; - if (urb->status) { - printk("Error in transfer...\n"); - /* return is the "right thing", but don't... */ - p->timer = 50; - /* return; */ - } - if (!(p->flags & FLAG_RUNNING)) { - return; - } - switch (p->controlstate) { - case STATE_WCREAD_WRITEREG: - /* We've written the register to sport0, now read form sport 1 */ - wcusb_async_read(p, WCUSB_SPORT1, &p->wcregval, 1, STATE_WCREAD_READRES, wcusb_async_control); - return; - case STATE_WCREAD_READRES: - switch(p->wcregindex) { - case 68: - if (!p->hookstate && (p->wcregval & 1)) { - p->hookstate = 1; - if (debug) - printk("Going off hook...\n"); - zt_hooksig(&p->chan, ZT_RXSIG_OFFHOOK); - } else if (p->hookstate && !(p->wcregval & 1)) { - p->hookstate = 0; - if (debug) - printk("Going on hook...\n"); - zt_hooksig(&p->chan, ZT_RXSIG_ONHOOK); - } - /* Set outgoing hook state if necessary */ - if (p->txhook != p->newtxhook) { - if (debug) - printk("Really setting hook state to %d\n", p->newtxhook); - p->txhook = p->newtxhook; - proslic_write_direct_async(p, 64, p->newtxhook); - } else - p->timer = 50; - break; - case 64: - if (debug) - printk("Read hook state as %02x\n", p->wcregval); - p->timer = 50; - break; - default: - printk("dunno what to do with read/regindex %d\n", p->wcregindex); - p->wcregindex = 0; - } - return; - case STATE_WCWRITE_WRITERES: - switch(p->wcregindex) { - case 64: - if (debug) { - printk("Hook transition complete to %d\n", ((char *)(urb->transfer_buffer))[1]); -#ifdef BOOST_RINGER - } - if (p->txhook == 4) { - /* Ringing -- boost battery to 96V */ - proslic_write_direct_async(p, 74, 0x3f); - } else { - /* Leave battery at default 75V */ - proslic_write_direct_async(p, 74, 0x32); - } - break; - case 74: - if (debug) { - printk("Battery set to -%dV\n", ((char *)(urb->transfer_buffer))[1] * 3 / 2); -#endif - proslic_read_direct_async(p, 64); - } else - p->timer = 50; - break; - default: - printk("dunno what to do with write/regindex %d\n", p->wcregindex); - p->wcregindex = 0; - } - return; - default: - printk("async control in unknown state %d\n", p->controlstate); - } -} - -#ifdef USB2420 -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static void keypad_check_done(struct urb *urb, struct pt_regs *regs) -#else -static void keypad_check_done(struct urb *urb) -#endif -#else -static void keypad_check_done(urb_t *urb) -#endif -{ - struct wc_usb_pvt *p = urb->context; - struct wc_keypad_data *d = p->pvt_data; - static char aux_pattern[] = {0x1e, 0x1d, 0x17, 0xf}; - char digit = 'z'; - - p->urbcount--; - if (!d->running) { - printk("Stopping stream (check_done)\n"); - return; - } - - if (urb->status) { - printk("status %d\n", urb->status); - } - - if (debug) printk("i is %d\n", d->i); - switch (d->state) { -loop_start: - case STATE_FOR_LOOP_1_OUT: - if (debug) printk("data12 is %x\n", d->data12); - if(d->i < sizeof(aux_pattern) / sizeof(char)) { - d->tmp = aux_pattern[d->i] | (d->data12 & 0xe0); - d->state = STATE_FOR_LOOP_2_IN; - if (debug) printk("tmp is %x\n", d->tmp); - wcusb_async_write(p, 0x12, &d->tmp, 1, 0, keypad_check_done); - return; - } else { - goto func_end; - } - case STATE_FOR_LOOP_2_IN: - d->state = STATE_FOR_LOOP_PROC_DATA; - wcusb_async_read(p, 0xc0, &d->data, 1, 0, keypad_check_done); - return; - case STATE_FOR_LOOP_PROC_DATA: - d->state = STATE_FOR_LOOP_CLEAR_DIGIT; - if(debug) printk("data is %x\n", d->data); - if ((d->data & 0x1f) != 0x1f) { - if(d->data == 0xe && aux_pattern[d->i] == 0x1e) { digit = '1';} - else if(d->data == 0xd && aux_pattern[d->i] == 0x1e) { digit = '2';} - else if(d->data == 0xb && aux_pattern[d->i] == 0x1e) { digit = '3';} - else if(d->data == 0x7 && aux_pattern[d->i] == 0x1e) { - p->hookstate = 0; /* On||Off */ - zt_hooksig(&p->chan, ZT_RXSIG_ONHOOK); - } - - else if(d->data == 0xe && aux_pattern[d->i] == 0x1d) { digit = '4';} - else if(d->data == 0xd && aux_pattern[d->i] == 0x1d) { digit = '5';} - else if(d->data == 0xb && aux_pattern[d->i] == 0x1d) { digit = '6';} - else if(d->data == 0x7 && aux_pattern[d->i] == 0x1d) { - p->hookstate = 1;/* Dial */ - zt_hooksig(&p->chan, ZT_RXSIG_OFFHOOK); - } - - else if(d->data == 0xe && aux_pattern[d->i] == 0x17) { digit = '7';} - else if(d->data == 0xd && aux_pattern[d->i] == 0x17) { digit = '8';} - else if(d->data == 0xb && aux_pattern[d->i] == 0x17) { digit = '9';} - else if(d->data == 0x7 && aux_pattern[d->i] == 0x17) d->scanned_event = 15; /* ReDial */ - - else if(d->data == 0xe && aux_pattern[d->i] == 0xf) { digit = '*';}/* '*' */ - else if(d->data == 0xd && aux_pattern[d->i] == 0xf) { digit = '0';} - else if(d->data == 0xb && aux_pattern[d->i] == 0xf) { digit = '#';} /* '#' */ - else if(d->data == 0x7 && aux_pattern[d->i] == 0xf) d->scanned_event = 16; /* Volume? */ - else { - (d->i)++; - if (debug) printk("Scanned event %d; data = %x\n", d->scanned_event, d->data); - goto loop_start; - } - } else { - if(debug) printk("Hit new if\n"); - goto func_end; - } - if (debug) printk("wcusb: got digit %d\n", d->scanned_event); - if (digit != 'z') { - d->tone = zt_mf_tone(&p->chan, digit, p->chan.digitmode); - if (!d->tone) { - printk("wcusb: Didn't get a tone structure\n"); - goto func_end; - } - zt_init_tone_state(&d->ts, d->tone); - p->sample = STREAM_DTMF; - } - d->count = 0; - case STATE_FOR_LOOP_CLEAR_DIGIT: - if (((d->data & 0xf) != 0xf) && d->count < 200) { - wcusb_async_read(p, 0xc0, &d->data, 1, 0, keypad_check_done); - return; - } - (d->i)++; - p->sample = STREAM_NORMAL; - goto loop_start; - } -func_end: - p->timer = 100; - return; -} - -static void wcusb_check_interrupt(struct wc_usb_pvt *p) -{ - /* Start checking for interrupts */ - if (p->devclass == WC_KEYPAD) { - wcusb_check_keypad(p); - } else { - proslic_read_direct_async(p, 68); - } - return; -} - -#ifdef USB2420 -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs)) -#else -static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb)) -#endif /* LINUX26 */ -#else -static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb)) -#endif -{ - __u16 size = len; - __u16 ind = index; -#ifdef USB2420 - struct urb *urb = &p->control; - memset(urb, 0, sizeof(struct urb)); - - p->dr.bRequestType = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - p->dr.bRequest = REQUEST_NORMAL; - p->dr.wValue = 0; - p->dr.wIndex = cpu_to_le16(ind); - p->dr.wLength = cpu_to_le16(size); -#else - urb_t *urb = &p->control; - memset(urb, 0, sizeof(urb_t)); - - p->dr.requesttype = USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - p->dr.request = REQUEST_NORMAL; - p->dr.value = 0; - p->dr.index = cpu_to_le16(ind); - p->dr.length = cpu_to_le16(size); -#endif - - FILL_CONTROL_URB(urb, p->dev, usb_rcvctrlpipe(p->dev, 0), (unsigned char *)&p->dr, data, len, complete, p); -#ifdef LINUX26 - if (usb_submit_urb(urb, GFP_KERNEL)) -#else - if (usb_submit_urb(urb)) -#endif - { - printk("wcusb_async_read: control URB died\n"); - p->timer = 50; - return -1; - } - p->controlstate = state; - p->urbcount++; - return 0; -} - -#ifdef USB2420 -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs)) -#else -static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb)) -#endif /* LINUX26 */ -#else -static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb)) -#endif -{ - __u16 size = len; - __u16 ind = index; -#ifdef USB2420 - struct urb *urb = &p->control; - memset(urb, 0, sizeof(struct urb)); - - p->dr.bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - p->dr.bRequest = REQUEST_NORMAL; - p->dr.wValue = 0; - p->dr.wIndex = cpu_to_le16(ind); - p->dr.wLength = cpu_to_le16(size); -#else - urb_t *urb = &p->control; - memset(urb, 0, sizeof(urb_t)); - - p->dr.requesttype = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE; - p->dr.request = REQUEST_NORMAL; - p->dr.value = 0; - p->dr.index = cpu_to_le16(ind); - p->dr.length = cpu_to_le16(size); -#endif - - FILL_CONTROL_URB(urb, p->dev, usb_sndctrlpipe(p->dev, 0), (unsigned char *)&p->dr, data, len, complete, p); -#ifdef LINUX26 - if (usb_submit_urb(urb, GFP_KERNEL)) -#else - if (usb_submit_urb(urb)) -#endif - { - printk("wcusb_async_write: control URB died\n"); - return -1; - } - p->controlstate = state; - p->urbcount++; - return 0; -} - -/* -** Write register to Wc560 -*/ -static int wcoutp(struct usb_device *dev, unsigned char address, unsigned char data) -{ - if (!Wcusb_WriteWcRegs(dev, address, &data, 1)) - return 0; - - return -1; -} - -/* -** read register from Wc560 -*/ -static int wcinp(struct usb_device *dev, unsigned char address, unsigned char* data ) -{ - if (!Wcusb_ReadWcRegs(dev, address, data, 1)) - return 0; - - return -1; -} - -static int waitForProSlicIndirectRegAccess(struct usb_device *dev) -{ - unsigned char count, data; - count = 0; - while (count++ < 3) - { - data = 0; - readProSlicDirectReg(dev, I_STATUS, &data); - - if (!data) - return 0; - - } - - if(count > 2) printk(" ##### Loop error #####\n"); - - return -1; -} - -static int writeProSlicInDirectReg(struct usb_device *dev, unsigned char address, unsigned short data) -{ - - if(!waitForProSlicIndirectRegAccess(dev)) - { - if (!writeProSlicDirectReg(dev, IDA_LO,(unsigned char)(data & 0xFF))) - { - if(!writeProSlicDirectReg(dev, IDA_HI,(unsigned char)((data & 0xFF00)>>8))) - { - if(!writeProSlicDirectReg(dev, IAA,address)) - return 0; - } - } - } - - return -1; -} - -/* -** Read register from ProSlic -*/ -int readProSlicDirectReg(struct usb_device *dev, unsigned char address, unsigned char* dataRead) -{ - unsigned char data[4]; - - data[0] = address | 0x80; - data[1] = 0; - data[2] = 0; - data[3] = 0x67; - - // write to WC register 0x26 - Wcusb_WriteWcRegs(dev, WCUSB_SPORT0, data, 4); - Wcusb_ReadWcRegs(dev, WCUSB_SPORT1, data, 1); - *dataRead = data[0]; - - return 0; -} - -/* -** Write register to ProSlic -*/ -int writeProSlicDirectReg(struct usb_device *dev, unsigned char address, unsigned char RegValue) -{ - unsigned char data[4]; - - data[0] = address & 0x7f; - data[1] = RegValue; - data[2] = 0; - data[3] = 0x27; - - // write to WC register 0x26 - return Wcusb_WriteWcRegs(dev, WCUSB_SPORT0, data, 4); -} - -static int readProSlicInDirectReg(struct usb_device *dev, unsigned char address, unsigned short *data) -{ - if (!waitForProSlicIndirectRegAccess(dev)) - { - if (!writeProSlicDirectReg(dev,IAA,address)) - { - if(!waitForProSlicIndirectRegAccess(dev)) - { - unsigned char data1, data2; - - if (!readProSlicDirectReg(dev,IDA_LO, &data1) && !readProSlicDirectReg (dev, IDA_HI, &data2)) - { - *data = data1 | (data2 << 8); - return 0; - } else - printk("Failed to read direct reg\n"); - } else - printk("Failed to wait inside\n"); - } else - printk("failed write direct IAA\n"); - } else - printk("failed to wait\n"); - - return -1; -} - -static int initializeIndirectRegisters(struct usb_device *dev) -{ - unsigned char i; - - for (i=0; i<43; i++) - { - if(writeProSlicInDirectReg(dev, i,indirect_regs[i].initial)) - return -1; - } - - return 0; -} - -static int verifyIndirectRegisters(struct usb_device *dev) -{ - int passed = 1; - unsigned short i,j, initial; - - for (i=0; i<43; i++) - { - if(readProSlicInDirectReg(dev, (unsigned char) i, &j)) { - printk("Failed to read indirect register %d\n", i); - return -1; - } - initial= indirect_regs[i].initial; - - if ( j != initial ) - { - printk("!!!!!!! %s iREG %X = %X should be %X\n", - indirect_regs[i].name,i,j,initial ); - passed = 0; - } - } - - if (passed) { - if (debug) - printk("Init Indirect Registers completed successfully.\n"); - } else { - printk(" !!!!! Init Indirect Registers UNSUCCESSFULLY.\n"); - } - - return 0; -} - -static int calibrateAndActivateProSlic(struct usb_device *dev) -{ - unsigned char x; - - if(writeProSlicDirectReg(dev, 92, 0xc8)) - return -1; - - if(writeProSlicDirectReg(dev, 97, 0)) - return -1; - - if(writeProSlicDirectReg(dev, 93, 0x19)) - return -1; - - if(writeProSlicDirectReg(dev, 14, 0)) - return -1; - - if(writeProSlicDirectReg(dev, 93, 0x99)) - return -1; - - if(!readProSlicDirectReg (dev, 93, &x)) - { - if (debug) - printk("DC Cal x=%x\n",x); - - if (!writeProSlicDirectReg(dev, 97, 0)) - { - if(!writeProSlicDirectReg(dev, CALIBR1, CALIBRATE_LINE)) - { - unsigned char data; - - if(!readProSlicDirectReg(dev, CALIBR1, &data)) - return writeProSlicDirectReg(dev, LINE_STATE,ACTIVATE_LINE); - } - } - } - - return -1; -} - -static int InitProSlic(struct usb_device *dev) -{ - if (writeProSlicDirectReg(dev, 67, 0x0e)) - /* Disable Auto Power Alarm Detect and other "features" */ - return -1; - if (initializeIndirectRegisters(dev)) { - printk(KERN_INFO "Indirect Registers failed to initialize.\n"); - return -1; - } - if (verifyIndirectRegisters(dev)) { - printk(KERN_INFO "Indirect Registers failed verification.\n"); - return -1; - } - if (calibrateAndActivateProSlic(dev)) { - printk(KERN_INFO "ProSlic Died on Activation.\n"); - return -1; - } - if (writeProSlicInDirectReg(dev, 97, 0x0)) { // Stanley: for the bad recording fix - printk(KERN_INFO "ProSlic IndirectReg Died.\n"); - return -1; - } - if (writeProSlicDirectReg(dev, 1, 0x2a)) { // U-Law GCI 8-bit interface - printk(KERN_INFO "ProSlic DirectReg Died.\n"); - return -1; - } - if (writeProSlicDirectReg(dev, 2, 0)) // Tx Start count low byte 0 - return -1; - if (writeProSlicDirectReg(dev, 3, 0)) // Tx Start count high byte 0 - return -1; - if (writeProSlicDirectReg(dev, 4, 0)) // Rx Start count low byte 0 - return -1; - if (writeProSlicDirectReg(dev, 5, 0)) // Rx Start count high byte 0 - return -1; - if (writeProSlicDirectReg(dev, 8, 0x0)) // disable loopback - return -1; - if (writeProSlicDirectReg(dev, 18, 0xff)) // clear all interrupt - return -1; - if (writeProSlicDirectReg(dev, 19, 0xff)) - return -1; - if (writeProSlicDirectReg(dev, 20, 0xff)) - return -1; - if (writeProSlicDirectReg(dev, 21, 0x00)) // enable interrupt - return -1; - if (writeProSlicDirectReg(dev, 22, 0x02)) // Loop detection interrupt - return -1; - if (writeProSlicDirectReg(dev, 23, 0x01)) // DTMF detection interrupt - return -1; - if (writeProSlicDirectReg(dev, 72, 0x20)) - return -1; -#ifdef BOOST_RINGER - /* Beef up Ringing voltage to 89V */ - if (writeProSlicInDirectReg(dev, 23, 0x1d1)) - return -1; -#endif - return 0; -} - -static int init_hardware(struct wc_usb_pvt *p) -{ - struct usb_device *dev = p->dev; - - switch (p->devclass) { - case WC_PROSLIC: - if (wcoutp(dev, 0x12, 0x00)) /* AUX6 as output, set to low */ - return -1; - if (wcoutp(dev, 0x13, 0x40)) /* AUX6 is output */ - return -1; - if (wcoutp(dev, 0, 0x50)) /* extrst, AUX2 is suspend */ - return -1; - if (wcoutp(dev, 0x29, 0x20)) /* enable SerialUP AUX pin definition */ - return -1; - if (wcoutp(dev, 0, 0x51)) /* no extrst, AUX2 is suspend */ - return -1; - /* Make sure there is no gain */ - if (wcoutp(dev, 0x22, 0x00)) - return -1; - if (wcoutp(dev, 0x23, 0xf2)) - return -1; - if (wcoutp(dev, 0x24, 0x00)) - return -1; - if (wcoutp(dev, 0x25, 0xc9)) - return -1; - if (InitProSlic(dev)) { - printk("wcusb: Failed to initialize proslic\n"); - return -1; - } - case WC_KEYPAD: - set_aux_ctrl(p, WC_AUX0, 1); - set_aux_ctrl(p, WC_AUX1, 1); - set_aux_ctrl(p, WC_AUX2, 1); - set_aux_ctrl(p, WC_AUX3, 1); - } - - if (debug) printk("wcusb: Setting correct interfaces.\n"); - - /* Setup correct settings (8000 Hz, signed linear) */ - if (usb_set_interface(dev, 2, 1)) { - printk("wcusb: Unable to setup USB interface 2 to altsetting 1\n"); - return -1; - } - if (usb_set_interface(dev, 3, 1)) { - printk("wcusb: Unable to setup USB interface 3 to altsetting 1\n"); - return -1; - } - return 0; -} - -/* Don't call from an interrupt context */ -static int set_aux_ctrl(struct wc_usb_pvt *p, char uauxpins, int on) -{ - char udata12 = 0; - char udata13 = 0; - - wcinp(p->dev, 0x12, &udata12); - wcinp(p->dev, 0x13, &udata13); - - wcoutp(p->dev, 0x12, on ? (uauxpins | udata12) : (~uauxpins & udata12)); - wcoutp(p->dev, 0x13, uauxpins | udata13); - - return 0; -} - -static void wcusb_check_keypad(struct wc_usb_pvt *p) -{ - struct wc_keypad_data *d = p->pvt_data; - - if (!d->running) { - printk("Stopping keypad stream\n"); - return; - } - if (debug) printk("Launched a packet\n"); - d->state = STATE_FOR_LOOP_1_OUT; - d->data = -1; - d->data12 = -1; - d->scanned_event = -1; - d->i = 0; - wcusb_async_read(p, 0x12, &d->data12, 1, 0, keypad_check_done); - return; -} - -static char wc_dtmf(struct wc_usb_pvt *p) -{ - struct wc_keypad_data *d = p->pvt_data; - short linsample = 0; - - if (!d) { - printk("NULL pointer, go away\n"); - return 0; - } - - linsample = zt_tone_nextsample(&d->ts, d->tone); - - - return ZT_LIN2MU(linsample); -} - -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static void wcusb_read_complete(struct urb *q, struct pt_regs *regs) -#else -static void wcusb_read_complete(struct urb *q) -#endif -{ - struct wc_usb_pvt *p = q->context; - short *chunk = q->transfer_buffer; - int x; - - if (!p->flags & FLAG_RUNNING) { - /* Stop sending URBs since we're not running anymore */ - p->urbcount--; - return; - } - - switch (p->sample) { - case STREAM_NORMAL: - for (x = 0; x < ZT_CHUNKSIZE; x++) { - p->chan.readchunk[x] = ZT_LIN2MU(le16_to_cpu(chunk[x])); - } - break; - case STREAM_DTMF: - for (x = 0; x < ZT_CHUNKSIZE; x++) { - p->chan.readchunk[x] = wc_dtmf(p); - } - break; - } - /* XXX We could probably optimize some here XXX */ - zt_ec_chunk(&p->chan, p->chan.readchunk, p->chan.writechunk); - - zt_receive(&p->span); - - q->dev = p->dev; - -#ifdef LINUX26 - if (usb_submit_urb(q, GFP_KERNEL)) -#else - if (usb_submit_urb(q)) -#endif - { - printk("wcusb: Read cycle failed\n"); - } - - if (p->timer && !--p->timer) { - if (p->devclass == WC_KEYPAD) { - if(debug) printk("Checking keypad\n"); - wcusb_check_keypad(p); - } else { - wcusb_check_interrupt(p); - } - } - -#ifdef PROSLIC_POWERSAVE - if (p->devclass != WC_KEYPAD) { - if (p->lowpowertimer && !--p->lowpowertimer) { - /* Switch back into low power mode */ - p->idletxhookstate = 1; - if (p->txhook == 2) - p->newtxhook = p->idletxhookstate; - } - } -#endif - return; -} - -#if defined(LINUX26) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) -static void wcusb_write_complete(struct urb *q, struct pt_regs *regs) -#else -static void wcusb_write_complete(struct urb *q) -#endif -{ - struct wc_usb_pvt *p = q->context; - short *chunk = q->transfer_buffer; - int x; - - if (!p->flags & FLAG_RUNNING) { - /* Stop sending URBs since we're not running anymore */ - p->urbcount--; - return; - } - - zt_transmit(&p->span); - for (x = 0; x < ZT_CHUNKSIZE; x++) { - chunk[x] = cpu_to_le16(ZT_MULAW(p->chan.writechunk[x])); - } - q->dev = p->dev; - -#ifdef LINUX26 - if (usb_submit_urb(q, GFP_KERNEL)) -#else - if (usb_submit_urb(q)) -#endif - { - printk("wcusb: Write cycle failed\n"); - } - - return; -} - -static int StopTransmit(struct wc_usb_pvt *p) -{ - p->flags &= ~FLAG_RUNNING; - - if (p->devclass == WC_KEYPAD) { - struct wc_keypad_data *d = p->pvt_data; - d->running = 0; - } - while(p->urbcount) { - schedule_timeout(1); - } - printk("ending transmit\n"); - return 0; -} - -static int flip_relays(struct wc_usb_pvt *p, int onoff) -{ - unsigned char ctl; - unsigned char data; - /* Read data */ - if (wcinp(p->dev, 0x12, &data)) - return -1; - /* Read control */ - if (wcinp(p->dev, 0x13, &ctl)) - return -1; - /* Setup values properly -- Pins AUX3 & AUX4 control the relays */ - ctl |= 0x18; - if (onoff) { - data |= 0x18; - } else { - data &= 0xe7; - } - if (wcoutp(p->dev, 0x12, data)) - return -1; - if (wcoutp(p->dev, 0x13, ctl)) - return -1; - return 0; -} - -static int prepare_transfer_urbs(struct wc_usb_pvt *p) -{ - int x; - /* Endpoint 6 is the wave-in device */ - unsigned int readpipe = usb_rcvisocpipe(p->dev, 0x06); - /* Endpoint 7 is the wave-out device */ - unsigned int writepipe = usb_sndisocpipe(p->dev, 0x07); - - for (x = 0; x < 2; x++) { - p->dataread[x].urb.dev = p->dev; - p->dataread[x].urb.pipe = readpipe; -#ifdef LINUX26 - p->dataread[x].urb.transfer_flags = URB_ISO_ASAP; -#else - p->dataread[x].urb.transfer_flags = USB_ISO_ASAP; -#endif - p->dataread[x].urb.number_of_packets = 1; - p->dataread[x].urb.context = p; - p->dataread[x].urb.complete = wcusb_read_complete; - p->dataread[x].urb.iso_frame_desc[0].length = ZT_CHUNKSIZE * 2; - p->dataread[x].urb.iso_frame_desc[0].offset = 0; - p->dataread[x].urb.transfer_buffer = p->readchunk + ZT_CHUNKSIZE * x; - p->dataread[x].urb.transfer_buffer_length = ZT_CHUNKSIZE * 2; - - p->datawrite[x].urb.dev = p->dev; - p->datawrite[x].urb.pipe = writepipe; -#ifdef LINUX26 - p->datawrite[x].urb.transfer_flags = URB_ISO_ASAP; -#else - p->datawrite[x].urb.transfer_flags = USB_ISO_ASAP; -#endif - p->datawrite[x].urb.number_of_packets = 1; - p->datawrite[x].urb.context = p; - p->datawrite[x].urb.complete = wcusb_write_complete; - p->datawrite[x].urb.iso_frame_desc[0].length = ZT_CHUNKSIZE * 2; - p->datawrite[x].urb.iso_frame_desc[0].offset = 0; - p->datawrite[x].urb.transfer_buffer = p->writechunk + ZT_CHUNKSIZE * x; - p->datawrite[x].urb.transfer_buffer_length = ZT_CHUNKSIZE * 2; - - } - return 0; -} - -static int begin_transfer(struct wc_usb_pvt *p) -{ - - int x; - p->urbcount = 4; - p->flags |= FLAG_RUNNING; - - for (x = 0; x < 2; x++) { -#ifdef LINUX26 - if (usb_submit_urb(&p->dataread[x].urb, GFP_KERNEL)) -#else - if (usb_submit_urb(&p->dataread[x].urb)) -#endif - { - printk(KERN_ERR "wcusb: Read submit failed\n"); - return -1; - } -#ifdef LINUX26 - if (usb_submit_urb(&p->datawrite[x].urb, GFP_KERNEL)) -#else - if (usb_submit_urb(&p->datawrite[x].urb)) -#endif - { - printk(KERN_ERR "wcusb: Write submit failed\n"); - return -1; - } - } - /* Start checking for interrupts */ - wcusb_check_interrupt(p); - return 0; -} - -static int wc_usb_hooksig(struct zt_chan *chan, zt_txsig_t txsig) -{ - struct wc_usb_pvt *p = chan->pvt; - - switch (p->devclass) { - case WC_PROSLIC: -#ifdef PROSLIC_POWERSAVE - if (p->txhook == 4) { - /* Switching out of ring... Be sure we idle at 2, not 1 at least - for a bit so we can transmit caller*ID */ - p->idletxhookstate = 2; - p->lowpowertimer = POWERSAVE_TIME; - } -#endif - - p->txhook = -1; - switch(txsig) { - case ZT_TXSIG_ONHOOK: - switch(chan->sig) { - case ZT_SIG_FXOKS: - case ZT_SIG_FXOLS: - p->newtxhook = p->idletxhookstate; - break; - case ZT_SIG_FXOGS: - p->newtxhook = 3; - break; - } - break; - case ZT_TXSIG_OFFHOOK: - p->newtxhook = p->idletxhookstate; - break; - case ZT_TXSIG_START: - p->newtxhook = 4; - break; - case ZT_TXSIG_KEWL: - p->newtxhook = 0; - break; - } - case WC_KEYPAD: - switch (txsig) { - case ZT_TXSIG_ONHOOK: - break; - case ZT_TXSIG_OFFHOOK: - break; - case ZT_TXSIG_START: - break; - case ZT_TXSIG_KEWL: - break; - } - break; - } - return 0; -} - -static int wc_usb_open(struct zt_chan *chan) -{ - struct wc_usb_pvt *p = chan->pvt; - if (p->dead) - return -1; - switch (p->devclass) { - case WC_KEYPAD: - p->hookstate = 0; - zt_hooksig(&p->chan, ZT_RXSIG_ONHOOK); - break; - default: - break; - } -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - p->usecount++; - return 0; -} - -static int wc_usb_close(struct zt_chan *chan) -{ - struct wc_usb_pvt *p = chan->pvt; - p->usecount--; - if (!p->usecount && p->dead) { - /* Someone unplugged us while we were running, so now - that the program exited, we can release our resources */ - zt_unregister(&p->span); - ifaces[p->pos] = NULL; - if (p->pvt_data) - kfree(p->pvt_data); - kfree(p); - } -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - return 0; -} - -static struct wc_usb_pvt *wc_detect_device(struct usb_device *dev, struct wc_usb_pvt *orig) -{ - struct wc_usb_pvt *p; - - p = orig; - if (!p) { - p = kmalloc(sizeof(struct wc_usb_pvt), GFP_KERNEL); - if (!p) { - printk("wcusb: kmalloc failed\n"); - return NULL; - } - - memset(p, 0, sizeof(struct wc_usb_pvt)); - } - p->dev = dev; - -#ifdef PROSLIC_POWERSAVE - /* By default we can't send on hook */ - p->idletxhookstate = 1; -#else - /* By default we can always send on hook */ - p->idletxhookstate = 2; -#endif - - printk("wcusb: wc_detect_device\n"); - if (dev->descriptor.idProduct == 0xb210) { - struct wc_keypad_data *d = kmalloc(sizeof(struct wc_keypad_data), GFP_KERNEL); - printk("wcusb: Found a WC Keyed Phone\n"); - p->devclass = WC_KEYPAD; - if (!d) { - printk("wcusb: kmalloc failed in init_device_pvt\n"); - return NULL; - } - memset(d, 0, sizeof(struct wc_keypad_data)); - p->pvt_data = d; - d->count = 0; - d->running = 1; - d->tone = NULL; - return p; - } else { - p->pvt_data = NULL; - p->devclass = WC_PROSLIC; - } - printk("Second exit\n"); - return p; -} - -static int wc_set_zaptel(struct wc_usb_pvt *p) -{ - int x; - - for (x = 0; x < WC_MAX_IFACES; x++) - if (!ifaces[x]) break; - if (x >= WC_MAX_IFACES) { - printk("wcusb: Too many interfaces\n"); - return -1; - } - - sprintf(p->span.name, "WCUSB/%d", x); - snprintf(p->span.desc, sizeof(p->span.desc) - 1, "%s %d", p->span.name, x); - sprintf(p->chan.name, "WCUSB/%d/%d", x, 0); - p->span.manufacturer = "Digium"; - zap_copy_string(p->span.devicetype, p->variety, sizeof(p->span.devicetype)); - - p->chan.sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS; /* We're capabable of both FXOKS and FXOLS */ - p->chan.chanpos = 1; - p->span.deflaw = ZT_LAW_MULAW; - p->span.chans = &p->chan; - p->span.channels = 1; - p->span.hooksig = wc_usb_hooksig; - p->span.open = wc_usb_open; - p->span.close = wc_usb_close; - - ifaces[x] = p; - p->pos = x; - p->span.flags = ZT_FLAG_RBS; - init_waitqueue_head(&p->span.maintq); - p->span.pvt = p; - p->chan.pvt = p; - - /* Set the stream to just pass the data from the device uninhibited */ - p->sample = STREAM_NORMAL; - - if (zt_register(&p->span, 0)) { - printk("wcusb: Unable to register span %s\n", p->span.name); - return -1; - } - - return 0; -} - -#ifdef LINUX26 -static int wc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) -#else -static void *wc_usb_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id) -#endif -{ - struct wc_usb_pvt *p = NULL; - struct wc_usb_desc *d = (struct wc_usb_desc *)id->driver_info; -#ifdef LINUX26 - struct usb_device *dev = interface_to_usbdev(intf); -#endif - - int x; - for (x=0;xdead) { - if (debug) - printk("Device slot %d can be revived\n", x); - break; - } - if (debug) - printk("Device slot %d is still in use\n", x); - } - - if (!(p = wc_detect_device(dev, p))) { - printk("wcusb: No wcusb devices found\n"); -#ifdef LINUX26 - return -ENODEV; -#else - return NULL; -#endif - } - -#ifndef LINUX26 - if (usb_set_configuration(dev, dev->config[0].bConfigurationValue) < 0) { - printk("wcusb: set_configuration failed (ConfigValue 0x%x)\n", dev->config[0].bConfigurationValue); - return NULL; - } -#endif - - if (init_hardware(p)) { - printk("wcusb: Hardware intialization failed.\n"); - goto cleanup; - } - - if (prepare_transfer_urbs(p)) { - printk("wcusb: problem preparing the urbs for transfer\n"); - goto cleanup; - } - - if (d->flags & FLAG_FLIP_RELAYS) { - flip_relays(p, 1); - } - - if (!p->dead && wc_set_zaptel(p)) { - printk("wcusb: Error in starting the zaptel stuff\n"); - goto cleanup; - } - - if (begin_transfer(p)) { - printk("wcusb: Something went wrong when starting the transfer\n"); - goto cleanup; - } - - if (p->dead) - printk("wcusb: Rekindling a %s (%s)\n", d->name, p->span.name); - else - printk("wcusb: Found a %s (%s)\n", d->name, p->span.name); - - /* Reset deadness */ - p->dead = 0; - /* Clear alarms */ - p->span.alarms = 0; - p->variety = d->name; - zt_alarm_notify(&p->span); -#ifdef LINUX26 - usb_set_intfdata(intf, p); - return 0; -#else - return p; -#endif - -cleanup: - printk("cleanup\n"); - if (p) { - if (p->pvt_data) { - kfree(p->pvt_data); - } - kfree(p); - } -#ifdef LINUX26 - return -ENODEV; -#else - return NULL; -#endif -} - -#ifdef LINUX26 -static void wc_usb_disconnect(struct usb_interface *intf) -#else -static void wc_usb_disconnect(struct usb_device *dev, void *ptr) -#endif -{ - /* Doesn't handle removal if we're in use right */ -#ifdef LINUX26 - struct wc_usb_pvt *p = usb_get_intfdata(intf); -#else - struct wc_usb_pvt *p = ptr; -#endif - if (p) { - StopTransmit(p); - p->dev = NULL; - if (!p->usecount) { - zt_unregister(&p->span); - if (p->pvt_data) - kfree(p->pvt_data); - ifaces[p->pos] = NULL; - kfree(p); - } else { - /* Generate alarm and note that we're dead */ - p->span.alarms = ZT_ALARM_RED; - zt_alarm_notify(&p->span); - p->dead = 1; - } - } - printk("wcusb: Removed a Wildcard device\n"); -#ifdef LINUX26 - usb_set_intfdata(intf, NULL); -#endif - return; -} - -static struct usb_device_id wc_dev_ids[] = { - /* This needs to be a USB audio device, and it needs to be made by us and have the right device ID */ - { - match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_DEVICE), - bInterfaceClass: USB_CLASS_AUDIO, - bInterfaceSubClass: 1, - idVendor: 0x06e6, - idProduct: 0x831c, /* Product ID / Chip configuration (you can't change this) */ - driver_info: (unsigned long)&wcusb, - }, - { - match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_DEVICE), - bInterfaceClass: USB_CLASS_AUDIO, - bInterfaceSubClass: 1, - idVendor: 0x06e6, - idProduct: 0x831e, - driver_info: (unsigned long)&wcusb2, - }, - { - match_flags: (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_DEVICE), - bInterfaceClass: USB_CLASS_AUDIO, - bInterfaceSubClass: 1, - idVendor: 0x06e6, - idProduct: 0xb210, - driver_info: (unsigned long)&wc_usb_phone, - }, - { } /* Terminating Entry */ -}; - -static struct usb_driver wc_usb_driver = -{ -#ifdef LINUX26 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) - owner: THIS_MODULE, -#endif -#else - fops: NULL, - minor: 0, -#endif - name: "wcusb", - probe: wc_usb_probe, - disconnect: wc_usb_disconnect, - id_table: wc_dev_ids, -}; - -static int __init wc_init (void) -{ - int res; - res = usb_register(&wc_usb_driver); - if (res) - return res; - printk("Wildcard USB FXS Interface driver registered\n"); - return 0; -} - -static void __exit wc_cleanup(void) -{ - usb_deregister(&wc_usb_driver); -} - -MODULE_AUTHOR("Matthew Fredrickson "); -MODULE_DESCRIPTION("Wildcard USB FXS Interface driver"); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -MODULE_DEVICE_TABLE(usb, wc_dev_ids); - -module_init(wc_init); -module_exit(wc_cleanup); diff --git a/zaptel/kernel/wcusb.h b/zaptel/kernel/wcusb.h deleted file mode 100644 index bd12ceef..00000000 --- a/zaptel/kernel/wcusb.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#ifndef _WCUSB_H -#define _WCUSB_H - -#include -#include -#include -#include - -#include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19) -#define USB2420 -#endif - -#include "zaptel.h" - -#define WC_MAX_IFACES 128 - -#define POWERSAVE_TIME 4000 /* Powersaving timeout for devices with a proslic */ - -/* Various registers and data ports on the tigerjet part */ -#define WCUSB_SPORT0 0x26 -#define WCUSB_SPORT1 0x27 -#define WCUSB_SPORT2 0x28 -#define WCUSB_SPORT_CTRL 0x29 - -#define WC_AUX0 0x1 -#define WC_AUX1 0x2 -#define WC_AUX2 0x4 -#define WC_AUX3 0x8 - -#define CONTROL_TIMEOUT_MS (500) /* msec */ -#define CONTROL_TIMEOUT_JIFFIES ((CONTROL_TIMEOUT_MS * HZ) / 1000) - -#define REQUEST_NORMAL 4 - -#define FLAG_RUNNING (1 << 0) - -/* Important data structures and data types */ - - -/* States for the Proslic read state machine */ -typedef enum { - STATE_WCREAD_WRITEREG, - STATE_WCREAD_READRES, - STATE_WCWRITE_WRITEREG, - STATE_WCWRITE_WRITERES, -} proslic_state_t; - -/* Used for current stream state */ -typedef enum { - STREAM_NORMAL, /* Sends normal (unmodified) audio data */ - STREAM_DTMF, /* (For keypad device) Sends dtmf data */ -} stream_t; - -/* States for the Keypad state machine */ -typedef enum { - STATE_FOR_LOOP_1_OUT, - STATE_FOR_LOOP_2_IN, - STATE_FOR_LOOP_PROC_DATA, - STATE_FOR_LOOP_CLEAR_DIGIT, -} keypad_state_t; - -/* Device types. For radical changes in a new device, use a switch based on the device type */ -typedef enum { - WC_KEYPAD, /* The tigerjet phone with the keypad. That was a bugger to implement */ - WC_PROSLIC, /* For various devices with a proslic */ -} dev_type_t; - -struct wc_keypad_data { - keypad_state_t state; /* Current state in the keypad detect routine */ -#ifdef USB2420 - struct urb urb; /* urb used for the keypad data transport ... can't remember whether it is used or not */ -#else - urb_t urb; /* urb used for the keypad data transport ... can't remember whether it is used or not */ -#endif - int running; - char data; - char data12; - char tmp; - int scanned_event; - int i; - int count; - /* DTMF tone generation stuff for zaptel */ - struct zt_tone_state ts; - struct zt_tone *tone; -}; - -struct stinky_urb { -#ifdef USB2420 - struct urb urb; -#ifndef LINUX26 - struct iso_packet_descriptor isoframe[1]; -#endif -#else - urb_t urb; - iso_packet_descriptor_t isoframe[1]; -#endif -}; - -struct wc_usb_pvt { - const char *variety; - struct usb_device *dev; - dev_type_t devclass; - int usecount; - int dead; - struct zt_span span; - struct zt_chan chan; - struct stinky_urb dataread[2]; - struct stinky_urb datawrite[2]; -#ifdef USB2420 - struct urb control; - struct usb_ctrlrequest dr; -#else - urb_t control; - devrequest dr; -#endif - proslic_state_t controlstate; - int urbcount; - int flags; - int timer; - int lowpowertimer; - int idletxhookstate; - int hookstate; - __u8 newtxhook; - __u8 txhook; - int pos; - unsigned char auxstatus; - unsigned char wcregindex; - unsigned char wcregbuf[4]; - unsigned char wcregval; - short readchunk[ZT_MAX_CHUNKSIZE * 2]; - short writechunk[ZT_MAX_CHUNKSIZE * 2]; - stream_t sample; - void *pvt_data; -}; - -struct wc_usb_desc { - char *name; - int flags; -}; -#endif diff --git a/zaptel/kernel/xpp/.version b/zaptel/kernel/xpp/.version deleted file mode 100644 index e7cb22c0..00000000 --- a/zaptel/kernel/xpp/.version +++ /dev/null @@ -1 +0,0 @@ -trunk-r6058 diff --git a/zaptel/kernel/xpp/Changelog_xpp b/zaptel/kernel/xpp/Changelog_xpp deleted file mode 100644 index 125eb9fd..00000000 --- a/zaptel/kernel/xpp/Changelog_xpp +++ /dev/null @@ -1,340 +0,0 @@ -Thu, Aug 14 2008 Oron Peled - xpp.r6055 - * Added E1 CAS support. Uses new firmware. - * New firmware also solve DTMF problems with some phones (double digits). - * Bugfix in caller_id_style parameter to xpd_fxo. Now caller_id_style=2 - actually works (always pass PCM). - * Warn about DAHDI ioctls sent to us by mistake (helps catching problems - during migration). - * Parse per-channel alarms the perl modules. Use this - to add an Zaptel::Chans->alarm() method. Update lszaptel - accordingly. - * Better parsing of signalling information in Zaptel::Chans - * Documentation updates in Zaptel::Span - * Fix some rare cases of false Yellow alarms in PRI. - * Updates to PCI IDs in Zaptel::Hardware::PCI - * Bugfix in blinking leds (rare, was detected with specific compiler - versions). - * Safer test in Kbuild for BRI compilation. - * Bugfix in DTMF (was leaking from one channel to the next one). - * Fix a rare problem in ONHOOK detection. - * Fix a build problem with Centos-5.2 (backporting bool). - * Debugging improvement: the pcmtx_chan parameter now refers - to zaptel channel numbers. - -Tue, 13 May 2008 Oron Peled - xpp.r5744 - * New firmware protocol version: 30 - * New numbers for the device types: (e.g. in card_init* scripts) - - FXS: 1 (was: 3) - - FXO: 2 (was: 4) - - BRI: 3 (was: 6 for TE, 7 for NT) - - PRI: 4 (was: 9) - * Init scripts of FXS and FXO modules are now written in Perl as well - (be sure to have File::Basename, e.g: perl-modules in Debian). - * calibrate_slics merged into init_card_1_30 . - * Each of the init_card_* scripts now runs no more than once per card even - if this card represents several XPD's (e.g: quad PRI, BRI). This means - maximum of 4 script runs per Astribank. - * Zaptel registration now briefly flash all LED's (not just the green ones as - before). - * Module parameter print_dbg was renamed to debug for consistency with - the rest of zaptel. - * init_fxo_modes removed: content moved into init_card_2_30, verified - at build time. - * FXO: removed polling for power-denial. New firmware notifies us. - * Code tested with sparse. Most warnings were fixed. - * Set ZT_SIG_DACS for the bchans in the PRI and BRI modules to not get - ignored by ztscan. - * fpga_load: Handle null config_desc we get from some crazy USB controllers. - * genzaptelconf: Fix reporting of empty slots in list mode. - * xpp_blink can now blink the led of a single analog port. - * "slics" has been renamed "chipregs". - * Fixed a small typo in fpga_load(8). - * Fixed bashism in xpp_fxloader. - -Thu, 20 Mar 2008 Oron Peled - xpp.r5566 - * Build: - - Zaptel >= 1.4.9 is migrating to storing kernel stuff in zaptel/kernel/* - - We conditionally use old/new directory scheme: - In xpp/Kbuild and xpp/utils/Makefile use ZAP_KERNEL variable, so it's - not confused with ZAPTEL_DIR (which appears in zaptel/Makefile as well). - - Fix compile warnings on 64 bit systems. - - Compile fixes for kernel-2.6.24 - * UDEV: - - /etc/udev/rules.d/xpp.rules now uses XPP_INIT_DIR to find astribank_hook. - - astribank_hook: Modify to do nothing. Add some documentation. - * Autoconfiguration -- zapconf: - - Don't fail zapconf et.al. if no config file was found. - - Skip the 'IRQ Missing:' line in /proc/zaptel/nnn for wcte1xp(?). - - Add some newer Digium cards to our hardware inventory. - - Partially handle cases where the /proc/zaptel strings does not contain - info about E1/T1/J1 or NT/TE. - * Better SYNC: - - Finer tuning of PLL (New firmware). - - Change calculation algorithm of sync offset. It now copes better - with the variance in USB frame reception timing. - - Statistics: - . The view of results was moved from /proc/xpp/XBUS-*/summary to - a new /sys/bus/astribanks/devices/xbus-*/timing and enhanced. - . A new xpp_timing script shows all astribanks. - . A new write only /sys/bus/astribanks/devices/xbus-*/cls is - used to clear statistics. Eventually, clearing of XBUS related - statistics should be done here. One that was migrated is the - clearing of 'PCM [TR]X:' numbers currently appearing in - /proc/xpp/XBUS-*/summary (they should be moved too later). - - Shorten the strings representation sync_mode ("SYNC_MODE_AB" -> "AB") - adapted their use in printk and /proc so the text is clear. - - Added a command line parameter xpp.disable_pll_sync to stop all - adjustments command to AB (calculations still continue as usual). - * PRI: - - 4 port support - - set clocking master span via ztcfg, like other zaptel devices. - * FXO: - - Fix false hangups in some countries (voltage fluctuations). - - Some countries send caller-id before first ring. - Added code to handle caller-id PCM pass through according to - a new command line parameter (xpd_fxo.caller_id_style). - - No longer sends an event on zt_open. See #12160 . - * FXS: Re-enable dtmf_detection. - * Misc: - - Adapt to zaptel-1.4.8 and above ztscan: added fields returend by - new ZT_SPANSTAT_V2 ioctl() - - Document sysfs and waitfor_xpds. - - Miscelaneous optimizations and bugfixes. - - Remove deprecated pcm_tasklet parameter. The rx_tasklet parameter has - replaced it a long time ago. - - Add RX_CMD counter to /proc/xpp/XBUS-*/summary - - Unclutter some of the usb disconnect messages. - - xpp_usb: minor preformance improvements in receive. - Expose the number of pending receive URB's in /proc/xpp/XBUS-*/xpp_usb -Thu Jan 10 2008 Oron Peled - xpp.r5254 - * Improved polarity reversal hangups in FXO (r5194). - Fixed false detection of polarity reversals. - * Optimize xframe allocation, by not zeroing the whole - memory (in get_xframe()). - * Fixed erronous error message that appeared sometimes - from fpga_load during USB renumeration. - * Zaptel::Chans now provides battery() reporting for some FXO - channels (Astribank FXO and wcfxo). - -Tue Dec 25 2007 Tzafrir Cohen - xpp.r5179 - * xpd_pri: Basically ready. - * PCM synchronization changes: - - Each Astribank unit ticks independently. Each with its own PLL. - - HOST synchronization is gone. Loading of xpp will no longer cause - useless 250 ticks per second if you have no Astribank. - - Synchronization from the zaptel sync master requires setting - ZAPTEL as sync source (xpp_sync ZAPTEL). - * rx_tasklet is now a parameter of the module xpp, rather than of xpp_usb. - * New FPGA firmware: 5128 (1151) / 5122 (1141, 1131): - - Fixes synchronization issues. - - PRI module: E1/T1 should now work. - * perl module and utilities: - - Modules no longer magically scan system on initialization. - - Scanning is by calling explicit methods. - - "Serial" has been renamed "Label". It is basically unique, but - should be modifieble. - - Some basic documentation of zaptel perl modules. - * Default sort order of zt_registration is back to SORT_CONNCTOR. - * zt_registration proc file now shows the number of span registered to - if registered. Try: grep . /proc/xpp/XBUS-*/XPD-*/zt_registration - * genzaptelconf: Allow using a custom command instead of - /etc/init.d/asterisk to start/stop asterisk. - * Fixed the typo "Slagish". - -Wed Nov 14 2007 Tzafrir Cohen - xpp.r5010 - * Fix a deadlock spotted on some SMP installations. - * increase FXS ring detect debounce interval. - * Improve (reduce) signal attenuation on FXO ports. - * zaptel-perl: further fixes to handling of empty slots. - -Wed Oct 3 2007 Tzafrir Cohen - xpp.r4900 - * Zaptel/Hardware perl modules: - - Use sysfs directly. Don't rely on lspci/lsusb. - - Each device has a description and driver name. - - Zaptel::Hardware::drivers() to show the list of required drivers - for this system (see zaptel_drivers). - - zaptel_hardware shows a description and a (suggested?) driver. - * zt_registration sorts by Serial first and only then by connector. - * USB_FW.hex replaces all the USB_11x0.hex . - - Separate USB interface for the management processor. - - Hence fpga_load can now work even with drivers loaded. - * Fix firmware upgrading. - * Fix manual firmware loading while auto-loading. - * Fix opermode parameter for FXO initialization (broken in r4648). - -Wed Oct 3 2007 Oron Peled - xpp.r4786 - * New firmware protocol version: 2.9 . - * fpga_load: initial clean-ups before interface split. - * genzaptelconf: Don't leave an empty directory behind (4784) - * Increase xpp poll_timeout to 1000ms - useful for CentOS 4 (r4781). - * Fix initialization anoyance: if AB don't answer to polls, don't - waitfor_xpds, and show no waiting XPDs (r4725). - * Disable dtmf_detection by default once again (r4712). - * Don't check twice for asterisk to stop. The second test was done - while Asterisk was still stopping (r4708). - * Support building the kernel with M= instead of with SUBDIRS= , as - used in some newer build systems (r4677). - -Tue Sep 11 2007 Oron Peled - xpp.r4648 - * New firmware protocol version: 2.8 . - * Cleanup INFO() messages during module loading. - - * USB: Receive queue with TASKLETS [r4600]. Controlled by rx_tasklet - parameter to xpp_usb module (can be changed in runtime). - * The pcm_tasklet parameter in xpp module is deprecated: - - Does not actually do anything. - - If set during module loading, shows an ERR() message. - - Also appears in /proc/xpp/sync - - * FXS: Hardware DTMF detection by default, can be disabled - by setting dtmf_detection=0 parameter to xpd_fxs. - PCM is muted when DTMF key is pressed. - - * zapconf: - - Can now generate users.conf compatible with asterisk-gui. - - Optional command-line arguments denoting which files to generate. - Possible values are 'zaptel', 'zapata' and 'users'. - - Defaults to creating zaptel and zapata. - - * Update to zaptel-1.4.5.1, zaptel-1.2.20.1 - * Fix building on kernel 2.6.23rc1, from Axel Thimm. - * New firmware to fix FXS leds irregularities. - * Less noise at build time - don't echo version, test compile ony once. - * zapconf can generate users.conf snippets. - -Thu Aug 16 2007 Tzafrir Cohen - xpp.r4515 - * Don't use Astribanks connected to USB1 interfaces - Unless the user set the option usb1=1 for xpp_usb (r4504). - * README.Astribank can now be generated from the makefile (r4503). - * Demote the messages about PCM in non-PCM from notice to debug (r4501). - * Fix sample BRI zapata.conf: NT instead of TE (r4498). - * Disable FXS hardware DTMF detection by default (r4492). - * Extra Zaptel PCI IDs (from Philipp Kempgen) (r4466). - -Thu Aug 2 2007 Oron Peled - xpp.r4464 - * Jump to zaptel-1.2.19 and zaptel-1.4.4 (with/without bristuff) - * BRI improvement: an 'nt_keepalive' parameter to xpd_bri forces - a BRI_NT to retry a connection indefinitely (this is our default). - When false it revert to the behaviour in changeset:4415 ("Bezeq like") - * Improvement in DBG macros. The print_dbg parameter is now set of - flags to debug. They are defined in zap_debug.h - * PRI configuration improvements (r4462): - - Hardcoded default (in init_card_9_26) is TE. - - The variable XPP_PRI_SETUP (in /etc/default/zaptel) may config - all PRI ports or some of them as we wish. Full docs are in - the utils/example_default_zaptel. - * PRI D-channel indication: Similar to BRI (r4464). - -Thu Jul 30 2007 Oron Peled - xpp.r4415 - * Show Astribank 6+2 as 6/2 channels and not 8/8 channels. - - Added as a "subtype" to the device type (r4391). - * Fixed a panic in BRI span shutdown method (r4393). - * Changes to debug macros. - * Add proper sysfs support (r4406) - - A bus on whuch all of the Astribanks reside. - - Replaces useless sysfs code that existed in the module. - - Currently used to set the sync source automatically at device - adition / removal. - * BRI: We do need the T1 timer in NT. If it gets into G2 state (rr4407). - -Thu Jul 12 2007 Oron Peled - xpp.r4372 - * Update to zaptel-1.2.18 and zaptel-1.4.3 (r4308 onward) - * Fix a critical race with zaptel synchronization (r4362) - * Added a /proc/xpp/cmds for statistics about command timing (r4360) - * Fix a digit mapping bug with hardware dtmf detection (r4357) - * In xpp/utils/Makefile add perl syntax checks to our scripts (r4337) - * Better USB data error checking (r4336) - * udev rules (xpp.rules) avoid false calls from wrong nodes (r4331) - * Improve hardware detection and reporting in lszaptel, - zaptel_hardware. zapconf is basically functional. - * Leds are blinked synchronously on all Astribanks now (r4262) - * Fix a BRI bug if OPTIMIZE_CHANMUTE was compiled into zaptel (r4258) - (This feature was not yet accepted into official zaptel) - * Removed compile warning about HZ != 1000 (r4218) - * Firmware updates. - * xpd_pri: the PRI module - * fpga_load now supports USB pathes without zeros (r4211) - * XPD numbers have changed to '' (r4196) - * Proper support for ZT_VMWI ioctl, if used in zaptel (r4092) - * Fix FXO power denial detection (r4054) - * FXO could accidentally go off-hook with some compilers (r4048) - -Tue May 1 2007 Oron Peled - xpp.r3898 - * Tested with zaptel-1.2.17.1 - * Add D-Channel TX, RX and BAD frames count in /proc/xpp/XBUS-*/XPD-*/bri_info - * Adjust output of xpp_sync script. Pad for 8 port BRI. - * Added a debugging module parport_debug (not compiled by default). - * Added an optional patch to zaptel: - - compiles only if ZAPTEL_SYNC_TICK is defined - - Allow interested driver to register for "sync" notification. - - Does not affect drivers that do not use this feature. - * Added external synchronization feature: - - Only if ZAPTEL_SYNC_TICK feature is compiled in - - Than XPP may be synchronized by another card (e.g: an Astribank - with FXS can be synchronized by a Digium PRI card). - - May be enabled/disabled in runtime via the 'sync_tick_active' module - parameter to the xpp.ko module. - * Fixed a potential bug in D-Channel hexdump printing. - * New visual indications in BRI leds: - - Constant ON RED/GREEN: Shows the port type -- NT/TE. - - Very fast "double blink": Layer1 work, no D-Channel yet. - - Steady blinking (1/2 sec): D-Channel trafic detected. - * xpp_fxloader moved to /usr/share/zaptel . - * adj_clock removed: never really used. - -Thu, 19 Apr 2007 Tzafrir Cohen - xpp.r3814 - * No need for extra patch beyond bristuff for Astribank BRI. - * Protocol no. 2.6: syncing improvements. - * Default poll intervals changed: 500 in BRI and FXO. - * Allow changing FXS polls interval at run time. - * BRI initalization fixed on SUSE (path to logger). - * When using the SUSE zaptel rpm package, set modules_var=ZAPTEL_MODULES in - /etc/sysconfig/zaptel . - * zt_registration not verbose by default. - * xpp_sync warns if FXO is sync slave. - * Extra PCM metrics data in /proc/xpp/XBUS-NN/summary . - * Extra USB metrics data in /proc/xpp/XBUS-NN/usb_info . - -Wed, 11 Apr 2007 Tzafrir Cohen - xpp.r3768 - * Removed "go away" notice and solved sync of a restarted device. - * Resetting firmware: rmmod xpp_usb; /etc/hotplug/usb/xpp_fxloader reset - * Perl modules use strict. - * genzaptelconf -F will not generate zapata configuration for NT spans. - * genzaptelconf uses perl utilities to start. - * Initial support for 2nd XHFC (BRI) chip. - -Sun, 1 Apr 2007 Tzafrir Cohen - xpp.r3712 - * New protocol version (2.5). - * Luckily firmware unloading now works. - * Solves "multiple ticks" bug. No need for pcm_tasklets workaround. - * genzaptelconf -z will generate zapscan.conf for the asterisk-gui. - * Fixed hardware detection for the BRI. - -Wed, 14 Mar 2007 Tzafrir Cohen - xpp.r3608 - * Initial verssion of firmware unloading. - * PCM bugfixes. - * Defaults of kernel parameters are now part of parameter description. - * Removed zaptel sync code for now. - * genzaptelconf will detect vzaphfc. - * genzaptelconf defaults to ptmp for BRI. - * Documentation updates. - -Mon, 26 Feb 2007 Tzafrir Cohen - xpp.r3517 - * genzaptelconf now uses ls for FXS lines by default . - * World-readable kernel parameters. - -Thu, 22 Feb 2007 Tzafrir Cohen - xpp.r3440 - * /proc/xpp/sync: 'm 0' is, while depracated, can still be used. - * New firmware with PCM improvements. - * Improvements to the xpp helper scripts. - * Bug fixes. - * zaptel/perl is now installed by xpp/utils/Makefile. - -Wed, 14 Feb 2007 Tzafrir Cohen - xpp.r3365 - * Kewlstart support on the FXS ports (already existed on the FXO ports). - * The format of /proc/xpp/sync has changed (still self-documented). - * Better notification of FXS lines that were off-hook on registration time. - * Parallel polling of Astribanks (faster startup when there are multiple - devices) - * zconf: scripts and perl modules to automate the work with Zaptel and the - Astribank. Current scripts: zt_registration, xpp_sync. diff --git a/zaptel/kernel/xpp/Kbuild b/zaptel/kernel/xpp/Kbuild deleted file mode 100644 index 3be5c71d..00000000 --- a/zaptel/kernel/xpp/Kbuild +++ /dev/null @@ -1,58 +0,0 @@ -ifdef SUBDIRS - ZAP_KERNEL = $(SUBDIRS) -else - ZAP_KERNEL = $(M) -endif - -EXTRA_CFLAGS = $(XPP_LOCAL_CFLAGS) \ - -I$(ZAP_KERNEL) \ - -DDEBUG \ - -DPOLL_DIGITAL_INPUTS \ - -DWITH_ECHO_SUPPRESSION \ - -DDEBUG_PCMTX \ - -DPROTOCOL_DEBUG \ - -g - # - -ifneq (,$(shell grep -w echo_can_state_t $(ZAP_KERNEL)/zaptel.h)) -EXTRA_CFLAGS += -DZAPTEL_EC_TYPEDEF -endif - -obj-m += xpp.o xpd_fxs.o xpd_fxo.o xpd_pri.o - -HAS_BRISTUFF := $(shell grep -c '^[[:space:]]*\#[[:space:]]*define[[:space:]]\+CONFIG_ZAPATA_BRI_DCHANS\>' $(ZAP_KERNEL)/zconfig.h) - -# Build only supported modules -ifneq (,$(filter y m,$(CONFIG_USB))) -obj-m += xpp_usb.o -endif -ifneq (0,$(HAS_BRISTUFF)) -obj-m += xpd_bri.o -endif - -xpp-y += xbus-core.o xbus-sysfs.o xbus-pcm.o xframe_queue.o xpp_zap.o xproto.o card_global.o zap_debug.o -xpd_fxs-y += card_fxs.o -xpd_fxo-y += card_fxo.o -xpd_bri-y += card_bri.o -xpd_pri-y += card_pri.o - -ifeq (y,$(PARPORT_DEBUG)) -EXTRA_CFLAGS += -DDEBUG_SYNC_PARPORT -obj-m += parport_debug.o -endif - -# Handle versioning -XPP_VERSION_STR ?= $(shell if [ -r $(obj)/.version ]; then echo "\"`cat $(obj)/.version`\""; else echo '"Unknown"'; fi) -clean-files := xpp_version.h - -$(obj)/card_fxs.o $(obj)/card_fxo.o $(obj)/card_bri.o $(obj)/card_pri.o $(obj)/xpp_usb.o $(obj)/xpp.o: $(obj)/xpp_version.h - -$(obj)/xpp_version.h: FORCE - $(Q)echo '#define XPP_VERSION $(XPP_VERSION_STR)' > $@.tmp - $(Q)if cmp -s $@.tmp $@ ; then echo; else \ - mv $@.tmp $@ ; \ - fi - $(Q)rm -f $@.tmp - -.PHONY: FORCE -FORCE: diff --git a/zaptel/kernel/xpp/Makefile b/zaptel/kernel/xpp/Makefile deleted file mode 100644 index 00fc5eec..00000000 --- a/zaptel/kernel/xpp/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# We only get here on kernels 2.6.0-2.6.9 . -# For newer kernels, Kbuild will be included directly by the kernel -# build system. --include $(src)/Kbuild - -ctags: - ctags *.[ch] diff --git a/zaptel/kernel/xpp/README.Astribank b/zaptel/kernel/xpp/README.Astribank deleted file mode 100644 index e3dfa331..00000000 --- a/zaptel/kernel/xpp/README.Astribank +++ /dev/null @@ -1,1374 +0,0 @@ -Xorcom Astribank Documentation -============================== -Xorcom Team -$Revision: 4272 $, $Date: 2008-05-14 08:53:13 -0700 (Wed, 14 May 2008) $ - -This file documents the Zaptel drivers for the Xorcom Channel Bank. -The drivers reside in a separate subdirectory, kernel/xpp/ . - -It is generally a more technical document than the -http://www.xorcom.com/documentation/manuals/[Astribank User Manual] - -An HTML version of the latest version of this document could be found at -http://zaptel.tzafrir.org.il/README.Astribank.html[] - -Building and Installation -------------------------- -Building and installation is basically like the normal procedure of -installing Zaptel with some additions. - -Building drivers -~~~~~~~~~~~~~~~~ -Apart from the standard Zaptel build requirements, you also need libusb -development headers to build the fpga_load firmware loader. This is -typically the package libusb-dev on Debian (and derivatives like Ubuntu) -or libusb-devel on RedHat (and derivatives like CentOS/Trixbox). - -On Zaptel 1.2 you will need to run the following extra step to build the -user space utilities, apart from the standard 'make; make install': - - make -C xpp/utils install - -Though this should be done automatically on Zaptel >= 1.4.1 . - - -Sample Configurations ---------------------- -We generally recommend to generate the configuration by using utility -genzaptelconf or zapconf which are included with Zaptel. Nevertheless, -the following can serve as reference configurations for a system where -Astribank devices are used. - - -Zaptel Init Configuration File -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The zaptel init.d script, genzaptelconf and the XPD init scripts uses the -parameters located in file /etc/default/zaptel (on Debian) or -/etc/sysconfig/zaptel (on RedHats). There is a number of useful parameters -that may be defined there: - ------------------------------------------------------------ -# Lines beginning with '#' are considered comments and ignored. - -# A two-letter country code. genzaptelconf uses it to better guess -# the configuration it generates. E.g: the signalling of E1 spans, and -# a few other country-specific settings. -#lc_country=us - -# See genzaptelconf(8) and the script itself for a longer list of -# variables. - -# Equivalent to the parameter opermode to the module wctdm: country-specific -# settings to the FXO lines. For a complete list of possible values, see -# /usr/share/zaptel/init_fxo_mode . -#opermode=FRANCE - -# xpp_sync runs with the value of 'XPP_SYNC' as its parameter to set the -# synchronization source. The default is 'auto' that selects the best -# Astribank. 'ZAPTEL' gets synchronization from the Zaptel sync master -# span. Or a specific XBUS number. -#XPP_SYNC=ZAPTEL - -# Disables hot-plug firmware loading -#XPP_HOTPLUG_DISABLED=yes -# - -# Disables udev hook called when an Astribank is added and ready -# or removed. -#ASTRIBANK_HOOK_DISABLED=yes - -# Setup for the Astribank PRI module: -# All the ports in the unit connected to the USB port 0000:00:1d.7-1 -# will be NT and E1. Ports no. 1 and 3 of all the other Astribanks will -# be NT and E1 (and thus ports 0 and 2 will be TE and E1). -#XPP_PRI_SETUP=' -# CONNECTOR/usb-0000:00:1d.7-1/XPD-01=NT,E1 -# NUM/*/XPD-0[13]=NT,E1 -# ' ------------------------------------------------------------ - -/etc/zaptel.conf -~~~~~~~~~~~~~~~~ - -Astribank 8 -^^^^^^^^^^^ - fxoks=1-14 - -Astribank 6FXS/2FXO -^^^^^^^^^^^^^^^^^^^ - fxoks=1-12 - fxsks=13-14 - -Astribank 16: 8FXS/8FXO -^^^^^^^^^^^^^^^^^^^^^^^ - fxoks=1-14 - fxsks=15-22 - -Astribank 4 BRI -^^^^^^^^^^^^^^^ - # Assumed ports settings: - # Ports 1,3: TE - # Ports 2,4: NT - span=1,1,1,ccs,ami - span=2,0,1,ccs,ami - span=3,2,1,ccs,ami - span=4,0,1,ccs,ami - bchan=1-2,4-5,7-8,10-11 - dchan=3,6,9,12 - -Astribank 4 PRI E1 -^^^^^^^^^^^^^^^^^^ - # Assumed ports settings: - # Ports 1,3: TE (CPE) - # Ports 2,4: NT (Net) - span=1,1,1,ccs,hdb3,crc4 - span=2,0,1,ccs,hdb3,crc4 - span=3,2,1,ccs,hdb3,crc4 - span=4,0,1,ccs,hdb3,crc4 - bchan=1-15,17-30,31-45,47-60,61-75,77-90,91-105,107-120 - dchan=16,46,76,106 - -Astribank 4 PRI T1 -^^^^^^^^^^^^^^^^^^ - # Assumed ports settings: - # Ports 1,3: TE (CPE) - # Ports 2,4: NT (Net) - span=1,1,1,esf,b8zs - span=2,0,1,esf,b8zs - span=3,2,1,esf,b8zs - span=4,0,1,esf,b8zs - bchan=1-23,25-47,49-71,73-95 - dchan=24,48,72,96 - - -/etc/asterisk/zapata.conf -~~~~~~~~~~~~~~~~~~~~~~~~~ -Astribank 8 -^^^^^^^^^^^ - [channels] - signalling=fxo_ks - ; The real analog ports: - context=from-internal - echocancel=yes - ; echocancelwhenbriged=yes - ; echotraining=no - channel => 1-8 - - ; output ports: - context=astbank-output - channel => 9-10 - ; input ports: - immediate=yes - context=astbank-input - channel => 11-14 - immediate=no - -Astribank 6FXS/2FXO -^^^^^^^^^^^^^^^^^^^ - [channels] - signalling=fxo_ks - ; The real analog ports: - context=from-internal - echocancel=yes - ; echocancelwhenbriged=yes - ; echotraining=no - channel => 1-6 - - ; output ports: - context=astbank-output - channel => 7-8 - ; input ports: - immediate=yes - context=astbank-input - channel => 9-12 - immediate=no - - ; FXO ports - signalling=fxs_ks - context=from-pstn - callerid=asreceived - channel => 13-14 - -Astribank 16: 8FXS/8FXO -^^^^^^^^^^^^^^^^^^^^^^^ - [channels] - signalling=fxo_ks - ; The real analog ports: - context=from-internal - echocancel=yes - ; echocancelwhenbriged=yes - ; echotraining=no - channel => 1-8 - - ; output ports: - context=astbank-output - channel => 9-10 - ; input ports: - immediate=yes - context=astbank-input - channel => 11-14 - immediate=no - - ; FXO ports - signalling=fxs_ks - context=from-pstn - callerid=asreceived - channel => 15-22 - -Astribank 4 BRI -^^^^^^^^^^^^^^^ - ; Assumed ports settings: - ; Ports 1,3: TE - ; Ports 2,4: NT - [channels] - switchtype = euroisdn - callerid = asreceived - - ; TE ports: - signalling = bri_cpe_ptmp - ;signalling = bri_cpe - context = from-pstn - group = 1,11 - channel => 1,2 - - group = 1,13 - channel => 7,8 - - ; NT ports: - signalling = bri_net_ptmp - ;signalling = bri_net - context = from-internal - group = 2,12 - channel => 4,5 - - group = 2,14 - channel => 10,11 - -Astribank 4 PRI E1 -^^^^^^^^^^^^^^^^^^ - ; Assumed ports settings: - ; Ports 1,3: TE - ; Ports 2,4: NT - [channels] - switchtype = euroisdn - callerid = asreceived - - ; TE ports: - signalling = pri_cpe - context = from-pstn - group = 1,11 - channel => 1-15,17-30 - - group = 1,13 - channel => 61-75,77-90 - - ; NT ports: - signalling = pri_net - ;signalling = pri_net - context = from-internal - group = 2,12 - channel => 31-45,47-60 - - group = 2,14 - channel => 91-105,107-120 - -Astribank 4 PRI T1 -^^^^^^^^^^^^^^^^^^ - ; Assumed ports settings: - ; Ports 1,3: TE - ; Ports 2,4: NT - [channels] - switchtype = national - callerid = asreceived - - ; TE ports: - signalling = pri_cpe - context = from-pstn - group = 1,11 - channel => 1-23 - - group = 1,13 - channel => 49-71 - - ; NT ports: - signalling = pri_cpe - ;signalling = pri_net - context = from-internal - group = 2,12 - channel => 25-47 - - group = 2,14 - channel => 73-95 - - -/etc/asterisk/extensions.conf -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Sample dialplan (extensions.conf) for all the above: - ------------------------------------------------------------ -[phones-zap] -; 6001 will dial to channel 1, 6020, to Zaptel channel 20, etc. -exten => _6XXX,1,Dial(ZAP/${EXTEN:1}) -; Useful for debugging trunks. Will potentially allow users to -; bypass context limitations. -;exten => _6XXX.,1,Dial(ZAP/${EXTEN:1:3}/${EXTEN:4}) - -[trunk] -; A number that begins with 9: dial it through a trunk -; (we put FXO channels and TE channels in group 0). -; The leading 9 is stripped. -exten => _9.,1,Dial(Zap/g0/${EXTEN:1}) -; dialing a number that begins with 83 will dial it through -; span 3, and so forth. The two leading digits are stripped. -; (Each digital span is also added to group 10+span number). -exten => _8X.,1,Dial(Zap/g1${EXTEN:1:1}/${EXTEN:2}) - -[from-internal] -; The context of FXS ports: analog phones. -; They are allowed to dial to all other phones -include => phones-zap -; They are also allowed to call through the trunk: -include => trunk -; some simple tests: -include => astbank-test - -[from-pstn] -; Calls from the PSTN enter here. Redirect calls to an IVR -; or a default extension in the s context here. In this case we -; redirect calls to Zaptel channel 1: -exten => s,1,Dial(Zap/1) - -; Alternatively, the following will redirect you to the demo IVR -; from the sample extensions.conf of Asterisk: -include => demo - -; An extra context with some simple tests -[astbank-test] -; 200: echo test -exten => 200,1,Answer -exten => 200,n,Wait(1) -exten => 200,n,Echo() -exten => 200,n,Hangup - -; 203: say extension number. Will only work if caller ID -; is properly set in zapata.conf / zapata-channels.conf -exten => 203,1,Answer -exten => 203,n,Wait(1) -exten => 203,n,SayNumber(${CALLERID(num)}) -exten => 203,n,Hangup - -[astbank-input] -exten => s,1,Set(ZAP_CHAN=${CUT(CHANNEL,-,1)}) -exten => s,n,Set(ZAP_CHAN=${CUT(ZAP_CHAN,/,2)}) -; 11 is the number of the first input port. At least in the sample -; configuration below. -;exten => s,n,Set(INPUT_NUM=$[${ZAP_CHAN}-11)]) -; The sample below just logs the signal. -exten => s,n,NoOp(Got signal from Zaptel Channel ${ZAP_CHAN}) -; Alternatively: -;exten => s,n,System(run something) - -; No. We did not forget the context astbank-outputs. Output -; ports only get calls from the PBX. Thus they don't need a context -; of their own. Sending them to a context of their on makes -; 'zap show channels' in the CLI provide useful display, though. ------------------------------------------------------------ - - - - -Troubleshooting ---------------- -The following commands provide useful information for debugging: - -lsusb Test -~~~~~~~~~~ -Check USB level status. You can use one of the following utilities for it: - - zaptel_hardware -v - or - lsusb | grep e4e4 - -- Look for the USB Product ID (the second number after e4e4). -- If you see *11x2* (e.g: 1152)- the FPGA firmware has been loaded. - Move on. - zaptel_hardware will also show you some more details if the driver - is loaded while the lsusb will just list the device. -- If it shows something as product ID *11x0* - the USB firmware is not - loaded. Maybe you need to run fxload. Or maybe just unplug and plug again - the device. Also make sure that you have fxload installed. -- If lsusb shows the Product ID as *11x1* - only the USB firmware is loaded - and not the FPGA firmware is loaded. If this is still the case after - a while - either the firmware loading has failed or you don't have - fpga_load. Make sure you have libusb-dev(el) installed when - building Zaptel. After you have installed it, you may need to re-run - ./configure . -- It should list all of your Astribank devices. If it doesn't (for - more than period of time needed for the initial firmware - loading) - Check that the Astribank is connected indeed. - - -Zaptel Registration -~~~~~~~~~~~~~~~~~~~ -Check if the Astribank spans are registered in Zaptel - - zt_registration - -- This should give useful results after the drivers have identified - and your devices are initialized. -- It should list all Astribank XPDs. For each of them it should write - "on" or "off". If the registration status is "off", then it means that - the span has not been registered in Zaptel and therefore can not be used - yet. -- Registration is normally done as part of `/etc/init.d/zaptel start`. - If you want to register the spans manually, then run command: - `zt_registration on` . -- Disabling of the automatic Astribank spans registration give you full - control on the order of Zaptel spans. See the module parameter - **zap_autoreg** for the further details. - - -Zaptel Level Information -~~~~~~~~~~~~~~~~~~~~~~~~ -You can get some information regarding Zaptel channels by running one of the -following commands: - - lszaptel - or - cat /proc/zaptel/* - -- Those two are almost the same. The lszaptel produced more correctly sorted - output if you have more than 10 spans, and also make the output listing - looks a little bit nicer. -- You can see if your Zaptel spans and channels were loaded, if - they were configured by ztcfg and if they are in use (typically by - Asterisk). - For example: - Not configured Astribank FXS channel will be displayed as: - - 42 FXS - -- When a channel has been configured with *ztcfg* (that applies - /etc/zaptel.conf), you will see an extra column for the signalling - type of the channel. The same channel after it has been configured: - - 42 FXS FXOKS - -- If a program (which is typically Asterisk) uses it, you'll see: - - 42 FXS FXOKS (In use) - - - -Asterisk Level Information -~~~~~~~~~~~~~~~~~~~~~~~~~~ - asterisk -rx 'zap show channels' - -- If you get error "Unable to connect to remote asterisk" then it - means that the Asterisk is not running. It is possible that Asterisk - has failed to start due to misconfigured zapata.conf or whatever reason. - Check /var/log/asterisk/messages or /var/log/asterisk/full . -- If you get the error that "there is no such command" then it means that - chan_zap.so is not loaded. There are two reasons for such problem: - * chan_zap.so is not even built. Check if the file exists: - - ls -l /usr/lib/asterisk/modules/chan_zap.so - - * the chan_zap.so file exists but it is not loaded. Try to load it manually: - - asterisk -rx 'load module chan_zap.so' - -- You see "pseudo" channel only. It means that you have not configured any - channels. If you have configured channels in zapata.conf, you may - need either to restart the Asterisk or unload/load chan_zap.so manually. - You can use the following Asterisk CLI commands for it: `unload chan_zap.so` - and `load chan_zap.so` - - -Known Issues -~~~~~~~~~~~~ -Empty /proc dir -^^^^^^^^^^^^^^^ -.Symptoms: -- Error message: - - "ERR-xpd_fxo: XBUS-00/XPD-00: Failed initializing registers (-22)" - -- Likewise for all XPDs. -- The directory /proc/xpp exists but is empty (not even the files - 'xbuses' and 'sync'). - -.Cause: -The driver failed to recreate the procfs directory /proc/xpp and hence -everything under it. This is because it has already existed. And it -existed because a process still uses it. This is typically because you -have a shell whose working directory is /proc/xpp or somewhere under -it: - - # lsof /proc/xpp - COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME - bash 2741 root cwd DIR 0,3 0 4026532684 /proc/xpp - -.Fix: -Move that process from that directory, or close the file it uses from -under /proc/xpp and reload the zaptel / xpp drivers. - - -Bad Firmware Version -^^^^^^^^^^^^^^^^^^^^ -.Symptoms: -- An Astribank finishes initialization quickly, the /proc/XBUS-nn - directory has no XPD-mm subdirectories. -- Error in the kernel logs about: - - NOTICE-xpp: XBUS-00: XPD at 00: type=6.0 has bad firmware revision 2.6 - -.Cause: -This is normally caused by an Astribank with an older firmware connected -to a - -The protocol version supported by the firmware will typically be the same -one as in the device initialization scripts installed to -/usr/share/zaptel . Hence if this version installed -`/usr/share/zaptel/init_card_3_29` it will probably include firmware of -protocol version 29. - -.Fix: -Reset the firmware: - - /usr/share/zaptel/xpp_fxloader reset - -Or disconnect the Astribank from the power and reocnnect. On some older -versions of the USB firmware resetting the firmware (or any operation of -fpga_load) would fail if the driver is loaded. Hence you would need to -run `rmmod xpp_usb` . In the end, reload the drivers. - - -USB Errors at Shutdown -^^^^^^^^^^^^^^^^^^^^^^ -.Symptoms: -You see USB-related errors similar to the following whenever you shut -down the drivers of the Astribank or disconnect its drivers: - - ERR-xpp_usb: XBUS-00: Failed to submit a receive urb - -.Cause: -This is a normal part of the shutdown of the USB connection. - -.Fix: -Ignore them. Unless the USB should not have disconnected at that time. - - -BRI Layer 1 Down -^^^^^^^^^^^^^^^^ -.Symptoms: -With the BRI module only, and not in the middle of an active call, you -notice that suddenly the line goes down. The LED of the port stops -blinking, layer1 not listed as "active" in the bri_info file in -/proc/xpp, and the span is in RED alarm in Zaptel. - -You may also see an error message such as: - - NOTICE-xpd_bri: XBUS-00/XPD-02: D-Chan RX Bad checksum: [2A:01=FC] (252) - -from the exact time of the disconnecting. - -.Cause: -This is expected with most european BRI PtMP providers. If they support -PtMP, they are normally also expected to support ISDN phones, that get -the power from the provider. And thus they shut down the line whenever -there's no active call. - -Sometimes the line is shut down in the middle of a layer 2 message. In -the BRI driver the HDLC decoding/encoding is done in the card. In that -case we may get the above error. - -.Fix: -Normaly this is not a problem. The driver will re-establish a connection -once a new call needs to be made. - - -Both default and sysconfig Exist -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.Symptoms: -The firmware fails to load. Manually running xpp_fxloader gives: - - Both '/etc/default/zaptel' and '/etc/sysconfig/zaptel' exist - -Alternatively: an initialization script fails and gives the error - - An '/etc/default/zaptel' collides with 'etc/sysconfig/zaptel' - -.Cause: -/etc/default/ is the place used in Debian-based -systems for initialization scripts. /etc/sysconfig/ is -used in Redhat and similar for the same purpose. For historical reasons -many of our programs read configuration from there: either from -/etc/default/zaptel or from /etc/sysconfig/zaptel . - -The problem is what to do if both of those exist. Selecting an arbitrary -one can lead to unexpected results. Likewise sourcing both of them. -Therefore we prefer to fail in a noisy and expected way. In the future -we will probably me to reading configuration from a file under /etc/zaptel . - -.Fix: -Remove one of those two. There should be no reason to have both on the -same system. - - -Astribank not initialized: Premature packet end -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.Symptoms: -After upgrading to Zaptel 1.4.12 / 1.2.25 the initialization of the -Astribank times out. In the logs you see: - - kernel: NOTICE-xpp: XBUS-00(00): FIRMWARE: ERROR_CODE CODE = 0x3 (Premature packet end) - -.Cause: -When an Astribank is detected, the driver asks it what is its version -and what components it has. Normally if the version of the firmware and -of the driver does not match the driver gives an ugly message and fails -the initialization. - -However in the change of the protocol between versions 2.9 (29) and 3.0 -(30), the response that the new driver recieves from a device with the -old version is now considered to be an illegal packet and gets -discarded. As a result, the Astribank waits till time-out for the -initilization to end. - -.Fix: -Reset the firmware of the Astribank by either: - - /usr/share/zaptel/xpp_fxloader reset - -or disconnecting it from the power and reconnecting it. - - -Reference ---------- -LEDs Indication -~~~~~~~~~~~~~~~ -The Astribank has 4 global indication leds and one or two per-port leds. -On some of the models the LEDs are located on the left side on the front -panel. If there are no separate LEDs there, then the red LEDs of the -upper left-most ports of the device are used as the indication LEDs. Don't -confuse them with green port status LEDs. - -The first led is the "Power" led. It is on if the unit gets power. -The second led is the "Active" led, which is on when there is at -least one "active" port (in a call / off-hook, though the meaning of this is -different in BRI). -The last led is called "Hardware OK", but is actually only is on in case of -the hardware failure. - -The third led is the "Sync" led. If it blinks, the device is synchronized -with the driver on the computer. If the device is selected to be the -synchronization source for all of the Astribank devices then it will blink -a quick single blink. -If the device gets synchronization from the driver, it will blink in a -more steady frequency. - -"Double blink" indicates that the unit has an FXO module, and still is -getting synchronization from the computer, and is not the synchronization -source. - -The per-port green led on analog (both FXS and FXO) indicates that the -port is off-hook. - -On the BRI, the green led indicates a TE port whereas an orange led -indicates an NT port. If the led is solid, the port is down (not even -layer-1 connection is up). If it is blinking a double blink, layer 1 -is up. A slower single blinking indicates that layer 2 is up as well -(which means that Asterisk is driving the port). - - -PRI Ports Configuration -~~~~~~~~~~~~~~~~~~~~~~~ -Astribank PRI module has two RJ-45 sockets for each PRI port. The lower -socket provides typical PRI CPE side wiring: Rx- pins 1,2; Tx - pins -4,5. The upper socket provides typical PRI Network side wiring: Rx- pins -4,5; Tx - pins 1,2. The both sockets are permanently active and you can -use any of them regardless of any configuration parameters (Both -connectors are live. And connecting both of them with a flat 8-wire -ethernet cable is a simple way to do a loop test for the port). - - -For each port there are two optional parameters that define its -behavior: - -Each port in the PRI module can be configured either as E1 or T1. The -port type defaults to E1 and can be changed to T1 in the Zaptel Init -Configuration File. - -The Astribank xpp driver uses that information for correct hardware -initialization that is performed before the Zaptel span registration -process takes place. Because of that, xpp driver can't use the -information from file zaptel.conf. - -Another parameter that also can be defined in the Zaptel Init -Configuration File is the function group TE (CPE) or NT (Network). This -parameter is used for (a) building correct Zaptel & Asterisk -configuration by genzaptelconf and (b) control RJ-45 sockets LEDs for -better visual port control: - -A port in the PRI module can be either E1 (default) or T1. It can also be -either "TE" (default) or "NT". - -TE:: - Green LED of the lower socket will light. Hint that this is a TE - (CPE) port. This is the default. - -NT:: - Orange LED of the upper socket will light. Hint that this is an - NT (network) port. - -To set them to a non-default value, you should use the variable -XPP_PRI_SETUP in the -xref:_zaptel_init_configuration_file[Zaptel Init Configuration File] -(/etc/sysconfig/zaptel on Redhats, /etc/default/zaptel on Debians). -This value is a whitespace-separated list of conditions. When a port is -initialized it checks those conditions and uses the first one that -matches. - -Match expressions may be: -- CONNECTOR/usb..../XPD-nn To identify by physical connector -- NUM/XBUS-mm/XPD-nn To identify by bus number - -Match expressions may contain "wildcards": - -- * matches zero or more characters. -- ? matches one charater -- [xyz] - any of 'x', 'y', or 'z'. - -For each line you should define both if it is E1 or T1 and if it is NT -or TE. - -The list implicitly contains an 'NUM/*=TE,E1' catch all default, appended -to its end. - -A number of useful examples. Note that you should use just one of them. ---------------------------------------------- -# All ports are E1 and CPE -#XPP_PRI_SETUP= #no need to set it - -# All ports are T1 and CPE: -XPP_PRI_SETUP='NUM/*=T1,TE' - -# Now you want to test a loop between ports 1 and 2 and between -# port 3 and 4. So let's make ports 2 and 4 network: -XPP_PRI_SETUP='NUM/*/XPD-0[24]=E1,NT' - -# The same with T1. In this case we also need to set the default of all -# the others to T1. Note that we can use more than one item and the -# first one that matches counts: -XPP_PRI_SETUP=' - NUM/*/XPD-0[24]=T1,NT - NUM/*=T1,TE -' - -# Actually, there is an implicit 'NUM/*=E1,TE' added to the end of the -# value and set as the value if there is none. This is how the default -# is set. - -# If you have more than one Astribank and you wish to configure -# different Astribanks differently, you can use the CONNECTOR option: -# e.g: set one specific Astribank as E1 network. The others default to -# E1 CPE: -XPP_PRI_SETUP='CONNECTOR/usb-0000:00:10.4-4/*=E1,NT' - -# Theoretically you could use: XPP_PRI_SETUP='NUM/XBUS-01/*=E1,NT' -# but the XBUS number depends on the specific load order and is thus -# might differ in a manual load and a system boot. ---------------------------------------------- - -This is currently implemented by writing a value to the -xref:_proc_xpp_xbus_nn_xpd_mm_pri_info[pri_info file in procfs], but -that may change in future versions. - - -Device Startup -~~~~~~~~~~~~~~ -This section describes in great depth the initialization of the Xorcom -Astribank. Normally it would not be really needed, as the standard -installation of Zaptel should put everything in place. - -Terminology -^^^^^^^^^^^ -There are some technical terms that are used in this document and in the -driver / zaptel. - -span: -Zaptel breaks the channels it knows about to logical units called -"spans". A port in a E1/T1/ISDN card is usually a span. An whole -analog card is also a "span". You can see the list of spans as the list -of files under /proc/zaptel directory or in output of the zttool -utility. - -XBUS: -A funny way to call an Astribank device. - -XPD: -Basically this is a logical unit of the Astribank. It will be registered in -Zaptel as a single span. This can be either an analog (FXS or FXO) -module or a single port in case of a BRI module. - - -Loading Firmware -^^^^^^^^^^^^^^^^ -Normally this is done using the script /usr/share/zaptel/xpp_fxloader. -If it works fine, you don't need to bother reading this section. -Once the firmware is loaded the USB Vendor ID and Product ID of the Astribank -became to be e4e4 11x2, and now the driver can pick it up. - -First and foremost: the simplest and most useful tool to debug problems -is lsusb. The output of lsusb should show you if the device is connected -if its firmware is loaded. - -The firmware files are named *.hex. They are presented in the text -hexadecimal format The files are copied from xpp/utils to /usr/share/zaptel -folder during the Zaptel installation. - -The Astribank needs a firmware loaded into it. Without the firmware, -the device will appear in lsusb with Vendor ID e4e4 and Product ID 1130. -The firmware loading process consists of two stages. In the first stage the -"USB" firmware is loaded by using program fxload. When the first stage is -completed the Vendor ID is e4e4 and the Product ID is 1131. - -You can use the following command in order to load the "USB" firmware -manually: - - fxload -t fx2 -D /proc/bus/usb/MMM/NNN -I /usr/share/zaptel/USB_FW.hex - -where, - -fxload:: - A standard program that is typically part either of package 'fxload' - or 'hotplug-utils' . -/proc/bus/usb:: - The mount point of the USB file-system (usbfs). -MMM:: - the first number (bus number) -NNN:: - the second number (device number) you see for the device in lsusb - -If the loading process has been completed successfully, the device -disconnects and then connects again itself with USB Product ID 1131 -(and a new device number). - -In the second stage, the "FPGA" firmware is loaded. -The second-stage firmware loading is performed by using program fpga_load, -which is built in the directory xpp/utils and then copied to folder -/usr/sbin during Zaptel installation. - -The command syntax is similar to the syntax of fxload. You can use the -following command in order to load the FPGA firmware manually: - - fpga_load -D /proc/bus/usb/MMM/NNN -I /usr/share/zaptel/FPGA_1151.hex - -Please note, that NNN value differs from that that was used for the -fxload command due to the fact that device has "reconnected" itself -with another Product ID number. So you need to run lsusb again and get -the new NNN value. Usually, the new value is equal to the old value -incremented by 1. - - -Firmware Loading with Hotplug -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The Hotplug framework was popular for hot-plugging different devices and -usually also for automatic device drivers loading. If Hotplug is used in -your system, you'll see many files in folder /etc/hotplug. Hotplug will -automatically load the most relevant USB and PCI kernel modules according -to the USB and PCI IDs provided by devices. Please note, that if the -Hotplug framework is in place and the correct configuration files are -located in the right place, then the firmware should be loaded automatically. - -In order to get the Hotplug framework to load the firmware into the -Astribank automatically, the configuration file xpp_fxloader.usermap and -the script xpp_fxloader should be copied into /etc/hotplug/usb/ . This is -done by 'make -C xpp/utils install'. - -File xpp_fxloader.usermap includes a map of USB IDs and the command to run -when such devices are encountered. It instructs the Hotplug to run the script -xpp_fxloader from that directory. This is also done by 'make -C -xpp/utils install' . - -When xpp_fxloader is run without any parameters it assumes that it was -run by the hotplug scripts. Then it will check if the "add" event was -accepted and if so, xpp_fxloader will install the required firmware file. -The xpp_fxloader will be called twice, as after the load of the USB -firmware the device will re-enumerate itself and thus "unplug" and -"replug" in order to load the FPGA firmware. - - -Firmware Loading with UDEV -^^^^^^^^^^^^^^^^^^^^^^^^^^ -The UDEV framework has replaced Hotplug in most recent systems. If you -have a recent 2.6 system without Hotplug and with many files in folder -/etc/udev, then there are good chances that are you using udev. -As in case of Hotplug, if your udev framework is configured properly -then the firmware should be loaded automatically. - -In order to get udev to automatically load the firmware into the Astribank, -the configuration file xpp.rules should be copied into folder /etc/udev/rules.d -and the script xpp_fxloader should be copied into folder /etc/hotplug/usb/ . -This is done by 'make -C xpp/utils install' during Zaptel installation. - -File xpp.rules instructs the udevd daemon to run xpp_fxloader script with -the option "udev" and with the Astribank USB ID obtained from the -device when it is plugged in. -Please note, that exactly like in case of Hotplug, the xpp_fxloader will be -called twice by the udevd. First time for the USB firmware loading and the -second time for FPGA firmware loading. - - -Firmware Resetting -^^^^^^^^^^^^^^^^^^ -Newer versions of the USB firmware can now be reset using 'fpga_load -r'. - -Also you can try the following: - - /usr/share/zaptel/xpp_fxloader reset - # if asterisk was running: you may need to stop/restart it now. - # if there are some "disconnected" spans in /proc/xpp/xbuses - # wait a while, until you see the 1152 IDs again, and then: - /etc/init.d/zaptel start - # and start/restart asterisk. - - -Loading The Modules -^^^^^^^^^^^^^^^^^^^ -Here is what should happen: -In short: you should plug the Astribank device(s) or have them plugged in at -the boot time. Then all the modules should be loaded automatically. -You will see xpp_usb , xpd_fxs and, possibly, xpd_fxo in the modules list -(the output of lsmod). - -After the module xpp is loaded, you'll also be able to see the directory -/proc/xpp. For any Astribank device discovered, you will see there a -directory /proc/xpp/XBUS-n (where n is a number: typically 0). Once a unit have -been discovered you'll see subdirectories: /proc/xpp/XBUS-n/XPD-m (where -m may be another number: 0, 1 ,etc). - -Now to the ugly details: - -The driver of the Astribank is composed of several modules: - -* xpp - the basic module, that communicates with Zaptel and provides - some common services to other modules. -* xpd_fxs - the module for controlling FXS modules. -* xpd_fxo - the module for controlling FXO modules. -* xpd_bri - the module for controlling BRI modules. -* xpd_pri - the module for controlling E1/T1 modules. -* xpd_usb - the module that holds the functionality needed to connect to the - USB bus. - -All modules depend on xpp, and modprobing them will install xpp as well. -However the xpd_* modules are installed on-demand: no need to install -the xpd_fxo if you have only Astribank FXS. - -Once an Astribank device connected and the firmware is loaded, the -Vendor-ID/Product-ID of the device will be e4e4/1132 . The handler for that -combination is listed as the kernel module xpp_usb. Therefore, the system -runs 'modprobe xpp_usb' if that module is not already loaded. - -The module xpp_usb depends on the zaptel and xpp modules. Both of them -are loaded before xpp_usb. As usual, parameters and rules form -/etc/modprobe.conf and/or from /etc/modprobe.d/* will be applied to -the module. - -When command 'modprobe xpp_usb' returns, the span type specific modules -(e.g., xpd_fxs, xpd_fxo) may or may not have been loaded yet. - -At this point the xpp driver "asks" the box about its software -(firmware) version) and the type of telephony modules it has. According -to the answers it receives, the xpp driver will "modprobe" the required -xpd_* modules. - - -Device Initializations Scripts -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The chips in the device need to be initialized. This requires sending a -bunch of values to certain registers in those chips. We decided that -hardwiring those values in the driver code is not a good idea. -Before registering a XPD as a span in Zaptel, we run an initialization -script: /usr/share/zaptel/init_card_N_MM ( -where, - -* N - is 3 for an FXS span and 4 for an FXO span, and 6 or 7 for BRI. -* MM - is a version number. Currently it equals 26 - -Those scripts must be executable. Funny things happen if such a script -exists but is not executable. - -If because of some reasons this fails (the script is not in the place, or the -file doesn't have the executable permissions), then you will get an error -message in the logs and the XPD will then be removed (you won't see directory -for that XPD under the corresponding /proc/xpp/XBUS-* directory) and will not -be registered in Zaptel. - -As the XPD is initialized, you'll see the green LEDs of the ports steadily -turn on and later off ("a train of lights"). This is a bit slower than the -faster "blinking" when the XPDs register as Zaptel spans. The initialization -of an FXS XPD may take a few seconds. - - -Registering in Zaptel -^^^^^^^^^^^^^^^^^^^^^ -The XPDs will not automatically register as Zaptel spans. This is -intended to allow you to set the registration order (and hence the order -of Zaptel spans and channels) among multiple Astribank devices, -or between an Astribank and a different Zaptel device. - -When the XPD registers to Zaptel, all the green LEDs will be lit for a -short while. - -Spans are normally registered with the utility zt_registration. Simply -running 'zt_registration' shows the available XPDs and whether or not -they are registered. To register: - - zt_registration on - -For a system with several spans you'll see a "fast train of lights". - -If you have multiple Astribank devices, zt_registration will register -them by the order of the "connector" field. This means that as long as -the same Astribank is connected to the same port, the order of plugging -is not important.. - -zt_registration checks if a span is registered or tries to register a -span using the file /proc/xpp/XBUS-nn/XPD-mm/zt_registration . Reading -from that file returns 0 if the span is unregisters or 1 if it is -registered. You can register a span or ask to unregister it by writing 1 -(register) or 0 (unregister) to that file. Registration should -generally always succeed. Unregistration may fail if a span is in use. - -You may choose to register the XPDs in Zaptel automatically. This may -make the startup sequence a bit simpler, but is generally not -recommended on a system with more than one Astribank or an Astribank and -a different Zaptel device. This behavior may be defined by setting -parameter zap_autoreg in the modprobe configuration file (A file under -/etc/modprobe.d or /etc/modprobe.conf): - - options xpp zap_autoreg=1 - - -Zaptel And Above -^^^^^^^^^^^^^^^^ -From here you get a standard Zaptel span. It still needs to be -configured by ztcfg and used by a program such as Asterisk like any -other Zaptel device. In order for you to get a dial-tone in a phone -connected to the FXS port or a fully synchronized BRI port (layer 2 -activated, as signalled by a more steady blink) you will actually need -both the span configured by Zaptel and the channels configured in -Asterisk. - -You should generally refer to the general Zaptel documentation on how to -configure those levels. e.g, the README file in the top-level directory, -and - - http://voip-info.org/wiki/view/Asterisk+config+zapata.conf[] - - -Zaptel now includes a utility called genzaptelconf (written as a big -ugly shell script) to configure Zaptel automatically as good as -possible. For analog channels it works quite well (because, IMHO, the -"configuration" level on Zaptel should be optional there - there are -already sane defaults). For digital spans - BRI and PRI , it may take -some tuning. - -Alternatively, write you own configuration, based on the sample from the -"Sample Configurations" section. - - -/proc Interface -~~~~~~~~~~~~~~~ -The Astribank drivers provide their own /proc interface under /proc/xpp. -Here we review the more useful details of the procfs interface. There -are many other debugging details that are exposed through the procfs -interface. - -Also note that those details are subject to changes. Generally the -recommended stable interface are the Zaptel-perl utilities from the -xpp/utils directory. - - -/proc/xpp/xbuses -^^^^^^^^^^^^^^^^ -File /proc/xpp/xbuses lists the connected Astribank devices (one line -per device). - -A device is normally has status "connected". The status "missing" means that -the device has been disconnected, but Asterisk still holds channels from it -open. - - -/proc/xpp/sync -^^^^^^^^^^^^^^ -A read/write file. It contains information about current synchronization -source. You can change the synchronization source by writing special -command to the file. For example, command - echo SYNC=01 > /proc/xpp/sync - -Possible values are: - -:: - Make the Astribank XBUS- the sync source for other Astribanks. - -ZAPTEL:: - Make the Astribanks synchronize with the Zaptel timing master span. - You probably need this to get faxes from a non-Astribank adapter to an - Astribank. - -Though you'll normally use xpp_sync(8) for that. - -For each Astribank device there is folder /proc/xpp/XBUS-nn and for each device -module (span in the terms of Zaptel) there is folder /proc/XBUS-nn/XPD-mm. - - -/proc/xpp/XBUS-nn/waitfor_xpds -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Reading from this file only returns when the Astribank has finished -initialization of the XPDs or in case of a timeout. It prints the number -of XPDs to initialize, and the number initialize. Unless something went -wrong, those two numbers are the same. Once the span was initialized, -reading from this file returns immediately: - - XPDS_READY: XBUS-00: 3/3 - - -/proc/xpp/XBUS-nn/XPD-mm/zt_registration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -is a read/write file. Reading from it gives 0 if the span is -unregistered, or the span number if it is registered. - -Writing to it allows manual registration / unregistration from Zaptel: -writing 1 registers a span (if it wasn't already registered) and writing -0 attempts to unregister it (if it is registered. Span unregistration -will fail if some channels from the span are used (e.g: by Asterisk). - -A more convenient interface to this is the command zt_registration that -registers or unregisters all the spans at once with a predefined order, -and this is what you should normally use. - -Alternatively you can use the parameter zap_autoreg to register spans -automatically. But this is only recommended on a system with a single -Astribank and no other Zaptel device. - - -/proc/xpp/XBUS-nn/XPD-mm/summary -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Contains detailed information about port statuses of the device module -(off-hook, on-hook etc.) For example, you can run the following command -in order to monitor the port statuses in the real time: - - watch -n1 cat /proc/xpp/XBUS-00/XPD-00/summary - - -/proc/xpp/XBUS-nn/XPD-mm/slics -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Provides direct read/write interface to the registers of each chip. -Reading from the file shows the result of the last read request. To make -either a read request or a write request you need to write to that file. - -It is mainly used by the initialization scripts (card_init_*). - -Incorrect usage of this file is one possible way of damaging the -Astribank. - - -/proc/xpp/XBUS-nn/XPD-mm/fxo_info -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Only for FXO modules. Apart from showing the status of the LEDs, it also -shows for each FXO port if it is connected to a provider: look for the -value of "battery" for that specific port, and a bunch of other -characteristics of the port. - - -/proc/xpp/XBUS-nn/XPD-mm/bri_info -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -In addition to the usual information about the LEDs, this file also -provides useful information regarding ISDN Layer 1 and Layer 2 status. -For example, you can run the following command in order to monitor -the Layer 1 port statuses for all BRI devices in the real time: - - watch -n1 -d 'grep "Layer 1:" /proc/xpp/XBUS-*/XPD-*/bri_info' - -For the status of the D channel of the ports on all BRI spans, run: - - watch -n1 -d 'grep D-Channel: /proc/xpp/XBUS-*/XPD-*/bri_info' - - -/proc/xpp/XBUS-nn/XPD-mm/pri_info -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -In addition to the usual information about the LEDs, this file also -provides useful information regarding ISDN Layer 1 and Layer 2 status. -For example, you can run the following command in order to monitor -the Layer 1 port statuses for all E1/T1 devices in the real time: - - watch -n1 -d 'grep "Layer 1:" /proc/xpp/XBUS-*/XPD-*/pri_info' - -For the status of the D channel of the ports on all PRI spans, run: - - watch -n1 -d 'grep D-Channel: /proc/xpp/XBUS-*/XPD-*/pri_info' - -Note: the layer 2 status is much more of a guesswork based on changes in -the contents of the channel that is supposed to be the D channel. - -Writing to this file can be used to change the type of the device. The -device type can only be changed when the XPD is not registered as a -Zaptel span. The value is a whitespace-separated list of values that can -be of: - -E1:: - Provides 31 channels, of which channel 16 is normally the D-channel. - Common in places outside of North America and Japan. This is the - default setup. - -T1:: - T1 provides 24 channels. The last one is normally the D-Channel. - Common in North America. - -TE:: - Use the bottom port (green LED) and don't invert any wiring. Hint to - higher layers that this will be the TE side of the connection. This is - the default setup. - -NT:: - Use the top port (orange LED) and invert wiring (this is done to allow - connecting an NT port and a TE port using a standard straight 8 wires - "ethernet" cable). Hint to higher layers that this will be the NT side - of the connection. - -LOCALOOP:: - Set the device into local loop mode: loops the transmitted channels - directly into the received channels. - -NOLOCALLOOP:: - Ends local loop mode. - -Normally those are set by the PRI initialization script . See the -definition of XPP_PRI_SETUP in -xref:_zaptel_init_configuration_file[the sample Zaptel init -configuration file] . - - -There are a bunch of other status files under /proc/xpp/. - - -/sys Interface -~~~~~~~~~~~~~~~ -When an Astribank device loads it generates a device node in the bus -'astribanks' in sysfs. You can see a directory for each device under -/sys/bus/astribanks/devices/ and under it there are several attributes -for each Astribank (such as its connector string). - -On each time an Astribank is initialized or destroyed a udev event is -generated. The rules from our sample udev rules file (xpp/utils/xpp.rules) -make that event run the script /usr/share/zaptel/astribank_hook with the -parameter 'add' or 'remove', if such script exists. An example script -that just adjusts the Astribank sync settings is included in xpp/utils. - -cls:: - CLear Statistics: writing to this file clear the procfs statistics for - this bus. - -connector:: - Connector string for the device. The place to which the Astribank is - connected. e.g: usb-0000:00:03.3-2 - -label:: - The label string of the Astribank unit. E.g: usb:00000135 - -status:: - 'connected' (normal operation) or 'disconnected' (has been disconnected, - some channels are still open). - -timing:: - Provides some statistics in case the Astribank is not the sync source. - The format of this file is subject to future changes. - - -Useful Module Parameters -~~~~~~~~~~~~~~~~~~~~~~~~ -Compilation-time defaults for the all modules can be shown as part of the -description line for the parameter in the "modinfo" command output. - -zap_autoreg (xpp):: - Register spans automatically (1) or not (0). Default: 0. - Setting it simplifies operations with a single Astribank and no other - Zaptel hardware. However if you have such systems, automatic - registration can cause the order of spans to be unpredictable. - The standard startup scripts use 'zt_registration on' instead of this. - -initdir (xpp):: - This is the directory containing the initialization scripts. - The default is /usr/share/zaptel . - Setting this value could be useful if that location is inconvenient for you. - -rx_tasklet (xpp):: - Enable (1) or disable (0) doing most of the packets processing in - separate tasklets. This should probably help on higher-end systems with - multiple Astribanks. - -debug (all modules):: - It will make the driver to print tons of debugging messages. You can - set/unset the parameter at run-time. The parameter value is a bitmask - of several values. The different bits meaning as it defined in - xpp/zap_debug.h: - - * 0 - Disable debug messages - * 1 - GENERAL - General debug comments. - * 2 - PCM - PCM-related messages. Tends to flood logs. - * 4 - LEDS - Anything related to the LEDs status control. The driver - produces a lot of messages when the option is enabled. - * 8 - SYNC - Synchronization related messages. - * 16 - SIGNAL - Zaptel signalling related messages. - * 32 - PROC - Messages related to the procfs interface. - * 64 - REGS - Reading and writing to chip registers. Tends to flood - logs. - * 128 - DEVICES - Device instantiation, destruction and such. - * 256 - COMMANDS - Protocol commands. Tends to flood logs. - - For example, - - echo 33 >/sys/modules/xpp/parameters/debug - - forces module xpp to print general debugging messages (1) and procfs - debugging messages (32). - -vmwineon (xpd_fxs):: - Enable (1) or disable (0) sending the voicemail message waiting indication - signal to phones equipped with the Message Waiting neon lamp. It is - disabled by default because the feature requires extra work of the driver - even when such a phone is not used and also may cause some unusual - side effects with some phone models. - -usb1 (xpp_usb):: - Enable (1) or disable (0) support of USB1 devices. Disabled by default. - - USB1 devices are not well-tested. It seems that they don't work at all - for Astribank BRI. Generally they should work with the current code, but - we expect the voice quality issues. Hence we would like to make it - very clear that you if you have a USB1 port (rather than a USB2 one, as - recommended) you will have to take an action to enable the device. - -poll intervals (various):: - There are various values which the driver occasionally polls the device - for. For instance, the parameter poll_battery_interval for xpd_fxo - to poll the battery, in order to know if the telco line is actually - connected. - - The value of those parameters is typically a number in milliseconds. - 0 is used to disable polling. Under normal operation there should be - no reason to play with those parameters. - -dtmf_detection (xpd_fxs):: - Enable (1) or disable (0) support of hardware DTMF detection by the - Astribank. - - -NOTE: XPP here does not stand for X Printing Panel, XML Pull Parser, -X-Windows Phase Plane or XML Professional Publisher. It is simply the -Xorcom Peripheral Protocol, which connects a computer to a XPD (Xorcom -Peripheral Device). An XBUS (originally XPP Bus) is actually a single -Astribank device and the XPDs have become the single modules in it. diff --git a/zaptel/kernel/xpp/card_bri.c b/zaptel/kernel/xpp/card_bri.c deleted file mode 100644 index c6a9f395..00000000 --- a/zaptel/kernel/xpp/card_bri.c +++ /dev/null @@ -1,1506 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * Parts derived from Cologne demo driver for the chip. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include "xpd.h" -#include "xproto.h" -#include "xpp_zap.h" -#include "card_bri.h" -#include "zap_debug.h" -#include "xbus-core.h" - -static const char rcsid[] = "$Id: card_bri.c 4474 2008-08-11 14:00:30Z tzafrir $"; - -#ifndef CONFIG_ZAPATA_BRI_DCHANS -#error CONFIG_ZAPATA_BRI_DCHANS is not defined -#endif - -static DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); /* must be before zap_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"); - -enum xhfc_states { - ST_RESET = 0, /* G/F0 */ - /* TE */ - ST_TE_SENSING = 2, /* F2 */ - ST_TE_DEACTIVATED = 3, /* F3 */ - ST_TE_SIGWAIT = 4, /* F4 */ - ST_TE_IDENT = 5, /* F5 */ - ST_TE_SYNCED = 6, /* F6 */ - ST_TE_ACTIVATED = 7, /* F7 */ - ST_TE_LOST_FRAMING = 8, /* F8 */ - /* NT */ - ST_NT_DEACTIVATED = 1, /* G1 */ - ST_NT_ACTIVATING = 2, /* G2 */ - ST_NT_ACTIVATED = 3, /* G3 */ - ST_NT_DEACTIVTING = 4, /* G4 */ -}; - -static const char *xhfc_state_name(bool is_nt, enum xhfc_states state) -{ - const char *p; - -#define _E(x) [ST_ ## x] = #x - static const char *te_names[] = { - _E(RESET), - _E(TE_SENSING), - _E(TE_DEACTIVATED), - _E(TE_SIGWAIT), - _E(TE_IDENT), - _E(TE_SYNCED), - _E(TE_ACTIVATED), - _E(TE_LOST_FRAMING), - }; - static const char *nt_names[] = { - _E(RESET), - _E(NT_DEACTIVATED), - _E(NT_ACTIVATING), - _E(NT_ACTIVATED), - _E(NT_DEACTIVTING), - }; -#undef _E - if(is_nt) { - if ((state < ST_RESET) || (state > ST_NT_DEACTIVTING)) - p = "NT ???"; - else - p = nt_names[state]; - } else { - if ((state < ST_RESET) || (state > ST_TE_LOST_FRAMING)) - p = "TE ???"; - else - p = te_names[state]; - } - return p; -} - -/* xhfc Layer1 physical commands */ -#define HFC_L1_ACTIVATE_TE 0x01 -#define HFC_L1_FORCE_DEACTIVATE_TE 0x02 -#define HFC_L1_ACTIVATE_NT 0x03 -#define HFC_L1_DEACTIVATE_NT 0x04 - -#define HFC_L1_ACTIVATING 1 -#define HFC_L1_ACTIVATED 2 -#define HFC_TIMER_T1 2500 -#define HFC_TIMER_T3 8000 /* 8s activation timer T3 */ -#define HFC_TIMER_OFF -1 /* timer disabled */ - -#define A_SU_WR_STA 0x30 /* ST/Up state machine register */ -#define V_SU_LD_STA 0x10 -#define V_SU_ACT 0x60 /* start activation/deactivation */ -#define STA_DEACTIVATE 0x40 /* start deactivation in A_SU_WR_STA */ -#define STA_ACTIVATE 0x60 /* start activation in A_SU_WR_STA */ -#define V_SU_SET_G2_G3 0x80 - -#define A_SU_RD_STA 0x30 -typedef union { - struct { - byte v_su_sta:4; - byte v_su_fr_sync:1; - byte v_su_t2_exp:1; - byte v_su_info0:1; - byte v_g2_g3:1; - } bits; - byte reg; -} su_rd_sta_t; - -#define REG30_LOST 3 /* in polls */ -#define DCHAN_LOST 15000 /* in ticks */ - -#define BRI_DCHAN_SIGCAP ( \ - ZT_SIG_EM | \ - ZT_SIG_CLEAR | \ - ZT_SIG_FXSLS | \ - ZT_SIG_FXSGS | \ - ZT_SIG_FXSKS | \ - ZT_SIG_FXOLS | \ - ZT_SIG_FXOGS | \ - ZT_SIG_FXOKS | \ - ZT_SIG_CAS | \ - ZT_SIG_SF \ - ) -#define BRI_BCHAN_SIGCAP (ZT_SIG_CLEAR | ZT_SIG_DACS) - -#define IS_NT(xpd) ((xpd)->direction == TO_PHONE) -#define BRI_PORT(xpd) ((xpd)->addr.subunit) - -/* shift in PCM highway */ -#define SUBUNIT_PCM_SHIFT 4 -#define PCM_SHIFT(mask, sunit) ((mask) << (SUBUNIT_PCM_SHIFT * (sunit))) - -/*---------------- BRI Protocol Commands ----------------------------------*/ - -static int write_state_register(xpd_t *xpd, byte value); -static bool bri_packet_is_valid(xpacket_t *pack); -static void bri_packet_dump(const char *msg, xpacket_t *pack); -static int proc_bri_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); -static int bri_spanconfig(struct zt_span *span, struct zt_lineconfig *lc); -static int bri_chanconfig(struct zt_chan *chan, int sigtype); -static int bri_startup(struct zt_span *span); -static int bri_shutdown(struct zt_span *span); - -#define PROC_REGISTER_FNAME "slics" -#define PROC_BRI_INFO_FNAME "bri_info" - -enum led_state { - BRI_LED_OFF = 0x0, - BRI_LED_ON = 0x1, - /* - * We blink by software from driver, so that - * if the driver malfunction that blink would stop. - */ - // BRI_LED_BLINK_SLOW = 0x2, /* 1/2 a second blink cycle */ - // BRI_LED_BLINK_FAST = 0x3 /* 1/4 a second blink cycle */ -}; - -enum bri_led_names { - GREEN_LED = 0, - RED_LED = 1 -}; - -#define NUM_LEDS 2 -#define LED_TICKS 100 - - -struct bri_leds { - byte state:2; - byte led_sel:1; /* 0 - GREEN, 1 - RED */ - byte reserved:5; -}; - -#ifndef MAX_DFRAME_LEN_L1 -#define MAX_DFRAME_LEN_L1 300 -#endif - -#define DCHAN_BUFSIZE MAX_DFRAME_LEN_L1 - -struct BRI_priv_data { - struct proc_dir_entry *bri_info; - su_rd_sta_t state_register; - bool initialized; - int t1; /* timer 1 for NT deactivation */ - int t3; /* timer 3 for TE activation */ - ulong l1_flags; - bool reg30_good; - uint reg30_ticks; - bool layer1_up; - xpp_line_t card_pcm_mask; - - /* - * D-Chan: buffers + extra state info. - */ - int dchan_r_idx; - byte dchan_rbuf[DCHAN_BUFSIZE]; - byte dchan_tbuf[DCHAN_BUFSIZE]; - bool txframe_begin; - - uint tick_counter; - uint poll_counter; - uint dchan_tx_counter; - uint dchan_rx_counter; - uint dchan_rx_drops; - bool dchan_alive; - uint dchan_alive_ticks; - uint dchan_notx_ticks; - uint dchan_norx_ticks; - enum led_state ledstate[NUM_LEDS]; -}; - -static xproto_table_t PROTO_TABLE(BRI); - - -DEF_RPACKET_DATA(BRI, SET_LED, /* Set one of the LED's */ - struct bri_leds bri_leds; - ); - -static /* 0x33 */ DECLARE_CMD(BRI, SET_LED, enum bri_led_names which_led, enum led_state to_led_state); - -#define DO_LED(xpd, which, tostate) \ - CALL_PROTO(BRI, SET_LED, (xpd)->xbus, (xpd), (which), (tostate)) - -#define DEBUG_BUF_SIZE (100) -static void dump_hex_buf(xpd_t *xpd, char *msg, byte *buf, size_t len) -{ - char debug_buf[DEBUG_BUF_SIZE + 1]; - int i; - int n = 0; - - debug_buf[0] = '\0'; - for(i = 0; i < len && n < DEBUG_BUF_SIZE; i++) - n += snprintf(&debug_buf[n], DEBUG_BUF_SIZE - n, "%02X ", buf[i]); - XPD_DBG(GENERAL, xpd, "%s[0..%zd]: %s%s\n", msg, len-1, debug_buf, - (n >= DEBUG_BUF_SIZE)?"...":""); -} - -static void dump_dchan_packet(xpd_t *xpd, bool transmit, byte *buf, int len) -{ - struct BRI_priv_data *priv; - char msgbuf[MAX_PROC_WRITE]; - char ftype = '?'; - char *direction; - int frame_begin; - - priv = xpd->priv; - BUG_ON(!priv); - if(transmit) { - direction = "TX"; - frame_begin = priv->txframe_begin; - } else { - direction = "RX"; - frame_begin = 1; - } - if(frame_begin) { /* Packet start */ - if(!IS_SET(buf[0], 7)) - ftype = 'I'; /* Information */ - else if(IS_SET(buf[0], 7) && !IS_SET(buf[0], 6)) - ftype = 'S'; /* Supervisory */ - else if(IS_SET(buf[0], 7) && IS_SET(buf[0], 6)) - ftype = 'U'; /* Unnumbered */ - else - XPD_NOTICE(xpd, "Unknown frame type 0x%X\n", buf[0]); - - snprintf(msgbuf, MAX_PROC_WRITE, "D-Chan %s = (%c) ", direction, ftype); - } else { - snprintf(msgbuf, MAX_PROC_WRITE, "D-Chan %s = ", direction); - } - dump_hex_buf(xpd, msgbuf, buf, len); -} - -static void set_bri_timer(xpd_t *xpd, const char *name, int *bri_timer, int value) -{ - if(value == HFC_TIMER_OFF) - XPD_DBG(SIGNAL, xpd, "Timer %s DISABLE\n", name); - else - XPD_DBG(SIGNAL, xpd, "Timer %s: set to %d\n", name, value); - *bri_timer = value; -} - -static void dchan_state(xpd_t *xpd, bool up) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(priv->dchan_alive == up) - return; - if(up) { - XPD_DBG(SIGNAL, xpd, "STATE CHANGE: D-Channel RUNNING\n"); - priv->dchan_alive = 1; - } else { - XPD_DBG(SIGNAL, xpd, "STATE CHANGE: D-Channel STOPPED\n"); - priv->dchan_rx_counter = priv->dchan_tx_counter = priv->dchan_rx_drops = 0; - priv->dchan_alive = 0; - priv->dchan_alive_ticks = 0; - } -} - -static void layer1_state(xpd_t *xpd, bool up) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(priv->layer1_up == up) - return; - priv->layer1_up = up; - XPD_DBG(SIGNAL, xpd, "STATE CHANGE: Layer1 %s\n", (up)?"UP":"DOWN"); - if(!up) - dchan_state(xpd, 0); -} - -static void te_activation(xpd_t *xpd, bool on) -{ - struct BRI_priv_data *priv; - xbus_t *xbus; - byte curr_state; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - curr_state = priv->state_register.bits.v_su_sta; - xbus = xpd->xbus; - XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF"); - if(on) { - if(curr_state == ST_TE_DEACTIVATED) { - XPD_DBG(SIGNAL, xpd, "HFC_L1_ACTIVATE_TE\n"); - set_bit(HFC_L1_ACTIVATING, &priv->l1_flags); - write_state_register(xpd, STA_ACTIVATE); - set_bri_timer(xpd, "T3", &priv->t3, HFC_TIMER_T3); - } else { - XPD_DBG(SIGNAL, xpd, - "HFC_L1_ACTIVATE_TE (state %d, ignored)\n", - curr_state); - } - } else { /* happen only because of T3 expiry */ - switch (curr_state) { - case ST_TE_DEACTIVATED: /* F3 */ - case ST_TE_SYNCED: /* F6 */ - case ST_TE_ACTIVATED: /* F7 */ - XPD_DBG(SIGNAL, xpd, - "HFC_L1_FORCE_DEACTIVATE_TE (state %d, ignored)\n", - curr_state); - break; - case ST_TE_SIGWAIT: /* F4 */ - case ST_TE_IDENT: /* F5 */ - case ST_TE_LOST_FRAMING: /* F8 */ - XPD_DBG(SIGNAL, xpd, "HFC_L1_FORCE_DEACTIVATE_TE\n"); - write_state_register(xpd, STA_DEACTIVATE); - break; - default: - XPD_NOTICE(xpd, "Bad TE state: %d\n", curr_state); - break; - } - } -} - -static void nt_activation(xpd_t *xpd, bool on) -{ - struct BRI_priv_data *priv; - xbus_t *xbus; - byte curr_state; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - curr_state = priv->state_register.bits.v_su_sta; - xbus = xpd->xbus; - XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF"); - if(on) { - switch(curr_state) { - case ST_RESET: /* F/G 0 */ - case ST_NT_DEACTIVATED: /* G1 */ - case ST_NT_DEACTIVTING: /* G4 */ - XPD_DBG(SIGNAL, xpd, "HFC_L1_ACTIVATE_NT\n"); - set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_T1); - set_bit(HFC_L1_ACTIVATING, &priv->l1_flags); - write_state_register(xpd, STA_ACTIVATE); - break; - case ST_NT_ACTIVATING: /* G2 */ - case ST_NT_ACTIVATED: /* G3 */ - XPD_DBG(SIGNAL, xpd, - "HFC_L1_ACTIVATE_NT (in state %d, ignored)\n", - curr_state); - break; - } - } else { - switch(curr_state) { - case ST_RESET: /* F/G 0 */ - case ST_NT_DEACTIVATED: /* G1 */ - case ST_NT_DEACTIVTING: /* G4 */ - XPD_DBG(SIGNAL, xpd, - "HFC_L1_DEACTIVATE_NT (in state %d, ignored)\n", - curr_state); - break; - case ST_NT_ACTIVATING: /* G2 */ - case ST_NT_ACTIVATED: /* G3 */ - XPD_DBG(SIGNAL, xpd, "HFC_L1_DEACTIVATE_NT\n"); - write_state_register(xpd, STA_DEACTIVATE); - break; - default: - XPD_NOTICE(xpd, "Bad NT state: %d\n", curr_state); - break; - } - } -} - - -/* - * D-Chan receive - */ -static int rx_dchan(xpd_t *xpd, reg_cmd_t *regcmd) -{ - xbus_t *xbus; - struct BRI_priv_data *priv; - byte *src; - byte *dst; - byte *dchan_buf; - struct zt_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; -#ifdef XPP_DEBUGFS - xbus_log(xbus, xpd, 0, regcmd, sizeof(reg_cmd_t)); /* 0 = RX */ -#endif - dchan = &xpd->span.chans[2]; - if(!IS_SET(xpd->offhook, 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(dchan_buf[idx-1]) { - XPD_NOTICE(xpd, "D-Chan RX Bad checksum: [%02X:%02X=%02X] (%d)\n", - dchan_buf[idx-3], dchan_buf[idx-2], dchan_buf[idx-1], dchan_buf[idx-1]); - 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(debug) - dump_dchan_packet(xpd, 0, dchan_buf, idx /* - 3 */); /* Print checksum? */ - /* - * Tell Zaptel 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; -} - -/* - * D-Chan transmit - */ -static int tx_dchan(xpd_t *xpd) -{ - struct BRI_priv_data *priv; - struct zt_chan *dchan; - int len; - int eoframe; - int ret; - - priv = xpd->priv; - BUG_ON(!priv); - if(!SPAN_REGISTERED(xpd) || !(xpd->span.flags & ZT_FLAG_RUNNING)) - return 0; - dchan = &xpd->chans[2]; - len = dchan->bytes2transmit; /* dchan's hdlc package len */ - eoframe = dchan->eoftx; /* dchan's end of frame */ - dchan->bytes2transmit = 0; - dchan->eoftx = 0; - dchan->bytes2receive = 0; - dchan->eofrx = 0; - 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); - return -EINVAL; - } - 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(xpd->direction == TO_PSTN) - te_activation(xpd, 1); - else - nt_activation(xpd, 1); - return 0; - } - if(debug) - dump_dchan_packet(xpd, 1, priv->dchan_tbuf, len); - if(eoframe) - priv->txframe_begin = 1; - else - priv->txframe_begin = 0; - 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) - priv->dchan_tx_counter++; - priv->dchan_notx_ticks = 0; - return ret; -} - -/*---------------- BRI: Methods -------------------------------------------*/ - -static void bri_proc_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(PROC, xpd, "\n"); -#ifdef CONFIG_PROC_FS - if(priv->bri_info) { - XPD_DBG(PROC, xpd, "Removing '%s'\n", PROC_BRI_INFO_FNAME); - remove_proc_entry(PROC_BRI_INFO_FNAME, xpd->proc_xpd_dir); - } -#endif -} - -static int bri_proc_create(xbus_t *xbus, xpd_t *xpd) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(PROC, xpd, "\n"); -#ifdef CONFIG_PROC_FS - XPD_DBG(PROC, xpd, "Creating '%s'\n", PROC_BRI_INFO_FNAME); - priv->bri_info = create_proc_read_entry(PROC_BRI_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_bri_info_read, xpd); - if(!priv->bri_info) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_BRI_INFO_FNAME); - goto err; - } - priv->bri_info->owner = THIS_MODULE; -#endif - return 0; -err: - bri_proc_remove(xbus, xpd); - return -EINVAL; -} - -static xpd_t *BRI_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, byte subtype, int subunits, bool to_phone) -{ - xpd_t *xpd = NULL; - int channels = min(3, CHANNELS_PERXPD); - - XBUS_DBG(GENERAL, xbus, "\n"); - xpd = xpd_alloc(sizeof(struct BRI_priv_data), proto_table, channels); - if(!xpd) - return NULL; - xpd->direction = (to_phone) ? TO_PHONE : TO_PSTN; - xpd->type_name = (to_phone) ? "BRI_NT" : "BRI_TE"; - if(xpd_common_init(xbus, xpd, unit, subunit, subtype, subunits) < 0) - goto err; - if(bri_proc_create(xbus, xpd) < 0) - goto err; - return xpd; -err: - xpd_free(xpd); - return NULL; -} - -static int BRI_card_init(xbus_t *xbus, xpd_t *xpd) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - XPD_DBG(GENERAL, xpd, "\n"); - priv = xpd->priv; - set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_OFF); - write_state_register(xpd, 0); /* Enable L1 state machine */ - priv->initialized = 1; - return 0; -} - -static int BRI_card_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(GENERAL, xpd, "\n"); - bri_proc_remove(xbus, xpd); - return 0; -} - -static int BRI_card_zaptel_preregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct BRI_priv_data *priv; - xpp_line_t tmp_pcm_mask; - int tmp_pcm_len; - unsigned long flags; - int i; - - BUG_ON(!xpd); - xbus = xpd->xbus; - priv = xpd->priv; - BUG_ON(!xbus); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); - if(!on) { - /* Nothing to do yet */ - return 0; - } -#ifdef ZT_SPANSTAT_V2 - xpd->span.spantype = "BRI"; -#endif - xpd->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_CCS; - xpd->span.deflaw = ZT_LAW_ALAW; - BIT_SET(xpd->digital_signalling, 2); /* D-Channel */ - for_each_line(xpd, i) { - struct zt_chan *cur_chan = &xpd->chans[i]; - - XPD_DBG(GENERAL, xpd, "setting BRI channel %d\n", i); - snprintf(cur_chan->name, MAX_CHANNAME, "XPP_%s/%02d/%1d%1d/%d", - xpd->type_name, xbus->num, - xpd->addr.unit, xpd->addr.subunit, i); - cur_chan->chanpos = i + 1; - cur_chan->pvt = xpd; - if(i == 2) { /* D-CHAN */ - cur_chan->sigcap = BRI_DCHAN_SIGCAP; - cur_chan->flags |= ZT_FLAG_BRIDCHAN; - cur_chan->flags &= ~ZT_FLAG_HDLC; - - /* Setup big buffers for D-Channel rx/tx */ - cur_chan->readchunk = priv->dchan_rbuf; - cur_chan->writechunk = priv->dchan_tbuf; - priv->dchan_r_idx = 0; - priv->txframe_begin = 1; - - cur_chan->maxbytes2transmit = MULTIBYTE_MAX_LEN; - cur_chan->bytes2transmit = 0; - cur_chan->bytes2receive = 0; - } else - cur_chan->sigcap = BRI_BCHAN_SIGCAP; - } - xpd->offhook = BIT(0) | BIT(1); /* 2*bchan */ - - /* - * Compute PCM lentgh and mask - * We know all cards have been initialized until now - */ - tmp_pcm_mask = 0; - if(xpd->addr.subunit == 0) { - int line_count = 0; - - for(i = 0; i < MAX_SUBUNIT; i++) { - xpd_t *sub_xpd = xpd_byaddr(xbus, xpd->addr.unit, i); - if(sub_xpd) { - tmp_pcm_mask |= PCM_SHIFT(sub_xpd->wanted_pcm_mask, i); - line_count += 2; - } - } - tmp_pcm_len = RPACKET_HEADERSIZE + sizeof(xpp_line_t) + line_count * ZT_CHUNKSIZE; - } else - tmp_pcm_len = 0; - spin_lock_irqsave(&xpd->lock, flags); - xpd->pcm_len = tmp_pcm_len; - xpd->wanted_pcm_mask = xpd->offhook; - priv->card_pcm_mask = tmp_pcm_mask; - xpd->span.spanconfig = bri_spanconfig; - xpd->span.chanconfig = bri_chanconfig; - xpd->span.startup = bri_startup; - xpd->span.shutdown = bri_shutdown; - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; -} - -static int BRI_card_zaptel_postregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - xbus = xpd->xbus; - priv = xpd->priv; - BUG_ON(!xbus); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); - return(0); -} - -static int BRI_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig) -{ - LINE_DBG(SIGNAL, xpd, pos, "%s\n", txsig2str(txsig)); - return 0; -} - -/* - * LED managment is done by the driver now: - * - Turn constant ON RED/GREEN led to indicate NT/TE port - * - Very fast "Double Blink" to indicate Layer1 alive (without D-Channel) - * - Constant blink (1/2 sec cycle) to indicate D-Channel alive. - */ -static void handle_leds(xbus_t *xbus, xpd_t *xpd) -{ - struct BRI_priv_data *priv; - unsigned int timer_count; - int which_led; - int other_led; - int mod; - - BUG_ON(!xpd); - if(IS_NT(xpd)) { - which_led = RED_LED; - other_led = GREEN_LED; - } else { - which_led = GREEN_LED; - other_led = RED_LED; - } - priv = xpd->priv; - BUG_ON(!priv); - timer_count = xpd->timer_count; - if(xpd->blink_mode) { - if((timer_count % DEFAULT_LED_PERIOD) == 0) { - // led state is toggled - if(priv->ledstate[which_led] == BRI_LED_OFF) { - DO_LED(xpd, which_led, BRI_LED_ON); - DO_LED(xpd, other_led, BRI_LED_ON); - } else { - DO_LED(xpd, which_led, BRI_LED_OFF); - DO_LED(xpd, other_led, BRI_LED_OFF); - } - } - return; - } - if(priv->ledstate[other_led] != BRI_LED_OFF) - DO_LED(xpd, other_led, BRI_LED_OFF); - if(priv->dchan_alive) { - mod = timer_count % 1000; - switch(mod) { - case 0: - DO_LED(xpd, which_led, BRI_LED_ON); - break; - case 500: - DO_LED(xpd, which_led, BRI_LED_OFF); - break; - } - } else if(priv->layer1_up) { - mod = timer_count % 1000; - switch(mod) { - case 0: - case 100: - DO_LED(xpd, which_led, BRI_LED_ON); - break; - case 50: - case 150: - DO_LED(xpd, which_led, BRI_LED_OFF); - break; - } - } else { - if(priv->ledstate[which_led] != BRI_LED_ON) - DO_LED(xpd, which_led, BRI_LED_ON); - } -} - -static void handle_bri_timers(xpd_t *xpd) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(IS_NT(xpd)) { - if (priv->t1 > HFC_TIMER_OFF) { - if (--priv->t1 == 0) { - set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_OFF); - if(!nt_keepalive) { - if(priv->state_register.bits.v_su_sta == ST_NT_ACTIVATING) { /* G2 */ - XPD_DBG(SIGNAL, xpd, "T1 Expired. Deactivate NT\n"); - clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags); - nt_activation(xpd, 0); /* Deactivate NT */ - } else - XPD_DBG(SIGNAL, xpd, - "T1 Expired. (state %d, ignored)\n", - priv->state_register.bits.v_su_sta); - } - } - } - } else { - if (priv->t3 > HFC_TIMER_OFF) { - /* timer expired ? */ - if (--priv->t3 == 0) { - XPD_DBG(SIGNAL, xpd, "T3 expired. Deactivate TE\n"); - set_bri_timer(xpd, "T3", &priv->t3, HFC_TIMER_OFF); - clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags); - te_activation(xpd, 0); /* Deactivate TE */ - } - } - } -} - -/* Poll the register ST/Up-State-machine Register, to see if the cable - * if a cable is connected to the port. - */ -static int BRI_card_tick(xbus_t *xbus, xpd_t *xpd) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(!priv->initialized || !xbus->self_ticking) - return 0; - if(poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) { - // XPD_DBG(GENERAL, xpd, "%d\n", priv->tick_counter); - priv->poll_counter++; - xpp_register_request(xbus, xpd, - BRI_PORT(xpd), /* portno */ - 0, /* writing */ - A_SU_RD_STA, /* regnum */ - 0, /* do_subreg */ - 0, /* subreg */ - 0, /* data_low */ - 0, /* do_datah */ - 0, /* data_high */ - 0 /* should_reply */ - ); - - if(IS_NT(xpd) && nt_keepalive && - !test_bit(HFC_L1_ACTIVATED, &priv->l1_flags) && - !test_bit(HFC_L1_ACTIVATING, &priv->l1_flags)) { - XPD_DBG(SIGNAL, xpd, "Kick NT D-Channel\n"); - nt_activation(xpd, 1); - } - } - /* Detect D-Channel disconnect heuristic */ - priv->dchan_notx_ticks++; - priv->dchan_norx_ticks++; - priv->dchan_alive_ticks++; - if(priv->dchan_alive && (priv->dchan_notx_ticks > DCHAN_LOST || priv->dchan_norx_ticks > DCHAN_LOST)) { - /* - * No tx_dchan() or rx_dchan() for many ticks - * This D-Channel is probabelly dead. - */ - dchan_state(xpd, 0); - } else if(priv->dchan_rx_counter > 1 && priv->dchan_tx_counter > 1) { - if(!priv->dchan_alive) - dchan_state(xpd, 1); - } - /* Detect Layer1 disconnect */ - if(priv->reg30_good && priv->reg30_ticks > poll_interval * REG30_LOST) { - /* No reply for 1/2 a second */ - XPD_ERR(xpd, "Lost state tracking for %d ticks\n", priv->reg30_ticks); - priv->reg30_good = 0; - layer1_state(xpd, 0); - } - handle_leds(xbus, xpd); - handle_bri_timers(xpd); - tx_dchan(xpd); - priv->tick_counter++; - priv->reg30_ticks++; - return 0; -} - -static int BRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg) -{ - BUG_ON(!xpd); - if(!TRANSPORT_RUNNING(xpd->xbus)) - return -ENODEV; - switch (cmd) { - case ZT_TONEDETECT: - /* - * Asterisk call all span types with this (FXS specific) - * call. Silently ignore it. - */ - LINE_DBG(SIGNAL, xpd, pos, "BRI: Starting a call\n"); - return -ENOTTY; - default: - report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd); - return -ENOTTY; - } - return 0; -} - -static int BRI_card_close(xpd_t *xpd, lineno_t pos) -{ - struct zt_chan *chan = &xpd->span.chans[pos]; - - /* Clear D-Channel pending data */ - chan->bytes2receive = 0; - chan->eofrx = 0; - chan->bytes2transmit = 0; - chan->eoftx = 0; - return 0; -} - -/* - * Called only for 'span' keyword in /etc/zaptel.conf - */ -static int bri_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - xpd_t *xpd = span->pvt; - const char *framingstr = ""; - const char *codingstr = ""; - const char *crcstr = ""; - - /* framing first */ - if (lc->lineconfig & ZT_CONFIG_B8ZS) - framingstr = "B8ZS"; - else if (lc->lineconfig & ZT_CONFIG_AMI) - framingstr = "AMI"; - else if (lc->lineconfig & ZT_CONFIG_HDB3) - framingstr = "HDB3"; - /* then coding */ - if (lc->lineconfig & ZT_CONFIG_ESF) - codingstr = "ESF"; - else if (lc->lineconfig & ZT_CONFIG_D4) - codingstr = "D4"; - else if (lc->lineconfig & ZT_CONFIG_CCS) - codingstr = "CCS"; - /* E1's can enable CRC checking */ - if (lc->lineconfig & ZT_CONFIG_CRC4) - crcstr = "CRC4"; - XPD_DBG(GENERAL, xpd, "[%s]: span=%d (%s) lbo=%d lineconfig=%s/%s/%s (0x%X) sync=%d\n", - IS_NT(xpd)?"NT":"TE", - lc->span, - lc->name, - lc->lbo, - framingstr, codingstr, crcstr, - lc->lineconfig, - lc->sync); - /* - * FIXME: validate - */ - span->lineconfig = lc->lineconfig; - return 0; -} - -/* - * Set signalling type (if appropriate) - * Called from zaptel with spinlock held on chan. Must not call back - * zaptel functions. - */ -static int bri_chanconfig(struct zt_chan *chan, int sigtype) -{ - DBG(GENERAL, "channel %d (%s) -> %s\n", chan->channo, chan->name, sig2str(sigtype)); - // FIXME: sanity checks: - // - should be supported (within the sigcap) - // - should not replace fxs <->fxo ??? (covered by previous?) - return 0; -} - -/* - * Called only for 'span' keyword in /etc/zaptel.conf - */ -static int bri_startup(struct zt_span *span) -{ - xpd_t *xpd = span->pvt; - struct BRI_priv_data *priv; - struct zt_chan *dchan; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(!TRANSPORT_RUNNING(xpd->xbus)) { - XPD_DBG(GENERAL, xpd, "Startup called by zaptel. No Hardware. Ignored\n"); - return -ENODEV; - } - XPD_DBG(GENERAL, xpd, "STARTUP\n"); - // Turn on all channels - CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 1); - if(SPAN_REGISTERED(xpd)) { - dchan = &span->chans[2]; - span->flags |= ZT_FLAG_RUNNING; - /* - * Zaptel (wrongly) assume that D-Channel need HDLC decoding - * and during zaptel registration override our flags. - * - * Don't Get Mad, Get Even: Now we override zaptel :-) - */ - dchan->flags |= ZT_FLAG_BRIDCHAN; - dchan->flags &= ~ZT_FLAG_HDLC; - } - return 0; -} - -/* - * Called only for 'span' keyword in /etc/zaptel.conf - */ -static int bri_shutdown(struct zt_span *span) -{ - xpd_t *xpd = span->pvt; - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(!TRANSPORT_RUNNING(xpd->xbus)) { - XPD_DBG(GENERAL, xpd, "Shutdown called by zaptel. No Hardware. Ignored\n"); - return -ENODEV; - } - XPD_DBG(GENERAL, xpd, "SHUTDOWN\n"); - // Turn off all channels - CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 0); - return 0; -} - -static void BRI_card_pcm_fromspan(xbus_t *xbus, xpd_t *xpd, xpp_line_t wanted_lines, xpacket_t *pack) -{ - byte *pcm; - struct zt_chan *chans; - unsigned long flags; - int i; - int subunit; - xpp_line_t pcm_mask = 0; - - - BUG_ON(!xbus); - BUG_ON(!xpd); - BUG_ON(!pack); - pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm); - for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) { - xpd_t *tmp_xpd; - - tmp_xpd = xpd_byaddr(xbus, xpd->addr.unit, subunit); - if(!tmp_xpd || !tmp_xpd->card_present) - continue; - spin_lock_irqsave(&tmp_xpd->lock, flags); - chans = tmp_xpd->span.chans; - for_each_line(tmp_xpd, i) { - if(IS_SET(wanted_lines, i)) { - if(SPAN_REGISTERED(tmp_xpd)) { -#ifdef DEBUG_PCMTX - int channo = tmp_xpd->span.chans[i].channo; - - if(pcmtx >= 0 && pcmtx_chan == channo) - memset((u_char *)pcm, pcmtx, ZT_CHUNKSIZE); - else -#endif - memcpy((u_char *)pcm, chans[i].writechunk, ZT_CHUNKSIZE); - } else - memset((u_char *)pcm, 0x7F, ZT_CHUNKSIZE); - pcm += ZT_CHUNKSIZE; - } - } - pcm_mask |= PCM_SHIFT(wanted_lines, subunit); - XPD_COUNTER(tmp_xpd, PCM_WRITE)++; - spin_unlock_irqrestore(&tmp_xpd->lock, flags); - } - RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines) = pcm_mask; -} - -static void BRI_card_pcm_tospan(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack) -{ - byte *pcm; - xpp_line_t pcm_mask; - unsigned long flags; - int subunit; - int i; - - /* - * Subunit 0 handle all other subunits - */ - if(xpd->addr.subunit != 0) - return; - if(!SPAN_REGISTERED(xpd)) - return; - pcm = RPACKET_FIELD(pack, GLOBAL, PCM_READ, pcm); - pcm_mask = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines); - for(subunit = 0; subunit < MAX_SUBUNIT; subunit++, pcm_mask >>= SUBUNIT_PCM_SHIFT) { - xpd_t *tmp_xpd; - - if(!pcm_mask) - break; /* optimize */ - tmp_xpd = xpd_byaddr(xbus, xpd->addr.unit, subunit); - if(!tmp_xpd || !tmp_xpd->card_present || !SPAN_REGISTERED(tmp_xpd)) - continue; - spin_lock_irqsave(&tmp_xpd->lock, flags); - for (i = 0; i < 2; i++) { - xpp_line_t tmp_mask = pcm_mask & (BIT(0) | BIT(1)); - volatile u_char *r; - - if(IS_SET(tmp_mask, i)) { - r = tmp_xpd->span.chans[i].readchunk; - // memset((u_char *)r, 0x5A, ZT_CHUNKSIZE); // DEBUG - memcpy((u_char *)r, pcm, ZT_CHUNKSIZE); - pcm += ZT_CHUNKSIZE; - } - } - XPD_COUNTER(tmp_xpd, PCM_READ)++; - spin_unlock_irqrestore(&tmp_xpd->lock, flags); - } -} - -/*---------------- BRI: HOST COMMANDS -------------------------------------*/ - -static /* 0x0F */ HOSTCMD(BRI, XPD_STATE, bool on) -{ - struct BRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF"); - if(on) { - if(!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags)) { - if(xpd->direction == TO_PSTN) - te_activation(xpd, 1); - else - nt_activation(xpd, 1); - } - } else if(IS_NT(xpd)) - nt_activation(xpd, 0); - return 0; -} - -static /* 0x33 */ HOSTCMD(BRI, SET_LED, enum bri_led_names which_led, enum led_state to_led_state) -{ - int ret = 0; - xframe_t *xframe; - xpacket_t *pack; - struct bri_leds *bri_leds; - struct BRI_priv_data *priv; - - BUG_ON(!xbus); - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(LEDS, xpd, "%s -> %d\n", - (which_led)?"RED":"GREEN", - to_led_state); - XFRAME_NEW_CMD(xframe, pack, xbus, BRI, SET_LED, xpd->xbus_idx); - bri_leds = &RPACKET_FIELD(pack, BRI, SET_LED, bri_leds); - bri_leds->state = to_led_state; - bri_leds->led_sel = which_led; - XPACKET_LEN(pack) = RPACKET_SIZE(BRI, SET_LED); - ret = send_cmd_frame(xbus, xframe); - priv->ledstate[which_led] = to_led_state; - return ret; -} - -static int write_state_register(xpd_t *xpd, byte value) -{ - int ret; - - XPD_DBG(REGS, xpd, "value = 0x%02X\n", value); - ret = xpp_register_request(xpd->xbus, xpd, - BRI_PORT(xpd), /* portno */ - 1, /* writing */ - A_SU_WR_STA, /* regnum */ - 0, /* do_subreg */ - 0, /* subreg */ - value, /* data_low */ - 0, /* do_datah */ - 0, /* data_high */ - 0 /* should_reply */ - ); - return ret; -} - -/*---------------- BRI: Astribank Reply Handlers --------------------------*/ -static void su_new_state(xpd_t *xpd, byte reg_x30) -{ - xbus_t *xbus; - struct BRI_priv_data *priv; - su_rd_sta_t new_state; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - xbus = xpd->xbus; - if(!priv->initialized) { - XPD_ERR(xpd, "%s called on uninitialized AB\n", __FUNCTION__); - return; - } - new_state.reg = reg_x30; - if(new_state.bits.v_su_t2_exp) { - XPD_NOTICE(xpd, "T2 Expired\n"); - } - priv->reg30_ticks = 0; - priv->reg30_good = 1; - if (priv->state_register.bits.v_su_sta == new_state.bits.v_su_sta) - return; /* same same */ - XPD_DBG(SIGNAL, xpd, "%02X ---> %02X (info0=%d) (%s%i)\n", - priv->state_register.reg, - reg_x30, - new_state.bits.v_su_info0, - IS_NT(xpd)?"G":"F", - new_state.bits.v_su_sta); - if(!IS_NT(xpd)) { - switch (new_state.bits.v_su_sta) { - case ST_TE_DEACTIVATED: /* F3 */ - XPD_DBG(SIGNAL, xpd, "State ST_TE_DEACTIVATED (F3)\n"); - clear_bit(HFC_L1_ACTIVATED, &priv->l1_flags); - layer1_state(xpd, 0); - break; - case ST_TE_SIGWAIT: /* F4 */ - XPD_DBG(SIGNAL, xpd, "State ST_TE_SIGWAIT (F4)\n"); - layer1_state(xpd, 0); - break; - case ST_TE_IDENT: /* F5 */ - XPD_DBG(SIGNAL, xpd, "State ST_TE_IDENT (F5)\n"); - layer1_state(xpd, 0); - break; - case ST_TE_SYNCED: /* F6 */ - XPD_DBG(SIGNAL, xpd, "State ST_TE_SYNCED (F6)\n"); - layer1_state(xpd, 0); - break; - case ST_TE_ACTIVATED: /* F7 */ - XPD_DBG(SIGNAL, xpd, "State ST_TE_ACTIVATED (F7)\n"); - set_bri_timer(xpd, "T3", &priv->t3, HFC_TIMER_OFF); - clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags); - set_bit(HFC_L1_ACTIVATED, &priv->l1_flags); - layer1_state(xpd, 1); - update_xpd_status(xpd, ZT_ALARM_NONE); - break; - case ST_TE_LOST_FRAMING: /* F8 */ - XPD_DBG(SIGNAL, xpd, "State ST_TE_LOST_FRAMING (F8)\n"); - layer1_state(xpd, 0); - break; - default: - XPD_NOTICE(xpd, "Bad TE state: %d\n", new_state.bits.v_su_sta); - break; - } - - } else { - switch (new_state.bits.v_su_sta) { - case ST_NT_DEACTIVATED: /* G1 */ - XPD_DBG(SIGNAL, xpd, "State ST_NT_DEACTIVATED (G1)\n"); - clear_bit(HFC_L1_ACTIVATED, &priv->l1_flags); - set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_OFF); - layer1_state(xpd, 0); - break; - case ST_NT_ACTIVATING: /* G2 */ - XPD_DBG(SIGNAL, xpd, "State ST_NT_ACTIVATING (G2)\n"); - layer1_state(xpd, 0); - if(!test_bit(HFC_L1_ACTIVATED, &priv->l1_flags)) - nt_activation(xpd, 1); - break; - case ST_NT_ACTIVATED: /* G3 */ - XPD_DBG(SIGNAL, xpd, "State ST_NT_ACTIVATED (G3)\n"); - clear_bit(HFC_L1_ACTIVATING, &priv->l1_flags); - set_bit(HFC_L1_ACTIVATED, &priv->l1_flags); - set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_OFF); - layer1_state(xpd, 1); - update_xpd_status(xpd, ZT_ALARM_NONE); - break; - case ST_NT_DEACTIVTING: /* G4 */ - XPD_DBG(SIGNAL, xpd, "State ST_NT_DEACTIVTING (G4)\n"); - set_bri_timer(xpd, "T1", &priv->t1, HFC_TIMER_OFF); - layer1_state(xpd, 0); - break; - default: - XPD_NOTICE(xpd, "Bad NT state: %d\n", new_state.bits.v_su_sta); - break; - } - } - priv->state_register.reg = new_state.reg; -} - -static int BRI_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info) -{ - unsigned long flags; - struct BRI_priv_data *priv; - struct xpd_addr addr; - xpd_t *orig_xpd; - int ret; - - /* Map UNIT + PORTNUM to XPD */ - orig_xpd = xpd; - addr.unit = orig_xpd->addr.unit; - addr.subunit = info->portnum; - xpd = xpd_byaddr(xbus, addr.unit, addr.subunit); - if(!xpd) { - static int rate_limit; - - if((rate_limit++ % 1003) < 5) - notify_bad_xpd(__FUNCTION__, xbus, addr , orig_xpd->xpdname); - return -EPROTO; - } - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - if(REG_FIELD(info, do_subreg)) { - XPD_DBG(REGS, xpd, "RI %02X %02X %02X\n", - REG_FIELD(info, regnum), REG_FIELD(info, subreg), REG_FIELD(info, data_low)); - } else { - if (REG_FIELD(info, regnum) != A_SU_RD_STA) - XPD_DBG(REGS, xpd, "RD %02X %02X\n", - REG_FIELD(info, regnum), REG_FIELD(info, data_low)); - else - XPD_DBG(REGS, xpd, "Got SU_RD_STA=%02X\n", - REG_FIELD(info, data_low)); - } - if(info->is_multibyte) { - XPD_DBG(REGS, xpd, "Got Multibyte: %d bytes, eoframe: %d\n", - info->bytes, info->eoframe); - ret = rx_dchan(xpd, info); - if (ret < 0) { - priv->dchan_rx_drops++; - if(atomic_read(&xpd->open_counter) > 0) - XPD_NOTICE(xpd, "Multibyte Drop: errno=%d\n", ret); - } - goto end; - } - if(REG_FIELD(info, regnum) == A_SU_RD_STA) { - su_new_state(xpd, REG_FIELD(info, data_low)); - } - - /* Update /proc info only if reply relate to the last slic read request */ - if( - REG_FIELD(&xpd->requested_reply, regnum) == REG_FIELD(info, regnum) && - REG_FIELD(&xpd->requested_reply, do_subreg) == REG_FIELD(info, do_subreg) && - REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) { - xpd->last_reply = *info; - } - -end: - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; -} - -static xproto_table_t PROTO_TABLE(BRI) = { - .owner = THIS_MODULE, - .entries = { - /* Table Card Opcode */ - }, - .name = "BRI", /* protocol name */ - .ports_per_subunit = 1, - .type = XPD_TYPE_BRI, - .xops = { - .card_new = BRI_card_new, - .card_init = BRI_card_init, - .card_remove = BRI_card_remove, - .card_zaptel_preregistration = BRI_card_zaptel_preregistration, - .card_zaptel_postregistration = BRI_card_zaptel_postregistration, - .card_hooksig = BRI_card_hooksig, - .card_tick = BRI_card_tick, - .card_pcm_fromspan = BRI_card_pcm_fromspan, - .card_pcm_tospan = BRI_card_pcm_tospan, - .card_ioctl = BRI_card_ioctl, - .card_close = BRI_card_close, - .card_register_reply = BRI_card_register_reply, - - .XPD_STATE = XPROTO_CALLER(BRI, XPD_STATE), - }, - .packet_is_valid = bri_packet_is_valid, - .packet_dump = bri_packet_dump, -}; - -static bool bri_packet_is_valid(xpacket_t *pack) -{ - const xproto_entry_t *xe = NULL; - // DBG(GENERAL, "\n"); - xe = xproto_card_entry(&PROTO_TABLE(BRI), XPACKET_OP(pack)); - return xe != NULL; -} - -static void bri_packet_dump(const char *msg, xpacket_t *pack) -{ - DBG(GENERAL, "%s\n", msg); -} -/*------------------------- REGISTER Handling --------------------------*/ - -static int proc_bri_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - struct BRI_priv_data *priv; - - DBG(PROC, "\n"); - if(!xpd) - return -ENODEV; - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - len += sprintf(page + len, "%05d Layer 1: ", priv->poll_counter); - if(priv->reg30_good) { - len += sprintf(page + len, "%-5s ", (priv->layer1_up) ? "UP" : "DOWN"); - len += sprintf(page + len, "%c%d %-15s -- fr_sync=%d t2_exp=%d info0=%d g2_g3=%d\n", - IS_NT(xpd)?'G':'F', - priv->state_register.bits.v_su_sta, - xhfc_state_name(IS_NT(xpd), priv->state_register.bits.v_su_sta), - priv->state_register.bits.v_su_fr_sync, - priv->state_register.bits.v_su_t2_exp, - priv->state_register.bits.v_su_info0, - priv->state_register.bits.v_g2_g3); - } else - len += sprintf(page + len, "Unkown\n"); - if(IS_NT(xpd)) { - len += sprintf(page + len, "T1 Timer: %d\n", priv->t1); - } else { - len += sprintf(page + len, "T3 Timer: %d\n", priv->t3); - } - len += sprintf(page + len, "Tick Counter: %d\n", priv->tick_counter); - len += sprintf(page + len, "Last Poll Reply: %d ticks ago\n", priv->reg30_ticks); - len += sprintf(page + len, "reg30_good=%d\n", priv->reg30_good); - len += sprintf(page + len, "D-Channel: TX=[%5d] RX=[%5d] BAD=[%5d] ", - priv->dchan_tx_counter, priv->dchan_rx_counter, priv->dchan_rx_drops); - if(priv->dchan_alive) { - len += sprintf(page + len, "(alive %d K-ticks)\n", - priv->dchan_alive_ticks/1000); - } else { - len += sprintf(page + len, "(dead)\n"); - } - 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]); - len += sprintf(page + len, "LED: %-10s = %d\n", "RED", priv->ledstate[RED_LED]); - len += sprintf(page + len, "\nDCHAN:\n"); - len += sprintf(page + len, "\n"); - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -static int __init card_bri_startup(void) -{ - DBG(GENERAL, "\n"); - - INFO("revision %s\n", XPP_VERSION); - xproto_register(&PROTO_TABLE(BRI)); - return 0; -} - -static void __exit card_bri_cleanup(void) -{ - DBG(GENERAL, "\n"); - xproto_unregister(&PROTO_TABLE(BRI)); -} - -MODULE_DESCRIPTION("XPP BRI Card Driver"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(XPP_VERSION); -MODULE_ALIAS_XPD(XPD_TYPE_BRI); - -module_init(card_bri_startup); -module_exit(card_bri_cleanup); diff --git a/zaptel/kernel/xpp/card_bri.h b/zaptel/kernel/xpp/card_bri.h deleted file mode 100644 index a7b69de3..00000000 --- a/zaptel/kernel/xpp/card_bri.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef CARD_BRI_H -#define CARD_BRI_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpd.h" - -enum bri_opcodes { - XPROTO_NAME(BRI, SET_LED) = 0x33, -}; - -#endif /* CARD_BRI_H */ diff --git a/zaptel/kernel/xpp/card_fxo.c b/zaptel/kernel/xpp/card_fxo.c deleted file mode 100644 index 9cea0815..00000000 --- a/zaptel/kernel/xpp/card_fxo.c +++ /dev/null @@ -1,1354 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include "xpd.h" -#include "xproto.h" -#include "xpp_zap.h" -#include "card_fxo.h" -#include "zap_debug.h" -#include "xbus-core.h" - -static const char rcsid[] = "$Id: card_fxo.c 4529 2008-09-09 16:35:41Z tzafrir $"; - -static DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); -static DEF_PARM(uint, poll_battery_interval, 500, 0644, "Poll battery interval in milliseconds (0 - disable)"); -#ifdef WITH_METERING -static DEF_PARM(uint, poll_metering_interval, 500, 0644, "Poll metering interval in milliseconds (0 - disable)"); -#endif -static DEF_PARM(int, ring_debounce, 50, 0644, "Number of ticks to debounce a false RING indication"); -static DEF_PARM(int, caller_id_style, 0, 0444, "Caller-Id detection style: 0 - [BELL], 1 - [ETSI_FSK], 2 - [ETSI_DTMF]"); - -/* Backward compatibility plug */ -#ifndef ZT_GET_PARAMS_V1 -#define zt_alarm_channel(a,b) zt_qevent_lock(a,( (b)==ZT_ALARM_NONE )? \ - ZT_EVENT_NOALARM : ZT_EVENT_ALARM) -#endif - -enum cid_style { - CID_STYLE_BELL = 0, /* E.g: US (Bellcore) */ - CID_STYLE_ETSI_FSK = 1, /* E.g: UK (British Telecom) */ - CID_STYLE_ETSI_DTMF = 2, /* E.g: DK, Russia */ -}; - -/* Signaling is opposite (fxs signalling for fxo card) */ -#if 1 -#define FXO_DEFAULT_SIGCAP (ZT_SIG_FXSKS | ZT_SIG_FXSLS) -#else -#define FXO_DEFAULT_SIGCAP (ZT_SIG_SF) -#endif - -enum fxo_leds { - LED_GREEN, - LED_RED, -}; - -#define NUM_LEDS 2 -#define DELAY_UNTIL_DIALTONE 3000 - -/* - * Minimum duration for polarity reversal detection (in ticks) - * Should be longer than the time to detect a ring, so voltage - * fluctuation during ring won't trigger false detection. - */ -#define POLREV_THRESHOLD 200 -#define BAT_THRESHOLD 3 -#define BAT_DEBOUNCE 1000 /* compensate for battery voltage fluctuation (in ticks) */ -#define POWER_DENIAL_CURRENT 3 -#define POWER_DENIAL_TIME 80 /* ticks */ -#define POWER_DENIAL_SAFEZONE 100 /* ticks */ -#define POWER_DENIAL_DELAY 2500 /* ticks */ - -/* Shortcuts */ -#define DAA_WRITE 1 -#define DAA_READ 0 -#define DAA_DIRECT_REQUEST(xbus,xpd,port,writing,reg,dL) \ - xpp_register_request((xbus), (xpd), (port), (writing), (reg), 0, 0, (dL), 0, 0, 0) - -/*---------------- FXO Protocol Commands ----------------------------------*/ - -static /* 0x0F */ DECLARE_CMD(FXO, XPD_STATE, bool on); - -static bool fxo_packet_is_valid(xpacket_t *pack); -static void fxo_packet_dump(const char *msg, xpacket_t *pack); -static int proc_fxo_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); -#ifdef WITH_METERING -static int proc_xpd_metering_read(char *page, char **start, off_t off, int count, int *eof, void *data); -#endif -static void zap_report_battery(xpd_t *xpd, lineno_t chan); - -#define PROC_REGISTER_FNAME "slics" -#define PROC_FXO_INFO_FNAME "fxo_info" -#ifdef WITH_METERING -#define PROC_METERING_FNAME "metering_read" -#endif - -#define REG_DAA_CONTROL1 0x05 /* 5 - DAA Control 1 */ -#define REG_DAA_CONTROL1_OH BIT(0) /* Off-Hook. */ -#define REG_DAA_CONTROL1_ONHM BIT(3) /* On-Hook Line Monitor */ - -#define DAA_REG_METERING 0x11 /* 17 */ -#define DAA_REG_CURRENT 0x1C /* 28 */ -#define DAA_REG_VBAT 0x1D /* 29 */ - -enum battery_state { - BATTERY_UNKNOWN = 0, - BATTERY_ON = 1, - BATTERY_OFF = -1 -}; - -enum polarity_state { - POL_UNKNOWN = 0, - POL_POSITIVE = 1, - POL_NEGATIVE = -1 -}; - -enum power_state { - POWER_UNKNOWN = 0, - POWER_ON = 1, - POWER_OFF = -1 -}; - -struct FXO_priv_data { -#ifdef WITH_METERING - struct proc_dir_entry *meteringfile; -#endif - struct proc_dir_entry *fxo_info; - uint poll_counter; - signed char battery_voltage[CHANNELS_PERXPD]; - signed char battery_current[CHANNELS_PERXPD]; - enum battery_state battery[CHANNELS_PERXPD]; - ushort nobattery_debounce[CHANNELS_PERXPD]; - enum polarity_state polarity[CHANNELS_PERXPD]; - ushort polarity_debounce[CHANNELS_PERXPD]; - enum power_state power[CHANNELS_PERXPD]; - xpp_line_t maybe_power_denial; - ushort power_denial_debounce[CHANNELS_PERXPD]; - ushort power_denial_delay[CHANNELS_PERXPD]; - ushort power_denial_minimum[CHANNELS_PERXPD]; - ushort power_denial_safezone[CHANNELS_PERXPD]; - xpp_line_t cidfound; /* 0 - OFF, 1 - ON */ - unsigned int cidtimer[CHANNELS_PERXPD]; - xpp_line_t ledstate[NUM_LEDS]; /* 0 - OFF, 1 - ON */ - xpp_line_t ledcontrol[NUM_LEDS]; /* 0 - OFF, 1 - ON */ - int led_counter[NUM_LEDS][CHANNELS_PERXPD]; - atomic_t ring_debounce[CHANNELS_PERXPD]; -#ifdef WITH_METERING - uint metering_count[CHANNELS_PERXPD]; - xpp_line_t metering_tone_state; -#endif -}; - -/* - * LED counter values: - * n>1 : BLINK every n'th tick - */ -#define LED_COUNTER(priv,pos,color) ((priv)->led_counter[color][pos]) -#define IS_BLINKING(priv,pos,color) (LED_COUNTER(priv,pos,color) > 0) -#define MARK_BLINK(priv,pos,color,t) ((priv)->led_counter[color][pos] = (t)) -#define MARK_OFF(priv,pos,color) do { BIT_CLR((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0) -#define MARK_ON(priv,pos,color) do { BIT_SET((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0) - -#define LED_BLINK_RING (1000/8) /* in ticks */ - -/*---------------- FXO: Static functions ----------------------------------*/ - -static void reset_battery_readings(xpd_t *xpd, lineno_t pos) -{ - struct FXO_priv_data *priv = xpd->priv; - - priv->nobattery_debounce[pos] = 0; - priv->power_denial_debounce[pos] = 0; - priv->power_denial_delay[pos] = 0; - BIT_CLR(priv->maybe_power_denial, pos); -} - -static const int led_register_mask[] = { BIT(7), BIT(6), BIT(5) }; - -/* - * LED control is done via DAA register 0x20 - */ -static int do_led(xpd_t *xpd, lineno_t chan, byte which, bool on) -{ - int ret = 0; - struct FXO_priv_data *priv; - xbus_t *xbus; - byte value; - - BUG_ON(!xpd); - xbus = xpd->xbus; - priv = xpd->priv; - which = which % NUM_LEDS; - if(IS_SET(xpd->digital_outputs, chan) || IS_SET(xpd->digital_inputs, chan)) - goto out; - if(chan == PORT_BROADCAST) { - priv->ledstate[which] = (on) ? ~0 : 0; - } else { - if(on) { - BIT_SET(priv->ledstate[which], chan); - } else { - BIT_CLR(priv->ledstate[which], chan); - } - } - value = 0; - value |= ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[which]); - value |= (on) ? BIT(0) : 0; - value |= (on) ? BIT(1) : 0; - LINE_DBG(LEDS, xpd, chan, "LED: which=%d -- %s\n", which, (on) ? "on" : "off"); - ret = DAA_DIRECT_REQUEST(xbus, xpd, chan, DAA_WRITE, 0x20, value); -out: - return ret; -} - -static void handle_fxo_leds(xpd_t *xpd) -{ - int i; - unsigned long flags; - const enum fxo_leds colors[] = { LED_GREEN, LED_RED }; - enum fxo_leds color; - unsigned int timer_count; - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - timer_count = xpd->timer_count; - for(color = 0; color < ARRAY_SIZE(colors); color++) { - for_each_line(xpd, i) { - if(IS_SET(xpd->digital_outputs, i) || IS_SET(xpd->digital_inputs, i)) - continue; - if((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) { // Blinking - int mod_value = LED_COUNTER(priv, i, color); - - if(!mod_value) - mod_value = DEFAULT_LED_PERIOD; /* safety value */ - // led state is toggled - if((timer_count % mod_value) == 0) { - LINE_DBG(LEDS, xpd, i, "ledstate=%s\n", (IS_SET(priv->ledstate[color], i))?"ON":"OFF"); - if(!IS_SET(priv->ledstate[color], i)) { - do_led(xpd, i, color, 1); - } else { - do_led(xpd, i, color, 0); - } - } - } else if(IS_SET(priv->ledcontrol[color], i) && !IS_SET(priv->ledstate[color], i)) { - do_led(xpd, i, color, 1); - } else if(!IS_SET(priv->ledcontrol[color], i) && IS_SET(priv->ledstate[color], i)) { - do_led(xpd, i, color, 0); - } - } - } - spin_unlock_irqrestore(&xpd->lock, flags); -} - -static void update_zap_ring(xpd_t *xpd, int pos, bool on) -{ - zt_rxsig_t rxsig; - - BUG_ON(!xpd); - if(on) { - if(caller_id_style == CID_STYLE_BELL) { - LINE_DBG(SIGNAL, xpd, pos, "Caller-ID PCM: off\n"); - BIT_CLR(xpd->cid_on, pos); - } - rxsig = ZT_RXSIG_RING; - } else { - if(caller_id_style == CID_STYLE_BELL) { - LINE_DBG(SIGNAL, xpd, pos, "Caller-ID PCM: on\n"); - BIT_SET(xpd->cid_on, pos); - } - rxsig = ZT_RXSIG_OFFHOOK; - } - pcm_recompute(xpd, 0); - /* - * We should not spinlock before calling zt_hooksig() as - * it may call back into our xpp_hooksig() and cause - * a nested spinlock scenario - */ - if(SPAN_REGISTERED(xpd)) - zt_hooksig(&xpd->chans[pos], rxsig); -} - -static void mark_ring(xpd_t *xpd, lineno_t pos, bool on, bool update_zap) -{ - struct FXO_priv_data *priv; - - priv = xpd->priv; - BUG_ON(!priv); - atomic_set(&priv->ring_debounce[pos], 0); /* Stop debouncing */ - /* - * We don't want to check battery during ringing - * due to voltage fluctuations. - */ - reset_battery_readings(xpd, pos); - if(on && !xpd->ringing[pos]) { - LINE_DBG(SIGNAL, xpd, pos, "START\n"); - xpd->ringing[pos] = 1; - priv->cidtimer[pos] = xpd->timer_count; - MARK_BLINK(priv, pos, LED_GREEN, LED_BLINK_RING); - if(update_zap) - update_zap_ring(xpd, pos, on); - } else if(!on && xpd->ringing[pos]) { - LINE_DBG(SIGNAL, xpd, pos, "STOP\n"); - xpd->ringing[pos] = 0; - priv->cidtimer[pos] = xpd->timer_count; - if(IS_BLINKING(priv, pos, LED_GREEN)) - MARK_BLINK(priv, pos, LED_GREEN, 0); - if(update_zap) - update_zap_ring(xpd, pos, on); - } -} - -static int do_sethook(xpd_t *xpd, int pos, bool to_offhook) -{ - unsigned long flags; - xbus_t *xbus; - struct FXO_priv_data *priv; - int ret = 0; - byte value; - - BUG_ON(!xpd); - BUG_ON(xpd->direction == TO_PHONE); // We can SETHOOK state only on PSTN - xbus = xpd->xbus; - priv = xpd->priv; - BUG_ON(!priv); - if(priv->battery[pos] != BATTERY_ON && to_offhook) { - LINE_NOTICE(xpd, pos, "Cannot take offhook while battery is off!\n"); - return -EINVAL; - } - spin_lock_irqsave(&xpd->lock, flags); - mark_ring(xpd, pos, 0, 0); // No more rings - value = REG_DAA_CONTROL1_ONHM; /* Bit 3 is for CID */ - if(to_offhook) - value |= REG_DAA_CONTROL1_OH; - LINE_DBG(SIGNAL, xpd, pos, "SETHOOK: value=0x%02X %s\n", value, (to_offhook)?"OFFHOOK":"ONHOOK"); - if(to_offhook) - MARK_ON(priv, pos, LED_GREEN); - else - MARK_OFF(priv, pos, LED_GREEN); - ret = DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, REG_DAA_CONTROL1, value); - if(to_offhook) { - BIT_SET(xpd->offhook, pos); - } else { - BIT_CLR(xpd->offhook, pos); - } - if(caller_id_style != CID_STYLE_ETSI_DTMF) { - LINE_DBG(SIGNAL, xpd, pos, "Caller-ID PCM: off\n"); - BIT_CLR(xpd->cid_on, pos); - } -#ifdef WITH_METERING - priv->metering_count[pos] = 0; - priv->metering_tone_state = 0L; - DAA_DIRECT_REQUEST(xbus, xpd, pos, DAA_WRITE, DAA_REG_METERING, 0x2D); -#endif - reset_battery_readings(xpd, pos); /* unstable during hook changes */ - priv->power_denial_safezone[pos] = (to_offhook) ? POWER_DENIAL_SAFEZONE : 0; - if(!to_offhook) - priv->power[pos] = POWER_UNKNOWN; - priv->cidtimer[pos] = xpd->timer_count; - spin_unlock_irqrestore(&xpd->lock, flags); - return ret; -} - -/*---------------- FXO: Methods -------------------------------------------*/ - -static void fxo_proc_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(PROC, xpd, "\n"); -#ifdef CONFIG_PROC_FS -#ifdef WITH_METERING - if(priv->meteringfile) { - XPD_DBG(PROC, xpd, "Removing xpd metering tone file\n"); - priv->meteringfile->data = NULL; - remove_proc_entry(PROC_METERING_FNAME, xpd->proc_xpd_dir); - priv->meteringfile = NULL; - } -#endif - if(priv->fxo_info) { - XPD_DBG(PROC, xpd, "Removing xpd FXO_INFO file\n"); - remove_proc_entry(PROC_FXO_INFO_FNAME, xpd->proc_xpd_dir); - priv->fxo_info = NULL; - } -#endif -} - -static int fxo_proc_create(xbus_t *xbus, xpd_t *xpd) -{ - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; -#ifdef CONFIG_PROC_FS - XPD_DBG(PROC, xpd, "Creating FXO_INFO file\n"); - priv->fxo_info = create_proc_read_entry(PROC_FXO_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_fxo_info_read, xpd); - if(!priv->fxo_info) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXO_INFO_FNAME); - goto err; - } - priv->fxo_info->owner = THIS_MODULE; -#ifdef WITH_METERING - XPD_DBG(PROC, xpd, "Creating Metering tone file\n"); - priv->meteringfile = create_proc_read_entry(PROC_METERING_FNAME, 0444, xpd->proc_xpd_dir, - proc_xpd_metering_read, xpd); - if(!priv->meteringfile) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME); - goto err; - } - priv->meteringfile->owner = THIS_MODULE; -#endif -#endif - return 0; -err: - return -EINVAL; -} - -static xpd_t *FXO_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, byte subtype, int subunits, bool to_phone) -{ - xpd_t *xpd = NULL; - int channels; - - if(to_phone) { - XBUS_NOTICE(xbus, - "XPD=%d%d: try to instanciate FXO with reverse direction\n", - unit, subunit); - return NULL; - } - if(subtype == 2) - channels = min(2, CHANNELS_PERXPD); - else - channels = min(8, CHANNELS_PERXPD); - xpd = xpd_alloc(sizeof(struct FXO_priv_data), proto_table, channels); - if(!xpd) - return NULL; - xpd->direction = TO_PSTN; - xpd->type_name = "FXO"; - if(xpd_common_init(xbus, xpd, unit, subunit, subtype, subunits) < 0) - goto err; - if(fxo_proc_create(xbus, xpd) < 0) - goto err; - return xpd; -err: - xpd_free(xpd); - return NULL; -} - -static int FXO_card_init(xbus_t *xbus, xpd_t *xpd) -{ - struct FXO_priv_data *priv; - int i; - - BUG_ON(!xpd); - priv = xpd->priv; - // Hanghup all lines - for_each_line(xpd, i) { - do_sethook(xpd, i, 0); - priv->polarity[i] = POL_UNKNOWN; /* will be updated on next battery sample */ - priv->battery[i] = BATTERY_UNKNOWN; /* will be updated on next battery sample */ - priv->power[i] = POWER_UNKNOWN; /* will be updated on next battery sample */ - if(caller_id_style == CID_STYLE_ETSI_DTMF) - BIT_SET(xpd->cid_on, i); - } - XPD_DBG(GENERAL, xpd, "done\n"); - for_each_line(xpd, i) { - do_led(xpd, i, LED_GREEN, 0); - } - for_each_line(xpd, i) { - do_led(xpd, i, LED_GREEN, 1); - msleep(50); - } - for_each_line(xpd, i) { - do_led(xpd, i, LED_GREEN, 0); - msleep(50); - } - pcm_recompute(xpd, 0); - return 0; -} - -static int FXO_card_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(GENERAL, xpd, "\n"); - fxo_proc_remove(xbus, xpd); - return 0; -} - -static int FXO_card_zaptel_preregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct FXO_priv_data *priv; - int i; - unsigned int timer_count; - - BUG_ON(!xpd); - xbus = xpd->xbus; - BUG_ON(!xbus); - priv = xpd->priv; - BUG_ON(!priv); - timer_count = xpd->timer_count; - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF"); -#ifdef ZT_SPANSTAT_V2 - xpd->span.spantype = "FXO"; -#endif - for_each_line(xpd, i) { - struct zt_chan *cur_chan = &xpd->chans[i]; - - XPD_DBG(GENERAL, xpd, "setting FXO channel %d\n", i); - snprintf(cur_chan->name, MAX_CHANNAME, "XPP_FXO/%02d/%1d%1d/%d", - xbus->num, xpd->addr.unit, xpd->addr.subunit, i); - cur_chan->chanpos = i + 1; - cur_chan->pvt = xpd; - cur_chan->sigcap = FXO_DEFAULT_SIGCAP; - } - for_each_line(xpd, i) { - MARK_ON(priv, i, LED_GREEN); - msleep(4); - MARK_ON(priv, i, LED_RED); - } - for_each_line(xpd, i) { - priv->cidtimer[i] = timer_count; - } - return 0; -} - -static int FXO_card_zaptel_postregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct FXO_priv_data *priv; - int i; - - BUG_ON(!xpd); - xbus = xpd->xbus; - BUG_ON(!xbus); - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF"); - for_each_line(xpd, i) { - zap_report_battery(xpd, i); - MARK_OFF(priv, i, LED_GREEN); - msleep(2); - MARK_OFF(priv, i, LED_RED); - msleep(2); - } - return 0; -} - -static int FXO_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig) -{ - struct FXO_priv_data *priv; - int ret = 0; - - priv = xpd->priv; - BUG_ON(!priv); - LINE_DBG(SIGNAL, xpd, pos, "%s\n", txsig2str(txsig)); - BUG_ON(xpd->direction != TO_PSTN); - /* XXX Enable hooksig for FXO XXX */ - switch(txsig) { - case ZT_TXSIG_START: - break; - case ZT_TXSIG_OFFHOOK: - ret = do_sethook(xpd, pos, 1); - break; - case ZT_TXSIG_ONHOOK: - ret = do_sethook(xpd, pos, 0); - break; - default: - XPD_NOTICE(xpd, "Can't set tx state to %s (%d)\n", - txsig2str(txsig), txsig); - return -EINVAL; - } - pcm_recompute(xpd, 0); - return ret; -} - -static void zap_report_battery(xpd_t *xpd, lineno_t chan) -{ - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - if(SPAN_REGISTERED(xpd)) { - switch(priv->battery[chan]) { - case BATTERY_UNKNOWN: - /* no-op */ - break; - case BATTERY_OFF: - LINE_DBG(SIGNAL, xpd, chan, "Send ZT_ALARM_RED\n"); - zt_alarm_channel(&xpd->chans[chan], ZT_ALARM_RED); - break; - case BATTERY_ON: - LINE_DBG(SIGNAL, xpd, chan, "Send ZT_ALARM_NONE\n"); - zt_alarm_channel(&xpd->chans[chan], ZT_ALARM_NONE); - break; - } - } -} - -static int FXO_card_open(xpd_t *xpd, lineno_t chan) -{ - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - return 0; -} - -static void poll_battery(xbus_t *xbus, xpd_t *xpd) -{ - int i; - - for_each_line(xpd, i) { - DAA_DIRECT_REQUEST(xbus, xpd, i, DAA_READ, DAA_REG_VBAT, 0); - } -} - -#ifdef WITH_METERING -static void poll_metering(xbus_t *xbus, xpd_t *xpd) -{ - int i; - - for_each_line(xpd, i) { - if (IS_SET(xpd->offhook, i)) - DAA_DIRECT_REQUEST(xbus, xpd, i, DAA_READ, DAA_REG_METERING, 0); - } -} -#endif - -static void handle_fxo_ring(xpd_t *xpd) -{ - struct FXO_priv_data *priv; - int i; - - priv = xpd->priv; - for_each_line(xpd, i) { - if(atomic_read(&priv->ring_debounce[i]) > 0) { - /* Maybe start ring */ - if(atomic_dec_and_test(&priv->ring_debounce[i])) - mark_ring(xpd, i, 1, 1); - } else if (atomic_read(&priv->ring_debounce[i]) < 0) { - /* Maybe stop ring */ - if(atomic_inc_and_test(&priv->ring_debounce[i])) - mark_ring(xpd, i, 0, 1); - } - } -} - -static void handle_fxo_power_denial(xpd_t *xpd) -{ - struct FXO_priv_data *priv; - int i; - - priv = xpd->priv; - for_each_line(xpd, i) { - if(priv->power_denial_minimum[i] > 0) { - priv->power_denial_minimum[i]--; - if(priv->power_denial_minimum[i] <= 0) { - /* - * But maybe the FXS started to ring (and the firmware haven't - * detected it yet). This would cause false power denials. - * So we just flag it and schedule more ticks to wait. - */ - LINE_DBG(SIGNAL, xpd, i, "Possible Power Denial Hangup\n"); - priv->power_denial_debounce[i] = 0; - BIT_SET(priv->maybe_power_denial, i); - } - } - if(priv->power_denial_safezone[i] > 0) { - if(--priv->power_denial_safezone[i]) { - /* - * Poll current, previous answers are meaningless - */ - DAA_DIRECT_REQUEST(xpd->xbus, xpd, i, DAA_READ, DAA_REG_CURRENT, 0); - } - } - if(IS_SET(priv->maybe_power_denial, i) && !xpd->ringing[i] && IS_SET(xpd->offhook, i)) { - /* - * Ring detection by the firmware takes some time. - * Therefore we delay our decision until we are - * sure that no ring has started during this time. - */ - priv->power_denial_delay[i]++; - if (priv->power_denial_delay[i] >= POWER_DENIAL_DELAY) { - LINE_DBG(SIGNAL, xpd, i, "Power Denial Hangup\n"); - priv->power_denial_delay[i] = 0; - BIT_CLR(priv->maybe_power_denial, i); - do_sethook(xpd, i, 0); - update_line_status(xpd, i, 0); - pcm_recompute(xpd, 0); - } - } else { - priv->power_denial_delay[i] = 0; - BIT_CLR(priv->maybe_power_denial, i); - } - } -} - -/* - * For caller-id CID_STYLE_ETSI_DTMF: - * - No indication is passed before the CID - * - We try to detect it and send "fake" polarity reversal. - * - The zapata.conf should have cidstart=polarity - * - Based on an idea in http://bugs.digium.com/view.php?id=9096 - */ -static void check_etsi_dtmf(xpd_t *xpd) -{ - struct FXO_priv_data *priv; - int portno; - unsigned int timer_count; - - if(!SPAN_REGISTERED(xpd)) - return; - priv = xpd->priv; - BUG_ON(!priv); - timer_count = xpd->timer_count; - for_each_line(xpd, portno) { - /* Skip offhook and ringing ports */ - if(IS_SET(xpd->offhook, portno) || xpd->ringing[portno]) - continue; - if(IS_SET(priv->cidfound, portno)) { - if(timer_count > priv->cidtimer[portno] + 4000) { - /* reset flags if it's been a while */ - priv->cidtimer[portno] = timer_count; - BIT_CLR(priv->cidfound, portno); - LINE_DBG(SIGNAL, xpd, portno, "Reset CID flag\n"); - } - continue; - } - if(timer_count > priv->cidtimer[portno] + 400) { - struct zt_chan *chan = &xpd->span.chans[portno]; - int sample; - int i; - - for(i = 0; i < ZT_CHUNKSIZE; i++) { - sample = ZT_XLAW(chan->readchunk[i], chan); - if(sample > 16000 || sample < -16000) { - priv->cidtimer[portno] = timer_count; - BIT_SET(priv->cidfound, portno); - LINE_DBG(SIGNAL, xpd, portno, "Found DTMF CLIP (%d)\n", i); - zt_qevent_lock(chan, ZT_EVENT_POLARITY); - break; - } - } - } - } -} - -static int FXO_card_tick(xbus_t *xbus, xpd_t *xpd) -{ - struct FXO_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(poll_battery_interval != 0 && (priv->poll_counter % poll_battery_interval) == 0) - poll_battery(xbus, xpd); -#ifdef WITH_METERING - if(poll_metering_interval != 0 && (priv->poll_counter % poll_metering_interval) == 0) - poll_metering(xbus, xpd); -#endif - handle_fxo_leds(xpd); - handle_fxo_ring(xpd); - handle_fxo_power_denial(xpd); - if(caller_id_style == CID_STYLE_ETSI_DTMF && likely(xpd->card_present)) - check_etsi_dtmf(xpd); - priv->poll_counter++; - return 0; -} - -/* FIXME: based on data from from wctdm.h */ -#include -/* - * The first register is the ACIM, the other are coefficient registers. - * We define the array size explicitly to track possible inconsistencies - * if the struct is modified. - */ -static const char echotune_regs[sizeof(struct wctdm_echo_coefs)] = {30, 45, 46, 47, 48, 49, 50, 51, 52}; - -static int FXO_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg) -{ - int i,ret; - unsigned char echotune_data[ARRAY_SIZE(echotune_regs)]; - - BUG_ON(!xpd); - if(!TRANSPORT_RUNNING(xpd->xbus)) - return -ENODEV; - switch (cmd) { - case WCTDM_SET_ECHOTUNE: - XPD_DBG(GENERAL, xpd, "-- Setting echo registers: \n"); - /* first off: check if this span is fxs. If not: -EINVALID */ - if (copy_from_user(&echotune_data, (void __user *)arg, sizeof(echotune_data))) - return -EFAULT; - - for (i = 0; i < ARRAY_SIZE(echotune_regs); i++) { - XPD_DBG(REGS, xpd, "Reg=0x%02X, data=0x%02X\n", echotune_regs[i], echotune_data[i]); - ret = DAA_DIRECT_REQUEST(xpd->xbus, xpd, pos, DAA_WRITE, echotune_regs[i], echotune_data[i]); - if (ret < 0) { - LINE_NOTICE(xpd, pos, "Couldn't write %0x02X to register %0x02X\n", - echotune_data[i], echotune_regs[i]); - return ret; - } - msleep(1); - } - - XPD_DBG(GENERAL, xpd, "-- Set echo registers successfully\n"); - break; - case ZT_TONEDETECT: - /* - * Asterisk call all span types with this (FXS specific) - * call. Silently ignore it. - */ - LINE_DBG(GENERAL, xpd, pos, - "ZT_TONEDETECT (FXO: NOTIMPLEMENTED)\n"); - return -ENOTTY; - default: - report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd); - return -ENOTTY; - } - return 0; -} - -/*---------------- FXO: HOST COMMANDS -------------------------------------*/ - -static /* 0x0F */ HOSTCMD(FXO, XPD_STATE, bool on) -{ - int ret = 0; - struct FXO_priv_data *priv; - - BUG_ON(!xbus); - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(GENERAL, xpd, "%s\n", (on) ? "on" : "off"); - return ret; -} - -/*---------------- FXO: Astribank Reply Handlers --------------------------*/ - -HANDLER_DEF(FXO, SIG_CHANGED) -{ - xpp_line_t sig_status = RPACKET_FIELD(pack, FXO, SIG_CHANGED, sig_status); - xpp_line_t sig_toggles = RPACKET_FIELD(pack, FXO, SIG_CHANGED, sig_toggles); - unsigned long flags; - int i; - struct FXO_priv_data *priv; - - if(!xpd) { - notify_bad_xpd(__FUNCTION__, xbus, XPACKET_ADDR(pack), cmd->name); - return -EPROTO; - } - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(SIGNAL, xpd, "(PSTN) sig_toggles=0x%04X sig_status=0x%04X\n", sig_toggles, sig_status); - spin_lock_irqsave(&xpd->lock, flags); - for_each_line(xpd, i) { - int debounce; - - if(IS_SET(sig_toggles, i)) { - if(priv->battery[i] == BATTERY_OFF) { - /* - * With poll_battery_interval==0 we cannot have BATTERY_OFF - * so we won't get here - */ - LINE_NOTICE(xpd, i, "SIG_CHANGED while battery is off. Ignored.\n"); - continue; - } - /* First report false ring alarms */ - debounce = atomic_read(&priv->ring_debounce[i]); - if(debounce) - LINE_NOTICE(xpd, i, "debounced false ring (only %d ticks)\n", debounce); - /* - * Now set a new ring alarm. - * It will be checked in handle_fxo_ring() - */ - debounce = (IS_SET(sig_status, i)) ? ring_debounce : -ring_debounce; - atomic_set(&priv->ring_debounce[i], debounce); - } - } - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; -} - -static void update_battery_voltage(xpd_t *xpd, byte data_low, xportno_t portno) -{ - struct FXO_priv_data *priv; - enum polarity_state pol; - int msec; - signed char volts = (signed char)data_low; - - priv = xpd->priv; - BUG_ON(!priv); - priv->battery_voltage[portno] = volts; - if(xpd->ringing[portno]) - goto ignore_reading; /* ring voltage create false alarms */ - if(abs(volts) < BAT_THRESHOLD) { - /* - * Check for battery voltage fluctuations - */ - if(priv->battery[portno] != BATTERY_OFF) { - int milliseconds; - - milliseconds = priv->nobattery_debounce[portno]++ * - poll_battery_interval; - if(milliseconds > BAT_DEBOUNCE) { - LINE_DBG(SIGNAL, xpd, portno, "BATTERY OFF voltage=%d\n", volts); - priv->battery[portno] = BATTERY_OFF; - if(SPAN_REGISTERED(xpd)) - zap_report_battery(xpd, portno); - priv->polarity[portno] = POL_UNKNOWN; /* What's the polarity ? */ - priv->power[portno] = POWER_UNKNOWN; /* What's the current ? */ - /* - * Stop further processing for now - */ - goto ignore_reading; - } - - } - } else { - priv->nobattery_debounce[portno] = 0; - if(priv->battery[portno] != BATTERY_ON) { - LINE_DBG(SIGNAL, xpd, portno, "BATTERY ON voltage=%d\n", volts); - priv->battery[portno] = BATTERY_ON; - if(SPAN_REGISTERED(xpd)) - zap_report_battery(xpd, portno); - } - } -#if 0 - /* - * Mark FXO ports without battery! - */ - if(priv->battery[portno] != BATTERY_ON) - MARK_ON(priv, portno, LED_RED); - else - MARK_OFF(priv, portno, LED_RED); -#endif - if(priv->battery[portno] != BATTERY_ON) { - priv->polarity[portno] = POL_UNKNOWN; /* What's the polarity ? */ - return; - } - /* - * Handle reverse polarity - */ - if(volts == 0) - pol = POL_UNKNOWN; - else if(volts < 0) - pol = POL_NEGATIVE; - else - pol = POL_POSITIVE; - if(priv->polarity[portno] == pol) { - /* - * Same polarity, reset debounce counter - */ - priv->polarity_debounce[portno] = 0; - return; - } - /* - * Track polarity reversals and debounce spikes. - * Only reversals with long duration count. - */ - msec = priv->polarity_debounce[portno]++ * poll_battery_interval; - if (msec >= POLREV_THRESHOLD) { - priv->polarity_debounce[portno] = 0; - if(pol != POL_UNKNOWN) { - char *polname = NULL; - - if(pol == POL_POSITIVE) - polname = "Positive"; - else if(pol == POL_NEGATIVE) - polname = "Negative"; - else - BUG(); - LINE_DBG(SIGNAL, xpd, portno, - "Polarity changed to %s\n", polname); - /* - * Inform zaptel/Asterisk: - * 1. Maybe used for hangup detection during offhook - * 2. In some countries used to report caller-id during onhook - * but before first ring. - */ - if(caller_id_style == CID_STYLE_ETSI_FSK) { - LINE_DBG(SIGNAL, xpd, portno, "Caller-ID PCM: on\n"); - BIT_SET(xpd->cid_on, portno); /* will be cleared on ring/offhook */ - } - if(SPAN_REGISTERED(xpd)) { - LINE_DBG(SIGNAL, xpd, portno, - "Send ZT_EVENT_POLARITY: %s\n", polname); - zt_qevent_lock(&xpd->chans[portno], ZT_EVENT_POLARITY); - } - } - priv->polarity[portno] = pol; - } - return; -ignore_reading: - /* - * Reset debounce counters to prevent false alarms - */ - reset_battery_readings(xpd, portno); /* unstable during hook changes */ -} - -static void update_battery_current(xpd_t *xpd, byte data_low, xportno_t portno) -{ - struct FXO_priv_data *priv; - - priv = xpd->priv; - BUG_ON(!priv); - priv->battery_current[portno] = data_low; - /* - * During ringing, current is not stable. - * During onhook there should not be current anyway. - */ - if(xpd->ringing[portno] || !IS_SET(xpd->offhook, portno)) - goto ignore_it; - /* - * Power denial with no battery voltage is meaningless - */ - if(priv->battery[portno] != BATTERY_ON) - goto ignore_it; - /* Safe zone after offhook */ - if(priv->power_denial_safezone[portno] > 0) - goto ignore_it; - if(data_low < POWER_DENIAL_CURRENT) { - if(priv->power[portno] == POWER_ON) { - LINE_DBG(SIGNAL, xpd, portno, "power: ON -> OFF\n"); - priv->power[portno] = POWER_OFF; - priv->power_denial_minimum[portno] = POWER_DENIAL_TIME; - } - } else { - LINE_DBG(SIGNAL, xpd, portno, "power: ON\n"); - priv->power[portno] = POWER_ON; - priv->power_denial_minimum[portno] = 0; - update_line_status(xpd, portno, 1); - } - return; -ignore_it: - BIT_CLR(priv->maybe_power_denial, portno); - priv->power_denial_debounce[portno] = 0; -} - -#ifdef WITH_METERING -#define BTD_BIT BIT(0) - -static void update_metering_state(xpd_t *xpd, byte data_low, lineno_t portno) -{ - struct FXO_priv_data *priv; - bool metering_tone = data_low & BTD_BIT; - bool old_metering_tone; - - priv = xpd->priv; - BUG_ON(!priv); - old_metering_tone = IS_SET(priv->metering_tone_state, portno); - LINE_DBG(SIGNAL, xpd, portno, "METERING: %s [dL=0x%X] (%d)\n", - (metering_tone) ? "ON" : "OFF", - data_low, priv->metering_count[portno]); - if(metering_tone && !old_metering_tone) { - /* Rising edge */ - priv->metering_count[portno]++; - BIT_SET(priv->metering_tone_state, portno); - } else if(!metering_tone && old_metering_tone) - BIT_CLR(priv->metering_tone_state, portno); - if(metering_tone) { - /* Clear the BTD bit */ - data_low &= ~BTD_BIT; - DAA_DIRECT_REQUEST(xpd->xbus, xpd, portno, DAA_WRITE, DAA_REG_METERING, data_low); - } -} -#endif - -static int FXO_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info) -{ - struct FXO_priv_data *priv; - lineno_t portno; - - priv = xpd->priv; - BUG_ON(!priv); - portno = info->portnum; - switch(REG_FIELD(info, regnum)) { - case DAA_REG_VBAT: - update_battery_voltage(xpd, REG_FIELD(info, data_low), portno); - break; - case DAA_REG_CURRENT: - update_battery_current(xpd, REG_FIELD(info, data_low), portno); - break; -#ifdef WITH_METERING - case DAA_REG_METERING: - update_metering_state(xpd, REG_FIELD(info, data_low), portno); - break; -#endif - } - LINE_DBG(REGS, xpd, portno, "%c reg_num=0x%X, dataL=0x%X dataH=0x%X\n", - ((info->bytes == 3)?'I':'D'), - REG_FIELD(info, regnum), - REG_FIELD(info, data_low), - REG_FIELD(info, data_high)); - /* Update /proc info only if reply relate to the last slic read request */ - if( - REG_FIELD(&xpd->requested_reply, regnum) == REG_FIELD(info, regnum) && - REG_FIELD(&xpd->requested_reply, do_subreg) == REG_FIELD(info, do_subreg) && - REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) { - xpd->last_reply = *info; - } - return 0; -} - - -static xproto_table_t PROTO_TABLE(FXO) = { - .owner = THIS_MODULE, - .entries = { - /* Prototable Card Opcode */ - XENTRY( FXO, FXO, SIG_CHANGED ), - }, - .name = "FXO", /* protocol name */ - .ports_per_subunit = 8, - .type = XPD_TYPE_FXO, - .xops = { - .card_new = FXO_card_new, - .card_init = FXO_card_init, - .card_remove = FXO_card_remove, - .card_zaptel_preregistration = FXO_card_zaptel_preregistration, - .card_zaptel_postregistration = FXO_card_zaptel_postregistration, - .card_hooksig = FXO_card_hooksig, - .card_tick = FXO_card_tick, - .card_pcm_fromspan = generic_card_pcm_fromspan, - .card_pcm_tospan = generic_card_pcm_tospan, - .card_ioctl = FXO_card_ioctl, - .card_open = FXO_card_open, - .card_register_reply = FXO_card_register_reply, - - .XPD_STATE = XPROTO_CALLER(FXO, XPD_STATE), - }, - .packet_is_valid = fxo_packet_is_valid, - .packet_dump = fxo_packet_dump, -}; - -static bool fxo_packet_is_valid(xpacket_t *pack) -{ - const xproto_entry_t *xe; - - //DBG(GENERAL, "\n"); - xe = xproto_card_entry(&PROTO_TABLE(FXO), XPACKET_OP(pack)); - return xe != NULL; -} - -static void fxo_packet_dump(const char *msg, xpacket_t *pack) -{ - DBG(GENERAL, "%s\n", msg); -} - -/*------------------------- DAA Handling --------------------------*/ - -static int proc_fxo_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - struct FXO_priv_data *priv; - int i; - - if(!xpd) - return -ENODEV; - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - len += sprintf(page + len, "\t%-17s: ", "Channel"); - for_each_line(xpd, i) { - if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i)) - len += sprintf(page + len, "%4d ", i % 10); - } - len += sprintf(page + len, "\nLeds:"); - len += sprintf(page + len, "\n\t%-17s: ", "state"); - for_each_line(xpd, i) { - if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i)) - len += sprintf(page + len, " %d%d ", - IS_SET(priv->ledstate[LED_GREEN], i), - IS_SET(priv->ledstate[LED_RED], i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "blinking"); - for_each_line(xpd, i) { - if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i)) - len += sprintf(page + len, " %d%d ", - IS_BLINKING(priv,i,LED_GREEN), - IS_BLINKING(priv,i,LED_RED)); - } - len += sprintf(page + len, "\nBattery-Data:"); - len += sprintf(page + len, "\n\t%-17s: ", "voltage"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->battery_voltage[i]); - } - len += sprintf(page + len, "\n\t%-17s: ", "current"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->battery_current[i]); - } - len += sprintf(page + len, "\nBattery:"); - len += sprintf(page + len, "\n\t%-17s: ", "on"); - for_each_line(xpd, i) { - char *bat; - - if(priv->battery[i] == BATTERY_ON) - bat = "+"; - else if(priv->battery[i] == BATTERY_OFF) - bat = "-"; - else - bat = "."; - len += sprintf(page + len, "%4s ", bat); - } - len += sprintf(page + len, "\n\t%-17s: ", "debounce"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->nobattery_debounce[i]); - } - len += sprintf(page + len, "\nPolarity-Reverse:"); - len += sprintf(page + len, "\n\t%-17s: ", "polarity"); - for_each_line(xpd, i) { - char *polname; - - if(priv->polarity[i] == POL_POSITIVE) - polname = "+"; - else if(priv->polarity[i] == POL_NEGATIVE) - polname = "-"; - else - polname = "."; - len += sprintf(page + len, "%4s ", polname); - } - len += sprintf(page + len, "\n\t%-17s: ", "debounce"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->polarity_debounce[i]); - } - len += sprintf(page + len, "\nPower-Denial:"); - len += sprintf(page + len, "\n\t%-17s: ", "power"); - for_each_line(xpd, i) { - char *curr; - - if(priv->power[i] == POWER_ON) - curr = "+"; - else if(priv->power[i] == POWER_OFF) - curr = "-"; - else - curr = "."; - len += sprintf(page + len, "%4s ", curr); - } - len += sprintf(page + len, "\n\t%-17s: ", "maybe"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", IS_SET(priv->maybe_power_denial, i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "debounce"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->power_denial_debounce[i]); - } - len += sprintf(page + len, "\n\t%-17s: ", "safezone"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->power_denial_safezone[i]); - } - len += sprintf(page + len, "\n\t%-17s: ", "delay"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->power_denial_delay[i]); - } -#ifdef WITH_METERING - len += sprintf(page + len, "\nMetering:"); - len += sprintf(page + len, "\n\t%-17s: ", "count"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%4d ", priv->metering_count[i]); - } -#endif - len += sprintf(page + len, "\n"); - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -#ifdef WITH_METERING -static int proc_xpd_metering_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - struct FXO_priv_data *priv; - int i; - - if(!xpd) - return -ENODEV; - priv = xpd->priv; - BUG_ON(!priv); - spin_lock_irqsave(&xpd->lock, flags); - len += sprintf(page + len, "# Chan\tMeter (since last read)\n"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d\t%d\n", - i, priv->metering_count[i]); - } - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - /* Zero meters */ - for_each_line(xpd, i) - priv->metering_count[i] = 0; - return len; -} -#endif - -static int __init card_fxo_startup(void) -{ - if(ring_debounce <= 0) { - ERR("ring_debounce=%d. Must be positive number of ticks\n", ring_debounce); - return -EINVAL; - } - INFO("revision %s\n", XPP_VERSION); -#ifdef WITH_METERING - INFO("FEATURE: WITH METERING Detection\n"); -#else - INFO("FEATURE: NO METERING Detection\n"); -#endif - xproto_register(&PROTO_TABLE(FXO)); - return 0; -} - -static void __exit card_fxo_cleanup(void) -{ - xproto_unregister(&PROTO_TABLE(FXO)); -} - -MODULE_DESCRIPTION("XPP FXO Card Driver"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(XPP_VERSION); -MODULE_ALIAS_XPD(XPD_TYPE_FXO); - -module_init(card_fxo_startup); -module_exit(card_fxo_cleanup); diff --git a/zaptel/kernel/xpp/card_fxo.h b/zaptel/kernel/xpp/card_fxo.h deleted file mode 100644 index 9f314417..00000000 --- a/zaptel/kernel/xpp/card_fxo.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef CARD_FXO_H -#define CARD_FXO_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpd.h" - -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 */ -}; - - -DEF_RPACKET_DATA(FXO, SIG_CHANGED, - xpp_line_t sig_status; /* channels: lsb=1, msb=8 */ - xpp_line_t sig_toggles; /* channels: lsb=1, msb=8 */ - ); - -#endif /* CARD_FXO_H */ diff --git a/zaptel/kernel/xpp/card_fxs.c b/zaptel/kernel/xpp/card_fxs.c deleted file mode 100644 index 07ecc529..00000000 --- a/zaptel/kernel/xpp/card_fxs.c +++ /dev/null @@ -1,1506 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include "xpd.h" -#include "xproto.h" -#include "xpp_zap.h" -#include "card_fxo.h" -#include "zap_debug.h" -#include "xbus-core.h" - -static const char rcsid[] = "$Id: card_fxs.c 4461 2008-08-07 10:12:36Z tzafrir $"; - -static DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); /* must be before zap_debug.h */ -static DEF_PARM_BOOL(reversepolarity, 0, 0644, "Reverse Line Polarity"); -static DEF_PARM_BOOL(vmwineon, 0, 0644, "Indicate voicemail to a neon lamp"); -static DEF_PARM_BOOL(dtmf_detection, 1, 0644, "Do DTMF detection in hardware"); -#ifdef POLL_DIGITAL_INPUTS -static DEF_PARM(uint, poll_digital_inputs, 1000, 0644, "Poll Digital Inputs"); -#endif - -#ifdef ZT_VMWI -static DEF_PARM_BOOL(vmwi_ioctl, 0, 0644, "Asterisk support VMWI notification via ioctl"); -#else -#define vmwi_ioctl 0 /* not supported */ -#endif - -/* Signaling is opposite (fxo signalling for fxs card) */ -#if 1 -#define FXS_DEFAULT_SIGCAP (ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS) -#else -#define FXS_DEFAULT_SIGCAP (ZT_SIG_SF | ZT_SIG_EM) -#endif - -#define LINES_DIGI_OUT 2 -#define LINES_DIGI_INP 4 - -enum fxs_leds { - LED_GREEN, - LED_RED, - OUTPUT_RELAY, -}; - -#define NUM_LEDS 2 - -/* Shortcuts */ -#define SLIC_WRITE 1 -#define SLIC_READ 0 -#define SLIC_DIRECT_REQUEST(xbus,xpd,port,writing,reg,dL) \ - xpp_register_request((xbus), (xpd), (port), (writing), (reg), 0, 0, (dL), 0, 0, 0) -#define SLIC_INDIRECT_REQUEST(xbus,xpd,port,writing,reg,dL,dH) \ - xpp_register_request((xbus), (xpd), (port), (writing), 0x1E, 1, (reg), (dL), 1, (dH), 0) - -#define VALID_PORT(port) (((port) >= 0 && (port) <= 7) || (port) == PORT_BROADCAST) - -#define REG_DIGITAL_IOCTRL 0x06 /* LED and RELAY control */ - -/* Values of SLIC linefeed control register (0x40) */ -enum fxs_state { - FXS_LINE_OPEN = 0x00, /* Open */ - FXS_LINE_ACTIVE = 0x01, /* Forward active */ - FXS_LINE_OHTRANS = 0x02, /* Forward on-hook transmission */ - FXS_LINE_TIPOPEN = 0x03, /* TIP open */ - FXS_LINE_RING = 0x04, /* Ringing */ - FXS_LINE_REV_ACTIVE = 0x05, /* Reverse active */ - FXS_LINE_REV_OHTRANS = 0x06, /* Reverse on-hook transmission */ - FXS_LINE_RING_OPEN = 0x07 /* RING open */ -}; - -#define FXS_LINE_POL_ACTIVE ((reversepolarity) ? FXS_LINE_REV_ACTIVE : FXS_LINE_ACTIVE) -#define FXS_LINE_POL_OHTRANS ((reversepolarity) ? FXS_LINE_REV_OHTRANS : FXS_LINE_OHTRANS) - -/* - * DTMF detection - */ -#define REG_DTMF_DECODE 0x18 /* 24 - DTMF Decode Status */ -#define REG_BATTERY 0x42 /* 66 - Battery Feed Control */ -#define REG_BATTERY_BATSL BIT(1) /* Battery Feed Select */ - -#define REG_LOOPCLOSURE 0x44 /* 68 - Loop Closure/Ring Trip Detect Status */ -#define REG_LOOPCLOSURE_LCR BIT(0) /* Loop Closure Detect Indicator. */ - -/*---------------- FXS Protocol Commands ----------------------------------*/ - -static /* 0x0F */ DECLARE_CMD(FXS, XPD_STATE, bool on); - -static bool fxs_packet_is_valid(xpacket_t *pack); -static void fxs_packet_dump(const char *msg, xpacket_t *pack); -static int proc_fxs_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); -#ifdef WITH_METERING -static int proc_xpd_metering_write(struct file *file, const char __user *buffer, unsigned long count, void *data); -#endif -static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos); - -#define PROC_REGISTER_FNAME "slics" -#define PROC_FXS_INFO_FNAME "fxs_info" -#ifdef WITH_METERING -#define PROC_METERING_FNAME "metering_gen" -#endif - -struct FXS_priv_data { -#ifdef WITH_METERING - struct proc_dir_entry *meteringfile; -#endif - struct proc_dir_entry *fxs_info; - xpp_line_t ledstate[NUM_LEDS]; /* 0 - OFF, 1 - ON */ - xpp_line_t ledcontrol[NUM_LEDS]; /* 0 - OFF, 1 - ON */ - xpp_line_t search_fsk_pattern; - xpp_line_t found_fsk_pattern; - xpp_line_t update_offhook_state; - xpp_line_t want_dtmf_events; /* what zaptel want */ - xpp_line_t want_dtmf_mute; /* what zaptel want */ - xpp_line_t prev_key_down; /* DTMF down sets the bit */ - struct timeval prev_key_time[CHANNELS_PERXPD]; - int led_counter[NUM_LEDS][CHANNELS_PERXPD]; - int ohttimer[CHANNELS_PERXPD]; -#define OHT_TIMER 6000 /* How long after RING to retain OHT */ - enum fxs_state idletxhookstate[CHANNELS_PERXPD]; /* IDLE changing hook state */ - enum fxs_state lasttxhook[CHANNELS_PERXPD]; -}; - -/* - * LED counter values: - * n>1 : BLINK every n'th tick - */ -#define LED_COUNTER(priv,pos,color) ((priv)->led_counter[color][pos]) -#define IS_BLINKING(priv,pos,color) (LED_COUNTER(priv,pos,color) > 0) -#define MARK_BLINK(priv,pos,color,t) ((priv)->led_counter[color][pos] = (t)) -#define MARK_OFF(priv,pos,color) do { BIT_CLR((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0) -#define MARK_ON(priv,pos,color) do { BIT_SET((priv)->ledcontrol[color],(pos)); MARK_BLINK((priv),(pos),(color),0); } while(0) - -#define LED_BLINK_RING (1000/8) /* in ticks */ - -/*---------------- FXS: Static functions ----------------------------------*/ -static int linefeed_control(xbus_t *xbus, xpd_t *xpd, lineno_t chan, enum fxs_state value) -{ - struct FXS_priv_data *priv; - - priv = xpd->priv; - LINE_DBG(SIGNAL, xpd, chan, "value=0x%02X\n", value); - priv->lasttxhook[chan] = value; - return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value); -} - -static int do_chan_power(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on) -{ - int value = (on) ? REG_BATTERY_BATSL : 0x00; - - BUG_ON(!xbus); - BUG_ON(!xpd); - LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on) ? "up" : "down"); - return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, REG_BATTERY, value); -} - -/* - * LED and RELAY control is done via SLIC register 0x06: - * 7 6 5 4 3 2 1 0 - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | M2 | M1 | M3 | C2 | O1 | O3 | C1 | C3 | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * - * Cn - Control bit (control one digital line) - * On - Output bit (program a digital line for output) - * Mn - Mask bit (only the matching output control bit is affected) - * - * C3 - OUTPUT RELAY (0 - OFF, 1 - ON) - * C1 - GREEN LED (0 - OFF, 1 - ON) - * O3 - Output RELAY (this line is output) - * O1 - Output GREEN (this line is output) - * C2 - RED LED (0 - OFF, 1 - ON) - * M3 - Mask RELAY. (1 - C3 effect the OUTPUT RELAY) - * M2 - Mask RED. (1 - C2 effect the RED LED) - * M1 - Mask GREEN. (1 - C1 effect the GREEN LED) - * - * The OUTPUT RELAY (actually a relay out) is connected to line 0 and 4 only. - */ - -// GREEN RED OUTPUT RELAY -static const int led_register_mask[] = { BIT(7), BIT(6), BIT(5) }; -static const int led_register_vals[] = { BIT(4), BIT(1), BIT(0) }; - -/* - * pos can be: - * - A line number - * - ALL_LINES. This is not valid anymore since 8-Jan-2007. - */ -static int do_led(xpd_t *xpd, lineno_t chan, byte which, bool on) -{ - int ret = 0; - struct FXS_priv_data *priv; - int value; - xbus_t *xbus; - - BUG_ON(!xpd); - BUG_ON(chan == ALL_LINES); - xbus = xpd->xbus; - priv = xpd->priv; - which = which % NUM_LEDS; - if(IS_SET(xpd->digital_outputs, chan) || IS_SET(xpd->digital_inputs, chan)) - goto out; - if(chan == PORT_BROADCAST) { - priv->ledstate[which] = (on) ? ~0 : 0; - } else { - if(on) { - BIT_SET(priv->ledstate[which], chan); - } else { - BIT_CLR(priv->ledstate[which], chan); - } - } - LINE_DBG(LEDS, xpd, chan, "LED: which=%d -- %s\n", which, (on) ? "on" : "off"); - value = BIT(2) | BIT(3); - value |= ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[which]); - if(on) - value |= led_register_vals[which]; - ret = SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, - REG_DIGITAL_IOCTRL, value); -out: - return ret; -} - -static void handle_fxs_leds(xpd_t *xpd) -{ - int i; - const enum fxs_leds colors[] = { LED_GREEN, LED_RED }; - enum fxs_leds color; - unsigned int timer_count; - struct FXS_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - timer_count = xpd->timer_count; - for(color = 0; color < ARRAY_SIZE(colors); color++) { - for_each_line(xpd, i) { - if(IS_SET(xpd->digital_outputs | xpd->digital_inputs, i)) - continue; - if((xpd->blink_mode & BIT(i)) || IS_BLINKING(priv, i, color)) { // Blinking - int mod_value = LED_COUNTER(priv, i, color); - - if(!mod_value) - mod_value = DEFAULT_LED_PERIOD; /* safety value */ - // led state is toggled - if((timer_count % mod_value) == 0) { - LINE_DBG(LEDS, xpd, i, "ledstate=%s\n", (IS_SET(priv->ledstate[color], i))?"ON":"OFF"); - if(!IS_SET(priv->ledstate[color], i)) { - do_led(xpd, i, color, 1); - } else { - do_led(xpd, i, color, 0); - } - } - } else if(IS_SET(priv->ledcontrol[color] & ~priv->ledstate[color], i)) { - do_led(xpd, i, color, 1); - } else if(IS_SET(~priv->ledcontrol[color] & priv->ledstate[color], i)) { - do_led(xpd, i, color, 0); - } - - } - } -} - -static void restore_leds(xpd_t *xpd) -{ - struct FXS_priv_data *priv; - int i; - - priv = xpd->priv; - for_each_line(xpd, i) { - if(IS_SET(xpd->offhook, i)) - MARK_ON(priv, i, LED_GREEN); - else - MARK_OFF(priv, i, LED_GREEN); - } -} - -#ifdef WITH_METERING -static int metering_gen(xpd_t *xpd, lineno_t chan, bool on) -{ - byte value = (on) ? 0x94 : 0x00; - - LINE_DBG(SIGNAL, xpd, chan, "METERING Generate: %s\n", (on)?"ON":"OFF"); - return SLIC_DIRECT_REQUEST(xpd->xbus, xpd, chan, SLIC_WRITE, 0x23, value); -} -#endif - -/*---------------- FXS: Methods -------------------------------------------*/ - -static void fxs_proc_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct FXS_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; -#ifdef CONFIG_PROC_FS -#ifdef WITH_METERING - if(priv->meteringfile) { - XPD_DBG(PROC, xpd, "Removing xpd metering tone file\n"); - priv->meteringfile->data = NULL; - remove_proc_entry(PROC_METERING_FNAME, xpd->proc_xpd_dir); - priv->meteringfile = NULL; - } -#endif - if(priv->fxs_info) { - XPD_DBG(PROC, xpd, "Removing xpd FXS_INFO file\n"); - remove_proc_entry(PROC_FXS_INFO_FNAME, xpd->proc_xpd_dir); - priv->fxs_info = NULL; - } -#endif -} - -static int fxs_proc_create(xbus_t *xbus, xpd_t *xpd) -{ - struct FXS_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - -#ifdef CONFIG_PROC_FS - XPD_DBG(PROC, xpd, "Creating FXS_INFO file\n"); - priv->fxs_info = create_proc_read_entry(PROC_FXS_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_fxs_info_read, xpd); - if(!priv->fxs_info) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXS_INFO_FNAME); - goto err; - } - priv->fxs_info->owner = THIS_MODULE; -#ifdef WITH_METERING - XPD_DBG(PROC, xpd, "Creating Metering tone file\n"); - priv->meteringfile = create_proc_entry(PROC_METERING_FNAME, 0200, xpd->proc_xpd_dir); - if(!priv->meteringfile) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME); - goto err; - } - priv->meteringfile->owner = THIS_MODULE; - priv->meteringfile->write_proc = proc_xpd_metering_write; - priv->meteringfile->read_proc = NULL; - priv->meteringfile->data = xpd; -#endif -#endif - return 0; -err: - return -EINVAL; -} - -static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, byte subtype, int subunits, bool to_phone) -{ - xpd_t *xpd = NULL; - int channels; - int regular_channels; - struct FXS_priv_data *priv; - int i; - - if(!to_phone) { - XBUS_NOTICE(xbus, - "XPD=%d%d: try to instanciate FXS with reverse direction\n", - unit, subunit); - return NULL; - } - if(subtype == 2) - regular_channels = min(6, CHANNELS_PERXPD); - else - regular_channels = min(8, CHANNELS_PERXPD); - channels = regular_channels; - if(unit == 0) - channels += 6; /* 2 DIGITAL OUTPUTS, 4 DIGITAL INPUTS */ - xpd = xpd_alloc(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"); - xpd->digital_outputs = BITMASK(LINES_DIGI_OUT) << regular_channels; - xpd->digital_inputs = BITMASK(LINES_DIGI_INP) << (regular_channels + LINES_DIGI_OUT); - } - xpd->direction = TO_PHONE; - xpd->type_name = "FXS"; - if(xpd_common_init(xbus, xpd, unit, subunit, subtype, subunits) < 0) - goto err; - if(fxs_proc_create(xbus, xpd) < 0) - goto err; - priv = xpd->priv; - for_each_line(xpd, i) { - priv->idletxhookstate[i] = FXS_LINE_POL_ACTIVE; - } - return xpd; -err: - xpd_free(xpd); - return NULL; -} - -static int FXS_card_init(xbus_t *xbus, xpd_t *xpd) -{ - struct FXS_priv_data *priv; - int ret = 0; - int i; - - BUG_ON(!xpd); - priv = xpd->priv; - /* - * Setup ring timers - */ - /* Software controled ringing (for CID) */ - ret = SLIC_DIRECT_REQUEST(xbus, xpd, PORT_BROADCAST, SLIC_WRITE, 0x22, 0x00); /* Ringing Oscilator Control */ - if(ret < 0) - goto err; - for_each_line(xpd, i) { - linefeed_control(xbus, xpd, i, FXS_LINE_POL_ACTIVE); - } - XPD_DBG(GENERAL, xpd, "done\n"); - for_each_line(xpd, i) { - do_led(xpd, i, LED_GREEN, 0); - do_led(xpd, i, LED_RED, 0); - } - for_each_line(xpd, i) { - do_led(xpd, i, LED_GREEN, 1); - msleep(50); - } - for_each_line(xpd, i) { - do_led(xpd, i, LED_GREEN, 0); - msleep(50); - } - restore_leds(xpd); - pcm_recompute(xpd, 0); - /* - * We should query our offhook state long enough time after we - * set the linefeed_control() - * So we do this after the LEDs - */ - for_each_line(xpd, i) { - if(IS_SET(xpd->digital_outputs | xpd->digital_inputs, i)) - continue; - SLIC_DIRECT_REQUEST(xbus, xpd, i, SLIC_READ, REG_LOOPCLOSURE, 0); - } - return 0; -err: - fxs_proc_remove(xbus, xpd); - XPD_ERR(xpd, "Failed initializing registers (%d)\n", ret); - return ret; -} - -static int FXS_card_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct FXS_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(GENERAL, xpd, "\n"); - fxs_proc_remove(xbus, xpd); - return 0; -} - -static int FXS_card_zaptel_preregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct FXS_priv_data *priv; - int i; - - BUG_ON(!xpd); - xbus = xpd->xbus; - BUG_ON(!xbus); - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); -#ifdef ZT_SPANSTAT_V2 - xpd->span.spantype = "FXS"; -#endif - for_each_line(xpd, i) { - struct zt_chan *cur_chan = &xpd->chans[i]; - - XPD_DBG(GENERAL, xpd, "setting FXS channel %d\n", i); - if(IS_SET(xpd->digital_outputs, i)) { - snprintf(cur_chan->name, MAX_CHANNAME, "XPP_OUT/%02d/%1d%1d/%d", - xbus->num, xpd->addr.unit, xpd->addr.subunit, i); - } else if(IS_SET(xpd->digital_inputs, i)) { - snprintf(cur_chan->name, MAX_CHANNAME, "XPP_IN/%02d/%1d%1d/%d", - xbus->num, xpd->addr.unit, xpd->addr.subunit, i); - } else { - snprintf(cur_chan->name, MAX_CHANNAME, "XPP_FXS/%02d/%1d%1d/%d", - xbus->num, xpd->addr.unit, xpd->addr.subunit, i); - } - cur_chan->chanpos = i + 1; - cur_chan->pvt = xpd; - cur_chan->sigcap = FXS_DEFAULT_SIGCAP; - } - for_each_line(xpd, i) { - MARK_ON(priv, i, LED_GREEN); - msleep(4); - MARK_ON(priv, i, LED_RED); - } - return 0; -} - -static int FXS_card_zaptel_postregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct FXS_priv_data *priv; - int i; - - BUG_ON(!xpd); - xbus = xpd->xbus; - BUG_ON(!xbus); - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); - for_each_line(xpd, i) { - MARK_OFF(priv, i, LED_GREEN); - msleep(2); - MARK_OFF(priv, i, LED_RED); - msleep(2); - } - restore_leds(xpd); - return 0; -} - -/* - * Called with XPD spinlocked - */ -static void __do_mute_dtmf(xpd_t *xpd, int pos, bool muteit) -{ - LINE_DBG(SIGNAL, xpd, pos, "%s\n", (muteit) ? "MUTE" : "UNMUTE"); - if(muteit) - BIT_SET(xpd->mute_dtmf, pos); - else - BIT_CLR(xpd->mute_dtmf, pos); -} - -static int set_vm_led_mode(xbus_t *xbus, xpd_t *xpd, int pos, int on) -{ - int ret = 0; - BUG_ON(!xbus); - BUG_ON(!xpd); - - LINE_DBG(SIGNAL, xpd, pos, "%s%s\n", (on)?"ON":"OFF", (vmwineon)?"":" (Ignored)"); - if (!vmwineon) - return 0; - if (on) { - /* A write to register 0x40 will now turn on/off the VM led */ - 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); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x22, 0x19); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x4A, 0x34); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x30, 0xE0); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x31, 0x01); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x32, 0xF0); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x33, 0x05); - ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x1D, 0x00, 0x46); - } else { - /* A write to register 0x40 will now turn on/off the ringer */ - ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x16, 0x00, 0x00); - ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x15, 0x60, 0x01); - ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x14, 0xF0, 0x7E); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x22, 0x00); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x4A, 0x34); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x30, 0x00); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x31, 0x00); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x32, 0x00); - ret += SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x33, 0x00); - ret += SLIC_INDIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x1D, 0x00, 0x36); - } - - return (ret ? -EPROTO : 0); -} - -static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos) -{ - struct FXS_priv_data *priv; - bool on; - - BUG_ON(!xpd); - if (!vmwineon || IS_SET(xpd->digital_outputs | xpd->digital_inputs, pos)) - return; - priv = xpd->priv; - on = IS_SET(xpd->msg_waiting, pos); - LINE_DBG(SIGNAL, xpd, pos, "%s\n", (on)?"ON":"OFF"); - set_vm_led_mode(xbus, xpd, pos, on); - do_chan_power(xbus, xpd, pos, on); - linefeed_control(xbus, xpd, pos, (on) ? FXS_LINE_RING : priv->idletxhookstate[pos]); -} - -static int relay_out(xpd_t *xpd, int pos, bool on) -{ - int value; - int which = pos; - int relay_channels[] = { 0, 4 }; - - BUG_ON(!xpd); - /* map logical position to output port number (0/1) */ - which -= (xpd->subtype == 2) ? 6 : 8; - LINE_DBG(SIGNAL, xpd, pos, "which=%d -- %s\n", which, (on) ? "on" : "off"); - which = which % ARRAY_SIZE(relay_channels); - value = BIT(2) | BIT(3); - value |= ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[OUTPUT_RELAY]); - if(on) - value |= led_register_vals[OUTPUT_RELAY]; - return SLIC_DIRECT_REQUEST(xpd->xbus, xpd, relay_channels[which], - SLIC_WRITE, REG_DIGITAL_IOCTRL, value); -} - -static int send_ring(xpd_t *xpd, lineno_t chan, bool on) -{ - int ret = 0; - xbus_t *xbus; - struct FXS_priv_data *priv; - enum fxs_state value = (on) ? FXS_LINE_RING : FXS_LINE_POL_ACTIVE; - - BUG_ON(!xpd); - xbus = xpd->xbus; - BUG_ON(!xbus); - LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on)?"on":"off"); - priv = xpd->priv; - set_vm_led_mode(xbus, xpd, chan, 0); - do_chan_power(xbus, xpd, chan, on); // Power up (for ring) - ret = linefeed_control(xbus, xpd, chan, value); - if(on) { - MARK_BLINK(priv, chan, LED_GREEN, LED_BLINK_RING); - } else { - if(IS_BLINKING(priv, chan, LED_GREEN)) - MARK_BLINK(priv, chan, LED_GREEN, 0); - } - return ret; -} - -static int FXS_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig) -{ - struct FXS_priv_data *priv; - int ret = 0; - struct zt_chan *chan = NULL; - enum fxs_state txhook; - unsigned long flags; - - LINE_DBG(SIGNAL, xpd, pos, "%s\n", txsig2str(txsig)); - priv = xpd->priv; - BUG_ON(xpd->direction != TO_PHONE); - if (IS_SET(xpd->digital_inputs, pos)) { - LINE_DBG(SIGNAL, xpd, pos, "Ignoring signal sent to digital input line\n"); - return 0; - } - if(SPAN_REGISTERED(xpd)) - chan = &xpd->span.chans[pos]; - switch(txsig) { - case ZT_TXSIG_ONHOOK: - spin_lock_irqsave(&xpd->lock, flags); - xpd->ringing[pos] = 0; - BIT_CLR(xpd->cid_on, pos); - BIT_CLR(priv->search_fsk_pattern, pos); - BIT_CLR(priv->want_dtmf_events, pos); - BIT_CLR(priv->want_dtmf_mute, pos); - __do_mute_dtmf(xpd, pos, 0); - __pcm_recompute(xpd, 0); /* already spinlocked */ - spin_unlock_irqrestore(&xpd->lock, flags); - if(IS_SET(xpd->digital_outputs, pos)) { - LINE_DBG(SIGNAL, xpd, pos, "%s -> digital output OFF\n", txsig2str(txsig)); - ret = relay_out(xpd, pos, 0); - return ret; - } - if (priv->lasttxhook[pos] == FXS_LINE_OPEN) { - /* - * Restore state after KEWL hangup. - */ - LINE_DBG(SIGNAL, xpd, pos, "KEWL STOP\n"); - linefeed_control(xbus, xpd, pos, FXS_LINE_POL_ACTIVE); - if(IS_SET(xpd->offhook, pos)) - MARK_ON(priv, pos, LED_GREEN); - } - ret = send_ring(xpd, pos, 0); // RING off - if (!IS_SET(xpd->offhook, pos)) - start_stop_vm_led(xbus, xpd, pos); - txhook = priv->lasttxhook[pos]; - if(chan) { - switch(chan->sig) { - case ZT_SIG_EM: - case ZT_SIG_FXOKS: - case ZT_SIG_FXOLS: - txhook = priv->idletxhookstate[pos]; - break; - case ZT_SIG_FXOGS: - txhook = FXS_LINE_TIPOPEN; - break; - } - } - ret = linefeed_control(xbus, xpd, pos, txhook); - break; - case ZT_TXSIG_OFFHOOK: - if(IS_SET(xpd->digital_outputs, pos)) { - LINE_NOTICE(xpd, pos, "%s -> Is digital output. Ignored\n", txsig2str(txsig)); - return -EINVAL; - } - txhook = priv->lasttxhook[pos]; - if(xpd->ringing[pos]) { - BIT_SET(xpd->cid_on, pos); - pcm_recompute(xpd, 0); - txhook = FXS_LINE_OHTRANS; - } - xpd->ringing[pos] = 0; - if(chan) { - switch(chan->sig) { - case ZT_SIG_EM: - txhook = FXS_LINE_POL_ACTIVE; - break; - default: - txhook = priv->idletxhookstate[pos]; - break; - } - } - ret = linefeed_control(xbus, xpd, pos, txhook); - break; - case ZT_TXSIG_START: - xpd->ringing[pos] = 1; - BIT_CLR(xpd->cid_on, pos); - BIT_CLR(priv->search_fsk_pattern, pos); - pcm_recompute(xpd, 0); - if(IS_SET(xpd->digital_outputs, pos)) { - LINE_DBG(SIGNAL, xpd, pos, "%s -> digital output ON\n", txsig2str(txsig)); - ret = relay_out(xpd, pos, 1); - return ret; - } - ret = send_ring(xpd, pos, 1); // RING on - break; - case ZT_TXSIG_KEWL: - if(IS_SET(xpd->digital_outputs, pos)) { - LINE_DBG(SIGNAL, xpd, pos, "%s -> Is digital output. Ignored\n", txsig2str(txsig)); - return -EINVAL; - } - linefeed_control(xbus, xpd, pos, FXS_LINE_OPEN); - MARK_OFF(priv, pos, LED_GREEN); - break; - default: - XPD_NOTICE(xpd, "%s: Can't set tx state to %s (%d)\n", - __FUNCTION__, txsig2str(txsig), txsig); - ret = -EINVAL; - } - return ret; -} - -/* - * Private ioctl() - * We don't need it now, since we detect vmwi via FSK patterns - */ -static int FXS_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg) -{ - struct FXS_priv_data *priv; - xbus_t *xbus; - int val; - unsigned long flags; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - xbus = xpd->xbus; - BUG_ON(!xbus); - if(!TRANSPORT_RUNNING(xbus)) - return -ENODEV; - if (pos < 0 || pos >= xpd->channels) { - XPD_NOTICE(xpd, "Bad channel number %d in %s(), cmd=%u\n", - pos, __FUNCTION__, cmd); - return -EINVAL; - } - - switch (cmd) { - case ZT_ONHOOKTRANSFER: - if (get_user(val, (int __user *)arg)) - return -EFAULT; - LINE_DBG(SIGNAL, xpd, pos, "ZT_ONHOOKTRANSFER (%d millis)\n", val); - if (IS_SET(xpd->digital_inputs | xpd->digital_outputs, pos)) - return 0; /* Nothing to do */ - BIT_CLR(xpd->cid_on, pos); - if(priv->lasttxhook[pos] == FXS_LINE_POL_ACTIVE) { - priv->ohttimer[pos] = OHT_TIMER; - priv->idletxhookstate[pos] = FXS_LINE_POL_OHTRANS; - BIT_SET(priv->search_fsk_pattern, pos); - pcm_recompute(xpd, priv->search_fsk_pattern); - } - if(!IS_SET(xpd->offhook, pos)) - start_stop_vm_led(xbus, xpd, pos); - return 0; - case ZT_TONEDETECT: - if (get_user(val, (int __user *)arg)) - return -EFAULT; - LINE_DBG(SIGNAL, xpd, pos, "ZT_TONEDETECT: %s %s (dtmf_detection=%s)\n", - (val & ZT_TONEDETECT_ON) ? "ON" : "OFF", - (val & ZT_TONEDETECT_MUTE) ? "MUTE" : "NO-MUTE", - (dtmf_detection ? "YES" : "NO")); - if(!dtmf_detection) { - spin_lock_irqsave(&xpd->lock, flags); - if(IS_SET(priv->want_dtmf_events, pos)) { - /* Detection mode changed: Disable DTMF interrupts */ - SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x17, 0); - } - BIT_CLR(priv->want_dtmf_events, pos); - BIT_CLR(priv->want_dtmf_mute, pos); - __do_mute_dtmf(xpd, pos, 0); - __pcm_recompute(xpd, 0); /* already spinlocked */ - spin_unlock_irqrestore(&xpd->lock, flags); - return -ENOTTY; - } - /* - * During natively bridged calls, Asterisk - * will request one of the sides to stop sending - * dtmf events. Check the requested state. - */ - spin_lock_irqsave(&xpd->lock, flags); - if(val & ZT_TONEDETECT_ON) { - if(!IS_SET(priv->want_dtmf_events, pos)) { - /* Detection mode changed: Enable DTMF interrupts */ - LINE_DBG(SIGNAL, xpd, pos, - "ZT_TONEDETECT: Enable Hardware DTMF\n"); - SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x17, 1); - } - BIT_SET(priv->want_dtmf_events, pos); - } else { - if(IS_SET(priv->want_dtmf_events, pos)) { - /* Detection mode changed: Disable DTMF interrupts */ - LINE_DBG(SIGNAL, xpd, pos, - "ZT_TONEDETECT: Disable Hardware DTMF\n"); - SLIC_DIRECT_REQUEST(xbus, xpd, pos, SLIC_WRITE, 0x17, 0); - } - BIT_CLR(priv->want_dtmf_events, pos); - } - if(val & ZT_TONEDETECT_MUTE) { - BIT_SET(priv->want_dtmf_mute, pos); - } else { - BIT_CLR(priv->want_dtmf_mute, pos); - __do_mute_dtmf(xpd, pos, 0); - __pcm_recompute(xpd, 0); - } - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; - case ZT_SETPOLARITY: - if (get_user(val, (int __user *)arg)) - return -EFAULT; - /* Can't change polarity while ringing or when open */ - if (priv->lasttxhook[pos] == FXS_LINE_RING || priv->lasttxhook[pos] == FXS_LINE_OPEN) { - LINE_ERR(xpd, pos, "ZT_SETPOLARITY: %s Cannot change when lasttxhook=0x%X\n", - (val)?"ON":"OFF", priv->lasttxhook[pos]); - return -EINVAL; - } - LINE_DBG(SIGNAL, xpd, pos, "ZT_SETPOLARITY: %s\n", (val)?"ON":"OFF"); - if ((val && !reversepolarity) || (!val && reversepolarity)) - priv->lasttxhook[pos] |= FXS_LINE_RING; - else - priv->lasttxhook[pos] &= ~FXS_LINE_RING; - linefeed_control(xbus, xpd, pos, priv->lasttxhook[pos]); - return 0; -#ifdef ZT_VMWI - case ZT_VMWI: /* message-waiting led control */ - if (get_user(val, (int __user *)arg)) - return -EFAULT; - if(!vmwi_ioctl) { - LINE_NOTICE(xpd, pos, "Got ZT_VMWI notification but vmwi_ioctl parameter is off. Ignoring.\n"); - return 0; - } - /* Digital inputs/outputs don't have VM leds */ - if (IS_SET(xpd->digital_inputs | xpd->digital_outputs, pos)) - return 0; - if (val) - BIT_SET(xpd->msg_waiting, pos); - else - BIT_CLR(xpd->msg_waiting, pos); - return 0; -#endif - default: - report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd); - } - return -ENOTTY; -} - -static int FXS_card_open(xpd_t *xpd, lineno_t chan) -{ - struct FXS_priv_data *priv; - bool is_offhook; - - BUG_ON(!xpd); - priv = xpd->priv; - is_offhook = IS_SET(xpd->offhook, chan); - if(is_offhook) - LINE_NOTICE(xpd, chan, "Already offhook during open. OK.\n"); - else - LINE_DBG(SIGNAL, xpd, chan, "is onhook\n"); - /* - * Delegate updating zaptel to FXS_card_tick(): - * The problem is that zt_hooksig() is spinlocking the channel and - * we are called by zaptel with the spinlock already held on the - * same channel. - */ - BIT_SET(priv->update_offhook_state, chan); - return 0; -} - -static int FXS_card_close(xpd_t *xpd, lineno_t chan) -{ - struct FXS_priv_data *priv; - - BUG_ON(!xpd); - LINE_DBG(GENERAL, xpd, chan, "\n"); - priv = xpd->priv; - priv->idletxhookstate[chan] = FXS_LINE_POL_ACTIVE; - return 0; -} - -#ifdef POLL_DIGITAL_INPUTS -/* - * INPUT polling is done via SLIC register 0x06 (same as LEDS): - * 7 6 5 4 3 2 1 0 - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * | I1 | I3 | | | I2 | I4 | | | - * +-----+-----+-----+-----+-----+-----+-----+-----+ - * - */ -static int input_channels[] = { 6, 7, 2, 3 }; // Slic numbers of input relays - -static void poll_inputs(xpd_t *xpd) -{ - int i; - - BUG_ON(xpd->xbus_idx != 0); // Only unit #0 has digital inputs - for(i = 0; i < ARRAY_SIZE(input_channels); i++) { - byte pos = input_channels[i]; - - SLIC_DIRECT_REQUEST(xpd->xbus, xpd, pos, SLIC_READ, 0x06, 0); - } -} -#endif - -static void handle_linefeed(xpd_t *xpd) -{ - struct FXS_priv_data *priv; - int i; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - for_each_line(xpd, i) { - if (priv->lasttxhook[i] == FXS_LINE_RING) { - /* RINGing, prepare for OHT */ - priv->ohttimer[i] = OHT_TIMER; - priv->idletxhookstate[i] = FXS_LINE_POL_OHTRANS; - } else { - if (priv->ohttimer[i]) { - priv->ohttimer[i]--; - if (!priv->ohttimer[i]) { - priv->idletxhookstate[i] = FXS_LINE_POL_ACTIVE; - BIT_CLR(xpd->cid_on, i); - BIT_CLR(priv->search_fsk_pattern, i); - pcm_recompute(xpd, 0); - if (priv->lasttxhook[i] == FXS_LINE_POL_OHTRANS) { - /* Apply the change if appropriate */ - linefeed_control(xpd->xbus, xpd, i, FXS_LINE_POL_ACTIVE); - } - } - } - } - } -} - -/* - * Optimized memcmp() like function. Only test for equality (true/false). - * This optimization reduced the detect_vmwi() runtime by a factor of 3. - */ -static inline bool mem_equal(const char a[], const char b[], size_t len) -{ - int i; - - for(i = 0; i < len; i++) - if(a[i] != b[i]) - return 0; - return 1; -} - -/* - * Detect Voice Mail Waiting Indication - */ -static void detect_vmwi(xpd_t *xpd) -{ - struct FXS_priv_data *priv; - xbus_t *xbus; - static const byte FSK_COMMON_PATTERN[] = { 0xA8, 0x49, 0x22, 0x3B, 0x9F, 0xFF, 0x1F, 0xBB }; - static const byte FSK_ON_PATTERN[] = { 0xA2, 0x2C, 0x1F, 0x2C, 0xBB, 0xA1, 0xA5, 0xFF }; - static const byte FSK_OFF_PATTERN[] = { 0xA2, 0x2C, 0x28, 0xA5, 0xB1, 0x21, 0x49, 0x9F }; - int i; - - BUG_ON(!xpd); - xbus = xpd->xbus; - priv = xpd->priv; - BUG_ON(!priv); - for_each_line(xpd, i) { - struct zt_chan *chan = &xpd->span.chans[i]; - byte *writechunk = chan->writechunk; - - if(IS_SET(xpd->offhook | xpd->cid_on | xpd->digital_inputs | xpd->digital_outputs, i)) - continue; -#if 0 - if(writechunk[0] != 0x7F && writechunk[0] != 0) { - int j; - - LINE_DBG(GENERAL, xpd, pos, "MSG:"); - for(j = 0; j < ZT_CHUNKSIZE; j++) { - if(debug) - printk(" %02X", writechunk[j]); - } - if(debug) - printk("\n"); - } -#endif - if(unlikely(mem_equal(writechunk, FSK_COMMON_PATTERN, ZT_CHUNKSIZE))) - BIT_SET(priv->found_fsk_pattern, i); - else if(unlikely(IS_SET(priv->found_fsk_pattern, i))) { - BIT_CLR(priv->found_fsk_pattern, i); - if(unlikely(mem_equal(writechunk, FSK_ON_PATTERN, ZT_CHUNKSIZE))) { - LINE_DBG(SIGNAL, xpd, i, "MSG WAITING ON\n"); - BIT_SET(xpd->msg_waiting, i); - start_stop_vm_led(xbus, xpd, i); - } else if(unlikely(mem_equal(writechunk, FSK_OFF_PATTERN, ZT_CHUNKSIZE))) { - LINE_DBG(SIGNAL, xpd, i, "MSG WAITING OFF\n"); - BIT_CLR(xpd->msg_waiting, i); - start_stop_vm_led(xbus, xpd, i); - } else { - int j; - - LINE_NOTICE(xpd, i, "MSG WAITING Unexpected:"); - for(j = 0; j < ZT_CHUNKSIZE; j++) { - printk(" %02X", writechunk[j]); - } - printk("\n"); - } - } - } -} - -static int FXS_card_tick(xbus_t *xbus, xpd_t *xpd) -{ - struct FXS_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); -#ifdef POLL_DIGITAL_INPUTS - if(poll_digital_inputs && xpd->xbus_idx == 0) { - if((xpd->timer_count % poll_digital_inputs) == 0) - poll_inputs(xpd); - } -#endif - handle_fxs_leds(xpd); - handle_linefeed(xpd); - if(priv->update_offhook_state) { /* set in FXS_card_open() */ - int i; - - for_each_line(xpd, i) { - if(!IS_SET(priv->update_offhook_state, i)) - continue; - /* - * Update zaptel with current state of line. - */ - if(IS_SET(xpd->offhook, i)) { - update_line_status(xpd, i, 1); - } else { - update_line_status(xpd, i, 0); - } - BIT_CLR(priv->update_offhook_state, i); - } - } - if(SPAN_REGISTERED(xpd)) { - if(vmwineon && !vmwi_ioctl) - detect_vmwi(xpd); /* Detect via FSK modulation */ - } - return 0; -} - -/*---------------- FXS: HOST COMMANDS -------------------------------------*/ - -static /* 0x0F */ HOSTCMD(FXS, XPD_STATE, bool on) -{ - BUG_ON(!xbus); - BUG_ON(!xpd); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); - return 0; -} - -/*---------------- FXS: Astribank Reply Handlers --------------------------*/ - -/* - * Should be called with spinlocked XPD - */ -static void process_hookstate(xpd_t *xpd, xpp_line_t offhook, xpp_line_t change_mask) -{ - xbus_t *xbus; - struct FXS_priv_data *priv; - int i; - - BUG_ON(!xpd); - BUG_ON(xpd->direction != TO_PHONE); - xbus = xpd->xbus; - priv = xpd->priv; - XPD_DBG(SIGNAL, xpd, "offhook=0x%X change_mask=0x%X\n", offhook, change_mask); - for_each_line(xpd, i) { - if(IS_SET(xpd->digital_outputs, i) || IS_SET(xpd->digital_inputs, i)) - continue; - if(IS_SET(change_mask, i)) { - xpd->ringing[i] = 0; /* No more ringing... */ -#ifdef WITH_METERING - metering_gen(xpd, i, 0); /* Stop metering... */ -#endif - MARK_BLINK(priv, i, LED_GREEN, 0); - /* - * Reset our previous DTMF memories... - */ - BIT_CLR(priv->prev_key_down, i); - priv->prev_key_time[i].tv_sec = priv->prev_key_time[i].tv_usec = 0L; - if(IS_SET(offhook, i)) { - LINE_DBG(SIGNAL, xpd, i, "OFFHOOK\n"); - MARK_ON(priv, i, LED_GREEN); - update_line_status(xpd, i, 1); - } else { - LINE_DBG(SIGNAL, xpd, i, "ONHOOK\n"); - MARK_OFF(priv, i, LED_GREEN); - update_line_status(xpd, i, 0); - } - /* - * Must switch to low power. In high power, an ONHOOK - * won't be detected. - */ - do_chan_power(xbus, xpd, i, 0); - } - } - __pcm_recompute(xpd, 0); /* in a spinlock */ -} - -HANDLER_DEF(FXS, SIG_CHANGED) -{ - xpp_line_t sig_status = RPACKET_FIELD(pack, FXS, SIG_CHANGED, sig_status); - xpp_line_t sig_toggles = RPACKET_FIELD(pack, FXS, SIG_CHANGED, sig_toggles); - unsigned long flags; - - BUG_ON(!xpd); - BUG_ON(xpd->direction != TO_PHONE); - XPD_DBG(SIGNAL, xpd, "(PHONE) sig_toggles=0x%04X sig_status=0x%04X\n", sig_toggles, sig_status); -#if 0 - Is this needed? - for_each_line(xpd, i) { - if(IS_SET(sig_toggles, i)) - do_chan_power(xpd->xbus, xpd, BIT(i), 0); // Power down (prevent overheating!!!) - } -#endif - spin_lock_irqsave(&xpd->lock, flags); - process_hookstate(xpd, sig_status, sig_toggles); - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; -} - -#ifdef POLL_DIGITAL_INPUTS -static void process_digital_inputs(xpd_t *xpd, const reg_cmd_t *info) -{ - int i; - bool offhook = (REG_FIELD(info, data_low) & 0x1) == 0; - xpp_line_t lines = BIT(info->portnum); - - /* Map SLIC number into line number */ - for(i = 0; i < ARRAY_SIZE(input_channels); i++) { - int channo = input_channels[i]; - int newchanno; - - if(IS_SET(lines, channo)) { - newchanno = xpd->channels - LINES_DIGI_INP + i; - BIT_CLR(lines, channo); - BIT_SET(lines, newchanno); - xpd->ringing[newchanno] = 0; // Stop ringing. No leds for digital inputs. - if(offhook && !IS_SET(xpd->offhook, newchanno)) { // OFFHOOK - LINE_DBG(SIGNAL, xpd, newchanno, "OFFHOOK\n"); - update_line_status(xpd, newchanno, 1); - } else if(!offhook && IS_SET(xpd->offhook, newchanno)) { // ONHOOK - LINE_DBG(SIGNAL, xpd, newchanno, "ONHOOK\n"); - update_line_status(xpd, newchanno, 0); - } - } - } -} -#endif - -static const char dtmf_digits[] = { - '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '*', '#', 'A', 'B', 'C', 'D' -}; - -/* - * This function is called with spinlocked XPD - */ -static void process_dtmf(xpd_t *xpd, uint portnum, byte val) -{ - byte digit; - bool key_down = val & 0x10; - bool want_mute; - bool want_event; - struct FXS_priv_data *priv; - struct timeval now; - int msec = 0; - - if(!dtmf_detection) - return; - if(!SPAN_REGISTERED(xpd)) - 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); - if(!IS_SET(priv->prev_key_down, portnum) && !key_down) { - LINE_NOTICE(xpd, portnum, "DTMF: duplicate UP (%c)\n", digit); - } - if(key_down) - BIT_SET(priv->prev_key_down, portnum); - else - BIT_CLR(priv->prev_key_down, portnum); - do_gettimeofday(&now); - if(priv->prev_key_time[portnum].tv_sec != 0) - msec = usec_diff(&now, &priv->prev_key_time[portnum]) / 1000; - priv->prev_key_time[portnum] = now; - LINE_DBG(SIGNAL, xpd, portnum, - "[%lu.%06lu] DTMF digit %-4s '%c' (val=%d, want_mute=%s want_event=%s, delta=%d msec)\n", - now.tv_sec, now.tv_usec, - (key_down)?"DOWN":"UP", digit, val, - (want_mute) ? "yes" : "no", - (want_event) ? "yes" : "no", - msec); - /* - * FIXME: we currently don't use the want_dtmf_mute until - * we are sure about the logic in Asterisk native bridging. - * Meanwhile, simply mute it on button press. - */ - if(key_down && want_mute) - __do_mute_dtmf(xpd, portnum, 1); - else - __do_mute_dtmf(xpd, portnum, 0); - __pcm_recompute(xpd, 0); /* XPD is locked */ - if(want_event) { - int event = (key_down) ? ZT_EVENT_DTMFDOWN : ZT_EVENT_DTMFUP; - - zt_qevent_lock(&xpd->chans[portnum], event | digit); - } -} - -static int FXS_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info) -{ - unsigned long flags; - struct FXS_priv_data *priv; - byte regnum; - bool indirect; - - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - indirect = (REG_FIELD(info, regnum) == 0x1E); - regnum = (indirect) ? REG_FIELD(info, subreg) : REG_FIELD(info, regnum); - XPD_DBG(REGS, xpd, "%s reg_num=0x%X, dataL=0x%X dataH=0x%X\n", - (indirect)?"I":"D", - regnum, REG_FIELD(info, data_low), REG_FIELD(info, data_high)); - if(!indirect && regnum == REG_DTMF_DECODE) { - byte val = REG_FIELD(info, data_low); - - process_dtmf(xpd, info->portnum, val); - } -#ifdef POLL_DIGITAL_INPUTS - /* - * Process digital inputs polling results - */ - else if(xpd->xbus_idx == 0 && !indirect && regnum == REG_DIGITAL_IOCTRL) { - process_digital_inputs(xpd, info); - } -#endif - else if(!indirect && regnum == REG_LOOPCLOSURE) { /* OFFHOOK ? */ - byte val = REG_FIELD(info, data_low); - xpp_line_t mask = BIT(info->portnum); - xpp_line_t offhook; - - offhook = (val & REG_LOOPCLOSURE_LCR) ? mask : 0; - LINE_DBG(SIGNAL, xpd, info->portnum, - "REG_LOOPCLOSURE: dataL=0x%X (offhook=0x%X mask=0x%X\n", - val, offhook, mask); - process_hookstate(xpd, offhook, mask); - } else { -#if 0 - XPD_NOTICE(xpd, "Spurious register reply(ignored): %s reg_num=0x%X, dataL=0x%X dataH=0x%X\n", - (indirect)?"I":"D", - regnum, REG_FIELD(info, data_low), REG_FIELD(info, data_high)); -#endif - } - /* Update /proc info only if reply relate to the last slic read request */ - if( - REG_FIELD(&xpd->requested_reply, regnum) == REG_FIELD(info, regnum) && - REG_FIELD(&xpd->requested_reply, do_subreg) == REG_FIELD(info, do_subreg) && - REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) { - xpd->last_reply = *info; - } - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; -} - -static xproto_table_t PROTO_TABLE(FXS) = { - .owner = THIS_MODULE, - .entries = { - /* Prototable Card Opcode */ - XENTRY( FXS, FXS, SIG_CHANGED ), - }, - .name = "FXS", /* protocol name */ - .ports_per_subunit = 8, - .type = XPD_TYPE_FXS, - .xops = { - .card_new = FXS_card_new, - .card_init = FXS_card_init, - .card_remove = FXS_card_remove, - .card_zaptel_preregistration = FXS_card_zaptel_preregistration, - .card_zaptel_postregistration = FXS_card_zaptel_postregistration, - .card_hooksig = FXS_card_hooksig, - .card_tick = FXS_card_tick, - .card_pcm_fromspan = generic_card_pcm_fromspan, - .card_pcm_tospan = generic_card_pcm_tospan, - .card_open = FXS_card_open, - .card_close = FXS_card_close, - .card_ioctl = FXS_card_ioctl, - .card_register_reply = FXS_card_register_reply, - - .XPD_STATE = XPROTO_CALLER(FXS, XPD_STATE), - }, - .packet_is_valid = fxs_packet_is_valid, - .packet_dump = fxs_packet_dump, -}; - -static bool fxs_packet_is_valid(xpacket_t *pack) -{ - const xproto_entry_t *xe; - - // DBG(GENERAL, "\n"); - xe = xproto_card_entry(&PROTO_TABLE(FXS), XPACKET_OP(pack)); - return xe != NULL; -} - -static void fxs_packet_dump(const char *msg, xpacket_t *pack) -{ - DBG(GENERAL, "%s\n", msg); -} - -/*------------------------- SLIC Handling --------------------------*/ - -static int proc_fxs_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - struct FXS_priv_data *priv; - int i; - int led; - - if(!xpd) - return -ENODEV; - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - len += sprintf(page + len, "%-8s %-10s %-10s %-10s\n", - "Channel", - "idletxhookstate", - "lasttxhook", - "ohttimer" - ); - for_each_line(xpd, i) { - char pref; - - if(IS_SET(xpd->digital_outputs, i)) - pref = 'O'; - else if(IS_SET(xpd->digital_inputs, i)) - pref = 'I'; - else - pref = ' '; - len += sprintf(page + len, "%c%7d %10d %10d %10d\n", - pref, - i, - priv->idletxhookstate[i], - priv->lasttxhook[i], - priv->ohttimer[i] - ); - } - len += sprintf(page + len, "\n"); - for(led = 0; led < NUM_LEDS; led++) { - len += sprintf(page + len, "LED #%d", led); - len += sprintf(page + len, "\n\t%-17s: ", "ledstate"); - for_each_line(xpd, i) { - if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i)) - len += sprintf(page + len, "%d ", IS_SET(priv->ledstate[led], i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "ledcontrol"); - for_each_line(xpd, i) { - if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i)) - len += sprintf(page + len, "%d ", IS_SET(priv->ledcontrol[led], i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "led_counter"); - for_each_line(xpd, i) { - if(!IS_SET(xpd->digital_outputs, i) && !IS_SET(xpd->digital_inputs, i)) - len += sprintf(page + len, "%d ", LED_COUNTER(priv,i,led)); - } - len += sprintf(page + len, "\n"); - } - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -#ifdef WITH_METERING -static int proc_xpd_metering_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - xpd_t *xpd = data; - char buf[MAX_PROC_WRITE]; - lineno_t chan; - int num; - int ret; - - if(!xpd) - return -ENODEV; - if(count >= MAX_PROC_WRITE - 1) { - XPD_ERR(xpd, "Metering string too long (%lu)\n", count); - return -EINVAL; - } - if(copy_from_user(&buf, buffer, count)) - return -EFAULT; - buf[count] = '\0'; - ret = sscanf(buf, "%d", &num); - if(ret != 1) { - XPD_ERR(xpd, "Metering value should be number. Got '%s'\n", buf); - return -EINVAL; - } - chan = num; - if(chan != PORT_BROADCAST && chan > xpd->channels) { - XPD_ERR(xpd, "Metering tone: bad channel number %d\n", chan); - return -EINVAL; - } - if((ret = metering_gen(xpd, chan, 1)) < 0) { - XPD_ERR(xpd, "Failed sending metering tone\n"); - return ret; - } - return count; -} -#endif - -static int __init card_fxs_startup(void) -{ - INFO("revision %s\n", XPP_VERSION); -#ifdef POLL_DIGITAL_INPUTS - INFO("FEATURE: with DIGITAL INPUTS support (polled every %d msec)\n", - poll_digital_inputs); -#else - INFO("FEATURE: without DIGITAL INPUTS support\n"); -#endif -#ifdef ZT_VMWI - INFO("FEATURE: ZT_VMWI\n"); -#else - INFO("FEATURE: NO ZT_VMWI\n"); -#endif -#ifdef WITH_METERING - INFO("FEATURE: WITH METERING Generation\n"); -#else - INFO("FEATURE: NO METERING Generation\n"); -#endif - xproto_register(&PROTO_TABLE(FXS)); - return 0; -} - -static void __exit card_fxs_cleanup(void) -{ - xproto_unregister(&PROTO_TABLE(FXS)); -} - -MODULE_DESCRIPTION("XPP FXS Card Driver"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(XPP_VERSION); -MODULE_ALIAS_XPD(XPD_TYPE_FXS); - -module_init(card_fxs_startup); -module_exit(card_fxs_cleanup); diff --git a/zaptel/kernel/xpp/card_fxs.h b/zaptel/kernel/xpp/card_fxs.h deleted file mode 100644 index 0b36d3d3..00000000 --- a/zaptel/kernel/xpp/card_fxs.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef CARD_FXS_H -#define CARD_FXS_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpd.h" - -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 */ -}; - - -DEF_RPACKET_DATA(FXS, SIG_CHANGED, - xpp_line_t sig_status; /* channels: lsb=1, msb=8 */ - xpp_line_t sig_toggles; /* channels: lsb=1, msb=8 */ - ); - -#endif /* CARD_FXS_H */ diff --git a/zaptel/kernel/xpp/card_global.c b/zaptel/kernel/xpp/card_global.c deleted file mode 100644 index 05d30c3b..00000000 --- a/zaptel/kernel/xpp/card_global.c +++ /dev/null @@ -1,851 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include "xdefs.h" -#include "xpd.h" -#include "xpp_zap.h" -#include "xproto.h" -#include "zap_debug.h" -#include "xbus-core.h" -#include "parport_debug.h" - -static const char rcsid[] = "$Id: card_global.c 4531 2008-09-09 17:13:27Z tzafrir $"; - -DEF_PARM(charp,initdir, "/usr/share/zaptel", 0644, "The directory of card initialization scripts"); - -#define CHIP_REGISTERS "chipregs" - -extern int debug; - -/*---------------- GLOBAL PROC handling -----------------------------------*/ - -static int proc_xpd_register_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - reg_cmd_t *info; - bool do_datah; - char datah_str[50]; - - if(!xpd) - return -ENODEV; - spin_lock_irqsave(&xpd->lock, flags); - info = &xpd->last_reply; - len += sprintf(page + len, "# Writing bad data into this file may damage your hardware!\n"); - len += sprintf(page + len, "# Consult firmware docs first\n"); - len += sprintf(page + len, "#\n"); - do_datah = REG_FIELD(info, do_datah) ? 1 : 0; - if(do_datah) { - snprintf(datah_str, ARRAY_SIZE(datah_str), "\t%02X", - REG_FIELD(info, data_high)); - } else - datah_str[0] = '\0'; - if(REG_FIELD(info, do_subreg)) { - len += sprintf(page + len, "#CH\tOP\tReg.\tSub\tDL%s\n", - (do_datah) ? "\tDH" : ""); - len += sprintf(page + len, "%2d\tRS\t%02X\t%02X\t%02X%s\n", - info->portnum, - REG_FIELD(info, regnum), REG_FIELD(info, subreg), - REG_FIELD(info, data_low), datah_str); - } else { - len += sprintf(page + len, "#CH\tOP\tReg.\tDL%s\n", - (do_datah) ? "\tDH" : ""); - len += sprintf(page + len, "%2d\tRD\t%02X\t%02X%s\n", - info->portnum, - REG_FIELD(info, regnum), - REG_FIELD(info, data_low), datah_str); - } - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -static int parse_hexbyte(const char *buf) -{ - char *endp; - unsigned val; - - val = simple_strtoul(buf, &endp, 16); - if(*endp != '\0' || val > 0xFF) - return -EBADR; - return (byte)val; -} - -static int execute_chip_command(xpd_t *xpd, const int argc, char *argv[]) -{ - int argno; - char num_args; - int portno; - bool writing; - int op; /* [W]rite, [R]ead */ - int addr_mode; /* [D]irect, [I]ndirect, [Mm]ulti */ - bool do_subreg = 0; - int regnum; - int subreg; - int data_low; - bool do_datah; - int data_high; - int ret = -EBADR; - - num_args = 2; /* port + operation */ - if(argc < num_args) { - XPD_ERR(xpd, "Not enough arguments (%d)\n", argc); - XPD_ERR(xpd, - "Any Command is composed of at least %d words (got only %d)\n", - num_args, argc); - goto out; - } - /* Process the arguments */ - argno = 0; - if(strcmp(argv[argno], "*") == 0) { - portno = PORT_BROADCAST; - //XPD_DBG(REGS, xpd, "Port broadcast\n"); - } else { - portno = parse_hexbyte(argv[argno]); - if(portno < 0 || portno >= 8) { - XPD_ERR(xpd, "Illegal port number '%s'\n", argv[argno]); - goto out; - } - //XPD_DBG(REGS, xpd, "Port is %d\n", portno); - } - argno++; - if(strlen(argv[argno]) != 2) { - XPD_ERR(xpd, "Wrong operation codes '%s'\n", argv[argno]); - goto out; - } - op = argv[argno][0]; - switch(op) { - case 'W': - writing = 1; - num_args++; /* data low */ - //XPD_DBG(REGS, xpd, "WRITING\n"); - break; - case 'R': - writing = 0; - //XPD_DBG(REGS, xpd, "READING\n"); - break; - default: - XPD_ERR(xpd, "Unkown operation type '%c'\n", op); - goto out; - } - addr_mode = argv[argno][1]; - switch(addr_mode) { - case 'I': - XPD_NOTICE(xpd, "'I' is deprecated in register commands. Use 'S' instead.\n"); - /* fall through */ - case 'S': - do_subreg = 1; - num_args += 2; /* register + subreg */ - //XPD_DBG(REGS, xpd, "SUBREG\n"); - break; - case 'D': - do_subreg = 0; - num_args++; /* register */ - //XPD_DBG(REGS, xpd, "DIRECT\n"); - break; - case 'M': - case 'm': - if(op != 'W') { - XPD_ERR(xpd, - "Can use Multibyte (%c) only with op 'W'\n", addr_mode); - goto out; - } - num_args--; /* No data low */ - //XPD_DBG(REGS, xpd, "Multibyte (%c)\n", addr_mode); - break; - default: - XPD_ERR(xpd, "Unkown addressing type '%c'\n", addr_mode); - goto out; - } - if(argv[argno][2] != '\0') { - XPD_ERR(xpd, "Bad operation field '%s'\n", argv[argno]); - goto out; - } - if(argc < num_args) { - XPD_ERR(xpd, - "Command \"%s\" is composed of at least %d words (got only %d)\n", - argv[argno], num_args, argc); - goto out; - } - argno++; - if(addr_mode == 'M' || addr_mode == 'm') { - if(argno < argc) { - XPD_ERR(xpd, - "Magic-Multibyte(%c) with %d extra arguments\n", - addr_mode, argc - argno); - goto out; - } - ret = send_multibyte_request(xpd->xbus, xpd->addr.unit, portno, - addr_mode == 'm', NULL, 0); - goto out; - } - /* Normal (non-Magic) register commands */ - do_datah = 0; - if(argno >= argc) { - XPD_ERR(xpd, "Missing register number\n"); - goto out; - } - regnum = parse_hexbyte(argv[argno]); - if(regnum < 0) { - XPD_ERR(xpd, "Illegal register number '%s'\n", argv[argno]); - goto out; - } - //XPD_DBG(REGS, xpd, "Register is %X\n", regnum); - argno++; - if(do_subreg) { - if(argno >= argc) { - XPD_ERR(xpd, "Missing subregister number\n"); - goto out; - } - subreg = parse_hexbyte(argv[argno]); - if(subreg < 0) { - XPD_ERR(xpd, "Illegal subregister number '%s'\n", argv[argno]); - goto out; - } - //XPD_DBG(REGS, xpd, "Subreg is %X\n", subreg); - argno++; - } else - subreg = 0; - if(writing) { - if(argno >= argc) { - XPD_ERR(xpd, "Missing data low number\n"); - goto out; - } - data_low = parse_hexbyte(argv[argno]); - if(data_low < 0) { - XPD_ERR(xpd, "Illegal data_low number '%s'\n", argv[argno]); - goto out; - } - //XPD_DBG(REGS, xpd, "Data Low is %X\n", data_low); - argno++; - } else - data_low = 0; - if(argno < argc) { - do_datah = 1; - if(!argv[argno]) { - XPD_ERR(xpd, "Missing data high number\n"); - goto out; - } - data_high = parse_hexbyte(argv[argno]); - if(data_high < 0) { - XPD_ERR(xpd, "Illegal data_high number '%s'\n", argv[argno]); - goto out; - } - //XPD_DBG(REGS, xpd, "Data High is %X\n", data_high); - argno++; - } else - data_high = 0; - if(argno < argc) { - XPD_ERR(xpd, - "Command contains an extra %d argument\n", - argc - argno); - goto out; - } -#if 0 - XPD_DBG(REGS, xpd, - "portno=%d writing=%d regnum=%d do_subreg=%d subreg=%d dataL=%d do_datah=%d dataH=%d\n", - portno, /* portno */ - writing, /* writing */ - regnum, - do_subreg, /* use subreg */ - subreg, /* subreg */ - data_low, - do_datah, /* use data_high*/ - data_high); -#endif - ret = xpp_register_request(xpd->xbus, xpd, portno, - writing, regnum, do_subreg, subreg, - data_low, do_datah, data_high, 1); -out: - return ret; -} - -static int parse_chip_command(xpd_t *xpd, char *cmdline) -{ - xbus_t *xbus; - int ret = -EBADR; - byte buf[MAX_PROC_WRITE]; - char *str; - char *p; - static const int MAX_ARGS = 10; - char *argv[MAX_ARGS + 1]; - int argc; - int i; - - BUG_ON(!xpd); - xbus = xpd->xbus; - if(!XBUS_GET(xbus)) { - XBUS_DBG(GENERAL, xbus, "Dropped packet. Is shutting down.\n"); - return -EBUSY; - } - strlcpy(buf, cmdline, MAX_PROC_WRITE); /* Save a copy */ - if(buf[0] == '#' || buf[0] == ';') - XPD_DBG(REGS, xpd, "Note: '%s'\n", buf); - if((p = strchr(buf, '#')) != NULL) /* Truncate comments */ - *p = '\0'; - if((p = strchr(buf, ';')) != NULL) /* Truncate comments */ - *p = '\0'; - for(p = buf; *p && (*p == ' ' || *p == '\t'); p++) /* Trim leading whitespace */ - ; - str = p; - for(i = 0; (p = strsep(&str, " \t")) != NULL && i < MAX_ARGS; ) { - if(*p != '\0') { - argv[i] = p; - // XPD_DBG(REGS, xpd, "ARG %d = '%s'\n", i, p); - i++; - } - } - argv[i] = NULL; - argc = i; - if(p) { - XPD_ERR(xpd, "Too many words (%d) to process. Last was '%s'\n", i, p); - goto out; - } - if(argc) - ret = execute_chip_command(xpd, argc, argv); - else - ret = 0; /* empty command - no op */ -out: - XBUS_PUT(xbus); - return ret; -} - - -static int proc_xpd_register_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - xpd_t *xpd = data; - char buf[MAX_PROC_WRITE]; - char *p; - int i; - int ret; - - if(!xpd) - return -ENODEV; - for(i = 0; i < count; /* noop */) { - for(p = buf; p < buf + MAX_PROC_WRITE; p++) { /* read a line */ - if(i >= count) - break; - if(get_user(*p, buffer + i)) - return -EFAULT; - i++; - if(*p == '\n' || *p == '\r') /* whatever */ - break; - } - if(p >= buf + MAX_PROC_WRITE) - return -E2BIG; - *p = '\0'; - ret = parse_chip_command(xpd, buf); - if(ret < 0) { - XPD_NOTICE(xpd, "Failed writing command: '%s'\n", buf); - return ret; - } - msleep(1); /* don't overflow command queue */ - } - return count; -} - -void chip_proc_remove(xbus_t *xbus, xpd_t *xpd) -{ - BUG_ON(!xpd); -#ifdef CONFIG_PROC_FS - if(xpd->proc_xpd_chipregs) { - XBUS_DBG(PROC, xbus, "UNIT %d: Removing %s\n", xpd->addr.unit, CHIP_REGISTERS); - xpd->proc_xpd_chipregs->data = NULL; - remove_proc_entry(CHIP_REGISTERS, xpd->proc_xpd_dir); - } -#endif -} - -int chip_proc_create(xbus_t *xbus, xpd_t *xpd) -{ - BUG_ON(!xpd); -#ifdef CONFIG_PROC_FS - XBUS_DBG(PROC, xbus, "UNIT %d: Creating %s\n", xpd->addr.unit, CHIP_REGISTERS); - xpd->proc_xpd_chipregs = create_proc_entry(CHIP_REGISTERS, 0644, xpd->proc_xpd_dir); - if(!xpd->proc_xpd_chipregs) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", CHIP_REGISTERS); - goto err; - } - xpd->proc_xpd_chipregs->owner = THIS_MODULE; - xpd->proc_xpd_chipregs->write_proc = proc_xpd_register_write; - xpd->proc_xpd_chipregs->read_proc = proc_xpd_register_read; - xpd->proc_xpd_chipregs->data = xpd; -#endif - return 0; -err: - chip_proc_remove(xbus, xpd); - return -EINVAL; -} - -/*---------------- GLOBAL Protocol Commands -------------------------------*/ - -static bool global_packet_is_valid(xpacket_t *pack); -static void global_packet_dump(const char *msg, xpacket_t *pack); - -/*---------------- GLOBAL: HOST COMMANDS ----------------------------------*/ - -/* 0x07 */ HOSTCMD(GLOBAL, AB_REQUEST) -{ - int ret = 0; - xframe_t *xframe; - xpacket_t *pack; - - if(!xbus) { - DBG(DEVICES, "NO XBUS\n"); - return -EINVAL; - } - XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, AB_REQUEST, 0); - RPACKET_FIELD(pack, GLOBAL, AB_REQUEST, rev) = XPP_PROTOCOL_VERSION; - RPACKET_FIELD(pack, GLOBAL, AB_REQUEST, reserved) = 0; - XBUS_DBG(DEVICES, xbus, "Protocol Version %d\n", XPP_PROTOCOL_VERSION); - ret = send_cmd_frame(xbus, xframe); - return ret; -} - -int xpp_register_request(xbus_t *xbus, xpd_t *xpd, xportno_t portno, - bool writing, byte regnum, bool do_subreg, byte subreg, - byte data_low, bool do_datah, byte data_high, bool should_reply) -{ - int ret = 0; - xframe_t *xframe; - xpacket_t *pack; - reg_cmd_t *reg_cmd; - - if(!xbus) { - DBG(REGS, "NO XBUS\n"); - return -EINVAL; - } - XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, REGISTER_REQUEST, xpd->xbus_idx); - LINE_DBG(REGS, xpd, portno, "%c%c %02X %02X %02X %02X\n", - (writing)?'W':'R', - (do_subreg)?'S':'D', - regnum, subreg, data_low, data_high); - reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd); - reg_cmd->bytes = sizeof(*reg_cmd) - 1; // do not count the 'bytes' field - reg_cmd->is_multibyte = 0; - if(portno == PORT_BROADCAST) { - reg_cmd->portnum = 0; - REG_FIELD(reg_cmd, all_ports_broadcast) = 1; - } else { - reg_cmd->portnum = portno; - REG_FIELD(reg_cmd, all_ports_broadcast) = 0; - } - reg_cmd->eoframe = 0; - REG_FIELD(reg_cmd, reserved) = 0; /* force reserved bits to 0 */ - REG_FIELD(reg_cmd, read_request) = (writing) ? 0 : 1; - REG_FIELD(reg_cmd, do_subreg) = do_subreg; - REG_FIELD(reg_cmd, regnum) = regnum; - REG_FIELD(reg_cmd, subreg) = subreg; - REG_FIELD(reg_cmd, do_datah) = do_datah; - REG_FIELD(reg_cmd, data_low) = data_low; - REG_FIELD(reg_cmd, data_high) = data_high; - if(should_reply) - xpd->requested_reply = *reg_cmd; - if(debug & DBG_REGS) { - dump_reg_cmd("REG_REQ", 1, xbus, xpd->addr.unit, reg_cmd->portnum, reg_cmd); - dump_packet("REG_REQ", pack, 1); - } - ret = send_cmd_frame(xbus, xframe); - 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. - */ -/* 0x19 */ HOSTCMD(GLOBAL, SYNC_SOURCE, enum sync_mode mode, int drift) -{ - xframe_t *xframe; - xpacket_t *pack; - const char *mode_name; - - BUG_ON(!xbus); - if((mode_name = sync_mode_name(mode)) == NULL) { - XBUS_ERR(xbus, "SYNC_SOURCE: bad sync_mode=0x%X\n", mode); - return -EINVAL; - } - XBUS_DBG(SYNC, xbus, "%s (0x%X), drift=%d\n", mode_name, mode, drift); - XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, SYNC_SOURCE, 0); - RPACKET_FIELD(pack, GLOBAL, SYNC_SOURCE, sync_mode) = mode; - RPACKET_FIELD(pack, GLOBAL, SYNC_SOURCE, drift) = drift; - send_cmd_frame(xbus, xframe); - return 0; -} - -/* 0x23 */ HOSTCMD(GLOBAL, RESET_SYNC_COUNTERS) -{ - xframe_t *xframe; - xpacket_t *pack; - - BUG_ON(!xbus); - //XBUS_DBG(SYNC, xbus, "\n"); - XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, RESET_SYNC_COUNTERS, 0); - RPACKET_FIELD(pack, GLOBAL, RESET_SYNC_COUNTERS, mask) = 0x10; - send_cmd_frame(xbus, xframe); - return 0; -} - -/*---------------- GLOBAL: Astribank Reply Handlers -----------------------*/ - -HANDLER_DEF(GLOBAL, NULL_REPLY) -{ - XBUS_DBG(GENERAL, xbus, "got len=%d\n", XPACKET_LEN(pack)); - return 0; -} - -HANDLER_DEF(GLOBAL, AB_DESCRIPTION) /* 0x08 */ -{ - struct xbus_workqueue *worker = xbus->worker; - byte rev; - struct unit_descriptor *units; - int count_units; - int i; - int ret = 0; - - rev = RPACKET_FIELD(pack, GLOBAL, AB_DESCRIPTION, rev); - units = RPACKET_FIELD(pack, GLOBAL, AB_DESCRIPTION, unit_descriptor); - count_units = XPACKET_LEN(pack) - ((byte *)units - (byte *)pack); - count_units /= sizeof(*units); - if(rev != XPP_PROTOCOL_VERSION) { - XBUS_NOTICE(xbus, "Bad protocol version %d (should be %d)\n", - rev, XPP_PROTOCOL_VERSION); - ret = -EPROTO; - goto proto_err; - } - if(count_units > NUM_UNITS) { - XBUS_NOTICE(xbus, "Too many units %d (should be %d)\n", - count_units, NUM_UNITS); - ret = -EPROTO; - goto proto_err; - } - if(count_units <= 0) { - XBUS_NOTICE(xbus, "Empty astribank? (%d units)\n", - count_units); - ret = -EPROTO; - goto proto_err; - } - XBUS_INFO(xbus, "DESCRIPTOR: %d cards, protocol revision %d\n", count_units, rev); - xbus->revision = rev; - if(!worker) { - XBUS_ERR(xbus, "missing worker\n"); - ret = -ENODEV; - goto err; - } - for(i = 0; i < count_units; i++) { - struct unit_descriptor *this_unit = &units[i]; - struct card_desc_struct *card_desc; - unsigned long flags; - - if((card_desc = KZALLOC(sizeof(struct card_desc_struct), GFP_ATOMIC)) == NULL) { - XBUS_ERR(xbus, "Card description allocation failed.\n"); - ret = -ENOMEM; - goto err; - } - card_desc->magic = CARD_DESC_MAGIC; - INIT_LIST_HEAD(&card_desc->card_list); - card_desc->type = this_unit->type; - card_desc->subtype = this_unit->subtype; - card_desc->xpd_addr = this_unit->addr; - card_desc->numchips = this_unit->numchips; - card_desc->ports_per_chip = this_unit->ports_per_chip; - card_desc->port_dir = this_unit->port_dir; - card_desc->ports = card_desc->numchips * card_desc->ports_per_chip; - XBUS_INFO(xbus, " CARD %d type=%d.%d ports=%d (%dx%d), port-dir=0x%02X\n", - card_desc->xpd_addr.unit, - card_desc->type, - card_desc->subtype, - card_desc->ports, - card_desc->numchips, - card_desc->ports_per_chip, - card_desc->port_dir - ); - spin_lock_irqsave(&worker->worker_lock, flags); - worker->num_units++; - XBUS_COUNTER(xbus, UNITS)++; - list_add_tail(&card_desc->card_list, &worker->card_list); - spin_unlock_irqrestore(&worker->worker_lock, flags); - } - /* Initialize the work. (adapt to kernel API changes). */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) - INIT_WORK(&worker->xpds_init_work, xbus_populate); -#else - INIT_WORK(&worker->xpds_init_work, xbus_populate, worker); -#endif - xbus = get_xbus(xbus->num); /* released in xbus_populate() */ - BUG_ON(!xbus); - /* Now send it */ - if(!queue_work(worker->wq, &worker->xpds_init_work)) { - XBUS_ERR(xbus, "Failed to queue xpd initialization work\n"); - return -ENODEV; - } - return 0; -proto_err: - dump_packet("AB_DESCRIPTION", pack, DBG_ANY); -err: - return ret; -} - -HANDLER_DEF(GLOBAL, REGISTER_REPLY) -{ - reg_cmd_t *reg = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REPLY, regcmd); - - if(!xpd) { - static int rate_limit; - - if((rate_limit++ % 1003) < 5) - notify_bad_xpd(__FUNCTION__, xbus, XPACKET_ADDR(pack), ""); - return -EPROTO; - } - if(debug & DBG_REGS) { - dump_reg_cmd("REG_REPLY", 0, xbus, xpd->addr.unit, reg->portnum, reg); - dump_packet("REG_REPLY", pack, 1); - } - return CALL_XMETHOD(card_register_reply, xbus, xpd, reg); -} - -HANDLER_DEF(GLOBAL, SYNC_REPLY) -{ - byte mode = RPACKET_FIELD(pack, GLOBAL, SYNC_REPLY, sync_mode); - byte drift = RPACKET_FIELD(pack, GLOBAL, SYNC_REPLY, drift); - const char *mode_name; - - BUG_ON(!xbus); - if((mode_name = sync_mode_name(mode)) == NULL) { - XBUS_ERR(xbus, "SYNC_REPLY: bad sync_mode=0x%X\n", mode); - return -EINVAL; - } - XBUS_DBG(SYNC, xbus, "%s (0x%X), drift=%d\n", mode_name, mode, drift); - //dump_packet("SYNC_REPLY", pack, debug & DBG_SYNC); - got_new_syncer(xbus, mode, drift); - return 0; -} - -#define TMP_NAME_LEN (XBUS_NAMELEN + XPD_NAMELEN + 5) - -HANDLER_DEF(GLOBAL, ERROR_CODE) -{ - byte errorcode; - char tmp_name[TMP_NAME_LEN]; - static long rate_limit; - const char *msg; - const static char *fw_messages[] = { - [1] = "Packet too short", - [2] = "Len field is too small", - [3] = "Premature packet end", - [4] = "Invalid op code", - [5] = "Invalid packet len", - [6] = "SPI fifo full", - }; - - BUG_ON(!xbus); - if((rate_limit++ % 5003) > 200) - return 0; - errorcode = RPACKET_FIELD(pack, GLOBAL, ERROR_CODE, errorcode); - msg = (errorcode < ARRAY_SIZE(fw_messages)) - ? fw_messages[errorcode] - : "UNKNOWN CODE"; - if(!xpd) { - snprintf(tmp_name, TMP_NAME_LEN, "%s(%1d%1d)", xbus->busname, - XPACKET_ADDR_UNIT(pack), XPACKET_ADDR_SUBUNIT(pack)); - } else { - snprintf(tmp_name, TMP_NAME_LEN, "%s/%s", xbus->busname, xpd->xpdname); - } - NOTICE("%s: FIRMWARE: %s CODE = 0x%X (%s) (rate_limit=%ld)\n", - tmp_name, cmd->name, errorcode, msg, rate_limit); - dump_packet("FIRMWARE: ", pack, 1); - /* - * FIXME: Should implement an error recovery plan - */ - return 0; -} - - -xproto_table_t PROTO_TABLE(GLOBAL) = { - .entries = { - /* Prototable Card Opcode */ - XENTRY( GLOBAL, GLOBAL, NULL_REPLY ), - XENTRY( GLOBAL, GLOBAL, AB_DESCRIPTION ), - XENTRY( GLOBAL, GLOBAL, SYNC_REPLY ), - XENTRY( GLOBAL, GLOBAL, ERROR_CODE ), - XENTRY( GLOBAL, GLOBAL, REGISTER_REPLY ), - }, - .name = "GLOBAL", - .packet_is_valid = global_packet_is_valid, - .packet_dump = global_packet_dump, -}; - -static bool global_packet_is_valid(xpacket_t *pack) -{ - const xproto_entry_t *xe; - - //DBG(GENERAL, "\n"); - xe = xproto_global_entry(XPACKET_OP(pack)); - return xe != NULL; -} - -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 60 - -int run_initialize_registers(xpd_t *xpd) -{ - int ret; - xbus_t *xbus; - char busstr[MAX_ENV_STR]; - char unitstr[MAX_ENV_STR]; - char subunitsstr[MAX_ENV_STR]; - char typestr[MAX_ENV_STR]; - char directionstr[MAX_ENV_STR]; - char revstr[MAX_ENV_STR]; - char connectorstr[MAX_ENV_STR]; - char init_card[MAX_PATH_STR]; - byte direction_mask; - int i; - char *argv[] = { - init_card, - NULL - }; - char *envp[] = { - busstr, - unitstr, - subunitsstr, - typestr, - directionstr, - revstr, - connectorstr, - NULL - }; - - BUG_ON(!xpd); - xbus = xpd->xbus; - if(!initdir || !initdir[0]) { - XPD_NOTICE(xpd, "Missing initdir parameter\n"); - return -EINVAL; - } - direction_mask = 0; - for(i = 0; i < xpd->subunits; i++) { - xpd_t *su = xpd_byaddr(xbus, xpd->addr.unit, i); - - if(!su) { - XPD_ERR(xpd, - "Have %d subunits, but not subunit #%d\n", - xpd->subunits, i); - continue; - } - direction_mask |= (su->direction == TO_PHONE) ? BIT(i) : 0; - } - snprintf(busstr, MAX_ENV_STR, "XBUS_NAME=%s", xbus->busname); - 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); - snprintf(directionstr, MAX_ENV_STR, "UNIT_SUBUNITS_DIR=%d", direction_mask); - snprintf(revstr, MAX_ENV_STR, "XBUS_REVISION=%d", xbus->revision); - snprintf(connectorstr, MAX_ENV_STR, "XBUS_CONNECTOR=%s", xbus->location); - if(snprintf(init_card, MAX_PATH_STR, "%s/init_card_%d_%d", - initdir, xpd->type, xbus->revision) > MAX_PATH_STR) { - XPD_NOTICE(xpd, "Cannot initialize. pathname is longer than %d characters.\n", MAX_PATH_STR); - return -E2BIG; - } - if(!XBUS_GET(xbus)) { - XBUS_ERR(xbus, "Skipped register initialization. XBUS is going down\n"); - return -ENODEV; - } - XPD_DBG(DEVICES, xpd, "running '%s' for type=%d revision=%d\n", - init_card, xpd->type, xbus->revision); - ret = call_usermodehelper(init_card, argv, envp, 1); - /* - * Carefully report results - */ - if(ret == 0) - XPD_DBG(DEVICES, xpd, "'%s' finished OK\n", init_card); - else if(ret < 0) { - XPD_ERR(xpd, "Failed running '%s' (errno %d)\n", init_card, ret); - } else { - byte exitval = ((unsigned)ret >> 8) & 0xFF; - byte sigval = ret & 0xFF; - - if(!exitval) { - XPD_ERR(xpd, "'%s' killed by signal %d\n", init_card, sigval); - } else { - XPD_ERR(xpd, "'%s' aborted with exitval %d\n", init_card, exitval); - } - ret = -EINVAL; - } - XBUS_PUT(xbus); - return ret; -} - -EXPORT_SYMBOL(sync_mode_name); -EXPORT_SYMBOL(run_initialize_registers); -EXPORT_SYMBOL(xpp_register_request); -EXPORT_SYMBOL(send_multibyte_request); diff --git a/zaptel/kernel/xpp/card_global.h b/zaptel/kernel/xpp/card_global.h deleted file mode 100644 index c71f74da..00000000 --- a/zaptel/kernel/xpp/card_global.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef CARD_GLOBAL_H -#define CARD_GLOBAL_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xdefs.h" -#include "xbus-pcm.h" - -enum global_opcodes { - XPROTO_NAME(GLOBAL, AB_REQUEST) = 0x07, - XPROTO_NAME(GLOBAL, AB_DESCRIPTION) = 0x08, - XPROTO_NAME(GLOBAL, REGISTER_REQUEST) = 0x0F, - XPROTO_NAME(GLOBAL, REGISTER_REPLY) = 0x10, -/**/ - XPROTO_NAME(GLOBAL, PCM_WRITE) = 0x11, - XPROTO_NAME(GLOBAL, PCM_READ) = 0x12, -/**/ - XPROTO_NAME(GLOBAL, SYNC_SOURCE) = 0x19, - XPROTO_NAME(GLOBAL, SYNC_REPLY) = 0x1A, -/**/ - XPROTO_NAME(GLOBAL, ERROR_CODE) = 0x22, - XPROTO_NAME(GLOBAL, RESET_SYNC_COUNTERS) = 0x23, - XPROTO_NAME(GLOBAL, NULL_REPLY) = 0xFE, -}; - -struct unit_descriptor { - struct xpd_addr addr; - byte subtype:4; - byte type:4; - byte numchips; - byte ports_per_chip; - byte port_dir; /* bitmask: 0 - PSTN, 1 - PHONE */ - byte reserved[2]; - struct xpd_addr ec_addr; -}; - -#define NUM_UNITS 6 - -DEF_RPACKET_DATA(GLOBAL, NULL_REPLY); -DEF_RPACKET_DATA(GLOBAL, AB_REQUEST, - byte rev; - byte reserved; - ); -DEF_RPACKET_DATA(GLOBAL, AB_DESCRIPTION, - byte rev; - byte reserved[3]; - struct unit_descriptor unit_descriptor[NUM_UNITS]; - ); -DEF_RPACKET_DATA(GLOBAL, REGISTER_REQUEST, - reg_cmd_t reg_cmd; - ); -DEF_RPACKET_DATA(GLOBAL, PCM_WRITE, - xpp_line_t lines; - byte pcm[PCM_CHUNKSIZE]; - ); -DEF_RPACKET_DATA(GLOBAL, PCM_READ, - xpp_line_t lines; - byte pcm[PCM_CHUNKSIZE]; - ); -DEF_RPACKET_DATA(GLOBAL, SYNC_SOURCE, - byte sync_mode; - byte drift; - ); -DEF_RPACKET_DATA(GLOBAL, SYNC_REPLY, - byte sync_mode; - byte drift; - ); -DEF_RPACKET_DATA(GLOBAL, REGISTER_REPLY, - reg_cmd_t regcmd; - ); -DEF_RPACKET_DATA(GLOBAL, RESET_SYNC_COUNTERS, - byte mask; - ); -DEF_RPACKET_DATA(GLOBAL, ERROR_CODE, - byte errorcode; - byte bad_packet[0]; - ); - -/* 0x07 */ DECLARE_CMD(GLOBAL, AB_REQUEST); -/* 0x19 */ DECLARE_CMD(GLOBAL, SYNC_SOURCE, enum sync_mode mode, int drift); -/* 0x23 */ DECLARE_CMD(GLOBAL, RESET_SYNC_COUNTERS); - -void chip_proc_remove(xbus_t *xbus, xpd_t *xpd); -int chip_proc_create(xbus_t *xbus, xpd_t *xpd); -int xpp_register_request(xbus_t *xbus, xpd_t *xpd, xportno_t portno, - bool writing, byte regnum, bool do_subreg, byte subreg, - byte data_low, bool do_datah, byte data_high, bool should_reply); -int send_multibyte_request(xbus_t *xbus, unsigned unit, xportno_t portno, - bool eoftx, byte *buf, unsigned len); -extern xproto_table_t PROTO_TABLE(GLOBAL); -int run_initialize_registers(xpd_t *xpd); -extern charp initdir; - -#endif /* CARD_GLOBAL_H */ diff --git a/zaptel/kernel/xpp/card_pri.c b/zaptel/kernel/xpp/card_pri.c deleted file mode 100644 index 3f6dac24..00000000 --- a/zaptel/kernel/xpp/card_pri.c +++ /dev/null @@ -1,1845 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * Parts derived from Cologne demo driver for the chip. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include "xpd.h" -#include "xproto.h" -#include "xpp_zap.h" -#include "card_pri.h" -#include "zap_debug.h" -#include "xpd.h" -#include "xbus-core.h" - -static const char rcsid[] = "$Id: card_pri.c 4474 2008-08-11 14:00:30Z tzafrir $"; - -static DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); /* must be before zap_debug.h */ -static DEF_PARM(uint, poll_interval, 500, 0644, "Poll channel state interval in milliseconds (0 - disable)"); - -#define PRI_LINES_BITMASK BITMASK(31) -#define PRI_DCHAN_SIGCAP ( \ - ZT_SIG_EM | \ - ZT_SIG_CLEAR | \ - ZT_SIG_FXSLS | \ - ZT_SIG_FXSGS | \ - ZT_SIG_FXSKS | \ - ZT_SIG_FXOLS | \ - ZT_SIG_FXOGS | \ - ZT_SIG_FXOKS | \ - ZT_SIG_CAS | \ - ZT_SIG_DACS | \ - ZT_SIG_SF \ - ) -#define PRI_BCHAN_SIGCAP (ZT_SIG_CLEAR | ZT_SIG_DACS | ZT_SIG_CAS) -#define MAX_SLAVES 4 /* we have MUX of 4 clocks */ - -#define PRI_PORT(xpd) ((xpd)->addr.subunit) - -/*---------------- PRI Protocol Commands ----------------------------------*/ - -static bool pri_packet_is_valid(xpacket_t *pack); -static void pri_packet_dump(const char *msg, xpacket_t *pack); -static int proc_pri_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); -static int proc_pri_info_write(struct file *file, const char __user *buffer, unsigned long count, void *data); -static int pri_startup(struct zt_span *span); -static int pri_shutdown(struct zt_span *span); -static int pri_rbsbits(struct zt_chan *chan, int bits); -static int pri_lineconfig(xpd_t *xpd, int lineconfig); - -#define PROC_REGISTER_FNAME "slics" -#define PROC_PRI_INFO_FNAME "pri_info" - -enum pri_protocol { - PRI_PROTO_0 = 0, - PRI_PROTO_E1 = 1, - PRI_PROTO_T1 = 2, - PRI_PROTO_J1 = 3 -}; - -static const char *pri_protocol_name(enum pri_protocol pri_protocol) -{ - static const char *protocol_names[] = { - [PRI_PROTO_0] = "??", /* unkown */ - [PRI_PROTO_E1] = "E1", - [PRI_PROTO_T1] = "T1", - [PRI_PROTO_J1] = "J1" - }; - return protocol_names[pri_protocol]; -} - -static int pri_num_channels(enum pri_protocol pri_protocol) -{ - static int num_channels[] = { - [PRI_PROTO_0] = 0, - [PRI_PROTO_E1] = 31, - [PRI_PROTO_T1] = 24, - [PRI_PROTO_J1] = 0 - }; - return num_channels[pri_protocol]; -} - -static const char *type_name(enum pri_protocol pri_protocol, bool is_nt) -{ - static const char *names[2][4] = { - /* TE */ [0] = { - [PRI_PROTO_0] = "Unknown_TE", - [PRI_PROTO_E1] = "E1_TE", - [PRI_PROTO_T1] = "T1_TE", - [PRI_PROTO_J1] = "J1_TE" - }, - /* NT */ [1] = { - [PRI_PROTO_0] = "Unknown_NT", - [PRI_PROTO_E1] = "E1_NT", - [PRI_PROTO_T1] = "T1_NT", - [PRI_PROTO_J1] = "J1_NT" - } - }; - int term = (is_nt) ? 1 : 0; - - return names[term][pri_protocol]; -} - -static int pri_linecompat(enum pri_protocol pri_protocol) -{ - static const int linecompat[] = { - [PRI_PROTO_0] = 0, - [PRI_PROTO_E1] = - /* coding */ - ZT_CONFIG_CCS | - ZT_CONFIG_CRC4 | - /* framing */ - ZT_CONFIG_AMI | ZT_CONFIG_HDB3, - [PRI_PROTO_T1] = - /* coding */ - // ZT_CONFIG_D4 | - ZT_CONFIG_ESF | - /* framing */ - ZT_CONFIG_AMI | ZT_CONFIG_B8ZS, - [PRI_PROTO_J1] = 0 - }; - - DBG(GENERAL, "pri_linecompat: pri_protocol=%d\n", pri_protocol); - return linecompat[pri_protocol]; -} - -#define PRI_DCHAN_IDX(priv) ((priv)->dchan_num - 1) - -enum pri_led_state { - PRI_LED_OFF = 0x0, - PRI_LED_ON = 0x1, - /* - * We blink by software from driver, so that - * if the driver malfunction that blink would stop. - */ - // PRI_LED_BLINK_SLOW = 0x2, /* 1/2 a second blink cycle */ - // PRI_LED_BLINK_FAST = 0x3 /* 1/4 a second blink cycle */ -}; - -enum pri_led_selectors { - TE_RED_LED = 0, - TE_GREEN_LED = 1, - NT_RED_LED = 2, - NT_GREEN_LED = 3, -}; - -#define NUM_LEDS 4 - -struct pri_leds { - byte state:2; /* enum pri_led_state */ - byte led_sel:2; /* enum pri_led_selectors */ - byte reserved:4; -}; - -#define REG_FRS0 0x4C /* Framer Receive Status Register 0 */ -#define REG_FRS0_T1_FSR BIT(0) /* T1 - Frame Search Restart Flag */ -#define REG_FRS0_LMFA BIT(1) /* Loss of Multiframe Alignment */ -#define REG_FRS0_E1_NMF BIT(2) /* E1 - No Multiframe Alignment Found */ -#define REG_FRS0_RRA BIT(4) /* Receive Remote Alarm: T1-YELLOW-Alarm */ -#define REG_FRS0_LFA BIT(5) /* Loss of Frame Alignment */ -#define REG_FRS0_AIS BIT(6) /* Alarm Indication Signal: T1-BLUE-Alarm */ -#define REG_FRS0_LOS BIT(7) /* Los Of Signal: T1-RED-Alarm */ - -#define REG_FRS1 0x4D /* Framer Receive Status Register 1 */ - -#define REG_LIM0 0x36 -#define REG_LIM0_MAS BIT(0) /* Master Mode, DCO-R circuitry is frequency - synchronized to the clock supplied by SYNC */ -#define REG_LIM0_RTRS BIT(5) /* - * Receive Termination Resistance Selection: - * integrated resistor to create 75 Ohm termination (100 || 300 = 75) - * 0 = 100 Ohm - * 1 = 75 Ohm - */ -#define REG_LIM0_LL BIT(1) /* LL (Local Loopback) */ - -#define REG_IMR0_E 0x14 /* Interrupt Mask Register 0 */ -#define REG_IMR0_E_CASC BIT(3) - -#define REG_FMR0 0x1C -#define REG_FMR0_E_RC0 BIT(4) /* Receive Code - LSB */ -#define REG_FMR0_E_RC1 BIT(5) /* Receive Code - MSB */ -#define REG_FMR0_E_XC0 BIT(6) /* Transmit Code - LSB */ -#define REG_FMR0_E_XC1 BIT(7) /* Transmit Code - MSB */ - -#define REG_FMR1 0x1D -#define REG_FMR1_XAIS BIT(0) /* Transmit AIS toward transmit end */ -#define REG_FMR1_SSD0 BIT(1) -#define REG_FMR1_ECM BIT(2) -#define REG_FMR1_XFS BIT(3) /* Transmit Framing Select */ -#define REG_FMR1_PMOD BIT(4) /* E1 = 0, T1/J1 = 1 */ -#define REG_FMR1_EDL BIT(5) -#define REG_FMR1_AFR BIT(6) - -#define REG_FMR2 0x1E -#define REG_FMR2_E_ALMF BIT(0) /* Automatic Loss of Multiframe */ -#define REG_FMR2_T_EXZE BIT(0) /* Excessive Zeros Detection Enable */ -#define REG_FMR2_E_AXRA BIT(1) /* Automatic Transmit Remote Alarm */ -#define REG_FMR2_T_AXRA BIT(1) /* Automatic Transmit Remote Alarm */ -#define REG_FMR2_E_PLB BIT(2) /* Payload Loop-Back */ -#define REG_FMR2_E_RFS0 BIT(6) /* Receive Framing Select - LSB */ -#define REG_FMR2_E_RFS1 BIT(7) /* Receive Framing Select - MSB */ -#define REG_FMR2_T_SSP BIT(5) /* Select Synchronization/Resynchronization Procedure */ -#define REG_FMR2_T_MCSP BIT(6) /* Multiple Candidates Synchronization Procedure */ -#define REG_FMR2_T_AFRS BIT(7) /* Automatic Force Resynchronization */ - -#define REG_FMR3 0x31 -#define REG_FMR3_EXTIW BIT(0) /* Extended CRC4 to Non-CRC4 Interworking */ - -#define REG_FMR4 0x20 -#define REG_FMR4_FM0 BIT(0) -#define REG_FMR4_FM1 BIT(1) -#define REG_FMR4_AUTO BIT(2) -#define REG_FMR4_SSC0 BIT(3) -#define REG_FMR4_SSC1 BIT(4) -#define REG_FMR4_XRA BIT(5) /* Transmit Remote Alarm (Yellow Alarm) */ -#define REG_FMR4_TM BIT(6) -#define REG_FMR4_AIS3 BIT(7) - -#define REG_XSW_E 0x20 -#define REG_XSW_E_XY4 BIT(0) -#define REG_XSW_E_XY3 BIT(1) -#define REG_XSW_E_XY2 BIT(2) -#define REG_XSW_E_XY1 BIT(3) -#define REG_XSW_E_XY0 BIT(4) -#define REG_XSW_E_XRA BIT(5) /* Transmit Remote Alarm (Yellow Alarm) */ -#define REG_XSW_E_XTM BIT(6) -#define REG_XSW_E_XSIS BIT(7) - -#define REG_XSP_E 0x21 -#define REG_FMR5_T 0x21 -#define REG_XSP_E_XSIF BIT(2) /* Transmit Spare Bit For International Use (FAS Word) */ -#define REG_FMR5_T_XTM BIT(2) /* Transmit Transparent Mode */ -#define REG_XSP_E_AXS BIT(3) /* Automatic Transmission of Submultiframe Status */ -#define REG_XSP_E_EBP BIT(4) /* E-Bit Polarity, Si-bit position of every outgoing CRC multiframe */ -#define REG_XSP_E_CASEN BIT(6) /* CAS: Channel Associated Signaling Enable */ - -#define REG_RC0 0x24 -#define REG_RC0_SJR BIT(7) /* T1 = 0, J1 = 1 */ - -#define REG_CMR1 0x44 -#define REG_CMR1_DRSS (BIT(7) | BIT(6)) -#define REG_CMR1_RS (BIT(5) | BIT(4)) -#define REG_CMR1_STF BIT(2) - -#define REG_RS1_E 0x70 /* Receive CAS Register 1 */ -#define REG_RS2_E 0x71 /* Receive CAS Register 2 */ -#define REG_RS3_E 0x72 /* Receive CAS Register 3 */ -#define REG_RS4_E 0x73 /* Receive CAS Register 4 */ -#define REG_RS5_E 0x74 /* Receive CAS Register 5 */ -#define REG_RS6_E 0x75 /* Receive CAS Register 6 */ -#define REG_RS7_E 0x76 /* Receive CAS Register 7 */ -#define REG_RS8_E 0x77 /* Receive CAS Register 8 */ -#define REG_RS9_E 0x78 /* Receive CAS Register 9 */ -#define REG_RS10_E 0x79 /* Receive CAS Register 10 */ -#define REG_RS11_E 0x7A /* Receive CAS Register 11 */ -#define REG_RS12_E 0x7B /* Receive CAS Register 12 */ -#define REG_RS13_E 0x7C /* Receive CAS Register 13 */ -#define REG_RS14_E 0x7D /* Receive CAS Register 14 */ -#define REG_RS15_E 0x7E /* Receive CAS Register 15 */ -#define REG_RS16_E 0x7F /* Receive CAS Register 16 */ - -#define NUM_CAS_RS (REG_RS16_E - REG_RS2_E + 1) - -struct PRI_priv_data { - bool is_nt; - bool clock_source; - struct proc_dir_entry *pri_info; - enum pri_protocol pri_protocol; - int deflaw; - unsigned int dchan_num; - bool initialized; - bool is_cas; - byte cas_rs_e[NUM_CAS_RS]; - byte cas_ts_e[NUM_CAS_RS]; - uint cas_replies; - bool local_loopback; - uint poll_noreplies; - uint layer1_replies; - byte reg_frs0; - byte reg_frs1; - bool layer1_up; - int alarms; - byte dchan_tx_sample; - byte dchan_rx_sample; - uint dchan_tx_counter; - uint dchan_rx_counter; - bool dchan_alive; - uint dchan_alive_ticks; - enum pri_led_state ledstate[NUM_LEDS]; -}; - -static xproto_table_t PROTO_TABLE(PRI); - -DEF_RPACKET_DATA(PRI, SET_LED, /* Set one of the LED's */ - struct pri_leds pri_leds; - ); - - -static /* 0x33 */ DECLARE_CMD(PRI, SET_LED, enum pri_led_selectors led_sel, enum pri_led_state to_led_state); - -#define DO_LED(xpd, which, tostate) \ - CALL_PROTO(PRI, SET_LED, (xpd)->xbus, (xpd), (which), (tostate)) - -/*---------------- PRI: Methods -------------------------------------------*/ - -static int query_subunit(xpd_t *xpd, byte regnum) -{ - XPD_DBG(REGS, xpd, "(%d%d): REG=0x%02X\n", - xpd->addr.unit, xpd->addr.subunit, - regnum); - return xpp_register_request( - xpd->xbus, xpd, - PRI_PORT(xpd), /* portno */ - 0, /* writing */ - regnum, - 0, /* do_subreg */ - 0, /* subreg */ - 0, /* data_L */ - 0, /* do_datah */ - 0, /* data_H */ - 0 /* should_reply */ - ); -} - - -static int write_subunit(xpd_t *xpd, byte regnum, byte val) -{ - XPD_DBG(REGS, xpd, "(%d%d): REG=0x%02X dataL=0x%02X\n", - xpd->addr.unit, xpd->addr.subunit, - regnum, val); - return xpp_register_request( - xpd->xbus, xpd, - PRI_PORT(xpd), /* portno */ - 1, /* writing */ - regnum, - 0, /* do_subreg */ - 0, /* subreg */ - val, /* data_L */ - 0, /* do_datah */ - 0, /* data_H */ - 0 /* should_reply */ - ); -} - -static int pri_write_reg(xpd_t *xpd, int regnum, byte val) -{ - XPD_DBG(REGS, xpd, "(%d%d): REG=0x%02X dataL=0x%02X\n", - xpd->addr.unit, xpd->addr.subunit, - regnum, val); - return xpp_register_request( - xpd->xbus, xpd, - PRI_PORT(xpd), /* portno */ - 1, /* writing */ - regnum, - 0, /* do_subreg */ - 0, /* subreg */ - val, /* data_L */ - 0, /* do_datah */ - 0, /* data_H */ - 0 /* should_reply */ - ); -} - -static void pri_proc_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(PROC, xpd, "\n"); -#ifdef CONFIG_PROC_FS - if(priv->pri_info) { - XPD_DBG(PROC, xpd, "Removing xpd PRI_INFO file\n"); - remove_proc_entry(PROC_PRI_INFO_FNAME, xpd->proc_xpd_dir); - } -#endif -} - -static int pri_proc_create(xbus_t *xbus, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(PROC, xpd, "\n"); -#ifdef CONFIG_PROC_FS - XPD_DBG(PROC, xpd, "Creating PRI_INFO file\n"); - priv->pri_info = create_proc_entry(PROC_PRI_INFO_FNAME, 0644, xpd->proc_xpd_dir); - if(!priv->pri_info) { - XPD_ERR(xpd, "Failed to create proc '%s'\n", PROC_PRI_INFO_FNAME); - goto err; - } - priv->pri_info->owner = THIS_MODULE; - priv->pri_info->write_proc = proc_pri_info_write; - priv->pri_info->read_proc = proc_pri_info_read; - priv->pri_info->data = xpd; -#endif - return 0; -err: - pri_proc_remove(xbus, xpd); - return -EINVAL; -} - -static bool valid_pri_modes(const xpd_t *xpd) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - if( - priv->pri_protocol != PRI_PROTO_E1 && - priv->pri_protocol != PRI_PROTO_T1 && - priv->pri_protocol != PRI_PROTO_J1) - return 0; - return 1; -} - -static void pri_pcm_update(xpd_t *xpd) -{ - struct PRI_priv_data *priv; - int channels = xpd->channels; - xpp_line_t mask = BITMASK(xpd->channels); - - priv = xpd->priv; - if(priv->is_cas) { - /* CAS: Don't send PCM to D-Channel */ - channels--; - mask &= ~BIT(PRI_DCHAN_IDX(priv)); - } - xpd->pcm_len = RPACKET_HEADERSIZE + sizeof(xpp_line_t) + channels * ZT_CHUNKSIZE; - xpd->wanted_pcm_mask = mask; -} - -/* - * Set E1/T1/J1 - * May only be called on unregistered xpd's - * (the span and channel description are set according to this) - */ -static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto) -{ - struct PRI_priv_data *priv; - int deflaw; - unsigned int dchan_num; - int default_lineconfig = 0; - int ret; - - BUG_ON(!xpd); - priv = xpd->priv; - if(SPAN_REGISTERED(xpd)) { - XPD_NOTICE(xpd, "Registered as span %d. Cannot do setup pri protocol (%s)\n", - xpd->span.spanno, __FUNCTION__); - return -EBUSY; - } - if(priv->pri_protocol != PRI_PROTO_0) { - if(priv->pri_protocol == set_proto) { - XPD_NOTICE(xpd, "Already in protocol %s. Ignored\n", pri_protocol_name(set_proto)); - return 0; - } else { - XPD_INFO(xpd, "Switching from %s to %s\n", - pri_protocol_name(priv->pri_protocol), - pri_protocol_name(set_proto)); - } - } - switch(set_proto) { - case PRI_PROTO_E1: - deflaw = ZT_LAW_ALAW; - dchan_num = 16; - default_lineconfig = ZT_CONFIG_CRC4 | ZT_CONFIG_HDB3; - break; - case PRI_PROTO_T1: - deflaw = ZT_LAW_MULAW; - dchan_num = 24; - default_lineconfig = ZT_CONFIG_ESF | ZT_CONFIG_B8ZS; - break; - case PRI_PROTO_J1: - /* - * Check all assumptions - */ - deflaw = ZT_LAW_MULAW; - dchan_num = 24; - default_lineconfig = 0; /* FIXME: J1??? */ - XPD_NOTICE(xpd, "J1 is not supported yet\n"); - return -ENOSYS; - default: - XPD_ERR(xpd, "%s: Unknown pri protocol = %d\n", - __FUNCTION__, set_proto); - return -EINVAL; - } - priv->pri_protocol = set_proto; - xpd->channels = pri_num_channels(set_proto); - pri_pcm_update(xpd); - priv->deflaw = deflaw; - priv->dchan_num = dchan_num; - priv->local_loopback = 0; - xpd->type_name = type_name(priv->pri_protocol, priv->is_nt); - XPD_DBG(GENERAL, xpd, "%s, channels=%d, dchan_num=%d, deflaw=%d\n", - pri_protocol_name(set_proto), - xpd->channels, - priv->dchan_num, - priv->deflaw - ); - /* - * Must set default now, so layer1 polling (Register REG_FRS0) would - * give reliable results. - */ - ret = pri_lineconfig(xpd, default_lineconfig); - if(ret) { - XPD_NOTICE(xpd, "Failed setting PRI default line config\n"); - return ret; - } - return 0; -} - -static void zap_update_syncsrc(xpd_t *xpd) -{ - struct PRI_priv_data *priv; - xpd_t *subxpd; - int best_spanno = 0; - int i; - - if(!SPAN_REGISTERED(xpd)) - return; - for(i = 0; i < MAX_SLAVES; i++) { - subxpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, i); - if(!subxpd) - continue; - priv = subxpd->priv; - if(priv->clock_source) { - if(best_spanno) - XPD_ERR(xpd, "Duplicate XPD's with clock_source=1\n"); - best_spanno = subxpd->span.spanno; - } - } - for(i = 0; i < MAX_SLAVES; i++) { - subxpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, i); - if(!subxpd) - continue; - if(subxpd->span.syncsrc == best_spanno) - XPD_DBG(SYNC, xpd, "Setting SyncSource to span %d\n", best_spanno); - else - XPD_DBG(SYNC, xpd, "Slaving to span %d\n", best_spanno); - subxpd->span.syncsrc = best_spanno; - } -} - -/* - * Called from: - * - set_master_mode() -- - * As a result of ztcfg or writing to /proc/xpp/XBUS-??/XPD-/??/pri_info - * - layer1_state() -- - * As a result of an alarm. - */ -static void set_clocking(xpd_t *xpd) -{ - xbus_t *xbus; - xpd_t *best_xpd = NULL; - int best_subunit = -1; /* invalid */ - int best_subunit_prio = 0; - int i; - - xbus = get_xbus(xpd->xbus->num); - /* Find subunit with best timing priority */ - for(i = 0; i < MAX_SLAVES; i++) { - struct PRI_priv_data *priv; - xpd_t *subxpd; - - subxpd = xpd_byaddr(xbus, xpd->addr.unit, i); - if(!subxpd) - continue; - priv = subxpd->priv; - if(priv->alarms != 0) - continue; - if(subxpd->timing_priority > best_subunit_prio) { - best_xpd = subxpd; - best_subunit = i; - best_subunit_prio = subxpd->timing_priority; - } - } - /* Now set it */ - if(best_xpd && ((struct PRI_priv_data *)(best_xpd->priv))->clock_source == 0) { - byte cmr1_val = - REG_CMR1_RS | - REG_CMR1_STF | - (REG_CMR1_DRSS & (best_subunit << 6)); - XPD_DBG(SYNC, best_xpd, - "ClockSource Set: cmr1=0x%02X\n", cmr1_val); - pri_write_reg(xpd, REG_CMR1, cmr1_val); - ((struct PRI_priv_data *)(best_xpd->priv))->clock_source = 1; - } - /* clear old clock sources */ - for(i = 0; i < MAX_SLAVES; i++) { - struct PRI_priv_data *priv; - xpd_t *subxpd; - - subxpd = xpd_byaddr(xbus, xpd->addr.unit, i); - if(subxpd && subxpd != best_xpd) { - XPD_DBG(SYNC, subxpd, "Clearing clock source\n"); - priv = subxpd->priv; - priv->clock_source = 0; - } - } - zap_update_syncsrc(xpd); - put_xbus(xbus); -} - -static void set_reg_lim0(const char *msg, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - bool is_master_mode; - bool localloop; - byte lim0 = 0; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - is_master_mode = xpd->timing_priority == 0; - localloop = priv->local_loopback; - lim0 |= (localloop) ? REG_LIM0_LL : 0; - if(is_master_mode) - lim0 |= REG_LIM0_MAS; - else - lim0 &= ~REG_LIM0_MAS; - XPD_DBG(SIGNAL, xpd, "%s(%s): %s, %s\n", __FUNCTION__, msg, - (is_master_mode) ? "MASTER" : "SLAVE", - (localloop) ? "LOCALLOOP" : "NO_LOCALLOOP"); - write_subunit(xpd, REG_LIM0 , lim0); -} - -/* - * Normally set by the timing parameter in zaptel.conf - * If this is called by ztcfg, than it's too late to change - * zaptel sync priority (we are already registered) - * There are two workarounds to mitigate this problem: - * 1. So we set *our* sync master at least. - * 2. And we try to call it with a sane default from set_nt() - * which is called before zaptel registration. - */ -static int set_master_mode(const char *msg, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - XPD_DBG(SIGNAL, xpd, "\n"); - priv = xpd->priv; - set_reg_lim0(__FUNCTION__, xpd); - set_clocking(xpd); - return 0; -} - -static int set_nt(const char *msg, xpd_t *xpd, bool is_nt) -{ - struct PRI_priv_data *priv; - const char *tname; - - BUG_ON(!xpd); - priv = xpd->priv; - tname = type_name(priv->pri_protocol, is_nt); - XPD_DBG(SIGNAL, xpd, "%s(%s): %s %s\n", __FUNCTION__, msg, tname, (is_nt) ? "NT" : "TE"); - if(SPAN_REGISTERED(xpd)) { - XPD_NOTICE(xpd, "Registered as span %d. Cannot do %s(%s)\n", - xpd->span.spanno, __FUNCTION__, msg); - return -EBUSY; - } - priv->is_nt = is_nt; - xpd->type_name = tname; - xpd->direction = (is_nt) ? TO_PHONE : TO_PSTN; - if(xpd->timing_priority == 0 && !is_nt) /* by default set timing priority from NT/TE */ - xpd->timing_priority = 1; - set_master_mode(msg, xpd); - return 0; -} - -static int set_localloop(const char *msg, xpd_t *xpd, bool localloop) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(SIGNAL, xpd, "(%s): %s\n", msg, (localloop)?"YES":"NO"); - if(SPAN_REGISTERED(xpd)) { - XPD_NOTICE(xpd, "Registered as span %d. Cannot do %s(%s)\n", - xpd->span.spanno, __FUNCTION__, msg); - return -EBUSY; - } - priv->local_loopback = localloop; - set_reg_lim0(__FUNCTION__, xpd); - return 0; -} - -#define VALID_CONFIG(bit,flg,str) [bit] = { .flags = flg, .name = str } - -static const struct { - const char *name; - const int flags; -} valid_spanconfigs[sizeof(unsigned int)*8] = { - /* These apply to T1 */ -// VALID_CONFIG(4, ZT_CONFIG_D4, "D4"), FIXME: should support - VALID_CONFIG(5, ZT_CONFIG_ESF, "ESF"), - VALID_CONFIG(6, ZT_CONFIG_AMI, "AMI"), - VALID_CONFIG(7, ZT_CONFIG_B8ZS, "B8ZS"), - /* These apply to E1 */ - VALID_CONFIG(8, ZT_CONFIG_CCS, "CCS"), - VALID_CONFIG(9, ZT_CONFIG_HDB3, "HDB3"), - VALID_CONFIG(10, ZT_CONFIG_CRC4, "CRC4"), -}; - -static int pri_lineconfig(xpd_t *xpd, int lineconfig) -{ - struct PRI_priv_data *priv; - const char *framingstr = ""; - const char *codingstr = ""; - const char *crcstr = ""; -#ifdef JAPANEZE_SUPPORT - byte rc0 = 0; /* FIXME: PCM offsets */ -#endif - byte fmr0 = 0; - byte fmr1 = - REG_FMR1_AFR | - REG_FMR1_ECM; - byte fmr2 = 0; - byte fmr3 = 0; /* write only for CRC4 */ - byte fmr4 = 0; - byte imr0 = 0; - byte xsp = 0; - unsigned int bad_bits; - int i; - - BUG_ON(!xpd); - priv = xpd->priv; - /* - * validate - */ - bad_bits = lineconfig & pri_linecompat(priv->pri_protocol); - bad_bits = bad_bits ^ lineconfig; - for(i = 0; i < ARRAY_SIZE(valid_spanconfigs); i++) { - unsigned int flags = valid_spanconfigs[i].flags; - - if(bad_bits & BIT(i)) { - if(flags) { - XPD_ERR(xpd, - "Bad config item '%s' for %s. Ignore\n", - valid_spanconfigs[i].name, - pri_protocol_name(priv->pri_protocol)); - } else { - /* we got real garbage */ - XPD_ERR(xpd, - "Unknown config item 0x%lX for %s. Ignore\n", - BIT(i), - pri_protocol_name(priv->pri_protocol)); - } - } - if(flags && flags != BIT(i)) { - ERR("%s: BUG: i=%d flags=0x%X\n", - __FUNCTION__, i, flags); - // BUG(); - } - } - if(bad_bits) - goto bad_lineconfig; - if(priv->pri_protocol == PRI_PROTO_E1) { - fmr2 = REG_FMR2_E_AXRA | REG_FMR2_E_ALMF; /* 0x03 */ - fmr4 = 0x9F; /* E1.XSW: All spare bits = 1*/ - xsp |= REG_XSP_E_EBP | REG_XSP_E_AXS | REG_XSP_E_XSIF; - } else if(priv->pri_protocol == PRI_PROTO_T1) { - fmr1 |= REG_FMR1_PMOD; - fmr2 = REG_FMR2_T_SSP | REG_FMR2_T_AXRA; /* 0x22 */ - fmr4 = 0x0C; - xsp |= REG_FMR5_T_XTM; - } else if(priv->pri_protocol == PRI_PROTO_J1) { - fmr1 |= REG_FMR1_PMOD; - fmr4 = 0x1C; - XPD_ERR(xpd, "J1 unsupported yet\n"); - return -ENOSYS; - } - if(priv->local_loopback) - fmr2 |= REG_FMR2_E_PLB; - /* framing first */ - if (lineconfig & ZT_CONFIG_B8ZS) { - framingstr = "B8ZS"; - fmr0 = REG_FMR0_E_XC1 | REG_FMR0_E_XC0 | REG_FMR0_E_RC1 | REG_FMR0_E_RC0; - } else if (lineconfig & ZT_CONFIG_AMI) { - framingstr = "AMI"; - fmr0 = REG_FMR0_E_XC1 | REG_FMR0_E_RC1; - } else if (lineconfig & ZT_CONFIG_HDB3) { - framingstr = "HDB3"; - fmr0 = REG_FMR0_E_XC1 | REG_FMR0_E_XC0 | REG_FMR0_E_RC1 | REG_FMR0_E_RC0; - } else { - XPD_NOTICE(xpd, "Bad lineconfig. Not (B8ZS|AMI|HDB3). Ignored.\n"); - return -EINVAL; - } - /* then coding */ - if (lineconfig & ZT_CONFIG_ESF) { - codingstr = "ESF"; - priv->is_cas = 0; - fmr4 |= REG_FMR4_FM1; - fmr2 |= REG_FMR2_T_AXRA | REG_FMR2_T_MCSP | REG_FMR2_T_SSP; - } else if (lineconfig & ZT_CONFIG_D4) { - codingstr = "D4"; - priv->is_cas = 0; - } else if (lineconfig & ZT_CONFIG_CCS) { - codingstr = "CCS"; - priv->is_cas = 0; - /* do nothing */ - } else { /* CAS */ - codingstr = "CAS"; - imr0 |= REG_IMR0_E_CASC; - xsp |= REG_XSP_E_CASEN; - priv->is_cas = 1; - } - pri_pcm_update(xpd); - /* E1's can enable CRC checking */ - if (lineconfig & ZT_CONFIG_CRC4) { - crcstr = "CRC4"; - fmr1 |= REG_FMR1_XFS; - fmr2 |= REG_FMR2_E_RFS1; - fmr3 |= REG_FMR3_EXTIW; - } - XPD_DBG(GENERAL, xpd, "[%s] lineconfig=%s/%s/%s %s (0x%X)\n", - (priv->is_nt)?"NT":"TE", - framingstr, codingstr, crcstr, - (lineconfig & ZT_CONFIG_NOTOPEN)?"YELLOW":"", - lineconfig); - set_reg_lim0(__FUNCTION__, xpd); - XPD_DBG(GENERAL, xpd, "%s: fmr1(0x%02X) = 0x%02X\n", __FUNCTION__, REG_FMR1, fmr1); - write_subunit(xpd, REG_FMR1, fmr1); - XPD_DBG(GENERAL, xpd, "%s: fmr2(0x%02X) = 0x%02X\n", __FUNCTION__, REG_FMR2, fmr2); - write_subunit(xpd, REG_FMR2, fmr2); - XPD_DBG(GENERAL, xpd, "%s: fmr0(0x%02X) = 0x%02X\n", __FUNCTION__, REG_FMR0, fmr0); - write_subunit(xpd, REG_FMR0, fmr0); - XPD_DBG(GENERAL, xpd, "%s: fmr4(0x%02X) = 0x%02X\n", __FUNCTION__, REG_FMR4, fmr4); - write_subunit(xpd, REG_FMR4, fmr4); - XPD_DBG(GENERAL, xpd, "%s: xsp(0x%02X) = 0x%02X\n", __FUNCTION__, REG_XSP_E, xsp); - write_subunit(xpd, REG_XSP_E, xsp); - if(fmr3) { - XPD_DBG(GENERAL, xpd, "%s: fmr3(0x%02X) = 0x%02X\n", __FUNCTION__, REG_FMR3, fmr3); - write_subunit(xpd, REG_FMR3, fmr3); - } -#ifdef JAPANEZE_SUPPORT - if(rc0) { - XPD_DBG(GENERAL, xpd, "%s: rc0(0x%02X) = 0x%02X\n", __FUNCTION__, REG_RC0, rc0); - write_subunit(xpd, REG_RC0, rc0); - } -#endif - XPD_DBG(GENERAL, xpd, "%s: imr0(0x%02X) = 0x%02X\n", __FUNCTION__, REG_IMR0_E, imr0); - write_subunit(xpd, REG_IMR0_E, imr0); - return 0; -bad_lineconfig: - XPD_ERR(xpd, "Bad lineconfig. Abort\n"); - return -EINVAL; -} - -/* - * Called only for 'span' keyword in /etc/zaptel.conf - */ - -static int pri_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) -{ - xpd_t *xpd = span->pvt; - struct PRI_priv_data *priv; - int ret; - - BUG_ON(!xpd); - priv = xpd->priv; - if(lc->span != xpd->span.spanno) { - XPD_ERR(xpd, "I am span %d but got spanconfig for span %d\n", - xpd->span.spanno, lc->span); - return -EINVAL; - } - /* - * FIXME: lc->name is unused by ztcfg and zaptel... - * We currently ignore it also. - */ - XPD_DBG(GENERAL, xpd, "[%s] lbo=%d lineconfig=0x%X sync=%d\n", - (priv->is_nt)?"NT":"TE", lc->lbo, lc->lineconfig, lc->sync); - ret = pri_lineconfig(xpd, lc->lineconfig); - if(!ret) { - span->lineconfig = lc->lineconfig; - xpd->timing_priority = lc->sync; - set_master_mode("spanconfig", xpd); - elect_syncer("PRI-master_mode"); - } - return ret; -} - -/* - * Set signalling type (if appropriate) - * Called from zaptel with spinlock held on chan. Must not call back - * zaptel functions. - */ -static int pri_chanconfig(struct zt_chan *chan, int sigtype) -{ - DBG(GENERAL, "channel %d (%s) -> %s\n", chan->channo, chan->name, sig2str(sigtype)); - // FIXME: sanity checks: - // - should be supported (within the sigcap) - // - should not replace fxs <->fxo ??? (covered by previous?) - return 0; -} - -static xpd_t *PRI_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, byte subtype, int subunits, bool to_phone) -{ - xpd_t *xpd = NULL; - struct PRI_priv_data *priv; - int channels = min(31, CHANNELS_PERXPD); /* worst case */ - - XBUS_DBG(GENERAL, xbus, "\n"); - xpd = xpd_alloc(sizeof(struct PRI_priv_data), proto_table, channels); - if(!xpd) - return NULL; - priv = xpd->priv; - priv->pri_protocol = PRI_PROTO_0; /* Default, changes in set_pri_proto() */ - priv->deflaw = ZT_LAW_DEFAULT; /* Default, changes in set_pri_proto() */ - xpd->type_name = - type_name(priv->pri_protocol, 0); /* Default, changes in set_nt() */ - if(xpd_common_init(xbus, xpd, unit, subunit, subtype, subunits) < 0) - goto err; - if(pri_proc_create(xbus, xpd) < 0) - goto err; - return xpd; -err: - xpd_free(xpd); - return NULL; -} - -static int PRI_card_init(xbus_t *xbus, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - int ret = 0; - xproto_table_t *proto_table; - - BUG_ON(!xpd); - XPD_DBG(GENERAL, xpd, "\n"); - xpd->type = XPD_TYPE_PRI; - proto_table = &PROTO_TABLE(PRI); - priv = xpd->priv; - if(priv->pri_protocol == PRI_PROTO_0) { - /* - * init_card_* script didn't set pri protocol - * Let's have a default E1 - */ - ret = set_pri_proto(xpd, PRI_PROTO_E1); - if(ret < 0) - goto err; - } - /* - * initialization script should have set correct - * operating modes. - */ - if(!valid_pri_modes(xpd)) { - XPD_NOTICE(xpd, "PRI protocol not set\n"); - goto err; - } - for(ret = 0; ret < NUM_LEDS; ret++) { - DO_LED(xpd, ret, PRI_LED_ON); - msleep(20); - DO_LED(xpd, ret, PRI_LED_OFF); - } - priv->initialized = 1; - return 0; -err: - pri_proc_remove(xbus, xpd); - XPD_ERR(xpd, "Failed initializing registers (%d)\n", ret); - return ret; -} - -static int PRI_card_remove(xbus_t *xbus, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - XPD_DBG(GENERAL, xpd, "\n"); - pri_proc_remove(xbus, xpd); - return 0; -} - -static int PRI_card_zaptel_preregistration(xpd_t *xpd, bool on) -{ - xbus_t *xbus; - struct PRI_priv_data *priv; - int i; - - 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), - xpd->channels, - priv->deflaw); - if(!on) { - /* Nothing to do yet */ - return 0; - } -#ifdef ZT_SPANSTAT_V2 - xpd->span.spantype = pri_protocol_name(priv->pri_protocol); -#endif - xpd->span.linecompat = pri_linecompat(priv->pri_protocol); - xpd->span.deflaw = priv->deflaw; - for_each_line(xpd, i) { - struct zt_chan *cur_chan = &xpd->chans[i]; - bool is_dchan = i == PRI_DCHAN_IDX(priv); - - XPD_DBG(GENERAL, xpd, "setting PRI channel %d (%s)\n", i, - (is_dchan)?"DCHAN":"CLEAR"); - snprintf(cur_chan->name, MAX_CHANNAME, "XPP_%s/%02d/%1d%1d/%d", - xpd->type_name, xbus->num, xpd->addr.unit, xpd->addr.subunit, i); - cur_chan->chanpos = i + 1; - cur_chan->pvt = xpd; - if(is_dchan && !priv->is_cas) { /* D-CHAN */ - cur_chan->sigcap = PRI_DCHAN_SIGCAP; - //FIXME: cur_chan->flags |= ZT_FLAG_PRIDCHAN; - cur_chan->flags &= ~ZT_FLAG_HDLC; - } else - cur_chan->sigcap = PRI_BCHAN_SIGCAP; - } - xpd->offhook = xpd->wanted_pcm_mask; - xpd->span.spanconfig = pri_spanconfig; - xpd->span.chanconfig = pri_chanconfig; - xpd->span.startup = pri_startup; - xpd->span.shutdown = pri_shutdown; - xpd->span.rbsbits = pri_rbsbits; - return 0; -} - -static int PRI_card_zaptel_postregistration(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\n", (on)?"on":"off"); - zap_update_syncsrc(xpd); - return(0); -} - -static int PRI_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig) -{ - LINE_DBG(SIGNAL, xpd, pos, "%s\n", txsig2str(txsig)); - return 0; -} - -static void dchan_state(xpd_t *xpd, bool up) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(priv->dchan_alive == up) - return; - if(!priv->layer1_up) /* No layer1, kill dchan */ - up = 0; - if(up) { - XPD_DBG(SIGNAL, xpd, "STATE CHANGE: D-Channel RUNNING\n"); - priv->dchan_alive = 1; - } else { - int d = PRI_DCHAN_IDX(priv); - - if(SPAN_REGISTERED(xpd) && d >= 0 && d < xpd->channels) { - byte *pcm; - - pcm = (byte *)xpd->span.chans[d].readchunk; - pcm[0] = 0x00; - pcm = (byte *)xpd->span.chans[d].writechunk; - pcm[0] = 0x00; - } - XPD_DBG(SIGNAL, xpd, "STATE CHANGE: D-Channel STOPPED\n"); - priv->dchan_rx_counter = priv->dchan_tx_counter = 0; - priv->dchan_alive = 0; - priv->dchan_alive_ticks = 0; - priv->dchan_rx_sample = priv->dchan_tx_sample = 0x00; - } -} - -/* - * LED managment is done by the driver now: - * - Turn constant ON RED/GREEN led to indicate NT/TE port - * - Very fast "Double Blink" to indicate Layer1 alive (without D-Channel) - * - Constant blink (1/2 sec cycle) to indicate D-Channel alive. - */ -static void handle_leds(xbus_t *xbus, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - unsigned int timer_count; - int which_led; - int other_led; - enum pri_led_state ledstate; - int mod; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(priv->is_nt) { - which_led = NT_RED_LED; - other_led = TE_GREEN_LED; - } else { - which_led = TE_GREEN_LED; - other_led = NT_RED_LED; - } - ledstate = priv->ledstate[which_led]; - timer_count = xpd->timer_count; - if(xpd->blink_mode) { - if((timer_count % DEFAULT_LED_PERIOD) == 0) { - // led state is toggled - if(ledstate == PRI_LED_OFF) { - DO_LED(xpd, which_led, PRI_LED_ON); - DO_LED(xpd, other_led, PRI_LED_ON); - } else { - DO_LED(xpd, which_led, PRI_LED_OFF); - DO_LED(xpd, other_led, PRI_LED_OFF); - } - } - return; - } - if(priv->ledstate[other_led] != PRI_LED_OFF) - DO_LED(xpd, other_led, PRI_LED_OFF); - if(priv->dchan_alive) { - mod = timer_count % 1000; - switch(mod) { - case 0: - DO_LED(xpd, which_led, PRI_LED_ON); - break; - case 500: - DO_LED(xpd, which_led, PRI_LED_OFF); - break; - } - } else if(priv->layer1_up) { - mod = timer_count % 1000; - switch(mod) { - case 0: - case 100: - DO_LED(xpd, which_led, PRI_LED_ON); - break; - case 50: - case 150: - DO_LED(xpd, which_led, PRI_LED_OFF); - break; - } - } else { - if(priv->ledstate[which_led] != PRI_LED_ON) - DO_LED(xpd, which_led, PRI_LED_ON); - } -} - -static int PRI_card_tick(xbus_t *xbus, xpd_t *xpd) -{ - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(!priv->initialized || !xbus->self_ticking) - return 0; - /* - * Poll layer1 status (cascade subunits) - */ - if(poll_interval != 0 && - ((xpd->timer_count % poll_interval) == 0)) { - priv->poll_noreplies++; - query_subunit(xpd, REG_FRS0); - //query_subunit(xpd, REG_FRS1); - } - if(priv->dchan_tx_counter >= 1 && priv->dchan_rx_counter > 1) { - dchan_state(xpd, 1); - priv->dchan_alive_ticks++; - } - handle_leds(xbus, xpd); - return 0; -} - -static int PRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg) -{ - BUG_ON(!xpd); - if(!TRANSPORT_RUNNING(xpd->xbus)) - return -ENODEV; - switch (cmd) { - case ZT_TONEDETECT: - /* - * Asterisk call all span types with this (FXS specific) - * call. Silently ignore it. - */ - LINE_DBG(SIGNAL, xpd, pos, "PRI: Starting a call\n"); - return -ENOTTY; - default: - report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd); - return -ENOTTY; - } - return 0; -} - -static int PRI_card_close(xpd_t *xpd, lineno_t pos) -{ - //struct zt_chan *chan = &xpd->span.chans[pos]; - dchan_state(xpd, 0); - return 0; -} - -/* - * Called only for 'span' keyword in /etc/zaptel.conf - */ -static int pri_startup(struct zt_span *span) -{ - xpd_t *xpd = span->pvt; - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(!TRANSPORT_RUNNING(xpd->xbus)) { - XPD_DBG(GENERAL, xpd, "Startup called by zaptel. No Hardware. Ignored\n"); - return -ENODEV; - } - XPD_DBG(GENERAL, xpd, "STARTUP\n"); - // Turn on all channels - CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 1); - return 0; -} - -/* - * Called only for 'span' keyword in /etc/zaptel.conf - */ -static int pri_shutdown(struct zt_span *span) -{ - xpd_t *xpd = span->pvt; - struct PRI_priv_data *priv; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - if(!TRANSPORT_RUNNING(xpd->xbus)) { - XPD_DBG(GENERAL, xpd, "Shutdown called by zaptel. No Hardware. Ignored\n"); - return -ENODEV; - } - XPD_DBG(GENERAL, xpd, "SHUTDOWN\n"); - // Turn off all channels - CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 0); - return 0; -} - -static int pri_rbsbits(struct zt_chan *chan, int bits) -{ - xpd_t *xpd; - struct PRI_priv_data *priv; - int pos; - byte val; - int reg_pos; - int regnum; - unsigned long flags; - - - xpd = chan->pvt; - BUG_ON(!xpd); - pos = chan->chanpos - 1; - priv = xpd->priv; - BUG_ON(!priv); - if(!priv->layer1_up) { - XPD_DBG(SIGNAL, xpd, "RBS: TX: No layer1. Ignore.\n"); - return 0; - } - if(priv->pri_protocol != PRI_PROTO_E1) { - XPD_NOTICE(xpd, "%s: protocol %s is not supported yet with CAS\n", - __FUNCTION__, pri_protocol_name(priv->pri_protocol)); - return 0; - } - if(pos == 15) - return 0; /* Don't write dchan in CAS */ - if(pos < 0 || pos > 31) { - XPD_NOTICE(xpd, "%s: pos=%d out of range. Ignore\n", __FUNCTION__, pos); - return 0; - } - spin_lock_irqsave(&xpd->lock, flags); - if(pos >= 16) { - /* Low nibble */ - reg_pos = pos - 16; - val = (priv->cas_ts_e[reg_pos] & 0xF0) | (bits & 0x0F); - } else { - /* High nibble */ - reg_pos = pos; - val = (priv->cas_ts_e[reg_pos] & 0x0F) | ((bits << 4) & 0xF0); - } - regnum = REG_RS2_E + reg_pos; - priv->cas_ts_e[reg_pos] = val; - priv->dchan_tx_counter++; - spin_unlock_irqrestore(&xpd->lock, flags); - LINE_DBG(SIGNAL, xpd, pos, "RBS: TX: bits=0x%X (reg=0x%X val=0x%02X)\n", - bits, regnum, val); - pri_write_reg(xpd, regnum, val); - return 0; -} - -/*! Copy PCM chunks from the buffers of the xpd to a new packet - * \param xbus xbus of source xpd. - * \param xpd source xpd. - * \param lines a bitmask of the active channels that need to be copied. - * \param pack packet to be filled. - * - * On PRI this function is should also shift the lines mask one bit, as - * channel 0 on the wire is an internal chip control channel. We only - * send 31 channels to the device, but they should be called 1-31 rather - * than 0-30 . - */ -static void PRI_card_pcm_fromspan(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, xpacket_t *pack) -{ - struct PRI_priv_data *priv; - byte *pcm; - struct zt_chan *chans; - unsigned long flags; - int i; - int physical_chan; - int physical_mask = 0; - - BUG_ON(!xbus); - BUG_ON(!xpd); - BUG_ON(!pack); - priv = xpd->priv; - BUG_ON(!priv); - pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm); - spin_lock_irqsave(&xpd->lock, flags); - chans = xpd->span.chans; - physical_chan = 0; - for_each_line(xpd, i) { - if(priv->pri_protocol == PRI_PROTO_E1) { - /* In E1 - Only 0'th channel is unused */ - if(i == 0) { - physical_chan++; - } - } else if(priv->pri_protocol == PRI_PROTO_T1) { - /* In T1 - Every 4'th channel is unused */ - if((i % 3) == 0) { - physical_chan++; - } - } - if(IS_SET(lines, i)) { - physical_mask |= BIT(physical_chan); - if(SPAN_REGISTERED(xpd)) { -#ifdef DEBUG_PCMTX - int channo = xpd->span.chans[i].channo; - - if(pcmtx >= 0 && pcmtx_chan == channo) - memset((u_char *)pcm, pcmtx, ZT_CHUNKSIZE); - else -#endif - memcpy((u_char *)pcm, chans[i].writechunk, ZT_CHUNKSIZE); - if(i == PRI_DCHAN_IDX(priv)) { - if(priv->dchan_tx_sample != chans[i].writechunk[0]) { - priv->dchan_tx_sample = chans[i].writechunk[0]; - priv->dchan_tx_counter++; - } else if(chans[i].writechunk[0] == 0xFF) - dchan_state(xpd, 0); - else - chans[i].writechunk[0] = 0xFF; /* Clobber for next tick */ - } - } else - memset((u_char *)pcm, ZT_XLAW(0, (&chans[i])), ZT_CHUNKSIZE); - pcm += ZT_CHUNKSIZE; - } - physical_chan++; - } - RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines) = physical_mask; - XPD_COUNTER(xpd, PCM_WRITE)++; - spin_unlock_irqrestore(&xpd->lock, flags); -} - -/*! Copy PCM chunks from the packet we recieved to the xpd struct. - * \param xbus xbus of target xpd. - * \param xpd target xpd. - * \param pack Source packet. - * - * On PRI this function is should also shift the lines back mask one bit, as - * channel 0 on the wire is an internal chip control channel. - * - * \see PRI_card_pcm_fromspan - */ -static void PRI_card_pcm_tospan(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack) -{ - struct PRI_priv_data *priv; - byte *pcm; - struct zt_chan *chans; - xpp_line_t physical_mask; - unsigned long flags; - int i; - int logical_chan; - - if(!SPAN_REGISTERED(xpd)) - return; - priv = xpd->priv; - BUG_ON(!priv); - pcm = RPACKET_FIELD(pack, GLOBAL, PCM_READ, pcm); - physical_mask = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines); - spin_lock_irqsave(&xpd->lock, flags); - chans = xpd->span.chans; - logical_chan = 0; - for (i = 0; i < CHANNELS_PERXPD; i++) { - volatile u_char *r; - - if(priv->pri_protocol == PRI_PROTO_E1) { - /* In E1 - Only 0'th channel is unused */ - if(i == 0) - continue; - } else if(priv->pri_protocol == PRI_PROTO_T1) { - /* In T1 - Every 4'th channel is unused */ - if((i % 4) == 0) - continue; - } - if(logical_chan == PRI_DCHAN_IDX(priv) && !priv->is_cas) { - if(priv->dchan_rx_sample != pcm[0]) { - if(debug & DBG_PCM) { - XPD_INFO(xpd, "RX-D-Chan: prev=0x%X now=0x%X\n", - priv->dchan_rx_sample, pcm[0]); - dump_packet("RX-D-Chan", pack, 1); - } - priv->dchan_rx_sample = pcm[0]; - priv->dchan_rx_counter++; - } else if(pcm[0] == 0xFF) - dchan_state(xpd, 0); - } - if(IS_SET(physical_mask, i)) { - r = chans[logical_chan].readchunk; - // memset((u_char *)r, 0x5A, ZT_CHUNKSIZE); // DEBUG - // fill_beep((u_char *)r, 1, 1); // DEBUG: BEEP - memcpy((u_char *)r, pcm, ZT_CHUNKSIZE); - pcm += ZT_CHUNKSIZE; - } - logical_chan++; - } - XPD_COUNTER(xpd, PCM_READ)++; - spin_unlock_irqrestore(&xpd->lock, flags); -} - -/*---------------- PRI: HOST COMMANDS -------------------------------------*/ - -static /* 0x0F */ HOSTCMD(PRI, XPD_STATE, bool on) -{ - BUG_ON(!xpd); - XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off"); - return 0; -} - -static /* 0x33 */ HOSTCMD(PRI, SET_LED, enum pri_led_selectors led_sel, enum pri_led_state to_led_state) -{ - int ret = 0; - xframe_t *xframe; - xpacket_t *pack; - struct pri_leds *pri_leds; - struct PRI_priv_data *priv; - - BUG_ON(!xbus); - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - XPD_DBG(LEDS, xpd, "led_sel=%d to_state=%d\n", led_sel, to_led_state); - XFRAME_NEW_CMD(xframe, pack, xbus, PRI, SET_LED, xpd->xbus_idx); - pri_leds = &RPACKET_FIELD(pack, PRI, SET_LED, pri_leds); - pri_leds->state = to_led_state; - pri_leds->led_sel = led_sel; - pri_leds->reserved = 0; - XPACKET_LEN(pack) = RPACKET_SIZE(PRI, SET_LED); - ret = send_cmd_frame(xbus, xframe); - priv->ledstate[led_sel] = to_led_state; - return ret; -} - -/*---------------- PRI: Astribank Reply Handlers --------------------------*/ -static void layer1_state(xpd_t *xpd, byte data_low) -{ - struct PRI_priv_data *priv; - int alarms = 0; - - BUG_ON(!xpd); - priv = xpd->priv; - BUG_ON(!priv); - priv->poll_noreplies = 0; - if(data_low & REG_FRS0_LOS) - alarms |= ZT_ALARM_RED; - if(data_low & REG_FRS0_AIS) - alarms |= ZT_ALARM_BLUE; - if(data_low & REG_FRS0_RRA) - alarms |= ZT_ALARM_YELLOW; - priv->layer1_up = alarms == 0; -#if 0 - /* - * Some bad bits (e.g: LMFA and NMF have no alarm "colors" - * associated. However, layer1 is still not working if they are set. - * FIXME: These behave differently in E1/T1, so ignore them for while. - */ - if(data_low & (REG_FRS0_LMFA | REG_FRS0_E1_NMF)) - priv->layer1_up = 0; -#endif - priv->alarms = alarms; - if(!priv->layer1_up) - dchan_state(xpd, 0); - if(SPAN_REGISTERED(xpd) && xpd->span.alarms != alarms) { - char str1[MAX_PROC_WRITE]; - char str2[MAX_PROC_WRITE]; - - alarm2str(xpd->span.alarms, str1, sizeof(str1)); - alarm2str(alarms, str2, sizeof(str2)); - XPD_NOTICE(xpd, "Alarms: 0x%X (%s) => 0x%X (%s)\n", - xpd->span.alarms, str1, - alarms, str2); - xpd->span.alarms = alarms; - zt_alarm_notify(&xpd->span); - set_clocking(xpd); - } - priv->reg_frs0 = data_low; - priv->layer1_replies++; - XPD_DBG(REGS, xpd, "subunit=%d data_low=0x%02X\n", xpd->addr.subunit, data_low); -} - -static void process_cas_dchan(xpd_t *xpd, byte regnum, byte data_low) -{ - struct PRI_priv_data *priv; - uint pos = regnum - REG_RS2_E; - int rsnum = pos + 2; - int chan1 = pos; - int chan2 = pos + 16; - - priv = xpd->priv; - if(!priv->is_cas) - return; - if(pos < 0 || pos >= NUM_CAS_RS) { - XPD_ERR(xpd, "%s: got bad pos=%d [0-%d]\n", __FUNCTION__, pos, NUM_CAS_RS); - return; - } - priv->cas_replies++; - if(priv->cas_rs_e[pos] != data_low) { - int old1 = (priv->cas_rs_e[pos] >> 4) & 0xF; - int old2 = priv->cas_rs_e[pos] & 0xF; - int new1 = (data_low >> 4) & 0xF; - int new2 = data_low & 0xF; - - XPD_DBG(SIGNAL, xpd, "RBS: RX: RS%02d (channel %2d, channel %2d): 0x%02X -> 0x%02X\n", - rsnum, chan1+1, chan2+1, priv->cas_rs_e[pos], data_low); - if(SPAN_REGISTERED(xpd)) { - if(old1 != new1) - zt_rbsbits(&xpd->span.chans[chan1], new1); - if(old2 != new2) - zt_rbsbits(&xpd->span.chans[chan2], new2); - } - priv->dchan_rx_counter++; - priv->cas_rs_e[pos] = data_low; - } else { - XPD_DBG(SIGNAL, xpd, "RBS: RX: RS%02d (channel %2d, channel %2d): REPEAT 0x%02X\n", - rsnum, chan1+1, chan2+1, priv->cas_rs_e[pos]); - } -} - -static int PRI_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info) -{ - unsigned long flags; - struct PRI_priv_data *priv; - struct xpd_addr addr; - xpd_t *orig_xpd; - byte regnum; - byte data_low; - - /* Map UNIT + PORTNUM to XPD */ - orig_xpd = xpd; - addr.unit = orig_xpd->addr.unit; - addr.subunit = info->portnum; - regnum = REG_FIELD(info, regnum); - data_low = REG_FIELD(info, data_low); - xpd = xpd_byaddr(xbus, addr.unit, addr.subunit); - if(!xpd) { - static int rate_limit; - - if((rate_limit++ % 1003) < 5) - notify_bad_xpd(__FUNCTION__, xbus, addr , orig_xpd->xpdname); - return -EPROTO; - } - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - if(info->is_multibyte) { - XPD_NOTICE(xpd, "Got Multibyte: %d bytes, eoframe: %d\n", - info->bytes, info->eoframe); - goto end; - } - if(regnum == REG_FRS0 && !REG_FIELD(info, do_subreg)) - layer1_state(xpd, data_low); - else if(regnum == REG_FRS1 && !REG_FIELD(info, do_subreg)) - priv->reg_frs1 = data_low; - if(priv->is_cas && !REG_FIELD(info, do_subreg)) { - if(regnum >= REG_RS2_E && regnum <= REG_RS16_E) { - process_cas_dchan(xpd, regnum, data_low); - } - } - /* Update /proc info only if reply relate to the last slic read request */ - if( - REG_FIELD(&xpd->requested_reply, regnum) == REG_FIELD(info, regnum) && - REG_FIELD(&xpd->requested_reply, do_subreg) == REG_FIELD(info, do_subreg) && - REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) { - xpd->last_reply = *info; - } - -end: - spin_unlock_irqrestore(&xpd->lock, flags); - return 0; -} - -static xproto_table_t PROTO_TABLE(PRI) = { - .owner = THIS_MODULE, - .entries = { - /* Table Card Opcode */ - }, - .name = "PRI", /* protocol name */ - .ports_per_subunit = 1, - .type = XPD_TYPE_PRI, - .xops = { - .card_new = PRI_card_new, - .card_init = PRI_card_init, - .card_remove = PRI_card_remove, - .card_zaptel_preregistration = PRI_card_zaptel_preregistration, - .card_zaptel_postregistration = PRI_card_zaptel_postregistration, - .card_hooksig = PRI_card_hooksig, - .card_tick = PRI_card_tick, - .card_pcm_fromspan = PRI_card_pcm_fromspan, - .card_pcm_tospan = PRI_card_pcm_tospan, - .card_ioctl = PRI_card_ioctl, - .card_close = PRI_card_close, - .card_register_reply = PRI_card_register_reply, - - .XPD_STATE = XPROTO_CALLER(PRI, XPD_STATE), - }, - .packet_is_valid = pri_packet_is_valid, - .packet_dump = pri_packet_dump, -}; - -static bool pri_packet_is_valid(xpacket_t *pack) -{ - const xproto_entry_t *xe_nt = NULL; - const xproto_entry_t *xe_te = NULL; - // DBG(GENERAL, "\n"); - xe_nt = xproto_card_entry(&PROTO_TABLE(PRI), XPACKET_OP(pack)); - return xe_nt != NULL || xe_te != NULL; -} - -static void pri_packet_dump(const char *msg, xpacket_t *pack) -{ - DBG(GENERAL, "%s\n", msg); -} -/*------------------------- REGISTER Handling --------------------------*/ -static int proc_pri_info_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - xpd_t *xpd = data; - struct PRI_priv_data *priv; - char buf[MAX_PROC_WRITE]; - char *p; - char *tok; - static const char *msg = "PROC"; /* for logs */ - int ret = 0; - bool got_localloop = 0; - bool got_nolocalloop = 0; - bool got_te = 0; - bool got_nt = 0; - bool got_e1 = 0; - bool got_t1 = 0; - bool got_j1 = 0; - - if(!xpd) - return -ENODEV; - priv = xpd->priv; - if(count >= MAX_PROC_WRITE) { /* leave room for null */ - XPD_ERR(xpd, "write too long (%ld)\n", count); - return -E2BIG; - } - if(copy_from_user(buf, buffer, count)) { - XPD_ERR(xpd, "Failed reading user data\n"); - return -EFAULT; - } - buf[count] = '\0'; - XPD_DBG(PROC, xpd, "PRI-SETUP: got %s\n", buf); - /* - * First parse. Act only of *everything* is good. - */ - p = buf; - while((tok = strsep(&p, " \t\v\n")) != NULL) { - if(*tok == '\0') - continue; - XPD_DBG(PROC, xpd, "Got token='%s'\n", tok); - if(strnicmp(tok, "LOCALLOOP", 8) == 0) - got_localloop = 1; - else if(strnicmp(tok, "NOLOCALLOOP", 8) == 0) - got_nolocalloop = 1; - else if(strnicmp(tok, "NT", 2) == 0) - got_nt = 1; - else if(strnicmp(tok, "TE", 2) == 0) - got_te = 1; - else if(strnicmp(tok, "E1", 2) == 0) - got_e1 = 1; - else if(strnicmp(tok, "T1", 2) == 0) - got_t1 = 1; - else if(strnicmp(tok, "J1", 2) == 0) { - got_j1 = 1; - } else { - XPD_NOTICE(xpd, "PRI-SETUP: unknown keyword: '%s'\n", tok); - return -EINVAL; - } - } - if(got_e1) - ret = set_pri_proto(xpd, PRI_PROTO_E1); - else if(got_t1) - ret = set_pri_proto(xpd, PRI_PROTO_T1); - else if(got_j1) - ret = set_pri_proto(xpd, PRI_PROTO_J1); - if(priv->pri_protocol == PRI_PROTO_0) { - XPD_ERR(xpd, - "Must set PRI protocol (E1/T1/J1) before setting other parameters\n"); - return -EINVAL; - } - if(got_localloop) - ret = set_localloop(msg, xpd, 1); - if(got_nolocalloop) - ret = set_localloop(msg, xpd, 0); - if(got_nt) - ret = set_nt(msg, xpd, 1); - if(got_te) - ret = set_nt(msg, xpd, 0); - return (ret) ? ret : count; -} - - -static int proc_pri_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - struct PRI_priv_data *priv; - int i; - - DBG(PROC, "\n"); - if(!xpd) - return -ENODEV; - spin_lock_irqsave(&xpd->lock, flags); - priv = xpd->priv; - BUG_ON(!priv); - len += sprintf(page + len, "PRI: %s %s%s (deflaw=%d, dchan=%d)\n", - (priv->is_nt) ? "NT" : "TE", - pri_protocol_name(priv->pri_protocol), - (priv->local_loopback) ? " LOCALLOOP" : "", - priv->deflaw, priv->dchan_num); - len += sprintf(page + len, "%05d Layer1: ", priv->layer1_replies); - if(priv->poll_noreplies > 1) - len += sprintf(page + len, "No Replies [%d]\n", - priv->poll_noreplies); - else { - len += sprintf(page + len, "%s\n", - ((priv->layer1_up) ? "UP" : "DOWN")); - len += sprintf(page + len, - "Framer Status: FRS0=0x%02X, FRS1=0x%02X ALARMS:", - priv->reg_frs0, priv->reg_frs1); - if(priv->reg_frs0 & REG_FRS0_LOS) - len += sprintf(page + len, " RED"); - if(priv->reg_frs0 & REG_FRS0_AIS) - len += sprintf(page + len, " BLUE"); - if(priv->reg_frs0 & REG_FRS0_RRA) - len += sprintf(page + len, " YELLOW"); - len += sprintf(page + len, "\n"); - } - if(priv->is_cas) { - len += sprintf(page + len, - "CAS: replies=%d\n", priv->cas_replies); - len += sprintf(page + len, " CAS-TS: "); - for(i = 0; i < NUM_CAS_RS; i++) { - len += sprintf(page + len, " %02X", priv->cas_ts_e[i]); - } - len += sprintf(page + len, "\n"); - len += sprintf(page + len, " CAS-RS: "); - for(i = 0; i < NUM_CAS_RS; i++) { - len += sprintf(page + len, " %02X", priv->cas_rs_e[i]); - } - len += sprintf(page + len, "\n"); - } - len += sprintf(page + len, "D-Channel: TX=[%5d] (0x%02X) RX=[%5d] (0x%02X) ", - priv->dchan_tx_counter, priv->dchan_tx_sample, - priv->dchan_rx_counter, priv->dchan_rx_sample); - if(priv->dchan_alive) { - len += sprintf(page + len, "(alive %d K-ticks)\n", - priv->dchan_alive_ticks/1000); - } else { - len += sprintf(page + len, "(dead)\n"); - } - for(i = 0; i < NUM_LEDS; i++) - len += sprintf(page + len, "LED #%d: %d\n", i, priv->ledstate[i]); - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -static int __init card_pri_startup(void) -{ - DBG(GENERAL, "\n"); - - INFO("revision %s\n", XPP_VERSION); - xproto_register(&PROTO_TABLE(PRI)); - return 0; -} - -static void __exit card_pri_cleanup(void) -{ - DBG(GENERAL, "\n"); - xproto_unregister(&PROTO_TABLE(PRI)); -} - -MODULE_DESCRIPTION("XPP PRI Card Driver"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(XPP_VERSION); -MODULE_ALIAS_XPD(XPD_TYPE_PRI); - -module_init(card_pri_startup); -module_exit(card_pri_cleanup); diff --git a/zaptel/kernel/xpp/card_pri.h b/zaptel/kernel/xpp/card_pri.h deleted file mode 100644 index dbe83c01..00000000 --- a/zaptel/kernel/xpp/card_pri.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef CARD_PRI_H -#define CARD_PRI_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpd.h" - -enum pri_opcodes { - XPROTO_NAME(PRI, SET_LED) = 0x33, -}; - - -#endif /* CARD_PRI_H */ diff --git a/zaptel/kernel/xpp/firmwares/FPGA_1141.hex b/zaptel/kernel/xpp/firmwares/FPGA_1141.hex deleted file mode 100644 index 3ad43498..00000000 --- a/zaptel/kernel/xpp/firmwares/FPGA_1141.hex +++ /dev/null @@ -1,650 +0,0 @@ -# -# $Id: FPGA_1141.hex 5959 2008-07-24 16:42:49Z dima $ -# -:020000040000FA -:80000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6AD6FF4000380E0A006AD6FF4000380E0A006AD6FF4000380E0A0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4455544455557475577775577675577775577765566665563625523235D2E37C2B5111155111155111155111DE -:80008000155111155111155111155111155111155111155111155111155111155111155111155111155111155111155111155111000000000000000000000000000000000000002552222552222552220025522225522200000000001AA1111AA1110025522200001AA1111AA111001AA11100001AA1111AA11100001AA1111AA1111AA113 -:80010000110000002552222552222F21F112122F21F112122552222552222552222552220000001AA111255222255222255222255222255222255222255222255222255222255222000000002F21F112122F21F1121200002552222552221AA1111AA1112552222F21F1121200001AA1112F21F1121200002F21F112122F21F112121AA100 -:80018000110025522225522200000000002552220000000025522225522200000000002552220000FFF9F99F9F7F78F8878700000000000000000000000000000000000000000000000000000000002552220000000025522225522200002552222552222552222552222552222552222552222552222552220025522200000000004F44D4 -:80020000F444444F44F44444000000004F44F444444F44F44444004F44F4444400004F44F444444F44F444440000004F44F444446F64F446466F64F44646000000004F48F884846F69F996962F21F11212000000CAACCC2F2DFDD2D22F21F112124F48F884842F21F11212004F4CFCC4C46F6DFDD6D62F21F1121200006F6DFDD6D66F6DF0 -:80028000FDD6D66F6DFDD6D6000000008AA8882F29F992922F21F112120000004F4CFCC4C46F6DFDD6D62F21F112128AA8882F21F11212004F4CFCC4C46F6DFDD6D62F21F1121200006F6DFDD6D6CFC5F55C5CBFBEFEEBEB006F6DFDD6D66F6DFDD6D6000000008F8CFCC8C8AFACFCCACA255222000000CFC4F44C4CCFC4F44C4C008F8C66 -:80030000FCC8C825522200CFC4F44C4CCFC4F44C4C000000CFC4F44C4CCFC4F44C4CCFC4F44C4C00000000CFCCFCCCCCCFCCFCCCCC000000008F84F44848AFA4F44A4A255222CFCCFCCCCC0000CFC4F44C4CEFE4F44E4E2552220000EFE4F44E4EEFE4F44E4EEFE4F44E4E00000000CFC8F88C8CCFC8F88C8C000000008F84F44848AFA4A9 -:80038000F44A4A255222CFC8F88C8C0000CFC4F44C4CEFE4F44E4E2552220000EFE4F44E4EEFE4F44E4EEFE4F44E4E00000000CFC8F88C8CCFC8F88C8C000000008F8CFCC8C8AFACFCCACA255222CFC8F88C8C0000CFCCFCCCCCEFECFCCECE2552220000EFECFCCECEEFECFCCECEEFECFCCECE00000000CFC8F88C8CCFCBFBBCBC3AA33379 -:800400000000008F8CFCC8C8AFADFDDADA2F21F11212CFC8F88C8C3AA33300CFCCFCCCCCEFEDFDDEDE2F21F112120000AFA9F99A9AFFFEFEEFEF00EFEDFDDEDEEFEDFDDEDEEFEDFDDEDE000000008AA888BAABBB3AA333000000CFCCFCCCCCEFEEFEEEEE2F22F222228AA8883AA33300CFCCFCCCCCEFEEFEEEEE2F22F222220000EFEEFEFD -:80048000EEEEEFEEFEEEEEEFEEFEEEEE000000004AA4441F14F44141155111000000CFCCFCCCCCFFFFFFFFFF3F33F333334AA44415511100CFCCFCCCCCFFFFFFFFFF3F33F333330000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000008F84F448489F95F559591F11F11111000000CFCCFCCCCCFFFEFEEFEF3F32F223238F84F448481F11AF -:80050000F1111100CFCCFCCCCCFFFEFEEFEF3F32F223230000FFFEFEEFEFFFFEFEEFEFFFFEFEEFEF00000000CFC4F44C4CFFF4F44F4F3553330000008F8CFCC8C8BFBFFFFBFB3F33F33333CFC4F44C4C35533300CFCCFCCCCCFFFFFFFFFF3F33F333330000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004554444F42F224242AA2220092 -:8005800000008F8CFCC8C8BFBFFFFBFB3F33F333334554442AA22200CFCCFCCCCCFFFFFFFFFF3F33F33333008F81F118189F9EFEE9E90000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004AA4446AA6662AA222000000CFCCFCCCCCFFFFFFFFFF3F33F333334AA4442AA22200CFCCFCCCCCFFFFFFFFFF3F33F333330000FFFFFFFFFFFF8D -:80060000FFFFFFFFFFFFFFFFFF00000000CFC4F44C4CCFC6F66C6C2AA2220000008F8CFCC8C8BFBFFFFBFB3F33F33333CFC4F44C4C2AA22200CFCCFCCCCCFFFFFFFFFF3F33F333330000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004F48F884846F68F886862552220000008F8CFCC8C8BFBFFFFBFB3F33F333334F48F884842552221B -:80068000008F8CFCC8C8BFBFFFFBFB3F33F333330000BFBFFFFBFBBFBFFFFBFBBFBFFFFBFB000000004F48F884846F68F88686255222000000CFCCFCCCCCFFFFFFFFFF3F33F333334F48F8848425522200CFCCFCCCCCFFFFFFFFFF3F33F333330000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004F48F884846F68F8868625522200009B -:8007000000CFCCFCCCCCFFFFFFFFFF3F33F333334F48F8848425522200CFCCFCCCCCFFFFFFFFFF3F33F33333EAAEEE7F75F55757000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004F44F444447F75F557573F31F11313000000CFC8F88C8CDFDBFBBDBD1F13F331314F44F444443F31F1131300CFC8F88C8CDFDBFBBDBD1F13F33105 -:80078000310000DFDBFBBDBDDFDBFBBDBDDFDBFBBDBD000000004F44F444445F54F445451551110000008F8CFCC8C88F8FFFF8F83AA3334F44F444441F11F11111008F8CFCC8C88F8EFEE8E82AA22200008F8EFEE8E88F8EFEE8E88F8EFEE8E8000000004F44F444445F57F775751F13F33131000000CFCCFCCCCCDFDEFEEDED1F12F221F8 -:80080000214F44F444441F13F3313100CFCCFCCCCCDFDEFEEDED1F12F221210000DFDEFEEDEDDFDEFEEDEDDFDEFEEDED000000004F44F444445F57F775751F13F33131000000CFCCFCCCCCCFCFFFFCFC3AA3334F44F444441F13F3313100CFCCFCCCCCCFCFFFFCFC3AA3330000CFCFFFFCFCCFCFFFFCFCCFCFFFFCFC0000000000000000AF -:8008800000000000000000000000EFEAFAAEAE3F39F9939300004818000000000000000000000000000014000000000000000000000000D05E0A0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00808401000000000052 -:8009000000000000000000004001000000000000000000000000EDA5000000000000000000000000000000000000000000000000000000000000FFE40F28000014000048400128004840012800000028004800001082040000800400002148000010F2BA5E000000000000000000000000000000000000000000000000000000000000FF08 -:80098000E40F0000000000000000000000000000000000000000000000000000000000F04FFE80840180020000001002000010024001002100140000001480020040818802880080880200003F6D07008084010000200100000000000000120000400100000000000014000000000050358084410128004840818102214860118002211ADD -:800A000001148002211A041400B01281041480028004148828108204808802214800CF550648180028000000002100000021001400100240010000400128000014882800008088020000CFE40B0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000010020000800180010000000000BD -:800A80000000000000000000F0A2E800002002000000100200000000004002000000004001280000208802000082280000F0B6FF000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000008001000000000000000000000000000000EFA50300000000000000000000000000009A -:800B0000000000000000000000000000000000F04FFE00000000000000000000000000002100120000000000000080020000000000F056750000000000000000000024000000000000000010010000008200000088000000EFEE0E000000000000000000000000000000000000000000000000000020020000EF1C0400002200000000212A -:800B80000000000000000000000000008002000000000000000000BF5E07000000000000000000000000000000000012000000000000000000000000DBA900001200004240020000000000004002000000100290210028000000000000002024088F180B0000000000000000000000000000000000180000000000000000000000008FC988 -:800C00000600200100200424000000000000002400000000210026012002000000000000004288F07E7800000000001A01000012002004008008A01100110000000000000000000000000022F0BC93000000000000000028000000000000000000000000000000000000000000E03B0F0000000000000000000000000000008002000000F7 -:800C800000000000000000000000AFB10426010014402121012041010024000000201481022400000022000020028004000080020000005E320000000020010000000000000040014002200200000000002004000000000000F07E1A601200400114120020410100240000002004280000000022000020020000000028000000F04CAA2008 -:800D000002002A01000000000020082004000000000080012200901248180000822400000048000067D110011601118022240200142124602248B04208808208002100248248200420020088004022040025218804200228E0F50122C011C021004228000040022400480022000021000048120000002008001002001488000000F02AC198 -:800D8000400100182002000011210028C82482420088000000248800422220422221840100200C2124004820240222D0F109004280840100106126C042480042122482420012200828800C0029220C28C842802202220020022800224002001B5500202402A042222521012029020021002414001A028200480018220022214800820000A0 -:800E00000022001400422400428F860418001C0100800440018820A2410080820800142002220000000028004002000042205812000000F01FF12001A012481862281C04C043122C2484E2242184412292410022118082228604182221C222A08248808A02000042A02800000080F413860000110000211214288882000000888200000076 -:800E80000082008002302200001082020000100228480000BB610012402184010025010042422728A028282422000000A02120043022288800003288006242220088202202880024F0A6DC1400112840012480444122111202182480048848002220820800200880022C88082C020020140210028602100220F89B9F80A42428008084213B -:800F00000400000000182828480042000000420000004200006220086800228220040010F26453001113011424121C024622142114410320240448009012A08200008082020048A024002A08902240024A123222A0826A08882188FF1B0948140048D02284621500002082440200006024A02448A22004424A022084021280044848200C8B -:800F800048C2218AA64800002222F0F57F00000021281100142480988288881A0A248088082490822006C28282828622080088200840020000001421800A20F4655180820200100150224A88A4852986C41258A016290442480080082C2808004248C082488848212A0424C2208C088A042482C8110021F0C3E10080820214100214185658 -:801000000182180029C482200400428A8122082091A248200200002460262C220200884002218026021C02ADCF1422801441022824140010C121141A04160222825022A018214A8884840840018002484820080088105222282008002121822908FFDE4681A2122062243480110146B151C491273C144A016AA6A44AB46202482984C4426D -:801080002A0482C81AA4C4282AA642482E2280B442A8184602460224A0E48823A48A2396A22C98E188883C9A42FB6920D611E411922148211B6523D212459243144A94C14AA5892391823E522F2282ACCC0027242B1A4AA2622482422328B28288A28882A0856821AA82A8422DE28AEA24582282AEC229E2282AB8E264262B22822641F263 -:80110000DF9B808432211411197122D23162243F1484497212023F22D822E424E9291102004A488288028AA8F62028A24C6028220082826229A8662922BE42A4423042602440028220028AB8EE42010014000012000020089A842209008242204422C482422C082C082E8242260288C0824002220000808204008220083E9EF041611F13EA -:80118000E313A3222CF813131AB112F1424327243F2DFD53523F3DFC42433F3DB592A1112BD52F25F762622BAA42C22B44CE822F2434222E222F2EFE82C22F25A1C42B462F24BC42EE26F6A2A225A2992BEE2AA24C4A84A4CE2F2CBCC2A888B0C2FCC2C22BCCEAAEEA2F186428AA22BAC2B445051F12F271713AF321212CF813133F3153E5 -:80120000332553333F2DFD53523F3FFE42423F35F712121E122F25F352522F26F6E2A223042B542F2CF842D2216AA2AA8E822F25F5414123F642432F22B262A6EA249AFDC2C22B444A2444E226F662622BEE28A044EEE22BCE2F2CBC821C22B822A22A2B448F4546F161611F13E713F321211F3454331F1444B252F542423F1DED25F4D38A -:80128000E33F2CFCD3D22B99DAED2DFDF2D26E622BEE2BCC8AAC54CAA8E62E422B62EAEE28ACDD2F1CEE2EAEEC8EA22BEEAA4CA2992BEEEEE22BCC2F24B462A4CEEABEE2BE820A2BCC2BAA2F2EEC22E226F6C2E22B882BAAAAE82C7CDC4DF161611F12F6212117121F34F413131F17F711133F35F543433F1D69213F1DFE83C23F27F91288 -:80130000922BCDFE122F2DF842622BEE2BCC4EC24AA4CC7AE622B642E626FEC2C2DAFDC261EEA21F2EB6E2A6EEAE8225A2952BEEEEE22BC42F24F262622F26B662BEE21EA2444ABCE2BE62FCA2A22F26FE62E32B882AEA2AEA2CFC8ED4002002008044814402248A44214922098022080021108212229482422908290800218008228A045B -:8013800082248A44022C0280048022F8F4F64081C21111462261324002100150224800281082040022008008226022602200828006682440820248800422248002007FF10B1CB411021B2146B111324219B24291212B9419B24219B14229F34291322F142BD212A9421CE922C4812E4216E12264192ED296C1429AE222B491E222B4914296 -:80140000B291A2841B292B141B282B8619B24298212B84112B84222BA4222B842229A842882E42FD7180B41186B41122A42123B41122A4212991614A32912BB4B22F14A9491CA9422D112B4A1CE92245E12269152E8256A11296C1D19E212EC213A9C21B61241B614AB191A294192216918219B2429A212B84A22B24A223249A822B4A8865 -:8014800026923F00824800000000120080010000100200000000140000480000000000008008000014147D7500400116812202188024862104800440820612420000481A042082242282015022242C64242C8202202404884002108202227F6E0F1334B100481031821414000029840228880028802A820200282242272120012A98128AC3 -:80150000019A022220A8244800904222A2882028641CF03B4C30411B1E119051281912821101682A01298482848208258282A169288A020078221944022828F260299022482D62282928046200212890827082A2248681F2713D000000008814200480040000A024000000200440A22148120029012019028022820448A048200A00200467 -:801580005FFE0D14281411144003000000240000128822000000004221422A01224002242800248A32220000802208800228B0CD050012221837261220B1124421641160144820022004420042250280022821290424242200422C81042014020021242042028088F8FD3E0080810221291182110242004821000082000050220028422CD5 -:80160000022B2560222400A042184022B22214020040822802230200FF380A112811111CB14142012045011C01114280021848224200480000248004008012420224428008004002280000A028888FA3014280045821E01402421400801401002542020023012C23C42212682081922248208104282220042824008A2226280428244A0283 -:80168000F0BFC100208501148061352028042240820412400280882423840180084800100248008246028024A648224888008A04252208242EF3200100004002809421200400920012420000000000000080022811100226820800240000428800F0B6E380011212181420222564182601424211211A8811222104888022820521E8800158 -:80170000210000221428214826A2824E220082290C200829880E244FD70A48006024001B41250342480000420010024022045221281840611422282C042A01808288140242A0842024828824A44200005B7C00800100C0112480011111400240021800000000000010820222210000212A28CC2200210000002120F88B963021141160229F -:8017800013052084014823160200000000002034422002C0212890421800101202200448882100A8C268486280023FD641810100004880814401124814000000000012000030211411282280228202244002200C21C28A32424A62280080022E780030111C1121044824114225018004281041029022420029020000000021208484460166 -:8018000048C8250120080025022A188208A8EF190842008A0440212144212422042400002C0100008004220048A04210028092422248008002882002882488242800212F6C0F141400400140010013012110021821004082210440024042410220C24240422202212044220421208208428002F07CD50080822115224222622100108204C2 -:8018800000000048482424704202282D221124002490420000800621002810924280020048226FDA44212108140046C14118482419011C440100800100290100200100261201200480021002282A280880A82824000040032FC20C20810413290100C01110824202002880833442C03280088004281480028004214822223C0280022810E7 -:80190000022848238A883882149F960A60191501112B44281A11314115731291131714242421C0122901484880A2412A840420828442122222E42212E222A22222241C34C23188461282C4A2222B484E822B842394821CB822F86452B0212108429613D11124B412F212512394211E63480000118002622301242512022E422411C02122C7 -:80198000242D12A0222934421902242E828AAE2C828882236A242E822B628E6220C86128FF1B44E11114A1311F11A1161E11421D414E52A0512C2414F2434121228062212B11004E4224214246622328E03262223B422CB24282024622C442272429B2628226E6229482242F22082BE84A2228A2A2222662289F5A014A8281026824283434 -:801A00001A428206123400222422202324022302224221100221002002800411269241A04824000048A048A048288A043F3E0D171A367111E1127221E327E534F463616E721F12062AB2419542212F2656222D222B312F22F222122AA2222E2226E226F66222242B336AE622F262622E224E4327222CB212E12151224682A446257342C1A9 -:801A8000E23F3CBC42ACCE8E822B8829F8C2822DE28AE82A76E2A28C222BEE5B6730312AA4233AA7127AE126F663314AD511E131F122223F265721242F26F622222D222F21F33232272221B02233222F2C5C222F26BA12A1442AF261612B222F34762252222F25F512122592221D211F14543225F183A12F24BC42E42C5E222BA826B282DF -:801B000088C2422E222B2E2B844E416EC2C90F1B641AF43121121F15F653513F17F741432B553F25B56252332B752F24F443432F24B422023E12272229B342042E122D224EC22D4225B232E326B622E236F622226E4227222D222D622552222552133F16143223A6F2C3C32F28BEC2EE28A8888AE828B88288A88C2BC82BAAEAEC28F8A656 -:801B80002AB0C1F6111117111F17F341733F35B153F571733F37D733F1723135F3537315F243432F2616023E122F23B112A3442E222E4229F242C22F22F2A2622F21F162622F22F262432B222F267622D222D2227622522227242D622B4625B263F2A1E32F2CF442422F2CBC82E82A58222F2CD822F642222CB882ACA2AEA14EC2DF830438 -:801C00001C01001C011C0114483448144800002001000020040000200200230226824402228A6422000082284828800200E7FD20122102223062E0122121061811460228800229024A0228242880220280420224400200002400482C082C0824C082484200489F5E0B481B21B01122B41132421B212F1491212B941B612B94112F1429F248 -:801C8000429113F24291322D912AC4912E421CE82264152E4296E12264192CA4292CB4D1C2421B29241B29421B6927241B2823B481F6428219B64218B142A8422B84AAB442A84229A842882E422EC520B211A4521361221B416632116612A1941B612F248BB242092F343B114EB1122DB129D412CB521CDB22E811EA2264192B1296D13285 -:801D0000A4292D421B292CB481C4121B69429A32428223A4282998214A1A91A2222B84A22B84A223348242A6F27CF90082000000000080020000001002008800000000000000000000800200000040017F420D8A641119212124010016213112424601888008484200200212004880220280420240A2212100224E22288220084290E20097 -:801D80002860122F6107208882482286462101B0210C6014401201A0210048100211002827241823820128141301008034C3880040E12C22A228602842C041826FE80848D23601486AA142149011181B92623041000042160220018212004230610012284A129211C02200482F14A242212A0888460224E8242C24C24188BFA10310019228 -:801E0000240080012448904120483281004A028084120211002825A22123020014402201008288280014A24A220A820020F259C700111001200262282A11411101198402288022011180048002100218000000C01250228200000024820000005F6E03198291211219B222859543123B411C84018008901318802424024220020029A221BA -:801E8000228016022303122880442124A8843042822C248884348248A042424F660719C21119128192121E2211382D114A1301118084122202624222200422200220022014022A01208281448384280421200429088248A024487FA50500801181268424A4241418112048011981012001148004003022232182210210021840022182808D -:801F0000084888248848482100005BF6140042190100184220C42160128001002436220420418122860148212094516026002084048621A2482A0822488823028800004AF2891D20034280810126031200A0424813420280022002221220488204421211284200484228501220044200280000502288008F5A080000480000211800242024 -:801F800084840100008848C01100120010022C0110010080040090C2004800004888B0950D1A0220A114126012272480C521C043482A0100222842228210B12101162204481829E41482D5220214482A24041CA842880042488842200821C288B0750D0010010012200100001964241200291102A024002A04184221001200000024114230 -:8020000020A46824820029020000E022F472C1000012200216410122238281012122C0221002521800802201000020220390222C02802406000080084210A2422A04FFEC0310010031182902334211A1424001200120022302150224502118002490111424002084A22421100248000042002008F0E1D22004004824682411244002184043 -:8020800002289043124200231211821402002100182904281C040014828220084042022C88042022B8F3411101902180818121014200111200E01124022A012A0448008064120046021111400220060090212114C8626210020088F0CB9E0040011440410100211480312248002C0328124848108104100242002800216200428084082482 -:80210000422220240280280448CFF14D0180260246022440A2141121200421141C02222052122142234111424101214222101301002904100219180121100220984210025EB5802204408241022821110011148003001C0142400290221D3218001002482440418204008014228442018004002A2804CF6F06111290412002281001002498 -:8021800000C023A041A01420428181042826A112A0610000114880028A828408101121840688214A2A14423122AF6A0E4826810646611442A0252220428102002044011012A15214881100804401160122485021002511135222242C88C6812128214A1802308286F16B63141CB21112511115F153623952333B12267243922135816121A1 -:802200002223022F12E21161131A24F74162236434272146D212E3236112242D4210C34231003F240468283724292C1843125223282F2AC44223FCC242A0848EC12F22A4B9206414A0224214523A41110127121A36113F14118241A1452722216A8145B1218601152143012025C4311D21104122E22614622448242092C31964186AA424EC -:80228000622C24B2422C48A1884F130719042A82C5422AC152285E222D212E51244001244AB23152211B6438282CA212343964142B621532431B214828292421E33257321B421C922266B2A14421FE42823C681C46A1C62430828888242AA626B07B0342000000141280040012280012301142120010210428002084012250122002268150 -:80230000048280048A8402A0483482288242BFC206481F13F321211F12E22AF2222225F223223F26F422223B57255222311F2434222F25F533311F17A3262B666AA6222F27F623632F24F412122F327A12D313F211332F24F472722F34F422222F2674435313706272427262F2C2822B442B4C2BC415F14341CABCC1AE462B242F2EAACCE9 -:802380006AAECCCA84BAE2F2B45D14F051511F12A222EE233F36F223232F22F262632F22B27315F323233D115E5225F252523F13F371731F26F372722B666AF652722F32F6C3C22F21F122A22F22F223211F31F143432F27F742433F22F243423F36541360146662242F2EF842414AF442423F18F8E3E1CEC21BEC4A3442EEA28AF8622186 -:802400004E422B64A022EFFE4951113AF721211F12A2441F32A2223B661F27F721217E723F24D62392125AB522F252723B231F17F662713F17B722A2356AF763614EC31F15E122D21162121F33F142417A37421F12F241611D431553331962242F24F281833B442F24B44254313F1CFAC1C14AA44442AEA22B4C6EE22BCC2B442AE426F686 -:8024800033E81419F411511F127221A1441F13F221216E616E711F12F271733F14D633D213F151512F22F272723F11F271613F16F373512B226E721F16E712F641C11F15F1A1211F12F221211F31F142417AB741F431314AD41146533337144E2227241F3CDA13F4C2422BC415B3C3FEC1C31F1624A624EEA223FCE2A22BCC23AEC4EE62C5 -:802500005F3E0C002601142022210226834401240012281A0400110000100100001C0114200226022448204803002C0224200428F0631160120000484E111100420011180013412322248102008044911100420022111440020080D422084E81132804218088048220F879C180B411021B214AB11132421B212F1491212B941B612B941B56 -:80258000412B94222F1429F34291322F14A9431CE922C4812E4256E122641D2E4296C142DAC2421B292E521B292E121B29621B2923B68132621B682B8619B242B881B442A84A2BA4A22F24A84229A84AA8AE424FAE04581B6190616E12137142827242B211B22239112F249B214A28D2322AE21438212938222F14C8524EA13F22AD812DFA -:8026000012DE2129E41DD232E519B222318125B291D622A16927141B692384F62281112B861994A211292232422A14228AB822A4842CF4B143008200002001000028000000002100800800001400000000000000000000000014F04399000080042905164141A2421E41120010F112221280848208243021181903000020728201212C0264 -:8026800022221100144214882C022422202404879D203181881A020012002913411201B02204424622222281262404803242214A0242489091208124811401888280044A0848B0820614C02162CFA40C18130C284880841111A1214E212E1118400234F04212260232BA048A142202561132612004E01412612148182964129081001B426F -:80270000A0488046A248294283E41204CF460E008212002901185022602411004A024A03A042004200111A322200004220998200280022800880442148022800002AF49FCF60120040012412A0612041A2411811181341222124011100108212020000245012000048224001468144024200008A0424CF5F0D2082032A61171B144813113A -:80278000C221C6022420842288022084042400121A2401184878482816011823222202A042282B8690821482288A24D422A2242848885F810A1382020019B11134121421224A115222181384611822180040014022E122240120A424404213C11222222842002611724182482288A2484890624A082CF8CC9500200319230648121A162174 -:80280000081A04202201214252420021001800182081848201000080A224A06820140142408202224850B9002064191A0248110020022601800C20322200282B8213B192860228A01200290242882004482581024A0882A0282100008028021FFA0100582842001214808884242681810100162244210852824221421C858414C31168003D -:80288000480082002840822484A28690418A22460280FC9C8980012008002E4200000048222128128004004200200200120024001C02002211426012200880440324880022BFE50E1880C1114A02481D62142028061C24012389226122724280A88434786821281621815122198116222802A0841C322162422683AC48A02448242A2814BF -:8029000002282AF8FC190000281800120000422024230400001426828204808224A4424280020011424002008800C08282800422888280F4A318000022801442224181612424C012003C042002800800282480824222C82222211E2228222722182142008A240C200800008282F045771432142081C321004A228284011C088A0190818A89 -:8029800002882642014220A1411200285240C1220090111430821C8A82120111A02442002042021FFD05111021045813344140021302241130421800292122422248020028236222C022808881212101104281988282252284241A0225A2288800F056D48082021113160200210000F0228120848148018240414142034215022450216894 -:802A00001041A224208402201421022908886242102288A442DFCF08121A0200181A1402100229348223243212282918820811222D822CC11100244002244224200834528A4481322280044001100248808428F4F58B144214182041011C1102195C12381C02601225011631221E418084012088828501003860224818482226210210C325 -:802A80002288002C220221288800F0AE8F008004C02220C221005A6A181820212848A12480021C8921022CA1483111C828581413244102001200E024021440028A0442800222B0E10120081111801102211400A08360228848141880010000111C022118800448C04182240010036024482384046028112322C221228B9A100119246124AC -:802B0000108195111C0221111A124121049012111421D02141C1822E412A010014220011192492131C844292216018250119022124004A083042F0B9DEA0138A0211382B6518582A51214AAC522CA8982B812E314E114888467222E11A273281256112F032412F31A1533D2123085A3C313F14B2617331D221B372C2318AF52222481CA8FA -:802B800048221442C2AAAAC2A04413A2822A6C12287F42021C36B114421B461722271533F112632D21233153271635E234A1892BE2271435F2A2A11A0A183EC217282721A038F042233642A2222E324E21AE4216921223C35237252602242B283F26C8613DE22CC44270C2B242D422C88282828E8126F2AE5D14111413E11361311CD1213B -:802C0000E434122152313C9A111691213542F2A192D6B1119111118E2125813841273115A26E11A0622721212D42106218481D812AF45321113F127A21C2213F2C281C53132D42282C022B6C2982A2642B441FD90A2002002A81040020220100130948208812010019819211CA028218C220E81221C811822282140082A0481448800440D5 -:802C8000012028E4E54FF171411F11F311111B411BC6171417141F32561315B2A1FAB1A31F1DFD81833F1464315AE536E614541225E11EA439EEE28E822E212B114E53CAAC763B33CABCD2ED1CF533718ABCF29A119A92D13F2CBE42B4C2F621A22F28F242C23F28B263F442432F247462D22258222F2C682423A84C422E423F2C47A14493 -:802D00005A45F111411F35753252231F32523125F2A1A33F3AFA61731F28E824FC2282CED22F27E32191828E932B5D9AF1F2F18E832BA227212F24ACDC6AF6B3B23F14F4D2E22F1EF6B3F239F6C2C22F28F882222BA21F3CEC3CFCC2622EA23D223F34D623B2E3E624F4424227262F285A222F2CF8E322272A2B66AAB222F24B23141F1484 -:802D8000F411511F1111F1D171173135E1221253211BAA9E82DEF11F38F843411E831F1DED26F641C12F11F992912F1CFC91911F2E7F81E312FA13114E513F14F6F2C12F11E114B4528FBB3283F4A3E11F2AF823211B4C3F2CBEE37E8391811521F421A22CF643433B446A3462A08C242B222BE64072A8057AA57130411F15B5127242E264 -:802E000022C6122D221F3EFA92825E728E824ED23F33FAD1D33F36F641433BD71F19F9F3D11F39BBE1FF81833F12F213133F3CF553433F1CF813132F1CFC52F239FB33733F18FE33633F32F131231F1AF371621F26F6A3231F127881F261E11F12E234FE41433F14A446EA4EA28C2F2632222B466E822AF6FD68A01200E012012021022052 -:802E8000089200A0413011200813080000982002220020022A012A81048214823400004022880242F04E1B000040A3414200208204008032812002221882004082B2210488800C2E81800929084E81808802284220044A0A20082288F03D5AA0421B21221B21621B212F2491612F24B111F6629319F24292112F2429F24293222F3429D2CF -:802F000012A9421CEB22E414F8224216F12242DE212E529E212D42DAD222B491F222421B292D121B296E121B2927241B2823B481B642B881B242B881B442A8422B842AB4422A9282AAA4842E42DF950F141AC6111B4142282F3481E234A1284E93124EA3E0343BB14622E234A94A4E113B422989E114B8238DD8232109D6D112E418921289 -:802F80001B2D2B429A54329A66361B4946A2284693614E821986AA282523C282224AAA4229B8229482AAF4826F0082000014000000000000001002008800004001000000000000000000000050127084011921010080043216820212802108800512288882222240C2123812212A01321818002100190220280A800400800428008EA72011 -:80300000240A1981C412B0119242111B48192118218852221922D8220448122CC2412C04A082004225221282825A12212A240B00282120048842234CA1422400142AB41F041B14E2901148168294114870E241210B922C02288A4482A124182349211A022C89023374320223015A4A42A2422A0114C02282A22A048246021162248042B11C -:8030800022D4160E20010000282B1213011210018224112C81048068224A8204242818120022282A01250120082800000042A084004800001FE30D0022C01140020042400124484A31212813098200282AA424A024214288800800141221282E82282248420040022008484200F0FAB910819111002C110114211D22C824421CA528248098 -:803100008404A021A8230CB042021D22268202272416A22C2A21028A0211196428A02822142B842B4800688A3482824A8828F89A5D408191311001312110120111212420D1128286048232802626B222A4242622260A2B4825A248181418230A1318622AA02440817C420220AC482B4882888888AD39000020810110014E22C8803451E217 -:8031800042001B1800A08229084840424102001222282200282219064282222480082002802404F0D82400800428A0421922010000280048111324A8281C0142192288020068222800230600A048808284A8248280328200880000829EE2800646E112218401A0242A2168149280E22228088062210026828A318200423400111B124242AA -:803200008224800110420200A248224082042400244F4504180000001001000012181002004220041001222122800800006022888042018018120290424A0866228C08429F720D1A041413A32418681992512A21182109183288230419024A0A4E22A83C122102234423240A13211402242682880420042C622800272A424229A82421001A -:8032800046F2DFA6200200000022004800201802144898C01120040028802202222880820820818872220129A8482028042028044A2808821F8E0320444181631229264281246838C041293A229021AA042128A21F28843C4122908124000020C8418820424201304242488200244A882262288800601990410018003012200212C8802405 -:80330000A182881142141423051423010014802688848125C121824200200221001100002304229042247F2D0B2811802204224631423448000086021082A2820011421122A60242202202A8248800142814602468A0424641820424002002824AF2D193002820148135114001118A12811201488820214111812162228001308124C01206 -:8033800048804222822288249222008221213022002223860448F022850000002110821202002180022123948280288246114243E122042C04246824242470210211C222002811002200A08400425012CFF90518181021141102502182112113384221294801908248C82B18C0A28810D2212C682840222882C81200238A032122231C2253 -:8034000082128234822821100288245FDE0714282E411818200480490280014228B091C261111216018800001001A8821212181C08821821210020022813880842008008F019D900002214221124488214288E4188114082028082020048C0616A18022004003C0282142022240800825021482C240423220820F2F1EA8011810410021132 -:803480002C820221902288484800332121110221C082408149A21434882C220648242C0C90824220928235C22148820080048A1222F4CE65F01121111C8243A2142813B121C681197822E22888888CB2427A81D322A5821CAA112E831B964AC4412F1232A31932818E4129342229B8829DE22F3A2539833F16F883821B43214AA8462A98CE -:80350000211D41259341884602426A24884421F2BA7414181E6111111AF121222F31346246D122F182411B89421572C281E82AB422AA881D423B111F12BA4161382672A30248AEC24E42314E12E029025E1219D233088A266224AE2222214E2266E2221821A42C2123E4220E2BE2E024A8448E9520240276F161412531613425B2A146C2D9 -:80358000213D412F18D521F27242001F16F25231A2489AA6413F18A834241E2327142D912CA82ACEA24AE42322A281222EA2241AF28221482D622C92422BC823082F32D822A4C82E62212F2802AAA8482CF2B67D00000018481848188081848184A148184820088200421112208128210288200226011C08224822400100208802200820CF -:80360000F4D97414117E31F0212117321F33F371711F26B752E535B332FB21311F35F551931F15BFE2BF72E725F5C342DED23F11A3FE1AE326F281822AF532322F27E729A1493F24B582B982F8D2D32B5D2B99331C11B2C2A4112BC82F28BA426824CAB8A2B2A258211F28F8C2822BCC24CEC22F24BCE2AC66E026B459031B237E711B2279 -:803680002E2126E223F352521F24E535E53CF821A12F2AFBD2F22724CEE1CEF2FEF25EF21F2EEE3DED3BBBF3FFB1F12F37BE63AA873B223F16F491D32F11F4C2D13F3EBFB2FB42C12B7F2BDD3F3CB48258322F2CEC3AB882BE82CAE22D22CEE22F12E22A5A231F2CAC8CCEC227248AEC26EC2AB862062B46CDA3141B321F130715F12123B9 -:803700001F37F771711F27B643E534F682823F13FAC1F31F3CFC81C12B232B324EC32F3DED27A7232F17E713A7721F18D8115C122F36E63BA25C3B442F15B482BEB2BFF2B752B482AE1139F263613B773F14F4E2A22B844E22EABAE3F283A134CEC227282BCC2CE42CFCC2E22BCE2B66882E42CF39061B331F13B721A2232E222E224E639A -:803780001F21F24153DEF31F18F832A22F3CED25A5CE2F25F4A2B21F36FEB1F31F37F7B1B13B771F3BEF3AFFE3E33F16F423212B571F3FFCC3D13F1CFC72612BFB3BC82B7F2B753F39FF93913D213F16F6E3E13F16B6E2EA24FE4222CEE23F1EF681A335B3C1AC88CEC22F26A4CCEAAE8A2B66246AE492041840012248224822200200245B -:803800008A0448B091843291421142001110012A0888A092800100982082240200148A0400800200CFAB0600A02142A0144081440280848804400120030021004200208488021122822428428A0220048800002A048220081C948FC0411B21B01122B411F242121B612F24B111F642911B612B941B412B94BAF442933AF44291AAD412A955 -:803880004A1CE922E414E82264112E5296F1225296E122AD292CB591E222BC917222B29122B491F262821B28272619F6428219F2428219B44228FA42A2222BA4A229A8424AE82AF4A3E260121B41181A663428341942A22846A1682D23281C28D8322AC823A24E9123DA12E928E51492914A9A421CB2226C1C2DC18691421B2D29BC1194A4 -:80390000C29227149AF642831348B281E42488C2A31B484EA2224E22824E822A2434222BA42A74D10200000000000000000000002180010000001400000000000000000000000021F087C910B1210120C41116828496414240110248801621081220040000000000602228B0222422884A01882420282402224A8298826820F46F13141236 -:80398000001212100121222388244822C8231022CC22A2132422D21282041D22C82AA48280082581388124008248144282601648308182C2202822021C024F2E02192104800412272460248A04A603231811028E41A622B84181F2324211C26022884210012414E03408258284889CA11C04824E212B42C0C18848282AAC822AA842222D21 -:803A000042EF2507B0110212181341016219024800A042242A0480020028001142228A02820088282220820200820020082288001002005F6F09260114121800139112128004001A248484022B2400130223020000228088228202282C082400820042D02208428022A22400222F2409183818281CC2311E63C0222A849C931391422C0421 -:803A800082218829641880032150121226E229826228322F21221153213823382272282E42346288AA3483008A22882828084828483FCF0119A312141820E11641313242D0120429044A01200823082828242221186021282A8831A225424183B2829282629062244888888A048882008088828482F2AD3C008081B2113221301224324A03 -:803B000028C9112014E224282492424E21204111021480B22208242218382222126022122810830A4A12032123A284882A28220420F4C9E3003041182601201111B281A4425826A241244280486228C216018A0432922821002482381AB4220148802804A024882A842C8AA4A400680000884FE308004211C0616034A014181221800220A2 -:803B800002424822502220248802421480148104808887019062000021225022402288040024CFA80D00320000220028140000206411000080021904001A882608200A00208202190200802408A084004800F08EF114003816611246014E331423A1421E62408201232496914882621810021B12122C22B411A82448213AE4210688281845 -:803C00002AA82462192202100286220842280000F08189004001800200481C19A11420040000232448014A8A24240200208808881A02120024004888684AA848422A1422B84288240420E8A34601C220041662218006002602241A02881E41D022011400310014290110C2121221C0128021A2215012002008A0828882000028F0917E2074 -:803C800002108181C2211180110211581811141901250110C28160288800102209824001284602134183021123E21432221021140229042100825FC60DA02820D1211311512290811E231982552311272826021003A23021272C114A41A2213B42481200003214243448212146912210024011022110026800AF75082211208804001800A1 -:803D00002C1881024681E521248201421E8220020042828E122028651C13011AA421001A048034818A84A42821C8422882482008501214002822421222A01212424800008002422880480228224A1A0229088800224820210428008088020000882820842462147F2A0811001200A01435020080A414100242000022003411001A221822D8 -:803D80009822004811221C02002200211502222982020022C8F0313F800411002818804401181816012810012442192106000014180042213C88042C0218241C4482024A021129240482000000E0E704202A424142816412A04219C23348100322241C8286226A164226819422A024130A422C0112282211281C120228268244128108A835 -:803E00000080C442C82004A79B3081111C0480148204301248802A0211481840311123014A2128152121E4141242818404198104A0411081445112603428102206230A2018023F6644B121F2812170110116E121D13104141AF111114643C3326E22129661272511B242A8381511728243C2424817382F26E82981E82DE414842433113E66 -:803E80001217131E12171390233366244EA24EE3881BA4888888E8242988CC21E084031CA44A2E21481B74192196327AF112E2336622182B1D23D4127823612419622216A1211F27EC2AE23684F8526113F831235AE219147292028A792391212E233984F242612C772182C4231B882501150227266AF42222222B4448EAA284822FE50AF0 -:803F000000113816F222623D21423996111CB242BE13964117111381B623D512B541A5621F1A4181A4281B422A61122B142BD238C84829F913221AA21418282F2431212394226683F422211B4233384225A3682B2882230C42A0422C3453200420020022A082488880888408A8801A0100114A12A12400110000422601268104400180040F -:803F8000821448200882002028F4692FB08124021D211F34B8B3B243B44224E428F892B325B38238831B382B468AEC2AF4C341DAA9DDCAAC8A2BC62CE82A14E222F492932F2BF182822F2CB8D2ED3CF4E3A21B441AA11120D43232226E4220A4CC2BCCCABCC2ACCCEAE424F442C22B8C242BC82A0E48FF2B4891616A56111F1272C1F191C4 -:80400000112D223F33A7351F32F313732BEECEB2372817383F3EFCA1C1AE723F1DB5B3FBB2922BAA1F1AB831DF22FEA37229F421632F39F533929AF9D1C3DED2DE43AEA24AA6513E133E3246F363233B222B6625D333B2C2FCC3813B642F24F4C2C12B222F2CB442ACCC242F28BC22AE822F24F46DCB14681D6119F211211F14B463B643DE -:80408000B662A6751F17E613E328F843213B851AB1E2DF31F722D22F37F572733F17F563E1AE91EEF11F38EA16FC31116AF4A3D32F39F5B3B32F3DF8D2D22F2CF4A3E34AF411511F2151333B6439B241F4634337241F1CF8C1C129D213F2C1C33F2CBC227C22F242C22B8C242B882BE2E82C9C3C148AD611B621F221216AB671F711322F4E -:8041000022E625F7F3F33F17F761633F3DF953821F35F46273EEF33F16EF17F721233F16F463F12E911F1AFFC3E33F37FE73732F26F6B3733F33FFB1B3DE432F2DFD93823F3FFF63611D111F33F333311F37F673623B643F16F643213BAC3F2CFE83A33B441F34F4C3C32F26F622A22F26F6E28225B2C2B862EE26EE24DC150B00003C01C4 -:804180008044A1412400121411241301124213080000181002292184012A01002A01224824483482244824008A44024280024BFF401101001B210018118811988028810A4A2891821AA424820012601C2A210482211311022E1200F0421110820619220420D2222822040040F122B580B411021B21421B21272419B24291212B9419F24249 -:8042000092112F2429F24291222F1429D212A9421CE922C4812F2264112E4296E12264192CA4292CB491E222BC9162221B29421B2923B481324219B242B881B24218B14228BA4228BA422892822A84E822F469E120B21124B21126B411726292212F2691216A19D1229B612F2429F24291222F143B2129BB22D412D921A5B43BC25AFA2248 -:80428000429E211F2224C9C39E212C34512E829AC6439246B19136428A724291212998612BA4D012AA422B84222B842229B8A23442AE425B230082000020080000280000000021800188008100140000480000400200000000004810029F830712001812360181241212250211111842181822422842248A42128104238108236421001059 -:80430000218122012154B989048004260228800182008FD201448E34194221582824190B86228872112289E8A2282214828502802284428CB27228D42281C128482E92281B8210823422221303002AA484812C2811842488220885C5622B2600CE241C32111236028830922B1829F2221116018D9220045800482333828A521C6E829842C5 -:8043800029592184482D92284EA11421482A81321344398924220610022882382C0820F27FF790141200881548F21128000024821C28A224122921A22422004A4202A024290129A124182800206122002814848084C8488832258404008285C442DEDD10042100405281472400198401211002A10020A44A005023834102181024C812125B -:8044000080020040C248200140022450220000828FF2011C212182C235A9822191312C21E9224153811289D94162944125E111048B21C042100849A4248CB2226481322622063614F244B2A41F21F2112854807E420216282884B2C83348524E241800BF1405111828224B122031114305003484C018414653242001382A0C0031424222A6 -:804480002A2191142C8236123228435B821238112784C622048188422486C84A904412002F970F4C410240312A24841332122B812E531211292198238184141C04830442218124C381129A42842282124014224462329441206221204102225E22A0142800888FC40544F04814311F8412C218301A162411147224018312961812444955A8 -:80450000844994228AC41213281502480044118120A2411200808121C82245A894891608008463414812F8B22E1019224404661434214E2150224924A112CB1C82482881182008254284A1482842833114E024182192484088364282482213820256981480C222B048282826285428826B6D808511024C01100827828417814248008B211E -:80458000426022262804408842044442221E24412E184002214130242001301800001094142A8121044428DFB30B1D124058161D184816C4231E416722166811581C644888A9A525186CB324F148844124C9041C24314656480443B4289121482183C232524922A4121983A381832381416822C088322E186BC184818AF25DEC90441269CD -:804600000147264C124838281648C2482143B14861824C42180883044222882642A442005AB224211806002144200800108814AA484284444B418848804444F858B6C012412100150811BC02841440080040429451441E4883524830482D884124266828008410B888C128261818D4220141121621E4158832122016F28224008C84F427D9 -:8046800078D04312912424202521054604181091824200213022210013646422419481202186521412302160442982048119622400288884480048291102F071D3200140048410048001321826080018840000411210A21448102A648C2C828283A881E08114C21438248128A150823084400C844440E2820941902848830481241B218595 -:80470000912240988412422A41248241C44827824258845A186142162106122440CA4540348150842890424C02168122C1442991941A98522A240A69F259CB3413884288221454431951844E82884044BD48518146731C01848B1215880170211889422A98131EAA224588A18426C42811C124912185418454824942181806302249128257 -:80478000332847155F570D26488204E0112221365269012E180043A81244C019172280534110084C2321C1488440A861002112CB815012229912B428311238E041223218248009412021F26E59804444410240180A40015022401402416111444245894104004024041077144151366823024830121059418964181F48018002898851841D -:8048000044E0CE0400143181211944147428210767810027814F819222E118004C12012C45E464C1219A22342249A118621748184124424C048168314CC24A14C04142408404432609F0526940D8128404004481204141041A42440187112211601421211941815881464201401944424882041138191214C15814208102244E14239128AA -:80488000188448259488EBFAE0413183AD2B428184D0EC521B9B111AB818021E98844E1881255C323D1A5D116D1114CF147241B84C71686B834588F112218E2AF0184A6F15F2128447B21F42E9A161C21F43119811B9F132462F52E531B4646131CF8288052383F214828D342FC9C11926F46D15144F12C2244392242F24F411619FD4F134 -:80490000414176FA426713C2116D1485E527E813C42136D34431242E288FC6D48457838D413E4969D231B819F6AAC185B41AFD22644F4E7121B685C364CF19B289D227C2425F2654E23E221CD284F223281F91A4183C512627684D866F22A87863B7245C4C4F85D2FB46D2237444135121848D1463B112D144D384F84239F0182875F28E81 -:8049800014D16F67911D8F8372183552118747504415E641D54EE5767151EAA624F25818A8843CB41351A24F46F8C841AF84D2D2B23C62D4DF8471599218A1D9BCD17258BC5485F7D81827C68C8462268E42FFFD0A200223024100A082602200C02611281128B0481241044A12A124A02C59211C248C21085012501448341A044082044857 -:804A00002448801428B1480889F8A7E6345F69D46552ADDD29CFCCF4F62EBFC5F4792F3F55B4C1F84D4BA5C81C55FFD6DCCFB5A155453516C7C255F75C19457816A8444F16F5141ECFC1DDD6FCC4459E88CDEC4FE9F9BA39CF2BEE46FE342489B8A8BA59F57272FF85574EBF84D375B25EF639222F437415F45D3C65D442F4B6A44F4CF88E -:804A800034BC3E128CE88878C676424AF317776D66CD2AFD294FC4FCF62EAFC4F47D7D9F45B761F6D1F62B228FC1F38D89CFCDFD6C7E7E5A4F637336782E7F26B572F33858CD5D1F14E426FD321ACFE7FFFEDFEFE7AE5BDFD8F6A426EFB1F8B7595F6EF634F7AF18F28AA48FEDFF567EEFC5F52426CFC5D77DF24E4893F11A6813F15D5CA1 -:804B000085A2414F4AF86444C7C94B48EFCCF428BC4F6DF1D9263477757F7246F3292B4FC4F4726AEFC5F47D27BF55B769F2C8ED8F82C3385FF9F9DFDFCF97F375536F72F23F1BEFC2F21444EF97F77515DF84B145F464E37FB1F5377D2FC7F578E957DB8FBDF6961EAF83FBB46F4F7FF61745DF43FABFBDBFED7D4FFF5F7CFF54F54F1C31 -:804B8000EFC4F2496C8F37F35A694F5DF8DC8CE7C42B444F46F2642E4FC7EB83F5E66CCCFC64FE6FC842F3F7373F72E232F22B2B6FC4F4727AAFE4F57F7FFF55F7EBE2AF85F63838CFA1F1978FFFFDFD7D7D5FF7F537377FD3F12B2BFFD2F679791F17F54C4D5FD4F4792BBFB7F6FF7FFFF7FDFB6BDFF7F558FBEFE2F28F6E7F73F777F62E -:804C00005F73FBBF3CDFDBFBFBFFFFF6F67F7DFFF7F77F5DFF76F64B6EBF17F25B491F1DF8DD5CAF24B442A426CFC6F6EC6CCFCAF46CEC8FC2F76CFE9F6702250145415824C011484541088400E0810440068100100844114421008021342610062C81941448221214481440056412640080028784004421C48119140E49A141252111380D -:804C8000114C098112A5341542414614012C240183C412811098464644012E11444AA821241658248487241A1288C496844E1643C1B23244432144F18C85C0421F4152281F4132481F41324A1D24AB141D24AB9419F24A9151AB9443F24A9143F242914782AF14F924481CF9244A4EA14FA264114FA2641D4FA264592E4ADE24ACF49124AC -:804D00002CF4912485F2912483F49124A7241F49B64AD141F24A9219F24A9259F44A9243BA4AB924B442793498924F8284F9244AEF45022E1A1F41F628421E2487161741A72615B468F18124AF6689F64AB75B288F243121ABB45B422BB44782AF143B37A9CB5A4EA15FA2B958FA244ADE211FA2A82C2ECBDE212E8A17C8ACFC91648DC2F1 -:804D80009E2CA7149E2CA7329E44A7141D64AF6499218DB659F64A924B4AA9B924B442B9B434426B4AA9F1A452DF17052008008220010044000000000021800188000040018004000000004004280000000000CF250C4432001954815128844D21B082811458C287618741163628281B212883442402228344453A4C46784A12888201006E -:804E00008C2412DC48C4488C82F1221A8C41D4626481424D4890429A2204846F43083083181644F88412225D8219029668848A41218888482878482458488284864A1C0A8C081C034C81F1128424A88C9194C098881901412120C4188241278121822084FA1421443FCE0E241B1C12419C34854447321342758488214E128C388245EA8809 -:804E8000D248622841833814A6328C28425D88846D199572141AF83A84124A68811E8448A886E8840130141E22484D124BA483C118A74424E021A4824323F182D110840212608127128881282CE1888451818847818D141280C4312628441848124808A02448421840820210688141153448CC5222848941481234428088848A0445D811F1 -:804F00000C29614150414901611143020029214916410544124A1164442242241445C8242D18122292A0242911511816044002701138221348C248242E48294248240220048FD444C12519D2412293234D488E22328CC1521B21235C818123D128A1818333182519A15283420189344428A024AB826DC2812B832148182CC1A28E321B69DB -:804F800019A4A132290429C241124384C14828AC2481A48218411F81032813C1211D2241CC247A229124421CB18294128C584225818852842791424E242A64124842428422582B2848299912290290114D32823B414829897112022146C1584423324281842848881A04CF2F427311C424444961135042188C6121225018181816DA143135 -:805000001818C01112C4008135942445C2288D12A61428CA424A6111A488322A488182724188E218420242893528284686012810F453FDA034252444584884B028E181226181411227811A524A181C024422414425014D118A0483032E14302283711412481488264484842101221421239864E088A45200844062419FCB0181B048C1114A -:805080004A02445141153C8149439884A82A21041242484E181C55424818866442212848560431318F4324842221012664A4426218184931148942145441809126C012F036331440322441100410714202212148817084421685514100814D282800A0411018440400161404809124114319430820812241C94C42008483FC7CB6141652A3 -:8051000024874247118F44124C341C1781B724112CC3186DC883F82214526932124CB521C4141494499224498492123AC4148394244459B1241484B2242144A46146D412B59492122C2111D4843424C3B12484843122807188F45F27A04A8041080019322416D42809208141C884115440C4484E14418314014189024AD224012D1A9012F6 -:80518000901C8001411E2880641215482289014A6881858454481088F4986A80834244012141000085211408C7219130282CF2812891C2D11314DAA16383255848151898288430426284811C71224E581889C148251858187483C218E08102582800D027031110C1241698115602282D288016115224302444411034242012040051222F6B -:805200004364419022230A8628B14152420042A02880820900812021C2882D5881488F2E0896A6418110D1240241418015220124281003400800211082280185426125808592141884891202441064212C6114604422403462A4260C1845E21E0410818401C018A3C218412144214934420022214D18002B141442221064424442122002FF -:80528000C4914823410490282594428200CA8238442112200443823C283F420F10D88451481AA2211D241AA21243E18208401C44880244222E4449C4244828921A34289B48006222898403108282A41426223422811A22F4162891A021200420951828818FC54321C4141302842506008458129B83288C12446441A800C01241006F2288B3 -:805300000132226051001AE41102901128A012A021408894225884A8223038800222AFC74D4249430244134808840087142D421840411158A214145082901445414801254141548241412508131211120C1514614870210460183014818C84880864F0E9C31024A8211C8204284582840329020026628422428130282883223A21482432BE -:805380008395128501001A02844128882E1AC018248421A01C8443044484212384E41284B46443425822484AF12384001608806241412C0780184812240461211981C48142422141214641344284612B422319C8424984B1441222EE41042D2C31306C482A388110D44241F48A45144F31B491F43425C12B1A41CC1168A1282CB158D2318E -:80540000A8112524D298E8D2D3285884C67528F8D446B5A9641B222AF228776AF21E1C4D5DAD2D4E1C2E222F41CD644DBC956A1B2FC582F66C3A9B33EF61F244DAAFA2B92A16F54C825F18336C2AE862E5266482878E3E54E6B12CF2E5DC243B128F1A51AA2E24DF45E243791E9224AF44723882EE12B12AD42684C4222A123622AD26477A -:80548000824CA6324F42467112D28C0167A9287AF215128B23E5E42432628F32B422C222152212C24462AE248A022F84D582B44ACC424B1428888DF329F64E284D674E429F2608442596111F1145DB33B221F6321C2AD1C431783D4A5E1487C4C722E7D1774485F2442C2E11991645087F42F88C413F357492D859E532542B482CC4482241 -:805500001E1213A111BD5CCF1271DE0E67B41D18A1521FA571B8739145E8C1D3C8725CF81828D249098B11C41FFD4201471200004002C048148C04841880118101421142200442A02420142614042110840448800448144024081A04402409006F98035A55848FA1F33D2EFFC4F63D3DC5DEEEF24A688F83B3CCAF378F4FFD4412AB311F64 -:8055800013F2D8C2FF52F2D5D77F33F3331B5FC2F235146F73F6AA8EEFE27726F62E2E5FDBFA2129844D481E188D498F43C6422FA3F31A12AF3BBF3AB2A2FB3C36FF51F37315EF62FA9A928F22F22A4D1F24FDDDFC8F46B6A8FB24244F6AFE21AA2F28ED85E483F776663F53084E533FB1F43B3ADFE3F35F5CDFD3F32F3FCFE2F26868CF23 -:80560000C3F2E8A49F17F7D9F6EF21941ECF43F2DCE6BF73F3FFF7EFA2D29FF46F6C9FC3F72E7BBFBAFE2FFD3FB3F56E4EEFC9FC79699F92F24D4A2F83F36A484FC7F644441FB3F63A2AAF9BFB7B786F6EFB7E7EFFF5F17B1BEFAEF8EEECBFB6F24B6D9FBCF59CDC8B568F8CFD64244F6EEE2EB3CAFF7A587E784F6777D741E147F53455E4 -:805680008FF1E371F34676FFF3F33F2FED2CCFC4F73A38AFECFF22618F9CFA4656AFC1A1328F8EFE3416EFCEFC2D2D9FD2F476794F53F164543F5AF846C6FD57AFC6F7A9ED1F96D499F4246D4F43F7187E3E2E4E423F33F71B31FFFBFB7A78EEBEEF67F74B3FBFF7F5BEBEAF6DFF5B2BBF84F6CED4EF45BD68F6F8F84FC6E22AFEA3EA2FF6 -:8057000081FD72784F83F72C7E7BF2344F77753FF53F3EDFF3F37776FFB3F33F33EFE2F3467CEFC3F38AFA9F96F78DCAEFE5D4CEF12C3CEBEE1732FFFFFD3D3FDFD3F77C7D4F77F56C6C3F5EFE7667AFB2F76F6DFFD8FE696B9FD7F64C4BAFA7F77E7E4F43F25464FF73F31A28FFDBFB5B784F6EFB7E7EBFF7F37A7EEFEEFEEAEEBFB6F28E -:805780004F4BBF3CFDDF5D8F87F5F8F84F46F3E8DAEFEFFFBE7CCF87F57478CFE6F7AEE70010023484002400488004404218084400114431104294122800004901004D11D02401450224009A4481045048828100D0C603A60114C4AB12441CC12CC921011225012D165118418D1247811C02440041D08141312512218922022061121225ED -:805800000210C111E022281118344240244102408841F8376EE032F4112485F3112483F49124A3D441B64AD141B24A9961AF149945AB944B42AF1439242F1479A4D812F9A5481CF9244A1CF8244A16F1244A96E1A2E459C24A9E24ACF491242CFC91248D821F4932481F49324A1F48B24AD141B24AB981B24A3985AF643924AF2439242BC8 -:8058800094478A29F9A448984FA2F4948CF024131D48CF32F5112483F41164A3D441B62AF18164AF46F98164AF1493658F44B9A4F44A315B4A29FBA448AF54F9B7484AF3A6524E214BD25EA14FA2F45821ACFCD8259CE41CC2481F8DA2821FC1D628FC91288B861FC9B66AF8814CAB161FC1F44A848E68AF54B381F24A9247888F24F3A489 -:80590000482D32AE488BB42F88B442E38AF5FDD840080000000040040000000010021800000040014008480000000000280000000014F0A72E142238100159E314024418221C212184D841028482844210284281C448897212542184302C81182833820821128062118CE22184A114205448258231488C0800285F180D18374810C4618882 -:805980008CE1426481154499AA485C410416944444453218261C044782284362452246C8146B428004121841188308215082258222021002845420C6982E58569148EDB8142C324510A52443723138444D181D1449921A6212821C82112448C21A44841A3224C28D248F42B424D138D4A4D141C22C8934182AB16381C812894802283D18AC -:805A000025BA3434322A0148102A8134A8AC618716B158F21C8280A12100141329840250181B281859441444C448444528648244501822422C01004800001004200100280042105284245181488820044D364002142814132114011230118D81401104848501851544244204400221400A00182002244481009018124210128421190A4A93 -:805A8000220248EFFD064C2131241841CC42194AD41442A184124CE14134385911A2814492420028484100269221D02832584C0129C118241818189B212C8A819482241E489A2481822435111A981888813F470F1092212A419438B415082A419141190114497314434811F48411430430240000222712004044028C416221804188084661 -:805B00002261248D123014A014211C012038488BC430141844101125044115041A988816B4444108309810084122204444022150288D224E18181212220049113831282391188820840D38888B41A0871E28005F7A08200152CC820434844552284D31864838624028924481004518088E1830484018040084A0142508CC043281211AA29D -:805B800012688C2882242281E1820140CC12522F3B4892389048276248234218442121914C50428D24144B1844262813A2145042488E111E440043964A2084E8E28521C6244B1260148C44C52840981421608286B48C0443644623215428A4FFC50E4014462111048100112400908A60810010280328444002205142224400002001802195 -:805C0000410800811818214604208408F014DC30124C119C32766A4281D13568211419C5888514561A8358488CB22811223414816845381481C02CAF4154426286D424062C83B214C244488B42C5711228C1282C4518A8416CEB8821A416469412433C1885F2E51B2002211514860400448D128C52223048824C216344001698284110217C -:805C8000C442800400208101C19018111812228C8281820881604443514822428480F4635C1014181484112C01481C61118484181283C884C08840022C8101282220810180A1219022821280028328480889820184A12011281368821800CFB807178211B1126782124215644161001181430281C4412184182644C81489413484453848D2 -:805D0000105484800128A0A4200228A889028C02290110A241212A34428184248F990440441181110140111812081504411822400C2628120420115884208801842328024044788802422652281224228424818460A4000089E2F2011200841110194802C1150418158801200261490480711432285288245246021289223414C91488816F -:805D80000141121604D028C1241604201224012118F079BF20180816152421014002008428004C1298822001444C184812882841424842883212898222022C82C22800C02A84108841688300221288127F6E4D41040010489411842008460147848628118881B11202C44260241842C0824948024223280420210220080000B0120221207B -:805E00000129011229F2979C5012C024800422442288842200829088801484480884890400484C243184C14C4224C8844014C884894964C949A48348824B252004A0424841C04481C7B420050040410412550800141444002022E4422401400421180023012118000018801108164208000000841A82480870380540840440448101821284 -:805E800054C3C824128004288441304290189088124888424AE81401E08188916430442981024122504280624ACC810982840021F0A2DF8071844928314216D91547D524F1168C2F9101811E151B35818B81418F8841344A4F4665864449C41A4CA1848B111E12C08ACF81F1383E9E229AA8398C93484F2283F28218CB28AA58E82F83B34C -:805F000028425A46854CAA118F83F318A816BA68C3184B81124FDF4EF221415056457415144D9C118952298115784115712C58844AC12C4A92984B82D044115A88C52443E8487C4884F9444442F022846A524443E24112F828848B23C48B314A0384AB215E186B13182148184A91822381C5222FAA457114544819D219E182C11412C3B1C9 -:805F80001164184CD818C288C5C8858E94863C28267626CA14AF81A2214D584CA861AD2AAF417544A8C82F6DB492516229C41829B52848B42468859E12886A58C463D32868258885823A5E8D88244B46AB624181857228F8CE1734282428412880028C128442010044400420784804815048000000220000841884422004422006460242CA -:806000004110143814814914787F4AA1653FD6F227275F52F64B699F93F32928DFD2D25DF127355F1B0B8FCCFC1D1D1BDD1AB1D44DE4A7F7A6AA2B51CF46F46C6CAF81B4C4CC1ACFA5F51C984B554F6CF51416CFE3F374764F41B558DD44E189F984941AF15C5CAFC1F95654DAF7D47445B6D2BD52F5DAD8EF81F1D4DA6F64B5CAD84CF4F6 -:80608000C4CE6F74F4CA9ACFC1F5D4D4EF45B4A448B343F66B6CF5FE1D5DBF54F63D35955DC8DF52F2AD37BFDB5B11CEE157915F1DAF194F8D4DE427F7B6BE2F23B76AF4585CCD5CCBCCEEDACFA7F51C984F85E5A5F59496DFF3FB7C7ECFF1F774FE4F41A9FB4F488BF76C7CAFC9F91E1C9AF3DC7CCF46F79CBCAF83F3DAFC6FC5F59E9E2E -:80610000ED16AB9C2AE62FFC6E7EEFCEFB1A589AF93C248FFD49F376441D63557315F57E5C9D299791D5FD393D7F51F199941B229F8CFE1D1D1F1DFD94944BCC47424FA7F7A4AA5E5CAF87F56C5CCD5CCEC84DAEEFA5E685B558F1DC566F61F11A1F4FE5F53E7E2FADFD66644F49FF34343AF31C3C8FEEFF2E2CCFC1718CF87C7EAF4B7B7D -:8061800018B29AFA5E5ECF29F91A12EF4C9848EEEAA786CFCFB91AE589F9283A9FA945F16544DD67DFF2725DFD7B5DDFD1F335255555F9FFFBF39B981F12E29CFC151DDF5FFD94944BDD4F42F27C72CFEBFBF2FCAF87F5685C4D448F8CFC74EEEFA7F7DE5CCFC5F5D85A6F68F99CDF6FE5D5EFF7F6F44F4FFF94B4CFC1F1683C4F41F3F8AE -:80620000FE6FC2F2F47CCFECF42E36AFC9EB27F6DEC8EFE1F19E86AB55CFCDE982F6E4C6FFE7F7DA988B514FCDFC2C3EAF270261100229011C214121080040618944001228000040843148181004002B92A08284C048221E484148E0810448441A041A4484D4480244F0FD446018501411C1100C1415140A8501441281404458424F83840C -:8062800042584880528400521881220010088722003028122722D02881E42461818584F4483200841826F8BD58C0431F41522C1FC132481F49324A1D64EB141D64AB9419F24A9151AB9443F24A9543FB42954782AF14F924488D954FA2D418F8244A16F5244A96E1A26459ACE449C24A1F49C2421F4952281FC9B248F8912CA3F48124ABE8 -:80630000141D24AB9619F24A9251AB9443F24A9243B24A7924989A4F8294984FA2F44232C0431FC1D624F4112887141F41364E1D64EB141B61AF54C924AF14B315D44AA142AF54A9492F54FA2448AF14B122F4489567238F14A1825675246A114F827418C141875D4D1A1F8D52A41B694D521F8892941D68E99161AB141FC8F26A941F4802 -:80638000F24AB253B84829FA4A96A28F4439A4A9B9A6949A4F2AB52D03840000000000002800000000218001000000140000000000004004000000004001DFD30D001C321100108891841C21088E118212D06801268811886232004100188912E82214882302008250A1428F131C82038F280120D228482421840100FFA80E2664382012F1 -:806400001862C24183428138224038528506908482C42241A02844B02E44942421320088200284608320028A01228048A4941AC4825028204211F82F9810649431161118524845084918B42228D218884C1C62C18283D2A41138241323E8484164C4C0122618C142848928220481822215A2429699924322E2820941B88AC182C04A24281D -:8064800014F0D985200222280022B02811C1910012292101504282200224280023423424E08281021A0228006081812006184022084887244118800140F81CE7000000442A012A0181841410628244841004800281841441282582421A18840280082210020040080040648229211308812AF43E3C9024E041129832A14D81E54366811E7D -:80650000232C682444A01416429614186D2887411508244972120683C4341827416C9318482358412782812F4401411A426841301248254CC2AA121281C3B414A62180F8CBE7C02480022B21814952431A12B82801114160816C51244190284181004125038916A62169A121252C0214A942B826046118810020140A2318B21812721488C3 -:8065800085018AF6B5E900C0148450428E11A44582512187284225024A02841247214183312140CA284311041E224058C2182C24182408180028C01424890144C0281604162876242842088F264C5248E0829C2242818368811A2274889114C08422254284D1A488048844443A08261408902444848608832565C1294884021A024922B143 -:8066000024014428009044844B4149C116F0D46B1018944241150C10444404C90A4AB12C81A84980E46122E284A121A14321C81228874A848065441244852284824318A258246824818D44A0148B246044801162828A4462289E488011E2419811231184984211811A020080014118400800A954844014B2440120023222000081C430943C -:80668000482888828118AC41A8242E88008184F065335024442867122D48C48143D51462C41783890258497112223D142CC424A18B144941F46688444371223C8247854448660843A14329218143982246C8224B6168388B8488C96484ACD184A4244B842588315C4186F2B5CDB08201E921D1140124841880280943182848048D941A842A -:80670000228842088428D04802284941C4982800C7228241844929814814AA212081010089038F44229818F055C900295414411044022E4420840321284472C400410000A400C012448D42260241482481C90500431848384828450898219622C21212882284126FF10C841982022140742804C188408801188628A828299282484331149A -:806780004D2812288E24848CC4281280C4821E224908002082A23444108801404404203248C44614F27875200C20110284211200A04121290421842D42608184411088C4128D4282008011322221228024842304C02800294442488204828421A018C1D7AF5084418C146244324A82110AA100518C911210024391642624C248580080058F -:806800001210C42C1AE481220428896284440080B94881180618C44A3142422A012504CD2600C02820A1411644D82892C4800E8C5984482604284C042E18128444608160C100436188124C0228C922018228A02192412830884B2181308820C2442041B933470285028C0510480481D049B11808884008219082400828242800A5342A8661 -:8068800008000000441AA218120042444C41420216028C92168118A9043BCD00904100828022044A0800484508504881604440040081208198224002430C21284A01848444442A088112824400C210524200D7B94032A820624949A2213012266242844034142863C124441A6283C0A828C028842B2121281826C2283818109824801888D1 -:80690000C12484288922411218481268222884324E1820F497A224841129344A480018101248048F2802A30821C88220110218468418044244497814412CD8A4188464488B12414C0841181244C03444844883C118100421F0B9172423B4A8D22BD2224144F4283A2D222F8352242F84AC218B8143F81E88AB18AFA244644C96B814BC1C76 -:80698000F11494B02CC41A18CB844F2144D424F188881E1463F224C21EC4457422F834244CA4154F49D8447B2884B1A8F4481A4B4945E42249B844A5352F897354EA2183711C096F350964471845B854A2494BB61E444CD12CE4C432284A0127C14A67274C71ACD222B266F22A2CCC3428C7864C22F238282F42931A6E5A2F81E241738A79 -:806A0000C82E2F41A33828CD244E588BB32E2C2A12A861885AAB23A4AD88E789E1A7C989A8442B22EE48CF81E44C94482F7503D0A364128D486B141241C7834A918A43F82988ACD5384956C44B2925F824C86CA1186AC2284C41B84C5422A48C3818874A47264F22B258217866F222CA206884839858224D18CFC35284D048E12141C416F7 -:806A80002427A28F229818E5C424182D1C9F68025014B024818408414843820400484C02284844200428A02440044A92842012282204A082482A082220A24822008280C4228AC422304820F4256D24AA52838D2A23A1E750EC6F62F14E7EEFE8B8E2FEA1B18E848B98AF8C9F144D3489A8C48FC8FBA48C4F84E68B6BC145FC445487818F11 -:806B0000A37A1AF8544C476123F1989A85FEBAA25E466144CF41F2CC448F816A41CD2C85BC28A29889F13814A5F29EB865F64E4C83B1DAFD2C3CCD16CD1CC5741EF84119242F22D22354988D124F42E241F13C3EEF62D1EEF18E8EEFCAFA2939BAFB1C9AEFC9FB161CCD1CCD828DAAAFEAFB929EEFC2F3B8BC6D1CCD2CCFE8F81A2AAF83AF -:806B8000FA1C14C7616F69FB13B3AF8BDBF47296EE62D2E446F438248F89F318A88F81DACCD2CCB21CF15C7C8F82D2A8D22AF11E3EE5F61E1E2AF32A18EFE1F17E18AF81F15818CD1CFF9444F222223F32D6E8F2322C7ABE34F23C28E5FE4A6E6F62F24A649F1AFA98BAAF68F8CAD8CF63BB16BB2AB262FC9AB8EDAC6FC7E7CBFB2C3CC727 -:806C0000C2CFE6FE321ACFE2B23AA27747434F3BFB8E8AA5FCB4BCDABD24F6282CCF49F3FC5C8F8A6B4ACFC2524C8B238FCFFF48588FA1731EFE9E9AEFE1F14E4C85F2EAFACFE2F2145CEFC4F51C5CCFC4F58766246F6AF227278FF2F23A3E4F47F6F474CFE2F22E26AF46F7EEE6AFC4F661618FA9DBEEF8FEDCEFC7FF3CBC8F22F268E88F -:806C80008FAFFF7AFCEFC6F7B8BECFC2F26C68CFE6FE3A3AEFEAF27E76EF67F7B6B66FF9FBBEAAFD2E6F6FF7E262ED26E5FCBC348F8DF7D8F8CFC9DACCF21C3CCF8BFBD8F88F83F3181AEF69F9BE9EEF21F15A5A8FAEFFEAD8EFE6F67E58CF85F55C5CCFC4F49BF1100661B024012C01418260882048020024000000001828410030263041 -:806D0000241044180449212102002440260100800200FF2F08504126422C821484428226840250428CC42641284D488B241285342442260245AA242A01630284461402214C92184C16C82441928006960884E08A149A44218C344845F1CC5BD024F41124C5F391248B141F41364E1D64EB141D64AB9419B64A9945AF14B924F44A954F8225 -:806D8000F442914F82F442954F82E414F9244A4E814FA264154FA2645D4FA26C5D2E4A8F4DE2A2F4D1242CF491248F22F8912483F69164A3F68164AB961F48F66A921B68AB945B48AB9443FA4A924B4A2F24FBA448A9FBA448B84FAAF46BBC7024AA41C593218B141F49522E1F8132441D28AF44F91124ADA15781AF1421D35A7124F842F8 -:806E0000113658526F88D412F1241A8D112ECA1665A287512EC287112E138D252E9217C1ACF5116487221F4132681F41322A1D24AB9215FC2A961F81922859B24A3924AF6421F348A24781A9B216D44AF3245AFBEF40280800000000002800000041100218000000400122880000000000000000000000F0AC4C106442839324811E28193E -:806E8000C4441646C818881843084225188A18A8211828A4444424CCF2122C184C5222890244211A022D2C3124882246C8848180018110C8884E1889C8148120E4440B6E12823116A8524552241618C144822781812D119664898A33848524314C494414946826784284014D8A812A819C24482E12902CB028E582B8446381322A816881AB -:806F000081216496CC242E14441AA2822AF82845478A9F930C64478E8D1122842E1C31699415257C9418A2121741824E8289182248F8244241224381F484284227624393186411C8704C42A2148932264689985280E1415A84A012218469588489B948E182C892882AE4C2F899AAA052302216AC16304416084860898522C814168873840D -:806F800058481289A14144A48D2424448C11D82498282E12893224A0122841842B128CB224E88132688068818140648128434224C124265848481F6505400480014200842A0100000021901A4800800420840400224200A0218002842248C0488886184828242204880084EFCA02805124492142E84281044121A4184602268C1484418460 -:80700000048E1890484508852421C1148287426041420082892D01806488BA8418029844818524888231281E84419FCE0EC014D0422143C81448400684400222502410440886088C5484108404490189828204002A9988008022A8284E8A1088191C982C0040C884845FDC07004142006200841E24242A810485240412241A848421018A38 -:807080000484181A04824490148924042025038442836445A082828120044A28A28128124C71CC0C19022A0125048D12168403821028110842104858144A0822494488848124C6288384444884049C91848C81880484422004840042528C04CB414144846F480343210249E28422820442411112007082341442438201384449841204449E -:8071000010AC811286880120028024B4883214CA2222880198400C20C8548086027F570F0041000000528C420800818C8802006084408222811424012634228A8204008082220112204208410041414903228024F29B91E011024902258C9248638161458DA18C41280185741884021658414AC14C4CC2268C82E54441B468B118C84C2347 -:80718000EA88422404184458488C1CE48D22266A84E0C108C144184B4A582E1449C4448167B4108482C1246280016200005028824A88D44802200A484241004241282A314818428052188283A2282A210100120000424994184183248222F25CC34002812840042004000018A08400100881410000812688422808001048A8848608002098 -:807200000642000041400884006D8A804106008001B028A918484248481840644280240C8C846442128CA44248124816A482200110243144C189BD44314884839488814281488364456A614280062FC2041006421084014228180020212108448024088504430890686238468801901842108861448442488C8426648C8100704498147660 -:80728000281208D031088D188B44AB44280000B088D144D844B424A6626280448402852244A8151AA5A98A99481008114CA8288548B848944843843C88448B811604455CC44B222AA2428148800445022AA4112F830B4100004100000000200820016084400842000044C0240000001004800112004220080043040084FF660B84268884F2 -:80730000040080011644C42428280000608827229012898181C8880040311114104C2884044008008664444C86A3248448200450229012CFAB0784424A04002002204884A922880000844810021A0588004800145048846248000028005044182883880481128188891482745A07800400002004460428000010081002588008000014889B -:807380006082A0442800008014480C890A008400002180F1E9C9002002000000008001000000400820220448420022008001000000404828080000800200D08D04818304420080218118143C2422220000812C484232148323293488003021131811088B44200400100841414322222204004042622443F1A25A60818448480081008049D9 -:80740000C484284A02000089046121188B9488C8100441541422848588AC44220000832845C44C28890280043088831412F283DB001841200200008048082001490800814820040010180400001004000020812808003048844846880441F01CBB0000000000120020040010088004420000008004228001800800121200008160812048C6 -:80748000080080F4B9EE00000010081A84A84881890800908440884418280422100842403424802221212808402882048E88848F8438188258488CA8456270481814F456E8000000410000802828011800878130C88B644848488C84C448424C14048800206242801204B018C188188882D08864881048984848008B44F7E2301432260453 -:8075000028002A8181A1912021242C0800818C0841C187864242008444688E342843120400008001893158481A84048374482804C48E884848D079082F22F212222CB11221B112012C5122881E131F11B188E998F848888F18F4484842151981548985B844E444742494244F4222E24202284554442E242F22B21282B192A1812B99822C49 -:807580005122881E1B1F11A1D88E898D888B484E48428C04488558884F84F49869F026226D222E123A213112002592829CB11191D19E888F81F888418B4C4246591148C48588F6484C45B444B6242222024054444CF326224DA22AA1131AB8922828582229C8111B1119E989F818888B48CA240400C485C8688F9C0F000000000000000051 -:80760000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000AC -:807680000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000002C -:8077000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000AB -:80778000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F2B -:807800000000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FF9D -:80788000E40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000029 -:8079000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000A9 -:80798000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000000000000000000000000029 -:807A00000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000000000000000000000A8 -:807A800000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000000028 -:807B0000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000A7 -:807B80000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000027 -:807C000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000A6 -:807C8000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000026 -:807D00000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000A5 -:807D800000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000025 -:807E0000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000A4 -:807E80000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000024 -:807F000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000A3 -:807F8000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0023 -:808000000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FA0 -:80808000FE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000000000000000000000000000061 -:80810000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000000000000000000000000A1 -:808180000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000021 -:8082000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000A0 -:80828000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000000000000000020 -:808300000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000000009F -:8083800000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000000001F -:80840000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000009E -:808480000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000001E -:8085000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000009D -:80858000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000001D -:808600000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F4212C0484D4841222222BA34244064884C88021A2221286981128A248C0500884A3128008142001004E081B4241C342422204884020092812038149FC80E2283140821897454C85C55 -:80868000464424A18332412285C424C443A26168828C9C18A082188AB18833188B288AA548C9AC24222A14C848D6D884946C4302E21888C34A2436444CB264E14122A22D96C818896C89001200A504264804582048448802222E1822A0841280042A8C210180A842400422008449113C488D144C08008288A042B02401C018818156FC29D6 -:80870000538036480010A44118808881A1218288C342044381849188834428048028C28828180022A0420086880420624A1882C9022A440442160442889288FF7B020084803448418B42490200004400009222200800008220110883084800800426840442000044604200182800F01DC200008C04008064424C8202440010042800128AB0 -:808780008128016081188924882CC448008148008082044C2202440000282A888801F0F53300002800000000000000000000000000000000000000420000000000000080F2BC280010182221C228200189882288250818284508800284208221220288831404002881414698148C04848041281404448444904A00818CF283B724422912FF -:8088000002A95684401CC8142C4202418141465C1490211249018018A442184021011A1A085282148E124068121E24D08432C1128230842220A23826240888706A0B2440088B528D2484C416C814282223888408584C020043020020812242A11889C414842081126841A9C4149B24431348641981104444143824B22922088368829FFA55 -:808880000A2984522210022200D02808301481418514514813822101848843A2241800008A0280244821088400C02842124A08882200D0840400F0A26D00100485821288A212848B14008440981840229128430148800450482D428129041828228A92948C02844184224011C1121240C8124100008902EF790B1981C3186C914464122182 -:80890000642AC1231608D02C0100258802134458214D2AC4463C52121213C1248BA44902730429024D7244485848A1482D281CB488B41494A68B4283A1427024A84220F2382720A112808104182011A221230184442001A41AC2281E458450824C64E45084218421C841224482188362258143142816384114488324B4885228C321064CEE -:80898000821428F2A5994001C95124E42656282849C2384619086081251808210000199424A1A04118582D114C962838241B4226E24208261404582400A9C21123391425A4160040888202B79DD022C2228C32484C125C24851258C18A42418198211C8801834828B1480920C12428821012082211113044860820A2482004121605200247 -:808A00001221818184182C23BBFC058141441314220240215114180028008011542200482B41211C24584218185981E4830883A424C0154014A82100401422D28224934490A4281A924240F83E5F004022110881438102188421114301854408128D2420811214084212468822D2620828223024282400214112B04802234104B04411A255 -:808A8000140044D0F94F0221CC321A814C427C165281121B29131111418468C1608916C8348B411226C244A902482D165289D224D224C61813A2244382D2144232244A2883041842212351421856646487424E28184A6142704306224C1212312684402852C1401822C81111400841A1828004414E2100841218822A0800C928015028107D -:808B000024011F810230482224128812890218A6F84E6280012448160812542244001081020020011614281402A3210810A82825A82C188A8221E8423181811B28444A028002002246846142008302F0697E001681415C41255A81181C2108102108512048012148184048C4224450482448182504B0448212480A003082901A30824425CB -:808B800008821022041644F8B4B2142C11943218A21249235162902683311224260184404A6881264118084628C24825C24445A228264228623220120A2248228143028142E0C441341C2C22C22C1810084FDB0C22904810C14482002281100181B011121202C018206118802881C182100882801CB18845A1862C018844218B14901441B5 -:808C000011200242180020F2935D008400184001313018804102C3514284448901221291812519CC8825141848544A1244C023844044C8222082C12818800184844100006081DFD14F42C81448482582110240040000508114219012842800428813140825648418622004142C0400408802212C4594186148228D4270184408F0D32D507F -:808C800085111C440400281200882411841C88016018107484814831141C18621100801214114484742164112F613281201828C1841111A0822484418C220841688BAA0027269011902110462601150850211044180400C081E02811240121009018220015020044214018022581110221842D1850860045724B0E35081C240241819C042F -:808D00004825E262012902125042BC42D118421146E22841A181148418104401185518924646121881C1A24C1824D2410228111832214084229112F02A2910121881F411314B211CE1515172274918182D113541F114151A51842584B9188132241F9819E124A12123BD12C114C12D2CA72347431E1426F6215347312FA6F59B242B134F8A -:808D80001A85F2AA424788ACA6124593144D464FC2B22434362D7669E2441A0826F2335260314F65E191F14716D06361412CA2134B4285FC19AA1522F82A2291F54653359589723DD45849C28A5F99D4F6D1115D9CC784C449CC1C8C9D214F18DE46B2888AC2839D221938A6412A931A1DA83B443749A791A1272428C3C41CE3810249F43A -:808E00001AAD341D343D2129E28152A446D8ABD2851445D22202122415886892A3D888721252924E19163848A718A53428854E72825222872E28AB2C2213043782D5C548C42D2288CC5A4A32A3A11190111AF8183C87A82638288C61814FC1F118284F8B0520427824416816200622E012081C088822882288118811004A1221142118212F -:808E80001C245C14D2201924581400C082C0831AC483122CA8414C88C4824885A448D04F4F11612145FE362F2F84F424298CF42E7E23F6A446AD9A8FBABA82D813F88B8ABAFB9C8ACDAE3F18EA8AA8A82E281BBA2D833F38A85E3E122F247D117A11D393F8C3CA9AB944F414914F2CFE93BB7F41D324F89C948B2B4BA84BA88F88EA69F378 -:808F00009C182CA2DF86B798E323B1D87DBEB2D2E583E3EDF9D49CCFC9E926F4DAFE145F52F2144667C147C14E484F85C558AD4A6F67F1A6466D9E8FA1D122D313F88BAB8F83F33838DDA9FF98BA33E1A1F3362CCBBABFB8F98B89CFC4FD13186FE5F5968C5F797887F56167CFEAFAC8E9CF8BE324F483E9FF58F8BC3A45A4A34D214BA835 -:808F8000EF48FA98344F4BB1A8EB5FBF84B19CF3BC94CFEF7FB6F6D2542E224F6DF9DA989AF97276CF114AF111114F43D788F12D3D8D1CFFD77618FA6E3E2F47F3A264AD9EBFB2B2127383D3BBF81C1CCFA3738DFF21812F82D119F38A885FD3F3819B3F3CFC6DC9DFD7F54C5E7F79F88A984F44F44A6D4FCDE6CFFC654D5E723F38F68FF3 -:80900000AD6F42F21A185F48B191A98A8AF83496AFC1F391B23B755F75FD1E184FAAFA46526F65FE5E7A2FAFFD3654EFC1F144542E128FC345F121215F43F23828DFD3F3595FFFD3F32D3FFFE6F272362F6AF62ABEBFBBDB337183F32B8BCFCBFB1C1F57B8DF92F8AB891F91F3B7ADDF33F3898B3FBCFC766A7F77F74F5FF7F1AD1EAFC4FB -:80908000F4CCCD4F47FF5D7C5FD6F6F1D3BF32FA1F17FFE3F3AEAC9F92FB13312AFA8AAAEFE2FA1A3EBD337F3DFF47D3FF33F12E26AFACFD7EEEEF87F7F8DA6F43F51E184F24E562F3934180011C0118800145230112244002241558481200850481504821446100812302430222842502222002228400004480220100F0EFB25034284538 -:80910000C22824C4C02C1828C0282111851244414802200113082B42124880012B428005495441614001490169280180A14144A034108A5448805194EFC1022CF41124C5F2112C83F4112CA3D441B26AD141B24A9921AB9451AF143924AF1439242F147924F842914F82E414F9244A4E814FA264154FA2641D2E4AD6C54ADE24ACF4D124F5 -:809180002CF59124CD121F49B248F19164A3F48164AB141D64AB941B61AB945B41AB944B43AB944B422B944F82949A4F8284FB244AEF760A2CF41144453211467111744A53418B1415F44A9415F44AB141AF143934AF1438242F147925D81A19D7127924CA915DCA16F1254A8711172287413CE451C24A1FC1C24B1F41562C1B212217C1E6 -:80920000A5F181242D121D2CAD9619F24AA359D2327824B8427834F842924598BA6B4229F3245A6FCC03004812000000002100000000100218800800001400840000820000000000000000006F5504412214635224C1400235021184402104631308251481440844B964E21828814588181444C23484A8614D8284288941A81420012184C7 -:809280001241460412264818F892E600210021186014C4498C4112C1848C348145011817C213ED4264198664C44012C141106222437222A824471250143122222EC18122AA04142551841249828212E82244144411F4728F0023042841690114A5748493141426816894461171328441647C26E4113C8845A818D042321222841528028D69 -:8093000064446B168431444C7A8248381846981411230318C90228C426C21287428187418B2E1084424314420848244800A14120480481178229914110245424871415681424702462486782601250148A3222601628228A220414451802384142484400F086C40040011CC12C24162834111884890910410181A220614486C2243B4228FB -:809380001944E42224C58890442814C012001A324448818C7442011C08290842490410388488E0BF0B40748612DC2406198584B14E282299418591C1644658814914B884248C3844402814F622491C011A92222662442368411742413F88843411492B09B04248E28C817442B48491328C841804005F8F050045119E5525B841315A121F60 -:80940000882482C18811195841B1403C88C84AC1444E824127124825D5C1C411528B3850243083411544F482411A14E5442A6924192454215820C4824C628450844908F0486E00412908224902209416188C681581428014898442242818849248224823A2422124222AE4440212322181284A2111480823887888821C365452800880084F -:80948000AF8D06831251142364432C084432301846052062488B812A044C46A218412243312456A1688063A25460843181424008288CC4846608706628210244A02848884152001FAD421308184A423822491288084181D048312121502488811502382C280160E8001816311244188332448230482C68412140A4125C014F26012E120005 -:8095000050822141269648FF1E0A50228400430880E84368181A62886081244110018A01844C042100904841001241200300852588B18321041002C400C418200212F0B7C500148D17284558224441124B828E18848C181431864548C6814D281681311C8E26604256914CC0688C1122F1441865014B1200424D219E46441D28441E228C63 -:8095800031124D4284261492282C847822842541F2BA2670220221A0124C2242282241B1110616981890922A0448888228484421602280C1244D120012228048186888A1922B944890612041240143884108414CC2483F1D0622922400142111251461812011912841801154254115081D828024A218204581884681021C42C121144C725A -:80960000C28182D8424281C24130422244A284A0424112F08AF450218111811D421634214818294812188114F188421C6C682C88849422290230288C0C4B4280241322D4422512022921B24201A30881212181C230C610228803008AF2A72B008200840012412C02122120011A021A12E1137841641135C485445981C43480818444046066 -:809680004119011115C8811410411151144C0C88129018422001822FE60F1450184001608210522189C289241728814184240090241A62822129588425415142E0481132812DC882213042822489311848162201A35124C0224148241800448F24024A4182628490648004111A08181924A1C15898122CC51C1818421308131322614512F6 -:809700009684118141440818901220A84112230888412328210812008044F194F6008011820448A01290221908004100001998448028D4145882430810041442001248430441502410114404A01424A0818826044440F2B86424004824830883932139A485008127A14091839082850422812280023C4142728148022C43D1A1014D22C0AD -:8097800014B02C0126584A422614080018304425E242084122CF3B442231818434200810C8149428C218464801444218260815442C668188894202704108123015468461148F41C4811A141184210125128802004181121243086BC7409812581034111818262122E64118F28228821284100880314A901819D4249841144D2181C0814093 -:80980000C4481598C400A4414001D041218142240149D12202002941F4F73240B1924153238734114611B84CF111143F26A9B8341B191B142CF814818F696862ACF1478D5E3411AA7A657884B142B121B14162131744FAB116A8112B854F51B517D944B812E141F115454F65C391A12541C2114129F546621ACC164B88C338226B2445D490 -:809880001485F8168424397481FA113830834AA8216E113762E21A3219BB8CA3A4A88744B30EAB19133538FB428FD5D2C594689F84D415E2C5C81647248F18D1E12CFC41231C612A94172114DD422F88D81A748AF85429C7A46F1538138D9BC58C58422B812D145E5E283AA811442AF288A5E023018187844D484F71B328F111621E212D78 -:80990000A3857922EA81C14BA7917F998595144AD856A438144F22C1112F38E8627338FE8E4367133D546781E022C5445762137468C6311F6664168F22B1817821C4921F4391112A9243CE824CA138221A92A247A518A0814768572B144A521228142829C8482112432248A141C0486082A0428120048100A024304819B848028A42A12CAA -:809980001828C0688042820628241A049A44264A06814880049FF24AD222B212F228222AD622F8696F1B222E422F22F369FBBFA7F72AA8ABD81F18F999FAEFF2FA62F26F41F19CD26F7AFA8DB38F16F27131CF57F6AD8F2FE454915E89C793C794BEA37F6CFAB6F43E615F7BBBD3FAB1233F62FA37373FC1F6B3BBFF8BFAE1654F4DF5EF1D -:809A0000EF7B6615F1898425BA12B724B224F2A4848ABA31F394F44D444F4CFC56442D25242F31F3D27AA5F922624E439FF7F739288FA2F27672BFB6F7676F8FAAFBA8B59F38F98BA3EFF3FA47D7EFCAF3BC325F78FAAD9FFFD6F275355F77F78B89CFE4E8A1F1448FE791C7843E2BEF54F2E4A41A54A13F15F2B17B7D877D473FB1F6A741 -:809A8000ABBFD9F8D957CFEBF3AFAF7F76F711119F3AFE824A2D624358244F4AB888FB35349EF26B414F48F8F6746FE34CF372423F31741AF82323CF86F6CF5D9FB6B372E742F3EDFD9FF5FFB9A98F8CFFC1919FBDF56E3EFFF4FDD6D6EFCFFF773D5F58FE63759F16F2ED7DDF78F866ED4F12B67CF425615E572F7AFEF6D76F45A7CD5F9F -:809B0000F1F576455F79F613955F71F17F4F3FFDF3DFCB3F4DFD7D76FFBDFD53551F32F3CBB36FE4F8D2D44F64F996944F23F8566C8F87F7C4B465F484846EF64FFA4BF173419F39F5333B1714FF9EF65F5D9FB7F66B684F47F7ED5D9FF7FFB9BBDF9CFFC9DB9F9FF55CDEFFF6FF5E5EEFEDFD557FDFDBFD4F7DDF17F3657FFF58F86D6D3C -:809B80001F93F5FD597F11F75556FFFBFFFA581E326F6FFE16573F5FFC9D355F72FA1717BFF7F4DBBBBFFFFEDBD6FFE5F5BFBB3F74F53333BF3CFFCEC66F6FFDD6966F6BFBB682AF8DFF3C1C2B9C6F41F1D4D6AEB64F220E1810421802141226022662894008124492241210810281112818281890140010060065018884141200004400F1 -:809C00000012284004CFAF07290424001E44421902C0816024828734116C88644447881C9844891105418129449547812D42442C544148135122444613314CD0280814118582A4844381381410142201F0B196C0421F41522A1F417248F21124A7241F41B26AD141B24AB911B24A19B54A7924F84A9143F2429147822F14F924481CF9247E -:809C80004A1CF8264A56F1244AD6F1214AD6E5A2E449E2A2FCD1242EC31F49F228921F4932681F49366A1F48B26AD141B26A9921AB9459B44AB924F44AB443F242B4478229F92448984FA2E4690A2E414CF4281316643617C146D241322C1F89D44AC164AF143A15AF247984F84231412F141BD412BB26F442914B1A467126EA11F8244A3E -:809D000096C14A1E242EC39E242E5B9E2C2E521F487628F291246AF19124AF26F19124C3F28164AF62B181B6489A25AF6428F248B243D248F384482BB4678A2B144F82F1A88A0082480000000044000000000021008008000000400800000048000028000000002501DF5E062800A11008163418111E811A64281286B148781401444C74D0 -:809D80004194481413089112C01481499452A829696188122A2871822251343024244653389314C192246081424034842882EF840E23244A082426944193924450288448CCC84C798284924A888A8132182843C424C022224311D124122C12314414100C4521479142138982014C01128E2141499818A01416E144F2E79F20244C1802C355 -:809E0000924147128C0457A183A14AA9D129EC94EA1184C24849E83C817211F8328148C982C1A24B214CD141B4432122114C3441284522381656542146E411386587311CD4418112823818C88341B244691143DD6C0E2382028424001698141188483084444144504248448C04401401008470247288B4223811292C8168811061322002A1 -:809E800025028180299123414440042822771E002008880080080000000000000000000000000000000000000000110010011400775EA0441239D144049714242825D484A4116AC2814482451882F42111186C2A21D681E41828C226508812843B488B181AE842423242114F410195C1864A1246083A4741D24458821A2524D244D1286A13 -:809F000081224AF452C380A421314D548D887048C528438434323814D022E8843624218E9218548D283213C8C166D42402848B45B0930144C3842E93134F4884B86842054156B822845318842F240A4B53216441888062892FF9040082008800880000000000000000000000000000000000000000100100114001702907411A4221014880 -:809F80002428C0488140012C9141244888908890181512182434224A12022E1283A842467422211102002502452208804188012C48981A4844124448CF91429211254652B418701451846901C691221E8230C416B41414558719A443593444702482D6C22114E81241064116021847188E156C721C7311B824B448212422B842C141206484 -:80A00000C4224C887492C8488C3428F09DF124111811651982C4116D284146A848002149D4426145272489184168448B1434EC32642D1E4848135324002442194122016D11B5E242F4124841221022440841226D8A80344852001F290B4721472220210141241250A1281B18803941101525A4961141008024322821807382AC3444296265 -:80A08000594D8126148801602488825216014AC14888B048919A4481C382F46B652004421603810044C01884152286040083C832306600884C628848A40045612A400165C83C830149085820822434141D84A012124C0400290481DF7209102884A2141800009046813E88891112849214E05832821488C18C11C2A20054140028528C21CD -:80A10000082818122012B221791112C4184C024304432802611824CF8E0F2CD124611121841054241E4185840C21008004110040042A0419127414012400C4800A4023014538281961411028048400181284218440F4482E20751222D11262844014541284D88431A9A91410247281889226431A81F86884CC72229964650A14412A18C8E3 -:80A18000212C4F8473112843644142116993F19C31128D81C122524E148A61A2C04818A4BFA10840442191121608B044415428488148850242C014121C8844040000160144211006A041C98C142219E881A212004842430112444004100441DF9D078051842112701241498841C911182414408458414734158441065028123B41148442D8 -:80A2000084221E22A02120C124211C3118E0A3048C22022CCC1248A4622C0222122843F1193B2002283028184782223088604270922821382880086632812E188E2249024334888054121A64C4425111448CC411184188801881348242604488908442A048221EC2F0F66FC062114311011140361155228171217811042C64198A3122821D -:80A280008AF1881514448651414002121860818023A4411E624884882127222C88A2212301204882042B12A412A51414FA5DA30044194414C44444292122268214221498164C3245128C312490A24619847424E91982B321081E222416081A0849044988242208846144634104238A214844042022E254074B4812404411C41190144100FE -:80A300008506008C01251841082C241409006086528C041344081224342430112218128068218890287024582886E884189888142FE70B16022005845084250214250884154834822018024482A0186024100C455832548C4254814410A8211908438126048120344C56C482428841221A08416BCA00C06224818082023018A81044240839 -:80A3800081490100A18A32222902ACE4214404200400484044C124882C08141341064321084906A012414148A8BF8F0245114418483119A41185942321B110C13281401848941A40C114901A35088515D28282A21211140029A4438543484148E84269186068181224162811E628C414281288FFC9038C0148134404803421204214C32217 -:80A400004110614128278114842B14948941859A244AC2142488148822A4C0E8814118A582048425E841228412024068851880584285F25C5DE0517496742444DE1851181F32D11E911B2F1A52398F127113DB9CF119334D1469B354E1619118EF5C82F1C171A7256187948F72F31D41711A31118B758D322A71217171028F61B91171857A -:80A48000AF2185E1C2F12828CAA2511AF146C256F498C48B16A7A5C7641E5CAE145E244B13463B82AF250E6642512971457C15E6417221E62272118CF153A24932C345CC8217188FD868883F51B831B11168E31CB889B22591444E1A6E78642724378247C48F95DC4AA2185E4426B844361819F8833A2F28E8297433FB22282F2868418E07 -:80A50000422F24C14249F812A8ED824FA1B482E888AAC24F22F93DF99034181E285E4113E284518C8C76147D44F232288481161672C2F8388C24FBA24D4A84E7D889F8A56C2E8F257643B8A27A18F7EE698D7C2CB83294214941911429722A9F326FFCA181682B948D149D878B22186919B486AA52AAA426A9F82458A5F494348D2CFE6E34 -:80A58000801282D21281220442A084A084A08484422246220A1B4B30811081021021088241C21482432218064643A882120020080092208882848244F4F75B243F31F227259FF2F222155E785FD5F6696ADF17F371723F16FEC9F8BF9AFBC9DC3F74FC43D2DF18FAF4F27F3EFEFF934D6ACFB2E75AB5B1FBA6EDBF9AB82AF266634F16FE14 -:80A60000BBB1FF98F8F5957F6AF232A26FD5BAB9AA236F67FA168C2721AFECFCFAF46FEEFAA2E2ABDF5758DFACFC7262274425B2965864CF45F12622EB368F85FBB432DAEF44FF42823E8E243F35F6367485DE72B712F31D2D9F76F669271F33F321A7DFFEFF7B799F53D35FF845D3DF7EDCA8F8AEA26F2EF8245B8D59BF58FEC1C11FAB9E -:80A68000FBAF29FD8F27A1DFF7FE2A65EFC4F4AC8CEF7BF232A2EFC1FA89A81BAA6F62DF82FA93E3B5FA9B957FCEE228FCCAC8DFDAF3C9DF2F2CF472626D424BE58FACF46C2EE7AEEFA4F1583A4F4DF7FEFC4F49FB98DA6F9C011F73F11777B5FB1E12AB12D7139FF6F23F777F71F3BB233FD3FB636BBD2BB7F8BFB8F1DAD23F19F9AC1A20 -:80A700002F2CFB1746AFD5F1E79DDF9BFBA5F72F1AFA2EA46F16F66562BF17F63E226F6FD5927A18FAC2681F81F3B4956F63349AAF13F2828F2F7AFBEEADABEAAF23F9BF3D3F5BB9B2B81213B494FC24A4CF6DFD3E9EAF8EFDA8AAAF8DFE96F4CFCADBA8F37E3CF071437F73F12B2DCF75F16A585F57F4792FBFF3F537359F5FF671F7BF50 -:80A78000BBFB1F39DFFDF5CF5BEF69F9BFBDDF7DFFD3B53F78FDEABDCFDDFBDDD8DFFEFFAFA8FFF2F22B49DFFAF43B7CFFFFFFBF1D8FA1FE3232AF88F391B85F53F13616AF89F2DFAF7FE1F1D3D5FFCCF8B8F2AFADFDEF6FBF9B79A8BAD2BA44F1F4D2AFAFFBFEFEEFEFFDCEDC8FAAF3BAB8CFCEFBE4F48FAAFBEA6A1004414001452261AF -:80A8000022842642081224124450681285147148044C12411463444183842184011C0118842E11841420A241228608482448441AC4228A44244104FE74F0861312850381448D11284D111285013C51814486C81216885881888039815082422E18812D1228244E2461124014C2242144AF2269892C618834C0124309B28D16C0848418A270 -:80A880008941F1125FD022F41124A5F21124A7341F41324A1D24AB141D24AB9419B24A19F54A944782AF3439A42F1479B5D812F9A5481CF9254A4E814FA264115FA264192E4A96D5A4E44DC24A1F4DD236F49124C5F29124A7241F49726AF1912CAB941D24AB9419B24A19B54A3934AB9443B242792498924F8284FB244A3F4303841F4145 -:80A900001448B448711134481D24EB1419F24A941D24ABB4112F445985AF1439852F14718438426F8884F1245A884FA268114FA224F9214A96C54B8B29266BC9263A9189B49132489E6423F6114CAB841D24AD9419B24A9325AB144783A334242B144598BA61B82E1AFF580D00480000008240042800000000000000000000000000000096 -:80A9800000000000000000D0654CC1221410E881626190183B21244603121485813418411884C2860483440915B824C411918CEC82146428B024C412281112442AE491F228828A42A28487181C85C8882CC124AB1823E24A942884F022DF009224541427924F14410447118C811178884254241F48C489812611D318429481218440F88AC2 -:80AA000022881D12442F839418221542911127A18936313042189C41D818022938182143988800C0841C14F885E3003305911E288D12128D123841198471288458832CE484494C78217842F22C81205D9283486142378A359891913E48869A281F22F441122673188145819218B6F88118419B2826D812E988918A88A5E42188C2628881E3 -:80AA800016F229B920022444341D244714441413D12A011815481444358118C08140548100818C248138486F22448401418001A3E24162241946825228481C8804C014A2A1C08447824284773BC0411A5212C01240130120042400C082121C084624428404801221B1230100488001210017484572810400104888080021800200FF960A69 -:80AB000023525286D4223124448A61212225143A188E188361183D886058188711221CA4121538813412612E84CD42228449582249B88152415D386C7815A8219C014FA128F8C821154812142461814C186443427078E442F4E56A241D6236522516E261028A010089048F21C81813188B9812888D112866818264183424548E2217C32178 -:80AB800081866424868452341443D842A1184437488E12B048081088088C4144242102561874350E10250840542117212C420689010082908513014604434109A021604142220021E018018743501853D21801C18219521885421424012C084382044322F6D6F740489443C4412118454101D0240288CCA882821C43B114541C2D444480C4 -:80AC0000882148F421822227181C11246812A28490410082221321014612448102226081442F8112C21446B2260F1D18C04222214115342A235412284110048158A0180021112C88A41292004822548F2244741442440E6724901116D482014484144B41808611140200218289F2493B00218111111128182021011F882191416D4184A5CB -:80AC80004204821A280410549270421818240200182391112843C12422608880810188818429316448004A6282F094441411254492216441323D2A3C24A112289311E4C8B464688D2CA21818114E14412C08301B411DE82AB427A8218C44F42112446D12144732411D14B6848341041860188C44B214926612412D384847894AF2D4DDA0F4 -:80AD000018501AC4251151141604110029284953812417815449D448286814A084430224508210C4242948A492C01280814242D81828911819B442016081008304208242F8D9FC00802292211901839111C01486221101180013129411E0111204211221004032140020019A12242201400110641128812121100400211FCB418222021839 -:80AD8000404816011319023082B02408AA91482A4C8412681C8A018561189014414E148481B021812A0822888089A8280025884218C2480089D228131414F44BC62008105282828481800A888008881C812801101128022612289231A238822068410010215126B0212151228002800180618120944842482F4C0150435041F028441524FA -:80AE000012121401002130444121482144633881140088001061226C91282608402C2281084038214441282100882908002504FFA9042922024415142102311880010049A241231502339136154222C22220034A11810150228E11810080014100240018400421000050822F49020021402812888212430210061228513223212218220235 -:80AE8000192142038061221001001288530818101184440649C222908200101404F0228C901425C82242A2434802438122010000112014440823038C082094184C1212489868988C84A82800412A6418E21160428B8291818C11C828682283022942E4250F128244364304215400113018141870244851241A420845028400400920223226 -:80AF00001341218524031A08226012501480018009241885044226012FAB0F84904200182848244D425062C0220025224201E01C3182B02131412E812022188468112E84118C9811481C11D182988284182125428C84220112828A4221C4282384F6A39F6062E39A2638C9F8183869E2F232117F6868412D821E1229088A5A7B1D83AF6174 -:80AF8000267113011D241738F01142205A81AE1614471A122B5A6D18983218D071C1824A621260684542F82C1418108C84688A4521144813F2121C80230857112E214D819516C9373E411D11001718E04111F4543417166F287128B881FAAC126E249F18E8127221C161811AE24161A18F22D1B43AA11B638CA1824B184BA96B182B131EDA -:80B00000181F3A3A2A2825E28418E9236389AD8AAE1229F3282845E844E4547244F8CD9E2423C12326726256C3174626B812148253228A115A242931247A37A2186E646CF134551E8929E88212D28AF313823E31493C244ADB867219646127189F48A8299F132862C38AF881845A511137142A12721453882D1218A15A48B4387626B82461 -:80B08000E442D4410C001022280442908480082C0888804888084415088440088482452808808802288581562C288581D23888820800002018084440E45743D26453E6455466CB444F61D153F415567F65F185472F1981F88A8A77783F39D157F89C9A6F4AF2EA76DF16FA2ABACED98F5AF91A833F18FA6A48A5F26A411F3BF8CA4EFFD165 -:80B10000F821A48FCBF268CB9EA41BEC5F5A7BA8C8311FECF6F6FCAF8EFC8DA59FACFEAD2FFF2E56A2AFCDDD4451B9CF68A8818F8BABFF5F42F22C26CFC2B224D2CEF2EE76246F61D3E67626F62767BF8EF4755FFFD2F437563F15F1B1737F51B912F9AAA857783F31FB27B5CFEC7C87F77AD6FF369E82ABDD8F1BF9919BBF9AFA4BF9AF30 -:80B1800021F352F99FB9F8EE6EF7D93E858FC3FB4CFA7FF3B263F4F5D58F89FAB9F95FF7FCE2CCAF8DFEBDB41F3F7DA5F6CB472FA2F2DAF8CD1C9FB1F18C9E8FA1F9B89AAF8FFF2524CF42926E4F42D68CF34ECCD066F326466F62F21612A9F26D67BFD1F37D3D5F67F226E62D1482AF81DB77F81212674ADFD3FB74E55FF6F7C44EB79832 -:80B200006FD6FE949D1F3AF98BA92FB6FC131B2B5797BB6FA6FE3725CFFAF3BE2EAFC6ECC9BAE1FCA5D58AFA89995F12F8BE94ABEC5FD8E81FFD2587AF54E48AFA5A78D5FD181ACFE8F81A888F83ABFFCFC2B268F66E6C6E64CFC4E7E44FF21232AF227226F477339F14F62D27FF51F37D3517154F63DF42A119AF89D375F832126F4AF12A -:80B28000FD7D4F57FE755F6FEFF79311DF4FFFB5BD1F3AF9A3A1AF37F6333B3F1FF73193EF667E17F5BC3EEFE1FB4CF45F5BBBC1F695D58F8BE81DFB15A6EB19ABCF4DBD1F3CDFFCF86B612F88F85A58D5FD181AEFE8F91A9AAFAAF8FAF8CD2CCFC2D2C8F624648FC4F68398302230269016844B1216683200120034122811241228922048 -:80B300008812819212281828228121800188D0140818120014001260882089028B246044F09643004410312411244440C41340021441272443034118411C42424122414211261184120425012001908213480224008424404218588400007F5E0E2D421F4152381F41324A1F41324A1D24EB141D24AB9419F24A9251AB9443F24A9143F21B -:80B38000429147822D915F82E454F9244A5CF8244A16F1244A96F1244AD6C54A9E242E5A1F49E222F49124CF22F19124CF36F19124A3F68124AF36D141F26A9119F24A9251AB9443B24AB9A4B44A793498924F82C4944FA2F45EF2C05A1E648D421F4132481F4136481D64EB1419F64A941D24ABB45F81F2488453F2489147822D915F8205 -:80B40000F442912B424E944F22E554F924C256F12442D6E122644D3CE44DE2B2F5512C2E429E648F22A5298B121F49366A8E64AB168E648F46B991B64A9B65AF1429B34AB8A4B44AB13494926D4889DBA475AD0720080000000000280010080000800188000000008400000000002280020000400414F08D88006B21612121142CC222812B -:80B480009F28423888A51142433811110044B0110244811612D48154180012498801411C224321211274124301871585427681424224011048942881BDB8008601C318644210C8124880022C31481504B0A841022601281044582816044711282122105112400110D11888129811001440482152822682924114485BE840624F25424A9482 -:80B50000242823921A2F8458842C2A82314145111161815062222E1122418E188351269D141416752122C1A489116144223814122631892E111449D1184548C42181712880722232449C2275DE081011C484100184902121848503A5428801A800110010048442840000401241110100442542480124112D820012A1101801842EDE0000E1 -:80B58000120000180000414200400100000000000000002800000000000000002100004827AB004184130211420020010000182001142818002C0441218314044331424C0214100680040000844400160810880140F8C44C0044A02140810412200100422001180020016024002140044C1142041140048004000081440089410284120054 -:80B6000083F4A3C4004018010000000044000011108102000044304800202402222400000000000000000000F0E31D0040030018004008400240548142004800000000440048000000114081282108004212126048808202F0B222001042122102002400800188800440010000008110022200004421001042088440180200210000009FDF -:80B68000C50A000018001008200121102201000000000034000000860400238162488001480011000020048002DF280D003160112218004008801112021C840411000000404A120428481004442412288614112811088411428011C284422280021FB80A0024100200811022410220C8148400800400004001000080082400112480094A6C -:80B700000824001200002002F0DD54000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE004800000000448002000000100218800800001400848004000000400428000000002180F1F3B50000000000000000000000000097 -:80B780000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000EB -:80B8000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000006A -:80B88000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000200800000000000000000000000000000000000000000000F077B6000022000000101A01008200C02820020044400800240000282212842210012885020018800800E9 -:80B9000080041FA54902301100004210022C048C0C001068114111841440014242800480028240044DA1803118288C0112001400402811048482C71F00808102000000A13100800881C0281189120140844408424022028880824244280211122885020018804808004288CF85082140010080440280048E4800003011440000110042003B -:80B9800000000041E0120918162842081200140000124410086F2705224C0220023011A0410021001160881448460128204488024C0281884222111800165422111816486289811319389100460289012812004F740B10D224014156C218844CC2888E2116B8815181D04814945116C8A4263C218C641295C441B7441634423C1101881200 -:80BA00002096141723841B1426421204421C021440319A80AC681618A8828C342CD7510050241004161811E4893481184008150893094684C421839421C4833424122B2414210018A0244413128834222447816089141008C088248258898102C024DF7E022CC2241220C2523018288012989311304441489C217A240922C04134994444CC -:80BA8000845118888A84422181612149D112512112002364821B18141B8114232124B42808818AC348846F390369542C442341148802164802578293818802481814608188221B21CA12642CC08C42402982028227E1866242688D122E5840280211828718CC8211262408164804C6F8C8D10081601400AC21624441184180120800980079 -:80BB00002518042021280284144501188114424180010000902480220142848301408803AF7905181028628400001C011240840182422222820088854408420000820058106821008230839011810000832B012C0188009FBF0C27415022164118982829528474188D31144400C88089421868422AF8A448C448224D888304C188223091C7 -:80BB800018412D12188CC14870882162118581185148186F86981883480287481A22F491D88044148C324480014A21019018828903A0411C029882100100290440012818C04244A9CC2462B022092100286088188081842191180086D853064412C48345B41852C20044200400004C922518184D28282444AC51840084141800003820120E -:80BC0000C849002092188A13283198AC1BE821282133481280F2BBA70010816221530448C082C18692588632814562542418609288A3816412444226F42218001C82149152848284214880B818029B842885240810022004184142B0470242491201830442A0148140011504C02440648248181C5448800184542A2181844488840400802C -:80BC8000222CA1418048A32500211A088818B0883448487F1F082131504212403448C58268218E28246025222C21A4840048242890421684A48221001C92411C3222914011821168148180064001008C0820089885F6C55430811008848B241C02808412210480248881140C1430C4C813041001222A0100200414228A424821C2B8242C00 -:80BD000011C481882C21088A1484182CC881DF260C1E282244812D440044832412881248314544114712A042112A942DF0251841840011C28116088242106181131C984150811C2464D28E418B411911382825028AC4581A82013F81054C542400401188028008C0488002B021088C28082800484601891408862114418148280813048165 -:80BD80000081C800428A0218120000223FBC01134381322422411B124034484A41480116840416010040041008190220830400112200141280E41104188041480122278200200C587B331484800480018150242264884FA40215224482314142153CC299814191812788211312099C123812841448218908110060584C54182881200460D7 -:80BE0000880021883FFA4F32341F785348CF42C51E1741604416DCE452C82E22871517241B442C94C476A3628321A44E5DA6662832414E141F54D81681C44814AAB24134524E418B1411A303BE58C6A146F04848C332A24B884E184AC122A323A14C4D888951448E593AFA1315F041652157822D284B43C7164D4D81C3A4885AF181C848A7 -:80BE8000544C1161451D345B911B4689D649E385F41D248C9A4C8D492AB22938188D214E288D48811F1A1451118538814E68819D489D18682AE99CF248381F91B41948989A86EA88A111DAA1C18B13F048445F1A43813124142483C47A9B328C86B44AB4225A1A2D88EF887496F16624371261275C4D281F91D894782881DC77E4D111D682 -:80BF0000AAC4221F92B2B1A15352B42C81A2AA24349F18F841218816F159191F18A2D11F31BC4A43F19983B6A8A4AF22988228C6E88CAC8586D2984F02241004230240088220088244481001008240024014010000008880082E8100482200001280048220011281CBFEE027F62222AF42F22C4627447F44B37631488F227282F2DA923FC2 -:80BF80001CF628426F78F8D6F41F26F6838325F3B7855F54B5A1F94C444F1AF8642F7F78788A4AD97654772F94E4187821A8538ECBBF391DE388E828F89313A5F9519117841D119D1819F829819724AF847511C1298F844CA8EE2B548F81F84C4C8F8282ED2BF28881242F16F265615F62F2264447C47D3CAF93B128F26828C5FE5636BF4C -:80C00000BCF6A262EFFCF8D2F23F24F4C3C737124F1FFC45551F2AF97E5C5F53F5CEDD1F1CFCC1C346F963CA3F31F172789F9AEA94A4558FACFCDBDB3F14F4C1C98FA8F8135329F471B89551199F14B439F71D95172D3F1B7319F181912F27F4BAAA8BFF2BDC8F81D864F53A688D98EFEDF5F5D4342B771CF42C2D4F62726EF67537CF87EE -:80C08000A1158FA7F7C24AAF6FF9D3F2BF25D727F857927F77F3D7D77F6CFFEF9D5F56F1A199FDE5CFDAFC25595F1AF848CA1E59FFF3F72E258F96E41DEC95F438388ECA3FB9F923219AFD19199FB9F96B291F17EB94F441519F96F361A19F55FD19918F8DFF91918E8A8FA4ED86E522BA12F118184FCCFCE6FC8AFDA4361FB64AE116F4F1 -:80C100002547FFE2F27E2CCFE7F4357F8F97A5778FA773CAFEFABEBFADFFDBF8DFB4F873D37F73F3F7F77F3BFBFF985F56F1E1D9FFD3FF35D7DF9AFEA9ABFFF4ECD1F5B75FFF63F37B799F99EA86A6378F8CFCD19B3F14F499D19FB1F1D393AF84E49FFBC9C99F94F459599F9AF6D9DF3FB5FDDBF99F15F58999AFAFFFFAFA8F22BAD2FD55 -:80C18000D8D84F4CFDB6BC4E52EED26F4F0D18702441B824812482044822008254111081823448F0482470480483149128B0488231482044011484148C44C148A0482286089A4463892886089A54489244F0A62470A40180021658184441842724153848D02298414E26C014221411302114114445083120022420224812210242F028115B -:80C20000112419941860144002180048836418BEC6D022F41124ED121F41726AF21124A3D441B24AF1112CAB9419B24A3995AB9443F24A955B422F147934D812F934481CF9244A1CF8264A16F1274A96E5A26D59ACE449E2A2F491242CF591248F22F8912483F69124AF16F18124AB161D64AB9419B24A3915AB9443B24A79A4B842793420 -:80C2800098B24F8394984FA2B491092D481F41961E1B21A72617C183F411242B161FC1724AF41124AB345B29AB84B2AD154B4AAB94435B526F8314F2A4581CF926C816F1225A46E4A26941BCEC49E2B2DDC1C2DA1F49F628D21F41B26849B46AF18124AB121F41F44A944CB24ABB15B24A3834AB944F82B44A733498A26F8394AA2E523F06 -:80C300005B080000211008000000000000403412281884000000004008000000004004000000001082729A095024844008226014191428B481142C088419248612C421105414222001184028220444802112217328011CD21834421218420041244A93480084F01D5C90148260422F42E45132184A63A120446221705942042A010030886B -:80C380004284C01A40314819A1184C514812622C511818C88541C48881E02861124A18216884A46048184D884091281FAF0A4446548226D44296118C8121C54141482B52444A111438512A24421421784244AC188D121214569811199814898461444E182118C814260D1362B48816E14304888944448202A4406883DFDC0D180010C824DD -:80C400002268850383043C48D83808200200228140210200008C81120422D0188142E181028618084E12288819045028E044E981C48400F0AA862002A02122282270242111021440011054484011440181554215011502000000C0241819021181D018018521189844240050484144F0934C408441114251614501304242811818496454E5 -:80C480004B42A72913D28285CC418426D12784E4A2C51E1628140D121A763231B24B1219C1192D24121B41484AE28834828242255127008C52288CAA424E28814E24C7F5C024121112266112330244582904168161144521D48651164A611846051972427146D324711C638146430918182F21022E1414CD224B121B211142008A8178498E -:80C5000052211528042782E08208629044EF77040090221044041D220081004142432278284288048501C170680100440062118A03121901A0141183B648581A0088412504400A4F8452844528F229B72084911129014121212601194101471C328884902512C0824411808181C81824C04164C0122AC42228292181810284A484550227E7 -:80C58000820040220A984E2A2A6482CF3245D2415248608490139028D04822224488020028814440C211502852C084888745C02162C41124841A14212406224916827244889121429820518483144212C882AF540900221418812A0484002A318285022582384C8887244B188C02484850C12306604180298422018002A501C38421048030 -:80C60000280868124304442200F02A28D016C2142C1181711BC642282601381F2681D82D0423D882F844281362412D94885C41512842842742921E4A16A42442E944A31223C2221C23F122517024D88466A4228522788A81A424C0124F88D224A4384262ACFA864880042E411608204218C82C1410288801008D848C0426084842605148AB -:80C680008141009E24A02148905220442882C41210984118009218490484608281F013F2008594218004312448241180044834816094446044833848145214441C011222001142211542A1421502841135184148581800220084C04448423FA80C1248484C81C224441094114800400410140247849841444678284248124888E42814F8FB -:80C70000C12848828084318884A622028A02158404A3C4888C1CC8C84008008F79045880C44110111184018001241004284D88AC82124842024CC1148B8100618218121240618148124413446112308248114C08244140582249485824125F360930118082110200250421212D541012D1120182822284828B180042804C13582482802852 -:80C780000180881488984A428150424288430C48212002888CF25652A048192402111400001304004454480081C0242210543242481884443400818034818484214E2A488C9422004861480000448880CC413F380844100140460442190120046212C446E414C2144184791801C1403844152444481111C22880020018811098488484817F -:80C800004180888842CA4810024FE407803114471162422041841402C022805412880081800418228C11014894C0142014238114414122A828884001002100A048001048F8EC8200404412912280022D449052216905290529054A01806118411450414044824442081400D0411182012140441215129C4446485224C241CB288482DF445D -:80C880000CC441182382019014180044800210643A43286A289022442F18015C2C591411A90114121D124618B1182C011D14111488112114C02100604C00268214027F74054F44F4941136F425112D6327544450242F41A1442951226941764256376F22F864882E4447844B2C41C774276847541E4813341670117262C21227B2899462FC -:80C900002188811F28049E312B881F2C68281113F44A47A44AC4824AB68464426D482FA248E894A8443F4B071AE144D41561419025114D364C612425410246044D11448E1427484B88876285C4ED8246F821328D148B188954896D4C895C4A9B945E121F1828D588F311118C59E4BF825C388D28AB22C55918D04C788848788C48B8CA54EB -:80C9800028CB488B44C398285F5F0150812CA2241B17265216125AD41554211AA4441E426B461B4187841F15D619F4183A8A68838F2A9181DD81878177144FD1DC51F1C4478F1471813814921521D41171913142C713371546F261282D411794234C5A85371465F4C444884E82AC28C824474A2CE488F194720018400126020024C012C0D5 -:80CA000012C012C012808184A148814800008239A128218A82A128A028148AC212400180440124002220022004281FAC0F4D444F55F114135B314F43514765F424344267512F1461212B156D14237516F45E186F46FBDFC94FCFBAD4F964185F91F854C84B8C8F367216F746C8149F71F1159F1F28FA94A687121BA2DABDD1F8A8281F1294 -:80CA8000FA91AD5F4CF6E9E81FA2FA8B88BF12BA4A5C199742D5F5472D4F42EA24F64E4AA3FC6E6C6DA8CFC2B248BC48E499041AF4591D4F31F175745F45F5654435A1325E145D156F5581F1623447412B355D14FFC4F5B4A4FFDFFFECB84BBE6FC6F175C14F4CFDC581CF365B762D888E81DF7DFD95158FB4F684A48F2AF8A9683AF7E1BB -:80CB0000E187981F1BF6516D7DA6BF86F7E1EAAF8CDC39D88E5889DFD6565F7FD4F224244F68FE6EEAAF86FA4C6C4FC6FC666CCF44FC78485F630B4F41F514554D135F53E325577765F424342CF157472F74F142522D326F6554266F74F54F1F6F7FFAEEEDCFCEFFACF8674B5FDEFD859D4F98CCCAFFD1D515E58DFDDDDF6FF5F572536F3F -:80CB8000EDF5CAF83E181F13B39195911F13733DFDEF47AF8EFEE9EABF88A8E69FC45C31AD21CFE4549FCF44FE6C44CF24FCEAE8CFEEFA46E8EFCEFE4CC48F8EFF4CEAE041F419555F31F165351F15D57552424F42F344545F74F552152B456B644F64F576444F75F44F4D5F7AFBFFEDCFCFFEAC6CC7CBDF9AF9CDCFEF98FC1D4FFFD5F503 -:80CC0000DD5D5FD1F15D5FFFD1F5B8DA6FC5FD587A1F97F5D1D11F11FD39B98795DFDFFC3F97BF97F7E3C3AFBEFE6BEBBFC45CB8FFB4F6CECEFFDEFCCCE4CF4ED82CF84ACAEFECFA6ECCCFCADA4CFCE8D86F1C0741009014100420011A04488044A2414C22D9482251480030481088210410020000148422008414408244E18804848182C5 -:80CC8000818220F83CDCA0181371240247342814B044115122001225341521130884209828828515E35112428564112528413A11481341618124118724F0488128A512114208602441AD82200481144F9E042CF511248D121F417268F31124A7241D24AF24D141F24A9219F24A9251AF243924AF347924F8429347822F14F9A4488F14F992 -:80CD0000244A4E814FA264114FA264193FA264596D5A9E242D4A1F49C2521F49522A1F49724AF39164A3F48124AF14F18124AB9419F24A9351AF243924AB9443B2427924B842F92448984FA2F46955C05A1F41D628E5417248F3112487241D24AF24D141F248961D248F241BF548B243E2347924E834F924482F14F9A648AF14F124524E76 -:80CD8000814FA26C116FA264192F8264196F92E44D7222FB912C2E4A1F49762AF29124A7261B68A18E24AB141F48D26A81F64AB21B288F2421F24AB24382EB82B442FB22482BB44D1A6FEA0E8480040000004004000000000000000000000000480000800840040000000000F0B5A40025911585041C1298211480441141044B4242411CEE -:80CE000014480441C4457A2964114562428A0422888B52282455821133212448141140111938C4212229120AC428484942B2A74E22240811414440066D1220018531111280389249F84118841424112084A481441887281E22441F41A82422830270139838414083442298188C0487442C0824C01414421F930A4642681119044541382400 -:80CE8000403446196112C5012A04601984EC0441C3512DC7181C714492A48E44189129326A8DA44215342A2D411C321B8902113442912FC2E884394A2822850285C622412846D2CC01211141C441281051321200001C31144243384243C81184142420220412002A289914136122281800B04251410014004100A7648200A04144F086816B -:80CF0000501211004732100824000040060024221045015082444508002081012110224141488202601400502884002400221884BD3A60412495141C024581C41441142342E2A831115C41D4813885248074240841502B1B34453812228849024113641116CC8290124906864408304148121A0227282608481CE18228765E0D494151C3C4 -:80CF8000702104C4401402219018181C011D88342820440941A44599464508288880411211110A25518243143284841904198414280188250848288C81F431221003405C22102124414421422258724144C084101265420021E0910223016043402484C1141A0818282200000016C2282480120216A1288CE2510E2D141D148915218112C8 -:80D0000058241229348317849022102248864122E82801108481A484212418565184184819384210026042308243015115A824004481828486582840F65E3D00C0214210C244104444D22401491248022028417848629624884CC11288260B4543612A4126182224119122494208C1243843041C02C484244424221622013F760A0000007A -:80D0800018181400000000234104482812004011284104802102224542041211128411890224004100123222006604AF1A0A16D41491390023325447211664442562252441502282160424A094164982082C2534192415042E1C63A2243DA244642042C1188415C8282214A51141144464218A618284844341F41F62100210810181400327 -:80D100001C5881008140022D94128B8426A824401444418A1226915282184008291191124C322490861694124880048481844C02292AA12424CF544A92111051634410042C021450A22441444011420686840140010044894818480C8843094400241684112401004144411042984C8034286E3960244143021068228421C190C91419C445 -:80D1800081248110AC282811CDA14004891261112CDA24024C18A14848118824A08100883728241821182B282081C1824B3821203884E769001113018485035191290200411420412491111200241424484C140412A012100121211601212121213024284024410283820189D44804F0529210242202403428101471828814048984410105 -:80D200008681488112021044418228846424406244002C42982368121240084812C6488214180460298041F2A77E7092114108A124441391321C021114874841861B044150241695143400444011444237284100142C18011004211820130444405C228041041E4827268EEA004302C1241C02218441004A181108161802440021442445D1 -:80D28000014501404C48C31140011200450200002022010000A1889800A76400002302481184C08819D8421802886984781498826088222840082028B4C812028840A9488608420080C89200218220391C208D180480D848F853FD10041881008001882110085018458322011901140050412001604112002484212614312244410019019C -:80D3000000242C018400C018007D7B408881044014994411488425048B282CA448800114617082021C1182289884202444D182918494127818E081088C041D5222C4234104E02108122C222114023FCF0E27411748CB224D292143A42257212E165C12D91218F888841FB8F8CA8B1D835311EC1841A5282E356140D544F28181484D8889CE -:80D38000084BBBC5B94294C1A788A22556214C18624829F882122F32419812CD8286B448E14168241612DE4821C1524D283F254B5211471218A516DC6252C8AD1C15B984B482E824F4438A488B445163E142A19815F2169A5D15C349517211397444B493E84AE244764F58A23F41D15D28AC111A9B352D218E32642D1882DD411E242B366E -:80D400004928F4148216D22CF1181C23688A4F84FC42D88A68429FAE45B144B112721103849559371C942ABFA2487B815814555B444CD5C8512A37414DA4192292812415185618D054E124D4A6C156812048D33558228715707238144F21E42121011622E3418153462598A2981E3623594856F888C21F294721A4123022200466024240AB -:80D48000A148002088428872810815487482884228C41828618121102404B02A018B14B04C088B84B0480887446044402248044260443FD30F4F4677157421DCC8F44444CF46F669489B165F41F72E648B481B8CAEC6CD8A1BCC4F1555151B999B33CB334F12F22C29DF13F188868E84DD3CDF44F649419AF9E86A8AFDC5DA4F81E198F808 -:80D50000C9811F3C7CC2F2A92B1F13F711186FC9D98A945AAF85F448889F8DBDCAFD4A488F88A9FDAF84B592A9DC8F89F9AB3C29A4DD8F88FDC8CADF294CF166245FC47419DECA54C6DFD2F24844FFF5F1377CEFEAFECEC63D432FE2F68D861F24FEDE57BF91F19D9ABB33CF43F3B9B9FFC3F339319F79F98A8CDDBCDF44F64DC15E51CF05 -:80D58000A6FEC4DECEDB2B114B88DFCCEC2CF4825ABFB2F23B581F85F5D4DCAF81F51A562BDD2B85BFC9B98ABA62F5C4C48FCBFA1614AFCD7D1AF29A98AFCAD242B552A588CFE9F31997F077645F53F6112AAFC212FE2424DFC4D2E7F73F344F66D2CAF4C1883FACDE3FD89FF4DCD9EFB1F1A6B36F99F9B592EF9BF9B7314F93C316D5BFFA -:80D600002578215915CF9DFDF452EF45F4584BBEA2CF88F8C5CD1F3CFC93432F29F11D1F1B44EF4DBD9AF9D21C2F2DF99143BF42EBA3A3A94F44E449F81E1C2F49F97A7A2BBACFCBBB92F852188F89FDCCDEE75A147F52F639649FA3F26A2CE5F8656F3FD6F23F7EFFC3F3E1AAAFECDCB3FCC7EBFF78F86FCF7FFDF59F9D6F1BFB96995F73 -:80D6800063F93795DFDBF3353C1D1775773FF965495F1CF4DCD94F2FF55E4EAFA5F4BABAEF88F9C5C5CEC2BF39F19A1A7F755313EF4BBB9AF9C21C2F2DF8994BBBB22FA7B6D2FF8C9C8FCBF95656AFCDFDBAB22F2BFABCAFEFC9FD58588F8DFC6CDEFF2B051C01148445C2482484148424841482141B484048248122080060441144208448 -:80D7000001214200616022C08212002492204902200112832401F05CF2A04A442400441444181514424852812554842D12842C19153225184011032019A42125C8248C5141241249285112909244301123020044431108294858421210D4A20E2F32F41124A5F21124A7141F41724AD241B24AD141B24A9921AF1419B54A3924AF143924BB -:80D780002F147925D812FB25481CF9244A1CF8264A56F1264A96F1265A8F59D2A2E449D2A6F4D1246D421F4952281F49B24AF19124EB141F48B24ED141B24A9921AF2419F54A9443F24A9643FA429447822F44FB24484CF9A44A9FE90C27921F41B42A3511A7161F41726AD241B46AD141F44A1468AF7493658B9443F24A11512F347BA45D -:80D8000088D38694B22E581CD9A6EC1572266A1C6D1A8F11D212EC41D2B6F451286D821F41F62C411749EB141F49B64E9161EB141F48F64A941D64AF249B61AF44A94AAF64B1A4E44433A42F447BA6F84A94AAF1C8464008000000004004000000000028008800000000000020082800008002009028004001BF890A6441501800E42280CF -:80D88000C112818480413181411C011122986C0870381154822C5124244A21220519014711444D11690888A042128031128301882122B0281864443F1A492163388445227122054C648245028E4170841279841A48088D626241844041128421318836212252284722412220888244825182C712121B821282448E221684722462E12A657E -:80D9000044163988AFB145D12463548414182742E4228C1234169126089115D6811844D128522180211923584A437112688147121D222A71283248614A031939245463184238244B4313031849C2B243819A26ECE222447C14A1815F210A0021C42111C0442041A2483084296188408881A42443928841001E21002C281122041E241001B7 -:80D9800044A0412091821508821882294108402281A14A814D48F30E410050141008850214400140081302410085010014000088282A0C29410400152444081200100410024C618288161808EFD80B39321125951C256AB11D84C0446A08AB4124A44246048141585142284245584325062484BD168D241841200427182419022242708216 -:80DA0000A814400924112482245220082E846E1CC0241114001C61C840864AC15810185248D01812C4541442141018516200846C712428A1488005194802112246088CA914000011804804828C08884F374442C11241CC516BA4113048481052218084040040048C824414160124509282284342024421902144420021009144245022C011 -:80DA8000128307188449F2771E00407446424203250244114B1621A82518186624008C412211444258424C1851820049022480C364301225E58814C335281311C428254204800428224E828124EFC90C440013042241142800C11143024018662210522840820848882150851008282445D8827424011800108898252840C214218465487D -:80DB000012642118F0DDFD804114038911CC484001004800120020019021144810218481041200480012822210642270820200004240841118184804AF380E415032418542D5C20429120462391444C81A506222301A81146488A5424594132954947024084824442B124F12B812D214918C1D221674A82299215022416C04464A2C129AF5 -:80DB8000484901EFBB098C41141491128C4212410114160882215048482412003819A1142084048480018012A221C14002460226031410082412108441C82492812CF1D212805414850246591212148344012044A624418584012481301400141088110C2982420426244202282840168428010000E2008694944908F0FDC724165C281812 -:80DC0000113244100281104291881C1112420A63A2844D41C0428424844160114481800224244C8632411011014433021031244C1218582600126D22F0CC8314244200801452249044A301C18C041C0425250110495649901C00000040584840044C14012508188220D18215741208400C8220483294DF674A0224404C02241001119121FF -:80DC80003902008244812008000000348541164484D24108BD44D048984519028419D281820289130461238201230229014DE120588216344211111824448224206848648210682813082029081048D11401E0824144023821101442941A1851218388224854124180220840644A6CF17E3A004140314444460160618E481041924984009F -:80DD00001210141C1A0885010044241008000084382144848819020000842220120212003F2D0E4311C12160818163022221182E81001044C41425888202A0411841444918180800280080020082222281218165182221021221384100F0799AC04100410085046C240882483084148B481B28461C242808452128414412481244048110FB -:80DD8000031421442110411106181072880147214140042114F03EC640081904610015141111711866812902860A2150382410228801888E28449018189C0849C11841898C9518184931122D188440AC148F11021028A121111200F0C9D650343F184414D94511D14D135656618714A9D8265162CB24A542F81884447712837448E9C17135 -:80DE0000DD049518FA88814B111556432F82618222411D22413CF81C441F39741471821DD922D25B4241F2481A5D143D19811884265441414B11344D143F9E4C925285FE12122714A715E5714212D12112F1111217918354142566C885F4241947A54427224D84249C14E841414C52588445321882CD2426F4941544774223A62226F21C50 -:80DE80001247111D1445BA3288A3C12721CD84E0A8F23A1229E2286141701425F125BF145614D49152442E4A462641E784E4FCD982E828D291FCC8881F11FC45816F247883929A8DAA4B88139884882958144147C284CD1187814D24E5446A81237222D28842D2CC714294212C739CA98A9D2887836185A9214F62F22C444D241E926B8213 -:80DF0000AE128E842ADA22F84FF520112411E48902282428A02824824482348214823448148A4421488151180018008A82B18112B28182A128A028000022000084444024432402BE75A0555F54F13D3DCD5DDFD7F53115DF95B525F262681F92F2CD491F13F352449B19FF85D79DF84B48DF12B251F5ADADBF8C7845F91D18DFD45CDD55BE -:80DF8000F911194FA3F312185D1515ED83732CECEAFAA1A73F72F3618DDF92EA1AFA21236F7EFC9A991F13F2AFBF3F53FBBB918D32AFE9F91313BF9858CC8F21F32C224F6AF817926B914DA44BAA1A72BB0A5AF514553F11F13131DFD7F5794DFFD7F725273F94F4515C2F45F5BB39AFC5F65955DF95F7474DBFB4F4AF2FBF95F5AFADFF50 -:80E00000DE7AC7F91511DFD555DC5D9D1E19DFF3BB12D1FD51579F13F32C2CAEAF9FE8FAA3B31F62FE29A91F18FFE1E37F72F31B199F99F83F3FFFFBFB9B9D8FA1F19ABC35F39BB94D248FA1B12CF3A4A46B886BBB4F4BFAB4A62BBB2741E045D551F4353775F751733F75F57F7975F44B43BF34FCFBF51F31F9DAE89F1CF4CFCDDFB4FC90 -:80E08000CECCDFD3FAD2C85F72F2AEECBF91F9D8D89D99CFD8D89D58DC5FB2F2161CDFC1F11D1C8F92F2AC888FE2F2113E3F7BDB43F4A9291E311F3BFB4F4BBFF3F3393F7F78F82FA72FD8E821F1DAFA3731BFF858EAAB57CFC7F6B4A66F29B9B6FB16944F4BEB28D9E1016F45D554F11C1FBFB2F355F73F75F45E5A7F72F26B63BF2CFCCB -:80E10000F3FBBFB9F9DEC99F5CFCEFCF7FFCFCCFCEFFFAFBC3DA7F7AFAAFECDFD9F9D9D89F98F98C8CD7D1C5FCAD2F7F51F11D1F5F51F13821CFCAFA212A9E9E3F737222F6AB2BBF9DF87171FFF2F19F9FCFFBFB3727FF7AFAA3891E32EFADDDB3F1BA9BE7E2AF85F57C7C4F6BFAB7B22BBB4F48FBA4B68EB23FBA04211002415024102493 -:80E1800041023484000044828504850481001088111812081004618421842E121648012041824444482241062800F037F61014512640538100141749218029C18541A9688921265842922048141418441144111458A4104204444532112542543A15148A120825254244181294124150247FCB014D421F41522C1F4132481FC1724AD241F5 -:80E20000B24AD141F24A9219B24A19F54A9643F24A9143F2429347822F14F924484E914FA2C4816FA27418F1264A96E1A264592E4A9E242FA2F491242E421F49722AF2912483F69164A3F48124AB141D24AF269921AB9451AB9443BA4A7924F8429447832D944F82C4944FA2F4FB93D024B411F624421B2183F6116C27221D642B161D64C8 -:80E280002F62D141B64893652F64B124D41891442D334F82E414F926482F14F1245A146FA27C18D126E519F2224A86E5B2E459F222481FC8F222481F49F62A421F4832681F49364A1F48B26A7191F46A961F48B248B385724A32A4218E482F44638B2D946F8AD442F8A45ADF2805200800000000002800C0880000001880080020440100F7 -:80E3000080040000000000000000405412141F7A0242400216018448118A249281C0433084D0282C644832862823480418C421244841482422163214402108CB2143024068882088084CE881248114440488BFF6431264281D2824501410C41841814A41189A488F24110955081414404C48C442F02841008A2292181C0426411CC4482623 -:80E380000514A351941AB221115838172190118885421838181E4170A60748C28C1262110049741198C443E211648219344247813187245141368388E3C118242855C227122448532852288714122752845C246412CB214D21835158CB211F8228428319B28161841618180456B112F87A1410062501211514080081822484818A14283850 -:80E400004882508100814100830420228481021241908844002100128186480144922448814781003FE50B414C4201004601A021424023C112004820089028150800002140028002440041112502002482148240880125120400F04ECB8002872244C446C22A8944126811130314205922912812AA01E0425482457214D84112D6A4B15C96 -:80E48000B294322C8D2463912629A212612B81E37388E18A219822822C0285C5852D142E488D842289A424444CC1845F4E01C024284185843441842412180031800842202802D0141248426C5244612D242A28D2684226322422214B1821822309298288481165584146988C2C022A041888C7D6902450290024872248302813B42111214C -:80E50000C1121642528122181A0826C848214412106281837514420C3845021264F01924A5C128820029123288248C8143024D48101414F4C72E804674121824250210449131C334124AB114C2828841822C230400A3081904CC42444241220448CC8364284489C12C84C01462412270589294A01800AB812CA838F0496B401448A1422156 -:80E58000A1401509901448C58102460813014B18AC69528128496921830181364833248762A018842A0400881400D08494220010C42210145428A0C26F2F010010021426880281882280888422410840088C01426821100249080026125422AC182401D02264942001885C1844022028066044F0664620145483672258A7126012508198E9 -:80E600004AA2144F149154A82F815448922AA1488991218183C6642F11542A81814DA2244CD2E28432C62963A841608181258B1484462218F5144A4C09AA21283682844B216AF85D897024081800302844C501266181218608800814D04A21D84841820980C1244183012002184423229816B02488541812188C048200250421418D1482FA -:80E680004A084F660B70281184C424411046D614421112C44114801A06893811444014241801128400C0484C011001A416522845028361228642460288250A2344088082F4992300C04119219423A014180080141E48018820C444888812AC21822C8314A158921C4802228A2489684282130900212628C8188D81008C38142B81230143D1 -:80E7000008AB41004420562481482841182022011844208A2502A3052886941216628484460242128200128418110021001184834208844028028221003BC720054004008148421C5148833842432262844282256488804148112842220214A4450186420A2441244142401856284C5824004CA82C102801899828CCF8E31E24A24214298A -:80E78000220260454844491292A800A100F041AA14490841224091812480615B294C44140486144244226841446082182D8845421C52A410A484443084B0110140C144111011041082E448018923812896121C228115018884111A54281B41184840711A216881410021008484440013A228108409235142284121417FA5014128221248FC -:80E80000421002006810C44190888181C0244098291410088882111088068818381E48406841221481C0240088242009002190186F31042AC414000022001628A1184211814782304496584183E881F415880022A41B42228934882AC41C3D868572116228504881861848480221000000418424608800FBE3C01CA042C12023842231412B -:80E880004084A128868204262884810221128A11A882822051244001128481898408184424A0288244805224842212AA044BA1108AB8CB4CC25443CA22426604242B365E56114D11B28F21D5D2355545A4C44F42A3894F17B126C8818E91284F28C8A91AF1AB83BC81E11868482F61F19DC8CF4141E18868C8D656C58E8A27988D22848F2B -:80E900002852A838B76212814592284781A391882147888D2843F88873A0261744144F12D424F232214E441A1474429921A94B38C8349B6285EA84E496B483EEC8A14C16782879293C3826E884A52B9B4D3F41F141D28E881C92822B1B4CF112928941921A1E9250226131AFA2F88428A5D242F888842D9A8D928C7284A2AB89A88288965B -:80E980000243E1917225F4113C48D324524CF034545622E44E18F528982D88AAB28A981885FC5961EFC151484F414911F24963282B44848B44AB23C974426628642B418D216D88833214CD446D1C9564C12A2A88D88478845B824B4A23F864D62B154D1621474887C51F7C0B100481100AA1100A2302250425215112100281804202001008 -:80EA00000828A02490219021902190211811181588518118841826082A04222013F8C6822429F51511D55A4ED5FB5E5A9FB6F46666467A535F27AFA7F74A8EEF7CF85E9EBF2FFF7E5FAF23F367E59FE7F44BC8DF5DFC85814FAA5AEEAF82F25252BF967769F9C8D94F54FCC1A26F6AF256559F73F2B7963F8AF884877F53E34AF8A186C7F3 -:80EA8000185F53F312126F6AFB19993F31F93A9C7F68F99E9F6F63F18AAA4F4BF2765A6FAAF99CBC4F43BB34F9248CAFF6015E441FD5D7FDF22E245F74F45656FFF6F46E6E2FE47413FD5B4E2B5CAFACFE9F9D7FE5F97B78EFF7F1FAB87FD5FDF4C8DF37FC9ED4D79817F195FFBABA3F37F56313AFBEFDC2D14F5CFCE4C76FEBF93EBC7F9F -:80EB0000D27227F6A7548FBAFA3F35DFDAF8AF96EF78F82D2775F7A7B7AFC1593BBFDAD86FF1BE9BEF63FB2E8EEF69FB96BE6FEBFBBE9E4F41F39CBC4F43F3BD34242D545F51D77DF2363C45F617355F76F66E6C56F65B1435F65A58AFA5FBDF9DFFF5F9EEEDEFECFC3F3D6F67FF7F7E7F84FCD7C55F59F8889E9FF8F82BA93F37F77B7B6F -:80EB80003F16F4D8DA5FFCFDE4CFCFEBF13E3E6FF9F896B78EC2DFCAFA9D9DDFF8FA8E8EFFEA5AF775F7B6A6AD9CBD89BDA9F7C1EFF859EEEFEBF99E3E6FA1F3169ACFCBD9CEDA8CFA249CFB82242F45F41975DD276FC3F34446FFF7F76D6F6F66E265F51B159FB5B5C2F5C8DABF99F95D9FEFDEFEECAEFFDFFB7CFCCFABFF77F16F4DFD2E -:80EC00009D9D8FC8F9898FAF23FA7B53BF37F7F2F1DED25FFDFDC4EC4FC9F91E9E6F7BFA96B74F69F98D8EEF6BFB8EAEEF69F9AFAEEFE1516E6F6BDABBF91A32EFA87A1FF68E9BEF62F81CBEEF69F9B6966F6BF99CBCE5FCAC8C4F42F3F7320060128449C148228C146481E081048280444498281AC424928514410481209493838408009C -:80EC8000490929088884981224960816089648648124864822490481D0C206824C424104286041D04124028B84411C41C8A11AC48782830430852884282E528111D022294D18512613512811109182151812018CD212588121842D8284C0482564818886F1D83BD024F5112485F2112487141F41724AD141B26AD141B66AB981B24A994519 -:80ED0000AF443924AF14B9A4F44291578AAD914F82C4914FA2C4A14FA264114FA27498E1A264592E4ADE242ECA1F49E222F4912487221F49B268F19124A3F68164AB141D24AB941F88B24A5985AF2479A4B84AFB24482BB44F8294B24F8AB448FBA44A8F2A034D121B618D121E2CA7141E2CAF14D1C1B22AD1C1F26A94159C3A19F24A946F -:80ED800043D31A39242F147125981A7B422D914FA2C5B15FA26C115FA234984B4296F1224B56E1A27491E8A2F491448F2234818B1613392A1B49AB161B21AF44F91128AB345F81F24A9216B848E381D422DB8494B22D48AB24ACF1DF5740084800000000000000000010021880080000140000000000004004280000000021F017A10023B2 -:80EE000042051C64441D284622B2A981182288D441386CB8836244833818444241281322113C182C919488244D828002849012A3018C110883612888844648288211E48842B8A811048F1C086624885134182C827118214142889A418E12582C8174C2E2296225A2221B8182679C41A12A511666588167A149015042232138148D443C2CB4 -:80EE8000D224AC82111114128683C8428424836824C248A681F83F84E0642256415CD412744422C35921172247888AA2C24E125B411E2AAE4246B214BCC861AB445E814CF8A2448E142D181E84278126FA84198E1C2C6138812624648816F4421C3490188C4811CC83B28533488394282C718448F288428C3AA4126F340100188081521842 -:80EF0000A0129648021482884984618A2C02212200853121608254585022444150221200249E48228E4423021C012088082100AE48A04120F814E8003022400121004003141AC4848022410428121482100418102204001044041A0200442C418821480134824602408801009F3D042A61425D124CC14C8D111722282661181A62288C4CE9 -:80EF8000619185642414841B49844F980414248D41222505C129E38234741827422F12216222141E81819C282C4C0434242041162804258414C444F0FFE40030132514C9183121001423189211004214858414E88418C18124532442042422905424282A41042D211B18811998848844121308405142422304E118414604AF6B052A912462 -:80F000004C22C1441128281392812A01998CD45859482829011C297211040081241901E11AB42824221114878222014028A414A1002503182C4808004800D0DA0C48184434128CA2412428222B58C044438C229288D0942422C182182018086042166822812222461861441C2202831202CC03151829126241222382AA848146412282F8C1 -:80F08000BBDE001122218001267118032042044B2487215032001DC445C22160241A0800422D115410282241A848180042450B2E4449A2282D18288A044884C014E9C18690488FC1016042800230244260842662B1821200B0482118044290882142C420418408582741A0420051218A2128440188004484004004146884229FBC09424DDD -:80F1000021458282E18261464217A18F24622F99A3844C9C448B21814AF182454CB29194442AD128887442180841C42F3219082742621E21411C7A1114E222A94855F816284B242A78A88351428C248292A846648127444884AAE4550320211211021819322200102201D022588181402448018840041A8205415AC2188004800284804403 -:80F1800001850181C094304280189418438AC218FFD20200221820041081428102338802002826031B8198142022410111C0C8888A0100404402212400002200244A880280882204EF1C0460338092211A0220812801005A0812454148E82401106484804868888CA81A24848488804386199828444311D8C102122314041210040012168A -:80F2000022F12FDF6022842D228003422848138844010082A028421400200284228061212082022A0121002001130200260100210080024220F4F7A800008434114041426848184CC1A81021089200184001000022206881860200100148002450480019180220344224181221F0A849A0412341220112202122312119324112192821086F -:80F280009822400821882A480885423882181222281381921426A41219C2155100A6D981220844002034224A2226022F27021568421114422813041B14A01480A2244B14807151288439241908881082D91629015601268381412895412711100621800888408208899C8200888882883F890F8400004012012210020081000000480014B8 -:80F3000080044183C248008200000021008C110290120000432111021242C78C148E21821400141400448A0214441123282448C2142A088A0110058A01224131294848581250124831181542121101105341150224472649182404142AF1F6FC4058181A84824828C118281901C49031414D11E02102846901218001A88038148C244141C2 -:80F3800002160A1A8428011248858204C49022602200701328111402AF2804F088282433621E292334214E4113A2862558319B844E218B88E05FB2C2FC19884235A8894C1A68127098D188C88287449B488E1A858A311128344D41843612625185F22C81881CC8224188248BCC4F24FA44D21C81A88126A1D54F9F072A749123222161117F -:80F400001CE481B131F21A941E612843A21147691F11A1891818D04681C142E02418E4839391184F4381AB152BA29AB92ACA11181B113D141AD143B2112152822955838F2382D811480224004B229AA1461C49F2D263F011232F42D113933819F22148195112188E211F48F12111524718191DA41499F818224F32A3A39E811815019B281A -:80F48000244964299D282F9BD4A23A18289225327265A4A92D234E1845D7274451818D2415D812D46251162313F22244257412BA6294345223F2D184000081100AA1100AA112A1501AD0120234481448142C44C142144011022302211121501220044E11C011C0128001188001000042FD54141F147417F528299F92F268C89F36F2534B16 -:80F500003F91F159795F61F9525A3F91F159597F69F1DFDFDFD1B153DCB9B2D37525F7F59797941D913F14F4C983F776B5F94D4D17B82FC9B893A9CDAAF32821BF1BFAA1A12F17F211112F53F3C8D8F7C12D422D532B151AE52BFB2A31BAF914156F49A9328FA9F956126BCCFFE7F782D24F41A1992724BFD3061F35F55F44111B739FAC30 -:80F58000744BF352491D1BBFA5F53EBE2FCCFD313BBF95F7DFCF7F3DFD9515BF9DFD41E33F1CFCA5834F5EF9DB895ED11F3DFDCA81DF7EFB1A2BFFF5759AF9988C7F4BF9D1D996FA9A88BF8BFAA1B13F17F715116F13F3D8D8DFD6D736D516B55AA1C87FFAFAAAB1BAFB84876F68F82232AFADFD94962F2CFC7E7E2BBB6F4DADBB2F2DF884 -:80F60000EE7B141F14F417471E311D23AF27F5733B3F15F459511F35F77EFE3F47F769611F34F69D9F5F4DFD57555ED2BD19CE58FFF4F696D5BF91E115DD11F188C9DFF2F8725375E538719BF69B938F39B19AF138223FABFB21232F31F511133F7BBBB9FB5F44257657B743D199F48886BF33B2835B757F48B8B2FAC8DA27242F2FFFBE12 -:80F68000BF2BFB6F43A3992CF1455AF071537F73F611119FA5B37BF571391F35F45B519F95F575F41F2DFF5B718FB5F5D5D65BDDFFDDF5D9DA3F15FDD1D8FFBFFFA6D49F99A9911F1CFD88CAFFD3F87848DFF1B19271B9F6BFD78FB97D9AF2BAA22FABFB21333F31F515177F7BBBF9FF3F352F717157B74BF199D9BFFAFABBA33BB81F393E -:80F70000F98786BEA2AFACFD86866F6FFFBEBE2BEF4F4FEE2BEB28795C0D147022012200002022412148050024C0240010088118818890828121909210062948D814012440021440058044A44100009EEA8084C21280A14125820419D6228824042F14082B84222B94842909982488260224121722442E4A922400282150181912028511F2 -:80F78000D128388110D12208882288A084324A28F283F1C0421F4152281FC132481FC1326A1D2CAB141FC8B24AF91128AB9455B84A79A4F84A91478A2F747B24D812F9A4481CF9244A5CFA244A16F1244A96E1A264592FA2E449D2A2FC91242D421F49522A1F49724AF19124A3F69124EF16F11124AF34B911B24AB915B44A3934AB944306 -:80F80000B342792498924F82A4944FA2F42E94D024B411C6521F41E214F111242F1671117446B1117242F411242BA45B212B8443734225F242374782AD9163D212F1241A5CFB248A1675246A592E4A86F5225916F5224A1FC9F2224A1F48F62A128E24EF12B191722AE248722E81F26A871D248BA459B64A3824AF247A24F84A82222DB459 -:80F880002F82F442B44FA2F1A7FC70822888040000000000000000000000880020010040080000000000000000000014E0C34282011C13C1344880442488811271889284708421A8122F8854828442A8222262248CCA34286218885A822832A1822100A120088190412489A228102408B0446248CFD90F43F482224542DA38AC8239751111 -:80F90000E812018AD483E1210C118CA64122392CE318A6C21A324C8DC1211D148B1212709598186654E241121998124D11188B422538152D82132498811D424427881224CC7C8821A1284E248718688F910B4674C26211248B61221B411B144381984439E113441881B2148CF8926246D82B9C482AB118EE82A828588BA18A8333A493C791 -:80F980001486BE4C0366213995205282F188C24318E112645486982A2A5848578882866244AE493AF41B569012284722157884831C42681280C9282C28D842C848142214B228A242414611C2252481418711A02421802978220129C14820512211608824102241A248208122423484890800812082020030428A04004004442A140200006B -:80FA0000284011042089A128400480480400100AA182880082002012081F490A441742241602426024844240A18446C98841160882890142450840026829A2244C421234424C8105302200400282402804C1888110922890841282AFAC0E441481202202100A23240C178440941C10A44321428100242810B1442242120486841404211083 -:80FA800004106228401822182C08860281209818E0590EC024B04211820448804414218C62880020480824440012E0222C02416029528B2118482082080000C4B0480288100880024D22A018AF16021121214425140AC058AC0128101294825042C0186084C0284860414022D424012908828A0400008338221AC2120000842781C6842287 -:80FB00008961888222F061FA242200A041422C3214200880844408202419C211604200422033811820426422800216022312245214204608001A0400604860444241ED4D001113012818124200901888828092441018040000104A042210A85282003244498144A341A442888008440022128C22028C02B03B0B134201A061462892164A41 -:80FB8000C1123038824A5884A842488D82491141982400504A4411234766A2434622A828282C6141681489DC9632426612084014981A4A22C1B84C81F8442862414FD60325022D114465228181146888004602244016844188810426288424A112822001922A084812411042B422012A210982004A014C2802A28182005FCF0C00A0210091 -:80FC00006248420000000084C0484A088004004881214400801204000020088A8201209888100842008A04F0B7CEC0120021181A4428018A31421A243C488984118808C024124222414485044181E81200422800442820832581048289081288248286082608824B822F6A0C12006A01122818428004C0480000400880A4244141C44A5842 -:80FC8000248442180020024004000000888928C8981088688400C8C0246FA40F85BA4884344212428324041E8245F414444B2E2A326818848608424F2AD42251221AA1119A88284808431A01D088568C8B444A242402381A2C217E1454444B222A22224802887028522227281AF9DCE3000000000000009882800440080081208404000062 -:80FD0000221044040010040000121A28088800002004F0EB2B5084844248100460844064444C8282028004002502298181218808001C14416182842E48484800000044444C82820200005022B042F195B950882268000020011844582A82040012004221488C218808100850140084800420082818885044A02188008009002548D8FA06F1 -:80FD800080040000220044800A00004242D08202188008004044810884800400000060498002002008C4100A186FB70780010000001400200448824400888400000000129024000028004008828028880800000000008F1B09818304420000111034444322A242120048C04225422621234928080013129121A189314842420000421841AB -:80FE00004143A24A22000040D2224422F1353D40C848484A0400182081D4487848848222040089043042211818888A8804001425018484484800000040448482020081288884235442EF3F081240042800200188000080040080044C04280010044400228011042880882101128181A0488A01000010043F6D0F00000000001200000048A4 -:80FE8000000000000000440000000000002008880000888018C84800424FEB06123226040080311118A0848B411A044A2484A444008384040042801408444542B2240212260400001888008328091820A889878284859848427F630841000000228C1581098282CA84813C441283048C04202246084024A1242EA428000080028388A18519 -:80FF0000A0818301208C880884800C41F08BFD000080120400209548420000008C848C12B44C1408000045040030142200908420028AA1188AA8814A8828080044A044904CFE5FF022222F21C2122B11122B11C0122592832F31F111119BD81F9858888D418F8424D4911481548985F844484E444F4294244F4222E24202284554642E247F -:80FF80002F22F212A22CB112A1812B99822C592229F812131F11B188E998784898488F8424E48404488558884F84F4FBBDF026226D222E123A21311240512229C81B1F1191919E8887818F18BC4824445111405C888CF64844CD444B244B262222002554444CF326226D222AA1131AB8922808259282BCB11191D19E8887818BC88B4442BD -:020000040001F9 -:800000004200C485C8687FFD0100001411000000000000000000000000000000000000000000000000502200F0B8DB1011110100000000000040420224502225522200404202000000000000000000000000250200F7FC1001110000000000210021240024210000242100240000000000000000400225020050225022F039C80000101115 -:800080000100000024002421002100002421004002000000000000000025020000104212026FA80400001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D000014110000000000000000000000000000000000000037 -:800100000000000000502200F0B8DB0000001400000050222121004002000010522210020000000000000000000000000040F2C3AE00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB000040110100000000000B -:80018000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8B8 -:80020000DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D0000141100000000000000000000000000000000000024 -:80028000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000008A -:800300000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D2E -:8003800000001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000007 -:8004000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F068160000401101000000000000000008 -:80048000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F068160000DA -:800500004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000E7 -:80058000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001400000000000000004042420287 -:800600000000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001400CC -:8006800000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D110010010000004002400200401212120240420200000000000000000000240000254202F0D77D141110015011000000000040120224000040121202240078 -:80070000000000000000005022400200400224F022C700100111000000002400242100210000242100000000000000000000502200000021242170BE0200001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000A3 -:800780001411000000000000000000000000000000000000000000000000502200F0B8DB00000011000000101212024002240000241002212400000000000000000024211012020010F2D45B00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000028 -:8008000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681600004011010000000000000000000000000000000000000000000000002502008FBB0D0000141100000000000004 -:80088000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00000000000000000024242424212121002400000000000000000000000000100240F2A498000040110100000000000000000000000000000000000000000000000025020023 -:800900008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F068160000401101000000000000000000000000000000002A -:8009800000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001011010000101212024002000040121202000000000000000000002400000000F0AC6300004011010000001A -:800A00000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F0681610011011010000000000401202240000401202400200000000000000002502240000245022F0FB420000001100000040024012021002004012020024000000000000BE -:800A800000005022000000212421F0CFFD00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00111041010000000000000000242424000024000000000000000000000000502200F045B114000010010000000008 -:800B00000021251242120200242121104202000000000000000040020000100221CFB60E00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660111101101110000001002104202401202004012024002000000008D -:800B800000000000245022000025022502EFAA090000110000000024002421002100002421000000000000000000005022000000212421F0187800004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004001000C -:800C0000000040424202004002000040420224000000000000000000004042022100D06C0100001001000000000010120200002410120224000000000000000000210000401202212F9B0D1100400100000050222121240000000000240024000000000000000000400200242440029B9E00000000000000000050220000000025020000C4 -:800C8000000000000000004002210000215022F036521400001411000000000040120240020050220025020000000000000000502240024002002502FF92481111111111511111000000242424242100000040022124242400000000000000005022000000404202FF8A0511111111151111010000000000000000400240424202000000D8 -:800D0000000000000000000050224002AD6E1411000000000000251212420200000000502250222502000000000000000000240040022140F26AC1000000141100000000002425425222240000255222255222210000000000000000002512020000214072180E0000001100000024244012121212020040022502250200000000000000C3 -:800D80000000250200000010B29C0C0000140000000000000000404242020000000000000000000000000000502200F06816000000000000002100210000210000502200210000000000000000001002002124100217AE14001400000000000000250250220000502200000000000000000000502210020050225022F0414600000014114D -:800E0000000000004002210024250224210000000000000000000000000000241012029FE70500001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001400000000242424000000000040022424000000000000B8 -:800E80000000000000002100F0DA6D00001001000000100210022440120200241002212502000000000000000000210000400221FFB80F00001411000000000000000000000000000000000000000000000000502200F0B8DB1001001411110000002424240000002400240000240000000000000000000000002100F0E8A110010014111C -:800F000000000000004012022400004002002400000000000000005022400200400224E061030000111100000040024012021002004012020000000000000000000025020000104212028FCF0C00001411000000000000000000000000000000000000000000000000502200F0B8DB000040110100000000000000000000000000000000B4 -:800F800000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F66411101400114000000101212024042021002100224241002000000000000000000240040024002AFCC4E1101002D -:801000004001000000210000242400000050222502000000000000000000244002211012124202FFEF4611010011000000000000242121240000401212020000000000000000002502250200400225022F1809000000000000400240120210020040120200000000000000000000250200001042124262ED00004011010000000000000076 -:8010800000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB001011410100000000000000002424240000000000000000000000000000002502009FAB080000100100000021002140022421004002211042020000000000000000002502004018 -:801100000210F2DBB800004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000401101000000210000001002000000000000000000000000000000002421004A0800001400000000000000004042420200000000F8 -:8011800000000000000000000000502200F06816000040010000000000400224000000244002000000000000000000002400002100F0C49310010014110000001002002440420200002400240000000000000000000024210021212100DFD5090000140000000000002502000000104202210000000000000000005022210000210025E26E -:80120000AA0A000015011100000024002425022121502200002410420200000000000000000000000000F07D594021C519844D498443D284044841228901A880021E249028301892232808184C9896891A8408832404404898444884A04841124C418802408422A82100412F7A052A6492211384914489E522B12474B48122F884214348A1 -:80128000946C413E44A0D2D8984AD84264241227412D828341A8146E9846BC8806E0821428945481AE1C4B344BC21E2422288E284149E8C294243216AC43C88989FD8212BFD90A1C82C1181111206161481B92201819A428208204488028A584106221244D1244224B2110080081899414A0C160488624229288848604200258C08880F81A -:8013000081698024124228014422284C1484A2388244461C0418B0C80381439142826140088C247484A8288024020010E482051220810190489014848842A05865F271A80010212404428C042002440022301441000020880182202119084884000048C184414A820490244428282820012A2101F07D4F004609107C44982840040000002B -:801380008082220B182C0800808138882088044860840081482200224100004144C024228800124F630D004001000000000000000000000000000000000000000000000000200200F0386214421A8242042840180889888448043880A414838219048C2A8814048CC12410C29C2122120044818181C1983088832A810141818AC212207145 -:8014000044084F88F2299A2428115023446CA1425AC21120441181489944124486240400422110722218F2824A2A6881D024242124012CC1441005442644828408428823048348EC84081608BF830748182C1211C422421E2800862884388481498231444B84228241C0E8230821D08281748242389C2934325218301487448195142CC980 -:801480002480AA18124888A1A88D829098C18CF18822F60E2392214014624122488D1120144101141A0480C14818000048442782F02688281810040000210010048D828C04004142805184424810F451210010C4244B122800A11371420120091A140214604443088444478244211084C292524502181A1202981D241811C5024A28C181CC -:801500008008889088802A022AE4C14E62446F220125214432241601C32AF288639C447884D148D285E44884A5182014A1288C02311E4535C432442624A8824B42C2115C81127642422124A914503812529CB184343412128945D884A129F083B6904223125412430200218581C2814889180415C8444A2101420044284410D4246342419F -:8015800018498884A81211282C281431411082C411204138C449824128058C83083B1810C416C0244AC1224C3211819E2433C468A581C181CB612744821488433484148CCA28454A73544301E023886C224CA24134490127411D2618E0C8A11488813989E41108988019E88248A4122AD466068C6441384668462721189012848249122841 -:80160000C82C98820018144218888CD41417246422C1842613048C8404226041890C49C54C43084129128448A442580022004AE27A0884403841124D21596414812A01450A841A1618A814D2444224684180A9149094D02348A1212361819044181988848211280A825180CA4222812001821E2228E0DA072410810200127046923116019A -:801680004120042122B03248489C216B28212502802101828245E228233181288444434A421182040018AC0820A824250418F02A1C002D148912E121C217484E128CF1443A1C0225481834888D82185AC814D2D048F724828A92442F4124644B18A9C9221A3A921E442B5A29816B124E184AB2843118D4214001444AD1C2386842924E229F -:801700002A288222F6D2D780041CC1284384D214114102981F810243B848A1418084022D218C041187443302215086142144004044211864C8224CB46268484A082182882221120044121870DE052022618200800316041303808142012011860288418212E81228822C883182008E244D82424A02412C260180421848180C50A2604122FB -:801780004E1826E8B14A41D21411784144C724504121890A444681E914D8341814988425AC4A49442112322442102201324118C2282921024368412400244125840448502844410084006F640700008110021A04CC082318219288967888321482001843049041004816A41C42424100862404D02204484901004D1822A42C049E448464C6 -:8018000049149844FF42070048A114140085158B412401A5023014302213010082231422681882001C68218462001742111B68153484002C44060021284260640000EB52244922942CC064D01482A321882B68508424002244604242122E158CA882123644B8214464420020242424C18421122002002622122444244101811014541CBF60 -:80188000750E16081E42454248044184160128182830248F4804821249E1441842A4148504222002545C61481244284812288228400C384841481810141418A4481222F0672F407129426112601210112222E111382114198101008082022880820840821882082890882E4228886D2288248642140242240000250222A01416F2DF21304C -:80190000511815040085051144444C4804868891112A8115D13218718482811411140182200424008001A511521841822381084B18528A020000C02888F02F3560C225A442200242604260224423880285C222822182809122483842191A827B42A4212125113184CC38164800A0288262222A64442400C0848042822235264AF2556B34C7 -:801980001AF714354F61D2C7D225F2212345556599B2889326501A16F12211242E8D86CE9473723472657424F57644EEC45F46F866148213C35436B2E118661C96B824F44A34AE8247152942F1846664C81E122C33426AB85881512A6C6544CC546650884F12053F4208576215F221188974680D89621127C369E86E7921F3A194172895E1 -:801A0000F81C344F24B23821F488A43D151A816A882962811D611F84EA18FE42224CF312129E841AB942EE24382449D262F228C12F6C7A2BA1C2A39D222F44A8226C51844A4C4C18145A881ABE24B218F8746ABFAE0614A3561826034534412AD31475316D819ABB14049AFCA388BB19497896E221A1ECE81B11A82468122392124B8A4B57 -:801A8000884C84556245C4249AE841A14A57284B13886B282656442AC4426D484CF42228414B8225F294224267422F45E5C452486F8A0600003022302240011440210111002800002440021800288002000040022400000040224222022004421F1446F171773F57D25DF221658FA6F6282EDFD6F62527BFD2F228A27F1EFFA1A1BFD368DD -:801B000038A7B127528B768F4AFAC2D227222F13FA24644F1AFA6C6E6BC2CFC2F64764BFB6F6C1F12F6EFEA4823F2E2C4BF3F634CE826F69F982A27F33F349CB7F7E7C49FBE6A2AFACFE26366BBD2F24F2DA9ECFC5F18A9AAFE6F692966D226D286B22EF8AF86C484F4EDC6EF4BB54243F35B733F63527FFD2F26C6ACFE2F2686C5F72F2CC -:801B80003B1EEF63FA63D11F1AFB1FAD1728B7A1EFD2B274F724246F25F522262F77F3E6F44F59FBEC7E6F2AFAEEE87F42F62B6B1F1AFBE2E62F63FB72534F4FFD44D66FCFE36EFA62666F2AFAB3B3BFBCFEE7E7B7F46F6EFACEEE4F43F3D2F429F2DAD2CF41F1B2B84FC6E62FFF46662FA4F66E46AFA8FA3E1C4F4FFD485A1F114DF161F0 -:801C0000714F53F72D367F72F26B692F42F24C4F7F53F331315F7AFAF3F7AEA3BFB1F38382BF18F8A837BFBEE76AFBC2D27F62F337A17F43F7E5E5CFC6F724E6EFD2FE25679FA3F7A1A12F6EEE6FFED6E74F6DF472626FEDF5C6666F4BEE6BFA3637ADAF2F7AFA9A3B4DA2AF84FE66762F4DF96222AFADFB5818EFECFD4E4A6BFF6F24F4EE -:801C800066484F86B6A6F82E2C4FCCFD4872DFE547F377777F73F33F3FFFD2F26D686742CFF6F627351FB2F337AF3F37FFA1B3FFA1F983832F38F8B637FFBFFF3C3E6F25FD27365F17FBE7F45F5FFFEC6E6F4AFA6CED5F72F6397A1F12FAE2E62F6FFF42624F6DFC72E26F6DF1C2662F4BF7B4B63F7BFBCBEF1F7EFE3B3F6F6AFA4AE86FC6 -:801D000067F7F2F22F22F2DADA8F81F1FEDEEFE6F6D2D26F64F4624AEFE6B482FA2E2C4FCEFF6C6E3D1A501240011484204122019234406288608820099200008021140400189086B022098848184826A241006081648C4484542848008744F08793A0182869D1810228141D24F08128221022C181C031D022011C82E454228298441C821F -:801D800084E22229C4924288422A042430249082282908627042022440022410888443B115082CF4112485F21124C7261F41726AD241B24AD141F64A911D28AF14B915F44A915B42AF543924AF547924F842B14F82C4914FAAE414F8264A16F1264A96F1225A96E5A2E449E2A2FC91242CF4912485F2912487241F49724EF29124AB141DDA -:801E000024AB9419B64A9945AF243924AF247BB4F842B447832F44FB24484AF9244ACF570CA41F41D628F41124A7261F417628D2C196184CD61AC96C2DB14F81F64A915B42AF149944AF14FB24482DB16782AD912AD558F1268887117F8224F8225A96D5B4E451D2A4F481284D5A1F49562C9E248F34E1C97264739138441F88D24AF191E5 -:801E800024A93A85AF2431B44E96B6E844688B2F447186B842FBA45A5F8C070000000000400400000000100200880000000000488004000040042800000000007F9B0110041184110029018224981188A92411C481228222288A4448844784021A048B812C240100608182000028220044801554242200001F670F48130A49117124021597 -:801F000014184481184884C412819012472440844128BA48528220382831435442C0A5422B8190121084852A482104891428C1128281D281184071C8F4CE9880B44402471111450330184119887832544142A51218D4126922824CA2122B81A67884F822584C284AD8127541524848AF112A34C2B012244184A12882144A826246C01490C3 -:801F8000123044212C0160C14DB8001100812850412100908880A84118004904008C042A040022102409442001102828040000818420A1844588698200A048EF340322501270220261480000001C8804418511D44818240460824008414604522005104244228108410013480100608844002A1418F4FF5B30414014924526A1C2221F863D -:8020000081EE18248C651448802184E42C820489614221453244F01628813282678241224212411045391842865A84865122819F21044FA1E4844112788844081283F4E3FC90611044625619B2C48232284AA284C242114681241164844BC2230C4800222914C82C41488014A4414200446493212824081C68181410F24814236188251489 -:80208000046284489FC90B4042031012829451881480818408804401C4448CD124024518448241E84261284D3820021225041460815048E124109A590046088183180812C48FED4C8152282281002170142304515043A881C21004842484803818422C4208484410024CC4280042604260890043048032488E484B822120D8282128688D0F -:80210000C0448941944156541842118B4241C2492221B81262430010884C8204415028200861148A61464828CC840224866188182842C841484C189484002224402202EFF40F00602210143448000088488014344482424048042A0444000083018124821200282248489084404A088100508488424884446F860B4B4220D2186244144CE2 -:8021800044F8294444C22882C694926A814C8488B4880444804228048648427418843848482D244B1200601A8E4818844B848A64848914445C848E482C382430C28C44C884CF960A20110629411C92412C8104112C1101454884444408848384E14408857422022004126302C8200266024382A49200902282288A044312280812A8245FEC -:802200002B0A2410A82442100114001008100418184242448481490242810046088800104C2444088684041042084084044004248810F8311850420044244684042CE41881094C14A5822C42221404889044210000822200004C2424280844211098444240C482435482401408210021F09AA2205141904114130600189021430842821056 -:8022800004281384A485491208424800C694C840E8182408308244497842C2426414430821214A984621411014125424243E55200411004014011084082824804C2274460288208418022222002144002502602448308882814481444800B0881252420088299884BFA7492128044440459341400460144738804412242458416081400425 -:802300004028148412440844244A180480180486281414420400444C04440089D814F2A7C6C044444C062860842644252402814A120443A42449082290824C8408008200400181488004810082004084AC488008818288414121842F120F1480042002008661154823088E4124221002404404224008A08481200400418A8428081028040E -:802380002142000088000000F0D3D160118082020042008828A0481443922400444129098302122022223284863984C1148200008100508187241044024358280060685028881FDA0C8431481120012024742491812228240088242C024821A0148394882914788A84C244853142880048448A14344A25D4224824C8442149E28C02236417 -:80240000282890225042F0413FF05312C28428242E61114E6446E111B1F189E8882C88E822A828A2244D626416A4914D484BA2848487822AC8AC41150C25D8280447C486A48C4F249484C748822744216D8CF0448225D2482228548280483682142C781C4641147521B441841211081D468844133648197CC632462F24544449044F1634DA -:802480004486E4466284A0444A8232A2EEE2C28398488E84242B88D0224448DC82E424D42474411A7842684842C82B442D884642046902C378A6F84C15D0145452284752197454E4545413F0C1444D218E21774247541D614C7224F452422F45F8628433A8C8CF84146A68588129B4889444859CCC4DCC415714CA0C4948F4888486E2242A -:80250000D8CAF888884D45C6C24229D4447CC2D86478AC768CD4265A64884D84EC58485F6C010000822302611022114208000012280000248124400224400200000000000000002002220000286FD74AD26655D71D2155F541413F36F65B1B3F227247F453937F3CFCC3C11F7C784754646F6CFCC6866F6FFBD2563F7AFEC7C54BCD8AF83E -:8025800086CA6F6CDC22F442424AB642FCC6CEEF4CFCCCCC6F4CFCC6CD55D733F4868C4F48F884848FE4F4CA42EFC4F44E4CC7E4FFF8F88F8BA9F4E2846F48F8C4E6AFA4FC4AC8CFE8CAA267626F28FA84844F8858662EF3346D477FD4D411722171417143F35F1D1B665F54F417973F35FDA3A15F7C5E574F74F4E6E66F2EFCB6B66F6DEC -:80260000F5C7C77F7CFCD2C4CE844F4FFFECCC8ED22FA4E484BEA2F8E6EEEFEEFCCBCD6FCCFC868EF7541F34F4C6CC8E866F68F8CACAEF64F44A4CCFC4F4C8CEFFF8FCCBCFAF24B4E2DE66F4C6E6EFE2F6EEECEFECDE22FAA6866BA82F48E898F89C9E5FDC49F2144669D411D24472417345F55B195F527245F7C1913F5EEE2CFECBAB33BC -:8026800054646F68F8E6A66F6EFBC6566F6CFCC7C56BCC8F88F88CD44F46D6A8EC84B462E62CFCC4CCCFE6F6CE4D4F64F4C8CC57F829D4445C646F68F84ACEE7C86FC4F44C4CE7E475FF8A8EAFA8BCC25A46CFACFC6EEC8F86FE88824F2238226F48BA86F884884F62F3E9D7344F71D55FD411F225251F347844F55F1F7F56F645474F5840 -:80270000F9E3F11DA3FFBC7C87F5C4C74F66F666466F6AFBC4566F447447F5C6C4474C4F4EFF6C4EAFA1EC84F4E228AE82EEEEEFCEF48C4DCFE4F4888E77DCCAF48CC4646F68F8CACAE7C82F4474CCFCCCCE7D4F8FACFCCACA2BEC6D46EFAEFC4E4AEF8CFCCECE6F22F8A6846F489A844F98F8ACBEEF320D00430222480041004800A0487E -:802780002482A0482882004A02004A1284821898840000108484C84820088A0482C048448A44042048044F850241004440E41401149E44262138484308412BA492002149044D488800489084444844492C4C022C0888402278440200230442828100C08400437833023CF41124A5F2112C87261F41724AD241F64A121F41F64A9219B24AF3 -:80280000D985F44A9143F24A914B432F147924D812FB24484E914FA2C4816FA264116FA264192FA27498D5A2E449D2A2F4D1246D421F4952281F4932481F49324A1F48B24AD141B64A9921AF249945AB9443FA4A9243B242792498924F8294984FAAF4E148C0181F4146F3112C873617412652818D121F41F248921D248DB34D28AB9443B6 -:80288000D21A29F342B517822DB46F83D412F824188D916BC28F11F8264887192F8264592D419E252D489E2C25B391562C1F4962241F49324E1F48921ACCF242911D24A99B258F6419B44A13E4245B8429FB244829F924586D3220288804000000400400000000100A008800004001400848000000004480020000005012F0F4DA141241CC -:80290000241842006014430400002912342488858441082482410000884304202104841A0810021021044A08854204632414841884C885BF8A054886415425121C81311444250326011448114821442490A4906489A424C0284B8110054C084C084908C0441A084CC81825D2286882913082244022482204148127B71458C641F2114448C7 -:8029800012901424460526614214482D214D424C825828C02CB01696828E64C0281A085C384188301848C644A85846A481214C48084E88229F4A04A542062724C84522486418AB81CF4E0A40140429118101471410020000004441188200830400440041446048000000002C115122840088004100420041DF560522004480022014212467 -:802A00004893410028131112C48448814100C04280644188808C020082260226024A010042800842434802008902AFB20E174410D512C233588E1741412534812F8224C88282002368482C0C83081481428144405482A1167832D42221524144872113085C0141650829088C0C2145382A4C742412142C51483F5C024C04113932212374F6 -:802A8000940142711B84AB82141908602280C8824400410040144234148C18A84826024004271810142251C200208C185224A6C84244414481F0BF51C0211044848103254404808498422308F0118241498498C8841484488448C04281211867231822450183C922303160440023284408304841442C02811A52846FB20F9016142B244059 -:802B0000C44480120441003A28225836224415C88220284A91144052288C01454218A44827814840185148901285024008504810048544C142837248D49601400143040042112098244848221200001A48E64201214508892828021C018002844F88248214080000414265823262902240C2844502F03AC4200130111A041048842101210F -:802B80004D810080A141840048000000002002182902400100232236264884200424000014604422EFAB092CC111C03148414C34484C8221C822485CA48132D022A14245A88190742450941820D8280240167814A22C18811C628491842829D3248214C84A4D422422D0420285848834248D248D19004434441800404184012008801885CC -:802C000001853184A018B84044082183818102282490840050246024840080024D4821005042418384F48328104224420414001143712211022413848404250481180081400284824088281224112432141A0240481204850284264424584A10420400DF4C045D22224140146264160500962698154B8212418A11111164884F88F414828B -:802C8000492C91488084820425210828888830C4844A0284102804242044088180185284843D370011211190264110132112015041641C888808C180018D547048111858288A2402B0130800319091D0C288528127622A04450890221002230281413FBE052852192503100330228222412800100444314119463821AC810288442C0244B6 -:802D00004450411248C28146544A40040081004241004508207262D2D5072120024440420143D8210814820014418820883114180010C28210280800288149C2141280728482180284004484408C02811044BA54011C0440424101522812E0310816542232411662448604895828881C4918C21821989014148A03202188A828218100197A -:802D80000228810021002488C28100CFEA0400C0241A8282C4228002282220084001204111022C0141A042308480488161218004C3C488880000004100811014148424041FC501822718400100004004452348022904002144C04400110061A028442C21180264141125C1820040084120442A4282022648C422F0D5734088C24242284111 -:802E00002501C08100880044882800289082842991444CA841C07A288D51144044684848489014230488244264222825188408000023E444B2610469642843E14262214C024351127F48E822A2A2156161286D428EC18E8673D444588B8B91456E6127A8122B42812EC88E844426BC82B8214AA423448263E827B91E612881231855422EBC -:802E8000225028A51434A810584684E0223228AFF6031D214B78284D525157324D462F2492212843789163624978876742574416C18415826BC81B1289F42C858495457A88F22E282E4A1B38418E121C5922814CF85195CF1842B72AD2C24848D1883248A5440885C82A85F626222C78A4D482D48CF44262AFEE4963223712172215E14270 -:802F0000127243D111013E131D8129B186E81881AC11214B1282504445B1D8FC84981B44CD5247A42B51421E522BAC8BC1441634961D144B994F2282C44C1F8CE8C43C846CDA2A22D482648245B444F242466958841098E8414654C4EEDF200112200848188001188001188021C211221422871423624422523058415A0228182880022805 -:802F8000182880028C040048A0422002A200F0D9FFF046467F71F3171775F713377F61F172763D176F43F394844B892EB22B995F59F8D7874F66F357533F39F8F2E23BAA1F4BB9B8FABDB97F5EFA84844F22F32B3118AF877314DCA8F92EBC4F42F3A4B64F4BF9B4B44F6EFA26A23BF38FCBFBFF77EFCFF7A8AAEFCAFA2D2D2E222187C276 -:80300000C5DE62D666F2EEEE6F64F6222A7D2EEFAEDECCF22864EFC2F61415247F64D6F756575F7353776F63F337375D154F71F197876F18F1A3B33F5BF995847F6EFB66367F75F592823F7EFFA7A4DF63F11791DF99F9B7BF6F6EFA8682B7B52EB22F217118A4855F52FB14244F62FBBDAD5F5BEAA8FE26A67F41FFF8EEFFFDFFFEF4EFD9 -:80308000E8FA8A88BFB2F2262AAFA2F62A2CC5DEEEF2262EEF6EFE66666FE2F2262EEF46F666648F82F23C3E4646F373572F42F625272D267F71F315166F637315F525373F38F982A51F29F883B35F78F9C7C37F77F6C7D73F1EAFCCBE918BA8BF51F99CDC4F4CFDADE14F64DC82A445AF8FF6C454CFC2FC7CED4D344F6ADBD7F1B7B54FB7 -:8031000068FE32322F21FBFAFAFF7CF6FFFDCFECFE86847F72F263672F26D22A52EE6F64F4C684CFCA5AEE6FC252D6EFC6D6CEF2286CCFE4F5A62F342F65D77BF237351F71F327A77F73F3373757514F73F283932F78FAB3A37F39D875F9E7C77F77F6D7C72BFE1F14FCB4954D246F41F9FDFFCFEEFFC7454F64FC66662F2FF682528FC401 -:80318000F7CCCC4F572EE12AFB27157F5BFB8C866F63FBD696EFEFFFCFC7FFDFFFCE4EEFC858FFBFF6F66A6AED2AE5FE6E4E2FACFEAEA4ED266FE2D2E6F26E644F46F62828CD1E6FA60B430223022200402348012048328120482418088524481411088180928410044D8180016D83C011484502144002404804440020044F6504450161DA -:803200001022E11441141401198208274460441002008849042D4842209842D0842448428421582450288A3442865C2A304A28A141424188843084810045F89BEEC0521F41D228F111248B141F41324A1D64AB141D24AB9419B24A19B54A3924AF1439252F147B25D812FB25488DB15FA2C4A16FA2E411F2244A8F19E2A26459ACE449D273 -:80328000A2F491242CF5912485F2912483F49124AB141F48B24AD141B24AD981B24A19B54A3924AB9443B24A79A498924F82C4944FA2D45104ACF511648D521F41B248F1112483D441344815F44A841B288B2441AB8443F24AA15129D88584F8174889D9A581D886C881457A8831248641EB58D2A2F4912CACF59164A5F291248B141F49DB -:80330000B24AF18124AB1615D442D981B24A9B25A93924AB9443B24839A4182782984FAAF59B6D4028080000000044800200000000008008000014000048000000004480020000005012F07BC80000160110120414820041004410011849024182104282014022114844820850821C020045012A0800100200400C287FA701201911041531 -:803380000420C1821826013081004CEA234802A081840000828429018A022302288180042984884482044890424C024D228002281444EE4900D2400515024120A881266142441C08414CB211486221A08116282808B0820118301285312AA08481248CC42129248854244984AA42809624D0240240C22C141AF2826F004021014400181193 -:8034000021000000822C02302410042400400AA02840448202000000110000211002200200413F450F204101A5012200120024000012200141448480040018800180022821004800A10080080000008110089F4605105242001817411861A49011821815C2140000880044250421100223012622911400002823422202210000104402006B -:803480001001815FAE0A24504224111813811182011981880118800118884144108404242001122212124002002344028121000010040040484108DF4F072041018160421044180224401106000000C502240040820110922480028082022C020020080024000000844FCD0710080000001850240028184034142200430412002C021200CB -:8035000018411860210000002100100428100440042400ADF1004141452301801441044130841E2A1004401844021602200100120000004C0410028002004182280081440085426C614ECE0024112110440400102101400100000044224002400440083012200100001008248004100282100212F0B31800455214652301001144402211B9 -:8035800044181244844108904445820212212120018C012418100210029022001082041012284804814341F2C7ED00000044414820011120883111004422440000002290140010240112490100004008008200444004211018F434BE00004100410000100144004400004004000000800228800228804382020000002302228122302430F1 -:803600002A2E43008144502119911150210021447721502441C0124141400400000020030000120010022332222722002800210021401842B2870F100111001004001110020021210090140000000000000000000000000021005082A18100F088FE0018804101D111814518C824C3628187230022002100002110042011020021231122EE -:80368000448204211012E4221404808412025022D022027F7C0C000000000028000020212102000000000080010028000000000000400240024002004FF201110000001004001C0163110490128001212200182244200118000048122800000024000000000021F01B51001100124C21311220011604103118214342225142438101440018 -:80370000188001003880016880011822282226C22440821204000010083BF620388284140000120000110010020000210000180000000000000000000040020000C01124FDF6D081818194144B1840381444438171310C4C52211220416441241221441880D842012901409112128CB14291428081012C04484004680024805258891218F6 -:8037800012F8AC51141D1282003C295194188418ACD281C32B8554948D123022322D142921415446001212411220022361211A4212021218122D228022A22221482147242410581424C011A5F884EB001318EC111141F1181467113C31186011417721274347412566211843119414004100490129E121812181032C315218523812002BED -:80380000222CC42646124402212140129A282126015FBA03141E19504543C114114445544418221D141CD1211182D14453622464B0142142027022240120210222A0122822706242A2422423022100268222D222D282C22A848D2CA42CE25B0C00001002A1100AA302814004281200440024400224C012282428800228802284220442205C -:803880000442002220022220023FDF081D123F11F118181F41E1497113F31F1F3D13F57D1AFA1E1A9F23F2181FFFA1F11613E7E12B116F42D34221A1114B111AF126262552222F21F124346F41D122B112A1132B1329E123F322322F23B212A1736AA7665AA5262F22F622626F24F622222F42C442214F4616D222D2AAF2272EA7A22AA287 -:8039000033A7822FDB4ED131F153598F81F111549E143F21F11F1C5551552F21F11A1E9F31F111377F21F11F1A6F61B112D14651424F41F114162B111AF13434E028F912124F43FB16142F21F112123F13B132F13233AF83E321F1524A2B333AE321F112122F25B562B222B622F666662F26F622642CF442626F42B2229222AD2AEFE27271 -:803980002A18A2118F83F1AAC7D021D113F41D1D5CE171F111117F51D189516516F41A1427812F21F316126F21711EFA161265147212B216B116B114A132C0821AF126344F6181E121F112211E122AE3A1D122F112522B331A81A1117AC3422F22F262222F62F26262296224214F64F4222225722A782EDC8A12A2112E121F250B1D12BDE6 -:803A000041DFD1F151151F71F111117F7151CF55F61C1CAB113F91F11713CFA1711EFE16124B116554226F61F1161463B114F1243445F612821AF1B6341E121E122B111E311E121F21F132383AF31A522B113AE327F752522B372C7422F262222F66E622922246B262F42426255222A7A2E7F2AD28818F83F3281ABF5601149014C01100C1 -:803A80004001204122410700204104000080410400800118100200182002240040020081100800AF7A060014800118122001190200403624181002184100008021010000800100000000000000210000845F23072CF5112485F2112487241F41724AD2C1F24A121D2CAF26D981B24A5985AB944782AF5439342F147B24D812F924481CF95A -:803B0000244A1CF8264A16F1264A96F1224A96F5225A9E242FA2F491242F22F4912487221F497268F29124A7261F48B24AD141B24A9921AF2419B54A3924ABB443B2427B2498B24F82C4B44FA2F4B7E9C05A1B612CF4112C87241B2187341FC1F248121FC1F268961F81B248DB85B24A6983AF1429F142A147832D912F82D412F924581CAA -:803B8000FB26C81E816D589E212F8265582F9265592F827591FC225A1F4974287291B4287191B4287181D428D141F22A941992BA599298F04AB4412F244BD842FB144829DAA4F54C584028880400000000000000000021008008000014008480040000000080020000005012F047BA000000001100001004004400000000004082014022AA -:803C000002002100210000000000000000487F410E20884881480100140000810000000000000000000000000000210000000000104241014F9909608C82111001141011042244000000003012200800101201100A42240010020041008002000021401172910E000088000000001008100400000000002001002800000000210000000043 -:803C80000000118074D4050000004008000000000000000000002440020000200800000000000000002200CF8407400418C01240321141121002000016040000410000C0120000800228400228400800240010042400003FB3034004122011129812441824000000180000400400402211120200282002108202000010021004102202D0F6 -:803D0000C60C00000000110000000010040000000000000000008800001008000000000000F0DB9F00280021000000120020018004800400440010040000000000400100100820C11800220000EE980010090000000023081002180000000020010000000000121800000000400200400418D09F0A00004002000000000010440200000004 -:803D80000000880020010000001200000000000000F0F1730022910000000024000000412420040044200100000012000018100100400800290120028001DD6600001002210000128840220112420000000000418008000000180080010000201108004400D0F20C0000E011018400001400000000000000000000000000008800200300F6 -:803E00004008000080016F680E000000000020010000000000000000000000000000000000000000000000DF880C0000000000000000000000000000000000000000000000000000000000F04FFE000000000000120000000000000000000000000000000000000000000000F08DC80000000000000000000000000000000000000000006C -:803E8000000000000000000000FFE40F00140040080000000000002100000000000000200100000000000000000000D0D70900000000400400000000000000400280018200000000000000000000A0210000F0BCFE000000000000000000000000000000000000000000000000000000000000FFE40F004008000000000040040000000010 -:803F00000000000021000040080000000000000000F09514000000000000000000000000410000000000000000000000000000000000F0BD32000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE004001000040040000006B -:803F80000000004100240000001002180040080000000000A0120000F0AB8E0000840084000000004004002100000000188008000000000000000000000000005F310E0000000000000000000000000000000000000000000000000000000000F04FFE00400100004005008004440010024004002180018828100218800884000080420831 -:804000000000280000F0B236004001008004548588022148400428100240042810828401882810828441848842188204441828842148E041012810A21140C435000000000080041400000000000000000000002800008008000000288400000000BF6F0B0014000000540000484084041002400400218001882810021880088400840028D5 -:80408000840000800200008FEF030000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00210000008004002810020080020000800280040000800444800221484004002148400400214FCF06000000000000000000000000BA -:804100000000000000000000000000000000000000F04FFE000000000000400100000000000000000028000000008800000080420800000070820E0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000008002000000000000000000000000F07F4D00000000000040018B -:494180000000000000000000000000000080080000002884000000002FDBFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEB -:00000001FF diff --git a/zaptel/kernel/xpp/firmwares/FPGA_1151.hex b/zaptel/kernel/xpp/firmwares/FPGA_1151.hex deleted file mode 100644 index bb461bd6..00000000 --- a/zaptel/kernel/xpp/firmwares/FPGA_1151.hex +++ /dev/null @@ -1,697 +0,0 @@ -# -# $Id: FPGA_1151.hex 5975 2008-07-28 14:38:23Z dima $ -# -:020000040000FA -:80000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6AD6FF400008CB0A006AD6FF400008CB0A006AD6FF400008CB0A0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4455544455557475577775577675577775577765566665563625523235D2E37C2B511115511115511115511137 -:80008000155111155111155111155111155111155111155111155111155111155111155111155111155111155111155111155111000000000000000000000000000000000000002552222552222552220025522225522200000000001AA1111AA1110025522200001AA1111AA111001AA11100001AA1111AA11100001AA1111AA1111AA113 -:80010000110000002552222552222F21F112122F21F112122552222552222552222552220000001AA111255222255222255222255222255222255222255222255222255222255222000000002F21F112122F21F1121200002552222552221AA1111AA1112552222F21F1121200001AA1112F21F112121AA111002F21F112122F21F11212EF -:800180001AA11100255222255222000000000025522200000000255222255222000000000025522200001F1BFBB1B1755777000000000000000000000000001AA1111AA11100000000000000000000000000002552220000000025522225522200002552222552222552222552222552222552222552222552222552220025522200000066 -:8002000000004F44F444444F44F44444000000004554444F41F114141AA1114F44F4444400004F44F444444F44F444440000004F44F444446F64F446466F64F44646000000004F48F884846F69F996962F21F112120000004AA4442F25F552522F21F112124F48F884846F61F116164554444AA4446F65F556566F61F116164F41F1141411 -:800280004554446F65F556566F65F556566F65F55656000000008AA8882F29F992922F21F112120000004F44F444446F65F556562F21F112128AA8882F21F11212004F4CFCC4C46F6DFDD6D62F21F112122F21F11212006F6DFDD6D68AA888255222006F6DFDD6D66F6DFDD6D6000000008F8CFCC8C8AFACFCCACA255222000000455444CE -:80030000455444008F8CFCC8C8255222004F44F444444F44F444440000004F44F444444F44F444444F44F4444400000000CFCCFCCCCCCFCCFCCCCC000000008F88F88888AFA8F88A8A255222CFCCFCCCCCC55CCCC55CCCCAACCCEFECFCCECEE55EEEC55CCCC55CCCEFECFCCECEEFECFCCECEEFECFCCECE00000000CFC8F88C8CCFC8F88CB8 -:800380008C000000008F84F44848AFA4F44A4A255222CFC8F88C8CC55CCCC55CCCCAACCCEFECFCCECEE55EEEC55CCCC55CCCEFECFCCECEEFECFCCECEEFECFCCECE00000000CFC8F88C8CCFC8F88C8C000000008F84F44848AFA4F44A4A255222CFC8F88C8CC55CCCC55CCCCAACCCEFECFCCECEE55EEEC55CCCC55CCCEFECFCCECEEFECFCE8 -:80040000CECEEFECFCCECE00000000CFC8F88C8CCFCBFBBCBC3AA3330000008F84F44848AFA5F55A5A2F21F11212CFC8F88C8CCFC3F33C3CC55CCCCAACCCEFEDFDDEDEEFE1F11E1ECFC1F11C1CC55CCC4F4CFCC4C48F8BFBB8B800EFEDFDDEDEEFEDFDDEDEEFEDFDDEDE000000008AA8889AA9991AA111000000CFC4F44C4CEFE6F66E6E1A -:800480002F22F222228AA8883AA33300CFCCFCCCCCEFECFCCECE2552220000EFECFCCECEEFECFCCECEEFECFCCECE000000004AA4441F14F44141155111000000CFC8F88C8CFFFBFBBFBF3F33F333334AA44415511100CFCCFCCCCCFFFFFFFFFF3F33F3333315511100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000008F84F448489F95F51A -:8005000059591F11F11111000000CFC8F88C8CFFFAFAAFAF3F32F223238F84F448489F91F119198558884F4CFCC4C4FFFEFEEFEFBFB2F22B2B955999855888FFFEFEEFEFFFFEFEEFEFFFFEFEEFEF00000000CFC4F44C4CFFF4F44F4F3553330000008F88F88888BFBBFBBBBB3F33F33333CFC4F44C4CF55FFFC55CCCCAACCCFFFFFFFFFF9E -:80058000FFF3F33F3FD55DDDC55CCCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004554444F42F224242AA2220000008F8CFCC8C8BFBFFFFBFB3F33F333334554444F42F224244554448F8CFCC8C8FFFFFFFFFF7F73F337374F42F224244AA4446F6CFCC6C600455444FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004AA4446AA6662AB6 -:80060000A222000000CFC8F88C8CFFFBFBBFBF3F33F333334AA4442AA22200CFCCFCCCCCFFFFFFFFFF3F33F333332AA22200FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000CFC4F44C4CCFC6F66C6C2AA2220000008F88F88888BFBBFBBBBB3F33F33333CFC4F44C4CCFC2F22C2CC55CCCCAACCCFFFFFFFFFFFFF3F33F3FCFC2F22C2CC571 -:800680005CCCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004F48F884846F68F886862552220000008F84F44848BFB7F77B7B3F33F333334F48F88484255222008F8CFCC8C8BFBFFFFBFB3F33F333330000BFBFFFFBFBBFBFFFFBFBBFBFFFFBFB000000004F48F884846F68F88686255222000000CFC4F44C4CFFF7F77F7F3F33F33333C3 -:800700004F48F8848425522200CFCCFCCCCCFFFFFFFFFF3F33F333330000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004F48F884846F68F88686255222000000CFC4F44C4CFFF7F77F7F3F33F333334F48F884846556664554448F8CFCC8C8FFFFFFFFFF7F73F337375F59F9959585588800655666455444FFFFFFFFFFFFFFFFFFFFFFC6 -:80078000FFFFFFFF000000004F44F444447F75F557573F31F11313000000CFC8F88C8CCFCBFBBCBC3AA3334F44F444443F31F1131300CFC8F88C8CCFCBFBBCBC3AA3330000CFCBFBBCBCCFCBFBBCBCCFCBFBBCBC000000004F44F444445F54F445451551110000008F8CFCC8C88F8FFFF8F83AA3334F44F444441F15F551514AA4448F88ED -:80080000F888888F8EFEE8E86AA6664AA4444AA4448F8EFEE8E88F8EFEE8E88F8EFEE8E8000000004F44F444444F47F774743AA333000000CFCCFCCCCCDFDEFEEDED1F12F221214F44F444441F17F771714AA444CFC8F88C8CCFCEFEECEC6AA6664AA4444AA444CFCEFEECECCFCEFEECECCFCEFEECEC000000004F44F444444F47F774740C -:800880003AA3330000008F8CFCC8C89F9FFFF9F91F13F331314F44F444441F17F771714AA4448F88F888888F8FFFF8F87AA7774AA4444AA4448F8FFFF8F88F8FFFF8F88F8FFFF8F80000000000000000000000000000000000008F8FFFF8F88F8DFDD8D800004818000000000000000000000000000014000000000000000000000000D0D2 -:800900005E0A000000000000000000000040010000000000000000000000000000000000BF280C0000000000000000000000000000000000000000000000000000000000F04FFE0000481800000000000000000014000000004001000000000000000000000000AF9C09000000000000000000000000000000000000000000000000000095 -:80098000000000F04FFE800200400100800414800280041480020000800280040000214840010080041400108204000021BF26050000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F481800280000000021000000210014CD -:800A0000001002400100000080020000882800008088020000EFE40F0080840100002001000000000000402101000014000000140000001400000000007028034818148002800414182810820416012810A21140012810A2414001002B11484001280048408188022148008828108204F05C658084018002000000100200001002400100D7 -:800A800021001400000000280000808802000088280000F04EFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000001002000000000000000000000000000000EFFC0500002200000040020000002100000018001800000000280000202802000082220000E01302000000EF -:800B00000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000012000000000000000000000000000000F04BF2000000000000000000000000000000800100000000000000000000000000E0DB0800002800000000000000000000400200000000008002000000000000220000C0F6F1 -:800B800000000000000000000000100200000000000000000000000000000082000000DFFC010000000000000000000000000000000000000000000080080000000000003F1B08000000000000240000000000000000000000000000000020020000000000F087210000000000000000000000000000002400000000000000000000000099 -:800C00000000F0EFFC00001200210000000000000000002200000023020000000000000000000082008A026FF80700800110020000000000000000200200008002000000000000000000008800003F910A0000000000000000000000000000400210020000000000000000000000A028F08CE320040000002001000088001A810400001112 -:800C8000001800000080011200000000001400000080027E2500000000140000000000800200000011000000000020020000000000000000001F8B020000280000000042120000200200000020010000000000000028000000000080025FD2043280021260126022004812004A280290C2128248112E4280A241282022010088800112429B -:800D00002C021C22448148210C202204880042888E6B80032800008002001220212C023082128842112C0680042082010088008021048002002004000088002882BBAC0000A0126012400280044800008084020000281828180000008001002602144826214821088082040020045F9A06000022000000004001200100000080020028005E -:800D80000000008004000000004820080000F031318002220020022248200100482220A2414A022280044200200442220000002120442204C2000022004A088242F042B820022280022800480000000022184A0228008004004280040000400200100248000000800488002FBD080000000022001200114228182004002004280080022001 -:800E00000200002004422004820080848208820048E0C343012A242202A02400122280A2140012188004002280A142302280A46112A820A45218000080288402280068001120042984FCBAB7001A84210118A0120018222888528022062001112921062001121800008248002005002242800A428200000021228F5E080000280000420008 -:800E800000804301822A01A0244220046820028004180024984A0288138404002004800819022A0800B77F148081012212422820212202CA81A5121AA24288481830414868422AE424032A21A543188A822188622118684882A0484A8204202424048002480028FF48018022A221002212808401000014122003802202008002004601803F -:800F00002401822001190420028800A28800800A428AF448FE0000004601200200201401000022420028002082240280810112124228004A02802488082008820088888601FFF102488083020012800212281420010080044880010000A041221122200222242042022220420288808882086800825F5607A052000000360212481A04323A -:800F800020015200A02400224A8186011061110000000040215412C081420000808202C81448DF1E051400002880020026010000000040820400182082A1210000208184024200241424C0A2480000882A0480F8A1F32022014200002094222004200200808404001800282242200112800300206424808224242424240482000000AF9BC7 -:8010000005202202A820820428400100002024040042200200208104188001480040024248C0228228C082404241220842F019E10040011422112214181122B041410100120010021800284880022200002222000000825021248800000000F0681EA0420028228002000000000000000000480048422800004800000080044222880088BE -:8010800020A882001C84F4998C0080040000002800282200200200218001A84842180014282828A0420028D012C2222428004AC22242246022001042F1AF71A024382242C041203731283B23262181341120011A01284A240280828584A126187A8361111A21A12138422C023061203443681DC242468208888228226014F04AEDA0422206 -:801100002890212822289012A025484220028026840442482021A4266A0222141A0228A014A04222A04434243C824823BC82AC68428602228AA844C21CA4841A09111A94112A22229221802206114AD211E1122201200442C042422822281248585A8624A212222222322880622229B662B422A442EA38222429A84829A8282DA2222BA8FC -:8011800088828AB42503130411102114A116114E12A01200802182210232422200001A024A02000000003022481081180148200800112008008F6B44F141611F15A3121D411F16F64121F041511F15E521F313114AF521111F11C121123AA2227AA5131AA3664AA446282AA2737A25A1321AB571A7333AA133227AA313482A127262523343 -:8012000023F2A3E137362B2217362D822F24BE42D42298222DA22F12FA42C24A8C4CF3CB7B80F4B1711F1221A2661F16F241612AA3771F14A666381D3115F11111123AA2223AA1571E722B226AB27285A2BA2AA2C6322AA1551F17A7333E113AA3133A87012A1232221F1464222F2AFA62423F12C6A22F2C7CC2B2C2F482822B2A2F2AFAA0 -:801280002221272E2B844A1CE25E064AA6711712A0622AF62121124AE52456131F17F611211F1151112A031AA3644A24B262A6666A85A2A22AA4461AA2321AE417A7121AA1331AA1731A012CC2226E222F2252132F22F6C2822F22F2C3232CF842C22B442D82212D832BA22BE42B4448F0AD6DD011F4B13122221F12F62161287AF62131ED -:801300001F31B362F61121171515F111112A031AA3644AA4422B4446A256283A2AA25F3AA2526AE617A7331B113AA3113AA311E022E222A2666A56332F22F2C3C33F32F6C2C22F24FC42422B4C2F28B8A2F2A2A22BA22BAE2B8CCEC28E811F3E0A00146012400126011400400100280000008002002800000000000024008A440280041176 -:80138000002882005F740E2260120048802606620048002820044A024A022822A042422084A121200120020021484282420048888220088242008E42BFFF042AB41122B21122B4117262B111B262B111B262B911B24239112B94322F1429F34291222F14A9424E912E421CE82264152E52DE212E52DE212CA4292CB491C2421B29241B293A -:80140000421B2923B481764291612F1498612F14B881B44228BA4228BA4228BA42AA424AE82AF4CB6240B11184B51122B4117242B111324213A184122F143A112BB4322F1429D312A9432D812B421CE922C5812EC21CE82261182C61193CE419E222B481E222B481C6121B6966329166B281621219F2228319E214BA81724222EA2428EA34 -:80148000242A883A2229A84A3F560920080021000000001800000010022901880000400100000000000000000000004001BFF60AA2001C0120033AA44212202181A181280012182AA42588220048382A240480142102008280242482084A8804482024AA422008A2C24F2A0212A228208504260280862E8484244622A221CA220620168220 -:8015000006324218A01422122A8421A2188063132A21A28442CA02824A0828884282824A32411C8472FB0738C2281800C0221A86A243882A8121252482A2124A63244A82A54A218A075A22A1244811221E412A24222408282E112AA442E888E882224A08288862E8E02448611A4AF85821002810A114482A018004684248204B02208803C0 -:80158000288002004A8201580011182818800918004880A484200442822088822424F2258200408142020022682A2108000000002004282084012B42122021A228000018200288A0848A048008248002202804FF320F382021218A0312A08120061A0838268284A214F28A22828C04282D4228884A22226421182880038A0618602282224D -:801600008028084228E880AC242088781904182001882820810228A22008002128488A04628A040058A08272281A84128202003880022A2888248408884828C822C2488004DF8A0D22108123921200A069124880012A218204182A210A20062C466222420020A1290038800C1240028A82088200302200288888824F3C08143A8481020056 -:80168000182021984128C812228025882482227382828808238544820E4A48018A820420048A02218002284814E288802462288084F8631A004828188085068002800742C242118022210421322A0C2088812122A18438422AA52128208104486282A84A0A8A0422484042A28400DF320F18000000288024812208202102130182124220C2 -:80170000042A25120280042842160280018280840A90410000008004004A72450DA0211A0220A14200688226A149A0413AA8241935816282525A223842425E22468224A1A1428A84A2258A071820842884A48620C8E14A0814222880642288C24862BF84081C01A02180041A02121848A04880048001382200A822A0128224422621810C75 -:80178000241A22A22120A1821082260280A4848A84880448006018BF740F4AA1128024240130418880A21814AA013062C22848000000821A02281A88210212881442000028222CA2420080040022868204224FDD0228200100242C210252CAC1214001182C29012A880448001222202208484A01281288182C09210024C082004682082430 -:801800000000002E552002282A24C261130432280011A024188008A024A02100828008008008888002A01200232284240442214002284242220046F1D8BA008084210112134202A82004214248122288162222240122881800122381041821904182804101001C02228A04420000808218F2D4248081210180A1242D42428A04209C82142C -:8018800028400218800110024A024A2102880088E01489820900800621420050220000A02488825F4403482248144226010024428200522006A0241200423022808482858202C280081A8C8408122880280448800200AA24A884A02448EF610700482819083021111A021B142004004848002AC4120080080088001818182448002100103B -:8019000002210021400221288008F0C3CC008A04A021481848802401100180033898202116028084820400128200800100210029040020060000686012825FF20D00481814800218128828122BA129A84100888008218001290810220186511280084800181840810228214A022002A04800296412EFC6072AA22E187AE41DD611A1421583 -:80198000A1249AB192A2C49AD42138C2124A24A132EAA2226AA157482488A041723AA41A002B5A1E12822CB18181A889211A012E612137222B482384A8224829D222A246884ABC42E21884BE8A0D128AA12138132294212F23D612A5E64ABDA1B14132521BD24AE422C2A288129A2C4182012A82858217C28298CAA88188881321A1542436 -:801A000010B32202E8484268233442272C002168A2486EA382CF7E084A250111183AE62521343121A0213C69181E212AA111CAB5D284A91429867242022462AA08281AA2291A6514823AA18E1C2A89E32101602466A2242E2280C4420080288EA28220F6916C2004000048A041204121091220011200422014022C814282C292282CA1244C -:801A80002C89C28128982818194212018088C4828028828804200442DFE30A2AA226121B6219A1375E122B112F25D122BA22B231A3DF4E422BA43AA1331E121AA9333E926AA31148242B3A3E322F21FF52521E52272A35F2B2323E132F2BB912E32FFA3231BAAF112AF2222225F32261CAFE41212AAA8E8E822B24A82BA88AA822112EC20E -:801B00008AA88823F6942CA066AA27F131315AA7351F34F113533B552CB882A8B35AE73CFC42817AA733BE927AADBB3ABF32A5172B51242BA21E122F23F172526A86F821A32F2BE71FAD139E322B7B1AA1193AF323313F1243E116F663612BEE2EE22BAC42CEC2E82BA8AEA22B44CEA12AB8C2ACEAC8C9034AA2631211111F17F341532362 -:801B8000F153132DF22B223E311F1DDF31B141A8133AE325B152AD772ABB62A35158242F22BA32E323A7572B73A22E23DAB512A3992AF191E33B119AE923533135A1221F22F6E2E23F36F2A2222F2C9242428672A212A2AA6AA4C22B66AAAC6ECFF3096AA63B3AF231315AF751311F34F513633B752CBEE2AAB3DAFCC1D33B847AA767DE9D -:801C0000922BC5BAABF77AA5572C55222F22B22262227AB562E629F88283AAB7D3EF29F9B2123F19F3B1B18AA1992B3329A1221B661F36B6E2BEA236C2CAEC24E42874A2F222222BCCEAAA82EAAECAC8DEF5A012800122408364124800001448A041800412280000A0248082010000002C0100246022820024820000004A22F8452C0000F9 -:801C800028181A260A18126A28091A840838228822983A24040028585220089A828482A929A028808281028A2682048A242402A242A2A04800EF360A481B21B01122B6117642B211B642B191B642B991B24239912B943AF44291B22F1429FB42913AE414EB22C4812E4216E122E519E222E519C2D2DAC2D21B292ED21B292CB991A2941B22 -:801D0000292B161B282394612B8419B64298412B842AB44228B242AA4A2B842AA484AE426DBB001B61A061141B2127241B61241B214AB811D2323A114AA2412F3428E31428531223C3812AC1912DC2142C6D182C61183CC5212CB581C25219C61319A6148AF242138A5212282D8119F242A2112BA4222F24084A2A9A822B422126F215CDE9 -:801D8000008200000022000000000000000000000040012002000000000000000014005012602CA04836011862141C212403521214482084A1421A82220458008022A2821C818103181A822181826128004280A482A82984240446A228484A822888A4869F29428121880116014AC2212486C3A2132228092C220848172818288022CA61E5 -:801E000020212114218406C21C24022AA842A8218A32432C288464288219C822229082372822688601EF3648A141DA2221811481E6122441A1422631214A082C222122C422168282A121A28E6122281A3A4112138424A1C1125222984228E02228E424886A24AA04134C022722881722A6A2A486A12CEFEA061001E012011C012622D822EC -:801E80002981280148884838132804420000188041A1122880C2412880E2222818824401428A42A24820A2248246A2480042D0A10E1CA4212220028024042A8804400118C01222A8124248288032221421A052822A29019012282248000024484282A0480000424842D0D2082280218185251282B31222A118522B1824782A28A442C200E7 -:801F00001982288482242127E2260142C042221228F04282B02139C1E82AAC242A081924048A6224A28AA428A828824F2101683238124A022820A11238181042A152A2C0420018468188244222C262222C83059846022C2121A24A2111C2A82AAC42C248860188220042A800F04F54100100184A418264268028AC148A012118482A21AEC4 -:801F8000822022240268121C014222C2221228804202422A1921042428202484842894A28242E862884F670B2A8424C11142222C0114124846A228004A8182C1422682281C9142124A08282C88A1814820C82112481AA88342C2A842290828468182244482841441220680FA97851418681122388024A2422302803242588248282200A052 -:80200000212B2812882852482800168226218C0600184222422200298A084A082088022821F0585640012200121C8201E028822221082C420119212403002A84B241010020A284001002800200118888800480822848010082485FF44F410126911180F34112324623622E241A2828A11A80E326C14292C819A3844AA224784A01218822B8 -:80208000D260115823822828A41CC8681C2C8A48A384C8803242C82092428088F8CFA9A0522818286A012220220168244842482F14021422280022001422C22A21C141142BC2288880A1212220022120820420A4488880082822E012F442A58014014E31400122B01104332898818221881100220021CA0222211A0442200C2A082A210124 -:80210000282442242088A248232888849222A084008220F47461808294211011121101291282111392211306201201AE114813484221A152200382000080028821302224201402210080122122A2422B84B0860D2238800428103242821E412B28A01842C22C23B82288888824840429270480052E41802C2421048220228284821482049B -:802180007082822408218223042642F14FC51001480023210420840812281002222002122C2802C0820014864102008A041E221A26248101422288A80000001480880826F2439620052280022A01190622180010011190114813081988944122182A042A0448390114402171928141012480088E2200242682682290228008BF6C0420418F -:802200000114501242301221D01298222D21180021208284C2422290828E4216C2422442212C46C2422C01C042424602204A0280AA24A2800242882248289FE10100480000130111001A828241021800182021812188081100168101920024808202220000000000000000AFAE02122820238222159212229A2202208CA1A12182A84228B4 -:80228000A82888281A8402288631228226A124238912A22C0013016880240280228898826E8122424021F84DC44011A14111121381A22519021334419031A082208381210821008088682220031C328210011C042521942242211002212829384200212D818094222CF471E520E61106222C2322B1427341A24419E21884D812E1223B531F -:80230000A2298182A8141BC84E222B252A3212241A61252D518E832F1194824824122C012B272B2A3A25022CA42E8AE82C4802E8292AAA2A421B2A488A6A18AAF2189D90211991111B5511313F2662332A741132721F22B8B1918133E41299921E2382171B2AE211A3928E83881D41722F24C8212419A2A2DE221739EAFAC3823AF6213261 -:802380008E92171429B213B1221482281292828222A22D82B0212CB4A2A2422EA348AFF84DE11125E212C22126E111C35119D412F322B18ED32B312523E918A4681E221B822B92388A2CA6481B42CE42EE2278AAA6527AA2471724482BA61AC451701281E4216C244E634E226A52222F24A462A22D82272C4E42282D822F28D222A884421C -:802400004A64244F5A01002022E82281041A042002241A4403141234921C22E91432821C1262142190128001293941211188190448002200820020883281002088F22DD5144AE61642E11364111C523127233B222F22B2C3EC16EF33F911813CFAA2A33F18FAB3A23F2A7A32D333B47114F172411D411B5C1F23A1F71F31F77171AEE21FCA -:802480002FBFA2AEDF26E316F7713317212E43AE232E237E732E222B442E82CEE22F2222C282CABE6284C822B0A3A8CC4A048E611FD542F151612E611D2117133E831E315E632F36F263612F3AFED3E33F35F592B114CEC1EEA11F3A7A23F282A32F32FAE3E13BC68EA12F12FCC1E13BF656A1661F17A777EAEE3CFEE2E22F1CB481EC1AE7 -:80250000F231711F23B3A1E836F263727E332E224E622F2EEC2CEA2EE228DA22E82CFC62822E822DA2EEC2372A6EE22B6EEABC82F6341E144AE41247E11363112F32D332B162F573126AF2C1C27EB11EB33CF912933F2EFEA2B32F3ABBB2BBA1E11DF5E2D13AF1E1D22F36E414FC32123F37F772725E722F2FEF1EB6F2FFE2C22F21F971D8 -:80258000E23F21E531E123F1E1623E235E732CA244AEA2CEE22EA2A82CA8C42B4E2AE82A4AB1A2A88C2BC488AABEB542F171612E311CE21363332F33F352632F37F373712F3BFED3E32F37F392932F31F1D2D13F26FBA3B22F33B192BB31BBF1EF17ED2FFF21C23F2EFE72637E221F33F372622F27F7F2F22F2DB7F2FFD1D22F29FDF3727A -:802600002F31F13233BE921F2DFB71725E134E624E622F2EEE2CEA2EE228F88282CEC22F2EEC22F822A2EEC2272A6ABEE2E62EEC1AFEF3C90080012A01242002000020480200000000000020022B82200200001800822200004800004A02002FA7062A042A01241262004829A9612C28282482210A80AA424A2882B82224B422012B5282C8 -:802680002BC24220B4222851228A2284228224840268888288802A82A8482082A842EE7FC0511B21221B21621B212B1619F642111B682F16B991B24239812B942AF44291A22F142BDA12AB4A4EB1AE421CEA22E415E22264192E4296C1429AC2421B2D2CBC9162221B294AB89136421B68272619B662B881F64282112F2428FA4282A22F65 -:8027000024AA4A29AA4A4AEA22F4FF8BC0411A46A16146214181724281D212A1214E31C02113E21439212F1438112D813B411C98511C98D156B12168192A042CE41882B5C142B19146916146B39162341B282419E42418E1241AE1242A6224602480B82294824837B8008200000000002100002001002180010000001400000000000000FA -:802780008A04000000002501DF2505122E11006642A15258C0414AA8A12D838A843C81821116B22191421292224233228192422B2C901288A086290129A1822E1180448304A81906482082B2C2A282822006281DE32026C8211921C1228828422AA1212100241A22A542424213A1426811803442A0929033C8238692128AE212012901BA20 -:8028000054228A82F8A2421984880CC2211B4880C4638A048E41C85F390C4A220F207522A36148484E21228E12138228442169122CA1422F21A416583224869112228E422ADC2333112982D222AFA11F24012B1A13E12229249AC223964113A8828084622268681F2CA248428691225E6380116112132102821A02124E92282C88C482B25B -:80288000424842134101A811422A2444A22100C8C2008082012248241120B822882684C482E0142888082022A448FF2D0D00001848A04100003011184818320028A0242024021128A0242282301148281C012E12001082C282E024A84880A424822822A800826FB94981A3123228681CB1310426C14180878894418024C4311B52482061DB -:8029000012824832181B141A04123AA49648381800C0421B86484A222CA64800298888888694C223A428E8705E0B281AA221808495411214002A04181981041A823331228043014AA22116A1245262A061F811582813011662241B8448286210622410828488A8246AA8C2A0A4885FBD031200221A12A1124228190418881924045842110D -:8029800048482024A248003011002A8108522212002820022324882E8CA88482824A824642022A08242B841428481C820118481081210AA848218A81A816888028B81114621D4AA841482C84022E411622AC21A04212408181086611118188020062800611424248AB1A002A04144800122A84024268800110820228289022128820212890 -:802A000041018032418A83042A090022008A84A228802402002A14221882F267D920250128282280022061122301802606129042422004108102200148004880082848481429288212014820880800190C80F8F822802591211621862384C24138A826311224188AE622A8242A4902484AA1424842585A0223C1114818CA32515A222228CC -:802A80009B2118C826A1A41382828A0848A26880C42280084E825FB80B222880020012228081A4844820212401A0A4A214C0814001C222601242212888800180045012E01418014800888082A484484226F1156AA0421414146681041414000014142681A14862222094416248601482141248A0121819018038216821154202882C66225F -:802B00004811248602404202A200DF6C0D80060011281246820960249820212A01122413424211818481A5822226834C32818682C32219019212002814000000880090414229041F12440100282822482890A1421C04C81242808A81988188241CA884001A82014200828024319120B8822228A2482982288418A2820024C2288280E21417 -:802B8000F843D810018044622500320030912800460120210123218111028280A581212419042114301210110200212002230442230280042C08AFB601481414141410C121140080081480888402788086021848213082284A01008200284A22E724013081248260342CC48288F08242282800F03AD12002282248A0144848481186A1412A -:802C00001C023681A421008026811481041168282082840413428106123021242A2484C22242882024248C622880AC84F07B190000001691222120211802128622C8222048021123081800800114821C0B002C0A4E8200800A28460100140022000000DF244701822800281842224218180018C2128085A6489800A21C11A1241CA484889E -:802C80002248909100281904882820882408202402A084C08188C021C23FBC0111284842241001C021132498214AA22440018008302388188018821822214101004848231113B182012450128890A2144210621242222221F07A56142213A82219227441B2139521125A0196A1869A85B813B4C1A8564AA4221BD823B761E614B2812CB585 -:802D000041C56113A23A1B93289A041E13AA632C19E336E414E83AE81222EA24622CA280E4248484B482E824B2E134218AAC821C24F4C582A024821462344830226E431BC81B54421A91814E314EA13A94A2324880AE1119A5241941A38DCEB32B442C8661241B881111266138118AB242F11112308225C1E2EAB8C27283F1E3238880D49A -:802D8000228A3422686EA3242FFC021D412E61111CB421F632316E215E4119E212C28139F88143463111AAC13192B89A397217183CB8A24883042B121AA481C6B1F2AC322F14A5882394312B832B392F23B511B2C2D822A2C21BE237142D22248870C2E224B4A2082F28AA24C2828A7CE70D0000481820A24121822148218229A2412182F1 -:802E000021123081402244022C21D421012E9240022A099880012A08220000480028002004F0A6E5B061F2612117121D411F14FA12223F24F453311F35E125BB51652937261F39F151711F27FBD3B32F2DB752E123FB92D21F1CA5513BEF1F1AAC1829F463E33F3BF791513F35F443822B55DAF513133F39F851333F31DB33F643C11F2B39 -:802E8000F9D1D22D222BC41F38E83CDC22B862FC43811DE325B2C2B462FCC1823F26BEA22AA6C48E819FA541F121611D611551111F32FA62633F15F571733F33E731F251532F3DF443231F34F141433F37F7D3913AA637BEB22BFF3F16F771711F36FFA3832F24AC443F34FE13B31F39FFF1F11F3EFE52722F35F191911F1BFA13511F212C -:802F0000F133333F35F6F2F21F2F5F222F26F2C3231F34FCC2E22F2CFEC3C31F3CF842822F2CF8C2C2EEA33F2EFC82E22B4AEABC827CF50D1B262A260266F212223F26B452B671B2F2FBD1D22BDD1BBD2BD9DED33F17F9D131FAEB2FBBF2AFFF3F1FFDD1D11F3EFFA3E339E821E525F5B1713F1BA5455E83FEF22BDC1F11E129F891F33FDC -:802F800039FB93B33BCDBE12CAADA8CAFCA1A3CEC1CAACEC3F1CFCC1C342CAB4E2ACCC2BEEAA3A624AAECC6F6645F121612A12016E632F37F773517E622B672F1FF2D1D15E533F1DB952ADDD1F3775D3B322EA2FBBF2AEFF1BD71BFF1F1EFEE1E11B445E421F1FF463313F1FE72FFF72712BFD1BD41F39F9B3A13F1AFB81113F3BFBD36245 -:803000002F2FAFFF2BAAEE223F3CF241C3EAEE2CFCC3C3CE814AE82CFCE2E2EAAECECABEE2E42EEA1CF8DFC8000020020000800400138802A048280082282014018800000020021440010000804401A048000000CFAD01800228221A34221A24A24120084842124AA2414A024A21621400194491411AB221641D221248121CA821262261E5 -:803080001612882890616A0888A08482004A024A2A2A24F8E55AC0411B21221B21421B612F16B111B24291612F1499212F1499412B94322F14AB422F1439312D911B421CE922E414E82264152E42D6F12152D6E122A5292CB5D1E222BD91E222B191E226B191B662B1817262B281F6428119F24282112B84AAF44282222BA4222BA4AA8447 -:80310000E82AF4C4D340A16126A14126A12127161A7222A12127141AF242A11A764221F142A13A744221D312B833041B52882A49A1D286B12125C85180B59102683C91412C31812C91214632814E8219E2241AC1A2224622E224081B842312A2422D36008200001400000000000000101201000000000088002002001002000000000050B5 -:8031800012F08AAC2091112216612216E124A14219A42824F22C8884246226121682064A82A1242C022AB1418284A434A082421A041B8229288202C82398812868882182C24022882C88024AA884BF9803628212C05142149232214A01428230C11321A242112929810246817641022112114A23812BA8961220E114218261224834882A19 -:80320000A48414A02846A12439E222A4482A4C21F2F66820611D12130113E11184A4248A8295F22ABC4208881B4321283B2486A224A0431D62821D122248521B421B24A2824A28F44132202386821C22683268A6224A0128F0A242112E426A28C8412B681B1CA04220026E1348241ACA13000020B42104324A0129218103A0424AD2210446 -:80328000208121A152122A2988081C01188A724201884842824A283841A0A482A04288F04BC500001280D612A1614219044818921C313100A04A14124224904110810242238282A8242A848288422388A84880E21418018A9482802888820480083F820C421238284211481118321E811846818424B412E4132402D21C04668102382B5295 -:803300005228181200209882148AA1522AF41243193242C280A48480248822222488822862281F1A0E4880A121603630611213448185814191312B141E21A04A1C8185D421061C2462123820B522818288E42822021AD221E328E219E4142AA486C8484A088A042A0842C88088023FAA4401182880041C252124830946818C250448222077 -:803380001C018002122B1442220000284288862188844442021011014A1822088A8202228088F88A6E0068182081021081034AA22110A218882A2428341123042083860282209422C0810048120062880022002B24C8A08428A084820028422B9180A44128A024124A228282844881AA4812A0428002B0822221248128044A82A51830118D -:803400009051882A048A21860122488084824A0120046024E84A9A42F031AC1412002814004A210400000014181228008008002280028084023821282800202428044800212488000000F0C644A0143820926112682819A242821984682418922A8CA7812A641188184A8882A62428C828D22248881B14B222202BA44200C8424228482C0E -:803480000888290A484E828AA64862244FF605002A011828A041421280822108400128002A04000080820521122240022A012212886880024829984180240488002280D47A0762200220023041001820210112001828820000121888800812800E0042888800882088840400A0284A080048629FA406103111111D1212002C8223114192D8 -:803500008100A0811921120118200811001190822129022828C011121C82C821002322021429889CC221212912820488BF4F092218142A64122016419111146011C0410011301138008004228081240100000060317042032583220421482C2268224A4802004A088FD60A11424800111981A2214280010012200240A21228823023002137 -:80358000304358482A3412622901282021024288A0848828144A020000A84072A80F108191211818808564189813883881A0482088230882008822002C24292108D820A1828A611188262138412A082B482120082229889282682180C281AFFB0100200820040000122800801301168112031C210182210000C051304248484022018022EF -:8036000002C23188002004202408CF220A4A014800002100102202360224002400180080088A61142C48821132822908222822824800424003280000222006C022CE3A00222081021CA121184820180113A4488601A2A04818A22301100180014A818A28A21414988022C4322A889682800A8016A2244222422A24CA22F06B54301112484D -:803680004210213241801A0180820800800821292488018823C4418831221C24012928C1628290120021111042A2A4210000001002AF720F111B7119B141D421011F112285A6221AB891D111389117112B14A0181B81121123E9128888443121B01285E9189192CE621A22B842314286D21183EA118163142C3883211384D83358212B626F -:803700002B8A2B2C23926223A22CC641D2864D81051412366111F0224116E2148C81288328A488122BA32681EB35A88252232128428161241F1454215A84B182F912528AAA2B2232A2AE227E4215A26E6AAA8EE82142CAAA8446A2824E6222682AAC822BA2EFF9087E2114322E21281B126A95311F16B191511125C112142A8DC48114384F -:8037800086B122838323C8831A82F182428E8196B2126C2A23E126B461EA2394111AAB4C1F2191C33B882B2A31242C76A2E22CA448236228682CA48846220468C2AF8407008001214823A24121822182219A1422992292219A84A249C04280050018A082421880082909188008A048A04820080082004282F07BA7B051F371311F11F221F2 -:80380000611D312D332F23D732B262F332323F295133371A3F39F113732F29F113111F3A7223F3B3111F33A54C1F16F192C23D833F34F571712B911D111F31F1434327212B132F23FF13E3EAFE61211AF221611F14FA336115F121231F32F863432B8637122A58311F3CF262622D822F22F262422F26B22204C8682F9849F161611F12D683 -:8038800011F221211F12F222233F14E215F271212F35731351111D213F31F153115AF111133F3353333F13F331636AF56113D81F14FCE1E31F17F7129237313F39FD53433F3DFC32122F36F743D32B541F13A4811F137241F393E31F3EDD33F261633F36FE62C23F32E824FE43831F34FEC2622F28FA22A22F2EFE62622F2296C26ABC42D5 -:80390000FCB7A8B051A2733E213AE323E213B272E514E226A7FB3B998E818EB29AB9D2AC9D1F39B982FAA191BEB23F1FBBC2FAB1D18AF141C14EC21F12B342F581C11F19FDC3D32F3DFCF2F22F2BFFB3E32B661F3AFE92823F1AAA8C3F11ADC61F3EEE2EFCE161EAFAE3418AFA41C3CAA86688AAAA466E622A36E2CAAC44CFCF4FF1616179 -:803980003AA3233E313E322E2137342F15F37133DEB13F31B982C8821E912F2DB842F881811F31FB83911F33FBF3B12BB71F1B0D1D833F32FA21312F2CD513D831FD53D22F35FCB2B23F2EF7F3F32B771F3BF292823F1A7AC1F313531F3EFDA3A31F1EF661E16EE23F32EA24FC43831F36AC4EEE822AAAEE6AA6622BE64EE24AFC566C00AD -:803A0000A01200800100000000301128114220041001201402292814022B12002082E412886412200200144800284820A824F03E9380A12100221262A016800118808184010038322028244281059846812101CA52221A2202182818008A24A428B081042A84A84828200460184FF80B1CB411021B2146B2117262B311F6621319F6429305 -:803A80001B212F2439112F24A9432F3429F342B3322D913AC4B12E421CF822421E212F2265192E4296C152DAC2521B2D2CB591C2121B294E121B292F24B18132421B282F24B881F642821B482B84A22B84A22BA4222B84AA84E82A9483C0411A468166141A6216122E11284E111AE214A3214631314213E31433311CB113C4213B521CA9A1 -:803B0000C21CF221D296E12264193C65112CB591C25319C6131B614E131B294E13194283623419E23412C1A2224E82224E22A0842312A242AFDC09280000000020010000000000210080080000140000000000480000000000001002AFBB0E4A821201621CC1121212112814121842292C2421042800AA8408221120A82400A061292361A4 -:803B8000121682812482C2C180242814A28420A44280A424A800AF5A069011321991114A228424043334722B844A8891118AA182925A9851120022221229B141212621A4142120042B18224812141314222C2822E824084288A0A42908424E81F087AF20E41461121C81C4112C852155213C7621A25A4A81B542088AA3C1C26603A0A58A78 -:803C0000220814584AA2521324011E625A22E418022B414813F24122138C84A8822EC2422984842C228AA8426882213FEB0D222818E01281064800A041200813A194001218120020A221294181082014022091121A021200202804208808806424482028046F280D2621010080012280081800A21001322880028084C25280051842482804 -:803C80001C011C0114822502216846011C888428088AA4A448288A8488F46CAC1412132282B31122B521041E41181D228A8588A514583A28AA211CBC126411CA61168A24921231721CA2244A62281A28A4248E31208834221B43828E4211F022812394821C24944222408284822472D4091C6313222A812234312002198A8D0180A4381CD6 -:803D0000028E314AC31182468184B21232436AA141621A22A84968111E21118034A2139182C662144225914129A8844A18A2A42A2424A24820F264410000C0111242B011244102881AA414B88028C342001A862228042C011902484821202728211841A224108242813A824214200488904222C246F2A31300681A422111420220A42880BA -:803D8000226824802481880186828138923042222420424122A4148AA44210011E42A840A14210810A100220042C0400F727208104126280A421192202111A02180000221A021B2422128800824AA11822122E81118054120082482448902122292688289C8282826028002CFC2FD4A0420028201242020022238404D222A04142008024B7 -:803E00002234310030414200C01220A1810000888004800480026022208404EF530F4A23021CE1226422602328482AC82242425823858601481A22681762224839812288B4C12226B182C4419829D21201602C6224198834612848C224C602828226228C042CF84F9420082A818201460214281081210882004A290321602888A024002980 -:803E8000210120228104309120810842281091828008A820040042482F964B210122144A01108121021A04004A4201C02113352100485220661C2002122823042800282CA524484268868204246248424A8822C8824828B0F20C68288004280028886288A081219880882108882986081458142081210A1A8821981182488A0482308200D6 -:803F0000112B82000010022880083B64200A0010A11442282112480018112302004810A114421602241848222CA424481111106111008022582248000082202448020048EFF40812802402001A2294412982C2121C231422011412882011420114182432206118282C8294424842282942020080080010020042002AF8C9F30000002814B0 -:803F8000221601421A820119A148B0810122288E1140814801880082222412008022882C2101222A081111803242004828886024147FE14601A042A0340020C4821928A8828A820488A0811100288800C0412AA4841188009AA4282A212912218C2A0C4820040028C60290820088F045B210A11410418124060000002112008008220020B0 -:80400000A4940000102208188004004280044602004800282220221C022F5E0B488A120122194191511439621100112E8123220380A1181A8498410080E2219A2148421EC2132422226811107122022227229082243C0C25022942420221008AE6870382114838208403200400290214211C0120022901188068212008C021243051212A03 -:804080002401801102880080028224200842A821F0A1D3A044822A8282A326185AC37246A2A3121E8225B243E41304805811FA52118004481B41171820A2221E42F83E412E111CB5326411A04223A24429A224422435A1882024E4246426282B882A9A421CA2229F6A03121B2A1031611D411B671D41623B6239A5922AD111E811F942A293 -:804100002AFA119118BA18A1911BB31D111BC419A1143A7753325286217A3292125622299811CA7581A259828E4229243242C8119062242938826226B24224C8828AFCB18B141B3252143E411A2441217211E1186814CA069AC1221B183B1182138183AD6A46A28C60152146A2FA1BF84AA1A4C2CEA22B681F26CA31AAEA11E214EA24F217 -:8041800032B262AE822F28AEC846F242232426B2A28C82F4828220A8868A6424A782001880A1482A09800482204922482149214921412149318214181C82611488800188138419A1824888488800482200008002288022089FB54BA14C13F411111D41284A12E111A7776E223B4C2A24BA82F1422237181951111F1851111F1CF5E1411F60 -:8042000017F591433D423F34F513423F36FC81433BC81D411BE22BEE2D633F31F713D146D313C8611F347862B2722AA4E6EE22EAFAE1A11F3E5C222B646E828AACE62BEE242EA2884AF442C24723144819F4111115A1951BB51B655E711B376E213B666AA731F053511F32F633111711167111E138F563614E513D533F34F4C3C33F35F525 -:8042800063C32F39B263DA11F421612BEB1E711F21F253111F317513D1117241F332122B262D222B444E622BAE3F3AFAC3C325B242E62EBCC29CC22BEE2F28EA26BE42ACC48EA2FBAEA0541B711D213AA2715E311B651F15A7731F2EBAD3A5DF8AF281111F2CF8B121AAF981818E111F1AEA1FFDE361FEF11F18A5CC1F14AC451F36F5A221 -:80430000432B591B886EC17AFFC2E23F29FF13D18ED23D91BEB11F34F8E2827EA22B8C6AFEE2E2CE823F1CF8C1E325A2442F26EC28ACEE2BEE242BE22BC2EAA6E4DFB847F1C1711B31157111F171511F17B351F251611F22F2E1833BFFEAAF991F19B9D1FDB1E33B9B1F19A9991F19A8513F1DED2CFD81C11BCC1F14BC51F5E1532F2BB68D -:8043800072B591A9DF7AB853E529FFD3D19EB33F1BFAB1B11F3EFEB2D22BFF2F2ABEE2FEE2E22BC43D423F3C5C226AF4E2C22F2CBCA2BCE2FEA2A22BA22BC6EACEA2EF910D2A01220060121A641240010034802201124A0228200400004222200222800100260200248200248A442208200400EF690B001420A2484240822482C4121280FA -:8044000084012028044A01005222122BC2E02224842DD122040042B04201224829A84834002004002928088E41BF280E481B21B01122B611364219B24291612B961B212F2419B142B931F4429113F3429113D312B931E414F921421CF8214216F12152DE212E5296C1429AC2521B2D2D431B292D131B2946B19136421B682394212B841997 -:80448000B64218B14228B242AA422B84A229A84A4AE822F48E7AC0411B6148282691612394212B1419366213F142321982B131F4421113F3421113D312B933D412F12152143BD216D123ED19F22152C0439E21581B212D411B612D1319443111211932421992821992A2112BA4B04208292898822B484223FA9C43008200100400000000FC -:8045000000100100400180081008000000000000000080024002000021F097FC6041281487224CA1242641813281181AE4212401421A94899081433421B0218418B921B161C14238522332329052102222FA825146E246D8282264282C941120042149428824684C2228F057F1344286624286814231942A31112827248180748122B821A4 -:80458000A8411D58389321A429881C3622C4D04A012D214B41C24C42E144C2118AC111282689611413A216A826A2849D8216E4A42A0487482C034A49A1482FED483146E23D243CC2141422132133812F24B14821961219B842B8B17448B14161181F214421E31946639A16C9512D5432281F24820D4243765281C2913B1E66A185942B242B -:804600004A2338212A788803ADE2261438849E226CA88380F8BB118001C08822684F18814281028081040092813285A44288A0A4C02422812562156981722432110098284038266814822726122384C4142004830442482848CFD7062200844D1230228C24A46134007042830448818A442109228304004229AC25988B2588284192249295 -:804680002D12822AC828219AA4829AC48112C048219221802288A848C7EB304526319436352393F74493137121D63888AA87922F182421E231F22882F820A8248B611C58624859B562912532312B42244346A378902228A28D631D121BC16E8183829421F08841482AE82298684E2CDA228CA74222AFAA03541182744541A14B48284E9850 -:804700001C2225384246213621288B584A28889D28D0260449A4426634122D229A8634A4B09284C1228AB292D23822FA2148A6A12542141188002662828306AA8488A886BFAB0F4A8232148CE322B118561627914D43199282238A61182D12C012833C22402122E512482864112941A12C1E41D0282394214922182241A248172198293440 -:80478000882AA8E1828D51488F222CE82C41A4B4A0434A02CFD84A838434182712C4216012C4E3B248924C8D32898971148222C514222B124004124E8829110843F221D86624FA52292AF142164964C1ACC32441B04C624C2C84E4C4E281C2188D84B0C2812112CC684C4198284F7F0581582818428C9524214A8284782482524144826096 -:8048000088824281841225BE18C88481241F881408128351144289A8421B288054120028C18624A12C82200885A61C2212A22BC1884F55091222402442841114422201822C0428490C004CA884A04241A0421A64411221844002002440B888232A2121932800481A14D8840280018120F4CD15241AA41284696284C9E1427124D142D428A9 -:8048800026FA482289D8C2751294344BC289989490264244269E884D482D381AF4C9148D243BE1CCA582652235C243D268E18162C22982DA8493248746ABA489C1C88B588E4C8C387A4129CE382883AA582AFCD21F00A0121371248244028722448B148031812018A241A0428969882981440442A480112832182E58284D12E0120823745F -:80490000910C484A2901681880014C688118418B14431148FA3B9C304115241276410213142114A92119688291439122478C00E0823C4249C482260C2C2485414C28AA41ACC18A2682031EA84C928AA094274523C4888AD18238424B4127882A15F88218298B982442E02C0123810600918144844421212100178118004F84013A8848C8B3 -:80498000821A0810019018148A849414248A01212828101845014941C18143524842220048618B4A1FBD451184011C52284904282981420492882D84461291CC1B1630218113312411623322822884841224D214A1C23C08A591281484142A58281018F44412844622A242203812188E22F0926F2002C14820128241044A288284628423DF -:804A000008269288D0828158424818814A1189041999428A428142018902121223648380021C22840A881068842082A84141FF41013B481C9121411124176414522639221CB48174421588C19429314227148AA1411848282B14248AE5816244C181128C4D4214048263B414F848144D22849A02252252824D48250C2D16418084021CF424 -:804A80001B488001404808224694238817218C428431418C022604C1206224144C0D1048A4188001002C04D829C68A4A82123214424A820D280080A8281880048A723907101202235281200223041E84182008221416A48129449122C0183011444081918442414383811304008848504211801151121244C01240441404EFBE4F01847068 -:804B00002188263424292422384818211A3C124D828984858A0A41C0282189322228843220C4A8261422889C28428248142058188A33688CD884082C84A82144282B4B898821F168622082924D2121494228514963D44108112932214828A18514420227AA16A414448908337C81B8A1145414218284C04149611124437982E81482185292 -:804B80004246A12132384E182908854484912A85F4F9C1D032A22910DA98D688F2656729713B64881D848F29EA89F71418176439E44ABF26AD68AE112DC82B154F48313A83A2122F1334325F866D885E75C84B113F21EBC3B92466638FA82872567212A4232FC7E2B1F229D21F18E18CDD28AC417FADE246FD1C444B5A85E2A328FD44C8CF -:804C000087178BC63FB94FB271C14ADCF26126334653884F4546AB24AF37B422F14483257282F15CBAB7A487547FA1B95A38514BA21F256AD83FECF8524A1B34C512B8657D8172ECAC2E26FCC623DAD112F122248FDCD758E21CFC8C5B8F18F4EC1467886EAA83E346F187858167812F22D888E28A39824D848E142C13F48D21144CF4257A -:804C800011D7224549F267442117324B74FF72BC84734111F3C1C1CF812F3A141E2A87464D4E8F2AF388418B424F249664C95A28CE79967118D588A8318DC4CB4CD063A8AC1E112F21E88AE9A2F342842C99C24E25212D2367998FA4C1558F28E284F352826F4196342B723AF284449E2E7FB40E4200204802241A0420A2414482549214D3 -:804D000012141287541246015418422C014D1280212412B1241181598149D181140400004400400481B04802422FCE0A5F69F1561EBFB1F12E6A7FE4748E7E49FA66267F77F18486DF96F418989F73F54D423F38F2C7121F2C7C24F6B5871F3AF8A1734B2A1F99FD15AD1F18F8E4147F52D5F7D813F16123BFF6F4CF4E4D44A7E81F58AA23 -:804D8000AADEB54F73F9B5673F86F472353CF2D3B69E213F31F3F3F23F35F9399DFD8D9FD5FE6EECCFECBCFEBBB2D166F28E9CC88F82F828683FCA43F15565CFE3F71B3BED2DF7F4C7F69FD6E642F26D274F6EF2E761AFA7F7DBB3CF64F841CB57641F2FFBC7975F78E922B3AAF7AF751F92D4E4FF82C24F42FC37477FF1F487D51F137E8B -:804E000075F585474F43F69E7FBF99FA81236F78F7149F3F3BF363EA6F7FDEB8F4FFB4DE951F37FB69E7BF17F7D9F7FFFDFCD5866F6AFEE4E66F4FEE8BFB2CAE8FE4B8A2FE88C8AF83FEA1B7F035266F7155FFEFA2F26F2E8D2AD7E44F72F257177D469FD7F55BDABFB1734CFAC7436F3EF76E8ADFF8F9BEDAEF67F422F87F96F294F8CF05 -:804E8000AEFB26E2DF74BC12775EFC91533F5EF6E9CCCFF6F694FC2FEEE8EAFAE1872F69FD3D1EFFEBFA5A5DAF4DF3E9AEBF4EEB1CF65F773F77FF52B18F95FBCF8DDFDDFD6ECC4F6CBDF6FBB438ED2E6DC4AF8AFEE8888BFE1F174AF1D1618F23D3F7D2FEF26FAF8FB6FA694D4CF145376F2EFED3D5AFAFFFCB9BEFECF8C7D74F77F7740A -:804F00009EEFECF98F9F5F7BFB2AF8CFC6F7B5FDDFBEDE2AFE2D472F23F45F4D5F7BFF37ED5FFEF8A6E34FC1FE57FE7FF8FAC6266F69F31D1EBFABFB4EEFEF6DF6DDDEFF4EFBC4D55F73FB61E32F16F7D4D37F79F9D5972FEAFCE4C66F4FFFB4BCCFE2EA44FCAEE88FA8BD2CFF5B1A80011884403824200226E288048C04482882004C2281 -:804F80009828C0242128C02498280049080021840088001E486081148A04406481000000D79F90521E2467228485C2E4241E44E0C8148AE2244188E98914C248AD3648982E484A213A4824838441C148DE21848F4482A1282985E2226949E08136489AB22C2828849288114CE18B6444802ACA144B4A85C449AF6B093CF4112487221F4101 -:805000007248F31124A7341FC1B24AD141F66A921B21AB945B48AB9453FB4A9153F342915783AF14F935484E915FA2C4815FA264154FA265192E5AD6C55ADE242E5A1F49E232FC91248F32F191248F34F9912CAF14F1816CAF36D941B24AB981F24A9251AF64B924B44AB9A4F442924F82F44AB14F82A4B44FAAF4F8CCC04B1E648F32646B -:805080004187341E2446E3C17248C164AF76A9218F54BA84D61AB1B5344A53B3427835988A7381FAA51A881FA28DF8241A86E1A26518BCE158E2A2E1C9E2B2AC488F32C1644E938E284E138E288F3659418F74B981F2483659F2489643F24892A24E1347824ABB16B442FAA4181FC70B84820021000000440000001618010000000000408E -:80510000010000000000200100008800001002FFAD0C10C12424AC44032548082B24228214C4864886F811442F81929AC6C85C42472840A2121E86D6724884672186E212E121A638D12922911CA3C1841E22AC2824043082128B48890C89AA818743C8287B7AB044E22A0100621E4C4712237127E888B18864852788271C1E468B1C1CB50C -:805180002AC88446848368C8A96422121724288CC2822CE842CC582C180182CF21C84DA81C42E2D438248F112A7888F14A848394CC324B218B87418142144CFC129780E69C03248CF42241167C2E532841CB82223A4C714EF11884A7644622DA4A6BE8624B581EC4AC280A2B612F6AE128B388A42D4F216A38871AA01486391A4D18899B4A -:805200003A88C72149B884853428A72CF08814B88F43A8698742869854482F42F4DCEC10046302002304181D282B148E4885628888489813F94815B042618981A446442211018C445422428C25F122538A12E4487242414441F462818C722A21C881418B8448838414288861828882AFDE0E2302C028659121904180429261808401888A6D -:8052800094A88028891284924680241422412288052E1200822C0942306A2888406288002981142898A2A0244B4AB5075B1459A112123A744262D5221F83B458984916682993F982432CB615628112A72E4D188B2452837CC148C251C189E12932688CA342A6C2538819D8A2A212485B5827E31BC1241AAC12AD8288122C38C82E8A9E2255 -:80530000A22322A47889086F540A1144221AC27242CC64164AE1834C9132188968152149298431C2A1324A81E4142A34124D488381A216A4483A68312C1291229A827C51F44A242F18B448A2922888212D18248B4886F82282222998C2124E2841DF3E46B2346411188425653213018D21904817842C7851828836238999A826B814688CE1 -:80538000284D888512C4412074921228A3284229A4818885022C8128811132428A112A2828082B214A918828226A28A8C2AF5B4A61122D58446041430114274243A448419084182D2249843482422E5244C0B484298C9242C5E223844165848D446212582682426828A218298868484A82A2144D882252304CA0852012F2AB9D24858414B3 -:805400009B1427148922312419C1228473824218048C18F82448A124221D488991822AE88491288285A4428D2141214446C24896C99827474064461E48C18514881224843884528AF1E81649F2229C81CCB277091828122521622484218420012B1858A9E4484102126C51844812424914082400808421921219684244008301842023049D -:805480002DD8813012100A40882481E4684A7234A312A7117931616E1E897122F3211C48D8158261C14D484B828F44582AB6EAE13448681961684E8826E82164842D82CB612332284568846B415E8349C221293B6A83B982E261A4812E88C287248B14497584A2834325951C4F81E88AB48825F148224738001004690140044C522A2888DE -:805500008AD4222111826444C0344183E482449442892252482095445263820212C949981410C4288364418128888483042C48A8842AD44231248952147FC205648E2481A41426424404184BA1248219C48128926228001800822951844684812282210680D642C182448E244B41412B124B2182284828641098148662422344140C42EBAE -:805580003214107814210123041B2430C1812B8424C170414404411D1C858444781DC218002C6224112C1521C814291502400285F2182182008498142B81100420A41822D8221AF886B440B491042842416430148A0100524911082D1C2741368228A28142682A011886823482224423A428448280CA4880512442492825924280018388CF -:805600008231248821D016F8924FA042001502338402818123A21289C582C082008C0818818422182C64818800422418A2C0211008288242E0186221288818884830420086822182015E3B004189911215982419041961128901286021124E2844528AA4214B28188A02C84A139124194C861882848288B82258341889C18136032581E860 -:8056800084625494124CC198219820224428F462351041C1648922062158224924E44884C821E0622421048421584B2448C124888984248241881C084884488242233224237454084A11423852260C218A244452488262F0775C002D221144128140025014224284219084A6C122418C440900100120014941684148AC9124188914216449 -:80570000844508461C6161407482412804F0522C48124444C5084A622C904118119441002928911441888908128229240C8281294C28C4312F81081C28E6A231818818830110119182C215922831B110F821424820160284848641FAD71C40288104888388D292B34102114425887B440A288C18A88280382649B824218218742134882188 -:80578000824581C2144788422D692B12908400824A114824A9244412244011A1C126B41A049EFB3024A6D114F12826137C43B42522C1241E849AA998878A9D92874D9DB4414FA2B214F254BC4698F48B424D2A8D686825F99468211F8AB2427382A1316F8A22A6581227892334528AF4982C4E24A74C8D844AE482F91CF21EC2DF4448B211 -:8058000012ADCA3F25C358CB13A9F338B3CAF8A6C2A0247F88D22BF211581CD7BC5C386F467611A16C4D2C4E625E16474C6D124B46ABB1AF5CF1889AB5B222312816E84E243E928F43E516F1641427141E461E16256455216B26CD3C8B829F4BB224EA41FB21D31B123EB21F2816A36C31FB18484D18A44E22486F18F282884FC85C144954 -:80588000B5C24ED161E46565C114A7212A7242D491F162189D13B7363229EC91C48127A8E6A4C166A44A8F496C9D4F489B996D846E1A4215F698E31EC28E812EE8CFAE8CED49FF11862F2CC8234D821D49F7A463F49EC25D416F85F138BBB7214661C42F33F31844874C214CE867E84426E78444FEAFD7000041848044C248A04800148C63 -:8059000044E18844814401544001850581118314012A3848611122400126011484262148E188446188004482810082F0BF6B246D423F9453A43D424F45F46D6C8F22F62C3A1A45F28EDA2E82AFECF88F9E6F48F63C355F31D977D157E11AFA8B9D9F9AFAB59527313F38F4871D4F46E6827E85F4E4EF9AFEC8D847414FA4F4A7A33F187880 -:80598000455CB8CFCB7F88768AF23B68CFC8BA1819F44C4A1E589F6FD526F1DE726F65B1D4FD1838BF81F135162F27F918389E1867553F3F4AF323633F14F32E3F7F67F276645F46F62A229FA2A111576BEFA9E922F1EABAFFE9F996944F5BF3953D4F42FBA4B6BEB3BFF7FBBAB8FADD72F9E367FFD6FE746C5E7E6F69FDB4BE2BFD9FBEC4 -:805A0000FFD4FE6FA6F8FEBE6F6BFAB5FC8FB1F1BEBC8F7FB3FAFF1838EF8BFABAA3CF62F6284F7E528F41F34C12EF35F55E164F2DF9583AAFB5F1F6E72FA5DD8AA7316F61F181641457747F5357616F72F3746D8F96F26C67FFC2F2484AA5FACAFEAFA9F2DAF8FFE8FDDB5DD742EF75FDCE2E6F4CB4D1F98AD9EFC2FF84941D162FBCF897 -:805A800064EA7F17F7787B7F7BFBCCEF1F39FEDCDD4F4BF2DC4A4FEBEF2BFE91F4CFF8F895B79F4EFAD9359F8FFECDAFBF87FB47A7BFCCFE39399FADDF37F1DFDA6F6DFDD4946BB36B8EEFE5B112F93E3C4FCDFD8416AFD9071F34F43373FFF3F337377FD5F4616BBF36F67B5A2F25F5F747AFE7F7FAEAAF8DFF979EFFDDFDFFFCEFFDFFD3 -:805B00006FEB6F6FFDF9F2AF9FFFEFD14F2CDDE1F8CAEFCFA6F67F699FB5F5B7F7DFFCFED3F3AFBFF79EBEEFA7F9F47E5F7FFEB934CFFAF29FBFBFFFFBFBBF3F15F7EFADBF9EFEEFEFBFBDFEEBFBDF9DFDCF89BFBDFDDEDE4F4CB9F6BBE6F87EBEEF87FFFCFCFAFFC4D53F3B0414F0221184144814822260228480041228400489022882E0 -:805B80001022148292124A9214302210042A094D824062812061228C440200241224828B246044F01AD8A0481E242A014B1248A3524170810C9098825C38142928D26258844CCA484A78246844A0244146F125828A02DA02522D8250281189B18124B281041914B2112434144E1390184829A34120923841AFF1032CF4112485F211248371 -:805C0000F41124A3D641B24AF1912CAB9419B24A3985AF1439A4AF14B924F442934F82D412F924484E914FA2C4814FA264114FA2641D2E4A87592E4ADE242ECA1F49D222F4912485F2912483F49124A3F68124AB941F48B24A9921AB9459F44A9243B24A39A4AB94478229F92448984FA2B4160A2CF4116CC5B211366A1741A7261F41F4FD -:805C800042121FC9F648941B68AF64B394724AF1A448AD9247832C783498826F83B442F9245A4AE922C8844F22651D2E4296E532E445A2829E282D429E4C8D421B29837481B46AB181B24219F14A141B282F44BB85F442B222AB9422AB142229F9A64829F9245A7FB80A00480000000044000000000080824104000088140084000000222A -:805D0000004004001002000014F04F682426341114199211562A1263412CC41829062412263818C04C41184D114A8834644944C8212626D6182CF88222C022202122427498A2828F24A2411302528C295828E04A312C23BC9A1228B228019BAE00828C721408274A895848F08221CA52A148CD11144C012741323C2128741114748258217A -:805D800076D2283458842921B648C1186381F58226301227144B424215C4886D983F8592281944D812C422482D51911C24B218C48587424F170E2142267928C4114D3A89524B2C9121EB28253162C72119F1281484169424122F28E114C151416F88F6C11283C1286D32421EC91F2C62AB84E12D42CE1C242823943C8866B45AF82C13CF6C -:805E000016C1786A91883538226B4B8F42714B82C3226AF118A11E24EF280A4332113011248A8408418AA4148C0611002C018B145110C4844810A424393448260A2084A1211828232251148A346215482208D018084240C241881F8814484844D88B0800411A52124C240222824A211108004A032C11848104801806705804284B42424B79 -:805E8000120020424482961448A0414A8884088812182E48894288480870B90DE041C218444C7121B81634211A346B2B2866A11437898E54C6458494618B43A74A8AE2813248A3022F8284849848C1988628BC22684213C11486A2A5912A38282AF4882123C2A2169888259848448A21213D641A982882AFC207C02416C83645A1246A81EB -:805F000082E424A8A4163118A71918131804122B1249822631481094424243688483A221842AA52810C1148223B848E2412A86F448824888A1908A4E18E08D32384638E48A6182F0D1C400124480411F14E121C229182A2404493C4472421B4247A48B81828302AF280283028305414B48C86C0843222142E425420184221B12A84AA218DB -:805F80008308301400984008824F554552214C5618704AB22491442025C9214F82B1184218612224132542F384428B140052892885C6824381521492181E44881A5429A840488212A14126C4214A21C2588A0482FB41812A0846022F6A098B421A644116082428850489C41841A8984D182991942CD228484422028B52C42A18584219236E -:80600000A484946889CA2389466246182684A121182608CC28849A5824224C2A041A2634128CA128DFCE4A8101C0244C4228018100004248894811044A618286A4244128130483914284006400188041213184255884800886088820018932814445A84228426FD246B151721264D189D362D284F342244189E58824922883E184D824745E -:8060800028D2416957A36A54CB4AAE5C22498266161AD428915127448A56485ABA82B265B182071D282B831AE221E881B21462824A896888128B5887259A92842A9C868D446AA8428C22FC834C108202448304188420D118218128D11821490224122120C448854418B826A4288C0140C4180012691111444C4248018392614A0880844289 -:80610000B848215348124A21F2D1A82044A2218011CC144466A414C0184318D42C11B484041E2481AA84323C24446130284028DA850284482068888A0228D084110428888E381E440084202A8648C84C46F83DE540B41404504890280089280112422008608410018863944150818868241944022CA2282889C226818452202202882890EA -:80618000881881418B829088224800CF2C012400124AA2254A622285E468B1488293684681A42883A34222431AE448018488A100842841A01800001302284C04C018228C03488A01212A21C138E0418282A51297C44001812F420470162104285C684410884802001582518111132242C28C1592114150421C9211503641184111241609E7 -:8062000011411C244414382C644C480488C0848988F818E9E048054C031AC428004024880217484A9A111282C9992442223889B888044218A016C2A08683288422082038188004C88400A08482A04842001290422F330E5022C0184400812391482184874112818924342C42422688240461588848688181E88016C848C084414608428971 -:80628000219638808181044E1CC284184E142084037F52021004212440120400861401504200142901503428185414401191248414444488450260415042400480184104000089028441C14FC80680514810324425386289841228283418164131281EC8308849112CCC44289412C183411108460422592852819081CCF22118269411CC00 -:80630000B9C1A142578880A124844C87085849212872CE0684C04126DC3802428114A024468488028722880017211D8819181291111A98C2191214C61188943524C818C0428A020048814240848442CA922A01841888A82D2288CF2B0F4664288C3358CB12EB54846485656997498B895F49CDC9186F2CB11889ECC2F1DE169FC9DF11F1E2 -:80638000345185F46184E381541946E182E288F42C85AEE479E26E8469289E888E288B894D56A14FC6941C8F44BCA985B81111D82CB124E881A95D8B2222824F878544F88E9930144D4487224CF2424526FC4D44282B162EC8212E684A32488FE62462421E284E411DA8F02CEC972C7F86C64A8E4D63E581F6134C6F51F417A28A14F21845 -:806400004829F8A4642D84CD264CE844A227174783F161249E2846A84C8DA45AA88287ACE746C18AF848484B978E84CF82B2C4F2D43ED021B4127116F526181E2A2CF23232EF86D484B44CE386AE1485F815149E819DAD2F8C36ECCBA126716621C8A43CF886211D1295B924B828137968C5288B14A6952815F12428171263529185C8194D -:806480003816B924E111AA324F9CF4845C56F812548AE2C2EA85B1948B9228DE96ABD25D35100111108111011904112008402148010042A024204422442244225524524D8213051301191494419041904120488104489041440040F4381F242D422FB451BABF9154CFD5FB4D45DF51D1CDF26DA5DF9C38489FDB551DDFCD7E2FF7DFD88F85 -:8065000044F8C9DFFFF8F987578F12D891EC32F483834F58F11D5FBFF37927F7452C1F38F4B6166FEBDD44F215E32D122FBDF38B899FB2F41E1445D7D7F241114F41F148B1DF95F169881FDED811F999B9AFA6F92A18CFC4F19C148F14F3CC1CCFC6FD1818EFD27E7B4BD353E471752EFF3F3DFFE4F42C5ECFC4F11D35DD6CCF86F2C88C5F -:806580009F92F89838DF98F9CDD6EF6EF6CEC98FC8FA8D9FFFFCFCA791BF93F3C1C93F3BFDE383FD9DDFF1F12B2F75DFF5F2A789CFF9F9B29A4F6BFB9FA91F12F3D5748F89F339FBFFD8F83172AD38DF51F11935DF41FBD89C8F96EEC4FE81D99FB8F92ABAAF89F93C1CCFC1F128398F87F17AD88B9BEFE7F7C147343F34F41256BF81F3CA -:806600001B2CEFD5741C7E5EFC5D1ECF54F27CA6AF4D3C189F9DFF8585DFCDFC6E46EF4FFD59B58FECFDC7DFFF58F52FC15F93FDEDFBFFF8DEFFFC1B591FD1F51754FFD7F7955DCF9AF6B6FCEFC9FF25EC1F3BF6B272AF2151ABFF77F37E266FC5B261F34515CFC6E346F769A89F9CF21C94CFEDFD7A1AAB178F86F2FCF58F85F9D4D4AF6F -:80668000C6F618588D5A4FEF4FF252561E16FF43F13F3C6FF7F53E1EFF95F17D34CFD4F6FCBEBF9FFD39998F8DFDDDDDDFEDFDFF7DCFC7F799BDCFECFDDFCDDFCFFF79795FBFFFE9DB3F3EFC5F4FFFD5F5696DFFD3F76F6D5FB7F54EE86FCEFEEEEC4FBEBEF6B6A4F6A923AFF7F34E4EEFE7F74F7DCF57F77C7CCFC7FFF1F18F96FE5C5863 -:80670000CFC9F9D8DA6FA6FBDAD88F8FFFFCFC8F86FBF4F48F87FFF8FA8F9677A5021810026342480224200200244828822C12C124111051480011002822800841804818024B12100440088A040040040000BF16058244C3022A81A41A48418AA6828A84A1414E81924A12A41492884398382A841821118452858188810088502482418C17 -:8067800012022286044898822486C82482608842478A4243F84D2FC0421F4152281F4132481F41B24AD141B26AD141B64AB981B24A19F54A9143FA4A914B422F1479A4D812F9A4484E914FA2C4A14FA264116FA264192FA264592D5A9E242D5A1F49D222FD9124AD121F49B24CF19124A3F4812CAB141D24AB941B68AB9451AB9443B24AB2 -:8068000039242B94478229F92448984FA2F42DC7C04B1F41D638F5112487341D244E111D2827161FC87442F581282F54DB84F24294A698924F82949A4B4AAF14B1A6F442914F82E114FA22DA8F14F82642C6F1224AD6D5B2E54DF2225A5E282FA2ED49F62A529E248B149A36429E6C23E4C1F62A848AF642B41F81B24AB834B442F834485B -:806880002BA43E4829FA3648884F22F5DC4D400800000040284104001188000010021800214100401104A400000000820021000000004081F42C4300274226465982265828181904AA51821B184187141963861B2188A638C841C022224922B444E1E6688868A901ABA142A6C1242711168141E8128124A3421CC242144812A9034B12CCAD -:80690000B12AC4246A813444EFC60C63E418114934454B411E64681E222846C16289A4582054614B84661822E1122419044678221628A142167864822A0427441A382883924B2B1286F428818D85962828EA8844FC4284C28C2828081E888718471A8AF2D9FA60442B142C427E49C42CCD62181907499B223BC31E848D414E21D972A2C563 -:80698000882AE8899464126312E2EC91644F84F11482C28C7459E2223828481F44F8C42A1B121839941A53E2149A248B24436A261F8A944C1EC2EE188C88328883D62483F6C4213E448FA801211D24C511011A8481468262148C14880412421AE42442081188802202218B2426A8216302D8302212811D2889818249D8182949210850426A -:806A00000043C9169088178920F8E21C10022602294164124C04448182428285818412C1841038940089722122840115182822C44228488298100240182461168AA284008420C1A482206944F0A6A540C424124B1249761832189068822F196296A48D5243AC817487214E2ACB851F49A42417882249C4483829F64B224BA15287218332F4 -:806A8000ACB0A4412192881AB28E34C6B84691C821121698185B484A18DA288A61434F8A24846ACEFFB8042120C1244B21A01246A42490826E81F04892198419D51A61C449ED4438A49C28826696211AB42AF48618481618FA8C6228C2149840328C488B124289B941A2281A941819AC84818929B214D848A294824D686FD90A4143C222EE -:806B00001823741854831038848F1211784802C9882402295A82168905100C78294231218321A224004B1282228398324662488815241482618810440A2CE24881A2843064824FD24471288414142812742AD41654428991A4128A618229C41423642344488B422092528AC48812121B164C041490221410B24142A4241CC288229C8831E7 -:806B8000282245A21200681828228908478261AF2803482D4C251162448A21A118814245014266512422165485896381888302AD11804804442225C1494C44C8128160251D281229014400421249286214221614084931442A1102AF280680E1821164A1830E83AA21282C01848218828430818021A11450222E448C64642011C824228A2D -:806C000061424324938450488422160887641111201C9E8A8C184428842204821FBA4CC16612CF111278447A78F418248B21168C6628188B141C98562E965668224B1846E888B328A121873448A94668612A9124A5C14C4A628326954623D2244B5848948C9A149378143A6812882F2C7144382A3E8860822AE58CA2434782416F190A8264 -:806C8000442542A41250221D442362812E1180C84824407415D818222104428018644548468505224429280112141D246E121A028C024814190240216844478110440420D8C24582022911088CD482D281658183041E48A8C72589042968A4814B412A541822304142268801148544841888489434C081702194184C68849A822248A8811F -:806D0000418E288002414B5847895886F43E4F004902441004284611140200884A1204142A88A84284003200203222560882200C127084828402860184C04324008028E424084843A242EF79054B1889542828858403C1219932188C721A442821D118442821243111121601804198121178801181018091144684110418841880C1541638 -:806D80009884188118C2802194823B612424122021022004424001140044425028844440981424159866118C4449C424C6C2263041950400481D22824C01895241304485124414082002818F1305A0612B12892424A214000050184249E18A0444C08841689022203442204404288B1622282604282688E2422182337128228AC38888A0AE -:806E000052284CC9641A220A40F1C6D720024C8402CE1823022F2106948A1482B8420227281410F44231848902132482FA482285E42401420046E8882442A881C88C049C14B84448082C14E8820489818201462C782824F41F2B0021190427118814124412604160115041521A52411301411144228615A41818811118144D1890111800B5 -:806E80008C41E1845122400224182440824802A5024302847FFC0F1282701222031841244C32422882308481850223018748184181001C44D4144494442618A4422C1111048128846449041588085049A2464444C8844C3128C0884CF24241D081048B4241C918148872280438544E11A881193121A04211002D12A012112C08260800C620 -:806F0000016DC18C024C144501148A5124C0128D15A024181824182221188C9412F0344A24228B282B32C9B264D1883A711E2A4D586B264AE186BAC8C841CF867145B28C7C4649D164D88822C428614354252D228D28354984F4481484174653B1E28254484958748F15D484D41AF944425F81F228888C91D487A9E18C91944D186E88CCE0 -:806F8000F154B883E1162AF26BBAA011234F62A7174847472D18667432453E2893912287E92B488F91D65232288B249F95F2C2D44D247C61121B622E2148E6D24CF65422BF5682E6497488F8C86615E4429334848B6C15F828178E261F18324880724812A5C24F6648F228244D444B89A3EA8418FC4C8C9F17032D674D5297C12D14AF818F -:80700000C25289D21CF548228D5137813CF515191B941E842AF9411A2CB517A15847139F9335388D1814CAF56D196F41A5159D494D1847834BB61EE22B924F117C147111F899353AF824345AB275F41A98AE942F21B3B97813F942D45E3C8B69A7439AF812322F26C4444F4AE7E1A5684B3B30414111B081449241241145824482440264A6 -:8070800012244824130813410444211082121208D012081480082140012048210882200882810082F01CEF3467765F57F31C1CDFF17619D9B1782EFC242FE7D4EF86F239391E2AAFCB7D18FAD331DF65F2CA896FC6F215759F23F27BF89FC6B714F3162CE01EB751F611A73F1151A17751CB234F4FEF1EFA34B529F415399F52F211118DFF -:80710000A17F15F363722F53FB989BF7D16F23F333312FA37117FFDE766F45F5981A2F81F952528FA6F9EEAA4B675E18CFC7F637D7343E233F9FF31D3FAF81F31C38DFB3F73F2DCFF3F76E2DDFF3F33E3C8FA9FF9ABCCF21F9DFD98FBDFADA89CFE3B312F33816EFCBFD6A7C4F83F3263C17121F12FE757FFFF1F317119FB3F33F7DDFD3B6 -:80718000F7BCFC8FBBF3BE3C2F49F565619F12F2BDF58FDDFB5735BFA7F7A3B5BFB9F9FF7DAFE3B3AAF35A3EFFF5F15A7E6B548FA1F12A3C2F67F57632EFA7F7F6784FC7F76E5C8F7D46F267466F43761FFD3C2E8FE5FE3E3EBFB7F42E3EFFC6D76EF27B7FAFABF8DAFAB7F5BFFDF1FFBEEF9EFC2E2E7FF5F7BB2A3F97FF67745D31DD3DE8 -:807200001D412EE32FA5F67A2E37F23D2E3FB5F21E294F4FFBC8AA3F95EB14F614748FC3F215158F62FA1137DD3E3F15EB7FFF3B35AFE9FB1B313FA9FB17D7EF69F97E76AFABFB36BC6F2FFD3A9EEF8FFB76548B9DCFC4B17B4BF27556FF5BF63C36EFE3F34B6FFFF7FF7A4AEFE7F76F7CDD2FAFE7F7FBCAEFADFD5F8FFFFDFDFEFBEF9F2F -:80728000FD2C2E3FB5F7FE6EFFDFFF6D7DDFB1F32C2C5F52F425656FD5F67E6EFFF3F13B7FFFF7F65E6D4F4DFBED2E7FC9EB5EFE35659F93F2BD3D8FEEF67177DFE6F7D7B7AFFDFDFBFDAFABBB9BFBDFD8FF75FDFA9EEFAFFF9E9EEFC3FBFEDAEFE7FFFEB84F4FFDF8FA4FCE5EF55012400165011460124814821400822848816044401419 -:8073000081120121444181100810042210044148140040020044408654485048F0A5F7004423426822848D124485534126425828C0864043C823C0841B4181004881902831286924C88213A84211418E28428C521217896280618142C01416081228001260128D67D026F41124A5F2112487241F41724AD241F24E131D24AF349921AF24DC -:807380003985AF24B925F44A9343F24293478A2D914F83C4914FA2C4814FA264116FA264193FA2F498256D4A9E24ACFC91242DC21F4952381F49B248F89124A7141F48F24A911D24AB9419B24A19F54A9443B24A39242B94478A29F92448984FA2D4B2092FB2F411642D121FC1B648F11164A3F61164EF34B111F248951B61ABB44B69ADFE -:80740000115F83F44A8243E354F9B448ADB16B431CFA245A1CF924C85EA17FA221DDA1F598244F32E54DF224D81F81D2A2ED49D6387511F448929E248F36E148F244931F88F268971F48A2B44788ADB64B484E92478A1B9447832BB46F8AB442FBA4583F7E0D84824C04000000002100000000000000240028000080880400004008228087 -:80748000220100002018089F8F0960610025D4A4820620E212883881895138005822A443E11224230414251432422D6146D48414784428124214588441118247121E4489D218F14222132844EC48348CB01418289148AAA182BF49061F423582AC7231AC52429668C12E128921F51228842116E491B24912584A43F548211654815788CDC5 -:8075000022846238C9028B212D32260443F164112952211CA21284281226D943A84813914817C8521A82C21C8934144E244C511849F48422C044272D2829614447248B82417012B8C4932297228951182293E4214458281D461CF318219E4D4427B86606481C62231D465048CF2241364485111644211AB444F1822D4D882571AAF141842E -:807580004B144A788468414B858145725824A1C1FF4F0E2E1144811D2C2B128CA21416A81228149688086C71118842C8244B41899344008902E022D148924287442E188D2448E01285021D282A41081B218712E014A1614284814383421838144A03893A24AFF5054111008110021081081054284120514211180049842842018541022C0A -:807600000420984428E0880230428480C28290888041384241000042225F1F05424722283D2C90234608812481269A112D128224512889C51425C8211F81281212322685014445026489140229117816834415B825B14362418114484F2104E04108122A411894984D486F3D09422614D287023142104881C828116182215428C4418C61B6 -:8076800012122A04221041094582440488481A029B2948159442994261428860881E4212815A180410084222DF2407411122402852820050C230321225481422315213110217886721822572244108644003A7245068105842214068616218C512A142414042041232409698CCF5FAB8002890248B126044142A413888122481818CD4426A -:807700005122209111812671247144185122C0511288842608400118812024185218248304128098226022602518C048F0D6D1C02418404A263212C72130322C021588012D1450844C08222A18048084C41A2CA242212CA2141880CA328421188C824425A114828D13421C8904284C24322C8382018CF2E3C124247011880115041008139C -:80778000010041408801E180044012188402302840220A10322192281416381800224008448412811220842682F8524F504218839134ED32176212412D3823F338821840582C1E4C63911443981411A21D244392441C84C428726A6188812FA221082821833218228D414E882D1587111E4242182D181C68442528712882B13CB442A1166B -:807800008384F87875602228148400437411088414503812008542582284388C041181254AD4224151222822422A011CA8212D138218281884008B8215282481288292442890288062829F68072001122444100100400200A1102202002414614008220010022583124A180A214C0210188111440400000000BFAD0914260222445081232B -:80788000D11292121821405132002092121548484818184908854212F82212E022014441A02112819534198424401818418841122802890420F6367A000040021421148011023552211002902281405822404108242225C2210050282800251818C31D00A1C01854200184280000221B9B50898B34212A11141468312823514445B424A228 -:8079000022224008238241538225E281E191719608818440781153112B21A55896C724848383018524120845544D4B222A7228041002C04A2552225AF1F62D00000000003012000000008114000000000021494202241002000040080000850200842004F0F83640C8484A82041042420244444C82922200200140022981817981880840C7 -:8079800004141422818CA4242904454208004485D448828202000010129212DF4C0284800450420012004416A223001400001D282184188048020011150141252C82440114801202278144122A02100800801282F4E5BC40A4420000800240062800004001A4218041880884004003400848000000184004284008001800A1C0182D91002D -:807A000000000000240000000084001008001008241800000050220000002410880100000000412FBD07818B1442422C0224C011301441478222221001814012426281129A222808401461421512088324248402101209C14143628222840010C842A42412AF650D8484484800002412404684824202404118185222212A91181988080049 -:807A800040C1212668A18D18482C04240021811844442828181004009042218F8109180011008418004008001450410000C41400001008291202240000100280010000008440088004F07678004004004002141002108201000084400400004410040000440000189011001002008400814084D4D605411244C02224812C911121008301EF -:807B0000C011144115088419421818281249084445D422128472247212321224104242D8221158812420114288014008848992444974770112222200002352222C3112A120011003148110184809401108A41220420220322234501221901385220185381800102411084E4830488FDA01001001610012112C012542120240311884918478 -:807B80004141228400214042D4420229120444212841202281D188410800855A8881408804007FE6062F22F212222CB11221B112012C512239E811F111119B98179885F888418F84041D4915C1419558884B44467424B444F22424222E2480524645E442F222222F2182B112A1812B99C0922592832F91F111111B988658888B484E48C0C9 -:807C00004880548885F84448FFFC0A6F22D226E222A11312230114259282BCF1131119F9918887818D4183244459111C54C19588F6484C4594244B222222004445C4346F22D226A2123AA1819282142592822D131F3191911F8978189848424200405C888CB658070000000000000000000000000000000000000000000000000000000053 -:807C800000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000000000000000000000026 -:807D0000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000000000000000000A5 -:807D80000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000025 -:807E000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000A4 -:807E8000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000000000024 -:807F00000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000000A3 -:807F800000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000023 -:80800000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000A2 -:808080000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000022 -:8081000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000A1 -:80818000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000021 -:808200000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000A0 -:8082800000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000020 -:80830000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F9F -:808380000000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FF12 -:80840000E40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000000000000000000000009D -:8084800000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000000000000000000000000000001E -:80850000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000009D -:808580000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000000000001D -:8086000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000000000000000009C -:80868000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000001C -:808700000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000009B -:8087800000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000001B -:80880000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000009A -:808880000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000001A -:8089000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000099 -:80898000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000019 -:808A00000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000098 -:808A800000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000018 -:808B0000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0097 -:808B80000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04F15 -:808C0000FE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000D5 -:808C8000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F1484004141400843A21222544480C2261224281A021200312180110293422402002150A6414F8201213022104844458242D2688282220123D1DC0428137112497919427838B624C126501630289024E12147221F422151238C416A2170 -:808D000044381D1619519697418D111250381538211C61911548110867834CC2344581C334809226442F428181D12215887144F216BB14008501101238344426B611028501445042D021021121100200125C5184E09112042501110014A1442221C021128444401444C2282142200137C180823112111881160224002210444228922400BD -:808D800023911884109433510014008042982118A301218071120C6C01284C0151212228160418819044AFA7091008104134242002004400411032161A0220010012102801001100405181404408438202002002252201200230129BEE40110184C100810044800228282001200280114242421112D2180140080000C12002004420028000 -:808E0000024460233012003F44022100000000000080010000000000000000002018020000008200002001000000F07B6C006143311184282442A18D21848352821C011086C1188843119411C90825D238614230182120413A1415028232141C4289012C011001410088452812941418414FA20914008544751CC211912C43044E811012A4 -:808E80007156F82182C3642266314992812841262444717C21C2446F882264423C9624142648BD18C2442E162E48861EF12811278C184E152098224624F112442B2448626AB829051502434151488C921217842372221DF88822A41311314E3B822F444128CC144949F12488642CE29154522E11816724852441E474712146018565935CE1 -:808F00005258708C2251828C045905860243D484B12411A2141AC2E4AFFD0E4004164C6141349018001904001244842C3321871490180041207248A412A08242268A02B028A82180E422E18106112E13821C014480224882E4441224045F270B1840514165C24414116B128400218481412141301483448812410110724884D418220200BE -:808F80001480C128218481169C1819344200008423044A018182182E48ED733422199116837228D12141AC212C7441423843113F2184786258412CD284821494241F858874220CCB24435522842F217414382AC90543E71A312823B818C2A12D124222A3CB218726119D12A04189F2A84283F282728AE4813688414B4390221443C1228752 -:80900000324D51311848465122408214524A414CD282624484813E49400C48244508461922820520E82192882E1881B01C4418C82110522830488CB288322828824A91182AF45F8F20215112151C048594216F211248384125D18161884A12034112469424881D421C0247A2496524468AF3281684C1F014611E218128211F22C8182138EA -:809080003BB42364861413012C21247452A21CA3E482885868EB6514E081444218981649541C4E2880128CF34211584CC3544715C371186443CCB1287482A5412826F82C42848C4348E8424104898C14A8283014641AA28283B288C1156825518468488C21C64484B0889226DFA30628CC741851414484122214C10028822410420A212094 -:8091000048342247A14964114006296133C0881E2283E14146110284894108431531AC8A738824C11282268401608123012F550A29442222B11214012721430125425182A4C1822C82024E228D412216111812084001419048804401400233228294528042024A0189C8184270228AA82441883FE70C23C2141D3AC5C14E4D194C351F6D6A -:8091800049C429522B16F2118ACB416CE921F4552AC3C14A1937B436DC84526AC3C438C3163238A9B118127C8488E4188111C982D04B0376A2E13E488F18C2212B814E8884B62A4D2C716EC28889942C47284F3107481022911200282A014410884422C22440323485446814132824420185154244A225A02129C424242800CF2241084483 -:809200001896682453C11448813AA42400329822DFD804004B218118174424414608289012142100286A211488244204813A04487022048136022602222902814344028142100841A0282440842A81023FF84C52414E148111818C111291134819E14481C44CF01128214914168104890418004352340019644546E844024C411484B22629 -:80928000419858483B82212383B84101E90A41812F820888824CF873E31051B211284860866811859241008066848C2414782A961881121E4AA061611D12B0483338902A22A05260C260C325A212411618561827245082CD1123E484328268298886C212F02CF12468C0424C11215241A1B04112445428104414142802004222D9114439B6 -:809300004812904189022041A52480810445312290489880C5242B84901283E288817112F48448C042D90E414440B8222482410228811A44141111A242414C3174440000D0121266424841A0421E44490241122D28299428800280C118A8423028842A812542284304BF2F078C044441182925041A12060068A1002301200321697261D205 -:80938000188444C8124135C2484D1280042E12200442304818444A2A4A88228148C44521468808784AB16D0510820250289014402202D0480344601221004B212E111100008113021200C04200004C0118448A0100430149018018048488885F2B0A3018A41114148584140812284604448022D1284458228C044246684216DC12942818C9 -:8094000000401B9816818483118AD4284492281A16898C141801C88B8480044144E0550A841139642528001D1842158844A42128422A54C28400805122D04281812843518446C82425118401E01114741401231174441111423C1239B2AA243116231184D1C201218576DE0425427524F91D161B518F82F6134A461B22A477584E14E51A6E -:809480007861E842D424A3328784C7A52E5838EB42B5E48654AFD3322BC7841D2C422D48455942412E644568E287C22E6A8F84F42A1AAFD4E5757F48F13882CE4285E955B81861A41EF82B888D54C14EA84F43F214443F854333414B41BD36941416714CB41CF45178AC5449284F82C4441394488D288F5654AA55B22221F42842344F8677 -:80950000D41463144CE631F32245896491CB354E22422B7647814CB344F114512D141B21411277829EA82B348B917765382D2C8B93A7688F87D126E24B11A4588CF89C53D054D6AB012B422F86F24712283F425118BF5252125622F141116F42F41626637412F854442F4207C361154E343487613E742F957144EC21F36613CF2266628FD5 -:8095800043B53C7711D6227138B31AF24222C3D566E145762432883D528E48278258FFA8F4E4826F4836646CE48FD882FEB8142C682C7F810A42230200348C140424208244C2481C0134485C024E2160442142002014022142101112011904110080048A048A04828054488200F015A650315FD4F11912BD4B4AE621D3425445FFD4513994 -:809600007B118D282E545F15F54C2AF7815B674F62F373717FE4B443F458585FD3F1642A75D52CF51553FF41B572F67B4B65C82E2F47F74848FD4367616F557228F31B53B37477F3333535F472216D37FF28B1E2B282DC33F143736F44948E8F46F2428CAD2A6B1845F84CC82D828F9249D273D445F51F3C7F21B24BF419114F67F36724FA -:80968000FFD3F349491F45F578687E767F14E4257173B25BF415351F77F7474E7FC5B552F5151D5F96F725694FAAFF1713EF63F9565F2F86F635751F57E747E786F51F177F54F61C6DC7719F31D14BF636322F47F3696EAF97D767FB2EF72F8EFACAEC25F957576F4CB6CEF438348FCBFF1EDAEF8CF5D65CCFC5FD42D2FFF8437241D2571C -:80970000F53C367F7232489F33F36B615B36FFC4F139333F55D788A3744F25754EDADEA5325F75F37A782F32B642F46B394FC2F5653B37148F62EEA3F3575D3B672F67F267618FB2F272348FC5F4165A7F75F4167417E27F617152736EFE7E7C9F21F17E33FFA1F7DA15ABA6ABF8D7747F1CFC46446D8E4F6FFA529A2D266BDCEF86F4DC11 -:80978000D84D96CF584AF365677F52F33A3E3F23F26B22BF37F77A32BF17F37F7FBFA7B773F36838CF24774FF75B176F76F56E7E6F65F37F7FAFB7F7767C9F96F3345C5FB6F64F4BFFF3FC7F5BFFEEF57E7AAFE7F32F6FAFB6F67A7E2FC7F5171F6F64F61A36BFE1F11D16AFD5F77E3CFFD7F37F74EF57F79EFDBF6EFEEAAAEF8CFC551FF8 -:80980000FF39F9C6E6EFACFD7E662BFF6F45BDC6FDEC5C8FAEDD64F8E74910022130228422004820014004A0418180222104004C12014901491198149014104498148C04008414008454824440A448441244D0D8034811496181341A6434C41CC1282714001D4827244128842D224B4123440824875440D183B5487223324826022A24341A -:809880002212212827222046786212A1968429A949272436286489A922921AA240F38CD1C0421F41D22AF11124CF34F11124EF34D1C1F64A121D2CAF249921AF24B915F44A924B43AF3439242F34F924482F54FB24488F14F9244A4E856FA264116FA2641D2FA264592D4ADE242FA2F491242F22F49124A7221F49326A1F49366A1F48B65E -:809900006AD141B26AB981B64AB985B44AB9A4B44A3B24ABB44F8BD442FB2448984FAA94A890141FC1D62AF511248F1481D21291618B141F81B266D84192B85994B24B428B9443D242E982A49427828BB416F248914F82F858814F8274D865A2875D2E4BDE242668CD2E4A9E648B429634288E64EB128E4CE3F68164AF42F9814CA9B38554 -:80998000961A4B48AB344994B29AD442F3A64829F984124F4E0D00410000000000000000000080018800004001400820924200002140010000000000E037012611D443513485532189041C34828B4214856384630518E022A442F048118306AB2428E9343521B981658618811835146288695281814242C18F24C2182362895602872116AA -:809A0000A841C945E448319890486FBB440219D128C21812281D24874149D28482715A822411B14833C827248115E814214894456014188C84624444882E422C82A224100425A243974226A468803E5114C49E4C2A98C44D28244A8A247428614A671B50121F44711AD13C11197163548422EB2843361A2F12D428711164821602AB423725 -:809A8000861D528F14386C439542CA91564D6921E714581D28406A2113668484107A32D81CA2428D444E2A4F82B52334384AB182D528E9C8344CCCC4844F21B818044F81F4897F20024722C0122881124714901819542848421AB4488804001210912813128881824184AC2523825224D024C824144842442A0888121C588485248221C336 -:809B0000122A24249828A24F4408224450C18144424821842D121D4818822344D84828D8183215508150818122442CC4244D528124A04216140461124B842082242278482109501216B848084A2AB9488234488AC46E10A2122B833825443A34A7128E18CE21A62811528217C94A5A329986044D21C24664465B8423946B69811592244AA6 -:809B800068816B8122626382C228388F24D158D881C1841E2AB21D428B488F111CA4844CE22D52846C26E118C334C11FB50D224922711D4208276799941A13021901F0C8144618B822CC414C119548C061133C62258C84C242896224812D64122E424C92221E289289D41262848E248AB242A8852B84886531D82E8C1AF828841E8426B89D -:809C00009182D24878E3480218232A12140C22828B48AB92A39412278825213A87153828112886314445180C66D126E14194164488181AC8244410044986D14898116081994341E8910420A4422324365248CB14481EF4704A8135A187222C941145F842341A46A8A1128D244444A9A44125985726A2814211678472A9D8A21354298118D0 -:809C8000268121346187144B421C92221244184C042021E4515282504216688233E14291C8622A48E8DD018D22484D18418311041444465684848E2242C022C45A024822182618321C8848890543944334822D84C48248C9088C24A22818488046EC88A281842A4C9414862484021602BFCF0310844801262812084001301883846918446F -:809D000000430448112908C022722022D1841608181210018B843028190AE011024843911882302140141828F8B6BE902116F42114D9E2A1942DC193B21454843F89429888161424F7134889D341C1621E44521B424D486B682562222E14BF261164122AC13CC31CE11CC1241D842D2189F1A4488AB348E1140A6889C18356183C241E8887 -:809D80004782296342C68C8293888F4F052F280481102261221E4422482041C248872486C886493442800A8111818483C548C04A5224C2214E242031282004C0240018199618822CE1894424C1841A84C248A9085F330A23116242205248224863048CA448A081421100438221024CC241111428442844433A4C30C449E84284081084B9C8 -:809E0000A42408412A21341842C100492931428925748442F867AC80024016A42429410400848908002A989489048842828426D284944514118880A112182288810017284C0218242A2844613412004C048B82200230144EE6202C2212922800288C2322084C0186A828830128414853022D8288286082430818884122008414418820910B -:809E8000441B84488A0282811A68428B82422263644C2AA842422FC50F1C018985B244816194422048811AC228166481422A85E8122121711291248C21412284B4211481214804260C43E38801604A8041188194219044898421228491224143016F934C82F24224211042180400A24880082AA4824021CA24822658484582283288882299 -:809F00008C0C400100214304004180081C9818C02822824148804144C881A76A800449243848A23861121E42800242821092884200485C14817644D8481824128492482308488828488826840C1A324400202894818A4184694149020026B47B05410081B0120C8D32418081110A0010C28241128429011814181951321A98144C82A218A5 -:809F80002E168C0582202402213849229412C0A12C4424440282901210FA6FB6008283F14A348A4152488126E8892602C8818189385824128E42482624AC8287582285014002881001212B4844004219014C28C4118A02840083628286249182184A81F47F5A407818C241401304211C14224404282A144234681032841B1825CA42582C70 -:80A0000081A8614721111D4A2245E322245C8116E628E72122721428C4C8228068414249028B85184280084A788288F843946062278926D4A8D28EB482B532F22A1C5E752AB1A3A51CA32141C818682F4236CA1E218AFD35144F68BF28D837E41EF21C295FC437354F28B248E441C794171EBE422D464E241D96922682EC42C1545B244401 -:80A080009AA88DC85B4455B8AAF3B848A67418644D69BF84D11CB5CCD13D0E2B65C6B4123134F623D641D524045E88C04AC688A8CC88AF8FE989C99161328E4817164F38E2C2D2C20516C2A726F42595C7A2A24847444BA916AA214F441A74A4F414212D883E46CB4617121D41879187818F4FECC4F444844E186F2EBD2425AF442426BCEA -:80A100003A4F92112E22CD2B2D444CF31C2EC5AA24E7A28AE684AAA24978C8F81C229B2E4483E462E64AFD46244EA187813FC4B4C8781D726176A8A1483F15E889B2C298246F618B6A168B88639A182F5CEA85A3CC4B2D8AA9A84A97321F2C83084B81384BE1282D8285E241EACF98C2BFE60B114951811815081150814562812484244777 -:80A1800081344D481416485281421130814239211422142214220413B42611B12A18111AB12A9841211A54121225A541292219F211482C6289288228BFA947F1F5251F37721BFA326D1E855FDCD2E8F42E6FCF16F464E25FB5F422488F2AD8EEF94A5A9FC2F27937EF22F3639DCFC6FD6CCC5F51FC358D57916B4ADF5AF565481F16FD115E -:80A2000031171A7F12B8B1BA32EB33F3A3241B357F15F31B39BFC1F7E968FF35FE422B2FE8B232F22F2F2F36F6D2F2AB8C2721AF25F466662F84FBAC8EABCD9B62ACF93478FAF7FEC24F3F032F27F72363DFE1F13A1D4FF6F4452D9FB6F4767B8F17F771F34FEDF672788FEDDFEEF94EFE1FC6FC69E54F2BF3638FDFD6F6ED6D7F57F47582 -:80A28000457DDF872ADF54F9645AFFD6F783A35F12F2A7E18FDEFEB2344F7BF3A16C3B483F9B7E96F4B3B49FC6F6DFA72F97F241999F97FB66677F46B6F1FF29BD2FE5F4DB89CFC6E78CFFAC2AEF2DFFEC562FA6FD32F84F97FFDEDC878DA0275F43F6182B8FA3721DF6662EBF95F55E7CBFC6F662EEBFF5FF5ABAAF81F31898CFEDF5EA37 -:80A3000069FF2FDB3FF7CAF65FF4DC55FE4F691F9BF9657B6F38FC29E33F16F47D1D4F51F18123FFF4FCBCAB6F63EA27F6A6CC5EF77F51F792B26F69FBF8734FD5BDC3B388F76173D7D82F57A77D8F2CFA9595EF45F59C444FE5F9AEDC7EC96F47F29C94EB554F4DB5E8FDD937247F7DF73736CFD1F33C1EFFE7FD77AFAFA7F55E7EFFC7F4 -:80A38000F777BFAFADFF5AFAEF8DFD1C9C8FAFFDEA69FF8FFF955BAF6DFD46CC2F4CFEEDED9F6EFC2DEF9F3AFE5D676F77F57F3B7F3CFCC7E77FE8FCF4EA6F6BF9F1F24F4AF6A667EF6BFBB323EFEBFB78734FDDFAF322ABFE8FEEEB54F673763F1FFBCDEB5FDDFDDFDBEF8EF7C4FAEFCAEFAFFFE677ABBACF4EFFF4BBCFCEFFFB6F1002DF -:80A40000230241844D1212A04820088A04922482288228124A021021041083B224014908988008419084108404408104822882441028C824E0470C48502484622046284218C268A31484C148AD26482584F44214828535854A52A25C722468114DC283A84242214A120224444AA821411AA48292A049409898488D143A44F284484A2111BD -:80A480002838CEC0421F4152281FC132481FC1364A1D24AB141D2CAF24D981B24A7915B84A7924F84A914F82F4429547832F14F925481CF9A54A8F54F8254A56F1244AD6E1A2645DACEC4DC24A1F4DC2421F4952281F49B248F89124A3F48124AB941F41B64AB911F64A915781AB944B4BABB44F83F442924F8B94924F8A94B84FAAF4A1D9 -:80A500003AF0244219D428D4C112F8116C83D441B66611E166D841B248DA81F24A8415E844BA25D442F824484E817782984FAA7548B424A9844782D66182D6C589CE24A4CE2C45A1488D4196F448819E64A71444AD911E64AD951D442BA445D85AB8A494A24F82D42AB88414B8A6B448F3841ABF9B022008400200000080021004200200E2 -:80A580000000000000000080024100004004880000000014D0D90D246082165528842604A961812CC428462A64882D822CD841C44468A7121744441354481914722844048F1864C496128C8C61182931A21914C488874981BB412A0519C8149CC4848A062E148866289A888E28BE6660444F2942542A4272585A9265691839411190444231 -:80A6000089842218A8848068822E42D028E114D138BC29482641A88126F224C35014C5A2298C51144213C184881D28422DC188D04AC18883BC2824588454F0C14720E46C5228578142AB244921D24BB68E914C27928F123442CC1CC248214924F6A3424684E88172446A1829F1284145024E8C9564A18E188B682A71C2018CAA521644DDBC -:80A6800048C9112D1D4982A2424C21D424D8840E36A8842C34288639983FB60B45223124102A21A64118408104008A94825B428884811144198482149816871C1F824891528241D0160C6D13442D81848848818AA49415C8831B488D818061884E842698A8434824F26E7400200888008008000000000000000000000000000000000000FA -:80A700000000110010011400775E241332424094148F121261444952A22E111A1451A829289114482B8A245C21814248A5485542C8218B451538828D444D124AB22208114F41018B221C68246952C1221CC41485D8241882A141AE822D14C116889242BF45013722144921D1C8A822344618DE41C2113A0484A8C5B432A1487C98143116E5 -:80A780009828618EC51724B028E281A948171421848D15413F226A84418B114CA4261C084127E1221D7144F044A8893432188E822941A4818D288AF4A75400200880088008000000000000000000000000000000000000000011001001140097726022404114441804248C921892AD11B042A14224001302208464442C045116C54244297B -:80A800000484A08211654264144C342A44830218178934C012122923514A82400870790A6364422FC241C1325E268B255E2A1E2547182E42222486487493D416CDE91E42C7241B43DB878634242663124D531AD22294152AC436BE4649DE42764322D28163284FA30845A1B42F78A187260384341D844B68442B84283E448394541E244118 -:80A880006FA409272626742244B124F13248484E181E23284222248D8256F422D113F981484662D42A75A4188494212A84711246B61514E44122ED84924468149743F07A812964C242CF11BA2208190825D224A9182D328E4289E2440847854942F4CF3310041781444076388412368D8D321A981B00446D4228182225B111A48443626405 -:80A900001127541C3251242E42482D266C88D21298222592844164141EA620E53261819414142E4441124432460818F0F2D63483829435124A1354221412237283D8128202460188891122F11122E2844B3430424B8326C81838AC9849412A581800689922F484584562131A12449284232182948230146D222849343420E8FB0A8741293F -:80A9800014881252128445426C441224B02861A18AC22849328148247044C112882819082B4A642031C21C14A84125E488948429022B1242239818824D116881809342A081F08222C8CC21747B08136461104128038B24190428166881190C898134428422841212112245128855141005289024142411124421889041B013228248941882 -:80AA0000C0B800CA01816881AF1742D21494168312B14AF12312248D424D5366B688723AD182B18145392A2AAC341528B31822E381D425C4A2472497412CB488D12493898CF1A2446A98254225D681EA8883F24A9423BB12E21954A48E221C2359481E481A98227032A2282338544931489F9E0D2A016D111A224214D84112085C410484A4 -:80AA80004A21592845988248148A44250222282E184E2540944200C011001534461094412322C11182230424228B9443C1841AE444628AAB2486B2850C68182D14AC92214129613632A800804422E2215268C0842601472266842434246CC18122230224200480B24201263441414128221C484181A1184A6921284C58681A24026F7502EB -:80AB000050121592111A2484823148444942384410CB18809498428A815C18001098413082E0281498281B28104125A224C830422163D41208292151828461218928B42221C24883F1612A00497214081D281B214A228142A218648961148E52122DC818482E9341A04A308119B222048024468442426C1420228861111392212E4114135B -:80AB800081338125344143012E844A81870C29C824AFA702161808411850284C041C384819C284884441114001224B832C4102411C8121216819828F41882141B298D2425594400223A818252814226484882E8845112812024C8821F4AFDF604823D422D2288434481181148991284A9812897118C121272AF09144429A146118495414FF -:80AC0000460227184E812601304263082A281A11F181221B41881E2141518848821118682C8434D420092A54186F670E2236944141452A63414352426386981282218A42147468022912811226C8628AD2146824005C4841C12146439244482C4984684120E42431248E244149C282806B2320282244C8429F150A840012504184C01810EC -:80AC800082528128209C11882840880411841840140CB028048C34820082230200C82921085400810041001044A482BE17C044001342144214110445624813B41128C4814598152249811486642888494102209442284A68484C6216118290C1612B2812111858243823E812544229824C3432482A08F0CD16C01891680030436014584AFF -:80AD0000F14114C022202424184412441192214D12144A094C414182C125008C0948411664825245A828A8D0C224A4246110080021909288FFCD02E06A71127422F2432B1F44F1523C4CB634D644BD4448985C4E1237884F2872165821BF5FC6A217731BC866B4463C824CB13235C18CBD82EC52E12A94FA246FDAAFD6AD3416B4A3B24441 -:80AD8000E155A4842F6C7284F5E6522F26FC615A2B5187185EA24F86A867EF68B72CFBA262C8B6E417C928AFE8054F42371A4D185715367416133162B579F26223FE521F9DD813E82468941DC22FCF84F152458C67448B291D2317541F288272145612221B643D1822DFC36C24241F1EE828C8969AF484923F797711E82491A85F11B38213 -:80AE00007A25C34697D82D264D167AE82964415E342B248F8862226FFF0856F245291F32D2C8935C8B62CF12F41D134E148D21AFC8D7135A428B49CF13F533D48F5E939C49B8A4B1C6F824315DC3A6F424CA6F17744DD7127595F441232B884EA447EC2B28111F1842F22521CF11F421A73F8222F224D13BE317518214CA385729B598B1F4 -:80AE80008A0827444A39AA499C448F4CFDC2D214424008844048C2484562884048C248808442485281400884400825A8218C280112215221108A1408C110881408200184404864814400BFDC44F263272F26D22AB11AD488F23124EFC1F335311AF325377DB18F21F1F9881F24D446FD1897CD9D8F83F111198FA7F33A58CFCFEF93F96C23 -:80AF00006A8DC8CFAEF6331BAF85FCD8DBCFDEBEA2D5A9F73E7C8FFAB423F325741B2E8FA9D1CBFC68689F33F1947C7FD9F6DE3A3F34F4F6681FA1FBA3C4BF98E94CEE86A7B3CFA2B16A7F4EF4267C4FC4F534D46F42F431B4243F15F626667F31F134364F32F273646F37F676349FC7F375E55F55FD3B323F4FFFC4D478EF27F3D39CAF30 -:80AF8000A7F5A3DD8F8FFB71757BEE1F9AFAA93B1F3EF662F34FF3F35B584F7DFDE4653F1AF78D5FCFE1F1D87D5F5EFB24749FABDF13F235B48FFBF379161F8FF3E5EEBF86F379FE7FC5FA81A98FCEBEC3F983846F6FB7B67B26B478F94E946FEEFFE6FCCFC3F12614CFBD48E167F23373BF63F33B259F87F67525EFC3F36573AF87F7BC53 -:80B000002EAFCDFB78739F85FB5142FFD4FD3837CFD7F7BCBDCF15F975BF7F1AFFE6E48F12FE257B2EE14F26FE3B336FF5F1C6C34F5FFFEAE83EE3EFCAFE385E3F8AFEB5E639E621F3B3B58B443FB9D946F19D276B3D9F86F2F164BBB13BE8BD9BDED62B548F83FBA4D26FC6F7D2C6AF46B54AF5149C8FA6FDF571144F47F63737FFA1F3ED -:80B080001D3FDFB7F77F2DEFB7F77B3FBFE7F362F2AF84F9FBF3FFA5FFDFDFAF8EFDFE973FDFF9FEFFEF77FF76BEFFDFBFE5FEEDE51FBEFEE8EB6F77F63C377FB5F5CECF4F5BF3EB29476BCFE9F9C8E67F7EF6B666BF2BFB83A3FFFBFAFA633FEFFBD794FF4EFE6B783F5FFFF2A4BF1CFECAE83F24F9D3D46F6DF7BEB8EFEAF8F6FC2F651B -:80B10000FDC8F4EF4EFFF4DE8FA6FC5917100463021470240100A04814921413C82482B08144242134811041941144114222A082400188E012082E9348204102244001A048444828824C026FCA09AA1501842D12CC061D48E7241B218B8210C248AB1412A7241144122B24825C22624423225522C226220885D426244C8242C12429C144EC -:80B180002117482CC1641CB881A414124E863E484C082D1243094994181CD4E1042CF41124A5F2112CA7241FC1724AD2C1F24E121FC8F64A931D28AF24D985F44A924F82F44A934F82F44A935782AF14F9A5488D914FA2F448857FA27418F1264A87193FA2FD98256DDA9E246FA2F5D1242D531F49D23EF1912CA3F4916CE7141FC9F24EA7 -:80B20000911FC1B24AF99168AF14F91548AF5439B4AF4439342B9447832D944F83C4944FAAF4916D40D141D622F4112423D44122F41124A18AF642911F41A2A459F442B44B438D814B438F147835B84A78A7D818E982F548915F82F818814FA27498D181FD98254DD99E254FA2F5D128BCF19164CD531F8932481FC8F64A111D2CAF14D9CC -:80B28000C1D24AF98148AF14F38148AF542AFA429445B84A7924988A6F8294924FAAE54B06008001002200120010880400008150111844000010010084000000000000000000400100FF594DD1128352B485D182352489555A42218C018246E2288154584CC14313689641C0846578417654B132C448D0482C81382219C4464513D48682E6 -:80B30000544235342516C527821CC881124B944C84E145B2849428AB8246988CA86F220343748622C114241351422C13381127161311591893E472A14825388E3869A8C11A82643826081447186E152C33E46B126C254A2129D22158C11F82283482CAD28298411242AD84112E124C1438124C21A11A1C51482FED42F214414E24E19761E5 -:80B38000486D3283D42B1288311F13619A428F25581427CC6D18E72CA22F326C4830947788CE1F6C2557C11CE76BF411648E2228A95E413F6468421D8867944C1AF182258A75823DC4981B4A697894714432546634464782A7222AD584E929F24BF86022C01390181149614146122106508125A1431440311185A441384830221411C24156 -:80B40000812C68414915812441C22424153846702481521211608142326081981298860845F82548000044221120110281129044428E48404834115C11150844244C52854484812C041844228019911811C18441A01413088225548488824410221888B4E5042F42313427E9366AC116743658859D264D1B2817A28C7913381C1E2443BADA -:80B480009596198A7222E888674A59E4887224E884B12291FA1B245CE4C9B24C48B471C814136142A398452638114A33829F222D0A5885A1144A3A361E228326C1482844709A0B282614129E386C2142D8C2524121228311A41446CC244B844581C924148C98418688A25243A3582E4915C81C444C7134A11216612182131148355844873E -:80B500001A1A3481128512F4482443C992260CA18A4224F4187B241684319C2C434471186451112D182668B182B955483A88C8398C613293E1C13E24414C52486558B2CC024384DE820CC241E048528187442661812C22A814230A481CA8418223228224210481F0FA61401A744891184431282184282D411264A8E0288225918CA48D365D -:80B580004C088041562422588D6415382D84262C31A24D1827818E4184260143C4191A0263132834421E24608412E088C6683A7828F46E9A248384067021081E48560448384D28487C82240181B014C242424F9491242E121F84928149D458021A12E1482254148C041D42260243845412A83011418A9438208442A624C445829144F0791D -:80B60000B58081411484444444622185440200DC31484144391142A121107184083618082488124A1192221504824921126A418311048246882118588247842A5928280080B462032F2104448CE1D452141AB44461A1411E212F828114D4C1E12403A48319FE22511AB2181474A87224532946B821D468929112478AA364531B2C6C9199B0 -:80B680002F51127A6A2161D19C28B18171123898AC21B452924816B2484138A8221885F428CC001E2485414402C72210C26823042413384286E8443114543285B484443521448CE44132248741488972242875240261008222444724484B12288026A4488145C8244F8AC4224362441E482F44AA425E59C016823018251264422082080049 -:80B700000042228F449821121084819A22812911982B8211C60812A018163182814308666412828820028880298918E8826848894881F8E1DC24104C0270288211428222918290828429480849C48213841813548118842212486022166588912821001721841348A4242200242880042684081618B626088F7B423174B613C82589611431 -:80B7800060521814C041841442221A82A12180211AC88820024450484190282849022614C824E025A229242E8C4440C2212CA49426424432184C1424D43A7464F853EC400922C0441294100885C12418282A812D840A2A412214828411362152C0212B434041341286081212848514A84119118143311843014480014088A212F0D8410034 -:80B800004341829128808161238110C83884104541043011D12603490430248544082C08886820922885A4A122440084128844156412321A12C41444A01820F2FEBA5022284124400448485A882D88B482661481304849C881A021414992898712871485A12D9892414214863524821D84115445511886146858305182891894C4A08480AF -:80B8800008418889FC622C8004128362282422A100901211382450481512314223248414810241480090184112C01121212800102A8144514212400240C2222AB1120641F0D89E0082160866A4248149459854E08214C44889822181820120F142188914C4442A2161145B4166945116D1C104485C3114184218522E5846A143CA226A84BF -:80B900001698C4304412434488C86856015E2EC028F022414414924226483128814C8188A2811D28C81981A4422C1891A63158B0441802235212618E4990522519882648280C114481144E14A024142028B681B24181861112F458ED301227481825E441B886558C4E5487152934518F82F511844AACA56D786ABCC9F52564782D833ADB02 -:80B9800021BD637A62C1492B241E4CA393241574BD22FC84651F84D551D5A421FB88344E9E8F4CE45BD414F2A8689BA15E818E719B844BC996B4D27844E449FE75247BEC9EB4EAD254FBCC88AF8441D14467998D24C7134F9664133F22F12221ACF3483D8D9A5EA14E12AD118D5A1F16E81142F8428146A3453794C7118D489DEC83F22C66 -:80BA00001DC56118AF8AA46A2F44F43458B084F29222175A195281CF18F2152A4678D2724464983815721458291DC12E562AF84412AD183AF16848EFC165192AF4F2C42417264F227332CB3AAD224E2E5A721C28A28B3082878286382183D98CF134A51AB1B298114F48E4C6728455244D341B412B365F84F751976F15C198A5F4199A275A -:80BA8000532AB812D2CE393413A112D9FB295C1F11F9644413B272C8324E1C4396249A21A288851C86E8A6C4246FBD02130415081190419041211B4823B28114A24829A248218228138822286428421542948142888384384888421C081C88D4128894821A14A248148A14A248218A14A248200882708542F1414317D59B234F5357B8B7D2 -:80BB00007125764655FE97B64F83F2411B3FFA7142F2D1315F76F1F3536F46F21414243F1353C88F48F514E18D4887C2AB136F61D999F4A369FD5D9F88D6844E974A5F687257F7B83C1F115FDDEFE4F84F2EA7A63FADF3423E7F29B122EB21F145974F1CED26FBB6B26B971F2BF967A88EC2CF81FC1CD83EE3AFC246C2425FD6F71F3E6DB8 -:80BB800047EFF2721BF713254D37CD1F9D81BFF352AAAFC153192F25F15F567F75F1E2255F7253222B2AAFC1A2544F32752EFFAF9D63F112928F85F71F4DBF85F4196D4FC17318FF323C1F31F35676AF81B118F725256FE3F34A189F87F471323F24F73714467223FF15935F37FF22B66F23BB26FB1D9AEFB2F8268E6F8EFF1CF8EDFCCF43 -:80BC00005D022F26F721668F31F21E349D2AAF63F36B5FEF47F25F1CAB9C1F7EFB62A8AF8CFE48889F3CFC6795BF9FFD4CA77F79F9A2B23F1AFB2B999F1AFD45F3AFA8FC2ACC1F33F114169F98FDE35B1F6AFDCA6F2F48FE885C7FA9FD85667F7BFC9A3C5F59FAE52F5FDDF8DA4D1FCEFBD55C4E9C1F7DFD63F15AFB47954F3CBD66BBC46C -:80BC8000F954962F6DF942984B992F41F9B8982EF49FCE48F24173DD76EFF1F35C36DFE5F33B278FC7F47C2EDFC5F55BD98F8FFFF8FADFBDFDDB998BDDDF6FFFDDDD8FFDFDE7B73F33FBB3B19FCBFFE1D15F1EFEEDEDDF57FE15235F79F5DDDDFFFFFEF1F6AFEDFFD2F49FCDFDD7C75F7DFEB7F7FFD9FBDDA41F7FFFF5FDBFFCFDFBFC5F9C -:80BD0000CFFF65F51F1DF9E1B37F1DFFD7D15F1FFDF4F66BFFEEF6AF6FFFFEF6EF8FFFFEFCCFAFFBECED6F820A2A01290129412822011608844008122812281200891211082800590118302260123022A012A0121678242341210116081244120085246144F04E1D0044814CA21A1E44A1448128A021008148C048742A2414A414412860B8 -:80BD8000412E484664828714618118442921114814C828430481482302206844A230A485220B2A847884D89F0A4D431F41523C1FC1724CF1112CE7141D24AF14D141F26A9119F24A9151AF14B934F44AB14B422F547935D812FB24488F14FB244A5CF8274A16F5275A875D2FA274D8E5A2F49824ACF591242CF491248D131FC97248F291DA -:80BE000024A7241F49B64AF11164AF249921AF343995AF64B9A4F44A9243BB4279A498924F8A94984FAAF4BC71D0B4A4614D431E28C7141E28E583D63CA1688D178E648D334B4987341B498F64A14A4E154789A5F1A548AB14AE5A4E152E8A1E854FA27558E5A27C58E5227C58C5921FC5C28A1B618DD21E2C8D831AF648831F41F6488211 -:80BE80001F49D668B181D62AB394F64A974B4AAD924B4B29F9A44829F9A648A9B9A4250C82820000100100008800001081042100808842040014000000100440020080020000005012F07DC53464411A32284B42688542CC48200E85314A8483C3481EC461AF52541C66318148281594286F82554825A4284548981C121417228C78185473 -:80BF0000361E488416942D1D542E5214833194188E144D824B2DC94434288E2844C3F8C7551021183517841634118E224F1112C8111E22184CA81467149A22628520D448C11C26DC24986849454161825381E861024449C214160481284E118CA8188489982810CA4126E81411A8812F9698C4149C21A2FC2441C6741492294CE644022793 -:80BF80004A9D34B08587F12813C156F268146A7124D224B54CD284D481D41471328878A79848765D81843A7888E4827114391C267554F116884D1294784E198B18D9D849B51C42C81869B941B228695DAF44E3C8F1628822818D15276B9FCA02346012161428D118413842848012A248811189A84981111443938849C424481E24214463E7 -:80C000004205442100284058248440A412E0249821408811048242518F4438A140F8E4AB0011800200109221A3440800009082413024001C02140026624800484418118813080011A304182818488122002948084188847F450F100441C0211044018213E28894412984B24121621124130849C148608229419C810085020060422449C2D5 -:80C08000484C4808126C92881481152441160800926818646F8545010041C0214014C221C8C0883420C2111012C4812604402102C114284348084004143083894404112D48908A11124D418921124202848A0112C46FB60950142002001041426892484848808432912400436184288439018810420242206142884902888480C124122256 -:80C10000810044842008C06482F031FB00282444222A7441024C018B82400242230982884C04000024260414A028181224007014624814244421804801948018C438188216082228707E4952411851800144414002181881008C01001598148C9224459122108401254248284D428411413814808181010010420240724812240640F82722 -:80C1800095008001211C0115082302001800C0228904004800400200480028200228248952820090182AA441400848000060418078A2062581931425943219C143C11229C22818122548226881222D48001289161435226D224413012B422341A843256242D04141DA85024502188E18481A541881884889632189182CE64102886F7A0D81 -:80C20000414001801614110429082021240182884954184120020000204828810820612286C41284292101601240022441004622018042F88AF9000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE004800000000448002E1 -:80C28000000000100218800800001400848004000000400428000000002180F1F3B5000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40FA9 -:80C300000000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FF52 -:80C38000E40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000004002000084000000002840140800000000000080010000100201 -:80C4000000000000F029F900002400101A0150228041B6480860420014482002204428084484001145220810084084058100418324021062841842F07394245141448444424C0222902142100A11241949E8119C4C403C81501A41144D22592132129022308670111478A4033048260326F142121484122188230182448826046FE1051431 -:80C480000024414228A11100235422846489082187421B814548C14888228444465148496822448002394824014484C048281A04A3110249112A081032488A3164F0A72F10461444081004226012001290413091802404441110038092138011180241D01648E832080045032681444108482C2201824400F057944002181200220084817C -:80C500009082842F144148120548701558483048D0580256312640024014261162482969C146111144081381218968812122214392828008AF13468292146D22811A522C1AE4C1E421A2422840621141197151C42A4F33D441F1631CA0684519D181D222C425281CD122BCC442F822142F1348415541A3D258662A8F42516816B3117828B4 -:80C58000E184184B1877A2D44835583684E14284996449F8BA2D104224120280311828C02840C21115044614A8414694624483420484A444381741214644180444444551248296EC11444D6119F01841848443D8C2C258160A184988296248DFD30C2682711234181A52A44A3244163268002948985293D1217125722166114D191D184B94 -:80C600008415C84926C36526314123A248272A241E225B29313C41B288E2D1C6228D24246C41689288338159121E82442AE44172248206C604777910C814468222911830112012E412C1188AA42189A24810946814A44641D2A4D881811582024359C1001612A8128BA14F81A81414618CE148218232242353180032282384A3424F216816 -:80C6800042B0B845316868102142C4224841444304884391210066012140124C24C4141988744284944113C1248B12118512C44219028019222214D481248E01848221895286002146F88EFC5024508243314A90188722184216490A84842445588415082D14411881002624B211D8824128464286820211C022263848111143618118844B -:80C70000448981124C941448902889017B89604629532A1CB33AD44831283B212D144817811CF112881EC41C41829C69C562844711414D4885744842D94186F62194424DD9367824E242E112C1224CE188D249C8721D2A8A55125C62448C5218837C14991826E8219224A7434F82A4423E8447818D42AFE40E40044400188C044C22C42840 -:80C7800040186882851444211242C811244C18245122422D189044400A21283CA12100C11688A921181A961200D048084622018428D0BE08410054911F8281741182042120E1280180E111B842422294188C11849222124845C814C08C4371127412211142548443C12951148E1414311B828116280282444141328094444F47072E1161BF -:80C80000A56321000089A12110D214028501414342918220C24284004631161E4214482889840282892218621842A024608481122444882832424A894412C428F03B161024022C624244941222412A8101446A11142B01211444801242188251248C491516A8828902246093A1414044722428110814184C01224422A0861286F8576810BE -:80C88000220100004C4614188832482851292202124D28188865435194524018018C21C8234004153488200883088288001889422108008441842582F2D5C220381128830236C82290122A08233E8182188A551483A8128AD192E184239988230822A083152481031666814B8111E04122942845011B142814184843449424282A012848DC -:80C90000C01885F34F1AE082042180210444841823440883019522A54281114B42444280631283A442830442844714008C021114498124945929C255B8881228004B144C4488A81A12490C1F2D0C139124811414114410914200D02246280221418306112382C141242C012100240028004100400841105212141B282C02248858460248B3 -:80C980002142DF1D0221216489C158412376213844611AC8527042646287442869146814CC0217424C1448591C51C0483524A512C254332241094004CC61128A01288688488418A4816048B08C018E24FF9F0C84A042444C22544823C4214E8889C2854E181CA2841C9888B0433814888821A84B14568418182138881186518182C48E2425 -:80CA0000488281862128180885426C124AC29180088C888184522612AFFF081F42B68123F21D3DA37241F8692C2E52DB474FA83C689B1D1F84FD42446E9E2B7ABB174F48B356EC23F66A918FC9F141849EAF6D2427314CF148429F44B1173CD8CF4366CD6F53F184284F5139A3CD85634BB5249489CF18B454D94BD48ACB81937281D41189 -:80CA8000B982A3A34BF84F48A984882FC4EC34F8442EDF460C1C7134D69E025CF138146137C425A4142FA199821691986D618CD8C4B2497828FB4789412AFA1C4183E212DC8D74637817EC8A44D3557581DA28C7E2BF41A12A3417885C7298F8492C4718567481F454A9169218305C4122CE1423F6584847414B3289D3CCA482DF1E4B72FB -:80CB00001612427222F255284D612CF41421BCF33A24282AD66A72953219D7743CF8324219F388141FC1D614E422934697846AF318432A7114F3881CA4984362882611F2142CD0A9B144691846FC2118AF12E22A51113F8BE2B5C9C9BE244D844116048B6A2B4543AB31AB497F9F45218401C048188C0448E088048E48148A041F8844B48F -:80CB800081048242824233480490824288422938488880084F1288A48248888C0482148A541292219A9422822192288242DF510D2E223F14F21534DF51B431F4252F7F57D749F37C7ECFE1BA34B372FB7919D7E4DE3C5FD6DA51F255175F5EF344297FFAF32CAC8D38DF71FA29259FD27313D484F834353FE9D14758418F436A439F2BF2F9 -:80CC000014244FD8A2331DCD5F51F121211F3AF222A53E2A3F537214F913131F7BD171D911CA866D866D96EF42DA28DBCEF268E83AF46AC45F7C4ED221F34161DFE1F33D651F13F224263F17B779F37A7CCFE6F22424AF91F253756F65F15C547F75D117F21B19FFF5F7443EFD5CFFD3F25828FD37D5F9A9AF1771CF83FB76353D1E37F4CF -:80CC80006FD1F366244CF12D3E45F64643AFF3F31B5FFFD1F1296DDF72F62B355F62F323E7FD179F33F213275DD71F38F816B66F489AD4CF8BFB281AA782CFC2F27446EFA3F59A54141F23D45356C95D159FD7F5692FFFF4F62F76AFE7F714E68FCFBB72FBD9B9DFF4FDD79D4FD5FDFDBD5F65F9E5B7CFF5FCE7FDEFC4FE89B9DF76FF8D1A -:80CD00008FFD8FBF6151819F3BFBDB56FFC9F9D84DCFCBF8F84E1FA9FA35A76F7AFC16963F79F8FE7D5F1A7A89FAC2CD8FAFF4BBAFAFD9F81B939F1DFACB9D5F31B9A2AAD74B88CFE1F92AB84F4FFD4EB86AFB68DE3F7A46F353525D67B5FE65259F97F66D2FBF94B67AF77E74EF6EFFEAFCAF9DFFDFD96F6CFDDEDC7FFDFDFFFFFFEDFD82 -:80CD8000D7F7CFFDFDAFFDDF9BFFF9FBCF6EFE8D8FFDCF9F73F3AD6AFFFFFFCBDE3F7DFDDAEE6FEFFCDADE5FE9FBB5A76F7AFC9A9FBFFDF8FEF5DF5EFECDCF3FDDFDFDF6BFF7FE1B978F33FBDFC9FFDCFD94914F2BFBF6D26BCCCFEDF92AB8DAFFDCBC4F6FFFEC9E5FFE0D002A012E11901440032400001648321100281281A02480028D2B -:80CE0000244181229014A012B026014541184408122284144025010048421281706501AA41D42E0141848F260149E181266281811A544259943255F848264351184128518D24272285A152121154490124286041148CC2112814114B1211A021819214A24C31844C63814C52844A52149FA2012CF411248D121F41326A1FC1F24A121FC1C5 -:80CE8000B66AD141B66AD981B24AD985F44A925F82F44A9157832F54FB2448AD914F82D418F9254A1CF8274A16F1244A96F1255A96C54A9E244D4A1F49D224F49124C7321F497268F19124E3F49124EF14F11124AF36D981F24A9353F94A9343FB4A9243FA42B247832D944F82A4B44FA2F4E9D740CA648D421F415222CC66241D6C83F4A8 -:80CF000081642D148E482B344F88F44A125F8A84F181482F44F1A4482F1431A78F14F1A518F027CA1AF8254856F1258A56D492E855D2A6F811244DC34CD63C2CD11AF81144CD821E64CD919E644E158E24AD314B49AF1438B4A9B884B44279B458426F8884F1A4586FC20E008002000000280000000000000088000000000048000000005C -:80CF80004002000081005082B0120C4115D4A11198142825584230112B28488C01C1514E12115384C2319180C4A245B8211123315111842A011E4500601826088722137212F6218424325E82436131867658C284F084284618E48442F8C5C990228A32269049A361418D52C713281E482E98881618215B188D64A9311F61529748478A375E -:80D00000C41F241248984FA6F81A464D82C18F222992342635146C1164D188874481128D91B48482842E18269428A412442A64512E44AF7D0A20D658127848C4228D142721CC23929C2A3938504914144D297D486548924845E9E172A1EA68C6191179619711B121ACF9384543B245822141941424CB424391815991312F82D4427918B1BA -:80D080001AA843251468C8462A82A243EF2E096352412D12C0131608CC44311123C64888160843FB4812481813D3523311888A64441588528283C482874549F81824228001411748A352818B8211A5E241D2284888093024A5648A24324449F4481445F8F93960221514022D12848F2291612E111781249018C011001F8894221B4A14A2CB -:80D100004E11414A5282B021144832C820252298824C42815218C4C7221D648168219290444E12412D2649542284200847888F2A4863111A9231ED311D241F4473435428A449688E8B243728473882AF544899268542ECC85114818F187482D141C419613D441D2C49C12447288938611615D1C2D228C1C413F382118512948E8F24632224 -:80D180001CF588131D84861898A843B244EBC192288746289FE907293214369324142F1374423128A73116896E842D8819A8184641734C618217C489C9241E418D851C7C4491184E2248BCF28844221EC483681849C8246D212837484F91E29172430C4BA43E481A28D524B141388845682C43D248991C2A28E442E8534EC1112D21211D56 -:80D2000018274345F82C1213246248A4221351423127C881A6022B82548611C842264248514395442411442282D61211119818894432842C425CA2D02212F188414951422722C342222612D84842F8C1DFC038203422224634582392433943786C0180021604A4242C220C881889484E66364430112F8208D4924CA1821C0226481412A41D -:80D28000434352922342031A0241412A2422D84A24F4F3BDD0811432434483D42111F44C11CC42C62112C4CB85896222848117488965488D2281244F8299822183C214836118912C01400887618CE4C40184141781814588AA1A4C6121829AE2A4886A88884C921228BFB54812A421164823011C021281408244028B14C841406481121444 -:80D300001504269121404812C4644483E921342100002F48A1584922768492112094424058A622814C9148462842F4B8CA304529628131836664CC96546FA57221D21832692994148487228E144538848D564F818847514167882553B487628D171698878F46612B8CF1144111418721871283B428F1C81243E281F4845A9CD29222D52642 -:80D3800025F18232876A87248D248F44B2886484414B249FEC0F2B121225C1242931113CD1814261C12011E88814A241830485032886182888628228A0244140524888B02229B124084D128614147124818221988211408831A488922843BA4803ED110040E342A4215481844D521118852124446888148C4243883428118591C225B4117E -:80D400007442E281C4253618E2814828332223433211257958068188214D418F2442AA844243358289411604C014221FA9034004144489A2422745239284C0824021334192250122250180C81111C088800481408448058504A2E0488212C2A181004410126442818A8128362882AF4E0CB0421201812C012115022914420229D42B0481B9 -:80D48000C29048400889344129448444C28C244110241804414C248408C492201421D46AA214189082272918412886D42545A14200125210410190884C9299284C8898482C28011684A48141288C8288631A81118644C312111282182A4831A18962481094924CA8842D21882245081828418088F4AFA5308225024283C242184602141591 -:80D5000004830932601C2A2489221128C1820090822444221044885A2450942728848144C41B8254D09202842D89848226282182810545F15B494048887224115114285128C82D884E84418882242602872250126A282812E4C1C4853484A661182559184918D48292888A1221545218001008824C2AC48260214144E048725482F2C7DA5C -:80D5800090544144C0464034284122184C024A028011011B1422005021A8A84302000040011022A2838230822440018002006308C0481002EFA80F2504002123648580944442214121204228384B42104111B82448028324A8842149A882108868321484444043C22D2CC1928829021943648188004C2401F0D624148C61132C8411A11235 -:80D60000001400174529B418324A2144524485312812251EC418800A26C118442C415123400868002C129821202244744C9128418C0821888088B842A8417941C1443B28447AE2447641D3497719F942641B2C9B441F28D4C681A4B566EBAB6CA43D588712388CD6C839213B284F45B4237244DA21CAC6BCD245D848485941A887281711C0 -:80D680001722EF81D282BA2E782A7AAA5E12CC51A846018F42E681684185B888E121A999484F1168254FEC024216D411521147922B6126F8442213D242DC84E117FAD18294A0488F14F123C18F61F8437A6F12345111C0CD971A3CF428A48B425F8C3228184F2862698F2A72B6B7217224F682216EC517761CF285844D814B3B9F21B44332 -:80D70000DA6378C65BB16F64F2821A2F4ADB62782664C48AB9886542AF1B41F21632CF2244D246F51B124FC27152D242741453342F29588289F45282EFAA948B35B498621E7059B8286819EFE8786CD2A2B244F192412F9CF128117F48798ADA8211DE160969F98A284D9813B88C65E92819D261F8C281AAF4A8488DC46B9C8B58C9781445 -:80D7800032148A92444F47E266B284FE44B40014808104A012A01200004128411004514280328187441187451928051220611212221628E28184482842088C2482044800288428868842084F774CE225F4622A3F23F322729B43DF97D3C6B122F113111E14AB8C6E329FDAF88C848F2CFF1117BFDBFF2C3F6F225ADF75F7E4A8AEB55DA13E -:80D800003F18FAC91BBFB1F373B37F5B7BF1FA85959F82B314E12AFA15171F33B3927B2DFABDF19E733FE2FAB23A1F289222BF93F335F9A43FE2DCAEF81E744F43F3363C218F23F23E366F41F5282883FE7EE49F2642F236726B621F33F31313DF45F55D7DFF71F36E773F31F33436AF4CF861339F98FA8C846FE8EBF5F13B7D4FCABB4488 -:80D88000F45919BF34F6E6E8AEB57F39FB47CB9FB4FD4F4D3F14F4FD7D9FFFDC93F1AA3FCF49F9B8BA55FD81A33F1FFFBDBADF3AFCEFE37FEFFF8AA4DF5AF2A2A1BFF3F16BF53F14F44BEAFFE4FCDFD6AF47F73E24AF21B8AAFBBAB4EFE5FC3E9C8F4AF2CEF44FE342E365F427673F23F312129F27F57D7B4FC4F754247D312E24BFD5D905 -:80D9000093F11BBBAB99EF4CFD31B1DF94F86F382FC3BB61F613597F85F5A9BDDFCAF3ABC9DFE4DCDFF44F6FFF59FC49DBDF58F8382945FA929A8E8B1F3AA2CADFE9FBA5A73FBEFEE3AF6FBBFBA582AD2CAFDBFB515DC6FACB6AB794BF1DEDC5F1121C6B981E1A2F23F3BEFC2B624F8CFBA47E9FE141F372367F72F217173F32F33D42FF8E -:80D98000F7F37F7FCFF7F267335F7AFA5BDB3FB8FD5B9BEF41F1EADABFBDF9EFEB6FAEFFD2DC9F97F35F7D7F8DFDA1BFDFEAFBE76FDFF5F44F4DEFE5F75FEFBFFEFFAFADAFEBF29E96AFA8F882853F7BF1B3F5DFAAFAC5A3FF9FFF75FFA7DADFDAFA2A2DAFEBF9CBD93F9CFCCBCABFA4F4DBD2AFC5F51E8CAFA1F882982F4BFB76E4EFC550 -:80DA0000FFA4BE4FE8FED52220024B1270260241008A44220882241D482486880228822813080031800800417026014110426822842008860840228842084024A824F055417082424422714831114284254114D281A614961832114A3831F01148A32419187448B125B448024E2515FA8824432258861B2841B02A48C4814C8648D424E81E -:80DA800081428356181B4825D4848421D842237B42246144A6F1F911F022521F4152281F41F24A111FC1F64A111F41F24A131F41B24AD981B24A5985AF143924AF147924F842B157822F14F924481CF9A54A8F14F8274A87555FA2655D4FA27D98D5A6E549E2A2FD91242E531F49F228121FC9B24CF1916CAF26F9812CAF26F1112CAF2672 -:80DB0000D981B64A9945AF24B934F44A9647822F247BB4D842FB24484CFB244A4FA5042D4A4C56281E64A5F1112CA71416744A62412F44E881F24AB25781AF1439142F147934F8429157832B9477832D915D5A8B143F2238481B92426FA27188D1B645D1A265C8BCF581642D531FC892141F88E634F1812C4E131FC1C2961D4C89BB15D40D -:80DB80002AA843AF6458842B9447814CF126484CF924584F3C0700000000000000401214080010021800000022001800000011124008000000000082008FBA024425031C11688485E222714C311184128421C41137C4884C6C289F4422C48459788158211B248CF22A4421348B18616C0316151316D8189A444A21F11822414AA1819412FC -:80DC000082C72422EE1C8D14231188147C847271022D2143FA1926287332231F4482046B8229988223C4442F18D58264221D428D222E191245884212D44A42164151814B42411072C1042E841F82918442B1655269148E138E229092E55261828F4118B28242C494E01288F44C63341372617624C2131D2499D285C43247845B2845F81231 -:80DC800082223047344734508436F2451849B484D236C88C8E394D2228E125E86472815C2612E918F141A228CCB8497243B44451E29992956F22082F13582488C37C84EA44EB8891144D1A424DA892EFBA0245028D1128858264224834122908872449D428C94889B281F442A217882884001465621415E814124181014332414D1244CD8C -:80DD00001180481832112C014A2159281648072943D86202880049F4687A8001C024906180D2284128441822882181914570841888040051834192281D8A4645022A0810511484C5034D1111809218A014842D914124842D144121844A9244BF654891214571129E188CC11A281D4C114A58181B1C849542B125DC2332888B413C3415A825 -:80DD8000CCC1C83F8862A42C321C1961422628F828124443524249E181C21529B828B18812FAC8118699812F3248A981C098A6E8186288881A64464988F84C16302114163A28841F26016618384A941724818682E114592146C91887348981446C848661348C51C2833228264CA2212748494234111D1843318B124B1A314A9128193821CB -:80DE00001E41301245183829EB8188424D282A44F48C6214184542941418812245911188428B81104961422B128624644845A18212869228C4282C6111869741888428101294248511D482528184178819C81829186A891CA8812A98824026819484C8DF294C312A293141478223140A65CA44D01214C2824E241446081E244125E4214A0B -:80DE8000247118C2CA2A480884188815D28421C1144D792544141A3811122443041F24424D88122C7284C8528942B41268412742C4BF4B09191438443147113811141D225A0260C42C4A143412A0819B144D42888C041AF2488146024B588465393188814028C43124A02482251861488443C2C2B830422280C4184D481082F4428E8001E8 -:80DF000000501400008181601124186C0C1C0281121C220A44144C02444024C2A21420816812124D882688A11889222101810080082222CA02283E8A143B5218406444190245712222D418146A287C487218624122A634478F4BA4811CB228D8A23428482D244B18C427D826742428D812E14192165C9A2927818F4D12489A414CFA5122E7 -:80DF80001D388CA8814528B28CA24125D848F232C8BA44C46C6FCB0C2450341D282D13164C437844A1212130481A4495444E8243C1111608418B14809A4585018384012C21E98241C441C01200112E9212494918084642488204824A22411484026FCD0C212C022CC6444E282302181F24A812A084882301818061244DB8A8602183C828FC -:80E0000090281A081186B4140819428432194E8182A319D161120450120015248A08102408412AB4C907260200221420611423818802289021285248121344E81218E214022624B1449214128480492438C4008128188810841218912412121269244122A48489041FFE4D324440181818C4445655421624E22164211ACC482522B49A94E8 -:80E08000891E24101474210815C41911228D114C08818C81485123182058219C0111C0224068188B82882823862C084442882F230611142C44413448208282220441C0841CC8852604C2415022430800445400250100292401411448860289D82892888A8608C04248884400228245F2AA781486A21484482511942122216140A248601674 -:80E100000090849022494248928828908884008288840000002200452218C129241134800C2446014443025F63041281588001001842188A02288C61A688144A312C8C51810022C08420193418262481A82C2AB418160881832182024302241918185A4841440028A2D042F49D33002468800400C08242442800A0424041818898438410FF -:80E180008834148028042014810828142C024092280000184400305841844829083F9C071904D08641188244843221884A08482018B1274808008048C184144049988C302C40041504438832852F4812A828881C28C828612210249884424308A082BFBC048485C151141C1151163394440035043923384A0061881111A748442C41919AB9 -:80E20000A23082142648110284242052145028594CD2A1144804C82C480228242A98223022F08242242522DB3AE132D476F124411B442E134E411B7223E222263642964278C7B346F18C412E1EDF449A218EA24CDA89E288D288A32843BA18C8C4478A8D8C27891502FD831E2148E088721A415C241D822EA89CB8A3F881452F78F24422D2 -:80E280008A88F4441A4D82282247444CFC1BF3F06145B7B41227C11781814D251E444F6373D2A4D91B9C2B891AB4289122C89E645E984B812F1BF1AC885D4CA798C6712C7511F52C891F51D196F11C1A1CAA31582E814B283A91181F18FA8CA83F21F981BA6B8A9D24ED64A5B16142928A36183A5649A2492742A6E844FAA88249F2EE2FAA -:80E300001412C02893B46874417E22B24512D234E824024D421F28F945C89F3EEC82F2298135E41C464855184D122B823592441E148F846A48171885348489F884641BC44E642558441732875643D231F6A288A67881328A859914D9A8892E462F4EC884CAF442844B4868E6F22C5D4014C224212800800448204131843081200819041B90 -:80E3800048818A042C042C0C2C0C2C0C8800841C084220442804466288460618C012841416484448F46649344F63F155359F83F33D7DAFC5D262F222246D362F65F555971F17F573B32F47D957F8C6962F32F88E8CEFE5F1561C4F87F33CF8CF44B444F46E666F62F6ED77AFC6F46DED6F4BFFDB572B448F87F732BC2F1FF7CDC72F2E7685 -:80E40000114F51CC8F4EF6F6659F1FF7ECA4AE686DE36BE61F31FB99D99FD1DD31F25ACA6F21F462227BDDEFC7FB7AD88FC6EE8AF86AABCF3A48F371113F91371BFF51B15AD77F7247F556166F67F147D77F5FF173D32F67FBD282AFA47DA6F7C3C36F61B996F9BCBC1EF8EF44FC848CEF63FBA7EFDFF6FE3F1CDFD3F3B76DBFBDFD87879C -:80E480007F19F3B2B4AFAFFFC7CD1F36FE733F25F1EC2C8F6AF2BF37BF3DF7EDA72F8AFE2FE57F46FED1F11F73DD34FC7FFBEFE3B2F6FE6464DFA5FD7E7E2F27FFE2E44F8AFA2EBA7FA742E222F41171CFE1F11111E7E7EFE6F466667F77F757565F71FD72F63F32F6C2623F38F5C2921F3AFC4ECCEFEDF1E67E6FC2F3FCB4EF4A76ACF4BE -:80E500008C362FACF227EDCFE352D74FEDFB11DD1E92AF93FBF4FECFCBFBA52F6F2EFE3767E5DDCCF88824FF53FB793DAEE4AEAE6FB6D26AF8F973AFB9FB5B9D9798AFA6FFE6E22F27F7CEC84BE66BC66F4ABCA8ECE6FF5629245F67F51B33EF63B213F1725277727F64F417177F61F577D72F6BFF73F36F2DFBD393EF6CF5A7E7BFBCF6E2 -:80E580001E9F6F6FFF5E7C9F1DFB2CE4CFFEFC2CB63FBEFA276DCFE756175FF7FB95DF7FDDFD94394F67FFBC2E7F56FEE5E3FF7357DEDFCAFAA826FF7FFFFB3D1F5AEEEAFAEF2FBF4CFEB1B37F39F34E8FFFDFFD2E3C6BEA6F4FFB46C4DFAEF6EEE86F4AFCACC24FF2FE7698901250121002224002149A049200448444504811100100503D -:80E6000048490849014B820000C083841C08418260891440048044A648424024F8DB1E308400C481484244228E442220147448044EA1135A588AC425438A62884C72254884C12140C1885084282EC11287120000C08315082818865818800A89C84881A28304871EF022421F41722AF31124A3F61124A3D441F24A121D64AB941B61AB9484 -:80E6800053B84A39A5AF1439A42F147925F842915F8AF448915FAAE414F8244A56F1254AD6F121CAD6C5CADE24ACFC91243CFC91248D931FC9F248831F49364A1F48F64A111D6CAB941B68AB945F81F44A954B43AB9443B3427B2498924F82C4944FA2F49325F022484C342A4C346A1283E441D228F111248F44B911D2188BB24831258D78 -:80E700009143F348131383792798181F82C1114FA2F818215F2238181F226141B487512CE1C1D294E448D634E1C9523C17494961C88D1115DC42D9C1826B818D9543F3489443A3B447812F44B822C4942AF59DAE6084000000000054800200002800000000000000008004820010024001280010080040016F830916246242A71112122A2F -:80E7800084114122E434631430C414628C31452F48E148C4194D81904444190347282612742874A43888004F12B88411381851112C481145388883981830422460224928B1288408FF74450247181470424378114A9848CD51130288C423514815466489A48C228464C2862152828D418331C8178812C034C6714146C2283388948A859627 -:80E800006C8B4AAB5A2A489141463598928B82888285227284E1127428F2D62810744198248522C5188395181D485512F421421342A4B4C44AD24A71447398F444A29C31458F41625CA6943184496986378897438E28CB288DC14714174689D381E821D41458482B869B481F45D8849A88484E1C8B38234C02A6D248C8224BC22641F2A5DF -:80E880008690124C423311346032001E486621A18484251441058909A14888002481191498824440840124826D82104848417C22C22810D118180112892A089012944A68823F2A0500001C012712136126CC74626281880000194425C8218242504824448002526B924249198111C1815024108C14E4482402148289012504250481A24ACC -:80E90000028F150B1742442F819211297262B414784892181B81601E241C584117AC49C19889F243144DC8C5618387182914924985C141B9589684A30125948625C23477A81B8285B221789268A21611B2493988875125F548A436EA886281CB182D241116682E8B766042403811272249F282111354822F2488F22281248814871C2D14D3 -:80E980008F157824EA442982A8431169044D49811B4225FB114847A88B414F285141612117435338A170A2648D704224628486D821D814E1C6D88693288C115C862AE882642C9F660F14642A011C2134248321771C216485881441004011F149844519C888842502142048260300981123582A44A19121CC3291211B1811164C08242C182D -:80EA0000A41822111222774B301B604412218751481AE29402C0228E248180C81837212485342149081116886A21221382811851484C2122082C8A83014728268241046932822B218388A2C142481884860429741A4FD12806834665252C024418411C5881C46D234857862092812282E01214B232D8415848A01841189522C222119C2363 -:80EA8000146988419999181D189C224118C1148F44120123728438184314148818729B05A021902285044782172441848C01A08481258248AC42248C91488042062511481A58816292409442253412242426840430888009000010E28288885148F0E481146E1132C12D11A7248F12D1C264215D58856489154A78C481B428381A23914197 -:80EB00002229324C6826D1A268122D18281F8841DC81912827834371236611619B29986CA18256FC122A1E2943487A116228833189905286E884B16CD148B88C3188484FB9012502224C921444221D64224081C28284A592458857822DA245D8182948014C1244558228292188644822E0820C25C2282117C188116081A02818490422A850 -:80EB80004914220840041784006012522280954189B4182482B1A484B41122A448804814932A2008501623E834021C1208684001411504704804C0281C4102A524824324014B82814021F2C7A9141E241C440413743102802222840A4442222664441392422E881022B2225848220026110482118A44041D122CAA24204852484200801125 -:80EC000006002824228594CA888FD349428221C144100410021230121921081CC1228B144A198441C3881410944220842814429224422752441284C48641944441948A82B818C818493182699A8480982254845F2B014826822202818381921115024490284003008C82119494142AA14A902427622011645344002001441B292504002972 -:80EC8000088B1428429014182B1680A11430445761E0288451143018694648440819245C218813A1613B121E44AA110B302126127943A212866314A042844A0148A841997237A21C1721848B24424AA2822890464C1404542924A214C2D2F0481360831430214714111C86A142841824C8400630A341009362811818892284668811960548 -:80ED00002E834811441E220060425A12C4228C088168281881001B8182832242C284CFFA01548400224064944CE11412120242008200302141889084004C016614B24211245382000020440240041002208802150244442870F7471123D222011227A40041108194189668482741423721548A82198112934C41190444C34818744202223D -:80ED80006835224288A1481952228021B1182801602CA60281276530184712812F79038441481646247124622211415041D025221401888C941421104ECC121888000011144141250848400430C8821338284483883E8A8382211854818E448821583FDF034C7491F712151B541F63D2417245DC49F7431C1F43B642B412B4C9D854FC43ED -:80EE00009547124EB515D154B9647C11F12139CFBA51164F78FA68243F44867C42C28C1F23FA194CAA88126D423641711778241C7811AC6843B42EBA18518826586E49D58831241E248F13ED82D24CF14248CD534FC4F653FCD01193584F22D244D216F46A512B5124CD61852162284C378849F4523237232F47FFB8482531ACC11BA11FFC -:80EE8000AA38632D9A2672B6F2A1697D434531444E522766274423DC647222C6362B158E256F2C7C4ADCC28C74A1A1235EC2DAC1844B4B8E2447284F28F286C12F81BE2C691A2CF892E63467272B2211328B1447A18F2262163246FA11111B8623F153189E2219A44847283F24F2983E295B42448B2185D8147414E15452446AF288542416 -:80EF00006F41F214412ADE3416B31DE312A8485F27FD2821458272D1CEA88E82AB188CFC5A286CFA12922979426461E29E244EA483F9D387201404148240382410A44120014004280010284124080000000014008440280200141240080080028100008FF94DF352572FE4F212241D67DFD4F42C162F24D446F67B5FBFD2F625723F36F26C -:80EF80006B5FBF54F141E12BAB4F23F726967FC79B9A35F1ADA55D255F93FAE4A2CFCCF731735F54FCA4424AEEA1F38B8A2F63F7C2C39F28FA82A27F737313FF94B6DFF9FF5F9F6F46F6EE262BA22A93848D1AAFEFFDC28A6FECFF66EE6F68D866F156535B348BBB89E78FFB3EAE4F7541F334726F12A6211E17DFD5F56E5C6F66F77A784B -:80F00000EFB5D51FF265756EE2BFFCFFCECF6BD52F2FFF16726F63F7F7BC2EC26F6BF9ABA51F93F3A1B72F66FA64E62F27F375577F7EF448EB6FA1F3DADB2F67F3D2D29FE6F226666FE7F7123A6F41F7497BEFE5FD5A36AF6EB66AFA2874CF52F828122F6DFF5AD4AFEDFDC6C62F2979A4F6E2C26F16F3F8F28BFBFEFBEFAEFFB9AE141F3B -:80F0800075F435774CC236C7848722AFC4F43634BFF7F57F6F2F45F7D163BFBDF74B551F55F936341F3FFF36367FC7F34E1CBF99F91F15DFD9F9A51D5FBEFE44E85F37F724444F6EE444FED8DEAFB7F7F2F62E621FE4F641667F53771BFF35371E741F7FF3F27AEF6AF64AC88FCEF7983C8FA3FB527A2FADFDCEDEEF8EF8A4826F62FB76E0 -:80F10000FAEFA5BD72B72EF778F8CFEEE5364DF175335F53F314341F61F37C9CFFD6F16E7CAFC3F37F5BFF77F613715EA2FFBDFDCFCF6F45F976362F3FED2FFFF7B95FF6F6BF9DF5F59198DFFAFAEA6FDFF6F677775F7771E7F748EEEFE9FB7E7A6F6FFF52121FEEFAA1E6FF63F73E3E7F5FFBD8F89FEFFF9AFAAF6EF66AA2BF7AFF9BB5AE -:80F180008F23FBDE92AF65FDDADE6BAEAEB2676A7FEEFC7EFA6F4FFF36F48FB7FFECEA4F710C23022B1200842A0124482048224124C12292892209401481024E2480024229211406615016D024014B12484322088424822482644024B148028744822E21C01110042E121F4184C1482F14E18162141A521A19C48548259145A042A525C168 -:80F20000218608250A18546B4246B1242421022A042C81726811C18284421E2822124A68814C488823C1A2C0A49228F05B6EC0421F4152281F417248F21124A3D6C1B24AF1112CAB941B61AB9453F84A9243F24A9143F242B34782AD914F83C4914FAAC4816FA2E411F2264A96F1224A96C54A9E24ACF591242E421F4952281F49326A1F6B -:80F28000C9364A1F48B24AF11124AF249921AB9455F84A9443B24A39342BB4478229F92448984FAAF4FDFC50A41F4156181E64A7141F41326C1D2C6B141FC1D24AB811B24A9B21AB14A28F1439242F147B24D818B9B6C4814F82E554D185E811F224C887191F227C98C4CB9E25ACEDC9E2B2FC9144481FC9A2821FC1764AF28124AF24E930 -:80F3000041F24A971D242BB45D28AD944B42AB944393A24B4229F9264829F924522F8D0A20081800000060420000000000210000000040810100440000000000840044000070220187F6005C7112011818121588041C091B481C8138181726163481145349A482201E1E8144022F192241042718303215DC8298182643E2545221161848BF -:80F3800018011E428C4162C189121282823B447FC8042744A2A419F12242448D614B21381CD32A642360884E1913721A443862E4901813314871424E268D118535546446B21892144C631413084442CE1C4F81A8812B61262439334AC81E814D6287451392944D295E8CC9511C224F9A024CB4C4531A115A3212288C216123CB182A611A71 -:80F40000141F8168114F1166A11958841E8716C83127852EC527CC2E43871145A3142213A41216D4187B41B2514859484E18748634E31B4127424F81F823181B822CD128E42562E536ECC17A2AE381147434B136F4F2611012C1121221448F14D14122166134304296286482A512A4241121418824004448814562592D1285444204284593 -:80F4800022089E688961412362810042458851844001414C688389087F110F14008041A41200126A318114504A4082C4211358121250818501D08104A02426084302211014712272113828116A18211201C08550225062412023047F72054382E18112D86142C24CE7254CF642219592181E421E8C8237E545A1212C384CAA14F12841418B -:80F5000086125C426721439214159416701242C421182FA2196811A829512416D82299188658821B18A4C988126482884F84034485F493175041A012841E21614E3A4AB144A2129724197141F2841AB04E1121672A81238AB12904115042398112F4244129022B21411112161461138622011227118B21860A8A718C423C223022E04402E1 -:80F5800040E86B0822128440042554682413A4128C2801C918514221144E85194401C53188E1D068142401C901412123022DAAA4248713265841AB2C8221118111148210566849C818324C14F4E25890182150185528022B42290486D184D218A52490A8422D12E6684269A2141C433C5244376843B42CA443821123924A4A41387244155A -:80F60000981181821CD41802144112230161818E284100002CB48F04D3423455322354526111264894581761821EA11200402414E18218B422682114821E282C41F421189311A4385494428A622281184B6180C44245C8539028A0122554241A5842B2988634224F480A218002124289321414AF254202400A151448691116C148001489BD -:80F68000C22881501281212D24894182B28241C4114C81424738228A911C0083088484C818222C048C164854E9B0111214C418B3F5234425D824D181F644228B1825B2C9D1218DD14138488711CF1A24D692A64B45D178D828942595F458241D2887452F91C83C876246B84341B126F114818F7182533C49661219E4C4417151D228C81895 -:80F70000A4872386F4843A96D44234924A7B84C8269F6B0565022E5119120447221946628146F1112840082648022931154484382228A45022563422282522A1924C929220028521D12889B42809A180011034488002288480F42FB6004CB41222D12844582815782842B8484858224281165868844C487136118212042144EB8138800836 -:80F780002410123472401163811443021AB82841020012182664C216180284215F980D650260441216024C5241648001111821AA0184444011022328C4184A42480C4E2A84114A0840844E869222882592482B842820B8110848304280054142EC0B412E118D421D2AC04428602120018CA44190542161142508229CB21804212302484268 -:80F800000050811A021400848100161C241202244128C481800141484467B6800400C021C01244130213741112384222209212222220014A71244803842001324880049012204884A1241BA400181901882988A12141414212A47B4C2018012681022422144981542222E025421204412443C1281285048686010016E8828151C2802102A4 -:80F880002484148D418504430210022B2128264892448504184961C4DFF2051B52248430118721448122894291A8168402852452491A721811119141211091842C21A15842253688162201143C4111818222449811862922411191121004244A13342288C7581042481504400180081800148288828888808108C9880489261A22A8482805 -:80F9000022C6224A2228880982238808008002200481280080F2639F80C2241544A84246457115027012314246480180219121618412109244122E41009048002A848204800118182843051324110860284C2A2401644280783B4551812B14205149288190188E118B281524C83885211EE81812A21A82822568288961928844411E828016 -:80F980004821013E8A981BC12898884C28810A1844800221180080221202FFBE41E224B6CA7326B424E4253459218F63A212CF63F13112AB85DF22785143F2C88663728834978F41B82961133E98A5F848824F88F14D118FA2CB1C8BD88B14A68CF252172B124BAE25B18121D1AC18F849154B229EBC4BB44E481A12022B192AF94C28893A -:80FA0000F22C5C472229B324351CAF62F435417014742196198D21CD184FA2D1A85296AFE1F281A8AD481D1918818F81D484F3888E67928F42DBB4F214818C5238448E482D252D2227418E625622C9A28F8291219EE21E121B4947113F2A7983E12B3BA42F29792872B1FFB991263218172855A1213A91141AF218147E46442A65843FBB88 -:80FA8000497123F11441943FE1F121215C565119511525E11CC8622F85D482F561112B431AF311A2343B1A2D243B1819F6C41265F4694236B444343841ACBC587492F2284842482E322CC8611A5181A887444B44482821181C612227282F48CC462344182444B484F85B390018100200000020088200200110080000804884490444400450 -:80FB00004440C491100221008230140028402401124CF2BA4B347F717117F611322F33F35A7B9FD1F53839D5FF1D1DCFE2FB2C18AF88FB898B9F3CFDC9F8EFC5F52E18CD9E5FDAD8DEF1A41CAEA11F15FC544467C44FA6F15D1146E8E1F89688C7E4B7ACAF85F49CAD4F61FE72E41FFBB3B7FAA7A51F6BFA21342F22F26276EFC5FD7BB439 -:80FB8000FF85FD889A2F69D9AAF813B26F61F17A1EEFE6F27E76EF23B332F72464C5F85E46BFAF43F3575777F5BFF1F37677BFB5F3313DCFC3F33E2F6FD1F11A9BEFD6F54A3AAD2EBFBDF9CBD9CFE3F3BE9CEFF25BD6AFF3F3271F2F1AFA3898CD1E67E4CFBEF86E2127A7AFE1F15E4AEFE5F1C6AF4FE7F6989BE7E12F67FAF26E7F2BF245 -:80FC0000B6B61F6AEA42FB6E4CBEB4CFC1FFBEB4FFDDFDA8B8BEB6FD8F7DA62F63F9FE9AEFE5F35E76EF21F236366F42F27C7CCF64FDDF75246F65F517563F51F234258FB7F61B5FBF92D2FDF1193D8FE8FB785C3F9CFA59799F14F55818EFC5F1BE3CCFEAF33D1DED1D4FCBF3AAB91F13CA146FCCD4E4F83939CFC4F4941E2FC1F15C5AE1 -:80FC8000EFF1F11A188F8DFC24BC4BAE1F1BF791847F12F21D8ADF83B333E246F79CDEDFE3F319AC5E722F21D38AF815966F61FBEADEEFC1F31C36EF47F734346F47F74C4CCF46FF2498246F65F51B77BF71F26727BFB7F61B5FEFC2F23E37BFD3F33B3FAF97F5DBBBFFBDFD5B1BBF15F15C1E6FCBF3AE3BEFD9F91E1F7FD3F3AAB97EF856 -:80FD0000CFE4748EFE4CCFEFD3F37E4EEFEBF9DACEEFA1F16A6A3E3ADFEFFF32FA6F2FFCBA723F69F1B6B2DFA1F93D31FFF7F6B2B4CFEDFFFCBE9FD9EB25F71632BF91F931922F63FBFCDA2F43F33C36EFC5F774746F47F77C7C8F64FC4B8570240126014D1384221658141608402201C024842088220982004E241842188129011810023F -:80FD8000980080012200840000241A542820048D24F052AE30821225428891614F22012211A988D612C1488581D4621984731418022841812D42F02442C048C0C2892222C1C228221223028968C1CB848AC2121A02D02221FA42122A44362418124286F1B63FD022F41124AF22F11124E3F41124E7261D24AF24D141F24A9219B24A598547 -:80FE0000AF243924AF3439352F347925D812F925481CF9244A1CF8274A16F5264A871D2E4A96C5DA8F49D2A2F491242CF4912485F39124A7341F49F24E921F49F26A121D24AF149921AB9453F94A9143B24A39242F447B34D842F934488D944FA2F4D569D0A2D441F62E5213314E1B21E3D641B24C91218F44D941A2B45D28AB1443F248CC -:80FE80009153E3147125D818B927D418F924181CF921C887514FA274D8F1244A86D594FD98254D8A1FC9D2A4F49164C5F11124C7348E2CCF327991746852418D951F48B2427B95F84A3543F24A9445D8426B832D846F83D44AD924F557A200800400000000000041000010020040020040010000148008000000000000001002EFC6072D4C -:80FF00001543012216A821C1C01C2A7191C2282CC81430682180D15A92588499C1298426C41185C44121F044124D38650241139284126976195248874244A381B182220116A6948069412142184489F8C8B2142286E2C1921328F42E51ED53224603121A4432141159D22902C66242AE144946742254298423921E2694128928A4C21A74F5 -:80FF8000130224597211180290624D23489D1217841C417824D284D4C2C288CB58C9C9488D21421D5D241E252C21D11267838D131F8142EFC1E236D114D18222D6248151186561222C7168C67A1816F913222628DA12C12439352229F1C8161E26A6B748711124C684357671D42951848566465B214995222716184D181666A48742822D49 -:020000040001F9 -:800000004C608126F49A42EF5C0C40342C004C7244A2410088122C09442A845281308144478A4E24454854858125584841008384042512011A522800282484211789891141A24A44928D14928F44891408EFB10443A221002A81B22681622270220100206844D02A33A1148414114E84241E2524A012C018800129012150321932228C12BC -:800080000481401141418803250442806228DFE90331143743CD132C78490493054E1881D67913481871528AE2D218C4561AE215E2825484A3724C018D14267588E1842242E42268112642F12412C7134962844D9253C178CF21AA282F210482481E84A9B4887328624C43D214351CF04E8A14317026D168A12127822B214A83924A25216F -:80010000651181344E124285332C4C961213F42841144782112A6141218DA18C82018825622210541A5C12DB42D15811B41408212119081A48281B9E464C625444F0BE9D90241C231181C845419420C1281788A1008968422E84182F18C1218C03C5229C4C2545C82518428C12A421132111B112E2421182A68223B2583228AB2852113075 -:8001800041858617882228846183827ECB1491221AA2217029465814001825498442EC83B88623F1812A434296A4128892422613F82244C0144A9112B01B044941C8524AB21892444794272213D492D384618549022B92122C12C422262218047FDD0C895742C354841F44014381012518B24412B94A1212125821498161B2A02481128891 -:8002000029A4248E1280521846628824968AB214F282654130282A21C81CB0440229121131421816C8181C419228478CDF3B4502172111502880D4821282342112825418201402A48289147524D2A512C418407158043028184CEA144202100892214D11288602C04A8C518140AC482358188C2301AFF30A2D431D169149725952414C34D9 -:8002800027904A363173155A5825E88198DC348E1347A18E24CC6643437A8F427433CA2217481E444C3358AF23046E14582D244933A34E2C28C7294F22E118C224A3B8626181257211D8222BC12AC91D8293988B128CFC8151A012284B121618C428A961812110428888C416222D22128D2422852168148428484AC8485A528200C09A1340 -:80030000F8228112A116146281621D484D121F81E4124128D4840484424301B6182A4254341F6C0C2211288064A34112161641D228D224581C3C446224A0142222D081642428292897D2443184212B148D524239D4218153248B4242274429440998212B94481E2181A391885A4832242A04284F670711104218018130425042441110E260 -:800380001231311C2148883C2838904181001A04821A148462188052282081628226C21417848413044028220C40084941C8421F8C0280F219225C427843643115081E484A419158481E224561826A61422324010044101218C16810C1821432102242818201A1602242382628210C223223D242A2818064114FB20C462811220120C45401 -:8004000081288144008308821012513248236882A0421568218C4452948C216241840012281841164431442120045902C2002041081E8441DF7C051641442CF11144244C62223254A7121698434948145894C189512C8149551C4D1821859132C724228094282B148211139212112D28842984C4111364412D18A9028145782238589CB4D5 -:8004800048C1C8C058288CF4AE741449124112881208008241428210624442A8141818142088894401B0218822388C282A880141424C48129124229C828228814801004084810886644C1082018098310089040085448881081420A842288A06992601141800411480052684141461928902202444012004B084328714694A84087FC30261 -:80050000C2A328514184441648041A82F13144184A410C0089A24285442991428113420888E41F48A284841D46444A12413C8846741428C1182420628848471963C8148842A0A1001E21F0DCBA408892418022B42134492846A8A4448022344849314823040021221882881312A141524126C18860819041164111029032181C6841ED810D -:80058000A9C2124A982218269842A0822984FAD78A60641728B554C817CA2E664F54954DCD288F9427F4283873B854D848F41B4D4F53D288E58CC1824AA1441F1C744AF261888F15E215B35105AC71A6B114FB624A5F14F451D856011166F826511B464AE5B2D7A1F732421CA1448DE819F51C4CDAD288AACD6D334F8EE44BF294448F12B6 -:80060000EC4CF1558C142E21AE392A13B558F44F1999F2521B6E122CF82DF213F118CE89E4A891244E1A1B862AE484638237124F818B1E7C22722158AA1F84F5C6619F81DE82B41CE84BE318924316F41218C71987CDCF219122B1275385F99AAA1E11272C87D11918BCC2D128628CAF31DA8428E41DA2E25FB943B211644116FB32111C04 -:80068000227132C8242B41174327C14E434E11F467174E829B484F31F21E21EF12F49B64CD38837234D812F681C8A14F1278B235294674C8E748D3A87822E422F32331CF72D243D221D2C2723D6E4143F441346AF4ABAA1E154B882F3CF322CA3AF424188BC34C91122EB84951A42F8249016901001820024100400188C084D048084C08D7 -:800700008504008584110881004302220020024948382400000084281220180881EF8D4E7263E181F326245F72F65AD94F65F12A2C17717F15F51212EF8DFF4A3BBD113F39D89FF28EB4AF9DFB6B222BCC1FBEFEB7D36E68AEC13FB7F48ACA8FA6F513531F36F69F8ADFB4F4DFDF8FA7B6FAF7D85EBF29FE44463FB3F338367F39FF5C43D7 -:800780007F77F77B2FBFFEFEDED6FF4CFBF9F33F2CFA6B4FBFDCF1CFD36F64F5EA626F42EBB4FDC3926BDC6AE48DF824245F934DF165657E726F43F23577BFB1FD1B53AFA5F61F57FF11F593D3AF8DFE6343FF547317F7CFE3FF32F77E79BFBAFEB7FF3FB7F777793F97F7E4ED1FBEFDEEEE8FBEDCB2F4796BFFAFFEC5C3FF75F5F5732F52 -:80080000ABF7F2FABFAFFE55773F27F731362F7BFFDCFF7FF7F77A3ABF8EBDD1BFD3FFFFF7BF2FFF5B7FBF14F15FD3EF6EF5AA42EF42F7F49ECFECF9DEDE6F4FF7D43D6D16DF354932436F51F53737BF32F25B594F65F37A7C8F63F75F716F61F3DAD4BF3CFD43793FADFC4F48EF45F75A79FFEFBF7AF76C6EEB55EFCEFE6861DFF6F7CBA2 -:80088000CB8FA6FC5B5BDFF6F6D7D24F36F597D74F77F6F6744FE5F5F3FE4F6EFC33738F63F29FBBCF57F67D359FF7F77F77EF65F57F76BFEDFDE3EABFA5FFCF5CFFFDFD663C8FAEFE36BE2FA6FF66376B92AF86E58BFDACBCCFBE035F67F73777F773FF77F15B5BFFE7F75A6AEF63F77F517F7DBFDAFDD3C3FF95711FFEEFCAFFBBFF7EC2 -:8009000079FFF2F5EFDFFFFFFF7F79DFDFFF6C6DDFFEFEEFEF8F36FE525BDFF7F6BFFB5F3AFDFFD74F7FF7D65E6FA6FFF3FE5F7EFE33721F63F3FBBFCFFDFF7D7FAFA7F76F7CBFC7F77F7CBFEFFFEBFADFA4F5CF59FFFDFDEEDCAFAEFCFEFE7FEFFD7E7EEFCBFBFEFCFEBBCFEAFA3B12A012D0144118840416286289228C4481048C041EA2 -:800980004828110010110842809281A082B024018880014F220926A34120613282E088440580C421124C22684482AF9F02652121B2113228112B14116334112111A929511213912250524F81942A13C214458A4AD218C25287512CE445421AC8C21B25261251248C7268014AC1282661882115981AD01AA141A92AFA421282441E4828842B -:800A00007F620B2D431F41D228F111248F24F11124EF24D141F24A121D24AF349921AF243995AF7439A5AF743BA4AF3479B4D812F9B5488D914FA2C4817FA2F418216FA27498F1265A87592D4A8F49F2224A1F49F222431F49722EF39124A3F69124A3F48124AF36D1C1B24A9921AB9451AB944B43AB944783ABB4478A2D944F8284F92430 -:800A80004A1F5A046D4B1B6189D541F24A121F41F26A1215F44E1219F248931D248F24BB94724833A4AF2423FA4817B22D15278BAD142E125CD9A6B818FA224287586B5287592D418F49F222489E2C6F82A469E72213396A1F49324A8E242F2259C1AD9419B24A9B25AB944B432F4468832F446B8AA9B126949A4B524F2C098282000000FC -:800B0000004004000000000000C082100200140000000020010000000000004001FFD8076956238416249138460A148534888283C8146CA18410623247831698244CA282652802278483B54AA2413024841B526948343A4B81222815826484A6E989E624981815929838611A82A58721460C26F6851180B1941281D284D46194211EAB16B3 -:800B8000EA3827E5A2012FB8D418CC2A1F85E228314C2CE814B288351846283444EB214B122DA44B81B5961823850E222F11C2842792AB18AF29E482D981B222C1424009C81744844A93448742844B941A723431C8BF254F62422F3C130887442C7168D12263118D348A817222546B57812562111612D52EEBB164C449B1B8C44C4976263A -:800C0000B2487A86BA4833461129C2418F144134668B213F22B98882BB1192614698816F8239812783341AA41248494168A9CE128B1226E5E1D8F8055844141E24181D6C708158281B48A3648989A8494AE88AF44822828B2480229B2824008391145A928487112D1856E48288B22238116948CC128CD42A48B822C168428C048AD458488D -:800C8000D842A3424E342A449444182AF4C7DF1014110880121891148001180000221840010050221026050040E248322412490180020080012484188001180084005F4B0C12281445B11192121612541825B1425882A95C622C2831136411841AE44274111418A2243866788273645822283281002D236019A991818125D4186112894806 -:800D000031183042164488028D3286A81449045EAB00118130312343581217C1212B41259218212728701281321240816451A490222CC34A13D9224202328426C422114971811228420217811C021484A522141488028B2129A814006F6C09433128464105204104118845A8864120014111814E12490212C0C23024424D488002308A41FB -:800D80001A162221611884440083094C01381212800184844914F2189B8002408232288D421428208881A4812C280880824161442200004642981489441492122C0112CC8308260865812223089082901E168828CC48814C8804CFB2022721269121214134E0A201254281C411341124264218D86802814048C8222E18810022800429C290 -:800E000064213522712448812801241528245418812A28725842483434484332288F2F0EC016100C1810044AB128048490548C22612582218C84414811042400002A4188440400281825140880088A21014820942620A3842840F43F1D30322D13504825D42941584A212931E8901918799C222312682A8F2152814B142648180C2312125B -:800E80000A83C6228429A5214E2423512218457823C4885321A2A123288541417814F828528963888F41A64B48418D241EDA004C6232208222B411228254121A2434811886C8121A141A244408112032188C044901492144421402CF12A1282A4148020085216824866824A2B0843442504843AA24F0CFF3000044241140048041088420EB -:800F00000141000000001002108801002C4114082018088004000000000000842FDE0823022D2480C25220612224002140114A14123612414142842424482C222434622410460224D082120812AB1881502848230412238101AC1294449024E01A05282042442201442400C110181142141614424204812440420200182140224102000018 -:800F800000488502008081012221002614F2513D508A8B442F442424324121182824474145A6222A2292180021184512D222A4111AE129A88CA248482F841201618558A8CB444E4A4E28848283D182490845D464B424A6222E12001048D4241452221E18360F2002110000000020410110040000420000008004002410020000000000002E -:8010000000180000F02EB140C84842484004240040C4262828000000460A2D18189882880040D325424148CC48484821410025081644C4241A82020010082490122FDE0284800440022140921144122A020080414802218021840C104804141054888004008022014084A122000000242A14C248EFF80680040021202201448052210000CC -:801080000030228118800810024001242608682400000040042824000000508280F1925C4004280044848011221102000041400800448100000021100421200200004A0112000000000000F0454810B848242404241002144130262213420200401248A241129A6A888240241115119128818364244200000041414322A242182100502800 -:8011000040A2416F1E0984844C8404000012448544A424280040080027642118188888424002142603164898442C0400000085448C8202001088445822218731001800222100000000481200008100800200401204290240022328280200000020040000008044F4D1688001004001122542022181100200004848000000008042041022E6 -:8011800001000021000000001044088014047F3C084122408112114A022CF112138112242714000000878441422044084885622121101424712262282100008400104802004184818C4488B444F4D9E5002002244504222B1100106A1511182141160884688984342822420000446F428242522212266428290230225A01120000000084FB -:80120000904810F8D8CF2021410450222429411203212400004450884800C10000214445E4240225B22212042100414002801128212584110212004A12046F74046F22F212222CB11221B112013C512229E811F111119B988E898F84F888418F8424F4414911489558884F84E444F4244449A222222E2480524645E442F222222F2182B168 -:8012800092A1812B99828E922592821E111F11B188E998F848888B488F8424E48404488558884F84F4F935F026226D222E123A21311200259282BCF1131119ED897818F888418B4442141501C485C8688F44D44CB444B2642222024054444CF326226DA22AA1131AB8922808259282BCB11391D19E8887818B488B44424608405C888CF617 -:801300003E450000000000000000000000008028080000008882000000000000000000000000BFFB0F2084A4444A2404202424040000008200008028080020280800000000000000000000000082F0DE4420A444000048004220040000202808008028088A280820080000000000000000008008800880F842388004000042000042000045 -:80138000808828080080088A880800008282000000000000000000820082009DD80000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF000000000000000000000000802808000000888200000000000000000000F5 -:801400000000BFFB0F0000004842800400000000000000800820080080080000000000000000888A88080082FFDF0300000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F0000000000000000000000008882000067 -:80148000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F000000000036 -:801500000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF000000000000000000000000802808000000888200000000000000000074 -:80158000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF00000000000000000000000080280800000035 -:801600008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF000000000000005A -:8016800000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F000000000000000000000000888200000080280800000000000000000000D4 -:8017000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F00000000000000000000000088820000008028B1 -:80178000080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F0000000000000000DB -:801800000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF000042424200000000000000000088820000008008000000000000000000000000C5 -:801880001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080028 -:8019000000000000000000000000001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF000042424200000000000039 -:80198000000000888200000080080000000000000000000000001FEF0F00000000000000000000000088820000008028080000000000000000000000F0BBFF20044A848404202424040000000000008028280800002008000000000000000000820082002FC602424200004848484220040000A088820000200882820082008A0800000047 -:801A0000000000000000008800AFAD09480000200400000000808828080080088A880800822008000000000000000000820082003F840800000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F0000000000000000D3 -:801A80000000000088820000008028080000000000000000000000F0BBFF004200004A0480044200000000828888000080080000820000000000000000808888082088F878230000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000080 -:801B000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F0020242404000000000000000080280800000088000000000000000000000000F0F1FE0000000000000000000000008028080000008882000000000000000000000000BFFB0F0000000000000000000000008882000028 -:801B8000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F20A44448480042000000000000000088000082000000000000000000000000002028F83B1C0000000000000000000000008028080000008882000000000000000000000000BFFB0F0000000A -:801C000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F0020242404000000000000000080280800000088000000000000000000000000F0F1FE00000000000000000000000080280800000088820000000000000040 -:801C80000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F0000004A040000000000008200008008000000828200000000000000008888880082F075D30000000000000000000000008028DE -:801D0000080000008882000000000000000000000000BFFB0F0020242404000000000000000080280800000088000000000000000000000000F0F1FE2024040080042004420000008A2808000082A0888200202808000000000000000000008008F0CC3D80040000420000420000808828080080088A880800002008000000000000000012 -:801D800020082008F0E79E0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF00004242420000420000000000008028080020088288000000000000000000000000F0E4B6004A0400A0448084044200008008209F -:801E00000800808808880000200800000000000000000000888A087F7D0B00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F424A04008004200442000000828200008882A08882008282200800000000000042 -:801E8000000088008800888FC101480000200400000000808828080080088A880800008200000000000000000020082008F097750000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF004200002024042004000050 -:801F0000000020288808000000800800000000000000000082828200F05842000000A04448002004000000880000A088008800002008000000000000000000008888F06DAC20040000200442200400000000002028082008008008000000000000000080A888882008E0680F000000484200000000002008008008802808000000000000D9 -:801F800000000000000000888288FF330D4220040000484842000000A0888200200880A8888200008882000000000000000000008008F0871D000000A044A044424242000080882808000020088220282828A8888200000000000000002028282808B05F04000000422024242404000000000080280820088282828A28280800000000002F -:80200000000000000000CFEA0F420000802484A4444A2404000000000020880800820000000000000000000000888A880882005F93024842420080A44442484A0400000082888200008888822008008028080000000000000000008028A8885729800400004A2404484200000088802808000000880000008200000000000000002028081E -:802080008A8808BF550B0020242404000000000000000080280800000088000000000000000000000000F0F1FE00480000484200480000000000008820088800000000000000000000000088008800881F7A0F48420000004800000000888A280800802888A88882008800000000000000000000000000882FE50B004A24044A04000000AD -:802100000000000000208808880000008882000000000000000000008A08F064CB0000000000000000000000008028080000008882000000000000000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000000042004242000000000000880000000088000000000000000000208F -:8021800028280800ED4A004A0400A044004848420000000000000082800800200800000000000000008008800882885F8B0900000000000000000000000088820000008028080000000000000000000000F0BBFF0000420042004220040000000000800800000080282808000000000000000082828200D0330242420000002004420000EA -:80220000008A2808000082202808008028080000000000000000000088004FE20F480000200400000000808828080080088A88080000828200000000000000000082008200150300000000000000000000000088820000008028080000000000000000000000F0BBFF000000000000000000000000802808000000888200000000000000D6 -:802280000000000000BFFB0F00000000000000000000000088820000008028080000000000000000000000F0BBFF0000424242000000000000000000888200000080080000000000000000000000001FEF0F4280048004424A248404000000000000820020080088800800000000000000008888880082827F4F0442000080A4444A240476 -:8023000000000000828008888888008200008008000000000000000088000082829729202404008084842404000000A08882000020088A280800200800000000000000000000808888F848F280040000420000000000888882000088A0888820080000000000000000000000820082001F3D030000000000000000000000008882000000D2 -:802380008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F002024240400000000000000008028080000828288000000000000000000000000F0E95120A44400004A048004420000000000002008800800008200000000000000008008800882885F8F01D7 -:8024000000000000000000000000000088820000008028080000000000000000000000F0BBFF0000000000000000000000008028080000008882000000000000000000000000BFFB0F800400000000000000000000008A080000008882000000000000000080080000F05A8D0000424242000000000000000000888200000080080000009E -:802480000000000000000000001FEF0F4200000020040000000082000080082008000088000000000000000000000000821F8D03424200000020240400000082800880888808820000802808000000000000000088000020F8A9E20000000042800400000088828882008008888028080088000000000000000000000000888D3D80044863 -:802500004200200448200400008882000000000000008A088200000000000000002008208808DFD807001C0129044528819441492163420024281662410020B1162484942218A981094285A486424280411844B824042410062604442C4266418721124A2221A441EF494F41B119528299548587443AD42ED624626228C08186644A6782A6 -:80258000446B422CA212AF219618488125A6122C81686884F6B8188A1C6CC26087844289654483D184F6A2444B161AA212833184282524C22243622683117A1812F8F67400121C7141420128182113042813880840B42214921240082744200210648168224664420080014954484A418808211289020061F012286084811A34481F624C91 -:80260000012C02848524E441146222446983210282812118127048228144686442230284218608806846B01802841248CC42522418122212886400182004218112AF760340012044082A1404001044322400220000182001881820A11881830400000030642A44C424002002504244181A2201F054CC401118084014482C24024004260456 -:802680002844412C220312240016622182829048821028841428140800A0420041419024282230222140024FBF0A000000000014000000000044000000000000000080020000180040012180020000BF370D166111400824001011088005842C034426088C648948212184842F824428431818CA124C0482448100702211A81422100849DC -:802700000241A01258411668267F574302211AD225E2141215943D2B14814E921C5822248412E9A8212456812A022E88404264444941D2484442248484119222846128A443A1146312A11413015614D84A032A1428882418F86B3D24172114284D2B624511D42DA241118E188602104AF8823829413469882A94982E42101244EA8304279E -:80278000442485C248121E442012148802242693284E115A92118460222A0190188A61448B1846F27E680012184001211240682411241A041244222412288460884012984444848B21844420542290828461502816A4144400004E14455848414A2222046082AB7C20A221142822164402229262161848D822D184C48141893324001001E2 -:80280000411062552D121AE2224C044441502244221E48432481A1480024D04AF81448A1412C0188484482BF280700248761122FB2A421ACD425C54A7062423192848A733A72B893C427298C6419484E2CA926F243282A11C8AC453A1C87242AFC42832E92188B12864806AA914E4F28323C4A9273214442E022648643D248B564E18AA11D -:80288000422CF4A35914222211C42127E4182314B488042B521423012F8D721AE281F288624098114014082C8453E128C5E24204828E421E822432822825B82491182E8689C5225224001E4C26CA44282B14CAB128C524824F1606200123A3211B2122813B1629B14212186A88A911C4A147182D14AE14238488D42926D624629280D56876 -:80290000A921ACC94C2F24524126245128851424A5842744188E24481D2210F44A84304226C814453824824848BEA7148122438421C1682827418902124563214E2146285A8243111164364688A168B6F84281844C220210110812BC1524816486890821124E121B814391182024B248880822261238C4827F870C89015619410281111193 -:80298000211C084CA42118800388708232842224128CA814421A38481A1636C1B82286088C924221414AD241C58241A0422584C6182C04414341B442810421AFDB076603280090442842262AD4822608441841812A11DA4801141180426121204338484502422818141B82801228B249226282814840022061828889088B12622F640456C6 -:802A000031229F4241612142CC14B5287422EA1954832384C414B82289C192412F58472C632489726299486AA1188994788D44CC88AB12114931282D8127828D242E4847168F13F452248B284E184608460AC6E841F818242636C8428AA682DFBC03220012C02826A2211400682C39118304AD14411C4218A84814138A08165124282A017A -:802A8000214221422ED2C011284282241288D01281921248182A1402208843D848C1429FF20E20826181222C022C04D0142814082D1888181383488899518B96154C746182811A68828A3164928C821831B281A187442028CB4432212004169822282C212104E04122F244CC3041124934414816181111B1619812283188C8239288A01231 -:802B00004A1882080086C828162A381400225B48282E444280822898288092C381288E1810840523382880111418F4A9CDC032C03800111D68281A068C44A1288904208289040030622120A21432E08234AA2182112884602144286244004C0500489042802824A82422F016B30000288100842004A0142144882314545200321C04A621A4 -:802B8000C181008E4640041D2612448086081606004188A16142499818CB18724344120482248F7A4611C11810B851921246C241195482112F82B9858431221829344242298704002D824224882424804162812C234162A18422124D483024008A2114B888052130220000146FB10E20924214C02818128411230A25081A482861121B18B9 -:802C00002412143B81A6B14941B14101230D1885C2584213848401498251481280E86886E142341A3880642287121880312429011FFC0744428458410041200142008002100800220080A842840000200800888229044130114A0210028881002B18841882443F270F2C4302301824388C1182C22889C8148C6584182282848C4122024A22 -:802C800021249242208224820412481221124846882A81AA1CE04872529824818022410840944200FF9C05460848100181222A014AD141012800448314026A8814C2842E18848820942884129C4602848A822641C24A642400814486C2320046046416021229A442CFCB0F4E223E228C23E341F528112B248F3493289F22B16AF141498DD8 -:802D00001816A244832162334B847E42244E3116E21CE488F44829A3E32CA113474827831E448F84E67CA3824D15A18D122E1A8F69FA824E8C63432F28FC24B48FA4B122E32A7152784C12B89C7222D22CF442824729181C82F693CC1416B14231129D196648FA19182F41F462114E219EC18F22F9D241A9B1A8A9384A85FC9941182B7CEE -:802D80001AF4C921CB823756241F14B538B482E48494488F82B332B814B451A5659A22F19A84B01CF376864BA84B361F3DD442EC84F4124889F19288242E4A38BE141AD4C2E146F2589426F68B5DF0215481C14AD419B212E2127421B811B482D4C1B292D245EA8C7416EA22F8922C3FCCD382738AA88113AAD21F61D228BA31CC22A88FDA -:802E0000A4FA28322C7BC4C2129F82F8822326E222ED8282F644486A984840044B2B8F21F84C84C0547AFF4214878D2982014B41A241BFD2014422442244402402200100412840040028504880024A82E1440285044644614440044001A0418004004110C482458848A88484F0AF3C346F45F57614A74155F5646C5F62F3434A65F74351B4 -:802E80001F3CBCC2FC41522FC5FDC4D6EFC5FD9612AFCDF5DD5F7FDEEDAAF892821F18F881D93FFBF643E91F2C751BD1287E12E8E8FC4E5CCFA4F696B89EDF6F5BF9B4E26F884AF286848FE9F99193FFD1F82E1E4EA42F2AF2432189F34848A5FC88AC6F6AF96E48A6F4921CE5F8C8CCCF8AF8741CEFC7F67B3F343F27F5725AAFC3F225B9 -:802F0000258F26F61B33BF17F47D373F34F4CBCBAF49B911F7D9FA2F2DB952FDB6B2AFEDFFDB9B3F3FFDEA8A2B883F18F8A1C81FF4F7436BBFB2F43B63AF21FE92AA2FEEFED6F66FB8FAB29E2FFDFFBEFF6F29FDA2FEAFA2F23EBEAFE9F99797BFD1FBAABEEEE46F6AFBDB9DAF26F3BAAACD122F48F93E3E6BCE6B6E2FCDF7C8DCDED66BED -:802F80008A4FC7F36C5E3F8A44B111B132B63CF2212C9F86F679627FE7F422223B541F21FF83841F31FD52F98F2DFDDAD86F2FFFDAF4DF7DFDE7D52E822B883D819F98FD2DFFEFD4FE61C3BF93F2687A2BC94F2BFFCAFC8FFDBE92F7946A3FD1F3F1F62BE8CF68BA82EA69F99292AF8FFF36267E343F37F25345AD1AAF84F79A98CF89F976 -:80300000AEBAAFE7E6A2792EF2949A2F44B466B7ECF8647E4F774BF13536AB73CF83F3312DDF76F65A63EFD7F4797A3F25F57BFBBF19F991F19FBDFDDAD26F4DFDE6F2AF6DFFDED7FFFFFD6ACA2B881F12FCA9D9DFF4F64F6F3F32F47B6BAFAFF7F2E2EFAFFFD6FA2FEDFEDAF2FFADFF57733F6FFFAAA2EF68F8B2B2AF6DF9BEB6AF8FFFC8 -:80308000B2A6FEF47F7EFFF3F1AFA6F75A7A8FA8B8D6F932362FEFFC62FAEF27F3421EAFCDBD66B7FCFB644E2F8E0C212002148C04841484144041088C04190400100881002004281008422A082A014B82A01284800496081A0484200148421220F8E46BE0188192121781241A4283E234A121266289881A941290323658722688B1118446 -:80310000E22A44E52264148CA121252AC58A4AC212198221918A12A724004C54221D246E12502882241AA4242658228011A4241CF4DD65E022F5112487221F417268F21124A7361D24AF24F11124AF26D981F24A9251AF247924F84AB343FB42B747822D914F82F448B14FA2E454FA264A5E216FA2E41DF2225A8F59D2A2E44DD2A2F4D120 -:80318000242D431F49522A1F49B24EF19124A3F48124EF24D941F64A9219B64A19F54A9243FA4A924B4A2B94478A2B944F8A84F9244AFF67092E5A1F41762872117468F21124A73615F448121F41F268961D288F249B258F2459848F342BF3422345D812FB2648AF14EB22E114DBA6E815F2264ACE216D588F59D296E44D52A6DE2C6D4B85 -:803200001F49964E1F49B24EB19112FA1164E72419F64A921D64ABB459F24A9643DA6AB1A4E44471A4F842146F8AB442D1A471A50C0048000000001200000000400800800800000000000000000044000000000000FFBC0F3C21C1220028485082A2836418809C88281C1409AAB18A91488A1128025A2281A85242468492188848323C41DA -:803280009189838B34581C21622D2823292418F22242288A5226812E445244EFB30366E41872187414B218465182721829019018253112232808AA413824126022E02402A95224818C4198C8482B24908284322C44B412A28246941626C9888934142D4838C31988848A21691A225F9E0653353189C1448B2424813A341288C38428235C6A -:80330000828A8218217888D2288A25E18102CE22781E284398781AD4C1E482C8188B282C24CE1A1611718AA2618B3C47114CB29DF282228F4224C1C2182D1C21822D84AD124B145843F374F36022702422911219220485A221105128112C0946418823C314848824280021101208422C24041214288B841E240046222144889944A1224A92 -:803380006A824A2202A2A8F0DD4A206241181140F428121904848004000013C226A64831941C024248C0482845684823229584B0220821009E486911314A8230118502299144002148004C029E432054218C028383058D224F84B343EA81B22A69399D924F88F112E249FA52861E881E42874A89E28964486D8829D24AA7212CE411384A53 -:80340000C31536382F4215012E94CF28E1428C92C82D446C784422231E9188842998A62F45B2A884FB6284CB148B85829FFB0330118160814A011934423984B18AA6188C7982841E96262F2891888CE24398584592C846325418621617FC144A4CE429624528244B1296C44436B812D8123484C63412321548688142616148A84B488D1452 -:803480004A0A4F73032A44A6121122448B12A3E2C2618A26881111331823A1281B1CCCA2433D8484198A189422899268D082682C22124528D212088885822A7C4418344A21281C0C2728244C28EA24E38228952242168CF8D499B018048746C02C49A24183C228442DF22416B48142981AC3E24251848CA5214E281D288531122A8832143D -:8035000040A8184B411CE821E41264AC1632289AA4144C29648219C212839821928B24C6840121228D242688A58129F875E950282452221A1442C8414850815A42D44262411302818A34223D88981223A4214C981483768C012827A21C2518181154248D42902A88168131641C4604396B8140CC864824180029F667A8106341501260A12B -:80358000261446A414008881209482212313040090C4944221562295426042A1243822882200414694428418814004232824C6880080047FD24CE2117412C228271242E7238B42CB428D4449E4AC6222161238181F22B528D868F18442263CA28B251922B48442E441A425178D89B412E644F24294A126B111D22262EA1E8A122F882378CA -:803600001482E784C22826A8814E854D5829C84C47228998242588A549486F9804409414B02C014D121122122D111A8438856484642289A3418D11828951A14217822865489412822D18282C2D94C2160428424443D4814661412F14194162818812248AA424843800A2FF6647115482142F8205C4406414AA81C848448648410C84822381 -:80368000129141448D644A32112254122DB21968828E12C0324901218C48A2822632844E928E48C81E828064AC1296642418328148C3B648D8ED4802804404421052424489830280C12240A41286648190A21C1185C88412A64844280848481429022522044418005082800120843944202302F063CA2062220022AC542818160840B2441A -:80370000012C084C810184284C2841012C4622C64C882085024A288D39162221C30122448CB218A22942862891A8848A01894888381CB81FE405841285849448284C84020090886491149B8427224641B1426812C1A012A08111314812245028142004561889C441181144149088001024220844844841FFBC088644844304001D2E46C4A7 -:8037800044A2842B28A042442148842901264891442082442841543885222148E24482211862812AD126088088984A226048208464822081048D21CD5C60111C11010022601289216142241C2AA1822AA182428B24258E912221488023D9239268604285D26103148A8262484DA288C026A86D121AC424184A533822266282A0424218A69F -:8038000002EF7503004008100A2488422B14428CC4848482944110014210135114001621026884110020211464818100001308221A04D042840100413F180D482A741C82A3422A9114901848852491184A1188D82C2608A024A0412B8286288434E24A18816244881EC422888088321489E41489E8110454248D41824601872160884800FA -:803880002C81F467E2148C02285048412A4428C22240044902311153948B4F1481B144110218658A18049042C04119A218A485C148601800408812684490284187241028C288432C18026F2443313517484D35CD284784469422D7A23F13B212B8A29868B6F45DCE4E118D8C24CF92668D6F78B22245E17AF4E915851164261F4CB2A1F642 -:8039000025EA8D2187642D22DFA5DF33E259FD22B2AF48EA86F14D2E2B164D836F49F2CA234F88D61BAB65B7128B818774AB2785F632C2892C96DC83F42423EF4EF529EE003A63225848CD28499112C3E44AA41427824A2428D233B2F7D16311B33854811F84EC8491661BC23DB34F11F224D38F21F8C2143B121E487E4826A145456281F6 -:8039800016F288A62F11F89CACBB4889F811D4A9B8C424C8488222D823BF48E14FE281E38522D8C8CC225F9B032D6427A4978127478B223E428FE6C424CCB54CF31C285E12ED9821DFA938A48DEDCAD83CFE4118CF3DF234344B21244E246E482D5427816F9461114E8A4BA28A7982A49A3B241B4830128A85E447A112E04261A1AFA2A915 -:803A00009C4E585F894CD884E58852868BC844F85AC1884F9E0B40011400601220A2412240010000008B241381024A921128F04824400446044422152C92412612612215682211221D4810C4224190442843A824824AF267B7241F74F6662EAFE252B33F3DF77226AF444453EAA7C4CD12AB179EDEAFA4B59AF97DFFBF9FFDE8E13F3EFC78 -:803A800062BA3DA94C7448F86CEBDFBAF88348DFA5E434FC911147D1D7F8EF68F4EE2EEFE6F7B7337F71758551A82F1B739CFDB537CFCDF754D51F15F5E1A1DE9A2F1DFDFB95DF49F1DDFFCFC8FCD4D42F4FFFBCB4C7484F4BF43414CFC3B5F4E69742F361636F66722AFF4F4FBFB7F77A66AF46D64EF21A1AEDAE2FE9F93232AFADFF8AB4 -:803B00001AEFD9F97FFDFFF5FDEBE9FF7EFC6EFE2F32FFA7D44BFF4F36FFACAB7FE6FC7F7A5F72F6973D6F5B7D89FD8C4F2F6CFE4EEFFFFFFF77F75FF9DD66F891924F55F5DD155F7DF7D5D4CFE5F5C5855F7FFF53D22BFCCF19F9D4DCCF8CFDECFE4FEEFBE6B4CF88F97C44EB914F55FD4E5A7FCB4BF141655F5256E9AF81F1D4784FE754 -:803B8000F66A6C1D2BB5FE8A3C8F4EB568F1D8F8DFD4F59998DFBEFEFFB9DFDEFEE3CB2FA6DFD7FA63589FC7F76CFF8FBAFE23C8DFB3F635671F99F3151EB7FCEFDCF4EA6EEFE6F6B33B7F71A56AD5FF3A38DFC5F5F736FFD5F636B6AF8CF5FFBE3FF5FDF2F2ABBDDB9DDFFDFD6E68EFE4E4A7FDBEB4CBAA4FCBFD365C4FCFFDE47E3EA48D -:803C0000141F37F73767B5FF5E1CCF87F77C66AF46F61F35BFB1F116B6AFAFFF7A72AFADFDCFDFFFD9F9EFE9FFADFFFFFD7FFFF566FE5FD6FFE7D9CFDFFF6CEF8FBEFE674FFFB7F735773F99F3F6DEAFBFF1FE7EAFACFE6FEE7FBFFF75E6CF2BFB3FB7CF6BFBF9FEEF7FFB56F66F2BFBFB73EF7EFAF2F62F2FFFCBD18F1CFDC4D6AFAFFF31 -:803C8000FEFEFEBE6F4FFF2838CFCFFDECE84FFFFF646E6F290E2302002C011812248A0484249A041309112411004282282110011142214223022100008449084908E0880484E088041608120042B018062F1211B12801181E2480D212818281921AD07831B4E083D442F824482D142AC4118A042E4A562422B1222425224138412F2201B9 -:803D00004B12F026121A746822316430224883246824A0A422230428488922F8C1C3E022F51124C5F2112483F61124E7261D64EB161F41B26AB981B24A3915AF243924AF3439242F147BB4F842B14F8BC4B14FA2E414FA244A1E216FA2E51DF222CA9E25ACEC4DC2CA1F4DE222FC9124AF22F89124AB861F49366A1F48B26AD141B66AD994 -:803D800081B24AD985B44A3924ABB44B42AB944F82B442FB24484AFB244A4758F024581E64E11F41326A1FC1322ECCB4647111FC6A941F48B44ABB14928A3AF4488543E3147A94B842BB92C4A42E5A4EB44DC88BA18CF55825ACFC88253CED45C28A1FC5A2C21F41B628FC91248B821F4936681F48B628F1116C8F667811BC48FA1568ABBC -:803E00008443B148BB24B44AF92448ABB46B438BA44F22B52D0C86288804000000400440010000002501408888020040010000000000004400008210080025011F86014723181024311481100885B181A41882611E2218611100C140026441838101828394544828482AE888819982A6A461288C2229A8344AC84660C2484922F4882432C2 -:803E8000C9A24246F93F9A00434A3A1881222CC4229A2492E289914841109841322B18C1638A2C19289C62D02222A84246A2128A322A1E84009022899418818F21A8842F2422048111CE181048820382488611F478DFE04172A254281A14A8124223924A222D6886E1421D14C4383CC5142B1841672A843012824F2412E4A388810637852F -:803F00008E14F09824486AC8881622E481A2242CE8848839842AA14244830583C42218CC6A2A49E618A441330E2001C4184481A018C0811E4881822110224241084B4898A44221102208C2224AF2224800C0128A92888694181E28268236424889984129782408414A0218842845F8524880614190213011214C123891421142901200480A -:803F800042260884100445084889420226020021131802A94828B28122220890188E4829890416182A886282C0485FF90962112081048410714204E28285C14C6E822E88272B3256A26158C22C4282924820F812844C8D84F29248214D2280322638248C49022C82B342828431442CC88880C844421826042FB60A6814800250824C42A11E -:8040000084A08288111822A9A8162B524AA21600442502204458228A85C42246022D22142952429A42B892C22129021602848991122488128628A8423024F01441206141301148130110D84321344142A44784C2222908AC0189A58428D084C248206A494426028C0944822052821028082A38224AA2414AB844281C582890446083C0483D -:804080002F180400178450820014524AA22150844C2284BE22048CB828210A18301C884142214018082528E48401888864AC0881284440489422803884221C84012A0829F9F42F243A34284624021B1242450281C442218E214115143C642810E241022928A18458818F213828184862425082A0212F82041A821E243112482B248741E838 -:804100001A242302A8428381A5212D22CFFF0411182A812141321C6AC128601880281408800144418884228AD48482624243A4146829011044824164213608109288428902100881403C1922E28142F03556246621538540C8228D4449C148221BA1708268544D481748658883584882AA31182A684887424B4287428E585E284A93486625 -:8041800032484984311232A3E3C1A2288A16B6381884922A2C91C84AA1924B288CE28984B618A687522E82FF4E0518A0121A9212138191612B128C14880482A0424A92448922D3421204304848122C44141298120090429084822562812184241A34484881008410842281488802AB8C2400848420821106001800802405210028C8450290 -:8042000010220800800800901200604218308842181810080020088A014E285FF60B800242481223B4180440382888B0422208424881504A850281484227444E8C8F22388848301400814188460A81842C86818168A88A876181C01489811484A4124CF82CD2904410B41842384884108202801104282122C0121848304800428B1220048C -:8042800045120425082100008038180080042A0482A04842004A08AFB502163914604416045489C6484C5C128121288842884298284E8420A4214968C24002206488208CE8842828081A222884248888C8C4802A98944985082898891A82F175DD004128412260216024002542D8224122C89220822428880200803862202234C420048484 -:8043000021800448188181481828000048201184012F84F2D1F68004128284002222A092888888CA01481A088820044AC82884880029388428A02420248C04A0488282582008C280048A028A2282322229024FFC4982028100282800264828024004222041F822184449D8A402406484C06C21A40029480C20988C901821800121905885AC -:804380000260214880149892884FF10496B4A8C1142828484824834262224002242C022722842A04A218A0284A02221082820182A0122122000042000081203884428200224248E05C028C021C044D4116120445D1C288C44418280026042EC46046842902184CC884A08212424446014284800488480000C064448002C044408405254A8A -:80440000F4CB1530224B28807214AC664D168D42C7124F82B26999A889C1862C842CAA968986C9848EAC4B1CAF6298246A32428B43AD222AAE2A1882248A082B8820E86108A28A048B88A091521AA8E16929C59483A2284AA279684AF4974940E48AC13C4E188F1654283932524E422B8CC0422998122BA82F28A29429644FB0A6B26484E9 -:80448000847682F88844442F24A846644CF8CC24414BC8215885AA1A8828CAB814341287291AA1818226A4446628A882B082B824552466F8D812CFC8F3C8CC245B7516741CF12C44281AE185F424282D2885D6A272326829B04421F612662C92928FA6E68515BA28FA44188B824598448E2C8E84AF8CB14AC44A2F44AC344E48E626140625 -:804500008F8C847448E884E98645A84C2B648FA8BC88318816BC84B4D4A44542BE5489A8822B826FE90D114115081141112A9141180000411004430120044430487018041A025A12A421E041021E24E04116C26480128296129012482D14222D14845C4108003F1C48F355511F17B115E19276A8F951536B776F15F44C796F48FA9DB1CE6A -:80458000B88F88F994944F49FB36344B22EEC42FCBFBE8EE6BCECFC5F1C46CCFEEFCEECCCFE8F17C3E4F46FAB4CC8FAEFDF6DC8FEBFAD6C44F24F57A744F4FF894AE8EB44F4BFFACEC6F4CFCDAFEAF4EFFB89A8F2DAFCDFEF2AFAFED2D7198F8FCF62F2DBCD2F5F4AC8F8EF8BCB85AF46848CFEEFE8C8B246F45F531755FC1E153F71C191C -:804600005F35F57B71AF17F64E797F58FA16B64E32AFC8AB889AFB36F46BA2AEC4BEFCCFEFFFFAFEEFC5F5C4CC8FAFFDEECC4D86CFE7F734366FCBFCEEDE6FC3F1D9CF6F4FFAE4F32FCFEB2FEC25E648FBB4B48F8DBDF2FFCAEC8F67F7BA9A8FADEF6DFDF272AFECFDD81A8FA1F37EF62F2FBF72F7D4DC8F8EFEACAC2B1E8F86F4ACFC5BC7 -:804680004D246B555B734F11113CC14E527F57F76636BD286F69FB83A52BAC8F89BB92B992F9B6B22F69BBA2FAAEA88FEEFEFEF8EFCDFD88488FAEFDEECC8F66FE3C3ECF83F1ACCA8FABFCEE9C8FFCBDC2F474622FCAEB2CFF82C24B8BBE948FADFDC88ACFAFFDEE988F8DFF9A98FEA62B558F8CFBDA988FACFCFAF8EAFED4D6EF4EFA7528 -:80470000BC4BB3AF86F47848CF4CF5B156247F55F52534CF53F37434DFC5F55D5FEF47F76E74BF84F4DFF5AD862FACFA9E98F0B6946B332F6BFB2242EF8FFD6C6EAFCFFF1E5CCFCCFC6C5EEFCCFC646ECFE2F22C2AEFA2FEFECEEFCCFDA8FF6F4CF4D5422F4CFDC4F68EC24B8B2E84CFEEFAD8DACF86F4FCDAAF8DFF1A98FAEF21F5CEC83B -:80478000AF8DFDF8C8CFE5BDD2FC7436EF4DFC64AC4F43FB68488F86F5CCE4CDA120022A4128022C0124842416480224822C02281242C024200444A0242928142484280410028800008280048220088A4484041242F01C2B80C1242244838232481A021A061A0241004232004A03A8484C42B84892144A828182C124188AA292A012B0287A -:8048000081A4121A24462802884880C4A42242124A48A824845FE60C4D421F41522C1FC1F248121F41326A1D2CAB141D64AB9419B24A19F54A9443F24A9143F3429347822F14F924481CF9244A8F54F8264A87116FA264592E4ADE256D4A9E242D4A1F49D222F4912485F2912483F49164A3F49164AB141F41B24AB911B64A3915AB944B83 -:804880004BAF4439342F447934989A4F8284F9244AEF18086D1A1A5624CCF24C121A326C84E981D24AD14192BA1F81524A32AF5428F34A1726F848156783AD912E584E156B821E216F227498D584F4582165E919D286F4912C6D421F41D62CF49124C11F4116FC116CAB141F41D24AF81164ABA45F81928ABE48A74432AF4428D34ABB2688 -:8049000084C1588FB80320080000000000000000001002008800002414000000000048000028000000002501BFD40C222120414A420842A084241A18242812024800CC048312280241401884011608212021A1184148A041608518211088A4410084A122122AF4EFEC008A120A484400836822008421A10022842E82828048821412223227 -:804980001243921224101484043082811A12088004260844130830123880214111F85CCC002B2C811242254408C0224344B238182488022246E8228868448827A184A22126229124233111105C2C200423091A924880817444D82803412880052A41C21A381CE181F461AE200221100821B04808884002A11002004008224221100484446C -:804A000024800148800189490420041800D01888442201840020F2D2A20028228C1204214022212401004829012C8194B241400248282190144008002C042480012282221A2282028008281220212422C448A74D1432604115C2282712428C251368282088014568A281818B12818B3432B024D428028D244F1192288DA266F424121AE6FD -:804A8000218262221A12C8682412811246A8148C41C814182C018849064C227D144854FC80033899524239924218C0184E82188800412D2A845022B28B422830444824262C6283A6BA48C2123AC41228268243A825B0128288E28681B3281188218131228A810222E88954246F540E804204830260842A11020018904812C0188B25844C32 -:804B0000810129722882024D114110342480622440028100811880044084080043243144124331486DFC400410042D188128404684C21829029554826E1200844222400810A4410028298494281084020042143024862404281AA8424430224A01A832D8FD6D242843A12580228244311C424C8404190320011883A42182297188A241A0AF -:804B8000432C028922011602819238A043444994886085184422882903292981A414442812A0213C0A18254804001281004002904C290144800240240484100860821800006061800412492202320088000081008008CF2948C214442841282B121A34282024848431114C4464816C83A1241242412C484828D14802818921220128301430 -:804C0000248064448B5859E28592148A02882329B91208423608222A21A884DFE90B2622911400848111C9411482522A50281781214840982882388C24044A42222582C21242290498284B121A12040080828106002AC41430424B41208823F24F95004122108881028002850200248142280028808102008001AC42024232482112210029 -:804C8000400422124301800112C088E0888204D77A009042322821211828202202490128289048200481288B1421C0244E24431208006442812840140480A3180048C3A841821882838181048362825F620248121880410422C012288144850220820280020021808221022001448011042001800100180000A2C0882812C0884AF8EF1128 -:804D00009012A90225042A24812102412934284094420023A14212200120024024410CE02104260850828044045084124C048C0448004882862424043F4F0D2001128481848110120820814242382810020040022428244022428242022420110400004028040080A424220028F0E8D700424C840400000012282800490143C22200008444 -:804D800018002002840085041822902280423834188002128021C8180000A0424F370B4490220041220024204202C0147012041284A061800248414014248404424C144414040044008008103488800848848008CF610EA6A22820224908840040528450222841251A0480022810081800301244380040840441200184006041001008204B -:804E0000824201CF74084785904421610068A052C014906244008084049022241826820824800214480080042284288C044904C4808654482A24E44298418B18D042013F8A426221CB28A0268FA9411608281632288D128D22AD44224B348D1C4B12AF4324228522A332840016841212F43268A011CD442A9244212C01401488F3841412F3 -:804E80001E284A548890883242899E619A0A5CA6822F720E43662C4D2461637228A8218D288096222F84722224512225622285085827829048304A32224961423E3485941825F42224212564C14D24446B2341C01C328F8124A294B0C4B514C418289A68C888CF8431488F9A88F6EACDC0542B1327231A014B14223A25B222412453842C61 -:804F000051442269D222B644B242022238242E222D2A2CA422472441AC022CA44446A2552422AB414446AC221A544400811664414243AD8C8D5872830FAAA21483D43802444004444E12A014A014844A014A014A014088C148188C0448C042122C24C1421A52241A42824282128C324828C384B24888929890989018438251841C5184502A -:804F800084F0F68B246F29F1222625F636764F2775229E421E587E522F27B372A7777AF454122F65F46464CFC7F33C5E4FE4F65A588F81F568687E786E68A9F4484A2B554F47F736742F65F5725ACFC3F326342F23F372727AF72624EFE3F33C78EFC6B66CF46C6CCF46F228644FCBF598388B558BDF4FCDF5D858CF45B738E6CBEBCFFFED -:80500000CC9C8B8E7EBC2EEC8F86F6BC1CE065F5666E6F23F136324F27F5624629A6736E522B378F42A1338F85F554146B112E248FA6F2286E4FC7F7686A2F22B662E683F332388D688F8EEE23F236B66F61E625F57848FFF3F356763E334F45F67272AFA4F634326D22CFC2F22C244FC6E684F22C6CCF4BE7CCE789F9E8FC8B5D4FCCF70A -:80508000747C8F87F7F8948F4EFFCDD44FEEF85ABC8F46FEEEF4FF244CF252742F21D726F236322D146B44215E184E322F23F722343AA3246F2155424F43F37C3ECF63F76C662F8626B432B728B228336A8F826E216F43F374264F63773CFC7E7D2CE227E785B772D764F634324F41F32E2445F8642C4D6C4F42F25C943E3CDEF84AF75C66 -:80510000D44ED85ED8CF4AEE8BBBECBFF8FFE4DC2B77CBEE8B762F99024F2DF71A763E362F22F242546B112B337A63262F23F72A288FA7775AF8145663E146F6781A8FE2F63E747E7AA7842B718F26B628F368288FA2BE42E44BF366246F43772CFE7C7D2B543B774F65A437A9F43636EFE1F13C344FC6A426CD44CF42F3749C6AB718B3E6 -:80518000CCEA85FD24848BFDCFCFBEF8F1E4E84F4FBFE8F552784FAEFE4464FF7C0F00181002222002244002244002284828800200280000002004800118000000004844482008822800F0224DE0220529819218122184002110080089010021226022602210042502002D424445022412410012008002008088240438800A7F26024D4243 -:805200001F41522C1F41726CF21164AB141D64AF24D141F64A9219F64A925D48AF64B924F44A934B43AF147934F84A914F83F448B14FA2E414F8264A56F1244AD6E1A2645DACE449D2A6F491246D421F4952281FC9324E1FC9364A1FC8B64AF1916CAB941F89B64A7995F84A944783AB944783AB944783AB944F8294B84FA2F42846D0A6B7 -:80528000F41164CD421F41722CD24194181D64AD121D642E961D6C2CDB85D668A9428DB73AF448854783AF147816F84AA14F82F148916F22E8157824EA1D7224FAD82145E119D286F491286D4A1B69C9F49128E11F8916FE8168E9F19168A5F4916CAB241F89724A7434F84A844783AF447834F84A946783AF44FA245A4764008248200274 -:8053000000004004280000000000188008000014008482480000800200000000000025012F840B8200120000200200002C12180444800210020018800128004132410038001228182001000000180043F4F96540A21800811604B088014200100218200400C04450242002830420C1420000000080028128001044611212490240011FC192 -:80538000092492801408002022042604C02210044424281014E2280122C04818111A4212482442840418002A81321C282200441400222C011412AF12080020011604B08801000021901820040080044100120000480012008002000080010030211841009044FF370A000000801208000010840130248004804202000000000020012004E2 -:8054000000004248884100880000F0D35B20214204200200280040040022001828502860440021213042210048181002128C0180020080818224222122C12818F0614B8081120480022281220040044418221024A14240822204240060240080844102008B14002200424892414222122218268801AF6B0600000000000000000080020062 -:8054800081401402244002000000182001000000002800820000F0BEDB0000440000104808204104428001002002000000200500000012808208002400880000428022784507281800128014020083049042004A1384088314040084850240140440020000810012A018001145020040084258F0D874000021811812004A0200000000D06D -:80550000840C0000002034280000114004442800002014080000A0142200F013DF8002504284184800628100124180841784688881412800842420144424012411001084032001008425012308008122423888DD7E00120018C0120084C0480023040018604448000040089028200400100440082888808904400400A041422004ED5500FF -:8055800000001B11400800000084000000000000000022800800000000A01100008100120000F03811400400000000000000000000000000000000000000000000000000000000E0140B0000000000000000000000000000000000000000000000000000000000F04FFE1004000000000000000000000000000000000000000000000000F8 -:8056000000000000E0A40F0000000000000000000000000000000000000000000000000000000000F04FFE0000004008000000000000004004000018800800000000000000000000280000B0430A0040080000440000480000000000002100000000000081000000000000120000F018C30000000000000000400400000000000000000072 -:805680000000000000000000000000F01B1C000000000000000000001002000000000000210000000000000000000000007F490A0000000000000000000000000000000000001200000000000000000000007F74030000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000039 -:80570000000000000000000000000000000000FFE40F000000000000004800001002100440028001880000180000000000000000280000F03A11000084008400440000004400000000000000001002000084000000000000180000D0E8040000000000000000000000000000000000000000000000000000000000F04FFE00000000005478 -:8057800000004840040021004400100218808802218001884008000028840000800200004B11004001008004548588022148400428100240042810828401882810828441848842188204441828842148E041012810A21140C435000000140000484001000000000000000000008002000088000000804208000000F04B57000000000054F5 -:805800000000484004002100440010021880880229081880088400840028840000800200002722000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00100240010080040028100200800200008002800400008004448002A1 -:8058800021484004002148400400214FD4080000000000000000000000000000000000000000000000000000000000F04FFE000000000000400100000000000000000028000000008800000080420800000070820E0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000CD -:63590000008002000000000000000000000000F07F4D00000000000040010000000000000000000000000080080000002884000000002FDBFBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBA -:00000001FF diff --git a/zaptel/kernel/xpp/firmwares/FPGA_FXS.hex b/zaptel/kernel/xpp/firmwares/FPGA_FXS.hex deleted file mode 100644 index bc6ef719..00000000 --- a/zaptel/kernel/xpp/firmwares/FPGA_FXS.hex +++ /dev/null @@ -1,644 +0,0 @@ -# -# $Id: FPGA_1131.hex 5959 2008-07-24 16:42:49Z dima $ -# -:020000040000FA -:80000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6AD6FF4000B8F609006AD6FF4000B8F609006AD6FF4000B8F6090000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4455544455557475577775577675577775577765566665563625523235D2E37C2B5111155111155111155111A9 -:80008000155111155111155111155111155111155111155111155111155111155111155111155111155111155111155111155111000000000000000000000000000000000000002552222552222552220025522225522200000000001AA1111AA1110025522200000000001AA1110000000000000000000000002552222552222F21F11211 -:80010000122F21F112122552222552222552222552220000001AA111255222255222255222255222255222255222255222255222255222255222000000002F21F112122F21F1121200002552222552221AA1111AA1112552222F21F1121200001AA1112F21F112121AA111002F21F112122F21F112121AA111002552222552220000000087 -:800180000025522200001AA1111AA111255222255222000000000025522200005F51F115151F1AFAA1A1000000000000000000000000001AA1111AA11100000000000000000000000000002552220000000025522225522200002552222552222552222552222552222552222552222552222552220025522200000000004F44F444444F08 -:8002000044F44444000000004F44F444445F55F555551F11F111114F44F4444400004F44F444444F44F444440000004F44F444446F64F446466F64F44646000000004554446F61F116162F21F11212000000CAACCC2F2DFDD2D22F21F112124F48F884846F61F116164554444AA4446F65F556566F61F116166F61F116164554446F65F5DC -:8002800056566F65F556566F65F5565600000000002F21F112122F21F112120000004F4CFCC4C46F6DFDD6D62F21F112128AA8882F21F11212004F44F444446F65F556562F21F112122F21F11212006F65F556566F6CFCC6C6BFB8F88B8B006F65F556566F65F55656000000008F8CFCC8C8AFACFCCACA255222000000CFCCFCCCCCCFCCEC -:80030000FCCCCC008F8CFCC8C825522200CFCCFCCCCCCFCCFCCCCC000000CFCCFCCCCCCFCCFCCCCCCFCCFCCCCC00000000CFC4F44C4CCFC4F44C4C000000008F8CFCC8C8AFACFCCACA255222CFCCFCCCCCC55CCCC55CCC4AA444EFE4F44E4EE55EEEC55CCCC55CCCEFE4F44E4EEFE4F44E4EEFE4F44E4E00000000CFC8F88C8CCFC8F88CC1 -:800380008C000000008F8CFCC8C8AFACFCCACA255222CFC8F88C8CC55CCCC55CCCCAACCCEFECFCCECEE55EEEC55CCCC55CCCEFECFCCECEEFECFCCECEEFECFCCECE00000000CFC8F88C8CCFC8F88C8C000000008F8CFCC8C8AFACFCCACA255222CFC8F88C8CC55CCCC55CCCCAACCCEFECFCCECEE55EEEC55CCCC55CCCEFECFCCECEEFECFCA8 -:80040000CECEEFECFCCECE00000000CFC8F88C8CCFCBFBBCBC3AA3330000008F8CFCC8C8AFADFDDADA2F21F11212CFC8F88C8CCFC3F33C3CC55CCCCAACCCEFEDFDDEDEEFE1F11E1ECFC1F11C1CC55CCC6F69F996964F4BFBB4B400EFEDFDDEDEEFEDFDDEDEEFEDFDDEDE000000008AA8889AA9991AA111000000CFCCFCCCCCEFEEFEEEEE84 -:800480002F22F222228AA8883AA33300CFCCFCCCCCEFECFCCECE2552220000EFECFCCECEEFECFCCECEEFECFCCECE000000004AA4441F14F44141155111000000CFCCFCCCCCFFFFFFFFFF3F33F333334AA44415511100CFCCFCCCCCFFFFFFFFFF3F33F3333315511100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000008F84F448489F95F50A -:8005000059591F11F11111000000CFCCFCCCCCFFFEFEEFEF3F32F223238F84F448489F91F119198558884F4CFCC4C4FFFEFEEFEFBFB2F22B2B955999855888FFFEFEEFEFFFFEFEEFEFFFFEFEEFEF00000000CFC4F44C4CFFF4F44F4F3553330000008F8CFCC8C8BFBFFFFBFB3F33F33333CFC4F44C4CF55FFFC55CCCCAACCCFFFFFFFFFF7E -:80058000FFF3F33F3FF55FFFC55CCCFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004554444F42F224242AA2220000008F8CFCC8C8BFBFFFFBFB3F33F333334554444F42F224244554448F8CFCC8C8FFFFFFFFFF7F73F337374554444AA44435533300455444FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000004AA4446AA6662AA222000044 -:8006000000CFCCFCCCCCFFFFFFFFFF3F33F333334AA4442AA22200CFCCFCCCCCFFFFFFFFFF3F33F333332AA22200FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000CFC4F44C4CCFC6F66C6C2AA2220000008F8CFCC8C8BFBFFFFBFB3F33F33333CFC4F44C4CCFC2F22C2CC55CCCCAACCCFFFFFFFFFFFFF3F33F3FCFC2F22C2CC55CCCFFFFEF -:80068000FFFFFFFFFFFFFFFFFFFFFFFFFF000000004F48F884846F68F886862552220000008F8CFCC8C8BFBFFFFBFB3F33F333334F48F88484255222008F8CFCC8C8BFBFFFFBFB3F33F333330000BFBFFFFBFBBFBFFFFBFBBFBFFFFBFB000000008AA8882F28F88282255222000000CFCCFCCCCCDFDFFFFDFD1F13F331314F48F8848425DA -:800700005222008F8CFCC8C89F9FFFF9F91F13F3313100009F9FFFF9F99F9FFFF9F99F9FFFF9F9000000004F48F884846F68F88686255222000000CFCCFCCCCCFFFFFFFFFF3F33F333334F48F884846556664554448F8CFCC8C8FFFFFFFFFF7F73F337374F4FFFF4F4BFB2F22B2B00455444455444FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA8 -:80078000000000004F44F444447F74F44747355333000000CFC8F88C8CDFDBFBBDBD1F13F331314F44F444447F71F117174554448F88F88888DFDAFAADAD5F52F22525455444455444DFDAFAADADDFDAFAADADDFDAFAADAD000000004F44F444445F54F44545155111000000CFCCFCCCCCEFEFFFFEFE2F23F332324F44F444441F11F111BF -:800800001100CFCCFCCCCCCFCEFEECEC2AA2220000CFCEFEECECCFCEFEECECCFCEFEECEC000000004F44F444444F47F774743AA333000000CFCCFCCCCCFFFCFCCFCF3553334F44F444441F17F771714AA444CFC8F88C8CCFCCFCCCCC4AA4444AA4444AA444CFCCFCCCCCCFCCFCCCCCCFCCFCCCCC000000004F44F444444F47F774743AA3C1 -:8008800033000000CFCCFCCCCCDFDDFDDDDD1F11F111114F44F444441F17F771714AA444CFC8F88C8CCFCDFDDCDC5AA5555AA5554AA444CFCDFDDCDCCFCDFDDCDCCFCDFDDCDC000000000000000000000000000000000000BFB7F77B7BCFC1F11C1C00008001000000000000000000000000004001000000000000000000000000DF8D077A -:80090000480000000000000000000000000000000000000000000080020000000000F01B24000000000000000000000000000000000000000000000000000000000000FFE40F48008001000000000000000000000000004001000000000080020000000000F089A200000000000000000000000000000000000000000000000000000000E5 -:800980000000FFE40F2800001400004840012800484001280000002800480000108204140000484001002148000010F26B52000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE808401800200000010020000100240010081 -:800A000021001400000000280000808802000088280000F04EFE000048180000001200000000000000200100001400000014000000148002000000002F49054818148002800414182810820416012810A21140012810A2414001002B11484001280048408188022148008828108204F05C6580840180020000001002000010024001002165 -:800A8000001400000000280000808802000088280000F04EFE000000000000000000000000000000000000000000000000000000000000FFE40F0000280000000000000010024001002100180000000000000000000000280000F0C1670000000000004002000000000000200100000000002800008008000020080000F0E66C0000000061 -:800B00000000400200000000000020010000000000000000000000000000008F2A090000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000240000000000180000000000000088000000000000F0ADF3000000000000000000000000000000000000000000000000000000000000FFE4DC -:800B80000F000000000000000000000000002400000000000000000000000020080000F0AFDE000000000000000000000000000000000000000000000000000000220000F0CE4100002002000000000000000010010000000000000028000000000000000000F057C50000000000000000000000000024000000000020022200000000002D -:800C000000000000F0DEAB0000000000000000001400000000000000000040020000000000000000008A041F7D0B00000000000000001001000000240000000000000000000000000000002004CF320500000000000000000000000000000000000060228002000000000000000088E0CC0A80010000000000000000000020080000110015 -:800C80000000000000282008000000000000FFA1030000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000082F0663E000000000000122004000000200100218001000000008008000000000000000000FFE10C000000000000200400001D -:800D0000002001400280010000000000000000000000000000F09C6C00000000000012000000000000000000000000008008000000000000000088F045E400000000004800000020088200000000000000420000880000482008000000820020F8BA880000000048200952000000004820060000002420240200000000200800820082008D -:800D800000A024F0984A0000000048A04800000080088242000000000021004200000000A0482008008008000022B02A0F0000000020011A040000000080060000000042220000800800000020080000880042824FB50F42200442000000228222182242002001100218800C000022281200480000000020022200000020B29B0F18A014B2 -:800E00000000000000220000000010021880080000230400A042000020044220820848000000F01DFA00003800408204000000000000000000008084082004880000420000000000800200F0DCF480011232420080040082202122040018000000000000290458202802004280044200822800800200225F91074800000010028002000078 -:800E8000000000000048008024288202000000000000002004000000AFAF010000422004240000802808008200008001222006200800008008802804482200822820080000F02DA20000420080012C011800202302000020A412001AA84221422301800400000042000000002002002200BF6B0D0000008002002004202828A284820082CC -:800F000022204402004842282008200288008008288008000082220000FFCF0200485200211221002582582238F04212800129298401188888580000A0140028588A022800000080220600008800F031E90000220080022400000020884882142206004220048082048A0410828282024220042088080028220000143FD50F00480042000B -:800F8000000012A824200242420021122212802202002008C88004004A218804800A280080088800002F1207004800244002211824282C012622284122014812212100420000244824002038120000000028824200888008001FE607200400480048000088002410128284228484010020044AA228820080022800008002282004002200D2 -:8010000000F056D10080042C042C02000080020000488230222818800800184001808184840400000082802202880088002114EFE30620044A0242243A03121816220280228A714282F4424242A252221A81A45422211238484A2884051AC2221A0242A04400A800AA0C88A88088884201EFF30A00002CC4422944120221212B48272823F6 -:801080004BF21282A0C12D121A282241024A081AA2444A2224E4282A21082622A2CA220082002A262882282404A2AA020000ADEB000058422002465222001898B0B28896A282CA2888E424A7622840A2822848482B42228AC4C28242008AA822124A2C2804228A08282800888A2208007FE9090000480020011220018023C8124818821847 -:80110000A02424C012282C21C41242262241224122A18212220000202208008022088200F01E150042A062C612D222B222F2424260212136B212C1222B833E82249AE925F912D22AA6132B4226728212A2C62B532F25D52241F2C2422F2CB482ED24F5521221BE522B19A055CAA8CC00A822A0A8A0882008820050CD0048A022C632422D41 -:80118000222B232B4520011AA2889E9227232F23EA29A9DD2F28B8C2B422A6372A45D222D922B162B512F552122D521F16A6FD9E932F2CBDC2AD511E122B2A223AA3444AA4CC4A042AA2A8A0CC4AA4882AAA82882C180221DF690880042AA24429B422B222B34285E121D122F112322F2199822AA9829E922F28F842822BC42B77226E5294 -:80120000238268212363224E425A7512A1FFDAE528BCD28CA431A6B28282A255CAA8CC4A2482AAA8A044A088A88A8AA8882100FF8D0300A0224223B422B232B35285E121D122F112122D822F21F982122F28FA82822BDD2F259D427AA7266E622962212B557AC72246A2512F17E62CFEC3422BCCDAEC21D122B2A2AA933AA344CAACCC4A5C -:8012800024A2228AA888CA0C8AA8A22A8888184202AF870A000000220000000000822420044A02102204102214022190820010028084880400004800200800B0A10B00008004122412001882208802248A240400282094124A02A012C288420023222802008820220882002088020040F1447580B411021B214AB111364219B64291212BCB -:80130000941B282B941B412B94B22F14AB432F14AB4B2D91BAE414E922E414EA2264112E42DE212E42DE212E429AC2421B292E421B2926B291A2861B2923B481324219B262B881B64218B14228B2422ABA422A9AA22A84EA22F47EC380B41126B21164241B2125B21132421B212F24B891F242A219F24282A22F3422C2A1A227142B4A2F51 -:801380001448E214EB22C8812CE51C6222CE213C65192CBD91C2521B692C35114A39912B141B282394212B8419B64212B1420A2B8422232412924229E822F465110082000000000000000000002180010000001400000000000000000000000021F0FAF4800200001812002001000024800600002082012002824A0988008008002800000F -:8014000000800820220AC041CF1905A018A8202404224232488A048A21282124012C8888044200002162888800224622228888A44A28802C082248A08488622800804281F2623700D22A08202481822482242182210848004EA2240042A018201182A6821182C22034428288C82A8802AA8408222A04C2888A8402C0822880F244162002B9 -:801480000042001220018A0482200112218088040080020080081828882800800400000000800220820280F4738B0000A012004818001200244022018220012004108282011880280490120020028800828800800228A0244800FBB8200200301218123022480088800C802205800400488004A028423222288002B82898008A04428008DC -:80150000008880042026D284032800A021298121012120018890821082A284004220042C042A04800382804282033822188088084A0888002288202482A4422867DB0000000042122842000042800112200100000012208824A324000088A08200480082000020024200F033FC00224200808391422A85042022044A0828602100208881A4 -:8015800081082818A04820040048488004480000AA24280280084800228F8307004A01420022000020222102200121429042221822882842001821224821A042800820088002220000222200002F73071200120000001820880C00004A02200100000000002001000020020000004800008848009F710512221820041828A04258004852C7 -:801600002242A0216821421848828003222800004AA2410022008022088002C280042002824800AF820F00200120223142120088820088008001002800004812201D022400202428044200008028028028220420F278DB80010020010080210880288488A21420A121824282181200800C00203812002128008004A248486280044248A85B -:801680004882F097E1002880020018208A0C8008800180C18280210800000088428002428002800200000000800800A200AFDF06421280040020220820018008000012220000800518121A028200800820848284020020020082000022BEC40080040012A04142208482222484A481882221C84800884002322226022800C0222CA4481290 -:80170000184280040042A082A200222200F0CA33004200000020232501880080840400808104421800181022810280810200282002420042688820280800824FF102481A8205200100000000202522482204208481210121220028214002308248800420280480020082A0248004E07307288004800452120082420000008A0180088200C7 -:801780008200800800000020040000200482000020248808EF8B022282200480014A2204128220080024A081C8000020018008881200A012002021840428422200800248004021F2B6D8008004820000180018284A8208822248002B12800188400228121C91228248122904881200220028800248200214C81002BF9905228A0200421A71 -:801800002185A2C3CAA59C1A89A88482CA84EA21022B488A8A22A8C81A8161214823A28D9AF942221AA3288823F112322B228A24A145800442826A046A84A8C22200AA82EC18082F66034A240E22821A01185AA414208102A0442082E821AD814A840C8088042921A1322031222A08182246A28462184A2482260280044A0282C26E414889 -:801880004A42A1226F620D381A21A14400002AA128122024A868881AA11CCA8482B112A11B5A0420A11880022CA21A002C84048A188221A222426A086A0642A82AA42888C8A84A2808888F9306200220A814004820010048002008122009005880848205582002002A080080840888488880028084024200BF8F074AA53580A44420A15413 -:801900005A21A2454AACDE824AA2914AACB37E1229B192A9563AB9D2ACCC8A81E124EC25B512A1DACE422F2E3B52AAEA2C6425242F22BEC20CA022A0AE4AA484EAA88C288AA88A2A0248EA8C042AF29EE4A0121A07A0C45AA5441AA177AAAADD9AA1EC8AA88CDAA9882AE22EB812F182922BF72AAB988AA8C45AE42544B262A6D91F1CF4D6 -:80198000F2B22F15A388CE422CE421B38218A255122A82A426CAACC48AAE88A0228AA8A24AA4662C9442B022E2DC0D5A8706A0445A25A1555AA3F65AACC4CAAF88CAACC8DAADA2EABA52B412B1B2A2BBCAADC4885AE5254402EAE935F892D22B51AAEA2CEC2154222F22BA42A4445AA3244AA2244A24AE2C428AA8AAAAA822A062EA9842CD -:801A0000A0224F2A0A7AA7311A01A0114AA4117AA7B25AAD5DDA2DA88CCAA8DD7AA7BF2BDD2BCD2BF77AAECC884A2461215E523AA3BFFE232F2ABF13A6AACEC21E122F21F3A2A22B445AA565284AA6AC4AA44ECA24A48CAAAA882AAA8CEAAA8829C482AAFAA3FF0000004818008A044800A048A048289A2424A92400001800009012800889 -:801A80001800808104828004008A8422088AA4240082DF1C0F1828180000482A81A214800988000000008AA48420044222C22A01482800218A220422200622824282A0480042008A0414AFDF082AB41122B21122B411B24291212B141B612B9419B24219B142A9422F1429FA4291322DB1BAC4912E421CE82264112E5296E122E419C252B5 -:801B00009AE222B591C2421B2926B291A2861B2923B481324219B64298212B8419B44228B242AA422B842AB442AA42A82E42FFBF0C2AB41124B2112694212394212B161992821B282B3419B24229F34291B22F3421C2A12B4A2D812E521CE822CD812A64192D528E213CCC212CBCD1C2421B692CB49192821B6923B481324219B64218B138 -:801B8000429A412BA410A2422988B4421892822E426DCF008200000000000000000000210000000040010000000000001002000000002170B10E001812421220028029818C04001A0228800422005200001888800810A218200800200220282808484282882840F1ED7C202229220848A212320000A0412004121212A0214800808121A4D3 -:801C00001821208283840110A2126222008226622C2004888022120114F0A25900CA0198488028012028A14A4248800412222C81242101821A041848881182A01A484E126028A01A42220028222EC28088880820622800F0631A20022A01A04122282A011800800120031200282A0400180012290122000012002200800821824200484A6B -:801C800022482102F05E610080010042480000000080042004000000008021010080218808004228228200004A0820028200E74A002828800418184AA214144A0118203412126880A2810000221602181242222C21A242008084822162288028044A8884280282820022281F730B80820100184242421442000012122A04000000280012EB -:801D0000202102008021882882018828A8C8802884A8A400008828222F490F002820044218221820011820142204A0241A0800002C0120812421912262008004806224000048000088A20000BE8E0020641120840100000080084880420280081812880058006682242A0222004800004288A22004C84824882014F2241120014200182846 -:801D800000200188221200200186A28412001848A8008002004210012088020080022242002800800829F24D4714002A01000000000000002800000000242004423288221282A8182800242004102284480200880000EFAA02002A012084010018800812880038800812880012222142124AA2216E82489A266218182008108204262228D5 -:801E0000AC8424808404298828C4223DBB8001301120210200000000800422A0480000420020040028202882220262000048008004A2200800F0B65600110048140048800100428218000080818104008081210A2021232202326A0100222200204202000000245F250D00221324021904121100001400183818289042800A2800A068003B -:801E80002800128002000042240000004200460200DFEF09144222004826110142260118601182888024222184220C42284A014A014A2804224220012A042A0448242CC4222C04290648288A04826842F0559400284820820228000030118001222302222124282A011282122220A12148202108121882212800820000000022481002E787 -:801F0000EA00002004808604000080848901524242422004482044222C024A82A42418220042A0242084260442244820A4C2488820027F110720024220020022800120014880040000A08188800100000000000000000028400288000000FF620A2280240200122A0148221200002C822182810280810200800200122002228002000000D5 -:801F8000000000004820F4A2D6000000208404422001184258000048006888481AA448482A84812404480000422084240420242C242424240242003C029F550A1C02480011208112611200190200000090228218128818002061120000581200000020722282120200C081002344525D142AE212A622284A26022AA722A025280014A08851 -:802000002026A512622A22A482F23252A034826A81A522186AA4812A83A34288482A82042A042C84A4422C84A4826A3C81C823E41284F4C5CB00001C24820242521414121218585AA5151A91322228292484A22C18428A2964212AAB216A2224A1312A02A0317880042662242422002180042842E01412F2BC4C501100427041F1416116BF -:8020800081B54136211818171113A588E022A241385A041E42AA8D848487A4512AA4458A0C486A041812324266A22442424AA4282B662B8427242B244223A424824A248806245DA5140020021448806412202241A141200812208102208882011880092280012A012A012200006022400200000000425D19142AA2262848A815A1262AA382 -:802100005117124A8621D111B15103CAEC22B132A1123E424AA4425AA4C2CAA5525AAC515AE42ABC52A4426AA6624AA413122AA144426A26A444424A64242BCE46B24226A444EAAAEE1B8C8A8C8444F22F7AA0222A0680BA21A2225AA55113A4441AA133121AA3544AED23B142A5575E524AE424B442ADC44AAC555AA5457AE72FF543619F -:802180004AE614A6754AA775381AA7646AA6666AA6444AA4646AB6C2AE442B444AA444EAAECC1BCC8AB8222442F2D3FB141D212A86A22250111F16A2115AF521211F14A6331AF311111B141AA1DD3E222B553AA3552B666AA47EEAACE67AA5555AA554DED22F15A4466AA6675AA4431AA1127AA4466AA6664AA4446E422F26F4C2E22F24E4 -:80220000B442A4444AA466EAAEC48AB862A6624E42CFF2051B222A82A222281B661B667AA7771B261B642AA3211F11B171A4CC5AED23B352A4325AB462E626A4E66AAC666AA5454AA577FE522F1EAE661B667AA7762AA7337AA3656AA6666AA6444AA4642B662BCC2B442B444E422B44EAAEEE4AAC886AA4424E42EF5D072200208224027D -:8022800000200112140012288002002800001828880000000000000000000082202804004F43071428004240A161804401004212882004184842A08420054220818482A42148282A014A8122840248468262246024002AA4A4820028F0E4EFC0411B21141B2146B111724291612F14B111F642911B212B9413F14291AAF44293322F142973 -:80230000D312A9431CE92AC4812E4216E12265192E5296E122AD292CB591E222B591E222B991E226B191B242B9817262B281F2628219F24282112B84222B84222B842229AA42882E428F96021CB41166121B41141A724291212F16012F1219B1429B212F1429D23221E21429D21298422DB12E521CC8D21CE2226C192E42142D4396C142F0 -:8023800013C84219C4421368241B29421B28272419F2428219E22412A1A4222B8430422229B822B44228F22FC90082000000000080020000001002000000001400004800000000000000000040016FB40F42001200142011816221482120418202800120022081242125011820020098188848880024B04308420022A028004224AFE4062E -:80240000200814002482422400190918882021952200000042128002C8244A8181A41218002602C0822220028214297241025023824081E4F90F42C200001182121123C2121BC280A1183022162282013012208821250118196421421A0242128212A28008227022E21A0442290222D022C882C041B08B0700301100242004002C010020F7 -:8024800021040020022004A05280081880A42120013042C082000082146034002601002CF459DE000000408104482212008004481C21A3A4000011422001429880A4250022281840012440216824004002002882008F110418400118422B12182CA41819244482A14118004021A1181800222B1218420080058888202108238482AA2448BC -:80250000424882004888A88220880488CF820A1840011824324A01239421522418002044A112C280018032221842008024A4248820A128242082480242882C0400822A0880280CC042000000481120242904004A81058011A121980010A141200148921220098002124811284A821421840820042188200280F8285F2004421C1101002084 -:8025800004708201218242002424822048C111803C22E0120458A21400C042400148822400200E484623020000297272020042200400000000620028184082B4310480A14188000040014221212A040000804203220000208A880A25F2FDAAA01280810200242601121400180000A0410042001100221200808201404122280811004A02AE -:8026000021001CA8840000003BD1A01280913146010023822441022442882022412281B421211C011A6424203211800126C142100224862128440122348004422C2C0482A028C022BF2D0448000000400110C181800142002024280410410128A02420A48280019021210080082168248200200A228800F0A32200004200160200292C0115 -:802680001341029288212823018810228181A41430C24220CC8118211210021882800400150228C26829840400F08B2300000000132424040020141102141834181411100219082A44210100002601321214111384324111001B8288808808800826B26E0514001400468214820411002C81018008800452C06200004A81A184208124A1DD -:80270000219062A0412428142B28C22B84824621382282002028084F3A0510014210018011210118100211808101A0411419011C48120120A82100C0212CA421184E21212028148102280000002100F06292004200404261111286021421180060111A082A242128044820814421039818A048004A828403248022842204200648C04200EE -:8027800024F0C52A140048001C210540010000000030111348024213A1830080384114808101480040A384140024142B248A022C44C282001002CD7300000000001211121800154281080020011888108121010088C290411984012004002400280000400100F027960082000014800416010012120014222922440111221C221121C3219B -:80280000004220083041800811485022112C220842860248280014F05627400148000016021882002800181301801C11025811880013044081C141208114021944022214224AC8814E212304284002249082F016DB14148220041140A3441D11395111213420011F38482181B813C1511C84341125E115A8111F14F2A28182888A681182F4 -:8028800039A1324AA6245E21423F18A86A1D2329B223D2125821AA2AA24224297822410214245B1A0082C04160112F1434131A61219E4118001A94131A21B191E122A2474A74911261142B5E1B111146A1431B451AA1194AB141A5552217311522632A1E134652124A643ECE41CE422D414E4142CE824A2488140286019DE41061140000BD -:802900001F21A154214A8C28A1111AC1123437181888183D311C88A814311CA22218398481B341A4421AA4888856012B132995511904132492412C3821CA18E3288EB282EA246424A0882C88F27CC61400004081448344010000240082281100002811004A024288C0810030222002344826012622482188A248248A440220087F2D0E2027 -:802980000448E021B143D111B152011B881D133711183810F291111F38F923232BD81B441F197911C3431F1E77118118F121611B991AA44C4E519AF441415216F21161F081A1141F38F883C33D233F14F443816E41421F1C26A68421C82F32120288F0BA1D108104001F21B113F513512B518AFC91911F31F13331A0313B113F11F111114D -:802A00001F39F933332BFC3F1CBCD1FD41524E421F16FE11211E111F11F171611F19FBD1D1DAA5D5DAF4C1411D412E231F31A1261F1DF941511F1CFC226327343F16F643613F1CFE41C14AAC4CEE6223A8486E21308282F014CD004800E021F143111F31F153111F29B993F911132B31001D133D1186D111F821233F1FFDC3D18E814E52C9 -:802A80002F24F463E13E11157141F131711F1FE919ADDD5AF5C1D11F14FD115115F313215AF191A11F35F483833F1CDC31F243433BE6CEE11F14FCC2C16AA48429B442FC2222212188F0EE6F100100F011133F35F553533F15F5C1D33F18D931B112A2113E1235F313111F11F111911F32F2F3F11F1CFD91914E422F24F463611F135311FB -:802B00001F15F171611F1FEB1DADDD1AF9D1511F1DF511111F33F333332B261F1BFB41513B883F1EFE61233F26F643633BCC1F24FC43C1EAEE2EFE82C22BCC2F2612A2888A48F25A35000000004021090000001100309100100100118029044214000080818488440114000048800400F05AB860180000C0111A744202141341012C11815C -:802B800021C81213B1420242114223220146A112C220852C8C013C81829161248A448302682D821984A84A0029082182007F6A091CB51142B11162141B21273419F6421119F6429119F64292112F34A94A2F3429FA429113D212AB421CE922C4811F22E415F22242D6F12242DE212F22A4292CBC91E232BC917222B2917262B2917242B29A -:802C0000817262B181F662831B282B8413F84283A22F24AA4A2F24AA4229A84A882E42EF120D1CA461141B6146A32134282D1319F24293284EB3284E83A22F3421EA343181A82B422D912E521C98D1A82362192D429E212D4316C1C29AC2C11B4925A26927341B292F24A82834284E83114A0A2F342A724202252292822B42212CE481027F -:802C8000000000000000000000000000180000000000000000000000000000000014F0ECAE2008005818182416015A08141434120011203451424820868101180012001890112190122C0100488E414800808484080020E4C34C018A021134242812200419218901242C012389B182212801231842110242982C01523A28948100194C22AD -:802D000002E0180424242C0848400224881414B0D6092006115824321812A094141B831C1111921225A218122CAD85121E4282AA94111220255821184A2128B4410821194402211021641C62860280042124861241C1425776000040230150124820010012001410122104100221001218001A82011C012C28A112008A0450220048808457 -:802D80000800006FF80A00181100200182200880215122224602004A01A042001A82210400820021122C088004280042D032082422200200F03AE51400221214259141281831139112182349023A2821A829D21A0810120229C1414022A12118522220512218882C0217222C8818422208248024E82824048A82F896BE0000111022840169 -:802E00002D8113911210C212B0129822C8924A014800290229E111062C84210192282412212B18004214239882C042C083240000002A88F87F731400381211111122120088128A01182818242882981224200400120022124200804182C82280224202602800B02284283E4200F099EA0020442164241A0400164141011810820140020050 -:802E800080911288001C1142224A0121800C22400124000022002810024210B22D0E0020040024482100A04200904200258228410218800842480014800411582304822304424A42026602420080028052228D4820018001120014000014000020023021000042002800200680020080820400200829924220080000FF470412001981E4B7 -:802F0000212444324121164141C141181022011022681124001848003C022430214821111A2804822A24642422246028C06248C082280040F2A69C0000008001000000002448200280024002004852002A280420022128241100420048240022008084025F4E0700001111C0420021240014180080311248121242182122183042314200F4 -:802F80004898000080140240029023108202282008F07AE7000012180020611100112410014012011C1121848204151201C042302140022622240100002200000000820024F0864D001140110142304148194181011800208841222128A24860110028002004001232A02158881002800820EA22084280088822CE7A14001100001100805D -:803000000111002921321200401231218820810819051A0623422184040014420014290A1C2202002188211002ABCB800100001582041816023400408202252208182C021824682AA8422602002125022522B422A5284800000021200200100260124D6A601214001831800120420217242085A18123A884180088248004A018888A22A1D5 -:803080001200208868284002238418821482582210022622048221886F720C4800002011011140210418001468809441112068241CC1811214000000822A040022800222308128824220040020022B3B14001112001364211324148101000098280020840C1442208231228A061828802189220821211002290A311082288292622A18827D -:8031000008DFA30A1C228214011823118201282382B1428224042118C248100219012C281111C111C0214224002D4112250128221CA28282004A0A8224240080322288AF5B46218112011C113112D012E114446131122427111D12E021890210228D6F184A7442A17A1BA11C31A1C2587E2120A488AA21B8923122486014B023421281F468 -:8031800022A18A4202C04221821429F213D9B02106C011111661342D5342123E22312513A214122C7182F152121B112B411CC112C6B2413A111A5111181F2332428823876122211E522BA12F24C1A18233C462258202822415032CB822682468EAC882222A088F1404141541311112211935511B411D121981B341F14141A044122AA28AE4 -:803200002F2CAC941B451561122E422CD9213412271A8AE431F72261282C9422151242A36342383E222B842AB282C8822BA62B882B88242326B822722292228A82A828AE823D9A202402001840031460221A44824401348A44030020281402002142201412B12218111201192412213681422024280424820028002FA70942135611201158 -:80328000914115B151551119A1121AB51191611111A81F119D813B881CF111111F17DA11A858111F15F881811F15F48181BAAD331C56112E22EE218E231F18BCC1FCB1B11F355133311F14F4C3632CF8418139B4C2F622222B88EAEE28FA22222BAA20A822FF53091AF1414115A1411215B24275437343F151111D112F21B122F3131239DC -:80330000B21191113F3A7AA3F181823B993F11F111111F36F143812CBC11F551411F19F9D1C33F2CF871B17AC24235F321232F13EF31F393B11B6EAEA22F22D43334232B442F24F641632BAC39F442622F26BE62AEAA2B8C2F26BA229A828AAA225F8E035AF521611501B01111D133F1431115F111112F23B25257332B55141AD133B94276 -:80338000FD12912F19F913111F11F561D11F12E834FC111117141F19F9C1C33F39E91AAE334E622D2215E3297491F29192FEF1AA2AF423222F14A4222F2CFC42423DA133F4C3C32F26B622AA662E622F2294A22B22A0229FC947B171F7216115B151A1111F21B153F553133F157141F131313F23B352F643432B575E51182F23FB73532F49 -:803400003CFD82911F11F511511F3EB4E2E834F411511F16B491F9E1C33F3DED16AE277E723F3242F292923F2AF2B3A22F1FE62BFB73733F26F662612BAA3F3AFA21232B881B8C3F3AF822A22BE623F262622F269CA22AAAAAAEA22F13010014C0120048141A44030014120028920042114A122294119091422A082A010022C092004800C4 -:80348000262208008224008A84220870AF051C0114111051321200003C01144022C182201481418258218081028AB22208481022D8222128022502425022488074422112A2424602290240F1213580B411021B21421B21272419F2421319F242931B212F2419F1429213F2429313FA429313D212A94A1CE92AE414E82264112F2264192FD8 -:8035000022641D2D42DAD222B4D1D232B491D232B8917242B1917242B181F6428119F2428119F24281112B84222F2428B2422892822A84E822F43A27A0421B41481B214692212F2481E23481F26293114EA21B614E921B422F2439A14E121B42982B4A2D91AE52142F22C9812B4296712262192D519E21219A52329AD632A86925A3212F02 -:803580001629F86281822F1488F242A113B84228F24282A2232492822994A2AE42C10080040000000080020000000000000000400100000000000000280000000000CF7C081001001CA114424A410240818138124819014829258411010000298108122280041C02008A048048034200422100482084C2229F270E1222601248229011151A -:80360000B221041C21612442193211200128004A02481868624A2205200123012CC193182E1218244813822402501280140220824221F49774206116C021422E11121E411364162130211AF482421C9251181846422284A1252088A1242823A49480C1118024847212118233D2002E81193422622411904221002CA224224AF2B583000077 -:803680000020042C0130111800121001A0340011800420A41200200229011C2188010023040000800400480040523600400100260218001242C012C012130182000080A4248002802821A221225012113C0100210082002008502280A84280F4A6F68063113822142722111890133223422399434E8322E021A23428381822888021015E0A -:803700002166222434422411A0812D122AC81288C0818A8432428682A848002140220262286F3F01281931210025121102140014251271C28352122252001220083220B2116226823042166212241311D3234A8208114A08230C2908002110022220F2EA6F20011228112822182C81E122812324A91420818131A2282A01228084240148DA -:8037800080A441222800881212180023082880084A880810022B82484A82F4E4740090511440012A11021142002210828201248021A4822A01882268002026823422114880880800200200C8826840028810F24F4990411842120048902148182D21126280224C01223100272880016E820038284001188082244482022902403182660118 -:803800000000008092422FA6070028000060242002001800008008400100000042280040021220012148000000002422288828005F6A0D19248141011420E232840468008002268121328280E12884280268214A22A124282A2422352200482C2918220220824801C8882C2482228822021E360060121200421221E03211818184012B84BD -:80388000004001108102002880020000702221012002230410118204002200218280F45B6DA0421329022211341322022987041120810300200280022C0438482246C3922288502210028200428823622888822482290800292224043F7B0A111001420000008288201501001302001904260200281200480012C022601160188214C8462D -:803900004101216024000000F0E84E142882281138246021385830811200208282010000220030228004A012211A280400800923022242002004422880028A067D95001001201111121101282014010028121A082A010012C80026012820C121008E122821190211400110A1842B82002918021082723A09001220842424241592215A226B -:8039800004C862521A24040000000030128001502210622142C012601820888848823842A08428002C2C8C48F175E11446C121C021111200400210010000124A081821298281C1824E12601440C22200C03220A118A84825C2C220040082222400822012029EBA20210100A02100114800181212400180432184819181221001112A040043 -:803A00000022280000002111191801242282002100A84F74022008181901221F24034A2111A181134401208622E62822A26148208222A21429820518A01A00802401A22922922220024001408292A2488012D26D0E8A0158001C0640830218800348002001182180418289011220413111B032082E5182261181016014142542820248A0FD -:803A800048820082218AE4760516B181C211114AD421B711A2132D1216B143A7178A2104132521A411429AA9215A21018621F1A242122E711F1181A3832F23A18138122D222F29A8213119813243342C88A8881C289422C8882100221CE828F8C47C141B248A9121121962114652211F14F24312328213B51191812AA4161C21943126021A -:803B00002E426222122F24A1142F36315242142C6214A0822C26A234141E3142218EC233388234151233822E4222222C98822BA44A84B422F679BEA0521621C3213E114226F142613268D0118EC8415E5118282AA6223A8CE212819241282E222A2281022AE6259412282F28739392121E112AB4A2A1882F2BFA81832A82FE61611B6C2574 -:803B800061283CAC8C272C2F2CA42AA6E222A488EA02BF230620022AA14822482248221A24A24980C421481C82C421C021124E21C02129C1211880219412A0921121110088200226A2482282A048A048288022882228F44EEE1413784151111D411B455A89A42248181A7521A1D31D111F193B4119A4221F11B521B391A9221F11B11314F7 -:803C0000E12AF351111F15AC554AA4112CA433141F1BC1226E2116B191CC233F32F2D2623F1898223D833F3C7823738353233B2C2AE228384223222288A88A24AF544A7121F1414117121D411B4E1F19F131112A7222017AF7F1E13A7311F1D1F11B5519F231311F11B3B1BB81FB33211F11B71117F121A31F35F251535AF741511F11F590 -:803C800021733E32181F11F1A1B33E73141B89BEA1BEB22F2CBC82788252333F3CF8C3833F3AFA83823F2CFEA2222F2E5E22250210A28C24CDD81415F12161111F13A3457AE325F722222B441F12A3756AA3F51F11F1C1D16E315AF531317AE51BAA9B3F12A3171CA5221F32BA72E526F713532B451F15E137B632A321BAF311232B6213BE -:803D0000B191E938FB23232F2DF683A18EA23F36FAC3E33F32FE81A33D832B8C6AAEEE2F2632222AA2A82BA2AAE824F41FBF141F1AF631611F12F271311F17B671F771732F26B662F771713F17F7F1F11F1DFF51511BCF6E717AA7771F17E71FAFAB3AF371712E712AE222F263732F27F733732B571F11E533F732322F21F3B1B1BEB22F47 -:803D800023F313121BA9BEA11F33FB73F33F3AFA83232F3EFAC3A32F3EFA81A13F38F8E2C22BAA2F2EFE22222B82AAAAA8AAAECE6E422F290A1840214801001412000014001220081200001022840118901280012280082400004002000024200400FFCC01141118118219E422011C11B142A12914A01412003832200348202281043B52A0 -:803E00001248282C012C8982213122122D83824E818A7442031C084E81222F24280810028886F1698980B411021B2146B211366219B242B111B262B991B64219B142B921F4429113F242B113D212BB31E414FB21421CF821421E213F2265192E52D6C152DAD222BD91C2D31B2925B39162141B292B841B2827241B282B841B682B8413B88E -:803E800042A84A2B842AB442289282AA84E822F44647A0421B412A14E126B1112492612B121B412B961B6929BB81B642914129BA2194B21B4229BB3394B21D52A81F228D5A239AE22261193CE511F22292923CAD6825A36846B381B26218F1228213A88613B842BA81B242289A82B0422A98222B482BA426F2FC7B008200280000000000AB -:803F0000001001008100000000400100000000240000800200000000F06B4B004118184420821242420146012901008728800412260242182818111200408201801182511600484E812382048840028224842028D48E4F018A021C38422A9812163111150822182598812496542218901228852104193242004285222C41822182280213CA -:803F80009228C0224A08216018241C44822488028A824429F2BCC614A02C129244A2298231131420F221523091301621A729502260113221CA22016014898108141818C24012311851A048422984A2C290438014824862A8428328F6454300441031428091214058120084218008004A21128804152224220190421224302220222182128B -:804000008212023C08148008218228800200EE631004181124282B12110014921400122D148011812201111419441461141901220012000018908220846424400300448425220200F0BA962044810AC018541815A412212031916100148D241A72144101308800524CE324321896223256688218122C82427811C21286C2221328127288CE -:80408000C3428288528011283448482F9E0A440011E08172220145C11211881886514200144C2281C11100911460114E241E6123812932163882121230328413283182421B84211184248200242800008F160D4811B800214CC1118002181112602143018CC1215C024081884484341110C822802404002200272160242602264262182949 -:80410000044968A52011883448485FEA074A014648114281012021D121041924012449D218632111121362164438A0841311683383018140C11889F13144802811324212328004120010120C0029F8A1DF402821041261482002848C01836284298281248464226041004C01882001001CC119001992422418001352284049746102508277 -:80418000A02818800865F2B1E400211302403828334201192402100100008200008100222821481841000024268802001001251802800880220412B0BE054829D18152211652942A9422281289E12403848F21240249966924881849C161444D2800190139B118044D1819118181B12211AA1A408234181A52288D421C8401A348226AC1DF -:8042000048806168EFCB0C18000090181114601415081944012C01181AC421C021000048282E1828211200008712156422C012601250121100210000222008F0DEDD10954114B41041544884801109510044141001124785806881155884F28C8448A8844A02128A4123018213042110026480A4414248C082488400DFBA04284481630450 -:8042800080921111808801009124850200002082288114181628415A248221231204121A02811324384112200190188AA3388021890A67AE302430218042248281C21128200183018D34442A0128203244284961423021122220122881821401405284841C1164111092138C0121A5023628242244FAB5C410021008488504184C18C842C4 -:804300000041494442016418414814141480D8840416012B4180028148420018419012411113227882A414824210420C18882D62308181D02102006041113301200136011602111011A4C281418904188A0440682890112200190120410418210058258824321280812652126FA70F425141401809508122800284140010840532001901DF -:80438000118D1410C11138822A240180A1128412150200C011121542088200822200489E5540C842104431125092400881400181608412444C01114781240031828450E22C0350C2124810124408400480088008982A6822800184BF13040081108112298202994A112191194489E34122820220028222362416E112080000C60118421154 -:8044000024504218290121250110981221808148A8142CE868088428491282120C48C0484056284D6A242C0110C41226042321981884881601202242C188A28421482121206121411006848A222848044481285042F06B1924418E4755934193D2124298219753D9F82A881E21A14D492921942A76BA14C2152544F414218EC819D818D8E3 -:8044800071F228488EA1479A1B9184AF2978826A292CB93254215815E162D85341B2127496F21547146C11E281B188A84C1A21A8382324E17241F8E196141D65C384922C2932111CD29E81C3788A734948D34151113E144F63D155E142711132241E116E54728F12E241B13CF1D4148F87A4C583E263A36449847B1111A8111692181AC189 -:8045000042ED1C5D120035D212FA11122B8C2FA455222B4E2D842E8A4B428F8286C682EFD707221972285CF214C7C4C7421A4448711141223118C7A1D549181A32641A23125854867A24C848159115B13C12E882B1683A222D64B845B142321270182841C51429A111918E81C924E1C1D928AA33A3E181AB18D28B483F694A2224022284B6 -:80458000230623062306622024E114024E21C021121C028B2486824282C2824E2440A482462452412215041504111081088812344904498412843284424142EFE64F73C371445A82FD4B4EC15FF7FD46467774B9E5A1F7D2F237111E42FD457FF556533B44DF54F521123F543511188F82F494462F28F88E1A2F86F444ECEFD9F51F79D7E5 -:80460000B1A7A145F6BE3AFF3AFAE3615FF67217F12563B79157713731FF7151534D851F38F89383B5F994948FACFADA9EAFEDF96EBE6BBACFC2F22C2ECD8C4959EE2F5B47712177437D2D7B4F5B337F79F16E4CDF55D15DF484CEEFEDFD5B418FE3D65FF54E7E7F15F51F3955F145433F51F1113775F11C187F54F189A9CD8EBFB1F15EE5 -:804680005DE7D8FFBDD19F51FD6F6CFA7E7BFFABF9F7755FE357375F22731BF91516F57D1D7617F115877F39F98283EFB2F29686EFE9FC929EAFE9FDACAE6BBB8FA2FB6A38ED8C4B94AFA1F18DE3F041654F62D6EAF22F2BFD27FFC3E344F2296D1F32F3DBB99EB7BFA6D722F34F143FA1F16F756B129F12E223F173776B137F52F33C5CE0 -:80470000CF4A7725F525A95F77F4766D8FBBFD39F597B3E7712F29FDA26E1FABFBC7C73F237713F53122F7F13552DF7554578E151D972F11F18BB91D81CFECF8DA984F2DF8E6A2AFEAFABA28BAF77E588D4C8FA4F5AB19343F7EF62B64DFD2F22F2BDFD8F27D7EEFE6F23F759FB3F3D3B19FFDFF2B32ED3AFF44F16E5EFF12F23F38DFD7AD -:80478000F777563F72F337247F52F23D5FCF46F6A5AF6FE2F27351CFD6F6BC5F9FFFF73A198731EFEDF9634E2FABF8F3E3EF6353732F23731FFF1212BF91F114147F517195F113972F31F19BBB7F59F9DADAAFADF95EDAEFADFBBABEAFABF8FEFCCF87F5785E8FACFDF28F1004002410445824924008008464164804004411443144294122 -:804800001403291118022B820080016081200100922492608920019281F023D80011C542181401901E12141181C0158001004C21615413988850184887112DC2408882AC21200100126190161012011123242104890A89022814AF9F052D421F41522A1F4132481F41364A1D64AB141D64AB9419B64AB915B44AB924F44A914B422F14F9C3 -:8048800034482D914F82E414F9A44A1CF8244A16F1244AD6F124CA96F524CADE244FA2FC91244F22F49124CD821F49326C1F49B24AF88164AB141F48B64AB981F64A9251AF54B924F44A944B422F447B24D842FB24484CF9244A6F33022E411FC17428F21144265141AF2251418F3251418F627911D4289B258D82418DB1412DB345C8A175 -:804900006D482DB14F28C1214DDA1EA14D4A9E21ACE819E2B26C112EDA17892AF49148AB821B49A37611B84AF88124AB141D24AD1619F24A228CC29126D82A092F246B882BB427822B94AE1AAFE80E84824800100100400428000000002100000000210040080000000040040000000000F09BA1002644440C003C01810088403822810034 -:804980008490214444001822200422120020034048121913422A012C01402E01126849C248007FC10E29611800845CC928899418867188B241688454203881441943148184A12415245441251811183148426B24262146116851424B81481280CC811342480320440200288F1142F4296F2430C444C184148CD281815118C7288AE48A049B -:804A000081239A891011488284317411821D128C126184111B242CA5248712424E31604146D82411391360886331212A110390122412422C92283216F4AEC480912100E0410848A182100151001084134431214440844404004008412002811120280421481C0881105284420022444881F0589B00122D115014601284412880040084000D -:804A8000004A1281024248442A44840445022A0C24282112E501412843242804424006640030482242F0B6EC2428144C223382284CA5241442333982A04813B142688828115813A8148E45134C419112612A44C5421A22C6162813069022A85225F24182A2468A384229F882128A0429A24986A82880A128881E63242816B2148272812422 -:804B0000926140C5621B188A048A9411828400A0421C6142481C94412D1443864285E46281E2489622660290224C0844884B82814A38423082250443B2124428482882069E5B0011111602604183060021007042888812A1411C28C4C11308002146840421421240811282D192E221042F1294428A1442A284184E8210228828222421284E -:804B8000782D051820140222100240A4242318829482124712008488001280B22208482180014800282A64C18118C58104304186182A81E8823418844C048812218F420184188F14014815080041268401494421C2484881AC015084212A282191C8230812002F9401830190424800008524484A342443C4421A88048123882212F282F9FE -:804C0000400280014460222004800140082411201128120440082C0180140C22119011182028A242392204001C0822002A81624400B0FA0D90129D1200DC0222108482239846482A38181D4431812301284188C0228D228E12422321D428812466112091224F84812862641C468CD838441867442CEE8B84C418269CC62800EF5F0A8A016D -:804C8000202104241082044829013484422281128186584880028381040040C418006012124088D18102480088868801608128482088036F860A8014832401228031822034848888A422886A090041184440042C4234249084422602001948541428281C6845AC28180660480088004144685F57052B1411418D31314A5381212634484918 -:804D000012881408414289028342088068A29825A882805282448C02002422C9822814921822A123A412888E1400281068481A028341F483EE20A812D0228445E114014244200A84A043820082814182808241188402814B128140624241C018C80042428012011311240A414822242200FF2B07001C04262828A224C02182461684441430 -:804D800081C11210832802471289312488008192200112888902460212427C1891210022828424282CA22182484800DF7F0921284008148502188C8218A84821100E9C9212818815088342D4A3028C42542A001002A04241148C2414C811C332D9841825484418428892544CC614C818824F7B0B289400842321044C924728002021F814FB -:804E0000A2428002822E8463880149420188484814808844E29224123123C02C2121E04A4442034C012121001092247B8260C1A042106588508420484204208802B028082210028A0130428618C422102421528100164404498208282184008226488401182E88298106AF61062048B8112264A2E02264842446C822842562A44884002550 -:804E8000823224892211022861AD14A842351802212821F08242D0A231454252B03544F911828413011E82160812421ACA8142C7A6E082148206A8214008406248A024C01246863448C200214818418800D01421C13383226188C044301141004449886844807244C2182594844B82131444B44222F83E2BE022E718551140F618981F82EF -:804F00007662A833478290422F2898422C41F152E42CE4A503A29C928445C18A2B32B022C42643F272B625F824862386B381042A22F146C42D164F54745594693F6AD614A64654122571A63A224F41B268EC11B124F854A414CEE42F8C0B529B2A21AB523B2819764A51486D448F1876A2E28E42748898826FC61FF48828A3F222292D882D -:804F80002AD828E2E1EB42E2F1E842C22AC37B88DA9464218C43622824C145F6AD1185D19534282EE34F46F85811A35698AB287D1C8506CD262E1A6B114F46E4E537A28F5601BFE9425242B02CF2512B8F97752261216887243F44F848A48D82CB4442C37C18F2A8122F16A1C88BC8895244A6A44AC141E5DA5448D8421AD8453718162841 -:80500000F322A46E22B14EEE1F28A12529F288182D134D888E9A1F29CB928E814F84F918B49823E848A2A880A5E143F2D9384004C418442C41444248C2486088248C44414805348285011421850185114201812B128163123122842B82404128628126A14114121492289228846088608828FF1D4542F2442D65F134781F35F4551D5F54DA -:80508000F422284F25F5442C1F3848E824CCC84F49F99FA54F69F8468CFF597DA1B1A8F88484DF98F877CD4B82676AF7325F54EC89F18A2E3F34F54854CF42F226255F53F3C6644FE6F225255FD2F78B1F2FB3F362267FD7FAA1A76FBAFFAAA88F11BA886811CF4CF6AC2EEFA2F2AEB6CB3B99A159CF82B53CF348C4DF194A7226F6252DED -:805100007D235F34F65D6CDFD6F24D6D8D287AE54EF681A72D222BEE4F44EC29FB36163F3AF825A5FFFBFD28281F38F8A785D7926FC6F58D815F527827F364645FDBBB28D273F4555545F42424DFDBFBC1411F92F424244F5AF949592FD7F366267F12FAA5A52EE36FCEF6A8E18BAA14AF44F4342EEFE2F2AEB6AF4FB66DF11C4ACF82B694 -:805180003CF35C54BF294FD266C661A5F419195F77F653593F34F4161ECF25F7CFEDBF7EFCE8A88F24FECAC86FCDFDDEA8CB8DBF9CFACBE3272CA1BF9AFA89A96EDA8FA2F82B8B95F36C4ABE1A7FF8F26E58CF74F52C26A7A21FB2F2D7756F62F62F2B5FFBFB8F4D5FB2F67F7C5FDFFFE9F97FD7FFDBA49F1DBB8BFB1195DF4CFD1CB6EFF5 -:80520000EBFBAE224FCB8FFD8C986DD4BEA84F42FD2FA5244E62DD25AFC2F279399F25F67E77BFB7F77636EFA5F74FEFBF9EFC686AAFACFECECEAFAFFDEDEBCF8FFFF8F82F2FFD6B29AF8AFAAEACCFA8FA616FAF68FA2A2C8D2EDFB6F6969A7F12F23E5CCFF6F63A3EA7A22FAAFAD676FF72F22A2ABFFBFB4F495FD6F27F7CCFDBF9BD9918 -:805280009FD1FDF3F49F1BBF9BFB1195FF6DFDB4B4EFEAFB8A264FCFAE944B8CEFCCEC8FEE489DE5200222601248262121022282A0482482A048A04828824C22880228218D24414A02009084009094844712200214843484144062894C2221044624F8F84FA018112490181A3448304480082148005C2BF24211841C088D8147881441144C -:8053000040C1821681E44102190219021B2181CC14B2812434812B8428A94848668285064A3824208211F4DDEEC0521F41D228F111248B141F41F24A111D24AB141D24AF14B981B64A19B54AB924F44A9143F24291478A2D914F82C4914FA2C4814FA264114FA264192E4A96E5A2EC4DE2A2FD91242E421F497228F291248B841F49726A5B -:80538000F38124AB161D24AF149961AF1419F54A9143B24A3B242BB4478229F9A448984FA2B4EA07581D6C2CD141B648C1248F14D141A2148E244E951B282BB45B214A39242F1429F24291478A1CB126C49167831CF824C21E814362192E5A96E5126C512A798128F2914C221B418B8686746273812406AD8528AF14BA84724A3184AF24C1 -:8054000012B4427BA498126F8294924D5A8FA5048480042008000044800200000010020000000000400800008400004400000000002501CFB80D0084C0411818142311A41480044223024D12680083060000002426341424120018210046414803488213748112E8A104209448292224048332DD1074A23111212273928118242E18250185 -:805480001038811844308160484486C4291592614E114415241411028C14B441129228198841C24143024F2201281844001F23C424512481F018A1F0FB840027141781216673340110624269042A14784122022C81082C2822F81128118E61521061245D2219418214E834A214A99281C0411C742411323469C841AE11C4460816C164DCAF -:80550000446224E0136881CF510C412800008E1113C11216C8110080284114E41402444D484400211441440041C01844000018100A80042824C012E02402242281488122BBBA00200261484F34111112111891880000C0842210D118110100430288508220021411141A820826012A088840225818506290A2304800F0981B402471116481 -:80558000122001581D4A8423844872C168192364111172411C0280022A4414825843414242200290242419828201804541518181C02CA024819094824A82F2B4E540847111C421444A71512411422814018E41150211114B424312011800424123224801890428284081A221290A1C028A82C48114908291435226A082C0188822225F377F -:805600000800282400241C744813112A988825A881421220092214941302284004274864200440015440812201200110490881A042A1E0440842F06B3EE0840142898224810494235441000083011440582200931202298108502480447121084488820041890441821C614814228CA9280025020025E2C50915886285113041204504444F -:80568000143024800212414002944888181188820028241C0240084C0448482846A18410483424302200810000211FCB4342022110861211210480639842482482219381041844102842083140010042222125C421244118244008240084248400180000BF2B0D16912225782992444641011D4C231421439844482A1132129489148241C8 -:8057000039298968228D1130834094221092212C0269D81402E041642642C9285881214541EA8279A208A4000024DFBF01290418001A22B4110400111C08408818C1140040C4420000001420242204442048C244404881041288000000122100F0668E000016110831110000006018880000271866828408498438411924422284A44200F4 -:8057800020B85108842084048638444820022442482B4800F063A62441142821293214204108281944B142A9811227414628426144708245028814504224C014004111412444D0241404418821001225044141853482812A180EEF25092230282022648220924113861888148884622828426880021B24808284024A020048146012508107 -:8058000030110092608838869414822D12C818824E12A01463F8C167C042000011114121412129B44308212501411A4822C1412502502488200414411004420038A0141004418144231801504840341640148271B40A8A1418411C22028352182618187144088488C04100144C880890240000004294100440B284410884806489701106CB -:8058800022200112482D92C21A22F4D87200544813C31820010048890221404412082100005018401401244286020000220048381122398434822C230123028284418410F49BFE50C2002144912180543418441889213518478844189014484B1489142264442C14D42201002A212211842161244121488301C01484208801388440884196 -:80590000085F6406284A120118418C4302008502850487222223022646221282221491232220344481A042200426010014481384118175210283828186210480D3220CFF9107A49048108101311922156141882C8228A414142B842122122541E112012C681122234203651314548480D462488AC11841100625044C0A2B82822DC6100414 -:80598000302286F86143E06232C31D2A85E4C362342C7211D18832119D6189026D42237885B17472497B3222B42472A2F124E1482A46E11684F426222AA4622568281D484B244D41441381988A2741C79418D384AA8486EA18F81214AF41AA222E8A2F4468E445FC52484CEA8214F24844244A9428143B211889D1184112F348446031EF3B -:805A0000BCB818F14818AF25542A26A48825621560283724C046357425D2112454536C81B47402131564126B2A4E42CD5219F14824584E16BD1918AF21B78428A2986B312AB51235C24D922F82E1653984390A615483C213A5F115243783C962164D232B163F849C51C6A8812E988E9469AC3453D262B555FC41142678C3F1258849B2424E -:805A800069443721469244274425E44244042CE261F1911D42239144344B49248BC557423CD4246121467494928C2C3D889A9428CCFD7355004302224822A0124822200280C4258E481C82C425C0248228114A021E24111A1221152401130111881190413011F09148004482448A4424180883243848AF810A2F247446085D55CFF4F453EF -:805B00004235D2BBD157F51112AD123F31F1CAD6CFE1F89A7ABF71B913F9551D5F4CAC111D461F51D911DDAA9443D7F83D532DD63F21D55684D5CDB1D4FD4A4D3E511F1155915F51E11AF4991BB7B537511F17F34D4B7EE3B5FB5193BFB7F14614EFA9F334166F49B534F352C2CF74F496968F43E841711EB4DE082D422F867428FA151504 -:805B8000E7F37F71F12A1ABD1BFFC2F11113EF76F19B9ABFCEFB1C9EAF89F3999B3F39F395B77F78E82191213F15D511FF185A39D2FDD93297723F21F516572CD398B192FD58799F927245F1515C5D271F32FE51537F65F11B1D9F82F24D4B1F3656F31D12BFF5F15212AFA3E123D322E323B352F556572B952F43E1435744FFAC022E667D -:805C00007D67BD2A7F72D377F237249D283F33F25765DFE3F34A741F3FFFCAB8CFEDF9DADAFFF3FB6EDAFF5FA9BB7F27F737557F57FF25918FB6F32341DFF67E237774F727236F77F32341AF95E44CFC5C5C4F82D455D445F41113674AFFFDF51F1E3F15B461F25D5F6F66FFDBDF3F35F9DBF92F25F59A9A2F63F1D2D4FAFBD25AEFE5FD5B -:805C800016DCEF87FDD4988F84FDC146246F62F62F67BFB2F23535FFF3F23F3D8F82F33B2BFFD7F67D7FAF76F7FBFAFFACFBDC9EAFAFFD7FFFFFE7F7FDFF3BBB7F63F337355F5FF7A5F48FB6F76361DFF7F623634F77F637776F76F66361EFC5F4D6D4BF84E692F655518F41D531F2F6A53F3DF51E1E9F95A577DFF5F5F6B7BFBDFD53D2FC -:805D0000FF9DBDD2FD9A9A6F6BFBD6F67E72AFA5F51EDEEFC5FDFCD8CF8FFF4CCC8FF80C21004002000000A049204122480200420020840129012921941680011810064100482048020000A0494400825DEC6028154402400C1598183048D028088918840844414611850814401144814501800448442018E84114420C4C04842C81C4140E -:805D800080018F440121841884CF1E052CF4112485F211248B141F41F24E111D24AF24D141F24A9119F24A9151AB9443FA4A9143F2429147822D914F8AC4915FAAC4816FA264115FA264191FA26459ACE449E2A2F491242CF4912487221F49B248F89124A3F48124AB141D24AB941D28AB9453F14A9543F24AB247822F44792498924F8202 -:805E000084FB244A2F690B2E421FC1E42234118F12E141F46E121741E3A6418F6628B14ABA85F24A964B482F14F314482DA14F81D412FA9448AD215B588F14DB24C8A17D5A9E215D4A8F1D42F318212EC21FC9C24A1F49F628421F48B248F99124A3F29144272617C8AD861D682BB49E282F74698A29EB88E4447324B84279A4B842FB2444 -:805E80001AFF260E8480040000248100800200002008218001000000000080040000008004280000000025013FB40E28446011687014015081241886011221008840C44822141CC4224423068005400848224C0200140090122315018882D244814221890484BFCB4801864118045D42485081C08994C0493944D2A164129D4230419220B6 -:805F000002009061C0284AB1828253124011623288344644236516501818A4814D22602828218363111E818AF28D58207244113815684592415081115958181342F11342904B221B84904142283303A261282E4130481D428A92288581E41412C4214073444183641469F1124111248E286CA248702298422B2185E1187112F867ED000066 -:805F8000001994140084852281C84800241185024496086014002904A02118C0120030229082008081028418842088318400811A04A6F2ACC7400234800126020010114858282064814C02381944212204448042022246A442400200002911110283062480218928281484E188A4848AF4B14AB01142614249618227841249E2B844A82148 -:806000002328041C9421211B424880242216840262181022364200222211282982A1242218260816E121A4588E462C442442028C92483024844F77093C025449B11842A8212952218422194848384139028CB22404221C641628289024122221226244286022112829026822118C024A211132862995940010BC1864842A84F4789C204165 -:806080008112022304448B84201122048430421E41001A84024442800400272420242402002001238111029382842D04212A6828422880684883F87AF2E0C40342106218139148144664C8850290424642384112502220829242184C022094284824802641E841C8C240A248412110843212143A14024E1482202802217F3705843048C376 -:8061000001002284124428002A21220111281D22430481228A012825010000404488A24242004246886448848C24242242021224A08490827EA20012110088489042100120091A280487429014000028000049012902002504114440942814181A24440180010022528008DD61A0121281C1211456A12411168498286029122E128C11515C -:80618000582C822384822222C2241021D48422D422022A54244126C4A1489042C18C8485C12A1AC4411832102289B2128C8E28F84498B0840414120040384A4885012120A448424838401504A44200260220414101800198100649885612A0844885014602B014040000F0A588001904130389068428441008484008261802302228132225 -:806200000221602228000020110842202206128602800A000048220000FF950A00004C1484248194212D621303121A142324311829041820041210120280C22120020020810142004341060088A042811880612289F45154A0492A410A1048688227820089141249082548482214022814111A4282D2210242480000212008001E221082FA -:806280000856818C282241021AA482281222E34A2112080018230200504220514222181220C2148882C04448800100241242421598281542A8484606004E8848008C0221A2128008482223D1430B24150411104191131522324150411184211001289012884800502120031A220112206122701221012A04121324481412A2282110120233 -:8063000020C4217BCC40048907184C8544D44214011302801418020042221002202602482211482822763824128A27021601002D128088A14880418882220C82F0543E4089145484490A8901848C6182448180213128A01218292224012848610000246015400800502642441E41002C2101301880A4418061818189F1716C30248A9124E9 -:80638000898232A2630245721C02404402800628C041882582022222181420022890482004B082040000002028A2146249022120B21884E46C49C141281B414AB111041391621148116C14C128112A644166C2442001250458A084424218A0411428C0282100284E28188421182CC81C42298611229812A2C823664421F01CCAF014221760 -:806400001F1E2C1B135AF8114653F3117825F818441F14A242153111242AA724163968221CB422E1484211C4124158233412681B212B411B253AC6422B22288E421A624118442334821741846932C82B2489B912F81472AF26BC32A894381653A25F7D44C1458F48D518C1643C93B41C7328F429277931281B25E1ACF4121981488D621E62 -:80648000162B24619AEE22B162B221A4424A14F221212A22A2561822A02287811592823BDC6A9243AC9411838489E82C8DCD8221CE326238CAB4227614E882AB518FEE0213863224A5F924448786AFA454224B442E2B2D42A54BD418B14C54A3AFC3A11229C2527E128098414AA2252F22E233428205242A8234481B114624B15822D2A66A -:8065000025A736121E922F2CF412121311A218BA26120838826AB448B468F2DD8E00411044880818804188C14810441144D184441124341410041112B01802008031411811891911185128195428118150184881486089608120081743141F34F656299FD1E211F451C356F35B6D4F55F61D49EF74F4521817215E4AEFD4F551713E551FB4 -:8065800057F575176F83D1C6F455174F41B8D4FC66454F52D431F2555546D28AF12878324E7229A2754AD331F247258F81F1B8E8B7BCFF56E6A1F3666C9FB1F113914FACFC424ABFB67443F3193BAD4A2E32EFEAFC6842AF26FC2292CFC3E183F17A2A7F694AF151532F1FF319211E311F3DF671733FF5F47767FFD2F57C7D7E3F37211F8E -:80660000E7F65E5D5F75F73A77BF55F57C367F95F5525A3F13F3B6844BCF6E714E415F7EFF13111F13FB192B8F82A5561F34B762E614F621292CF227251F12F2A1F38FACFE7F773D3B7FD6F6181ABFBDFDC7DB3FBCFC4E6EBFB5F513132F28FC3A1A6F6AFA7852ABD62BBAEFC6B538F37A6A9B45141F74F41755DFF1F33B1F7FF7F5F24FF7 -:80668000BFD5F54615FFD4F65F7F2D7C1FB2F7423ABFB5F15755BF84B457F15C1AAF45F579332B516BEFBEB44AA5442CFA74462F277123A1637AE436B752A7778CE727D777F61311BEB2AF2AFA373F3F35F34E6625F29B9B3F7C5D2A3F34F64A4A5E522F27EB2FFF6E3E2FAFFF62E2AF8FFD6674BED88FACF9E2E2145F77F7B775DF31F2C3 -:806700003B37FFF5F67F7FBFD7F76537FFD6F46F6FBF95F6697BFFB4F35F1F3F17F5797A7B37DFB7F37A649F37F776744BFF9E941F16F665654F67BE22E12AD233A2636AE736B772B771A7771F36F636362B338F8FFBC9E36FE7D722F34E66BFB5F5D2D22F6CFD8B83CFACFD52522F25FD7A9AAFAFFD66762FABBD32FBBAF84F42E72BEF3A -:806780008E7F660A14200200472A8447226032482412241608122812004A1281024A12831222044200000018802101122448000000A04842128304FF880C4B428041A416444B144C344800112420044E2140214201881100100122002032112632112612A18211231451221308119882200A808284021814ED2CC0421F4152281FC1324824 -:806800001F49324A1D24AB141D24AB9419B24A19B54A3924AF3439242F347924D812F924481CF9244A1CF8244A16F1244AD6E1A2E459C24A9E242D4A1F49C2421F4952281F49B24CF89124A7241F48F24A121D24AB9419B24A19B54A3934AB9443BA42792498924F8284F9244AFF9B052CF51168A5B211764AB211324A1D24AB141D24AFBA -:80688000449921A99B65AB9443F24A9143C2914F82C49147822D814FA2C5815FA2EC11F8244A9641E259E292E458C24A1FC852241F4856281D64CB841B29E72617488D121D248F44D94192BA49D21A3934A938A42F44712498926F82C4B44D5AEF220E8482480000000044001800000010021800240000140084800400000060428002006B -:80690000000000F02BFA90441C42612285148C8212C12483243113407422028CC38421258444454314118612A8418D114240220824118448242CDC84844AA94248429609229024816088205828BF2A0B36A318CC61911F228D514A16287492C2129450291941D8244252181AA4241C1188A224239248583B2425C82222274623E2128401A3 -:8069800082822E1260121652213E428137A12CC8424B14122CC2CAA043282AC12922FF9C0D1E46F2C57138634C4781C32292412F28F1144A16333195D224211262A31D8242484E11113313E22862442A54924A31381724442483084642318842241314661A1D1250122F4244331400C54228440A828B21BF5C03261181018F320121160883 -:806A00004C02840014846C028524D1420285044E243181184A52821423A22423B241820188E022012AE88154228C36681E482CE8892424C322AA0432A8328942B29C0700008B1210042144182004000000000000850442240060220020922100000000210041290228800228F0E747B0245441165C144004491311010024504823614242C7 -:806A800040014884E04244011110582848290438820068518424182C012283542110C84800240082F0CEA18012311430184094242154182004401C024810014800424120045028482C022882281922420110221102811450488C042230228008FF340D43441458412244204101442002218091240024008301494209112484402204124618 -:806B0000082014140812002823442202290200002229D1240D18181420814206702211E882011004108A084B618A0100142180128C18880244001A32128C11820881248200800181242004621628F2D16E0000C381024001800418000028224281002042084800220000200210048112200100897882A2218001008004AFBD0122604110DF -:806B80002101200211000012841200C06800410040820212201282014428400223220285011002810000002830AE20011615288101142822408801411860822094341EC8004312098052848281282261001E261A9214248CB82291282C9181002D8A86A21281122148202482F21EEB202201166412284502241187141A0200502812A83049 -:806C00004822004002483022281800808102502800001008001884000020B24801AEBF0000121812001800004100301418124448000000448442222002002212200120040021000016A8248022012E483FA1011800410083110428C01200128C4108004836048742412222800600002828222428AC02800384222004488333580080044287 -:806C8000F04ACB800100126081442042240141004004124334143024418002448024022828408812C2220080040021201248882102221840F85DD8508883044301120012504445A6222A22931884181840726252221E181AA129002A44081100857828A8644A244728012A018149026A822226234528042C54222D425AF368C700200200F5 -:806D00000083011800000080010020040000002228002002001008890100000000400800222FCC0B8CC168421A0441200200444C8282020000D022022981812988088140114101848C8486040000C04441442228002001704A82D282F177D850C880040000004024A12200400484C04821818C01880000421410D888024A042200000044B2 -:806D800018280000200210029F1D0E80050012180040042800000000218001C800004001C0288004002800004C0128000000002180F576F300000000000000180000001008008004000020020000000000008118000040084820F278B3103848524A01009011124130242222180000242D422412129A2228080013522111811283242404BA -:806E0000008001414538242002000024AD222412DE4E40C8184848224100104144544828280044004290422D441818888810084041018484684800000018444C82A222000040082129F493550000001220010000000010480800800200482001602220A22100200218800100202401000080048B5E0010041800008041080000004008411F -:806E8000001008000022200200000028000020040040084820027E86102401001818001112200100008400890248000000002222283AA2232A022200200158810042004048088F82A4228B441F810F80218201430180810100120040245188844E4841C12024044884126A8242220200002884388C01122021050000284842A0221FF30FAF -:806F000018221624A12144A0121781801118088001410048802434282284008100242800000022008001100880012011480848F06E6DF026222982B112219112C0122592832F31F111119B98179885F888418F84041D4911489558884F84F448444F4294242A22E24202284554242AF2262227212CB112A1812B99C0922592822F31F11192 -:806F8000118B98867948B888A444424E4880548885E884B6390B6F22D224A2123A21110214259282BCF1111119E9897818D818344842941501C485C8688F44D44CB444B2642262428052424584F3222225A2321AA181232908259282BCB11191D19E88878189B448246484008485C848D7A2000040110100000000000000000000000000FE -:8070000000000000000000000000002502008FBB0D1111110000000000000024244002255222250200242400000000000000000000000050220070CF0F00110000000000210021245022242100002421244002000000000000000024000000250225023F9E0C00001111000000400240120210020040120200240000000000000000502225 -:80708000000000212421F0864A00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00004001000000251212020000000024 -:8071000010522210020000000000000000004002000000243FF80C00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000CC -:80718000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000B6 -:80720000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D000014110000000000000000000040 -:807280000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D000014D1 -:8073000011000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB000040110100000000000000000000000000000000000000000000D1 -:8073800000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000BF -:80740000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB00004011013E -:807480000000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F66010000141100000000000000000000000000000000000000000000000005 -:80750000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000003D -:807580000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F6601000014110000BD -:8076000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002559 -:8076800002008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB100100110000000024002400244012121202404202000000000000000000000000502224007FC94101100150110000000000401242420200002421250224000000000000000050220000002440028F69030011100100000040BF -:8077000002401202100200401202000000000000000000002502000010421202E72B00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB000040110100000000000000000000000000000000000000000000000072 -:807780002502008FBB0D000010010000002121210024212400002410022124000000000000000000240021210000214FBB0A00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000141100000000000000000009 -:80780000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D00005F -:807880001411000000000000000000000000000000000000000000000000502200F0B8DB00000000000000000040022424212121002400000000000000000000002400002100244F9E0F00001411000000000000000000000000000000000000000000000000502200F0B8DB0000401101000000000000000000000000000000000000008C -:8079000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F660100001411000000000000000000000000000000000000000000000000502200F0B8DB0000401101000000000000000039 -:80798000000000000000000000000000000000002502008FBB0D00001411000000000000000000000000000000000000000000000000502200F0B8DB0000001111000000212121002400000024212100000000000000000000400200000000CF3A0600001411000000000000000000000000000000000000000000000000502200F0B8DB75 -:807A00000000400100000000000000002424240000000000000000000000000000002502008F6601001011010000000000401242420200002421244002000000000000000025020000400225021F340B000010010000002400242100210000242100400200000000000000002502000010421202FFDC0F00001411000000000000000000EB -:807A8000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D100111140000000000000000404242020040020000000000000000000000002502005F140B000010010000000000212502242100401212121242020000000000000000401202000020 -:807B00002110F21C5800004011010000000000000000000000000000000000000000000000002502008FBB0D0000140000000000000000404242020000000000000000000000000000502200F06816001011011100000010021042022542120200401242022400000000000000004002000050225022F0749B00001001000000400240124C -:807B8000021002004012020000000000000000000025020000104212028F810700001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D110040010000004042420200400200004002400200000000000000000000248D -:807C0000241002006F6F4801000011000000000000210000002410024002000000000000000010120200401202212FAC060000140000000025121242024002000000242440020000000000000000000000242440023F1506000000000000000000251202000000250200000000000000000040020000100225026F250A0000141100000094 -:807C8000000040124202240000250221250200000000000000005022000024005022F07FAB1011111111511111000000242424242100000040022125424202000000000000000025020000002424F0BF1B10111111511111110000000000000000002400242424000000000000000000000000250224D0EA06000000000000502221212440 -:807D0000002400000050222552222502000000000000000000000024100224CE731411000014110000000000242512522224000025522250222100000000000000000025420200002140F2D24C0000001001000040420224212110020040022502250200000000000000000025120200000021CB3F00004001000000000000000024242421 -:807D80000000000000000000000000000000002502008F660100000000000010021002100221000050220021000000000000000000000010420221F081FA00400100000000000050221052220000502210020000000000000000002502000050225022F031F5000000141100000000400221002425022421000000000000000000000000A8 -:807E00000000241012029FE70500001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D000014000000002424240000000000400224240000000000000000000000002100F0DA6D000010010000001002100224212445 -:807E80002100400221105222000000000000000000000000400221F7BE00004011010000000000000000000000000000000000000000000000002502008FBB0D00001411110000002424240000002400240024400200000000000000000000001002002F1103000014110000000000401242420200002440022400000000000000005022F4 -:807F0000000000244002AF7A0C0000111100000040024012021002004012020000000000000000000025020000104212028FCF0C00001411000000000000000000000000000000000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D000014110000000000000042 -:807F80000000000000000000000000000000000000502200F0B8DB0000400100000000000000002424240000000000000000000000000000002502008F66011100144001000000212121002424002100214052221002000000000000000000240040024002AFFD4A11010040010000002100002424000000502225020000000000000000B6 -:8080000000244002211012124202FFEF4601001001000000000040125222240000401252220000000000000000005022100200400225028B63000000000000002400242100210000242100000000000000000000502200000021242124D60E00001411000000000000000000000000000000000000000000000000502200F0B8DB00004027 -:8080800011010000000000000000000000000000000000000000000000002502008FBB0D001111140000000000000000404242020000000000000000000000000000502200F0B98A00000011000000100210022425421202002410022124000000000000000000000000240021BF9F02000014110000000000000000000000000000000036 -:808100000000000000000000502200F0B8DB00004011010000000000000000000000000000000000000000000000002502008FBB0D0000141100000010020000002100000000000000000000000000000000401202A0840000400100000000000000002424240000000000000000000000000000002502008F66011100400100000000004E -:80818000400224000000240000000000000000000000400200100200E7330000401101000000210040022424000040022424000000000000000000002421002121210077DA000040010000000000502210020000104202210000000000000000005022000010025022CE5A000050111001000040024052220021502200002410420200003C -:80820000000000000000002100000000DF914A010014140016084143024004C428281A025A2201231182810121184210283448A02418488C05848480040000001E28281A12088341F85E6F107111781811981C45982C26644228183849423824284187414438008915644425322429E18152828B218B414881201448484A6284622AA42421 -:808280002A01228C43088B2422428921A452124622F55EED001781841440148801006042812222400C202401444224442CC122811688812404200242848022020040080010488802901885F2FACA100112301484000012384044148822021A029048214418322100220081201488416221814618288207804108830472209448184248BF7B -:80830000640C00144008418D248042040000001A02228081512200C018204408400848400842208404000080820222122A0190128F760D0010480122C024442200004444184420010000002001428420044008420000002228000020010000190C0000000000000000480000000000000000000000000000000000000000008FB1094002E8 -:808380001280021400814A126844008C811214842432144120024100200523CA3258388424808184B138840221188400460210028982014D748011619111A456321C4982119A111C199288B042222A01BD42228A8414180621A571169A1921E94268414214A028125826481142254121C8481294254264A4409844C822287D652051214015 -:808400000176C21C1742164258181DC2814E8430422E9828455248222A9C1424412221955482A1259248814B1A384AA1218E2820A4214823E1842351212045484852242C04844889AA21225EC700D018215128000080A12140082220011934422054840010624119014B121022541200122941480145810282811234204448024448004F43 -:80848000A50F001480C148102104802484440124C0214180042280541837A29016810026A2244100004426C1486A21382A120000832499288002001EC3145B163012A312416211588711284282818443D18224F124C9C28CA42581427041289242604290626963264A4184C2231D221C817A61D88444C188CB41342C24C413644843D28451 -:8085000064448CC844A222889DA92002231122C14816018304484A6884901184248C220800200228902849C2128384022C33442890212981322D288C24C24A8C828544421412A4812A14288222022FEE4F315510C1281424C0511921020046483442184F14C86146AC344628048714482D4B15421284921662292412742102118842C714DE -:80858000118B854B1814212116014866984C852498448820F842EE00A024182426221455484951484A8241A8164800823048432844458421846C22588E48204109528416C4411E442018C421C724C12450482229C44848486023A05244CF840B81204404142628012244800822282A812212642822144886882181080029417412230184E5 -:8086000086880490122842124D811422802802442C81C8444890629F320912211480044446B241124241081881A084405422518021021C420B2180810422282121200249028305804128C841180024A0420000CF9B0C001CC2144662328C6444153614E0828419A841228A028E224552494CAA412E458748D018258422F49842522C61A328 -:80868000366224E0C1681252222328C2414D18929150498AA1428146E621842A212485F2E48EC0120000302413316A288501201188A4142244A08440013021502290120044001800104484E1C12482541A90824824200480E444022849B4B70B1524021052298084D28102214098856628226882430A2A2816842884028488006083A08438 -:8087000041C024002DA48018181281B45888B4880100C088A8584D222F1D0600E9041E22807412C81880712802881E4880180124411694825A98321816C88425048A042318344549010028821031422641484242121444088B24498401A504A7F1204112912168381F81C22EC0420098341124898501114B14002034342E4113A28226345E -:80878000354228422B28142BA41C02281C02285C011C2404465114228220A112614A8884F44A622400488D1281001100874410284104148972132AC428881741288C11D28288C14B2C45486181211828111662211841814901C988818111287118A214AE1200220023E8E50B2C2462228A87C138846828434218284218C26226890A2E8400 -:80880000181CA642DC04221422208A84259271A6012604191431248A3222B212521100004A4BA4258A2288E24188F4C8CF0014842028040050225048A8000088801818224811881808814489028140042D4822C114C443C8482821881604824A0A2A044218212128A7A3400441904841104404186448C01818441CF411241810B2811142C7 -:80888000844814541420011820216814480020140149245842404102401208841283023F3E0F18486848808413116114488081810812842487254609008C08003842158A51240024A422214082019051008244422082052127461840F4112E40081C44088004460CE042046842144686C5441128155442144E145CC48421C8412222254154 -:80890000028C8281941435A48190122D2488C0149384321840089084C0442382B8DF45622142118D692C472C67A3542E4A8C447A384823D1A136D187914AC823AF25EC41C6C21B1446B51192221CF288414F41D24485F222A4172533D6417163B229D26472143521645F3B91411EC41BD124871513B141FC42328BA94A311878238E85AA74 -:80898000A4F642111451F85285F838619D785D6147845CF248168B6243B888DC5125961E2A7535BC11D494F125811B188E286D284F4E65822A78242C722AA9168CE182E111FAA422DC4232218B224D226D3829B25EF3C832841691C4CF34D444B128E886B414F4227A2E84CD2C4B8ECFE7E548F452E1C0552E226B222E1223E7244172488B -:808A0000B43832412311B242E181F1CE88182E6F1F2CDA38F3E69C2E2486F874254DC58F284CD85D7516FC53A2CEC81BA52FB16421E9B684A1844BC123B15211E359B8E848E44A782539423B942C61888361C9182EA242472C1E921A0243F2EF9D6044271244214421808194140000411004488130480024812483D4211908810049081C6F -:808A8000010088484008822284254418022184404844081EFF243B227744CB226B622AF65E74EF42F252216F87F22523AF81F1222229F454D62F89C946BFC7B7C6FCC2848F7BF9A6B94F44F9C5D5DFF8FE87AF7F7AF5676E4F67FDA72F272E6E3C3D12EFE5F646477F54F7D4463F95D38AF21775B5F98113F7D87F16F642C46E6A2F26FED2 -:808B00006271EE8E173C16F844466F65756EBC48B52AB684D488FCC8C48F22F43E7B247F46D6C6942CAF42F638387F57F22F252F93F276285F36F21E1C2F22F22A68CFEDFD86BC4F24F47374AF4FF7A3A76F61FB83B36F48F9C5D5DDFC5F1CFA65F77F27F764644F42FA64264F477632F37E6EEFE4F44FFD1F7DF4422EA5FA1717AF91F1E0 -:808B800021B3B5FB72722B541F34F4F6F4EEF32F6F6B2C5E666F66F746D6EFCFBDE8FCA22C8FE9F5AAFC8F4FEDA7FF43DC347F57F723658FC2F23339DFF7F67872CF66F66F37FFA6F61F173F56B228F2187A6F2DFD9E9C9D21DFB7F7E7D32FFFF9DADF2FD8FFCEDC4F59F8ADFD5FDAFE2DEF5FD2F23E3C5FDBF3EC2E1FD6F24A7BEFE4F6EA -:808C00003A3E3FF9F5A7677D47E5FC3735DFB3F38737EFECD49FF25EF6FFF5FF53D73F14F4D9B9BF18F15C5EAB668F86F66C6E2F84F77256E5FC52D84FCEFE64D61FC548F16163FF32F22A26BF37F37F2F7E22CF63F72F3FFFE6F65F77BFD6F22A22AF21F7DAD7AF99F97971DFB7F7AB77AFDDFD5EFCFFDDFFEFD94F5DFCADECDFFAFE3F44 -:808C80006FDFD7F76B6DDFFBFBBE3EDFD7F75A6ACFE5F73A3E3FFBFFA367BF73F73F3F7F73F33C3F7F78FBEE6EFFF1F36F7FFFFEFB82941F3CFCDFF9FFD8F5795D8FA7F57A58CFEFFDF2D86F6FF1B634EF4EFFF4DC6EF23FF802250140088CD414414802141648E288448304842C22482449040044001100424B127022010067224021C122 -:808D0000821220018A442481A24120C8241200FFA60F22002880128456126022488004482C81C48186C81116681443A824842845C8214F826C14AC11883411D815142201118F227881344840819488118324086024824A0142147C0E2E421F4152281F417248F21124A3F41124AB141F41B24AB981B24A19B54A39A4AF1439242F1479244B -:808D8000D812F924481CF9244A1CF8264A16F1275A96F122CA96D5A2EC49D2A4FC91242CFC91248D831F4932481F49B24AF88164AB141D24AF24D981F24A9251AF243924AF2439A42B94478229F92448984FA2F49DE2E0A2B151D238B411F248131B2183D441B222D1C1F44A941B28AB341B212B841788AB34222D8147822F14FB2648AD42 -:808E0000B15F8284F927C81A782768182F826D516FB2EC19D2A4FC91282CDC41F624938E684E111FC8928A1F48B26AF18124AF6641F848B35B218F2428E26479A4E844332429B92694B24F2AF5E3684008480040010040040024000000218001000000000080051002000000280000000021F0FB4F8036118423311645914848818485125B -:808E8000011C341A159A48488E241CE1840142848054820061449046250280A2121024212462148B2C4223CA114860441604182748208221D86A081624028511E982852112D11421A44217818321840760118D265C8222823E21B041C2212681064218D0149D8417281081C42424198153348C48C8884048A2C2618A82C1D8422621F49570 -:808F00003D30241344E8B14424A3144291CD1149D412B2217148C2588F129148424DB18D361C8182F282281CA21C33042CC22444190424CF111CB461B8121291444922A42116F144A34784AB2836088446942661AA31928E48621AB252F847CA80A52124D018D1C1148802108814381180140210F14824208404902813428104245614023A -:808F8000880000122411628488C08148004A09108401006B7600100241280026A24800407848044E2443430142134221A82441302220428401880011211189B111C281842468AD12120000A0482018E888A424E05C0C4E341117422E11121C55126F3144CC13182B1C4A98433419187182A142A83210344125962148817386D1322184A2F9 -:80900000144C22C8241941C42141842F2661421CE81CC2411C4513C4C42F886212ACC1125A028628F2E5EDC024157221C4314CA112241D4428D62121048D41C72419784483082003C08241224226C2442C62214828D2418226931144182882624C7281A28210012188A822A41A782248E88408EB38200500D0211421111E52221A682C10A7 -:8090800001282E151CA682422651141CC46215444268121815840120024110D118321585711218B222945933A5411441465482C68101588A2482F2F55D00917082682226CE62A6F128114220A4188722190427816E1447241632814428545226B121E541F812424004466234228A66A1260546A4846B4870822131C4A0812021022F268176 -:8091000014880910F2C58E14188923140560881A242451691C032032222410011E228E4111842210822808160222941D181810C85100004A02611C12028088041244480023F4721624450128AA210188826120010018200CA2840000004468002246180442102209120023850132809444400200006218F018DB14438142F211281E22CD0F -:80918000228133344112123B21502818228BC144471A2538911D44288504B043B24433826041846246D812C1F2F09924114B41244C741292412CA12C282B414C248132421A924284586280F411D450121321420420A621EB124885818409460325A243421229224891114A32211604522128294414A224201122018A8488A4928011818AA3 -:809200000282244818418880017D39008221C021000045682220611400284440134401684848A08119043100214304182288224141880020C1121244C2100212801418F2BA810018208204D421815012A0C22821250129511818E042444485013446024712821814308110492201002B141133021938A211130700208C0120F8C43B002FAE -:80928000188222052850242484101121044844107214C186141D125012206492124901484420A521A1801224B144D121464122A424801222042223044004243F9E081304111489411A3421188021128222C2211E812681A128190588001682192488A414248E11001D48282815383122390248860800C460422B4844803C82C0A448AFC9FB -:809300000890282031611831112781301221A6063184126264006014D01204182C8405181C8845018248100121308212230113D842044A0221128130128840F1131230244004408482419454228E43008081129421288880022C621A88128A822228613812822117214824601648801411022E82881308C02220618400F033D44048A24100 -:809380008553281344280411114C2301812200C042224311C624444200206842004A48441842024A086041A0427844806141C348849834004190C2CF7D0960181820298A02422880013922022100430818120055621299428118C18248241823263212964221818302482823041906308441422524242408FB9C141F8423D18196221022D5 -:80940000B44411B44221644C11285964854364146F260146A1422922C414800C222C240226B581018441482850A2408ABA148868C2C0A2103248C88828828821418F85044A73828193317AB8C1D28AB23515EA817322C141473B313531517F41F35565B37717F252414E74AE4353566266B21351292AF121C42F130D5A49E23C41523B2976 -:80948000C1119644F213142F2DC343EEE52F24679547218D122F1399A865F4A4824D424B158E184E448718887FA208449B392526572123736562244FE5F147465AF1219229E4347428C669C6622274CABA81382744244714511CB242BBC2E82522B841A168821EC423E1468262213332474F2662926A781982F881422B8A3F58D44484842B -:809500008CB422E82A94428A38246F24F4D4EF141F126422971385D3985768545410D821B2D292B1A0248B122290342E15474216B115C3641B429E414AE4D3F4116143D841E22958663F111DB4E1E6816122BBAA4E233E38484C9C132921A2A24AA2811F2472C476C8C2344E18885A18C482828F790E44400CC41448414826810482F0142C -:809580004880048C0482000000800849288408410010088382542C1A14A8498110A84800608914260826085F9D4BF181113711E5DCDDF5C96BDFDD774DFD1515BFD3F7357C6AD312F261957F15F117396F62F262264F62F13F118D156F527B64F445557F74D477B4A2D755F222823F3EB442E418F821224F4CD474F4D7D71F387E177F1B53 -:80960000FB12524D2F7FF5F44A4E8F2DF6D848DFD6F449C99F15F53B5FCFE5D47654AEE7842F25F54AC88F86F616164F4AFEACA4EFE7F446A8144F72F1776E37236F42A567DFC7774CFC5515FFF3F33F3F6F67A3A65ED67F35F57F79AF767266F34517EF67F5BE367F717924F564557F7757571F16FB45652F32F2D2536F4DE758E232F2FE -:80968000C4444F64FCD7DF3F14F6756DB7B1BFA8FAC7CD6FE5F44F4F873CDE435F76F95DFD9F1FF793776F74FCCEEE65F24A886F67FF46848F86F64E5CEFC4FC8C84EFE7F573DF144D363F31F62B39DFD1F34D4FBFBFF76F4FFFF2F13E765F65F573762F3BF242F11F34F44A45FF67F373766F73F1361D6FD3FB36B56F43F215255F26F776 -:8097000027652EE36F71F77A7A3F1BB745FC95936F53F3D6549E526FECACCC5F53F73222AFAADA32F24B43AF65F5C7BC1F25F767358F6FFD73C92F21F647C27F187C4EFE4E4E2F24F4F2F2AF81F57E3C6F44FC848CCF66F5BDEB14AE52BF33F63F3F3F15F3BC2FBFA7F76F6EFFB7F73E36FF75F573772F2FFE56D23F34F46B4DBFF6F377E8 -:80978000736F75F7767F6FEFFF37B52F53F174575F66D757E437F61677AFB7F6D2515F4CFEF5776F6FFED454DEC27F7DFDD3D1DF53F73A2A3F28FA4767EF65F57F755FDFFF5173FFFFFFD8F63F9FFA96C2BFB4FCEBC86764AFA4F4F6F6AFAEBE43F566F44F44ECAAFA6C561F740D26012F1201184841841412241214400224124C22081214 -:809800004C024221428092124A820888422A012A0145022683248244A248241A4406002C220882008F760800222883840210CA24232228144121C21200224A2182B224442442C118A0C2282D12D024258808203962284A212804230218121CA148803442808104829F16022CF4112485F2112483F4112CE3D441B24AD141B24AB981B24ADB -:8098800019B54A39A4AF1439242F1479A5D812F9A5481CF9244A1CF8244A16F1274A96E5A26C5DACEC49D2A4FC91242CF4912485F2912487161F49724AF28164AB141D64AB9419B64A19B54AB924B44A3B242B94478229F924484AF9244ADFD80A69B51116BC1136441D28C33211AB121E24AD941B28AB961B218D8413DA4A31352979A1E4 -:80990000C8117F8AC4915F82C5911DC81EA41FA264591FA22CD5B468114DCA9E281CAC698D431B2987141749A18AD61CC164AD1568AF149924AD11482B9426B84A21D24ABB2294B82E12BF8C0F20880400000000800200000010228401000000140084000000000020081200000040016F3602302120614116E8436461C0482233158101C3 -:8099800040A3412E912A68174A911441C0261429913880022118808801232164111C9443211F28A642A722588AE42824280820A2436A08C6F2F61C20B182819221244830481584314181821D821D445921522C842C0422428E21271213A4346846B4243453628CA1842B8146C2A28A127184228458488A051142822502418C443C688886BC -:809A00000814222FBA072C218E92211694125287641564844F24F2184113682949561426F14612871326F221425A32143221C6E414A141812E443B12688156B18A61284ADA22028829217C42985219BA4482F222122C6C2C3088C18C04872BA2141AFC336A00130112C0484322011214001114124088A848182034851C72218232225E24BB -:809A8000204422810848128813314419445141884825C3484A0830844280222A840426F249B8002008880080080000000000000000000000000000000000000000110010011400775E40322211CD4C184234282598494F12232489088461482A21C2A71A018C04C285478822013B48CFC101222DA2525941843888144E222115F82421481A -:809B000018858888B4460132226C8A21E188BCC90E2962811911084C42210645BC22A251148429F8186243A41A4C4852161688B38C7C4125C222001F8164112F8C11484294A26219614122C18DA14648341527127800AF84C8424B2229E1210886B4286B8543F85C3A0020088800800800000000000000000000000000000000000000006B -:809B8000110010011400775E4011D11CB1118201C0246D12682049028140528114824C01422281243021280048901492218051413412458144020014481400920042846022AF1D4EE2462101611F427412DD144788321162272281C213E89221E22CC2282D35228F58A282541F42B428D441B64CD161D41477722422A28448222CD2344294 -:809C0000528422BAD423E342A4432F21643E181C91424B242AD528B28814EC8AA1148B2C8E4C1DBF242AC11185151281A152A0122714422A198A184829C2A91C52121E241482406CA44E211E45246E154168224A0121222F1211132FA3691334242724242031112146A4141E2282814A430889E84E43C14580F111244357C315D48412A60D -:809C800021222124481CA81224464238B4E0C2287624E114824264824F12442207C084D2284044440215943229A421521BA42581944122288698484489A8148BC24B427FFF0384008C84648224A02126025E282338284994312688925142A0245018881B14230E4722502440462412A8168245215421E04102898441A1814A9242830412E1 -:809D00004130142C8844F2884900418982044381428204286041AA043082612092918668122D422849613830824051689294128F2122C43C29010010410283D242848192844508240024C17088086C011819011088421B84084084112861A1400210248884126446184A22220160244002504A438C0448121C24058812288A4408A882812E -:809D8000C0448F7E0441618B211D184847828127229B436129E2A182B14C68411D288B926D2A1CC142188C4EC4CBA81912C6648E12424D211642148832322CC3986731848A8464418095431783211829E442784438184429A2818140D2950718000012220028884888202411222124C281C0212094444E2125C22422508692615224302431 -:809E0000304415148262148418484AA948188C840820482478489454BFBA0B425C21021A92212B21447022B288017085C2942E428E2C83242204122C02A2424B41101381B284F4241222C23B84C312B414942446E42108591134310094002220A22400872484FFD90F160880441402BD22208404484A9148884001148841484042222241BA -:809E80003264C230884724124400241A84180A008813CA48486212800486C88412C042AF6E040080C21818181881487028B2188804B04491154A5A41004B85682083E4410260118800221522A8812022062213241E020088A0A4282800A082446FD902C0281CE454214444081825048800224B48266282188C82F52241502C2C1144638400 -:809F00008724904844218B286041128D642D2281C0428A5442304180889212272A8143840560821828DE7C30828041011A4461444218286284183400444888C01483421123D214C141221AC42383465428204214E24142081C08844426081392121305822A0890B81A82C489DFDC071C06284342142812CA214928C112984C82480442C1A9 -:809F800062882A04685041890A45212228D1182C211A2288041512A42432234A0814844E21884E382311148406891808CF55051211487068022518119221C608004E1C91420049614200416E148728708422411806284144204209448C31128001200CA48400818B48C1448048F6C52F00269418841001422A2131229C29542120A218280E -:80A0000018B044031514A18440024C0212368104E02221F5238210811A8105288836020020040028C228A26F9D061D2818481230241CA4121100463421894241198811EE880181A9C1884CA114896882880060114A8141081A044825880228259842445AB8120246186888A1240021486F9843E112665A112887848B2656F311692F31B3CA -:80A0800022FC58B866D8828174DE59518F4BFC15413AA753BAE155621522B09437744B145752424EBADEC48B38624A7842F414328D142AC122CF68F683831ADA73E4842218C1124AA14C782BC88B4A8B420048AEA94F2AF81A36100138184F2255138F821152811F2532221AE9167851C1D4EFA88CB26A32C4DF14C2C46D182E142F54F23D -:80A1000042A427123D25A7719E2823E218B425B152F412728E365F23B182F8852A29F423192F818885B13CD328F81AC1283F8AD433B4132BE3844194244F84B482AB92528CF299DF245AB11D33385FD7E441F2141639F26C16624D148AF489628B494FE831216AF24418CC51CA8E8C4B242AF48C68DFA8F4A44346DEA8E58AD622F4156AA0 -:80A1800017438CF2248CC7C823C3A166FC32814F61F24C44627E282F26247824B461E21FB848781818F84A8A8B224F84FA52888B2A47C28F899248AF44C4E2001484228C04004840282208C021841C02148246012820044E243048888100304149180119941419041F810448A041344800000000448F334AF353515FD5A3314D4C97913F8A -:80A2000037B753F46525FFD1F54D6D8D388F31F273855BC89F18FA31B1DBCCDD2B3F85F431391F11F9682C84AF91F842C1CFECF52E4CEFE2FCDEDE7F176553CFCAF2766C2FDDFEB4B71F7BFBF22FBFF2F22F79FF54F3E8B11F39F5B2A3FFB9FB96BFBFB7F773616E461F1CFC82A2AB336AE427F7F6966BF7AEA48F84A798EFEAFA85181411 -:80A280001F17F5357D1AF2345C9FF1F35B7FBF94F6577DEFF3F7CFEFEFC8F9983B3F54FE85C1DFBDF8B79FBFBCFC1F3BFFD7F5B1192EC3D7964F82F46AFA3F36FC6FFFE7E2EFE1F7CFEF7F17E573F8D7756FCFFED6EEDFDAFB81B13FBBF73FBBBFE2D31FF5ADB11F3FFDA1A33F3BFBB7B3FFFDBF72E664E6A8FDC8888F8EFF48588FA3F7D8 -:80A3000052D26F47FFA88AAF84A688AFAFFFB386347F55F31474CFC1F31C348F85F55557DF55754DF743517F76F68AAEAF31FA53E95F7CF49B93FF7ABACEFC2D27AF85F11D991E91FFD7B674D734F1E2E3ADC81F93F7354BBFBDFD55711F5DF4BC6F6F6FFAD2CC4FC3FFB5F16F6BF7AF2B3F62F37B33FAFBB1F32F26D2BBF1262B9FFEFE93 -:80A3800063715E321F1DBD52B53823F664666F6EFEF6B88FCAFA6A58EED84FECFF72ED347F45F71D35CFC1F37C343E327F77F77F7F7FF7F753117F76F2EA96AF3AFA47C95F7CF4DF87FF7EFCEBAAFF73F37B58DFDBABF2FF96F4254BCFE6F6E3C3BFF7F67B3B6FE7F6EBEBFF93F3F1C7EFBBF6F6EE6FCEFE24FD5F1BFFBE37BFFBFB2612CF -:80A40000FF57F7ECB51F3FFFE2A3BFFFFF636B9FFAFA63715FB5FDC1D9BF95F1E8F88BFECFE6F662E2EFCFFFA8A8AF87FFB8FA8FAAFF1E1D50142002418445425814602240A349608864504892008D24001144114C828192948028949430268449018810840400826089000081A024F0BC66E018B1110244803622008A324216A884842FDC -:80A4800044289132261812A42432144F22C4812E425641488164512CA4292C44A4828224448014A2412CA84842198288D4128104484654842812897284F19814D022F4112487321F4132481FC9364A1D24AB141D24AB961F88B24A19B54A3924AF147BA4F842B1478A2F14F9A4481CF9244A4EA14FA264154FA2E45DF2224A96C5CA9E2433 -:80A50000ACF4D1244D421F49D228F89124C3F49164A3F4916CAB141D64AB9419F64A9259F44A914B42AB9443B242792498924F8284F9244A7FE20725FA11648732CCA412CC921A1D242B141D2C2F567881BC4A9324AB94412DB147882DB1478A4E3163EA14D9A4E514FA24925E8184DE252A68593CEC51E2227CD15C241B618DC21F4932BB -:80A58000241B4823F2914483F21144AD861FC1D6229B64AD9149E4243B144E22478323742688E3A2F566CA00000000008200100800000010021800000000000000000000008002000000812870D90C31222D24181F842213828401D0821521212192184695521C628118482A54284521041C9161A9051A642DCA2222028321A812241A729B -:80A600001184052212C082100258004888485FAF0642430841445C7414F826128145918A2418C33C48126F1A2472A8C44246813484442A0415268448C484582C18CC13C091285C28521240216C381B58C631C114484890228328444C6811841F634F32414604304D1743182F4483016788A33133C39458287B5847364F8A4562B51A9484F9 -:80A680003E44AC621851481E811D264DD819A481A3FC4A81285E812819A9281C031C11C19169C4211B82148221008B18502884A0413B3E00286362412248E1105A41800492209128001B420042201424140248802194141A128202C4244082B24489C4918AA4142084542222424844489884DF310B142800454134421942A24826114182F7 -:80A70000044185E282D47801281349A1480081604126880244D8442A0141E0229941C04826827442118128314884A8920042A281227F6E46D142C1121D146C81E7957218F1421445D14822A9C18915FC46830019A92C1DE49D444AB2382472C184C666D0A2867112A2436A18A483257414C2338E324C3438221A92C4A286288CC5C11CB8D2 -:80A78000129814A9D22CC244874A526883F8CD9210821241B452723C024215C2E8111B4910384261848B86AE44222AE414DB81024B4848CC46923421302226E448E44822C214142B822B1A4E18C04845E228B44138C11A981183AC186CC188C442C4A28CE4A2D89F044D1116C214121564148F1491374444B860852D448605901399F1833A -:80A8000044850552AA4481022189B428B12281A54812122741F012241847241982A2212A8C420848C211A1A82A8152424AAA4128F0628280024AC233811400897448B421D112443412682125E41411193821C9684263023D161F280421121A4291142422A53142406144848442424724128C5242A3E8A4E222887114021A22314880F897F7 -:80A8800034002631482142C4841321812248E244488102302418004A0221A183210AE2402124DC1214C5148344383228200188218E41144C448402882B248290422C9B24288DCD0041184022C24428374229018C0187481882831502241A8431411C2C860200100284004044050048222501008800008178448800811F1F0D40B5188272C3 -:80A90000487221344836D314B62CE128314129FC128D12701A66128D118522C1946257282C96253C042B2C182381D484092D215C41543C224912A84126823442237D28A248AD8489D422AA81CF22A14A6CA2418C972489D24A04A688423211218441D0288164121608602482424B41004E212E48542A14488A02001C024229445422001356 -:80A98000210481481C4844110100408284218128088AF177AE80A412901462D4842250481343781874816883184889A1618C42184AD8A244CA212C842252C185B424848802618AC181414C782894B81A742802109A222944D82214C82288256288423287244FBF08008032114212A02411422014441214042094421C24442102400C721C2D -:80AA000048221281420229220112489042A4A868841E245847812C1404481094824B826FBE0FA215D82402228CA11615444268224E2324604C50412694A216A1252840314482544A98A22C211102212128448129724204211021110842843524840246D248481228048B7A6021411011A8242502A126120841891242921810414409214956 -:80AA8000521847248411130184C1438104800282122B4819D1428231285889848102A302842006282229F95A6C1044460154184061441860111830A81F8186F782178842111008402C4214042924812402807832924822898148420E2A0834100A4988B28C44F284281064447F59062412C0241220544823821457482188241088048444CA -:80AB00002E4840883312242C420811428AE26854214422C80028688B42624C42C694814C8116048A249224426B8184283FB40F2784C0181341022501008100280014101802200411111C24C441844428608141004420481404124800290518C0421200120081AF440617428A9221101C2582123432121A02441741542262472126270222BC -:80AB80004A43044342381C2001614901284965818C2A414202442C34512A214838818A028CD882328820E21804DF2A052558184905C6A22894813041464264A419324248241113044150124129A5422918014242A3E114118262A4904441B9225884418019C884806A4224453844109124899C1416723F054B2286062F42E228F143A51B2A -:80AC000025459A466F24B45AD612E185544336B434C4122FA1F762DA4F94F53961114837C43CA4C23D4295F126554AF1484ACB544F64E429D441C2422F22718C6D24C71918C3F52A42466E29CAF81242B9AA419F94DC887226F4C4126BA81DE82AB222D454FE2C46EF514292425B2B9D11115F43F42C4229F4212566FC392126F87928E5C5 -:80AC8000B48CA84417348D245F16C8248B2243B46296284F32D48AE234E252E28CD281D22C7213E5A1B2224318A2224CC292E9C1A45E2C3FA2BD54321A2B763AF188B81E4AEB183E34234CA8C28B4247624F88E98C699CCE288F824D6175AD194F43F214118F94E281F12819A12CC2185D13242C41FB8EBBAD145F974474915163255C88E8 -:80AD000046B918726574177C44F826468B811F81949427429AF866352652464B8D2B23AEAC2B52EF2AE84842B42557C8ED6B624A415E264F63F448C2AD2C463ACAAD46CD243E121AE98D0700100400410040022482000020314811102214012014022100118811699841881914140119041904004818800100F02C2BF041663F93F31828EE -:80AD80005F11E6297243F2162E6F4656511E254B752B673FD7F54241BFB9F32617AD113F58FBC1811F12F26F438F14C6483FB3F441491F3E7523F72FAB7F37F57277DF72F34D5A4F62F288CB7F72F244445FF5EA31F335729F21F32B251D216F227218FE27276F14F468F26E443F5CF4CAA9CFABFA64B43AF1BE9457269AF12CA88AFC6A89 -:80AE00006A6F884BD261F6737FAFC1F21175CFE3F37B22FFF1F26E66FF74F46F753FC5F562623F94F64E47BFF9FB2262FB313F5AFB91939F92B267F44A69841FF6D7F1F469EB5F16F265233FB6F47A7F7F72F345636F6AFA88ED9D2F2F26F697ED8FF1F397BA9FE9F3B3B7AFE5FF6723DFF5F66D2FEFD4F3CBE3BF1DFFC245BB9DAF6FFAEE -:80AE80006ABEEF46F2E6E43762AFE7F77CD8CFABFD5C5EDF6B0B2F64F41757B5FD35155FFAF2633F8F27F76767B7B6AFB3F33A3EBFB7F71B3B7F35FD97136772A5D1BDF2DBF97F57F77B39AF967621F925376D695F66FC2767FFB6F46F41DF74F51F57EFB3F1E6E6AFAAFA262E1F76F612E7DF29F33EA2AF71F8AB27E788EFA6F73B17EF3D -:80AF000077FF7B7C2EF21FB1F7DF5BEF9DE969ECC6FF246E6FCCFC741AAAFA26A8CF85F5E8FE7FEF4AE265F73376BFC1F37134DFE3F37B77BF35F76767FF34F47F71BF87F76B63B5F95FD7BFFBF93C3FDF35F3AFABBFAFFF6F6D7F56F468691F96F46D6F7FB4F46F6FFFF2F66F6B7FC6D4FDD17FF56C6B6F2EFFE9EE2FE2F26363EF59FA32 -:80AF8000BD2E6FABFBF87F2F6FFF7FEF6F26F37E76EF77FA7B7C2F2EFE9AD8CFFCF5CF942F6FFE6ABEEF67F3E6646F63F1AEAC6F86FCBCD8CFEEFF851DD01201650114842484144002344874844C328144400489028131813181292114261402219014846D12844D821241160884241244C0244004204904DFA60F6924011A225441630458 -:80B0000065C24889A1412364814A088D11824E141658184842418044A4428744593418219A824114244822086829C14846A228A041888E484644082E4829D884844808D06D082CF41124C5F21124A3F41124E3D441B24AD141F24A9319F24A9253B84A3924AF1439242F147934F84A914F82C4914FA2E414F8274A16F1244AD6E1A26C598F -:80B080002DCA9E242D4A1F49C2421F49D22CF89124AB841F49B64EF88164AB141D24AF249961AB9459F44A9243B24AB924F44292478229F92448B84FA2F4EE19E022F411648D421F81326A1F41B26A9121AB164CF26A9719F24AB253B84A3324AD934B4B8F343B348F143A2729F9245A4AFB278A5EA14FA2641DAC68512DCB8F49F222CA98 -:80B100001FCD62921F41F42EC31B29AD811F41F626811F88F44A111D64AF72D941C6B15D68AF3439A489B824F442824D48A865B84AFB245ACF44424128884402002200004828000000000000000000000000000000002280020000005012F0766290142604121285012531121C1208E0114488B2424184048591484284237A241258489DA3 -:80B1800014268A311429E28862411218159822121594412984621A48AF3812684C828C9142282AC84449CA24A0245FCD074213C989316048208618B44253121A081842282722F06883182843B3244408242282414D616048482486041A122104A3D11C2A85A4281213C8112311D2185184C18913CA188641F8599CC0145B1E869111124528 -:80B20000093D4288244F8215A312188C21226742421B4A2D1B8449B73C948A8602285358482D715721448B2CC562414AD128422114F54218378EE0143A249B183598942F2853289951484DA84E186F88B21C42B112F6E67F80048502800828181D24008819044825022184A042002843125886832142048A021288C01128184041A416E088 -:80B2800024888298412021240243028048F82363004C02000000008008001044012042042800400100442008001E24422004182800000020020022005F5202301100200243924A28A3648281481880089289A2814111002880228812112841C2243012850281548422408288628413A48490882054841242188B24AF7B0E701401002890D1 -:80B30000244224838482081800441C88822142012002400114C014244348028422423048281222292822C44100822850481248C0482F850220020000102A02818442008220418818440428002888221008200218244911581400000084200C848004802281F2D56800400100241400130800708208800200260820424488028C08224F28F7 -:80B3800004880021807444022024088100820082128004F09D21104402412564A14260418189021290421180914820228424021148444821244C81211244041C01009211008081140144848120240100AFD209004400000000000018200444200220042902414222000000008002C012402104188044240481480070A708445014412189F5 -:80B40000814441049B82007042D281084A21442482C22822481D224B42412248A63814184BC24186042C0180E4694401299481188113014E844442884A818504F0DBC300100241502280410880012001902800484200008446140221282400400180028001802404008184400800F0A2AC0000000000000000000000000000000000000074 -:80B480000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE004800000000448002000000100218800800001400848004000000400428000000002180F1F3B5000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000A9 -:80B5000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000006D -:80B58000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000ED -:80B600000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000000000000000180000004400AFD70F00002044321800228114421288802802400180020028400820020088004211101408001824888242000080F84B9C1004410020218432888004002F844104C1424840084645 -:80B68000044C0410240200901140041318222101482852308A4142440082898409B06D03440000422483012012482124110260420014819024800428C028002240014C088622041014882244824986882804001280F837DC0010040018482286084800E0894424188824040042400410040000180040011C21014820018480440420384850 -:80B70000820097BC00800100904181001A54328430146081001001009028221200A028222800108181144C488284381130814098329098A20080F4A3D2109214C1D0C38236384149E1118434A881124248278248C9EC4855C2478142C0244A524153914D8A92744B161638562981B4142292126215EC288184E418E123C44216524865B135 -:80B780008201234214C828228145F8D2DA0040082525C41848181A0412A483210480E4488418260110042816744804421E2481612142122229A1146021808425A24124AC48862811028328224228F4D83510C2144C018982225241C111428C1E03305427828311B8144458854220A2424569121381BA1422A4384AA321C024108172486523 -:80B80000C8830433E824199112154431182982D24889120810FC6386604411424014F9482480031E48184442298261A5004A2168242E484A68422038222A112443015024588D142328421C898216022B418882691A84A282D8128116C4123A84F9E472141220924110442242C114206248441E228008182221A414002A21C948821608143C -:80B8800080013048002021048A254101258484020000882441582FA143021614A11248284018042200818181444604002A08144844110024144644140800C40041818002282628010021444824908881F08E5D90140016813421CC16C831183AA4218849142AE14904181888A8224E81464444B248A2121823014484411818CC08844D1178 -:80B90000682842185E21221844442C22BA440830168E1847812CFC9E3890421741268112444C821244140840C81284859244A042218C744801282216018245C8214904189042442128418481482B921062882D828A0400124A4188084A02CF58081A94184503280012811883A181206C864C06121024E888C64A4018E842246181E082242D -:80B9800041C43290418062884078410219041B2C10411824B228E8C428C48C004301CF2A0522392283025028441081020044190142C0114D411341D42844E212042A0444118E4884271868004064886822432482981242001B844442004281269842689D662440041E44104184044A0166E1284142C2138B184C8813484284B524184806DF -:80BA0000450822C4241EA24644044C18813241812368228E188A82A282428D141242292322A2C24723008CF15F9280411818B128C42466C2227826440189442408622C222C22011788A0288816081193240194848A4401818180D8188208421425322814801874422208424C2418F457E3200C85D4840141311229040093E1C8810A104425 -:80BA800094442F8834848840421414090022441782006083282440C84866010000612250484628126A82811CB46403100121CD1126112892194C18E841020041811A041B211118262284041149A11843088A2181156888004141244502C181A014C0814E1218A0824480A1844522F27A3280823232004800402826A848467214A848235844 -:80BB00002A1410541851C429480128839658004E818844808908200482101242B2C121140118C0824100A849F82C4750244311824405450114896248404121948212A012004812402484A1844C2481316400284D222800241074280483220C848644D224C1CC90288428D02842F83ACA24848064121820426142468261542428C0284E2281 -:80BB80008E28C684C418282922884588183121111318D81246844818E4182468144CAA8490824321E142081A262A04400249181422B8D2092CF48B2D4732E7429D2817448D62272189D284BC298AA914F5F684841F96592A2A95261A51131F82A598212672441CF224B183F1D464D1184E44DA0C1034812E8417C423B26A58649FC5D2C2DC -:80BC000038812C91A1C6B151D9461E7AAC768462822D588147194678DC4D12A41189E211A44322716A31628F54E185E11AF698C24AF86A1227299AFECAAC9E519D254FC1FC58818F35C688874C685E1493F1213415A81D1E88EFA9F92325ADC446E248BA28728CC8814E841B68AB8E82B072A52C1893F182652AF1B4884AF4284863B43C7E -:80BC8000F8622487226B82EF9F082B3747222FC1B141D354D11462D259F215593A12365115A9588CD644E6867114E246B864B4C8F1862457C2CF6CD682DC1BD894E2C4E49CD418C129CF2EA622CD184B2E571A121E89282CF4886A45CF682F12FCF8221CBA22FC4A494DDC4562254E742DA84AFA88E44CD284ECC4FA8874DF590D00104410 -:80BD0000088424008C24022484744001000028214C120180820821001110011528120111301120088228820024928100CFB845E26171117F1DFC196BBF87F561433F44F64A7E8F96F18C8A6B9E9F9AFAC9C9BFBDFD9AB8BF29FAFDCC67A43F16E43EFF23724D611F16F5662A6F26F6C16A7F25F756D15F1AFA11291F11E7C1FC86AEEEC448 -:80BD80001F5BEB61F3B2B54F5BF92181DF4E7A4EF743473D27E5FC44773F35FF3372BFD47811F312716D12EFACF96A8A2F82E882F47AD85AE781F176485B64E061F231779F81D371F66B595F76F64363AFA4F52A185D1B7F5EFBF9391F35FFCFCBEFE1FB8B22EFF57DCEF673514F6EFA2F69FF91F8B9954FAFF724627FECFF5B7AFF97F7F6 -:80BE00007D311F94F219718F71F5D636AF96FAB9BD1F79FBF374CD851F12FCE9A2F764AF64DE73F243C37F64FF56D62F16FE68EC9F71FD53576F25F75E18CFC2E886FC644C2F6FED83F1341C6F86F5C2C9241AF33565DD2FBFB1F27F4D9FF6F443672F65F73A3DCFEBFAF2F41F12F2597AFFFDFD929AEFF2722EFEBFBB6F4DFDE1E27F497C -:80BE8000F92F395F16F1CC9EABCCBBE65F17F71D5D1F1AFC7D6D5F5BEFFFF5725EAFC7F7313C1F31F33674DFC3F3ADAC4F7EFAA6A6AFAAF88BEAFF7EFE56562F6DFE5352BF9CFA5D9F7F357522F2EAD26F64F886A44F21FB5ED8EFC4B684BC24F53F51F042227F53D3FDF25B2FF7D397F27D256F61D2C8D2FDF3E3F51F16D799F54FCB6FD2 -:80BF0000C7FD7E3FCFE5F5EFFF2BFE5F7FFF97995F9AF9AD95CFCEFFEAEAFFD7FE7575DFD3F639519FD7F7B9FC8FCFFF7266DF87F6F4BDDEB26F43574DCFDEF8E8A3EF6EFEEBEB6FF8EA2EFEF6F63F7DFCE2E3EF8CFA5D9F7F35F5A6A6AFAFFDE68E2F2EFEFEBE2F4FFDE6EC4F2AFE2C4CCF310100471230224826827424012049C14824FB -:80BF80008AC422122813992813A9248012724814B148928483342481292984082A488808248C342400001214482C82C424488F440246044D5FB082C5242D1184C9811648A4129E488B82004B4921848F4411A42441A04844848524024112115E244846041E24604141302C48412846E288A41690128E484443918882254488211B48F13B1C -:80C00000A6C0421F41522C1F4132481FC1724AD2C1B24AD141F26A911D28AF2419F54A924782AF543924AF147924D812F924481CF9244A1CFA264A1E254FA264192E4A9E25ACE449D2A2F491242D421F4952281F4932681FC9324A1F49B24AF11124AB9419B24A3985AB9443BA4A3B242B944783A9F92448984FA2F4FB3790441F41562E3B -:80C080001A26E44132464CB24AD141F2229515B44A1BF5429122AF543924AF147124D812F926481CF9245A4E152E88444FA26D592E4A86C55B9E242E481FC9F2244A1B698D421F492274113C4C19B24AD141F24A841D24AF243385AB94828F443924AB844782816B4289F9245A8F2805000000002440010000000010480118800800001418 -:80C10000000048000000004400000000002128FFE2048061A1542991254D1A263C29C69188008C2424328E45C134A302814428100C433221282644B8642122272471829A84C24AB184C44823C422802A014848301244128022E8A2F81A93D024768102D018741222C452582442222C185428432C018118BE45448B2183B4A224B44262841E -:80C18000299C48299444818991828002504A8742B449929C428B84242CC48125A82148C3F41228A684894901BF6745D1246414AD12412C44D3247418C6511B84CB48202A1498448C482193384F325D8485B418B282E2C82496482F149A682D4415C8448B12AB86484A318A21E9E444624C49246924412AA842D0822442E244B12EC11482A4 -:80C20000807892F8E48620220111AD111E248981362810824252844622DA4211546800808324440243028092448B212001286048881658388C324E288B84D0223181A0414284208A210B224F710F00C1444184428C84014A91412450121022082A44E1886414844A02000000800118112018044E112818A0140082888444844484A816C8FE -:80C2800024F0892FB036F424112502A9D426C519641FA214CC892E8A845E8CE495B44D52585B5285A21422C11F4418E4423424444AF28C621F41DC48B2A415B222C4844351418F1271115814222F34C1448F628DC8814A418C919283A2E1324E161A841AC8881DBC244422A16424AC41D148E431129811A8C0C8106494141C1688A582C4C0 -:80C30000478C284A8202E022CC8122AA84B142423411541B188514B5113443428B922B412005901241838883A5388A1128F8FDC4A01617414502466C444E18D0824434C893542A43511E353826C3C8144A52128C64141449441444A442453854C44C11021A480489621180A22169C144821308C9A8818968823A44449C4226C824849F62BB -:80C380000B11001C4498462800228484302C243212642A11B811D22802708222010080094D8882241088A1184817815018484C22611425D41A9468481608C024521848ACA9242004812925048D428126420114446E1112E0420C1358248846428804122C22E242C42822001C119111811C88C424821866820282C084418A928880A11A1826 -:80C40000882C488CF7CBE7604210818203D041621181252125088440982880024144800214489452604458232482081001228210C8121008801112E42802424008F0B59D14430681284E28418B242D251643511283014E151823B31CC626B285B4119A68C1482C0A2C22944483A718D0A4A18426611860181C187488215829C032121784EE -:80C480008865C94823C418A62269441A9C98CC94686FEF09144033112C810484228C12984188848180484821121204240014228D21809244C2189012802121A62118688346840821489886482481220300826F36031622D1228241AC1441283481212110E244025179C14441430C86086C5824112489B21138842C84282482EA4224A82414 -:80C50000484B21852282A1241628CA41908282302464288820EA22C41A808404200112901890341908C221200111838881044826A8424AA1211EC1222289A2218E248A140426180184284214416814181584222406814222814904DFB4052002463234904414416288221810CC252F848812821452182887114009008E11C08441105441B5 -:80C58000882664888514016C4804218400478441166821224512C42418416BC14018342954902581C4285181884235840880011442434231A44621014384344846810281114A12014420B8133441890400A382021082A4C18489819848816DACA02884168801288B1612B01808484A0180A41288263414604218212841A02118412800AA21 -:80C60000B138280860188C06439624488822188282108402A02868427084F3C1DFC0191512143141441148191472AA2291218B69914B81448934482844128744488591424C0185018001008CC124111001823508230425241112311218214B812384012D84F04EAF24C44B122C4408422422001A0484448E42222082C8822E888C9882808E -:80C680000829042912328C212B4144442186211812C25C20E818624118C8144D119210A482301482898112382F24661462116411291101A9E1140B4AD24308111B184E888C3811811813C4469502930284F028461D184668C817A16014408CE26832812791844C322264842129582416384627416288472422A0436F110B151888C4284051 -:80C70000D12262D5224440051C220114431438511782922531A458908543240890124E2148142D1890418111624424881E8283DC4127E421122112682860218143381A827FBF4BF124166B1B2AC22955722471417A58F83112476D83E314F471428F48D849B662DAC8E442B64C7924ED15C7E89D542F8CB8A1C42E482CF43811CF8DBC2118 -:80C780007EC29A3C1CCD244BA44D858FA83A281D898BC79F45D416EA9C36724AF19A88522B991F88E68261846F4492582F49E88C91148F1433D85FEF4892626C52F1412F95C1248D514F42F34A281F927542A69A2D81697444E978E12F7844EA12F45192874AC75E414F72D6187A76B112F1143C3B8C2E334339282F427838227C8194415C -:80C8000013D294D42CF2852F2B1A1FC454258E268F22C8623D8A45C1862CF41E76A6A2884B461EE48EA84D884D6A2B417051D189B41AF15B164CB251F536243D4154A9EA889B238D141F34A19853D115B19959C18B486D881B11EE8B9961E499744525C66A1554F81E74DAF4C42CDF33F83251AA52541F28EA4684D1B472A8F2328449FD6B -:80C8800016681F16C17115D616719624A2916F67D228732EF22844BE442E841DA10000224800240084241260810021902A112011180200109812424312981200100400006088204882842208000012F0B66B242257C5D7F14F72C7415F57F73B3E9FD2F351533F3EFD5A583F16B431F9CF8D3F34FE3B398FB4FDC8CFDFD6FB25B32F23FB34 -:80C90000A5A15F9FFFF5615FDCF426633F32D2FFF292E89E91DFD9FB88884F6BFB3EE15F1FBFE17C8145F7236EFF64F65D359D453F4CFC85646F63F366B21F8AFBE1D17F79F89FFFCD488F827322F262C84FCFFFF4B48FCEE24DFD7C6C57A4347E625F57F719136F42F324615F57F73B3DDF57F559737F79FF5E781F1CFA25A57F5DB9D39E -:80C98000FD7DFFFFF7FFFCEF5F5FFF9497EF67FD7FB91DC17F1FFF85C55F7AFE7777FFF2FB82E27F59FD2D2DBF97E72FFFBEF5DFDEFEF3511F14E43AF223215FF6F6B5A59F1774ADF5C5A76F66FF76B41F16F241E37F79F19FDDCD488FA3F126222F86F6E6FC4F6FFF763C4F4BFD2C3E3FE6054CB113751FFF26362B441F15F52B6FBF5349 -:80CA0000F35F7DFFFFF75B5FBFB6F411B19F9CF8D5D37F57F7CD913F5CFC69BF7F9FFBB5B96F58F9D5DDDFFC7DA4DFDFFC2163FFF4F617EFBFF3FDDBF7AFB5F496BEAFA9F9F7FB3F5BEC58D4F8F22B2FBF5CF279359BC89F9AFE85226F21F3DA9C9F9AFFC1F37F3DFCD7D97EE88FA7FF2A2E2FCEFCF4B84B9DAFCFEB8DFF6474ABEE242F3E -:80CA800061F71755F7F36F63B332F77171BFF2F77B7FFF65F797F7BFF7F7FBBB7F35FFD7977F1DFDC5D7FF5EFFFFE55FFDFDF6DDDFDBF9BFBDDFF4FDEDEFFFFADCDFFC2567FFFEF77F6FBFF7FDF9E76F77F7F6FEBFAFFDF5EF7F5BFDA5E5DD2FFFD2F2C868DF5BFBFDD5DF5AFA65A62F2FFFFA9C9F96F6D1D37F7DFDD3D84FC6FC389AEFBF -:80CB0000E3F2725C4FCFF7D8F86FCFEB8EFE6C6E2F9F0C22501484004302228A4421088E48141348E489044844504813D848024E24318F4492154AA282908242004D81D012888489D4148804004840088E48002028042FF50A27181741211123C2242714844E1317C9811AD21818140A4A1B85628889A14A85C1484E8111D02571885481CF -:80CB8000422668444D18824014C428472215C882C425C224181F81744232158148AD16324449B442E182C414A6A92EC0421F4152281F4132481FC1324A1D24AB141D24AB941F81B24A19F54A924782AF343924AF347924D812F924488D914FA2C4814FA264114FA27498E1A2645D4FA2F49824ACF491242CF49124C5F2912483F49124A3C4 -:80CC0000F49124AB141D2CAB941D28AF245985AB944B42AB9443B24A792498924F8384F9244A4F91082CF41164A5F211448B141F41B24AD141B24AD141D242F91124ABA453D1223B248F3439248F343925986F83D418F924521CF924CA8F11F8244A87192E4296F5241B83E922E4C9F2245A1F49562C1B2983F49124A3F68124AB141D2CF2 -:80CC80002F46D9C1F24AB25D288911B44A3B24AF44392429F3264829F8245ABFDB08004800000000448002000000100200884800001400001100000020010000000000004F61072B2125424A628414A49C3448152468818144CB842CC45248448595188A046240180846086B85E0A288941241A028C1A18C918A844486483898488E4818DE -:80CD00004598141E44C48C24B24C1274ACF274F320A4280060C4236242412326218C01C02180220D4C4474142878C4D84202814C2118888494186C1AB132581A98111B82B024887824338113B219088128468822ED4812286118F0C5B2E026A12484805461D058566862824A61C244CB484A22049E44414781493C14235128830A844D18BB -:80CD80006088118B2C83F12894345A18D86849E12269884F82C8845DA2478819E91A8518982483C47447894AC222CC92844F21F858C110022502A18C74280242158461881800112D122A0415280481AAE444181408422C684548D0220461282F12088115080084148C12C84818844C01424788811A042698C70028181234481800101A4110 -:80CE000041C891842480B881A4144508400142150245080088A092112184618220A18200112486288444022C22882811083F8649922411A3D2389228C5522D8D1215E282A4484E8860184D4869A552453828456282C0488144C02A4C32292994AA493AAC9014711226B624E18B742CC318E8741B968E1BA81788184729891AF814881A14F0 -:80CE8000F81448498882F869B9244419C218859228461A3118342E484E884611C1888734C9A42100C634381018480189D45212984E81448C02411B82197122D448D1488402D824CA2108198889698284214A22E8C1C41420F834DF204282E2125121444D182121109288409194184225BC88423142458804448042C221248A823A848216A6 -:80CF000032140023B29272846B81221F48C22116BB814258824D428A048F48612181888889024FA4098C14448204468134489C942C82464104283A2808111A16C388D022081304282822224288271861834802704428815818C0821024D8388832A26021A0281698881881CFDA05150883248302842622811112482C840250842281228069 -:80CF80001202128E24A01850121E24189440144A84041098128844128362422321014362861A1248D12401883F9309A0211145424C041800930127381148856144218244820091418423314C4004902400001F881102230849921A00248441C1848800E01802009F49081984436A4384464578286294248213542248488B8243483881499C -:80D00000121108178844116B1289A61250123AC41684805822960A478420D878A3814180928A8D112D142B2849CA282A91888E188D141282BFE60B4044016302421A84E1C1D21841D818180113612441281E48292A8842028C044182438212A4282C481404450124928502818229414832848184A0412122288240F8424B201501840020C0 -:80D0800006222308444618226288245282302A1A48081041126182111676141844A4288691A85CC822282D28142D84282D2184818E1428C44782182420F28A1440F2F7A11004208104411602002C622250241354411E441112A0489141C2612314845212437C82082B181C4102612C1188058F4C0118C830424A32824218288222A9818410 -:80D10000C4886F2F0F8006830418418481850482828189542A3032303433840822244018C882D221822424886062142414C718C2481C7414018D21E0919448526181292191882021F4F4931044249224814374623944008501844CA28244524068841A4A142254424A022B16003042B0C80146814182820680923890282112282A21A242D3 -:80D18000801428022CA812AFA204C2189100241840028221482908008A9482841240A88482872411172628116024814784200440843C81224014021B4186029338828A140242424480F8B4DC0022211846B824012183A4428C72680450586C0449C2143120E144822224A88484CC04426044204446616360C14C44453D92460480041028C7 -:80D20000C1568B128682A8844B8485F2B619201244426422848441C0948091814926889314C02128414182812828410049820210011A088814008001A814C0113C0800404208812528B4FE044011C1221848D08212A2842A04211002460845023384825122201108884D4222111460414931348921B384219284224229F85282A22682A288 -:80D28000142B29212922880B00F06E7CC02825A2421428A14A013424648504283A24212898484665425233269811A082218D41897884015E81344A482898418618911891829922044646C8281141818924868405250C5FC40218A644F244244A741488717266942AF48382AF26512145E4E2F37514E14F641FF86C3B144F42D418F8822ADD -:80D3000045B1A2513E3689748E7722D62F18F29A93418E1235F582BC3F12B88C73AC54859F5A81E265C361AD4A2ECA95F2A2384A79324CEA2C7798BA2238C847848AF982CF146E22249F12B211E182D32A7451C46825F24E964F84022942B2429C6A1E1C23F924D51D446B68C21366442F2A68648C724276A8A3A21C287C443E4423BD44CE -:80D38000E8217A1CE161E371F411A28E254EE2E7F1211D821B2613F552C89DC3EFC2D424BD26B632B822A81147C18F2908BF1E064D445F11167228582A4E34ED6AC1818A32288CEACCF84AC8D348B2C12C72533A921F47B11AFB94788BC24AC4681B4489F647A81F85B4C586B598D5C1C4D51F43B4A471217284F863884E598BC247811BB5 -:80D40000DE4F1AFCE2188E11A9E15821E529B248B25841A8748F8C96C24CF4486A1F7706424018124192412A11A1121118138821C8238234502882200843084112211A92821002002110028800008200000000200192F05235141E565F7551D66F4253755F71F118546F55F4786B7F76B6FEF5DBD19F1FBD8CFCDDB9DFCDFDEDFEAFADFD0D -:80D48000D7DD8FD9FFD3954F45F754543F12A2EEDFF2F15D571F16F875559F95F55541184B5DCF59F15C5417757FF9F9BA211F133119BFDDFDFAF11F77F5DBBADFE5FB91B81D89AF8EDC11FC43E24D224FABF3FCDE8F8858898B528FC1A555EEAA5FFC44E167F536724D246D34DD2FDFF1F11B11EFF7F63A6BFFF7F737352F2EFECAE8DFAD -:80D50000FCFC9C98FFEDFDBFFEAF8EFEF56D1FFFFFC7972B73CFC5F57D3F6F6EFEA99BBF15F53537BD438D6F3F75E634F1D652CF51F15D5D47415FDCFCAFA73F32F625A97F1FFFFFF1DFBFFFCBD99FB7FFEDFD9F93FFDBBD1D993F14FE2C224F83F3F4D68F8AEA27F63A726FC1BDD4F9F8BA9FEA49F141571F7357BAFF516121CF61F13B74 -:80D5800035EF26F74B4AAFA7F74B452F2CFCCAEAEF89FDC583EFBFBF76F7E9E94FACFCFB7D7F5DB162F771715D1F6F6EDEBBF8484A9FB1F1874FBFB6F457432D136F6CF5DA122FC45C555F59FFB9AB3FF3F313433FFDFFABEBBFFBF7F3B3FFF7F79BBD9F94FAD9F99F19F811932F62F6AA326F67F5CAC887967AD18EF98C98CEFA2F5C4BD0 -:80D60000F161773F33F3282BFFD3F3186ADF75B43AF36E72BD4ABFB6E641F3F2F2BFB4F4DFDBCF84F4FEFF6F27F7EBE9CFEEF6FB7F7F1AA2F31F15F5213B2F26FE598B6FE5F5272FAFAAF6FD7F7F75E628F1D65EDFA1F1575D4F41F19DF5FFFBFB733FDFF3F3FFF7FFF6FEEFFF3F5CF979FF3FDEFF61E9FF9DFD1999BF17FD2C26EB73CF5B -:80D68000E7F4EAE88F86B232DF86BD84F9C8FA1F5F02185014B0240141008C2422091648648164848524A824114C120111901183840118901430229084104488C14880048E48E08144A24864001A14285148F03375E01A443424304844A981D62E8186E98854228264AAE444014ABB149422824C41885A2289021E213F2248948450829299 -:80D700002D12860496582AC082961C684921161802296881818049B842688842F0CA49C0421F4152281F417248F21124A3D641B66AD141B24AB981B24A3985AF2439A5AF343B25AF3479A4D81AF9A4481CF9A44A5CF8244A16F5244A96F5224A8F59D2A2EC49D2A2F491243CF49124A5F29124A3F49124AB841F48B24AF18124AB9419B2F1 -:80D780004A19F54A9443B24A39242BB4478329F9B448984FAAF42B1E40D841965A1E2CA7241E24A14C364A44AF44E848B24AB384F44A1243FA481343F24893539A186F8AF44211AE1A87542E8A5E852668582D4887552D885E252D8A1FCC42E848D61AE448521A4CF64A818E24AF14E148F24A154CF24A9149F24A9543929A2AF44A9447B4 -:80D800008329F8B648F0A45ADF9B05000000400100440000000000001800000040010080040000000080020000005012F0D1FCA0413029D02AC442C048488DC2008A042C4822044841D186088C023022281B256869C1228825E845384292258261846441428D81442121830415144218A44143C1C818C242CDEA102508160181813C134948 -:80D8800001A60157285D48C02C42434838C2114348A44822429100288046026C02413083608898624A4831619842F01482448C48682C444C4205DF9C0F5625C42816934829041D588D41178461266142415784306C424884EC8468481E24C28A82849221244C82225418ADD4422B1450221C4C168C8D221897618B41D0248218C28C83E4E1 -:80D9000064D1288CF14481122FAB0900140084A128218220A88413D8220821C084412D8115088440825281522A2441A2282130268261128180088F14C8442480884431148504188244430248ED3C00106481000020081100856488882229A34A4A02836482A042541981120449281422880440044002421A140A4216880144491422123868 -:80D980009483C4481728344A4263114127348D462E114E117034C1482365184A28FC4126CCF241881D4891121D348242C71C442E422A945C1AD6418F32844B496B12635A2384211ADC4ABC42D821DD2438A1C22E9234002CE18A94184788AB18482220EA1E0729066711856424460811B09122A41488884147162D881B282B426E88183845 -:80DA00008828CD81224D227074A84218A6849492922C0485021827482B482D124682818C7342120818884628888AC4348C24F6D512141001164251241B1258405428141448899C88436284161921561489C448424C6414130716F444A160484666422DA4150244C88304196C48E6118A48218101E376145248A34128088CF8A133502844C6 -:80DA80002524C128418125A8422028813818120048C0141188B082271881843269C08448483C081D846342D44254481C814848841153122684911410249254004A02F0E83840081901422C8144D412714224716AE3C411824201442E48A304CC5484252212287848348241941044012142194821044041018281C4280018A0280029284497 -:80DB0000F2462E20042280312228002200144B488190861440828D0210040040181206844501245028504830148A150816824801165C82412128294A9814608B2044F42211182E486F22B148522A1E612742988CA258A91D4841645446F84E1219C12CE028021588B428F48269C46D8941805834174827224C588742852198145C24718151 -:80DB8000C21823C811446CC11C4D2232242A98E84C44B2C7032410041800448044B211541A498201290828A0848A5448584C0A100400296444A4004414106E4150819884211181804108E044280280012D8A80040048472481472112818A9248423CC48880A849930120242264884054822E144141D0280A002902008E1CC0728998C844CA -:80DC0000422887248240182469422068248E48DFF20D22F0291481103224212C1421341282216021623062696412844543EA12552228488662818100484129A44824918A044C6848444481248A8488D42A2199888416A281283824EF730A10444254292200142606272A8480841C344482A5024C0282848C042362424829A18400230210AA -:80DC80004298848400188D11114281881A426424860848224224F0BA7E003601268342C844138202894201414128141C022882A048282C94341445C241201848442C88120186143841684248424A09185304C2414229148A3414C8413F710F8A9412941441480021118120822408802141424758184414C6142144995852848AC29100198E -:80DD00008218334290141E288482212908818C0812200D88852428E48A0F4C022C4208806244808448324181008882431811984122133484A0822051411418460CC882888504141CA848515C014A084041D2842114440C458A3816F086BD108212840214A02150821120880128224D2283C22822414428222283440888854204503214408D -:80DD800001244001100281834112048118C0280021829FAD4C021400260548141F82840414141146A4842904453184828A22280810422224882888C145C04241448244490530421048220841860225125424A01414F0B53C14D441484562844C422124C1A4214C1AD8241218062004850448A44911891835881427646E16149648649280B9 -:80DE0000744412483238104104AF41289424462194844A012D413E4C286558847F360B4334817C51A2FF14F24424424CB158F2C4283B281F98726138456C4C32444F21911D4F8824F8A848A6D4AA784C56AB1D48D5FA3128CF51FD94456FC8E44BD8D25D65282EC564308E4D41EF45B22555418D4D842D88AF8DDAF47C62D184F1D64C43E4 -:80DE8000E1A17522F32E4C1EA44F5553E65D8E142D454F52528C9B22105BA43E2139D1510416D23A48714EA8A22B826EA12F9EF428278792457544E11A6692FA42E244C481C28F24298632CD8833DE2112D425DCC1BC11A8D26CB25E959423FDD842181147418B8889D8AA6D4447C55EB243C2C18AF8B3DA242E221AB12152542E4E2E4285 -:80DF00002E655F24E432742AF228CA2BC28AD46825B8D4B481E648E4611AD267AA241DE843B483DE44F4222529F2CE54355A828F21D98C64212B4A3C348293788A2DF4CA1C13B858C88923DC690C4883FC88C22F65C412C6B48E986882CE5887288B444F380200100200000000188218000000000000004190160000100400490841001282 -:80DF800000444004441228003FBD0A5F32F2263CDB335F42F246A45F42F221211F56F727358F2CFECB618F85F441545F15F59A98B86F42FB44763F11DB51FE8DA78B6C9FD8FC1D6F4F24FE66735F72E234FE5D799FB5F581CB1F8B7E2AFC48D38E846AF4252585FE8BC93FBCFC1B196AF2EDAFAF3DF9D3915F1DADDD2F675437BB64A789B3 -:80E000008F65F44242ED181FC5B272E3C6F7287445F2C1422437323F94F51D165D456F56FA2F2C35E157F5173D9FBCFEEF67BFB7F66374DF94F4CAA8B82BF44F65FF36B6FDE7EF68FAE96D9FFAF81FBF5DAFEFBC5D75CFF4749DF9594E5FF8F8FC69AFCAF8C8C3B5FC62627FD6F6898B7FD8F882CABFF9F53B1D5F7EFE9B97FF7DFDDFDF17 -:80E08000AF8DFDBA6ABD43FFC8FC1E4AAFE5D4EEF4CACA6F13F23632AFC6B638E725F55B55F025266F43F7353C7FC2F24E2E7D227F76F261673F12B7E8FE8AEC1E48BFA4FFC5C3FFF8F898AA6F45F25577ABB9FF18FACDEDBFD6F689CD5D355F9EFE69EBDFF252B93F1DF54F4D3F98E8BBFA3E3E4F69E8A8E82AF8A7C7B5DDDFF8C7C3F7CD -:80E10000915F77F26FAFEFF4F9D3911F59A9CDAF85573DBF14741AEC65F45252EF84FD441C6BFF2FC6D648F24C5AEFEA45D223F41B51DFE3714FFD6E2FFFE452331F74F4133BBF9EFE8BEF1FB3DEAFFFDDDBBFBEFC182A2BED5F3DFF9FB3FF78FAEDEDBFD6F68187DFF8FB85AFBFB1FE4F4DDFF4F49319BD4EFFFDFDFCEAEFEFFFDDD65F52 -:80E18000E4E42EFEAFE59FB8F8878F7FB8FC9F5FBFFBF167C7BFF1F9CE4EAFE8F8D288AF81D57DFC8FCDEFE1F552446F65F5DEDEEF82B3B6FF7E7CCBB1CFE4F57E214001407826825434603284348C44224805449264304890282004442183941783941481000021842C48A81216583492C0482400846482801428794804BFBA0D2117418E -:80E2000050418110A241E0481498618B8450288A044846436854494491414A588681604488861182C2821584082C484C41C482448D8140A14921864824784A224164832F44082882EF9E0D2CF4112485F31124A7141F41324A1D2CAB141D24AB9419F24A9153B84A3925AF3439242F147924D812F924481CF9244A1CF8244A16F1244A96B6 -:80E28000F1244A96D5A4E449E2A2F491242CF49124C5F2912483F49164E3F48164EB941D64AF24B911B24AB915F44A924B42AF4439242F647934D842F92448B84FA2F4D364E082E441F42A4216344A1F41326215BC4AD141F24A941E24ABA45B29A33415AF341AE4147B84D812F3A6482D11ACC5B54DCA5A7A24AA294FA264194FB2644DB4 -:80E300002FA2F1D12C47A29AD42CB49132489E64E3B411B64E9861AF44F911248BA44B61AB944B438F4428F2429416C8A46D48B84FA2F5E4F7008248000000001504280000000021800100000010048480040000000048002400000025018F28022C042831168444028186911148144135082830448BC21641F44421422244D024644E22B0 -:80E38000CE2446026028302194844714487048462424A84886024AA84112622A818881848DB43D4C12214808A984F12248135C212C851621BC41A84842444D5A8C82B18AC24882248A24A441A541824431A28C3248214724884C1201899822218B8354A904236441004FA438184A58234213C821646F6846D221244C48438CD422844499F4 -:80E4000093471314136E543B8442224F247144B8287823085B8427258A24A841C7144B4A284A38E1263848A378461231291D4813C4CA228CF4823C17444D884A38624482488B182E483A788342C2C116F112461788006022A01412833281803442482018084484281A84D9848402284904250229C425250200A02841100424440023042C15 -:80E4800028212461641242A014A0A4705E054D110011241100211904194423480388C0264828110030241081D28408002482200880897428821268481800822394442C0888A084869888F06C7880522128254429C442488F2164288E592D88423486F84192008E48F08844A012882C2414440460A4493242211D54139A1425154413C4814A -:80E5000018112191C88481996888842EC42D1681A024C0844FE40C1C1121524214480018A0851D8880082D910030424C4C0180B442021524C284464226045B488E2124418098422E882941C18411C88110914C8CD826461408A28841CF1F052644021185422194422D4A172C158A744142D11A889482E0C40A26082A2108414100848428D3 -:80E580001092126049144416411421522860810087288B4888208819826C8484889F8C4D9248C0228C22C112D042C11110048908422840083081401432844441830150434A210A30422598182C048308146189611110A8182224414A194458C2206222CF9D0481220013440480A42420C444002F38612442134288C284112F240216688AAF -:80E600006C24088800141C4464C482A6618400184842442D114085021A441C524248258824F8A3DC1051721215023041228450223011830400182094423048871800803264850428414A0800100820488841042008C0148200802802F054A83417243432258385C1424152264202D248428E214883312181AE418215ECA80284221E4EAE94 -:80E6800044857482252482CC43404498A927848182193144421C911386F8841190142B84460625BE8C34282882DFE808C024C028144425A121858104488D218C42225122488014122494414C1954482200A0128605D02404980082409812160C4400004C618944002024F27972004008946084218C81E48401150A3548420C002004E02869 -:80E7000094811684421401A028304100800880041E413014884800428684022C829C228308EFBD4C628224112422122816C142882414634801200C424A08203C24205283611488414E84204C824884544120446441A50430412B812800212004006341F82AEA40022420141102000000C0410000204241924142819148428D818414814493 -:80E780000000484B848410F1814C48441414292424042C180441D024F833DF20461141392320021184432838618419368619021C82B481268824444491444A011448144C44A248428800821130C300882130441A18022506200528F09FB1205C1840012C612148208488142208400290821414804201109821A91484722884280849044DC7 -:80E8000081C08181C11005C232141A082098824C24014225F4F788240000422501002C2804421D42006084100180288902400244888482854241044C84046048400600422822000088821014B8DC03142428004001221118228002C110010022102908000080084420088810145212138848A21814801802824C3444124180014F370E101E -:80E8800082120200159221001428E02816914248408134414081E24403A6A4241009840020490148414229848CC4412180841402424481448848211E8240094800250884484061C4800E8AE43218F12241242850128A84011C9C415024422C641448444618810C441001A188604125E3411A012395A2121A88022928B8B848532193582263 -:80E900001427141D1116229142C850912F6212A9A2E75415238402E016E214ECCC92441C934D1D2A1D444D419D488F88FAE444841944B48168484E81F046449FE8F4148115B4487482029E421543A244884EE44F4CE981A28428CB81E0560A6A06502128B02152831A32C92F550146E13CD82264282239F42241171C3F169241F011413F16 -:80E980001698C64E192E846E22644B882CD488F84846C22B444001C62448F18A422F8C48E1547D425212492C5D222B4C8682E424A861822AD188F89A3D501225F32129A11FA27412DA82641417B6E0A8EC24FE814848179419FCC2EC85314129AC488813A8828A326125F45E41141F8468544714288AD856A888474588574849D411384654 -:80EA00001744CF11F48784121F19BC61614D2F120D6C3126216F48F1841425E46C748674890D288012881288D22881921828815028102842220A8002004421288800814100000000804188010000440022A04280045FF643F1234117A295F8292A9782A3D2B1F2332ABF83F2A3823FBDF5E3E98F88F8C3829F84FA2DAE1F46FCC9E91F1C61 -:80EA8000DA11C221EAAAAABF937423F1672335F337DD1F52DE997885F7834225C44A82489E1915D155D4711442F2C3913F31B596F181C235D263F147157D4625F612142B222B118F89ABAC5AB138FB484A2FD244F263421FB4E622F221638782BD233FB1F3332B8781BFA8FAD7DB3F86F66D2CBFBCA8CC7F52F2EB8C3F3EFCC1E11F32F834 -:80EB000042E22B26EAFE1F9D7F5EFCE3B32F257167F763E59FD4F8C94BB5F3E264B4CDCCC84FDD7581F181811D476F74D4AAF44B5BBFF9F5D2567F68F441C33F72FF47557F68F442462F45F564266F25FDDEFE6F2DBB32B758FD5C5AFF4F4DD223D623B421D223B249E6A131229913F11B1A3F56F6CBC12F28FEC9CA1B847F6EF8C7E49FD7 -:80EB80009464161F14C22137141B228FA85D227F7458715FD3F7A465979857F86FBA56464D46379C6F44E419DD11A8885D472B8885FED687ED5FF7C81F69FD93923F18FB47153F31F586826B112F44FC72F6EFE9F8A6C46F49F1ECECCDDE9FBB4EF24362BD4324B7B68B641FB1F173519F16F56A683F25F16325BBCCFFACFEC1C3CAFC4F28 -:80EC00006DFFF4D233F463411F36F4426137141F36F64CDE6F7CFC5787CFF5F54D6F6F4C76C9FDCDCEEF36FEEE6CDFECF487CD2BC88F197585F584845D477F7CFC8ACA7F7DFC8E5F7F6CFC93D63F3DFD87F17F54F593D34F2CBC56F544866F27FF1E8E6BDB2F4BF3888CCFECF9CF7A501210020014482048A14800308100200813880210C2 -:80EC80008112011142490849084180083C0845034D83823482244002804424482449045EAE20184102141A344211428221D0129841299844211944924120A82411A825022E484424442608AC2488444441048654281008001C3194204802889092807884F93CCCC0421F4152381FC17248F1112CA3F4112CAF14F1112CAB941D28AF3459EF -:80ED000085AF147924F84A9147822F147924F842914F82C4B14FA2E454F8244A16F1265ADE212E4A87594D4A9E24ACF491242CF4912485F2912483F49164A3F49164AB141FC1B64A9961AB9459B44AB924F44A9243B2427B2498B24F8284FB244A6F1702ACE441C442162C7411FC421216AC1417C12F4449FC42B245A89445F8429345F8B3 -:80ED8000421145F842916F82D41AEBA2E554F924CA16F526DA8F15F2224287594F32E419D2A2E4C9C24B1F48D628F5912483F49164A3F4916423F4116CAF44F81164ABB45B61AF14B934F44A944391B84B41297B1688FB241A87174008480000000044000000280044001880080000140000482800000000800200000010026E65200112CC -:80EE00006011244641028CC94185012C084E128813941131890242998218C224502C902A2126043A440114829C42819448441305A1145621D44814B81498A4004828F081DE803484430290484B122791172414A0127041B881158342A8687082F148814528D414C2688C44C3E12E14488724104A31421181112D424B8244200A1A24E48846 -:80EE8000542886C192C82442C622048609AF7F041A64C44C0218841695132D41AF1188342126E438B44178420146E1314CF1238284C9745851258B3C4B24152248E482D4298412B82865141099412D494332448C843A4149354A1F887448A2248E468E4864A22424308821FFAA090018408134628400141608841812294A8802811B48203F -:80EF0000820A81F048252F220121442111211120682213081024010013C18116089246A448424828F05F5E001200102112A11248228442006044488D24001008288444221062584846440200250224842400004800981E4824228100844A08EF7A035A024F8102A84285957C251D34C21484424561C418845847258F4422A4488188002504 -:80EF8000CC2C81480021101384517888263142C9BC31E888321281204881B82274882222984C8281A8FF280D4A0228A028114D284D482D35244A1A210445216441422E1443944C90C881820069D22402868124144212011642454228D482ACA1004820A8184A28C288A1C044888904FFA50112184D18004211131368441048880485241443 -:80F0000098482C8122048042181418486844404402401412388217224044E1A288410840311829942228828484882AF831B9148C41238101001C21440443618880918821814C0400411A448408404146733844024503C46480024082C52200D0489132001880C11128007FBA0E2944088D61429344082140581422AB1420420824302281F7 -:80F08000903222DC082002882C94814122518125880C842C18C4888C281825C1818C028B84002825941228F0C77E001008161D04254818882B02101421010082490A3082302140982800400846A2125024A084222E19152601810030881200C0418880F85EDC2448112D189362844C44781B42083AA82182231134A129012C04239A84417D -:80F100006229581428C02987228663A58825342117444722812D8429A2488835D6B4EC820194C09D18B0C8810124488A23C282EF2A061800124D11150820441C1811C8681884818444002608C0248414004130244048542212410084221E28188229488401A1860800324C01003F2D0D48289584120146952489942289082181812823722F -:80F1800028052241224368224A48062CA28210022388114202811058813081190189011811888C849912188E18808481F21283403241161231188712109124119021100114502214D0210C4811004088146444481E44288260485966481444424C34421C44443148C914123442412D88412312247644B82A088001800581006442804CC208 -:80F200004141864521882404424024042924044284422A014002133221822382044842850448ACC488810023A2212840F275B1104214442C12141208844018088884812044044304430422414348628482316084199242140080021A0216022721824024015248C084166828F07C6E6044002004404194819083804CC24180CA45004004F6 -:80F280004602289014828440087081028415682881113081004212894988348882C048160282F01ACE80210228211CD4488484024004850400C180022A042A0448880048C04818488344088014482204422348C8828304C200818328088821885F78054022218118124104208AC282004111218845114401001322148108114400C0441445 -:80F300001C8218440159021100110080042003F0224887242FA90DB634842244002220248214C828004A5248C024804284524229728842F4C22844A1004088041042288414012186021A441411028084C141428414F03FAC4088C14884222726A02484C4C3427444A224278C84002113141111026C018C4E0640181118A3828480244202DD -:80F38000221A2861419E4287581C882AA3811694884C04881A7E1AA6823F5C4123F18662D04A629E15FA414855A422D50485B8E858261B48A91451174054154E44444E466D44C6B944D46252446B444D888D494B91AB44A642521421C35CE9C938424929B482093F14B14A51C98CE4C431888FC5091F48018D544E4D2E446F6C0C4A25FB8D -:80F400001C154383E116564C228D44224996226CF4484883E454D23CD2E852155F16624828B024022E2426D294E428528887244460921C1241F22129192AA44217128E6539C1422D56897481AD48B8A3A8D48AE444F822E84F296B86AE318F88F847947024C4152648EB21167622F1486147A4BCFAE8881F3248C8812D8857A286AC822FB8 -:80F480004C8EA46477124B6C31CE222D42AD248B8E2BC5822D4113F44A481AB34AEC4C9483C126E91852B36817279E4117558F85E8A9A8C14E93E3EC216CE1248F89755822A6A98F21F84222FA4A0224008400002008822008008A04004001144081585824442C41A4820044884422442A08000010044508411C12044170A947F121433F41 -:80F5000023F32B189FA3F7BB688F827229FC29298FA6D679F2E4E23F36F6828445F4888AE7A2BF12F22A248EA11F12E214F664251B647B2239F6686A9D69DFB6F4FDF944DFD454446F44F426745F7ADA575413DB224B8A1B44DD4D6F42E22DFF13537F55B594E114988ADFF4F48EA44F419594A7C42F48F864A47AF2F8FCFEF44FE6F6A429 -:80F580003A343F12F4757C9FE3F13F349F87FF6969BFC6F4692D8FA6F62D2FCFE6F66B6BAFC67645FD4B6BE7F6AF12F226245F14F265251F74F627241F14F635763D649FB2FB2B69E7A2EF877742F6474F33B442F52736FFD6F241437F74F42D215F92F64546FD447F42F271733F11F155D54FE8BDD2FD32B41F3DF5CAE26FE1B596FDDA92 -:80F60000542F69FDE7F66F6EFB5AFCFEF4CFE7FB916B346F47F63175DF93F33D3BBF37F668221F42F62D69DFF6F66F6FBF5CFE29211F3C7E47F5C9C9CF86F22925BF52E25EFE25615F16F622215B664F12F36662DF96FE2668AF86F6FAF8F5FB4A4EA5E924E483E1AADE46D413F42B259F1AFA4D4C9D492F22F6F6F63D137F75F59B159B07 -:80F680009CBF38FB4BCBBF3CFC5ED2AFE1F94A8A6F29F9628A6F4FBE62F7FCF84E5A7FA948F174649F73F73B3FFFD3F379739F36F46B6CDFD6F26D6FFFFEFEEBEF3F3AFACBEBFFDCF8EBCBFF76F22B25BF7AFAE3E55F52F661657F42F265614F32F36662CFC7F6276DFFD2F2FAF8FF98E8C454D44E5A3E3A3F9AFE81C17D45BF52F2E9A939 -:80F700009F2EFE2F653F32F2F7F63F29F957D7BFF9FDCBC1FF31FFDBDBFF7EFCDEDAAF69FDCAD26FA8FDF6FE2BFF2BF74BFFCFEEFF9EF170240141601284438264324082440124114C12C124484C0244E0440244214C1202004100501240C148003440010080041608304820041F3E0948C01112461201001F48142868248246012413082F -:80F78000110000104244088C088412844CC2C1008CE2349861261281088928D11A3881A9012928184298B2228826F89329D022F41124A5F21124E3F4112CA7141D24AB141F48B24AB981B24A3985AB9443FA4A9143FA42914F8AD412F9A5481CF9A54A1CF8254A56F1254A87195FA26C596DCA9E242FA2FD91246DC21F49D22CF89124CFC0 -:80F8000026F89124EB861F48B24AD941F24A9219B64A19F54A9443F24A944F82F442944F82D442FB24484CF9244A5F45052F82F411442B4217C163E481326A15BC42D1C1F26A9419B24ADB85B2425984AF1453842DB14D482F1453862B344D1A89F324CA5A52A48B2D4B125265A9246F827191D8A6F41164CD421F49326C1741C3F291440B -:80F88000E11B61AD841D64899B41AF4429D342E882D442C9482F447B32C8842E5AFD8D2028080000000000280000000021200400000014000048000000004480080000005012F02FBB6044188742542905148722428148284250249088804888428842548411C5814404100418428A12541400704482440242828881200816E228810122F4 -:80F9000083062FE44EB12261181228446F38B444C15126C1478968858487789445984146421464144491482F24429442C142A410384242108178824843F8824A83C1829E488E512368118CE438A441A483B18154488334F486C8918CF844FC3442D6C1281D264B413419C56131F4492C34286C180D1364241038218564126B41257C838418 -:80F98000644400101DA2418394A1436888190425BA185422872D3C8114614A86AA1424162871823A481E8689F22891A3F93B69B024014901244C1C64816248811E28421548528489084C18240481A0242485456844A4004200006501A18A14A448A04888928394416088B081C414124A222804FF260F4044624181101801704221293481E3 -:80FA00001490828001001C081C880421442C08604124001120080011002140020025022100841870BF4F312114400113724221724202508111484328C841C8112CBA810220065442D0185C4A19288208499811444021312D46130442C226E38104218C44A81880220188F01B43142211301400A9044224428C292468582414C814241C028F -:80FA80002006174442704174820800244411143081D0484203808414811102488188001280015F6B0411CC441211C82111265122404191251304884A08188A8218C281E011884802834866182896443188184C048041211405248624D2826422105822122122408A087FA3060010010020E1416218AF14124148813C12688381448808A890 -:80FB0000894807814E1280C8244322084B291884690822445428164288128808D04881222201444C01FF1B03803212105448404A81244122184288A1481288904540484D0214100825225482430320023284210041848233A118004518028748842F4108828D447B2C001C0124260826088C048324018800842122222A01110028842A2414 -:80FB8000080082000033081A4228781802801128048888408C1486942800DE6600381215C22C4181F012413AF489524E38131848A994D638522628C25C002E842CC824159828C821214936AA16044B182223B8344838226021418502AD11830D82448741C48B28C3B194C42888C9F4F55F0011210084228481441051228200212298481CEA -:80FC000022581815185821803418201842A48220225138A012844958C122128989028260882122460621414C015F8B0E8042012428000046011490880000430200004120020088C0421261822240220812A50229018840221802C048004424CDFB4042911211141C11C118111C8849612819681482888886688141434828028712611CC404 -:80FC8000482621A8212B4880682AA0816928B8113221888A224882A84142406C21A4262E01A810F84896400239013400008811001CB84908821088024400F024894011681288AE128214188E2421246028822071828288010050242490262904864204DDA71485F868414A3441601314834141F1944455F4A5222A2222088288C941D622E6 -:80FD000058A21AA3119A9886E2420015611413D48A588A8B4C7ABC44081C631288260865D644B8F4A2622227881284811648922225E281F14C4900000000400100136811000082008100140000400488100428228200001820110200820000824810F8F87B40CC48481904002622612844444C829221008812C41012921218188288100880 -:80FD8000421342C12886C84848489084212840C284446C829221000000248129F19F2240082A0400100125215944A022800800002221818C81840C0010410540084814007082220840A5811B3282002011082221F0C1D3006800105412005041198803882400003042E014018A080000140084A048000000004480420200000025084A718D -:80FE0000960800005021841002100282000088000048000000180000412008248800460282100248004100100846F4EE27103858424200004214414938A42A280200003C54282C2421A1A984820010011392A881832524042100121865328D43222202000085022412EFD60584844C840440020018D41594221C2E0840080021211898192B -:80FE8000A88800001415018CC188484828008290824044C422281800108834422516F247B7200100280012A0811C088119041882008188424144220024004490242502000088402A1102180040012140080048F019670000400211141200000000001018010000800480020000440024822008008C28040082000000AF92022062421450B9 -:80FF000022603246B181B1111138913B848A68280016089CAC44101429062400444224B08432141222C022230824CA81C91214232134C3180084818608C924F4492600120028501B112721348886C1819651119888828A480894A0440046014820012AC22222000080288848022B81B12C480182210084C02890441FF90E430100100529A1 -:80FF800081816838191808420000850489924491224008101884D2440880A88A4CC8818245522A2B1A2B81252288388816420190841280B4480481EF830B2F22F212222CB11221B112013C512229F812111F11B189E9987848D818F44848421F945411488558884F84E444F4244449F22424222E2480524445E642F222222F21CA122B115D -:020000040001F9 -:800000001AB89229C8932592821E111F11B189E998F8488889F44848424E4880548885F84448AF52096F22D226E222A1131212002592822D1B1F3191D19E8887818F18BC482464141501155D888CF64844CD444B244B262222002554444CF326226D222E123AA1812B8982502221BCF1131119ED89F818888B488B4C424200C485C8683FB3 -:80008000D40C0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000000000000000000000000000000000B4 -:8001000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000000000000000000021 -:80018000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000000000000000000000A1 -:800200000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000020 -:8002800000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000A0 -:80030000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000001F -:800380000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000000000000000009F -:8004000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000001E -:80048000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000009E -:800500000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000000000000000001D -:8005800000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000009D -:80060000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000001C -:800680000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE00000000009C -:8007000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE0000001B -:80078000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE009B -:800800000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04F18 -:80088000FE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000D9 -:80090000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000000000000000000000000000019 -:800980000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000099 -:800A000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000000000000000018 -:800A8000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000000000000000098 -:800B00000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000017 -:800B800000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000000000000000097 -:800C0000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000000000000000016 -:800C80000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000096 -:800D000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000000000000000015 -:800D8000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000000000000000095 -:800E00000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000014 -:800E800000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F000000000094 -:800F0000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F00000013 -:800F80000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0093 -:8010000000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE421 -:801080000F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F424E288C41084143D2843424412082014642C622248F1132112484D08424081981D1499189B048092483242444410849648249A44230226012442C88C22623 -:8011000024448A22093016CB3A142712113119F417488964A53846F221524C22C12545B8846282411D7441272EBE419883799262241CDD427283A22827415EA91742C6F888415425D181D38231C1FB14844BC12D3A4CB8154E243314814352A4D08463832D522AB48291D886F8DC6210322118248C012A440C291204160549544280C41964 -:80118000E0148848384A002682081688A224422451C01911901183E4A8A321232841849111008441C012CA0288248AF1B31C142824008034182B1449E4348122018188842234411B6829410841488E514112CD2186C4485C088348026223A184290420045C180243122C082281A16026184658487F34081C3448148442C480820200222087 -:801200004242943410022118828825621180098200001400818141465448682082026042612428281800001F54090084195414100440042210042210228281822128110240032591118961881CC448421018110400444A0200002C021644042B188009CC0D000000110000000000000000000028000000000000000000000000000000F005 -:801280001287C04414113621C4241131944AB28814820181411841488444438424042914E44224CB48882C24824224C481860A2154842841112082018D824242482965A28441C92172554B83020010128A02112180081304462A31841692C119B21168424E21441C012D4930120020080086258842042D484C0280C8829014818D248200AB -:8013000000483FC80A42111419C2422614982294137648028240119418908484671813E218A42419141641E29A7148220980C284481938881D86821C42C822411D24200250220049A641222518341C481FB1066302200150121100290818304860244321242194441841284816B4242404C04228000024004441304800802998884B4183BE -:80138000449882840060225F55011444141225C22881482450120000100244118811441146448242084186C44880A42865238808888224129820041C19D142084642081283248808FF7609413502224951141724241F416416C66213D01264183B491788256B28CC248434814322283245145A481112E2212E8884429324272819F2641173 -:8014000047938D8342693419272A849A4442E282E86438388D86A200445FCE054551121110429141298454218AB4210111882D91860270418484C48411412014814123182A2CA4C2254132A4822B8246912123293C42142328A181864222328A22308A82009F760F40148263412D2C812453916214219042142C548194695882881414494C -:80148000822C722344A8484144482C83084722130821118E348741159812444E182632891D4244608C43941A47892A0482412FA30C8144004004244800122A7111D281E48192821048688840311965988800242240082721119018272141A381682122168A8121F1821412002B41824218228262F026AA1098224230343F2102841F8261CA -:80150000948E112843D242081CCC42599141415912C62420E1240883244412281421A8212B488312C1E12C04822442442918494462821E2881204814D6820446F287A5800553012508111C0441C041259848002604822C22B44802281045051184004444F021124004002021188812429848822304002B424A8821015D4820D14262412481 -:801580001E2C4711218D429B414784137821C21ACF3184F418622ADC43215C2C1F4AD448048C42DC61444518D1821228044721223B25282555142724002B121E4847A1A82569818F2184B862711228C8824D624E848B141A44F2596880041440824211211281A14120581813480485211228C2251502848024440284442938112C28C11200 -:801600008A92188298D0220818122908818442202481228882F4BD62200400490481423011888B2446034A08421440089381C111108174123481CC04A44662214311022521021214E217442842A018905A8256882805431722089FBA0280A242181152412301232A22014A12A14354472688274220324322212221268124728201008581A8 -:801680006442481768422B28008146014E8181190120E22621424CA8C280FC9CF7004508006024002934486028102844021F4234424861860419488CC24848444119622846A982D0A2081088344225014E84882334458882A8824A088882817082F8CFA160211260126044606242902281603410842804B02688048C0448598801001AA4EB -:8017000024184048D1280210110929028110820441102288020028EF870F144C72140185218181410121250140190B544284214E1C42250982C0C8641E48311044224401811A34282C22049F2441241401442428422E126022C4224A42B19D4F41286122485012411142828400005082821143088220D8214191C24188884A022302B06237 -:8017800028418182180566152622E142182281440244828008004F750B0080921424196464281921840618291654141240E111180120041918220200142882A4008642022200C0214002214222802184821802E733204521311448280080040000001082042032124800886160644880A224228428140022210010621C860148822170C846 -:8018000004C18247838D2B40084814224122222228144423C4214068263084C044708285A438488800188043314140C92148214248002882634A044AA21800201402502290599011E9F221141F1762134564A37B413974127282B8496434218E48453CCB7D16435C322338141D82918A76481671CCF22144814BC423E24498436E32302813 -:8018800013622C6837142E422722D423F4A11A3F24785199141E98274A2322CC62474429D28C68124BA12F7F0F9011241815A415442E224E22EA79483132C04113D41A54341C4CE384E814E18468482F95FC4283144F34D4C344E28D54431E522AE215F182483F2CB613DA88D2137AC8E262FA42291F44B649A6224BE41C92442F149C424B -:801900004AAA646B2223B42848AC22702ADA710C5A64431A42B44C94637B444E14221D612AC6282B481F24712AA1254CA6243F42DC4CF624C4BD754F158613B18136221ABBC4D86463128F14D222F428224D812651B4253334258815C1816B124F581CA2482B881729C2489E8A1ED29AE988B6FC38C28EC2C2EFAD0A280000001880218823 -:801980000118802182219A18A281A281A22032182A3818200180084088480800840000000000800448B0E245A1445FD3F224263B229FE6F673151F57F353252F26F761B2BF15FB69333F47B553F513181D33AF85F771733F19F96F2B2BFBCF86B7A1F9492B3F38BA22E215F53A2A6F4FFE4C1A7F537712F214262B343F1858133F83538A82 -:801A00001F19FB28687F527241F34747EF91F145477F31FB42C23F6CFC4785122632824F44FC6AD82F2698424FC6AECCCFE5FC2C27141D115F57F625277F52F6383A7F77F172341F74F333733F23F27F27BF36F373741F34F44A6AED32EF85F767617F72F64F4F3F71F17E395F17F5592B3D637F47FE6775AD1A6F25F53A2A3D513D514F94 -:801A800041A7453F82B641F4535187B21F13D588F467673D237F56F63F3B7F74FE13B73F36FE23627F78F892722F2AFE82426F44F43A982F2EFA8A42EFC6AE22CDBE7BBE147AD611F524363B339FA6F673111F12F623352F24F673A23FC3FE3123393343BB44DF75F42B1D5D47BFBAFA5F1BEF88FC6E589FC8FB49191F1EA8848FB6D7EF32 -:801B0000F5CFCCD7B17F52E736F314462D723FADF953323F21578A9F99FB2969FFD3F331337F74F41B198FAEF692F62BC43BEC5F54F9514166B2A2F274E4AF86FD6A8A27866FC2AEAA4F62BB754FF131211F11F535377F55F33C3E7F77B176F775273F32F7A3B2BFEEFE7B2379F31113A726F775BFD2F1B7B1EFF8FCDFDBFF9AFAFE89DF0C -:801B8000DDFEC99B3F2AFC6362BFB4741FFAFFEAFFBADB57E437F634762F23B6B3FFF1F23F13F7282BBF9FFBA9E9EFF7F713337F76F63F7BFFF4FE13B33F36DE23F687973F3FF5E2A22F2AF2F664AF8BF9EEAE6F8EF226EC6AF624A61F390649014F12012E1250344834404348022411641164110044111042140371422302226012302278 -:801C000040012602226032402241022800501800F043D46018001D244004288082884401871400D028285848121C48A884501841828400D022240C40638840581211A56348100160140082AD32410040F1995EE022F41124A5F2112487141F41764AF2112CAB141F49B64AB991F24A9253F94A9143FB4AB343FB4AB14F8BF44AB15F8AF463 -:801C800048B14FAAD418FA254A8F11F2245A8F19E2A2FD9825ACFD98244DDA1F49D224FC9124CD831FC9F248821FC9B64AF8812CAB941D2CAB941F89F24A915F88B44A79B4F84A9647822B944F8BB442F9A4484AF9A44A4FD10D27821F41D42AE44112D2C1B64AF1112C811F41F66A841F41922A4B618334142D214F81C4A14F81F442A149 -:801D000065A8B44D1A8DB14DC24AD2A4E11CC21A8D254D5389D224F591284D521AD62CF59124CB121F4194141F81961A1F41D642E9C996225F88F64214478B25C4484CFB94482B3427888F44F3A4123F5C04004800840000400428000000002180010000001400004818000000008002000000100256082212901448241C44644430C21644 -:801D800021419214121841528C0210942822490410081448244840C2122441854258484CA214200C88204424A512296242008166742D0D248212105812603318121400141518145B28131814818458244110422208408202304413021146C1244823082302801503288352864210021486F8F7418002124C9448250117422745244D411122 -:801E00005021DB211049B211588424484127A122430C308A40D121C422461138442D229043D082724864424E1290442016816442846B1262502240F83288FBE44022011200271412208128810130142951844222148038244424000000000013014487144424828082082C09004A431832240090445F91082211614001102122591860146C -:801E80001002288022C2214302005180C4214800808482081450288604820025D181C41140012D128618020042F08C8190412813128252254D1141256112C818821C61185041155249544B1814AE441D484C0422C5F142841333246100190C19082B1888241D1425042968A8800825121888A448AD628C648481F04EFD80C421131232217F -:801F0000245414311C394118113C0120122112E412C8214302494421C2492322612244203461881114928210110223D8380813012481812724882782898484043FB70F1942420440854124829288A084C08150415096193214414AC8491004414F1468164100200888245028866641430824D0818448124182C188422C048484F0238F0042 -:801F80001252941821421CD8820128482604421601414551841918444C818808281304004881815022850220A84828148800819284A3A848429012C062009F540E8444422428130100450819624A5418481042288294121420C1881028024D3821215485C444504114449944048C18189114601240644125988450822160628D1E2448246C -:8020000011004522E1484121C211008480C288850140081281226042480000008012840840628180C2220021CC84082182004200484F110F216C0185A221341264914CE211E2122458581AA43489584815D848F2814818874185A1282082A424A0121042042E4424531842A4482DC4281B828DA2C012F018458668488AD1828898122904AD -:80208000E024F295EE80041C1141624142138141080000112411440041140084442648018514224448444214180115981810081444818224842744484410A8421074550113223421002B2411329021002001128214111041048442484981210AC60800861181C11129991221162288928880088880582240080024F03D610011444641444E -:80210000844115C114980043885814100418411849081B82103884301420A34143852402C114220044811C62822400008183080082212CF8BB7D4004444224008001004308004342080040E24481024150411100880011001031111214400614220000128424A440023F440623148411148105001618840415081A14D112B12238148C487B -:80218000B82104408484A44148114880A1411E481388512820688446222404224668144624A424A7245283C444812B28F04BF420481441214201601200A880084480480880080041221C08820000A04840088284860213B2880281118C1802842400102244D1DF0E28002604902512442023011041010048134241818444C18112190800E3 -:802200000011404141410240451C46421112111102881012022184AF9E0219440220812201184001C011101821641800B08A511815080089021B4144428902448032821241812240D14B82C824008821801128882828B86D06410000450245014128004400444428858452412A04A08428460413044220040000408144C24200C044C043B9 -:80228000800448008004FFC9058C014810818186026811CC218816012212410081211118801901004001888C41884458818D824440011427C234004024C124218C165842F06249242A633812285F2112F1213416C1341A61111E28B09915F14D114D21A7258E8584137811AC2817841B4C48285AD581B84444A112484813E414117118D151 -:8023000029E1117181B442D454FA424C456512A5F14664884A048FA4F4181A8B5521C8C0852F88F857E3145D444C544415042B42239121118B421B384A88C881860113C281114CE112C2816E52890586B12444A14213B859EC44044B25C81B4A8C58211483D81A78883A4219622E6D228E8A1722C65111C612A284256E844F84528262F04A -:802380005D4E60144117124F1444F1543446F1241416D154624218435844604186D445E1823254C4C11D8D542E2947448F51F185844F18C311004AC9188E1116C4114D382F887823C2184B11157228D38B5A891B2294916592822634822885522A8B888E42F061DE241A021A024002423048128714828B14828B14224E12A289219218A247 -:80240000200226088C4844E84142E84182E841021E2429E8C182C828418008888018847824883824884B42B024046BD6342F57E677F132151F42E64FF376747E715F5382F514454F96F411199FD9FD15D59F95FE1D3D5F77F77E7EEF8BFB55755F13F32D3D4BEA9F92F629295F12F26D61DF44F6E1E1CF84D41DB528F42414CF81B1A4ABC3 -:80248000135F52F11D19DFABFB3312DF7BF95355BF96F6636BDFFE7CAD59191F68F8C7C53F1CE446F6C8CCCFC8F3D672EFE6F6E6C4CFCEBEE4FE6CED5F894AF171672FC266421F43D351F435355F577725F42D6CDD4D1FD5F451599F92F71D5D5E717E71DFF2F336166B765F53F32533FFD2F12D28BF97F16161DF92B86CF66D65DFD2F223 -:802500004D48DD11DF56F43414CF97F734785F53F5755DCFB3F33F6A3F13713DFF53559FB6F66A6ABFB6D4FDF8898B1F7EFC47447F52F8E2E48FEEFEDE7C6F25FF6A6A2BCEEFC8BCC4FCB8FAFF6C076AD775541357424F47F376746F53F36565C5FC4C1C26B458A5B9CFC5D944E845F52535CFC3F1A5B4DFD5F524347F53F1ACFC9F82F584 -:8025800029695F56FC61694F44F6FDED1F55F411194D358F84E443E78CFC54741D419F53F3998BDFF1F39892BFD3F34F4DBFA6F46D4E95FD89899FB4FE4B497F54A4CCCF86BE5CFD725E2FAAF842686F88EC4CFCA8D87B1E343F76772BF511151F43F1A5657F52F337355F47D6457145F541518B998F88FBD4944F4FFC1C38DFF2F2D7D758 -:80260000FFDEFE1D3D4F42F29F9DDFFAFF49591F12F64D494F87F625255F5FFED9CD1F95E514F74C5C1F41B5A1FBD1F1DD559FF1F1E9ABDFD9FB988ABFDFFF4D4FEFE4F48F8FB55BB97F3CF6C7C53F14B462F6CE42EBD52F67F5EACA4F44F68C88EE648FBAE9BC041400000000400100441100100111422014010019210400400114400251 -:802680001484260300244003000000002F3D01415014112211181982C128188C8258814C5884348618021417818D81110046941142881418802488042413182228447426914126125118484210C848A981142A08829F720D2CF511248D121F41F248111F41324A1D24AF14F19124AB941B28AB9453B84A39A4AF3439A42F1479A4D81AF921 -:80270000A4481CF9A44A5CF8244A16F1244A96E1A26C592ECA9E242EDA1F49E222FD91248F22F99124AB961F49F26E921FC8B24AD941B24A9921AB9451AB9443F24AB247822BB4478229FB2448B84FA2F43419C05A1D648F2241F44C111F4112CC246F12F1112C25D4C1D212DB8592924782AD1353D2483924AD156B425CE9A2D558F124E1 -:80278000CA87114FA27498E5A27418E5B254582E5A17C82E5A1D442A7581BC627181FC661215A8141D2C2F44C928AF149B25AB94412F245B844A5B8429DB8494BA4D52AFC20386288804000000008002000000000000000040010080040000000080020000005012E0DA0E805224194221014C140100112008400440110810220222102806 -:8028000081010000402142020083480186012C045022812481001C747342018210144883A1124822880000104108418828800283C414C4002184100810012424132204A821200224C012200881C24011B8ED4C01E26443022412438224120413020014C10015220232218E6818220070110881813041401132220080182432212448242427 -:802880002484812FA8041423D18F0C0010511813011A440188008008001084480800405484402A0100000020123142E02248480188402201820000C048EF7D0E0000906180766813B148182114414208401141011400245400202802401422890824842502248229210812211012D44201A88220E8B80B4C1111011342221103CD121C01E6 -:802900001B81A3843C143DD8814B48814004888284D04111092112301A1CC122808298364411C92898143012148842409882855268002248D734401411012217242C01467819A684009188857451084E849110048240186451850182123018142C2281021E24250A258C6841238148C18200908244A082882288AFDC0E18001081024E2131 -:802980001312D21811E11499422C64218284144001148008250140022210C2162028682810148108230823011242101A941AE50200485FFB0CA1144249411804888419214121420285024002218200121C18584800C0144001400800008100108402124A02204C34118441F03D8510482404002014C1241018942420042149141851844912 -:802A0000D11A01881A04200400142041081460825021224092248A522848400810082180F23E490000302118C0820080110813011A44011004000021240086080041203212284400282004001440A28126044A3B810060BC005480C12818204468421210582418845012448150841881002F8154682084080044802261124400260142242D -:802A8000281011C262844CA24844128441282FD30E2100441444002531117011084081B442014602252548140111000081490100181002C028403822008048A8148009E08B8408007F7F0D4304411C414882840488142110420C41004400504210828128084482408122480260A820284A4882480200430282812181231228793701141404 -:802B000020E2618401219994521810248C9412308428460241200800282100230288250222400280022002A810A2828800001880087F460C0084004110458144012400000000008210044400002288002301000000004002210022842602502828EF4F060022816012004445835421121502144C4241C24140C12434283C02881C021C02DF -:802B800021202102282221282501212958142748281001214100005024BFBA0614181C81841284512520883412A110040000000040083288260800002485021800242002880070220218860288818288F0E8A880518190141280A424242E114004111229011003444042066416080011400844160800002826820100000086022C11040087 -:802C0000881FC4084480146154124421008028042188484841869412B082014423621221290118272A1826C1228828002C0A2308C02222241988280829028A02284829029F6F0C8A24588184144004430588C011001110411451211144118811401C3181822048E8888141048222A61438822488262242144111120840820822247FFA0BB7 -:802C80008C012A2402660100644C410428422419314416428812140119038818002140012184142A342214180014004481A800228002288225022FF94CC1141718814AC34E57324F447444C1184E72673518441D418CB41111B44154125DC82C514150232E211562134D32261171342322424342722854222CA228261622C2118819A28893 -:802D000099F281821CE268022118242381C48823F868C6D01134981F127219B954A351902127541D81111CB81221784612E244014522D412024F12A888455244243E849222C022A0282B3192250232341AF2A9222D22F0A22286D42242022F2A183228822692222EA828A22CFA4F2630547014684215C12416D242D4257496845D22873477 -:802D800025C2141C78227184C534251754146C515429F822292D18869883AC38812B8827891D88874A299B312A22F822882388A8882D2AF02282222D84211190B24CDA8A9A84812B888D224CF1F3E7400444000024008A041A8418C4821B42881B428813823821308110018092822888288800112918811801111001821400A2608AE08201 -:802E0000042608BF9C074B5457D49FD2F23D391F5BB772F753535F36F651113F2EA3112F2DFD1A18777C3F59B174F693963B289AF32E2E5F4BA9AA1B334F623A23EFCAF239384D841F3BF3ABAB2F1181E223B3A2524C2E326FE2F223213F13F321227F73712BFB83833F23F3212357382D82B5CF832F28F82282AFA1FBA2A22F8BF9AF8441 -:802E8000ABEC8F82E28AB83878D4045E445E559FD2F23D595F51B572F743435F76F655551F67F715172F25F5AAA8771C7F19F3F4F46F2BFB82649AF7AEEC6F6BA9881E122F23D122F22EBC3AD3CCF89113BF98E811E112E823519A4FC2E322FA66643F12F231711F22FA3636AD8A3F38F833322F2AEA68D831D8A8522227282F22FA3A98E8 -:802F00002CB21AF32C2E2FAEDC82B288FAA8B8BE65141F54D551F42D299FD3F355553F17F753534F76F653137F2BFFD2D63F2DFD4B686B847F35F5D4C31F73D717FC3417AF9AF8153565F591912EB33F3AF82EAD9FB1F127273F3BFBABAB3F3979A2F3B29227284FEAFAB2227F72F622223BBB2F1AF2B4B487A83F28F8B2B32E22642D82D5 -:802F8000BD2B37383B88888FABF982A2ABB96F58F8A2882F8496A8AE926FDE0B4B451F11F52D219FD6F3D4553F56F647437F76F257575F63FBD3D73F25F5DBF82B843F77F577777F3DF947C55F77F56F4F7F595B171F3BFBA1933F38FA3F2D1F13F3BD2F3F3BFBABAB1F39E928FA9292BFAAFA96862F28F827672F22B2F1F9A2A14F4BFB6B -:803000008B8B1F28F8B2B32F28F8A3831F38F88A8A37383F18A882AF89CB822F8B792CB68ABA42E48AF8A8A2AEE100A01290145014483440021440850480024440044480120219080021A0123022400226022440020000002038480082BF320C504150C100004714132824010060541164400154C081111284140088D0A228084022082830 -:803080008882880028205812100225628888828124CFA3032D521F4152281F417248F2112CA3D441B24AD1C1F24A911B61AB9451AB944782AF1439242F147924D812F924481CF9244A1CF8244A16F5244A96F5244A96E5A2E449E2A2F491242CF491248D121F4932481FC9324A1F48B24AD1C1B24A9921AB9451AB9443F24AB443F242B6AD -:80310000478329FB2448B84FA2F4A979D0A2F5116485F2112426D2C1B2687111346816DC4AF1112429FA15288F247834F848B2439388478329FA3648A84F8295382F226C412E488F58F224581CE2B2C5244F82F511284D4A1F4896581D244B141D28AB141FC9326A15FC4A941D242B344D28AB9443F3423447832F447B34C8A46F8284EB7F -:80318000A2B5BE0B2008000000004480020084000021008008000014000048000000000028000000002501ADF800001100001001200100000040080000848220010040A28100000022248114830800290140220AC022EF890E2CB18102006448245024005061424440046418200123480400100428008002000022002002003880828802DB -:80320000289C18F8F1FC1424130C11408244024503604315064440046400122331828604848800110081244A090000222824456812818082128282C8222682C28123F1A5348081020044000000004200008041080000006041800200280000000000880012180080088126785C042011044014041400120000250444000040010000002045 -:8032800022480240040011A11022080000004100003F9A065041A41488204103148E1842005048001142440049081085028048420200200228192814288A0814841484002061A186482111D8EA094011448118341411108128050041250445010090841440810220081022080041228250188B282C081C18180100205184290840F853E5EF -:803300000043512800002411901800008400204404000041000010820210820240214402000040080020411881015F9B0BC01244002031442428412410011004002002A90144214002008410028502000000002200000000100112930C844CB248110200004C014241181048020025044129418808000040020081160800001289088052A2 -:8033800018001222000000BBD78002000040020000481134100841000000000000001002440000000000000000401809F0B47620C224A5040000604240021C1401100244612210480821400200002100830100001288200285012021020000B0360220C1120080C14425220148200115584284000044004100000081211002610000008488 -:8034000000000000008184003FF50320040040020000001004002400006048189800000081100800280000000000000000003FBF041604124002181224413012450230124004210024502200000000000000181818002002000000001008E04B090000000000000000000000000000000000000000000000000000000022008FE40910042C -:8034800000292114022141214121100200400221001800001002002100180000002002000000000028DF23010000800148000010040000000061000000000000000000000000000000008410F8AC620000002004008400004110040000000000000000008011028002002200200200890200D0210218181240148401800100180040C212EE -:803500002400278150822514041800000028260222121A1208222822000000000000223F170482828400004904410000000040040081000000000000000000000000000022400140012F920D848054484908000040042800000012100A18812D8400211840110284800400100840584880420800000021F0ED920043184844822164410083 -:80358000850245040050442C110250A841A42118181200002124400280018100002200812200608200148C726709129200433812582944921244230121246504101294122118244048840821240040088C02200118280089820200000014D0884201CFA50A4981A411844444162204450440921420010024005082214F611804001200008B -:8036000028001E32A033408882224208000022000020D2920780410800100229012901290129012100000082812C0124400224400224200240082002000000000020014FC50316C4141E184564287042725486F11616AFA1C1121AF116162F21D1648151642B1165B612011AF184862F2858222F41A1912B1125B2120121251242F2222207 -:803680002B223E3223A133128F82A2222AB228F228280085A822A022F02928F018181A7128F813EB60414E5C8CD14444E26161244745295166A58EB13253662D224D142951642F2151662B11218F81F1849EAFA8F882922B111AB11251222F215113212553AA214E482E222B731AA133128F82A222702CF428282E24D088A222A022F028FE -:803700002824AF81A111AF83F1673BE041E1419518C54C022167452C5144A53C122C53442167411652461E1265B61211A2114D162592821632121E12E021511224401AA2622AE221B132A3118B118F82A2222AF2282487822850882A022A028F8202A5088F82F183E460418F41B51851CC2CE861217556C4124F61518823C1324F612172D0 -:8037800016642165E42151662B11F01818455CAAAF81682123E12141B2124141522125082CF422222B153AA3118B118F82022AF228248F8292247028A822A022F02829508A248F82F17E960000000000000000000000000000180000002002002280010022000000000000B0DC0C0000411200000000000000210024100400000000000035 -:8038000000000080020000000000F0A7E3D024F4112485F2112483F41124A3D441B24ED141B24A9921AB9451AB9443F24A9543F2429547822D914F82C4914FA2C4814FA264114FA265192E4A96C54A9E24ACF491242CF4912485F2912483F49124A3F48124AB141D24AB9419B24A19B54A3924AB9443B2427924989A4F8284FB244AFF3C0C -:80388000024D5A19D624F5112C83F41124E11F41B64EB111F24A941FC1B24ABB15F24A9432AF5429F3428547832D856F83D418F824525CF124C8144F8265182E5886C5599E258CF4912C481F49B6287481B448F19124237681BC6A51412F44D9C1B24A9B252B9445B84A1BB44A5B84A9BB1694BA4D5A3EA8402888040000004004280000C3 -:80390000000021008008000014008480040000004004000000005012D0A6010000100400000000000000000000008400000000000000002800000000608290282D74008210042048040000000024000000000000000000000000000000000000004001BFEB02200C44008244000026040000002400122008000011008120040000001024AF -:80398000220200000024264831382F130100004004000000000010020000000040080000000000000000000000000000BF45010000000000000000001004414008000024000000000000000084000000000000676100000041420000000041210000000000001004240010022100000000120000000000F0771F0000004448000000000041 -:803A000000000084000040020021400224000000008412000000000050430000000000000000450200411004000000100400000000000000000000000000F0E59C0000002200280000000000004440080085068400000000008028020000001200000000EFBC0780120800000084810000000021000000000000001200000000000000008A -:803A800012000018F041650000000000000000240040040000000010080000000000000000000010028001F0723D002881002800284008004002004410048400401C1248080080010000822200000020012C01001818F02C91000000000000840000000021000000000000000000000000000000000000008FE603000000100800100100A1 -:803B00001004000000100400002220080000005088A03100002200000000EDC7000000000000120000000000000000000000000000000000000000000000F08DC8000000000000000000000000000000000000000000000000000000000000FFE40F000000000020010000000000000000000000000000000000000000000000DF880C0077 -:803B800000000000000000000000000000000000000000000000000000000000F04FFE0000000000000000000000000000212001001002000084000000000000380000E0410600100840080000000000002100000000000000800100000000000000000000D0870C00000000000000000000000000000000000000000000000000000000EC -:803C000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F0000000000000000000000000000000000000000000000000000E6 -:803C8000000000F04FFE0000840000000000000040020000002180010000000040080000000000800200001F8D0700000084000000000000000000000000001002180000000000000000180000F039E1000000000000000000000000000000000000000000000000000000000000FFE40F0000000040050000400400210044001002188048 -:803D00008802218001884008000028840000800200004FB1070014000048405588281082044480022100448002214818808802214818448828842148408481421882041E148002211A01445C0300004001008004540000484004000040040000008002000088000000804208000000F046990000000000540000004400100240040021806E -:803D800001882810021880088400840028840000800200005FF90B0000000000000000000000000000000000000000000000000000000000F04FFE000000000000000000000000000000000000000000000000000000000000FFE40F002100140000480080022148008002000080028004000080044480022148400400214840040021FFE4 -:803E000018040000000000000000000000000000000000000000000000000000000000F04FFE000000000000400500440000000040040000280000000088000028004008000000B0F2040000000000000000000000000000000000000000000000000000000000F04FFE00000000000000004004000000000000002800000000000080022B -:593E80000000000000E0580C00000000000054000000000000400400000000000080080000004008000000F03D7BFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC4 -:00000001FF diff --git a/zaptel/kernel/xpp/firmwares/LICENSE.firmware b/zaptel/kernel/xpp/firmwares/LICENSE.firmware deleted file mode 100644 index b9bb89f0..00000000 --- a/zaptel/kernel/xpp/firmwares/LICENSE.firmware +++ /dev/null @@ -1,37 +0,0 @@ -The firmware files (*.hex) in this directory are software for the -Astribank itself and not intended to run on the Linux system itself. -They are generally freely distriributable (see exact terms below). - -/****************************************************************************/ -/* Copyright (c) 2004-2006 Xorcom Inc. All Rights Reserved. */ -/* Redistribution and use of the microcode software ( Firmware ) is */ -/* permitted provided that the following conditions are met: */ -/* */ -/* 1. Firmware is redistributed verbatim without any modification; */ -/* 2. Any reproduction of Firmware must contain the above */ -/* copyright notice, this list of conditions and the below */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution; and */ -/* 3. The name of Xorcom may not be used to endorse or promote */ -/* products derived from this Firmware without specific prior */ -/* written consent. */ -/* */ -/* Disclaimer: Xorcom provides this firmware "as is" with no warranties */ -/* or indemnities whatsoever. Xorcom expressly disclaims any express, */ -/* statutory or implied warranties, including, but not limited to, the */ -/* implied warranties of merchantability, fitness for a particular */ -/* purpose and non-infringement. In no event shall Xorcom be liable for */ -/* any direct, indirect, incidental, special, exemplary, or consequential */ -/* damages (including, but not limited to, procurement of substitute */ -/* goods or services; loss of use, data, or profits; or business */ -/* interruption) however caused and on any theory of liability, whether */ -/* in contract, strict liability, or tort (including negligence or */ -/* otherwise) arising in any way out of the use of this firmware, even */ -/* if advised of the possibility of such damage. User acknowledges and */ -/* agrees that the purchase or use of the firmware will not create or */ -/* give grounds for a license by implication, estoppel, or otherwise in */ -/* any intellectual property rights (patent, copyright, trade secret, */ -/* mask work, or other proprietary right) embodied in any other Xorcom */ -/* hardware or firmware either solely or in combination with the firmware. */ -/****************************************************************************/ - diff --git a/zaptel/kernel/xpp/firmwares/README b/zaptel/kernel/xpp/firmwares/README deleted file mode 100644 index e423aa62..00000000 --- a/zaptel/kernel/xpp/firmwares/README +++ /dev/null @@ -1,19 +0,0 @@ -This distribution includes the firmware files required by the Xorcom[tm] -Astribank[tm]. - -This distribution inlcudes just the firmware files. Be sure to use a -zaptel distribution/package of a matching version. - -INSTALLATION -"""""""""""" -run "make install" as root. (which will simply copy all the *.hex files -to /usr/share/zaptel ) - -USAGE -""""" -When the firmware files are in place everything should work -automagically. Consult the xpp documentation included in the package -zaptel (or the debian package zaptel) that you use for further information. - - -For further information contact support@xorcom.com http://xorcom.com diff --git a/zaptel/kernel/xpp/firmwares/USB_FW.hex b/zaptel/kernel/xpp/firmwares/USB_FW.hex deleted file mode 100644 index 01f7ce98..00000000 --- a/zaptel/kernel/xpp/firmwares/USB_FW.hex +++ /dev/null @@ -1,223 +0,0 @@ -# -# $Id:$ -# -:100600001201000200000040E4E451110000010268 -:1006100003010A0600020000004001000902370041 -:1006200002010080320904000002FF0000040705F7 -:100630000202000200070586020002000904010010 -:1006400002FF0000050705040200020007058802FA -:100650000002000902370002010080320904000094 -:1006600002FF0000040705020240000007058602A1 -:100670004000000904010002FF0000050705040214 -:100680004000000705880240000004030904160327 -:1006900058006F00720063006F006D0020004C0076 -:1006A0005400440014034100730074007200690098 -:1006B000620061006E006B001203490053004E009F -:1006C00075006D006200650072000A03460050006C -:1006D000470041002A034D0061006E006100670081 -:1006E00065006D0065006E0074002000500072000F -:1006F0006F0063006500730073006F0072000000FC -:0B0B6C00C2B675B5C4120B18D2B62239 -:100A6300E4901010F07A107B107D017F50120A9FE2 -:100A73007F501208567A107B007D107F50020A8344 -:1008F8007F031209EBEF2402FFE43EFEE516C394E2 -:1009080008501F74082516F582E43410F583E0FDBD -:100918008F828E8375F002E5161205E8EDF0051654 -:0209280080DA73 -:01092A0022AA -:10092B00E50B240AFDE4350AFC901003E02FFF0DC4 -:10093B00EDAA0470010C14F5828A83EFF090100479 -:10094B00E08D828C83F0D20512099090E680E05402 -:02095B00F7F0B3 -:01095D002277 -:1007000090E600E054E74410F090E60174C0F090E9 -:10071000E6107420F000000090E611F00000009058 -:10072000E6047480F0000000740FF0000000E4F0B4 -:1007300000000090E6187410F0000000E490E61944 -:10074000F000000090E61A7408F0000000E490E663 -:100750001BF000000090E6497482F0000000F000F9 -:10076000000090E6247402F0000000E490E625F01A -:1007700000000090E6957480F0000000F00000009A -:0407800043AF012260 -:040B18007F327E00AA -:100B1C007C007D181205D6EF1FAC0670011E4C70C0 -:020B2C00F622AF -:0A0784008E188F198B1A8A1B891C2E -:10078E00E4F51DF51EC3E51E9519E51D95185033AC -:10079E00AB1AAA1BA91C851E82851D83120587FF15 -:1007AE00E4FEC2B2EF1392B7EFC313FFD2B20EBE86 -:1007BE0008F0C2B220B002C322051EE51E70C605A7 -:0407CE001D80C2D3F5 -:0107D2002204 -:10029200E4901010F0F516F517C204E5AA54846034 -:1002A200030203F990F400E024FE700302036524C4 -:1002B200FA700302038724F870030203B324F07078 -:1002C200030203BD24E070030203D824C0700302BA -:1002D20003D8247F60030203CC75160075170490BF -:1002E200FC007401F090F401E090FC01F090F40243 -:1002F200E090FC02F090F401E07017A3E07013307C -:10030200B01090E60174C0F0C2B6120B18D2B61249 -:100312000B1820B00330B44390E694E0FE90E695CB -:10032200E07C002400FFEC3ECF24FCCF34FFFE7BB8 -:10033200017AF47904120784501990FC0330B40D49 -:100342007408F07FE87E03120B1C0203D87404F0D9 -:100352000203D890FC037402F0807B90FC037401CA -:10036200F0807375160075170490FC007402F0E4B7 -:10037200A3F0A3F030B406A37410F0805990FC03EC -:100382007420F0805175160075171190FC007408E6 -:10039200F0E4FF74002FF582E43410F583E0FE747C -:1003A200012FF582E434FCF583EEF00FBF10E480F8 -:1003B2002590E6017403F07F02800A90E60174C082 -:1003C200F0C2B6E4FF12092B800C751600751701F6 -:1003D20090FC0074AAF0E51745166012E51690E647 -:1003E2009CF0000000E51790E69DF000000090E60A -:0703F200957480F00000008B -:0103F90022E1 -:020AFD00D32202 -:080B8C0090E6BAE0F528D3223F -:100AEB0090E740E528F0E490E68AF090E68B04F07E -:020AFB00D32204 -:080B940090E6BAE0F527D32238 -:100B5A0090E740E527F0E490E68AF090E68B04F00F -:020B6A00D32294 -:100A160090E6B9E0242F600D04701990E604E0FF1B -:100A2600430780800890E604E0FF53077F0000003C -:070A3600EFF08002D322C3A0 -:010A3D002296 -:100ABB00C0E0C083C082D2015391EF90E65D740118 -:080ACB00F0D082D083D0E032AC -:100B2E00C0E0C083C0825391EF90E65D7404F0D0B4 -:060B3E0082D083D0E032FA -:100B4400C0E0C083C0825391EF90E65D7402F0D0A0 -:060B540082D083D0E032E4 -:10088E00C0E0C083C08285100C85110D850D828558 -:10089E000C83A37402F085080E85090F850F8285DF -:1008AE000E83A37407F05391EF90E65D7410F0D0B1 -:0608BE0082D083D0E0327D -:100AD300C0E0C083C082D2035391EF90E65D7408F7 -:080AE300F0D082D083D0E03294 -:10081900C0E0C083C08290E680E030E72085080C04 -:1008290085090D850D82850C83A37402F085100E50 -:1008390085110F850F82850E83A37407F05391EFFD -:0D08490090E65D7420F0D082D083D0E032C4 -:0A0B8200000102020303040405054C -:10050200C203C200C202C201120B6C120700120B1C -:100512009C120A63750A06750B0075120675131292 -:1005220075080675091C7510067511537514067544 -:10053200158AD2E843D82090E668E04409F090E6B4 -:100542005CE0443DF0D2AF1208F87F0112092B5350 -:100552008EF8C203120292300105120070C20130FD -:1005620003F2C203120A3E20001690E682E030E750 -:1005720004E020E1EF90E682E030E604E020E0E4EF -:050582001209BF80CF4B -:0B0B770090E50DE030E402C322D32221 -:1000700090E6B9E0700302012F1470030201A4247A -:10008000FE700302021F24FB700302012914700397 -:1000900002012314700302011714700302011D24CE -:1000A00005600302027E120AFD400302028A90E606 -:1000B000BBE024FE602714603824FD601114602723 -:1000C00024067050E50A90E6B3F0E50B803C120B75 -:1000D00077503EE51290E6B3F0E513802DE50C90E5 -:1000E000E6B3F0E50D8023E50E90E6B3F0E50F8072 -:1000F0001990E6BAE0FF1209EBAA06A9077B01EA0C -:10010000494B600DEE90E6B3F0EF90E6B4F00202DA -:100110008A020279020279120B5A02028A120B94A5 -:1001200002028A120B8C02028A120AEB02028A90E5 -:10013000E6B8E0247F601514601924027063A20001 -:10014000E43325E0FFA202E4334F8041E490E7402E -:10015000F0803F90E6BCE0547EFF7E00E0D39480C8 -:100160007C0040047D0180027D00EC4EFEED4F24BA -:1001700082F582740B3EF583E493FF3395E0FEEF46 -:1001800024A1FFEE34E68F82F583E0540190E7402E -:10019000F0E4A3F090E68AF090E68B7402F002029D -:1001A0008A02027990E6B8E024FE60162402600319 -:1001B00002028A90E6BAE0B40105C20002028A0295 -:1001C000027990E6BAE0705590E6BCE0547EFF7E7E -:1001D00000E0D394807C0040047D0180027D00EC2F -:1001E0004EFEED4F2482F582740B3EF583E493FFBF -:1001F0003395E0FEEF24A1FFEE34E68F82F583E035 -:1002000054FEF090E6BCE05480131313541FFFE03B -:10021000540F2F90E683F0E04420F0806D805A90D8 -:10022000E6B8E024FE60192402704E90E6BAE0B40D -:100230000104D200805490E6BAE06402604C803938 -:1002400090E6BCE0547EFF7E00E0D394807C0040CA -:10025000047D0180027D00EC4EFEED4F2482F5828C -:10026000740B3EF583E493FF3395E0FEEF24A1FF8A -:10027000EE34E68F82F583800D90E6A08008120AA6 -:1002800016500790E6A0E04401F090E6A0E044801C -:01029000F07D -:01029100224A -:03003300020BA419 -:040BA40053D8EF3201 -:03004300020B00AD -:03005300020B009D -:100B0000020ABB00020B4400020B2E00020AD300B3 -:080B100002088E000208190022 -:1009BF0090E682E030E004E020E60B90E682E03043 -:1009CF00E119E030E71590E680E04401F07F147EF6 -:0C09DF00001207D390E680E054FEF022E6 -:1009900030050990E680E0440AF0800790E680E0A8 -:1009A0004408F07FDC7E051207D390E65D74FFF00B -:0F09B00090E65FF05391EF90E680E054F7F0226D -:080B9C00E4F526D2E9D2AF22F4 -:10085600AD0790E678E020E6F9C2E990E678E04454 -:1008660080F0ED25E090E679F090E678E030E0F96A -:1008760090E678E04440F090E678E020E6F990E6ED -:0808860078E030E1D6D2E9224E -:10095E00AC0790E678E020E6F9E526702390E6787D -:10096E00E04480F0EC25E090E679F08D21AF03A90C -:10097E00077522018A238924E4F525752601D322E1 -:02098E00C32282 -:1008C400AC0790E678E020E6F9E526702590E67816 -:1008D400E04480F0EC25E0440190E679F08D21AF0E -:1008E40003A9077522018A238924E4F525752603C3 -:0408F400D322C32226 -:03004B000203FAB3 -:1003FA00C0E0C083C082C085C084C086758600C044 -:10040A00D075D000C000C001C002C003C006C0073A -:10041A0090E678E030E2067526060204E490E67873 -:10042A00E020E10CE526640260067526070204E472 -:10043A00E52624FE605F14603624FE70030204D5AC -:10044A0024FC70030204E1240860030204E4AB22E2 -:10045A00AA23A924AF2505258F8275830012058753 -:10046A0090E679F0E52565217070752605806B9018 -:10047A00E679E0AB22AA23A924AE258E82758300F1 -:10048A001205B4752602E5216401704E90E678E003 -:10049A004420F08045E52124FEB5250790E678E062 -:1004AA004420F0E52114B5250A90E678E04440F0AE -:1004BA0075260090E679E0AB22AA23A924AE258E00 -:1004CA00827583001205B40525800F90E678E04412 -:1004DA0040F075260080037526005391DFD007D0BF -:1004EA0006D003D002D001D000D0D0D086D084D09C -:0804FA0085D082D083D0E032EE -:0209EB00A9075A -:1009ED00AE14AF158F828E83A3E064037017AD0133 -:1009FD0019ED7001228F828E83E07C002FFDEC3E7D -:080A0D00FEAF0580DFE4FEFFEF -:010A150022BE -:100A83001208C4E52624FA600E146006240770F3E6 -:0C0A9300D322E4F526D322E4F526D3227A -:100A9F0012095EE52624FA600E146006240770F32F -:0C0AAF00D322E4F526D322E4F526D3225E -:100A3E0090E682E044C0F090E681F043870100002A -:040A4E000000002282 -:1007D3008E188F1990E600E054187012E519240161 -:1007E300FFE43518C313F518EF13F519801590E6D8 -:1007F30000E05418FFBF100BE51925E0F519E518C3 -:1008030033F518E5191519AE18700215184E600561 -:06081300120A5280EE22E1 -:100A52007400F58690FDA57C05A3E582458370F9B7 -:010A62002271 -:030000000205F402 -:0C05F400787FE4F6D8FD7581280205022E -:10058700BB010CE58229F582E5833AF583E0225029 -:1005970006E92582F8E622BBFE06E92582F8E22273 -:0D05A700E58229F582E5833AF583E493228D -:1005B400F8BB010DE58229F582E5833AF583E8F07D -:1005C400225006E92582C8F622BBFE05E92582C829 -:0205D400F22211 -:1005D600EF8DF0A4A8F0CF8CF0A428CE8DF0A42E39 -:0205E600FE22F3 -:0C05E800A42582F582E5F03583F583221E -:00000001FF - \ No newline at end of file diff --git a/zaptel/kernel/xpp/init_card_1_30 b/zaptel/kernel/xpp/init_card_1_30 deleted file mode 100755 index 370695e2..00000000 --- a/zaptel/kernel/xpp/init_card_1_30 +++ /dev/null @@ -1,535 +0,0 @@ -#! /usr/bin/perl -w -use strict; - -# -# Written by Oron Peled -# Copyright (C) 2006, Xorcom -# -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# See the file LICENSE in the top level of this tarball. -# - -# -# $Id: init_card_1_30 4531 2008-09-09 17:13:27Z tzafrir $ -# -# Data format: -# - A comment start with ';' or '#' until the end of line -# - Blank lines are ignored -# - Fields are whitespace separated (spaces or tabs) -# -# The fields are (in command line order): -# 1. SLIC select in decimal (range 0-7). -# * is a special value which means ALL SLICS (only some registers -# accept settings for ALL SLICS). -# 2. Command word: -# - RD Read Direct register. -# - RS Read Sub-register. -# - WD Write Direct register. -# - WS Write Sub-register. -# 3. Register number in hexadecimal. -# 4. Low data byte in hexadecimal. (for WD and WS commands). -# 5. High data byte in hexadecimal. (for WS command only). -# -# - -package main; -use File::Basename; -use Getopt::Std; - -my $program = basename("$0"); -my $init_dir = dirname("$0"); -BEGIN { $init_dir = dirname($0); unshift(@INC, "$init_dir", "$init_dir/zconf"); } -use Zaptel::Config::Defaults; -my $unit_id; -my %opts; -$ENV{XPP_BASE} = '/proc/xpp'; - -getopts('o:', \%opts); - -my $debug; -my $skip_calib; - -my $xpd_name = sprintf("XPD-%1d0", $ENV{UNIT_NUMBER}); -my $chipregs = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/chipregs"; - -sub logit { - print STDERR "$unit_id: @_\n"; -} - -sub debug { - logit @_ if $debug; -} - -# Arrange for error logging -if (-t STDERR) { - $unit_id = 'Interactive'; - logit "Interactive startup"; -} else { - $unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}"; - open (STDERR, "| logger -t $program -p kern.info") || die; - logit "Non Interactive startup"; -} - -sub set_output() { - my $output; - - if($opts{o}) { - $output = $opts{o}; - } else { - # No subunits in FXS (everything is subunit 0) - $output = $chipregs; - } - open(REG, ">$output") || die "Failed to open '$output': $!\n"; - my $oldfh = select REG; - print "# Setting output\n" if $opts{o}; - return $oldfh; -} - -sub mysleep($) { - my $timeout = shift; - select(undef,undef,undef,$timeout); -} - -package FXS; - -sub gen { - my $fmt = shift; - $| = 1; - printf "$fmt\n", @_; -} - -my @SlicNums = (0 .. 7); - -sub write_to_slic_file($) { - my $write_str = shift; - - open(SLICS,">$chipregs") or - die("Failed writing to chipregs file $chipregs"); - print SLICS $write_str; - close(SLICS) or die "Failed writing '$write_str' to '$chipregs': $!"; - main::mysleep(0.001); - -} - -sub read_reg($$$) { - my $read_slic = shift; - my $read_reg = shift; - my $direct = shift; - - write_to_slic_file( - sprintf("%s R%s %02X", $read_slic, $direct, $read_reg)); - main::mysleep(0.005); - open(SLICS,$chipregs) or - die("Failed reading from chipregs file $chipregs"); - #awk '/^SLIC_REPLY:/{print $5}' $SLICS | cut -dx -f2 - my @reply = (); - while(){ - #if (/^ /) { - # main::debug "answer line: $_"; - #} - s/#.*//; - next unless /\S/; - if (/^ \d*\s+[RW][DI]\s+[[:xdigit:]]+\s+([[:xdigit:]]+)\s+([[:xdigit:]]*)/){ - @reply = (hex($1), hex($2)); - #main::debug "got [$reply]"; - last; - } else { - main::logit("Got from '$chipregs' a non-matching line '$_'"); - } - } - close(SLICS); - die("Failed reading from '$chipregs' ($read_slic,$read_reg,$direct)") - unless @reply; - if ($direct eq 'S') { - return @reply; - } else { - return $reply[0]; - } -} - -# TODO: rearange arguments -sub write_reg{#($$$$$) { - my $read_slic = shift; - my $read_reg = shift; - my $direct = shift; - my $reg_val_low = shift; - my $reg_val_hi = shift; - - my $str = sprintf "%s W%s %02X %02X", - $read_slic, $direct, $read_reg, $reg_val_low; - if ($direct eq 'S') { - $str .= sprintf " %02X", $reg_val_hi; - } - write_to_slic_file($str); -} - -sub log_calib_params() { - for my $i (100 .. 107) { - my $line="Calib Reg $i: "; - for my $slic (@SlicNums) { - $line .= " ".read_reg($slic, $i, 'D'); - } - main::debug($line); - } -} - -sub init_indirect_registers() { - return write_to_slic_file("# -* WS 1E 00 C2 55 -* WS 1E 01 E6 51 -* WS 1E 02 85 4B -* WS 1E 03 37 49 - -* WS 1E 04 33 33 -* WS 1E 05 02 02 -* WS 1E 06 02 02 -* WS 1E 07 98 01 - -* WS 1E 08 98 01 -* WS 1E 09 11 06 -* WS 1E 0A 02 02 -* WS 1E 0B E5 00 - -* WS 1E 0C 1C 0A -* WS 1E 0D 30 7B -* WS 1E 0E 63 00 -* WS 1E 0F 00 00 - -* WS 1E 10 70 78 -* WS 1E 11 7D 00 -* WS 1E 12 00 00 -* WS 1E 13 00 00 - -* WS 1E 14 F0 7E -* WS 1E 15 C0 01 -* WS 1E 16 00 00 -* WS 1E 17 00 20 - -* WS 1E 18 00 20 -* WS 1E 19 00 00 -* WS 1E 1A 00 20 -* WS 1E 1B 00 40 - -* WS 1E 1C 00 10 -* WS 1E 1D 00 36 -* WS 1E 1E 00 10 -* WS 1E 1F 00 02 - -* WS 1E 20 C0 07 -* WS 1E 21 00 26 -* WS 1E 22 F4 0F -* WS 1E 23 00 80 - -#* WS 1E 24 20 03 -#* WS 1E 25 8C 08 -#* WS 1E 26 00 01 -#* WS 1E 27 10 00 - -* WS 1E 24 00 08 -* WS 1E 25 00 08 -* WS 1E 26 00 08 -* WS 1E 27 00 08 - -* WS 1E 28 00 0C -* WS 1E 29 00 0C -* WS 1E 2B 00 01 - -* WS 1E 63 DA 00 -* WS 1E 64 60 6B -* WS 1E 65 74 00 -* WS 1E 66 C0 79 - -* WS 1E 67 20 11 -* WS 1E 68 E0 3B -#"); -} - -sub init_early_direct_regs() { - return write_to_slic_file("# -* WD 08 00 # Audio Path Loopback Control -* WD 4A 34 # High Battery Voltage -* WD 4B 10 # Low Battery Voltage -* WD 40 00 # Line Feed Control -#") -} - -my @FilterParams = (); - -sub save_indirect_filter_params() { - for my $slic (@SlicNums) { - for my $reg (35 .. 39) { - $FilterParams[$slic][$reg] = - [read_reg($slic, $reg, 'S')]; - write_reg($slic, $reg, 'S', 0, 0x80); - } - } - -} - -sub restore_indirect_filter_params() { - for my $slic (@SlicNums) { - for my $reg (35 .. 39) { - write_reg($slic, $reg, 'S', - @{$FilterParams[$slic][$reg]}); - } - } -} - -my $ManualCalibrationSleepTime = 0.04; # 40ms - -sub manual_calibrate_loop($$) { - my $write_reg = shift; - my $read_reg = shift; - - # counters to count down to (at most) 0 - my @slic_counters = (); - for my $i (0 .. $#SlicNums) { - $slic_counters[$i] = 0x1F; - } - - # start calibration: - my $calibration_in_progress = 1; - write_reg('*', $write_reg, 'D', 0x1F); - main::mysleep $ManualCalibrationSleepTime; - - # wait until all slics have finished calibration, or for timeout - while ($calibration_in_progress) { - $calibration_in_progress = 0; # until proven otherwise - my $debug_calib_str = "ManualCalib:: "; - for my $slic(@SlicNums) { - my $value = read_reg($slic, $read_reg, 'D'); - $debug_calib_str .= " [$slic_counters[$slic]:$value]"; - if ($value != 0 && $slic_counters[$slic] > 0) { - $calibration_in_progress = 1; - $slic_counters[$slic]--; - write_reg($slic,$write_reg,'D',$slic_counters[$slic]); - } - } - main::debug($debug_calib_str); - # TODO: unnecessary sleep in the last round: - main::mysleep $ManualCalibrationSleepTime; - } -} - -sub manual_calibrate() { - manual_calibrate_loop(98, 88); - manual_calibrate_loop(99, 89); -} - -sub auto_calibrate($$) { - my $calib_96 = shift; - my $calib_97 = shift; - - #log_calib_params(); - # start calibration: - write_to_slic_file( - sprintf - "* WD 60 %02X\n". - "* WD 61 %02X\n". - "", $calib_96, $calib_97 - - ); - # wait until all slics have finished calibration, or for timeout - my $sleep_cnt = 0; - # time periods in seconds: - my $sleep_time = 0.1; - my $timeout_time = 2; - CALIB_LOOP: for my $slic (@SlicNums) { - main::debug("checking slic $slic"); - while(1) { - if ((read_reg($slic, 60, 'D')) == 0) { - # move to next register - main::debug("slic $slic calibrated"); - last; - } - if ( $sleep_cnt > $timeout_time/$sleep_time) { - main::debug("Auto Calibration: Exiting on timeout: $timeout_time."); - last CALIB_LOOP; - } - main::debug("auto_calibrate not done yet: slic #$slic"); - main::mysleep(0.1); - $sleep_cnt++; - } - } - #log_calib_params(); -} - -sub calibrate_slics() { - main::logit "Calibrating '$0'"; - auto_calibrate(0x47, 0x1E); - main::debug "after auto_calibrate"; - manual_calibrate(); - main::debug "after manul_calibrate"; - auto_calibrate(0x40, 0x01); - main::debug "after auto_calibrate 2"; - main::logit "Continue '$0'"; -} - -sub read_defaults() { - # For lab tests - my $labfile = "$init_dir/genzaptelconf.env"; - - # Source default files - $ENV{ZAPTEL_DEFAULTS} = "$labfile" if -r "$labfile"; - my $var_debug = 'DEBUG_INIT_FXS'; - my $var_skip_calib = 'INIT_FXS_SKIP_CALIB'; - my ($default_file, %source_defaults) = - Zaptel::Config::Defaults::source_vars($var_debug, $var_skip_calib); - $debug = $source_defaults{$var_debug}; - $skip_calib = $source_defaults{$var_skip_calib}; - main::logit "From $default_file: $var_debug=$debug $var_skip_calib=$skip_calib"; -} - -package main; - -main::logit "Starting '$0'"; - -FXS::read_defaults; -main::debug "before init_indirect_registers"; -FXS::init_indirect_registers(); -main::debug "after init_indirect_registers"; -FXS::init_early_direct_regs(); -main::debug "after init_early_direct_regs"; -if($skip_calib) { - main::logit "==== WARNING: SKIPPED SLIC CALIBRATION ====="; -} else { - FXS::calibrate_slics; -} -set_output; -while() { - chomp; - s/[#;].*$//; # remove comments - s/^\s+//; # trim whitespace - s/\s+$//; # trim whitespace - s/\t+/ /g; # replace tabs with spaces (for logs) - next unless /\S/; # Skip empty lines - main::debug "writing: '$_'"; - print "$_\n"; -} -close REG; - -main::logit "Ending '$0'"; -close STDERR; -exit 0; - -# ----------------------------------==== 8-channel FXS unit initialization ===----------------------------------------- - -__DATA__ -# Change SLICs states to "Open state"s (Off,all transfers tristated to avoid data collision), Voltage sense -* WD 40 00 - -# Flush out energy accumulators -* WS 1E 58 00 00 -* WS 1E 59 00 00 -* WS 1E 5A 00 00 -* WS 1E 5B 00 00 -* WS 1E 5C 00 00 -* WS 1E 5D 00 00 -* WS 1E 5E 00 00 -* WS 1E 5F 00 00 -* WS 1E 61 00 00 -* WS 1E 58 00 00 -* WS 1E C1 00 00 -* WS 1E C2 00 00 -* WS 1E C3 00 00 -* WS 1E C4 00 00 -* WS 1E C5 00 00 -* WS 1E C6 00 00 -* WS 1E C7 00 00 -* WS 1E C8 00 00 -* WS 1E C9 00 00 -* WS 1E CA 00 00 -* WS 1E CB 00 00 -* WS 1E CC 00 00 -* WS 1E CD 00 00 -* WS 1E CE 00 00 -* WS 1E CF 00 00 -* WS 1E D0 00 00 -* WS 1E D1 00 00 -* WS 1E D2 00 00 -* WS 1E D3 00 00 - -# Setting of SLICs offsets -# New card initialization -0 WD 02 00 -0 WD 04 00 -1 WD 02 08 -1 WD 04 08 -2 WD 02 10 -2 WD 04 10 -3 WD 02 18 -3 WD 04 18 -4 WD 02 20 -4 WD 04 20 -5 WD 02 28 -5 WD 04 28 -6 WD 02 30 -6 WD 04 30 -7 WD 02 38 -7 WD 04 38 -* WD 03 00 -* WD 05 00 - -# Audio path. (also initialize 0A and 0B here if necessary) -* WD 08 00 -* WD 09 C0 - -# Automatic/Manual Control: defaults but: -# Cancel AOPN - Power Alarm -# Cancel ABAT - Battery Feed Automatic Select -* WD 43 16 - -# Loop Closure Debounce Interval -* WD 45 0A - -# Ring Detect Debounce Interval -* WD 46 47 - -# Battery Feed Control: Battery low (DCSW low) -* WD 42 00 - -# Loop Current Limit -* WD 47 00 - -# Ring VBath: -* WD 4A 3F - - -* WD 6C 01 - -* WS 1E 23 00 80 -* WS 1E 24 20 03 -* WS 1E 25 8C 08 -* WS 1E 26 00 01 -* WS 1E 27 10 00 - -#------ Metering tone -* WS 1E 17 61 15 # Amplitue Ramp-up -* WS 1E 18 61 15 # Max Amplitude -* WS 1E 19 FB 30 # Frequency -* WD 2C 00 # Timer dL -* WD 2D 03 # Timer dH - -# ------------------------------------- Initialization of direct registers -------------------------------------------- - -# Mode(8-bit,u-Law,1 PCLK ) setting, Loopbacks and Interrupts clear - -* WD 01 29 -#* WD 0E 00 - -#* WD 15 00 -#* WD 16 03 - -# Clear pending interrupts -* WD 12 FF -* WD 13 FF -* WD 14 FF - -#* WD 4A 34 -#* WD 4B 10 diff --git a/zaptel/kernel/xpp/init_card_2_30 b/zaptel/kernel/xpp/init_card_2_30 deleted file mode 100755 index 50973893..00000000 --- a/zaptel/kernel/xpp/init_card_2_30 +++ /dev/null @@ -1,426 +0,0 @@ -#! /usr/bin/perl -w -use strict; - -# -# Written by Oron Peled -# Copyright (C) 2006, Xorcom -# -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# See the file LICENSE in the top level of this tarball. -# - -# -# $Id: init_card_2_30 4531 2008-09-09 17:13:27Z tzafrir $ -# -# Data format: -# - A comment start with ';' or '#' until the end of line -# - Blank lines are ignored -# - Fields are whitespace separated (spaces or tabs) -# -# The fields are (in command line order): -# 1. SLIC select in decimal (range 0-7). -# * is a special value which means ALL SLICS (only some registers -# accept settings for ALL SLICS). -# 2. Command word: -# - RD Read Direct register. -# - RS Read Sub-register. -# - WD Write Direct register. -# - WS Write Sub-register. -# 3. Register number in hexadecimal. -# 4. Low data byte in hexadecimal. (for WD and WS commands). -# 5. High data byte in hexadecimal. (for WS command only). -# -# - -package main; -use File::Basename; -use Getopt::Std; - -my $program = basename("$0"); -my $init_dir = dirname("$0"); -BEGIN { $init_dir = dirname($0); unshift(@INC, "$init_dir", "$init_dir/zconf", "$init_dir/utils/zconf"); } -use Zaptel::Config::Defaults; -my $unit_id; -my %opts; -$ENV{XPP_BASE} = '/proc/xpp'; - -getopts('o:v:', \%opts); - -my $debug; - -my $xpd_name; -my $chipregs; - -sub logit { - print STDERR "$unit_id: @_\n"; -} - -sub debug { - logit @_ if $debug; -} - -# Arrange for error logging -if (-t STDERR) { - $unit_id = 'Interactive'; - main::debug "Interactive startup"; -} else { - $unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}"; - $xpd_name = sprintf("XPD-%1d0", $ENV{UNIT_NUMBER}); - $chipregs = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/chipregs"; - open (STDERR, "| logger -t $program -p kern.info") || die; - main::debug "Non Interactive startup"; -} - -sub set_output() { - my $output; - - if($opts{o}) { - $output = $opts{o}; - } else { - # No subunits in FXS (everything is subunit 0) - $output = $chipregs; - } - open(REG, ">$output") || die "Failed to open '$output': $!\n"; - my $oldfh = select REG; - main::logit "# Setting output" if $opts{o}; - return $oldfh; -} - -package FXO; - -sub gen { - my $fmt = shift; - $| = 1; - printf "$fmt\n", @_; -} - -my $OPERMODE = 'FCC'; - -sub turn_off_leds() { - # Turning off red LEDs - # Warning: do not send WD 31 20 A0 ! - foreach my $i (0..7) { - FXO::gen "$i WD 20 A0"; - } -} - -# This data is manually taken from utils/init_fxo_modes which is generated -# during build. -# Running this script with a single 'verify' argument, during build, -# compare this data to a (possibly updated) utils/init_fxo_modes file. -my $OPERMODE_DATA = " -FCC reg16=01 reg26=C0 reg30=00 reg31=20 -TBR21 reg16=00 reg26=C2 reg30=02 reg31=20 ring_osc=7E6C ring_x=023A -ARGENTINA reg16=00 reg26=C0 reg30=00 reg31=20 -AUSTRALIA reg16=40 reg26=30 reg30=03 reg31=20 -AUSTRIA reg16=00 reg26=C2 reg30=03 reg31=28 -BAHRAIN reg16=00 reg26=C2 reg30=02 reg31=20 -BELGIUM reg16=00 reg26=C2 reg30=02 reg31=28 -BRAZIL reg16=00 reg26=30 reg30=00 reg31=20 -BULGARIA reg16=00 reg26=C2 reg30=03 reg31=20 -CANADA reg16=00 reg26=C0 reg30=00 reg31=20 -CHILE reg16=00 reg26=C0 reg30=00 reg31=20 -CHINA reg16=00 reg26=30 reg30=0F reg31=20 -COLOMBIA reg16=00 reg26=C0 reg30=00 reg31=20 -CROATIA reg16=00 reg26=C2 reg30=02 reg31=20 -CYPRUS reg16=00 reg26=C2 reg30=02 reg31=20 -CZECH reg16=00 reg26=C2 reg30=02 reg31=20 -DENMARK reg16=00 reg26=C2 reg30=02 reg31=28 -ECUADOR reg16=00 reg26=C0 reg30=00 reg31=20 -EGYPT reg16=00 reg26=30 reg30=00 reg31=20 -ELSALVADOR reg16=00 reg26=C0 reg30=00 reg31=20 -FINLAND reg16=00 reg26=C2 reg30=02 reg31=28 -FRANCE reg16=00 reg26=C2 reg30=02 reg31=28 -GERMANY reg16=00 reg26=C2 reg30=03 reg31=28 -GREECE reg16=00 reg26=C2 reg30=02 reg31=28 -GUAM reg16=00 reg26=C0 reg30=00 reg31=20 -HONGKONG reg16=00 reg26=C0 reg30=00 reg31=20 -HUNGARY reg16=00 reg26=C0 reg30=00 reg31=20 -ICELAND reg16=00 reg26=C2 reg30=02 reg31=28 -INDIA reg16=00 reg26=C0 reg30=04 reg31=20 -INDONESIA reg16=00 reg26=C0 reg30=00 reg31=20 -IRELAND reg16=00 reg26=C2 reg30=02 reg31=28 -ISRAEL reg16=00 reg26=C2 reg30=02 reg31=20 -ITALY reg16=00 reg26=C2 reg30=02 reg31=28 -JAPAN reg16=00 reg26=30 reg30=00 reg31=20 -JORDAN reg16=00 reg26=30 reg30=00 reg31=20 -KAZAKHSTAN reg16=00 reg26=C0 reg30=00 reg31=20 -KUWAIT reg16=00 reg26=C0 reg30=00 reg31=20 -LATVIA reg16=00 reg26=C2 reg30=02 reg31=20 -LEBANON reg16=00 reg26=C2 reg30=02 reg31=20 -LUXEMBOURG reg16=00 reg26=C2 reg30=02 reg31=28 -MACAO reg16=00 reg26=C0 reg30=00 reg31=20 -MALAYSIA reg16=00 reg26=30 reg30=00 reg31=20 -MALTA reg16=00 reg26=C2 reg30=02 reg31=20 -MEXICO reg16=00 reg26=C0 reg30=00 reg31=20 -MOROCCO reg16=00 reg26=C2 reg30=02 reg31=20 -NETHERLANDS reg16=00 reg26=C2 reg30=02 reg31=28 -NEWZEALAND reg16=00 reg26=C0 reg30=04 reg31=20 -NIGERIA reg16=00 reg26=C2 reg30=02 reg31=20 -NORWAY reg16=00 reg26=C2 reg30=02 reg31=28 -OMAN reg16=00 reg26=30 reg30=00 reg31=20 -PAKISTAN reg16=00 reg26=30 reg30=00 reg31=20 -PERU reg16=00 reg26=C0 reg30=00 reg31=20 -PHILIPPINES reg16=00 reg26=30 reg30=00 reg31=20 -POLAND reg16=03 reg26=C0 reg30=00 reg31=20 -PORTUGAL reg16=00 reg26=C2 reg30=02 reg31=28 -ROMANIA reg16=00 reg26=C0 reg30=00 reg31=20 -RUSSIA reg16=00 reg26=30 reg30=00 reg31=20 -SAUDIARABIA reg16=00 reg26=C0 reg30=00 reg31=20 -SINGAPORE reg16=00 reg26=C0 reg30=00 reg31=20 -SLOVAKIA reg16=00 reg26=C0 reg30=03 reg31=20 -SLOVENIA reg16=00 reg26=C0 reg30=02 reg31=20 -SOUTHAFRICA reg16=42 reg26=C0 reg30=03 reg31=20 -SOUTHKOREA reg16=00 reg26=C0 reg30=00 reg31=20 -SPAIN reg16=00 reg26=C2 reg30=02 reg31=28 -SWEDEN reg16=00 reg26=C2 reg30=02 reg31=28 -SWITZERLAND reg16=00 reg26=C2 reg30=02 reg31=28 -SYRIA reg16=00 reg26=30 reg30=00 reg31=20 -TAIWAN reg16=00 reg26=30 reg30=00 reg31=20 -THAILAND reg16=00 reg26=30 reg30=00 reg31=20 -UAE reg16=00 reg26=C0 reg30=00 reg31=20 -UK reg16=00 reg26=C2 reg30=05 reg31=28 -USA reg16=00 reg26=C0 reg30=00 reg31=20 -YEMEN reg16=00 reg26=C0 reg30=00 reg31=20 - "; - -my %opermode_table; - -sub opermode_setup() { - main::logit "Setting OPERMODE=$OPERMODE"; - # Several countries (South Africa, UAE, anybody else) - # require a shorter delay: - if($OPERMODE eq 'SOUTHAFRICA' or $OPERMODE eq 'UAE') { - FXO::gen "* WD 17 2B"; - } - # defaults, based on fxo_modes from wctdm.c . - # Decimal register numbers! - my %regs = ( - 16 => 0, - 26 => 0, - 30 => 0, - 31 => 0x20, - ); - my $mode = $opermode_table{$OPERMODE}; - if(defined $mode) { - foreach my $k (keys %regs) { - my $fullkey = "reg$k"; - $regs{$k} = $mode->{$fullkey}; - } - } - foreach my $k (keys %regs) { - # Our values are HEXADECIMAL without a 0x prefix!!! - my $cmd = sprintf "* WD %02X %02X", $k, hex($regs{$k}); - main::debug " regs: '$cmd'"; - FXO::gen "$cmd"; - } - main::debug "Finished Opermode"; -} - -sub parse_opermode_line($) { - my $line = shift or return(); - - chomp $line; - $line =~ s/#.*//; - my @params = split(/\s+/, $line); - my $location = shift @params; - my $entry = {}; - foreach my $p (@params) { - my ($key, $val) = split(/=/, $p, 2); - $entry->{$key} = $val; - } - return ($location, $entry); -} - -sub opermode_preprocess() { - undef %opermode_table; - foreach my $line (split(/\n/, $OPERMODE_DATA)) { - my ($location, $entry) = parse_opermode_line($line); - next unless defined $location; - #print "$location\t", ref($entry), "\n"; - die "An entry for '$location' already exists\n" - if exists $opermode_table{$location}; - $opermode_table{$location} = $entry; - } -} - -sub opermode_to_string($) { - my $mode = shift or die; - my @params; - - foreach my $k (sort keys %{$mode}) { - push(@params, "$k=$mode->{$k}"); - } - return join(" ", @params); -} - -sub opermode_verify($) { - my $input = shift or die; - my %verification_table; - my %location_lines; - my $mismatches = 0; - - open(F, $input) or die "$0: Failed opening '$input': $!\n"; - while() { - chomp; - #print "$_\n"; - s/#.*//; - my @params = split; - my $location = shift @params; - foreach my $p (@params) { - my ($key, $val) = split(/=/, $p, 2); - $verification_table{$location}{$key} = $val; - } - $location_lines{$location} = $.; - } - close F; - # First test: check for missing data in our program - foreach my $location (sort keys %verification_table) { - my $mode = $opermode_table{$location}; - if(! defined $mode) { - printf STDERR "Missing from $0: '$location' at $input:$location_lines{$location}\n"; - $mismatches++; - next; - } - my $verify_mode = $verification_table{$location}; - my $str1 = opermode_to_string($mode); - my $str2 = opermode_to_string($verify_mode); - if($str1 ne $str2) { - print STDERR "DIFF: '$location' at $input:$location_lines{$location}\n"; - printf STDERR "\t%-20s: %s\n", "program", $str1; - printf STDERR "\t%-20s: %s\n", "verify", $str2; - $mismatches++; - } - } - # Second test: check for extra data in our program - foreach my $location (sort keys %opermode_table) { - my $mode = $verification_table{$location}; - if(! defined $mode) { - printf STDERR "Extra in $0 '$location'\n"; - $mismatches++; - next; - } - } - print STDERR "Total $mismatches mismatches\n" if $mismatches; - return $mismatches; -} - -sub read_defaults() { - # For lab tests - my $labfile = "$init_dir/genzaptelconf.env"; - - # Source default files - $ENV{ZAPTEL_DEFAULTS} = "$labfile" if -r "$labfile"; - my $var_debug = 'DEBUG_INIT_FXO'; - my $var_opermode = 'opermode'; - my ($default_file, %source_defaults) = - Zaptel::Config::Defaults::source_vars($var_debug, $var_opermode); - $debug = $source_defaults{$var_debug}; - my $tmp_opermode = $source_defaults{$var_opermode}; - if(defined($tmp_opermode) and $tmp_opermode) { - # Verify - my $mode = $opermode_table{$tmp_opermode}; - if(! defined $mode) { - main::logit "Unknown opermode='$tmp_opermode'"; - die; - } - $OPERMODE = $tmp_opermode; - } - main::logit "From $default_file: $var_debug=$debug $var_opermode=$tmp_opermode"; -} - -package main; - -FXO::opermode_preprocess; # Must be first - -if($opts{v}) { - my $verify_file = $opts{v}; - die "Usage: $0 [-v verify_filename]\n" unless $verify_file; - main::debug "$0: opermode verification (input='$verify_file')"; - my $mismatches = FXO::opermode_verify($verify_file); - die "$0: Verification against $verify_file failed\n" if $mismatches != 0; - exit 0; -} - -main::logit "Starting"; - -FXO::read_defaults; -die "OPERMODE is undefined" unless $OPERMODE; -set_output; -FXO::turn_off_leds; -while() { - chomp; - s/[#;].*$//; # remove comments - s/^\s+//; # trim whitespace - s/\s+$//; # trim whitespace - s/\t+/ /g; # replace tabs with spaces (for logs) - next unless /\S/; # Skip empty lines - main::debug "writing: '$_'"; - FXO::gen "$_"; -} -FXO::opermode_setup; -close REG; - -main::logit "Ending '$0'"; -close STDERR; -exit 0; - -__DATA__ -* WD 21 28 -* WD 18 99 -* WD 06 00 - -# ----------- DAA PCM start offset ---------- - -0 WD 22 00 -0 WD 23 00 -0 WD 24 00 -0 WD 25 00 - -1 WD 22 08 -1 WD 23 00 -1 WD 24 08 -1 WD 25 00 - -2 WD 22 10 -2 WD 23 00 -2 WD 24 10 -2 WD 25 00 - -3 WD 22 18 -3 WD 23 00 -3 WD 24 18 -3 WD 25 00 - -4 WD 22 20 -4 WD 23 00 -4 WD 24 20 -4 WD 25 00 - -5 WD 22 28 -5 WD 23 00 -5 WD 24 28 -5 WD 25 00 - -6 WD 22 30 -6 WD 23 00 -6 WD 24 30 -6 WD 25 00 - -7 WD 22 38 -7 WD 23 00 -7 WD 24 38 -7 WD 25 00 - -# ----------- DAA ONHOOK -------------------- -* WD 05 00 - -# Set tip to ring voltage to 3.5 volts while off-hook -# instead of default of 3.1 -* WD 1A C0 diff --git a/zaptel/kernel/xpp/init_card_3_30 b/zaptel/kernel/xpp/init_card_3_30 deleted file mode 100755 index 66fd68f1..00000000 --- a/zaptel/kernel/xpp/init_card_3_30 +++ /dev/null @@ -1,432 +0,0 @@ -#! /usr/bin/perl -w -use strict; - -# -# $Id: init_card_3_30 4531 2008-09-09 17:13:27Z tzafrir $ -# - -# -# Written by Oron Peled -# Copyright (C) 2006, Xorcom -# -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# See the file LICENSE in the top level of this tarball. -# - -# This script is run from the xpp kernel module upon detection -# of a new XPD. -# -# Expects the following environment variables to be set: -# XBUS_NAME - bus name -# UNIT_NUMBER - xpd unit number -# UNIT_SUBUNITS - number of subunits in this xpd -# UNIT_TYPE - xpd type number (from protocol reply): -# 1 - FXS -# 2 - FXO -# 3 - BRI -# 4 - PRI -# XBUS_REVISION - xbus revision number -# XBUS_CONNECTOR - xbus connector string -# -# Output data format: -# - An optional comment start with ';' or '#' until the end of line -# - Optional Blank lines are ignored -# - Fields are whitespace separated (spaces or tabs) -# -# The fields are (in command line order): -# 1. CHIP select in decimal (ignored, taken from 3 LSB's of subunit number) -# 2. Command word: -# - RD Read Direct register. -# - RS Read Sub-register. -# - WD Write Direct register. -# - WS Write Sub-register. -# 3. Register number in hexadecimal. -# 4. Subregister number in hexadecimal. (for RS and WS commands). -# 5. Data byte in hexadecimal. (for WD and WS commands only). -# - -package main; -use File::Basename; -use Getopt::Std; - -my $program = basename("$0"); -my $init_dir = dirname("$0"); -my $unit_id; -my %opts; -$ENV{XPP_BASE} = '/proc/xpp'; - -getopts('o:', \%opts); - -sub logit { - print STDERR "$unit_id: @_\n"; -} - -# Arrange for error logging -if (-t STDERR) { - $unit_id = 'Interactive'; - logit "Interactive startup"; -} else { - $unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}"; - open (STDERR, "| logger -t $program -p kern.info") || die; - logit "Non Interactive startup"; -} - -sub select_subunit($) { - my $subunit = shift; - die unless defined $subunit; - my $output; - - if($opts{o}) { - $output = $opts{o}; - } else { - my $xpd_name = sprintf("XPD-%1d%1d", $ENV{UNIT_NUMBER}, $subunit); - $output = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/chipregs"; - } - open(REG, ">$output") || die "Failed to open '$output': $!\n"; - my $oldfh = select REG; - print "# Selecting subunit $subunit\n" if $opts{o}; - return $oldfh; -} - -package BRI; - -sub gen { - my $fmt = shift; - $| = 1; - printf "$fmt\n", @_; -} - -# Turning on/off multi-byte packet reception. -sub multibyte($) { - my $active = (shift) ? 'M' : 'm'; - for my $subunit (0 .. $ENV{UNIT_SUBUNITS} - 1) { - #main::logit "multibyte(): $subunit -> $active"; - main::select_subunit($subunit); - - BRI::gen "$subunit W$active"; - } -} - -package BRI::Port; - -sub new { - my $pack = shift; - my $port = { @_ }; - bless $port, $pack; -} - -# zap_xhfc_su.c:995 -sub init_su { - my $port = shift; - my $portnum = $port->{PORT_NUM}; - my $port_mode_up = $port->{PORT_MODE_UP}; - my $port_mode_exch = $port->{PORT_MODE_EXCH}; - my $bri_nt = $port->{BRI_NT}; - #main::logit "init_su(portnum=$portnum, port_mode_up=$port_mode_up, bri_nt=$bri_nt)"; - - # Setting PLL - # R_PLL_CTRL = 0 (V_PLL_M = 0, Reset PLL, Disable PLL_ - # R_CLK_CFG = 05 (PLL clock as system clock, output it to CLK_OUT pin) - # R_PLL_P = 1 - # R_PLL_N = 6 - # R_PLL_S = 1 - # R_PLL_CTRL = 1 (V_PLL_M) - - BRI::gen "#--------------------------- init_su($portnum, $bri_nt, $port_mode_up, $port_mode_exch)"; - BRI::gen "$portnum WD 02 04"; - BRI::gen "$portnum WD 50 00"; # disable PLL - BRI::gen "$portnum WD 51 02"; - BRI::gen "$portnum WD 52 06"; - BRI::gen "$portnum WD 53 04"; - BRI::gen "$portnum WD 50 01"; # Enable PLL - BRI::gen "$portnum WD 02 05"; # Enable PLL - - su_sel($portnum); # select port - if ("$port_mode_up" == 1) { - $port->{CTRL3} = 0x01; # A_ST_CTRL3: V_ST_SEL = 1 - $port->{CTRL0} = 0x10; # A_SU_CTRL0: V_ST_SQ_EN = 1 - BRI::gen "$portnum WD 34 0F"; # A_MS_TX: - # (multiframe/superframe transmit register) - } else { - $port->{CTRL3} = 0x00; # A_ST_CTRL3: V_ST_SEL = 0 - $port->{CTRL0} = 0x00; # A_SU_CTRL0: V_ST_SQ_EN = 0 - } - if ("$bri_nt" == 1) { - $port->{CTRL0} |= 0x04; # V_SU_MD - } - # ((V_SU_EXCH)?0x80:00) (change polarity) - if($port_mode_exch) { - $port->{CTRL2} = 0x80; - } else { - $port->{CTRL2} = 0x00; - } - BRI::gen "$portnum WD 35 %02X", $port->{CTRL3}; # A_ST_CTRL3 - BRI::gen "$portnum WD 31 %02X", $port->{CTRL0}; # A_SU_CTRL0 - BRI::gen "$portnum WD 35 F8"; # A_ST_CTRL3 = set end of pulse control to 0xF8 - BRI::gen "$portnum WD 32 09"; # A_SU_CTRL1 = Ignore E-channel data, Force automatic transition from G2 to G3 - BRI::gen "$portnum WD 33 %02X", $port->{CTRL2}; # A_SU_CTRL2 - - # zap_xhfc_su.c:1030 in init_su() - # A_SU_CLK_DLY - my $clk_dly; - if ("$bri_nt" == 1) { - $clk_dly = 0x6C; - } else { - $clk_dly = 0x0E; - } - #main::logit "clk_dly=$clk_dly"; - BRI::gen "$portnum WD 37 %02X", "$clk_dly"; -} - -sub su_sel { - if (@_ != 1 ) { - main::logit "ERROR: su_sel() called with " . scalar(@_) . " parameters"; - exit 1; - } - my $portnum = shift; - BRI::gen "$portnum WD 16 %02X", $portnum; # R_SU_SEL -} - -# zap_xhfc_su.c:281 -sub xhfc_selfifo { - my $port = shift; - my $portnum = $port->{PORT_NUM}; - - if (@_ != 1 ) { - main::logit "ERROR: xhfc_selfifo() called with " . scalar(@_) . " parameters"; - exit 1; - } - my $fifonum = shift; - #main::logit "xhfc_selfifo($fifonum)"; - BRI::gen "$portnum WD 0F %02X", $fifonum; - # --> WAIT UNTIL (R_STATUS & M_BUSY) == 0 -} - -# zap_xhfc_su.c:295 -sub xhfc_resetfifo() { - my $port = shift; - my $portnum = $port->{PORT_NUM}; - - #main::logit "xhfc_resetfifo()"; - # A_INC_RES_FIFO = M_RES_FIFO | M_RES_FIFO_ERR - BRI::gen "$portnum WD 0E 0A"; - # --> WAIT UNTIL (R_STATUS & M_BUSY) == 0 -} - -# zap_xhfc_su.c:1040 -# Initialize fifo (called for each portnum, channel, direction) -sub setup_fifo { - my $port = shift; - my $chan = shift; - my $direction = shift; - my $conhdlc = shift; - my $subcfg = shift; - my $fifoctrl = shift; - my $portnum = $port->{PORT_NUM}; - my $port_mode_up = $port->{PORT_MODE_UP}; - my $port_mode_exch = $port->{PORT_MODE_EXCH}; - my $bri_nt = $port->{BRI_NT}; - - BRI::gen "#--------------------------- setup_fifo($portnum, $chan, $direction)"; - # my $fifonum = 0x80 | ($portnum << 3) | ($chan << 1) | ($direction); # # MSB first - my $fifonum = ($portnum << 3) | ($chan << 1) | ($direction); # # MSB first - my $r_slot = ($portnum << 3) | ($chan << 1) | ($direction); - - # channel order workaround, swap odd and even portnums in $r_slot for PCM (chan 0, 1) only - if ("$chan" == 0 || "$chan" == 1) { - $r_slot = $r_slot ^ 0x08; - } - - my $short_portnum = $portnum & 0x03; - my $a_sl_cfg = (0x80 | ($short_portnum << 3) | ($chan << 1) | ($direction)); # receive data from STIO2, transmit to STIO1 - - #main::logit "setup_fifo($fifonum)"; - $port->xhfc_selfifo($fifonum); - # A_CON_HDLC: transparent mode selection - BRI::gen "$portnum WD FA %02X", $conhdlc; - # A_SUBCH_CFG: subchnl params - BRI::gen "$portnum WD FB %02X", $subcfg; - # A_FIFO_CTRL: FIFO Control Register - BRI::gen "$portnum WD FF %02X", $fifoctrl; - $port->xhfc_resetfifo(); - $port->xhfc_selfifo($fifonum); # wait for busy is builtin in this command - BRI::gen "$portnum WD 10 %02X", $r_slot; # R_SLOT - BRI::gen "$portnum WD D0 %02X", $a_sl_cfg; # A_SL_CFG - - #system("/bin/echo \"----=====TE\" \"short_portnum=\"$short_portnum \"portnum=\" $portnum \"chan=\" $chan\"======----\n\" >>/root/xortel/test_init"); -} - -# zap_xhfc_su.c:1071 -sub setup_su { - my $port = shift; - my $bchan = shift; - my $portnum = $port->{PORT_NUM}; - my $port_mode_exch = $port->{PORT_MODE_EXCH}; - my $bri_nt = $port->{BRI_NT}; - - BRI::gen "#--------------------------- setup_su($portnum, $bchan)"; - #main::logit "setup_su(portnum=$portnum, bchan=$bchan, port_mode_exch=$port_mode_exch, bri_nt=$bri_nt)"; - $port->{CTRL0} |= (1 << $bchan) | $bri_nt; - $port->{CTRL2} |= ($port_mode_exch << 7) | (1 << $bchan); - su_sel($portnum); # Select port - BRI::gen "$portnum WD 31 %02X", $port->{CTRL0}; # A_SU_CTRL0: V_B1_TX_EN | V_SU_MD | (NT/TE) - BRI::gen "$portnum WD 33 %02X", $port->{CTRL2}; # A_SU_CTRL2: V_B1_RX_EN -} - -sub xhfc_ph_command { - my $port = shift; - my $cmd = shift; - my $portnum = $port->{PORT_NUM}; - #main::logit "xhfc_ph_command(portnum=$portnum)"; - if ("$cmd" eq "HFC_L1_ACTIVATE_TE") { - su_sel($portnum); # Select port - BRI::gen "$portnum WD 30 60"; # A_SU_WR_STA = (M_SU_ACT & 0x03) - # (set activation) - } elsif ("$cmd" eq "HFC_L1_FORCE_DEACTIVATE_TE") { - su_sel($portnum); # Select port - BRI::gen "$portnum WD 30 40"; # A_SU_WR_STA = (M_SU_ACT & 0x02) - # (set deactivation) - } elsif ("$cmd" eq "HFC_L1_ACTIVATE_NT") { - su_sel($portnum); # Select port - BRI::gen "$portnum WD 30 E0"; # A_SU_WR_STA = (M_SU_ACT & 0x03) | 0x80 - # (set activation + NT) - } elsif ("$cmd" eq "HFC_L1_DEACTIVATE_NT") { - su_sel($portnum); # Select port - BRI::gen "$portnum WD 30 40"; # A_SU_WR_STA = (M_SU_ACT & 0x02) - # (set deactivation) - } -} - - -sub zthfc_startup { - my $port = shift; - my $portnum = $port->{PORT_NUM}; - my $port_mode_exch = $port->{PORT_MODE_EXCH}; - my $bri_nt = $port->{BRI_NT}; - #main::logit "zthfc_startup(portnum=$portnum, port_mode_exch=$port_mode_exch, bri_nt=$bri_nt)"; - - # PCM <-> ST/Up Configuration - foreach my $chan ( 0, 1 ) { - $port->setup_fifo($chan, 0, 0xFE, 0, 0);# Transparent mode, FIFO EN, ST->PCM - $port->setup_fifo($chan, 1, 0xFE, 0, 0);# Transparent mode, FIFO EN, ST->PCM - $port->setup_su($chan); # zap_xhfc_su.c:194 - } - - # Zaptel chan 2 used as HDLC D-Channel - $port->setup_fifo(2, 0, 0x05, 2, 0); # D-TX: zap_xhfc_su.c:205 - $port->setup_fifo(2, 1, 0x05, 2, 0); # D-RX: zap_xhfc_su.c:206 - # E-chan, Echo channel is ignored - - - # enable this port's state machine - su_sel($portnum); # Select port - # A_SU_WR_STA: reset port state machine - BRI::gen "$portnum WD 30 00"; - if ("$bri_nt" == 0) { - $port->xhfc_ph_command("HFC_L1_ACTIVATE_TE"); - } else { - $port->xhfc_ph_command("HFC_L1_ACTIVATE_NT"); - } -} - -package main; - -logit "Starting '$0'"; - -#------------------------------------------- Instance detection - -# zap_xhfc_su.c:895 -sub init_xhfc($) { - my $portnum = shift; - main::logit "init_xhfc($portnum)"; - BRI::gen "#--------------------------- init_xhfc"; - BRI::gen "$portnum WD 0D 00"; # r_FIFO_MD: 16 fifos, - # 64 bytes for TX and RX each (FIFO mode config) - - # software reset to enable R_FIFO_MD setting - BRI::gen "$portnum WD 00 08"; # R_CIRM = M_SRES (soft reset) - # --> WAIT 5u - BRI::gen "$portnum WD 00 00"; # R_CIRM = 0 (zero it to deactivate reset) - - # amplitude - BRI::gen "$portnum WD 46 80"; # R_PWM_MD: (PWM output mode register) - # PWM push to zero only - BRI::gen "$portnum WD 39 18"; # R_PWM1: (modulator register for PWM1) - # set duty cycle - - BRI::gen "$portnum WD 0C 11"; # R_FIFO_THRES: (FIFO fill lvl control register) - # RX/TX threshold = 16 bytes - - # set PCM bus mode to slave by default - BRI::gen "$portnum WD 14 08"; # R_PCM_MD0 = PCM slave mode, F0IO duration is 2 HFC_PCLK's - # (C4IO, F0IO are inputs) - - BRI::gen "$portnum WD 14 98"; # R_PCM_MD0: Index value to select - # the register at address 15 - BRI::gen "$portnum WD 15 20"; # R_PCM_MD1: V_PLL_ADJ (DPLL adjust speed), - # in the last slot of PCM frame - # V_PCM_DR, C4IO is 16.384MHz(128 time slots) - - BRI::gen "$portnum WD 4C 03"; # GPIOGPIO function (not PWM) on GPIO0 and GPIO1 pins - BRI::gen "$portnum WD 4A 03"; # Output enable for GPIO0 and GPIO1 pins -} - -my @port_type = ( - { 'BRI_NT' => 1 }, - { 'BRI_NT' => 0 } - ); - -# zap_xhfc_su.c:175 -sub main() { - my $subunit; - my $subunits_mask = pack("C", $ENV{UNIT_SUBUNITS_DIR}); - my @direction = split(//, unpack("b*", $subunits_mask)); - - #logit "main(): UNIT_TYPE=$ENV{UNIT_TYPE} UNIT_SUBUNITS_DIR=[@direction]"; - if(!$opts{o}) { - foreach my $var (qw(XBUS_NAME UNIT_NUMBER UNIT_TYPE UNIT_SUBUNITS UNIT_SUBUNITS_DIR XBUS_REVISION XBUS_CONNECTOR)) { - die "Missing mandatory '$var' environment variable" unless defined $var; - } - } - # Turn off multi-byte packet reception before initialization started - # Otherwise we mess with registers while the FPGA firmware tries to - # send us packets. - BRI::multibyte(0); - - # Port initialization - for($subunit = 0; $subunit < $ENV{UNIT_SUBUNITS}; $subunit++) { - my $is_nt = $direction[$subunit]; - - main::select_subunit($subunit); - if(($subunit % 4) == 0) { # A new xhfc chip - #logit "main(): Initializing chip"; - init_xhfc($subunit); # zap_xhfc_su.c:1173 in setup_instance() - } - #logit "main(): Initializing subunit $subunit is_nt=$is_nt"; - my $p = BRI::Port->new( - 'PORT_NUM' => $subunit, - 'BRI_NT' => $is_nt, - 'PORT_MODE_UP' => 0, - 'PORT_MODE_EXCH' => 0 - ); - # zap_XHfc_su.c:1186 in setup_instance() - $p->init_su; - $p->zthfc_startup; - } - # Turn on multi-byte packet reception when ports initialization finished - BRI::multibyte(1); -} - -main; - -logit "Ending '$0'"; - -close REG; -close STDERR; -exit 0; diff --git a/zaptel/kernel/xpp/init_card_4_30 b/zaptel/kernel/xpp/init_card_4_30 deleted file mode 100755 index 4636cd58..00000000 --- a/zaptel/kernel/xpp/init_card_4_30 +++ /dev/null @@ -1,387 +0,0 @@ -#! /usr/bin/perl -w -use strict; - -# -# $Id: init_card_4_30 4305 2008-05-19 12:42:19Z tzafrir $ -# - -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# See the file LICENSE in the top level of this tarball. -# - -# This script is run from the xpp kernel module upon detection -# of a new XPD. -# -# Expects the following environment variables to be set: -# XBUS_NAME - bus name -# UNIT_NUMBER - xpd unit number -# UNIT_SUBUNITS - number of subunits in this xpd -# UNIT_TYPE - xpd type number (from protocol reply): -# 1 - FXS -# 2 - FXO -# 3 - BRI -# 4 - PRI -# XBUS_REVISION - xbus revision number -# XBUS_CONNECTOR - xbus connector string -# -# Output data format: -# - An optional comment start with ';' or '#' until the end of line -# - Optional Blank lines are ignored -# - Fields are whitespace separated (spaces or tabs) -# -# The fields are (in command line order): -# 1. CHIP select in decimal (ignored, taken from 3 LSB's of subunit number) -# 2. Command word: -# - RD Read Direct register. -# - WD Write Direct register. -# 3. Register number in hexadecimal. -# 5. Data byte in hexadecimal. (for WD command only). -# - -package main; -use File::Basename; -use Getopt::Std; - -my $program = basename("$0"); -my $init_dir = dirname("$0"); -my $unit_id; -my %opts; -$ENV{XPP_BASE} = '/proc/xpp'; -my @pri_specs; - -getopts('o:', \%opts); - -sub logit { - print STDERR "$unit_id: @_\n"; -} - -# Arrange for error logging -if (-t STDERR) { - $unit_id = 'Interactive'; - logit "Interactive startup"; -} else { - $unit_id = "$ENV{XBUS_NAME}/UNIT-$ENV{UNIT_NUMBER}"; - open (STDERR, "| logger -t $program -p kern.info") || die; - logit "Non Interactive startup"; -} - -sub select_subunit($) { - my $subunit = shift; - die unless defined $subunit; - my $output; - - if($opts{o}) { - $output = $opts{o}; - } else { - my $xpd_name = sprintf("XPD-%1d%1d", $ENV{UNIT_NUMBER}, $subunit); - $output = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/chipregs"; - } - open(REG, ">$output") || die "Failed to open '$output': $!\n"; - my $oldfh = select REG; - print "# Selecting subunit $subunit\n" if $opts{o}; - return $oldfh; -} - -package PRI; - -sub gen { - my $fmt = shift; - $| = 1; - printf "$fmt\n", @_; -} - -sub init_quad() { - main::select_subunit(0); - # Tuning of clocking unit to the 16.384 MHz reference frequence - # by setting Global Clock Mode registers (GCM[1:8]), same for E1 and T1/J1 - PRI::gen "0 WD 92 00"; # GCM1 - PRI::gen "0 WD 93 18"; # GCM2 - PRI::gen "0 WD 94 FB"; # GCM3 - PRI::gen "0 WD 95 0B"; # GCM4 - PRI::gen "0 WD 96 01"; # GCM5 - PRI::gen "0 WD 97 0B"; # GCM6 - PRI::gen "0 WD 98 DB"; # GCM7 - PRI::gen "0 WD 99 DF"; # GCM8 -} - -sub finish_quad() { - PRI::gen "0 WD BB FF"; # REGFP - PRI::gen "0 WD BC AC"; # REGFD - PRI::gen "0 WD BB 2B"; # REGFP - PRI::gen "0 WD BC 00"; # REGFD - PRI::gen "0 WD BB AB"; # REGFP - PRI::gen "0 WD BC 2A"; # REGFD - PRI::gen "0 WD BB FF"; # REGFP - PRI::gen "0 WD BC AA"; # REGFD - PRI::gen "0 WD BB 29"; # REGFP - PRI::gen "0 WD BC FF"; # REGFD - PRI::gen "0 WD BB A9"; # REGFP - PRI::gen "0 WD BC 28"; # REGFD - PRI::gen "0 WD BB 00"; # REGFP - PRI::gen "0 WD BC A8"; # REGFD - PRI::gen "0 WD BB 27"; # REGFP - PRI::gen "0 WD BC FF"; # REGFD - PRI::gen "0 WD BB A7"; # REGFP - PRI::gen "0 WD BC 00"; # REGFD - -# PRI::gen "0 WD 80 00"; # PC1 (Port configuration 1): RPB_1.SYPR , XPB_1.SYPX - PRI::gen "0 WD 81 0B"; # PC2 (Port configuration 2): RPB_1.GPOH (ResetID ), XPB_1.GPOL (MUX_SEL0) - PRI::gen "0 WD 82 9B"; # PC3 (Port configuration 3): RPC_1.GPI (nConfig0), XPC_1.GPOL (MUX_SEL1) - PRI::gen "0 WD 83 9B"; # PC4 (Port configuration 4): RPD_1.GPI (nConfig1), XPD_1.GPOL (MUX_SEL2) -} - -sub read_pri_specs() { - # For lab tests - my $labfile = "${0}.setup"; - - # Source default files - $ENV{ZAPTEL_DEFAULTS} = "$labfile" if -r "$labfile"; - my $setup_var = 'XPP_PRI_SETUP'; - my $setup_string; - my ($default_file, %source_defaults) = - Zaptel::Config::Defaults::source_vars($setup_var); - $setup_string = $source_defaults{$setup_var}; - $setup_string =~ s/^\s+//; # trim - $setup_string =~ s/\s+$//; # trim - $setup_string =~ s/\s+/\n/g; # cannonical spaces - #main::logit "From $default_file: $setup_var=\n$setup_string"; - @pri_specs = split(/\s+/, $setup_string); - push(@pri_specs, 'NUM/*=TE,E1'); # Fall back default (last) - main::logit "pri_specs: @pri_specs"; -} - -package PRI::Port; - -sub new { - my $pack = shift; - my $port = { @_ }; - bless $port, $pack; - $port->process_pri_spec; - return $port; -} - -sub write_pri_info { - my $port = shift; - my $subunit = $port->{PORT_NUM}; - my @pri_setup = @{$port->{PRI_SETUP}}; - my $pri_type = $pri_setup[0] || die "Missing pri_type parameter"; - my $pri_proto = $pri_setup[1] || die "Missing pri_proto parameter"; - my $xpd_name = "XPD-$ENV{UNIT_NUMBER}$subunit"; - my $info = "$ENV{XPP_BASE}/$ENV{XBUS_NAME}/$xpd_name/pri_info"; - - main::logit "$xpd_name: PRI_SETUP $pri_type $pri_proto"; - open(INFO, ">$info") || die "Failed to open '$info': $!\n"; - print INFO "$pri_type $pri_proto\n" || die "Failed writing to '$info': $!\n"; - close INFO || die "Failed during close of '$info': $!\n"; -} - -sub process_pri_spec($) { - my $port = shift; - my $subunit = $port->{PORT_NUM}; - my $xpd_name = "XPD-$ENV{UNIT_NUMBER}$subunit"; - my $match; - my $setup; - my @pri_setup; -SPEC: - for(my $i = 0; $i < @pri_specs; $i++) { - my $spec = $pri_specs[$i]; - ($match, $setup) = split(/=/, $spec); - next unless defined $match and defined $setup; - # Convert "globs" to regex - $match =~ s/\*/.*/g; - $match =~ s/\?/./g; - #logit "match: $match"; - my @patlist = ( - "CONNECTOR/$ENV{XBUS_CONNECTOR}/$xpd_name", - "NUM/$ENV{XBUS_NAME}/$xpd_name" - ); - foreach my $pattern (@patlist) { - #logit "testmatch: $pattern =~ $match"; - if($pattern =~ $match) { - main::logit "$xpd_name: MATCH '$pattern' ~ '$match' setup=$setup"; - last SPEC; - } - } - } - die "No setup matching $ENV{XBUS_NAME}/$xpd_name\n" unless defined $setup; - @pri_setup = split(/,/, $setup); - die "Bad setup string '$setup'\n" unless @pri_setup; - $port->{'PRI_SETUP'} = \@pri_setup; -} - -sub port_setup($) { - my $port = shift; - my $portno = $port->{PORT_NUM}; - - # only one of the following loopbacks can be activated in the same time - my $LIM1_RL = 0 << 1; # RL (Remote Loopback) - my $lim1 = 0xB0 | $LIM1_RL; - - PRI::gen "$portno WD 26 F6"; # XPM0: Pulse Shape Programming for R1=18Ohms - PRI::gen "$portno WD 27 02"; # XPM1: ...3V Pulse Level at the line (Vp-p=6v) - PRI::gen "$portno WD 28 00"; # XPM2: ~XLT (transmit line is not in the high impedance state) - - # if (unchannelized) - #PRI::gen "$portno WD 1F 22"; # LOOP (Channel Looback): - # ECLB (Enable Channel Loop-Back) - # CLA (Channel Address) - PRI::gen "$portno WD 2B EF"; # IDL (Idle): - # If channel loopback is enabled than transmit this code on the outgoing - PRI::gen "$portno WD 1F 00"; # LOOP (Channel Looback): - #if($portno eq 0){ - # PRI::gen "0 WD 1F 00"; # LOOP (Channel Looback): - # # channels (XL1/XL2) - #}else { - # PRI::gen "0 WD 1F 20"; # LOOP (Channel Looback): - #} - - PRI::gen "$portno WD 37 %02X", $lim1; - # LIM1: ~RL (Remote Loop bit 0x02), - # ~DRS (Dual Rail Select, latch receive data while trasmit), - # RIL1, RIL0 (Receive Input Treshold 0.62 V), - # CLOS (Clear data in case of LOS) - PRI::gen "$portno WD 3A 20"; # LIM2: SLT1, SLT0 = 01 - # (Receiver Slicer Threshold, the receive slicer - # generates a mark (digital one) if the voltage at - # RL1/2 exceeds 50% of the peak amplitude, - # default, recommended in E1 mode). - - PRI::gen "$portno WD 38 0A"; # PCD: (Pulse Count Detection, LOS Detection after 176 consecutive 0s) - PRI::gen "$portno WD 39 15"; # PCR: (Pulse Count Recovery, LOS Recovery after 22 ones in PCD interval) - - # Configure system interface - PRI::gen "$portno WD 3E C2"; # SIC1: SSC1 (System clock ) is 8.192 Mhz, - # SSD1 (System Data rate) is 8.192 Mbit/s, - # ~BIM (Byte interleaved mode), - # XBS (Transmit Buffer Size) is 2 frames - PRI::gen "$portno WD 40 04"; # SIC3: Edges for capture, Synchronous Pulse Receive @Rising Edge - PRI::gen "$portno WD 41 04"; # CMR4: RCLK is 8.192 MHz - PRI::gen "$portno WD 43 04"; # CMR5: TCLK is 8.192 MHz - PRI::gen "$portno WD 44 34"; # CMR6: Receive reference clock generated by channel 1, - # RCLK is at 8.192 Mhz dejittered, Clock recovered from the line - # TCLK is at 8.192 MHz is de-jittered by DCO-R to drive a6.176 MHz - # clock on RCLK.*/ - - PRI::gen "$portno WD 22 00"; # XC0: (Transmit Counter Offset = 497/T=2) - PRI::gen "$portno WD 23 04"; # XC1: - - PRI::gen "$portno WD 24 00"; # RC0: (Receive Counter Offset = 497/T=2) - PRI::gen "$portno WD 25 05"; # RC1: - - my $sic2 = sprintf("%x", 0x00 | ($portno << 1)); - - PRI::gen "$portno WD 3F $sic2"; # SIC2: No FFS, no center receive elastic buffer, data active at phase ($sic >> 1) - - # enable the following interrupt sources - PRI::gen "$portno WD 16 00"; # IMR2 (Interrupt Mask Register2): Enable ALL - - PRI::gen "$portno WD 17 3F"; # IMR3 ~ES, ~SEC (Enable ES and SEC interrupts) - PRI::gen "$portno WD 18 00"; # IMR4: Enable ALL - - PRI::gen "$portno WD 08 04"; # IPC: SYNC is 8 Khz - - PRI::gen "$portno WD 02 51"; # CMDR (Command Register): RRES, XRES, SRES (Receiver/Transmitter reset) - PRI::gen "$portno WD 02 00"; # CMDR - - - # Configure interrupts - PRI::gen "$portno WD 46 40"; # GCR: Interrupt on Activation/Deactivation of AIX, LOS - - PRI::gen "$portno WD 45 00"; # CMR2: External sources for SYPR, SCLKR, SYPX, SCLKX for TX and RX. - #PRI::gen "$portno WD 22 00"; # XC0: Normal operation of Sa-bits - #PRI::gen "$portno WD 23 04"; # XC1: X=4 => T=4-X=0 offset - #PRI::gen "$portno WD 24 00"; # RC0: 0 offset - #PRI::gen "$portno WD 25 00"; # RC1: Remaining part of RC0 - - # Configure ports - PRI::gen "$portno WD 85 80"; # GPC1 (Global Port Configuration 1): - #PRI::gen "$portno WD 85 00"; # GPC1 (Global Port Configuration 1): - # SMM (System Interface Multiplex Mode) - PRI::gen "$portno WD 80 00"; # PC1: SYPR/SYPX provided to RPA/XPA inputs - - PRI::gen "$portno WD 84 31"; # PC5: XMFS active low, SCLKR is input, RCLK is output (unused) - PRI::gen "$portno WD 86 03"; # PC6: CLK1 is Tx Clock output, CLK2 is 8.192 Mhz from DCO-R - PRI::gen "$portno WD 3B 00"; # Clear LCR1 - Loop Code Register 1 - - # printk("TE110P: Successfully initialized serial bus for card\n"); - - # Initialize PCM and SIG regs - PRI::gen "$portno WD A0 00"; # TSEO (Time Slot Even/Odd Select) - PRI::gen "$portno WD A1 FF"; # TSBS (Time Slot Bit Select)- only selected bits are used for HDLC channel 1 - # in selected time slots - PRI::gen "$portno WD 03 89"; # Mode Register: - # MDS (Mode Select) = 100 (No address comparison) - # HRAC (Receiver Active - HDLC channel 1) - # RFT2 (HDLC Receive FIFO is 64 byte deep) - PRI::gen "$portno WD 09 18"; # CCR1 (Common Configuration Register1) - # EITS (Enable Internal Time Slot 0 to 31 Signalling) - # ITF (Interframe Time Fill) - PRI::gen "$portno WD 0A 04"; # CCR2 (Common Configuration Register2) - # RCRC (enable CRC - HDLC channel 1enable CRC - HDLC channel 1) - PRI::gen "$portno WD 0C 00"; # RTR1 (Receive Time Slot register 1) - PRI::gen "$portno WD 0D 00"; # RTR2 (Receive Time Slot register 2) - PRI::gen "$portno WD 0E 00"; # RTR3 (Receive Time Slot register 3), TS16 (Enable time slot 16) - PRI::gen "$portno WD 0F 00"; # RTR4 (Receive Time Slot register 4) - - PRI::gen "$portno WD 10 00"; # TTR1 (Transmit Time Slot register 1) - PRI::gen "$portno WD 11 00"; # TTR2 (Transmit Time Slot register 2) - PRI::gen "$portno WD 12 00"; # TTR3 (Transmit Time Slot register 3), TS16 (Enable time slot 16) - PRI::gen "$portno WD 13 00"; # TTR4 (Transmit Time Slot register 4) - - # configure the best performance of the Bipolar Violation detection for all four channels - PRI::gen "$portno WD BD 00"; # BFR (Bugfix Register): ~BVP (Bipolar Violations), - # use Improved Bipolar Violation Detection instead -} - -package main; -BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } -use Zaptel::Config::Defaults; - -logit "Starting '$0'"; - -PRI::read_pri_specs; - -sub main() { - my @ports; - my $subunit; - - logit "main(): Initializing chip ($ENV{UNIT_SUBUNITS} ports)"; - PRI::init_quad; - # Must initialize all 4 ports, regardless how much there are - for($subunit = 0; $subunit < 4; $subunit++) { - my $is_nt = 0; - - #logit "main(): Initializing subunit $subunit is_nt=$is_nt"; - my $p = PRI::Port->new( - 'PORT_NUM' => $subunit, - 'PRI_NT' => $is_nt, - 'EXIST' => ($subunit < $ENV{UNIT_SUBUNITS}) - ); - $p->port_setup; - push(@ports, $p); - } - PRI::finish_quad; - foreach my $p (@ports) { - if($p->{EXIST}) { - $p->write_pri_info; - } - } -} - -main; - -logit "Ending '$0'"; - -close REG; -close STDERR; -exit 0; diff --git a/zaptel/kernel/xpp/param_doc b/zaptel/kernel/xpp/param_doc deleted file mode 100755 index 58487281..00000000 --- a/zaptel/kernel/xpp/param_doc +++ /dev/null @@ -1,40 +0,0 @@ -#! /usr/bin/perl -w -use strict; -# -# Extract parameter documentation from *.ko files. -# Assumes that parameter description include the default -# value in the format we use in our DEF_PARM() macro -# - -@ARGV || die "Usage: $0 module.ko....\n"; - -my $modinfo = '/sbin/modinfo'; -my @mod_params; - -foreach my $file (glob "@ARGV") { - undef @mod_params; - print "$file:\n"; - open(F, "$modinfo '$file' |") || die; - while() { - chomp; - next unless s/^parm:\s*//; - my ($name, $description) = split(/:/, $_, 2); - # Extract type - $description =~ s/\s*\(([^)]+)\)$//; - my $type = $1; - # Extract default value - $description =~ s/\s*\[default\s+([^]]+)\]$//; - my $default = $1; - push(@mod_params, { - NAME => $name, - TYPE => $type, - DEFVAL => $default, - DESC => $description, - }); - } - # Print sorted list - foreach my $p (sort { $a->{NAME} cmp $b->{NAME} } @mod_params) { - printf "\t%-8s %-22s = %-20s %s\n", $p->{TYPE}, $p->{NAME}, $p->{DEFVAL}, $p->{DESC}; - } - close F || die; -} diff --git a/zaptel/kernel/xpp/parport_debug.c b/zaptel/kernel/xpp/parport_debug.c deleted file mode 100644 index 93049ef8..00000000 --- a/zaptel/kernel/xpp/parport_debug.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2007, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif - -#include -#include -#include -#include "parport_debug.h" - -static struct parport *debug_sync_parport = NULL; -static int parport_toggles[8]; /* 8 bit flip-flop */ - -void flip_parport_bit(unsigned char bitnum) -{ - static unsigned char last_value; - spinlock_t lock = SPIN_LOCK_UNLOCKED; - unsigned long flags; - unsigned char mask; - unsigned char value; - - if(!debug_sync_parport) { - if(printk_ratelimit()) { - printk(KERN_NOTICE "%s: no debug parallel port\n", - THIS_MODULE->name); - } - return; - } - BUG_ON(bitnum > 7); - mask = 1 << bitnum; - spin_lock_irqsave(&lock, flags); - value = last_value & ~mask; - if(parport_toggles[bitnum] % 2) /* square wave */ - value |= mask; - last_value = value; - parport_toggles[bitnum]++; - spin_unlock_irqrestore(&lock, flags); - parport_write_data(debug_sync_parport, value); -} -EXPORT_SYMBOL(flip_parport_bit); - -static void parport_attach(struct parport *port) -{ - printk(KERN_INFO "%s: Using %s for debugging\n", THIS_MODULE->name, port->name); - if(debug_sync_parport) { - printk(KERN_ERR "%s: Using %s, ignore new attachment %s\n", - THIS_MODULE->name, debug_sync_parport->name, port->name); - return; - } - parport_get_port(port); - debug_sync_parport = port; -} - -static void parport_detach(struct parport *port) -{ - printk(KERN_INFO "%s: Releasing %s\n", THIS_MODULE->name, port->name); - if(debug_sync_parport != port) { - printk(KERN_ERR "%s: Using %s, ignore new detachment %s\n", - THIS_MODULE->name, debug_sync_parport->name, port->name); - return; - } - parport_put_port(debug_sync_parport); - debug_sync_parport = NULL; -} - -static struct parport_driver debug_parport_driver = { - .name = "parport_debug", - .attach = parport_attach, - .detach = parport_detach, -}; - -int __init parallel_dbg_init(void) -{ - int ret; - - ret = parport_register_driver(&debug_parport_driver); - return ret; -} - -void __exit parallel_dbg_cleanup(void) -{ - parport_unregister_driver(&debug_parport_driver); -} - -MODULE_DESCRIPTION("Use parallel port to debug drivers"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION("$Id:"); - -module_init(parallel_dbg_init); -module_exit(parallel_dbg_cleanup); diff --git a/zaptel/kernel/xpp/parport_debug.h b/zaptel/kernel/xpp/parport_debug.h deleted file mode 100644 index 138af994..00000000 --- a/zaptel/kernel/xpp/parport_debug.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef PARPORT_DEBUG_H -#define PARPORT_DEBUG_H -/* - * Written by Oron Peled - * Copyright (C) 2007, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifdef DEBUG_SYNC_PARPORT -void flip_parport_bit(unsigned char bitnum); -#else -#define flip_parport_bit(bitnum) -#endif - -#endif /* PARPORT_DEBUG_H */ diff --git a/zaptel/kernel/xpp/utils/Makefile b/zaptel/kernel/xpp/utils/Makefile deleted file mode 100644 index 2a121665..00000000 --- a/zaptel/kernel/xpp/utils/Makefile +++ /dev/null @@ -1,144 +0,0 @@ -PEDANTIC = -ansi -pedantic -std=c99 - -RANLIB = ranlib -INSTALL = install -INSTALL_DATA = install -m 644 - -# -# Ugly hack to find kernel directories before/after the split -# to kernel/user-space. -# -# These variables should be passed to us. But until then... -# -ZAPTEL_DIR ?= $(shell if [ -f "../../zaptel.h" ]; then echo "../.."; else echo "../../.."; fi) -ZAP_KERNEL ?= $(shell if [ -d "$(ZAPTEL_DIR)/kernel" ]; then echo "$(ZAPTEL_DIR)/kernel"; else echo "$(ZAPTEL_DIR)"; fi) - --include $(ZAPTEL_DIR)/makeopts - -INSTALL_DATA = $(INSTALL) -m 644 - -# In 1.4 those are provided by autoconf through makeopts -prefix ?= /usr -datadir ?= $(prefix)/share -mandir ?= $(datadir)/man -INSTALL ?= install - -INSTALL_DATA = $(INSTALL) -m 644 - -SBINDIR = $(prefix)/sbin -DATADIR = $(datadir)/zaptel -MANDIR = $(mandir)/man8 -HOTPLUG_USB_DIR = /etc/hotplug/usb -UDEV_RULES_DIR = /etc/udev/rules.d -PERLLIBDIR := $(shell eval `perl -V:sitelib`; echo "$$sitelib") -PERL_DIRS := $(shell cd zconf; find * -name '[A-Z]*' -type d| xargs) -PERL_MODS_PAT := *.pm $(PERL_DIRS:%=%/*.pm) -PERL_MODS := $(shell cd zconf; echo $(PERL_MODS_PAT)) - -XPD_FIRMWARE = $(wildcard ../firmwares/*.hex) -XPD_INIT_DATA = $(XPD_FIRMWARE) init_fxo_modes -XPD_INIT = $(wildcard ../init_card_?_*) xpp_fxloader - -# Variables that should be defined above, but need sane defaults: -# FIXME: Are those values really sane? -HOSTCC ?= $(CC) - -ifeq (,$(PBX_LIBUSB)) -# No PBX_LIBUSB? Maybe we compile against zaptel-1.2 -# Let's make a poor man detection of libusb -PBX_LIBUSB = $(shell if [ -r /usr/include/usb.h ]; then echo 1; else echo 0; fi) -endif - -WCTDM=$(shell for i in $(ZAP_KERNEL)/wctdm.c $(ZAP_KERNEL)/fxo_modes.h; do [ -f "$$i" ] && echo "$$i"; done) - -CFLAGS = -g -Wall $(EXTRA_CFLAGS) - -%.8: % - pod2man --section 8 $^ > $@ || $(RM) $@ -PERL_SCRIPTS = \ - zt_registration \ - xpp_sync \ - lszaptel \ - xpp_blink \ - zapconf \ - zaptel_hardware \ - # - -PERL_MANS = $(PERL_SCRIPTS:%=%.8) - -TARGETS = init_fxo_modes print_modes perlcheck -PROG_INSTALL = genzaptelconf -MAN_INSTALL = $(PROG_INSTALL:%=%.8) -ifeq (1,$(PBX_LIBUSB)) -TARGETS += libhexfile.a fpga_load test_parse -PROG_INSTALL += fpga_load -endif -ifneq (,$(PERLLIBDIR)) -PROG_INSTALL += $(PERL_SCRIPTS) -TARGETS += $(PERL_MANS) -endif - -all: $(TARGETS) - -docs: $(PERL_MANS) - -install: all - $(INSTALL) -d $(DESTDIR)$(SBINDIR) - $(INSTALL) $(PROG_INSTALL) $(DESTDIR)$(SBINDIR)/ - $(INSTALL) -d $(DESTDIR)$(DATADIR) - $(INSTALL_DATA) $(XPD_INIT_DATA) $(DESTDIR)$(DATADIR)/ - $(INSTALL) $(XPD_INIT) $(DESTDIR)$(DATADIR)/ - $(INSTALL) -d $(DESTDIR)$(MANDIR) - $(INSTALL_DATA) $(MAN_INSTALL) $(DESTDIR)$(MANDIR)/ - $(INSTALL) -d $(DESTDIR)$(HOTPLUG_USB_DIR) - $(INSTALL_DATA) xpp_fxloader.usermap $(DESTDIR)$(HOTPLUG_USB_DIR)/ - # for backward compatibility and for hotplug users: - ln -sf $(DATADIR)/xpp_fxloader $(DESTDIR)$(HOTPLUG_USB_DIR)/ - $(INSTALL) -d $(DESTDIR)$(UDEV_RULES_DIR) - $(INSTALL_DATA) xpp.rules $(DESTDIR)$(UDEV_RULES_DIR)/ -ifneq (,$(PERLLIBDIR)) - $(INSTALL) -d $(DESTDIR)$(PERLLIBDIR) - for i in $(PERL_DIRS); \ - do \ - $(INSTALL) -d "$(DESTDIR)$(PERLLIBDIR)/$$i"; \ - done - for i in $(PERL_MODS); \ - do \ - $(INSTALL_DATA) "zconf/$$i" "$(DESTDIR)$(PERLLIBDIR)/$$i"; \ - done -endif - -libhexfile.a: hexfile.o - $(AR) cru $@ $^ - $(RANLIB) $@ - -fpga_load: fpga_load.o libhexfile.a - $(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb - -fpga_load.o: CFLAGS+=-D_GNU_SOURCE # We use memrchr() - -hexfile.o: hexfile.c hexfile.h - $(CC) $(CFLAGS) $(PEDANTIC) -c $< - -test_parse.o: test_parse.c hexfile.h - $(CC) $(CFLAGS) $(PEDANTIC) -c $< - -test_parse: test_parse.o libhexfile.a - $(CC) -L. -o $@ $@.o $(EXTRA_LIBS) -lhexfile -lusb - -print_modes: print_modes.c wctdm_fxomodes.h - $(HOSTCC) -o $@ $(CFLAGS) $< - -wctdm_fxomodes.h: $(WCTDM) - @echo Building FXO modes from: $(WCTDM) - perl -n -e 'print if (/^static struct fxo_mode {$$/ .. /};$$/)' $(WCTDM) >$@ || rm -f $@ - -init_fxo_modes: print_modes - ./$< >$@ - -perlcheck: $(PERL_SCRIPTS) - for i in $^; do perl -I./zconf -c $$i || exit 1; done - touch $@ - -clean: - $(RM) *.o $(TARGETS) wctdm_fxomodes.h diff --git a/zaptel/kernel/xpp/utils/astribank_hook b/zaptel/kernel/xpp/utils/astribank_hook deleted file mode 100755 index 8dd13c9c..00000000 --- a/zaptel/kernel/xpp/utils/astribank_hook +++ /dev/null @@ -1,57 +0,0 @@ -#! /bin/sh - -# This is an example of an Astribank device hook. The xpp.rules file -# calls /usr/share/zaptel/astribank_hook after a new Astribank is ready -# and after and old Astribank device has been destroyed. -# - -set -e - -me=`basename $0` -INIT_DIR=`dirname $0` -XPP_BASE=/proc/xpp -export XPP_BASE -LOGGER="logger -s -t $me" - -ZAPTEL_BOOT_DEBIAN=${ZAPTEL_BOOT_DEBIAN:-/etc/default/zaptel} -ZAPTEL_BOOT_FEDORA=${ZAPTEL_BOOT_FEDORA:-/etc/sysconfig/zaptel} - -# read default configuration from /etc/default/zaptel -if [ -r $ZAPTEL_BOOT_DEBIAN ]; then . $ZAPTEL_BOOT_DEBIAN; fi -if [ -r $ZAPTEL_BOOT_FEDORA ]; then . $ZAPTEL_BOOT_FEDORA; fi - -if [ "$ASTRIBANK_HOOK_DISABLED" != '' ]; then - $LOGGER -p kern.info "Exiting... ASTRIBANK_HOOK_DISABLED" - exit 0 -fi - -# Always redirect stderr somewhere, otherwise the shell script will die -# when it tries to do I/O related stuff on closed file descriptor. -# Our default is to throw it down the bit-bucket. -#exec 2> /dev/console -## If you wish to trace this script: -#exec 2> "/tmp/astribank_hook_$XBUS_NAME" - -# Maybe add some logging -#$LOGGER -p kern.info "$0: $ACTION: $*." - -case "$ACTION" in -add) - # An Astribank was added and is initialized and ready. - # Put your shell commands bellow - : - ;; -remove) - # An Astribank was Removed. - # Put your shell commands bellow - # You should not access /proc/xpp/... or run related utilities - # like xpp_sync, since this is likely to cause very bad race - # conditions during driver removal. - : - ;; -*) - ;; -esac - -# Maybe add some logging -#$LOGGER -p kern.info "$0: Done: $ACTION: $*." diff --git a/zaptel/kernel/xpp/utils/example_default_zaptel b/zaptel/kernel/xpp/utils/example_default_zaptel deleted file mode 100644 index f60b651d..00000000 --- a/zaptel/kernel/xpp/utils/example_default_zaptel +++ /dev/null @@ -1,31 +0,0 @@ -# Disables hotplug firmware loading -#XPP_HOTPLUG_DISABLED=yes -# -# Disables udev hook called when an astribank is added and ready -# or removed. -#ASTRIBANK_HOOK_DISABLED=yes - -# Setup for XPP PRI. This allows to have fixed settings: -# 1. The variable XPP_PRI_SETUP contains a whitespace separated list of -# port specifications. -# 2. Each port specification contains a match expression, a '=' and -# a setting string. -# 2. Match expressions may be: -# - CONNECTOR/usb..../XPD-nn To identify by physical connector -# - NUM/XBUS-mm/XPD-nn To identify by bus number -# 4. Match expressions may contain "wildcards" (which are translated -# internally to regular expressions): -# * matches zero or more characters. -# ? matches one charater -# 5. The list of matches is scanned from beginning to end. First match wins. -# 6. The list implicitly contains an 'NUM/*=TE,E1' catch all default, appended -# to its end. -# 7. The setting string is composed of comma separated settings. Valid -# settings are: -# - NT or TE -# - E1 or T1 or J1 -# -XPP_PRI_SETUP=' - CONNECTOR/usb-0000:00:1d.7-1/XPD-01=NT,E1 - NUM/*/XPD-03=NT,E1 - ' diff --git a/zaptel/kernel/xpp/utils/fpga_load.8 b/zaptel/kernel/xpp/utils/fpga_load.8 deleted file mode 100644 index dd21db06..00000000 --- a/zaptel/kernel/xpp/utils/fpga_load.8 +++ /dev/null @@ -1,86 +0,0 @@ -.TH "FPGA_LOAD" "8" "16 April 2006" "" "" - -.SH NAME -fpga_load \- Xorcom Astribank (xpp) firmware tool -.SH SYNOPSIS - -.B fpga_load -[\fB-g\fR] [\fB-r\fR] [\fB-v\fR] \fB-D \fR{/proc/bus/usb|/dev/bus/usb}/\fIBUS/DEV\fR - -.B fpga_load -[\fB-g\fR] [\fB-v\fR] \fB-D \fR{/proc/bus/usb|/dev/bus/usb}/\fIBUS/DEV\fR \fB-I \fIfirmware.hex\fR [\fB-b \fIdump.bin\fR] [\fB-i\fR] - -.B fpga_load -h - -.SH DESCRIPTION -.B fpga_load -loads the FPGA firmware to the Xorcom Astribank device. -The syntax resembles that of fxload(8). - -.SH OPTIONS -.B -b -.I dump.bin -.RS -Before writing firmware, bump the processed binary file to -.I dump.bin\fR. -.RE - -.B -D -.I DEVICE -.RS -Required. The device to read from/write to. On modern UDEV-based system -this is usually /dev/bus/usb/\fIbus_num\fR/\fIdevice_num\fR, -where \fIbus_num\fR and \fIdevice_num\fR are the first two numbers in the -output of lsusb(8). -On older systems that use usbfs, it is usually -/proc/bus/usb/\fIbus_num\fR/\fIdevice_num\fR. -.RE - -.B -r -.RS -Reset the Astribank and renumerate its USB connection to power on product ID. -.RE - -.B -g -.RS -Dump all eeprom data to standard output. -.RE - -.B -I -.I fireware_file -.RS -The firmware file to write to the device. -.RE - -.B -i -.RS -Show information about the firmware file (valid only with \fB-I\fR option). -Example: -.PP - ./FPGA_1151.hex: Version=3297 Checksum=58270 - -In particular, the calculated checksum should match the output of \fIsum(1)\fR -on the binary firmware file generated by the \fB-b\fR option. -.RE - -.B -v -.RS -Increase verbosity. May be used multiple times. -.RE - -.B -h -.RS -Displays usage message. -.RE - -.SH SEE ALSO -fxload(8), lsusb(8) - -.SH AUTHOR -This manual page was written by Tzafrir Cohen . -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/kernel/xpp/utils/fpga_load.c b/zaptel/kernel/xpp/utils/fpga_load.c deleted file mode 100644 index 8fed3374..00000000 --- a/zaptel/kernel/xpp/utils/fpga_load.c +++ /dev/null @@ -1,1011 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "hexfile.h" - -static const char rcsid[] = "$Id: fpga_load.c 4523 2008-09-09 14:23:56Z tzafrir $"; - -#define ERR(fmt, arg...) do { \ - if(verbose >= LOG_ERR) \ - fprintf(stderr, "%s: ERROR (%d): " fmt, \ - progname, __LINE__, ## arg); \ - } while(0); -#define INFO(fmt, arg...) do { \ - if(verbose >= LOG_INFO) \ - fprintf(stderr, "%s: " fmt, \ - progname, ## arg); \ - } while(0); -#define DBG(fmt, arg...) do { \ - if(verbose >= LOG_DEBUG) \ - fprintf(stderr, "%s: DBG: " fmt, \ - progname, ## arg); \ - } while(0); - -static int verbose = LOG_WARNING; -static char *progname; -static int disconnected = 0; - -#define MAX_HEX_LINES 10000 -#define PACKET_SIZE 512 -#define EEPROM_SIZE 16 -#define LABEL_SIZE 8 -#define TIMEOUT 5000 - - -/* My device parameters */ -#define MY_EP_OUT 0x04 -#define MY_EP_IN 0x88 - -#define FPGA_EP_OUT 0x02 -#define FPGA_EP_IN 0x86 - -/* USB firmware types */ -#define USB_11xx 0 -#define USB_FIRMWARE_II 1 - -#define TYPE_ENTRY(t,ni,n,ne,out,in,...) \ - [t] = { \ - .type_code = (t), \ - .num_interfaces = (ni), \ - .my_interface_num = (n), \ - .num_endpoints = (ne), \ - .my_ep_in = (in), \ - .my_ep_out = (out), \ - .name = #t, \ - .endpoints = { __VA_ARGS__ }, \ - } - -static const struct astribank_type { - int type_code; - int num_interfaces; - int my_interface_num; - int num_endpoints; - int my_ep_out; - int my_ep_in; - char *name; - int endpoints[4]; /* for matching */ -} astribank_types[] = { - TYPE_ENTRY(USB_11xx, 1, 0, 4, MY_EP_OUT, MY_EP_IN, - FPGA_EP_OUT, - MY_EP_OUT, - FPGA_EP_IN, - MY_EP_IN), - TYPE_ENTRY(USB_FIRMWARE_II, 2, 1, 2, MY_EP_OUT, MY_EP_IN, - MY_EP_OUT, - MY_EP_IN), -}; -#undef TYPE_ENTRY - -enum fpga_load_packet_types { - PT_STATUS_REPLY = 0x01, - PT_DATA_PACKET = 0x01, -#ifdef XORCOM_INTERNAL - PT_EEPROM_SET = 0x04, -#endif - PT_EEPROM_GET = 0x08, - PT_RENUMERATE = 0x10, - PT_RESET = 0x20, - PT_BAD_COMMAND = 0xAA -}; - -struct myeeprom { - uint8_t source; - uint16_t vendor; - uint16_t product; - uint8_t release_major; - uint8_t release_minor; - uint8_t reserved; - uint8_t label[LABEL_SIZE]; -} PACKED; - -struct fpga_packet_header { - struct { - uint8_t op; - } PACKED header; - union { - struct { - uint16_t seq; - uint8_t status; - } PACKED status_reply; - struct { - uint16_t seq; - uint8_t reserved; - uint8_t data[ZERO_SIZE]; - } PACKED data_packet; - struct { - struct myeeprom data; - } PACKED eeprom_set; - struct { - struct myeeprom data; - } PACKED eeprom_get; - } d; -} PACKED; - -enum fpga_load_status { - FW_FAIL_RESET = 1, - FW_FAIL_TRANS = 2, - FW_TRANS_OK = 4, - FW_CONFIG_DONE = 8 -}; - -struct my_usb_device { - struct usb_device *dev; - usb_dev_handle *handle; - int my_interface_num; - int my_ep_out; - int my_ep_in; - char iManufacturer[BUFSIZ]; - char iProduct[BUFSIZ]; - char iSerialNumber[BUFSIZ]; - char iInterface[BUFSIZ]; - int is_usb2; - struct myeeprom eeprom; - const struct astribank_type *abtype; -}; - -const char *load_status2str(enum fpga_load_status s) -{ - switch(s) { - case FW_FAIL_RESET: return "FW_FAIL_RESET"; - case FW_FAIL_TRANS: return "FW_FAIL_TRANS"; - case FW_TRANS_OK: return "FW_TRANS_OK"; - case FW_CONFIG_DONE: return "FW_CONFIG_DONE"; - default: return "UNKNOWN"; - } -} - -/* return 1 if: - * - str has a number - * - It is larger than 0 - * - It equals num - */ -int num_matches(int num, const char* str) { - int str_val = atoi(str); - if (str_val <= 0) - return 0; - return (str_val == num); -} - -struct usb_device *dev_of_path(const char *path) -{ - struct usb_bus *bus; - struct usb_device *dev; - char dirname[PATH_MAX]; - char filename[PATH_MAX]; - const char *p; - int bnum; - int dnum; - int ret; - - assert(path != NULL); - if(access(path, F_OK) < 0) { - perror(path); - return NULL; - } - /* Find last '/' */ - if((p = memrchr(path, '/', strlen(path))) == NULL) { - ERR("Missing a '/' in %s\n", path); - return NULL; - } - /* Get the device number */ - ret = sscanf(p + 1, "%d", &dnum); - if(ret != 1) { - ERR("Path tail is not a device number: '%s'\n", p); - return NULL; - } - /* Search for a '/' before that */ - p = memrchr(path, '/', p - path); - if(p == NULL) - p = path; /* Relative path */ - else - p++; /* skip '/' */ - /* Get the bus number */ - ret = sscanf(p, "%d", &bnum); - if(ret != 1) { - ERR("Path tail is not a bus number: '%s'\n", p); - return NULL; - } - sprintf(dirname, "%03d", bnum); - sprintf(filename, "%03d", dnum); - for (bus = usb_busses; bus; bus = bus->next) { - if (! num_matches(bnum, bus->dirname)) - //if(strcmp(bus->dirname, dirname) != 0) - continue; - for (dev = bus->devices; dev; dev = dev->next) { - //if(strcmp(dev->filename, filename) == 0) - if (num_matches(dnum, dev->filename)) - return dev; - } - } - ERR("no usb device match '%s'\n", path); - return NULL; -} - -int get_usb_string(char *buf, unsigned int len, uint16_t item, usb_dev_handle *handle) -{ - char tmp[BUFSIZ]; - int ret; - - if (!item) - return 0; - ret = usb_get_string_simple(handle, item, tmp, BUFSIZ); - if (ret <= 0) - return ret; - return snprintf(buf, len, "%s", tmp); -} - -void my_usb_device_cleanup(struct my_usb_device *mydev) -{ - assert(mydev != NULL); - if(!mydev->handle) { - return; /* Nothing to do */ - } - if(!disconnected) { - if(usb_release_interface(mydev->handle, mydev->abtype->my_interface_num) != 0) { - ERR("Releasing interface: usb: %s\n", usb_strerror()); - } - } - if(usb_close(mydev->handle) != 0) { - ERR("Closing device: usb: %s\n", usb_strerror()); - } - disconnected = 1; - mydev->handle = NULL; -} - -static void show_device_info(const struct my_usb_device *mydev) -{ - const struct myeeprom *eeprom; - uint8_t data[LABEL_SIZE + 1]; - - assert(mydev != NULL); - eeprom = &mydev->eeprom; - memset(data, 0, LABEL_SIZE + 1); - memcpy(data, eeprom->label, LABEL_SIZE); - printf("USB Firmware Type: [%s]\n", mydev->abtype->name); - printf("USB iManufacturer: [%s]\n", mydev->iManufacturer); - printf("USB iProduct: [%s]\n", mydev->iProduct); - printf("USB iSerialNumber: [%s]\n", mydev->iSerialNumber); - printf("EEPROM Source: 0x%02X\n", eeprom->source); - printf("EEPROM Vendor: 0x%04X\n", eeprom->vendor); - printf("EEPROM Product: 0x%04X\n", eeprom->product); - printf("EEPROM Release: %d.%03d\n", eeprom->release_major, eeprom->release_minor); - printf("EEPROM Label: HEX(%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X) [%s]\n", - data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7], data); -} - -void dump_packet(const char *msg, const char *buf, int len) -{ - int i; - - for(i = 0; i < len; i++) - INFO("%s: %2d> 0x%02X\n", msg, i, (uint8_t)buf[i]); -} - -int send_usb(const char *msg, struct my_usb_device *mydev, struct fpga_packet_header *phead, int len, int timeout) -{ - char *p = (char *)phead; - int ret; - - if(verbose >= LOG_DEBUG) - dump_packet(msg, p, len); - if(mydev->my_ep_out & USB_ENDPOINT_IN) { - ERR("send_usb called with an input endpoint 0x%x\n", mydev->my_ep_out); - return -EINVAL; - } - ret = usb_bulk_write(mydev->handle, mydev->my_ep_out, p, len, timeout); - if(ret < 0) { - /* - * If the device was gone, it may be the - * result of renumeration. Ignore it. - */ - if(ret != -ENODEV) { - ERR("bulk_write to endpoint 0x%x failed: %s\n", mydev->my_ep_out, usb_strerror()); - dump_packet("send_usb[ERR]", p, len); - } else { - disconnected = 1; - my_usb_device_cleanup(mydev); - } - return ret; - } else if(ret != len) { - ERR("bulk_write to endpoint 0x%x short write: %s\n", mydev->my_ep_out, usb_strerror()); - dump_packet("send_usb[ERR]", p, len); - return -EFAULT; - } - return ret; -} - -int recv_usb(const char *msg, struct my_usb_device *mydev, char *buf, size_t len, int timeout) -{ - int ret; - - if(mydev->my_ep_in & USB_ENDPOINT_OUT) { - ERR("recv_usb called with an output endpoint 0x%x\n", mydev->my_ep_in); - return -EINVAL; - } - ret = usb_bulk_read(mydev->handle, mydev->my_ep_in, buf, len, timeout); - if(ret < 0) { - ERR("bulk_read from endpoint 0x%x failed: %s\n", mydev->my_ep_in, usb_strerror()); - return ret; - } - if(verbose >= LOG_DEBUG) - dump_packet(msg, buf, ret); - return ret; -} - -#ifdef XORCOM_INTERNAL -int eeprom_set(struct my_usb_device *mydev, const struct myeeprom *eeprom) -{ - int ret; - int len; - char buf[PACKET_SIZE]; - struct fpga_packet_header *phead = (struct fpga_packet_header *)buf; - - DBG("%s Start...\n", __FUNCTION__); - assert(mydev != NULL); - phead->header.op = PT_EEPROM_SET; - memcpy(&phead->d.eeprom_set.data, eeprom, EEPROM_SIZE); - len = sizeof(phead->d.eeprom_set) + sizeof(phead->header.op); - ret = send_usb("eeprom_set[W]", mydev, phead, len, TIMEOUT); - if(ret < 0) - return ret; - ret = recv_usb("eeprom_set[R]", mydev, buf, sizeof(buf), TIMEOUT); - if(ret <= 0) - return ret; - phead = (struct fpga_packet_header *)buf; - if(phead->header.op == PT_BAD_COMMAND) { - ERR("Firmware rejected PT_EEPROM_SET command\n"); - return -EINVAL; - } else if(phead->header.op != PT_EEPROM_SET) { - ERR("Got unexpected reply op=%d\n", phead->header.op); - return -EINVAL; - } - return 0; -} -#endif - -int eeprom_get(struct my_usb_device *mydev) -{ - int ret; - int len; - char buf[PACKET_SIZE]; - struct fpga_packet_header *phead = (struct fpga_packet_header *)buf; - struct myeeprom *eeprom; - - assert(mydev != NULL); - eeprom = &mydev->eeprom; - DBG("%s Start...\n", __FUNCTION__); - phead->header.op = PT_EEPROM_GET; - len = sizeof(phead->header.op); /* warning: sending small packet */ - ret = send_usb("eeprom_get[W]", mydev, phead, len, TIMEOUT); - if(ret < 0) - return ret; - ret = recv_usb("eeprom_get[R]", mydev, buf, sizeof(buf), TIMEOUT); - if(ret <= 0) - return ret; - phead = (struct fpga_packet_header *)buf; - if(phead->header.op == PT_BAD_COMMAND) { - ERR("PT_BAD_COMMAND\n"); - return -EINVAL; - } else if(phead->header.op != PT_EEPROM_GET) { - ERR("Got unexpected reply op=%d\n", phead->header.op); - return -EINVAL; - } - memcpy(eeprom, &phead->d.eeprom_get.data, EEPROM_SIZE); - return 0; -} - -int send_hexline(struct my_usb_device *mydev, struct hexline *hexline, int seq) -{ - int ret; - int len; - uint8_t *data; - char buf[PACKET_SIZE]; - struct fpga_packet_header *phead = (struct fpga_packet_header *)buf; - enum fpga_load_status status; - - assert(mydev != NULL); - assert(hexline != NULL); - if(hexline->d.content.header.tt != TT_DATA) { - DBG("Non data record %d type = %d\n", seq, hexline->d.content.header.tt); - return 0; - } - len = hexline->d.content.header.ll; /* don't send checksum */ - data = hexline->d.content.tt_data.data; - phead->header.op = PT_DATA_PACKET; - phead->d.data_packet.seq = seq; - phead->d.data_packet.reserved = 0x00; - memcpy(phead->d.data_packet.data, data, len); - len += sizeof(hexline->d.content.header); - DBG("%04d+\r", seq); - ret = send_usb("hexline[W]", mydev, phead, len, TIMEOUT); - if(ret < 0) - return ret; - ret = recv_usb("hexline[R]", mydev, buf, sizeof(buf), TIMEOUT); - if(ret <= 0) - return ret; - DBG("%04d-\r", seq); - phead = (struct fpga_packet_header *)buf; - if(phead->header.op != PT_STATUS_REPLY) { - ERR("Got unexpected reply op=%d\n", phead->header.op); - dump_packet("hexline[ERR]", buf, ret); - return -EINVAL; - } - status = (enum fpga_load_status)phead->d.status_reply.status; - switch(status) { - case FW_TRANS_OK: - case FW_CONFIG_DONE: - break; - case FW_FAIL_RESET: - case FW_FAIL_TRANS: - ERR("status reply %s (%d)\n", load_status2str(status), status); - dump_packet("hexline[ERR]", buf, ret); - return -EPROTO; - default: - ERR("Unknown status reply %d\n", status); - dump_packet("hexline[ERR]", buf, ret); - return -EPROTO; - } - return 0; -} - -//. returns > 0 - ok, the number of lines sent -//. returns < 0 - error number -int send_splited_hexline(struct my_usb_device *mydev, struct hexline *hexline, int seq, uint8_t maxwidth) -{ - struct hexline *extraline; - int linessent = 0; - int allocsize; - int extra_offset = 0; - unsigned int this_line = 0; - uint8_t bytesleft = 0; - - assert(mydev != NULL); - if(!hexline) { - ERR("Bad record %d type = %d\n", seq, hexline->d.content.header.tt); - return -EINVAL; - } - bytesleft = hexline->d.content.header.ll; - // split the line into several lines - while (bytesleft > 0) { - int status; - this_line = (bytesleft >= maxwidth) ? maxwidth : bytesleft; - allocsize = sizeof(struct hexline) + this_line + 1; - // generate the new line - if((extraline = (struct hexline *)malloc(allocsize)) == NULL) { - ERR("Not enough memory for spliting the lines\n" ); - return -EINVAL; - } - memset(extraline, 0, allocsize); - extraline->d.content.header.ll = this_line; - extraline->d.content.header.offset = hexline->d.content.header.offset + extra_offset; - extraline->d.content.header.tt = hexline->d.content.header.tt; - memcpy( extraline->d.content.tt_data.data, hexline->d.content.tt_data.data+extra_offset, this_line); - status = send_hexline(mydev, extraline, seq+linessent ); - // cleanups - free(extraline); - extra_offset += this_line; - bytesleft -= this_line; - if (status) - return status; - linessent++; - } - return linessent; -} - -int match_usb_device_identity(const struct usb_config_descriptor *config_desc, - const struct astribank_type *ab) -{ - struct usb_interface *interface; - struct usb_interface_descriptor *iface_desc; - - if(config_desc->bNumInterfaces <= ab->my_interface_num) - return 0; - interface = &config_desc->interface[ab->my_interface_num]; - iface_desc = interface->altsetting; - - return iface_desc->bInterfaceClass == 0xFF && - iface_desc->bInterfaceNumber == ab->my_interface_num && - iface_desc->bNumEndpoints == ab->num_endpoints; -} - -const struct astribank_type *my_usb_device_identify(const char devpath[], struct my_usb_device *mydev) -{ - struct usb_device_descriptor *dev_desc; - struct usb_config_descriptor *config_desc; - int i; - - assert(mydev != NULL); - usb_init(); - usb_find_busses(); - usb_find_devices(); - mydev->dev = dev_of_path(devpath); - if(!mydev->dev) { - ERR("Bailing out\n"); - return 0; - } - dev_desc = &mydev->dev->descriptor; - config_desc = mydev->dev->config; - if (!config_desc) { - ERR("No configuration descriptor: strange USB1 controller?\n"); - return 0; - } - for(i = 0; i < sizeof(astribank_types)/sizeof(astribank_types[0]); i++) { - if(match_usb_device_identity(config_desc, &astribank_types[i])) { - DBG("Identified[%d]: interfaces=%d endpoints=%d: \"%s\"\n", - i, - astribank_types[i].num_interfaces, - astribank_types[i].num_endpoints, - astribank_types[i].name); - return &astribank_types[i]; - } - } - return NULL; -} - -int my_usb_device_init(const char devpath[], struct my_usb_device *mydev, const struct astribank_type *abtype) -{ - struct usb_device_descriptor *dev_desc; - struct usb_config_descriptor *config_desc; - struct usb_interface *interface; - struct usb_interface_descriptor *iface_desc; - struct usb_endpoint_descriptor *endpoint; - int ret; - int i; - - assert(mydev != NULL); - usb_init(); - usb_find_busses(); - usb_find_devices(); - mydev->dev = dev_of_path(devpath); - if(!mydev->dev) { - ERR("Bailing out\n"); - return 0; - } - mydev->handle = usb_open(mydev->dev); - if(!mydev->handle) { - ERR("Failed to open usb device '%s/%s': %s\n", mydev->dev->bus->dirname, mydev->dev->filename, usb_strerror()); - return 0; - } - if(usb_claim_interface(mydev->handle, abtype->my_interface_num) != 0) { - ERR("usb_claim_interface: %s\n", usb_strerror()); - return 0; - } - dev_desc = &mydev->dev->descriptor; - config_desc = mydev->dev->config; - if (!config_desc) { - ERR("usb interface without a configuration\n"); - return 0; - } - interface = &config_desc->interface[abtype->my_interface_num]; - iface_desc = interface->altsetting; - endpoint = iface_desc->endpoint; - mydev->is_usb2 = (endpoint->wMaxPacketSize == 512); - for(i = 0; i < iface_desc->bNumEndpoints; i++, endpoint++) { - if(endpoint->bEndpointAddress != abtype->endpoints[i]) { - ERR("Wrong endpoint 0x%X (at index %d)\n", endpoint->bEndpointAddress, i); - return 0; - } - if(endpoint->bEndpointAddress == MY_EP_OUT || endpoint->bEndpointAddress == MY_EP_IN) { - if(endpoint->wMaxPacketSize > PACKET_SIZE) { - ERR("Endpoint #%d wMaxPacketSize too large (%d)\n", i, endpoint->wMaxPacketSize); - return 0; - } - } - } - mydev->abtype = abtype; - mydev->my_ep_in = abtype->my_ep_in; - mydev->my_ep_out = abtype->my_ep_out; - ret = get_usb_string(mydev->iManufacturer, BUFSIZ, dev_desc->iManufacturer, mydev->handle); - ret = get_usb_string(mydev->iProduct, BUFSIZ, dev_desc->iProduct, mydev->handle); - ret = get_usb_string(mydev->iSerialNumber, BUFSIZ, dev_desc->iSerialNumber, mydev->handle); - ret = get_usb_string(mydev->iInterface, BUFSIZ, iface_desc->iInterface, mydev->handle); - INFO("ID=%04X:%04X Manufacturer=[%s] Product=[%s] SerialNumber=[%s] Interface=[%s]\n", - dev_desc->idVendor, - dev_desc->idProduct, - mydev->iManufacturer, - mydev->iProduct, - mydev->iSerialNumber, - mydev->iInterface); - if(usb_clear_halt(mydev->handle, mydev->my_ep_out) != 0) { - ERR("Clearing output endpoint: %s\n", usb_strerror()); - return 0; - } - if(usb_clear_halt(mydev->handle, mydev->my_ep_in) != 0) { - ERR("Clearing input endpoint: %s\n", usb_strerror()); - return 0; - } - return 1; -} - -int renumerate_device(struct my_usb_device *mydev, enum fpga_load_packet_types pt) -{ - char buf[PACKET_SIZE]; - struct fpga_packet_header *phead = (struct fpga_packet_header *)buf; - int ret; - - assert(mydev != NULL); - DBG("Renumerating with 0x%X\n", pt); - phead->header.op = pt; - ret = send_usb("renumerate[W]", mydev, phead, 1, TIMEOUT); - if(ret < 0 && ret != -ENODEV) - return ret; -#if 0 - /* - * FIXME: we count on our USB firmware to reset the device... should we? - */ - ret = usb_reset(mydev->handle); - if(ret < 0) { - ERR("usb_reset: %s\n", usb_strerror()); - return -ENODEV; - } -#endif - return 0; -} - -/* - * Returns: true on success, false on failure - */ -int fpga_load(struct my_usb_device *mydev, const struct hexdata *hexdata) -{ - unsigned int i; - unsigned int j = 0; - int ret; - int finished = 0; - const char *v = hexdata->version_info; - - v = (v[0]) ? v : "Unknown"; - assert(mydev != NULL); - INFO("FPGA_LOAD (version %s)\n", v); - /* - * i - is the line number - * j - is the sequence number, on USB 2, i=j, but on - * USB 1 send_splited_hexline may increase the sequence - * number, as it needs - */ - for(i = 0; i < hexdata->maxlines; i++) { - struct hexline *hexline = hexdata->lines[i]; - - if(!hexline) - break; - if(finished) { - ERR("Extra data after End Of Data Record (line %d)\n", i); - return 0; - } - if(hexline->d.content.header.tt == TT_EOF) { - DBG("End of data\n"); - finished = 1; - continue; - } - if(mydev->is_usb2) { - if((ret = send_hexline(mydev, hexline, i)) != 0) { - perror("Failed sending hexline"); - return 0; - } - } else { - if((ret = send_splited_hexline(mydev, hexline, j, 60)) < 0) { - perror("Failed sending hexline (splitting did not help)"); - return 0; - } - j += ret; - } - } - DBG("Finished...\n"); - return 1; -} - -#include - -void usage() -{ - fprintf(stderr, "Usage: %s -D {/proc/bus/usb|/dev/bus/usb}// [options...]\n", progname); - fprintf(stderr, "\tOptions:\n"); - fprintf(stderr, "\t\t[-r] # Reset the device\n"); - fprintf(stderr, "\t\t[-b ] # Output to \n"); - fprintf(stderr, "\t\t[-I ] # Input from \n"); - fprintf(stderr, "\t\t[-H ] # Output to ('-' is stdout)\n"); - fprintf(stderr, "\t\t[-i] # Show hexfile information\n"); - fprintf(stderr, "\t\t[-g] # Get eeprom from device\n"); - fprintf(stderr, "\t\t[-v] # Increase verbosity\n"); -#ifdef XORCOM_INTERNAL - fprintf(stderr, "\t\t[-C srC byte] # Set Address sourCe (default: C0)\n"); - fprintf(stderr, "\t\t[-V vendorid] # Set Vendor id on device\n"); - fprintf(stderr, "\t\t[-P productid] # Set Product id on device\n"); - fprintf(stderr, "\t\t[-R release] # Set Release. 2 dot separated decimals\n"); - fprintf(stderr, "\t\t[-L label] # Set label.\n"); -#endif - exit(1); -} - -static void parse_report_func(int level, const char *msg, ...) -{ - va_list ap; - - va_start(ap, msg); - if(level <= verbose) - vfprintf(stderr, msg, ap); - va_end(ap); -} - -#ifdef XORCOM_INTERNAL -static void eeprom_fill(struct myeeprom *myeeprom, - const char vendor[], - const char product[], - const char release[], - const char label[], - const char source[]) -{ - // FF: address source is from device. C0: from eeprom - if (source) - myeeprom->source = strtoul(source, NULL, 0); - else - myeeprom->source = 0xC0; - if(vendor) - myeeprom->vendor = strtoul(vendor, NULL, 0); - if(product) - myeeprom->product = strtoul(product, NULL, 0); - if(release) { - int release_major = 0; - int release_minor = 0; - - sscanf(release, "%d.%d", &release_major, &release_minor); - myeeprom->release_major = release_major; - myeeprom->release_minor = release_minor; - } - if(label) { - /* padding */ - memset(myeeprom->label, 0, LABEL_SIZE); - memcpy(myeeprom->label, label, strlen(label)); - } -} -#endif - -int main(int argc, char *argv[]) -{ - const struct astribank_type *abtype; - struct my_usb_device mydev; - const char *devpath = NULL; - const char *binfile = NULL; - const char *inhexfile = NULL; - const char *outhexfile = NULL; - struct hexdata *hexdata = NULL; - int opt_reset = 0; - int opt_info = 0; - int opt_read_eeprom = 0; - int opt_output_width = 0; - int output_is_set = 0; -#ifdef XORCOM_INTERNAL - int opt_write_eeprom = 0; - char *vendor = NULL; - char *source = NULL; - char *product = NULL; - char *release = NULL; - char *label = NULL; - const char options[] = "rib:D:ghH:I:vw:C:V:P:R:S:"; -#else - const char options[] = "rib:D:ghH:I:vw:"; -#endif - int ret = 0; - - progname = argv[0]; - assert(sizeof(struct fpga_packet_header) <= PACKET_SIZE); - assert(sizeof(struct myeeprom) == EEPROM_SIZE); - while (1) { - int c; - - c = getopt (argc, argv, options); - if (c == -1) - break; - - switch (c) { - case 'D': - devpath = optarg; - if(output_is_set++) { - ERR("Cannot set -D. Another output option is already selected\n"); - return 1; - } - break; - case 'r': - opt_reset = 1; - break; - case 'i': - opt_info = 1; - break; - case 'b': - binfile = optarg; - if(output_is_set++) { - ERR("Cannot set -b. Another output option is already selected\n"); - return 1; - } - break; - case 'g': - opt_read_eeprom = 1; - break; - case 'H': - outhexfile = optarg; - if(output_is_set++) { - ERR("Cannot set -H. Another output option is already selected\n"); - return 1; - } - break; - case 'I': - inhexfile = optarg; - break; -#ifdef XORCOM_INTERNAL - case 'V': - vendor = optarg; - break; - case 'C': - source = optarg; - break; - case 'P': - product = optarg; - break; - case 'R': - release = optarg; - break; - case 'S': - label = optarg; - { - const char GOOD_CHARS[] = - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789" - "-_."; - int len = strlen(label); - int goodlen = strspn(label, GOOD_CHARS); - - if(len > LABEL_SIZE) { - ERR("Label too long (%d > %d)\n", len, LABEL_SIZE); - usage(); - } - if(goodlen != len) { - ERR("Bad character in label number (pos=%d)\n", goodlen); - usage(); - } - } - break; -#endif - case 'w': - opt_output_width = strtoul(optarg, NULL, 0); - break; - case 'v': - verbose++; - break; - case 'h': - default: - ERR("Unknown option '%c'\n", c); - usage(); - } - } - - if (optind != argc) { - usage(); - } - if(inhexfile) { -#ifdef XORCOM_INTERNAL - if(vendor || product || release || label || source ) { - ERR("The -I option is exclusive of -[VPRSC]\n"); - return 1; - } -#endif - parse_hexfile_set_reporting(parse_report_func); - hexdata = parse_hexfile(inhexfile, MAX_HEX_LINES); - if(!hexdata) { - ERR("Bailing out\n"); - exit(1); - } - if(opt_info) { - printf("%s: Version=%s Checksum=%d\n", - inhexfile, hexdata->version_info, - bsd_checksum(hexdata)); - } - if(binfile) { - dump_binary(hexdata, binfile); - return 0; - } - if(outhexfile) { - if(opt_output_width) - dump_hexfile2(hexdata, outhexfile, opt_output_width); - else - dump_hexfile(hexdata, outhexfile); - return 0; - } - } -#ifdef XORCOM_INTERNAL - else if(vendor || product || release || label || source ) { - if(outhexfile) { - FILE *fp; - - if(strcmp(outhexfile, "-") == 0) - fp = stdout; - else if((fp = fopen(outhexfile, "w")) == NULL) { - perror(outhexfile); - return 1; - } - memset(&mydev.eeprom, 0, sizeof(struct myeeprom)); - eeprom_fill(&mydev.eeprom, vendor, product, release, label, source); - gen_hexline((uint8_t *)&mydev.eeprom, 0, sizeof(mydev.eeprom), fp); - gen_hexline(NULL, 0, 0, fp); /* EOF */ - return 0; - } - } -#endif - if(!devpath) { - ERR("Missing device path\n"); - usage(); - } - DBG("Startup %s\n", devpath); - if((abtype = my_usb_device_identify(devpath, &mydev)) == NULL) { - ERR("Bad device. Does not match our types.\n"); - usage(); - } - INFO("FIRMWARE: %s (type=%d)\n", abtype->name, abtype->type_code); - if(!my_usb_device_init(devpath, &mydev, abtype)) { - ERR("Failed to initialize USB device '%s'\n", devpath); - ret = -ENODEV; - goto dev_err; - } - ret = eeprom_get(&mydev); - if(ret < 0) { - ERR("Failed reading eeprom\n"); - goto dev_err; - } -#ifdef XORCOM_INTERNAL - if(vendor || product || release || label || source ) { - eeprom_fill(&mydev.eeprom, vendor, product, release, label, source); - opt_write_eeprom = 1; - opt_read_eeprom = 1; - } -#endif - if(opt_read_eeprom) { - show_device_info(&mydev); - } - if(hexdata) { - if (!mydev.is_usb2) - INFO("Warning: working on a low end USB1 backend\n"); - if(!fpga_load(&mydev, hexdata)) { - ERR("FPGA loading failed\n"); - ret = -ENODEV; - goto dev_err; - } - ret = renumerate_device(&mydev, PT_RENUMERATE); - if(ret < 0) { - ERR("Renumeration failed: errno=%d\n", ret); - goto dev_err; - } - } -#ifdef XORCOM_INTERNAL - else if(opt_write_eeprom) { - if(abtype->type_code == USB_FIRMWARE_II) { - ERR("No EEPROM burning command in %s. Use fxload for that\n", - abtype->name); - goto dev_err; - } - ret = eeprom_set(&mydev, &mydev.eeprom); - if(ret < 0) { - ERR("Failed writing eeprom: %s\n", strerror(-ret)); - goto dev_err; - } - printf("------- RESULTS -------\n"); - show_device_info(&mydev); - } -#endif - if(opt_reset) { - DBG("Reseting to default\n"); - ret = renumerate_device(&mydev, PT_RESET); - if(ret < 0) { - ERR("Renumeration to default failed: errno=%d\n", ret); - goto dev_err; - } - } - DBG("Exiting\n"); -dev_err: - my_usb_device_cleanup(&mydev); - return ret; -} diff --git a/zaptel/kernel/xpp/utils/genzaptelconf b/zaptel/kernel/xpp/utils/genzaptelconf deleted file mode 100755 index b59703f6..00000000 --- a/zaptel/kernel/xpp/utils/genzaptelconf +++ /dev/null @@ -1,1198 +0,0 @@ -#! /bin/bash - -# genzaptelconf: generate as smartly as you can: -# /etc/zaptel.conf -# /etc/asterisk/zapata-channels.conf (to be #include-d into zapata.conf) -# update: -# With '-M' /etc/modules (list of modules to load) -# -# Copyright (C) 2005 by Xorcom -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# -# If you have any technical questions, contact -# Tzafrir Cohen -# - -# The script uses a number of bash-specific features -# TODO: either ditch them or convert to perl -# Don't override variables here. -# Override them in /etc/default/zaptel (debian) or /etc/sysconfig/zaptel -# (redhat/centos) - -# /etc/default/zaptel may override the following variables -VERSION=0.5.10 -rcsid='$Id: genzaptelconf 4266 2008-05-13 21:08:09Z tzafrir $' -lc_country=us -# set to: ls, ks or gs for (Loopstart, Kewlstart and GroundStart) -# on FXS channels (FXO signalling). -fxs_default_start=ks -base_exten=6000 -# If set: no context changes are made in zapata-channels.conf -#context_manual=yes -context_lines=from-pstn # context into which PSTN calls go -context_phones=from-internal # context for internal phones calls. -# The two below apply to input and output ports of the Xorcom Astribank: -context_input=astbank-input -context_output=astbank-output # useless, but helps marking the channels :-) -# TODO: what about PRI/BRI? -# If set: no group changes are made in zapata-channels.conf -#group_manual=yes -group_phones=5 # group for phones -group_lines=0 # group for lines -# Set fxs_immediate to 'yes' to make all FXS lines answer immediately. -fxs_immediate=no - -ZAPCONF_FILE=${ZAPCONF_FILE:-/etc/zaptel.conf} -ZAPCONF_FILE_SYSTEM=$ZAPCONF_FILE -ZAPATA_FILE=${ZAPATA_FILE:-/etc/asterisk/zapata-channels.conf} -ZAPSCAN_FILE=${ZAPSCAN_FILE:-/etc/asterisk/zapscan.conf} -ZAPTEL_BOOT_DEBIAN=${ZAPTEL_BOOT_DEBIAN:-/etc/default/zaptel} -ZAPTEL_BOOT_FEDORA=${ZAPTEL_BOOT_FEDORA:-/etc/sysconfig/zaptel} -MODLIST_FILE=/etc/modules -MODLIST_FILE_FEDORA=/etc/sysconfig/zaptel -exten_base_dir=/etc/asterisk/extensions-phones.d -exten_defs_file=/etc/asterisk/extensions-defs.conf -# perl utilities: -xpp_sync=/usr/sbin/xpp_sync -zt_registration=/usr/sbin/zt_registration -# how long to wait for /dev/zap/ctl to appear? (seconds) -DEVZAP_TIMEOUT=${DEVZAP_TIMEOUT:-20} -ZTCFG=${ZTCFG:-/sbin/ztcfg} -# BRI/PRI spans will be in an additional per-span group whose number -# is SPAN_GROUP_BASE + span-number -SPAN_GROUP_BASE=10 -# set to "yes" to make BRI NT spans set overlapdial (handy for ISDN phones -# and other devices). -brint_overlap=no - -# a temporary directory to store whatever we need to remember. -# -# The main loop of genconf is run in a sub-process. -tmp_dir= - -# A list of all modules: -# - the list of modules which will be probed (in this order) if -d is used -# - The module that will be deleted from /etc/modules , if -d -M is used -ALL_MODULES="wct4xxp wcte12xp wcte11xp wct1xxp wanpipe tor2 torisa qozap vzaphfc zaphfc ztgsm wctdm24xxp wctdm opvxa1200 wcfxo pciradio wcusb xpp_usb" - -# The name of the variable in /etc/sysconfig/zaptel into which to set -# the list of detected modules. -modules_var=MODULES -# On SuSE with the rpm package: -#modules_var=ZAPTEL_MODULES - -# What signalling to give to ZapBRI channels? -# bri: bri_net; bri_cpe (Bristuffed Asterisk. No multi- support) -# bri_ptmpi: bri_net_ptmp; bri_cpe_ptmp (Bristuffed Asterisk, multi- support) -# pri: pri_net; pri_cpe (Recent Asterisk. Experimental) -#ZAPBRI_SIGNALLING=bri -ZAPBRI_SIGNALLING=bri_ptmp -#ZAPBRI_SIGNALLING=pri -zapconf_def_termtype=te - -# A command to stop / start asterisk. Must support parameters "start" -# and "stop" . This is the executable: -ZAPCONF_ASTERISK_SCRIPT=/etc/init.d/asterisk -# -# Should you need to pass extra arguments: -ZAPCONF_ASTERISK_CMD=$ZAPCONF_ASTERISK_SCRIPT - -# read default configuration from /etc/default/zaptel -if [ -r $ZAPTEL_BOOT_DEBIAN ]; then . $ZAPTEL_BOOT_DEBIAN; fi -if [ -r $ZAPTEL_BOOT_FEDORA ]; then . $ZAPTEL_BOOT_FEDORA; fi - -if [ ! -x "$ZTCFG" ]; then - # Work around a bug in the rpm package: ztcfg should be in - # /sbin as it may be required for starting a network interface - if [ -x /usr/sbin/ztcfg ]; then - ZTCFG=/usr/sbin/ztcfg - else - echo >&2 "ztcfg is not on found, do you have zaptel properly installed?" - exit_cleanup 1 - fi -fi - -XPP_SYNC=auto # sync mode. can be set to '0' or '1' or HOST explicitly. - -# it is safe to use -c twice: the last one will be used. -ztcfg_cmd="$ZTCFG -c $ZAPCONF_FILE" - -# work around a bug (that was already fixed) in the installer: -if [ "$lc_country" = '' ]; then lc_country=us; fi - -force_stop_ast=no -do_detect=no -do_unload=no -do_module_list=no -verbose=no -do_restart=yes -fxsdisable=no -do_gen_zapscan=no - -span_te_timing_counter=1 - -case "$ZAPBRI_SIGNALLING" in -bri) ZAPBRI_NET=bri_net; ZAPBRI_CPE=bri_cpe ;; -pri) ZAPBRI_NET=pri_net; ZAPBRI_CPE=pri_cpe ;; -bri_ptmp) ZAPBRI_NET=bri_net_ptmp; ZAPBRI_CPE=bri_cpe_ptmp ;; -*) - die "Incorrect value for ZAPBRI_SIGNALLING ($ZAPBRI_SIGNALLING). Abortring" - ;; -esac - -die() { - echo "$@" >&2 - exit_cleanup 1 -} - -say() { - if [ "$verbose" = no ]; then - return - fi - echo "$@" >&2 -} - -# exit (exit value is the optional $1), and clean up after us -exit_cleanup() { - if [ -d "$tmp_dir" ]; then - # don't fail but don't hide error if directory is not - # empty - rmdir "$tmp_dir" || : - fi - exit $1 -} - -# Wait for udev to generate /dev/zap/ctl, if needed: -wait_for_zapctl() { - # if device file already exists, or if zaptel has failed to load: - # no point waiting. - if [ -c /dev/zap/ctl ] || ! grep -q zaptel /proc/modules ; then - return - fi - say "Waiting for /dev/zap/ctl to be generated" - devzap_found=0 - for i in `seq $DEVZAP_TIMEOUT`; do - sleep 1 - if [ -c /dev/zap/ctl ]; then - devzap_found=1 - break - fi - done - if [ "$devzap_found" != 1 ]; then - say "Still no /dev/zap/ctl after $devzap_timeout seconds." - echo >&2 "No /dev/zap/ctl: cannot run ztcfg. Aborting." - fi -} - -run_ztcfg() { - # Run ztcfg itself - if [ "$verbose" = no ]; then - $ztcfg_cmd "$@" - else - say "Reconfiguring identified channels" - $ztcfg_cmd -vv "$@" - fi -} - -update_module_list_debian() { - say "Updating Debian modules list $MODLIST_FILE." - del_args=`for i in $ALL_MODULES ztdummy - do - echo "$i" | sed s:.\*:-e\ '/^&/d': - done` - add_args=`for i in $* - do - echo "$i" | sed s:.\*:-e\ '\$a&': - done` - - sed -i.bak $del_args "$MODLIST_FILE" - for i in $* - do - echo "$i" - done >> "$MODLIST_FILE" -} - -update_module_list_fedora() { - say "Updating modules list in zaptel init config $MODLIST_FILE_FEDORA." - sed -i.bak -e "/^$modules_var=/d" "$MODLIST_FILE_FEDORA" - echo "$modules_var=\"$*\"" >> "$MODLIST_FILE_FEDORA" -} - -update_module_list() { - if [ -f "$MODLIST_FILE" ]; then - update_module_list_debian "$@" - elif [ -f "$MODLIST_FILE_FEDORA" ]; then - update_module_list_fedora "$@" - else - die "Can't find a modules list to update. Tried: $MODLIST_FILE, $MODLIST_FILE_FEDORA. Aborting" - fi -} - - - -zap_reg_xpp() { - if [ ! -d /proc/xpp ]; then return; fi - - # Get a list of connected Astribank devices, sorted by the name of - # the USB connector. That order is rather arbitrary, but will not - # change without changes to the cabling. - xbusses=`sed -e '/STATUS=connected/!d' -e 's/ *STATUS=.*//' -e 's/ *CONNECTOR=//' /proc/xpp/xbuses | sort -t: -k 2 | cut -d: -f1` - say "Zaptel registration order:" - say "$xbusses" - - # get a list of XPDs that were not yet registered as zaptel spans. - # this will be the case if you set the parameter zap_autoreg=0 to - # the module xpp - # Append /dev/null to provide a valid file name in case of an empty pattern. - xbusses_pattern=`echo $xbusses| sed -e 's|XBUS-[0-9]*|/proc/xpp/&/XPD-*/zt_registration|g'`' /dev/null' - xpds_to_register=`grep -l 0 $xbusses_pattern` - for file in $xpds_to_register; do - echo 1 >$file - done -} - -# Initialize the Xorcom Astribank (xpp/) -xpp_startup() { - # do nothing if the module xpp was not loaded, or if no - # Astribanks connected: - if [ ! -d /proc/xpp ]; then return 0; fi - if ! grep -q 'STATUS=connected' /proc/xpp/xbuses; then return 0; fi - - echo "Waiting for Astribank devices to initialize:" - cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true - - # overriding locales for the above two, as perl can be noisy - # when locales are missing. - # No register all the devices if they didn't auto-register: - LC_ALL=C $zt_registration on - - # this one could actually be run after ztcfg: - LC_ALL=C $xpp_sync "$XPP_SYNC" -} - - - -usage() { - program=`basename $0` - - echo >&2 "$program: generate zaptel.conf and zapata.conf" - echo >&2 "(version $VERSION, $rcsid)" - echo >&2 "usage:" - echo >&2 " $program [-sRdv] [-m k|l|g] [-c ] [-e ] [-F]" - echo >&2 " $program [-sRdv] -l" - echo >&2 " $program -su" - echo >&2 " $program -h (this screen)" - echo >&2 "" - echo >&2 "Options:" - echo >&2 " -c CODE: set the country code (default: $lc_country)" - echo >&2 " -e NUM: set the base extension number (default: $base_exten)" - echo >&2 " -F: Don't print FXSs in zapata.conf" - echo >&2 " -l: output a list of detected channels instead of zaptel.conf" - echo >&2 " -d: Perform hardware detection" - echo >&2 " -u: Unload zaptel modules (will not restart Asterisk)." - echo >&2 " -v: verbose" - echo >&2 " -s: Stop Asterisk before running, and start it at the end." - echo >&2 " -R: Don't restart asterisk in the end." - echo >&2 " -z: also generate zapscan.conf for the asterisk GUI." -} - -# print /etc/asterisk/zapscan.conf for the Asterisk-GUI -# $1: port type. Currently only fxs/fxo . Note that this is the type, and -# not the signalling (which would be the fxo fir an fxs port. -# $2: port number. Probably a range of ports is also allowed. -print_zapscan_port () { - if [ "$do_gen_zapscan" != 'yes' ]; then return 0; fi - - echo " -[$2] -port=$1 -" >>$zapscan_file -} - -# $1: channel number -print_pattern() { - local astbank_type='' - local reset_values="" - OPTIND=1 - while getopts 'a:' arg - do - case "$arg" in - a) case "$OPTARG" in input|output) astbank_type=$OPTARG;;esac ;; - esac - done - shift $(( $OPTIND-1 )) - - - local chan=$1 - local sig=$2 #fxs/fxo - local mode=$3 - local method - - if [ "$sig" = 'fxs' ]; then - # Coutries in which we need to use busydetect: - # United Arab Emirats, Israel, Slovenia - case "$lc_country" in - ae|il|si) - method=ls - ;; - *) - method=ks - ;; - esac - else - method="$fxs_default_start" - fi - case "$sig" in - fxs) sig_name=FXO;; - fxo) sig_name=FXS;; - esac - case "$mode" in - list) - echo $chan $sig_name $astbank_type;; - files) - # sadly, both input ports and output ports go into the same span as - # the FXS ports. Thus we need to separate between them. See also - # the zapata.conf section: - - echo ";;; line=\"$line\"" >> $zapata_file - - if [ "$astbank_type" != '' ]; - then echo "# astbanktype: $astbank_type" >>$zaptel_file; - fi - echo "${sig}$method=$chan" >>$zaptel_file - # zap2amp will rewrite those from zaptel.conf and hints there - if [ "$fxsdisable" = 'yes' ] && [ "$sig" = 'fxo' ]; then return; fi - - echo "signalling=${sig}_$method" >>$zapata_file - if [ "$sig" = 'fxo' ] - then - # to preconfigure channel 1's extension to 550, set - # chan_1_exten=550 - # in, e.g, /etc/default/zaptel - var_name=`echo chan_${chan}_exten` - cfg_exten=`echo ${!var_name} | tr -d -c 0-9` - var_name=`echo chan_${chan}_vmbox` - cfg_vmbox=`echo ${!var_name} | tr -d -c 0-9` - var_name=`echo chan_${chan}_cntxt` - cfg_cntxt=`echo ${!var_name} | tr -d -c 0-9` - - if [ "$cfg_exten" = '' ] - then # No extension number set for this channel - exten=$(($chan+$base_exten)) - else # use the pre-configured extension number - exten=$cfg_exten - fi - # is there any real need to set 'mailbox=' ? - if [ "x$cfg_vmbox" = x ] - then # No extension number set for this channel - vmbox=$exten - else # use the pre-configured extension number - vmbox=$cfg_vmbox - fi - echo "callerid=\"Channel $chan\" <$exten>" >> $zapata_file - reset_values="$reset_values callerid" - echo "mailbox=$exten" >> $zapata_file - reset_values="$reset_values mailbox" - if [ "$group_manual" != "yes" ] - then - echo "group=$group_phones" >> $zapata_file - reset_values="$reset_values group" - fi - if [ "$context_manual" != "yes" ] - then - if [ "$astbank_type" != '' ]; - then - context_var_name=context_$astbank_type - echo context=${!context_var_name} >> $zapata_file - else - echo "context=$context_phones" >> $zapata_file - fi - reset_values="$reset_values context" - fi - else # this is an FXO (trunk/phone: FXO signalling) - # we have may have set it. So reset it: - echo "callerid=asreceived" >> $zapata_file - if [ "$group_manual" != "yes" ] - then - echo "group=$group_lines" >> $zapata_file - fi - if [ "$context_manual" != "yes" ] - then - echo "context=$context_lines" >> $zapata_file - reset_values="$reset_values context" - fi - if [ "$lc_country" = 'uk' ] - then - echo "cidsignalling=v23" >> $zapata_file - case $line in - *WCFXO*) echo "cidstart=history" >> $zapata_file;; - *) echo "cidstart=polarity" >> $zapata_file;; - esac - reset_values="$reset_values cidsignalling cidstart" - fi - case "$line" in - *XPP_FXO*) - if [ "$xpp_fxo_rxgain" != '' ]; then - echo "rxgain=$xpp_fxo_rxgain" >> $zapata_file - reset_values="$reset_values rxgain" - fi - ;; - esac - # if kewlstart is not used, busydetect has to be employed: - if [ "$method" = 'ls' ] - then - echo 'busydetect=yes' >> $zapata_file - reset_values="$reset_values busydetect" - fi - fi - - if [ "$astbank_type" = 'input' ] || \ - ( [ "$fxs_immediate" = 'yes' ] && [ "$sig" = "fxo" ] ) - then - echo 'immediate=yes' >> $zapata_file - reset_values="$reset_values immediate" - fi - echo "channel => $chan" >> $zapata_file - reset_zapata_entry $zapata_file $reset_values - echo "" >> $zapata_file - - print_zapscan_port "$sig" "$chan" - ;; - esac - -} - -# the number of channels from /proc/zaptel -# must always print a number as its output. -count_proc_zap_lines() { - # if zaptel is not loaded there are 0 channels: - if [ ! -d /proc/zaptel ]; then echo '0'; return; fi - - ( - for file in `echo /proc/zaptel/* |grep -v '\*'` - do sed -e 1,2d $file # remove the two header lines - done - ) | wc -l # the total number of lines -} - -load_modules() { - say "Test Loading modules:" - for i in $ALL_MODULES - do - lines_before=`count_proc_zap_lines` - args="${i}_args" - eval "args=\$$args" - # a module is worth listing if it: - # a. loaded successfully, and - # b. added channels lines under /proc/zaptel/* - if /sbin/modprobe $i $args 2> /dev/null - then - check=0 - case "$i" in - xpp_usb) check=`grep 'STATUS=connected' 2>/dev/null /proc/xpp/xbuses | wc -l` ;; - *) if [ $lines_before -lt `count_proc_zap_lines` ]; then check=1; fi ;; - esac - if [ "$check" != 0 ] - then - probed_modules="$probed_modules $i" - say " ok $i $args" - else - say " - $i $args" - rmmod $i - fi - else - say " - $i $args" - fi - done -} - -# recursively unload a module and its dependencies, if possible. -# where's modprobe -r when you need it? -# inputs: module to unload. -# returns: the result from -unload_module() { - module="$1" - line=`lsmod 2>/dev/null | grep "^$1 "` - if [ "$line" = '' ]; then return; fi # module was not loaded - - set -- $line - # $1: the original module, $2: size, $3: refcount, $4: deps list - mods=`echo $4 | tr , ' '` - # xpp_usb keeps the xpds below busy, and hence must be removed - # before them: - case "$module" in xpd_*) mods="xpp_usb $mods";; esac - for mod in $mods; do - # run in a subshell, so it won't step over our vars: - (unload_module $mod) - # TODO: the following is probably the error handling we want: - # if [ $? != 0 ]; then return 1; fi - done - rmmod $module -} - -unload_modules() { - say "Unloading zaptel modules:" - unload_module zaptel - say '' -} - -# sleep a while until the xpp modules fully register -wait_for_xpp() { - if [ -d /proc/xpp ] - then - # wait for the XPDs to register: - # TODO: improve error reporting and produce a messagee here - cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true - fi -} - -detect() { - unload_modules - temporary_zapconf save - load_modules - temporary_zapconf restore - modlist="$probed_modules" - modlist="$(echo $modlist)" # clean spaces - if [ "$do_module_list" = yes ] - then - update_module_list "$modlist" - fi - if echo $modlist | grep -q xpp_usb; then wait_for_xpp; fi -} - -# The module configuration generated by zaptel includes a totally useless -# automatic run of ztcfg after modules loading. As a workaround for that, -# we provide an empty zaptel.conf temporarily. -# -# At hardware detection time we shouldn't really touch zaptel.conf . So we -# must keep a copy of it somewhere. -# -# I use ZAPCONF_FILE_SYSTEM rather than ZAPCONF_FILE, as the bogus modprobe -# entries will not be initiated by us. -# -# ZAPCONF_FILE_TMP is a "global", as it needs to be preserved between the -# call to 'save' and to 'restore' -ZAPCONF_FILE_TMP= -temporary_zapconf() { - case "$1" in - save) - say "Temporarily moving zaptel.conf aside to work around broken modprobe.conf" - ZAPCONF_FILE_TMP=`mktemp /tmp/genzaptelconf-zaptel.conf-XXXXXX` || die "Error creating temporary zaptel.conf" - if [ -f $ZAPCONF_FILE_SYSTEM ]; then - cp -a $ZAPCONF_FILE_SYSTEM $ZAPCONF_FILE_TMP - fi - echo -n >$ZAPCONF_FILE_SYSTEM - ;; - restore) - # restore original zaptel.conf: - if [ "$ZAPCONF_FILE_TMP" = '' ]; then return; fi - mv $ZAPCONF_FILE_TMP $ZAPCONF_FILE_SYSTEM - ZAPCONF_FILE_TMP='' - ;; - esac -} - -# run after the channel's entry. Used to reset all the values -reset_zapata_entry() { - conf_file="$1"; shift - - for arg in "$@"; do - case "$arg" in - busydetect) echo "$arg=no" >>$conf_file;; - context) echo "$arg=default" >>$conf_file;; - immediate) echo "$arg=no" >>$conf_file;; - overlapdial) echo "$arg=no" >>$conf_file;; - rxgain) echo "$arg=0" >>$conf_file;; - txgain) echo "$arg=0" >>$conf_file;; - *) echo "$arg=" >>$conf_file;; - esac - done -} - - -# we need to preserve the permissions of existing configurations files. -# However we also don't want to be left with incomplete configurations in -# case we are stopped in the middle. Thus we create a temporary file and -# mv it to the original file only when done. -# -# This function gives the temporary file the permissions of the original, -# or some sane defaults. -# -# The temporary file is generated here, and ths its name is passed through -# a variable whose name is passed as a parameter (new_var). -# -# $1: orig_cfg_file -# $2: new_var -gen_tmp_conf() { - orig_cfg_file=$1 - new_var=$2 - - # assign to new_var by reference: - eval $new_var=`mktemp /tmp/genzaptelconf-conf-XXXXXX` \ - || die "Unable to create temporary config file for $orig_cfg_file" - if [ -r "$orig_cfg_file" ]; then - chown --reference="$orig_cfg_file" ${!new_var} 2>/dev/null - chmod --reference="$orig_cfg_file" ${!new_var} 2>/dev/null - else - chmod 644 ${!new_var} - fi -} - -# Extract information from one digital channel (one line in a /proc/zaptel -# file). Information is saved to $tmp_dir/span_foo variables. -# FIXME: detection should move to when we know the number of channels -# and hence can tell between an E1 and a T1. -detect_digital_channel() { - line="$1" - chan_num="$2" - span_num="$3" - - # PRI/BRI channel - # Rather than identifying cards by the header line, we identify - # them by the channel names. This is shorter. - # This also allows us to count the channel numbers and check if - # we have a E1 span, a T1 span or a BRI span. - - # span_lastd is always the one before last - # channel. span_bchan is the last: - echo $chan_num >$tmp_dir/span_end - - if [ "`cat $tmp_dir/span_begin`" != "-1" ] - then - return #we already configured this span. - fi - - # Now we need to give initial configuration to the span - echo $chan_num >$tmp_dir/span_begin - echo $span_num >$tmp_dir/span_num - - case "$line" in - *ZTHFC*/* | *ztqoz*/* | *XPP_BRI_*/*) - # BRI channel - echo 'ccs' >$tmp_dir/span_framing - echo 'euroisdn' >$tmp_dir/span_switchtype - if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ] - then - echo $ZAPBRI_NET >$tmp_dir/span_signalling - else - echo $ZAPBRI_CPE >$tmp_dir/span_signalling - fi - ;; - *ztgsm*/*) - # Junghanns's GSM cards. - echo 'ccs' >$tmp_dir/span_framing - #Does this mean anything? - echo 'gsm' >$tmp_dir/span_signalling - ;; - *TE[24]/* | *WCT1/* | *Tor2/* | *TorISA/* | *WP[TE]1/* | \ - *R[124]T1/* | *XPP_[TEJ]1_*) - # FIXME: handle cwain around here. - # name: *cwain[12]/* . Always E1. - - # PRI span (E1/T1) - echo 'esf' >$tmp_dir/span_framing - echo 'b8zs' >$tmp_dir/span_coding - echo 'national' >$tmp_dir/span_switchtype - if [ "`cat $tmp_dir/span_termtype`" = 'nt' 2>/dev/null ] - then - echo pri_net >$tmp_dir/span_signalling - else - echo pri_cpe >$tmp_dir/span_signalling - fi - # an example of country-specific setup. This is probably not accurate - # Contributions are welcome - case "$lc_country" in - nl) - # (Just an example for per-country info) - echo 'ccs' >$tmp_dir/span_framing - echo 'ami' >$tmp_dir/span_coding - #echo 'crc4' >$tmp_dir/span_yellow - #echo 'euroisdn' >$tmp_dir/span_switchtype - #echo 'pri_cpe' >$tmp_dir/span_signalling - ;; - il|de|au) - echo 'ccs' >$tmp_dir/span_framing - echo 'hdb3' >$tmp_dir/span_coding - echo 'crc4' >$tmp_dir/span_yellow - echo 'euroisdn' >$tmp_dir/span_switchtype - ;; - cl) - echo 'ccs' >$tmp_dir/span_framing - echo 'hdb3' >$tmp_dir/span_coding - #echo 'crc4' >$tmp_dir/span_yellow - echo 'national' >$tmp_dir/span_switchtype - ;; - esac - ;; - esac -} - -# read information from the $tmp_dir/span_foo files and generate -# configuration for the span and its channels. -write_digital_config() { - # if the current file we checked was not of a digital span, we have - # nothing to do: - if [ "`cat $tmp_dir/span_begin`" = -1 ]; then return; fi - - # read files to variables: - for suffix in num begin end timing lbo framing \ - coding switchtype signalling yellow termtype - do - eval span_$suffix=`cat $tmp_dir/span_$suffix 2>/dev/null` - done - - # exactly the same logic is used in asterisk's chan_zap.c. - # also not that $(( )) is bash-specific - case "$((1+ $span_end - $span_begin))" in - 2|3|24) #ztgsm, BRI or T1 - dchan=$span_end - bchans="$span_begin-$(($span_end-1))" - ;; - 31) #E1 - dchan="$(($span_begin+15))" - bchans="$span_begin-$(($span_begin+14)),$(($span_begin+16))-$span_end" - if [ "$span_framing" = 'esf' ]; then - # don't leave an E1 span with defective defaults: - span_framing=ccs - span_coding=hdb3 - span_switchtype=euroisdn - span_yellow=crc4 - fi - ;; - esac - if [ "$span_yellow" != '' ]; then span_yellow=",$span_yellow"; fi - # Let's assume that a TE span should get the clock from the remote unit, - # and NT spans should provide timing. Just as a sane default. - # If we have several TE spans, the first will have priority 1, - # second: 2, etc. - case "$span_signalling" in *_cpe*) - span_timing=$span_te_timing_counter - span_te_timing_counter=$(($span_te_timing_counter + 1)) - ;; - esac - case "$mode" in - files) - echo span=$span_num,$span_timing,$span_lbo,$span_framing,$span_coding$span_yellow >> $zaptel_file - # leave a comment in zaptel.conf that allows to tell if - # this span is TE or NT: - if [ "$span_termtype" != '' ] - then echo "# termtype: $span_termtype" >>$zaptel_file - fi - - echo bchan=$bchans >>$zaptel_file - echo dchan=$dchan >>$zaptel_file - if [ "$fxsdisable" = 'yes' ] && [ "$span_termtype" = 'nt' ]; then return; fi - # You should not send content to zapata.conf below this line - - span_group=$(($SPAN_GROUP_BASE + $span_num)) - - if [ "$span_termtype" != '' ] - then - # an ISDN card's span that we know if it is in NT mode or TE mode. - # NT is the same as FXS for us and TE is the same as FXO - if [ "$span_termtype" = 'nt' ] - then - echo "callerid=\"Channels $span_begin - $span_end\" <$span_begin>" >> $zapata_file - reset_values="$reset_values callerid" - #echo "mailbox=$exten" - if [ "$brint_overlap" = 'yes' ] - then - echo "overlapdial=yes" >> $zapata_file - reset_values="$reset_values overlapdial" - fi - if [ "$group_manual" != "yes" ] - then - echo "group=$group_phones,$span_group" >> $zapata_file - reset_values="$reset_values group" - fi - if [ "$context_manual" != "yes" ] - then - echo "context=$context_phones" >> $zapata_file - fi - else - #echo "mailbox=" - if [ "$group_manual" != "yes" ] - then - echo "group=$group_lines,$span_group" >> $zapata_file - reset_values="$reset_values group" - fi - if [ "$context_manual" != "yes" ] - then - echo "context=$context_lines" >> $zapata_file - reset_values="$reset_values context" - fi - fi - fi - echo "switchtype = $span_switchtype" >> $zapata_file - echo "signalling = $span_signalling" >> $zapata_file - echo "channel => $bchans" >> $zapata_file - reset_zapata_entry $zapata_file $reset_values - reset_values= - ;; - list) - echo "### BRI/PRI: $span_termtype" - echo "$bchans Data" - echo "$dchan Control" - #echo BRI/PRI: chans: $bchans, control: $dchan - ;; - esac -} - -# This is where the actual detection configuration detection work happens. -genconf() { - local mode=$1 - local reset_values="" - -# spanlist=`echo /proc/zaptel/* | grep -v '\*'` -# spanlist=$(for i in `for i in /proc/zaptel/*; do if [ -f $i ]; then echo $i | cut -f 4 -d / ; fi; done | sort -n`; do echo -n "/proc/zaptel/$i "; done) -# spanlist=(cd /proc/zaptel; ls | sort -n | sed 's|^|/proc/zaptel/|') - spanlist=`ls /proc/zaptel/ 2>/dev/null | sort -n | sed 's|^|/proc/zaptel/|'` - - #if [ "$spanlist" == "" ]; then - # die "No zapata interfaces in /proc/zaptel" - #fi - - - case "$mode" in - files) - if [ "$do_gen_zapscan" = 'yes' ]; then - gen_tmp_conf "$ZAPSCAN_FILE" zapscan_file - cat <$zapscan_file -; zapscan.conf: information about detected zaptel channels -; (currently: analog only) -; -; Automatically generated by $0 -- Please do not edit. - -EOF - fi - gen_tmp_conf "$ZAPTEL_FILE" zaptel_file - gen_tmp_conf "$ZAPATA_FILE" zapata_file - cat <$zaptel_file -# Autogenerated by $0 -- do not hand edit -# Zaptel Configuration File -# -# This file is parsed by the Zaptel Configurator, ztcfg -# - -# It must be in the module loading order - -EOF - cat <$zapata_file -; Autogenerated by $0 -- do not hand edit -; Zaptel Channels Configurations (zapata.conf) -; -; This is not intended to be a complete zapata.conf. Rather, it is intended -; to be #include-d by /etc/zapata.conf that will include the global settings -; -EOF - ;; - esac - - # For each line in the spanlist: see if it represents a channel. - # if it does, test that the channel is usable. - # we do that by configuring it (using ztcfg with a 1-line config file) - # and then trying to read 1 byte from the device file. - # - # The '<(command)' syntax creates a temporary file whose content is is the - # output of 'command'. - # - # Another problem with such an approach is how to include an existing - # configuration file. For instance: how to include some default settings. - # - # Maybe an 'include' directive should be added to zaptel.conf ? - #cat $spanlist | - for procfile in $spanlist - do - span_num=`basename $procfile` - # the first line is the title line. It states the model name - # the second line is empty - title=`head -n 1 $procfile` - # stuff that needs to be remembered accross lines (for PRI/BRI support) - case "$mode" in - list) echo "### $title";; - files) - echo "" >>$zaptel_file - echo "# $title" >>$zaptel_file - echo "" >>$zapata_file - echo "; $title" >>$zapata_file - ;; - esac - echo '-1' >$tmp_dir/span_begin - echo '-1' >$tmp_dir/span_end - echo '0' >$tmp_dir/span_timing - echo '0' >$tmp_dir/span_lbo - echo '' >$tmp_dir/span_framing - echo 'ami' >$tmp_dir/span_coding - echo '' >$tmp_dir/span_switchtype - echo '' >$tmp_dir/span_signalling - if [ "$zapconf_def_termtype" != '' ] - then - echo "$zapconf_def_termtype" >$tmp_dir/span_termtype - fi - - # Check if ZapBRI cards are in TE or NT mode - if echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] |Xorcom .* (BRI|T1|E1)_NT)' - then - echo 'nt' >$tmp_dir/span_termtype - elif echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] |Xorcom .* (BRI|T1|E1)_TE)' - then - echo 'te' >$tmp_dir/span_termtype - fi - - # The rest of the lines are per-channel lines - sed -e 1,2d $procfile | \ - while read line - do - # in case this is a real channel. - chan_num=`echo $line |awk '{print $1}'` - case "$line" in - *WCTDM/* | *\ WRTDM/* | *OPVXA1200/*) - # TDM400P/2400P and similar cards (Sangoma A200, OpenVox A1200) - # this can be either FXS or FXO - maybe_fxs=0 - maybe_fxo=0 - $ztcfg_cmd -c <(echo fxoks=$chan_num) &>/dev/null && maybe_fxs=1 - $ztcfg_cmd -c <(echo fxsks=$chan_num) &>/dev/null && maybe_fxo=1 - if [ $maybe_fxs = 1 ] && [ $maybe_fxo = 1 ] - then - # An installed module won't accept both FXS and FXO signalling types: - # this is an empty slot. - # TODO: I believe that the Sangoma A20x will reject both and thus - # print nothing here. - case "$mode" in - list) echo "# channel $chan_num, WCTDM, no module.";; - files) echo "# channel $chan_num, WCTDM, no module." >> $zaptel_file;; - esac - continue - fi - - if [ $maybe_fxs = 1 ]; then print_pattern $chan_num fxo $mode; fi - if [ $maybe_fxo = 1 ]; then print_pattern $chan_num fxs $mode; fi - ;; - *WCFXO/*) - # X100P - print_pattern $chan_num fxs $mode || \ - echo "# channel $chan_num, WCFXO, inactive." >>$zaptel_file - ;; - *WCUSB/*) - print_pattern $chan_num fxo $mode - ;; - *XPP_FXO/*) - # Astribank FXO span - print_pattern $chan_num fxs $mode - ;; - *XPP_FXS/*) - # Astribank FXS span (regular port) - print_pattern $chan_num fxo $mode - ;; - *' FXO'/*) - # FXO module (probably Rhino) - print_pattern $chan_num fxs $mode - ;; - *' FXS'/*) - # FXS module (probably Rhino) - print_pattern $chan_num fxo $mode - ;; - *' ---'/*) - # no module (probably Rhino) - continue - ;; - *XPP_OUT/*) - # Astribank FXS span (output port) - print_pattern -a output $chan_num fxo $mode - ;; - *XPP_IN/*) - # Astribank FXS span (input port) - print_pattern -a input $chan_num fxo $mode - ;; - *ZTHFC*/* | *ztqoz*/* |*ztgsm/* |*TE[24]/* | \ - *WCT1/*|*Tor2/* | *TorISA/* | \ - *XPP_BRI_*/* | *WP[TE]1/* | *R[124]T1/* | \ - *XPP_[TE]1*/* ) - detect_digital_channel "$line" "$chan_num" "$span_num" - ;; - '') ;; # Empty line (after span header) - *) - case "$mode" in - list) echo "# ??: $line";; - files) - echo "# ??: $line" >>$zaptel_file - echo "; ??: $line" >>$zapata_file - esac - ;; - esac - done - # end of part in sub-process. - - write_digital_config - done - - if [ "$mode" = 'files' ] - then - cat <> ${zaptel_file} - -# Global data - -loadzone = $loadzone -defaultzone = $defaultzone -EOF - fi - - if [ "$mode" = 'files' ]; then - mv ${ZAPCONF_FILE} ${ZAPCONF_FILE}.bak 2>/dev/null - mv $zaptel_file ${ZAPCONF_FILE} - mv ${ZAPATA_FILE} ${ZAPATA_FILE}.bak 2>/dev/nullk - mv $zapata_file ${ZAPATA_FILE} - if [ "$do_gen_zapscan" = 'yes' ]; then - mv $ZAPSCAN_FILE $ZAPSCAN_FILE.bak 2>/dev/null - mv $zapscan_file $ZAPSCAN_FILE - fi - - zapata_file_name=`basename $ZAPATA_FILE` - if ! grep -q "^#include.*$zapata_file_name" \ - /etc/asterisk/zapata.conf - then - say "Note: generated $ZAPATA_FILE not included in zapata.conf" - say "To fix: echo '#include $zapata_file_name' >>/etc/asterisk/zapata.conf" - fi - fi -} - -while getopts 'c:de:Fhlm:MRsuvz' arg -do - case "$arg" in - e) # guarantee that it is a number: - new_base_exten=`echo $OPTARG | tr -d -c 0-9` - if [ "x$new_base_exten" != x ]; then base_exten=$new_base_exten; fi - ;; - c) lc_country=`echo $OPTARG | tr -d -c a-z` ;; - d) do_detect=yes ;; - F) fxsdisable=yes;; - u) do_unload=yes ; force_stop_ast=yes ;; - v) verbose=yes ;; - l) mode='list' ;; - M) do_module_list=yes; do_detect=yes ;; - s) force_stop_ast=yes ;; - R) do_restart=no ;; - z) do_gen_zapscan=yes ;; - h) usage; exit 0;; - *) echo >&2 "unknown parameter -$arg, Aborting"; usage; exit 1;; - esac -done -shift $(( $OPTIND-1 )) -if [ $# != 0 ]; then - echo >&2 "$0: too many parameters" - usage - exit 1 -fi - -tmp_dir=`mktemp -d /tmp/genzaptelconf-dir-XXXXXX` || \ - die "$0: failed to create temporary directory. Aborting" - - -case "$lc_country" in - # the list was generated from the source of zaptel: - #grep '{.*[0-9]\+,.*"[a-z][a-z]"' zonedata.c | cut -d'"' -f 2 | xargs |tr ' ' '|' - us|au|fr|nl|uk|fi|es|jp|no|at|nz|it|gr|tw|cl|se|be|sg|il|br|hu|lt|pl|za|pt|ee|mx|in|de|ch|dk|cz|cn):;; - *) - lc_country=us - echo >&2 "unknown country-code $lc_country, defaulting to \"us\"" - ;; -esac -# any reason for loadzone and defaultzone to be different? If so, this is -# the place to make that difference -loadzone=$lc_country -defaultzone=$loadzone - -# make sure asterisk is not in our way -if [ "$force_stop_ast" = 'yes' ] -then - $ZAPCONF_ASTERISK_CMD stop 1>&2 -else - # if asterisk is running and we wanted to detect modules - # or simply to unload modules, asterisk needs to go away. - if ( [ "$do_unload" = yes ] || [ "$do_detect" = yes ] ) && \ - pidof asterisk >/dev/null - then - echo >&2 "Asterisk is already running. Configuration left untouched" - echo >&2 "You can use the option -s to shut down Asterisk for the" - echo >&2 "duration of the detection." - exit_cleanup 1 - fi -fi - -if [ "$do_unload" = yes ] -then - unload_modules - exit_cleanup $? -fi - -if [ "$do_detect" = yes ] -then - detect -fi - -if [ "$zapconf_use_perl" = yes ]; then - #redefine genconf to use perl utilities: - genconf() { - case "$1" in - list) zaptel_hardware ;; - files) zapconf ;; - esac - } -fi - -if [ "$mode" = list ]; then - genconf list -else - #zap_reg_xpp - xpp_startup - wait_for_zapctl - say "Generating '${ZAPCONF_FILE} and ${ZAPATA_FILE}'" - genconf files - run_ztcfg -fi - -if [ "$tmp_dir" != '' ] -then - rm -rf "$tmp_dir" -fi - -if [ "$force_stop_ast" != 'yes' ] || [ "$do_restart" != 'yes' ] -then - exit_cleanup 0 -fi - -if [ -x "$ZAPCONF_ASTERISK_SCRIPT" ] -then - $ZAPCONF_ASTERISK_CMD start 1>&2 -fi - -# if in verbose mode: verify that asterisk is running -if [ "$verbose" != 'no' ] - then - say "Checking channels configured in Asterisk:" - sleep 1 # give it some time. This is enough on our simple test server - if [ -x ast-cmd ] - then - ast-cmd cmd "zap show channels" - else - asterisk -rx "zap show channels" - fi -fi - -# vim:ts=8: diff --git a/zaptel/kernel/xpp/utils/genzaptelconf.8 b/zaptel/kernel/xpp/utils/genzaptelconf.8 deleted file mode 100644 index c3f6f73c..00000000 --- a/zaptel/kernel/xpp/utils/genzaptelconf.8 +++ /dev/null @@ -1,326 +0,0 @@ -.TH GENZAPTELCONF 8 "July 18th, 2005" "Xorcom Rapid Asterisk" "Linux Programmer's Manual" -.SH "NAME" -.B genzaptelconf --- generates zaptel configuration (TDM adaptors) -.SH SYNOPSIS -.PP -.B genzaptelconf -[-sRdvzF] [-c ] [-e ] - -.B genzaptelconf -[-sRdv] -l -- only list to standard output - -.B genzaptelconf --su -- only unload zaptel modules - -.B genzaptelconf --h -- Help screen - -.SH DESCRIPTION -.B genzaptelconf -is a script to detect zaptel devices (currently mostly TDM cards are -supported). It generates both -.I /etc/zaptel.conf -and -.I /etc/asterisk/zapata-channels.conf - -.I PRI -and -.I BRI -(with ZapBRI) cards are basically identified as well. However the span -configiration is a default that I only hope is sane. Looking for feedback - -.SH OPTIONS -.B -c -.I country_code -.RS -A two-letter country code. Sets the country-code for the zonezone -entries in -.I zaptel.conf -, The default is the value of -.I lc_country -from -.I /etc/default/zaptel -and failing that, "us". -.RE - -.B -d -.RS -Also try to detect modules. Unloads all zaptel modules and loads them -one by one. Considers a module useful if it loaded successfully and if -loading it has generated at least one zapata channel. - -The list of detected modules is written as the value of -.I ZAPTEL_MODS -in -.I /etc/default/zaptel -.RE - -.B -e -.I base_exten_num -.RS -Configure channel -.I i -as extension -.I exten_num -+ -.I i - . This is mostly for the caller-id values. Crude, but may be good enough. -See also -.I -r -.RE - -.B -F -.RS -Disable writing FXS extensions in zapata.conf -.RE - -.B -l -.RS -Only list deceted channels and their signalling. Don't write -configuration files. Note, however that -.I -ld -will still rewrite the modules line in -.I /etc/default/zaptel -(see -.I -d -above). -.RE - -.B -M -.RS -Update -.I /etc/modules -with a list of our modules, thereby -triggers their loading via modprobe on the next boot. - -This triggers the -.I -d -option as well. -.RE - -.B -R -.RS -Don't restart asterisk even if it was stopped using -.I -s - . -.RE - -.B -s -.RS -Stop asterisk for the duration of the test. The detection will only -work if nobody uses the zaptel channels: - -* To allow unloading of modules - -* to allow reading configuration files. - -This option tells the script to stop asterisk (if it was running) and to -try to start it after the end of the test. -.RE - -.B -v -.RS -Be verbose. lists the detected modules if -.I -d -is used. Lists detected channls. In the end tries to connect to asterisk -to get a list of configured zaptel channels. -.RE - -.B -z -.RS -emulate the operation of zapscan.bin: generate -.I /etc/asterisk/zapscan.conf -with the results of the scan. -.RE - -.SH CONFIGURATION -Look at the beginning of the script for a number of variables that can -be overriden through the configuraion file. Some variables can also be -overriden through the environment. The configuration file is sourced by -bash but for compatibility expected to have only 'var=VALUE' lines and -comments or empty lines. - -The configuration will first be read from -.I /etc/default/zaptel -if it exists, and -.I /etc/sysconfig/zaptel -otherwise (But those file names may be overriden, see -.I ZAPTEL_BOOT_DEBIAN -and -.I ZAPTEL_BOOT_FEDORA -below). Variables set in those files will override the default settings -and setting rom the environment. - -The following variables may be set from the environment: -ZAPCONF_FILE, ZAPATA_FILE, ZAPTEL_BOOT_DEBIAN, ZAPTEL_BOOT_FEDORA, -DEVZAP_TIMEOUT, ZTCFG - -.RS -.I lc_country -.RS -The default country. Can be also overriden by the option -c -.RE - -.I base_exten -.RS -The base number used for automatic numbering -.RE - -.I context_manual -.RS -If set to 'yes', no context changes are made in zapata-channels.conf -.RE - -.I context_lines -.RS -The context into which calls will go from zaptel trunks. -.RE - -.I context_phones -.RS -The context into which calls will go from zaptel phones. -.RE - -.I context_manual -.RS -If set to 'yes', no group settings are made in zapata-channels.conf -.RE - -.I group_lines -.RS -The group number for zaptel trunks. -.RE - -.I group_phones -.RS -The group number for zaptel phones. -.RE - -.I ALL_MODULES -.RS -modules list. Used for unloading and modules detection. The order of modules -is the same for both. -.RE - -.I ZAPCONF_FILE -.RS -ztcfg's configuration file. The sane default is /etc/zaptel.conf . -.RE - -.I ZAPATA_FILE -.RS -The generated partial zapata.conf snippet. Default: -/etc/asterisk/zapata-channels.conf . -.RE - -.I ZAPTEL_BOOT_DEBIAN -.RS -The Debian Zaptel defaults file. Normally -.I /etc/default/zaptel -. -.RE - - -.I ZAPTEL_BOOT_FEDORA -.RS -The Zaptel defaults file on various other distributions. Normally -.I /etc/sysconfig/zaptel - . -.RE - -.I DEVZAP_TIMEOUT -.RS -Maximal number of seconds to wait for /dev/zap to be initializaed by -udev. -.RE - -.I ZTCFG -.RS -The full path to the ztcfg tool. Default: -.I /sbin/ztcfg -genzaptelconf will also explicitly test for -.I /usr/sbin/ztcfg -as a last resort. -.RE -.RE - -.SH FILES -.I /etc/zaptel.conf -.RS -The configuration file used by -.I ztcfg -to configure zaptel devices. re-written by -.I genzaptelconf - . A backup copy is saved to -.I /etc/zaptel.conf.bak - . -.RE - -.I /etc/asterisk/zapata.conf -.RS -The configuration file of Asterisk's -.I chan_zap. -Not modified directly by -.I genzaptelconf. -If you want genzaptelconf's setting to take effect, add the following -line at the end of -.I zapata.conf: -.RS -#include "zapata-channels.conf" -.RE -.RE - -.I /etc/asterisk/zapata-channels.conf -.RS -This is the snippet of -.I chan_zap -configuration file that -.I genzaptelconf generates. - . A backup copy is saved to -.I /etc/asterisk/zapata-channels.conf.bak - . -.RE - -.I /etc/default/zaptel -.RS -This file holds configuration for both -.I genzaptelconf -and -.I /etc/init.d/zaptel . -It is sourced by both scripts and can thus be used to override settings -of variables from those scripts. -.RE - -.I /etc/modules -.RS -A debian-specific list of kernel modules to be loaded by modprobe at -boot time. When the option -.I -d -(detect) is used, genzaptelconf will write in this file zaptel modules -to be loaded. If you want to use a different file, set -.I MOD_FILELIST - . If it is rewritten, a backup copy is saved to -.I /etc/modules.bak - . -.RS -The backup copy of -.I /etc/modules -.RE - -.SH "SEE ALSO" -ztcfg(8) asterisk(8). - -.SH BUGS -If you override a configuration variable both through the environment -and through the configuration file, the value from the configuration -file wins. - -.SH "AUTHOR" -This manual page was written by Tzafrir Cohen -Permission is granted to copy, distribute and/or modify this document under -the terms of the GNU General Public License, Version 2 any -later version published by the Free Software Foundation. - -On Debian systems, the complete text of the GNU General Public -License can be found in /usr/share/common-licenses/GPL. diff --git a/zaptel/kernel/xpp/utils/hexfile.c b/zaptel/kernel/xpp/utils/hexfile.c deleted file mode 100644 index aa11d1a0..00000000 --- a/zaptel/kernel/xpp/utils/hexfile.c +++ /dev/null @@ -1,567 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include "hexfile.h" - -static const char rcsid[] = "$Id: hexfile.c 3793 2008-02-04 23:00:48Z tzafrir $"; - -static parse_hexfile_report_func_t report_func = NULL; - -parse_hexfile_report_func_t parse_hexfile_set_reporting(parse_hexfile_report_func_t rf) -{ - parse_hexfile_report_func_t old_rf = report_func; - report_func = rf; - return old_rf; -} - -static void chomp(char buf[]) -{ - size_t last = strlen(buf) - 1; - while(last >= 0 && isspace(buf[last])) - buf[last--] = '\0'; -} - -static int hexline_checksum(struct hexline *hexline) -{ - unsigned int i; - unsigned int chksm = 0; - int ll = hexline->d.content.header.ll; - - for(i = 0; i <= sizeof(hexline->d.content.header) + ll; i++) { - chksm += hexline->d.raw[i]; - } - return chksm & 0xFF; -} - -int dump_hexline(int recordno, struct hexline *line, FILE *fp) -{ - uint8_t ll; - uint16_t offset; - uint8_t tt; - uint8_t old_chksum; - uint8_t new_chksum; - uint8_t *data; - unsigned int i; - - ll = line->d.content.header.ll; - offset = line->d.content.header.offset; - tt = line->d.content.header.tt; - fprintf(fp, ":%02X%04X%02X", ll, offset, tt); - data = line->d.content.tt_data.data; - for(i = 0; i < ll; i++) { - fprintf(fp, "%02X", data[i]); - } - old_chksum = data[ll]; - data[ll] = 0; - new_chksum = 0xFF - hexline_checksum(line) + 1; - data[ll] = old_chksum; - fprintf(fp, "%02X\n", new_chksum); - if(new_chksum != old_chksum) { - if(report_func) - report_func(LOG_ERR, "record #%d: new_chksum(%02X) != old_chksum(%02X)\n", - recordno, new_chksum, old_chksum); - return 0; - } - return 1; -} - -struct hexline *new_hexline(uint8_t datalen, uint16_t offset, uint8_t tt) -{ - struct hexline *hexline; - size_t allocsize; - - allocsize = sizeof(struct hexline) + datalen + 1; /* checksum byte */ - if((hexline = malloc(allocsize)) == NULL) { - if(report_func) - report_func(LOG_ERR, "No more memory\n"); - return NULL; - } - memset(hexline, 0, allocsize); - hexline->d.content.header.ll = datalen; - hexline->d.content.header.offset = offset; - hexline->d.content.header.tt = tt; - return hexline; -} - -static int append_hexline(struct hexdata *hexdata, char *buf) -{ - int ret; - unsigned int ll, offset, tt; - char *p; - struct hexline *hexline; - unsigned int i; - - if(hexdata->got_eof) { - if(report_func) - report_func(LOG_ERR, "Extranous data after EOF record\n"); - return -EINVAL; - } - if(hexdata->last_line >= hexdata->maxlines) { - if(report_func) - report_func(LOG_ERR, "Hexfile too large (maxline %d)\n", hexdata->maxlines); - return -ENOMEM; - } - ret = sscanf(buf, "%02X%04X%02X", &ll, &offset, &tt); - if(ret != 3) { - if(report_func) - report_func(LOG_ERR, "Bad line header (only %d items out of 3 parsed)\n", ret); - return -EINVAL; - } - switch(tt) { - case TT_DATA: - break; - case TT_EOF: - if(ll != 0) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EOF): Bad len = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - if(offset != 0) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EOF): Bad offset = %d\n", - hexdata->last_line, tt, offset); - return -EINVAL; - } - hexdata->got_eof = 1; - break; - case TT_EXT_SEG: - if(ll != 2) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EXT_SEG): Bad len = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - if(offset != 0) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EXT_SEG): Bad offset = %d\n", - hexdata->last_line, tt, offset); - return -EINVAL; - } - break; - case TT_START_SEG: - if(ll != 4) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(START_SEG): Bad len = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - if(offset != 0) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(START_SEG): Bad offset = %d\n", - hexdata->last_line, tt, offset); - return -EINVAL; - } - break; - case TT_EXT_LIN: - if(ll != 2) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EXT_LIN): Bad len = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - if(offset != 0) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EXT_LIN): Bad offset = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - break; - case TT_START_LIN: /* Unimplemented */ - if(ll != 4) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EXT_LIN): Bad len = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - if(offset != 0) { - if(report_func) - report_func(LOG_ERR, - "%d: Record %d(EXT_LIN): Bad offset = %d\n", - hexdata->last_line, tt, ll); - return -EINVAL; - } - break; - default: - if(report_func) - report_func(LOG_ERR, "%d: Unimplemented record type %d: %s\n", - hexdata->last_line, tt, buf); - return -EINVAL; - } - buf += 8; /* Skip header */ - if((hexline = new_hexline(ll, offset, tt)) == NULL) { - if(report_func) - report_func(LOG_ERR, "No more memory for hexfile lines\n"); - return -EINVAL; - } - p = buf; - for(i = 0; i < ll + 1; i++) { /* include checksum */ - unsigned int val; - - if((*p == '\0') || (*(p+1) == '\0')) { - if(report_func) - report_func(LOG_ERR, "Short data string '%s'\n", buf); - return -EINVAL; - } - ret = sscanf(p, "%02X", &val); - if(ret != 1) { - if(report_func) - report_func(LOG_ERR, "Bad data byte #%d\n", i); - return -EINVAL; - } - hexline->d.content.tt_data.data[i] = val; - p += 2; - } - if(hexline_checksum(hexline) != 0) { - if(report_func) { - report_func(LOG_ERR, "Bad checksum (%d instead of 0)\n", - hexline_checksum(hexline)); - dump_hexline(hexdata->last_line, hexline, stderr); - } - return -EINVAL; - } - hexdata->lines[hexdata->last_line] = hexline; - if(hexdata->got_eof) - return 0; - hexdata->last_line++; - return 1; -} - -void free_hexdata(struct hexdata *hexdata) -{ - if(hexdata) { - unsigned int i; - - for(i = 0; i < hexdata->maxlines; i++) - if(hexdata->lines[i] != NULL) - free(hexdata->lines[i]); - free(hexdata); - } -} - -int dump_hexfile(struct hexdata *hexdata, const char *outfile) -{ - FILE *fp; - unsigned int i; - - if(report_func) - report_func(LOG_INFO, "Dumping hex data into '%s'\n", outfile); - if(!outfile || strcmp(outfile, "-") == 0) - fp = stdout; - else if((fp = fopen(outfile, "w")) == NULL) { - perror(outfile); - exit(1); - } - for(i = 0; i <= hexdata->last_line; i++) { - struct hexline *line = hexdata->lines[i]; - if(!line) { - if(report_func) - report_func(LOG_ERR, "Missing line at #%d\n", i); - return -EINVAL; - } - if(!dump_hexline(i, line, fp)) - return -EINVAL; - } - return 0; -} - -int dump_hexfile2(struct hexdata *hexdata, const char *outfile, uint8_t maxwidth) -{ - FILE *fp; - uint8_t tt; - unsigned int i; - struct hexline *line; - - if(report_func) - report_func(LOG_INFO, - "Dumping hex data into '%s' (maxwidth=%d)\n", - outfile, maxwidth); - if(!outfile || strcmp(outfile, "-") == 0) - fp = stdout; - else if((fp = fopen(outfile, "w")) == NULL) { - perror(outfile); - exit(1); - } - if(maxwidth == 0) - maxwidth = UINT8_MAX; - for(i = 0; i <= hexdata->last_line; i++) { - int bytesleft = 0; - int extra_offset = 0; - int base_offset; - uint8_t *base_data; - - line = hexdata->lines[i]; - if(!line) { - if(report_func) - report_func(LOG_ERR, "Missing line at #%d\n", i); - return -EINVAL; - } - bytesleft = line->d.content.header.ll; - /* split the line into several lines */ - tt = line->d.content.header.tt; - base_offset = line->d.content.header.offset; - base_data = line->d.content.tt_data.data; - while (bytesleft > 0) { - struct hexline *extraline; - uint8_t new_chksum; - unsigned int curr_bytes = (bytesleft >= maxwidth) ? maxwidth : bytesleft; - - /* generate the new line */ - if((extraline = new_hexline(curr_bytes, base_offset + extra_offset, tt)) == NULL) { - if(report_func) - report_func(LOG_ERR, "No more memory for hexfile lines\n"); - return -EINVAL; - } - memcpy(extraline->d.content.tt_data.data, base_data + extra_offset, curr_bytes); - new_chksum = 0xFF - hexline_checksum(extraline) + 1; - extraline->d.content.tt_data.data[curr_bytes] = new_chksum; - /* print it */ - dump_hexline(i, extraline, fp); - /* cleanups */ - free(extraline); - extra_offset += curr_bytes; - bytesleft -= curr_bytes; - } - } - if(tt != TT_EOF) { - if(report_func) - report_func(LOG_ERR, "Missing EOF record\n"); - return -EINVAL; - } - dump_hexline(i, line, fp); - return 0; -} - -void process_comment(struct hexdata *hexdata, char buf[]) -{ - char *dollar_start; - char *dollar_end; - const char id_prefix[] = "Id: "; - char tmp[BUFSIZ]; - char *p; - int len; - - if(report_func) - report_func(LOG_INFO, "Comment: %s\n", buf + 1); - /* Search for RCS keywords */ - if((dollar_start = strchr(buf, '$')) == NULL) - return; - if((dollar_end = strchr(dollar_start + 1, '$')) == NULL) - return; - /* Crop the '$' signs */ - len = dollar_end - dollar_start; - len -= 2; - memcpy(tmp, dollar_start + 1, len); - tmp[len] = '\0'; - p = tmp; - if(strstr(tmp, id_prefix) == NULL) - return; - p += strlen(id_prefix); - if((p = strchr(p, ' ')) == NULL) - return; - p++; - snprintf(hexdata->version_info, BUFSIZ, "%s", p); - if((p = strchr(hexdata->version_info, ' ')) != NULL) - *p = '\0'; -} - -struct hexdata *parse_hexfile(const char *fname, unsigned int maxlines) -{ - FILE *fp; - struct hexdata *hexdata = NULL; - int datasize; - char buf[BUFSIZ]; - int line; - int dos_eof = 0; - int ret; - - assert(fname != NULL); - if(report_func) - report_func(LOG_INFO, "Parsing %s\n", fname); - datasize = sizeof(struct hexdata) + maxlines * sizeof(char *); - hexdata = (struct hexdata *)malloc(datasize); - if(!hexdata) { - if(report_func) - report_func(LOG_ERR, "Failed to allocate %d bytes for hexfile contents\n", datasize); - goto err; - } - memset(hexdata, 0, datasize); - hexdata->maxlines = maxlines; - if((fp = fopen(fname, "r")) == NULL) { - if(report_func) - report_func(LOG_ERR, "Failed to open hexfile '%s'\n", fname); - goto err; - } - for(line = 1; fgets(buf, BUFSIZ, fp); line++) { - if(dos_eof) { - if(report_func) - report_func(LOG_ERR, "%s:%d - Got DOS EOF character before true EOF\n", fname, line); - goto err; - } - if(buf[0] == 0x1A && buf[1] == '\0') { /* DOS EOF char */ - dos_eof = 1; - continue; - } - chomp(buf); - if(buf[0] == '\0') { - if(report_func) - report_func(LOG_ERR, "%s:%d - Short line\n", fname, line); - goto err; - } - if(buf[0] == '#') { - process_comment(hexdata, buf); - continue; - } - if(buf[0] != ':') { - if(report_func) - report_func(LOG_ERR, "%s:%d - Line begins with 0x%X\n", fname, line, buf[0]); - goto err; - } - if((ret = append_hexline(hexdata, buf + 1)) < 0) { - if(report_func) - report_func(LOG_ERR, "%s:%d - Failed parsing.\n", fname, line); - goto err; - } - } - fclose(fp); - if(report_func) - report_func(LOG_INFO, "%s parsed OK\n", fname); - return hexdata; -err: - free_hexdata(hexdata); - return NULL; -} - -void dump_binary(struct hexdata *hexdata, const char *outfile) -{ - FILE *fp; - unsigned int i; - size_t len; - - if(report_func) - report_func(LOG_INFO, "Dumping binary data into '%s'\n", outfile); - if((fp = fopen(outfile, "w")) == NULL) { - perror(outfile); - exit(1); - } - for(i = 0; i < hexdata->maxlines; i++) { - struct hexline *hexline = hexdata->lines[i]; - - if(!hexline) - break; - switch(hexline->d.content.header.tt) { - case TT_EOF: - if(report_func) - report_func(LOG_INFO, "\ndump: good EOF record"); - break; - case TT_DATA: - if(report_func) - report_func(LOG_INFO, "dump: %6d\r", i); - len = hexline->d.content.header.ll; - if(fwrite(hexline->d.content.tt_data.data, 1, len, fp) != len) { - perror("write"); - exit(1); - } - break; - case TT_EXT_SEG: - case TT_START_SEG: - case TT_EXT_LIN: - case TT_START_LIN: - if(report_func) - report_func(LOG_INFO, - "\ndump(%d): ignored record type %d", - i, hexline->d.content.header.tt); - break; - default: - if(report_func) - report_func(LOG_ERR, "dump: Unknown record type %d\n", - hexline->d.content.header.tt); - exit(1); - } - } - if(report_func) - report_func(LOG_INFO, "\nDump finished\n"); - fclose(fp); -} - -void gen_hexline(const uint8_t *data, uint16_t addr, size_t len, FILE *output) -{ - struct hexline *hexline; - - if(!data) { - fprintf(output, ":%02X%04X%02XFF\n", 0, 0, TT_EOF); - return; - } - if((hexline = new_hexline(len, addr, (!data) ? TT_EOF : TT_DATA)) == NULL) { - if(report_func) - report_func(LOG_ERR, "No more memory\n"); - return; - } - if(data) - memcpy(&hexline->d.content.tt_data, data, len); - dump_hexline(0, hexline, output); - free(hexline); -} - -/* - * Algorithm lifted of sum(1) implementation from coreutils. - * We chose the default algorithm (BSD style). - */ -int bsd_checksum(struct hexdata *hexdata) -{ - unsigned int i; - size_t len; - int ck = 0; - - for(i = 0; i < hexdata->maxlines; i++) { - struct hexline *hexline = hexdata->lines[i]; - unsigned char *p; - - if(!hexline) - break; - if(hexline->d.content.header.tt == TT_EOF) - continue; - len = hexline->d.content.header.ll; - p = hexline->d.content.tt_data.data; - for(; len; p++, len--) { - ck = (ck >> 1) + ((ck & 1) << 15); - ck += *p; - ck &= 0xffff; /* Keep it within bounds. */ - } - } - return ck; -} diff --git a/zaptel/kernel/xpp/utils/hexfile.h b/zaptel/kernel/xpp/utils/hexfile.h deleted file mode 100644 index f8bf6a96..00000000 --- a/zaptel/kernel/xpp/utils/hexfile.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef PARSE_HEXFILE_H -#define PARSE_HEXFILE_H - -#include - -/* - * Some portability workarounds - */ -#ifdef _WINDOWS - -#include /* for UCHAR USHORT */ -typedef UCHAR uint8_t; -typedef USHORT uint16_t; -#define PACKED -#define sscanf sscanf_s -#define ZERO_SIZE 1 - -/* From /usr/include/syslog.h */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but significant condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS -# define __END_DECLS -#endif - -#elif __GNUC__ - -#include -#include -#define PACKED __attribute__((packed)) -#define ZERO_SIZE 1 - -#else - -#error "Cannot compile on this platform" - -#endif - -/* Record types in hexfile */ -enum { - TT_DATA = 0, - TT_EOF = 1, - TT_EXT_SEG = 2, - TT_START_SEG = 3, - TT_EXT_LIN = 4, - TT_START_LIN = 5, - TT_NO_SUCH_TT -}; - -#pragma pack(1) -struct hexline { - union { - uint8_t raw[ZERO_SIZE]; - struct content { - struct header { - uint8_t ll; /* len */ - uint16_t offset; /* offset */ - uint8_t tt; /* type */ - } PACKED header; - struct tt_data { - uint8_t data[ZERO_SIZE]; - } tt_data; - } PACKED content; - } d; -} PACKED; -#pragma pack() - -struct hexdata { - unsigned int maxlines; - unsigned int last_line; - int got_eof; - char version_info[BUFSIZ]; - struct hexline *lines[ZERO_SIZE]; -}; - - -__BEGIN_DECLS - -typedef void (*parse_hexfile_report_func_t)(int level, const char *msg, ...); - -parse_hexfile_report_func_t parse_hexfile_set_reporting(parse_hexfile_report_func_t rf); -void free_hexdata(struct hexdata *hexdata); -struct hexdata *parse_hexfile(const char *fname, unsigned int maxlines); -int dump_hexfile(struct hexdata *hexdata, const char *outfile); -int dump_hexfile2(struct hexdata *hexdata, const char *outfile, uint8_t maxwidth); -void dump_binary(struct hexdata *hexdata, const char *outfile); -void gen_hexline(const uint8_t *data, uint16_t addr, size_t len, FILE *output); -int bsd_checksum(struct hexdata *hexdata); -__END_DECLS - -#endif diff --git a/zaptel/kernel/xpp/utils/lszaptel b/zaptel/kernel/xpp/utils/lszaptel deleted file mode 100755 index 12536629..00000000 --- a/zaptel/kernel/xpp/utils/lszaptel +++ /dev/null @@ -1,110 +0,0 @@ -#! /usr/bin/perl -w -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: lszaptel 4456 2008-08-04 15:52:49Z tzafrir $ -# -use strict; -use File::Basename; -BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } - -use Zaptel; -use Zaptel::Span; -use Zaptel::Xpp; -use Zaptel::Xpp::Xbus; -use Zaptel::Xpp::Xpd; - -my @xbuses = Zaptel::Xpp::xbuses("SORT_CONNECTOR"); -my @xpds = map { $_->xpds } @xbuses; - -foreach my $span (Zaptel::spans()) { - my $spanno = $span->num; - my $xpd = $span->xpd; - my @lines; - my $index = 0; - - @lines = @{$xpd->lines} if defined $xpd; - printf "### Span %2d: %s %s\n", $span->num, $span->name, $span->description; - foreach my $chan ($span->chans()) { - my %type_map = ( - OUT => 'Output', - IN => 'Input' - ); - my ($type) = map { $type_map{$_} or $_ } $chan->type || ("unknown"); - my $batt = ""; - $batt = "(battery)" if $chan->battery; - my @alarms = $chan->alarms; - my $alarm_str = join(" ", @alarms); - printf "%3d %-10s %-10s %s %s %s\n", - $chan->num, $type, $chan->signalling, $chan->info, $batt, $alarm_str; - $index++; - } -} - -__END__ - -=head1 NAME - -lszaptel - List all zaptel channels with their types and spans. - -=head1 SYNOPSIS - -lszaptel - -=head1 DESCRIPTION - -Example output: - - ### Span 1: WCTDM/0 "Wildcard TDM400P REV E/F Board 1" - 1 FXO FXOLS (In use) - 2 FXS FXSKS - 3 FXS FXSKS - 4 FXS FXSKS - ### Span 2: XBUS-00/XPD-00 "Xorcom XPD #00/00: FXO" - 5 FXO FXSKS (In use) - 6 FXO FXSKS (In use) (no pcm) - 7 FXO FXSKS (In use) (no pcm) - 8 FXO FXSKS (In use) (no pcm) - 9 FXO FXSKS (In use) (no pcm) - 10 FXO FXSKS (In use) (no pcm) - 11 FXO FXSKS (In use) (no pcm) - 12 FXO FXSKS (In use) (no pcm) - ### Span 3: XBUS-00/XPD-10 "Xorcom XPD #00/10: FXO" - 13 FXO FXSKS (In use) (no pcm) - 14 FXO FXSKS (In use) (no pcm) - 15 FXO FXSKS (In use) (no pcm) - 16 FXO FXSKS (In use) (no pcm) - 17 FXO FXSKS (In use) (no pcm) - 18 FXO FXSKS (In use) (no pcm) - 19 FXO FXSKS (In use) (no pcm) - 20 FXO FXSKS (In use) (no pcm) - - ... - - ### Span 6: XBUS-01/XPD-00 "Xorcom XPD #01/00: FXS" - 37 FXS FXOLS (In use) - 38 FXS FXOLS (In use) (no pcm) - 39 FXS FXOLS (In use) (no pcm) - 40 FXS FXOLS (In use) (no pcm) - 41 FXS FXOLS (In use) (no pcm) - 42 FXS FXOLS (In use) (no pcm) - 43 FXS FXOLS (In use) (no pcm) - 44 FXS FXOLS (In use) (no pcm) - 45 Output FXOLS (In use) (no pcm) - 46 Output FXOLS (In use) (no pcm) - 47 Input FXOLS (In use) (no pcm) - 48 Input FXOLS (In use) (no pcm) - 49 Input FXOLS (In use) (no pcm) - 50 Input FXOLS (In use) (no pcm) - -The first column is the type of the channel (port, for an analog device) -and the second one is the signalling (if set). - -=head1 FILES - -lszaptel is a somewhat glorified 'cat /proc/zaptel/*' . Unlike that -command, it sorts the spans with the proper order. It also formats the -output slightly differently. diff --git a/zaptel/kernel/xpp/utils/print_modes.c b/zaptel/kernel/xpp/utils/print_modes.c deleted file mode 100644 index 77e0e333..00000000 --- a/zaptel/kernel/xpp/utils/print_modes.c +++ /dev/null @@ -1,33 +0,0 @@ -#include - -#include "wctdm_fxomodes.h" - -int main() { - size_t i; - - for (i=0; i<(sizeof(fxo_modes)/sizeof(struct fxo_mode)); i++) { - if (fxo_modes[i].name == NULL) break; - int reg16=0, reg26=0, reg30=0, reg31=0x20; - char ring_osc[BUFSIZ]="", ring_x[BUFSIZ] = ""; - - reg16 |= (fxo_modes[i].ohs << 6); - reg16 |= (fxo_modes[i].rz << 1); - reg16 |= (fxo_modes[i].rt); - - reg26 |= (fxo_modes[i].dcv << 6); - reg26 |= (fxo_modes[i].mini << 4); - reg26 |= (fxo_modes[i].ilim << 1); - - reg30 = (fxo_modes[i].acim); - - reg31 |= (fxo_modes[i].ohs2 << 3); - - if (fxo_modes[i].ring_osc) - snprintf(ring_osc, BUFSIZ, "ring_osc=%04X", fxo_modes[i].ring_osc); - if (fxo_modes[i].ring_x) - snprintf(ring_x, BUFSIZ, "ring_x=%04X", fxo_modes[i].ring_x); - printf("%-15s\treg16=%02X\treg26=%02X\treg30=%02X\treg31=%02X\t%s\t%s\n", - fxo_modes[i].name, reg16, reg26, reg30, reg31, ring_osc, ring_x); - } - return 0; -} diff --git a/zaptel/kernel/xpp/utils/test_parse.c b/zaptel/kernel/xpp/utils/test_parse.c deleted file mode 100644 index 8ac20238..00000000 --- a/zaptel/kernel/xpp/utils/test_parse.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include "hexfile.h" - -static void default_report_func(int level, const char *msg, ...) -{ - va_list ap; - - va_start(ap, msg); - vfprintf(stderr, msg, ap); - va_end(ap); -} - -int main(int argc, char *argv[]) -{ - struct hexdata *hd; - int i; - - if(argc < 2) { - fprintf(stderr, "Usage: program hexfile...\n"); - return 1; - } - parse_hexfile_set_reporting(default_report_func); - for(i = 1; i < argc; i++) { - hd = parse_hexfile(argv[i], 2000); - if(!hd) { - fprintf(stderr, "Parsing failed\n"); - return 1; - } - fprintf(stderr, "=== %s === (version: %s)\n", argv[i], hd->version_info); - dump_hexfile2(hd, "-", 60 ); - free_hexdata(hd); - } - return 0; -} diff --git a/zaptel/kernel/xpp/utils/xpp.rules b/zaptel/kernel/xpp/utils/xpp.rules deleted file mode 100644 index d3cc226e..00000000 --- a/zaptel/kernel/xpp/utils/xpp.rules +++ /dev/null @@ -1,14 +0,0 @@ -BUS!="usb", ACTION!="add", GOTO="xpp_usb_add_end" -KERNEL=="*_ep*", GOTO="xpp_usb_add_end" -KERNEL=="[0-9]*", GOTO="xpp_usb_add_end" - -# Load firmware into the Xorcom Astribank device: -SYSFS{idVendor}=="e4e4", SYSFS{idProduct}=="11[345][01]", \ - RUN+="/usr/share/zaptel/xpp_fxloader udev $sysfs{idVendor}/$sysfs{idProduct}/$sysfs{bcdDevice}" - -LABEL="xpp_usb_add_end" - -# Hotplug hook for Astribank up/down -# By default XPP_INIT_DIR="/usr/share/zaptel" -KERNEL=="xbus*" RUN+="%E{XPP_INIT_DIR}/astribank_hook udev $kernel $sysfs{status} $sysfs{connector}" - diff --git a/zaptel/kernel/xpp/utils/xpp_blink b/zaptel/kernel/xpp/utils/xpp_blink deleted file mode 100755 index c9f82b80..00000000 --- a/zaptel/kernel/xpp/utils/xpp_blink +++ /dev/null @@ -1,168 +0,0 @@ -#! /usr/bin/perl -w -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: xpp_blink 4272 2008-05-14 15:53:13Z tzafrir $ -# -use strict; -use File::Basename; -BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } - -use Zaptel; -use Zaptel::Span; -use Zaptel::Xpp; -use Zaptel::Xpp::Xbus; - -sub usage { - die "Usage: $0 {on|off|bzzt} {span | chan | xpd [] | label /dev/null 2>&1 &)& -} - -init_astribank() { - wait_for_xpp - zap_reg_xpp - fix_asterisbank_sync - run_adj_clock -} - -xpp_do_blink() { - val="$1" - shift - for xbus in $* - do - for xpd in /proc/xpp/XBUS-"$xbus"/XPD-* - do - echo "$val" > "$xpd/blink" - done - done -} - -xpp_blink() { - xbuses=`grep STATUS=connected /proc/xpp/xbuses | sed -e 's/^XBUS-//' -e 's/:.*$//'` - num=`echo $1 | tr -c -d 0-9` - case "$num" in - [0-9]*) - shift - xpp_do_blink 1 $xbuses - sleep 2 - xpp_do_blink 0 $xbuses - ;; - *) - shift - echo 1>&2 Enumerating $xbuses - xpp_do_blink 0 $xbuses - for i in $xbuses - do - echo "BLINKING: $i" - xpp_do_blink 1 "$i" - sleep 2 - xpp_do_blink 0 "$i" - done - ;; - esac -} - -# The current Debian start function. -# The function is not responsible for loading the zaptel modules: -# they will be loaded beforehand. -debian_start() { - wait_for_xpp - zap_reg_xpp - fix_asterisbank_sync - wait_for_zapctl - - if [ -r /etc/fxotune.conf ] && [ -x $FXOTUNE ]; then - $FXOTUNE -s - fi - - # configure existing modules: - $ZTCFG -} - - -# run_fxotune: destroy all FXO channels and run fxotune. -# This allows running fxotune without completly shutting down Asterisk. -# -# A simplistic assumption: every zaptel channel in the context from-pstn -# is a FXO ones. -# or rather: all tunable FXO channels are in the context from-pstn are -# not defined by zaptel. -run_fxotune() { - zap_fxo_chans=`asterisk -rx "zap show channels" | awk "/$FXO_CONTEXT/{print \$1}"` - xpp_fxo_chans=`cat /proc/zaptel/* | awk '/XPP_FXO/{print $1}'` - for chan in $xpp_fxo_chans $zap_fxo_chans; do - asterisk -rx "zap destroy channel $chan" - done - $FXOTUNE -i - asterisk -rx "zap restart" -} - - -# recursively unload a module and its dependencies, if possible. -# where's modprobe -r when you need it? -# inputs: module to unload. -unload_module() { - set +e - module="$1" - line=`lsmod 2>/dev/null | grep "^$module "` - if [ "$line" = '' ]; then return; fi # module was not loaded - - set -- $line - # $1: the original module, $2: size, $3: refcount, $4: deps list - mods=`echo $4 | tr , ' '` - # xpd_fxs actually sort of depends on xpp: - case "$module" in xpd_*) mods="xpp_usb $mods";; esac - for mod in $mods; do - # run in a subshell, so it won't step over our vars: - (unload_module $mod) - done - rmmod $module || true - set -e -} - -unload() { - unload_module zaptel -} - -# sleep a while until the xpp modules fully register -wait_for_xpp() { - if [ -d /proc/xpp ] && \ - [ "`cat /sys/module/xpp/parameters/zap_autoreg`" = 'Y' ] - then - # wait for the XPDs to register: - # TODO: improve error reporting and produce a messagee here - cat /proc/xpp/XBUS-*/waitfor_xpds 2>/dev/null >/dev/null || true - fi -} - -############################################################################# -##### -##### Hardware detection functions -##### - -load_modules() { - say "Test Loading modules:" - for i in $ALL_MODULES - do - lines_before=`count_proc_zap_lines` - args="${i}_args" - eval "args=\$$args" - # a module is worth listing if it: - # a. loaded successfully, and - # b. added channels lines under /proc/zaptel/* - if /sbin/modprobe $i $args 2> /dev/null - then - check=0 - case "$i" in - xpp_usb) check=`grep 'STATUS=connected' 2>/dev/null /proc/xpp/xbuses | wc -l` ;; - # FIXME: zttranscode will always load, and will never - # add a span. Maybe try to read from /dev/zap/transcode . - zttranscode) : ;; - *) if [ $lines_before -lt `count_proc_zap_lines` ]; then check=1; fi ;; - esac - if [ "$check" != 0 ] - then - probed_modules="$probed_modules $i" - say " ok $i $args" - else - say " - $i $args" - rmmod $i - fi - else - say " - $i $args" - fi - done -} - -update_module_list_debian() { - say "Updating Debian modules list $MODLIST_FILE_DEBIAN." - del_args=`for i in $ALL_MODULES ztdummy - do - echo "$i" | sed s:.\*:-e\ '/^&/d': - done` - add_args=`for i in $* - do - echo "$i" | sed s:.\*:-e\ '\$a&': - done` - - sed -i.bak $del_args "$MODLIST_FILE_DEBIAN" - for i in $* - do - echo "$i" - done >> "$MODLIST_FILE_DEBIAN" -} - -update_module_list_redhat() { - say "Updating modules list in zaptel init config $MODLIST_FILE_REDHAT." - sed -i.bak -e '/^MODULES=/d' "$MODLIST_FILE_REDHAT" - echo "MODULES=\"$*\"" >> "$MODLIST_FILE_REDHAT" -} - -update_module_list() { - if [ -f "$MODLIST_FILE_DEBIAN" ]; then - update_module_list_debian "$@" - elif [ -f "$MODLIST_FILE_REDHAT" ]; then - update_module_list_redhat "$@" - else - die "Can't find a modules list to update. Tried: $MODLIST_FILE_DEBIAN, $MODLIST_FILE_REDHAT. Aborting" - fi -} - - - - - - -# unless we wanted to use this as a set of functions, run -# the given function with its parameters: -if [ "$ZAPHELPER_ONLY_INCLUDE" = '' ]; then - "$@" -fi diff --git a/zaptel/kernel/xpp/utils/zaptel_drivers b/zaptel/kernel/xpp/utils/zaptel_drivers deleted file mode 100755 index d7904c01..00000000 --- a/zaptel/kernel/xpp/utils/zaptel_drivers +++ /dev/null @@ -1,9 +0,0 @@ -#! /usr/bin/perl -w -use strict; -use File::Basename; -BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } - -use Zaptel::Hardware; - -my $hardware = Zaptel::Hardware->scan; -print join("\n", $hardware->drivers),"\n"; diff --git a/zaptel/kernel/xpp/utils/zaptel_hardware b/zaptel/kernel/xpp/utils/zaptel_hardware deleted file mode 100755 index 91c83cf7..00000000 --- a/zaptel/kernel/xpp/utils/zaptel_hardware +++ /dev/null @@ -1,164 +0,0 @@ -#! /usr/bin/perl -w -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: zaptel_hardware 3793 2008-02-04 23:00:48Z tzafrir $ -# -use strict; -use File::Basename; -use Getopt::Std; -BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } - -use Zaptel; -use Zaptel::Span; -use Zaptel::Xpp; -use Zaptel::Xpp::Xbus; -use Zaptel::Hardware; - -sub usage { - die "Usage: $0 [-v][-x]\n"; -} - -our ($opt_v, $opt_x); -getopts('vx') || usage; -@ARGV == 0 or usage; - -my $hardware = Zaptel::Hardware->scan; -my @spans = Zaptel::spans; - -sub show_xbus($) { - my $xbus = shift or die; - my @xpds = $xbus->xpds; - my $label = '[' . $xbus->label() . ']'; - my $connector = ($xbus->status eq 'CONNECTED') ? $xbus->connector : "MISSING"; - printf " LABEL=%-20s CONNECTOR=%-20s\n", $label, $connector; - foreach my $xpd (@xpds) { - my $reg = $xpd->zt_registration; - my $span; - my $spanstr; - if($reg && @spans) { - ($span) = grep { $_->name eq $xpd->fqn } @spans; - $spanstr = ($span) ? ("Span " . $span->num) : ""; - } else { - $spanstr = "Unregistered"; - } - my $master = ''; - #$master = "XPP-SYNC" if $xpd->is_sync_master; - $master .= " ZAPTEL-SYNC" if defined($span) && $span->is_zaptel_sync_master; - printf "\t%-10s: %-8s %s %s\n", $xpd->fqn, $xpd->type, $spanstr, $master; - } -} - -my %seen; -my $format = "%-20s %-12s %4s:%4s %s\n"; - -sub show_disconnected(%) { - my %seen = @_; - - my $notified_lost = 0; - foreach my $xbus (Zaptel::Xpp::xbuses('SORT_CONNECTOR')) { - if(!$seen{$xbus->name}) { - print "----------- XPP Spans with disconnected hardware -----------\n" - unless $notified_lost++; - printf($format, $xbus->name, '', '', '', "NO HARDWARE"); - show_xbus($xbus) if $opt_v; - } - } -} - -foreach my $dev ($hardware->device_list) { - my $driver = $dev->driver || ""; - my $xbus; - my $loaded; - if($dev->is_astribank) { - $xbus = $dev->xbus; - } - $loaded = $dev->loaded; - warn "driver should be '$driver' but is actually '$loaded'\n" - if defined($loaded) && $driver ne $loaded; - $driver = "$driver" . (($loaded) ? "+" : "-"); - my $description = $dev->description || ""; - printf $format, $dev->hardware_name, $driver, $dev->vendor, $dev->product, $description; - if(!defined $xbus || !$xbus) { - next; - } - $seen{$xbus->name} = 1; - show_xbus($xbus) if $opt_v; -} - -show_disconnected(%seen) if $opt_x; - -__END__ - -=head1 NAME - -zaptel_hardware - Shows Zaptel hardware devices. - -=head1 SYNOPSIS - -zaptel_hardware [-v][-x] - -=head1 OPTIONS - -=over - -=item -v - -Verbose ouput - show spans used by each device etc. Currently only -implemented for the Xorcom Astribank. - -=item -x - -Show disconnected Astribank unit, if any. - -=back - -=head1 DESCRIPTION - -Show all zaptel hardware devices. Devices are recognized according to -lists of PCI and USB IDs in Zaptel::Hardware::PCI.pm and -Zaptel::Hardware::USB.pm . For PCI it is possible to detect by -sub-vendor and sub-product ID as well. - -The first output column is the connector: a bus specific field that -shows where this device is. - -The second field shows which driver should handle the device. a "-" sign -marks that the device is not yet handled by this driver. A "+" sign -means that the device is handled by the driver. - -For the Xorcom Astribank (and in the future: for other Zaptel devices) -some further information is provided from the driver. Those extra lines -always begin with spaces. - -Example output: - -Without drivers loaded: - - usb:001/002 xpp_usb- e4e4:1152 Astribank-multi FPGA-firmware - usb:001/003 xpp_usb- e4e4:1152 Astribank-multi FPGA-firmware - pci:0000:01:0b.0 wctdm- e159:0001 Wildcard TDM400P REV H - -With drivers loaded, without -v: - usb:001/002 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware - usb:001/003 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware - pci:0000:01:0b.0 wctdm+ e159:0001 Wildcard TDM400P REV E/F - -With drivers loaded, with -v: - usb:001/002 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware - LABEL=[usb:123] CONNECTOR=usb-0000:00:1d.7-1 - XBUS-00/XPD-00: FXS Span 2 - XBUS-00/XPD-10: FXS Span 3 - XBUS-00/XPD-20: FXS Span 4 - XBUS-00/XPD-30: FXS Span 5 - usb:001/003 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware - LABEL=[usb:4567] CONNECTOR=usb-0000:00:1d.7-4 - XBUS-01/XPD-00: FXS Span 6 XPP-SYNC - XBUS-01/XPD-10: FXO Span 7 - XBUS-01/XPD-20: FXO Span 8 - XBUS-01/XPD-30: FXO Span 9 - pci:0000:01:0b.0 wctdm+ e159:0001 Wildcard TDM400P REV E/F - diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel.pm deleted file mode 100644 index d8147174..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel.pm +++ /dev/null @@ -1,68 +0,0 @@ -package Zaptel; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Zaptel.pm 4534 2008-09-09 18:24:17Z tzafrir $ -# -use strict; -use Zaptel::Span; - -=head1 NAME - -Zaptel - Perl interface to Zaptel information - -This package allows access from Perl to information about Zaptel -hardware and loaded Zaptel devices. - -=head1 SYNOPSIS - - # Listing channels in analog spans: - use Zaptel; - # scans system: - my @spans = Zaptel::spans(); - for my $span (@spans) { - next if ($span->is_digital); - $span->num. " - [". $span->type ."] ". $span->name. "\n"; - for my $chan ($span->chans) { - print " - ".$chan->num . " - [". $chan->type. "] ". $chan->fqn". \n"; - } - } -=cut - -my $proc_base = "/proc/zaptel"; - -=head1 spans() - -Returns a list of span objects, ordered by span number. - -=cut - -sub spans() { - my @spans; - - -d $proc_base or return (); - foreach my $zfile (glob "$proc_base/*") { - $zfile =~ s:$proc_base/::; - my $span = Zaptel::Span->new($zfile); - push(@spans, $span); - } - @spans = sort { $a->num <=> $b->num } @spans; - return @spans; -} - -=head1 SEE ALSO - -Span objects: L. - -Zaptel channels objects: L. - -Zaptel hardware devices information: L. - -Xorcom Astribank -specific information: L. - -=cut - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Chans.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Chans.pm deleted file mode 100644 index d8b29047..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Chans.pm +++ /dev/null @@ -1,255 +0,0 @@ -package Zaptel::Chans; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Chans.pm 4514 2008-09-08 20:40:05Z tzafrir $ -# -use strict; -use Zaptel::Utils; - -=head1 NAME - -Zaptel::Chans - Perl interface to a Zaptel channel information - -This package allows access from perl to information about a Zaptel -channel. It is part of the Zaptel Perl package. - -=head1 alarms() - -In an array context returns a list of alarm strings (RED, BLUE, etc.) -for this channel (an empty list == false if there are no alarms). -In scalar context returns the number of alarms for a specific channel. - -=head1 battery() - -Returns 1 if channel reports to have battery (A remote PBX connected to -an FXO port), 0 if channel reports to not have battery and C -otherwise. - -Currently only wcfxo and Astribank FXO modules report battery. For the -rest of the channels - -=head1 fqn() - -(Fully Qualified Name) Returns the full "name" of the channel. - -=head1 index() - -Returns the number of this channel (in the span). - -=head1 num() - -Returns the number of this channel as a Zaptel channel. - -=head signalling() - -Returns the signalling set for this channel through /etc/zaptel.conf . -This is always empty before ztcfg was run. And shows the "other" type -for FXS and for FXO. - -=head1 span() - -Returns a reference to the span to which this channel belongs. - -=head1 type() - -Returns the type of the channel: 'FXS', 'FXO', 'EMPTY', etc. - -=cut - -my @alarm_types = qw(BLUE YELLOW RED LOOP RECOVERING NOTOPEN); - -# Taken from zaptel-base.c -my @sigtypes = ( - "FXSLS", - "FXSKS", - "FXSGS", - "FXOLS", - "FXOKS", - "FXOGS", - "E&M", - "E&M-E1", - "Clear", - "HDLCRAW", - "HDLCFCS", - "HDLCNET", - "Hardware-assisted HDLC", - "Slave", - "CAS", - "DACS", - "DACS+RBS", - "SF (ToneOnly)", - "Unconfigured" - ); - -sub new($$$$$$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $span = shift or die "Missing a span parameter\n"; - my $index = shift; - my $line = shift or die "Missing an input line\n"; - defined $index or die "Missing an index parameter\n"; - my $self = { - 'SPAN' => $span, - 'INDEX' => $index, - }; - bless $self, $pack; - my ($num, $fqn, $rest) = split(/\s+/, $line, 3); - $num or die "Missing a channel number parameter\n"; - $fqn or die "Missing a channel fqn parameter\n"; - my $signalling = ''; - my @alarms = (); - my $info = ''; - if(defined $rest) { - # remarks in parenthesis (In use), (no pcm) - while($rest =~ s/\s*(\([^)]+\))\s*/ /) { - $info .= " $1"; - } - # Alarms - foreach my $alarm (@alarm_types) { - if($rest =~ s/\s*(\b${alarm}\b)\s*/ /) { - push(@alarms, $1); - } - } - foreach my $sig (@sigtypes) { - if($rest =~ s/^\Q$sig\E/ /) { - $signalling = $sig; - last; - } - } - warn "Unrecognized garbage '$rest' in $fqn\n" - if $rest =~ /\S/; - } - $self->{NUM} = $num; - $self->{FQN} = $fqn; - $self->{SIGNALLING} = $signalling; - $self->{ALARMS} = \@alarms; - $self->{INFO} = $info; - my $type; - if($fqn =~ m|\bXPP_(\w+)/.*$|) { - $type = $1; # An Astribank - } elsif ($fqn =~ m{\bWCFXO/.*}) { - $type = "FXO"; # wcfxo - x100p and relatives. - # A single port card. The driver issue RED alarm when - # There's no better - $self->{BATTERY} = !($span->description =~ /\bRED\b/); - } elsif ($fqn =~ m{\bFXS/.*}) { - $type = "FXS"; # likely Rhino - } elsif ($fqn =~ m{\bFXO/.*}) { - $type = "FXO"; # likely Rhino - } elsif ($fqn =~ m{\b---/.*}) { - $type = "EMPTY"; # likely Rhino, empty slot. - } elsif ($fqn =~ m{\b(TE[24]|WCT1|Tor2|TorISA|WP[TE]1|cwain[12])/.*}) { - # TE[24]: Digium wct4xxp - # WCT1: Digium single span card drivers? - # Tor2: Tor PCI cards - # TorISA: ISA ones (still used?) - # WP[TE]1: Sangoma. TODO: this one tells us if it is TE or NT. - # cwain: Junghanns E1 card. - $type = "PRI"; - } elsif ($fqn =~ m{\b(ZTHFC%d*|ztqoz\d*)/.*}) { - # ZTHFC: HFC-s single-port card (zaphfc/vzaphfc) - # ztqoz: qozap (Junghanns) multi-port HFC card - $type = "BRI"; - } elsif ($fqn =~ m{\bztgsm/.*}) { - # Junghanns GSM card - $type = "GSM"; - } elsif(defined $signalling) { - $type = 'FXO' if $signalling =~ /^FXS/; - $type = 'FXS' if $signalling =~ /^FXO/; - } else { - $type = undef; - } - $self->type($type); - $self->span()->type($type) - if ! defined($self->span()->type()) || - $self->span()->type() eq 'UNKNOWN'; - return $self; -} - -=head1 probe_type() - -In the case of some cards, the information in /proc/zaptel is not good -enough to tell the type of each channel. In this case an extra explicit -probe is needed. - -Currently this is implemented by using some invocations of ztcfg(8). - -It may later be replaced by ztscan(8). - -=cut - -my $ztcfg = $ENV{ZTCFG} || '/sbin/ztcfg'; -sub probe_type($) { - my $self = shift; - my $fqn = $self->fqn; - my $num = $self->num; - my $type; - - if($fqn =~ m:WCTDM/| WRTDM/|OPVXA1200/:) { - my %maybe; - - undef %maybe; - foreach my $sig (qw(fxo fxs)) { - my $cmd = "echo ${sig}ks=$num | $ztcfg -c /dev/fd/0"; - - $maybe{$sig} = system("$cmd >/dev/null 2>&1") == 0; - } - if($maybe{fxo} and $maybe{fxs}) { - $type = 'EMPTY'; - } elsif($maybe{fxo}) { - $type = 'FXS'; - } elsif($maybe{fxs}) { - $type = 'FXO'; - } else { - $type = 'EMPTY'; - } - } else { - $type = $self->type; - } - return $type; -} - -sub battery($) { - my $self = shift or die; - my $span = $self->span or die; - - return undef if (not defined $self->type); - return undef unless $self->type eq 'FXO'; - return $self->{BATTERY} if defined $self->{BATTERY}; - - my $xpd = $span->xpd; - my $index = $self->index; - return undef if !$xpd; - - # It's an XPD (FXO) - my @lines = @{$xpd->lines}; - my $line = $lines[$index]; - return $line->battery; -} - -sub alarms($) { - my $self = shift or die; - my @alarms = @{$self->{ALARMS}}; - - return @alarms; -} - -sub blink($$) { - my $self = shift or die; - my $on = shift; - my $span = $self->span or die; - - my $xpd = $span->xpd; - my $index = $self->index; - return undef if !$xpd; - - my @lines = @{$xpd->lines}; - my $line = $lines[$index]; - return $line->blink($on); -} - - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm deleted file mode 100644 index dc2c170d..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm +++ /dev/null @@ -1,56 +0,0 @@ -package Zaptel::Config::Defaults; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Defaults.pm 4187 2008-04-21 21:27:59Z tzafrir $ -# -use strict; - -# Use the shell to source a file and expand a given list -# of variables. -sub do_source($@) { - my $file = shift; - my @vars = @_; - my @output = `env -i sh -ec '. $file; export @vars; for i in @vars; do eval echo \$i=\\\$\$i; done'`; - die "$0: Sourcing '$file' exited with $?" if $?; - my %vars; - - foreach my $line (@output) { - chomp $line; - my ($k, $v) = split(/=/, $line, 2); - $vars{$k} = $v if grep /^$k$/, @vars; - } - return %vars; -} - -sub source_vars { - my @vars = @_; - my $default_file; - my %system_files = ( - "/etc/default/zaptel" => 'Debian and friends', - "/etc/sysconfig/zaptel" => 'Red Hat and friends', - ); - - if(defined $ENV{ZAPTEL_DEFAULTS}) { - $default_file = $ENV{ZAPTEL_DEFAULTS}; - } else { - foreach my $f (keys %system_files) { - if(-r $f) { - if(defined $default_file) { - die "An '$f' collides with '$default_file'"; - } - $default_file = $f; - } - } - } - if (! $default_file) { - return ("", ()); - } - my %vars = Zaptel::Config::Defaults::do_source($default_file, @vars); - return ($default_file, %vars); -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware.pm deleted file mode 100644 index 24090889..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware.pm +++ /dev/null @@ -1,168 +0,0 @@ -package Zaptel::Hardware; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Hardware.pm 4039 2008-03-21 01:51:39Z tzafrir $ -# -use strict; -use Zaptel::Hardware::USB; -use Zaptel::Hardware::PCI; - -=head1 NAME - -Zaptel::Hardware - Perl interface to a Zaptel devices listing - - - use Zaptel::Hardware; - - my $hardware = Zaptel::Hardware->scan; - - # mini zaptel_hardware: - foreach my $device ($hardware->device_list) { - print "Vendor: device->{VENDOR}, Product: $device->{PRODUCT}\n" - } - - # let's see if there are devices without loaded drivers, and sugggest - # drivers to load: - my @to_load = (); - foreach my $device ($hardware->device_list) { - if (! $device->{LOADED} ) { - push @to_load, ($device->${DRIVER}); - } - } - if (@to_load) { - print "To support the extra devices you probably need to run:\n" - print " modprobe ". (join ' ', @to_load). "\n"; - } - - -This module provides information about available Zaptel devices on the -system. It identifies devices by (USB/PCI) bus IDs. - - -=head1 Device Attributes -As usual, object attributes can be used in either upp-case or -lower-case, or lower-case functions. - -=head2 bus_type - -'PCI' or 'USB'. - - -=head2 description - -A one-line description of the device. - - -=head2 driver - -Name of a Zaptel device driver that should handle this device. This is -based on a pre-made list. - - -=head2 vendor, product, subvendor, subproduct - -The PCI and USB vendor ID, product ID, sub-vendor ID and sub-product ID. -(The standard short lspci and lsusb listings show only vendor and -product IDs). - - -=head2 loaded - -If the device is handled by a module - the name of the module. Else - -undef. - - -=head2 priv_device_name - -A string that shows the "location" of that device on the bus. - - -=head2 is_astribank - -True if the device is a Xorcom Astribank (which may provide some extra -attributes). - -=head2 serial - -(Astribank-specific attrribute) - the serial number string of the -Astribank. - -=cut - -sub device_detected($$) { - my $dev = shift || die; - my $name = shift || die; - die unless defined $dev->{'BUS_TYPE'}; - $dev->{IS_ASTRIBANK} = 0 unless defined $dev->{'IS_ASTRIBANK'}; - $dev->{'HARDWARE_NAME'} = $name; -} - -sub device_removed($) { - my $dev = shift || die; - my $name = $dev->hardware_name; - die "Missing zaptel device hardware name" unless $name; -} - - -=head1 device_list() - -Returns a list of the hardware devices on the system. - -You must run scan() first for this function to run meaningful output. - -=cut - -sub device_list($) { - my $self = shift || die; - my @types = @_; - my @list; - - @types = qw(USB PCI) unless @types; - foreach my $t (@types) { - @list = ( @list, @{$self->{$t}} ); - } - return @list; -} - - -=head1 drivers() - -Returns a list of drivers (currently sorted by name) that are used by -the devices in the current system (regardless to whether or not they are -loaded. - -=cut - -sub drivers($) { - my $self = shift || die; - my @devs = $self->device_list; - my @drvs = map { $_->{DRIVER} } @devs; - # Make unique - my %drivers; - @drivers{@drvs} = 1; - return sort keys %drivers; -} - - -=head1 scan() - -Scan the system for Zaptel devices (PCI and USB). Returns nothing but -must be run to initialize the module. - -=cut - -sub scan($) { - my $pack = shift || die; - my $self = {}; - bless $self, $pack; - - $self->{USB} = [ Zaptel::Hardware::USB->devices ]; - $self->{PCI} = [ Zaptel::Hardware::PCI->scan_devices ]; - return $self; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm deleted file mode 100644 index 32bc570b..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm +++ /dev/null @@ -1,211 +0,0 @@ -package Zaptel::Hardware::PCI; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: PCI.pm 4456 2008-08-04 15:52:49Z tzafrir $ -# -use strict; -use Zaptel::Utils; -use Zaptel::Hardware; - -our @ISA = qw(Zaptel::Hardware); - -# Lookup algorithm: -# First match 'vendor:product/subvendor:subproduct' key -# Else match 'vendor:product/subvendor' key -# Else match 'vendor:product' key -# Else not a zaptel hardware. -my %pci_ids = ( - # from wct4xxp - '10ee:0314' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P/TE405P (1st Gen)' }, - 'd161:0420/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE420 (4th Gen)' }, - 'd161:0410/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P (4th Gen)' }, - 'd161:0405/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE405P (4th Gen)' }, - 'd161:0410/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P (3rd Gen)' }, - 'd161:0405/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE405P (3rd Gen)' }, - 'd161:0410' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P (2nd Gen)' }, - 'd161:0405' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE405P (2nd Gen)' }, - 'd161:0220/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE220 (4th Gen)' }, - 'd161:0205/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P (4th Gen)' }, - 'd161:0210/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P (4th Gen)' }, - 'd161:0205/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P (3rd Gen)' }, - 'd161:0210/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P (3rd Gen)' }, - 'd161:0205' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P ' }, - 'd161:0210' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P ' }, - - # from wctdm24xxp - 'd161:2400' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM2400P' }, - 'd161:0800' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM800P' }, - 'd161:8002' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX800' }, - 'd161:8003' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX2400' }, - 'd161:8005' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM410P' }, - 'd161:8006' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX410P' }, - - # from pciradio - 'e159:0001/e16b' => { DRIVER => 'pciradio', DESCRIPTION => 'PCIRADIO' }, - - # from wcfxo - 'e159:0001/8084' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P clone' }, - 'e159:0001/8085' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P' }, - 'e159:0001/8086' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P clone' }, - 'e159:0001/8087' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P clone' }, - '1057:5608' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X100P' }, - - # from wct1xxp - 'e159:0001/6159' => { DRIVER => 'wct1xxp', DESCRIPTION => 'Digium Wildcard T100P T1/PRI or E100P E1/PRA Board' }, - - # from wctdm - 'e159:0001/a159' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard S400P Prototype' }, - 'e159:0001/e159' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard S400P Prototype' }, - 'e159:0001/b100' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV E/F' }, - 'e159:0001/b1d9' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV I' }, - 'e159:0001/b118' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV I' }, - 'e159:0001/b119' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV I' }, - 'e159:0001/a9fd' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - 'e159:0001/a8fd' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - 'e159:0001/a800' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - 'e159:0001/a801' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - 'e159:0001/a908' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - 'e159:0001/a901' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - #'e159:0001' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, - - # from wcte11xp - 'e159:0001/71fe' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, - 'e159:0001/79fe' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, - 'e159:0001/795e' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, - 'e159:0001/79de' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, - 'e159:0001/797e' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, - - # from wcte12xp - 'd161:0120' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE12xP' }, - 'd161:8000' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE121' }, - 'd161:8001' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE122' }, - - # from tor2 - '10b5:9030' => { DRIVER => 'tor2', DESCRIPTION => 'PLX 9030' }, - '10b5:3001' => { DRIVER => 'tor2', DESCRIPTION => 'PLX Development Board' }, - '10b5:D00D' => { DRIVER => 'tor2', DESCRIPTION => 'Tormenta 2 Quad T1/PRI or E1/PRA' }, - '10b5:4000' => { DRIVER => 'tor2', DESCRIPTION => 'Tormenta 2 Quad T1/E1 (non-Digium clone)' }, - - # Cologne Chips: - # (Still a partial list) - '1397:08b4/b556' => { DRIVER => 'qozap', DESCRIPTION => 'Junghanns DuoBRI ISDN card' }, - '1397:08b4' => { DRIVER => 'qozap', DESCRIPTION => 'Junghanns QuadBRI ISDN card' }, - '1397:16b8' => { DRIVER => 'qozap', DESCRIPTION => 'Junghanns OctoBRI ISDN card' }, - '1397:30b1' => { DRIVER => 'cwain', DESCRIPTION => 'HFC-E1 ISDN E1 card' }, - '1397:2bd0' => { DRIVER => 'zaphfc', DESCRIPTION => 'HFC-S ISDN BRI card' }, - '1397:f001' => { DRIVER => 'ztgsm', DESCRIPTION => 'HFC-GSM Cologne Chips GSM' }, - - # Rhino cards (based on pci.ids) - '0b0b:0105' => { DRIVER => 'r1t1', DESCRIPTION => 'Rhino R1T1' }, - '0b0b:0205' => { DRIVER => 'r4fxo', DESCRIPTION => 'Rhino R14FXO' }, - '0b0b:0206' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB4FXO 4-channel FXO analog telphony card' }, - '0b0b:0305' => { DRIVER => 'r1t1', DESCRIPTION => 'Rhino R1T1' }, - '0b0b:0405' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R8FXX' }, - '0b0b:0406' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB8FXX 8-channel modular analog telphony card' }, - '0b0b:0505' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R24FXX' }, - '0b0b:0506' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB24FXS 24-Channel FXS analog telphony card' }, - '0b0b:0605' => { DRIVER => 'rxt1', DESCRIPTION => 'Rhino R2T1' }, - '0b0b:0705' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R24FXS' }, - '0b0b:0706' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB24FXO 24-Channel FXO analog telphony card' }, - '0b0b:0906' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB24FXX 24-channel modular analog telphony card' }, - - # Sangoma cards (based on pci.ids) - '1923:0040' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A200/Remora FXO/FXS Analog AFT card' }, - '1923:0100' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A104d QUAD T1/E1 AFT card' }, - '1923:0300' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A101 single-port T1/E1' }, - '1923:0400' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A104u Quad T1/E1 AFT' }, - - # Yeastar (from output of modinfo): - 'e159:0001/2151' => { DRIVER => 'ystdm8xx', DESCRIPTION => 'Yeastar YSTDM8xx'}, - ); - -$ENV{PATH} .= ":/usr/sbin:/sbin:/usr/bin:/bin"; - -sub pci_sorter { - return $a->priv_device_name() cmp $b->priv_device_name(); -} - -sub new($$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $self = { @_ }; - bless $self, $pack; - Zaptel::Hardware::device_detected($self, - sprintf("pci:%s", $self->{PRIV_DEVICE_NAME})); - return $self; -} - -my %pci_devs; - -sub readfile($) { - my $name = shift || die; - open(F, $name) || die "Failed to open '$name': $!"; - my $str = ; - close F; - chomp($str); - return $str; -} - -sub scan_devices($) { - my @devices; - - while() { - m,([^/]+)$,,; - my $name = $1; - my $l = readlink $_ || die; - $pci_devs{$name}{PRIV_DEVICE_NAME} = $name; - $pci_devs{$name}{DEVICE} = $l; - $pci_devs{$name}{VENDOR} = readfile "$_/vendor"; - $pci_devs{$name}{PRODUCT} = readfile "$_/device"; - $pci_devs{$name}{SUBVENDOR} = readfile "$_/subsystem_vendor"; - $pci_devs{$name}{SUBPRODUCT} = readfile "$_/subsystem_device"; - my $dev = $pci_devs{$name}; - grep(s/0x//, $dev->{VENDOR}, $dev->{PRODUCT}, $dev->{SUBVENDOR}, $dev->{SUBPRODUCT}); - $pci_devs{$name}{DRIVER} = ''; - } - - while() { - m,^(.*?)/([^/]+)/([^/]+)$,; - my $prefix = $1; - my $drvname = $2; - my $id = $3; - my $l = readlink "$prefix/$drvname/module"; - # Find the real module name (if we can). - if(defined $l) { - my $moduledir = "$prefix/$drvname/$l"; - my $modname = $moduledir; - $modname =~ s:^.*/::; - $drvname = $modname; - } - $pci_devs{$id}{LOADED} = $drvname; - } - foreach (sort keys %pci_devs) { - my $dev = $pci_devs{$_}; - my $key; - # Try to match - $key = "$dev->{VENDOR}:$dev->{PRODUCT}/$dev->{SUBVENDOR}:$dev->{SUBPRODUCT}"; - $key = "$dev->{VENDOR}:$dev->{PRODUCT}/$dev->{SUBVENDOR}" if !defined($pci_ids{$key}); - $key = "$dev->{VENDOR}:$dev->{PRODUCT}" if !defined($pci_ids{$key}); - next unless defined $pci_ids{$key}; - - my $d = Zaptel::Hardware::PCI->new( - BUS_TYPE => 'PCI', - PRIV_DEVICE_NAME => $dev->{PRIV_DEVICE_NAME}, - VENDOR => $dev->{VENDOR}, - PRODUCT => $dev->{PRODUCT}, - SUBVENDOR => $dev->{SUBVENDOR}, - SUBPRODUCT => $dev->{SUBPRODUCT}, - LOADED => $dev->{LOADED}, - DRIVER => $pci_ids{$key}{DRIVER}, - DESCRIPTION => $pci_ids{$key}{DESCRIPTION}, - ); - push(@devices, $d); - } - @devices = sort pci_sorter @devices; - return @devices; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/USB.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/USB.pm deleted file mode 100644 index 32c4c9b3..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Hardware/USB.pm +++ /dev/null @@ -1,116 +0,0 @@ -package Zaptel::Hardware::USB; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: USB.pm 3793 2008-02-04 23:00:48Z tzafrir $ -# -use strict; -use Zaptel::Utils; -use Zaptel::Hardware; -use Zaptel::Xpp; -use Zaptel::Xpp::Xbus; - -our @ISA = qw(Zaptel::Hardware); - -my %usb_ids = ( - # from wcusb - '06e6:831c' => { DRIVER => 'wcusb', DESCRIPTION => 'Wildcard S100U USB FXS Interface' }, - '06e6:831e' => { DRIVER => 'wcusb2', DESCRIPTION => 'Wildcard S110U USB FXS Interface' }, - '06e6:b210' => { DRIVER => 'wc_usb_phone', DESCRIPTION => 'Wildcard Phone Test driver' }, - - # from xpp_usb - 'e4e4:1130' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-8/16 no-firmware' }, - 'e4e4:1131' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-8/16 USB-firmware' }, - 'e4e4:1132' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-8/16 FPGA-firmware' }, - 'e4e4:1140' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-BRI no-firmware' }, - 'e4e4:1141' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-BRI USB-firmware' }, - 'e4e4:1142' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-BRI FPGA-firmware' }, - 'e4e4:1150' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi no-firmware' }, - 'e4e4:1151' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi USB-firmware' }, - 'e4e4:1152' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi FPGA-firmware' }, - 'e4e4:1160' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular no-firmware' }, - 'e4e4:1161' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular USB-firmware' }, - 'e4e4:1162' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular FPGA-firmware' }, - ); - - -$ENV{PATH} .= ":/usr/sbin:/sbin:/usr/bin:/bin"; - -my @xbuses = Zaptel::Xpp::xbuses('SORT_CONNECTOR'); - -sub usb_sorter() { - return $a->hardware_name cmp $b->hardware_name; -} - -sub xbus_of_usb($) { - my $priv_device_name = shift; - my $dev = shift; - - my ($wanted) = grep { - defined($_->usb_devname) && - $priv_device_name eq $_->usb_devname - } @xbuses; - return $wanted; -} - -sub new($$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $self = { @_ }; - bless $self, $pack; - my $xbus = xbus_of_usb($self->priv_device_name); - if(defined $xbus) { - $self->{XBUS} = $xbus; - $self->{LOADED} = 'xpp_usb'; - } else { - $self->{XBUS} = undef; - $self->{LOADED} = undef; - } - Zaptel::Hardware::device_detected($self, - sprintf("usb:%s", $self->{PRIV_DEVICE_NAME})); - return $self; -} - -sub devices($) { - my $pack = shift || die; - my $usb_device_list = "/proc/bus/usb/devices"; - return unless (-r $usb_device_list); - - my @devices; - open(F, $usb_device_list) || die "Failed to open $usb_device_list: $!"; - local $/ = ''; - while() { - my @lines = split(/\n/); - my ($tline) = grep(/^T/, @lines); - my ($pline) = grep(/^P/, @lines); - my ($sline) = grep(/^S:.*SerialNumber=/, @lines); - my ($busnum,$devnum) = ($tline =~ /Bus=(\w+)\W.*Dev#=\s*(\w+)\W/); - my $devname = sprintf("%03d/%03d", $busnum, $devnum); - my ($vendor,$product) = ($pline =~ /Vendor=(\w+)\W.*ProdID=(\w+)\W/); - my $serial; - if(defined $sline) { - $sline =~ /SerialNumber=(.*)/; - $serial = $1; - #$serial =~ s/[[:^print:]]/_/g; - } - my $model = $usb_ids{"$vendor:$product"}; - next unless defined $model; - my $d = Zaptel::Hardware::USB->new( - IS_ASTRIBANK => ($model->{DRIVER} eq 'xpp_usb')?1:0, - BUS_TYPE => 'USB', - PRIV_DEVICE_NAME => $devname, - VENDOR => $vendor, - PRODUCT => $product, - SERIAL => $serial, - DESCRIPTION => $model->{DESCRIPTION}, - DRIVER => $model->{DRIVER}, - ); - push(@devices, $d); - } - close F; - @devices = sort usb_sorter @devices; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Span.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Span.pm deleted file mode 100644 index 14bfb032..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Span.pm +++ /dev/null @@ -1,300 +0,0 @@ -package Zaptel::Span; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Span.pm 4309 2008-05-20 14:54:58Z tzafrir $ -# -use strict; -use Zaptel::Utils; -use Zaptel::Chans; -use Zaptel::Xpp::Xpd; - -=head1 NAME - -Zaptel::Spans - Perl interface to a Zaptel span information - -This package allows access from perl to information about a Zaptel -channel. It is part of the Zaptel Perl package. - -A span is a logical unit of Zaptel channels. Normally a port in a -digital card or a whole analog card. - -See documentation of module L for usage example. Specifically -C must be run initially. - -=head1 by_number() - -Get a span by its Zaptel span number. - -=head1 Span Properties - -=head2 num() - -The span number. - -=head2 name() - -The name field of a Zaptel span. E.g.: - - TE2/0/1 - -=head2 description() - -The description field of the span. e.g: - - "T2XXP (PCI) Card 0 Span 1" HDB3/CCS/CRC4 RED - -=head2 chans() - -The list of the channels (L objects) of this span. -In a scalar context returns the number of channels this span has. - -=head2 bchans() - -Likewise a list of bchannels (or a count in a scalar context). - -=head2 is_sync_master() - -Is this span the source of timing for Zaptel? - -=head2 type() - -Type of span, or "UNKNOWN" if could not be detected. Current known -types: - -BRI_TE, BRI_NT, E1_TE, E1_NT, J1_TE, J1_NT, T1_TE, T1_NT, FXS, FXO - -=head2 is_pri() - -Is this an E1/J1/T1 span? - -=head2 is_bri() - -Is this a BRI span? - -=head2 is_digital() - -Is this a digital (as opposed to analog) span? - -=head2 termtype() - -Set for digital spans. "TE" or "NT". Will probably be assumed to be "TE" -if there's no information pointing either way. - -=head2 coding() - -Suggested sane coding type (e.g.: "hdb3", "b8zs") for this type of span. - -=head2 framing() - -Suggested sane framing type (e.g.: "ccs", "esf") for this type of span. - -=head2 yellow(), crc4() - -Likewise, suggestions ofr the respective fields in the span= line in -zaptel.conf for this span. - -=head2 signalling() - -Suggested zapata.conf signalling for channels of this span. - -=head2 switchtype() - -Suggested zapata.conf switchtype for channels of this span. - -=head1 Note - -Most of those properties are normally used as lower-case functions, but -actually set in the module as capital-letter propeties. To look at e.g. -"signalling" is set, look for "SIGNALLING". - -=cut - -my $proc_base = "/proc/zaptel"; - -sub chans($) { - my $span = shift; - return @{$span->{CHANS}}; -} - -sub by_number($) { - my $span_number = shift; - die "Missing span number" unless defined $span_number; - my @spans = Zaptel::spans(); - - my ($span) = grep { $_->num == $span_number } @spans; - return $span; -} - -my @bri_strings = ( - 'BRI_(NT|TE)', - '(?:quad|octo)BRI PCI ISDN Card.* \[(NT|TE)\]\ ', - 'octoBRI \[(NT|TE)\] ', - 'HFC-S PCI A ISDN.* \[(NT|TE)\] ' - ); - -my @pri_strings = ( - '(E1|T1|J1)_(NT|TE)', - 'Tormenta 2 .*Quad (E1|T1)', # tor2. - 'Digium Wildcard .100P (T1|E1)/', # wct1xxp - 'ISA Tormenta Span 1', # torisa - 'TE110P T1/E1', # wcte11xp - 'Wildcard TE120P', # wcte12xp - 'Wildcard TE121', # wcte12xp - 'Wildcard TE122', # wcte12xp - 'T[24]XXP \(PCI\) Card ', # wct4xxp - ); - -our $ZAPBRI_NET = 'bri_net'; -our $ZAPBRI_CPE = 'bri_cpe'; - -our $ZAPPRI_NET = 'pri_net'; -our $ZAPPRI_CPE = 'pri_cpe'; - -sub init_proto($$) { - my $self = shift; - my $proto = shift; - - $self->{PROTO} = $proto; - if($proto eq 'E1') { - $self->{DCHAN_IDX} = 15; - $self->{BCHAN_LIST} = [ 0 .. 14, 16 .. 30 ]; - } elsif($proto eq 'T1') { - $self->{DCHAN_IDX} = 23; - $self->{BCHAN_LIST} = [ 0 .. 22 ]; - } - $self->{TYPE} = "${proto}_$self->{TERMTYPE}"; -} - -sub new($$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $num = shift or die "Missing a span number parameter\n"; - my $self = { NUM => $num }; - bless $self, $pack; - $self->{TYPE} = "UNKNOWN"; - my @xpds = Zaptel::Xpp::Xpd::xpds_by_spanno; - my $xpd = $xpds[$num]; - if(defined $xpd) { - die "Spanno mismatch: $xpd->spanno, $num" unless $xpd->spanno == $num; - $self->{XPD} = $xpd; - } - open(F, "$proc_base/$num") or die "Failed to open '$proc_base/$num\n"; - my $head = ; - chomp $head; - $self->{IS_DIGITAL} = 0; - $self->{IS_BRI} = 0; - $self->{IS_PRI} = 0; - foreach my $cardtype (@bri_strings) { - if($head =~ m/$cardtype/) { - $self->{IS_DIGITAL} = 1; - $self->{IS_BRI} = 1; - $self->{TERMTYPE} = $1; - $self->{TYPE} = "BRI_$1"; - $self->{DCHAN_IDX} = 2; - $self->{BCHAN_LIST} = [ 0, 1 ]; - last; - } - } - foreach my $cardtype (@pri_strings) { - if($head =~ m/$cardtype/) { - my @info; - - push(@info, $1) if defined $1; - push(@info, $2) if defined $2; - my ($proto) = grep(/(E1|T1|J1)/, @info); - $proto = 'UNKNOWN' unless defined $proto; - my ($termtype) = grep(/(NT|TE)/, @info); - $termtype = 'TE' unless defined $termtype; - - $self->{IS_DIGITAL} = 1; - $self->{IS_PRI} = 1; - $self->{TERMTYPE} = $termtype; - $self->init_proto($proto); - last; - } - } - die "$0: Unkown TERMTYPE [NT/TE]\n" - if $self->is_digital and !defined $self->{TERMTYPE}; - ($self->{NAME}, $self->{DESCRIPTION}) = (split(/\s+/, $head, 4))[2, 3]; - $self->{IS_ZAPTEL_SYNC_MASTER} = - ($self->{DESCRIPTION} =~ /\(MASTER\)/) ? 1 : 0; - $self->{CHANS} = []; - my @channels; - my $index = 0; - while() { - chomp; - s/^\s*//; - s/\s*$//; - next unless /\S/; - next unless /^\s*\d+/; # must be a real channel string. - my $c = Zaptel::Chans->new($self, $index, $_); - push(@channels, $c); - $index++; - } - close F; - if($self->is_pri()) { - # Check for PRI with unknown type strings - if($index == 31) { - if($self->{PROTO} eq 'UNKNOWN') { - $self->init_proto('E1'); - } elsif($self->{PROTO} ne 'E1') { - die "$index channels in a $self->{PROTO} span"; - } - } elsif($index == 24) { - if($self->{PROTO} eq 'UNKNOWN') { - $self->init_proto('T1'); # FIXME: J1? - } elsif($self->{PROTO} ne 'T1') { - die "$index channels in a $self->{PROTO} span"; - } - } - } - @channels = sort { $a->num <=> $b->num } @channels; - $self->{CHANS} = \@channels; - $self->{YELLOW} = undef; - $self->{CRC4} = undef; - if($self->is_bri()) { - $self->{CODING} = 'ami'; - $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}]; - $self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ]; - # Infer some info from channel name: - my $first_chan = ($self->chans())[0] || die "$0: No channels in span #$num\n"; - my $chan_fqn = $first_chan->fqn(); - if($chan_fqn =~ m(ZTHFC.*/|ztqoz.*/|XPP_BRI_.*/)) { # BRI - $self->{FRAMING} = 'ccs'; - $self->{SWITCHTYPE} = 'euroisdn'; - $self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $ZAPBRI_NET : $ZAPBRI_CPE ; - } elsif($chan_fqn =~ m(ztgsm.*/)) { # Junghanns's GSM cards. - $self->{FRAMING} = 'ccs'; - $self->{SIGNALLING} = 'gsm'; - } - } - if($self->is_pri()) { - $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}]; - $self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ]; - if($self->{PROTO} eq 'E1') { - $self->{CODING} = 'hdb3'; - $self->{FRAMING} = 'ccs'; - $self->{SWITCHTYPE} = 'euroisdn'; - $self->{CRC4} = 'crc4'; - } elsif($self->{PROTO} eq 'T1') { - $self->{CODING} = 'b8zs'; - $self->{FRAMING} = 'esf'; - $self->{SWITCHTYPE} = 'national'; - } else { - die "'$self->{PROTO}' unsupported yet"; - } - $self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $ZAPPRI_NET : $ZAPPRI_CPE ; - } - return $self; -} - -sub bchans($) { - my $self = shift || die; - - return @{$self->{BCHANS}}; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Utils.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Utils.pm deleted file mode 100644 index 8d13ad70..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Utils.pm +++ /dev/null @@ -1,52 +0,0 @@ -package Zaptel::Utils; - -# Accessors (miniperl does not have Class:Accessor) -our $AUTOLOAD; -sub AUTOLOAD { - my $self = shift; - my $name = $AUTOLOAD; - $name =~ s/.*://; # strip fully-qualified portion - return if $name =~ /^[A-Z_]+$/; # ignore special methods (DESTROY) - my $key = uc($name); - my $val = shift; - if (defined $val) { - #print STDERR "set: $key = $val\n"; - return $self->{$key} = $val; - } else { - if(!exists $self->{$key}) { - #$self->xpp_dump; - #die "Trying to get uninitialized '$key'"; - } - my $val = $self->{$key}; - #print STDERR "get: $key ($val)\n"; - return $val; - } -} - -sub xpp_dump($) { - my $self = shift || die; - printf STDERR "Dump a %s\n", ref($self); - foreach my $k (sort keys %{$self}) { - my $val = $self->{$k}; - $val = '**UNDEF**' if !defined $val; - printf STDERR " %-20s %s\n", $k, $val; - } -} - -# Based on Autoloader - -sub import { - my $pkg = shift; - my $callpkg = caller; - - #print STDERR "import: $pkg, $callpkg\n"; - # - # Export symbols, but not by accident of inheritance. - # - die "Sombody inherited Zaptel::Utils" if $pkg ne 'Zaptel::Utils'; - no strict 'refs'; - *{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD; - *{ $callpkg . '::xpp_dump' } = \&xpp_dump; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp.pm deleted file mode 100644 index 3e3e2977..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp.pm +++ /dev/null @@ -1,199 +0,0 @@ -package Zaptel::Xpp; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Xpp.pm 4309 2008-05-20 14:54:58Z tzafrir $ -# -use strict; -use Zaptel::Xpp::Xbus; - -=head1 NAME - -Zaptel::Xpp - Perl interface to the Xorcom Astribank drivers. - -=head1 SYNOPSIS - - # Listing all Astribanks: - use Zaptel::Xpp; - # scans hardware: - my @xbuses = Zaptel::Xpp::xbuses("SORT_CONNECTOR"); - for my $xbus (@xbuses) { - print $xbus->name." (".$xbus->label .", ". $xbus->connector .")\n"; - for my $xpd ($xbus->xpds) { - print " - ".$xpd->fqn,"\n"; - } - } -=cut - - -my $proc_base = "/proc/xpp"; - -# Nominal sorters for xbuses -sub by_name { - return $a->name cmp $b->name; -} - -sub by_connector { - return $a->connector cmp $b->connector; -} - -sub by_label { - my $cmp = $a->label cmp $b->label; - return $cmp if $cmp != 0; - return $a->connector cmp $b->connector; -} - -=head1 xbuses([sort_order]) - -Scans system (/proc and /sys) and returns a list of Astribank (Xbus) -objects. The optional parameter sort_order is the order in which -the Astribanks will be returns: - -=over - -=item SORT_CONNECTOR - -Sort by the connector string. For USB this defines the "path" to get to -the device through controllers, hubs etc. - -=item SORT_LABEL - -Sorts by the label of the Astribank. The label field is unique to the -Astribank. It can also be viewed through 'lsusb -v' without the drivers -loaded (the iSerial field in the Device Descriptor). - -=item SORT_NAME - -Sort by the "name". e.g: "XBUS-00". The order of Astribank names depends -on the load order, and hence may change between different runs. - -=item custom function - -Instead of using a predefined sorter, you can pass your own sorting -function. See the example sorters in the code of this module. - -=back - -=cut - -sub xbuses { - my $optsort = shift || 'SORT_CONNECTOR'; - my @xbuses; - - -d "$proc_base" or return (); - my @lines; - local $/ = "\n"; - open(F, "$proc_base/xbuses") || - die "$0: Failed to open $proc_base/xbuses: $!\n"; - @lines = ; - close F; - foreach my $line (@lines) { - chomp $line; - my ($name, @attr) = split(/\s+/, $line); - $name =~ s/://; - $name =~ /XBUS-(\d\d)/ or die "Bad XBUS number: $name"; - my $num = $1; - @attr = map { split(/=/); } @attr; - my $xbus = Zaptel::Xpp::Xbus->new(NAME => $name, NUM => $num, @attr); - push(@xbuses, $xbus); - } - my $sorter; - if($optsort eq "SORT_CONNECTOR") { - $sorter = \&by_connector; - } elsif($optsort eq "SORT_NAME") { - $sorter = \&by_name; - } elsif($optsort eq "SORT_LABEL") { - $sorter = \&by_label; - } elsif(ref($optsort) eq 'CODE') { - $sorter = $optsort; - } else { - die "Unknown optional sorter '$optsort'"; - } - @xbuses = sort $sorter @xbuses; - return @xbuses; -} - -sub xpd_of_span($) { - my $span = shift or die "Missing span parameter"; - return undef unless defined $span; - foreach my $xbus (Zaptel::Xpp::xbuses('SORT_CONNECTOR')) { - foreach my $xpd ($xbus->xpds()) { - return $xpd if $xpd->fqn eq $span->name; - } - } - return undef; -} - -=head1 sync([new_sync_source]) - -Gets (and optionally sets) the internal Astribanks synchronization -source. When used to set sync source, returns the original sync source. - -A synchronization source is a value valid writing into /proc/xpp/sync . -For more information read that file and see README.Astribank . - -=cut - -sub sync { - my $newsync = shift; - my $result; - my $newapi = 0; - - my $file = "$proc_base/sync"; - return '' unless -f $file; - # First query - open(F, "$file") or die "Failed to open $file for reading: $!"; - while() { - chomp; - /SYNC=/ and $newapi = 1; - s/#.*//; - if(/\S/) { # First non-comment line - s/^SYNC=\D*// if $newapi; - $result = $_; - last; - } - } - close F; - if(defined($newsync)) { # Now change - $newsync =~ s/.*/\U$&/; - if($newsync =~ /^(\d+)$/) { - $newsync = ($newapi)? "SYNC=$1" : "$1 0"; - } elsif($newsync ne 'ZAPTEL') { - die "Bad sync parameter '$newsync'"; - } - open(F, ">$file") or die "Failed to open $file for writing: $!"; - print F $newsync; - close(F) or die "Failed in closing $file: $!"; - } - return $result; -} - -=head1 SEE ALSO - -=over - -=item L - -Xbus (Astribank) object. - -=item L - -XPD (the rough equivalent of a Zaptel span) object. - -=item L - -Object for a line: an analog port or a time-slot in a adapter. -Equivalent of a channel in Zaptel. - -=item L - -General documentation in the master package. - -=back - -=cut - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm deleted file mode 100644 index c366306e..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Line.pm +++ /dev/null @@ -1,95 +0,0 @@ -package Zaptel::Xpp::Line; -# -# Written by Oron Peled -# Copyright (C) 2008, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Line.pm 4266 2008-05-13 21:08:09Z tzafrir $ -# -use strict; -use Zaptel::Utils; - -my $proc_base = "/proc/xpp"; - -sub new($$$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $xpd = shift or die; - my $index = shift; - defined $index or die; - my $self = {}; - bless $self, $pack; - $self->{XPD} = $xpd; - $self->{INDEX} = $index; - return $self; -} - -sub blink($$) { - my $self = shift; - my $on = shift; - my $xpd = $self->xpd; - my $result; - - my $file = "$proc_base/" . $xpd->fqn . "/blink"; - die "$file is missing" unless -f $file; - # First query - open(F, "$file") or die "Failed to open $file for reading: $!"; - $result = ; - chomp $result; - close F; - if(defined($on)) { # Now change - my $onbitmask = 1 << $self->index; - my $offbitmask = $result & ~$onbitmask; - - $result = $offbitmask; - $result |= $onbitmask if $on; - open(F, ">$file") or die "Failed to open $file for writing: $!"; - print F "$result"; - if(!close(F)) { - if($! == 17) { # EEXISTS - # good - } else { - undef $result; - } - } - } - return $result; -} - -sub create_all($$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $xpd = shift || die; - my $procdir = shift || die; - local $/ = "\n"; - my @lines; - for(my $i = 0; $i < $xpd->{CHANNELS}; $i++) { - my $line = Zaptel::Xpp::Line->new($xpd, $i); - push(@lines, $line); - } - $xpd->{LINES} = \@lines; - my ($infofile) = glob "$procdir/*_info"; - die "Failed globbing '$procdir/*_info'" unless defined $infofile; - my $type = $xpd->type; - open(F, "$infofile") || die "Failed opening '$infofile': $!"; - my $battery_info = 0; - while () { - chomp; - if($type eq 'FXO') { - $battery_info = 1 if /^Battery:/; - if($battery_info && s/^\s*on\s*:\s*//) { - my @batt = split; - foreach my $l (@lines) { - die unless @batt; - my $state = shift @batt; - $l->{BATTERY} = ($state eq '+') ? 1 : 0; - } - $battery_info = 0; - die if @batt; - } - } - } - close F; -} - - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm deleted file mode 100644 index 45df9b1f..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm +++ /dev/null @@ -1,118 +0,0 @@ -package Zaptel::Xpp::Xbus; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Xbus.pm 4266 2008-05-13 21:08:09Z tzafrir $ -# -use strict; -use Zaptel::Utils; -use Zaptel::Xpp::Xpd; - -my $proc_base = "/proc/xpp"; - -sub xpds($) { - my $xbus = shift; - return @{$xbus->{XPDS}}; -} - -sub by_number($) { - my $busnumber = shift; - die "Missing xbus number parameter" unless defined $busnumber; - my @xbuses = Zaptel::Xpp::xbuses(); - - my ($xbus) = grep { $_->num == $busnumber } @xbuses; - return $xbus; -} - -sub by_label($) { - my $label = shift; - die "Missing xbus label parameter" unless defined $label; - my @xbuses = Zaptel::Xpp::xbuses(); - - my ($xbus) = grep { $_->label eq $label } @xbuses; - return $xbus; -} - -sub get_xpd_by_number($$) { - my $xbus = shift; - my $xpdid = shift; - die "Missing XPD id parameter" unless defined $xpdid; - my @xpds = $xbus->xpds; - my ($wanted) = grep { $_->id eq $xpdid } @xpds; - return $wanted; -} - -sub new($$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $self = {}; - bless $self, $pack; - while(@_) { - my ($k, $v) = @_; - shift; shift; - # Keys in all caps - $k = uc($k); - # Some values are in all caps as well - if($k =~ /^(STATUS)$/) { - $v = uc($v); - } - $self->{$k} = $v; - } - # backward compat for drivers without labels. - if(!defined $self->{LABEL}) { - $self->{LABEL} = '[]'; - } - $self->{LABEL} =~ s/^\[(.*)\]$/$1/ or die "$self->{NAME}: Bad label"; - # Fix badly burned labels. - $self->{LABEL} =~ s/[[:^print:]]/_/g; - $self->{NAME} or die "Missing xbus name"; - my $prefix = "$proc_base/" . $self->{NAME}; - my $usbfile = "$prefix/xpp_usb"; - if(open(F, "$usbfile")) { - my $head = ; - chomp $head; - close F; - $head =~ s/^device: +([^, ]+)/$1/i or die; - $self->{USB_DEVNAME} = $head; - } - @{$self->{XPDS}} = (); - foreach my $dir (glob "$prefix/XPD-??") { - my $xpd = Zaptel::Xpp::Xpd->new($self, $dir); - push(@{$self->{XPDS}}, $xpd); - } - @{$self->{XPDS}} = sort { $a->id <=> $b->id } @{$self->{XPDS}}; - return $self; -} - -sub pretty_xpds($) { - my $xbus = shift; - my @xpds = sort { $a->id <=> $b->id } $xbus->xpds(); - my @xpd_types = map { $_->type } @xpds; - my $last_type = ''; - my $mult = 0; - my $xpdstr = ''; - foreach my $curr (@xpd_types) { - if(!$last_type || ($curr eq $last_type)) { - $mult++; - } else { - if($mult == 1) { - $xpdstr .= "$last_type "; - } elsif($mult) { - $xpdstr .= "$last_type*$mult "; - } - $mult = 1; - } - $last_type = $curr; - } - if($mult == 1) { - $xpdstr .= "$last_type "; - } elsif($mult) { - $xpdstr .= "$last_type*$mult "; - } - $xpdstr =~ s/\s*$//; # trim trailing space - return $xpdstr; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm b/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm deleted file mode 100644 index a586a307..00000000 --- a/zaptel/kernel/xpp/utils/zconf/Zaptel/Xpp/Xpd.pm +++ /dev/null @@ -1,123 +0,0 @@ -package Zaptel::Xpp::Xpd; -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: Xpd.pm 4266 2008-05-13 21:08:09Z tzafrir $ -# -use strict; -use Zaptel::Utils; -use Zaptel::Xpp; -use Zaptel::Xpp::Line; - -my $proc_base = "/proc/xpp"; - -sub blink($$) { - my $self = shift; - my $on = shift; - my $result; - - my $file = "$proc_base/" . $self->fqn . "/blink"; - die "$file is missing" unless -f $file; - # First query - open(F, "$file") or die "Failed to open $file for reading: $!"; - $result = ; - chomp $result; - close F; - if(defined($on) and $on ne $result) { # Now change - open(F, ">$file") or die "Failed to open $file for writing: $!"; - print F ($on)?"0xFFFF":"0"; - if(!close(F)) { - if($! == 17) { # EEXISTS - # good - } else { - undef $result; - } - } - } - return $result; -} - -sub zt_registration($$) { - my $self = shift; - my $on = shift; - my $result; - - my $file = "$proc_base/" . $self->fqn . "/zt_registration"; - die "$file is missing" unless -f $file; - # First query - open(F, "$file") or die "Failed to open $file for reading: $!"; - $result = ; - chomp $result; - close F; - if(defined($on) and $on ne $result) { # Now change - open(F, ">$file") or die "Failed to open $file for writing: $!"; - print F ($on)?"1":"0"; - if(!close(F)) { - if($! == 17) { # EEXISTS - # good - } else { - undef $result; - } - } - } - return $result; -} - -sub xpds_by_spanno() { - my @xbuses = Zaptel::Xpp::xbuses("SORT_CONNECTOR"); - my @xpds = map { $_->xpds } @xbuses; - @xpds = grep { $_->spanno } @xpds; - @xpds = sort { $a->spanno <=> $b->spanno } @xpds; - my @spanno = map { $_->spanno } @xpds; - my @idx; - @idx[@spanno] = @xpds; # The spanno is the index now - return @idx; -} - -sub new($$) { - my $pack = shift or die "Wasn't called as a class method\n"; - my $xbus = shift || die; - my $procdir = shift || die; - my $self = {}; - bless $self, $pack; - $self->{XBUS} = $xbus; - $self->{DIR} = $procdir; - local $/ = "\n"; - open(F, "$procdir/summary") || die "Missing summary file in $procdir"; - my $head = ; - chomp $head; # "XPD-00 (BRI_TE ,card present, span 3)" - # The driver does not export the number of channels... - # Let's find it indirectly - while() { - chomp; - if(s/^\s*offhook\s*:\s*//) { - my @offhook = split; - @offhook || die "No channels in '$procdir/summary'"; - $self->{CHANNELS} = @offhook; - last; - } - } - close F; - $head =~ s/^(XPD-(\d\d))\s+// || die; - $self->{ID} = $2; - $self->{FQN} = $xbus->name . "/" . $1; - $head =~ s/^.*\(// || die; - $head =~ s/\) */, / || die; - $head =~ s/\s*,\s*/,/g || die; - my ($type,$present,$span,$rest) = split(/,/, $head); - #warn "Garbage in '$procdir/summary': rest='$rest'\n" if $rest; - if($span =~ s/span\s+(\d+)//) { # since changeset:5119 - $self->{SPANNO} = $1; - } - $self->{TYPE} = $type; - $self->{IS_BRI} = ($type =~ /BRI_(NT|TE)/); - $self->{IS_PRI} = ($type =~ /[ETJ]1_(NT|TE)/); - $self->{IS_DIGITAL} = ( $self->{IS_BRI} || $self->{IS_PRI} ); - Zaptel::Xpp::Line->create_all($self, $procdir); - return $self; -} - -1; diff --git a/zaptel/kernel/xpp/utils/zt_registration b/zaptel/kernel/xpp/utils/zt_registration deleted file mode 100755 index f14deda5..00000000 --- a/zaptel/kernel/xpp/utils/zt_registration +++ /dev/null @@ -1,125 +0,0 @@ -#! /usr/bin/perl -w -# -# Written by Oron Peled -# Copyright (C) 2007, Xorcom -# This program is free software; you can redistribute and/or -# modify it under the same terms as Perl itself. -# -# $Id: zt_registration 3793 2008-02-04 23:00:48Z tzafrir $ -# -use strict; -use File::Basename; -BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); } - -use Zaptel; -use Zaptel::Span; -use Zaptel::Xpp; -use Zaptel::Xpp::Xbus; - -sub usage { - die "Usage: $0 [on|off|1|0]\n"; -} - -@ARGV == 0 or @ARGV == 1 or usage; -my $on = shift; -my $verbose = 0; -my $should_output = 1; - -if(defined($on)) { # Translate to booleans - $on = uc($on); - $on =~ /^(ON|OFF|1|0)$/ or usage; - $on = ($on eq 'ON') ? 1 : 0; - $should_output = 0 unless $verbose; -} - -sub state2str($) { - return (shift)?"on":"off"; -} - -sub myprintf { - printf @_ if $should_output; -} - -my @spans = Zaptel::spans; - -foreach my $xbus (Zaptel::Xpp::xbuses('SORT_CONNECTOR')) { - myprintf "%-10s\t%s\t%s\n", $xbus->name, $xbus->label, $xbus->connector; - next unless $xbus->status eq 'CONNECTED'; - foreach my $xpd ($xbus->xpds()) { - my $prev = $xpd->zt_registration($on); - if(!defined($prev)) { # Failure - printf "%s: Failed %s\n", $xpd->fqn, $!; - next; - } - myprintf "\t%-10s: ", $xpd->fqn; - if(!defined($on)) { # Query only - my ($span) = grep { $_->name eq $xpd->fqn } @spans; - my $spanstr = ($span) ? ("Span " . $span->num) : ""; - myprintf "%s %s\n", state2str($prev), $spanstr ; - next; - } - myprintf "%3s ==> %3s\n", state2str($prev), state2str($on); - } -} - -__END__ - -=head1 NAME - -zt_registration - Handle registration of Xorcom XPD modules in zaptel. - -=head1 SYNOPSIS - -zt_registration [on|off] - -=head1 DESCRIPTION - -Without parameters, show all connected XPDs sorted by physical connector order. -Each one is show to be unregistered (off), or registered to a specific zaptel -span (the span number is shown). - -All registerations/deregisterations are sorted by physical connector string. - -Span registration should generally always succeed. Span unregistration may -fail if channels from the span are in use by e.g. asterisk. In such a case -you'll also see those channels as '(In use)' in the output of lszaptel(8). - -=head2 Parameters - -off -- deregisters all XPD's from zaptel. - -on -- registers all XPD's to zaptel. - -=head2 Sample Output - -An example of the output of zt_registration for some registered -Astribanks: - - $ zt_registration - XBUS-02 [] usb-0000:00:1d.7-4 - XBUS-00/XPD-00: on Span 1 - XBUS-00/XPD-10: on Span 2 - XBUS-00 [usb:00000126] usb-0000:00:1d.7-2 - XBUS-02/XPD-00: on Span 3 - XBUS-02/XPD-10: on Span 4 - XBUS-02/XPD-20: on Span 5 - XBUS-02/XPD-30: on Span 6 - XBUS-01 [usb:00000128] usb-0000:00:1d.7-1 - XBUS-01/XPD-00: on Span 7 - XBUS-01/XPD-10: on Span 8 - XBUS-01/XPD-20: on Span 9 - XBUS-01/XPD-30: on Span 10 - -=head1 FILES - -=over - -=item /proc/xpp/XBUS-nn/XPD-mm/zt_registration - -Reading from this file shows if if the if the specific XPD is -registered. Writing to it 0 or 1 registers / unregisters the device. - -This should allow you to register / unregister a specific XPD rather -than all of them. - -=back diff --git a/zaptel/kernel/xpp/xbus-core.c b/zaptel/kernel/xpp/xbus-core.c deleted file mode 100644 index e51387ac..00000000 --- a/zaptel/kernel/xpp/xbus-core.c +++ /dev/null @@ -1,1708 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif - -#include -#include -#include -#include -#ifdef PROTOCOL_DEBUG -#include -#endif -#include -#include -#include /* for msleep() to debug */ -#include "xpd.h" -#include "xpp_zap.h" -#include "xbus-core.h" -#include "card_global.h" -#ifdef XPP_DEBUGFS -#include "xpp_log.h" -#endif -#include "zap_debug.h" - -static const char rcsid[] = "$Id: xbus-core.c 4474 2008-08-11 14:00:30Z tzafrir $"; - -/* Defines */ -#define INITIALIZATION_TIMEOUT (90*HZ) /* in jiffies */ -#define PROC_XBUSES "xbuses" -#define PROC_XBUS_SUMMARY "summary" -#define PROC_XBUS_WAITFOR_XPDS "waitfor_xpds" - -#ifdef PROTOCOL_DEBUG -#define PROC_XBUS_COMMAND "command" -static int proc_xbus_command_write(struct file *file, const char __user *buffer, unsigned long count, void *data); -#endif - -/* Command line parameters */ -extern int debug; -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 int xbus_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); -static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count, int *eof, void *data); -static void transport_init(xbus_t *xbus, struct xbus_ops *ops, ushort max_send_size, void *priv); -static void transport_destroy(xbus_t *xbus); - -/* Data structures */ -static spinlock_t xbuses_lock = SPIN_LOCK_UNLOCKED; -static int bus_count = 0; -static struct proc_dir_entry *proc_xbuses = NULL; - -static struct xbus_desc { - xbus_t *xbus; - atomic_t xbus_refcount; - wait_queue_head_t can_release_xbus; -} xbuses_array[MAX_BUSES]; - -static void init_xbus(uint num, xbus_t *xbus) -{ - struct xbus_desc *desc; - - BUG_ON(num >= ARRAY_SIZE(xbuses_array)); - desc = &xbuses_array[num]; - desc->xbus = xbus; - atomic_set(&desc->xbus_refcount, 0); - init_waitqueue_head(&desc->can_release_xbus); -} - -static int refcount_xbus(uint num) -{ - BUG_ON(num >= ARRAY_SIZE(xbuses_array)); - return atomic_read(&xbuses_array[num].xbus_refcount); -} - -xbus_t *get_xbus(uint num) -{ - struct xbus_desc *desc; - - if(num >= ARRAY_SIZE(xbuses_array)) - return NULL; - desc = &xbuses_array[num]; - atomic_inc(&desc->xbus_refcount); - if(!desc->xbus) - atomic_dec(&desc->xbus_refcount); - return desc->xbus; -} - -void put_xbus(xbus_t *xbus) -{ - struct xbus_desc *desc; - int num; - - BUG_ON(!xbus); - num = xbus->num; - BUG_ON(num >= ARRAY_SIZE(xbuses_array)); - desc = &xbuses_array[num]; - BUG_ON(desc->xbus != xbus); - if(atomic_dec_and_test(&desc->xbus_refcount)) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) - XBUS_DBG(DEVICES, xbus, - "wake_up(can_release_xbus) (%d)\n", rate_limit); - wake_up(&desc->can_release_xbus); - } -} - -static bool __must_check wait_for_xbus_release(uint xbus_num) -{ - xbus_t *xbus; - int ret; - - xbus = get_xbus(xbus_num); - if(!xbus) { - ERR("%s: xbus #%d is already removed. Skip.\n", - __FUNCTION__, xbus_num); - return 0; - } - put_xbus(xbus); - DBG(DEVICES, "Waiting... refcount_xbus=%d\n", refcount_xbus(xbus_num)); - ret = wait_event_interruptible(xbuses_array[xbus_num].can_release_xbus, - refcount_xbus(xbus_num) == 0); - if(ret) { - ERR("%s: waiting for xbus #%d interrupted!!!\n", - __FUNCTION__, xbus_num); - } else - DBG(DEVICES, "Waiting for refcount_xbus done.\n"); - return 1; -} - -static void initialize_xbuses_array(void) -{ - int i; - - for(i = 0; i < ARRAY_SIZE(xbuses_array); i++) - init_xbus(i, NULL); -} - -static void finalize_xbuses_array(void) -{ - int i; - - for(i = 0; i < ARRAY_SIZE(xbuses_array); i++) { - if(xbuses_array[i].xbus != NULL) { - ERR("%s: xbus #%d is not NULL\n", __FUNCTION__, i); - BUG(); - } - } -} - -/*------------------------- Debugfs Handling -----------------------*/ -#ifdef XPP_DEBUGFS - -#define DEBUGFS_BUFSIZ 4096 /* must be power of two, otherwise POS_IN_BUF will have to use '%' instead of '&' */ -#define POS_IN_BUF(x) ((x) & (DEBUGFS_BUFSIZ-1)) - -struct debugfs_data { - spinlock_t lock; - xbus_t *xbus; - char buffer[DEBUGFS_BUFSIZ]; - unsigned long head, tail; /* reading and writing are performed at position (head % BUF_SIZ) and (tail % BUF_SIZ) */ - wait_queue_head_t queue; -}; - -static unsigned long add_to_buf(struct debugfs_data *d, unsigned long tail, const void *buf, unsigned long len) -{ - unsigned long count = min(len, (unsigned long)(DEBUGFS_BUFSIZ - POS_IN_BUF(tail))); - memcpy(d->buffer + POS_IN_BUF(tail), buf, count); /* fill starting at position tail */ - memcpy(d->buffer, (u_char *)buf + count, len - count); /* fill leftover */ - return len; -} - -int xbus_log(xbus_t *xbus, xpd_t *xpd, int direction, const void *buf, unsigned long len) -{ - unsigned long tail; - unsigned long flags; - struct debugfs_data *d; - struct log_header header; - int ret = 0; - - BUG_ON(!xbus); - BUG_ON(!xpd); - BUG_ON(sizeof(struct log_header) + len > DEBUGFS_BUFSIZ); - d = xbus->debugfs_data; - if (!d) /* no consumer process */ - return ret; - spin_lock_irqsave(&d->lock, flags); - if (sizeof(struct log_header) + len > DEBUGFS_BUFSIZ - (d->tail - d->head)) { - ret = -ENOSPC; - XPD_DBG(GENERAL, xpd, "Dropping debugfs data of len %lu, free space is %lu\n", sizeof(struct log_header) + len, - DEBUGFS_BUFSIZ - (d->tail - d->head)); - goto out; - } - header.len = sizeof(struct log_header) + len; - header.time = jiffies_to_msecs(jiffies); - header.xpd_num = xpd->xbus_idx; - header.direction = (char)direction; - tail = d->tail; - tail += add_to_buf(d, tail, &header, sizeof(header)); - tail += add_to_buf(d, tail, buf, len); - d->tail = tail; - wake_up_interruptible(&d->queue); -out: - spin_unlock_irqrestore(&d->lock, flags); - return ret; -} - -static struct dentry *debugfs_root = NULL; -static int debugfs_open(struct inode *inode, struct file *file); -static ssize_t debugfs_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos); -static int debugfs_release(struct inode *inode, struct file *file); - -static struct file_operations debugfs_operations = { - .open = debugfs_open, - .read = debugfs_read, - .release = debugfs_release, -}; - -/* - * As part of the "inode diet" the private data member of struct inode - * has changed in 2.6.19. However, Fedore Core 6 adopted this change - * a bit earlier (2.6.18). If you use such a kernel, Change the - * following test from 2,6,19 to 2,6,18. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#define I_PRIVATE(inode) ((inode)->u.generic_ip) -#else -#define I_PRIVATE(inode) ((inode)->i_private) -#endif - -static int debugfs_open(struct inode *inode, struct file *file) -{ - xbus_t *xbus = I_PRIVATE(inode); - struct debugfs_data *d; - struct log_global_header gheader; - - BUG_ON(!xbus); - XBUS_DBG(GENERAL, xbus, "\n"); - if (xbus->debugfs_data) - return -EBUSY; - d = KZALLOC(sizeof(struct debugfs_data), GFP_KERNEL); - if (!d) - return -ENOMEM; - try_module_get(THIS_MODULE); - spin_lock_init(&d->lock); - d->xbus = xbus; - d->head = d->tail = 0; - init_waitqueue_head(&d->queue); - file->private_data = d; - - gheader.magic = XPP_LOG_MAGIC; - gheader.version = 1; - d->tail += add_to_buf(d, d->tail, &gheader, sizeof(gheader)); - - xbus->debugfs_data = d; - return 0; -} - -static ssize_t debugfs_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) -{ - struct debugfs_data *d = file->private_data; - size_t len; - - BUG_ON(!d); - BUG_ON(!d->xbus); - XBUS_DBG(GENERAL, d->xbus, "\n"); - while (d->head == d->tail) { - if (wait_event_interruptible(d->queue, d->head != d->tail)) - return -EAGAIN; - } - len = min(nbytes, (size_t)(d->tail - d->head)); - if (copy_to_user(buf, d->buffer + POS_IN_BUF(d->head), len)) - return -EFAULT; - d->head += len; - /* optimization to avoid future buffer wraparound */ - if (d->head == d->tail) { - unsigned long flags; - spin_lock_irqsave(&d->lock, flags); - if (d->head == d->tail) - d->head = d->tail = 0; - spin_unlock_irqrestore(&d->lock, flags); - } - return len; -} - -static int debugfs_release(struct inode *inode, struct file *file) -{ - struct debugfs_data *d = file->private_data; - - BUG_ON(!d); - BUG_ON(!d->xbus); - XBUS_DBG(GENERAL, d->xbus, "\n"); - d->xbus->debugfs_data = NULL; - kfree(d); - module_put(THIS_MODULE); - return 0; -} -#endif - -/*------------------------- Frame Handling ------------------------*/ - -void xframe_init(xbus_t *xbus, xframe_t *xframe, void *buf, size_t maxsize, void *priv) -{ - memset(xframe, 0, sizeof(*xframe)); - INIT_LIST_HEAD(&xframe->frame_list); - xframe->priv = priv; - xframe->xbus = xbus; - xframe->packets = xframe->first_free = buf; - xframe->frame_maxlen = maxsize; - atomic_set(&xframe->frame_len, 0); - do_gettimeofday(&xframe->tv_created); - xframe->xframe_magic = XFRAME_MAGIC; -} - -/* - * Return pointer to next packet slot in the frame - * or NULL if the frame is full. - * - * FIXME: we do not use atomic_add_return() because kernel-2.6.8 - * does not have it. This make this code a little racy, - * but we currently call xframe_next_packet() only in the - * PCM loop (xbus_tick() etc.) - */ -xpacket_t *xframe_next_packet(xframe_t *frm, int len) -{ - int newlen = XFRAME_LEN(frm); - - newlen += len; -// DBG(GENERAL, "len=%d, newlen=%d, frm->frame_len=%d\n", len, newlen, XFRAME_LEN(frm)); - if (newlen > XFRAME_DATASIZE) { - return NULL; - } - atomic_add(len, &frm->frame_len); - return (xpacket_t *)(frm->packets + newlen - len); -} - -static spinlock_t serialize_dump_xframe = SPIN_LOCK_UNLOCKED; - -static void do_hexdump(const char msg[], byte *data, uint16_t len) -{ - int i; - int debug = DBG_ANY; /* mask global debug */ - - for(i = 0; i < len; i++) - DBG(ANY, "%s: %3d> %02X\n", msg, i, data[i]); -} - -void dump_xframe(const char msg[], const xbus_t *xbus, const xframe_t *xframe, int debug) -{ - const uint16_t frm_len = XFRAME_LEN(xframe); - xpacket_t *pack; - uint16_t pos = 0; - uint16_t nextpos; - int num = 1; - bool do_print; - unsigned long flags; - - if(xframe->xframe_magic != XFRAME_MAGIC) { - XBUS_ERR(xbus, "%s: bad xframe_magic %lX\n", - __FUNCTION__, xframe->xframe_magic); - return; - } - spin_lock_irqsave(&serialize_dump_xframe, flags); - do { - if(pos >= xbus->transport.max_send_size) { - if(printk_ratelimit()) { - XBUS_NOTICE(xbus, "%s: xframe overflow (%d bytes)\n", - msg, frm_len); - do_hexdump(msg, xframe->packets, frm_len); - } - break; - } - if(pos > frm_len) { - if(printk_ratelimit()) { - XBUS_NOTICE(xbus, "%s: packet overflow pos=%d frame_len=%d\n", - msg, pos, frm_len); - do_hexdump(msg, xframe->packets, frm_len); - } - break; - } - pack = (xpacket_t *)&xframe->packets[pos]; - if(XPACKET_LEN(pack) <= 0) { - if(printk_ratelimit()) { - XBUS_NOTICE(xbus, "%s: xframe -- bad packet_len=%d pos=%d frame_len=%d\n", - msg, XPACKET_LEN(pack), pos, frm_len); - do_hexdump(msg, xframe->packets, frm_len); - } - break; - } - nextpos = pos + XPACKET_LEN(pack); - if(nextpos > frm_len) { - if(printk_ratelimit()) { - XBUS_NOTICE(xbus, "%s: packet overflow nextpos=%d frame_len=%d\n", - msg, nextpos, frm_len); - do_hexdump(msg, xframe->packets, frm_len); - } - break; - } - do_print = 0; - if(debug == DBG_ANY) - do_print = 1; - else if(XPACKET_OP(pack) != XPROTO_NAME(GLOBAL,PCM_READ) && - XPACKET_OP(pack) != XPROTO_NAME(GLOBAL,PCM_WRITE)) - do_print = 1; - else if(debug & DBG_PCM) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) - do_print = 1; - } - if(do_print) { - if(num == 1) { - XBUS_DBG(ANY, xbus, "%s: frame_len=%d. %s\n", - msg, frm_len, - (XPACKET_IS_PCM(pack)) - ? "(IS_PCM)" - : ""); - } - XBUS_DBG(ANY, xbus, " %3d. DATALEN=%d pcm=%d slot=%d OP=0x%02X XPD-%d%d (pos=%d)\n", - num, XPACKET_LEN(pack), - XPACKET_IS_PCM(pack), XPACKET_PCMSLOT(pack), - XPACKET_OP(pack), - XPACKET_ADDR_UNIT(pack), XPACKET_ADDR_SUBUNIT(pack), - pos); - dump_packet(" ", pack, debug); - } - num++; - pos = nextpos; - if(pos >= frm_len) - break; - } while(1); - spin_unlock_irqrestore(&serialize_dump_xframe, flags); -} - -static bool xbus_ready(const xbus_t *xbus, const char msg[]) -{ - if(!xbus) { - ERR("null xbus: %s\n", msg); - return 0; - } - if (!TRANSPORT_RUNNING(xbus)) { - XBUS_ERR(xbus, "%s -- hardware is not ready.", msg); - return 0; - } - if(!xbus->transport.ops) { - XBUS_ERR(xbus, "%s -- hardware is gone.", msg); - return 0; - } - return 1; -} - -/** - * - * Frame is freed: - * - In case of error, by this function. - * - Otherwise, by the underlying sending mechanism - */ -int send_pcm_frame(xbus_t *xbus, xframe_t *xframe) -{ - struct xbus_ops *ops; - int ret = -ENODEV; - - BUG_ON(!xframe); - if(!xbus_ready(xbus, "Dropped a pcm frame")) { - ret = -ENODEV; - goto error; - } - ops = transportops_get(xbus); - BUG_ON(!ops); - ret = ops->xframe_send_pcm(xbus, xframe); - transportops_put(xbus); - if(ret) - XBUS_COUNTER(xbus, TX_BYTES) += XFRAME_LEN(xframe); - return ret; - -error: - FREE_SEND_XFRAME(xbus, xframe); - return ret; -} - -static int really_send_cmd_frame(xbus_t *xbus, xframe_t *xframe) -{ - struct xbus_ops *ops; - int ret; - - BUG_ON(!xbus); - BUG_ON(!xframe); - BUG_ON(xframe->xframe_magic != XFRAME_MAGIC); - if(!xbus_ready(xbus, "Dropped command before sending")) { - FREE_SEND_XFRAME(xbus, xframe); - return -ENODEV; - } - ops = transportops_get(xbus); - BUG_ON(!ops); - if(debug & DBG_COMMANDS) - dump_xframe("TX-CMD", xbus, xframe, DBG_ANY); - ret = ops->xframe_send_cmd(xbus, xframe); - transportops_put(xbus); - if(ret == 0) { - XBUS_COUNTER(xbus, TX_CMD)++; - XBUS_COUNTER(xbus, TX_BYTES) += XFRAME_LEN(xframe); - } - return ret; -} - -int xbus_command_queue_tick(xbus_t *xbus) -{ - xframe_t *frm; - int ret = 0; - - frm = xframe_dequeue(&xbus->command_queue); - if(frm) { - BUG_ON(frm->xframe_magic != XFRAME_MAGIC); - ret = really_send_cmd_frame(xbus, frm); - if(ret < 0) - XBUS_ERR(xbus, - "Failed to send from command_queue (ret=%d)\n", - ret); - XBUS_PUT(xbus); - } else - wake_up(&xbus->command_queue_empty); - return ret; -} - -static void xbus_command_queue_clean(xbus_t *xbus) -{ - xframe_t *frm; - - XBUS_DBG(DEVICES, xbus, "count=%d\n", xbus->command_queue.count); - xframe_queue_disable(&xbus->command_queue); - while((frm = xframe_dequeue(&xbus->command_queue)) != NULL) { - FREE_SEND_XFRAME(xbus, frm); - XBUS_PUT(xbus); - } -} - -static int xbus_command_queue_waitempty(xbus_t *xbus) -{ - int ret; - - XBUS_DBG(DEVICES, xbus, "Waiting for command_queue to empty\n"); - ret = wait_event_interruptible(xbus->command_queue_empty, - xframe_queue_count(&xbus->command_queue) == 0); - if(ret) { - XBUS_ERR(xbus, "waiting for command_queue interrupted!!!\n"); - } - return ret; -} - -int send_cmd_frame(xbus_t *xbus, xframe_t *xframe) -{ - static int rate_limit; - int ret = 0; - - - BUG_ON(xframe->xframe_magic != XFRAME_MAGIC); - if(!xbus_ready(xbus, "Dropped command before queueing")) { - ret = -ENODEV; - goto err; - } - if(!XBUS_GET(xbus)) { - /* shutting down */ - ret = -ENODEV; - goto err; - } - if(!xframe_enqueue(&xbus->command_queue, xframe)) { - if((rate_limit++ % 1003) == 0) { - XBUS_ERR(xbus, - "Dropped command xframe. Cannot enqueue (%d)\n", - rate_limit); - dump_xframe("send_cmd_frame", xbus, xframe, DBG_ANY); - } - XBUS_PUT(xbus); - ret = -E2BIG; - goto err; - } - return 0; -err: - FREE_SEND_XFRAME(xbus, xframe); - return ret; -} - -/*------------------------- Receive Tasklet Handling ---------------*/ - -static void xframe_enqueue_recv(xbus_t *xbus, xframe_t *xframe) -{ - int cpu = smp_processor_id(); - - BUG_ON(!xbus); - xbus->cpu_rcv_intr[cpu]++; - if(!xframe_enqueue(&xbus->receive_queue, xframe)) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) - XBUS_ERR(xbus, "Failed to enqueue for receive_tasklet (%d)\n", rate_limit); - FREE_RECV_XFRAME(xbus, xframe); /* return to receive_pool */ - return; - } - tasklet_schedule(&xbus->receive_tasklet); -} - -/* - * process frames in the receive_queue in a tasklet - */ -static void receive_tasklet_func(unsigned long data) -{ - xbus_t *xbus = (xbus_t *)data; - xframe_t *xframe = NULL; - int cpu = smp_processor_id(); - - BUG_ON(!xbus); - xbus->cpu_rcv_tasklet[cpu]++; - while((xframe = xframe_dequeue(&xbus->receive_queue)) != NULL) { - xframe_receive(xbus, xframe); - } -} - -void xbus_receive_xframe(xbus_t *xbus, xframe_t *xframe) -{ - BUG_ON(!xbus); - if(rx_tasklet) { - xframe_enqueue_recv(xbus, xframe); - } else { - if (likely(TRANSPORT_RUNNING(xbus))) - xframe_receive(xbus, xframe); - else - FREE_RECV_XFRAME(xbus, xframe); /* return to receive_pool */ - } -} - -/*------------------------- Bus Management -------------------------*/ -xpd_t *xpd_of(const xbus_t *xbus, int xpd_num) -{ - if(!VALID_XPD_NUM(xpd_num)) - return NULL; - return xbus->xpds[xpd_num]; -} - -xpd_t *xpd_byaddr(const xbus_t *xbus, uint unit, uint subunit) -{ - if(unit > MAX_UNIT || subunit > MAX_SUBUNIT) - return NULL; - return xbus->xpds[XPD_IDX(unit,subunit)]; -} - -int xbus_register_xpd(xbus_t *xbus, xpd_t *xpd) -{ - unsigned int xpd_num = xpd->xbus_idx; - unsigned long flags; - int ret = 0; - - xbus = get_xbus(xbus->num); /* until unregister */ - BUG_ON(!xbus); - XBUS_DBG(DEVICES, xbus, "XPD #%d (xbus_refcount=%d)\n", - xpd_num, refcount_xbus(xbus->num)); - spin_lock_irqsave(&xbus->lock, flags); - if(!VALID_XPD_NUM(xpd_num)) { - XBUS_ERR(xbus, "Bad xpd_num = %d\n", xpd_num); - ret = -EINVAL; - goto out; - } - if(xbus->xpds[xpd_num] != NULL) { - xpd_t *other = xbus->xpds[xpd_num]; - - XBUS_ERR(xbus, "xpd_num=%d is occupied by %p (%s)\n", - xpd_num, other, other->xpdname); - ret = -EINVAL; - goto out; - } - xbus->xpds[xpd_num] = xpd; - xpd->xbus = xbus; - xbus->num_xpds++; -out: - spin_unlock_irqrestore(&xbus->lock, flags); - return ret; -} - -int xbus_unregister_xpd(xbus_t *xbus, xpd_t *xpd) -{ - unsigned int xpd_num = xpd->xbus_idx; - unsigned long flags; - int ret = -EINVAL; - - spin_lock_irqsave(&xbus->lock, flags); - XBUS_DBG(DEVICES, xbus, "XPD #%d (xbus_refcount=%d)\n", - xpd_num, refcount_xbus(xbus->num)); - if(!VALID_XPD_NUM(xpd_num)) { - XBUS_ERR(xbus, "%s: Bad xpd_num = %d\n", __FUNCTION__, xpd_num); - goto out; - } - if(xbus->xpds[xpd_num] == NULL) { - XBUS_ERR(xbus, "%s: slot xpd_num=%d is empty\n", __FUNCTION__, xpd_num); - goto out; - } - if(xbus->xpds[xpd_num] != xpd) { - xpd_t *other = xbus->xpds[xpd_num]; - - XBUS_ERR(xbus, "%s: slot xpd_num=%d is occupied by %p (%s)\n", - __FUNCTION__, xpd_num, other, other->xpdname); - goto out; - } - xbus->xpds[xpd_num] = NULL; - xbus->num_xpds--; - xpd->xbus = NULL; - put_xbus(xbus); /* we got it in xbus_register_xpd() */ - ret = 0; -out: - spin_unlock_irqrestore(&xbus->lock, flags); - return ret; -} - -/* - * Called with xbus->worker locked. - */ -static int new_card(xbus_t *xbus, - int unit, - byte type, - byte subtype, - byte numchips, - byte ports_per_chip, - byte ports, - byte port_dir) -{ - const xproto_table_t *proto_table; - const xops_t *xops; - int i; - int subunits; - int ret = 0; - - proto_table = xproto_get(type); - if(!proto_table) { - XBUS_NOTICE(xbus, - "CARD %d: missing protocol table for type %d. Ignored.\n", - unit, type); - return -EINVAL; - } - subunits = (ports + proto_table->ports_per_subunit - 1) / - proto_table->ports_per_subunit; - XBUS_DBG(DEVICES, xbus, "CARD %d type=%d.%d ports=%d (%dx%d), %d subunits, port-dir=0x%02X\n", - unit, - type, - subtype, - ports, - numchips, - ports_per_chip, - subunits, - port_dir - ); - xops = &proto_table->xops; - BUG_ON(!xops); - xbus->worker->num_units += subunits - 1; - for(i = 0; i < subunits; i++) { - if(!TRANSPORT_RUNNING(xbus)) { - ret = -ENODEV; - goto out; - } - XBUS_DBG(DEVICES, xbus, "Creating XPD=%d%d type=%d.%d\n", - unit, - i, - type, - subtype); - if(!XBUS_GET(xbus)) { - XBUS_ERR(xbus, "Aborting creation. Is shutting down.\n"); - ret = -ENODEV; - goto out; - } - ret = create_xpd(xbus, proto_table, unit, i, type, subtype, subunits, port_dir); - XBUS_PUT(xbus); - if(ret < 0) { - XBUS_ERR(xbus, "Creation of XPD=%d%d failed %d\n", - unit, i, ret); - goto out; - } - xbus->worker->num_units_initialized++; - } -out: - xproto_put(proto_table); /* ref count is inside the xpds now */ - return ret; -} - -static int xbus_initialize(xbus_t *xbus) -{ - int unit; - int subunit; - xpd_t *xpd; - - for(unit = 0; unit < MAX_UNIT; unit++) { - xpd = xpd_byaddr(xbus, unit, 0); - if(!xpd) - continue; - if(run_initialize_registers(xpd) < 0) { - XPD_ERR(xpd, "Register Initialization failed\n"); - goto err; - } - for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) { - xpd = xpd_byaddr(xbus, unit, subunit); - if(!xpd) - continue; - if(CALL_XMETHOD(card_init, xpd->xbus, xpd) < 0) { - XPD_ERR(xpd, "Card Initialization failed\n"); - goto err; - } - //CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 0); /* Turn off all channels */ - xpd->card_present = 1; - CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 1); /* Turn on all channels */ - XPD_INFO(xpd, "Initialized: %s\n", xpd->type_name); - xpd_post_init(xpd); - } - } - return 0; -err: - for(unit = 0; unit < MAX_UNIT; unit++) { - for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) { - xpd = xpd_byaddr(xbus, unit, subunit); - if(!xpd) - xpd_free(xpd); - } - } - return -EINVAL; -} - -/* - * This must be called from synchronous (non-interrupt) context - * it returns only when all XPD's on the bus are detected and - * initialized. - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -void xbus_populate(struct work_struct *work) -{ - struct xbus_workqueue *worker = container_of(work, struct xbus_workqueue, xpds_init_work); -#else -void xbus_populate(void *data) -{ - struct xbus_workqueue *worker = data; -#endif - xbus_t *xbus; - struct list_head *card; - struct list_head *next_card; - unsigned long flags; - int ret = 0; - - xbus = worker->xbus; - if(!XBUS_GET(xbus)) { - XBUS_NOTICE(xbus, "Shutting down, aboring initialization\n"); - return; - } - spin_lock_irqsave(&worker->worker_lock, flags); - list_for_each_safe(card, next_card, &worker->card_list) { - struct card_desc_struct *card_desc = list_entry(card, struct card_desc_struct, card_list); - - list_del(card); - BUG_ON(card_desc->magic != CARD_DESC_MAGIC); - /* Release/Reacquire locks around blocking calls */ - spin_unlock_irqrestore(&xbus->worker->worker_lock, flags); - ret = new_card(xbus, - card_desc->xpd_addr.unit, - card_desc->type, - card_desc->subtype, - card_desc->numchips, - card_desc->ports_per_chip, - card_desc->ports, - card_desc->port_dir); - spin_lock_irqsave(&xbus->worker->worker_lock, flags); - KZFREE(card_desc); - if(ret) - break; - } - spin_unlock_irqrestore(&worker->worker_lock, flags); - xbus_initialize(xbus); - worker->xpds_init_done = 1; - ret = xbus_sysfs_create(xbus); - if(ret) { - XBUS_ERR(xbus, "SYSFS creation failed: %d\n", ret); - } - wake_up(&worker->wait_for_xpd_initialization); - /* - * Now request Astribank to start self_ticking. - * This is the last initialization command. So - * all others will reach the device before it. - */ - xbus_request_sync(xbus, SYNC_MODE_PLL); - elect_syncer("xbus_poll(end)"); /* FIXME: try to do it later */ - put_xbus(xbus); /* taken in AB_DESCRIPTION */ - XBUS_PUT(xbus); -} - -static void worker_destroy(struct xbus_workqueue *worker) -{ - xbus_t *xbus; - struct list_head *card; - struct list_head *next_card; - unsigned long flags; - - if(!worker) - return; - spin_lock_irqsave(&worker->worker_lock, flags); - xbus = worker->xbus; - list_for_each_safe(card, next_card, &worker->card_list) { - struct card_desc_struct *card_desc = list_entry(card, struct card_desc_struct, card_list); - - BUG_ON(card_desc->magic != CARD_DESC_MAGIC); - list_del(card); - kfree(card_desc); - } - spin_unlock_irqrestore(&worker->worker_lock, flags); - if(xbus) { -#ifdef CONFIG_PROC_FS - if(xbus->proc_xbus_dir && worker->proc_xbus_waitfor_xpds) { - XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", PROC_XBUS_WAITFOR_XPDS); - remove_proc_entry(PROC_XBUS_WAITFOR_XPDS, xbus->proc_xbus_dir); - worker->proc_xbus_waitfor_xpds = NULL; - } -#endif - XBUS_DBG(DEVICES, xbus, "detach worker\n"); - xbus->worker = NULL; - } - if (worker->wq) { - DBG(DEVICES, "XBUS #%d: destroy workqueue\n", worker->xbus->num); - flush_workqueue(worker->wq); - destroy_workqueue(worker->wq); - worker->wq = NULL; - } - put_xbus(xbus); /* Taken in worker_new() */ - KZFREE(worker); -} - -/* - * Allocate a worker for the xbus including the nessessary workqueue. - * May call blocking operations, but only briefly (as we are called - * from xbus_new() which is called from khubd. - */ -static struct xbus_workqueue *worker_new(int xbus_num) -{ - struct xbus_workqueue *worker; - xbus_t *xbus; - - xbus = get_xbus(xbus_num); /* release in worker_destroy */ - BUG_ON(xbus->busname[0] == '\0'); /* No name? */ - BUG_ON(xbus->worker != NULL); /* Hmmm... nested workers? */ - XBUS_DBG(DEVICES, xbus, "\n"); - worker = KZALLOC(sizeof(*worker), GFP_KERNEL); - if(!worker) - goto err; - worker->xbus = xbus; - /* poll related variables */ - spin_lock_init(&worker->worker_lock); - INIT_LIST_HEAD(&worker->card_list); - init_waitqueue_head(&worker->wait_for_xpd_initialization); - worker->wq = create_singlethread_workqueue(xbus->busname); - if(!worker->wq) { - XBUS_ERR(xbus, "Failed to create worker workqueue.\n"); - goto err; - } -#ifdef CONFIG_PROC_FS - if(xbus->proc_xbus_dir) { - worker->proc_xbus_waitfor_xpds = create_proc_read_entry( - PROC_XBUS_WAITFOR_XPDS, 0444, - xbus->proc_xbus_dir, - xbus_read_waitfor_xpds, - xbus); - if (!worker->proc_xbus_waitfor_xpds) { - XBUS_ERR(xbus, "Failed to create proc file '%s'\n", PROC_XBUS_WAITFOR_XPDS); - goto err; - } - worker->proc_xbus_waitfor_xpds->owner = THIS_MODULE; - } -#endif - return worker; -err: - worker_destroy(worker); - return NULL; -} - -int xbus_activate(xbus_t *xbus) -{ - struct xbus_ops *ops; - struct xbus_workqueue *worker; - - BUG_ON(!xbus); - ops = transportops_get(xbus); - BUG_ON(!ops); - worker = xbus->worker; - BUG_ON(!worker); - /* Sanity checks */ - BUG_ON(!ops->xframe_send_pcm); - BUG_ON(!ops->xframe_send_cmd); - BUG_ON(!ops->alloc_xframe); - BUG_ON(!ops->free_xframe); - xpp_drift_init(xbus); - /* - * We start with timer based ticking - */ - xbus_set_command_timer(xbus, 1); - xbus->transport.transport_running = 1; /* must be done after transport is valid */ - XBUS_INFO(xbus, "[%s] Activating\n", xbus->label); - /* - * Make sure Astribank knows not to send us ticks. - */ - xbus_request_sync(xbus, SYNC_MODE_NONE); - CALL_PROTO(GLOBAL, AB_REQUEST, xbus, NULL); - return 0; -} - -void xbus_disconnect(xbus_t *xbus) -{ - int i; - - BUG_ON(!xbus); - XBUS_INFO(xbus, "[%s] Disconnecting\n", xbus->label); - xbus_set_command_timer(xbus, 1); - xbus_request_sync(xbus, SYNC_MODE_NONE); /* no more ticks */ - xbus_sysfs_remove(xbus); /* Device-Model */ - for(i = 0; i < MAX_XPDS; i++) { - xpd_t *xpd = xpd_of(xbus, i); - if(!xpd) - continue; - if(xpd->xbus_idx != i) { - XBUS_ERR(xbus, "BUG: xpd->xbus_idx=%d != i=%d\n", xpd->xbus_idx, i); - continue; - } - xpd_disconnect(xpd); - } - XBUS_DBG(DEVICES, xbus, "Deactivating\n"); - tasklet_kill(&xbus->receive_tasklet); - xframe_queue_clear(&xbus->receive_queue); - xbus_command_queue_clean(xbus); - xbus_command_queue_waitempty(xbus); - del_timer_sync(&xbus->command_timer); - xframe_queue_clear(&xbus->send_pool); - xframe_queue_clear(&xbus->receive_pool); - xframe_queue_clear(&xbus->pcm_tospan); - transportops_put(xbus); - transport_destroy(xbus); - elect_syncer("disconnect"); - XBUS_DBG(DEVICES, xbus, "Deactivated (refcount_xbus=%d)\n", refcount_xbus(xbus->num)); - if(atomic_dec_and_test(&xbus->xbus_ref_count)) { - XBUS_DBG(DEVICES, xbus, "Going to remove XBUS\n"); - xbus_remove(xbus); - } -} - -static xbus_t *xbus_alloc(void) -{ - unsigned long flags; - xbus_t *xbus; - int i; - - xbus = KZALLOC(sizeof(xbus_t), GFP_KERNEL); - if(!xbus) { - ERR("%s: out of memory\n", __FUNCTION__); - return NULL; - } - spin_lock_irqsave(&xbuses_lock, flags); - for(i = 0; i < MAX_BUSES; i++) - if(xbuses_array[i].xbus == NULL) - break; - if(i >= MAX_BUSES) { - ERR("%s: No free slot for new bus. i=%d\n", __FUNCTION__, i); - kfree(xbus); - xbus = NULL; - goto out; - } - /* Found empty slot */ - xbus->num = i; - init_xbus(i, xbus); - xbus = get_xbus(i); - bus_count++; -out: - spin_unlock_irqrestore(&xbuses_lock, flags); - return xbus; -} - - -static void xbus_free(xbus_t *xbus) -{ - unsigned long flags; - uint num; - - if(!xbus) - return; - spin_lock_irqsave(&xbuses_lock, flags); - num = xbus->num; - BUG_ON(!xbuses_array[num].xbus); - BUG_ON(xbus != xbuses_array[num].xbus); - spin_unlock_irqrestore(&xbuses_lock, flags); -#ifdef XPP_DEBUGFS - if(xbus->debugfs_dir) { - if(xbus->debugfs_file) { - XBUS_DBG(GENERAL, xbus, "Removing debugfs file\n"); - debugfs_remove(xbus->debugfs_file); - } - XBUS_DBG(GENERAL, xbus, "Removing debugfs directory\n"); - debugfs_remove(xbus->debugfs_dir); - } -#endif -#ifdef CONFIG_PROC_FS - if(xbus->proc_xbus_dir) { - if(xbus->proc_xbus_summary) { - XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", PROC_XBUS_SUMMARY); - remove_proc_entry(PROC_XBUS_SUMMARY, xbus->proc_xbus_dir); - xbus->proc_xbus_summary = NULL; - } -#ifdef PROTOCOL_DEBUG - if(xbus->proc_xbus_command) { - XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", PROC_XBUS_COMMAND); - remove_proc_entry(PROC_XBUS_COMMAND, xbus->proc_xbus_dir); - xbus->proc_xbus_command = NULL; - } -#endif - XBUS_DBG(PROC, xbus, "Removing proc directory\n"); - remove_proc_entry(xbus->busname, xpp_proc_toplevel); - xbus->proc_xbus_dir = NULL; - } -#endif - spin_lock_irqsave(&xbuses_lock, flags); - /* - * Return to xbus reference counts: - * - One from our caller: transport disconnect or xpp_close() - * - One from xbus_alloc() - */ - put_xbus(xbus); - put_xbus(xbus); - if(!wait_for_xbus_release(xbus->num)) - BUG(); /* Let's see what happens next... */ - bus_count--; - XBUS_DBG(DEVICES, xbus, "Going to free... refcount_xbus=%d\n", refcount_xbus(num)); - BUG_ON(refcount_xbus(num) != 0); - init_xbus(num, NULL); - spin_unlock_irqrestore(&xbuses_lock, flags); - KZFREE(xbus); -} - -xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, void *priv) -{ - int err; - xbus_t *xbus = NULL; - - BUG_ON(!ops); - XBUS_DBG(GENERAL, xbus, "allocate new xbus\n"); - xbus = xbus_alloc(); - if(!xbus) - return NULL; - transport_init(xbus, ops, max_send_size, priv); - spin_lock_init(&xbus->lock); - atomic_set(&xbus->xbus_ref_count, 1); /* a single ref */ - snprintf(xbus->busname, XBUS_NAMELEN, "XBUS-%02d", xbus->num); - init_waitqueue_head(&xbus->command_queue_empty); - init_timer(&xbus->command_timer); - atomic_set(&xbus->pcm_rx_counter, 0); - xbus->min_tx_sync = INT_MAX; - xbus->min_rx_sync = INT_MAX; - - xbus->num_xpds = 0; - xbus->sync_mode = SYNC_MODE_NONE; - init_rwsem(&xbus->in_use); - xbus_reset_counters(xbus); -#ifdef CONFIG_PROC_FS - XBUS_DBG(PROC, xbus, "Creating xbus proc directory\n"); - xbus->proc_xbus_dir = proc_mkdir(xbus->busname, xpp_proc_toplevel); - if(!xbus->proc_xbus_dir) { - XBUS_ERR(xbus, "Failed to create proc directory\n"); - err = -EIO; - goto nobus; - } - xbus->proc_xbus_summary = create_proc_read_entry(PROC_XBUS_SUMMARY, - 0444, xbus->proc_xbus_dir, - xbus_read_proc, - (void *)((unsigned long)(xbus->num))); - if (!xbus->proc_xbus_summary) { - XBUS_ERR(xbus, "Failed to create proc file '%s'\n", PROC_XBUS_SUMMARY); - err = -EIO; - goto nobus; - } - xbus->proc_xbus_summary->owner = THIS_MODULE; -#ifdef PROTOCOL_DEBUG - xbus->proc_xbus_command = create_proc_entry(PROC_XBUS_COMMAND, 0200, xbus->proc_xbus_dir); - if (!xbus->proc_xbus_command) { - XBUS_ERR(xbus, "Failed to create proc file '%s'\n", PROC_XBUS_COMMAND); - err = -EIO; - goto nobus; - } - xbus->proc_xbus_command->write_proc = proc_xbus_command_write; - xbus->proc_xbus_command->data = xbus; - xbus->proc_xbus_command->owner = THIS_MODULE; -#endif -#endif -#ifdef XPP_DEBUGFS - xbus->debugfs_dir = debugfs_create_dir(xbus->busname, debugfs_root); - if(!xbus->debugfs_dir) { - XBUS_ERR(xbus, "Failed to create debugfs directory\n"); - goto nobus; - } - xbus->debugfs_file = debugfs_create_file("dchannel", S_IFREG|S_IRUGO|S_IWUSR, xbus->debugfs_dir, xbus, &debugfs_operations); - if(!xbus->debugfs_file) { - XBUS_ERR(xbus, "Failed to create dchannel file\n"); - goto nobus; - } -#endif - xframe_queue_init(&xbus->command_queue, 10, 200, "command_queue", xbus); - xframe_queue_init(&xbus->receive_queue, 10, 50, "receive_queue", xbus); - xframe_queue_init(&xbus->send_pool, 10, 200, "send_pool", xbus); - xframe_queue_init(&xbus->receive_pool, 10, 50, "receive_pool", xbus); - xframe_queue_init(&xbus->pcm_tospan, 5, 10, "pcm_tospan", xbus); - tasklet_init(&xbus->receive_tasklet, receive_tasklet_func, (unsigned long)xbus); - /* - * Create worker after /proc/XBUS-?? so the directory exists - * before /proc/XBUS-??/waitfor_xpds tries to get created. - */ - xbus->worker = worker_new(xbus->num); - if(!xbus->worker) { - ERR("Failed to allocate worker\n"); - goto nobus; - } - return xbus; -nobus: - xbus_free(xbus); - return NULL; -} - -void xbus_remove(xbus_t *xbus) -{ - int i; - - BUG_ON(TRANSPORT_RUNNING(xbus)); - down_write(&xbus->in_use); - - XBUS_INFO(xbus, "[%s] Removing\n", xbus->label); - for(i = 0; i < MAX_XPDS; i++) { - xpd_t *xpd = xpd_of(xbus, i); - - if(xpd) { - if(xpd->xbus_idx != i) { - XBUS_ERR(xbus, "BUG: xpd->xbus_idx=%d != i=%d\n", xpd->xbus_idx, i); - continue; - } - XBUS_DBG(DEVICES, xbus, " Removing xpd #%d\n", i); - xpd_remove(xpd); - } - xbus->xpds[i] = NULL; - } - worker_destroy(xbus->worker); - xbus_free(xbus); -} - -/*------------------------- Proc handling --------------------------*/ - -void xbus_reset_counters(xbus_t *xbus) -{ - int i; - - XBUS_DBG(GENERAL, xbus, "Reseting counters\n"); - for(i = 0; i < XBUS_COUNTER_MAX; i++) { - xbus->counters[i] = 0; - } -} - -#if CONFIG_PROC_FS - -static int xbus_fill_proc_queue(char *p, struct xframe_queue *q) -{ - int len; - - len = sprintf(p, - "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02ld.%ld ms\n", - q->name, - q->steady_state_count, - q->count, - q->max_count, - q->worst_count, - q->overflows, - q->worst_lag_usec / 1000, - q->worst_lag_usec % 1000); - xframe_queue_clearstats(q); - return len; -} - -static int xbus_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - xbus_t *xbus; - struct xbus_workqueue *worker; - unsigned long flags; - int len = 0; - int i = (int)((unsigned long)data); - - xbus = get_xbus(i); - if(!xbus) - goto out; - spin_lock_irqsave(&xbus->lock, flags); - worker = xbus->worker; - - len += sprintf(page + len, "%s: CONNECTOR=%s LABEL=[%s] STATUS=%s\n", - xbus->busname, - xbus->location, - xbus->label, - (TRANSPORT_RUNNING(xbus)) ? "connected" : "missing" - ); - len += sprintf(page + len, "\nxbus_ref_count=%d\n", - atomic_read(&xbus->xbus_ref_count) - ); - len += xbus_fill_proc_queue(page + len, &xbus->send_pool); - len += xbus_fill_proc_queue(page + len, &xbus->receive_pool); - len += xbus_fill_proc_queue(page + len, &xbus->command_queue); - len += xbus_fill_proc_queue(page + len, &xbus->receive_queue); - len += xbus_fill_proc_queue(page + len, &xbus->pcm_tospan); - if(rx_tasklet) { - len += sprintf(page + len, "\ncpu_rcv_intr: "); - for_each_online_cpu(i) - len += sprintf(page + len, "%5d ", xbus->cpu_rcv_intr[i]); - len += sprintf(page + len, "\ncpu_rcv_tasklet: "); - for_each_online_cpu(i) - len += sprintf(page + len, "%5d ", xbus->cpu_rcv_tasklet[i]); - len += sprintf(page + len, "\n"); - } - len += sprintf(page + len, "self_ticking: %d (last_tick at %ld)\n", - xbus->self_ticking, xbus->ticker.last_sample.tv.tv_sec); - len += sprintf(page + len, "xbus: pcm_rx_counter = %d, frag = %d\n", - atomic_read(&xbus->pcm_rx_counter), xbus->xbus_frag_count); - len += sprintf(page + len, "max_rx_process = %2ld.%ld ms\n", - xbus->max_rx_process / 1000, - xbus->max_rx_process % 1000); - xbus->max_rx_process = 0; - len += sprintf(page + len, "\nTRANSPORT: max_send_size=%d refcount=%d\n", - MAX_SEND_SIZE(xbus), - atomic_read(&xbus->transport.transport_refcount) - ); - len += sprintf(page + len, "PCM Metrices:\n"); - len += sprintf(page + len, "\tPCM TX: min=%ld max=%ld\n", - xbus->min_tx_sync, xbus->max_tx_sync); - len += sprintf(page + len, "\tPCM RX: min=%ld max=%ld\n", - xbus->min_rx_sync, xbus->max_rx_sync); - len += sprintf(page + len, "COUNTERS:\n"); - for(i = 0; i < XBUS_COUNTER_MAX; i++) { - len += sprintf(page + len, "\t%-15s = %d\n", - xbus_counters[i].name, xbus->counters[i]); - } - len += sprintf(page + len, "<-- len=%d\n", len); - spin_unlock_irqrestore(&xbus->lock, flags); - put_xbus(xbus); -out: - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; - -} - -static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xbus_t *xbus = data; - struct xbus_workqueue *worker; - int ret; - - if(!xbus) - goto out; - /* first handle special cases */ - if(!count || off) - goto out; - /* - * worker is created before /proc/XBUS-?? - * So by now it exists and initialized. - */ - worker = xbus->worker; - BUG_ON(!worker); - XBUS_DBG(DEVICES, xbus, - "Waiting for card initialization of %d XPD's max %d seconds\n", - worker->num_units, - INITIALIZATION_TIMEOUT/HZ); - /* - * when polling is finished xbus_poll(): - * - Unset worker->is_polling - * - Sets worker->count_xpds_to_initialize. - * So we wait until polling is finished (is_polling == 0) and: - * - No poll answers from Astribank (e.g: defective firmware). - * - Or no units to initialize (e.g: mini-AB with only main card). - * - Or we finished initializing all existing units. - * - Or A timeout passed. - */ - ret = wait_event_interruptible_timeout( - worker->wait_for_xpd_initialization, - worker->xpds_init_done, - INITIALIZATION_TIMEOUT); - if(ret == 0) { - XBUS_ERR(xbus, "Card Initialization Timeout\n"); - return ret; - } else if(ret < 0) { - XBUS_ERR(xbus, "Card Initialization Interrupted %d\n", ret); - return ret; - } else - XBUS_DBG(DEVICES, xbus, - "Finished initialization of %d XPD's in %d seconds.\n", - worker->num_units_initialized, - (INITIALIZATION_TIMEOUT - ret)/HZ); - spin_lock_irqsave(&xbus->lock, flags); - len += sprintf(page + len, "XPDS_READY: %s: %d/%d\n", - xbus->busname, - worker->num_units_initialized, worker->num_units); - spin_unlock_irqrestore(&xbus->lock, flags); -out: - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; - -} - -#ifdef PROTOCOL_DEBUG -static int proc_xbus_command_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - char *buf; - xbus_t *xbus = data; - char *p; - byte *pack_start; - byte *q; - xframe_t *xframe; - size_t len; - const size_t max_len = xbus->transport.max_send_size; - const size_t max_text = max_len * 3 + 10; - - if(count > max_text) { - XBUS_ERR(xbus, "%s: line too long (%ld > %zd)\n", __FUNCTION__, count, max_len); - return -EFBIG; - } - /* 3 bytes per hex-digit and space */ - buf = kmalloc(max_text, GFP_KERNEL); - if(!buf) - return -ENOMEM; - if(copy_from_user(buf, buffer, count)) { - count = -EINVAL; - goto out; - } - buf[count] = '\0'; - XBUS_DBG(GENERAL, xbus, "count=%ld\n", count); - /* - * We replace the content of buf[] from - * ascii representation to packet content - * as the binary representation is shorter - */ - q = pack_start = buf; - for(p = buf; *p;) { - int val; - char hexdigit[3]; - - while(*p && isspace(*p)) // skip whitespace - p++; - if(!(*p)) - break; - if(!isxdigit(*p)) { - XBUS_ERR(xbus, "%s: bad hex value ASCII='0x%X' at position %ld\n", - __FUNCTION__, *p, (long)(p - buf)); - count = -EINVAL; - goto out; - } - hexdigit[0] = *p++; - hexdigit[1] = '\0'; - hexdigit[2] = '\0'; - if(isxdigit(*p)) - hexdigit[1] = *p++; - if(sscanf(hexdigit, "%2X", &val) != 1) { - XBUS_ERR(xbus, "%s: bad hex value '%s' at position %ld\n", - __FUNCTION__, hexdigit, (long)(p - buf)); - count = -EINVAL; - goto out; - } - *q++ = val; - XBUS_DBG(GENERAL, xbus, "%3zd> '%s' val=%d\n", q - pack_start, hexdigit, val); - } - len = q - pack_start; - xframe = ALLOC_SEND_XFRAME(xbus); - if(!xframe) { - count = -ENOMEM; - goto out; - } - if(len > max_len) - len = max_len; - atomic_set(&xframe->frame_len, len); - memcpy(xframe->packets, pack_start, len); /* FIXME: checksum? */ - dump_xframe("COMMAND", xbus, xframe, debug); - send_cmd_frame(xbus, xframe); -out: - kfree(buf); - return count; -} -#endif - - -static int read_proc_xbuses(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - int i; - - spin_lock_irqsave(&xbuses_lock, flags); - for(i = 0; i < MAX_BUSES; i++) { - xbus_t *xbus = get_xbus(i); - - if(xbus) { - len += sprintf(page + len, "%s: CONNECTOR=%s LABEL=[%s] STATUS=%s REFCOUNT=%d\n", - xbus->busname, - xbus->location, - xbus->label, - (TRANSPORT_RUNNING(xbus)) ? "connected" : "missing", - refcount_xbus(i) - 1 - ); - put_xbus(xbus); - } - } -#if 0 - len += sprintf(page + len, "<-- len=%d\n", len); -#endif - spin_unlock_irqrestore(&xbuses_lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; - -} -#endif - -static void transport_init(xbus_t *xbus, struct xbus_ops *ops, ushort max_send_size, void *priv) -{ - BUG_ON(!xbus); - BUG_ON(!ops); - BUG_ON(!ops->xframe_send_pcm); - BUG_ON(!ops->xframe_send_cmd); - BUG_ON(!ops->alloc_xframe); - BUG_ON(!ops->free_xframe); - xbus->transport.ops = ops; - xbus->transport.max_send_size = max_send_size; - xbus->transport.priv = priv; - spin_lock_init(&xbus->transport.lock); - atomic_set(&xbus->transport.transport_refcount, 0); - init_waitqueue_head(&xbus->transport.transport_unused); -} - -static void transport_destroy(xbus_t *xbus) -{ - int ret; - - BUG_ON(!xbus); - xbus->transport.transport_running = 0; - XBUS_DBG(DEVICES, xbus, "Waiting... (transport_refcount=%d)\n", - atomic_read(&xbus->transport.transport_refcount)); - ret = wait_event_interruptible(xbus->transport.transport_unused, - atomic_read(&xbus->transport.transport_refcount) == 0); - if(ret) - XBUS_ERR(xbus, "Waiting for transport_refcount interrupted!!!\n"); - xbus->transport.ops = NULL; - xbus->transport.priv = NULL; -} - -struct xbus_ops *transportops_get(xbus_t *xbus) -{ - struct xbus_ops *ops; - - BUG_ON(!xbus); - atomic_inc(&xbus->transport.transport_refcount); - ops = xbus->transport.ops; - if(!ops) - atomic_dec(&xbus->transport.transport_refcount); - /* fall through */ - return ops; -} - -void transportops_put(xbus_t *xbus) -{ - struct xbus_ops *ops; - - BUG_ON(!xbus); - ops = xbus->transport.ops; - BUG_ON(!ops); - if(atomic_dec_and_test(&xbus->transport.transport_refcount)) - wake_up(&xbus->transport.transport_unused); -} - -/*------------------------- Initialization -------------------------*/ -static void xbus_core_cleanup(void) -{ - finalize_xbuses_array(); -#ifdef XPP_DEBUGFS - if(debugfs_root) { - DBG(GENERAL, "Removing xpp from debugfs\n"); - debugfs_remove(debugfs_root); - } -#endif -#ifdef CONFIG_PROC_FS - if(proc_xbuses) { - DBG(PROC, "Removing " PROC_XBUSES " from proc\n"); - remove_proc_entry(PROC_XBUSES, xpp_proc_toplevel); - proc_xbuses = NULL; - } -#endif -} - -int __init xbus_core_init(void) -{ - int ret = 0; - - initialize_xbuses_array(); -#ifdef PROTOCOL_DEBUG - INFO("FEATURE: with PROTOCOL_DEBUG\n"); -#endif -#ifdef XPP_DEBUGFS - INFO("FEATURE: with XPP_DEBUGFS support\n"); -#endif -#ifdef CONFIG_PROC_FS - proc_xbuses = create_proc_read_entry(PROC_XBUSES, 0444, xpp_proc_toplevel, read_proc_xbuses, NULL); - if (!proc_xbuses) { - ERR("Failed to create proc file %s\n", PROC_XBUSES); - ret = -EFAULT; - goto err; - } - proc_xbuses->owner = THIS_MODULE; -#endif -#ifdef XPP_DEBUGFS - DBG(GENERAL, "Creating debugfs xpp root\n"); - debugfs_root = debugfs_create_dir("xpp", NULL); - if(!debugfs_root) { - ERR("Failed to create debugfs root\n"); - ret = -EFAULT; - goto err; - } -#endif - if((ret = register_xpp_bus()) < 0) - goto err; - return 0; -err: - xbus_core_cleanup(); - return ret; -} - - -void xbus_core_shutdown(void) -{ - int i; - - for(i = 0; i < MAX_BUSES; i++) { - xbus_t *xbus = get_xbus(i); - - if(xbus) { - xbus_remove(xbus); - } - } - BUG_ON(bus_count); - unregister_xpp_bus(); - xbus_core_cleanup(); -} - -EXPORT_SYMBOL(xpd_of); -EXPORT_SYMBOL(xpd_byaddr); -EXPORT_SYMBOL(get_xbus); -EXPORT_SYMBOL(put_xbus); -EXPORT_SYMBOL(xbus_new); -EXPORT_SYMBOL(xbus_remove); -EXPORT_SYMBOL(xbus_activate); -EXPORT_SYMBOL(xbus_disconnect); -EXPORT_SYMBOL(xbus_receive_xframe); -EXPORT_SYMBOL(xbus_reset_counters); -EXPORT_SYMBOL(xframe_next_packet); -EXPORT_SYMBOL(dump_xframe); -EXPORT_SYMBOL(send_pcm_frame); -EXPORT_SYMBOL(send_cmd_frame); -EXPORT_SYMBOL(xframe_init); -EXPORT_SYMBOL(transportops_get); -EXPORT_SYMBOL(transportops_put); -EXPORT_SYMBOL(xbus_command_queue_tick); -#ifdef XPP_DEBUGFS -EXPORT_SYMBOL(xbus_log); -#endif diff --git a/zaptel/kernel/xpp/xbus-core.h b/zaptel/kernel/xpp/xbus-core.h deleted file mode 100644 index 85fac807..00000000 --- a/zaptel/kernel/xpp/xbus-core.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#ifndef XBUS_CORE_H -#define XBUS_CORE_H - -#include -#include /* for tasklets */ -#include "xpd.h" -#include "xframe_queue.h" -#include "xbus-pcm.h" - -#define MAX_BUSES 32 -#define XFRAME_DATASIZE 512 - -/* forward declarations */ -struct xbus_workqueue; -#ifdef XPP_DEBUGFS -struct debugfs_data; -#endif - -#ifdef __KERNEL__ - -struct xbus_ops { - int (*xframe_send_pcm)(xbus_t *xbus, xframe_t *xframe); - int (*xframe_send_cmd)(xbus_t *xbus, xframe_t *xframe); - xframe_t *(*alloc_xframe)(xbus_t *xbus, gfp_t gfp_flags); - void (*free_xframe)(xbus_t *xbus, xframe_t *xframe); -}; - -/* - * XBUS statistics counters - */ -enum { - XBUS_N_UNITS, - XBUS_N_TX_XFRAME_PCM, - XBUS_N_RX_XFRAME_PCM, - XBUS_N_TX_PACK_PCM, - XBUS_N_RX_PACK_PCM, - XBUS_N_TX_BYTES, - XBUS_N_RX_BYTES, - XBUS_N_TX_PCM_FRAG, - XBUS_N_RX_CMD, - XBUS_N_TX_CMD, -}; - -#define XBUS_COUNTER(xbus, counter) ((xbus)->counters[XBUS_N_ ## counter]) - -#define C_(x) [ XBUS_N_ ## x ] = { #x } - -/* yucky, make an instance so we can size it... */ -static struct xbus_counters { - char *name; -} xbus_counters[] = { - C_(UNITS), - C_(TX_XFRAME_PCM), - C_(RX_XFRAME_PCM), - C_(TX_PACK_PCM), - C_(RX_PACK_PCM), - C_(TX_BYTES), - C_(RX_BYTES), - C_(TX_PCM_FRAG), - C_(RX_CMD), - C_(TX_CMD), -}; - -#undef C_ - -#define XBUS_COUNTER_MAX ARRAY_SIZE(xbus_counters) - -struct xbus_transport { - struct xbus_ops *ops; - void *priv; - ushort max_send_size; - bool transport_running; /* Hardware is functional */ - atomic_t transport_refcount; - wait_queue_head_t transport_unused; - spinlock_t lock; -}; - -#define MAX_SEND_SIZE(xbus) ((xbus)->transport.max_send_size) -#define TRANSPORT_RUNNING(xbus) ((xbus)->transport.transport_running) -#define TRANSPORT_EXIST(xbus) ((xbus)->transport.ops != NULL) - -struct xbus_ops *transportops_get(xbus_t *xbus); -void transportops_put(xbus_t *xbus); - -/* - * Encapsulate all poll related data of a single xbus. - */ -struct xbus_workqueue { - xbus_t *xbus; - struct workqueue_struct *wq; - struct work_struct xpds_init_work; - bool xpds_init_done; - struct list_head card_list; - int num_units; - int num_units_initialized; - wait_queue_head_t wait_for_xpd_initialization; - struct proc_dir_entry *proc_xbus_waitfor_xpds; - spinlock_t worker_lock; -}; - -/* - * Allocate/Free an xframe from pools of empty xframes. - * Calls to {get,put}_xframe are wrapped in - * the macros bellow, so we take/return it - * to the correct pool. - */ -xframe_t *get_xframe(struct xframe_queue *q); -void put_xframe(struct xframe_queue *q, xframe_t *xframe); - -#define ALLOC_SEND_XFRAME(xbus) get_xframe(&(xbus)->send_pool) -#define ALLOC_RECV_XFRAME(xbus) get_xframe(&(xbus)->receive_pool) -#define FREE_SEND_XFRAME(xbus, xframe) put_xframe(&(xbus)->send_pool, (xframe)) -#define FREE_RECV_XFRAME(xbus, xframe) put_xframe(&(xbus)->receive_pool, (xframe)) - -xbus_t *get_xbus(uint num); -void put_xbus(xbus_t *xbus); - -/* - * An xbus is a transport layer for Xorcom Protocol commands - */ -struct xbus { - char busname[XBUS_NAMELEN]; /* set by xbus_new() */ - - /* low-level bus drivers set these 2 fields */ - char location[XBUS_DESCLEN]; - char label[LABEL_SIZE]; - byte revision; /* Protocol revision */ - struct xbus_transport transport; - - int num; - struct xpd *xpds[MAX_XPDS]; - - struct xframe_queue command_queue; - wait_queue_head_t command_queue_empty; - - struct xframe_queue send_pool; /* empty xframes for send */ - struct xframe_queue receive_pool; /* empty xframes for receive */ - - /* tasklet processing */ - struct xframe_queue receive_queue; - struct tasklet_struct receive_tasklet; - int cpu_rcv_intr[NR_CPUS]; - int cpu_rcv_tasklet[NR_CPUS]; - - bool self_ticking; - enum sync_mode sync_mode; - struct timer_list command_timer; - unsigned int xbus_frag_count; - struct xframe_queue pcm_tospan; - - struct xpp_ticker ticker; /* for tick rate */ - struct xpp_drift drift; /* for tick offset */ - - atomic_t pcm_rx_counter; - unsigned int global_counter; - - /* Device-Model */ - struct device astribank; -#define dev_to_xbus(dev) container_of(dev, struct xbus, astribank) - - spinlock_t lock; - atomic_t xbus_ref_count; /* How many need this struct? */ - - /* PCM metrics */ - struct timeval last_tx_sync; - struct timeval last_rx_sync; - unsigned long max_tx_sync; - unsigned long min_tx_sync; - unsigned long max_rx_sync; - unsigned long min_rx_sync; - unsigned long max_rx_process; /* packet processing time (usec) */ -#ifdef SAMPLE_TICKS -#define SAMPLE_SIZE 1000 - int sample_ticks[SAMPLE_SIZE]; - bool sample_running; - int sample_pos; -#endif - - struct xbus_workqueue *worker; - - /* - * Sync adjustment - */ - int sync_adjustment; - int sync_adjustment_offset; - long pll_updated_at; - - struct rw_semaphore in_use; -#define XBUS_GET(xbus) down_read_trylock(&(xbus)->in_use) -#define XBUS_PUT(xbus) up_read(&(xbus)->in_use) - - int num_xpds; - -#ifdef XPP_DEBUGFS - struct dentry *debugfs_dir; - struct dentry *debugfs_file; - struct debugfs_data *debugfs_data; -#endif -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *proc_xbus_dir; - struct proc_dir_entry *proc_xbus_summary; -#ifdef PROTOCOL_DEBUG - struct proc_dir_entry *proc_xbus_command; -#endif -#endif - - /* statistics */ - int counters[XBUS_COUNTER_MAX]; -}; -#endif - -#define XFRAME_MAGIC 123456L - -struct xframe { - unsigned long xframe_magic; - struct list_head frame_list; - atomic_t frame_len; - xbus_t *xbus; - struct timeval tv_created; - struct timeval tv_queued; - struct timeval tv_submitted; - struct timeval tv_received; - /* filled by transport layer */ - size_t frame_maxlen; - byte *packets; /* max XFRAME_DATASIZE */ - byte *first_free; - void *priv; -}; - -void xframe_init(xbus_t *xbus, xframe_t *xframe, void *buf, size_t maxsize, void *priv); - -#define XFRAME_LEN(frame) atomic_read(&(frame)->frame_len) - -int xbus_core_init(void); /* Initializer */ -void xbus_core_shutdown(void); /* Terminator */ - -#ifdef XPP_DEBUGFS -/* Debugfs handling */ -int xbus_log(xbus_t *xbus, xpd_t *xpd, int direction, const void *buf, unsigned long len); -#endif - -/* Frame handling */ -void dump_xframe(const char msg[], const xbus_t *xbus, const xframe_t *xframe, int debug); -int send_cmd_frame(xbus_t *xbus, xframe_t *xframe); - -/* - * Return pointer to next packet slot in the frame - * or NULL if the frame is full. - */ -xpacket_t *xframe_next_packet(xframe_t *xframe, int len); - -/* XBUS handling */ - -/* - * Map: unit+subunit <--> index in xbus->xpds[] - */ -#define XPD_IDX(unit,subunit) ((unit) * MAX_SUBUNIT + (subunit)) -#define XBUS_UNIT(idx) ((idx) / MAX_SUBUNIT) -#define XBUS_SUBUNIT(idx) ((idx) % MAX_SUBUNIT) - -xpd_t *xpd_of(const xbus_t *xbus, int xpd_num); -xpd_t *xpd_byaddr(const xbus_t *xbus, uint unit, uint subunit); -xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, void *priv); -void xbus_remove(xbus_t *xbus); -int xbus_activate(xbus_t *xbus); -void xbus_disconnect(xbus_t *xbus); -void xbus_receive_xframe(xbus_t *xbus, xframe_t *xframe); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -void xbus_populate(struct work_struct *work); -#else -void xbus_populate(void *data); -#endif - -int xbus_register_xpd(xbus_t *xbus, xpd_t *xpd); -int xbus_unregister_xpd(xbus_t *xbus, xpd_t *xpd); - -/* sysfs */ -int register_xpp_bus(void); -void unregister_xpp_bus(void); -int xbus_sysfs_create(xbus_t *xbus); -void xbus_sysfs_remove(xbus_t *xbus); - -#endif /* XBUS_CORE_H */ - diff --git a/zaptel/kernel/xpp/xbus-pcm.c b/zaptel/kernel/xpp/xbus-pcm.c deleted file mode 100644 index 85e4d76f..00000000 --- a/zaptel/kernel/xpp/xbus-pcm.c +++ /dev/null @@ -1,1312 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2007, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif - -#include -#include -#include "xbus-pcm.h" -#include "xbus-core.h" -#include "xpp_zap.h" -#include "zap_debug.h" -#include "parport_debug.h" - -static const char rcsid[] = "$Id: xbus-pcm.c 4474 2008-08-11 14:00:30Z tzafrir $"; - -extern int debug; -#ifdef XPP_EC_CHUNK -#include "supress/ec_xpp.h" -DEF_PARM_BOOL(xpp_ec, 0, 0444, "Do we use our own (1) or Zaptel's (0) echo canceller"); -#endif -#ifdef OPTIMIZE_CHANMUTE -static DEF_PARM_BOOL(optimize_chanmute, 1, 0644, "Optimize by muting inactive channels"); -#endif - -static DEF_PARM(int, disable_pcm, 0, 0644, "Disable all PCM transmissions"); -#ifdef DEBUG_PCMTX -DEF_PARM(int, pcmtx, -1, 0644, "Forced PCM value to transmit (negative to disable)"); -DEF_PARM(int, pcmtx_chan, 0, 0644, "channel to force PCM value"); -#endif -static DEF_PARM_BOOL(disable_pll_sync, 0, 0644, "Disable automatic adjustment of AB clocks"); - -static xbus_t *syncer; /* current syncer */ -static atomic_t xpp_tick_counter = ATOMIC_INIT(0); -static struct xpp_ticker zaptel_ticker; -/* - * The ref_ticker points to the current referece tick source. - * I.e: one of our AB or zaptel_ticker - */ -static struct xpp_ticker *ref_ticker = NULL; -static spinlock_t ref_ticker_lock = SPIN_LOCK_UNLOCKED; -static bool force_zaptel_sync = 0; /* from "/proc/xpp/sync" */ -static xbus_t *global_ticker; -static struct xpp_ticker global_ticks_series; - -#define PROC_SYNC "sync" -#define BIG_TICK_INTERVAL 1000 -#define SYNC_ADJ_MAX 63 /* maximal firmware drift unit (63) */ -/* - * The USB bulk endpoints have a large jitter in the timing of frames - * from the AB to the ehci-hcd. This is because we cannot predict - * in which USB micro-frame our data passes. Each micro-frame is - * A 125 usec. - */ -#define SYNC_ADJ_QUICK 1000 -#define SYNC_ADJ_SLOW 10000 - -#ifdef ZAPTEL_SYNC_TICK -static unsigned int zaptel_tick_count = 0; -#endif - -/*------------------------- SYNC Handling --------------------------*/ - -static void send_drift(xbus_t *xbus, int drift); - -static void xpp_ticker_init(struct xpp_ticker *ticker) -{ - memset(ticker, 0, sizeof(*ticker)); - do_gettimeofday(&ticker->last_sample.tv); - ticker->first_sample = ticker->last_sample; - ticker->cycle = SYNC_ADJ_QUICK; - spin_lock_init(&ticker->lock); -} - -static int xpp_ticker_step(struct xpp_ticker *ticker, const struct timeval *t) -{ - unsigned long flags; - long usec; - bool cycled = 0; - - spin_lock_irqsave(&ticker->lock, flags); - ticker->last_sample.tv = *t; - if((ticker->count % ticker->cycle) == ticker->cycle - 1) { /* rate adjust */ - usec = (long)usec_diff( - &ticker->last_sample.tv, - &ticker->first_sample.tv); - ticker->first_sample = ticker->last_sample; - ticker->tick_period = usec / ticker->cycle; - cycled = 1; - } - ticker->count++; - spin_unlock_irqrestore(&ticker->lock, flags); - return cycled; -} - -static inline void driftinfo_recalc(struct xpp_drift *driftinfo) -{ - driftinfo->delta_max = INT_MIN; - driftinfo->delta_min = INT_MAX; -} - -/* - * No locking. It is called only from: - * - update_sync_master() in a globall spinlock protected code. - * - initalization. - */ -static inline void xbus_drift_clear(xbus_t *xbus) -{ - struct xpp_drift *driftinfo = &xbus->drift; - - driftinfo_recalc(driftinfo); - driftinfo->calc_drift = 0; - xbus->ticker.cycle = SYNC_ADJ_QUICK; -} - -void xpp_drift_init(xbus_t *xbus) -{ - memset(&xbus->drift, 0, sizeof(xbus->drift)); - spin_lock_init(&xbus->drift.lock); - xpp_ticker_init(&xbus->ticker); - xbus->drift.wanted_offset = 500; - xbus_drift_clear(xbus); -} - -#ifdef SAMPLE_TICKS -static void sample_tick(xbus_t *xbus, int sample) -{ - if(!xbus->sample_running) - return; - if(xbus->sample_pos < SAMPLE_SIZE) - xbus->sample_ticks[xbus->sample_pos++] = sample; - else { - xbus->sample_running = 0; - xbus->sample_pos = 0; - } -} -#else -#define sample_tick(x,y) -#endif - -static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv) -{ - struct xpp_drift *driftinfo = &xbus->drift; - struct xpp_ticker *ticker = &xbus->ticker; - unsigned long flags; - bool cycled; - - spin_lock_irqsave(&driftinfo->lock, flags); - cycled = xpp_ticker_step(&xbus->ticker, tv); - if(ref_ticker && syncer && xbus->sync_mode == SYNC_MODE_PLL) { - int new_delta_tick = ticker->count - ref_ticker->count; - int lost_ticks = new_delta_tick - driftinfo->delta_tick; - - driftinfo->delta_tick = new_delta_tick; - if(lost_ticks) { - driftinfo->lost_ticks++; - driftinfo->lost_tick_count += abs(lost_ticks); - XBUS_DBG(SYNC, xbus, "Lost %d tick%s\n", - lost_ticks, - (abs(lost_ticks) > 1) ? "s": ""); - ticker->cycle = SYNC_ADJ_QUICK; - if(abs(lost_ticks) > 100) - ticker->count = ref_ticker->count; - } else { - long usec_delta; - bool nofix = 0; - - usec_delta = (long)usec_diff( - &ticker->last_sample.tv, - &ref_ticker->last_sample.tv); - usec_delta -= driftinfo->wanted_offset; - sample_tick(xbus, usec_delta); - if(abs(usec_delta) > 300) { - /* - * We are close to the edge, send a brutal - * fix, and skip calculation until next time. - */ - if(usec_delta > 0 && xbus->sync_adjustment > -SYNC_ADJ_MAX) { - XBUS_DBG(SYNC, xbus, "Pullback usec_delta=%ld\n", usec_delta); - send_drift(xbus, -SYNC_ADJ_MAX); /* emergency push */ - } - if(usec_delta < 0 && xbus->sync_adjustment < SYNC_ADJ_MAX) { - XBUS_DBG(SYNC, xbus, "Pushback usec_delta=%ld\n", usec_delta); - send_drift(xbus, SYNC_ADJ_MAX); /* emergency push */ - } - ticker->cycle = SYNC_ADJ_QUICK; - nofix = 1; - } else { - /* good data, use it */ - if(usec_delta > driftinfo->delta_max) - driftinfo->delta_max = usec_delta; - if(usec_delta < driftinfo->delta_min) - driftinfo->delta_min = usec_delta; - } - if(!nofix && cycled) { - int offset = 0; - - driftinfo->median = (driftinfo->delta_max + driftinfo->delta_min) / 2; - driftinfo->jitter = driftinfo->delta_max - driftinfo->delta_min; - if(abs(driftinfo->median) >= 150) { /* more than 1 usb uframe */ - int factor = abs(driftinfo->median) / 125; - - factor = 1 + (factor * 8000) / ticker->cycle; - if(driftinfo->median > 0) - offset = driftinfo->calc_drift - factor; - else - offset = driftinfo->calc_drift + factor; - /* for large median, push some more */ - if(abs(driftinfo->median) >= 300) { /* more than 2 usb uframes */ - ticker->cycle = SYNC_ADJ_QUICK; - XBUS_NOTICE(xbus, - "Back to quick: median=%d\n", - driftinfo->median); - } - } else { - ticker->cycle += 500; - if(ticker->cycle >= SYNC_ADJ_SLOW) - ticker->cycle = SYNC_ADJ_SLOW; - } - driftinfo->calc_drift = offset; - XBUS_DBG(SYNC, xbus, - "ADJ: min=%d max=%d jitter=%d median=%d offset=%d\n", - driftinfo->delta_min, - driftinfo->delta_max, - driftinfo->jitter, - driftinfo->median, - offset); - if(offset < -SYNC_ADJ_MAX) - offset = -SYNC_ADJ_MAX; - if(offset > SYNC_ADJ_MAX) - offset = SYNC_ADJ_MAX; - xbus->sync_adjustment_offset = offset; - if(xbus != syncer && xbus->sync_adjustment != offset) - send_drift(xbus, offset); - driftinfo_recalc(driftinfo); - } - } - } - spin_unlock_irqrestore(&driftinfo->lock, flags); -} - -const char *sync_mode_name(enum sync_mode mode) -{ - static const char *sync_mode_names[] = { - [SYNC_MODE_AB] = "AB", - [SYNC_MODE_NONE] = "NONE", - [SYNC_MODE_PLL] = "PLL", - [SYNC_MODE_QUERY] = "QUERY", - }; - if(mode >= ARRAY_SIZE(sync_mode_names)) - return NULL; - return sync_mode_names[mode]; -} - -static void xpp_set_syncer(xbus_t *xbus, bool on) -{ - if(syncer != xbus && on) { - XBUS_DBG(SYNC, xbus, "New syncer\n"); - syncer = xbus; - } else if(syncer == xbus && !on) { - XBUS_DBG(SYNC, xbus, "Lost syncer\n"); - syncer = NULL; - } else - XBUS_DBG(SYNC, xbus, "ignore %s (current syncer: %s)\n", - (on)?"ON":"OFF", - (syncer) ? syncer->busname : "NO-SYNC"); -} - -static void xbus_command_timer(unsigned long param) -{ - xbus_t *xbus = (xbus_t *)param; - struct timeval now; - - BUG_ON(!xbus); - do_gettimeofday(&now); - xbus_command_queue_tick(xbus); - if(!xbus->self_ticking) - mod_timer(&xbus->command_timer, jiffies + 1); /* Must be 1KHz rate */ -} - -void xbus_set_command_timer(xbus_t *xbus, bool on) -{ - XBUS_DBG(SYNC, xbus, "%s\n", (on)?"ON":"OFF"); - if(on) { - if(!timer_pending(&xbus->command_timer)) { - XBUS_DBG(SYNC, xbus, "add_timer\n"); - xbus->command_timer.function = xbus_command_timer; - xbus->command_timer.data = (unsigned long)xbus; - xbus->command_timer.expires = jiffies + 1; - add_timer(&xbus->command_timer); - } - } else if(timer_pending(&xbus->command_timer)) { - XBUS_DBG(SYNC, xbus, "del_timer\n"); - del_timer(&xbus->command_timer); - } -} - -/* - * Called when the Astribank replies to a sync change request - */ -void got_new_syncer(xbus_t *xbus, enum sync_mode mode, int drift) -{ - unsigned long flags; - - XBUS_DBG(SYNC, xbus, "Mode %s (%d), drift=%d (pcm_rx_counter=%d)\n", - sync_mode_name(mode), mode, drift, atomic_read(&xbus->pcm_rx_counter)); - spin_lock_irqsave(&xbus->lock, flags); - xbus->sync_adjustment = (signed char)drift; - if(xbus->sync_mode == mode) { - XBUS_DBG(SYNC, xbus, "Already in mode '%s'. Ignored\n", sync_mode_name(mode)); - goto out; - } - switch(mode) { - case SYNC_MODE_AB: - xbus->sync_mode = mode; - xbus_set_command_timer(xbus, 0); - xbus->self_ticking = 1; - xpp_set_syncer(xbus, 1); - global_ticker = xbus; - break; - case SYNC_MODE_PLL: - xbus->sync_mode = mode; - xbus_set_command_timer(xbus, 0); - xbus->self_ticking = 1; - xpp_set_syncer(xbus, 0); - global_ticker = xbus; - break; - case SYNC_MODE_NONE: /* lost sync source */ - xbus->sync_mode = mode; - xbus_set_command_timer(xbus, 1); - xbus->self_ticking = 0; - xpp_set_syncer(xbus, 0); - break; - case SYNC_MODE_QUERY: /* ignore */ - break; - default: - XBUS_ERR(xbus, "%s: unknown mode=0x%X\n", __FUNCTION__, mode); - } -out: - spin_unlock_irqrestore(&xbus->lock, flags); -} - -void xbus_request_sync(xbus_t *xbus, enum sync_mode mode) -{ - BUG_ON(!xbus); - XBUS_DBG(SYNC, xbus, "sent request (mode=%d)\n", mode); - CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, mode, 0); -} - -static void reset_sync_counters(void) -{ - int i; - - //DBG(SYNC, "%d\n", atomic_read(&xpp_tick_counter)); - for(i = 0; i < MAX_BUSES; i++) { - xbus_t *xbus = get_xbus(i); - - if(!xbus) - continue; - /* - * Don't send to non self_ticking Astribanks: - * - Maybe they didn't finish initialization - * - Or maybe they didn't answer us in the first place - (e.g: wrong firmware version, etc). - */ - if (TRANSPORT_RUNNING(xbus) && xbus->self_ticking) { - if(XBUS_GET(xbus)) { - /* Reset sync LEDs once in a while */ - CALL_PROTO(GLOBAL, RESET_SYNC_COUNTERS, xbus, NULL); - XBUS_PUT(xbus); - } else { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) - XBUS_DBG(GENERAL, xbus, - "Dropped packet. Is shutting down. (%d)\n", rate_limit); - } - } - put_xbus(xbus); - } -} - -static void send_drift(xbus_t *xbus, int drift) -{ - struct timeval now; - const char *msg; - - BUG_ON(abs(drift) > SYNC_ADJ_MAX); - do_gettimeofday(&now); - if(drift > xbus->sync_adjustment) - msg = "up"; - else - msg = "down"; - XBUS_DBG(SYNC, xbus, "%sDRIFT adjust %s (%d) (last update %ld seconds ago)\n", - (disable_pll_sync) ? "Fake " : "", - msg, drift, now.tv_sec - xbus->pll_updated_at); - if(!disable_pll_sync) - CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_PLL, drift); - xbus->pll_updated_at = now.tv_sec; -} - -static void global_tick(void) -{ - struct timeval now; - - do_gettimeofday(&now); - atomic_inc(&xpp_tick_counter); - if((atomic_read(&xpp_tick_counter) % BIG_TICK_INTERVAL) == 0) - reset_sync_counters(); - xpp_ticker_step(&global_ticks_series, &now); -} - -#ifdef ZAPTEL_SYNC_TICK -int zaptel_sync_tick(struct zt_span *span, int is_master) -{ - xpd_t *xpd = span->pvt; - static int redundant_ticks; /* for extra spans */ - struct timeval now; - - if(!force_zaptel_sync) - goto noop; - do_gettimeofday(&now); - BUG_ON(!xpd); - /* - * Detect if any of our spans is zaptel sync master - */ - if(is_master) { - static int rate_limit; - - if(xpd->xbus != syncer && ((rate_limit % 1003) == 0)) { - XPD_ERR(xpd, - "Zaptel master, but syncer=%s\n", - xpd->xbus->busname); - } - if((rate_limit % 5003) == 0) - XPD_NOTICE(xpd, "Zaptel master: ignore ZAPTEL sync\n"); - rate_limit++; - goto noop; - } - /* Now we know for sure someone else is zaptel sync master */ - if(syncer) { - static int rate_limit; - - if((rate_limit++ % 5003) == 0) - XBUS_DBG(SYNC, syncer, - "Already a syncer, ignore ZAPTEL sync\n"); - goto noop; - } - /* ignore duplicate calls from all our registered spans */ - if((redundant_ticks++ % total_registered_spans()) != 0) { -#if 0 - static int rate_limit; - - if((rate_limit++ % 1003) < 16) - XPD_NOTICE(xpd, "boop (%d)\n", zaptel_tick_count); -#endif - goto noop; - } - xpp_ticker_step(&zaptel_ticker, &now); - zaptel_tick_count++; - //flip_parport_bit(1); - return 0; -noop: - return 0; /* No auto sync from zaptel */ -} -#endif - -/* - * called from elect_syncer() - * if new_syncer is NULL, than we move all to SYNC_MODE_PLL - * for ZAPTEL sync. - */ -static void update_sync_master(xbus_t *new_syncer) -{ - const char *msg = (force_zaptel_sync) ? "ZAPTEL" : "NO-SYNC"; - int i; - unsigned long flags; - - DBG(SYNC, "%s => %s\n", - (syncer) ? syncer->busname : msg, - (new_syncer) ? new_syncer->busname : msg); - /* - * This global locking protects: - * - The ref_ticker so it won't be used while we change it. - * - The xbus_drift_clear() from corrupting driftinfo data. - */ - spin_lock_irqsave(&ref_ticker_lock, flags); - if(syncer) - xbus_drift_clear(syncer); /* Clean old data */ - if(new_syncer) { - XBUS_DBG(SYNC, new_syncer, "pcm_rx_counter=%d\n", - atomic_read(&new_syncer->pcm_rx_counter)); - force_zaptel_sync = 0; - ref_ticker = &new_syncer->ticker; - xbus_drift_clear(new_syncer); /* Clean new data */ - xbus_request_sync(new_syncer, SYNC_MODE_AB); - } else if(force_zaptel_sync) { - ref_ticker = &zaptel_ticker; - } else { - ref_ticker = NULL; - } - spin_unlock_irqrestore(&ref_ticker_lock, flags); - DBG(SYNC, "stop unwanted syncers\n"); - /* Shut all down except the wanted sync master */ - for(i = 0; i < MAX_BUSES; i++) { - xbus_t *xbus = get_xbus(i); - if(!xbus) - continue; - if(TRANSPORT_RUNNING(xbus) && xbus != new_syncer) { - if(xbus->self_ticking) - xbus_request_sync(xbus, SYNC_MODE_PLL); - else - XBUS_DBG(SYNC, xbus, "Not self_ticking yet. Ignore\n"); - } - put_xbus(xbus); - } -} - -void elect_syncer(const char *msg) -{ - int i; - int j; - uint timing_priority = 0; - xpd_t *best_xpd = NULL; - xbus_t *the_xbus = NULL; - - for(i = 0; i < MAX_BUSES; i++) { - xbus_t *xbus = get_xbus(i); - if(!xbus) - continue; - if(!the_xbus) - the_xbus = xbus; - if (TRANSPORT_RUNNING(xbus)) { - for(j = 0; j < MAX_XPDS; j++) { - xpd_t *xpd = xpd_of(xbus, j); - - if(!xpd || !xpd->card_present) - continue; - if(xpd->timing_priority > timing_priority) { - timing_priority = xpd->timing_priority; - best_xpd = xpd; - } - } - } - put_xbus(xbus); - } - if(best_xpd) { - the_xbus = best_xpd->xbus; - XPD_DBG(SYNC, best_xpd, "%s: elected with priority %d\n", msg, timing_priority); - } else if(the_xbus) { - XBUS_DBG(SYNC, the_xbus, "%s: elected\n", msg); - } else - DBG(SYNC, "%s: No more syncers\n", msg); - if(the_xbus != syncer) - update_sync_master(the_xbus); -} - -/* - * This function is used by FXS/FXO. The pcm_mask argument signifies - * channels which should be *added* to the automatic calculation. - * Normally, this argument is 0. - * - * The caller should spinlock the XPD before calling it. - */ -void __pcm_recompute(xpd_t *xpd, xpp_line_t pcm_mask) -{ - int i; - int line_count = 0; - - XPD_DBG(SIGNAL, xpd, "pcm_mask=0x%X\n", pcm_mask); - /* Add/remove all the trivial cases */ - pcm_mask |= xpd->offhook; - pcm_mask |= xpd->cid_on; - pcm_mask &= ~xpd->digital_signalling; /* No PCM in D-Channels */ - pcm_mask &= ~xpd->digital_inputs; - pcm_mask &= ~xpd->digital_outputs; - for_each_line(xpd, i) - if(IS_SET(pcm_mask, i)) - line_count++; - /* - * FIXME: Workaround a bug in sync code of the Astribank. - * Send dummy PCM for sync. - */ - if(xpd->addr.unit == 0 && pcm_mask == 0) { - pcm_mask = BIT(0); - line_count = 1; - } - xpd->pcm_len = (line_count) - ? RPACKET_HEADERSIZE + sizeof(xpp_line_t) + line_count * ZT_CHUNKSIZE - : 0L; - xpd->wanted_pcm_mask = pcm_mask; -} - -/* - * A spinlocked version of __pcm_recompute() - */ -void pcm_recompute(xpd_t *xpd, xpp_line_t pcm_mask) -{ - unsigned long flags; - - spin_lock_irqsave(&xpd->lock, flags); - __pcm_recompute(xpd, pcm_mask); - spin_unlock_irqrestore(&xpd->lock, flags); -} - -void fill_beep(u_char *buf, int num, int duration) -{ - bool alternate = (duration) ? (jiffies/(duration*1000)) & 0x1 : 0; - int which; - u_char *snd; - - /* - * debug tones - */ - static u_char beep[] = { - 0x7F, 0xBE, 0xD8, 0xBE, 0x80, 0x41, 0x24, 0x41, /* Dima */ - 0x67, 0x90, 0x89, 0x90, 0xFF, 0x10, 0x09, 0x10, /* Izzy */ - }; - static u_char beep_alt[] = { - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, /* silence */ - }; - if(alternate) { - which = num % ARRAY_SIZE(beep_alt); - snd = &beep_alt[which]; - } else { - which = num % ARRAY_SIZE(beep); - snd = &beep[which]; - } - memcpy(buf, snd, ZT_CHUNKSIZE); -} - -#ifdef XPP_EC_CHUNK -/* - * Taken from zaptel.c - */ -static inline void xpp_ec_chunk(struct zt_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk) -{ - int16_t rxlin; - int x; - unsigned long flags; - - /* Perform echo cancellation on a chunk if necessary */ - if (!chan->ec) - return; - spin_lock_irqsave(&chan->lock, flags); - for (x=0;xec, ZT_XLAW(txchunk[x], chan), rxlin); - rxchunk[x] = ZT_LIN2X((int)rxlin, chan); - } - spin_unlock_irqrestore(&chan->lock, flags); -} -#endif - -static void do_ec(xpd_t *xpd) -{ -#ifdef WITH_ECHO_SUPPRESSION - struct zt_chan *chans = xpd->span.chans; - int i; - - /* FIXME: need to Echo cancel double buffered data */ - for (i = 0;i < xpd->span.channels; i++) { - if(unlikely(IS_SET(xpd->digital_signalling, i))) /* Don't echo cancel BRI D-chans */ - continue; - if(!IS_SET(xpd->wanted_pcm_mask, i)) /* No ec for unwanted PCM */ - continue; -#ifdef XPP_EC_CHUNK - /* even if defined, parameterr xpp_ec can override at run-time */ - if (xpp_ec) - xpp_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]); - else -#endif - zt_ec_chunk(&chans[i], chans[i].readchunk, xpd->ec_chunk2[i]); - memcpy(xpd->ec_chunk2[i], xpd->ec_chunk1[i], ZT_CHUNKSIZE); - memcpy(xpd->ec_chunk1[i], chans[i].writechunk, ZT_CHUNKSIZE); - } -#endif -} - -#if 0 -/* Okay, now we get to the signalling. You have several options: */ - -/* Option 1: If you're a T1 like interface, you can just provide a - rbsbits function and we'll assert robbed bits for you. Be sure to - set the ZT_FLAG_RBS in this case. */ - -/* Opt: If the span uses A/B bits, set them here */ -int (*rbsbits)(struct zt_chan *chan, int bits); - -/* Option 2: If you don't know about sig bits, but do have their - equivalents (i.e. you can disconnect battery, detect off hook, - generate ring, etc directly) then you can just specify a - sethook function, and we'll call you with appropriate hook states - to set. Still set the ZT_FLAG_RBS in this case as well */ -int (*hooksig)(struct zt_chan *chan, zt_txsig_t hookstate); - -/* Option 3: If you can't use sig bits, you can write a function - which handles the individual hook states */ -int (*sethook)(struct zt_chan *chan, int hookstate); -#endif - -int xpp_echocan(struct zt_chan *chan, int len) -{ -#ifdef XPP_EC_CHUNK - if(len == 0) { /* shut down */ - /* zaptel calls this also during channel initialization */ - if(chan->ec) { - xpp_echo_can_free(chan->ec); - } - return 0; - } - if(chan->ec) { - ERR("%s: Trying to override an existing EC (%p)\n", __FUNCTION__, chan->ec); - return -EINVAL; - } - chan->ec = xpp_echo_can_create(len, 0); - if(!chan->ec) { - ERR("%s: Failed creating xpp EC (len=%d)\n", __FUNCTION__, len); - return -EINVAL; - } -#endif - return 0; -} - -static bool pcm_valid(xpd_t *xpd, xpacket_t *pack) -{ - xpp_line_t lines = RPACKET_FIELD(pack, GLOBAL, PCM_READ, lines); - int i; - int count = 0; - uint16_t good_len; - - BUG_ON(!pack); - BUG_ON(XPACKET_OP(pack) != XPROTO_NAME(GLOBAL, PCM_READ)); - /* - * Don't use for_each_line(xpd, i) here because for BRI it will - * ignore the channels of the other xpd's in the same unit. - */ - for (i = 0; i < CHANNELS_PERXPD; i++) - if(IS_SET(lines, i)) - count++; - /* FRAMES: include opcode in calculation */ - good_len = RPACKET_HEADERSIZE + sizeof(xpp_line_t) + count * 8; - if(XPACKET_LEN(pack) != good_len) { - static int rate_limit = 0; - - XPD_COUNTER(xpd, RECV_ERRORS)++; - if((rate_limit++ % 1000) <= 10) { - XPD_ERR(xpd, "BAD PCM REPLY: packet_len=%d (should be %d), count=%d\n", - XPACKET_LEN(pack), good_len, count); - dump_packet("BAD PCM REPLY", pack, 1); - } - return 0; - } - return 1; -} - - - -static inline void pcm_frame_out(xbus_t *xbus, xframe_t *xframe) -{ - unsigned long flags; - struct timeval now; - unsigned long usec; - - spin_lock_irqsave(&xbus->lock, flags); - do_gettimeofday(&now); - if(unlikely(disable_pcm || !TRANSPORT_RUNNING(xbus))) - goto dropit; - if(XPACKET_ADDR_SYNC((xpacket_t *)xframe->packets)) { - usec = usec_diff(&now, &xbus->last_tx_sync); - xbus->last_tx_sync = now; - /* ignore startup statistics */ - if(likely(atomic_read(&xbus->pcm_rx_counter) > BIG_TICK_INTERVAL)) { - if(abs(usec - 1000) > TICK_TOLERANCE) { - static int rate_limit; - - if((rate_limit++ % 5003) == 0) - XBUS_DBG(SYNC, xbus, "Bad PCM TX timing(%d): usec=%ld.\n", - rate_limit, usec); - } - if(usec > xbus->max_tx_sync) - xbus->max_tx_sync = usec; - if(usec < xbus->min_tx_sync) - xbus->min_tx_sync = usec; - } - } - spin_unlock_irqrestore(&xbus->lock, flags); - /* OK, really send it */ - if(debug & DBG_PCM ) - dump_xframe("TX_XFRAME_PCM", xbus, xframe, debug); - send_pcm_frame(xbus, xframe); - XBUS_COUNTER(xbus, TX_XFRAME_PCM)++; - return; -dropit: - spin_unlock_irqrestore(&xbus->lock, flags); - FREE_SEND_XFRAME(xbus, xframe); -} - -/* - * Generic implementations of card_pcmfromspan()/card_pcmtospan() - * For FXS/FXO - */ -void generic_card_pcm_fromspan(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, xpacket_t *pack) -{ - byte *pcm; - struct zt_chan *chans; - unsigned long flags; - int i; - - BUG_ON(!xbus); - BUG_ON(!xpd); - BUG_ON(!pack); - RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines) = lines; - pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm); - spin_lock_irqsave(&xpd->lock, flags); - chans = xpd->span.chans; - for (i = 0; i < xpd->channels; i++) { - if(IS_SET(lines, i)) { - if(SPAN_REGISTERED(xpd)) { -#ifdef DEBUG_PCMTX - int channo = xpd->span.chans[i].channo; - - if(pcmtx >= 0 && pcmtx_chan == channo) - memset((u_char *)pcm, pcmtx, ZT_CHUNKSIZE); - else -#endif - memcpy((u_char *)pcm, chans[i].writechunk, ZT_CHUNKSIZE); - } else - memset((u_char *)pcm, 0x7F, ZT_CHUNKSIZE); - pcm += ZT_CHUNKSIZE; - } - } - XPD_COUNTER(xpd, PCM_WRITE)++; - spin_unlock_irqrestore(&xpd->lock, flags); -} - -void generic_card_pcm_tospan(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack) -{ - byte *pcm; - xpp_line_t pcm_mask; - xpp_line_t pcm_mute; - unsigned long flags; - int i; - - pcm = RPACKET_FIELD(pack, GLOBAL, PCM_READ, pcm); - pcm_mask = RPACKET_FIELD(pack, GLOBAL, PCM_READ, lines); - spin_lock_irqsave(&xpd->lock, flags); - /* - * Calculate the channels we want to mute - */ - pcm_mute = ~xpd->wanted_pcm_mask; - pcm_mute |= xpd->mute_dtmf | xpd->silence_pcm; - if(!SPAN_REGISTERED(xpd)) - goto out; - for (i = 0; i < xpd->channels; i++) { - volatile u_char *r = xpd->span.chans[i].readchunk; - bool got_data = IS_SET(pcm_mask, i); - - if(got_data && !IS_SET(pcm_mute, i)) { - /* We have and want real data */ - // memset((u_char *)r, 0x5A, ZT_CHUNKSIZE); // DEBUG - memcpy((u_char *)r, pcm, ZT_CHUNKSIZE); - } else if(IS_SET(xpd->wanted_pcm_mask | xpd->silence_pcm, i)) { - /* Inject SILENCE */ - memset((u_char *)r, 0x7F, ZT_CHUNKSIZE); - if(IS_SET(xpd->silence_pcm, i)) { - /* - * This will clear the EC buffers until next tick - * So we don't have noise residues from the past. - */ - memset(xpd->ec_chunk2[i], 0x7F, ZT_CHUNKSIZE); - memset(xpd->ec_chunk1[i], 0x7F, ZT_CHUNKSIZE); - } - } - if(got_data) - pcm += ZT_CHUNKSIZE; - } -out: - XPD_COUNTER(xpd, PCM_READ)++; - spin_unlock_irqrestore(&xpd->lock, flags); -} - -static int copy_pcm_tospan(xbus_t *xbus, xframe_t *xframe) -{ - byte *xframe_end; - xpacket_t *pack; - byte *p; - int ret = -EPROTO; /* Assume error */ - - if(debug & DBG_PCM) - dump_xframe("RX_XFRAME_PCM", xbus, xframe, debug); - /* handle content */ - - p = xframe->packets; - xframe_end = p + XFRAME_LEN(xframe); - do { - int len; - xpd_t *xpd; - - pack = (xpacket_t *)p; - len = XPACKET_LEN(pack); - /* Sanity checks */ - if(unlikely(XPACKET_OP(pack) != XPROTO_NAME(GLOBAL,PCM_READ))) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) { - XBUS_NOTICE(xbus, - "%s: Non-PCM packet within a PCM xframe. (%d)\n", - __FUNCTION__, rate_limit); - dump_xframe("In PCM xframe", xbus, xframe, debug); - } - goto out; - } - p += len; - if(p > xframe_end || len < RPACKET_HEADERSIZE) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) { - XBUS_NOTICE(xbus, - "%s: Invalid packet length %d. (%d)\n", - __FUNCTION__, len, rate_limit); - dump_xframe("BAD LENGTH", xbus, xframe, debug); - } - goto out; - } - xpd = xpd_byaddr(xbus, XPACKET_ADDR_UNIT(pack), XPACKET_ADDR_SUBUNIT(pack)); - if(unlikely(!xpd)) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) { - notify_bad_xpd(__FUNCTION__, xbus, XPACKET_ADDR(pack), "RECEIVE PCM"); - dump_xframe("Unknown XPD addr", xbus, xframe, debug); - } - goto out; - } - if(!pcm_valid(xpd, pack)) - goto out; - if(SPAN_REGISTERED(xpd)) { - XBUS_COUNTER(xbus, RX_PACK_PCM)++; - CALL_XMETHOD(card_pcm_tospan, xbus, xpd, pack); - } - } while(p < xframe_end); - ret = 0; /* all good */ - XBUS_COUNTER(xbus, RX_XFRAME_PCM)++; -out: - FREE_RECV_XFRAME(xbus, xframe); - return ret; -} - -static void xbus_tick(xbus_t *xbus) -{ - int i; - xpd_t *xpd; - xframe_t *xframe = NULL; - xpacket_t *pack = NULL; - size_t pcm_len; - bool sent_sync_bit = 0; - - /* - * Update zaptel - */ - for(i = 0; i < MAX_XPDS; i++) { - xpd = xpd_of(xbus, i); - if(xpd && SPAN_REGISTERED(xpd)) { -#ifdef OPTIMIZE_CHANMUTE - int j; - xpp_line_t xmit_mask = xpd->wanted_pcm_mask; - - xmit_mask |= xpd->silence_pcm; - xmit_mask |= xpd->digital_signalling; - for_each_line(xpd, j) { - xpd->chans[j].chanmute = (optimize_chanmute) - ? !IS_SET(xmit_mask, j) - : 0; - } -#endif - /* - * calls to zt_transmit should be out of spinlocks, as it may call back - * our hook setting methods. - */ - zt_transmit(&xpd->span); - } - } - /* - * Fill xframes - */ - for(i = 0; i < MAX_XPDS; i++) { - if((xpd = xpd_of(xbus, i)) == NULL) - continue; - pcm_len = xpd->pcm_len; - if(SPAN_REGISTERED(xpd)) { - if(pcm_len && xpd->card_present) { - do { - // pack = NULL; /* FORCE single packet frames */ - if(xframe && !pack) { /* FULL frame */ - pcm_frame_out(xbus, xframe); - xframe = NULL; - XBUS_COUNTER(xbus, TX_PCM_FRAG)++; - } - if(!xframe) { /* Alloc frame */ - xframe = ALLOC_SEND_XFRAME(xbus); - if (!xframe) { - static int rate_limit; - - if((rate_limit++ % 3001) == 0) - XBUS_ERR(xbus, - "%s: failed to allocate new xframe\n", - __FUNCTION__); - return; - } - } - pack = xframe_next_packet(xframe, pcm_len); - } while(!pack); - XPACKET_INIT(pack, GLOBAL, PCM_WRITE, xpd->xbus_idx, 1, 0); - XPACKET_LEN(pack) = pcm_len; - if(!sent_sync_bit) { - XPACKET_ADDR_SYNC(pack) = 1; - sent_sync_bit = 1; - } - CALL_XMETHOD(card_pcm_fromspan, xbus, xpd, xpd->wanted_pcm_mask, pack); - XBUS_COUNTER(xbus, TX_PACK_PCM)++; - } - } - } - if(xframe) /* clean any leftovers */ - pcm_frame_out(xbus, xframe); - /* - * Receive PCM - */ - while((xframe = xframe_dequeue(&xbus->pcm_tospan)) != NULL) { - copy_pcm_tospan(xbus, xframe); - if(XPACKET_ADDR_SYNC((xpacket_t *)xframe->packets)) { - struct timeval now; - unsigned long usec; - - do_gettimeofday(&now); - usec = usec_diff(&now, &xbus->last_rx_sync); - xbus->last_rx_sync = now; - /* ignore startup statistics */ - if(likely(atomic_read(&xbus->pcm_rx_counter) > BIG_TICK_INTERVAL)) { - if(abs(usec - 1000) > TICK_TOLERANCE) { - static int rate_limit; - - if((rate_limit++ % 5003) == 0) - XBUS_DBG(SYNC, xbus, "Bad PCM RX timing(%d): usec=%ld.\n", - rate_limit, usec); - } - if(usec > xbus->max_rx_sync) - xbus->max_rx_sync = usec; - if(usec < xbus->min_rx_sync) - xbus->min_rx_sync = usec; - } - } - } - for(i = 0; i < MAX_XPDS; i++) { - xpd = xpd_of(xbus, i); - if(!xpd || !xpd->card_present) - continue; - if(SPAN_REGISTERED(xpd)) { - do_ec(xpd); - zt_receive(&xpd->span); - } - xpd->silence_pcm = 0; /* silence was injected */ - xpd->timer_count = xbus->global_counter; - /* - * Must be called *after* tx/rx so - * D-Chan counters may be cleared - */ - CALL_XMETHOD(card_tick, xbus, xpd); - } -} - -static void do_tick(xbus_t *xbus, const struct timeval *tv_received) -{ - int counter = atomic_read(&xpp_tick_counter); - unsigned long flags; - - xbus_command_queue_tick(xbus); - if(global_ticker == xbus) - global_tick(); /* called from here or zaptel_sync_tick() */ - spin_lock_irqsave(&ref_ticker_lock, flags); - xpp_drift_step(xbus, tv_received); - spin_unlock_irqrestore(&ref_ticker_lock, flags); - if(likely(xbus->self_ticking)) - xbus_tick(xbus); - xbus->global_counter = counter; -} - -void xframe_receive_pcm(xbus_t *xbus, xframe_t *xframe) -{ - if(!xframe_enqueue(&xbus->pcm_tospan, xframe)) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) - XBUS_DBG(SYNC, xbus, - "Failed to enqueue received pcm frame. (%d)\n", - rate_limit); - FREE_RECV_XFRAME(xbus, xframe); - } - /* - * The sync_master bit is marked at the first packet - * of the frame, regardless of the XPD that is sync master. - * FIXME: what about PRI split? - */ - if(XPACKET_ADDR_SYNC((xpacket_t *)xframe->packets)) { - do_tick(xbus, &xframe->tv_received); - atomic_inc(&xbus->pcm_rx_counter); - } else - xbus->xbus_frag_count++; -} - -#ifdef CONFIG_PROC_FS -static int proc_sync_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - struct timeval now; - unsigned int counter = atomic_read(&xpp_tick_counter); - unsigned long usec; - - do_gettimeofday(&now); - len += sprintf(page + len, "# To modify sync source write into this file:\n"); - len += sprintf(page + len, "# ZAPTEL - Another zaptel device provide sync\n"); - len += sprintf(page + len, "# SYNC=nn - XBUS-nn provide sync\n"); - len += sprintf(page + len, "# QUERY=nn - Query XBUS-nn for sync information (DEBUG)\n"); - if(!syncer) { - if(force_zaptel_sync) - len += sprintf(page + len, "ZAPTEL\n"); - else - len += sprintf(page + len, "NO-SYNC\n"); - } else - len += sprintf(page + len, "SYNC=%02d\n", syncer->num); -#ifdef ZAPTEL_SYNC_TICK - if(force_zaptel_sync) { - len += sprintf(page + len, - "Zaptel Reference Sync (%d registered spans):\n", - total_registered_spans()); - len += sprintf(page + len, "\tzaptel_tick: #%d\n", zaptel_tick_count); - len += sprintf(page + len, "\ttick - zaptel_tick = %d\n", - counter - zaptel_tick_count); - } else { - len += sprintf(page + len, - "Zaptel Reference Sync Not activated\n"); - } -#endif - usec = usec_diff(&now, &global_ticks_series.last_sample.tv); - len += sprintf(page + len, "\ntick: #%d\n", counter); - len += sprintf(page + len, - "tick duration: %d usec (measured %ld.%ld msec ago)\n", - global_ticks_series.tick_period, - usec / 1000, usec % 1000); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -static int proc_sync_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - char buf[MAX_PROC_WRITE]; - int xbus_num; - int xpd_num; - xbus_t *xbus; - xpd_t *xpd; - - // DBG(SYNC, "%s: count=%ld\n", __FUNCTION__, count); - if(count >= MAX_PROC_WRITE) - return -EINVAL; - if(copy_from_user(buf, buffer, count)) - return -EFAULT; - buf[count] = '\0'; - if(strncmp("ZAPTEL", buf, 6) == 0) { - DBG(SYNC, "ZAPTEL\n"); - force_zaptel_sync=1; - update_sync_master(NULL); - } else if(sscanf(buf, "SYNC=%d", &xbus_num) == 1) { - DBG(SYNC, "SYNC=%d\n", xbus_num); - if((xbus = get_xbus(xbus_num)) == NULL) { - ERR("No bus %d exists\n", xbus_num); - return -ENXIO; - } - update_sync_master(xbus); - put_xbus(xbus); - } else if(sscanf(buf, "QUERY=%d", &xbus_num) == 1) { - DBG(SYNC, "QUERY=%d\n", xbus_num); - if((xbus = get_xbus(xbus_num)) == NULL) { - ERR("No bus %d exists\n", xbus_num); - return -ENXIO; - } - CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_QUERY, 0); - put_xbus(xbus); - } else if(sscanf(buf, "%d %d", &xbus_num, &xpd_num) == 2) { - NOTICE("Using deprecated syntax to update %s file\n", - PROC_SYNC); - if(xpd_num != 0) { - ERR("Currently can only set sync for XPD #0\n"); - return -EINVAL; - } - if((xbus = get_xbus(xbus_num)) == NULL) { - ERR("No bus %d exists\n", xbus_num); - return -ENXIO; - } - if((xpd = xpd_of(xbus, xpd_num)) == NULL) { - XBUS_ERR(xbus, "No xpd %d exists\n", xpd_num); - put_xbus(xbus); - return -ENXIO; - } - update_sync_master(xbus); - put_xbus(xbus); - } else { - ERR("%s: cannot parse '%s'\n", __FUNCTION__, buf); - count = -EINVAL; - } - return count; -} - -static struct proc_dir_entry *top; - -#endif - -int xbus_pcm_init(struct proc_dir_entry *toplevel) -{ - int ret = 0; -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; -#endif - -#ifdef OPTIMIZE_CHANMUTE - INFO("FEATURE: with CHANMUTE optimization (%sactivated)\n", - (optimize_chanmute)?"":"de"); -#endif -#ifdef WITH_ECHO_SUPPRESSION - INFO("FEATURE: with ECHO_SUPPRESSION\n"); -#else - INFO("FEATURE: without ECHO_SUPPRESSION\n"); -#endif - if(xpp_ec) - INFO("FEATURE: with XPP_EC_CHUNK\n"); - else - INFO("FEATURE: without XPP_EC_CHUNK\n"); -#ifdef ZAPTEL_SYNC_TICK - INFO("FEATURE: with sync_tick() from ZAPTEL\n"); -#else - INFO("FEATURE: without sync_tick() from ZAPTEL\n"); -#endif - xpp_ticker_init(&global_ticks_series); - xpp_ticker_init(&zaptel_ticker); -#ifdef CONFIG_PROC_FS - top = toplevel; - ent = create_proc_entry(PROC_SYNC, 0644, top); - if(!ent) { - ret = -EFAULT; - goto err; - } - ent->read_proc = proc_sync_read; - ent->write_proc = proc_sync_write; - ent->data = NULL; -#endif -err: - return ret; -} - -void xbus_pcm_shutdown(void) -{ -#ifdef CONFIG_PROC_FS - DBG(GENERAL, "Removing '%s' from proc\n", PROC_SYNC); - remove_proc_entry(PROC_SYNC, top); -#endif -} - - -EXPORT_SYMBOL(xbus_request_sync); -EXPORT_SYMBOL(got_new_syncer); -EXPORT_SYMBOL(elect_syncer); -EXPORT_SYMBOL(xpp_echocan); -#ifdef ZAPTEL_SYNC_TICK -EXPORT_SYMBOL(zaptel_sync_tick); -#endif -EXPORT_SYMBOL(__pcm_recompute); -EXPORT_SYMBOL(pcm_recompute); -EXPORT_SYMBOL(generic_card_pcm_tospan); -EXPORT_SYMBOL(generic_card_pcm_fromspan); -#ifdef DEBUG_PCMTX -EXPORT_SYMBOL(pcmtx); -EXPORT_SYMBOL(pcmtx_chan); -#endif - diff --git a/zaptel/kernel/xpp/xbus-pcm.h b/zaptel/kernel/xpp/xbus-pcm.h deleted file mode 100644 index 3265f686..00000000 --- a/zaptel/kernel/xpp/xbus-pcm.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2007, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * This source module contains all the PCM and SYNC handling code. - */ -#ifndef XBUS_PCM_H -#define XBUS_PCM_H - -#include "xdefs.h" -#include -#include - -#ifdef __KERNEL__ - -enum sync_mode { - SYNC_MODE_NONE = 0x00, - SYNC_MODE_AB = 0x01, /* Astribank sync */ - SYNC_MODE_PLL = 0x03, /* Adjust XPD's PLL according to HOST */ - SYNC_MODE_QUERY = 0x80, -}; - -/* - * Abstract representation of timestamp. - * It would (eventually) replace the hard-coded - * timeval structs so we can migrate to better - * time representations. - */ -struct xpp_timestamp { - struct timeval tv; -}; - -/* - * A ticker encapsulates the timing information of some - * abstract tick source. The following tickers are used: - * - Each xbus has an embedded ticker. - * - There is one global zaptel_ticker to represent ticks - * of external zaptel card (in case we want to sync - * from other zaptel devices). - */ -struct xpp_ticker { /* for rate calculation */ - int count; - int cycle; - struct xpp_timestamp first_sample; - struct xpp_timestamp last_sample; - int tick_period; /* usec/tick */ - spinlock_t lock; -}; - -/* - * xpp_drift represent the measurements of the offset between an - * xbus ticker to a reference ticker. - */ -struct xpp_drift { - int wanted_offset; /* fixed */ - int delta_tick; /* from ref_ticker */ - int lost_ticks; /* occurances */ - int lost_tick_count; - int delta_max; - int delta_min; - int median; /* (max + min) / 2 */ - int jitter; /* max - min */ - int calc_drift; - spinlock_t lock; -}; - -void xpp_drift_init(xbus_t *xbus); - -static inline long usec_diff(const struct timeval *tv1, const struct timeval *tv2) -{ - long diff_sec; - long diff_usec; - - diff_sec = tv1->tv_sec - tv2->tv_sec; - diff_usec = tv1->tv_usec - tv2->tv_usec; - return diff_sec * 1000000 + diff_usec; -} - - -int xbus_pcm_init(struct proc_dir_entry *top); -void xbus_pcm_shutdown(void); -int send_pcm_frame(xbus_t *xbus, xframe_t *xframe); -void pcm_recompute(xpd_t *xpd, xpp_line_t tmp_pcm_mask); -void __pcm_recompute(xpd_t *xpd, xpp_line_t tmp_pcm_mask); /* non locking */ -void xframe_receive_pcm(xbus_t *xbus, xframe_t *xframe); -void generic_card_pcm_fromspan(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, xpacket_t *pack); -void generic_card_pcm_tospan(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack); -void fill_beep(u_char *buf, int num, int duration); -const char *sync_mode_name(enum sync_mode mode); -void xbus_set_command_timer(xbus_t *xbus, bool on); -void xbus_request_sync(xbus_t *xbus, enum sync_mode mode); -void got_new_syncer(xbus_t *xbus, enum sync_mode mode, int drift); -int xbus_command_queue_tick(xbus_t *xbus); -void xbus_reset_counters(xbus_t *xbus); -void elect_syncer(const char *msg); -int xpp_echocan(struct zt_chan *chan, int len); -#ifdef ZAPTEL_SYNC_TICK -int zaptel_sync_tick(struct zt_span *span, int is_master); -#endif - -#ifdef XPP_EC_CHUNK -extern int xpp_ec; -#else -#define xpp_ec 0 -#endif - -#ifdef DEBUG_PCMTX -extern int pcmtx; -extern int pcmtx_chan; -#endif - -#endif /* __KERNEL__ */ - -#endif /* XBUS_PCM_H */ - diff --git a/zaptel/kernel/xpp/xbus-sysfs.c b/zaptel/kernel/xpp/xbus-sysfs.c deleted file mode 100644 index 1d039c97..00000000 --- a/zaptel/kernel/xpp/xbus-sysfs.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif - -#include -#include -#include -#include -#ifdef PROTOCOL_DEBUG -#include -#endif -#include -#include -#include /* for msleep() to debug */ -#include "xpd.h" -#include "xpp_zap.h" -#include "xbus-core.h" -#ifdef XPP_DEBUGFS -#include "xpp_log.h" -#endif -#include "zap_debug.h" - -static const char rcsid[] = "$Id: xbus-sysfs.c 4266 2008-05-13 21:08:09Z tzafrir $"; - -/* Command line parameters */ -extern int debug; - - -/* Kernel versions... */ -/* - * Hotplug replaced with uevent in 2.6.16 - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) -#define OLD_HOPLUG_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) -#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) -#endif - -/*--------- Sysfs Bus handling ----*/ -static int xpp_bus_match(struct device *dev, struct device_driver *driver) -{ - DBG(GENERAL, "dev->bus_id = %s, driver->name = %s\n", dev->bus_id, driver->name); - return 1; -} - -#ifdef OLD_HOPLUG_SUPPORT -static int xpp_bus_hotplug(struct device *dev, char **envp, int envnum, char *buff, int bufsize) -{ - xbus_t *xbus; - - if(!dev) - return -ENODEV; - xbus = dev_to_xbus(dev); - envp[0] = buff; - if(snprintf(buff, bufsize, "XBUS_NAME=%s", xbus->busname) >= bufsize) - return -ENOMEM; - envp[1] = NULL; - return 0; -} -#else - -#define XBUS_VAR_BLOCK \ - do { \ - XBUS_ADD_UEVENT_VAR("XPP_INIT_DIR=%s", initdir); \ - XBUS_ADD_UEVENT_VAR("XBUS_NUM=%02d", xbus->num); \ - XBUS_ADD_UEVENT_VAR("XBUS_NAME=%s", xbus->busname); \ - } while(0) - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -#define XBUS_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) - -static int xpp_bus_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) -{ - xbus_t *xbus; - int i = 0; - int len = 0; - extern char *initdir; - - if(!dev) - return -ENODEV; - xbus = dev_to_xbus(dev); - DBG(GENERAL, "bus_id=%s xbus=%s\n", dev->bus_id, xbus->busname); - XBUS_VAR_BLOCK; - envp[i] = NULL; - return 0; -} -#else -#define XBUS_ADD_UEVENT_VAR(fmt, val...) \ - do { \ - int err = add_uevent_var(kenv, fmt, val); \ - if (err) \ - return err; \ - } while (0) - -static int xpp_bus_uevent(struct device *dev, struct kobj_uevent_env *kenv) -{ - xbus_t *xbus; - extern char *initdir; - - if(!dev) - return -ENODEV; - xbus = dev_to_xbus(dev); - DBG(GENERAL, "bus_id=%s xbus=%s\n", dev->bus_id, xbus->busname); - XBUS_VAR_BLOCK; - return 0; -} -#endif - -#endif /* OLD_HOPLUG_SUPPORT */ - -static void xpp_bus_release(struct device *dev) -{ - DBG(GENERAL, "\n"); -} - -static void xpp_dev_release(struct device *dev) -{ - xbus_t *xbus; - - BUG_ON(!dev); - xbus = dev_to_xbus(dev); - XBUS_DBG(GENERAL, xbus, "\n"); -} - -static struct bus_type xpp_bus_type = { - .name = "astribanks", - .match = xpp_bus_match, -#ifdef OLD_HOPLUG_SUPPORT - .hotplug = xpp_bus_hotplug, -#else - .uevent = xpp_bus_uevent, -#endif -}; - -static struct device xpp_bus = { - .bus_id = "xppbus", - .release = xpp_bus_release -}; - -static struct device_driver xpp_driver = { - .name = "xppdrv", - .bus = &xpp_bus_type, -#ifndef OLD_HOPLUG_SUPPORT - .owner = THIS_MODULE -#endif -}; - -int register_xpp_bus(void) -{ - int ret; - - if((ret = bus_register(&xpp_bus_type)) < 0) { - ERR("%s: bus_register failed. Error number %d", __FUNCTION__, ret); - goto failed_bus; - } - if((ret = device_register(&xpp_bus)) < 0) { - ERR("%s: registration of xpp_bus failed. Error number %d", - __FUNCTION__, ret); - goto failed_busdevice; - } - if((ret = driver_register(&xpp_driver)) < 0) { - ERR("%s: driver_register failed. Error number %d", __FUNCTION__, ret); - goto failed_driver; - } - return 0; -failed_driver: - device_unregister(&xpp_bus); -failed_busdevice: - bus_unregister(&xpp_bus_type); -failed_bus: - return ret; -} - -void unregister_xpp_bus(void) -{ - driver_unregister(&xpp_driver); - device_unregister(&xpp_bus); - bus_unregister(&xpp_bus_type); -} - -/*--------- Sysfs Device handling ----*/ -static DEVICE_ATTR_READER(connector_show, dev, buf) -{ - xbus_t *xbus; - int ret; - - xbus = dev_to_xbus(dev); - ret = snprintf(buf, PAGE_SIZE, "%s\n", xbus->location); - return ret; -} - -static DEVICE_ATTR_READER(label_show, dev, buf) -{ - xbus_t *xbus; - int ret; - - xbus = dev_to_xbus(dev); - ret = snprintf(buf, PAGE_SIZE, "%s\n", xbus->label); - return ret; -} - -static DEVICE_ATTR_READER(status_show, dev, buf) -{ - xbus_t *xbus; - int ret; - - xbus = dev_to_xbus(dev); - ret = snprintf(buf, PAGE_SIZE, "%s\n", (TRANSPORT_RUNNING(xbus))?"connected":"missing"); - return ret; -} - -static DEVICE_ATTR_READER(timing_show, dev, buf) -{ - xbus_t *xbus; - struct xpp_drift *driftinfo; - int len = 0; - struct timeval now; - - do_gettimeofday(&now); - xbus = dev_to_xbus(dev); - driftinfo = &xbus->drift; - len += snprintf(buf + len, PAGE_SIZE - len, "DRIFT: %-3s", sync_mode_name(xbus->sync_mode)); - if(xbus->sync_mode == SYNC_MODE_PLL) { - len += snprintf(buf + len, PAGE_SIZE - len, - " %5d: jitter %4d median %4d calc_drift %3d lost (%4d,%4d) : ", - xbus->ticker.cycle, - driftinfo->jitter, driftinfo->median, - driftinfo->calc_drift, - driftinfo->lost_ticks, driftinfo->lost_tick_count); - len += snprintf(buf + len, PAGE_SIZE - len, - "DRIFT %3d %ld sec ago", - xbus->sync_adjustment, - (xbus->pll_updated_at == 0) ? 0 : now.tv_sec - xbus->pll_updated_at); - } - len += snprintf(buf + len, PAGE_SIZE - len, "\n"); - return len; -} - -#ifdef SAMPLE_TICKS -/* - * tick sampling: Measure offset from reference ticker: - * - Recording start when writing to: - * /sys/bus/astribanks/devices/xbus-??/samples - * - Recording ends when filling SAMPLE_SIZE ticks - * - Results are read from the same sysfs file. - * - Trying to read/write during recording, returns -EBUSY. - */ -static DEVICE_ATTR_READER(samples_show, dev, buf) -{ - xbus_t *xbus; - int len = 0; - int i; - - xbus = dev_to_xbus(dev); - if(xbus->sample_running) - return -EBUSY; - for(i = 0; i < SAMPLE_SIZE; i++) { - if(len > PAGE_SIZE - 20) - break; - len += snprintf(buf + len, PAGE_SIZE - len, "%d\n", xbus->sample_ticks[i]); - } - return len; -} - -static DEVICE_ATTR_WRITER(samples_store, dev, buf, count) -{ - xbus_t *xbus; - - xbus = dev_to_xbus(dev); - if(xbus->sample_running) - return -EBUSY; - memset(xbus->sample_ticks, 0, sizeof(*xbus->sample_ticks)); - xbus->sample_pos = 0; - xbus->sample_running = 1; - return count; -} -#endif - -/* - * Clear statistics - */ -static DEVICE_ATTR_WRITER(cls_store, dev, buf, count) -{ - xbus_t *xbus; - struct xpp_drift *driftinfo; - - xbus = dev_to_xbus(dev); - driftinfo = &xbus->drift; - driftinfo->lost_ticks = 0; - driftinfo->lost_tick_count = 0; - xbus->min_tx_sync = INT_MAX; - xbus->max_tx_sync = 0; - xbus->min_rx_sync = INT_MAX; - xbus->max_rx_sync = 0; -#ifdef SAMPLE_TICKS - memset(xbus->sample_ticks, 0, sizeof(*xbus->sample_ticks)); -#endif - return count; -} - -static DEVICE_ATTR(connector, S_IRUGO, connector_show, NULL); -static DEVICE_ATTR(label, S_IRUGO, label_show, NULL); -static DEVICE_ATTR(status, S_IRUGO, status_show, NULL); -static DEVICE_ATTR(timing, S_IRUGO, timing_show, NULL); -static DEVICE_ATTR(cls, S_IWUSR, NULL, cls_store); -#ifdef SAMPLE_TICKS -static DEVICE_ATTR(samples, S_IWUSR | S_IRUGO, samples_show, samples_store); -#endif - -void xbus_sysfs_remove(xbus_t *xbus) -{ - struct device *astribank; - - BUG_ON(!xbus); - XBUS_DBG(GENERAL, xbus, "\n"); - astribank = &xbus->astribank; - BUG_ON(!astribank); - if(!astribank->driver_data) - return; - BUG_ON(astribank->driver_data != xbus); -#ifdef SAMPLE_TICKS - device_remove_file(&xbus->astribank, &dev_attr_samples); -#endif - device_remove_file(&xbus->astribank, &dev_attr_cls); - device_remove_file(&xbus->astribank, &dev_attr_timing); - device_remove_file(&xbus->astribank, &dev_attr_status); - device_remove_file(&xbus->astribank, &dev_attr_label); - device_remove_file(&xbus->astribank, &dev_attr_connector); - device_unregister(&xbus->astribank); -} - -int xbus_sysfs_create(xbus_t *xbus) -{ - struct device *astribank; - int ret = 0; - - BUG_ON(!xbus); - astribank = &xbus->astribank; - BUG_ON(!astribank); - XBUS_DBG(GENERAL, xbus, "\n"); - device_initialize(astribank); - astribank->bus = &xpp_bus_type; - astribank->parent = &xpp_bus; - snprintf(astribank->bus_id, BUS_ID_SIZE, "xbus-%02d", xbus->num); - astribank->driver_data = NULL; /* override below */ - astribank->release = xpp_dev_release; - ret = device_register(astribank); - if(ret) { - XBUS_ERR(xbus, "%s: device_add failed: %d\n", __FUNCTION__, ret); - goto out; - } - ret = device_create_file(astribank, &dev_attr_connector); - if(ret) { - XBUS_ERR(xbus, "%s: device_create_file failed: %d\n", __FUNCTION__, ret); - goto out; - } - ret = device_create_file(astribank, &dev_attr_label); - if(ret) { - XBUS_ERR(xbus, "%s: device_create_file failed: %d\n", __FUNCTION__, ret); - goto out; - } - ret = device_create_file(astribank, &dev_attr_status); - if(ret) { - XBUS_ERR(xbus, "%s: device_create_file failed: %d\n", __FUNCTION__, ret); - goto out; - } - ret = device_create_file(astribank, &dev_attr_timing); - if(ret) { - XBUS_ERR(xbus, "%s: device_create_file failed: %d\n", __FUNCTION__, ret); - goto out; - } - ret = device_create_file(astribank, &dev_attr_cls); - if(ret) { - XBUS_ERR(xbus, "%s: device_create_file failed: %d\n", __FUNCTION__, ret); - goto out; - } -#ifdef SAMPLE_TICKS - ret = device_create_file(astribank, &dev_attr_samples); - if(ret) { - XBUS_ERR(xbus, "%s: device_create_file failed: %d\n", __FUNCTION__, ret); - goto out; - } -#endif - astribank->driver_data = xbus; /* Everything is good */ -out: - return ret; -} diff --git a/zaptel/kernel/xpp/xdefs.h b/zaptel/kernel/xpp/xdefs.h deleted file mode 100644 index 9e6b7839..00000000 --- a/zaptel/kernel/xpp/xdefs.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef XDEFS_H -#define XDEFS_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpp_version.h" - -#ifdef __KERNEL__ - -#include -#include - -#else - -/* This is to enable user-space programs to include this. */ - -#include -typedef uint8_t __u8; -typedef uint32_t __u32; - -#include - -#define DBG(fmt, ...) printf("DBG: %s: " fmt, __FUNCTION__, ## __VA_ARGS__) -#define INFO(fmt, ...) printf("INFO: " fmt, ## __VA_ARGS__) -#define NOTICE(fmt, ...) printf("NOTICE: " fmt, ## __VA_ARGS__) -#define ERR(fmt, ...) printf("ERR: " fmt, ## __VA_ARGS__) -#define __user - -struct list_head { struct list_head *next; struct list_head *prev; }; - -#endif - -#define PACKED __attribute__((packed)) - -#define ALL_LINES ((lineno_t)-1) - -#ifndef BIT /* added in 2.6.24 */ -#define BIT(i) (1UL << (i)) -#endif -#define BIT_SET(x,i) ((x) |= BIT(i)) -#define BIT_CLR(x,i) ((x) &= ~BIT(i)) -#define IS_SET(x,i) (((x) & BIT(i)) != 0) -#define BITMASK(i) (((u64)1 << (i)) - 1) - -#define MAX_PROC_WRITE 100 /* Largest buffer we allow writing our /proc files */ -#define CHANNELS_PERXPD 32 /* Depends on xpp_line_t and protocol fields */ - -#define MAX_SPANNAME 20 /* From zaptel.h */ -#define MAX_SPANDESC 40 /* From zaptel.h */ -#define MAX_CHANNAME 40 /* From zaptel.h */ - -#define XPD_NAMELEN 10 /* must be <= from maximal workqueue name */ -#define XPD_DESCLEN 20 -#define XBUS_NAMELEN 20 /* must be <= from maximal workqueue name */ -#define XBUS_DESCLEN 40 -#define LABEL_SIZE 20 - -#define UNIT_BITS 3 /* Bit for Astribank unit number */ -#define SUBUNIT_BITS 3 /* Bit for Astribank subunit number */ - -#define MAX_UNIT (1 << UNIT_BITS) /* 1 FXS + 3 FXS/FXO | 1 BRI + 3 FXS/FXO */ -#define MAX_SUBUNIT (1 << SUBUNIT_BITS) /* 8 port BRI */ - -/* - * Compile time sanity checks - */ -#if MAX_UNIT > BIT(UNIT_BITS) -#error "MAX_UNIT too large" -#endif - -#if MAX_SUBUNIT > BIT(SUBUNIT_BITS) -#error "MAX_SUBUNIT too large" -#endif - -#define MAX_XPDS (MAX_UNIT*MAX_SUBUNIT) - -#define VALID_XPD_NUM(x) ((x) < MAX_XPDS && (x) >= 0) - -#define CHAN_BITS 5 /* 0-31 for E1 */ - -typedef char *charp; -typedef unsigned char byte; -#ifdef __KERNEL__ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -#define KMEM_CACHE_T kmem_cache_t -#else -#define KMEM_CACHE_T struct kmem_cache -#endif - -#define KZALLOC(size, gfp) my_kzalloc(size, gfp) -#define KZFREE(p) do { \ - memset((p), 0, sizeof(*(p))); \ - kfree(p); \ - } while(0); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -/* Also don't define this for later RHEL >= 5.2 . hex_asc is from the - * same linux-2.6-net-infrastructure-updates-to-mac80211-iwl4965.patch - * as is the bool typedef. */ -#if LINUX_VERSION_CODE != KERNEL_VERSION(2,6,18) || ! defined(hex_asc) -typedef int bool; -#endif -#endif -#else -typedef int bool; -#endif -typedef struct xbus xbus_t; -typedef struct xpd xpd_t; -typedef struct xframe xframe_t; -typedef struct xpacket xpacket_t; -typedef struct xops xops_t; -typedef __u32 xpp_line_t; /* at most 31 lines for E1 */ -typedef byte lineno_t; -typedef byte xportno_t; - -#define PORT_BROADCAST 255 - -#endif /* XDEFS_H */ diff --git a/zaptel/kernel/xpp/xframe_queue.c b/zaptel/kernel/xpp/xframe_queue.c deleted file mode 100644 index 5d116001..00000000 --- a/zaptel/kernel/xpp/xframe_queue.c +++ /dev/null @@ -1,278 +0,0 @@ -#include "xframe_queue.h" -#include "xbus-core.h" -#include "zap_debug.h" - -extern int debug; - -static xframe_t *transport_alloc_xframe(xbus_t *xbus, gfp_t gfp_flags); -static void transport_free_xframe(xbus_t *xbus, xframe_t *xframe); - -void xframe_queue_init(struct xframe_queue *q, unsigned int steady_state_count, unsigned int max_count, const char *name, void *priv) -{ - memset(q, 0, sizeof(*q)); - spin_lock_init(&q->lock); - INIT_LIST_HEAD(&q->head); - q->max_count = XFRAME_QUEUE_MARGIN + max_count; - q->steady_state_count = XFRAME_QUEUE_MARGIN + steady_state_count; - q->name = name; - q->priv = priv; -} - -void xframe_queue_clearstats(struct xframe_queue *q) -{ - q->worst_count = 0; - //q->overflows = 0; /* Never clear overflows */ - q->worst_lag_usec = 0L; -} - -static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe) -{ - int ret = 1; - - if(q->count >= q->max_count) { - q->overflows++; - NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02ld.%ld ms\n", - q->name, - q->steady_state_count, - q->count, - q->max_count, - q->worst_count, - q->overflows, - q->worst_lag_usec / 1000, - q->worst_lag_usec % 1000); - ret = 0; - goto out; - } - if(++q->count > q->worst_count) - q->worst_count = q->count; - list_add_tail(&xframe->frame_list, &q->head); - do_gettimeofday(&xframe->tv_queued); -out: - return ret; -} - -bool xframe_enqueue(struct xframe_queue *q, xframe_t *xframe) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&q->lock, flags); - ret = __xframe_enqueue(q, xframe); - spin_unlock_irqrestore(&q->lock, flags); - return ret; -} - -static xframe_t *__xframe_dequeue(struct xframe_queue *q) -{ - xframe_t *frm = NULL; - struct list_head *h; - struct timeval now; - unsigned long usec_lag; - - if(list_empty(&q->head)) - goto out; - h = q->head.next; - list_del_init(h); - --q->count; - frm = list_entry(h, xframe_t, frame_list); - do_gettimeofday(&now); - usec_lag = - (now.tv_sec - frm->tv_queued.tv_sec)*1000*1000 + - (now.tv_usec - frm->tv_queued.tv_usec); - if(q->worst_lag_usec < usec_lag) - q->worst_lag_usec = usec_lag; -out: - return frm; -} - -xframe_t *xframe_dequeue(struct xframe_queue *q) -{ - unsigned long flags; - xframe_t *frm; - - spin_lock_irqsave(&q->lock, flags); - frm = __xframe_dequeue(q); - spin_unlock_irqrestore(&q->lock, flags); - return frm; -} -void xframe_queue_disable(struct xframe_queue *q) -{ - q->max_count = 0; -} - -void xframe_queue_clear(struct xframe_queue *q) -{ - xframe_t *xframe; - xbus_t *xbus = q->priv; - int i = 0; - - xframe_queue_disable(q); - while((xframe = xframe_dequeue(q)) != NULL) { - transport_free_xframe(xbus, xframe); - i++; - } - XBUS_DBG(DEVICES, xbus, "%s: finished queue clear (%d items)\n", q->name, i); -} - -uint xframe_queue_count(struct xframe_queue *q) -{ - return q->count; -} - -/*------------------------- Frame Alloc/Dealloc --------------------*/ - -static xframe_t *transport_alloc_xframe(xbus_t *xbus, gfp_t gfp_flags) -{ - struct xbus_ops *ops; - xframe_t *xframe; - unsigned long flags; - - BUG_ON(!xbus); - ops = transportops_get(xbus); - if(unlikely(!ops)) { - XBUS_ERR(xbus, "Missing transport\n"); - return NULL; - } - spin_lock_irqsave(&xbus->transport.lock, flags); - //XBUS_INFO(xbus, "%s (transport_refcount=%d)\n", __FUNCTION__, atomic_read(&xbus->transport.transport_refcount)); - xframe = ops->alloc_xframe(xbus, gfp_flags); - if(!xframe) { - static int rate_limit; - - if((rate_limit++ % 3001) == 0) - XBUS_ERR(xbus, - "Failed xframe allocation from transport (%d)\n", - rate_limit); - transportops_put(xbus); - /* fall through */ - } - spin_unlock_irqrestore(&xbus->transport.lock, flags); - return xframe; -} - -static void transport_free_xframe(xbus_t *xbus, xframe_t *xframe) -{ - struct xbus_ops *ops; - unsigned long flags; - - BUG_ON(!xbus); - ops = xbus->transport.ops; - BUG_ON(!ops); - spin_lock_irqsave(&xbus->transport.lock, flags); - //XBUS_INFO(xbus, "%s (transport_refcount=%d)\n", __FUNCTION__, atomic_read(&xbus->transport.transport_refcount)); - ops->free_xframe(xbus, xframe); - transportops_put(xbus); - spin_unlock_irqrestore(&xbus->transport.lock, flags); -} - -static bool xframe_queue_adjust(struct xframe_queue *q) -{ - xbus_t *xbus; - xframe_t *xframe; - int delta; - unsigned long flags; - int ret = 0; - - BUG_ON(!q); - xbus = q->priv; - BUG_ON(!xbus); - spin_lock_irqsave(&q->lock, flags); - delta = q->count - q->steady_state_count; - if(delta < -XFRAME_QUEUE_MARGIN) { - /* Increase pool by one frame */ - //XBUS_INFO(xbus, "%s(%d): Allocate one\n", q->name, delta); - xframe = transport_alloc_xframe(xbus, GFP_ATOMIC); - if(!xframe) { - static int rate_limit; - - if((rate_limit++ % 3001) == 0) - XBUS_ERR(xbus, "%s: failed frame allocation\n", q->name); - goto out; - } - if(!__xframe_enqueue(q, xframe)) { - static int rate_limit; - - if((rate_limit++ % 3001) == 0) - XBUS_ERR(xbus, "%s: failed enqueueing frame\n", q->name); - transport_free_xframe(xbus, xframe); - goto out; - } - } else if(delta > XFRAME_QUEUE_MARGIN) { - /* Decrease pool by one frame */ - //XBUS_INFO(xbus, "%s(%d): Free one\n", q->name, delta); - xframe = __xframe_dequeue(q); - if(!xframe) { - static int rate_limit; - - if((rate_limit++ % 3001) == 0) - XBUS_ERR(xbus, "%s: failed dequeueing frame\n", q->name); - goto out; - } - transport_free_xframe(xbus, xframe); - } - ret = 1; -out: - spin_unlock_irqrestore(&q->lock, flags); - return ret; -} - -xframe_t *get_xframe(struct xframe_queue *q) -{ - xframe_t *xframe; - xbus_t *xbus; - - BUG_ON(!q); - xbus = (xbus_t *)q->priv; - BUG_ON(!xbus); - xframe_queue_adjust(q); - xframe = xframe_dequeue(q); - if(!xframe) { - static int rate_limit; - - if((rate_limit++ % 3001) == 0) - XBUS_ERR(xbus, "%s STILL EMPTY (%d)\n", q->name, rate_limit); - return NULL; - } - BUG_ON(xframe->xframe_magic != XFRAME_MAGIC); - atomic_set(&xframe->frame_len, 0); - xframe->first_free = xframe->packets; - do_gettimeofday(&xframe->tv_created); - /* - * If later parts bother to correctly initialize their - * headers, there is no need to memset() the whole data. - * - * ticket:403 - * - * memset(xframe->packets, 0, xframe->frame_maxlen); - */ - //XBUS_INFO(xbus, "%s\n", __FUNCTION__); - return xframe; -} - -void put_xframe(struct xframe_queue *q, xframe_t *xframe) -{ - xbus_t *xbus; - - BUG_ON(!q); - xbus = (xbus_t *)q->priv; - BUG_ON(!xbus); - //XBUS_INFO(xbus, "%s\n", __FUNCTION__); - BUG_ON(!TRANSPORT_EXIST(xbus)); - if(unlikely(!xframe_enqueue(q, xframe))) { - XBUS_ERR(xbus, "Failed returning xframe to %s\n", q->name); - transport_free_xframe(xbus, xframe); - return; - } - xframe_queue_adjust(q); -} - - -EXPORT_SYMBOL(xframe_queue_init); -EXPORT_SYMBOL(xframe_queue_clearstats); -EXPORT_SYMBOL(xframe_enqueue); -EXPORT_SYMBOL(xframe_dequeue); -EXPORT_SYMBOL(xframe_queue_disable); -EXPORT_SYMBOL(xframe_queue_clear); -EXPORT_SYMBOL(xframe_queue_count); -EXPORT_SYMBOL(get_xframe); -EXPORT_SYMBOL(put_xframe); diff --git a/zaptel/kernel/xpp/xframe_queue.h b/zaptel/kernel/xpp/xframe_queue.h deleted file mode 100644 index 5612d653..00000000 --- a/zaptel/kernel/xpp/xframe_queue.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef XFRAME_QUEUE_H -#define XFRAME_QUEUE_H - -#include -#include -#include "xdefs.h" - -#define XFRAME_QUEUE_MARGIN 10 - -struct xframe_queue { - struct list_head head; - unsigned int count; - unsigned int max_count; - unsigned int steady_state_count; - spinlock_t lock; - const char *name; - void *priv; - /* statistics */ - unsigned int worst_count; - unsigned int overflows; - unsigned long worst_lag_usec; /* since xframe creation */ -}; - -void xframe_queue_init(struct xframe_queue *q, - unsigned int steady_state_count, unsigned int max_count, - const char *name, void *priv); -__must_check bool xframe_enqueue(struct xframe_queue *q, xframe_t *xframe); -__must_check xframe_t *xframe_dequeue(struct xframe_queue *q); -void xframe_queue_clearstats(struct xframe_queue *q); -void xframe_queue_disable(struct xframe_queue *q); -void xframe_queue_clear(struct xframe_queue *q); -uint xframe_queue_count(struct xframe_queue *q); - -#endif /* XFRAME_QUEUE_ */ diff --git a/zaptel/kernel/xpp/xpd.h b/zaptel/kernel/xpp/xpd.h deleted file mode 100644 index 35688d69..00000000 --- a/zaptel/kernel/xpp/xpd.h +++ /dev/null @@ -1,231 +0,0 @@ -#ifndef XPD_H -#define XPD_H - -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xdefs.h" -#include "xproto.h" - -#ifdef __KERNEL__ -#include -#include -#include -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#include -#else -#include -#endif -#include -#ifdef XPP_DEBUGFS -#ifndef CONFIG_DEBUG_FS -#warning kernel does not include CONFIG_DEBUG_FS, canceling XPP_DEBUGFS support -#undef XPP_DEBUGFS -#else -#include -#endif -#endif -#endif /* __KERNEL__ */ - -#include - -#ifdef __KERNEL__ -#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) -typedef unsigned gfp_t; /* Added in 2.6.14 */ -#endif -#endif - -/* - * FIXME: Kludge for 2.6.19 - * bool is now defined as a proper boolean type (gcc _Bool) - * but the command line parsing framework handles it as int. - */ -#define DEF_PARM_BOOL(name,init,perm,desc) \ - int name = init; \ - module_param(name, bool, perm); \ - MODULE_PARM_DESC(name, desc " [default " #init "]") - -#define DEF_PARM(type,name,init,perm,desc) \ - type name = init; \ - module_param(name, type, perm); \ - MODULE_PARM_DESC(name, desc " [default " #init "]") - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) -/* - * Old 2.6 kernels had module_param_array() macro that receive the counter - * by value. - */ -#define DEF_ARRAY(type,name,count,init,desc) \ - unsigned int name ## _num_values; \ - type name[count] = { [0 ... ((count)-1)] = (init) }; \ - module_param_array(name, type, name ## _num_values, 0644); \ - MODULE_PARM_DESC(name, desc " ( 1-" __MODULE_STRING(count) ")") -#else -#define DEF_ARRAY(type,name,count,init,desc) \ - unsigned int name ## _num_values; \ - type name[count] = {[0 ... ((count)-1)] = init}; \ - module_param_array(name, type, &name ## _num_values, 0644); \ - MODULE_PARM_DESC(name, desc " ( 1-" __MODULE_STRING(count) ")") -#endif -#endif // __KERNEL__ - -#define CARD_DESC_MAGIC 0xca9dde5c - -struct card_desc_struct { - struct list_head card_list; - u32 magic; - byte type; /* LSB: 1 - to_phone, 0 - to_line */ - byte subtype; - struct xpd_addr xpd_addr; - byte numchips; - byte ports_per_chip; - byte ports; - byte port_dir; - struct xpd_addr ec_addr; /* echo canceler address */ -}; - -typedef enum xpd_direction { - TO_PSTN = 0, - TO_PHONE = 1, -} xpd_direction_t; - -#ifdef __KERNEL__ - -/* - * XPD statistics counters - */ -enum { - XPD_N_PCM_READ, - XPD_N_PCM_WRITE, - XPD_N_RECV_ERRORS, -}; - -#define XPD_COUNTER(xpd, counter) ((xpd)->counters[XPD_N_ ## counter]) - -#define C_(x) [ XPD_N_ ## x ] = { #x } - -/* yucky, make an instance so we can size it... */ -static struct xpd_counters { - char *name; -} xpd_counters[] = { - C_(PCM_READ), - C_(PCM_WRITE), - C_(RECV_ERRORS), -}; - -#undef C_ - -#define XPD_COUNTER_MAX (sizeof(xpd_counters)/sizeof(xpd_counters[0])) - -/* - * An XPD is a single Xorcom Protocol Device - */ -struct xpd { - char xpdname[XPD_NAMELEN]; - struct zt_span span; - struct zt_chan *chans; - int channels; - xpd_type_t type; - const char *type_name; - byte subtype; - xpd_direction_t direction; /* TO_PHONE, TO_PSTN */ - int subunits; /* all siblings */ - xpp_line_t no_pcm; /* Temporary: disable PCM (for USB-1) */ - xpp_line_t offhook; /* Actual chip state: 0 - ONHOOK, 1 - OFHOOK */ - xpp_line_t cid_on; - xpp_line_t msg_waiting; /* Voice Mail Waiting Indication */ - xpp_line_t digital_outputs; /* 0 - no, 1 - yes */ - xpp_line_t digital_inputs; /* 0 - no, 1 - yes */ - xpp_line_t digital_signalling; /* BRI signalling channels */ - uint timing_priority; /* from 'span' directives in zapata.conf */ - - /* maintained by card drivers */ - uint pcm_len; /* allocation length of PCM packet (dynamic) */ - xpp_line_t wanted_pcm_mask; - xpp_line_t silence_pcm; /* inject silence during next tick */ - xpp_line_t mute_dtmf; - - bool ringing[CHANNELS_PERXPD]; - - xbus_t *xbus; /* The XBUS we are connected to */ - - spinlock_t lock; - atomic_t zt_registered; /* Am I fully registered with zaptel */ - atomic_t open_counter; /* Number of open channels */ - - int flags; - unsigned long blink_mode; /* bitmask of blinking ports */ -#define DEFAULT_LED_PERIOD (1000/8) /* in tick */ - -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *proc_xpd_dir; - struct proc_dir_entry *proc_xpd_summary; - struct proc_dir_entry *proc_xpd_ztregister; - struct proc_dir_entry *proc_xpd_blink; - struct proc_dir_entry *proc_xpd_chipregs; -#endif - - int counters[XPD_COUNTER_MAX]; - - const xproto_table_t *xproto; /* Card level protocol table */ - const xops_t *xops; /* Card level operations */ - void *priv; /* Card level private data */ - bool card_present; - reg_cmd_t requested_reply; - reg_cmd_t last_reply; - - unsigned long last_response; /* in jiffies */ - unsigned xbus_idx; /* index in xbus->xpds[] */ - struct xpd_addr addr; - struct list_head xpd_list; - unsigned int timer_count; - /* Echo cancelation */ - u_char ec_chunk1[CHANNELS_PERXPD][ZT_CHUNKSIZE]; - u_char ec_chunk2[CHANNELS_PERXPD][ZT_CHUNKSIZE]; -}; - -#define for_each_line(xpd,i) for((i) = 0; (i) < (xpd)->channels; (i)++) -#define IS_BRI(xpd) ((xpd)->type == XPD_TYPE_BRI) -#define TICK_TOLERANCE 500 /* usec */ - -#ifdef DEBUG_SYNC_PARPORT -void xbus_flip_bit(xbus_t *xbus, unsigned int bitnum0, unsigned int bitnum1); -#else -#define xbus_flip_bit(xbus, bitnum0, bitnum1) -#endif - -static inline void *my_kzalloc(size_t size, gfp_t flags) -{ - void *p; - - p = kmalloc(size, flags); - if(p) - memset(p, 0, size); - return p; -} - -#endif - -#endif /* XPD_H */ diff --git a/zaptel/kernel/xpp/xpp_log.h b/zaptel/kernel/xpp/xpp_log.h deleted file mode 100644 index 322b7f0a..00000000 --- a/zaptel/kernel/xpp/xpp_log.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef XPP_LOG_H -#define XPP_LOG_H -/* - * Written by Alexander Landau - * Copyright (C) 2004-2007, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifdef __KERNEL__ - -#include -#include - -#else - -/* This is to enable user-space programs to include this. */ - -#include "xdefs.h" - -#endif - -#define XPP_LOG_MAGIC 0x10583ADE - -struct log_global_header { - __u32 magic; - __u32 version; -} __attribute__((packed)); - -struct log_header { - __u32 len; - __u32 time; - __u8 xpd_num; - __u8 direction; -} __attribute__((packed)); - -#endif diff --git a/zaptel/kernel/xpp/xpp_usb.c b/zaptel/kernel/xpp/xpp_usb.c deleted file mode 100644 index 2988817f..00000000 --- a/zaptel/kernel/xpp/xpp_usb.c +++ /dev/null @@ -1,1107 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include /* for udelay */ -#include -#include -#include -#include -#include -#include -#include "xpd.h" -#include "xproto.h" -#include "xbus-core.h" -#include "xframe_queue.h" -#ifdef DEBUG -#include "card_fxs.h" -#include "card_fxo.h" -#endif -#include "parport_debug.h" - -static const char rcsid[] = "$Id: xpp_usb.c 4266 2008-05-13 21:08:09Z tzafrir $"; - -static DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); /* must be before zap_debug.h */ -static DEF_PARM(int, usb1, 0, 0644, "Allow using USB 1.1 interfaces"); -static DEF_PARM(uint, tx_sluggish, 2000, 0644, "A sluggish transmit (usec)"); -static DEF_PARM(uint, drop_pcm_after, 6, 0644, "Number of consecutive tx_sluggish to drop a PCM frame"); - -#include "zap_debug.h" - - -#define XUSB_PRINTK(level, xusb, fmt, ...) \ - printk(KERN_ ## level "%s-%s: xusb-%d (%s) [%s]: " fmt, #level, \ - THIS_MODULE->name, (xusb)->index, xusb->path, xusb->serial, ## __VA_ARGS__) - -#define XUSB_DBG(bits, xusb, fmt, ...) \ - ((void)((debug & (DBG_ ## bits)) && XUSB_PRINTK(DEBUG, xusb, "%s: " fmt, __FUNCTION__, ## __VA_ARGS__))) -#define XUSB_ERR(xusb, fmt, ...) XUSB_PRINTK(ERR, xusb, fmt, ## __VA_ARGS__) -#define XUSB_NOTICE(xusb, fmt, ...) XUSB_PRINTK(NOTICE, xusb, fmt, ## __VA_ARGS__) -#define XUSB_INFO(xusb, fmt, ...) XUSB_PRINTK(INFO, xusb, fmt, ## __VA_ARGS__) - -/* FIXME: A flag that was deprecated at some point, and rather useless */ -/* anyway. Only used in the code or-ed to other flags */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) -# define URB_ASYNC_UNLINK 0 -#endif -/* Get a minor range for your devices from the usb maintainer */ -#define USB_SKEL_MINOR_BASE 192 - -#ifdef CONFIG_PROC_FS -#define PROC_USBXPP_SUMMARY "xpp_usb" -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) -# undef USB_FIELDS_MISSING -#else -# define USB_FIELDS_MISSING - -# define USB_MAX_STRING 128 -# define USB_GET_STRING(udev,field,buf) \ - do { \ - if((udev)->descriptor.field) { \ - char tmp[USB_MAX_STRING]; \ - if(usb_string((udev), (udev)->descriptor.field, tmp, sizeof(tmp)) > 0) \ - snprintf((buf), USB_MAX_STRING, "%s", tmp); \ - } \ - } while(0); -# define USB_GET_IFACE_NAME(udev,iface,buf) \ - do { \ - if((iface)->desc.iInterface) { \ - char tmp[USB_MAX_STRING]; \ - if(usb_string((udev), (iface)->desc.iInterface, tmp, sizeof(tmp)) > 0) \ - snprintf((buf), USB_MAX_STRING, "%s", tmp); \ - } \ - } while(0); -#endif - -#ifdef DEBUG_PCM_TIMING -static cycles_t stamp_last_pcm_read; -static cycles_t accumulate_diff; -#endif - -struct xusb_model_info; - -struct xusb_endpoint { - int ep_addr; - int max_size; - usb_complete_t callback; -}; - -enum xusb_dir { - XUSB_RECV = 0, - XUSB_SEND = 1, -}; - -static __must_check int xframe_send_pcm(xbus_t *xbus, xframe_t *xframe); -static __must_check int xframe_send_cmd(xbus_t *xbus, xframe_t *xframe); -static __must_check xframe_t *alloc_xframe(xbus_t *xbus, gfp_t flags); -static void free_xframe(xbus_t *xbus, xframe_t *frm); - -static struct xbus_ops xusb_ops = { - .xframe_send_pcm = xframe_send_pcm, - .xframe_send_cmd = xframe_send_cmd, - .alloc_xframe = alloc_xframe, - .free_xframe = free_xframe, -}; - -enum { - XUSB_N_RX_FRAMES, - XUSB_N_TX_FRAMES, - XUSB_N_RX_ERRORS, - XUSB_N_TX_ERRORS, - XUSB_N_RCV_ZERO_LEN, -}; - -#define XUSB_COUNTER(xusb, counter) ((xusb)->counters[XUSB_N_ ## counter]) - -#define C_(x) [ XUSB_N_ ## x ] = { #x } - -static struct xusb_counters { - char *name; -} xusb_counters[] = { - C_(RX_FRAMES), - C_(TX_FRAMES), - C_(RX_ERRORS), - C_(TX_ERRORS), - C_(RCV_ZERO_LEN), -}; - -#undef C_ - -#define XUSB_COUNTER_MAX ARRAY_SIZE(xusb_counters) - -#define MAX_PENDING_WRITES 100 - -static KMEM_CACHE_T *xusb_cache = NULL; - -typedef struct xusb xusb_t; - -/* - * A uframe is our low level representation of a frame. - * - * It contains the metadata for the usb stack (a urb) - * and the metadata for the xbus-core (an xframe) - * as well as pointing to the data (transfer_buffer, transfer_buffer_length) - * directionality (send/receive) and ownership (xusb). - */ -struct uframe { - unsigned long uframe_magic; -#define UFRAME_MAGIC 654321L - struct urb urb; - xframe_t xframe; - size_t transfer_buffer_length; - void *transfer_buffer; /* max XFRAME_DATASIZE */ - xusb_t *xusb; -}; - -#define urb_to_uframe(urb) container_of(urb, struct uframe, urb) -#define xframe_to_uframe(xframe) container_of(xframe, struct uframe, xframe) -#define xusb_of(xbus) ((xusb_t *)((xbus)->transport.priv)) - -#define USEC_BUCKET 100 /* usec */ -#define NUM_BUCKETS 15 -#define BUCKET_START (500/USEC_BUCKET) /* skip uninteresting */ - -/* - * USB XPP Bus (a USB Device) - */ -struct xusb { - uint xbus_num; - struct usb_device *udev; /* save off the usb device pointer */ - struct usb_interface *interface; /* the interface for this device */ - unsigned char minor; /* the starting minor number for this device */ - uint index; - char path[XBUS_DESCLEN]; /* a unique path */ - - struct xusb_model_info *model_info; - struct xusb_endpoint endpoints[2]; /* RECV/SEND endpoints */ - - int present; /* if the device is not disconnected */ - atomic_t pending_writes; /* submited but not out yet */ - atomic_t pending_reads; /* submited but not in yet */ - struct semaphore sem; /* locks this structure */ - int counters[XUSB_COUNTER_MAX]; - - /* metrics */ - struct timeval last_tx; - unsigned int max_tx_delay; - uint usb_tx_delay[NUM_BUCKETS]; - uint sluggish_debounce; - bool drop_next_pcm; /* due to sluggishness */ - atomic_t pcm_tx_drops; - atomic_t usb_sluggish_count; - -#ifdef USB_FIELDS_MISSING - /* storage for missing strings in old kernels */ - char manufacturer[USB_MAX_STRING]; - char product[USB_MAX_STRING]; - char serial[USB_MAX_STRING]; - char interface_name[USB_MAX_STRING]; -#else - const char *manufacturer; - const char *product; - const char *serial; - const char *interface_name; -#endif - -}; - -static spinlock_t xusb_lock = SPIN_LOCK_UNLOCKED; -static xusb_t *xusb_array[MAX_BUSES] = {}; -static unsigned bus_count = 0; - - -/* prevent races between open() and disconnect() */ -static DECLARE_MUTEX (disconnect_sem); - -/* - * AsteriskNow kernel has backported the "lean" callback from 2.6.20 - * to 2.6.19 without any macro to notify of this fact -- how lovely. - * Debian-Etch and Centos5 are using 2.6.18 for now (lucky for us). - * Fedora6 jumped from 2.6.18 to 2.6.20. So far luck is on our side ;-) - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#define USB_PASS_CB(u) struct urb *u, struct pt_regs *regs -#else -#define USB_PASS_CB(u) struct urb *u -#endif - -static void xpp_send_callback(USB_PASS_CB(urb)); -static void xpp_receive_callback(USB_PASS_CB(urb)); -static int xusb_probe (struct usb_interface *interface, const struct usb_device_id *id); -static void xusb_disconnect (struct usb_interface *interface); -static int xusb_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); - -/*------------------------------------------------------------------*/ - -/* - * Updates the urb+xframe metadata from the uframe information. - */ -static void uframe_recompute(struct uframe *uframe, enum xusb_dir dir) -{ - struct urb *urb = &uframe->urb; - xusb_t *xusb = uframe->xusb; - struct usb_device *udev = xusb->udev; - struct xusb_endpoint *xusb_ep = &xusb->endpoints[dir]; - unsigned int ep_addr = xusb_ep->ep_addr; - usb_complete_t urb_cb = xusb_ep->callback; - unsigned int epnum = ep_addr & USB_ENDPOINT_NUMBER_MASK; - int pipe = usb_pipein(ep_addr) - ? usb_rcvbulkpipe(udev, epnum) - : usb_sndbulkpipe(udev, epnum); - - BUG_ON(uframe->uframe_magic != UFRAME_MAGIC); - usb_fill_bulk_urb(urb, udev, pipe, uframe->transfer_buffer, uframe->transfer_buffer_length, urb_cb, uframe); - urb->transfer_flags = (URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); -} - -static xframe_t *alloc_xframe(xbus_t *xbus, gfp_t gfp_flags) -{ - struct uframe *uframe; - xusb_t *xusb; - void *p; - int size; - static int rate_limit; - - BUG_ON(!xbus); - xusb = xusb_of(xbus); - BUG_ON(!xusb); - if(!xusb->present) { - if((rate_limit++ % 1003) == 0) - XUSB_ERR(xusb, - "abort allocations during device disconnect (%d)\n", rate_limit); - return NULL; - } - size = min(xusb->endpoints[XUSB_SEND].max_size, xusb->endpoints[XUSB_RECV].max_size); - uframe = kmem_cache_alloc(xusb_cache, gfp_flags); - if(!uframe) { - if((rate_limit++ % 1003) == 0) - XUSB_ERR(xusb, "frame allocation failed (%d)\n", rate_limit); - return NULL; - } - usb_init_urb(&uframe->urb); - p = usb_buffer_alloc(xusb->udev, size, gfp_flags, &uframe->urb.transfer_dma); - if(!p) { - if((rate_limit++ % 1003) == 0) - XUSB_ERR(xusb, "buffer allocation failed (%d)\n", rate_limit); - kmem_cache_free(xusb_cache, uframe); - return NULL; - } - uframe->uframe_magic = UFRAME_MAGIC; - uframe->transfer_buffer_length = size; - uframe->transfer_buffer = p; - uframe->xusb = xusb; - xframe_init(xbus, &uframe->xframe, uframe->transfer_buffer, uframe->transfer_buffer_length, uframe); - return &uframe->xframe; -} - -static void free_xframe(xbus_t *xbus, xframe_t *xframe) -{ - struct uframe *uframe = xframe_to_uframe(xframe); - struct urb *urb = &uframe->urb; - - BUG_ON(xbus->transport.priv != uframe->xusb); - //XUSB_INFO(uframe->xusb, "frame_free\n"); - usb_buffer_free(urb->dev, uframe->transfer_buffer_length, - urb->transfer_buffer, - urb->transfer_dma); - memset(uframe, 0, sizeof(*uframe)); - kmem_cache_free(xusb_cache, uframe); -} - -/*------------------------------------------------------------------*/ - -/* - * Actuall frame sending -- both PCM and commands. - */ -static int do_send_xframe(xbus_t *xbus, xframe_t *xframe) -{ - struct urb *urb; - xusb_t *xusb; - int ret = 0; - struct uframe *uframe; - - BUG_ON(!xframe); - BUG_ON(xframe->xframe_magic != XFRAME_MAGIC); - xusb = xusb_of(xbus); - BUG_ON(!xusb); - if(!xusb->present) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) - XUSB_ERR(xusb, - "abort do_send_xframe during device disconnect (%d)\n", rate_limit); - ret = -ENODEV; - goto failure; - } - /* - * If something really bad happend, do not overflow the USB stack - */ - if(atomic_read(&xusb->pending_writes) > MAX_PENDING_WRITES) { - static int rate_limit; - - if((rate_limit++ % 5000) == 0) - XUSB_ERR(xusb, - "USB device is totaly stuck. Dropping packets (#%d).\n", - rate_limit); - ret = -ENODEV; - goto failure; - } - uframe = xframe->priv; - BUG_ON(!uframe); - BUG_ON(uframe->uframe_magic != UFRAME_MAGIC); - uframe_recompute(uframe, XUSB_SEND); - urb = &uframe->urb; - BUG_ON(!urb); - /* update urb length */ - urb->transfer_buffer_length = XFRAME_LEN(xframe); - do_gettimeofday(&xframe->tv_submitted); - ret = usb_submit_urb(urb, GFP_ATOMIC); - if(ret < 0) { - static int rate_limit; - - if((rate_limit++ % 1000) == 0) - XBUS_ERR(xbus, "%s: usb_submit_urb failed: %d\n", - __FUNCTION__, ret); - ret = -EBADF; - goto failure; - } -// if (debug) -// dump_xframe("USB_FRAME_SEND", xbus, xframe, debug); - atomic_inc(&xusb->pending_writes); - return 0; -failure: - XUSB_COUNTER(xusb, TX_ERRORS)++; - FREE_SEND_XFRAME(xbus, xframe); /* return to pool */ - return ret; -} - -/* - * PCM wrapper - */ -static int xframe_send_pcm(xbus_t *xbus, xframe_t *xframe) -{ - xusb_t *xusb; - - BUG_ON(!xbus); - BUG_ON(!xframe); - xusb = xusb_of(xbus); - BUG_ON(!xusb); - if(xusb->drop_next_pcm) { - FREE_SEND_XFRAME(xbus, xframe); /* return to pool */ - xusb->drop_next_pcm = 0; - return -EIO; - } - return do_send_xframe(xbus, xframe); -} - -/* - * commands wrapper - */ -static int xframe_send_cmd(xbus_t *xbus, xframe_t *xframe) -{ - BUG_ON(!xbus); - BUG_ON(!xframe); - //XBUS_INFO(xbus, "%s:\n", __FUNCTION__); - return do_send_xframe(xbus, xframe); -} - -/* - * get a urb from the receive_pool and submit it on the read endpoint. - */ -static bool xusb_listen(xusb_t *xusb) -{ - xbus_t *xbus = get_xbus(xusb->xbus_num); - xframe_t *xframe; - struct uframe *uframe; - int ret = 0; - - BUG_ON(!xbus); - xframe = ALLOC_RECV_XFRAME(xbus); - if(!xframe) { - XBUS_ERR(xbus, "Empty receive_pool\n"); - goto out; - } - uframe = xframe_to_uframe(xframe); - uframe_recompute(uframe, XUSB_RECV); - ret = usb_submit_urb(&uframe->urb, GFP_ATOMIC); - if(ret < 0) { - static int rate_limit; - - if((rate_limit++ % 1000) == 0) - XBUS_ERR(xbus, "%s: usb_submit_urb failed: %d\n", - __FUNCTION__, ret); - FREE_RECV_XFRAME(xbus, xframe); - goto out; - } - atomic_inc(&xusb->pending_reads); - ret = 1; -out: - put_xbus(xbus); - return ret; -} - -/*------------------------- XPP USB Bus Handling -------------------*/ - -enum XUSB_MODELS { - MODEL_FPGA_XPD -}; - -static const struct xusb_model_info { - const char *desc; - int iface_num; - struct xusb_endpoint in; - struct xusb_endpoint out; -} model_table[] = { - [MODEL_FPGA_XPD] = { - .iface_num = 0, - .in = { .ep_addr = 0x86 }, - .out = { .ep_addr = 0x02 }, - .desc = "FPGA_XPD" - }, -}; - -/* table of devices that work with this driver */ -static const struct usb_device_id xusb_table [] = { - { USB_DEVICE(0xE4E4, 0x1132), .driver_info=(kernel_ulong_t)&model_table[MODEL_FPGA_XPD] }, // FPGA_FXS - { USB_DEVICE(0xE4E4, 0x1142), .driver_info=(kernel_ulong_t)&model_table[MODEL_FPGA_XPD] }, // FPGA_1141 - { USB_DEVICE(0xE4E4, 0x1152), .driver_info=(kernel_ulong_t)&model_table[MODEL_FPGA_XPD] }, // FPGA_1151 - { USB_DEVICE(0xE4E4, 0x1162), .driver_info=(kernel_ulong_t)&model_table[MODEL_FPGA_XPD] }, // FPGA_1161 - { } /* Terminating entry */ -}; - -MODULE_DEVICE_TABLE (usb, xusb_table); - - -/* usb specific object needed to register this driver with the usb subsystem */ -static struct usb_driver xusb_driver = { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) - .owner = THIS_MODULE, -#endif - .name = "xpp_usb", - .probe = xusb_probe, - .disconnect = xusb_disconnect, - .id_table = xusb_table, -}; - -/* - * File operations needed when we register this driver. - * This assumes that this driver NEEDS file operations, - * of course, which means that the driver is expected - * to have a node in the /dev directory. If the USB - * device were for a network interface then the driver - * would use "struct net_driver" instead, and a serial - * device would use "struct tty_driver". - */ -static struct file_operations xusb_fops = { - /* - * The owner field is part of the module-locking - * mechanism. The idea is that the kernel knows - * which module to increment the use-counter of - * BEFORE it calls the device's open() function. - * This also means that the kernel can decrement - * the use-counter again before calling release() - * or should the open() function fail. - */ - .owner = THIS_MODULE, -}; - -/* - * usb class driver info in order to get a minor number from the usb core, - * and to have the device registered with devfs and the driver core - */ -static struct usb_class_driver xusb_class = { - .name = "usb/xpp_usb%d", - .fops = &xusb_fops, -/* FIXME: The sysfs class interfase seems to have chaged around here */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) - .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH, -#endif - .minor_base = USB_SKEL_MINOR_BASE, -}; - -/* - * Check that an endpoint's wMaxPacketSize attribute is 512. This - * indicates that it is a USB2's high speed end point. - * - * If it is 64, it means we have a USB1 controller. By default we do not - * support it and just fail the probe of the device. However if the user - * has set usb1=1, we continue and just put a notice. - * - * Returns true if all OK, false otherwise. - */ -static int check_usb1(struct usb_endpoint_descriptor *endpoint) -{ - const char *msg = (usb_pipein(endpoint->bEndpointAddress))?"input":"output"; - - if(endpoint->wMaxPacketSize >= sizeof(xpacket_t)) - return 1; - - if(usb1) { - NOTICE("USB1 endpoint detected: USB %s endpoint 0x%X support only wMaxPacketSize=%d.\n", - msg, endpoint->bEndpointAddress, endpoint->wMaxPacketSize); - return 1; - } - NOTICE("USB1 endpoint detected. Device disabled. To enable: usb1=1, and read docs. (%s, endpoint %d, size %d).\n", - msg, endpoint->bEndpointAddress, endpoint->wMaxPacketSize); - return 0; -} - -/* - * set up the endpoint information - * check out the endpoints - * FIXME: Should be simplified (above 2.6.10) to use usb_dev->ep_in[0..16] and usb_dev->ep_out[0..16] - */ -static int set_endpoints(xusb_t *xusb, struct usb_host_interface *iface_desc, struct xusb_model_info *model_info) -{ - struct usb_endpoint_descriptor *endpoint; - struct xusb_endpoint *xusb_ep; - int ep_addr; - int i; - -#define BULK_ENDPOINT(ep) (((ep)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) - - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; - ep_addr = endpoint->bEndpointAddress; - - if(!BULK_ENDPOINT(endpoint)) { - DBG(DEVICES, "endpoint 0x%x is not bulk: mbAttributes=0x%X\n", - ep_addr, endpoint->bmAttributes); - continue; - } - if(usb_pipein(ep_addr)) { // Input - if(ep_addr == model_info->in.ep_addr) { - if (!check_usb1(endpoint)) - return 0; - xusb_ep = &xusb->endpoints[XUSB_RECV]; - xusb_ep->ep_addr = ep_addr; - xusb_ep->max_size = endpoint->wMaxPacketSize; - xusb_ep->callback = xpp_receive_callback; - } - } else { // Output - if(ep_addr == model_info->out.ep_addr) { - if (!check_usb1(endpoint)) - return 0; - xusb_ep = &xusb->endpoints[XUSB_SEND]; - xusb_ep->ep_addr = ep_addr; - xusb_ep->max_size = endpoint->wMaxPacketSize; - xusb_ep->callback = xpp_send_callback; - } - } - } - if (!xusb->endpoints[XUSB_RECV].ep_addr || !xusb->endpoints[XUSB_SEND].ep_addr) { - XUSB_ERR(xusb, "Couldn't find bulk-in or bulk-out endpoints\n"); - return 0; - } - DBG(DEVICES, "in=0x%02X out=0x%02X\n", xusb->endpoints[XUSB_RECV].ep_addr, xusb->endpoints[XUSB_SEND].ep_addr); - return 1; -} - -/* - * The USB stack before 2.6.10 seems to be a bit shoddy. It seems that when - * being called from the probe we may already have the lock to udev (the Usb DEVice). - * Thus we call the internal __usb_reset_device instead. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) -#define DO_USB_RESET_DEVICE(dev) __usb_reset_device(dev) -#else -#define DO_USB_RESET_DEVICE(dev) usb_reset_device(dev) -#endif - -/** - * xusb_probe - * - * Called by the usb core when a new device is connected that it thinks - * this driver might be interested in. - */ -static int xusb_probe(struct usb_interface *interface, const struct usb_device_id *id) -{ - struct usb_device *udev = interface_to_usbdev(interface); - struct usb_host_interface *iface_desc = usb_altnum_to_altsetting(interface, 0); - xusb_t *xusb = NULL; - struct xusb_model_info *model_info = (struct xusb_model_info*)id->driver_info; - struct proc_dir_entry *procsummary = NULL; - xbus_t *xbus = NULL; - unsigned long flags; - int retval = -ENOMEM; - int i; - - DBG(DEVICES, "New XUSB device MODEL=%s\n", model_info->desc); - if(iface_desc->desc.bInterfaceNumber != model_info->iface_num) { - DBG(DEVICES, "Skip interface #%d != #%d\n", - iface_desc->desc.bInterfaceNumber, model_info->iface_num); - return -ENODEV; - } - if((retval = DO_USB_RESET_DEVICE(udev)) < 0) { - ERR("usb_reset_device failed: %d\n", retval); - goto probe_failed; - } - if (!model_info) { - ERR("Missing endpoint setup for this device %d:%d\n", - udev->descriptor.idVendor,udev->descriptor.idProduct); - retval = -ENODEV; - goto probe_failed; - } - - /* allocate memory for our device state and initialize it */ - xusb = KZALLOC(sizeof(xusb_t), GFP_KERNEL); - if (xusb == NULL) { - ERR("xpp_usb: Unable to allocate new xpp usb bus\n"); - retval = -ENOMEM; - goto probe_failed; - } - init_MUTEX (&xusb->sem); - atomic_set(&xusb->pending_writes, 0); - atomic_set(&xusb->pending_reads, 0); - atomic_set(&xusb->pcm_tx_drops, 0); - atomic_set(&xusb->usb_sluggish_count, 0); - xusb->udev = udev; - xusb->interface = interface; - xusb->model_info = model_info; - - if(!set_endpoints(xusb, iface_desc, model_info)) { - retval = -ENODEV; - goto probe_failed; - } -#ifndef USB_FIELDS_MISSING - xusb->serial = udev->serial; - xusb->manufacturer = udev->manufacturer; - xusb->product = udev->product; - xusb->interface_name = iface_desc->string; -#else - USB_GET_STRING(udev, iSerialNumber, xusb->serial); - USB_GET_STRING(udev, iManufacturer, xusb->manufacturer); - USB_GET_STRING(udev, iProduct, xusb->product); - USB_GET_IFACE_NAME(udev, iface_desc, xusb->interface_name); -#endif - INFO("XUSB: %s -- %s -- %s\n", - xusb->manufacturer, xusb->product, xusb->interface_name); - - /* allow device read, write and ioctl */ - xusb->present = 1; - - /* we can register the device now, as it is ready */ - usb_set_intfdata (interface, xusb); - retval = usb_register_dev (interface, &xusb_class); - if (retval) { - /* something prevented us from registering this driver */ - ERR ("Not able to get a minor for this device.\n"); - goto probe_failed; - } - - xusb->minor = interface->minor; - - /* let the user know what node this device is now attached to */ - DBG(DEVICES, "USB XPP device now attached to minor %d\n", xusb->minor); - xbus = xbus_new(&xusb_ops, min(xusb->endpoints[XUSB_SEND].max_size, xusb->endpoints[XUSB_RECV].max_size), xusb); - if(!xbus) { - retval = -ENOMEM; - goto probe_failed; - } - spin_lock_irqsave(&xusb_lock, flags); - for(i = 0; i < MAX_BUSES; i++) { - if(xusb_array[i] == NULL) - break; - } - spin_unlock_irqrestore(&xusb_lock, flags); - if(i >= MAX_BUSES) { - ERR("xpp_usb: Too many XPP USB buses\n"); - retval = -ENOMEM; - goto probe_failed; - } - usb_make_path(udev, xusb->path, XBUS_DESCLEN); // May trunacte... ignore - snprintf(xbus->location, XBUS_DESCLEN, "%s", xusb->path); - if(xusb->serial && xusb->serial[0]) - snprintf(xbus->label, LABEL_SIZE, "usb:%s", xusb->serial); - xusb->index = i; - xusb_array[i] = xusb; - XUSB_DBG(DEVICES, xusb, "GOT XPP USB BUS: %s\n", xbus->location); - -#ifdef CONFIG_PROC_FS - DBG(PROC, "Creating proc entry " PROC_USBXPP_SUMMARY " in bus proc dir.\n"); - procsummary = create_proc_read_entry(PROC_USBXPP_SUMMARY, 0444, xbus->proc_xbus_dir, - xusb_read_proc, xusb); - if (!procsummary) { - XBUS_ERR(xbus, "Failed to create proc file '%s'\n", PROC_USBXPP_SUMMARY); - // FIXME: better error handling - retval = -EIO; - goto probe_failed; - } - procsummary->owner = THIS_MODULE; -#endif - bus_count++; - xusb->xbus_num = xbus->num; - /* prepare several pending frames for receive side */ - for(i = 0; i < 10; i++) - xusb_listen(xusb); - xbus_activate(xbus); - return retval; -probe_failed: - ERR("Failed to initialize xpp usb bus: %d\n", retval); - usb_set_intfdata (interface, NULL); - if(xusb) { - if(xusb->minor) { // passed registration phase - ERR("Calling usb_deregister_dev()\n"); - usb_deregister_dev(interface, &xusb_class); - } - ERR("Removing failed xusb\n"); - KZFREE(xusb); - } - if(xbus) { - if(procsummary) { - XBUS_DBG(PROC, xbus, "Remove proc_entry: " PROC_USBXPP_SUMMARY "\n"); - remove_proc_entry(PROC_USBXPP_SUMMARY, xbus->proc_xbus_dir); - procsummary = NULL; - } - ERR("Calling xbus_disconnect()\n"); - xbus_disconnect(xbus); // Blocking until fully deactivated! - } - return retval; -} - -/** - * xusb_disconnect - * - * Called by the usb core when the device is removed from the system. - * - * This routine guarantees that the driver will not submit any more urbs - * by clearing dev->udev. It is also supposed to terminate any currently - * active urbs. Unfortunately, usb_bulk_msg(), used in xusb_read(), does - * not provide any way to do this. But at least we can cancel an active - * write. - */ -static void xusb_disconnect(struct usb_interface *interface) -{ - xusb_t *xusb; - xbus_t *xbus; - int minor; - int i; - - DBG(DEVICES, "CALLED\n"); - /* prevent races with open() */ - down (&disconnect_sem); - - xusb = usb_get_intfdata (interface); - xusb->present = 0; - xbus = get_xbus(xusb->xbus_num); - - /* find our xusb */ - for(i = 0; i < MAX_BUSES; i++) { - if(xusb_array[i] == xusb) - break; - } - BUG_ON(i >= MAX_BUSES); - xusb_array[i] = NULL; - -#ifdef CONFIG_PROC_FS - if(xbus->proc_xbus_dir) { - XBUS_DBG(PROC, xbus, "Remove proc_entry: " PROC_USBXPP_SUMMARY "\n"); - remove_proc_entry(PROC_USBXPP_SUMMARY, xbus->proc_xbus_dir); - } -#endif - /* - * put_xbus() would be called during xbus_disconnect() - */ - xbus_disconnect(xbus); // Blocking until fully deactivated! - usb_set_intfdata (interface, NULL); - - down (&xusb->sem); - minor = xusb->minor; - - /* give back our minor */ - usb_deregister_dev (interface, &xusb_class); - - up (&xusb->sem); - DBG(DEVICES, "Semaphore released\n"); - XUSB_INFO(xusb, "now disconnected\n"); - KZFREE(xusb); - - up (&disconnect_sem); -} - -static void xpp_send_callback(USB_PASS_CB(urb)) -{ - struct uframe *uframe = urb_to_uframe(urb); - xframe_t *xframe = &uframe->xframe; - xusb_t *xusb = uframe->xusb; - xbus_t *xbus = get_xbus(xusb->xbus_num); - struct timeval now; - long usec; - int writes = atomic_read(&xusb->pending_writes); - int i; - - if(!xbus) { - XUSB_ERR(xusb, "Sent URB does not belong to a valid xbus anymore...\n"); - return; - } - //flip_parport_bit(6); - atomic_dec(&xusb->pending_writes); - do_gettimeofday(&now); - xusb->last_tx = xframe->tv_submitted; - usec = usec_diff(&now, &xframe->tv_submitted); - if(usec > xusb->max_tx_delay) - xusb->max_tx_delay = usec; - i = usec / USEC_BUCKET; - if(i >= NUM_BUCKETS) - i = NUM_BUCKETS - 1; - xusb->usb_tx_delay[i]++; - if(unlikely(usec > tx_sluggish)) { - atomic_inc(&xusb->usb_sluggish_count); - if(xusb->sluggish_debounce++ > drop_pcm_after) { - static int rate_limit; - - if((rate_limit++ % 1003) == 500) /* skip first messages */ - XUSB_NOTICE(xusb, - "Sluggish USB. Dropping next PCM frame (pending_writes=%d)\n", - writes); - atomic_inc(&xusb->pcm_tx_drops); - xusb->drop_next_pcm = 1; - xusb->sluggish_debounce = 0; - } - } else - xusb->sluggish_debounce = 0; - /* sync/async unlink faults aren't errors */ - if (urb->status && !(urb->status == -ENOENT || urb->status == -ECONNRESET)) { - static int rate_limit; - if((rate_limit++ % 1000) < 10) { - XUSB_ERR(xusb, - "nonzero write bulk status received: %d (pending_writes=%d)\n", - urb->status, writes); - dump_xframe("usb-write-error", xbus, xframe, DBG_ANY); - } - XUSB_COUNTER(xusb, TX_ERRORS)++; - } else - XUSB_COUNTER(xusb, TX_FRAMES)++; - FREE_SEND_XFRAME(xbus, xframe); - if(!xusb->present) - XUSB_ERR(xusb, "A urb from non-connected device?\n"); - put_xbus(xbus); -} - -static void xpp_receive_callback(USB_PASS_CB(urb)) -{ - struct uframe *uframe = urb_to_uframe(urb); - xframe_t *xframe = &uframe->xframe; - xusb_t *xusb = uframe->xusb; - xbus_t *xbus = get_xbus(xusb->xbus_num); - size_t size; - bool do_resubmit = 1; - bool is_inuse = 0; - struct timeval now; - - do_gettimeofday(&now); - atomic_dec(&xusb->pending_reads); - if(!xbus) { - XUSB_ERR(xusb, "Received URB does not belong to a valid xbus anymore...\n"); - return; - } - if(!XBUS_GET(xbus)) { - XUSB_ERR(xusb, "Dropping urb. Is shutting down.\n"); - do_resubmit = 0; - goto err; - } - is_inuse = 1; - if(!xusb->present) { - do_resubmit = 0; - goto err; - } - if (urb->status) { - DBG(GENERAL, "nonzero read bulk status received: %d\n", urb->status); - XUSB_COUNTER(xusb, RX_ERRORS)++; - goto err; - } - size = urb->actual_length; - if(size == 0) { - static int rate_limit; - - if((rate_limit++ % 5003) == 0) - XUSB_NOTICE(xusb, "Received a zero length URBs (%d)\n", rate_limit); - XUSB_COUNTER(xusb, RCV_ZERO_LEN)++; - goto err; - } - atomic_set(&xframe->frame_len, size); - xframe->tv_received = now; - -// if (debug) -// dump_xframe("USB_FRAME_RECEIVE", xbus, xframe, debug); - XUSB_COUNTER(xusb, RX_FRAMES)++; - /* Send UP */ - xbus_receive_xframe(xbus, xframe); -end: - if(is_inuse) - XBUS_PUT(xbus); - if(do_resubmit) - xusb_listen(xusb); - put_xbus(xbus); - return; -err: - FREE_RECV_XFRAME(xbus, xframe); - goto end; -} - - -/*------------------------- Initialization -------------------------*/ - -static void xpp_usb_cleanup(void) -{ - if(xusb_cache) { - kmem_cache_destroy(xusb_cache); - xusb_cache = NULL; - } -} - -static int __init xpp_usb_init(void) -{ - int ret; - //xusb_t *xusb; - - INFO("revision %s\n", XPP_VERSION); - xusb_cache = kmem_cache_create("xusb_cache", - sizeof(xframe_t) + XFRAME_DATASIZE, - 0, 0, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) - NULL, -#endif - NULL); - if(!xusb_cache) { - ret = -ENOMEM; - goto failure; - } - - /* register this driver with the USB subsystem */ - ret = usb_register(&xusb_driver); - if (ret) { - ERR("usb_register failed. Error number %d\n", ret); - goto failure; - } - return 0; -failure: - xpp_usb_cleanup(); - return ret; -} - - -static void __exit xpp_usb_shutdown(void) -{ - DBG(GENERAL, "\n"); - /* deregister this driver with the USB subsystem */ - usb_deregister(&xusb_driver); - xpp_usb_cleanup(); -} - - - -#ifdef CONFIG_PROC_FS - -static int xusb_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - int i; - //unsigned long stamp = jiffies; - xusb_t *xusb = data; - uint usb_tx_delay[NUM_BUCKETS]; - const int mark_limit = tx_sluggish/USEC_BUCKET; - - if(!xusb) - goto out; - // TODO: probably needs a per-xusb lock: - spin_lock_irqsave(&xusb_lock, flags); - len += sprintf(page + len, "Device: %03d/%03d\n", - xusb->udev->bus->busnum, - xusb->udev->devnum - ); - len += sprintf(page + len, "USB: manufacturer=%s\n", xusb->manufacturer); - len += sprintf(page + len, "USB: product=%s\n", xusb->product); - len += sprintf(page + len, "USB: serial=%s\n", xusb->serial); - len += sprintf(page + len, "Minor: %d\nModel Info: %s\n", - xusb->minor, xusb->model_info->desc); - len += sprintf(page + len, "Endpoints:\n" - "\tIn: 0x%02X - Size: %d)\n" - "\tOut: 0x%02X - Size: %d)\n", - xusb->endpoints[XUSB_RECV].ep_addr, - xusb->endpoints[XUSB_RECV].max_size, - xusb->endpoints[XUSB_SEND].ep_addr, - xusb->endpoints[XUSB_SEND].max_size - ); - len += sprintf(page + len, "\npending_writes=%d\n", atomic_read(&xusb->pending_writes)); - len += sprintf(page + len, "pending_reads=%d\n", atomic_read(&xusb->pending_reads)); - len += sprintf(page + len, "max_tx_delay=%d\n", xusb->max_tx_delay); - xusb->max_tx_delay = 0; -#ifdef DEBUG_PCM_TIMING - len += sprintf(page + len, "\nstamp_last_pcm_read=%lld accumulate_diff=%lld\n", stamp_last_pcm_read, accumulate_diff); -#endif - memcpy(usb_tx_delay, xusb->usb_tx_delay, sizeof(usb_tx_delay)); - len += sprintf(page + len, "usb_tx_delay[%d,%d,%d]: ", - USEC_BUCKET, BUCKET_START, NUM_BUCKETS); - for(i = BUCKET_START; i < NUM_BUCKETS; i++) { - len += sprintf(page + len, "%6d ", - usb_tx_delay[i]); - if(i == mark_limit) - len += sprintf(page + len, "| "); - } - len += sprintf(page + len, "\nPCM_TX_DROPS: %5d (sluggish: %d)\n", - atomic_read(&xusb->pcm_tx_drops), - atomic_read(&xusb->usb_sluggish_count) - ); - len += sprintf(page + len, "\nCOUNTERS:\n"); - for(i = 0; i < XUSB_COUNTER_MAX; i++) { - len += sprintf(page + len, "\t%-15s = %d\n", xusb_counters[i].name, xusb->counters[i]); - } -#if 0 - len += sprintf(page + len, "<-- len=%d\n", len); -#endif - spin_unlock_irqrestore(&xusb_lock, flags); -out: - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; - -} - -#endif - - - -MODULE_DESCRIPTION("XPP USB Transport Driver"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(XPP_VERSION); - -module_init(xpp_usb_init); -module_exit(xpp_usb_shutdown); diff --git a/zaptel/kernel/xpp/xpp_zap.c b/zaptel/kernel/xpp/xpp_zap.c deleted file mode 100644 index 53d2cfad..00000000 --- a/zaptel/kernel/xpp/xpp_zap.c +++ /dev/null @@ -1,1091 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004, Xorcom - * - * Derived from ztdummy - * - * Copyright (C) 2002, Hermes Softlab - * Copyright (C) 2004, Digium, Inc. - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif - -#include -#include -#include -#include -#include -#include /* for udelay */ -#include -#include -#include -#include "xbus-core.h" -#include "xproto.h" -#include "xpp_zap.h" -#include "parport_debug.h" - -static const char rcsid[] = "$Id: xpp_zap.c 4456 2008-08-04 15:52:49Z tzafrir $"; - -#ifdef CONFIG_PROC_FS -struct proc_dir_entry *xpp_proc_toplevel = NULL; -#define PROC_DIR "xpp" -#define PROC_XPD_ZTREGISTER "zt_registration" -#define PROC_XPD_BLINK "blink" -#define PROC_XPD_SUMMARY "summary" -#endif - -#define MAX_QUEUE_LEN 10000 -#define DELAY_UNTIL_DIALTONE 3000 - -DEF_PARM(int, debug, 0, 0644, "Print DBG statements"); -static DEF_PARM_BOOL(zap_autoreg, 0, 0644, "Register spans automatically (1) or not (0)"); -static DEF_PARM_BOOL(prefmaster, 0, 0644, "Do we want to be zaptel preferred sync master"); -// DEF_ARRAY(int, pcmtx, 4, 0, "Forced PCM values to transmit"); - -#include "zap_debug.h" - -#ifdef DEBUG_SYNC_PARPORT -/* - * Use parallel port to sample our PCM sync and diagnose quality and - * potential problems. A logic analizer or a scope should be connected - * to the data bits of the parallel port. - * - * Array parameter: Choose the two xbuses Id's to sample. - * This can be changed on runtime as well. Example: - * echo "3,5" > /sys/module/xpp/parameters/parport_xbuses - */ -static int parport_xbuses[2] = { 0, 1 }; -unsigned int parport_xbuses_num_values; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) -module_param_array(parport_xbuses, int, &parport_xbuses_num_values, 0577); -#else -module_param_array(parport_xbuses, int, parport_xbuses_num_values, 0577); -#endif -MODULE_PARM_DESC(parport_xbuses, "Id's of xbuses to sample (1-2)"); - -/* - * Flip a single bit in the parallel port: - * - The bit number is either bitnum0 or bitnum1 - * - Bit is selected by xbus number from parport_xbuses[] - */ -void xbus_flip_bit(xbus_t *xbus, unsigned int bitnum0, unsigned int bitnum1) -{ - int num = xbus->num; - - if(num == parport_xbuses[0]) - flip_parport_bit(bitnum0); - if(num == parport_xbuses[1]) - flip_parport_bit(bitnum1); -} -EXPORT_SYMBOL(xbus_flip_bit); -#endif - -static atomic_t num_registered_spans = ATOMIC_INIT(0); - -int total_registered_spans(void) -{ - return atomic_read(&num_registered_spans); -} - -static int zaptel_register_xpd(xpd_t *xpd); -static int zaptel_unregister_xpd(xpd_t *xpd); -static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); -static int proc_xpd_ztregister_read(char *page, char **start, off_t off, int count, int *eof, void *data); -static int proc_xpd_ztregister_write(struct file *file, const char __user *buffer, unsigned long count, void *data); -static int proc_xpd_blink_read(char *page, char **start, off_t off, int count, int *eof, void *data); -static int proc_xpd_blink_write(struct file *file, const char __user *buffer, unsigned long count, void *data); - -/*------------------------- XPD Management -------------------------*/ - -static void xpd_proc_remove(xbus_t *xbus, xpd_t *xpd) -{ -#ifdef CONFIG_PROC_FS - if(xpd->proc_xpd_dir) { - chip_proc_remove(xbus, xpd); - if(xpd->proc_xpd_summary) { - XPD_DBG(PROC, xpd, "Removing proc '%s'\n", PROC_XPD_SUMMARY); - remove_proc_entry(PROC_XPD_SUMMARY, xpd->proc_xpd_dir); - xpd->proc_xpd_summary = NULL; - } - if(xpd->proc_xpd_ztregister) { - XPD_DBG(PROC, xpd, "Removing proc '%s'\n", PROC_XPD_ZTREGISTER); - remove_proc_entry(PROC_XPD_ZTREGISTER, xpd->proc_xpd_dir); - xpd->proc_xpd_ztregister = NULL; - } - if(xpd->proc_xpd_blink) { - XPD_DBG(PROC, xpd, "Removing proc '%s'\n", PROC_XPD_BLINK); - remove_proc_entry(PROC_XPD_BLINK, xpd->proc_xpd_dir); - xpd->proc_xpd_blink = NULL; - } - XPD_DBG(PROC, xpd, "Removing %s/%s proc directory\n", - xbus->busname, xpd->xpdname); - remove_proc_entry(xpd->xpdname, xbus->proc_xbus_dir); - xpd->proc_xpd_dir = NULL; - } -#endif -} - -static int xpd_proc_create(xbus_t *xbus, xpd_t *xpd) -{ -#ifdef CONFIG_PROC_FS - XPD_DBG(PROC, xpd, "Creating proc directory\n"); - xpd->proc_xpd_dir = proc_mkdir(xpd->xpdname, xbus->proc_xbus_dir); - if(!xpd->proc_xpd_dir) { - XPD_ERR(xpd, "Failed to create proc directory\n"); - goto err; - } - xpd->proc_xpd_summary = create_proc_read_entry(PROC_XPD_SUMMARY, 0444, xpd->proc_xpd_dir, - xpd_read_proc, xpd); - if(!xpd->proc_xpd_summary) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_XPD_SUMMARY); - goto err; - } - xpd->proc_xpd_summary->owner = THIS_MODULE; - xpd->proc_xpd_ztregister = create_proc_entry(PROC_XPD_ZTREGISTER, 0644, xpd->proc_xpd_dir); - if (!xpd->proc_xpd_ztregister) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_XPD_ZTREGISTER); - goto err; - } - xpd->proc_xpd_ztregister->owner = THIS_MODULE; - xpd->proc_xpd_ztregister->data = xpd; - xpd->proc_xpd_ztregister->read_proc = proc_xpd_ztregister_read; - xpd->proc_xpd_ztregister->write_proc = proc_xpd_ztregister_write; - xpd->proc_xpd_blink = create_proc_entry(PROC_XPD_BLINK, 0644, xpd->proc_xpd_dir); - if (!xpd->proc_xpd_blink) { - XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_XPD_BLINK); - goto err; - } - xpd->proc_xpd_blink->owner = THIS_MODULE; - xpd->proc_xpd_blink->data = xpd; - xpd->proc_xpd_blink->read_proc = proc_xpd_blink_read; - xpd->proc_xpd_blink->write_proc = proc_xpd_blink_write; - if(chip_proc_create(xbus, xpd) < 0) - goto err; -#endif - return 0; -err: - xpd_proc_remove(xbus, xpd); - return -EFAULT; -} - -void xpd_free(xpd_t *xpd) -{ - xbus_t *xbus = NULL; - - if(!xpd) - return; - if(xpd->xproto) - xproto_put(xpd->xproto); /* was taken in xpd_alloc() */ - xpd->xproto = NULL; - xbus = xpd->xbus; - if(!xbus) - return; - XPD_DBG(DEVICES, xpd, "\n"); - xpd_proc_remove(xbus, xpd); - xbus_unregister_xpd(xbus, xpd); - KZFREE(xpd); -} - - -__must_check int xpd_common_init(xbus_t *xbus, xpd_t *xpd, int unit, int subunit, int subtype, int subunits) -{ - int ret; - - MKADDR(&xpd->addr, unit, subunit); - xpd->xbus_idx = XPD_IDX(unit,subunit); - snprintf(xpd->xpdname, XPD_NAMELEN, "XPD-%1d%1d", unit, subunit); - xpd->subtype = subtype; - xpd->subunits = subunits; - xpd->offhook = 0; - - /* For USB-1 disable some channels */ - if(MAX_SEND_SIZE(xbus) < RPACKET_SIZE(GLOBAL, PCM_WRITE)) { - xpp_line_t no_pcm; - - no_pcm = 0x7F | xpd->digital_outputs | xpd->digital_inputs; - xpd->no_pcm = no_pcm; - XBUS_NOTICE(xbus, "max xframe size = %d, disabling some PCM channels. no_pcm=0x%04X\n", - MAX_SEND_SIZE(xbus), xpd->no_pcm); - } - if((ret = xpd_proc_create(xbus, xpd)) < 0) - return ret; - xbus_register_xpd(xbus, xpd); - return 0; -} - -/* - * Synchronous part of XPD detection. - * Called from xbus_poll() - */ -int create_xpd(xbus_t *xbus, const xproto_table_t *proto_table, - int unit, - int subunit, - byte type, - byte subtype, - int subunits, - byte port_dir) -{ - xpd_t *xpd = NULL; - bool to_phone; - int ret = -EINVAL; - - BUG_ON(type == XPD_TYPE_NOMODULE); - to_phone = BIT(subunit) & port_dir; - BUG_ON(!xbus); - xpd = xpd_byaddr(xbus, unit, subunit); - if(xpd) { - XPD_NOTICE(xpd, "XPD at %d%d already exists\n", - unit, subunit); - goto out; - } - xpd = proto_table->xops.card_new(xbus, unit, subunit, proto_table, subtype, subunits, to_phone); - if(!xpd) { - XBUS_NOTICE(xbus, "card_new(%d,%d,%d,%d,%d) failed. Ignored.\n", - unit, subunit, proto_table->type, subtype, to_phone); - goto err; - } -out: - return 0; -err: - if(xpd) - xpd_free(xpd); - return ret; -} - -void xpd_post_init(xpd_t *xpd) -{ - XPD_DBG(DEVICES, xpd, "\n"); - if(zap_autoreg) - zaptel_register_xpd(xpd); -} - -#ifdef CONFIG_PROC_FS - -/** - * Prints a general procfs entry for the bus, under xpp/BUSNAME/summary - * @page TODO: figure out procfs - * @start TODO: figure out procfs - * @off TODO: figure out procfs - * @count TODO: figure out procfs - * @eof TODO: figure out procfs - * @data an xbus_t pointer with the bus data. - */ -static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - xpd_t *xpd = data; - xbus_t *xbus; - int i; - - if(!xpd) - goto out; - - xbus = xpd->xbus; - len += sprintf(page + len, "%s (%s, card %s, span %d)\n" - "timing_priority: %d\n" - "timer_count: %d span->mainttimer=%d\n" - , - xpd->xpdname, xpd->type_name, - (xpd->card_present) ? "present" : "missing", - (SPAN_REGISTERED(xpd)) ? xpd->span.spanno : 0, - xpd->timing_priority, - xpd->timer_count, xpd->span.mainttimer - ); - len += sprintf(page + len, "Address: U=%d S=%d\n", xpd->addr.unit, xpd->addr.subunit); - len += sprintf(page + len, "Subunits: %d\n", xpd->subunits); - len += sprintf(page + len, "Type: %d.%d\n\n", xpd->type, xpd->subtype); - len += sprintf(page + len, "pcm_len=%d\n\n", xpd->pcm_len); - len += sprintf(page + len, "wanted_pcm_mask=0x%04X\n\n", xpd->wanted_pcm_mask); - len += sprintf(page + len, "mute_dtmf=0x%04X\n\n", xpd->mute_dtmf); - len += sprintf(page + len, "STATES:"); - len += sprintf(page + len, "\n\t%-17s: ", "output_relays"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", IS_SET(xpd->digital_outputs, i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "input_relays"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", IS_SET(xpd->digital_inputs, i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "offhook"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", IS_SET(xpd->offhook, i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "cid_on"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", IS_SET(xpd->cid_on, i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "msg_waiting"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", IS_SET(xpd->msg_waiting, i)); - } - len += sprintf(page + len, "\n\t%-17s: ", "ringing"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", xpd->ringing[i]); - } - len += sprintf(page + len, "\n\t%-17s: ", "no_pcm"); - for_each_line(xpd, i) { - len += sprintf(page + len, "%d ", IS_SET(xpd->no_pcm, i)); - } -#if 1 - if(SPAN_REGISTERED(xpd)) { - len += sprintf(page + len, "\nPCM:\n | [readchunk] | [writechunk] | W D"); - for_each_line(xpd, i) { - struct zt_chan *chans = xpd->span.chans; - byte rchunk[ZT_CHUNKSIZE]; - byte wchunk[ZT_CHUNKSIZE]; - byte *rp; - byte *wp; - int j; - - if(IS_SET(xpd->digital_outputs, i)) - continue; - if(IS_SET(xpd->digital_inputs, i)) - continue; - if(IS_SET(xpd->digital_signalling, i)) - continue; - rp = chans[i].readchunk; - wp = chans[i].writechunk; - memcpy(rchunk, rp, ZT_CHUNKSIZE); - memcpy(wchunk, wp, ZT_CHUNKSIZE); - len += sprintf(page + len, "\n port %2d> | ", i); - for(j = 0; j < ZT_CHUNKSIZE; j++) { - len += sprintf(page + len, "%02X ", rchunk[j]); - } - len += sprintf(page + len, " | "); - for(j = 0; j < ZT_CHUNKSIZE; j++) { - len += sprintf(page + len, "%02X ", wchunk[j]); - } - len += sprintf(page + len, " | %c", - (IS_SET(xpd->wanted_pcm_mask, i))?'+':' '); - len += sprintf(page + len, " %c", - (IS_SET(xpd->mute_dtmf, i))?'-':' '); - } - } -#endif -#if 0 - if(SPAN_REGISTERED(xpd)) { - len += sprintf(page + len, "\nSignalling:\n"); - for_each_line(xpd, i) { - struct zt_chan *chan = &xpd->span.chans[i]; - len += sprintf(page + len, "\t%2d> sigcap=0x%04X sig=0x%04X\n", i, chan->sigcap, chan->sig); - } - } -#endif - len += sprintf(page + len, "\nCOUNTERS:\n"); - for(i = 0; i < XPD_COUNTER_MAX; i++) { - len += sprintf(page + len, "\t\t%-20s = %d\n", - xpd_counters[i].name, xpd->counters[i]); - } - len += sprintf(page + len, "<-- len=%d\n", len); -out: - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; - -} - -#endif - -/* - * xpd_alloc - Allocator for new XPD's - * - */ -xpd_t *xpd_alloc(size_t privsize, const xproto_table_t *proto_table, int channels) -{ - xpd_t *xpd = NULL; - size_t alloc_size = sizeof(xpd_t) + privsize; - int type = proto_table->type; - - BUG_ON(!proto_table); - DBG(DEVICES, "type=%d channels=%d (alloc_size=%zd)\n", - type, channels, alloc_size); - if(channels > CHANNELS_PERXPD) { - ERR("%s: type=%d: too many channels %d\n", - __FUNCTION__, type, channels); - goto err; - } - - if((xpd = KZALLOC(alloc_size, GFP_KERNEL)) == NULL) { - ERR("%s: type=%d: Unable to allocate memory\n", - __FUNCTION__, type); - goto err; - } - xpd->priv = (byte *)xpd + sizeof(xpd_t); - spin_lock_init(&xpd->lock); - xpd->xbus = NULL; - xpd->xbus_idx = -1; - xpd->channels = channels; - xpd->chans = NULL; - xpd->card_present = 0; - xpd->offhook = 0x0; /* ONHOOK */ - xpd->type = proto_table->type; - xpd->xproto = proto_table; - xpd->xops = &proto_table->xops; - xpd->digital_outputs = 0; - xpd->digital_inputs = 0; - - atomic_set(&xpd->zt_registered, 0); - atomic_set(&xpd->open_counter, 0); - - xpd->chans = kmalloc(sizeof(struct zt_chan)*xpd->channels, GFP_KERNEL); - if (xpd->chans == NULL) { - ERR("%s: Unable to allocate channels\n", __FUNCTION__); - goto err; - } - xproto_get(type); /* will be returned in xpd_free() */ - return xpd; -err: - if(xpd) { - if(xpd->chans) - kfree((void *)xpd->chans); - kfree(xpd); - } - return NULL; -} - -/* FIXME: this should be removed once digium patch their zaptel.h - * I simply wish to avoid changing zaptel.h in the xpp patches. - */ -#ifndef ZT_EVENT_REMOVED -#define ZT_EVENT_REMOVED (20) -#endif - -void xpd_disconnect(xpd_t *xpd) -{ - unsigned long flags; - - BUG_ON(!xpd); - - spin_lock_irqsave(&xpd->lock, flags); - XPD_DBG(DEVICES, xpd, "(%p)\n", xpd->xproto); - if(!xpd->card_present) /* Multiple reports */ - goto out; - xpd->card_present = 0; - if(SPAN_REGISTERED(xpd)) { - int i; - - update_xpd_status(xpd, ZT_ALARM_NOTOPEN); - /* TODO: Should this be done before releasing the spinlock? */ - XPD_DBG(DEVICES, xpd, "Queuing ZT_EVENT_REMOVED on all channels to ask user to release them\n"); - for (i=0; ispan.channels; i++) - zt_qevent_lock(&xpd->chans[i],ZT_EVENT_REMOVED); - } -out: - spin_unlock_irqrestore(&xpd->lock, flags); -} - -void xpd_remove(xpd_t *xpd) -{ - xbus_t *xbus; - - BUG_ON(!xpd); - xbus = xpd->xbus; - XPD_INFO(xpd, "Remove\n"); - zaptel_unregister_xpd(xpd); - CALL_XMETHOD(card_remove, xbus, xpd); - xpd_free(xpd); -} - -void update_xpd_status(xpd_t *xpd, int alarm_flag) -{ - struct zt_span *span = &xpd->span; - - if(!SPAN_REGISTERED(xpd)) { - // XPD_NOTICE(xpd, "%s: XPD is not registered. Skipping.\n", __FUNCTION__); - return; - } - switch (alarm_flag) { - case ZT_ALARM_NONE: - xpd->last_response = jiffies; - break; - default: - // Nothing - break; - } - if(span->alarms == alarm_flag) - return; - span->alarms = alarm_flag; - zt_alarm_notify(span); - XPD_DBG(GENERAL, xpd, "Update XPD alarms: %s -> %02X\n", xpd->span.name, alarm_flag); -} - -void update_line_status(xpd_t *xpd, int pos, bool to_offhook) -{ - zt_rxsig_t rxsig; - - BUG_ON(!xpd); - if(to_offhook) { - BIT_SET(xpd->offhook, pos); - rxsig = ZT_RXSIG_OFFHOOK; - } else { - BIT_CLR(xpd->offhook, pos); - BIT_CLR(xpd->cid_on, pos); - rxsig = ZT_RXSIG_ONHOOK; - /* - * To prevent latest PCM to stay in buffers - * indefinitely, mark this channel for a - * single silence transmittion. - * - * This bit will be cleared on the next tick. - */ - BIT_SET(xpd->silence_pcm, pos); - } - /* - * We should not spinlock before calling zt_hooksig() as - * it may call back into our xpp_hooksig() and cause - * a nested spinlock scenario - */ - LINE_DBG(SIGNAL, xpd, pos, "rxsig=%s\n", (rxsig == ZT_RXSIG_ONHOOK) ? "ONHOOK" : "OFFHOOK"); - if(SPAN_REGISTERED(xpd)) - zt_hooksig(&xpd->chans[pos], rxsig); -} - -#ifdef CONFIG_PROC_FS -static int proc_xpd_ztregister_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - - BUG_ON(!xpd); - spin_lock_irqsave(&xpd->lock, flags); - - len += sprintf(page + len, "%d\n", SPAN_REGISTERED(xpd) ? xpd->span.spanno : 0); - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -static int proc_xpd_ztregister_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - xpd_t *xpd = data; - char buf[MAX_PROC_WRITE]; - int zt_reg; - int ret; - - BUG_ON(!xpd); - if(count >= MAX_PROC_WRITE) - return -EINVAL; - if(copy_from_user(buf, buffer, count)) - return -EFAULT; - buf[count] = '\0'; - ret = sscanf(buf, "%d", &zt_reg); - if(ret != 1) - return -EINVAL; - XPD_DBG(GENERAL, xpd, "%s\n", (zt_reg) ? "register" : "unregister"); - if(zt_reg) - ret = zaptel_register_xpd(xpd); - else - ret = zaptel_unregister_xpd(xpd); - return (ret < 0) ? ret : count; -} - -static int proc_xpd_blink_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int len = 0; - unsigned long flags; - xpd_t *xpd = data; - - BUG_ON(!xpd); - spin_lock_irqsave(&xpd->lock, flags); - - len += sprintf(page + len, "0x%lX\n", xpd->blink_mode); - spin_unlock_irqrestore(&xpd->lock, flags); - if (len <= off+count) - *eof = 1; - *start = page + off; - len -= off; - if (len > count) - len = count; - if (len < 0) - len = 0; - return len; -} - -static int proc_xpd_blink_write(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ - xpd_t *xpd = data; - char buf[MAX_PROC_WRITE]; - char *endp; - unsigned long blink; - - - BUG_ON(!xpd); - if(count >= MAX_PROC_WRITE) - return -EINVAL; - if(copy_from_user(buf, buffer, count)) - return -EFAULT; - buf[count] = '\0'; - if(count > 0 && buf[count-1] == '\n') /* chomp */ - buf[count-1] = '\0'; - blink = simple_strtoul(buf, &endp, 0); - if(*endp != '\0' || blink > 0xFFFF) - return -EINVAL; - XPD_DBG(GENERAL, xpd, "BLINK channels: 0x%lX\n", blink); - xpd->blink_mode = blink; - return count; -} - -#endif - - -#define XPP_MAX_LEN 512 - -/*------------------------- Zaptel Interfaces ----------------------*/ - - -/* - * Called from zaptel with spinlock held on chan. Must not call back - * zaptel functions. - */ -int xpp_open(struct zt_chan *chan) -{ -#if 0 - xpd_t *xpd = chan->pvt; - xbus_t *xbus = xpd->xbus; - int pos = chan->chanpos - 1; - unsigned long flags; -#else - xpd_t *xpd; - xbus_t *xbus; - int pos; - unsigned long flags; - - if (!chan) { - NOTICE("open called on a null chan\n"); - return -EINVAL; - } - xpd = chan->pvt; - if (!xpd) { - NOTICE("open called on a chan with no pvt (xpd)\n"); - return -EINVAL; - } - xbus = xpd->xbus; - if (!xbus) { - NOTICE("open called on a chan with no xbus\n"); - return -EINVAL; - } - pos = chan->chanpos - 1; -#endif - - spin_lock_irqsave(&xbus->lock, flags); - atomic_inc(&xbus->xbus_ref_count); - atomic_inc(&xpd->open_counter); - if(IS_SET(xpd->digital_signalling, pos)) /* D-chan offhook */ - BIT_SET(xpd->offhook, pos); - DBG(DEVICES, "chan=%d (xbus_ref_count=%d)\n", - pos, atomic_read(&xbus->xbus_ref_count)); - spin_unlock_irqrestore(&xbus->lock, flags); - if(xpd->xops->card_open) - xpd->xops->card_open(xpd, pos); - return 0; -} - -int xpp_close(struct zt_chan *chan) -{ - xpd_t *xpd = chan->pvt; - xbus_t *xbus = xpd->xbus; - int pos = chan->chanpos - 1; - unsigned long flags; - - spin_lock_irqsave(&xbus->lock, flags); - atomic_dec(&xpd->open_counter); - if(IS_SET(xpd->digital_signalling, pos)) /* D-chan onhook */ - BIT_CLR(xpd->offhook, pos); - spin_unlock_irqrestore(&xbus->lock, flags); - if(xpd->xops->card_close) - xpd->xops->card_close(xpd, pos); - XPD_DBG(GENERAL, xpd, "pid=%d: chan=%d (xbus_ref_count=%d)\n", - current->pid, pos, atomic_read(&xbus->xbus_ref_count)); - if(atomic_dec_and_test(&xbus->xbus_ref_count)) - xbus_remove(xbus); - return 0; -} - -void report_bad_ioctl(const char *msg, xpd_t *xpd, int pos, unsigned int cmd) -{ - char *extra_msg = ""; - - if(_IOC_TYPE(cmd) == 0xDA) - extra_msg = " (for DAHDI driver)"; - XPD_NOTICE(xpd, "%s: Bad ioctl%s\n", msg, extra_msg); - XPD_NOTICE(xpd, "ENOTTY: chan=%d cmd=0x%x\n", pos, cmd); - XPD_NOTICE(xpd, " IOC_TYPE=0x%02X\n", _IOC_TYPE(cmd)); - XPD_NOTICE(xpd, " IOC_DIR=0x%02X\n", _IOC_DIR(cmd)); - XPD_NOTICE(xpd, " IOC_NR=%d\n", _IOC_NR(cmd)); - XPD_NOTICE(xpd, " IOC_SIZE=0x%02X\n", _IOC_SIZE(cmd)); -} - -int xpp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long arg) -{ - xpd_t *xpd = chan->pvt; - int pos = chan->chanpos - 1; - - if(!xpd) { - ERR("%s: channel in pos %d, was already closed. Ignore.\n", - __FUNCTION__, pos); - return -ENODEV; - } - switch (cmd) { - default: - /* Some span-specific commands before we give up: */ - if (xpd->xops->card_ioctl != NULL) { - return xpd->xops->card_ioctl(xpd, pos, cmd, arg); - } - report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd); - return -ENOTTY; - } - return 0; -} - -static int xpp_hooksig(struct zt_chan *chan, zt_txsig_t txsig) -{ - xpd_t *xpd = chan->pvt; - xbus_t *xbus; - int pos = chan->chanpos - 1; - - if(!xpd) { - ERR("%s: channel in pos %d, was already closed. Ignore.\n", - __FUNCTION__, pos); - return -ENODEV; - } - xbus = xpd->xbus; - BUG_ON(!xbus); - DBG(SIGNAL, "Setting %s to %s (%d)\n", chan->name, txsig2str(txsig), txsig); - return CALL_XMETHOD(card_hooksig, xbus, xpd, pos, txsig); -} - -/* Req: Set the requested chunk size. This is the unit in which you must - report results for conferencing, etc */ -int xpp_setchunksize(struct zt_span *span, int chunksize); - -/* Enable maintenance modes */ -int xpp_maint(struct zt_span *span, int cmd) -{ - xpd_t *xpd = span->pvt; - int ret = 0; -#if 0 - char loopback_data[] = "THE-QUICK-BROWN-FOX-JUMPED-OVER-THE-LAZY-DOG"; -#endif - - DBG(GENERAL, "span->mainttimer=%d\n", span->mainttimer); - switch(cmd) { - case ZT_MAINT_NONE: - printk("XXX Turn off local and remote loops XXX\n"); - break; - case ZT_MAINT_LOCALLOOP: - printk("XXX Turn on local loopback XXX\n"); - break; - case ZT_MAINT_REMOTELOOP: - printk("XXX Turn on remote loopback XXX\n"); - break; - case ZT_MAINT_LOOPUP: - printk("XXX Send loopup code XXX\n"); - // CALL_XMETHOD(LOOPBACK_AX, xpd->xbus, xpd, loopback_data, ARRAY_SIZE(loopback_data)); - break; - case ZT_MAINT_LOOPDOWN: - printk("XXX Send loopdown code XXX\n"); - break; - case ZT_MAINT_LOOPSTOP: - printk("XXX Stop sending loop codes XXX\n"); - break; - default: - ERR("XPP: Unknown maint command: %d\n", cmd); - ret = -EINVAL; - break; - } - if (span->mainttimer || span->maintstat) - update_xpd_status(xpd, ZT_ALARM_LOOPBACK); - return ret; -} - -#ifdef CONFIG_ZAPTEL_WATCHDOG -/* - * If the watchdog detects no received data, it will call the - * watchdog routine - */ -static int xpp_watchdog(struct zt_span *span, int cause) -{ - static int rate_limit = 0; - - if((rate_limit++ % 1000) == 0) - DBG(GENERAL, "\n"); - return 0; -} -#endif - -/** - * Unregister an xpd from zaptel 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() - */ -static int zaptel_unregister_xpd(xpd_t *xpd) -{ - unsigned long flags; - - BUG_ON(!xpd); - spin_lock_irqsave(&xpd->lock, flags); - - if(!SPAN_REGISTERED(xpd)) { - XPD_NOTICE(xpd, "Already unregistered\n"); - spin_unlock_irqrestore(&xpd->lock, flags); - return -EIDRM; - } - update_xpd_status(xpd, ZT_ALARM_NOTOPEN); - if(atomic_read(&xpd->open_counter)) { - XPD_NOTICE(xpd, "Busy (open_counter=%d). Skipping.\n", atomic_read(&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) - xpd->xops->card_zaptel_preregistration(xpd, 0); - atomic_dec(&xpd->zt_registered); - atomic_dec(&num_registered_spans); - zt_unregister(&xpd->span); - if(xpd->card_present) - xpd->xops->card_zaptel_postregistration(xpd, 0); - return 0; -} - -static int zaptel_register_xpd(xpd_t *xpd) -{ - struct zt_span *span; - xbus_t *xbus; - int cn; - const xops_t *xops; - - BUG_ON(!xpd); - xops = xpd->xops; - xbus = xpd->xbus; - - if (SPAN_REGISTERED(xpd)) { - XPD_ERR(xpd, "Already registered\n"); - return -EEXIST; - } - cn = xpd->channels; - XPD_DBG(DEVICES, xpd, "Initializing span: %d channels.\n", cn); - memset(xpd->chans, 0, sizeof(struct zt_chan)*cn); - memset(&xpd->span, 0, sizeof(struct zt_span)); - - span = &xpd->span; - snprintf(span->name, MAX_SPANNAME, "%s/%s", xbus->busname, xpd->xpdname); - span->deflaw = ZT_LAW_MULAW; /* default, may be overriden by card_* drivers */ - init_waitqueue_head(&span->maintq); - span->pvt = xpd; - span->channels = cn; - span->chans = xpd->chans; - - span->open = xpp_open; - span->close = xpp_close; - span->flags = ZT_FLAG_RBS; - span->hooksig = xpp_hooksig; /* Only with RBS bits */ - span->ioctl = xpp_ioctl; - span->maint = xpp_maint; -#ifdef ZT_SPANSTAT_V2 - /* - * This actually describe the zt_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_zaptel_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->location); - /* - * 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; -#endif -#ifdef ZAPTEL_SYNC_TICK - span->sync_tick = zaptel_sync_tick; -#endif - if (xpp_ec) - span->echocan = xpp_echocan; -#ifdef CONFIG_ZAPTEL_WATCHDOG - span->watchdog = xpp_watchdog; -#endif - - snprintf(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", xpd->span.desc); - xpd->xops->card_zaptel_preregistration(xpd, 1); - if(zt_register(&xpd->span, prefmaster)) { - XPD_ERR(xpd, "Failed to zt_register span\n"); - return -ENODEV; - } - atomic_inc(&num_registered_spans); - atomic_inc(&xpd->zt_registered); - xpd->xops->card_zaptel_postregistration(xpd, 1); - /* - * Update zaptel about our state - */ -#if 0 - /* - * FIXME: since asterisk didn't open the channel yet, the report - * is discarded anyway. OTOH, we cannot report in xpp_open or - * xpp_chanconfig since zaptel call them with a spinlock on the channel - * and zt_hooksig tries to acquire the same spinlock, resulting in - * double spinlock deadlock (we are lucky that RH/Fedora kernel are - * compiled with spinlock debugging).... tough. - */ - for_each_line(xpd, cn) { - struct zt_chan *chans = xpd->span.chans; - - if(IS_SET(xpd->offhook, cn)) { - LINE_NOTICE(xpd, cn, "Report OFFHOOK to zaptel\n"); - zt_hooksig(&chans[cn], ZT_RXSIG_OFFHOOK); - } - } -#endif - return 0; -} - -/*------------------------- Proc debugging interface ---------------*/ - -#ifdef CONFIG_PROC_FS - -#if 0 -static int xpp_zap_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) -{ -} -#endif - -#endif - -/*------------------------- Initialization -------------------------*/ - -static void do_cleanup(void) -{ -#ifdef CONFIG_PROC_FS - if(xpp_proc_toplevel) { - DBG(GENERAL, "Removing '%s' from proc\n", PROC_DIR); - remove_proc_entry(PROC_DIR, NULL); - xpp_proc_toplevel = NULL; - } -#endif -} - -static int __init xpp_zap_init(void) -{ - int ret = 0; - - INFO("revision %s MAX_XPDS=%d (%d*%d)\n", XPP_VERSION, - MAX_XPDS, MAX_UNIT, MAX_SUBUNIT); -#ifdef CONFIG_ZAPATA_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) { - ret = -EIO; - goto err; - } -#endif - ret = xbus_core_init(); - if(ret) { - ERR("xbus_core_init failed (%d)\n", ret); - goto err; - } - ret = xbus_pcm_init(xpp_proc_toplevel); - if(ret) { - ERR("xbus_pcm_init failed (%d)\n", ret); - xbus_core_shutdown(); - goto err; - } - return 0; -err: - do_cleanup(); - return ret; -} - -static void __exit xpp_zap_cleanup(void) -{ - xbus_pcm_shutdown(); - xbus_core_shutdown(); - do_cleanup(); -} - -EXPORT_SYMBOL(debug); -EXPORT_SYMBOL(xpd_common_init); -EXPORT_SYMBOL(create_xpd); -EXPORT_SYMBOL(xpd_post_init); -EXPORT_SYMBOL(xpd_alloc); -EXPORT_SYMBOL(xpd_free); -EXPORT_SYMBOL(xpd_disconnect); -EXPORT_SYMBOL(update_xpd_status); -EXPORT_SYMBOL(update_line_status); -EXPORT_SYMBOL(xpp_open); -EXPORT_SYMBOL(xpp_close); -EXPORT_SYMBOL(xpp_ioctl); -EXPORT_SYMBOL(xpp_maint); -EXPORT_SYMBOL(report_bad_ioctl); - -MODULE_DESCRIPTION("XPP Zaptel Driver"); -MODULE_AUTHOR("Oron Peled "); -MODULE_LICENSE("GPL"); -MODULE_VERSION(XPP_VERSION); - -module_init(xpp_zap_init); -module_exit(xpp_zap_cleanup); diff --git a/zaptel/kernel/xpp/xpp_zap.h b/zaptel/kernel/xpp/xpp_zap.h deleted file mode 100644 index dd56657d..00000000 --- a/zaptel/kernel/xpp/xpp_zap.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef XPP_ZAP_H -#define XPP_ZAP_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpd.h" -#include "xproto.h" - -void xpd_disconnect(xpd_t *xpd); -int xpd_common_init(xbus_t *xbus, xpd_t *xpd, int unit, int subunit, int subtype, int subunits); -int create_xpd(xbus_t *xbus, const xproto_table_t *proto_table, - int unit, int subunit, byte type, byte subtype, int subunits, byte port_dir); -void xpd_post_init(xpd_t *xpd); -xpd_t *xpd_alloc(size_t privsize, const xproto_table_t *proto_table, int channels); -void xpd_free(xpd_t *xpd); -void xpd_remove(xpd_t *xpd); -void update_xpd_status(xpd_t *xpd, int alarm_flag); -void update_line_status(xpd_t *xpd, int pos, bool good); -int xpp_open(struct zt_chan *chan); -int xpp_close(struct zt_chan *chan); -int xpp_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long arg); -int xpp_maint(struct zt_span *span, int cmd); -void report_bad_ioctl(const char *msg, xpd_t *xpd, int pos, unsigned int cmd); -int total_registered_spans(void); - -#ifdef CONFIG_PROC_FS -#include - -extern struct proc_dir_entry *xpp_proc_toplevel; -#endif - -#define SPAN_REGISTERED(xpd) atomic_read(&(xpd)->zt_registered) - -#endif /* XPP_ZAP_H */ diff --git a/zaptel/kernel/xpp/xproto.c b/zaptel/kernel/xpp/xproto.c deleted file mode 100644 index 169a77f9..00000000 --- a/zaptel/kernel/xpp/xproto.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xpd.h" -#include "xproto.h" -#include "xpp_zap.h" -#include "xbus-core.h" -#include "zap_debug.h" -#include -#include - -static const char rcsid[] = "$Id: xproto.c 4266 2008-05-13 21:08:09Z tzafrir $"; - -extern int debug; - -static const xproto_table_t *xprotocol_tables[XPD_TYPE_NOMODULE]; - -#if MAX_UNIT*MAX_SUBUNIT > MAX_XPDS -#error MAX_XPDS is too small -#endif - -bool valid_xpd_addr(const struct xpd_addr *addr) -{ - return ((addr->subunit & ~BITMASK(SUBUNIT_BITS)) == 0) && ((addr->unit & ~BITMASK(UNIT_BITS)) == 0); -} - -/*---------------- General Protocol Management ----------------------------*/ - -const xproto_entry_t *xproto_card_entry(const xproto_table_t *table, byte opcode) -{ - const xproto_entry_t *xe; - - //DBG(GENERAL, "\n"); - xe = &table->entries[opcode]; - return (xe->handler != NULL) ? xe : NULL; -} - -const xproto_entry_t *xproto_global_entry(byte opcode) -{ - const xproto_entry_t *xe; - - xe = xproto_card_entry(&PROTO_TABLE(GLOBAL), opcode); - //DBG(GENERAL, "opcode=0x%X xe=%p\n", opcode, xe); - return xe; -} - -xproto_handler_t xproto_global_handler(byte opcode) -{ - return xproto_card_handler(&PROTO_TABLE(GLOBAL), opcode); -} - -static const xproto_table_t *xproto_table(xpd_type_t cardtype) -{ - if(cardtype >= XPD_TYPE_NOMODULE) - return NULL; - return xprotocol_tables[cardtype]; -} - -const xproto_table_t *xproto_get(xpd_type_t cardtype) -{ - const xproto_table_t *xtable; - - if(cardtype >= XPD_TYPE_NOMODULE) - return NULL; - xtable = xprotocol_tables[cardtype]; - if(!xtable) { /* Try to load the relevant module */ - int ret = request_module(XPD_TYPE_PREFIX "%d", cardtype); - if(ret != 0) { - NOTICE("%s: Failed to load module for type=%d. exit status=%d.\n", - __FUNCTION__, cardtype, ret); - /* Drop through: we may be lucky... */ - } - xtable = xprotocol_tables[cardtype]; - } - if(xtable) { - BUG_ON(!xtable->owner); - DBG(GENERAL, "%s refcount was %d\n", xtable->name, module_refcount(xtable->owner)); - if(!try_module_get(xtable->owner)) { - ERR("%s: try_module_get for %s failed.\n", __FUNCTION__, xtable->name); - return NULL; - } - } - return xtable; -} - -void xproto_put(const xproto_table_t *xtable) -{ - BUG_ON(!xtable); - DBG(GENERAL, "%s refcount was %d\n", xtable->name, module_refcount(xtable->owner)); - BUG_ON(module_refcount(xtable->owner) <= 0); - module_put(xtable->owner); -} - -xproto_handler_t xproto_card_handler(const xproto_table_t *table, byte opcode) -{ - const xproto_entry_t *xe; - - //DBG(GENERAL, "\n"); - xe = xproto_card_entry(table, opcode); - return xe->handler; -} - -void notify_bad_xpd(const char *funcname, xbus_t *xbus, const struct xpd_addr addr, const char *msg) -{ - XBUS_NOTICE(xbus, "%s: non-existing address (%1d%1d): %s\n", - funcname, addr.unit, addr.subunit, msg); -} - -static int packet_process(xbus_t *xbus, xpacket_t *pack) -{ - byte op; - const xproto_entry_t *xe; - xproto_handler_t handler; - xproto_table_t *table; - xpd_t *xpd; - int ret = -EPROTO; - - BUG_ON(!pack); - if(!valid_xpd_addr(&XPACKET_ADDR(pack))) { - if(printk_ratelimit()) { - XBUS_NOTICE(xbus, "%s: from %d%d: bad address.\n", - __FUNCTION__, - XPACKET_ADDR_UNIT(pack), XPACKET_ADDR_SUBUNIT(pack)); - dump_packet("packet_process -- bad address", pack, debug); - } - goto out; - } - op = XPACKET_OP(pack); - xpd = xpd_byaddr(xbus, XPACKET_ADDR_UNIT(pack), XPACKET_ADDR_SUBUNIT(pack)); - /* XPD may be NULL (e.g: during bus polling */ - xe = xproto_global_entry(op); - /*-------- Validations -----------*/ - if(!xe) { - const xproto_table_t *xtable; - - if(!xpd) { - if(printk_ratelimit()) { - XBUS_NOTICE(xbus, "%s: from %d%d opcode=0x%02X: no such global command.\n", - __FUNCTION__, - XPACKET_ADDR_UNIT(pack), XPACKET_ADDR_SUBUNIT(pack), op); - dump_packet("packet_process -- no such global command", pack, 1); - } - goto out; - } - xtable = xproto_table(xpd->type); - if(!xtable) { - if(printk_ratelimit()) - XPD_ERR(xpd, "%s: no protocol table (type=%d)\n", - __FUNCTION__, - xpd->type); - goto out; - } - xe = xproto_card_entry(xtable, op); - if(!xe) { - if(printk_ratelimit()) { - XPD_NOTICE(xpd, "%s: bad command (type=%d,opcode=0x%x)\n", - __FUNCTION__, - xpd->type, op); - dump_packet("packet_process -- bad command", pack, 1); - } - goto out; - } - } - table = xe->table; - BUG_ON(!table); - if(!table->packet_is_valid(pack)) { - if(printk_ratelimit()) { - ERR("xpp: %s: wrong size %d for opcode=0x%02X\n", - __FUNCTION__, XPACKET_LEN(pack), op); - dump_packet("packet_process -- wrong size", pack, debug); - } - goto out; - } - ret = 0; /* All well */ - handler = xe->handler; - BUG_ON(!handler); - XBUS_COUNTER(xbus, RX_BYTES) += XPACKET_LEN(pack); - handler(xbus, xpd, xe, pack); -out: - return ret; -} - -static int xframe_receive_cmd(xbus_t *xbus, xframe_t *xframe) -{ - byte *xframe_end; - xpacket_t *pack; - byte *p; - int len; - int ret; - - if(debug & DBG_COMMANDS) - dump_xframe("RX-CMD", xbus, xframe, DBG_ANY); - p = xframe->packets; - xframe_end = p + XFRAME_LEN(xframe); - do { - pack = (xpacket_t *)p; - len = XPACKET_LEN(pack); - /* Sanity checks */ - if(unlikely(XPACKET_OP(pack) == XPROTO_NAME(GLOBAL,PCM_READ))) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) { - XBUS_DBG(GENERAL, xbus, "A PCM packet within a Non-PCM xframe\n"); - dump_xframe("In Non-PCM xframe", xbus, xframe, debug); - } - ret = -EPROTO; - goto out; - } - p += len; - if(p > xframe_end || len < RPACKET_HEADERSIZE) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) { - XBUS_NOTICE(xbus, "Invalid packet length %d\n", len); - dump_xframe("BAD LENGTH", xbus, xframe, debug); - } - ret = -EPROTO; - goto out; - } - ret = packet_process(xbus, pack); - if(unlikely(ret < 0)) - break; - } while(p < xframe_end); -out: - FREE_RECV_XFRAME(xbus, xframe); - return ret; -} - -int xframe_receive(xbus_t *xbus, xframe_t *xframe) -{ - int ret = 0; - struct timeval now; - struct timeval tv_received; - int usec; - - if(XFRAME_LEN(xframe) < RPACKET_HEADERSIZE) { - static int rate_limit; - - if((rate_limit++ % 1003) == 0) { - XBUS_NOTICE(xbus, "short xframe\n"); - dump_xframe("short xframe", xbus, xframe, debug); - } - FREE_RECV_XFRAME(xbus, xframe); - return -EPROTO; - } - if(!XBUS_GET(xbus)) { - XBUS_DBG(GENERAL, xbus, "Dropped xframe. Is shutting down.\n"); - return -ENODEV; - } - tv_received = xframe->tv_received; - /* - * We want to check that xframes do not mix PCM and other commands - */ - if(XPACKET_IS_PCM((xpacket_t *)xframe->packets)) - xframe_receive_pcm(xbus, xframe); - else { - XBUS_COUNTER(xbus, RX_CMD)++; - ret = xframe_receive_cmd(xbus, xframe); - } - /* Calculate total processing time */ - do_gettimeofday(&now); - usec = (now.tv_sec - tv_received.tv_sec) * 1000000 + - now.tv_usec - tv_received.tv_usec; - if(usec > xbus->max_rx_process) - xbus->max_rx_process = usec; - XBUS_PUT(xbus); - return ret; -} - -#define VERBOSE_DEBUG 1 -#define ERR_REPORT_LIMIT 20 - -void dump_packet(const char *msg, const xpacket_t *packet, bool debug) -{ - byte op = XPACKET_OP(packet); - byte *addr = (byte *)&XPACKET_ADDR(packet); - - if(!debug) - return; - printk(KERN_DEBUG "%s: XPD=%1X-%1X%c (0x%X) OP=0x%02X LEN=%d", - msg, - XPACKET_ADDR_UNIT(packet), - XPACKET_ADDR_SUBUNIT(packet), - (XPACKET_ADDR_SYNC(packet))?'+':' ', - *addr, - op, - XPACKET_LEN(packet)); -#if VERBOSE_DEBUG - { - int i; - byte *p = (byte *)packet; - - printk(" BYTES: "); - for(i = 0; i < XPACKET_LEN(packet); i++) { - static int limiter = 0; - - if(i >= sizeof(xpacket_t)) { - if(limiter < ERR_REPORT_LIMIT) { - ERR("%s: length overflow i=%d > sizeof(xpacket_t)=%lu\n", - __FUNCTION__, i+1, (long)sizeof(xpacket_t)); - } else if(limiter == ERR_REPORT_LIMIT) { - ERR("%s: error packet #%d... squelsh reports.\n", - __FUNCTION__, limiter); - } - limiter++; - break; - } - if (debug) - printk("%02X ", p[i]); - } - } -#endif - printk("\n"); -} - -void dump_reg_cmd(const char msg[], bool writing, xbus_t *xbus, - byte unit, xportno_t port, const reg_cmd_t *regcmd) -{ - char action; - char modifier; - char port_buf[MAX_PROC_WRITE]; - char reg_buf[MAX_PROC_WRITE]; - char data_buf[MAX_PROC_WRITE]; - - if(regcmd->bytes > sizeof(*regcmd) - 1) { /* The size byte is not included */ - PORT_NOTICE(xbus, unit, port, "%s: %s: Too long: regcmd->bytes = %d\n", - __FUNCTION__, msg, regcmd->bytes); - return; - } - if(regcmd->is_multibyte) { - char buf[MAX_PROC_WRITE + 1]; - int i; - int n = 0; - size_t len = regcmd->bytes; - const byte *p = REG_XDATA(regcmd); - - buf[0] = '\0'; - for(i = 0; i < len && n < MAX_PROC_WRITE; i++) - n += snprintf(&buf[n], MAX_PROC_WRITE - n, "%02X ", p[i]); - PORT_DBG(REGS, xbus, unit, port, - "UNIT-%d PORT-%d: Multibyte(eoframe=%d) %s[0..%zd]: %s%s\n", - unit, port, regcmd->eoframe, - msg, len-1, buf, (n >= MAX_PROC_WRITE)?"...":""); - return; - } - if(regcmd->bytes != sizeof(*regcmd) - 1) { /* The size byte is not included */ - PORT_NOTICE(xbus, unit, port, "%s: %s: Wrong size: regcmd->bytes = %d\n", - __FUNCTION__, msg, regcmd->bytes); - return; - } - snprintf(port_buf, MAX_PROC_WRITE, "%d%s", - regcmd->portnum, - (REG_FIELD(regcmd, all_ports_broadcast)) ? "*" : ""); - action = (REG_FIELD(regcmd, read_request)) ? 'R' : 'W'; - modifier = 'D'; - if(REG_FIELD(regcmd, do_subreg)) { - snprintf(reg_buf, MAX_PROC_WRITE, "%02X %02X", - REG_FIELD(regcmd, regnum), - REG_FIELD(regcmd, subreg)); - modifier = 'S'; - } else { - snprintf(reg_buf, MAX_PROC_WRITE, "%02X", - REG_FIELD(regcmd, regnum)); - } - if(REG_FIELD(regcmd, read_request)) { - data_buf[0] = '\0'; - } else if(REG_FIELD(regcmd, do_datah)) { - snprintf(data_buf, MAX_PROC_WRITE, "%02X %02X", - REG_FIELD(regcmd, data_low), - REG_FIELD(regcmd, data_high)); - modifier = 'I'; - } else { - snprintf(data_buf, MAX_PROC_WRITE, "%02X", - REG_FIELD(regcmd, data_low)); - } - PORT_DBG(REGS, xbus, unit, port, "%s: %s %c%c %s %s\n", - msg, port_buf, action, modifier, - reg_buf, data_buf); -} - -const char *xproto_name(xpd_type_t xpd_type) -{ - const xproto_table_t *proto_table; - - BUG_ON(xpd_type >= XPD_TYPE_NOMODULE); - proto_table = xprotocol_tables[xpd_type]; - if(!proto_table) - return NULL; - return proto_table->name; -} - -#define CHECK_XOP(f) \ - if(!(xops)->f) { \ - ERR("%s: missing xmethod %s [%s (%d)]\n", __FUNCTION__, #f, name, type); \ - return -EINVAL; \ - } - -int xproto_register(const xproto_table_t *proto_table) -{ - int type; - const char *name; - const xops_t *xops; - - BUG_ON(!proto_table); - type = proto_table->type; - name = proto_table->name; - if(type >= XPD_TYPE_NOMODULE) { - NOTICE("%s: Bad xproto type %d\n", __FUNCTION__, type); - return -EINVAL; - } - DBG(GENERAL, "%s (%d)\n", name, type); - if(xprotocol_tables[type]) - NOTICE("%s: overriding registration of %s (%d)\n", __FUNCTION__, name, type); - xops = &proto_table->xops; - CHECK_XOP(card_new); - CHECK_XOP(card_init); - CHECK_XOP(card_remove); - CHECK_XOP(card_tick); - CHECK_XOP(card_pcm_fromspan); - CHECK_XOP(card_pcm_tospan); - CHECK_XOP(card_zaptel_preregistration); - CHECK_XOP(card_zaptel_postregistration); - CHECK_XOP(card_hooksig); - // CHECK_XOP(card_ioctl); // optional method -- call after testing - CHECK_XOP(card_register_reply); - CHECK_XOP(XPD_STATE); - - xprotocol_tables[type] = proto_table; - return 0; -} - -void xproto_unregister(const xproto_table_t *proto_table) -{ - int type; - const char *name; - - BUG_ON(!proto_table); - type = proto_table->type; - name = proto_table->name; - DBG(GENERAL, "%s (%d)\n", name, type); - if(type >= XPD_TYPE_NOMODULE) { - NOTICE("%s: Bad xproto type %s (%d)\n", __FUNCTION__, name, type); - return; - } - if(!xprotocol_tables[type]) - NOTICE("%s: xproto type %s (%d) is already unregistered\n", __FUNCTION__, name, type); - xprotocol_tables[type] = NULL; -} - -EXPORT_SYMBOL(dump_packet); -EXPORT_SYMBOL(dump_reg_cmd); -EXPORT_SYMBOL(xframe_receive); -EXPORT_SYMBOL(notify_bad_xpd); -EXPORT_SYMBOL(valid_xpd_addr); -EXPORT_SYMBOL(xproto_global_entry); -EXPORT_SYMBOL(xproto_card_entry); -EXPORT_SYMBOL(xproto_name); -EXPORT_SYMBOL(xproto_register); -EXPORT_SYMBOL(xproto_unregister); diff --git a/zaptel/kernel/xpp/xproto.h b/zaptel/kernel/xpp/xproto.h deleted file mode 100644 index 4691094e..00000000 --- a/zaptel/kernel/xpp/xproto.h +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef XPROTO_H -#define XPROTO_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include "xdefs.h" - -#ifdef __KERNEL__ -#include -#include -#include - -/* - * This must match the firmware protocol version - */ -#define XPP_PROTOCOL_VERSION 30 - -struct xpd_addr { - uint8_t subunit:SUBUNIT_BITS; - uint8_t reserved:1; - uint8_t unit:UNIT_BITS; - uint8_t sync_master:1; -} PACKED; - -#define MKADDR(p, u, s) do { \ - (p)->unit = (u); \ - (p)->subunit = (s); \ - (p)->sync_master = 0; \ - } while(0) - -struct xpacket_header { - uint16_t packet_len:10; - uint16_t reserved:1; - uint16_t is_pcm:1; - uint16_t pcmslot:4; - uint8_t opcode; - struct xpd_addr addr; -} PACKED; - -#define XPACKET_OP(p) ((p)->head.opcode) -#define XPACKET_LEN(p) ((p)->head.packet_len) -#define XPACKET_IS_PCM(p) ((p)->head.is_pcm) -#define XPACKET_PCMSLOT(p) ((p)->head.pcmslot) -#define XPACKET_RESERVED(p) ((p)->head.reserved) -#define XPACKET_ADDR(p) ((p)->head.addr) -#define XPACKET_ADDR_UNIT(p) (XPACKET_ADDR(p).unit) -#define XPACKET_ADDR_SUBUNIT(p) (XPACKET_ADDR(p).subunit) -#define XPACKET_ADDR_SYNC(p) (XPACKET_ADDR(p).sync_master) -#define XPACKET_ADDR_RESERVED(p) (XPACKET_ADDR(p).reserved) - -#define PROTO_TABLE(n) n ## _protocol_table - -/* - * The LSB of the type number signifies: - * 0 - TO_PSTN - * 1 - TO_PHONE - */ -#define XPD_TYPE_FXS 1 // TO_PHONE -#define XPD_TYPE_FXO 2 // TO_PSTN -#define XPD_TYPE_BRI 3 // TO_PSTN/TO_PHONE (from hardware) -#define XPD_TYPE_PRI 4 // TO_PSTN/TO_PHONE (runtime) -#define XPD_TYPE_NOMODULE 7 - -typedef byte xpd_type_t; - -#define XPD_TYPE_PREFIX "xpd-type-" - -#define MODULE_ALIAS_XPD(type) \ - MODULE_ALIAS(XPD_TYPE_PREFIX __stringify(type)) - -#define PCM_CHUNKSIZE (CHANNELS_PERXPD * 8) /* samples of 8 bytes */ - -bool valid_xpd_addr(const struct xpd_addr *addr); - -#define XPROTO_NAME(card,op) card ## _ ## op -#define XPROTO_HANDLER(card,op) XPROTO_NAME(card,op ## _handler) -#define XPROTO_CALLER(card,op) XPROTO_NAME(card,op ## _send) - -#define HANDLER_DEF(card,op) \ - static int XPROTO_HANDLER(card,op) ( \ - xbus_t *xbus, \ - xpd_t *xpd, \ - const xproto_entry_t *cmd, \ - xpacket_t *pack) - -#define CALL_PROTO(card,op, ...) XPROTO_CALLER(card,op)( __VA_ARGS__ ) - -#define DECLARE_CMD(card,op, ...) \ - int CALL_PROTO(card, op, xbus_t *xbus, xpd_t *xpd, ## __VA_ARGS__ ) - -#define HOSTCMD(card, op, ...) \ - DECLARE_CMD(card, op, ## __VA_ARGS__ ) - -#define RPACKET_NAME(card,op) XPROTO_NAME(RPACKET_ ## card, op) -#define RPACKET_TYPE(card,op) struct RPACKET_NAME(card, op) - -#define DEF_RPACKET_DATA(card,op, ...) \ - RPACKET_TYPE(card,op) { \ - struct xpacket_header head; \ - __VA_ARGS__ \ - } PACKED -#define RPACKET_HEADERSIZE sizeof(struct xpacket_header) -#define RPACKET_FIELD(p,card,op,field) (((RPACKET_TYPE(card,op) *)(p))->field) -#define RPACKET_SIZE(card,op) sizeof(RPACKET_TYPE(card,op)) - -#define XENTRY(prototab,module,op) \ - [ XPROTO_NAME(module,op) ] = { \ - .handler = XPROTO_HANDLER(module,op), \ - .datalen = RPACKET_SIZE(module,op), \ - .name = #op, \ - .table = &PROTO_TABLE(prototab) \ - } - -#define XPACKET_INIT(p, card, op, to, pcm, pcmslot) \ - do { \ - XPACKET_OP(p) = XPROTO_NAME(card,op); \ - XPACKET_LEN(p) = RPACKET_SIZE(card,op); \ - XPACKET_IS_PCM(p) = (pcm); \ - XPACKET_PCMSLOT(p) = (pcmslot); \ - XPACKET_RESERVED(p) = 0; \ - XPACKET_ADDR_UNIT(p) = XBUS_UNIT(to); \ - XPACKET_ADDR_SUBUNIT(p) = XBUS_SUBUNIT(to); \ - XPACKET_ADDR_SYNC(p) = 0; \ - XPACKET_ADDR_RESERVED(p) = 0; \ - } while(0) - -#define XFRAME_NEW_CMD(frm, p, xbus, card, op, to) \ - do { \ - int pack_len = RPACKET_SIZE(card,op); \ - \ - if(!TRANSPORT_RUNNING(xbus)) \ - return -ENODEV; \ - frm = ALLOC_SEND_XFRAME(xbus); \ - if(!frm) \ - return -ENOMEM; \ - (p) = xframe_next_packet(frm, pack_len); \ - if(!(p)) \ - return -ENOMEM; \ - XPACKET_INIT(p, card, op, to, 0, 0); \ - } while(0) - -#endif - -/*--------------------------- register handling --------------------------------*/ - -#define MULTIBYTE_MAX_LEN 5 /* FPGA firmware limitation */ - -typedef struct reg_cmd { - byte bytes:3; /* Length (for Multibyte) */ - byte eoframe:1; /* For BRI -- end of frame */ - byte portnum:3; /* For port specific registers */ - byte is_multibyte:1; - union { - struct { - byte reserved:4; - byte do_datah:1; - byte do_subreg:1; - byte read_request:1; - byte all_ports_broadcast:1; - byte regnum; - byte subreg; - byte data_low; - byte data_high; - } PACKED r; - /* For Write-Multibyte commands in BRI */ - struct { - byte xdata[MULTIBYTE_MAX_LEN]; - } PACKED d; - } PACKED alt; -} PACKED reg_cmd_t; - -/* Shortcut access macros */ -#define REG_FIELD(regptr,member) ((regptr)->alt.r.member) -#define REG_XDATA(regptr) ((regptr)->alt.d.xdata) - -#ifdef __KERNEL__ -/*--------------------------- protocol tables ----------------------------------*/ - -typedef struct xproto_entry xproto_entry_t; -typedef struct xproto_table xproto_table_t; - -typedef int (*xproto_handler_t)( - xbus_t *xbus, - xpd_t *xpd, - const xproto_entry_t *cmd, - xpacket_t *pack); - -const xproto_table_t *xproto_get(xpd_type_t cardtype); -void xproto_put(const xproto_table_t *xtable); -const xproto_entry_t *xproto_card_entry(const xproto_table_t *table, byte opcode); -xproto_handler_t xproto_card_handler(const xproto_table_t *table, byte opcode); - -const xproto_entry_t *xproto_global_entry(byte opcode); -xproto_handler_t xproto_global_handler(byte opcode); - -#define CALL_XMETHOD(name, xbus, xpd, ...) \ - (xpd)->xops->name(xbus, xpd, ## __VA_ARGS__ ) - -struct xops { - xpd_t *(*card_new)(xbus_t *xbus, int unit, int subunit, - const xproto_table_t *proto_table, byte subtype, int subunits, bool to_phone); - int (*card_init)(xbus_t *xbus, xpd_t *xpd); - int (*card_remove)(xbus_t *xbus, xpd_t *xpd); - int (*card_tick)(xbus_t *xbus, xpd_t *xpd); - void (*card_pcm_fromspan)(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, xpacket_t *pack); - void (*card_pcm_tospan)(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack); - int (*card_zaptel_preregistration)(xpd_t *xpd, bool on); - int (*card_zaptel_postregistration)(xpd_t *xpd, bool on); - int (*card_hooksig)(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig); - int (*card_ioctl)(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg); - int (*card_open)(xpd_t *xpd, lineno_t pos); - int (*card_close)(xpd_t *xpd, lineno_t pos); - int (*card_register_reply)(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *reg); - - int (*XPD_STATE)(xbus_t *xbus, xpd_t *xpd, bool on); -}; - -struct xproto_entry { - xproto_handler_t handler; - int datalen; - const char *name; - xproto_table_t *table; -}; - -struct xproto_table { - struct module *owner; - xproto_entry_t entries[256]; /* Indexed by opcode */ - xops_t xops; - xpd_type_t type; - byte ports_per_subunit; - const char *name; - bool (*packet_is_valid)(xpacket_t *pack); - void (*packet_dump)(const char *msg, xpacket_t *pack); -}; - -#include "card_global.h" -#include "card_fxs.h" -#include "card_fxo.h" -#include "card_bri.h" -#include "card_pri.h" - - -#define MEMBER(card,op) RPACKET_TYPE(card,op) RPACKET_NAME(card,op) - -struct xpacket { - struct xpacket_header head; - union { - MEMBER(GLOBAL, NULL_REPLY); - MEMBER(GLOBAL, PCM_WRITE); - MEMBER(GLOBAL, PCM_READ); - MEMBER(GLOBAL, SYNC_REPLY); - MEMBER(GLOBAL, ERROR_CODE); - - MEMBER(FXS, SIG_CHANGED); - MEMBER(FXO, SIG_CHANGED); - - byte data[0]; - }; - /* Last byte is chksum */ -} PACKED; - -void dump_packet(const char *msg, const xpacket_t *packet, bool debug); -void dump_reg_cmd(const char msg[], bool writing, xbus_t *xbus, byte unit, xportno_t port, const reg_cmd_t *regcmd); -int xframe_receive(xbus_t *xbus, xframe_t *xframe); -void notify_bad_xpd(const char *funcname, xbus_t *xbus, const struct xpd_addr addr, const char *msg); -int xproto_register(const xproto_table_t *proto_table); -void xproto_unregister(const xproto_table_t *proto_table); -const xproto_entry_t *xproto_global_entry(byte opcode); -const char *xproto_name(xpd_type_t xpd_type); - -#endif /* __KERNEL__ */ - -#endif /* XPROTO_H */ diff --git a/zaptel/kernel/xpp/zap_debug.c b/zaptel/kernel/xpp/zap_debug.c deleted file mode 100644 index 468db551..00000000 --- a/zaptel/kernel/xpp/zap_debug.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -# warning "This module is tested only with 2.6 kernels" -#endif - -#include -#include -#include -#include -#include "zap_debug.h" -#include "xdefs.h" - -static const char rcsid[] = "$Id: zap_debug.c 4266 2008-05-13 21:08:09Z tzafrir $"; - -#define P_(x) [ x ] = { .value = x, .name = #x, } -static struct { - int value; - char *name; -} poll_names[] = { - P_(POLLIN), - P_(POLLPRI), - P_(POLLOUT), - P_(POLLERR), - P_(POLLHUP), - P_(POLLNVAL), - P_(POLLRDNORM), - P_(POLLRDBAND), - P_(POLLWRNORM), - P_(POLLWRBAND), - P_(POLLMSG), - P_(POLLREMOVE) -}; -#undef P_ - -void dump_poll(int debug, const char *msg, int poll) -{ - int i; - - for(i = 0; i < ARRAY_SIZE(poll_names); i++) { - if(poll & poll_names[i].value) - DBG(GENERAL, "%s: %s\n", msg, poll_names[i].name); - } -} - -void alarm2str(int alarm, char *buf, int buflen) -{ - char *p = buf; - int left = buflen; - int i; - int n; - - if(!alarm) { - snprintf(buf, buflen, "NONE"); - return; - } - memset(buf, 0, buflen); - for(i = 0; i < 8; i++) { - if(left && (alarm & BIT(i))) { - n = snprintf(p, left, "%s,", alarmbit2str(i)); - p += n; - left -= n; - } - } - if(p > buf) /* kill last comma */ - *(p - 1) = '\0'; -} - -EXPORT_SYMBOL(dump_poll); -EXPORT_SYMBOL(alarm2str); diff --git a/zaptel/kernel/xpp/zap_debug.h b/zaptel/kernel/xpp/zap_debug.h deleted file mode 100644 index 79aefdfe..00000000 --- a/zaptel/kernel/xpp/zap_debug.h +++ /dev/null @@ -1,201 +0,0 @@ -#ifndef ZAP_DEBUG_H -#define ZAP_DEBUG_H -/* - * Written by Oron Peled - * Copyright (C) 2004-2006, Xorcom - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include /* for zt_* defs */ - -/* Debugging Macros */ - -#define PRINTK(level, category, fmt, ...) \ - printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, THIS_MODULE->name, ## __VA_ARGS__) - -#define XBUS_PRINTK(level, category, xbus, fmt, ...) \ - printk(KERN_ ## level "%s%s-%s: %s: " fmt, #level, \ - category, THIS_MODULE->name, (xbus)->busname, ## __VA_ARGS__) - -#define XPD_PRINTK(level, category, xpd, fmt, ...) \ - printk(KERN_ ## level "%s%s-%s: %s/%s: " fmt, #level, \ - category, THIS_MODULE->name, (xpd)->xbus->busname, (xpd)->xpdname, ## __VA_ARGS__) - -#define LINE_PRINTK(level, category, xpd, pos, fmt, ...) \ - printk(KERN_ ## level "%s%s-%s: %s/%s/%d: " fmt, #level, \ - category, THIS_MODULE->name, (xpd)->xbus->busname, (xpd)->xpdname, (pos), ## __VA_ARGS__) - -#define PORT_PRINTK(level, category, xbus, unit, port, fmt, ...) \ - printk(KERN_ ## level "%s%s-%s: %s UNIT=%d PORT=%d: " fmt, #level, \ - category, THIS_MODULE->name, (xbus)->busname, (unit), (port), ## __VA_ARGS__) - -#define DBG(bits, fmt, ...) \ - ((void)((debug & (DBG_ ## bits)) && PRINTK(DEBUG, "-" #bits, "%s: " fmt, __FUNCTION__, ## __VA_ARGS__))) -#define INFO(fmt, ...) PRINTK(INFO, "", fmt, ## __VA_ARGS__) -#define NOTICE(fmt, ...) PRINTK(NOTICE, "", fmt, ## __VA_ARGS__) -#define WARNING(fmt, ...) PRINTK(WARNING, "", fmt, ## __VA_ARGS__) -#define ERR(fmt, ...) PRINTK(ERR, "", fmt, ## __VA_ARGS__) - -#define XBUS_DBG(bits, xbus, fmt, ...) \ - ((void)((debug & (DBG_ ## bits)) && XBUS_PRINTK(DEBUG, "-" #bits, xbus, "%s: " fmt, __FUNCTION__, ## __VA_ARGS__))) -#define XBUS_INFO(xbus, fmt, ...) XBUS_PRINTK(INFO, "", xbus, fmt, ## __VA_ARGS__) -#define XBUS_NOTICE(xbus, fmt, ...) XBUS_PRINTK(NOTICE, "", xbus, fmt, ## __VA_ARGS__) -#define XBUS_ERR(xbus, fmt, ...) XBUS_PRINTK(ERR, "", xbus, fmt, ## __VA_ARGS__) - -#define XPD_DBG(bits, xpd, fmt, ...) \ - ((void)((debug & (DBG_ ## bits)) && XPD_PRINTK(DEBUG, "-" #bits, xpd, "%s: " fmt, __FUNCTION__, ## __VA_ARGS__))) -#define XPD_INFO(xpd, fmt, ...) XPD_PRINTK(INFO, "", xpd, fmt, ## __VA_ARGS__) -#define XPD_NOTICE(xpd, fmt, ...) XPD_PRINTK(NOTICE, "", xpd, fmt, ## __VA_ARGS__) -#define XPD_WARNING(xpd, fmt, ...) XPD_PRINTK(WARNING, "", xpd, fmt, ## __VA_ARGS__) -#define XPD_ERR(xpd, fmt, ...) XPD_PRINTK(ERR, "", xpd, fmt, ## __VA_ARGS__) - -#define LINE_DBG(bits, xpd, pos, fmt, ...) \ - ((void)((debug & (DBG_ ## bits)) && LINE_PRINTK(DEBUG, "-" #bits, xpd, pos, "%s: " fmt, __FUNCTION__, ## __VA_ARGS__))) -#define LINE_NOTICE(xpd, pos, fmt, ...) LINE_PRINTK(NOTICE, "", xpd, pos, fmt, ## __VA_ARGS__) -#define LINE_ERR(xpd, pos, fmt, ...) LINE_PRINTK(ERR, "", xpd, pos, fmt, ## __VA_ARGS__) - -#define PORT_DBG(bits, xbus, unit, port, fmt, ...) \ - ((void)((debug & (DBG_ ## bits)) && PORT_PRINTK(DEBUG, "-" #bits, \ - xbus, unit, port, "%s: " fmt, __FUNCTION__, ## __VA_ARGS__))) -#define PORT_NOTICE(xbus, unit, port, fmt, ...) PORT_PRINTK(NOTICE, "", xbus, unit, port, fmt, ## __VA_ARGS__) -#define PORT_ERR(xbus, unit, port, fmt, ...) PORT_PRINTK(ERR, "", xbus, unit, port, fmt, ## __VA_ARGS__) - -/* - * Bits for debug - */ -#define DBG_GENERAL BIT(0) -#define DBG_PCM BIT(1) -#define DBG_LEDS BIT(2) -#define DBG_SYNC BIT(3) -#define DBG_SIGNAL BIT(4) -#define DBG_PROC BIT(5) -#define DBG_REGS BIT(6) -#define DBG_DEVICES BIT(7) /* instantiation/destruction etc. */ -#define DBG_COMMANDS BIT(8) /* All commands */ -#define DBG_ANY (~0) - -void dump_poll(int debug, const char *msg, int poll); - -static inline char *rxsig2str(zt_rxsig_t sig) -{ - switch(sig) { - case ZT_RXSIG_ONHOOK: return "ONHOOK"; - case ZT_RXSIG_OFFHOOK: return "OFFHOOK"; - case ZT_RXSIG_START: return "START"; - case ZT_RXSIG_RING: return "RING"; - case ZT_RXSIG_INITIAL: return "INITIAL"; - } - return "Unknown rxsig"; -} - -static inline char *txsig2str(zt_txsig_t sig) -{ - switch(sig) { - case ZT_TXSIG_ONHOOK: return "TXSIG_ONHOOK"; - case ZT_TXSIG_OFFHOOK: return "TXSIG_OFFHOOK"; - case ZT_TXSIG_START: return "TXSIG_START"; - case ZT_TXSIG_KEWL: return "TXSIG_KEWL"; /* Drop battery if possible */ - } - return "Unknown txsig"; -} - -static inline char *event2str(int event) -{ - switch(event) { - case ZT_EVENT_NONE: return "NONE"; - case ZT_EVENT_ONHOOK: return "ONHOOK"; - case ZT_EVENT_RINGOFFHOOK: return "RINGOFFHOOK"; - case ZT_EVENT_WINKFLASH: return "WINKFLASH"; - case ZT_EVENT_ALARM: return "ALARM"; - case ZT_EVENT_NOALARM: return "NOALARM"; - case ZT_EVENT_ABORT: return "ABORT"; - case ZT_EVENT_OVERRUN: return "OVERRUN"; - case ZT_EVENT_BADFCS: return "BADFCS"; - case ZT_EVENT_DIALCOMPLETE: return "DIALCOMPLETE"; - case ZT_EVENT_RINGERON: return "RINGERON"; - case ZT_EVENT_RINGEROFF: return "RINGEROFF"; - case ZT_EVENT_HOOKCOMPLETE: return "HOOKCOMPLETE"; - case ZT_EVENT_BITSCHANGED: return "BITSCHANGED"; - case ZT_EVENT_PULSE_START: return "PULSE_START"; - case ZT_EVENT_TIMER_EXPIRED: return "TIMER_EXPIRED"; - case ZT_EVENT_TIMER_PING: return "TIMER_PING"; - case ZT_EVENT_POLARITY: return "POLARITY"; - } - return "Unknown event"; -} - -static inline char *hookstate2str(int hookstate) -{ - switch(hookstate) { - case ZT_ONHOOK: return "ZT_ONHOOK"; - case ZT_START: return "ZT_START"; - case ZT_OFFHOOK: return "ZT_OFFHOOK"; - case ZT_WINK: return "ZT_WINK"; - case ZT_FLASH: return "ZT_FLASH"; - case ZT_RING: return "ZT_RING"; - case ZT_RINGOFF: return "ZT_RINGOFF"; - } - return "Unknown hookstate"; -} - -/* From zaptel.c */ -static inline char *sig2str(int sig) -{ - switch (sig) { - case ZT_SIG_FXSLS: return "FXSLS"; - case ZT_SIG_FXSKS: return "FXSKS"; - case ZT_SIG_FXSGS: return "FXSGS"; - case ZT_SIG_FXOLS: return "FXOLS"; - case ZT_SIG_FXOKS: return "FXOKS"; - case ZT_SIG_FXOGS: return "FXOGS"; - case ZT_SIG_EM: return "E&M"; - case ZT_SIG_EM_E1: return "E&M-E1"; - case ZT_SIG_CLEAR: return "Clear"; - case ZT_SIG_HDLCRAW: return "HDLCRAW"; - case ZT_SIG_HDLCFCS: return "HDLCFCS"; - case ZT_SIG_HDLCNET: return "HDLCNET"; - case ZT_SIG_SLAVE: return "Slave"; - case ZT_SIG_CAS: return "CAS"; - case ZT_SIG_DACS: return "DACS"; - case ZT_SIG_DACS_RBS: return "DACS+RBS"; - case ZT_SIG_SF: return "SF (ToneOnly)"; - case ZT_SIG_NONE: - break; - } - return "Unconfigured"; -} - -static inline char *alarmbit2str(int alarmbit) -{ - /* from zaptel.h */ - switch(1 << alarmbit) { - case ZT_ALARM_NONE: return "NONE"; - case ZT_ALARM_RECOVER: return "RECOVER"; - case ZT_ALARM_LOOPBACK: return "LOOPBACK"; - case ZT_ALARM_YELLOW: return "YELLOW"; - case ZT_ALARM_RED: return "RED"; - case ZT_ALARM_BLUE: return "BLUE"; - case ZT_ALARM_NOTOPEN: return "NOTOPEN"; - } - return "UNKNOWN"; -} - -void alarm2str(int alarm, char *buf, int buflen); - -#endif /* ZAP_DEBUG_H */ diff --git a/zaptel/kernel/zaptel-base.c b/zaptel/kernel/zaptel-base.c deleted file mode 100644 index e8255f9c..00000000 --- a/zaptel/kernel/zaptel-base.c +++ /dev/null @@ -1,7839 +0,0 @@ -/* - * Zapata Telephony Interface Driver - * - * Written by Mark Spencer - * Based on previous works, designs, and architectures conceived and - * written by Jim Dixon . - * - * Special thanks to Steve Underwood - * for substantial contributions to signal processing functions - * in zaptel and the zapata library. - * - * Yury Bokhoncovich - * Adaptation for 2.4.20+ kernels (HDLC API was changed) - * The work has been performed as a part of our move - * from Cisco 3620 to IBM x305 here in F1 Group - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 -2006 Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include "zconfig.h" -#include "../version.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_DEVFS_FS -#include -#endif /* CONFIG_DEVFS_FS */ -#ifdef CONFIG_ZAPATA_NET -#include -#endif /* CONFIG_ZAPATA_NET */ -#include -#ifdef CONFIG_ZAPATA_PPP -#include -#include -#include -#endif -#include - -#ifndef CONFIG_OLD_HDLC_API -#define NEW_HDLC_INTERFACE -#endif - -#define __ECHO_STATE_MUTE (1 << 8) -#define ECHO_STATE_IDLE (0) -#define ECHO_STATE_PRETRAINING (1 | (__ECHO_STATE_MUTE)) -#define ECHO_STATE_STARTTRAINING (2 | (__ECHO_STATE_MUTE)) -#define ECHO_STATE_AWAITINGECHO (3 | (__ECHO_STATE_MUTE)) -#define ECHO_STATE_TRAINING (4 | (__ECHO_STATE_MUTE)) -#define ECHO_STATE_ACTIVE (5) - -/* #define BUF_MUNGE */ - -/* Grab fasthdlc with tables */ -#define FAST_HDLC_NEED_TABLES -#include "fasthdlc.h" - -#include "zaptel.h" - -#ifdef LINUX26 -#include -#endif - -/* Get helper arithmetic */ -#include "arith.h" -#if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP) -#include -#endif - -#define hdlc_to_ztchan(h) (((struct zt_hdlc *)(h))->chan) -#define dev_to_ztchan(h) (((struct zt_hdlc *)(dev_to_hdlc(h)->priv))->chan) -#ifdef LINUX26 -#define ztchan_to_dev(h) ((h)->hdlcnetdev->netdev) -#else -#define ztchan_to_dev(h) (&((h)->hdlcnetdev->netdev.netdev)) -#endif - -/* macro-oni for determining a unit (channel) number */ -#define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev) - -/* names of tx level settings */ -static char *zt_txlevelnames[] = { -"0 db (CSU)/0-133 feet (DSX-1)", -"133-266 feet (DSX-1)", -"266-399 feet (DSX-1)", -"399-533 feet (DSX-1)", -"533-655 feet (DSX-1)", -"-7.5db (CSU)", -"-15db (CSU)", -"-22.5db (CSU)" -} ; - -EXPORT_SYMBOL(zt_transcode_fops); -EXPORT_SYMBOL(zt_init_tone_state); -EXPORT_SYMBOL(zt_mf_tone); -EXPORT_SYMBOL(zt_register); -EXPORT_SYMBOL(zt_unregister); -EXPORT_SYMBOL(__zt_mulaw); -EXPORT_SYMBOL(__zt_alaw); -#ifdef CONFIG_CALC_XLAW -EXPORT_SYMBOL(__zt_lineartoulaw); -EXPORT_SYMBOL(__zt_lineartoalaw); -#else -EXPORT_SYMBOL(__zt_lin2mu); -EXPORT_SYMBOL(__zt_lin2a); -#endif -EXPORT_SYMBOL(zt_lboname); -EXPORT_SYMBOL(zt_transmit); -EXPORT_SYMBOL(zt_receive); -EXPORT_SYMBOL(zt_rbsbits); -EXPORT_SYMBOL(zt_qevent_nolock); -EXPORT_SYMBOL(zt_qevent_lock); -EXPORT_SYMBOL(zt_hooksig); -EXPORT_SYMBOL(zt_alarm_notify); -EXPORT_SYMBOL(zt_set_dynamic_ioctl); -EXPORT_SYMBOL(zt_ec_chunk); -EXPORT_SYMBOL(zt_ec_span); -EXPORT_SYMBOL(zt_hdlc_abort); -EXPORT_SYMBOL(zt_hdlc_finish); -EXPORT_SYMBOL(zt_hdlc_getbuf); -EXPORT_SYMBOL(zt_hdlc_putbuf); -EXPORT_SYMBOL(zt_alarm_channel); -EXPORT_SYMBOL(zt_register_chardev); -EXPORT_SYMBOL(zt_unregister_chardev); - -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry *proc_entries[ZT_MAX_SPANS]; -#endif - -/* Here are a couple important little additions for devfs */ -#ifdef CONFIG_DEVFS_FS -static devfs_handle_t zaptel_devfs_dir; -static devfs_handle_t channel; -static devfs_handle_t pseudo; -static devfs_handle_t ctl; -static devfs_handle_t timer; -#endif - -/* udev necessary data structures. Yeah! */ -#ifdef CONFIG_ZAP_UDEV - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) -#define CLASS_DEV_CREATE(class, devt, device, name) \ - device_create(class, device, devt, NULL, "%s", name) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#define CLASS_DEV_CREATE(class, devt, device, name) \ - device_create(class, device, devt, name) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) -#define CLASS_DEV_CREATE(class, devt, device, name) \ - class_device_create(class, NULL, devt, device, name) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) -#define CLASS_DEV_CREATE(class, devt, device, name) \ - class_device_create(class, devt, device, name) -#else -#define CLASS_DEV_CREATE(class, devt, device, name) \ - class_simple_device_add(class, devt, device, name) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) -#define CLASS_DEV_DESTROY(class, devt) \ - device_destroy(class, devt) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) -#define CLASS_DEV_DESTROY(class, devt) \ - class_device_destroy(class, devt) -#else -#define CLASS_DEV_DESTROY(class, devt) \ - class_simple_device_remove(devt) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) -static struct class *zap_class = NULL; -#else -static struct class_simple *zap_class = NULL; -#define class_create class_simple_create -#define class_destroy class_simple_destroy -#endif - -#endif /* CONFIG_ZAP_UDEV */ - - -/* There is a table like this in the PPP driver, too */ - -static int deftaps = 64; - -#if !defined(LINUX26) -static -__u16 fcstab[256] = -{ - 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, - 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, - 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, - 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, - 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, - 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, - 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, - 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, - 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, - 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, - 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, - 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, - 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, - 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, - 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, - 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, - 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, - 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, - 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, - 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, - 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, - 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, - 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, - 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, - 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, - 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, - 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, - 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, - 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, - 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, - 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, - 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 -}; -#endif - -static int debug; - -/* states for transmit signalling */ -typedef enum {ZT_TXSTATE_ONHOOK,ZT_TXSTATE_OFFHOOK,ZT_TXSTATE_START, - ZT_TXSTATE_PREWINK,ZT_TXSTATE_WINK,ZT_TXSTATE_PREFLASH, - ZT_TXSTATE_FLASH,ZT_TXSTATE_DEBOUNCE,ZT_TXSTATE_AFTERSTART, - ZT_TXSTATE_RINGON,ZT_TXSTATE_RINGOFF,ZT_TXSTATE_KEWL, - ZT_TXSTATE_AFTERKEWL,ZT_TXSTATE_PULSEBREAK,ZT_TXSTATE_PULSEMAKE, - ZT_TXSTATE_PULSEAFTER - } ZT_TXSTATE_t; - -typedef short sumtype[ZT_MAX_CHUNKSIZE]; - -static sumtype sums[(ZT_MAX_CONF + 1) * 3]; - -/* Translate conference aliases into actual conferences - and vice-versa */ -static short confalias[ZT_MAX_CONF + 1]; -static short confrev[ZT_MAX_CONF + 1]; - -static sumtype *conf_sums_next; -static sumtype *conf_sums; -static sumtype *conf_sums_prev; - -static struct zt_span *master; -static struct file_operations zt_fops; -struct file_operations *zt_transcode_fops = NULL; - -static struct -{ - int src; /* source conf number */ - int dst; /* dst conf number */ -} conf_links[ZT_MAX_CONF + 1]; - - -/* There are three sets of conference sum accumulators. One for the current -sample chunk (conf_sums), one for the next sample chunk (conf_sums_next), and -one for the previous sample chunk (conf_sums_prev). The following routine -(rotate_sums) "rotates" the pointers to these accululator arrays as part -of the events of sample chink processing as follows: - -The following sequence is designed to be looked at from the reference point -of the receive routine of the master span. - -1. All (real span) receive chunks are processed (with putbuf). The last one -to be processed is the master span. The data received is loaded into the -accumulators for the next chunk (conf_sums_next), to be in alignment with -current data after rotate_sums() is called (which immediately follows). -Keep in mind that putbuf is *also* a transmit routine for the pseudo parts -of channels that are in the REALANDPSEUDO conference mode. These channels -are processed from data in the current sample chunk (conf_sums), being -that this is a "transmit" function (for the pseudo part). - -2. rotate_sums() is called. - -3. All pseudo channel receive chunks are processed. This data is loaded into -the current sample chunk accumulators (conf_sums). - -4. All conference links are processed (being that all receive data for this -chunk has already been processed by now). - -5. All pseudo channel transmit chunks are processed. This data is loaded from -the current sample chunk accumulators (conf_sums). - -6. All (real span) transmit chunks are processed (with getbuf). This data is -loaded from the current sample chunk accumulators (conf_sums). Keep in mind -that getbuf is *also* a receive routine for the pseudo part of channels that -are in the REALANDPSEUDO conference mode. These samples are loaded into -the next sample chunk accumulators (conf_sums_next) to be processed as part -of the next sample chunk's data (next time around the world). - -*/ - -#define DIGIT_MODE_DTMF 0 -#define DIGIT_MODE_MFR1 1 -#define DIGIT_MODE_PULSE 2 -#define DIGIT_MODE_MFR2_FWD 3 -#define DIGIT_MODE_MFR2_REV 4 - -#include "digits.h" - -static struct zt_dialparams global_dialparams = { - .dtmf_tonelen = DEFAULT_DTMF_LENGTH, - .mfv1_tonelen = DEFAULT_MFR1_LENGTH, - .mfr2_tonelen = DEFAULT_MFR2_LENGTH, -}; - -static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit); - -#if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP) -/* XXX kernel_fpu_begin() is NOT exported properly (in 2.4), so we have to make - a local version. Somebody fix this! XXX */ - -#ifndef LINUX26 -static inline void __save_init_fpu( struct task_struct *tsk ) -{ - if ( cpu_has_fxsr ) { - asm volatile( "fxsave %0 ; fnclex" - : "=m" (tsk->thread.i387.fxsave) ); - } else { - asm volatile( "fnsave %0 ; fwait" - : "=m" (tsk->thread.i387.fsave) ); - } - tsk->flags &= ~PF_USEDFPU; -} - -static inline void zt_kernel_fpu_begin(void) -{ - struct task_struct *tsk = current; - if (tsk->flags & PF_USEDFPU) { - __save_init_fpu(tsk); - return; - } - clts(); -} -#else -#define zt_kernel_fpu_begin kernel_fpu_begin -#endif /* LINUX26 */ -#endif - -static struct zt_timer { - int ms; /* Countdown */ - int pos; /* Position */ - int ping; /* Whether we've been ping'd */ - int tripped; /* Whether we're tripped */ - struct zt_timer *next; /* Linked list */ - wait_queue_head_t sel; -} *zaptimers = NULL; - -#ifdef DEFINE_SPINLOCK -static DEFINE_SPINLOCK(zaptimerlock); -static DEFINE_SPINLOCK(bigzaplock); -#else -static spinlock_t zaptimerlock = SPIN_LOCK_UNLOCKED; -static spinlock_t bigzaplock = SPIN_LOCK_UNLOCKED; -#endif - -struct zt_zone { - atomic_t refcount; - char name[40]; /* Informational, only */ - int ringcadence[ZT_MAX_CADENCE]; - struct zt_tone *tones[ZT_TONE_MAX]; - /* Each of these is a circular list - of zt_tones to generate what we - want. Use NULL if the tone is - unavailable */ - struct zt_tone dtmf[16]; /* DTMF tones for this zone, with desired length */ - struct zt_tone dtmf_continuous[16]; /* DTMF tones for this zone, continuous play */ - struct zt_tone mfr1[15]; /* MFR1 tones for this zone, with desired length */ - struct zt_tone mfr2_fwd[15]; /* MFR2 FWD tones for this zone, with desired length */ - struct zt_tone mfr2_rev[15]; /* MFR2 REV tones for this zone, with desired length */ - struct zt_tone mfr2_fwd_continuous[16]; /* MFR2 FWD tones for this zone, continuous play */ - struct zt_tone mfr2_rev_continuous[16]; /* MFR2 REV tones for this zone, continuous play */ -}; - -static struct zt_span *spans[ZT_MAX_SPANS]; -static struct zt_chan *chans[ZT_MAX_CHANNELS]; - -static int maxspans = 0; -static int maxchans = 0; -static int maxconfs = 0; -static int maxlinks = 0; - -static int default_zone = -1; - -short __zt_mulaw[256]; -short __zt_alaw[256]; - -#ifndef CONFIG_CALC_XLAW -u_char __zt_lin2mu[16384]; - -u_char __zt_lin2a[16384]; -#endif - -static u_char defgain[256]; - -#ifdef DEFINE_RWLOCK -static DEFINE_RWLOCK(zone_lock); -static DEFINE_RWLOCK(chan_lock); -#else -static rwlock_t zone_lock = RW_LOCK_UNLOCKED; -static rwlock_t chan_lock = RW_LOCK_UNLOCKED; -#endif - -static struct zt_zone *tone_zones[ZT_TONE_ZONE_MAX]; - -#define NUM_SIGS 10 - - -/* Echo cancellation */ -#if defined(ECHO_CAN_HPEC) -#include "hpec/hpec_zaptel.h" -#elif defined(ECHO_CAN_STEVE) -#include "sec.h" -#elif defined(ECHO_CAN_STEVE2) -#include "sec-2.h" -#elif defined(ECHO_CAN_KB1) -#include "kb1ec.h" -#elif defined(ECHO_CAN_MG2) -#include "mg2ec.h" -#elif defined(ECHO_CAN_JP1) -#include "jpah.h" -#endif - -static inline void rotate_sums(void) -{ - /* Rotate where we sum and so forth */ - static int pos = 0; - conf_sums_prev = sums + (ZT_MAX_CONF + 1) * pos; - conf_sums = sums + (ZT_MAX_CONF + 1) * ((pos + 1) % 3); - conf_sums_next = sums + (ZT_MAX_CONF + 1) * ((pos + 2) % 3); - pos = (pos + 1) % 3; - memset(conf_sums_next, 0, maxconfs * sizeof(sumtype)); -} - - /* return quiescent (idle) signalling states, for the various signalling types */ -static int zt_q_sig(struct zt_chan *chan) -{ -int x; - -static unsigned int in_sig[NUM_SIGS][2] = { - { ZT_SIG_NONE, 0}, - { ZT_SIG_EM, 0 | (ZT_ABIT << 8)}, - { ZT_SIG_FXSLS,ZT_BBIT | (ZT_BBIT << 8)}, - { ZT_SIG_FXSGS,ZT_ABIT | ZT_BBIT | ((ZT_ABIT | ZT_BBIT) << 8)}, - { ZT_SIG_FXSKS,ZT_BBIT | ZT_BBIT | ((ZT_ABIT | ZT_BBIT) << 8)}, - { ZT_SIG_FXOLS,0 | (ZT_ABIT << 8)}, - { ZT_SIG_FXOGS,ZT_BBIT | ((ZT_ABIT | ZT_BBIT) << 8)}, - { ZT_SIG_FXOKS,0 | (ZT_ABIT << 8)}, - { ZT_SIG_SF, 0}, - { ZT_SIG_EM_E1, ZT_DBIT | ((ZT_ABIT | ZT_DBIT) << 8) }, - } ; - - /* must have span to begin with */ - if (!chan->span) return(-1); - /* if RBS does not apply, return error */ - if (!(chan->span->flags & ZT_FLAG_RBS) || - !chan->span->rbsbits) return(-1); - if (chan->sig == ZT_SIG_CAS) - return chan->idlebits; - for (x=0;xsig) return(in_sig[x][1]); - } return(-1); /* not found -- error */ -} - -#ifdef CONFIG_PROC_FS -static char *sigstr(int sig) -{ - switch (sig) { - case ZT_SIG_FXSLS: - return "FXSLS"; - case ZT_SIG_FXSKS: - return "FXSKS"; - case ZT_SIG_FXSGS: - return "FXSGS"; - case ZT_SIG_FXOLS: - return "FXOLS"; - case ZT_SIG_FXOKS: - return "FXOKS"; - case ZT_SIG_FXOGS: - return "FXOGS"; - case ZT_SIG_EM: - return "E&M"; - case ZT_SIG_EM_E1: - return "E&M-E1"; - case ZT_SIG_CLEAR: - return "Clear"; - case ZT_SIG_HDLCRAW: - return "HDLCRAW"; - case ZT_SIG_HDLCFCS: - return "HDLCFCS"; - case ZT_SIG_HDLCNET: - return "HDLCNET"; - case ZT_SIG_HARDHDLC: - return "Hardware-assisted HDLC"; - case ZT_SIG_MTP2: - return "MTP2"; - case ZT_SIG_SLAVE: - return "Slave"; - case ZT_SIG_CAS: - return "CAS"; - case ZT_SIG_DACS: - return "DACS"; - case ZT_SIG_DACS_RBS: - return "DACS+RBS"; - case ZT_SIG_SF: - return "SF (ToneOnly)"; - case ZT_SIG_NONE: - default: - return "Unconfigured"; - } - -} - -static inline int fill_alarm_string(char *buf, int count, int alarms) -{ - int len = 0; - - if (alarms > 0) { - if (alarms & ZT_ALARM_BLUE) - len += snprintf(buf + len, count - len, "BLUE "); - if (alarms & ZT_ALARM_YELLOW) - len += snprintf(buf + len, count - len, "YELLOW "); - if (alarms & ZT_ALARM_RED) - len += snprintf(buf + len, count - len, "RED "); - if (alarms & ZT_ALARM_LOOPBACK) - len += snprintf(buf + len, count - len, "LOOP "); - if (alarms & ZT_ALARM_RECOVER) - len += snprintf(buf + len, count - len, "RECOVERING "); - if (alarms & ZT_ALARM_NOTOPEN) - len += snprintf(buf + len, count - len, "NOTOPEN "); - } - if(len > 0) { - len--; - buf[len] = '\0'; /* strip last space */ - } - return len; -} - -static int zaptel_proc_read(char *page, char **start, off_t off, int count, int *eof, void *data) -{ - int x, len = 0; - long span; - - /* In Linux 2.6, this MUST NOT EXECEED 1024 bytes in one read! */ - - span = (long)data; - - if (!span) - return 0; - - if (spans[span]->name) - len += sprintf(page + len, "Span %ld: %s ", span, spans[span]->name); - if (spans[span]->desc) - len += sprintf(page + len, "\"%s\"", spans[span]->desc); - else - len += sprintf(page + len, "\"\""); - - if(spans[span] == master) - len += sprintf(page + len, " (MASTER)"); - - if (spans[span]->lineconfig) { - /* framing first */ - if (spans[span]->lineconfig & ZT_CONFIG_B8ZS) - len += sprintf(page + len, " B8ZS/"); - else if (spans[span]->lineconfig & ZT_CONFIG_AMI) - len += sprintf(page + len, " AMI/"); - else if (spans[span]->lineconfig & ZT_CONFIG_HDB3) - len += sprintf(page + len, " HDB3/"); - /* then coding */ - if (spans[span]->lineconfig & ZT_CONFIG_ESF) - len += sprintf(page + len, "ESF"); - else if (spans[span]->lineconfig & ZT_CONFIG_D4) - len += sprintf(page + len, "D4"); - else if (spans[span]->lineconfig & ZT_CONFIG_CCS) - len += sprintf(page + len, "CCS"); - /* E1's can enable CRC checking */ - if (spans[span]->lineconfig & ZT_CONFIG_CRC4) - len += sprintf(page + len, "/CRC4"); - } - - len += sprintf(page + len, " "); - - /* list alarms */ - len += fill_alarm_string(page + len, count - len, spans[span]->alarms); - if (spans[span]->syncsrc && (spans[span]->syncsrc == spans[span]->spanno)) - len += sprintf(page + len, "ClockSource "); - len += sprintf(page + len, "\n"); - if (spans[span]->bpvcount) - len += sprintf(page + len, "\tBPV count: %d\n", spans[span]->bpvcount); - if (spans[span]->crc4count) - len += sprintf(page + len, "\tCRC4 error count: %d\n", spans[span]->crc4count); - if (spans[span]->ebitcount) - len += sprintf(page + len, "\tE-bit error count: %d\n", spans[span]->ebitcount); - if (spans[span]->fascount) - len += sprintf(page + len, "\tFAS error count: %d\n", spans[span]->fascount); - if (spans[span]->irqmisses) - len += sprintf(page + len, "\tIRQ misses: %d\n", spans[span]->irqmisses); - if (spans[span]->timingslips) - len += sprintf(page + len, "\tTiming slips: %d\n", spans[span]->timingslips); - len += sprintf(page + len, "\n"); - - - for (x=1;xspan && (chans[x]->span->spanno == span)) { - if (chans[x]->name) - len += sprintf(page + len, "\t%4d %s ", x, chans[x]->name); - if (chans[x]->sig) { - if (chans[x]->sig == ZT_SIG_SLAVE) - len += sprintf(page + len, "%s ", sigstr(chans[x]->master->sig)); - else { - len += sprintf(page + len, "%s ", sigstr(chans[x]->sig)); - if (chans[x]->nextslave && chans[x]->master->channo == x) - len += sprintf(page + len, "Master "); - } - } - if ((chans[x]->flags & ZT_FLAG_OPEN)) { - len += sprintf(page + len, "(In use) "); - } -#ifdef OPTIMIZE_CHANMUTE - if ((chans[x]->chanmute)) { - len += sprintf(page + len, "(no pcm) "); - } -#endif - len += fill_alarm_string(page + len, count - len, chans[x]->chan_alarms); - len += sprintf(page + len, "\n"); - } - if (len <= off) { /* If everything printed so far is before beginning of request */ - off -= len; - len = 0; - } - if (len > off+count) /* stop if we've already generated enough */ - break; - } - } - if (len <= off) { /* If everything printed so far is before beginning of request */ - off -= len; - len = 0; - } - *start = page + off; - len -= off; /* un-count any remaining offset */ - if (len > count) len = count; /* don't return bytes not asked for */ - return len; -} -#endif - -static int zt_first_empty_alias(void) -{ - /* Find the first conference which has no alias pointing to it */ - int x; - for (x=1;x0;x--) { - if (confrev[x]) { - maxconfs = x+1; - return; - } - } - maxconfs = 0; -} - -static void recalc_maxlinks(void) -{ - int x; - for (x=ZT_MAX_CONF-1;x>0;x--) { - if (conf_links[x].src || conf_links[x].dst) { - maxlinks = x+1; - return; - } - } - maxlinks = 0; -} - -static int zt_first_empty_conference(void) -{ - /* Find the first conference which has no alias */ - int x; - for (x=ZT_MAX_CONF-1;x>0;x--) { - if (!confalias[x]) - return x; - } - return -1; -} - -static int zt_get_conf_alias(int x) -{ - int a; - if (confalias[x]) { - return confalias[x]; - } - - /* Allocate an alias */ - a = zt_first_empty_alias(); - confalias[x] = a; - confrev[a] = x; - - /* Highest conference may have changed */ - recalc_maxconfs(); - return a; -} - -static void zt_check_conf(int x) -{ - int y; - - /* return if no valid conf number */ - if (x <= 0) return; - /* Return if there is no alias */ - if (!confalias[x]) - return; - for (y=0;yconfna == x) && - ((chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONF || - (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANN || - (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFMON || - (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANNMON || - (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_REALANDPSEUDO)) - return; - } - /* If we get here, nobody is in the conference anymore. Clear it out - both forward and reverse */ - confrev[confalias[x]] = 0; - confalias[x] = 0; - - /* Highest conference may have changed */ - recalc_maxconfs(); -} - -/* enqueue an event on a channel */ -static void __qevent(struct zt_chan *chan, int event) -{ - - /* if full, ignore */ - if ((chan->eventoutidx == 0) && (chan->eventinidx == (ZT_MAX_EVENTSIZE - 1))) - return; - /* if full, ignore */ - if (chan->eventinidx == (chan->eventoutidx - 1)) return; - /* save the event */ - chan->eventbuf[chan->eventinidx++] = event; - /* wrap the index, if necessary */ - if (chan->eventinidx >= ZT_MAX_EVENTSIZE) chan->eventinidx = 0; - /* wake em all up */ - if (chan->iomask & ZT_IOMUX_SIGEVENT) wake_up_interruptible(&chan->eventbufq); - wake_up_interruptible(&chan->readbufq); - wake_up_interruptible(&chan->writebufq); - wake_up_interruptible(&chan->sel); - return; -} - -void zt_qevent_nolock(struct zt_chan *chan, int event) -{ - __qevent(chan, event); -} - -void zt_qevent_lock(struct zt_chan *chan, int event) -{ - unsigned long flags; - spin_lock_irqsave(&chan->lock, flags); - __qevent(chan, event); - spin_unlock_irqrestore(&chan->lock, flags); -} - -/* sleep in user space until woken up. Equivilant of tsleep() in BSD */ -static int schluffen(wait_queue_head_t *q) -{ - DECLARE_WAITQUEUE(wait, current); - add_wait_queue(q, &wait); - current->state = TASK_INTERRUPTIBLE; - if (!signal_pending(current)) schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(q, &wait); - if (signal_pending(current)) { - return -ERESTARTSYS; - } - return(0); -} - -static inline void calc_fcs(struct zt_chan *ss, int inwritebuf) -{ - int x; - unsigned int fcs=PPP_INITFCS; - unsigned char *data = ss->writebuf[inwritebuf]; - int len = ss->writen[inwritebuf]; - /* Not enough space to do FCS calculation */ - if (len < 2) - return; - for (x=0;x> 8) & 0xff; -} - -static int zt_reallocbufs(struct zt_chan *ss, int j, int numbufs) -{ - unsigned char *newbuf, *oldbuf; - unsigned long flags; - int x; - /* Check numbufs */ - if (numbufs < 2) - numbufs = 2; - if (numbufs > ZT_MAX_NUM_BUFS) - numbufs = ZT_MAX_NUM_BUFS; - /* We need to allocate our buffers now */ - if (j) { - newbuf = kmalloc(j * 2 * numbufs, GFP_KERNEL); - if (!newbuf) - return (-ENOMEM); - memset(newbuf, 0, j * 2 * numbufs); - } else - newbuf = NULL; - /* Now that we've allocated our new buffer, we can safely - move things around... */ - spin_lock_irqsave(&ss->lock, flags); - ss->blocksize = j; /* set the blocksize */ - oldbuf = ss->readbuf[0]; /* Keep track of the old buffer */ - ss->readbuf[0] = NULL; - if (newbuf) { - for (x=0;xreadbuf[x] = newbuf + x * j; - ss->writebuf[x] = newbuf + (numbufs + x) * j; - } - } else { - for (x=0;xreadbuf[x] = NULL; - ss->writebuf[x] = NULL; - } - } - /* Mark all buffers as empty */ - for (x=0;xwriten[x] = - ss->writeidx[x]= - ss->readn[x]= - ss->readidx[x] = 0; - - /* Keep track of where our data goes (if it goes - anywhere at all) */ - if (newbuf) { - ss->inreadbuf = 0; - ss->inwritebuf = 0; - } else { - ss->inreadbuf = -1; - ss->inwritebuf = -1; - } - ss->outreadbuf = -1; - ss->outwritebuf = -1; - ss->numbufs = numbufs; - if (ss->txbufpolicy == ZT_POLICY_WHEN_FULL) - ss->txdisable = 1; - else - ss->txdisable = 0; - - if (ss->rxbufpolicy == ZT_POLICY_WHEN_FULL) - ss->rxdisable = 1; - else - ss->rxdisable = 0; - - spin_unlock_irqrestore(&ss->lock, flags); - if (oldbuf) - kfree(oldbuf); - return 0; -} - -static int zt_hangup(struct zt_chan *chan); -static void zt_set_law(struct zt_chan *chan, int law); - -/* Pull a ZT_CHUNKSIZE piece off the queue. Returns - 0 on success or -1 on failure. If failed, provides - silence */ -static int __buf_pull(struct confq *q, u_char *data, struct zt_chan *c, char *label) -{ - int oldoutbuf = q->outbuf; - /* Ain't nuffin to read */ - if (q->outbuf < 0) { - if (data) - memset(data, ZT_LIN2X(0,c), ZT_CHUNKSIZE); - return -1; - } - if (data) - memcpy(data, q->buf[q->outbuf], ZT_CHUNKSIZE); - q->outbuf = (q->outbuf + 1) % ZT_CB_SIZE; - - /* Won't be nuffin next time */ - if (q->outbuf == q->inbuf) { - q->outbuf = -1; - } - - /* If they thought there was no space then - there is now where we just read */ - if (q->inbuf < 0) - q->inbuf = oldoutbuf; - return 0; -} - -/* Returns a place to put stuff, or NULL if there is - no room */ - -static u_char *__buf_pushpeek(struct confq *q) -{ - if (q->inbuf < 0) - return NULL; - return q->buf[q->inbuf]; -} - -static u_char *__buf_peek(struct confq *q) -{ - if (q->outbuf < 0) - return NULL; - return q->buf[q->outbuf]; -} - -#ifdef BUF_MUNGE -static u_char *__buf_cpush(struct confq *q) -{ - int pos; - /* If we have no space, return where the - last space that we *did* have was */ - if (q->inbuf > -1) - return NULL; - pos = q->outbuf - 1; - if (pos < 0) - pos += ZT_CB_SIZE; - return q->buf[pos]; -} - -static void __buf_munge(struct zt_chan *chan, u_char *old, u_char *new) -{ - /* Run a weighted average of the old and new, in order to - mask a missing sample */ - int x; - int val; - for (x=0;xinbuf; - if (q->inbuf < 0) { - return -1; - } - if (data) - /* Copy in the data */ - memcpy(q->buf[q->inbuf], data, ZT_CHUNKSIZE); - - /* Advance the inbuf pointer */ - q->inbuf = (q->inbuf + 1) % ZT_CB_SIZE; - - if (q->inbuf == q->outbuf) { - /* No space anymore... */ - q->inbuf = -1; - } - /* If they don't think data is ready, let - them know it is now */ - if (q->outbuf < 0) { - q->outbuf = oldinbuf; - } - return 0; -} - -static void reset_conf(struct zt_chan *chan) -{ - int x; - /* Empty out buffers and reset to initialization */ - for (x=0;xconfin.buf[x] = chan->confin.buffer + ZT_CHUNKSIZE * x; - chan->confin.inbuf = 0; - chan->confin.outbuf = -1; - - for (x=0;xconfout.buf[x] = chan->confout.buffer + ZT_CHUNKSIZE * x; - chan->confout.inbuf = 0; - chan->confout.outbuf = -1; -} - - -static inline int hw_echocancel_off(struct zt_chan *chan) -{ - struct zt_echocanparams ecp; - - int ret = -ENODEV; - if (chan->span) { - if (chan->span->echocan) { - ret = chan->span->echocan(chan, 0); - } else if (chan->span->echocan_with_params) { - memset(&ecp, 0, sizeof(ecp)); /* Sets tap length to 0 */ - ret = chan->span->echocan_with_params(chan, &ecp, NULL); - } - } - return ret; -} - -static void close_channel(struct zt_chan *chan) -{ - unsigned long flags; - void *rxgain = NULL; - struct echo_can_state *ec = NULL; - int oldconf; - short *readchunkpreec; -#ifdef CONFIG_ZAPATA_PPP - struct ppp_channel *ppp; -#endif - - /* XXX Buffers should be send out before reallocation!!! XXX */ - if (!(chan->flags & ZT_FLAG_NOSTDTXRX)) - zt_reallocbufs(chan, 0, 0); - spin_lock_irqsave(&chan->lock, flags); -#ifdef CONFIG_ZAPATA_PPP - ppp = chan->ppp; - chan->ppp = NULL; -#endif - ec = chan->ec; - chan->ec = NULL; - readchunkpreec = chan->readchunkpreec; - chan->readchunkpreec = NULL; - chan->curtone = NULL; - if (chan->curzone) - atomic_dec(&chan->curzone->refcount); - chan->curzone = NULL; - chan->cadencepos = 0; - chan->pdialcount = 0; - zt_hangup(chan); - chan->itimerset = chan->itimer = 0; - chan->pulsecount = 0; - chan->pulsetimer = 0; - chan->ringdebtimer = 0; - init_waitqueue_head(&chan->sel); - init_waitqueue_head(&chan->readbufq); - init_waitqueue_head(&chan->writebufq); - init_waitqueue_head(&chan->eventbufq); - init_waitqueue_head(&chan->txstateq); - chan->txdialbuf[0] = '\0'; - chan->digitmode = DIGIT_MODE_DTMF; - chan->dialing = 0; - chan->afterdialingtimer = 0; - /* initialize IO MUX mask */ - chan->iomask = 0; - /* save old conf number, if any */ - oldconf = chan->confna; - /* initialize conference variables */ - chan->_confn = 0; - if ((chan->sig & __ZT_SIG_DACS) != __ZT_SIG_DACS) { - chan->confna = 0; - chan->confmode = 0; - } - chan->confmute = 0; - /* release conference resource, if any to release */ - if (oldconf) zt_check_conf(oldconf); - chan->gotgs = 0; - reset_conf(chan); - - if (chan->gainalloc && chan->rxgain) - rxgain = chan->rxgain; - - chan->rxgain = defgain; - chan->txgain = defgain; - chan->gainalloc = 0; - chan->eventinidx = chan->eventoutidx = 0; - chan->flags &= ~(ZT_FLAG_LOOPED | ZT_FLAG_LINEAR | ZT_FLAG_PPP | ZT_FLAG_SIGFREEZE); - - zt_set_law(chan,0); - - memset(chan->conflast, 0, sizeof(chan->conflast)); - memset(chan->conflast1, 0, sizeof(chan->conflast1)); - memset(chan->conflast2, 0, sizeof(chan->conflast2)); - - if (chan->span && chan->span->dacs && oldconf) - chan->span->dacs(chan, NULL); - - spin_unlock_irqrestore(&chan->lock, flags); - - hw_echocancel_off(chan); - - if (rxgain) - kfree(rxgain); - if (ec) - echo_can_free(ec); - if (readchunkpreec) - kfree(readchunkpreec); - -#ifdef CONFIG_ZAPATA_PPP - if (ppp) { - tasklet_kill(&chan->ppp_calls); - skb_queue_purge(&chan->ppp_rq); - ppp_unregister_channel(ppp); - kfree(ppp); - } -#endif - -} - -static int free_tone_zone(int num) -{ - struct zt_zone *z; - - if ((num >= ZT_TONE_ZONE_MAX) || (num < 0)) - return -EINVAL; - - write_lock(&zone_lock); - z = tone_zones[num]; - tone_zones[num] = NULL; - write_unlock(&zone_lock); - if (!z) - return 0; - - if (atomic_read(&z->refcount)) { - /* channels are still using this zone so put it back */ - write_lock(&zone_lock); - tone_zones[num] = z; - write_unlock(&zone_lock); - - return -EBUSY; - } else { - kfree(z); - - return 0; - } -} - -static int zt_register_tone_zone(int num, struct zt_zone *zone) -{ - int res = 0; - - if ((num >= ZT_TONE_ZONE_MAX) || (num < 0)) - return -EINVAL; - - write_lock(&zone_lock); - if (tone_zones[num]) { - res = -EINVAL; - } else { - res = 0; - tone_zones[num] = zone; - } - write_unlock(&zone_lock); - - if (!res) - printk(KERN_INFO "Registered tone zone %d (%s)\n", num, zone->name); - - return res; -} - -static int start_tone(struct zt_chan *chan, int tone) -{ - int res = -EINVAL; - - /* Stop the current tone, no matter what */ - chan->tonep = 0; - chan->curtone = NULL; - chan->pdialcount = 0; - chan->txdialbuf[0] = '\0'; - chan->dialing = 0; - - if (tone == -1) { - /* Just stop the current tone */ - res = 0; - } else if (!chan->curzone) { - static int __warnonce = 1; - if (__warnonce) { - __warnonce = 0; - /* The tonezones are loaded by ztcfg based on /etc/zaptel.conf. */ - printk(KERN_WARNING "zaptel: Cannot start tones until tone zone is loaded.\n"); - } - /* Note that no tone zone exists at the moment */ - res = -ENODATA; - } else if ((tone >= 0 && tone <= ZT_TONE_MAX)) { - /* Have a tone zone */ - if (chan->curzone->tones[tone]) { - chan->curtone = chan->curzone->tones[tone]; - res = 0; - } else { /* Indicate that zone is loaded but no such tone exists */ - res = -ENOSYS; - } - } else if (chan->digitmode == DIGIT_MODE_DTMF) { - if ((tone >= ZT_TONE_DTMF_BASE) && (tone <= ZT_TONE_DTMF_MAX)) { - chan->dialing = 1; - res = 0; - tone -= ZT_TONE_DTMF_BASE; - if (chan->curzone) { - /* Have a tone zone */ - if (chan->curzone->dtmf_continuous[tone].tonesamples) { - chan->curtone = &chan->curzone->dtmf_continuous[tone]; - res = 0; - } else { - /* Indicate that zone is loaded but no such tone exists */ - res = -ENOSYS; - } - } else { - /* Note that no tone zone exists at the moment */ - res = -ENODATA; - } - } else { - res = -EINVAL; - } - } else if (chan->digitmode == DIGIT_MODE_MFR2_FWD) { - if ((tone >= ZT_TONE_MFR2_FWD_BASE) && (tone <= ZT_TONE_MFR2_FWD_MAX)) { - res = 0; - tone -= ZT_TONE_MFR2_FWD_BASE; - if (chan->curzone) { - /* Have a tone zone */ - if (chan->curzone->mfr2_fwd_continuous[tone].tonesamples) { - chan->curtone = &chan->curzone->mfr2_fwd_continuous[tone]; - res = 0; - } else { - /* Indicate that zone is loaded but no such tone exists */ - res = -ENOSYS; - } - } else { - /* Note that no tone zone exists at the moment */ - res = -ENODATA; - } - } else { - res = -EINVAL; - } - } else if (chan->digitmode == DIGIT_MODE_MFR2_REV) { - if ((tone >= ZT_TONE_MFR2_REV_BASE) && (tone <= ZT_TONE_MFR2_REV_MAX)) { - res = 0; - tone -= ZT_TONE_MFR2_REV_BASE; - if (chan->curzone) { - /* Have a tone zone */ - if (chan->curzone->mfr2_rev_continuous[tone].tonesamples) { - chan->curtone = &chan->curzone->mfr2_rev_continuous[tone]; - res = 0; - } else { - /* Indicate that zone is loaded but no such tone exists */ - res = -ENOSYS; - } - } else { - /* Note that no tone zone exists at the moment */ - res = -ENODATA; - } - } else { - res = -EINVAL; - } - } else { - chan->dialing = 0; - res = -EINVAL; - } - - if (chan->curtone) - zt_init_tone_state(&chan->ts, chan->curtone); - - return res; -} - -static int set_tone_zone(struct zt_chan *chan, int zone) -{ - int res = 0; - struct zt_zone *z; - unsigned long flags; - - /* Do not call with the channel locked. */ - - if (zone == -1) - zone = default_zone; - - if ((zone >= ZT_TONE_ZONE_MAX) || (zone < 0)) - return -EINVAL; - - read_lock(&zone_lock); - - if ((z = tone_zones[zone])) { - spin_lock_irqsave(&chan->lock, flags); - if (chan->curzone) - atomic_dec(&chan->curzone->refcount); - - atomic_inc(&z->refcount); - chan->curzone = z; - chan->tonezone = zone; - memcpy(chan->ringcadence, z->ringcadence, sizeof(chan->ringcadence)); - spin_unlock_irqrestore(&chan->lock, flags); - } else { - res = -ENODATA; - } - - read_unlock(&zone_lock); - - return res; -} - -static void zt_set_law(struct zt_chan *chan, int law) -{ - if (!law) { - if (chan->deflaw) - law = chan->deflaw; - else - if (chan->span) law = chan->span->deflaw; - else law = ZT_LAW_MULAW; - } - if (law == ZT_LAW_ALAW) { - chan->xlaw = __zt_alaw; -#ifdef CONFIG_CALC_XLAW - chan->lineartoxlaw = __zt_lineartoalaw; -#else - chan->lin2x = __zt_lin2a; -#endif - } else { - chan->xlaw = __zt_mulaw; -#ifdef CONFIG_CALC_XLAW - chan->lineartoxlaw = __zt_lineartoulaw; -#else - chan->lin2x = __zt_lin2mu; -#endif - } -} - -#ifdef CONFIG_DEVFS_FS -static devfs_handle_t register_devfs_channel(struct zt_chan *chan, devfs_handle_t dir) -{ - char path[100]; - char link[100]; - char buf[50]; - char tmp[100]; - int link_offset = 0; - int tmp_offset = 0; - int path_offset = 0; - int err = 0; - devfs_handle_t chan_dev; - umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO; - unsigned int flags = DEVFS_FL_AUTO_OWNER; - - sprintf(path, "%d", chan->chanpos); - chan_dev = devfs_register(dir, path, flags, ZT_MAJOR, chan->channo, mode, &zt_fops, NULL); - if (!chan_dev) { - printk("zaptel: Something really bad happened. Unable to register devfs entry\n"); - return NULL; - } - - /* Set up the path of the destination of the link */ - link_offset = devfs_generate_path(chan_dev, link, sizeof(link) - 1); - /* Now we need to strip off the leading "zap/". If we don't, then we build a broken symlink */ - path_offset = devfs_generate_path(zaptel_devfs_dir, path, sizeof(path) - 1); /* We'll just "borrow" path for a second */ - path_offset = strlen(path+path_offset); - link_offset += path_offset; /* Taking out the "zap" */ - link_offset++; /* Add one more place for the '/'. The path generated does not contain the '/' we need to strip */ - - /* Set up the path of the file/link itself */ - tmp_offset = devfs_generate_path(zaptel_devfs_dir, tmp, sizeof(tmp) - 1); - sprintf(buf, "/%d", chan->channo); - zap_copy_string(path, tmp+tmp_offset, sizeof(path)); - strncat(path, buf, sizeof(path) - 1); - - err = devfs_mk_symlink(NULL, path, DEVFS_FL_DEFAULT, link+link_offset, &chan->fhandle_symlink, NULL); - if (err != 0) { - printk("Problem with making devfs symlink: %d\n", err); - } - - return chan_dev; -} -#endif /* CONFIG_DEVFS_FS */ - -static int zt_chan_reg(struct zt_chan *chan) -{ - int x; - int res=0; - unsigned long flags; - - write_lock_irqsave(&chan_lock, flags); - for (x=1;xlock); - chans[x] = chan; - if (maxchans < x + 1) - maxchans = x + 1; - chan->channo = x; - if (!chan->master) - chan->master = chan; - if (!chan->readchunk) - chan->readchunk = chan->sreadchunk; - if (!chan->writechunk) - chan->writechunk = chan->swritechunk; - zt_set_law(chan, 0); - close_channel(chan); - /* set this AFTER running close_channel() so that - HDLC channels wont cause hangage */ - chan->flags |= ZT_FLAG_REGISTERED; - res = 0; - break; - } - } - write_unlock_irqrestore(&chan_lock, flags); - if (x >= ZT_MAX_CHANNELS) - printk(KERN_ERR "No more channels available\n"); - return res; -} - -char *zt_lboname(int x) -{ - if ((x < 0) || ( x > 7)) - return "Unknown"; - return zt_txlevelnames[x]; -} - -#if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP) -#endif - -#ifdef CONFIG_ZAPATA_NET -#ifdef NEW_HDLC_INTERFACE -static int zt_net_open(struct net_device *dev) -{ -#ifdef LINUX26 - int res = hdlc_open(dev); - struct zt_chan *ms = dev_to_ztchan(dev); -#else - hdlc_device *hdlc = dev_to_hdlc(dev); - struct zt_chan *ms = hdlc_to_ztchan(hdlc); - int res = hdlc_open(hdlc); -#endif - -/* if (!dev->hard_start_xmit) return res; is this really necessary? --byg */ - if (res) /* this is necessary to avoid kernel panic when UNSPEC link encap, proven --byg */ - return res; -#else -static int zt_net_open(hdlc_device *hdlc) -{ - struct zt_chan *ms = hdlc_to_ztchan(hdlc); - int res; -#endif - if (!ms) { - printk("zt_net_open: nothing??\n"); - return -EINVAL; - } - if (ms->flags & ZT_FLAG_OPEN) { - printk("%s is already open!\n", ms->name); - return -EBUSY; - } - if (!(ms->flags & ZT_FLAG_NETDEV)) { - printk("%s is not a net device!\n", ms->name); - return -EINVAL; - } - ms->txbufpolicy = ZT_POLICY_IMMEDIATE; - ms->rxbufpolicy = ZT_POLICY_IMMEDIATE; - - res = zt_reallocbufs(ms, ZT_DEFAULT_MTU_MRU, ZT_DEFAULT_NUM_BUFS); - if (res) - return res; - - fasthdlc_init(&ms->rxhdlc); - fasthdlc_init(&ms->txhdlc); - ms->infcs = PPP_INITFCS; - - netif_start_queue(ztchan_to_dev(ms)); - -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif -#ifdef CONFIG_ZAPATA_DEBUG - printk("ZAPNET: Opened channel %d name %s\n", ms->channo, ms->name); -#endif - return 0; -} - -#ifdef LINUX26 -static int zt_register_hdlc_device(struct net_device *dev, const char *dev_name) -{ - int result; - - if (dev_name && *dev_name) { - if ((result = dev_alloc_name(dev, dev_name)) < 0) - return result; - } - result = register_netdev(dev); - if (result != 0) - return -EIO; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,14) - if (netif_carrier_ok(dev)) - netif_carrier_off(dev); /* no carrier until DCD goes up */ -#endif - return 0; -} -#endif - -#ifdef NEW_HDLC_INTERFACE -static int zt_net_stop(struct net_device *dev) -{ -#ifdef LINUX26 - hdlc_device *h = dev_to_hdlc(dev); - struct zt_hdlc *hdlc = h->priv; -#else - hdlc_device *hdlc = dev_to_hdlc(dev); -#endif - -#else -static void zt_net_close(hdlc_device *hdlc) -{ -#endif - struct zt_chan *ms = hdlc_to_ztchan(hdlc); - if (!ms) { -#ifdef NEW_HDLC_INTERFACE - printk("zt_net_stop: nothing??\n"); - return 0; -#else - printk("zt_net_close: nothing??\n"); - return; -#endif - } - if (!(ms->flags & ZT_FLAG_NETDEV)) { -#ifdef NEW_HDLC_INTERFACE - printk("zt_net_stop: %s is not a net device!\n", ms->name); - return 0; -#else - printk("zt_net_close: %s is not a net device!\n", ms->name); - return; -#endif - } - /* Not much to do here. Just deallocate the buffers */ - netif_stop_queue(ztchan_to_dev(ms)); - zt_reallocbufs(ms, 0, 0); -#ifdef LINUX26 - hdlc_close(dev); -#else -#ifndef CONFIG_OLD_HDLC_API - hdlc_close(hdlc); -#endif -#endif -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif -#ifdef NEW_HDLC_INTERFACE - return 0; -#else - return; -#endif -} - -#ifdef NEW_HDLC_INTERFACE -/* kernel 2.4.20+ has introduced attach function, dunno what to do, - just copy sources from dscc4 to be sure and ready for further mastering, - NOOP right now (i.e. really a stub) --byg */ -#ifdef LINUX26 -static int zt_net_attach(struct net_device *dev, unsigned short encoding, - unsigned short parity) -#else -static int zt_net_attach(hdlc_device *hdlc, unsigned short encoding, - unsigned short parity) -#endif -{ -/* struct net_device *dev = hdlc_to_dev(hdlc); - struct dscc4_dev_priv *dpriv = dscc4_priv(dev); - - if (encoding != ENCODING_NRZ && - encoding != ENCODING_NRZI && - encoding != ENCODING_FM_MARK && - encoding != ENCODING_FM_SPACE && - encoding != ENCODING_MANCHESTER) - return -EINVAL; - - if (parity != PARITY_NONE && - parity != PARITY_CRC16_PR0_CCITT && - parity != PARITY_CRC16_PR1_CCITT && - parity != PARITY_CRC32_PR0_CCITT && - parity != PARITY_CRC32_PR1_CCITT) - return -EINVAL; - - dpriv->encoding = encoding; - dpriv->parity = parity;*/ - return 0; -} -#endif - -static struct zt_hdlc *zt_hdlc_alloc(void) -{ - struct zt_hdlc *tmp; - tmp = kmalloc(sizeof(struct zt_hdlc), GFP_KERNEL); - if (tmp) { - memset(tmp, 0, sizeof(struct zt_hdlc)); - } - return tmp; -} - -#ifdef NEW_HDLC_INTERFACE -static int zt_xmit(struct sk_buff *skb, struct net_device *dev) -{ - /* FIXME: this construction seems to be not very optimal for me but I could find nothing better at the moment (Friday, 10PM :( ) --byg */ -/* struct zt_chan *ss = hdlc_to_ztchan(list_entry(dev, struct zt_hdlc, netdev.netdev));*/ -#ifdef LINUX26 - struct zt_chan *ss = dev_to_ztchan(dev); - struct net_device_stats *stats = hdlc_stats(dev); -#else - struct zt_chan *ss = (list_entry(dev, struct zt_hdlc, netdev.netdev)->chan); - struct net_device_stats *stats = &ss->hdlcnetdev->netdev.stats; -#endif - -#else -static int zt_xmit(hdlc_device *hdlc, struct sk_buff *skb) -{ - struct zt_chan *ss = hdlc_to_ztchan(hdlc); - struct net_device *dev = &ss->hdlcnetdev->netdev.netdev; - struct net_device_stats *stats = &ss->hdlcnetdev->netdev.stats; -#endif - int retval = 1; - int x,oldbuf; - unsigned int fcs; - unsigned char *data; - unsigned long flags; - /* See if we have any buffers */ - spin_lock_irqsave(&ss->lock, flags); - if (skb->len > ss->blocksize - 2) { - printk(KERN_ERR "zt_xmit(%s): skb is too large (%d > %d)\n", dev->name, skb->len, ss->blocksize -2); - stats->tx_dropped++; - retval = 0; - } else if (ss->inwritebuf >= 0) { - /* We have a place to put this packet */ - /* XXX We should keep the SKB and avoid the memcpy XXX */ - data = ss->writebuf[ss->inwritebuf]; - memcpy(data, skb->data, skb->len); - ss->writen[ss->inwritebuf] = skb->len; - ss->writeidx[ss->inwritebuf] = 0; - /* Calculate the FCS */ - fcs = PPP_INITFCS; - for (x=0;xlen;x++) - fcs = PPP_FCS(fcs, data[x]); - /* Invert it */ - fcs ^= 0xffff; - /* Send it out LSB first */ - data[ss->writen[ss->inwritebuf]++] = (fcs & 0xff); - data[ss->writen[ss->inwritebuf]++] = (fcs >> 8) & 0xff; - /* Advance to next window */ - oldbuf = ss->inwritebuf; - ss->inwritebuf = (ss->inwritebuf + 1) % ss->numbufs; - - if (ss->inwritebuf == ss->outwritebuf) { - /* Whoops, no more space. */ - ss->inwritebuf = -1; - - netif_stop_queue(ztchan_to_dev(ss)); - } - if (ss->outwritebuf < 0) { - /* Let the interrupt handler know there's - some space for us */ - ss->outwritebuf = oldbuf; - } - dev->trans_start = jiffies; - stats->tx_packets++; - stats->tx_bytes += ss->writen[oldbuf]; -#ifdef CONFIG_ZAPATA_DEBUG - printk("Buffered %d bytes to go out in buffer %d\n", ss->writen[oldbuf], oldbuf); - for (x=0;xwriten[oldbuf];x++) - printk("%02x ", ss->writebuf[oldbuf][x]); - printk("\n"); -#endif - retval = 0; - /* Free the SKB */ - dev_kfree_skb_any(skb); - } - spin_unlock_irqrestore(&ss->lock, flags); - return retval; -} - -#ifdef NEW_HDLC_INTERFACE -static int zt_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -{ - return hdlc_ioctl(dev, ifr, cmd); -} -#else -static int zt_net_ioctl(hdlc_device *hdlc, struct ifreq *ifr, int cmd) -{ - return -EIO; -} -#endif - -#endif - -#ifdef CONFIG_ZAPATA_PPP - -static int zt_ppp_xmit(struct ppp_channel *ppp, struct sk_buff *skb) -{ - - /* - * If we can't handle the packet right now, return 0. If we - * we handle or drop it, return 1. Always free if we return - * 1 and never if we return 0 - */ - struct zt_chan *ss = ppp->private; - int x,oldbuf; - unsigned int fcs; - unsigned char *data; - unsigned long flags; - int retval = 0; - - /* See if we have any buffers */ - spin_lock_irqsave(&ss->lock, flags); - if (!(ss->flags & ZT_FLAG_OPEN)) { - printk("Can't transmit on closed channel\n"); - retval = 1; - } else if (skb->len > ss->blocksize - 4) { - printk(KERN_ERR "zt_ppp_xmit(%s): skb is too large (%d > %d)\n", ss->name, skb->len, ss->blocksize -2); - retval = 1; - } else if (ss->inwritebuf >= 0) { - /* We have a place to put this packet */ - /* XXX We should keep the SKB and avoid the memcpy XXX */ - data = ss->writebuf[ss->inwritebuf]; - /* Start with header of two bytes */ - /* Add "ALL STATIONS" and "UNNUMBERED" */ - data[0] = 0xff; - data[1] = 0x03; - ss->writen[ss->inwritebuf] = 2; - - /* Copy real data and increment amount written */ - memcpy(data + 2, skb->data, skb->len); - - ss->writen[ss->inwritebuf] += skb->len; - - /* Re-set index back to zero */ - ss->writeidx[ss->inwritebuf] = 0; - - /* Calculate the FCS */ - fcs = PPP_INITFCS; - for (x=0;xlen + 2;x++) - fcs = PPP_FCS(fcs, data[x]); - /* Invert it */ - fcs ^= 0xffff; - - /* Point past the real data now */ - data += (skb->len + 2); - - /* Send FCS out LSB first */ - data[0] = (fcs & 0xff); - data[1] = (fcs >> 8) & 0xff; - - /* Account for FCS length */ - ss->writen[ss->inwritebuf]+=2; - - /* Advance to next window */ - oldbuf = ss->inwritebuf; - ss->inwritebuf = (ss->inwritebuf + 1) % ss->numbufs; - - if (ss->inwritebuf == ss->outwritebuf) { - /* Whoops, no more space. */ - ss->inwritebuf = -1; - } - if (ss->outwritebuf < 0) { - /* Let the interrupt handler know there's - some space for us */ - ss->outwritebuf = oldbuf; - } -#ifdef CONFIG_ZAPATA_DEBUG - printk("Buffered %d bytes (skblen = %d) to go out in buffer %d\n", ss->writen[oldbuf], skb->len, oldbuf); - for (x=0;xwriten[oldbuf];x++) - printk("%02x ", ss->writebuf[oldbuf][x]); - printk("\n"); -#endif - retval = 1; - } - spin_unlock_irqrestore(&ss->lock, flags); - if (retval) { - /* Get rid of the SKB if we're returning non-zero */ - /* N.B. this is called in process or BH context so - dev_kfree_skb is OK. */ - dev_kfree_skb(skb); - } - return retval; -} - -static int zt_ppp_ioctl(struct ppp_channel *ppp, unsigned int cmd, unsigned long flags) -{ - return -EIO; -} - -static struct ppp_channel_ops ztppp_ops = -{ - start_xmit: zt_ppp_xmit, - ioctl: zt_ppp_ioctl, -}; - -#endif - -static void zt_chan_unreg(struct zt_chan *chan) -{ - int x; - unsigned long flags; -#ifdef CONFIG_ZAPATA_NET - if (chan->flags & ZT_FLAG_NETDEV) { -#ifdef LINUX26 - unregister_hdlc_device(chan->hdlcnetdev->netdev); - free_netdev(chan->hdlcnetdev->netdev); -#else - unregister_hdlc_device(&chan->hdlcnetdev->netdev); -#endif - kfree(chan->hdlcnetdev); - chan->hdlcnetdev = NULL; - } -#endif - write_lock_irqsave(&chan_lock, flags); - if (chan->flags & ZT_FLAG_REGISTERED) { - chans[chan->channo] = NULL; - chan->flags &= ~ZT_FLAG_REGISTERED; - } -#ifdef CONFIG_ZAPATA_PPP - if (chan->ppp) { - printk("HUH??? PPP still attached??\n"); - } -#endif - maxchans = 0; - for (x=1;xmaster == chan) { - chans[x]->master = chans[x]; - } - if ((chans[x]->confna == chan->channo) && - ((chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR || - (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORTX || - (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH || - (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_RX_PREECHO || - (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_TX_PREECHO || - (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH_PREECHO || - (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_DIGITALMON)) { - /* Take them out of conference with us */ - /* release conference resource if any */ - if (chans[x]->confna) { - zt_check_conf(chans[x]->confna); - if (chans[x]->span && chans[x]->span->dacs) - chans[x]->span->dacs(chans[x], NULL); - } - chans[x]->confna = 0; - chans[x]->_confn = 0; - chans[x]->confmode = 0; - } - } - chan->channo = -1; - write_unlock_irqrestore(&chan_lock, flags); -} - -static ssize_t zt_chan_read(struct file *file, char *usrbuf, size_t count, int unit) -{ - struct zt_chan *chan = chans[unit]; - int amnt; - int res, rv; - int oldbuf,x; - unsigned long flags; - /* Make sure count never exceeds 65k, and make sure it's unsigned */ - count &= 0xffff; - if (!chan) - return -EINVAL; - if (count < 1) - return -EINVAL; - for(;;) { - spin_lock_irqsave(&chan->lock, flags); - if (chan->eventinidx != chan->eventoutidx) { - spin_unlock_irqrestore(&chan->lock, flags); - return -ELAST /* - chan->eventbuf[chan->eventoutidx]*/; - } - res = chan->outreadbuf; - if (chan->rxdisable) - res = -1; - spin_unlock_irqrestore(&chan->lock, flags); - if (res >= 0) break; - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - rv = schluffen(&chan->readbufq); - if (rv) return (rv); - } - amnt = count; -/* added */ -#if 0 - if ((unit == 24) || (unit == 48) || (unit == 16) || (unit == 47)) { - int myamnt = amnt; - int x; - if (amnt > chan->readn[res]) - myamnt = chan->readn[res]; - printk("zt_chan_read(unit: %d, inwritebuf: %d, outwritebuf: %d amnt: %d\n", - unit, chan->inwritebuf, chan->outwritebuf, myamnt); - printk("\t("); for (x = 0; x < myamnt; x++) printk((x ? " %02x" : "%02x"), (unsigned char)usrbuf[x]); - printk(")\n"); - } -#endif -/* end addition */ - if (chan->flags & ZT_FLAG_LINEAR) { - if (amnt > (chan->readn[res] << 1)) - amnt = chan->readn[res] << 1; - if (amnt) { - /* There seems to be a max stack size, so we have - to do this in smaller pieces */ - short lindata[128]; - int left = amnt >> 1; /* amnt is in bytes */ - int pos = 0; - int pass; - while(left) { - pass = left; - if (pass > 128) - pass = 128; - for (x=0;xreadbuf[res][x + pos], chan); - if (copy_to_user(usrbuf + (pos << 1), lindata, pass << 1)) - return -EFAULT; - left -= pass; - pos += pass; - } - } - } else { - if (amnt > chan->readn[res]) - amnt = chan->readn[res]; - if (amnt) { - if (copy_to_user(usrbuf, chan->readbuf[res], amnt)) - return -EFAULT; - } - } - spin_lock_irqsave(&chan->lock, flags); - chan->readidx[res] = 0; - chan->readn[res] = 0; - oldbuf = res; - chan->outreadbuf = (res + 1) % chan->numbufs; - if (chan->outreadbuf == chan->inreadbuf) { - /* Out of stuff */ - chan->outreadbuf = -1; - if (chan->rxbufpolicy == ZT_POLICY_WHEN_FULL) - chan->rxdisable = 1; - } - if (chan->inreadbuf < 0) { - /* Notify interrupt handler that we have some space now */ - chan->inreadbuf = oldbuf; - } - spin_unlock_irqrestore(&chan->lock, flags); - - return amnt; -} - -static ssize_t zt_chan_write(struct file *file, const char *usrbuf, size_t count, int unit) -{ - unsigned long flags; - struct zt_chan *chan = chans[unit]; - int res, amnt, oldbuf, rv,x; - /* Make sure count never exceeds 65k, and make sure it's unsigned */ - count &= 0xffff; - if (!chan) - return -EINVAL; - if (count < 1) - return -EINVAL; - for(;;) { - spin_lock_irqsave(&chan->lock, flags); - if ((chan->curtone || chan->pdialcount) && !(chan->flags & ZT_FLAG_PSEUDO)) { - chan->curtone = NULL; - chan->tonep = 0; - chan->dialing = 0; - chan->txdialbuf[0] = '\0'; - chan->pdialcount = 0; - } - if (chan->eventinidx != chan->eventoutidx) { - spin_unlock_irqrestore(&chan->lock, flags); - return -ELAST; - } - res = chan->inwritebuf; - spin_unlock_irqrestore(&chan->lock, flags); - if (res >= 0) - break; - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - /* Wait for something to be available */ - rv = schluffen(&chan->writebufq); - if (rv) - return rv; - } - - amnt = count; - if (chan->flags & ZT_FLAG_LINEAR) { - if (amnt > (chan->blocksize << 1)) - amnt = chan->blocksize << 1; - } else { - if (amnt > chan->blocksize) - amnt = chan->blocksize; - } - -#ifdef CONFIG_ZAPATA_DEBUG - printk("zt_chan_write(unit: %d, res: %d, outwritebuf: %d amnt: %d\n", - unit, chan->res, chan->outwritebuf, amnt); -#endif -#if 0 - if ((unit == 24) || (unit == 48) || (unit == 16) || (unit == 47)) { - int x; - printk("zt_chan_write/in(unit: %d, res: %d, outwritebuf: %d amnt: %d, txdisable: %d)\n", - unit, res, chan->outwritebuf, amnt, chan->txdisable); - printk("\t("); for (x = 0; x < amnt; x++) printk((x ? " %02x" : "%02x"), (unsigned char)usrbuf[x]); - printk(")\n"); - } -#endif - - if (amnt) { - if (chan->flags & ZT_FLAG_LINEAR) { - /* There seems to be a max stack size, so we have - to do this in smaller pieces */ - short lindata[128]; - int left = amnt >> 1; /* amnt is in bytes */ - int pos = 0; - int pass; - while(left) { - pass = left; - if (pass > 128) - pass = 128; - if (copy_from_user(lindata, usrbuf + (pos << 1), pass << 1)) - return -EFAULT; - left -= pass; - for (x=0;xwritebuf[res][x + pos] = ZT_LIN2X(lindata[x], chan); - pos += pass; - } - chan->writen[res] = amnt >> 1; - } else { - if (copy_from_user(chan->writebuf[res], usrbuf, amnt)) - return -EFAULT; - chan->writen[res] = amnt; - } - chan->writeidx[res] = 0; - if (chan->flags & ZT_FLAG_FCS) - calc_fcs(chan, res); - oldbuf = res; - spin_lock_irqsave(&chan->lock, flags); - chan->inwritebuf = (res + 1) % chan->numbufs; - if (chan->inwritebuf == chan->outwritebuf) { - /* Don't stomp on the transmitter, just wait for them to - wake us up */ - chan->inwritebuf = -1; - /* Make sure the transmitter is transmitting in case of POLICY_WHEN_FULL */ - chan->txdisable = 0; - } - if (chan->outwritebuf < 0) { - /* Okay, the interrupt handler has been waiting for us. Give them a buffer */ - chan->outwritebuf = oldbuf; - } - spin_unlock_irqrestore(&chan->lock, flags); - - if (chan->flags & ZT_FLAG_NOSTDTXRX && chan->span->hdlc_hard_xmit) - chan->span->hdlc_hard_xmit(chan); - } - return amnt; -} - -static int zt_ctl_open(struct inode *inode, struct file *file) -{ - /* Nothing to do, really */ -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int zt_chan_open(struct inode *inode, struct file *file) -{ - /* Nothing to do here for now either */ -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - return 0; -} - -static int zt_ctl_release(struct inode *inode, struct file *file) -{ - /* Nothing to do */ -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - return 0; -} - -static int zt_chan_release(struct inode *inode, struct file *file) -{ - /* Nothing to do for now */ -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - return 0; -} - -static void set_txtone(struct zt_chan *ss,int fac, int init_v2, int init_v3) -{ - if (fac == 0) - { - ss->v2_1 = 0; - ss->v3_1 = 0; - return; - } - ss->txtone = fac; - ss->v1_1 = 0; - ss->v2_1 = init_v2; - ss->v3_1 = init_v3; - return; -} - -static void zt_rbs_sethook(struct zt_chan *chan, int txsig, int txstate, int timeout) -{ -static int outs[NUM_SIGS][5] = { -/* We set the idle case of the ZT_SIG_NONE to this pattern to make idle E1 CAS -channels happy. Should not matter with T1, since on an un-configured channel, -who cares what the sig bits are as long as they are stable */ - { ZT_SIG_NONE, ZT_ABIT | ZT_CBIT | ZT_DBIT, 0, 0, 0 }, /* no signalling */ - { ZT_SIG_EM, 0, ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, 0 }, /* E and M */ - { ZT_SIG_FXSLS, ZT_BBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, 0 }, /* FXS Loopstart */ - { ZT_SIG_FXSGS, ZT_BBIT | ZT_DBIT, -#ifdef CONFIG_CAC_GROUNDSTART - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, 0, 0 }, /* FXS Groundstart (CAC-style) */ -#else - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, ZT_ABIT | ZT_CBIT, 0 }, /* FXS Groundstart (normal) */ -#endif - { ZT_SIG_FXSKS, ZT_BBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, 0 }, /* FXS Kewlstart */ - { ZT_SIG_FXOLS, ZT_BBIT | ZT_DBIT, ZT_BBIT | ZT_DBIT, 0, 0 }, /* FXO Loopstart */ - { ZT_SIG_FXOGS, ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_BBIT | ZT_DBIT, 0, 0 }, /* FXO Groundstart */ - { ZT_SIG_FXOKS, ZT_BBIT | ZT_DBIT, ZT_BBIT | ZT_DBIT, 0, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT }, /* FXO Kewlstart */ - { ZT_SIG_SF, ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_CBIT | ZT_DBIT, - ZT_BBIT | ZT_CBIT | ZT_DBIT }, /* no signalling */ - { ZT_SIG_EM_E1, ZT_DBIT, ZT_ABIT | ZT_BBIT | ZT_DBIT, - ZT_ABIT | ZT_BBIT | ZT_DBIT, ZT_DBIT }, /* E and M E1 */ - } ; - int x; - - /* if no span, return doing nothing */ - if (!chan->span) return; - if (!chan->span->flags & ZT_FLAG_RBS) { - printk("zt_rbs: Tried to set RBS hook state on non-RBS channel %s\n", chan->name); - return; - } - if ((txsig > 3) || (txsig < 0)) { - printk("zt_rbs: Tried to set RBS hook state %d (> 3) on channel %s\n", txsig, chan->name); - return; - } - if (!chan->span->rbsbits && !chan->span->hooksig) { - printk("zt_rbs: Tried to set RBS hook state %d on channel %s while span %s lacks rbsbits or hooksig function\n", - txsig, chan->name, chan->span->name); - return; - } - /* Don't do anything for RBS */ - if (chan->sig == ZT_SIG_DACS_RBS) - return; - chan->txstate = txstate; - - /* if tone signalling */ - if (chan->sig == ZT_SIG_SF) - { - chan->txhooksig = txsig; - if (chan->txtone) /* if set to make tone for tx */ - { - if ((txsig && !(chan->toneflags & ZT_REVERSE_TXTONE)) || - ((!txsig) && (chan->toneflags & ZT_REVERSE_TXTONE))) - { - set_txtone(chan,chan->txtone,chan->tx_v2,chan->tx_v3); - } - else - { - set_txtone(chan,0,0,0); - } - } - chan->otimer = timeout * ZT_CHUNKSIZE; /* Otimer is timer in samples */ - return; - } - if (chan->span->hooksig) { - if (chan->txhooksig != txsig) { - chan->txhooksig = txsig; - chan->span->hooksig(chan, txsig); - } - chan->otimer = timeout * ZT_CHUNKSIZE; /* Otimer is timer in samples */ - return; - } else { - for (x=0;xsig) { -#ifdef CONFIG_ZAPATA_DEBUG - printk("Setting bits to %d for channel %s state %d in %d signalling\n", outs[x][txsig + 1], chan->name, txsig, chan->sig); -#endif - chan->txhooksig = txsig; - chan->txsig = outs[x][txsig+1]; - chan->span->rbsbits(chan, chan->txsig); - chan->otimer = timeout * ZT_CHUNKSIZE; /* Otimer is timer in samples */ - return; - } - } - } - printk("zt_rbs: Don't know RBS signalling type %d on channel %s\n", chan->sig, chan->name); -} - -static int zt_cas_setbits(struct zt_chan *chan, int bits) -{ - /* if no span, return as error */ - if (!chan->span) return -1; - if (chan->span->rbsbits) { - chan->txsig = bits; - chan->span->rbsbits(chan, bits); - } else { - printk("Huh? CAS setbits, but no RBS bits function\n"); - } - return 0; -} - -static int zt_hangup(struct zt_chan *chan) -{ - int x,res=0; - - /* Can't hangup pseudo channels */ - if (!chan->span) - return 0; - /* Can't hang up a clear channel */ - if (chan->flags & (ZT_FLAG_CLEAR | ZT_FLAG_NOSTDTXRX)) - return -EINVAL; - - chan->kewlonhook = 0; - - - if ((chan->sig == ZT_SIG_FXSLS) || (chan->sig == ZT_SIG_FXSKS) || - (chan->sig == ZT_SIG_FXSGS)) chan->ringdebtimer = RING_DEBOUNCE_TIME; - - if (chan->span->flags & ZT_FLAG_RBS) { - if (chan->sig == ZT_SIG_CAS) { - zt_cas_setbits(chan, chan->idlebits); - } else if ((chan->sig == ZT_SIG_FXOKS) && (chan->txstate != ZT_TXSTATE_ONHOOK) - /* if other party is already on-hook we shouldn't do any battery drop */ - && !((chan->rxhooksig == ZT_RXSIG_ONHOOK) && (chan->itimer <= 0))) { - /* Do RBS signalling on the channel's behalf */ - zt_rbs_sethook(chan, ZT_TXSIG_KEWL, ZT_TXSTATE_KEWL, ZT_KEWLTIME); - } else - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_ONHOOK, 0); - } else { - /* Let the driver hang up the line if it wants to */ - if (chan->span->sethook) { - if (chan->txhooksig != ZT_ONHOOK) { - chan->txhooksig = ZT_ONHOOK; - res = chan->span->sethook(chan, ZT_ONHOOK); - } else - res = 0; - } - } - /* if not registered yet, just return here */ - if (!(chan->flags & ZT_FLAG_REGISTERED)) return res; - /* Mark all buffers as empty */ - for (x = 0;x < chan->numbufs;x++) { - chan->writen[x] = - chan->writeidx[x]= - chan->readn[x]= - chan->readidx[x] = 0; - } - if (chan->readbuf[0]) { - chan->inreadbuf = 0; - chan->inwritebuf = 0; - } else { - chan->inreadbuf = -1; - chan->inwritebuf = -1; - } - chan->outreadbuf = -1; - chan->outwritebuf = -1; - chan->dialing = 0; - chan->afterdialingtimer = 0; - chan->curtone = NULL; - chan->pdialcount = 0; - chan->cadencepos = 0; - chan->txdialbuf[0] = 0; - return res; -} - -static int initialize_channel(struct zt_chan *chan) -{ - int res; - unsigned long flags; - void *rxgain=NULL; - struct echo_can_state *ec=NULL; - if ((res = zt_reallocbufs(chan, ZT_DEFAULT_BLOCKSIZE, ZT_DEFAULT_NUM_BUFS))) - return res; - - spin_lock_irqsave(&chan->lock, flags); - - chan->rxbufpolicy = ZT_POLICY_IMMEDIATE; - chan->txbufpolicy = ZT_POLICY_IMMEDIATE; - - /* Free up the echo canceller if there is one */ - ec = chan->ec; - chan->ec = NULL; - chan->echocancel = 0; - chan->echostate = ECHO_STATE_IDLE; - chan->echolastupdate = 0; - chan->echotimer = 0; - - chan->txdisable = 0; - chan->rxdisable = 0; - - chan->digitmode = DIGIT_MODE_DTMF; - chan->dialing = 0; - chan->afterdialingtimer = 0; - - chan->cadencepos = 0; - chan->firstcadencepos = 0; /* By default loop back to first cadence position */ - - /* HDLC & FCS stuff */ - fasthdlc_init(&chan->rxhdlc); - fasthdlc_init(&chan->txhdlc); - chan->infcs = PPP_INITFCS; - - /* Timings for RBS */ - chan->prewinktime = ZT_DEFAULT_PREWINKTIME; - chan->preflashtime = ZT_DEFAULT_PREFLASHTIME; - chan->winktime = ZT_DEFAULT_WINKTIME; - chan->flashtime = ZT_DEFAULT_FLASHTIME; - - if (chan->sig & __ZT_SIG_FXO) - chan->starttime = ZT_DEFAULT_RINGTIME; - else - chan->starttime = ZT_DEFAULT_STARTTIME; - chan->rxwinktime = ZT_DEFAULT_RXWINKTIME; - chan->rxflashtime = ZT_DEFAULT_RXFLASHTIME; - chan->debouncetime = ZT_DEFAULT_DEBOUNCETIME; - chan->pulsemaketime = ZT_DEFAULT_PULSEMAKETIME; - chan->pulsebreaktime = ZT_DEFAULT_PULSEBREAKTIME; - chan->pulseaftertime = ZT_DEFAULT_PULSEAFTERTIME; - - /* Initialize RBS timers */ - chan->itimerset = chan->itimer = chan->otimer = 0; - chan->ringdebtimer = 0; - - init_waitqueue_head(&chan->sel); - init_waitqueue_head(&chan->readbufq); - init_waitqueue_head(&chan->writebufq); - init_waitqueue_head(&chan->eventbufq); - init_waitqueue_head(&chan->txstateq); - - /* Reset conferences */ - reset_conf(chan); - - /* I/O Mask, etc */ - chan->iomask = 0; - /* release conference resource if any */ - if (chan->confna) zt_check_conf(chan->confna); - if ((chan->sig & __ZT_SIG_DACS) != __ZT_SIG_DACS) { - chan->confna = 0; - chan->confmode = 0; - if (chan->span && chan->span->dacs) - chan->span->dacs(chan, NULL); - } - chan->_confn = 0; - memset(chan->conflast, 0, sizeof(chan->conflast)); - memset(chan->conflast1, 0, sizeof(chan->conflast1)); - memset(chan->conflast2, 0, sizeof(chan->conflast2)); - chan->confmute = 0; - chan->gotgs = 0; - chan->curtone = NULL; - chan->tonep = 0; - chan->pdialcount = 0; - if (chan->gainalloc && chan->rxgain) - rxgain = chan->rxgain; - chan->rxgain = defgain; - chan->txgain = defgain; - chan->gainalloc = 0; - chan->eventinidx = chan->eventoutidx = 0; - zt_set_law(chan,0); - zt_hangup(chan); - - /* Make sure that the audio flag is cleared on a clear channel */ - if ((chan->sig & ZT_SIG_CLEAR) || (chan->sig & ZT_SIG_HARDHDLC)) - chan->flags &= ~ZT_FLAG_AUDIO; - - if ((chan->sig == ZT_SIG_CLEAR) || (chan->sig == ZT_SIG_HARDHDLC)) - chan->flags &= ~(ZT_FLAG_PPP | ZT_FLAG_FCS | ZT_FLAG_HDLC); - - chan->flags &= ~ZT_FLAG_LINEAR; - if (chan->curzone) { - /* Take cadence from tone zone */ - memcpy(chan->ringcadence, chan->curzone->ringcadence, sizeof(chan->ringcadence)); - } else { - /* Do a default */ - memset(chan->ringcadence, 0, sizeof(chan->ringcadence)); - chan->ringcadence[0] = chan->starttime; - chan->ringcadence[1] = ZT_RINGOFFTIME; - } - - spin_unlock_irqrestore(&chan->lock, flags); - set_tone_zone(chan, -1); - - hw_echocancel_off(chan); - - if (rxgain) - kfree(rxgain); - if (ec) - echo_can_free(ec); - return 0; -} - -static int zt_timing_open(struct inode *inode, struct file *file) -{ - struct zt_timer *t; - unsigned long flags; - t = kmalloc(sizeof(struct zt_timer), GFP_KERNEL); - if (!t) - return -ENOMEM; - /* Allocate a new timer */ - memset(t, 0, sizeof(struct zt_timer)); - init_waitqueue_head(&t->sel); - file->private_data = t; -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#endif - spin_lock_irqsave(&zaptimerlock, flags); - t->next = zaptimers; - zaptimers = t; - spin_unlock_irqrestore(&zaptimerlock, flags); - return 0; -} - -static int zt_timer_release(struct inode *inode, struct file *file) -{ - struct zt_timer *t, *cur, *prev; - unsigned long flags; - t = file->private_data; - if (t) { - spin_lock_irqsave(&zaptimerlock, flags); - prev = NULL; - cur = zaptimers; - while(cur) { - if (t == cur) - break; - prev = cur; - cur = cur->next; - } - if (cur) { - if (prev) - prev->next = cur->next; - else - zaptimers = cur->next; - } - spin_unlock_irqrestore(&zaptimerlock, flags); - if (!cur) { - printk("Zap Timer: Not on list??\n"); - return 0; - } - kfree(t); -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - } - return 0; -} - -static int zt_specchan_open(struct inode *inode, struct file *file, int unit, int inc) -{ - int res = 0; - - if (chans[unit] && chans[unit]->sig) { - /* Make sure we're not already open, a net device, or a slave device */ - if (chans[unit]->flags & ZT_FLAG_NETDEV) - res = -EBUSY; - else if (chans[unit]->master != chans[unit]) - res = -EBUSY; - else if ((chans[unit]->sig & __ZT_SIG_DACS) == __ZT_SIG_DACS) - res = -EBUSY; - else if (!test_and_set_bit(ZT_FLAGBIT_OPEN, &chans[unit]->flags)) { - unsigned long flags; - res = initialize_channel(chans[unit]); - if (res) { - /* Reallocbufs must have failed */ - clear_bit(ZT_FLAGBIT_OPEN, &chans[unit]->flags); - return res; - } - spin_lock_irqsave(&chans[unit]->lock, flags); - if (chans[unit]->flags & ZT_FLAG_PSEUDO) - chans[unit]->flags |= ZT_FLAG_AUDIO; - if (chans[unit]->span && chans[unit]->span->open) { - res = chans[unit]->span->open(chans[unit]); - } - if (!res) { - chans[unit]->file = file; -#ifndef LINUX26 - if (inc) - MOD_INC_USE_COUNT; -#endif - spin_unlock_irqrestore(&chans[unit]->lock, flags); - } else { - spin_unlock_irqrestore(&chans[unit]->lock, flags); - close_channel(chans[unit]); - clear_bit(ZT_FLAGBIT_OPEN, &chans[unit]->flags); - } - } else - res = -EBUSY; - } else - res = -ENXIO; - return res; -} - -static int zt_specchan_release(struct inode *node, struct file *file, int unit) -{ - int res=0; - unsigned long flags; - - if (chans[unit]) { - /* Chan lock protects contents against potentially non atomic accesses. - * So if the pointer setting is not atomic, we should protect */ - spin_lock_irqsave(&chans[unit]->lock, flags); - chans[unit]->file = NULL; - spin_unlock_irqrestore(&chans[unit]->lock, flags); - close_channel(chans[unit]); - if (chans[unit]->span && chans[unit]->span->close) - res = chans[unit]->span->close(chans[unit]); - - /* The channel might be destroyed on close: */ - if (chans[unit]) - clear_bit(ZT_FLAGBIT_OPEN, &chans[unit]->flags); - } else - res = -ENXIO; -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#endif - return res; -} - -static struct zt_chan *zt_alloc_pseudo(void) -{ - struct zt_chan *pseudo; - unsigned long flags; - /* Don't allow /dev/zap/pseudo to open if there are no spans */ - if (maxspans < 1) - return NULL; - pseudo = kmalloc(sizeof(struct zt_chan), GFP_KERNEL); - if (!pseudo) - return NULL; - memset(pseudo, 0, sizeof(struct zt_chan)); - pseudo->sig = ZT_SIG_CLEAR; - pseudo->sigcap = ZT_SIG_CLEAR; - pseudo->flags = ZT_FLAG_PSEUDO | ZT_FLAG_AUDIO; - spin_lock_irqsave(&bigzaplock, flags); - if (zt_chan_reg(pseudo)) { - kfree(pseudo); - pseudo = NULL; - } else - sprintf(pseudo->name, "Pseudo/%d", pseudo->channo); - spin_unlock_irqrestore(&bigzaplock, flags); - return pseudo; -} - -static void zt_free_pseudo(struct zt_chan *pseudo) -{ - unsigned long flags; - if (pseudo) { - spin_lock_irqsave(&bigzaplock, flags); - zt_chan_unreg(pseudo); - spin_unlock_irqrestore(&bigzaplock, flags); - kfree(pseudo); - } -} - -static int zt_open(struct inode *inode, struct file *file) -{ - int unit = UNIT(file); - - struct zt_chan *chan; - /* Minor 0: Special "control" descriptor */ - if (!unit) - return zt_ctl_open(inode, file); - if (unit == 250) { - if (!zt_transcode_fops) - if (request_module("zttranscode")) { - return -ENXIO; - } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - __MOD_INC_USE_COUNT (zt_transcode_fops->owner); -#else - if (!try_module_get(zt_transcode_fops->owner)) { - return -ENXIO; - } -#endif - if (zt_transcode_fops && zt_transcode_fops->open) { - return zt_transcode_fops->open(inode, file); - } else { - /* zttranscode module should have exported a - * file_operations table. */ - WARN_ON(1); - } - return -ENXIO; - } - if (unit == 253) { - if (maxspans) { - return zt_timing_open(inode, file); - } else { - return -ENXIO; - } - } - if (unit == 254) - return zt_chan_open(inode, file); - if (unit == 255) { - if (maxspans) { - chan = zt_alloc_pseudo(); - if (chan) { - file->private_data = chan; - return zt_specchan_open(inode, file, chan->channo, 1); - } else { - return -ENXIO; - } - } else - return -ENXIO; - } - return zt_specchan_open(inode, file, unit, 1); -} - -#if 0 -static int zt_open(struct inode *inode, struct file *file) -{ - int res; - unsigned long flags; - spin_lock_irqsave(&bigzaplock, flags); - res = __zt_open(inode, file); - spin_unlock_irqrestore(&bigzaplock, flags); - return res; -} -#endif - -static ssize_t zt_read(struct file *file, char *usrbuf, size_t count, loff_t *ppos) -{ - int unit = UNIT(file); - struct zt_chan *chan; - - /* Can't read from control */ - if (!unit) { - return -EINVAL; - } - - if (unit == 253) - return -EINVAL; - - if (unit == 254) { - chan = file->private_data; - if (!chan) - return -EINVAL; - return zt_chan_read(file, usrbuf, count, chan->channo); - } - - if (unit == 255) { - chan = file->private_data; - if (!chan) { - printk("No pseudo channel structure to read?\n"); - return -EINVAL; - } - return zt_chan_read(file, usrbuf, count, chan->channo); - } - if (count < 0) - return -EINVAL; - - return zt_chan_read(file, usrbuf, count, unit); -} - -static ssize_t zt_write(struct file *file, const char *usrbuf, size_t count, loff_t *ppos) -{ - int unit = UNIT(file); - struct zt_chan *chan; - /* Can't read from control */ - if (!unit) - return -EINVAL; - if (count < 0) - return -EINVAL; - if (unit == 253) - return -EINVAL; - if (unit == 254) { - chan = file->private_data; - if (!chan) - return -EINVAL; - return zt_chan_write(file, usrbuf, count, chan->channo); - } - if (unit == 255) { - chan = file->private_data; - if (!chan) { - printk("No pseudo channel structure to read?\n"); - return -EINVAL; - } - return zt_chan_write(file, usrbuf, count, chan->channo); - } - return zt_chan_write(file, usrbuf, count, unit); - -} - -static int zt_set_default_zone(int defzone) -{ - if ((defzone < 0) || (defzone >= ZT_TONE_ZONE_MAX)) - return -EINVAL; - write_lock(&zone_lock); - if (!tone_zones[defzone]) { - write_unlock(&zone_lock); - return -EINVAL; - } - if ((default_zone != -1) && tone_zones[default_zone]) - atomic_dec(&tone_zones[default_zone]->refcount); - atomic_inc(&tone_zones[defzone]->refcount); - default_zone = defzone; - write_unlock(&zone_lock); - return 0; -} - -/* No bigger than 32k for everything per tone zone */ -#define MAX_SIZE 32768 -/* No more than 128 subtones */ -#define MAX_TONES 128 - -/* The tones to be loaded can (will) be a mix of regular tones, - DTMF tones and MF tones. We need to load DTMF and MF tones - a bit differently than regular tones because their storage - format is much simpler (an array structure field of the zone - structure, rather an array of pointers). -*/ -static int ioctl_load_zone(unsigned long data) -{ - struct zt_tone *samples[MAX_TONES] = { NULL, }; - short next[MAX_TONES] = { 0, }; - struct zt_tone_def_header th; - struct zt_tone_def td; - struct zt_zone *z; - struct zt_tone *t; - void *slab, *ptr; - int x; - size_t space; - size_t size; - int res; - - if (copy_from_user(&th, (struct zt_tone_def_header *) data, sizeof(th))) - return -EFAULT; - - data += sizeof(th); - - if ((th.count < 0) || (th.count > MAX_TONES)) { - printk("Too many tones included\n"); - return -EINVAL; - } - - space = size = sizeof(*z) + th.count * sizeof(*t); - - if (size > MAX_SIZE) - return -E2BIG; - - if (!(z = ptr = slab = kmalloc(size, GFP_KERNEL))) - return -ENOMEM; - - memset(slab, 0, size); - - ptr += sizeof(*z); - space -= sizeof(*z); - - zap_copy_string(z->name, th.name, sizeof(z->name)); - - for (x = 0; x < ZT_MAX_CADENCE; x++) - z->ringcadence[x] = th.ringcadence[x]; - - atomic_set(&z->refcount, 0); - - for (x = 0; x < th.count; x++) { - enum { - REGULAR_TONE, - DTMF_TONE, - MFR1_TONE, - MFR2_FWD_TONE, - MFR2_REV_TONE, - } tone_type; - - if (space < sizeof(*t)) { - kfree(slab); - printk("Insufficient tone zone space\n"); - return -EINVAL; - } - - if (copy_from_user(&td, (struct zt_tone_def *) data, sizeof(td))) { - kfree(slab); - return -EFAULT; - } - - data += sizeof(td); - - if ((td.tone >= 0) && (td.tone < ZT_TONE_MAX)) { - tone_type = REGULAR_TONE; - - t = samples[x] = ptr; - - space -= sizeof(*t); - ptr += sizeof(*t); - - /* Remember which sample is next */ - next[x] = td.next; - - /* Make sure the "next" one is sane */ - if ((next[x] >= th.count) || (next[x] < 0)) { - printk("Invalid 'next' pointer: %d\n", next[x]); - kfree(slab); - return -EINVAL; - } - } else if ((td.tone >= ZT_TONE_DTMF_BASE) && - (td.tone <= ZT_TONE_DTMF_MAX)) { - tone_type = DTMF_TONE; - td.tone -= ZT_TONE_DTMF_BASE; - t = &z->dtmf[td.tone]; - } else if ((td.tone >= ZT_TONE_MFR1_BASE) && - (td.tone <= ZT_TONE_MFR1_MAX)) { - tone_type = MFR1_TONE; - td.tone -= ZT_TONE_MFR1_BASE; - t = &z->mfr1[td.tone]; - } else if ((td.tone >= ZT_TONE_MFR2_FWD_BASE) && - (td.tone <= ZT_TONE_MFR2_FWD_MAX)) { - tone_type = MFR2_FWD_TONE; - td.tone -= ZT_TONE_MFR2_FWD_BASE; - t = &z->mfr2_fwd[td.tone]; - } else if ((td.tone >= ZT_TONE_MFR2_REV_BASE) && - (td.tone <= ZT_TONE_MFR2_REV_MAX)) { - tone_type = MFR2_REV_TONE; - td.tone -= ZT_TONE_MFR2_REV_BASE; - t = &z->mfr2_rev[td.tone]; - } else { - printk("Invalid tone (%d) defined\n", td.tone); - kfree(slab); - return -EINVAL; - } - - t->fac1 = td.fac1; - t->init_v2_1 = td.init_v2_1; - t->init_v3_1 = td.init_v3_1; - t->fac2 = td.fac2; - t->init_v2_2 = td.init_v2_2; - t->init_v3_2 = td.init_v3_2; - t->modulate = td.modulate; - - switch (tone_type) { - case REGULAR_TONE: - t->tonesamples = td.samples; - if (!z->tones[td.tone]) - z->tones[td.tone] = t; - break; - case DTMF_TONE: - t->tonesamples = global_dialparams.dtmf_tonelen; - t->next = &dtmf_silence; - z->dtmf_continuous[td.tone] = *t; - z->dtmf_continuous[td.tone].next = &z->dtmf_continuous[td.tone]; - break; - case MFR1_TONE: - switch (td.tone + ZT_TONE_MFR1_BASE) { - case ZT_TONE_MFR1_KP: - case ZT_TONE_MFR1_ST: - case ZT_TONE_MFR1_STP: - case ZT_TONE_MFR1_ST2P: - case ZT_TONE_MFR1_ST3P: - /* signaling control tones are always 100ms */ - t->tonesamples = 100 * ZT_CHUNKSIZE; - break; - default: - t->tonesamples = global_dialparams.mfv1_tonelen; - break; - } - t->next = &mfr1_silence; - break; - case MFR2_FWD_TONE: - t->tonesamples = global_dialparams.mfr2_tonelen; - t->next = &dtmf_silence; - z->mfr2_fwd_continuous[td.tone] = *t; - z->mfr2_fwd_continuous[td.tone].next = &z->mfr2_fwd_continuous[td.tone]; - break; - case MFR2_REV_TONE: - t->tonesamples = global_dialparams.mfr2_tonelen; - t->next = &dtmf_silence; - z->mfr2_rev_continuous[td.tone] = *t; - z->mfr2_rev_continuous[td.tone].next = &z->mfr2_rev_continuous[td.tone]; - break; - } - } - - for (x = 0; x < th.count; x++) { - if (samples[x]) - samples[x]->next = samples[next[x]]; - } - - if ((res = zt_register_tone_zone(th.zone, z))) { - kfree(slab); - } else { - if ( -1 == default_zone ) { - zt_set_default_zone(th.zone); - } - } - - return res; -} - -void zt_init_tone_state(struct zt_tone_state *ts, struct zt_tone *zt) -{ - ts->v1_1 = 0; - ts->v2_1 = zt->init_v2_1; - ts->v3_1 = zt->init_v3_1; - ts->v1_2 = 0; - ts->v2_2 = zt->init_v2_2; - ts->v3_2 = zt->init_v3_2; - ts->modulate = zt->modulate; -} - -struct zt_tone *zt_mf_tone(const struct zt_chan *chan, char digit, int digitmode) -{ - unsigned int tone_index; - - if (!chan->curzone) { - static int __warnonce = 1; - if (__warnonce) { - __warnonce = 0; - /* The tonezones are loaded by ztcfg based on /etc/zaptel.conf. */ - printk(KERN_WARNING "zaptel: Cannot get dtmf tone until tone zone is loaded.\n"); - } - return NULL; - } - - switch (digitmode) { - case DIGIT_MODE_DTMF: - switch (digit) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - tone_index = ZT_TONE_DTMF_0 + (digit - '0'); - break; - case '*': - tone_index = ZT_TONE_DTMF_s; - break; - case '#': - tone_index = ZT_TONE_DTMF_p; - break; - case 'A': - case 'B': - case 'C': - case 'D': - tone_index = ZT_TONE_DTMF_A + (digit - 'A'); - case 'W': - return &tone_pause; - default: - return NULL; - } - return &chan->curzone->dtmf[tone_index - ZT_TONE_DTMF_BASE]; - case DIGIT_MODE_MFR1: - switch (digit) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - tone_index = ZT_TONE_MFR1_0 + (digit - '0'); - break; - case '*': - tone_index = ZT_TONE_MFR1_KP; - break; - case '#': - tone_index = ZT_TONE_MFR1_ST; - break; - case 'A': - tone_index = ZT_TONE_MFR1_STP; - break; - case 'B': - tone_index = ZT_TONE_MFR1_ST2P; - break; - case 'C': - tone_index = ZT_TONE_MFR1_ST3P; - break; - case 'W': - return &tone_pause; - default: - return NULL; - } - return &chan->curzone->mfr1[tone_index - ZT_TONE_MFR1_BASE]; - case DIGIT_MODE_MFR2_FWD: - switch (digit) { - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - tone_index = ZT_TONE_MFR2_FWD_1 + (digit - '1'); - break; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - tone_index = ZT_TONE_MFR2_FWD_10 + (digit - 'A'); - break; - case 'W': - return &tone_pause; - default: - return NULL; - } - return &chan->curzone->mfr2_fwd[tone_index - ZT_TONE_MFR2_FWD_BASE]; - case DIGIT_MODE_MFR2_REV: - switch (digit) { - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - tone_index = ZT_TONE_MFR2_REV_1 + (digit - '1'); - break; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - tone_index = ZT_TONE_MFR2_REV_10 + (digit - 'A'); - break; - case 'W': - return &tone_pause; - default: - return NULL; - } - return &chan->curzone->mfr2_rev[tone_index - ZT_TONE_MFR2_REV_BASE]; - default: - return NULL; - } -} - -static void __do_dtmf(struct zt_chan *chan) -{ - char c; - - /* Called with chan->lock held */ - while ((c = chan->txdialbuf[0])) { - memmove(chan->txdialbuf, chan->txdialbuf + 1, sizeof(chan->txdialbuf) - 1); - switch (c) { - case 'T': - chan->digitmode = DIGIT_MODE_DTMF; - chan->tonep = 0; - break; - case 'M': - chan->digitmode = DIGIT_MODE_MFR1; - chan->tonep = 0; - break; - case 'O': - chan->digitmode = DIGIT_MODE_MFR2_FWD; - chan->tonep = 0; - break; - case 'R': - chan->digitmode = DIGIT_MODE_MFR2_REV; - chan->tonep = 0; - break; - case 'P': - chan->digitmode = DIGIT_MODE_PULSE; - chan->tonep = 0; - break; - default: - if ((c != 'W') && (chan->digitmode == DIGIT_MODE_PULSE)) { - if ((c >= '0') && (c <= '9') && (chan->txhooksig == ZT_TXSIG_OFFHOOK)) { - chan->pdialcount = (c == '0') ? 10 : c - '0'; - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_PULSEBREAK, - chan->pulsebreaktime); - return; - } - } else { - chan->curtone = zt_mf_tone(chan, c, chan->digitmode); - chan->tonep = 0; - if (chan->curtone) { - zt_init_tone_state(&chan->ts, chan->curtone); - return; - } - } - } - } - - /* Notify userspace process if there is nothing left */ - chan->dialing = 0; - __qevent(chan, ZT_EVENT_DIALCOMPLETE); -} - -static int zt_release(struct inode *inode, struct file *file) -{ - int unit = UNIT(file); - int res; - struct zt_chan *chan; - - if (!unit) - return zt_ctl_release(inode, file); - if (unit == 253) { - return zt_timer_release(inode, file); - } - if (unit == 250) { - /* We should not be here because the zttranscode.ko module - * should have updated the file_operations for this file - * handle when the file was opened. */ - WARN_ON(1); - return -EFAULT; - } - if (unit == 254) { - chan = file->private_data; - if (!chan) - return zt_chan_release(inode, file); - else - return zt_specchan_release(inode, file, chan->channo); - } - if (unit == 255) { - chan = file->private_data; - if (chan) { - res = zt_specchan_release(inode, file, chan->channo); - zt_free_pseudo(chan); - } else { - printk("Pseudo release and no private data??\n"); - res = 0; - } - return res; - } - return zt_specchan_release(inode, file, unit); -} - -#if 0 -static int zt_release(struct inode *inode, struct file *file) -{ - /* Lock the big zap lock when handling a release */ - unsigned long flags; - int res; - spin_lock_irqsave(&bigzaplock, flags); - res = __zt_release(inode, file); - spin_unlock_irqrestore(&bigzaplock, flags); - return res; -} -#endif - - -void zt_alarm_channel(struct zt_chan *chan, int alarms) -{ - unsigned long flags; - - spin_lock_irqsave(&chan->lock, flags); - if (chan->chan_alarms != alarms) { - chan->chan_alarms = alarms; - zt_qevent_nolock(chan, alarms ? ZT_EVENT_ALARM : ZT_EVENT_NOALARM); - } - spin_unlock_irqrestore(&chan->lock, flags); -} - -void zt_alarm_notify(struct zt_span *span) -{ - int x; - - span->alarms &= ~ZT_ALARM_LOOPBACK; - /* Determine maint status */ - if (span->maintstat || span->mainttimer) - span->alarms |= ZT_ALARM_LOOPBACK; - /* DON'T CHANGE THIS AGAIN. THIS WAS DONE FOR A REASON. - The expression (a != b) does *NOT* do the same thing - as ((!a) != (!b)) */ - /* if change in general state */ - if ((!span->alarms) != (!span->lastalarms)) { - span->lastalarms = span->alarms; - for (x = 0; x < span->channels; x++) - zt_alarm_channel(&span->chans[x], span->alarms); - /* Switch to other master if current master in alarm */ - for (x=1; xalarms && (spans[x]->flags & ZT_FLAG_RUNNING)) { - if(master != spans[x]) - printk("Zaptel: Master changed to %s\n", spans[x]->name); - master = spans[x]; - break; - } - } - } -} - -#define VALID_SPAN(j) do { \ - if ((j >= ZT_MAX_SPANS) || (j < 1)) \ - return -EINVAL; \ - if (!spans[j]) \ - return -ENXIO; \ -} while(0) - -#define CHECK_VALID_SPAN(j) do { \ - /* Start a given span */ \ - if (get_user(j, (int *)data)) \ - return -EFAULT; \ - VALID_SPAN(j); \ -} while(0) - -#define VALID_CHANNEL(j) do { \ - if ((j >= ZT_MAX_CHANNELS) || (j < 1)) \ - return -EINVAL; \ - if (!chans[j]) \ - return -ENXIO; \ -} while(0) - -static int zt_timer_ioctl(struct inode *node, struct file *file, unsigned int cmd, unsigned long data, struct zt_timer *timer) -{ - int j; - unsigned long flags; - switch(cmd) { - case ZT_TIMERCONFIG: - get_user(j, (int *)data); - if (j < 0) - j = 0; - spin_lock_irqsave(&zaptimerlock, flags); - timer->ms = timer->pos = j; - spin_unlock_irqrestore(&zaptimerlock, flags); - break; - case ZT_TIMERACK: - get_user(j, (int *)data); - spin_lock_irqsave(&zaptimerlock, flags); - if ((j < 1) || (j > timer->tripped)) - j = timer->tripped; - timer->tripped -= j; - spin_unlock_irqrestore(&zaptimerlock, flags); - break; - case ZT_GETEVENT: /* Get event on queue */ - j = ZT_EVENT_NONE; - spin_lock_irqsave(&zaptimerlock, flags); - /* set up for no event */ - if (timer->tripped) - j = ZT_EVENT_TIMER_EXPIRED; - if (timer->ping) - j = ZT_EVENT_TIMER_PING; - spin_unlock_irqrestore(&zaptimerlock, flags); - put_user(j,(int *)data); - break; - case ZT_TIMERPING: - spin_lock_irqsave(&zaptimerlock, flags); - timer->ping = 1; - wake_up_interruptible(&timer->sel); - spin_unlock_irqrestore(&zaptimerlock, flags); - break; - case ZT_TIMERPONG: - spin_lock_irqsave(&zaptimerlock, flags); - timer->ping = 0; - spin_unlock_irqrestore(&zaptimerlock, flags); - break; - default: - return -ENOTTY; - } - return 0; -} - -static int zt_common_ioctl(struct inode *node, struct file *file, unsigned int cmd, unsigned long data, int unit) -{ - union { - struct zt_gains gain; - struct zt_spaninfo spaninfo; - struct zt_params param; - } stack; - struct zt_chan *chan; - unsigned long flags; - unsigned char *txgain, *rxgain; - struct zt_chan *mychan; - int i,j; - int return_master = 0; - size_t size_to_copy; - - switch(cmd) { - /* get channel parameters */ - case ZT_GET_PARAMS_V1: - case ZT_GET_PARAMS: - size_to_copy = (cmd == ZT_GET_PARAMS_V1) ? sizeof(struct zt_params_v1) : - sizeof(struct zt_params); - if (copy_from_user(&stack.param, (struct zt_params *) data, size_to_copy)) - return -EFAULT; - - /* check to see if the caller wants to receive our master channel number */ - if (stack.param.channo & ZT_GET_PARAMS_RETURN_MASTER) { - return_master = 1; - stack.param.channo &= ~ZT_GET_PARAMS_RETURN_MASTER; - } - - /* Pick the right channo's */ - if (!stack.param.channo || unit) { - stack.param.channo = unit; - } - /* Check validity of channel */ - VALID_CHANNEL(stack.param.channo); - chan = chans[stack.param.channo]; - - /* point to relevant structure */ - stack.param.sigtype = chan->sig; /* get signalling type */ - /* return non-zero if rx not in idle state */ - if (chan->span) { - j = zt_q_sig(chan); - if (j >= 0) { /* if returned with success */ - stack.param.rxisoffhook = ((chan->rxsig & (j >> 8)) != (j & 0xff)); - } else { - stack.param.rxisoffhook = ((chan->rxhooksig != ZT_RXSIG_ONHOOK) && - (chan->rxhooksig != ZT_RXSIG_INITIAL)); - } - } else if ((chan->txstate == ZT_TXSTATE_KEWL) || (chan->txstate == ZT_TXSTATE_AFTERKEWL)) - stack.param.rxisoffhook = 1; - else - stack.param.rxisoffhook = 0; - if (chan->span && chan->span->rbsbits && !(chan->sig & ZT_SIG_CLEAR)) { - stack.param.rxbits = chan->rxsig; - stack.param.txbits = chan->txsig; - stack.param.idlebits = chan->idlebits; - } else { - stack.param.rxbits = -1; - stack.param.txbits = -1; - stack.param.idlebits = 0; - } - if (chan->span && (chan->span->rbsbits || chan->span->hooksig) && - !(chan->sig & ZT_SIG_CLEAR)) { - stack.param.rxhooksig = chan->rxhooksig; - stack.param.txhooksig = chan->txhooksig; - } else { - stack.param.rxhooksig = -1; - stack.param.txhooksig = -1; - } - stack.param.prewinktime = chan->prewinktime; - stack.param.preflashtime = chan->preflashtime; - stack.param.winktime = chan->winktime; - stack.param.flashtime = chan->flashtime; - stack.param.starttime = chan->starttime; - stack.param.rxwinktime = chan->rxwinktime; - stack.param.rxflashtime = chan->rxflashtime; - stack.param.debouncetime = chan->debouncetime; - stack.param.channo = chan->channo; - stack.param.chan_alarms = chan->chan_alarms; - - /* if requested, put the master channel number in the top 16 bits of the result */ - if (return_master) - stack.param.channo |= chan->master->channo << 16; - - stack.param.pulsemaketime = chan->pulsemaketime; - stack.param.pulsebreaktime = chan->pulsebreaktime; - stack.param.pulseaftertime = chan->pulseaftertime; - if (chan->span) stack.param.spanno = chan->span->spanno; - else stack.param.spanno = 0; - zap_copy_string(stack.param.name, chan->name, sizeof(stack.param.name)); - stack.param.chanpos = chan->chanpos; - stack.param.sigcap = chan->sigcap; - /* Return current law */ - if (chan->xlaw == __zt_alaw) - stack.param.curlaw = ZT_LAW_ALAW; - else - stack.param.curlaw = ZT_LAW_MULAW; - - if (copy_to_user((struct zt_params *) data, &stack.param, size_to_copy)) - return -EFAULT; - - break; - /* set channel parameters */ - case ZT_SET_PARAMS_V1: - case ZT_SET_PARAMS: - /* The difference between zt_params and zt_params_v1 is just the - * last field, which is read-only anyway. Thus we just read the - * size of the older struct. - */ - if (copy_from_user(&stack.param, (struct zt_params *) data, sizeof(struct zt_params_v1))) - return -EFAULT; - - stack.param.chan_alarms = 0; /* be explicit about the above */ - - /* Pick the right channo's */ - if (!stack.param.channo || unit) { - stack.param.channo = unit; - } - /* Check validity of channel */ - VALID_CHANNEL(stack.param.channo); - chan = chans[stack.param.channo]; - /* point to relevant structure */ - /* NOTE: sigtype is *not* included in this */ - /* get timing stack.paramters */ - chan->prewinktime = stack.param.prewinktime; - chan->preflashtime = stack.param.preflashtime; - chan->winktime = stack.param.winktime; - chan->flashtime = stack.param.flashtime; - chan->starttime = stack.param.starttime; - /* Update ringtime if not using a tone zone */ - if (!chan->curzone) - chan->ringcadence[0] = chan->starttime; - chan->rxwinktime = stack.param.rxwinktime; - chan->rxflashtime = stack.param.rxflashtime; - chan->debouncetime = stack.param.debouncetime; - chan->pulsemaketime = stack.param.pulsemaketime; - chan->pulsebreaktime = stack.param.pulsebreaktime; - chan->pulseaftertime = stack.param.pulseaftertime; - break; - case ZT_GETGAINS: /* get gain stuff */ - if (copy_from_user(&stack.gain,(struct zt_gains *) data,sizeof(stack.gain))) - return -EFAULT; - i = stack.gain.chan; /* get channel no */ - /* if zero, use current channel no */ - if (!i) i = unit; - /* make sure channel number makes sense */ - if ((i < 0) || (i > ZT_MAX_CHANNELS) || !chans[i]) return(-EINVAL); - - if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - stack.gain.chan = i; /* put the span # in here */ - for (j=0;j<256;j++) { - stack.gain.txgain[j] = chans[i]->txgain[j]; - stack.gain.rxgain[j] = chans[i]->rxgain[j]; - } - if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain))) - return -EFAULT; - break; - case ZT_SETGAINS: /* set gain stuff */ - if (copy_from_user(&stack.gain,(struct zt_gains *) data,sizeof(stack.gain))) - return -EFAULT; - i = stack.gain.chan; /* get channel no */ - /* if zero, use current channel no */ - if (!i) i = unit; - /* make sure channel number makes sense */ - if ((i < 0) || (i > ZT_MAX_CHANNELS) || !chans[i]) return(-EINVAL); - if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - - rxgain = kmalloc(512, GFP_KERNEL); - if (!rxgain) - return -ENOMEM; - - stack.gain.chan = i; /* put the span # in here */ - txgain = rxgain + 256; - - for (j=0;j<256;j++) { - rxgain[j] = stack.gain.rxgain[j]; - txgain[j] = stack.gain.txgain[j]; - } - - if (!memcmp(rxgain, defgain, 256) && - !memcmp(txgain, defgain, 256)) { - if (rxgain) - kfree(rxgain); - spin_lock_irqsave(&chans[i]->lock, flags); - if (chans[i]->gainalloc) - kfree(chans[i]->rxgain); - chans[i]->gainalloc = 0; - chans[i]->rxgain = defgain; - chans[i]->txgain = defgain; - spin_unlock_irqrestore(&chans[i]->lock, flags); - } else { - /* This is a custom gain setting */ - spin_lock_irqsave(&chans[i]->lock, flags); - if (chans[i]->gainalloc) - kfree(chans[i]->rxgain); - chans[i]->gainalloc = 1; - chans[i]->rxgain = rxgain; - chans[i]->txgain = txgain; - spin_unlock_irqrestore(&chans[i]->lock, flags); - } - if (copy_to_user((struct zt_gains *) data,&stack.gain,sizeof(stack.gain))) - return -EFAULT; - break; - case ZT_SPANSTAT_V1: - case ZT_SPANSTAT_V2: - case ZT_SPANSTAT: - size_to_copy = (cmd == ZT_SPANSTAT_V1) ? sizeof(struct zt_spaninfo_v1) : - (cmd == ZT_SPANSTAT_V2) ? sizeof(struct zt_spaninfo_v2) : - sizeof(struct zt_spaninfo); - if (copy_from_user(&stack.spaninfo, (struct zt_spaninfo *) data, size_to_copy)) - return -EFAULT; - i = stack.spaninfo.spanno; /* get specified span number */ - if ((i < 0) || (i >= maxspans)) return(-EINVAL); /* if bad span no */ - if (i == 0) { - /* if to figure it out for this chan */ - if (!chans[unit]) - return -EINVAL; - i = chans[unit]->span->spanno; - } - if (!spans[i]) - return -EINVAL; - stack.spaninfo.spanno = i; /* put the span # in here */ - stack.spaninfo.totalspans = 0; - if (maxspans) stack.spaninfo.totalspans = maxspans - 1; /* put total number of spans here */ - zap_copy_string(stack.spaninfo.desc, spans[i]->desc, sizeof(stack.spaninfo.desc)); - zap_copy_string(stack.spaninfo.name, spans[i]->name, sizeof(stack.spaninfo.name)); - stack.spaninfo.alarms = spans[i]->alarms; /* get alarm status */ - stack.spaninfo.bpvcount = spans[i]->bpvcount; /* get BPV count */ - stack.spaninfo.rxlevel = spans[i]->rxlevel; /* get rx level */ - stack.spaninfo.txlevel = spans[i]->txlevel; /* get tx level */ - stack.spaninfo.crc4count = spans[i]->crc4count; /* get CRC4 error count */ - stack.spaninfo.ebitcount = spans[i]->ebitcount; /* get E-bit error count */ - stack.spaninfo.fascount = spans[i]->fascount; /* get FAS error count */ - stack.spaninfo.irqmisses = spans[i]->irqmisses; /* get IRQ miss count */ - stack.spaninfo.syncsrc = spans[i]->syncsrc; /* get active sync source */ - stack.spaninfo.totalchans = spans[i]->channels; - stack.spaninfo.numchans = 0; - for (j = 0; j < spans[i]->channels; j++) { - if (spans[i]->chans[j].sig) - stack.spaninfo.numchans++; - } - /* version 2 fields */ - stack.spaninfo.lbo = spans[i]->lbo; - stack.spaninfo.lineconfig = spans[i]->lineconfig; - /* version 3 fields */ - stack.spaninfo.irq = spans[i]->irq; - stack.spaninfo.linecompat = spans[i]->linecompat; - zap_copy_string(stack.spaninfo.lboname, zt_lboname(spans[i]->lbo), sizeof(stack.spaninfo.lboname)); - if (spans[i]->manufacturer) - zap_copy_string(stack.spaninfo.manufacturer, spans[i]->manufacturer, - sizeof(stack.spaninfo.manufacturer)); - if (spans[i]->devicetype) - zap_copy_string(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype)); - zap_copy_string(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location)); - if (spans[i]->spantype) - zap_copy_string(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype)); - - if (copy_to_user((struct zt_spaninfo *) data, &stack.spaninfo, size_to_copy)) - return -EFAULT; - break; - case ZT_CHANDIAG: - get_user(j, (int *)data); /* get channel number from user */ - /* make sure its a valid channel number */ - if ((j < 1) || (j >= maxchans)) - return -EINVAL; - /* if channel not mapped, not there */ - if (!chans[j]) - return -EINVAL; - - if (!(mychan = kmalloc(sizeof(*mychan), GFP_KERNEL))) - return -ENOMEM; - - /* lock channel */ - spin_lock_irqsave(&chans[j]->lock, flags); - /* make static copy of channel */ - memcpy(mychan, chans[j], sizeof(*mychan)); - /* release it. */ - spin_unlock_irqrestore(&chans[j]->lock, flags); - - printk(KERN_INFO "Dump of Zaptel Channel %d (%s,%d,%d):\n\n",j, - mychan->name,mychan->channo,mychan->chanpos); - printk(KERN_INFO "flags: %x hex, writechunk: %08lx, readchunk: %08lx\n", - (unsigned int) mychan->flags, (long) mychan->writechunk, (long) mychan->readchunk); - printk(KERN_INFO "rxgain: %08lx, txgain: %08lx, gainalloc: %d\n", - (long) mychan->rxgain, (long)mychan->txgain, mychan->gainalloc); - printk(KERN_INFO "span: %08lx, sig: %x hex, sigcap: %x hex\n", - (long)mychan->span, mychan->sig, mychan->sigcap); - printk(KERN_INFO "inreadbuf: %d, outreadbuf: %d, inwritebuf: %d, outwritebuf: %d\n", - mychan->inreadbuf, mychan->outreadbuf, mychan->inwritebuf, mychan->outwritebuf); - printk(KERN_INFO "blocksize: %d, numbufs: %d, txbufpolicy: %d, txbufpolicy: %d\n", - mychan->blocksize, mychan->numbufs, mychan->txbufpolicy, mychan->rxbufpolicy); - printk(KERN_INFO "txdisable: %d, rxdisable: %d, iomask: %d\n", - mychan->txdisable, mychan->rxdisable, mychan->iomask); - printk(KERN_INFO "curzone: %08lx, tonezone: %d, curtone: %08lx, tonep: %d\n", - (long) mychan->curzone, mychan->tonezone, (long) mychan->curtone, mychan->tonep); - printk(KERN_INFO "digitmode: %d, txdialbuf: %s, dialing: %d, aftdialtimer: %d, cadpos. %d\n", - mychan->digitmode, mychan->txdialbuf, mychan->dialing, - mychan->afterdialingtimer, mychan->cadencepos); - printk(KERN_INFO "confna: %d, confn: %d, confmode: %d, confmute: %d\n", - mychan->confna, mychan->_confn, mychan->confmode, mychan->confmute); - printk(KERN_INFO "ec: %08lx, echocancel: %d, deflaw: %d, xlaw: %08lx\n", - (long) mychan->ec, mychan->echocancel, mychan->deflaw, (long) mychan->xlaw); - printk(KERN_INFO "echostate: %02x, echotimer: %d, echolastupdate: %d\n", - (int) mychan->echostate, mychan->echotimer, mychan->echolastupdate); - printk(KERN_INFO "itimer: %d, otimer: %d, ringdebtimer: %d\n\n", - mychan->itimer, mychan->otimer, mychan->ringdebtimer); -#if 0 - if (mychan->ec) { - int x; - /* Dump the echo canceller parameters */ - for (x=0;xec->taps;x++) { - printk(KERN_INFO "tap %d: %d\n", x, mychan->ec->fir_taps[x]); - } - } -#endif - kfree(mychan); - break; - default: - return -ENOTTY; - } - return 0; -} - -static int (*zt_dynamic_ioctl)(unsigned int cmd, unsigned long data); - -void zt_set_dynamic_ioctl(int (*func)(unsigned int cmd, unsigned long data)) -{ - zt_dynamic_ioctl = func; -} - -static void recalc_slaves(struct zt_chan *chan) -{ - int x; - struct zt_chan *last = chan; - - /* Makes no sense if you don't have a span */ - if (!chan->span) - return; - -#ifdef CONFIG_ZAPATA_DEBUG - printk("Recalculating slaves on %s\n", chan->name); -#endif - - /* Link all slaves appropriately */ - for (x=chan->chanpos;xspan->channels;x++) - if (chan->span->chans[x].master == chan) { -#ifdef CONFIG_ZAPATA_DEBUG - printk("Channel %s, slave to %s, last is %s, its next will be %d\n", - chan->span->chans[x].name, chan->name, last->name, x); -#endif - last->nextslave = x; - last = &chan->span->chans[x]; - } - /* Terminate list */ - last->nextslave = 0; -#ifdef CONFIG_ZAPATA_DEBUG - printk("Done Recalculating slaves on %s (last is %s)\n", chan->name, last->name); -#endif -} - -static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data) -{ - /* I/O CTL's for control interface */ - int i,j; - int sigcap; - int res = 0; - int x,y; - struct zt_chan *newmaster; - unsigned long flags; - int rv; - switch(cmd) { - case ZT_INDIRECT: - { - struct zt_indirect_data ind; - - if (copy_from_user(&ind, (struct zt_indirect_data *)data, sizeof(ind))) - return -EFAULT; - VALID_CHANNEL(ind.chan); - return zt_chan_ioctl(inode, file, ind.op, (unsigned long) ind.data, ind.chan); - } - case ZT_SPANCONFIG: - { - struct zt_lineconfig lc; - - if (copy_from_user(&lc, (struct zt_lineconfig *)data, sizeof(lc))) - return -EFAULT; - VALID_SPAN(lc.span); - if ((lc.lineconfig & 0x07f0 & spans[lc.span]->linecompat) != (lc.lineconfig & 0x07f0)) - return -EINVAL; - if (spans[lc.span]->spanconfig) { - spans[lc.span]->lineconfig = lc.lineconfig; - spans[lc.span]->lbo = lc.lbo; - spans[lc.span]->txlevel = lc.lbo; - spans[lc.span]->rxlevel = 0; - - return spans[lc.span]->spanconfig(spans[lc.span], &lc); - } - return 0; - } - case ZT_STARTUP: - CHECK_VALID_SPAN(j); - if (spans[j]->flags & ZT_FLAG_RUNNING) - return 0; - if (spans[j]->startup) - res = spans[j]->startup(spans[j]); - if (!res) { - /* Mark as running and hangup any channels */ - spans[j]->flags |= ZT_FLAG_RUNNING; - for (x=0;xchannels;x++) { - y = zt_q_sig(&spans[j]->chans[x]) & 0xff; - if (y >= 0) spans[j]->chans[x].rxsig = (unsigned char)y; - spin_lock_irqsave(&spans[j]->chans[x].lock, flags); - zt_hangup(&spans[j]->chans[x]); - spin_unlock_irqrestore(&spans[j]->chans[x].lock, flags); - spans[j]->chans[x].rxhooksig = ZT_RXSIG_INITIAL; - } - } - return 0; - case ZT_SHUTDOWN: - CHECK_VALID_SPAN(j); - if (spans[j]->shutdown) - res = spans[j]->shutdown(spans[j]); - spans[j]->flags &= ~ZT_FLAG_RUNNING; - return 0; - case ZT_CHANCONFIG: - { - struct zt_chanconfig ch; - - if (copy_from_user(&ch, (struct zt_chanconfig *)data, sizeof(ch))) - return -EFAULT; - VALID_CHANNEL(ch.chan); - if (ch.sigtype == ZT_SIG_SLAVE) { - /* We have to use the master's sigtype */ - if ((ch.master < 1) || (ch.master >= ZT_MAX_CHANNELS)) - return -EINVAL; - if (!chans[ch.master]) - return -EINVAL; - ch.sigtype = chans[ch.master]->sig; - newmaster = chans[ch.master]; - } else if ((ch.sigtype & __ZT_SIG_DACS) == __ZT_SIG_DACS) { - newmaster = chans[ch.chan]; - if ((ch.idlebits < 1) || (ch.idlebits >= ZT_MAX_CHANNELS)) - return -EINVAL; - if (!chans[ch.idlebits]) - return -EINVAL; - } else { - newmaster = chans[ch.chan]; - } - spin_lock_irqsave(&chans[ch.chan]->lock, flags); -#ifdef CONFIG_ZAPATA_NET - if (chans[ch.chan]->flags & ZT_FLAG_NETDEV) { - if (ztchan_to_dev(chans[ch.chan])->flags & IFF_UP) { - spin_unlock_irqrestore(&chans[ch.chan]->lock, flags); - printk(KERN_WARNING "Can't switch HDLC net mode on channel %s, since current interface is up\n", chans[ch.chan]->name); - return -EBUSY; - } -#ifdef LINUX26 - spin_unlock_irqrestore(&chans[ch.chan]->lock, flags); - unregister_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev); - spin_lock_irqsave(&chans[ch.chan]->lock, flags); - free_netdev(chans[ch.chan]->hdlcnetdev->netdev); -#else - unregister_hdlc_device(&chans[ch.chan]->hdlcnetdev->netdev); -#endif - kfree(chans[ch.chan]->hdlcnetdev); - chans[ch.chan]->hdlcnetdev = NULL; - chans[ch.chan]->flags &= ~ZT_FLAG_NETDEV; - } -#else - if (ch.sigtype == ZT_SIG_HDLCNET) { - spin_unlock_irqrestore(&chans[ch.chan]->lock, flags); - printk(KERN_WARNING "Zaptel networking not supported by this build.\n"); - return -ENOSYS; - } -#endif - sigcap = chans[ch.chan]->sigcap; - /* If they support clear channel, then they support the HDLC and such through - us. */ - if (sigcap & ZT_SIG_CLEAR) - sigcap |= (ZT_SIG_HDLCRAW | ZT_SIG_HDLCFCS | ZT_SIG_HDLCNET | ZT_SIG_DACS); - - if ((sigcap & ch.sigtype) != ch.sigtype) - res = -EINVAL; - - if (!res && chans[ch.chan]->span->chanconfig) - res = chans[ch.chan]->span->chanconfig(chans[ch.chan], ch.sigtype); - if (chans[ch.chan]->master) { - /* Clear the master channel */ - recalc_slaves(chans[ch.chan]->master); - chans[ch.chan]->nextslave = 0; - } - if (!res) { - chans[ch.chan]->sig = ch.sigtype; - if (chans[ch.chan]->sig == ZT_SIG_CAS) - chans[ch.chan]->idlebits = ch.idlebits; - else - chans[ch.chan]->idlebits = 0; - if ((ch.sigtype & ZT_SIG_CLEAR) == ZT_SIG_CLEAR) { - /* Set clear channel flag if appropriate */ - chans[ch.chan]->flags &= ~ZT_FLAG_AUDIO; - chans[ch.chan]->flags |= ZT_FLAG_CLEAR; - } else { - /* Set audio flag and not clear channel otherwise */ - chans[ch.chan]->flags |= ZT_FLAG_AUDIO; - chans[ch.chan]->flags &= ~ZT_FLAG_CLEAR; - } - if ((ch.sigtype & ZT_SIG_HDLCRAW) == ZT_SIG_HDLCRAW) { - /* Set the HDLC flag */ - chans[ch.chan]->flags |= ZT_FLAG_HDLC; - } else { - /* Clear the HDLC flag */ - chans[ch.chan]->flags &= ~ZT_FLAG_HDLC; - } - if ((ch.sigtype & ZT_SIG_HDLCFCS) == ZT_SIG_HDLCFCS) { - /* Set FCS to be calculated if appropriate */ - chans[ch.chan]->flags |= ZT_FLAG_FCS; - } else { - /* Clear FCS flag */ - chans[ch.chan]->flags &= ~ZT_FLAG_FCS; - } - if ((ch.sigtype & __ZT_SIG_DACS) == __ZT_SIG_DACS) { - /* Setup conference properly */ - chans[ch.chan]->confmode = ZT_CONF_DIGITALMON; - chans[ch.chan]->confna = ch.idlebits; - if (chans[ch.chan]->span && - chans[ch.chan]->span->dacs && - chans[ch.idlebits] && - chans[ch.chan]->span && - (chans[ch.chan]->span->dacs == chans[ch.idlebits]->span->dacs)) - chans[ch.chan]->span->dacs(chans[ch.chan], chans[ch.idlebits]); - } else if (chans[ch.chan]->span && chans[ch.chan]->span->dacs) - chans[ch.chan]->span->dacs(chans[ch.chan], NULL); - chans[ch.chan]->master = newmaster; - /* Note new slave if we are not our own master */ - if (newmaster != chans[ch.chan]) { - recalc_slaves(chans[ch.chan]->master); - } - if ((ch.sigtype & ZT_SIG_HARDHDLC) == ZT_SIG_HARDHDLC) { - chans[ch.chan]->flags &= ~ZT_FLAG_FCS; - chans[ch.chan]->flags &= ~ZT_FLAG_HDLC; - chans[ch.chan]->flags |= ZT_FLAG_NOSTDTXRX; - } else - chans[ch.chan]->flags &= ~ZT_FLAG_NOSTDTXRX; - - if ((ch.sigtype & ZT_SIG_MTP2) == ZT_SIG_MTP2) - chans[ch.chan]->flags |= ZT_FLAG_MTP2; - else - chans[ch.chan]->flags &= ~ZT_FLAG_MTP2; - } -#ifdef CONFIG_ZAPATA_NET - if (!res && - (newmaster == chans[ch.chan]) && - (chans[ch.chan]->sig == ZT_SIG_HDLCNET)) { - chans[ch.chan]->hdlcnetdev = zt_hdlc_alloc(); - if (chans[ch.chan]->hdlcnetdev) { -/* struct hdlc_device *hdlc = chans[ch.chan]->hdlcnetdev; - struct net_device *d = hdlc_to_dev(hdlc); mmm...get it right later --byg */ -#ifdef LINUX26 - chans[ch.chan]->hdlcnetdev->netdev = alloc_hdlcdev(chans[ch.chan]->hdlcnetdev); - if (chans[ch.chan]->hdlcnetdev->netdev) { - chans[ch.chan]->hdlcnetdev->chan = chans[ch.chan]; -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,23) - SET_MODULE_OWNER(chans[ch.chan]->hdlcnetdev->netdev); -#endif - chans[ch.chan]->hdlcnetdev->netdev->irq = chans[ch.chan]->span->irq; - chans[ch.chan]->hdlcnetdev->netdev->tx_queue_len = 50; - chans[ch.chan]->hdlcnetdev->netdev->do_ioctl = zt_net_ioctl; - chans[ch.chan]->hdlcnetdev->netdev->open = zt_net_open; - chans[ch.chan]->hdlcnetdev->netdev->stop = zt_net_stop; - dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->attach = zt_net_attach; - dev_to_hdlc(chans[ch.chan]->hdlcnetdev->netdev)->xmit = zt_xmit; - spin_unlock_irqrestore(&chans[ch.chan]->lock, flags); - /* Briefly restore interrupts while we register the device */ - res = zt_register_hdlc_device(chans[ch.chan]->hdlcnetdev->netdev, ch.netdev_name); - spin_lock_irqsave(&chans[ch.chan]->lock, flags); - } else { - printk("Unable to allocate hdlc: *shrug*\n"); - res = -1; - } -#else /* LINUX26 */ - chans[ch.chan]->hdlcnetdev->chan = chans[ch.chan]; -#ifndef HDLC_MAINTAINERS_ARE_MORE_STUPID_THAN_I_THOUGHT - chans[ch.chan]->hdlcnetdev->netdev.ioctl = zt_net_ioctl; -#endif - chans[ch.chan]->hdlcnetdev->netdev.netdev.do_ioctl = zt_net_ioctl; -#ifdef NEW_HDLC_INTERFACE - chans[ch.chan]->hdlcnetdev->netdev.netdev.open = zt_net_open; - chans[ch.chan]->hdlcnetdev->netdev.netdev.stop = zt_net_stop; - chans[ch.chan]->hdlcnetdev->netdev.xmit = zt_xmit; - chans[ch.chan]->hdlcnetdev->netdev.attach = zt_net_attach; -#else - chans[ch.chan]->hdlcnetdev->netdev.open = zt_net_open; - chans[ch.chan]->hdlcnetdev->netdev.close = zt_net_close; - chans[ch.chan]->hdlcnetdev->netdev.set_mode = NULL; - chans[ch.chan]->hdlcnetdev->netdev.xmit = zt_xmit; -#endif /* NEW_HDLC_INTERFACE */ - chans[ch.chan]->hdlcnetdev->netdev.netdev.irq = chans[ch.chan]->span->irq; - chans[ch.chan]->hdlcnetdev->netdev.netdev.tx_queue_len = 50; - res = register_hdlc_device(&chans[ch.chan]->hdlcnetdev->netdev); -#endif /* LINUX26 */ - if (!res) - chans[ch.chan]->flags |= ZT_FLAG_NETDEV; - } else { - printk("Unable to allocate netdev: out of memory\n"); - res = -1; - } - } -#endif - if ((chans[ch.chan]->sig == ZT_SIG_HDLCNET) && - (chans[ch.chan] == newmaster) && - !(chans[ch.chan]->flags & ZT_FLAG_NETDEV)) - printk("Unable to register HDLC device for channel %s\n", chans[ch.chan]->name); - if (!res) { - /* Setup default law */ - chans[ch.chan]->deflaw = ch.deflaw; - /* Copy back any modified settings */ - spin_unlock_irqrestore(&chans[ch.chan]->lock, flags); - if (copy_to_user((struct zt_chanconfig *)data, &ch, sizeof(ch))) - return -EFAULT; - spin_lock_irqsave(&chans[ch.chan]->lock, flags); - /* And hangup */ - zt_hangup(chans[ch.chan]); - y = zt_q_sig(chans[ch.chan]) & 0xff; - if (y >= 0) chans[ch.chan]->rxsig = (unsigned char)y; - chans[ch.chan]->rxhooksig = ZT_RXSIG_INITIAL; - } -#ifdef CONFIG_ZAPATA_DEBUG - printk("Configured channel %s, flags %04x, sig %04x\n", chans[ch.chan]->name, chans[ch.chan]->flags, chans[ch.chan]->sig); -#endif - spin_unlock_irqrestore(&chans[ch.chan]->lock, flags); - return res; - } - case ZT_SFCONFIG: - { - struct zt_sfconfig sf; - - if (copy_from_user(&sf, (struct zt_chanconfig *)data, sizeof(sf))) - return -EFAULT; - VALID_CHANNEL(sf.chan); - if (chans[sf.chan]->sig != ZT_SIG_SF) return -EINVAL; - spin_lock_irqsave(&chans[sf.chan]->lock, flags); - chans[sf.chan]->rxp1 = sf.rxp1; - chans[sf.chan]->rxp2 = sf.rxp2; - chans[sf.chan]->rxp3 = sf.rxp3; - chans[sf.chan]->txtone = sf.txtone; - chans[sf.chan]->tx_v2 = sf.tx_v2; - chans[sf.chan]->tx_v3 = sf.tx_v3; - chans[sf.chan]->toneflags = sf.toneflag; - if (sf.txtone) /* if set to make tone for tx */ - { - if ((chans[sf.chan]->txhooksig && !(sf.toneflag & ZT_REVERSE_TXTONE)) || - ((!chans[sf.chan]->txhooksig) && (sf.toneflag & ZT_REVERSE_TXTONE))) - { - set_txtone(chans[sf.chan],sf.txtone,sf.tx_v2,sf.tx_v3); - } - else - { - set_txtone(chans[sf.chan],0,0,0); - } - } - spin_unlock_irqrestore(&chans[sf.chan]->lock, flags); - return res; - } - case ZT_DEFAULTZONE: - if (get_user(j,(int *)data)) - return -EFAULT; - return zt_set_default_zone(j); - case ZT_LOADZONE: - return ioctl_load_zone(data); - case ZT_FREEZONE: - get_user(j, (int *) data); - return free_tone_zone(j); - case ZT_SET_DIALPARAMS: - { - struct zt_dialparams tdp; - - if (copy_from_user(&tdp, (struct zt_dialparams *) data, sizeof(tdp))) - return -EFAULT; - - if ((tdp.dtmf_tonelen <= 4000) || (tdp.dtmf_tonelen >= 10)) { - global_dialparams.dtmf_tonelen = tdp.dtmf_tonelen; - } - if ((tdp.mfv1_tonelen <= 4000) || (tdp.mfv1_tonelen >= 10)) { - global_dialparams.mfv1_tonelen = tdp.mfv1_tonelen; - } - if ((tdp.mfr2_tonelen <= 4000) || (tdp.mfr2_tonelen >= 10)) { - global_dialparams.mfr2_tonelen = tdp.mfr2_tonelen; - } - - /* update the lengths in all currently loaded zones */ - write_lock(&zone_lock); - for (j = 0; j < sizeof(tone_zones) / sizeof(tone_zones[0]); j++) { - struct zt_zone *z = tone_zones[j]; - - if (!z) - continue; - - for (i = 0; i < sizeof(z->dtmf) / sizeof(z->dtmf[0]); i++) { - z->dtmf[i].tonesamples = global_dialparams.dtmf_tonelen * ZT_CHUNKSIZE; - } - - /* for MFR1, we only adjust the length of the digits */ - for (i = ZT_TONE_MFR1_0; i <= ZT_TONE_MFR1_9; i++) { - z->mfr1[i - ZT_TONE_MFR1_BASE].tonesamples = global_dialparams.mfv1_tonelen * ZT_CHUNKSIZE; - } - - for (i = 0; i < sizeof(z->mfr2_fwd) / sizeof(z->mfr2_fwd[0]); i++) { - z->mfr2_fwd[i].tonesamples = global_dialparams.mfr2_tonelen * ZT_CHUNKSIZE; - } - - for (i = 0; i < sizeof(z->mfr2_rev) / sizeof(z->mfr2_rev[0]); i++) { - z->mfr2_rev[i].tonesamples = global_dialparams.mfr2_tonelen * ZT_CHUNKSIZE; - } - } - write_unlock(&zone_lock); - - dtmf_silence.tonesamples = global_dialparams.dtmf_tonelen * ZT_CHUNKSIZE; - mfr1_silence.tonesamples = global_dialparams.mfv1_tonelen * ZT_CHUNKSIZE; - mfr2_silence.tonesamples = global_dialparams.mfr2_tonelen * ZT_CHUNKSIZE; - - break; - } - case ZT_GET_DIALPARAMS: - { - struct zt_dialparams tdp; - - tdp = global_dialparams; - if (copy_to_user((struct zt_dialparams *) data, &tdp, sizeof(tdp))) - return -EFAULT; - break; - } - case ZT_GETVERSION: - { - struct zt_versioninfo vi; - - memset(&vi, 0, sizeof(vi)); - zap_copy_string(vi.version, ZAPTEL_VERSION, sizeof(vi.version)); - echo_can_identify(vi.echo_canceller, sizeof(vi.echo_canceller) - 1); - if (copy_to_user((struct zt_versioninfo *) data, &vi, sizeof(vi))) - return -EFAULT; - break; - } - case ZT_MAINT: /* do maintenance stuff */ - { - struct zt_maintinfo maint; - /* get struct from user */ - if (copy_from_user(&maint,(struct zt_maintinfo *) data, sizeof(maint))) - return -EFAULT; - /* must be valid span number */ - if ((maint.spanno < 1) || (maint.spanno > ZT_MAX_SPANS) || (!spans[maint.spanno])) - return -EINVAL; - if (!spans[maint.spanno]->maint) - return -ENOSYS; - spin_lock_irqsave(&spans[maint.spanno]->lock, flags); - /* save current maint state */ - i = spans[maint.spanno]->maintstat; - /* set maint mode */ - spans[maint.spanno]->maintstat = maint.command; - switch(maint.command) { - case ZT_MAINT_NONE: - case ZT_MAINT_LOCALLOOP: - case ZT_MAINT_REMOTELOOP: - /* if same, ignore it */ - if (i == maint.command) break; - rv = spans[maint.spanno]->maint(spans[maint.spanno], maint.command); - spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags); - if (rv) return rv; - spin_lock_irqsave(&spans[maint.spanno]->lock, flags); - break; - case ZT_MAINT_LOOPUP: - case ZT_MAINT_LOOPDOWN: - spans[maint.spanno]->mainttimer = ZT_LOOPCODE_TIME * ZT_CHUNKSIZE; - rv = spans[maint.spanno]->maint(spans[maint.spanno], maint.command); - spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags); - if (rv) return rv; - rv = schluffen(&spans[maint.spanno]->maintq); - if (rv) return rv; - spin_lock_irqsave(&spans[maint.spanno]->lock, flags); - break; - default: - printk("zaptel: Unknown maintenance event: %d\n", maint.command); - } - zt_alarm_notify(spans[maint.spanno]); /* process alarm-related events */ - spin_unlock_irqrestore(&spans[maint.spanno]->lock, flags); - break; - } - case ZT_DYNAMIC_CREATE: - case ZT_DYNAMIC_DESTROY: - if (zt_dynamic_ioctl) - return zt_dynamic_ioctl(cmd, data); - else { - request_module("ztdynamic"); - if (zt_dynamic_ioctl) - return zt_dynamic_ioctl(cmd, data); - } - return -ENOSYS; -#if defined(ECHO_CAN_HPEC) - case ZT_EC_LICENSE_CHALLENGE: - case ZT_EC_LICENSE_RESPONSE: - return hpec_license_ioctl(cmd, data); -#endif /* defined(ECHO_CAN_HPEC) */ - default: - return zt_common_ioctl(inode, file, cmd, data, 0); - } - return 0; -} - -static int ioctl_zt_dial(struct zt_chan *chan, unsigned long data) -{ - struct zt_dialoperation *tdo; - unsigned long flags; - char *s; - int rv; - - tdo = kmalloc(sizeof(*tdo), GFP_KERNEL); - - if (!tdo) - return -ENOMEM; - - if (copy_from_user(tdo, (struct zt_dialoperation *)data, sizeof(*tdo))) - return -EFAULT; - rv = 0; - /* Force proper NULL termination and uppercase entry */ - tdo->dialstr[ZT_MAX_DTMF_BUF - 1] = '\0'; - for (s = tdo->dialstr; *s; s++) - *s = toupper(*s); - spin_lock_irqsave(&chan->lock, flags); - if (!chan->curzone) { - spin_unlock_irqrestore(&chan->lock, flags); - /* The tone zones are loaded by ztcfg from /etc/zaptel.conf */ - printk(KERN_WARNING "zaptel: Cannot dial until a tone zone is loaded.\n"); - return -ENODATA; - } - switch (tdo->op) { - case ZT_DIAL_OP_CANCEL: - chan->curtone = NULL; - chan->dialing = 0; - chan->txdialbuf[0] = '\0'; - chan->tonep = 0; - chan->pdialcount = 0; - break; - case ZT_DIAL_OP_REPLACE: - strcpy(chan->txdialbuf, tdo->dialstr); - chan->dialing = 1; - __do_dtmf(chan); - break; - case ZT_DIAL_OP_APPEND: - if (strlen(tdo->dialstr) + strlen(chan->txdialbuf) >= (ZT_MAX_DTMF_BUF - 1)) { - rv = -EBUSY; - break; - } - zap_copy_string(chan->txdialbuf + strlen(chan->txdialbuf), tdo->dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf)); - if (!chan->dialing) { - chan->dialing = 1; - __do_dtmf(chan); - } - break; - default: - rv = -EINVAL; - } - spin_unlock_irqrestore(&chan->lock, flags); - return rv; -} - -static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit) -{ - struct zt_chan *chan = chans[unit]; - union { - struct zt_bufferinfo bi; - struct zt_confinfo conf; - struct zt_ring_cadence cad; - } stack; - unsigned long flags, flagso; - int i, j, k, rv; - int ret, c; - - if (!chan) - return -EINVAL; - switch(cmd) { - case ZT_DIALING: - spin_lock_irqsave(&chan->lock, flags); - j = chan->dialing; - spin_unlock_irqrestore(&chan->lock, flags); - if (copy_to_user((int *)data,&j,sizeof(int))) - return -EFAULT; - return 0; - case ZT_DIAL: - return ioctl_zt_dial(chan, data); - case ZT_GET_BUFINFO: - stack.bi.rxbufpolicy = chan->rxbufpolicy; - stack.bi.txbufpolicy = chan->txbufpolicy; - stack.bi.numbufs = chan->numbufs; - stack.bi.bufsize = chan->blocksize; - /* XXX FIXME! XXX */ - stack.bi.readbufs = -1; - stack.bi.writebufs = -1; - if (copy_to_user((struct zt_bufferinfo *)data, &stack.bi, sizeof(stack.bi))) - return -EFAULT; - break; - case ZT_SET_BUFINFO: - if (copy_from_user(&stack.bi, (struct zt_bufferinfo *)data, sizeof(stack.bi))) - return -EFAULT; - if (stack.bi.bufsize > ZT_MAX_BLOCKSIZE) - return -EINVAL; - if (stack.bi.bufsize < 16) - return -EINVAL; - if (stack.bi.bufsize * stack.bi.numbufs > ZT_MAX_BUF_SPACE) - return -EINVAL; - chan->rxbufpolicy = stack.bi.rxbufpolicy & 0x1; - chan->txbufpolicy = stack.bi.txbufpolicy & 0x1; - if ((rv = zt_reallocbufs(chan, stack.bi.bufsize, stack.bi.numbufs))) - return (rv); - break; - case ZT_GET_BLOCKSIZE: /* get blocksize */ - put_user(chan->blocksize,(int *)data); /* return block size */ - break; - case ZT_SET_BLOCKSIZE: /* set blocksize */ - get_user(j,(int *)data); - /* cannot be larger than max amount */ - if (j > ZT_MAX_BLOCKSIZE) return(-EINVAL); - /* cannot be less then 16 */ - if (j < 16) return(-EINVAL); - /* allocate a single kernel buffer which we then - sub divide into four pieces */ - if ((rv = zt_reallocbufs(chan, j, chan->numbufs))) - return (rv); - break; - case ZT_FLUSH: /* flush input buffer, output buffer, and/or event queue */ - get_user(i,(int *)data); /* get param */ - spin_lock_irqsave(&chan->lock, flags); - if (i & ZT_FLUSH_READ) /* if for read (input) */ - { - /* initialize read buffers and pointers */ - chan->inreadbuf = 0; - chan->outreadbuf = -1; - for (j=0;jnumbufs;j++) { - /* Do we need this? */ - chan->readn[j] = 0; - chan->readidx[j] = 0; - } - wake_up_interruptible(&chan->readbufq); /* wake_up_interruptible waiting on read */ - wake_up_interruptible(&chan->sel); /* wake_up_interruptible waiting on select */ - } - if (i & ZT_FLUSH_WRITE) /* if for write (output) */ - { - /* initialize write buffers and pointers */ - chan->outwritebuf = -1; - chan->inwritebuf = 0; - for (j=0;jnumbufs;j++) { - /* Do we need this? */ - chan->writen[j] = 0; - chan->writeidx[j] = 0; - } - wake_up_interruptible(&chan->writebufq); /* wake_up_interruptible waiting on write */ - wake_up_interruptible(&chan->sel); /* wake_up_interruptible waiting on select */ - /* if IO MUX wait on write empty, well, this - certainly *did* empty the write */ - if (chan->iomask & ZT_IOMUX_WRITEEMPTY) - wake_up_interruptible(&chan->eventbufq); /* wake_up_interruptible waiting on IOMUX */ - } - if (i & ZT_FLUSH_EVENT) /* if for events */ - { - /* initialize the event pointers */ - chan->eventinidx = chan->eventoutidx = 0; - } - spin_unlock_irqrestore(&chan->lock, flags); - break; - case ZT_SYNC: /* wait for no tx */ - for(;;) /* loop forever */ - { - spin_lock_irqsave(&chan->lock, flags); - /* Know if there is a write pending */ - i = (chan->outwritebuf > -1); - spin_unlock_irqrestore(&chan->lock, flags); - if (!i) break; /* skip if none */ - rv = schluffen(&chan->writebufq); - if (rv) return(rv); - } - break; - case ZT_IOMUX: /* wait for something to happen */ - get_user(chan->iomask,(int*)data); /* save mask */ - if (!chan->iomask) return(-EINVAL); /* cant wait for nothing */ - for(;;) /* loop forever */ - { - /* has to have SOME mask */ - ret = 0; /* start with empty return value */ - spin_lock_irqsave(&chan->lock, flags); - /* if looking for read */ - if (chan->iomask & ZT_IOMUX_READ) - { - /* if read available */ - if ((chan->outreadbuf > -1) && !chan->rxdisable) - ret |= ZT_IOMUX_READ; - } - /* if looking for write avail */ - if (chan->iomask & ZT_IOMUX_WRITE) - { - if (chan->inwritebuf > -1) - ret |= ZT_IOMUX_WRITE; - } - /* if looking for write empty */ - if (chan->iomask & ZT_IOMUX_WRITEEMPTY) - { - /* if everything empty -- be sure the transmitter is enabled */ - chan->txdisable = 0; - if (chan->outwritebuf < 0) - ret |= ZT_IOMUX_WRITEEMPTY; - } - /* if looking for signalling event */ - if (chan->iomask & ZT_IOMUX_SIGEVENT) - { - /* if event */ - if (chan->eventinidx != chan->eventoutidx) - ret |= ZT_IOMUX_SIGEVENT; - } - spin_unlock_irqrestore(&chan->lock, flags); - /* if something to return, or not to wait */ - if (ret || (chan->iomask & ZT_IOMUX_NOWAIT)) - { - /* set return value */ - put_user(ret,(int *)data); - break; /* get out of loop */ - } - rv = schluffen(&chan->eventbufq); - if (rv) return(rv); - } - /* clear IO MUX mask */ - chan->iomask = 0; - break; - case ZT_GETEVENT: /* Get event on queue */ - /* set up for no event */ - j = ZT_EVENT_NONE; - spin_lock_irqsave(&chan->lock, flags); - /* if some event in queue */ - if (chan->eventinidx != chan->eventoutidx) - { - j = chan->eventbuf[chan->eventoutidx++]; - /* get the data, bump index */ - /* if index overflow, set to beginning */ - if (chan->eventoutidx >= ZT_MAX_EVENTSIZE) - chan->eventoutidx = 0; - } - spin_unlock_irqrestore(&chan->lock, flags); - put_user(j,(int *)data); - break; - case ZT_CONFMUTE: /* set confmute flag */ - get_user(j,(int *)data); /* get conf # */ - if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - spin_lock_irqsave(&bigzaplock, flags); - chan->confmute = j; - spin_unlock_irqrestore(&bigzaplock, flags); - break; - case ZT_GETCONFMUTE: /* get confmute flag */ - if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - j = chan->confmute; - put_user(j,(int *)data); /* get conf # */ - rv = 0; - break; - case ZT_SETTONEZONE: - get_user(j, (int *) data); - rv = set_tone_zone(chan, j); - return rv; - case ZT_GETTONEZONE: - spin_lock_irqsave(&chan->lock, flags); - if (chan->curzone) - j = chan->tonezone; - spin_unlock_irqrestore(&chan->lock, flags); - put_user(j, (int *) data); - break; - case ZT_SENDTONE: - get_user(j,(int *)data); - spin_lock_irqsave(&chan->lock, flags); - rv = start_tone(chan, j); - spin_unlock_irqrestore(&chan->lock, flags); - return rv; - case ZT_GETCONF: /* get conf stuff */ - if (copy_from_user(&stack.conf,(struct zt_confinfo *) data,sizeof(stack.conf))) - return -EFAULT; - i = stack.conf.chan; /* get channel no */ - /* if zero, use current channel no */ - if (!i) i = chan->channo; - /* make sure channel number makes sense */ - if ((i < 0) || (i > ZT_MAX_CONF) || (!chans[i])) return(-EINVAL); - if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - stack.conf.chan = i; /* get channel number */ - stack.conf.confno = chans[i]->confna; /* get conference number */ - stack.conf.confmode = chans[i]->confmode; /* get conference mode */ - if (copy_to_user((struct zt_confinfo *) data,&stack.conf,sizeof(stack.conf))) - return -EFAULT; - break; - case ZT_SETCONF: /* set conf stuff */ - if (copy_from_user(&stack.conf,(struct zt_confinfo *) data,sizeof(stack.conf))) - return -EFAULT; - i = stack.conf.chan; /* get channel no */ - /* if zero, use current channel no */ - if (!i) i = chan->channo; - /* make sure channel number makes sense */ - if ((i < 1) || (i > ZT_MAX_CHANNELS) || (!chans[i])) return(-EINVAL); - if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - if ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORTX || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_RX_PREECHO || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_TX_PREECHO || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH_PREECHO) { - /* Monitor mode -- it's a channel */ - if ((stack.conf.confno < 0) || (stack.conf.confno >= ZT_MAX_CHANNELS) || !chans[stack.conf.confno]) return(-EINVAL); - } else { - /* make sure conf number makes sense, too */ - if ((stack.conf.confno < -1) || (stack.conf.confno > ZT_MAX_CONF)) return(-EINVAL); - } - - /* if taking off of any conf, must have 0 mode */ - if ((!stack.conf.confno) && stack.conf.confmode) return(-EINVAL); - /* likewise if 0 mode must have no conf */ - if ((!stack.conf.confmode) && stack.conf.confno) return (-EINVAL); - stack.conf.chan = i; /* return with real channel # */ - spin_lock_irqsave(&bigzaplock, flagso); - spin_lock_irqsave(&chan->lock, flags); - if (stack.conf.confno == -1) - stack.conf.confno = zt_first_empty_conference(); - if ((stack.conf.confno < 1) && (stack.conf.confmode)) { - /* No more empty conferences */ - spin_unlock_irqrestore(&chan->lock, flags); - spin_unlock_irqrestore(&bigzaplock, flagso); - return -EBUSY; - } - /* if changing confs, clear last added info */ - if (stack.conf.confno != chans[i]->confna) { - memset(chans[i]->conflast, 0, ZT_MAX_CHUNKSIZE); - memset(chans[i]->conflast1, 0, ZT_MAX_CHUNKSIZE); - memset(chans[i]->conflast2, 0, ZT_MAX_CHUNKSIZE); - } - j = chans[i]->confna; /* save old conference number */ - chans[i]->confna = stack.conf.confno; /* set conference number */ - chans[i]->confmode = stack.conf.confmode; /* set conference mode */ - chans[i]->_confn = 0; /* Clear confn */ - zt_check_conf(j); - zt_check_conf(stack.conf.confno); - if (chans[i]->span && chans[i]->span->dacs) { - if (((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_DIGITALMON) && - chans[stack.conf.confno]->span && - chans[stack.conf.confno]->span->dacs == chans[i]->span->dacs && - chans[i]->txgain == defgain && - chans[i]->rxgain == defgain && - chans[stack.conf.confno]->txgain == defgain && - chans[stack.conf.confno]->rxgain == defgain) { - chans[i]->span->dacs(chans[i], chans[stack.conf.confno]); - } else { - chans[i]->span->dacs(chans[i], NULL); - } - } - /* if we are going onto a conf */ - if (stack.conf.confno && - ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONF || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANN || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFMON || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANNMON || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_REALANDPSEUDO)) { - /* Get alias */ - chans[i]->_confn = zt_get_conf_alias(stack.conf.confno); - } - - if (chans[stack.conf.confno]) { - if ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_RX_PREECHO || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR_TX_PREECHO || - (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH_PREECHO) - chans[stack.conf.confno]->readchunkpreec = kmalloc(sizeof(*chans[stack.conf.confno]->readchunkpreec) * ZT_CHUNKSIZE, GFP_ATOMIC); - else { - if (chans[stack.conf.confno]->readchunkpreec) { - kfree(chans[stack.conf.confno]->readchunkpreec); - chans[stack.conf.confno]->readchunkpreec = NULL; - } - } - } - - spin_unlock_irqrestore(&chan->lock, flags); - spin_unlock_irqrestore(&bigzaplock, flagso); - if (copy_to_user((struct zt_confinfo *) data,&stack.conf,sizeof(stack.conf))) - return -EFAULT; - break; - case ZT_CONFLINK: /* do conf link stuff */ - if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - if (copy_from_user(&stack.conf,(struct zt_confinfo *) data,sizeof(stack.conf))) - return -EFAULT; - /* check sanity of arguments */ - if ((stack.conf.chan < 0) || (stack.conf.chan > ZT_MAX_CONF)) return(-EINVAL); - if ((stack.conf.confno < 0) || (stack.conf.confno > ZT_MAX_CONF)) return(-EINVAL); - /* cant listen to self!! */ - if (stack.conf.chan && (stack.conf.chan == stack.conf.confno)) return(-EINVAL); - spin_lock_irqsave(&bigzaplock, flagso); - spin_lock_irqsave(&chan->lock, flags); - /* if to clear all links */ - if ((!stack.conf.chan) && (!stack.conf.confno)) - { - /* clear all the links */ - memset(conf_links,0,sizeof(conf_links)); - recalc_maxlinks(); - spin_unlock_irqrestore(&chan->lock, flags); - spin_unlock_irqrestore(&bigzaplock, flagso); - break; - } - rv = 0; /* clear return value */ - /* look for already existant specified combination */ - for(i = 1; i <= ZT_MAX_CONF; i++) - { - /* if found, exit */ - if ((conf_links[i].src == stack.conf.chan) && - (conf_links[i].dst == stack.conf.confno)) break; - } - if (i <= ZT_MAX_CONF) /* if found */ - { - if (!stack.conf.confmode) /* if to remove link */ - { - conf_links[i].src = conf_links[i].dst = 0; - } - else /* if to add and already there, error */ - { - rv = -EEXIST; - } - } - else /* if not found */ - { - if (stack.conf.confmode) /* if to add link */ - { - /* look for empty location */ - for(i = 1; i <= ZT_MAX_CONF; i++) - { - /* if empty, exit loop */ - if ((!conf_links[i].src) && - (!conf_links[i].dst)) break; - } - /* if empty spot found */ - if (i <= ZT_MAX_CONF) - { - conf_links[i].src = stack.conf.chan; - conf_links[i].dst = stack.conf.confno; - } - else /* if no empties -- error */ - { - rv = -ENOSPC; - } - } - else /* if to remove, and not found -- error */ - { - rv = -ENOENT; - } - } - recalc_maxlinks(); - spin_unlock_irqrestore(&chan->lock, flags); - spin_unlock_irqrestore(&bigzaplock, flagso); - return(rv); - case ZT_CONFDIAG: /* output diagnostic info to console */ - if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL); - get_user(j,(int *)data); /* get conf # */ - /* loop thru the interesting ones */ - for(i = ((j) ? j : 1); i <= ((j) ? j : ZT_MAX_CONF); i++) - { - c = 0; - for(k = 1; k < ZT_MAX_CHANNELS; k++) - { - /* skip if no pointer */ - if (!chans[k]) continue; - /* skip if not in this conf */ - if (chans[k]->confna != i) continue; - if (!c) printk("Conf #%d:\n",i); - c = 1; - printk("chan %d, mode %x\n", - k,chans[k]->confmode); - } - rv = 0; - for(k = 1; k <= ZT_MAX_CONF; k++) - { - if (conf_links[k].dst == i) - { - if (!c) printk("Conf #%d:\n",i); - c = 1; - if (!rv) printk("Snooping on:\n"); - rv = 1; - printk("conf %d\n",conf_links[k].src); - } - } - if (c) printk("\n"); - } - break; - case ZT_CHANNO: /* get channel number of stream */ - put_user(unit,(int *)data); /* return unit/channel number */ - break; - case ZT_SETLAW: - get_user(j, (int *)data); - if ((j < 0) || (j > ZT_LAW_ALAW)) - return -EINVAL; - zt_set_law(chan, j); - break; - case ZT_SETLINEAR: - get_user(j, (int *)data); - /* Makes no sense on non-audio channels */ - if (!(chan->flags & ZT_FLAG_AUDIO)) - return -EINVAL; - - if (j) - chan->flags |= ZT_FLAG_LINEAR; - else - chan->flags &= ~ZT_FLAG_LINEAR; - break; - case ZT_SETCADENCE: - if (data) { - /* Use specific ring cadence */ - if (copy_from_user(&stack.cad, (struct zt_ring_cadence *)data, sizeof(stack.cad))) - return -EFAULT; - memcpy(chan->ringcadence, &stack.cad, sizeof(chan->ringcadence)); - chan->firstcadencepos = 0; - /* Looking for negative ringing time indicating where to loop back into ringcadence */ - for (i=0; iringcadence[i]<0) { - chan->ringcadence[i] *= -1; - chan->firstcadencepos = i; - break; - } - } - } else { - /* Reset to default */ - chan->firstcadencepos = 0; - if (chan->curzone) { - memcpy(chan->ringcadence, chan->curzone->ringcadence, sizeof(chan->ringcadence)); - /* Looking for negative ringing time indicating where to loop back into ringcadence */ - for (i=0; iringcadence[i]<0) { - chan->ringcadence[i] *= -1; - chan->firstcadencepos = i; - break; - } - } - } else { - memset(chan->ringcadence, 0, sizeof(chan->ringcadence)); - chan->ringcadence[0] = chan->starttime; - chan->ringcadence[1] = ZT_RINGOFFTIME; - } - } - break; - default: - /* Check for common ioctl's and private ones */ - rv = zt_common_ioctl(inode, file, cmd, data, unit); - /* if no span, just return with value */ - if (!chan->span) return rv; - if ((rv == -ENOTTY) && chan->span->ioctl) - rv = chan->span->ioctl(chan, cmd, data); - return rv; - - } - return 0; -} - -#ifdef CONFIG_ZAPATA_PPP -/* - * This is called at softirq (BH) level when there are calls - * we need to make to the ppp_generic layer. We do it this - * way because the ppp_generic layer functions may not be called - * at interrupt level. - */ -static void do_ppp_calls(unsigned long data) -{ - struct zt_chan *chan = (struct zt_chan *) data; - struct sk_buff *skb; - - if (!chan->ppp) - return; - if (chan->do_ppp_wakeup) { - chan->do_ppp_wakeup = 0; - ppp_output_wakeup(chan->ppp); - } - while ((skb = skb_dequeue(&chan->ppp_rq)) != NULL) - ppp_input(chan->ppp, skb); - if (chan->do_ppp_error) { - chan->do_ppp_error = 0; - ppp_input_error(chan->ppp, 0); - } -} -#endif - -static int ioctl_echocancel(struct zt_chan *chan, struct zt_echocanparams *ecp, void *data) -{ - struct echo_can_state *ec = NULL, *tec; - struct zt_echocanparam *params; - int ret; - unsigned long flags; - - if (ecp->param_count > ZT_MAX_ECHOCANPARAMS) - return -E2BIG; - - if (ecp->tap_length == 0) { - /* disable mode, don't need to inspect params */ - spin_lock_irqsave(&chan->lock, flags); - tec = chan->ec; - chan->ec = NULL; - chan->echocancel = 0; - chan->echostate = ECHO_STATE_IDLE; - chan->echolastupdate = 0; - chan->echotimer = 0; - spin_unlock_irqrestore(&chan->lock, flags); - hw_echocancel_off(chan); - if (tec) - echo_can_free(tec); - - return 0; - } - - /* if parameters were supplied and this channel's span provides an echocan, - but not one that takes params, then we must punt here and return an error */ - if (ecp->param_count && chan->span && chan->span->echocan && - !chan->span->echocan_with_params) - return -EINVAL; - - params = kmalloc(sizeof(params[0]) * ZT_MAX_ECHOCANPARAMS, GFP_KERNEL); - - if (!params) - return -ENOMEM; - - /* enable mode, need the params */ - - if (copy_from_user(params, (struct zt_echocanparam *) data, sizeof(params[0]) * ecp->param_count)) { - ret = -EFAULT; - goto exit_with_free; - } - - spin_lock_irqsave(&chan->lock, flags); - tec = chan->ec; - chan->ec = NULL; - spin_unlock_irqrestore(&chan->lock, flags); - - if (tec) - echo_can_free(tec); - - ret = -ENODEV; - - /* attempt to use the span's echo canceler; fall back to built-in - if it fails (but not if an error occurs) */ - if (chan->span) { - if (chan->span->echocan_with_params) - ret = chan->span->echocan_with_params(chan, ecp, params); - else if (chan->span->echocan) - ret = chan->span->echocan(chan, ecp->tap_length); - } - - if (ret == -ENODEV) { - switch (ecp->tap_length) { - case 32: - case 64: - case 128: - case 256: - case 512: - case 1024: - break; - default: - ecp->tap_length = deftaps; - } - - if ((ret = echo_can_create(ecp, params, &ec))) - goto exit_with_free; - - spin_lock_irqsave(&chan->lock, flags); - chan->echocancel = ecp->tap_length; - chan->ec = ec; - chan->echostate = ECHO_STATE_IDLE; - chan->echolastupdate = 0; - chan->echotimer = 0; - echo_can_disable_detector_init(&chan->txecdis); - echo_can_disable_detector_init(&chan->rxecdis); - spin_unlock_irqrestore(&chan->lock, flags); - } - -exit_with_free: - kfree(params); - return ret; -} - -static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit) -{ - struct zt_chan *chan = chans[unit]; - unsigned long flags; - int j, rv; - int ret; - int oldconf; - void *rxgain=NULL; - struct echo_can_state *ec; - - if (!chan) - return -ENOSYS; - - switch(cmd) { - case ZT_SIGFREEZE: - get_user(j, (int *)data); - spin_lock_irqsave(&chan->lock, flags); - if (j) { - chan->flags |= ZT_FLAG_SIGFREEZE; - } else { - chan->flags &= ~ZT_FLAG_SIGFREEZE; - } - spin_unlock_irqrestore(&chan->lock, flags); - break; - case ZT_GETSIGFREEZE: - spin_lock_irqsave(&chan->lock, flags); - if (chan->flags & ZT_FLAG_SIGFREEZE) - j = 1; - else - j = 0; - spin_unlock_irqrestore(&chan->lock, flags); - put_user(j, (int *)data); - break; - case ZT_AUDIOMODE: - /* Only literal clear channels can be put in */ - if (chan->sig != ZT_SIG_CLEAR) return (-EINVAL); - get_user(j, (int *)data); - if (j) { - spin_lock_irqsave(&chan->lock, flags); - chan->flags |= ZT_FLAG_AUDIO; - chan->flags &= ~(ZT_FLAG_HDLC | ZT_FLAG_FCS); - spin_unlock_irqrestore(&chan->lock, flags); - } else { - /* Coming out of audio mode, also clear all - conferencing and gain related info as well - as echo canceller */ - spin_lock_irqsave(&chan->lock, flags); - chan->flags &= ~ZT_FLAG_AUDIO; - /* save old conf number, if any */ - oldconf = chan->confna; - /* initialize conference variables */ - chan->_confn = 0; - chan->confna = 0; - if (chan->span && chan->span->dacs) - chan->span->dacs(chan, NULL); - chan->confmode = 0; - chan->confmute = 0; - memset(chan->conflast, 0, sizeof(chan->conflast)); - memset(chan->conflast1, 0, sizeof(chan->conflast1)); - memset(chan->conflast2, 0, sizeof(chan->conflast2)); - ec = chan->ec; - chan->ec = NULL; - /* release conference resource, if any to release */ - reset_conf(chan); - if (chan->gainalloc && chan->rxgain) - rxgain = chan->rxgain; - else - rxgain = NULL; - - chan->rxgain = defgain; - chan->txgain = defgain; - chan->gainalloc = 0; - /* Disable any native echo cancellation as well */ - spin_unlock_irqrestore(&chan->lock, flags); - - hw_echocancel_off(chan); - - if (rxgain) - kfree(rxgain); - if (ec) - echo_can_free(ec); - if (oldconf) zt_check_conf(oldconf); - } - break; - case ZT_HDLCPPP: -#ifdef CONFIG_ZAPATA_PPP - if (chan->sig != ZT_SIG_CLEAR) return (-EINVAL); - get_user(j, (int *)data); - if (j) { - if (!chan->ppp) { - chan->ppp = kmalloc(sizeof(struct ppp_channel), GFP_KERNEL); - if (chan->ppp) { - struct echo_can_state *tec; - memset(chan->ppp, 0, sizeof(struct ppp_channel)); - chan->ppp->private = chan; - chan->ppp->ops = &ztppp_ops; - chan->ppp->mtu = ZT_DEFAULT_MTU_MRU; - chan->ppp->hdrlen = 0; - skb_queue_head_init(&chan->ppp_rq); - chan->do_ppp_wakeup = 0; - tasklet_init(&chan->ppp_calls, do_ppp_calls, - (unsigned long)chan); - if ((ret = zt_reallocbufs(chan, ZT_DEFAULT_MTU_MRU, ZT_DEFAULT_NUM_BUFS))) { - kfree(chan->ppp); - chan->ppp = NULL; - return ret; - } - - if ((ret = ppp_register_channel(chan->ppp))) { - kfree(chan->ppp); - chan->ppp = NULL; - return ret; - } - tec = chan->ec; - chan->ec = NULL; - chan->echocancel = 0; - chan->echostate = ECHO_STATE_IDLE; - chan->echolastupdate = 0; - chan->echotimer = 0; - /* Make sure there's no gain */ - if (chan->gainalloc) - kfree(chan->rxgain); - chan->rxgain = defgain; - chan->txgain = defgain; - chan->gainalloc = 0; - chan->flags &= ~ZT_FLAG_AUDIO; - chan->flags |= (ZT_FLAG_PPP | ZT_FLAG_HDLC | ZT_FLAG_FCS); - hw_echocancel_off(chan); - - if (tec) - echo_can_free(tec); - } else - return -ENOMEM; - } - } else { - chan->flags &= ~(ZT_FLAG_PPP | ZT_FLAG_HDLC | ZT_FLAG_FCS); - if (chan->ppp) { - struct ppp_channel *ppp = chan->ppp; - chan->ppp = NULL; - tasklet_kill(&chan->ppp_calls); - skb_queue_purge(&chan->ppp_rq); - ppp_unregister_channel(ppp); - kfree(ppp); - } - } -#else - printk("Zaptel: Zaptel PPP support not compiled in\n"); - return -ENOSYS; -#endif - break; - case ZT_HDLCRAWMODE: - if (chan->sig != ZT_SIG_CLEAR) return (-EINVAL); - get_user(j, (int *)data); - chan->flags &= ~(ZT_FLAG_AUDIO | ZT_FLAG_HDLC | ZT_FLAG_FCS); - if (j) { - chan->flags |= ZT_FLAG_HDLC; - fasthdlc_init(&chan->rxhdlc); - fasthdlc_init(&chan->txhdlc); - } - break; - case ZT_HDLCFCSMODE: - if (chan->sig != ZT_SIG_CLEAR) return (-EINVAL); - get_user(j, (int *)data); - chan->flags &= ~(ZT_FLAG_AUDIO | ZT_FLAG_HDLC | ZT_FLAG_FCS); - if (j) { - chan->flags |= ZT_FLAG_HDLC | ZT_FLAG_FCS; - fasthdlc_init(&chan->rxhdlc); - fasthdlc_init(&chan->txhdlc); - } - break; - case ZT_ECHOCANCEL_PARAMS: - { - struct zt_echocanparams ecp; - - if (!(chan->flags & ZT_FLAG_AUDIO)) - return -EINVAL; - if (copy_from_user(&ecp, (struct zt_echocanparams *) data, sizeof(ecp))) - return -EFAULT; - data += sizeof(ecp); - if ((ret = ioctl_echocancel(chan, &ecp, (void *) data))) - return ret; - break; - } - case ZT_ECHOCANCEL: - { - struct zt_echocanparams ecp; - - if (!(chan->flags & ZT_FLAG_AUDIO)) - return -EINVAL; - get_user(j, (int *) data); - ecp.tap_length = j; - ecp.param_count = 0; - if ((ret = ioctl_echocancel(chan, &ecp, NULL))) - return ret; - break; - } - case ZT_ECHOTRAIN: - get_user(j, (int *)data); /* get pre-training time from user */ - if ((j < 0) || (j >= ZT_MAX_PRETRAINING)) - return -EINVAL; - j <<= 3; - if (chan->ec) { - /* Start pretraining stage */ - chan->echostate = ECHO_STATE_PRETRAINING; - chan->echotimer = j; - } else - return -EINVAL; - break; - case ZT_SETTXBITS: - if (chan->sig != ZT_SIG_CAS) - return -EINVAL; - get_user(j,(int *)data); - zt_cas_setbits(chan, j); - rv = 0; - break; - case ZT_GETRXBITS: - put_user(chan->rxsig, (int *)data); - rv = 0; - break; - case ZT_LOOPBACK: - get_user(j, (int *)data); - spin_lock_irqsave(&chan->lock, flags); - if (j) - chan->flags |= ZT_FLAG_LOOPED; - else - chan->flags &= ~ZT_FLAG_LOOPED; - spin_unlock_irqrestore(&chan->lock, flags); - rv = 0; - break; - case ZT_HOOK: - get_user(j,(int *)data); - if (chan->flags & ZT_FLAG_CLEAR) - return -EINVAL; - if (chan->sig == ZT_SIG_CAS) - return -EINVAL; - /* if no span, just do nothing */ - if (!chan->span) return(0); - spin_lock_irqsave(&chan->lock, flags); - /* if dialing, stop it */ - chan->curtone = NULL; - chan->dialing = 0; - chan->txdialbuf[0] = '\0'; - chan->tonep = 0; - chan->pdialcount = 0; - spin_unlock_irqrestore(&chan->lock, flags); - if (chan->span->flags & ZT_FLAG_RBS) { - switch (j) { - case ZT_ONHOOK: - spin_lock_irqsave(&chan->lock, flags); - zt_hangup(chan); - spin_unlock_irqrestore(&chan->lock, flags); - break; - case ZT_OFFHOOK: - spin_lock_irqsave(&chan->lock, flags); - if ((chan->txstate == ZT_TXSTATE_KEWL) || - (chan->txstate == ZT_TXSTATE_AFTERKEWL)) { - spin_unlock_irqrestore(&chan->lock, flags); - return -EBUSY; - } - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_DEBOUNCE, chan->debouncetime); - spin_unlock_irqrestore(&chan->lock, flags); - break; - case ZT_RING: - case ZT_START: - spin_lock_irqsave(&chan->lock, flags); - if (!chan->curzone) { - spin_unlock_irqrestore(&chan->lock, flags); - printk(KERN_WARNING "zaptel: Cannot start tone until a tone zone is loaded.\n"); - return -ENODATA; - } - if (chan->txstate != ZT_TXSTATE_ONHOOK) { - spin_unlock_irqrestore(&chan->lock, flags); - return -EBUSY; - } - if (chan->sig & __ZT_SIG_FXO) { - ret = 0; - chan->cadencepos = 0; - ret = chan->ringcadence[0]; - zt_rbs_sethook(chan, ZT_TXSIG_START, ZT_TXSTATE_RINGON, ret); - } else - zt_rbs_sethook(chan, ZT_TXSIG_START, ZT_TXSTATE_START, chan->starttime); - spin_unlock_irqrestore(&chan->lock, flags); - if (file->f_flags & O_NONBLOCK) - return -EINPROGRESS; -#if 0 - rv = schluffen(&chan->txstateq); - if (rv) return rv; -#endif - rv = 0; - break; - case ZT_WINK: - spin_lock_irqsave(&chan->lock, flags); - if (chan->txstate != ZT_TXSTATE_ONHOOK) { - spin_unlock_irqrestore(&chan->lock, flags); - return -EBUSY; - } - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_PREWINK, chan->prewinktime); - spin_unlock_irqrestore(&chan->lock, flags); - if (file->f_flags & O_NONBLOCK) - return -EINPROGRESS; - rv = schluffen(&chan->txstateq); - if (rv) return rv; - break; - case ZT_FLASH: - spin_lock_irqsave(&chan->lock, flags); - if (chan->txstate != ZT_TXSTATE_OFFHOOK) { - spin_unlock_irqrestore(&chan->lock, flags); - return -EBUSY; - } - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_PREFLASH, chan->preflashtime); - spin_unlock_irqrestore(&chan->lock, flags); - if (file->f_flags & O_NONBLOCK) - return -EINPROGRESS; - rv = schluffen(&chan->txstateq); - if (rv) return rv; - break; - case ZT_RINGOFF: - spin_lock_irqsave(&chan->lock, flags); - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_ONHOOK, 0); - spin_unlock_irqrestore(&chan->lock, flags); - break; - default: - return -EINVAL; - } - } else if (chan->span->sethook) { - if (chan->txhooksig != j) { - chan->txhooksig = j; - chan->span->sethook(chan, j); - } - } else - return -ENOSYS; - break; -#ifdef CONFIG_ZAPATA_PPP - case PPPIOCGCHAN: - if (chan->flags & ZT_FLAG_PPP) - return put_user(ppp_channel_index(chan->ppp), (int *)data) ? -EFAULT : 0; - else - return -EINVAL; - break; - case PPPIOCGUNIT: - if (chan->flags & ZT_FLAG_PPP) - return put_user(ppp_unit_number(chan->ppp), (int *)data) ? -EFAULT : 0; - else - return -EINVAL; - break; -#endif - default: - return zt_chanandpseudo_ioctl(inode, file, cmd, data, unit); - } - return 0; -} - -static int zt_prechan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit) -{ - struct zt_chan *chan = file->private_data; - int channo; - int res; - - if (chan) { - printk("Huh? Prechan already has private data??\n"); - } - switch(cmd) { - case ZT_SPECIFY: - get_user(channo,(int *)data); - if (channo < 1) - return -EINVAL; - if (channo > ZT_MAX_CHANNELS) - return -EINVAL; - res = zt_specchan_open(inode, file, channo, 0); - if (!res) { - /* Setup the pointer for future stuff */ - chan = chans[channo]; - file->private_data = chan; - /* Return success */ - return 0; - } - return res; - default: - return -ENOSYS; - } - return 0; -} - -static int zt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data) -{ - int unit = UNIT(file); - struct zt_chan *chan; - struct zt_timer *timer; - - if (!unit) - return zt_ctl_ioctl(inode, file, cmd, data); - - if (unit == 250) { - /* zttranscode should have updated the file_operations on - * this file object on open, so we shouldn't be here. */ - WARN_ON(1); - return -EFAULT; - } - - if (unit == 253) { - timer = file->private_data; - if (timer) - return zt_timer_ioctl(inode, file, cmd, data, timer); - else - return -EINVAL; - } - if (unit == 254) { - chan = file->private_data; - if (chan) - return zt_chan_ioctl(inode, file, cmd, data, chan->channo); - else - return zt_prechan_ioctl(inode, file, cmd, data, unit); - } - if (unit == 255) { - chan = file->private_data; - if (!chan) { - printk("No pseudo channel structure to read?\n"); - return -EINVAL; - } - return zt_chanandpseudo_ioctl(inode, file, cmd, data, chan->channo); - } - return zt_chan_ioctl(inode, file, cmd, data, unit); -} - -int zt_register(struct zt_span *span, int prefmaster) -{ - int x; - -#ifdef CONFIG_PROC_FS - char tempfile[17]; -#endif - if (!span) - return -EINVAL; - if (span->flags & ZT_FLAG_REGISTERED) { - printk(KERN_ERR "Span %s already appears to be registered\n", span->name); - return -EBUSY; - } - for (x=1;xname); - return -EBUSY; - } - for (x=1;xflags |= ZT_FLAG_REGISTERED; - span->spanno = x; - spin_lock_init(&span->lock); - if (!span->deflaw) { - printk("zaptel: Span %s didn't specify default law. Assuming mulaw, please fix driver!\n", span->name); - span->deflaw = ZT_LAW_MULAW; - } - - if (span->echocan && span->echocan_with_params) { - printk("zaptel: Span %s implements both echocan and echocan_with_params functions, preserving only echocan_with_params, please fix driver!\n", span->name); - span->echocan = NULL; - } - - for (x=0;xchannels;x++) { - span->chans[x].span = span; - zt_chan_reg(&span->chans[x]); - } - -#ifdef CONFIG_PROC_FS - sprintf(tempfile, "zaptel/%d", span->spanno); - proc_entries[span->spanno] = create_proc_read_entry(tempfile, 0444, NULL , zaptel_proc_read, (int *)(long)span->spanno); -#endif - -#ifdef CONFIG_DEVFS_FS - { - char span_name[50]; - sprintf(span_name, "span%d", span->spanno); - span->dhandle = devfs_mk_dir(zaptel_devfs_dir, span_name, NULL); - for (x = 0; x < span->channels; x++) { - struct zt_chan *chan = &span->chans[x]; - chan->fhandle = register_devfs_channel(chan, chan->span->dhandle); /* Register our stuff with devfs */ - } - } -#endif /* CONFIG_DEVFS_FS */ - -#ifdef CONFIG_ZAP_UDEV - for (x = 0; x < span->channels; x++) { - char chan_name[50]; - if (span->chans[x].channo < 250) { - sprintf(chan_name, "zap%d", span->chans[x].channo); - CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo), NULL, chan_name); - } - } -#endif /* CONFIG_ZAP_UDEV */ - - if (debug) - printk("Registered Span %d ('%s') with %d channels\n", span->spanno, span->name, span->channels); - if (!master || prefmaster) { - master = span; - if (debug) - printk("Span ('%s') is new master\n", span->name); - } - return 0; -} - -int zt_unregister(struct zt_span *span) -{ - int x; - int new_maxspans; - static struct zt_span *new_master; - -#ifdef CONFIG_PROC_FS - char tempfile[17]; -#endif /* CONFIG_PROC_FS */ - - if (!(span->flags & ZT_FLAG_REGISTERED)) { - printk(KERN_ERR "Span %s does not appear to be registered\n", span->name); - return -1; - } - /* Shutdown the span if it's running */ - if (span->flags & ZT_FLAG_RUNNING) - if (span->shutdown) - span->shutdown(span); - - if (spans[span->spanno] != span) { - printk(KERN_ERR "Span %s has spanno %d which is something else\n", span->name, span->spanno); - return -1; - } - if (debug) - printk("Unregistering Span '%s' with %d channels\n", span->name, span->channels); -#ifdef CONFIG_PROC_FS - sprintf(tempfile, "zaptel/%d", span->spanno); - remove_proc_entry(tempfile, NULL); -#endif /* CONFIG_PROC_FS */ -#ifdef CONFIG_DEVFS_FS - for (x = 0; x < span->channels; x++) { - devfs_unregister(span->chans[x].fhandle); - devfs_unregister(span->chans[x].fhandle_symlink); - } - devfs_unregister(span->dhandle); -#endif /* CONFIG_DEVFS_FS */ - -#ifdef CONFIG_ZAP_UDEV - for (x = 0; x < span->channels; x++) { - if (span->chans[x].channo < 250) - CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, span->chans[x].channo)); - } -#endif /* CONFIG_ZAP_UDEV */ - - spans[span->spanno] = NULL; - span->spanno = 0; - span->flags &= ~ZT_FLAG_REGISTERED; - for (x=0;xchannels;x++) - zt_chan_unreg(&span->chans[x]); - new_maxspans = 0; - new_master = master; /* FIXME: locking */ - if (master == span) - new_master = NULL; - for (x=1;xname: "no master"); - master = new_master; - - return 0; -} - -/* -** This routine converts from linear to ulaw -** -** Craig Reese: IDA/Supercomputing Research Center -** Joe Campbell: Department of Defense -** 29 September 1989 -** -** References: -** 1) CCITT Recommendation G.711 (very difficult to follow) -** 2) "A New Digital Technique for Implementation of Any -** Continuous PCM Companding Law," Villeret, Michel, -** et al. 1973 IEEE Int. Conf. on Communications, Vol 1, -** 1973, pg. 11.12-11.17 -** 3) MIL-STD-188-113,"Interoperability and Performance Standards -** for Analog-to_Digital Conversion Techniques," -** 17 February 1987 -** -** Input: Signed 16 bit linear sample -** Output: 8 bit ulaw sample -*/ - -#define ZEROTRAP /* turn on the trap as per the MIL-STD */ -#define BIAS 0x84 /* define the add-in bias for 16 bit samples */ -#define CLIP 32635 - -#ifdef CONFIG_CALC_XLAW -unsigned char -#else -static unsigned char __init -#endif -__zt_lineartoulaw(short sample) -{ - static int exp_lut[256] = {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7}; - int sign, exponent, mantissa; - unsigned char ulawbyte; - - /* Get the sample into sign-magnitude. */ - sign = (sample >> 8) & 0x80; /* set aside the sign */ - if (sign != 0) sample = -sample; /* get magnitude */ - if (sample > CLIP) sample = CLIP; /* clip the magnitude */ - - /* Convert from 16 bit linear to ulaw. */ - sample = sample + BIAS; - exponent = exp_lut[(sample >> 7) & 0xFF]; - mantissa = (sample >> (exponent + 3)) & 0x0F; - ulawbyte = ~(sign | (exponent << 4) | mantissa); -#ifdef ZEROTRAP - if (ulawbyte == 0) ulawbyte = 0x02; /* optional CCITT trap */ -#endif - if (ulawbyte == 0xff) ulawbyte = 0x7f; /* never return 0xff */ - return(ulawbyte); -} - -#define AMI_MASK 0x55 - -#ifdef CONFIG_CALC_XLAW -unsigned char -#else -static inline unsigned char __init -#endif -__zt_lineartoalaw (short linear) -{ - int mask; - int seg; - int pcm_val; - static int seg_end[8] = - { - 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF - }; - - pcm_val = linear; - if (pcm_val >= 0) - { - /* Sign (7th) bit = 1 */ - mask = AMI_MASK | 0x80; - } - else - { - /* Sign bit = 0 */ - mask = AMI_MASK; - pcm_val = -pcm_val; - } - - /* Convert the scaled magnitude to segment number. */ - for (seg = 0; seg < 8; seg++) - { - if (pcm_val <= seg_end[seg]) - break; - } - /* Combine the sign, segment, and quantization bits. */ - return ((seg << 4) | ((pcm_val >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask; -} -/*- End of function --------------------------------------------------------*/ - -static inline short int __init alaw2linear (uint8_t alaw) -{ - int i; - int seg; - - alaw ^= AMI_MASK; - i = ((alaw & 0x0F) << 4); - seg = (((int) alaw & 0x70) >> 4); - if (seg) - i = (i + 0x100) << (seg - 1); - return (short int) ((alaw & 0x80) ? i : -i); -} -/*- End of function --------------------------------------------------------*/ -static void __init zt_conv_init(void) -{ - int i; - - /* - * Set up mu-law conversion table - */ - for(i = 0;i < 256;i++) - { - short mu,e,f,y; - static short etab[]={0,132,396,924,1980,4092,8316,16764}; - - mu = 255-i; - e = (mu & 0x70)/16; - f = mu & 0x0f; - y = f * (1 << (e + 3)); - y += etab[e]; - if (mu & 0x80) y = -y; - __zt_mulaw[i] = y; - __zt_alaw[i] = alaw2linear(i); - /* Default (0.0 db) gain table */ - defgain[i] = i; - } -#ifndef CONFIG_CALC_XLAW - /* set up the reverse (mu-law) conversion table */ - for(i = -32768; i < 32768; i += 4) - { - __zt_lin2mu[((unsigned short)(short)i) >> 2] = __zt_lineartoulaw(i); - __zt_lin2a[((unsigned short)(short)i) >> 2] = __zt_lineartoalaw(i); - } -#endif -} - -static inline void __zt_process_getaudio_chunk(struct zt_chan *ss, unsigned char *txb) -{ - /* We transmit data from our master channel */ - /* Called with ss->lock held */ - struct zt_chan *ms = ss->master; - /* Linear representation */ - short getlin[ZT_CHUNKSIZE], k[ZT_CHUNKSIZE]; - int x; - - /* Okay, now we've got something to transmit */ - for (x=0;xec) { - for (x=0;xtxecdis, getlin[x])) { - printk("zaptel Disabled echo canceller because of tone (tx) on channel %d\n", ss->channo); - ms->echocancel = 0; - ms->echostate = ECHO_STATE_IDLE; - ms->echolastupdate = 0; - ms->echotimer = 0; - echo_can_free(ms->ec); - ms->ec = NULL; - __qevent(ss, ZT_EVENT_EC_DISABLED); - break; - } - } - } -#endif - if ((!ms->confmute && !ms->dialing) || (ms->flags & ZT_FLAG_PSEUDO)) { - /* Handle conferencing on non-clear channel and non-HDLC channels */ - switch(ms->confmode & ZT_CONF_MODE_MASK) { - case ZT_CONF_NORMAL: - /* Do nuffin */ - break; - case ZT_CONF_MONITOR: /* Monitor a channel's rx mode */ - /* if a pseudo-channel, ignore */ - if (ms->flags & ZT_FLAG_PSEUDO) break; - /* Add monitored channel */ - if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { - ACSS(getlin, chans[ms->confna]->getlin); - } else { - ACSS(getlin, chans[ms->confna]->putlin); - } - for (x=0;xflags & ZT_FLAG_PSEUDO) break; - /* Add monitored channel */ - if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { - ACSS(getlin, chans[ms->confna]->putlin); - } else { - ACSS(getlin, chans[ms->confna]->getlin); - } - - for (x=0;xflags & ZT_FLAG_PSEUDO) break; - ACSS(getlin, chans[ms->confna]->putlin); - ACSS(getlin, chans[ms->confna]->getlin); - for (x=0;xflags & ZT_FLAG_PSEUDO) - break; - - if (!chans[ms->confna]->readchunkpreec) - break; - - /* Add monitored channel */ - ACSS(getlin, chans[ms->confna]->flags & ZT_FLAG_PSEUDO ? - chans[ms->confna]->readchunkpreec : chans[ms->confna]->putlin); - for (x = 0; x < ZT_CHUNKSIZE; x++) - txb[x] = ZT_LIN2X(getlin[x], ms); - - break; - case ZT_CONF_MONITOR_TX_PREECHO: /* Monitor a channel's tx mode */ - /* if a pseudo-channel, ignore */ - if (ms->flags & ZT_FLAG_PSEUDO) - break; - - if (!chans[ms->confna]->readchunkpreec) - break; - - /* Add monitored channel */ - ACSS(getlin, chans[ms->confna]->flags & ZT_FLAG_PSEUDO ? - chans[ms->confna]->putlin : chans[ms->confna]->readchunkpreec); - for (x = 0; x < ZT_CHUNKSIZE; x++) - txb[x] = ZT_LIN2X(getlin[x], ms); - - break; - case ZT_CONF_MONITORBOTH_PREECHO: /* monitor a channel's rx and tx mode */ - /* if a pseudo-channel, ignore */ - if (ms->flags & ZT_FLAG_PSEUDO) - break; - - if (!chans[ms->confna]->readchunkpreec) - break; - - ACSS(getlin, chans[ms->confna]->putlin); - ACSS(getlin, chans[ms->confna]->readchunkpreec); - - for (x = 0; x < ZT_CHUNKSIZE; x++) - txb[x] = ZT_LIN2X(getlin[x], ms); - - break; - case ZT_CONF_REALANDPSEUDO: - /* This strange mode takes the transmit buffer and - puts it on the conference, minus its last sample, - then outputs from the conference minus the - real channel's last sample. */ - /* if to talk on conf */ - if (ms->confmode & ZT_CONF_PSEUDO_TALKER) { - /* Store temp value */ - memcpy(k, getlin, ZT_CHUNKSIZE * sizeof(short)); - /* Add conf value */ - ACSS(k, conf_sums_next[ms->_confn]); - /* save last one */ - memcpy(ms->conflast2, ms->conflast1, ZT_CHUNKSIZE * sizeof(short)); - memcpy(ms->conflast1, k, ZT_CHUNKSIZE * sizeof(short)); - /* get amount actually added */ - SCSS(ms->conflast1, conf_sums_next[ms->_confn]); - /* Really add in new value */ - ACSS(conf_sums_next[ms->_confn], ms->conflast1); - } else { - memset(ms->conflast1, 0, ZT_CHUNKSIZE * sizeof(short)); - memset(ms->conflast2, 0, ZT_CHUNKSIZE * sizeof(short)); - } - memset(getlin, 0, ZT_CHUNKSIZE * sizeof(short)); - txb[0] = ZT_LIN2X(0, ms); - memset(txb + 1, txb[0], ZT_CHUNKSIZE - 1); - /* fall through to normal conf mode */ - case ZT_CONF_CONF: /* Normal conference mode */ - if (ms->flags & ZT_FLAG_PSEUDO) /* if pseudo-channel */ - { - /* if to talk on conf */ - if (ms->confmode & ZT_CONF_TALKER) { - /* Store temp value */ - memcpy(k, getlin, ZT_CHUNKSIZE * sizeof(short)); - /* Add conf value */ - ACSS(k, conf_sums_next[ms->_confn]); - /* save last one */ - memcpy(ms->conflast2, ms->conflast1, ZT_CHUNKSIZE * sizeof(short)); - memcpy(ms->conflast1, k, ZT_CHUNKSIZE * sizeof(short)); - /* get amount actually added */ - SCSS(ms->conflast1, conf_sums_next[ms->_confn]); - /* Really add in new value */ - ACSS(conf_sums_next[ms->_confn], ms->conflast1); - /* add in stuff from pseudo-receive, too */ - ACSS(getlin,ms->putlin_pseudo); - memcpy(ms->getlin, getlin, ZT_CHUNKSIZE * sizeof(short)); - } else { - memset(ms->conflast1, 0, ZT_CHUNKSIZE * sizeof(short)); - memset(ms->conflast2, 0, ZT_CHUNKSIZE * sizeof(short)); - memset(getlin, 0, ZT_CHUNKSIZE * sizeof(short)); - } - txb[0] = ZT_LIN2X(0, ms); - memset(txb + 1, txb[0], ZT_CHUNKSIZE - 1); - break; - } - /* fall through */ - case ZT_CONF_CONFMON: /* Conference monitor mode */ - if (ms->confmode & ZT_CONF_LISTENER) { - /* Subtract out last sample written to conf */ - SCSS(getlin, ms->conflast); - /* Add in conference */ - ACSS(getlin, conf_sums[ms->_confn]); - } - for (x=0;x_confn], getlin); - /* Start with silence */ - memset(getlin, 0, ZT_CHUNKSIZE * sizeof(short)); - /* If a listener on the conf... */ - if (ms->confmode & ZT_CONF_LISTENER) { - /* Subtract last value written */ - SCSS(getlin, ms->conflast); - /* Add in conf */ - ACSS(getlin, conf_sums[ms->_confn]); - } - for (x=0;xconfna]) - break; - if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { - if (ms->ec) { - for (x=0;xconfna]->getlin[x], ms); - } else { - memcpy(txb, chans[ms->confna]->getraw, ZT_CHUNKSIZE); - } - } else { - if (ms->ec) { - for (x=0;xconfna]->putlin[x], ms); - } else { - memcpy(txb, chans[ms->confna]->putraw, ZT_CHUNKSIZE); - } - } - for (x=0;xconfmute || (ms->echostate & __ECHO_STATE_MUTE)) { - txb[0] = ZT_LIN2X(0, ms); - memset(txb + 1, txb[0], ZT_CHUNKSIZE - 1); - if (ms->echostate == ECHO_STATE_STARTTRAINING) { - /* Transmit impulse now */ - txb[0] = ZT_LIN2X(16384, ms); - ms->echostate = ECHO_STATE_AWAITINGECHO; - } - } - /* save value from last chunk */ - memcpy(ms->getlin_lastchunk, ms->getlin, ZT_CHUNKSIZE * sizeof(short)); - /* save value from current */ - memcpy(ms->getlin, getlin, ZT_CHUNKSIZE * sizeof(short)); - /* save value from current */ - memcpy(ms->getraw, txb, ZT_CHUNKSIZE); - /* if to make tx tone */ - if (ms->v1_1 || ms->v2_1 || ms->v3_1) - { - for (x=0;xtxgain[txb[x]]; -} - -static inline void __zt_getbuf_chunk(struct zt_chan *ss, unsigned char *txb) -{ - /* Called with ss->lock held */ - /* We transmit data from our master channel */ - struct zt_chan *ms = ss->master; - /* Buffer we're using */ - unsigned char *buf; - /* Old buffer number */ - int oldbuf; - /* Linear representation */ - int getlin; - /* How many bytes we need to process */ - int bytes = ZT_CHUNKSIZE, left; - int x; - - /* Let's pick something to transmit. First source to - try is our write-out buffer. Always check it first because - its our 'fast path' for whatever that's worth. */ - while(bytes) { - if ((ms->outwritebuf > -1) && !ms->txdisable) { - buf= ms->writebuf[ms->outwritebuf]; - left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf]; - if (left > bytes) - left = bytes; - if (ms->flags & ZT_FLAG_HDLC) { - /* If this is an HDLC channel we only send a byte of - HDLC. */ - for(x=0;xtxhdlc.bits < 8) - /* Load a byte of data only if needed */ - fasthdlc_tx_load_nocheck(&ms->txhdlc, buf[ms->writeidx[ms->outwritebuf]++]); - *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc); - } - bytes -= left; - } else { - memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left); - ms->writeidx[ms->outwritebuf]+=left; - txb += left; - bytes -= left; - } - /* Check buffer status */ - if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) { - /* We've reached the end of our buffer. Go to the next. */ - oldbuf = ms->outwritebuf; - /* Clear out write index and such */ - ms->writeidx[oldbuf] = 0; - ms->outwritebuf = (ms->outwritebuf + 1) % ms->numbufs; - - if (!(ms->flags & ZT_FLAG_MTP2)) { - ms->writen[oldbuf] = 0; - if (ms->outwritebuf == ms->inwritebuf) { - /* Whoopsies, we're run out of buffers. Mark ours - as -1 and wait for the filler to notify us that - there is something to write */ - ms->outwritebuf = -1; - if (ms->iomask & (ZT_IOMUX_WRITE | ZT_IOMUX_WRITEEMPTY)) - wake_up_interruptible(&ms->eventbufq); - /* If we're only supposed to start when full, disable the transmitter */ - if (ms->txbufpolicy == ZT_POLICY_WHEN_FULL) - ms->txdisable = 1; - } - } else { - if (ms->outwritebuf == ms->inwritebuf) { - ms->outwritebuf = oldbuf; - if (ms->iomask & (ZT_IOMUX_WRITE | ZT_IOMUX_WRITEEMPTY)) - wake_up_interruptible(&ms->eventbufq); - /* If we're only supposed to start when full, disable the transmitter */ - if (ms->txbufpolicy == ZT_POLICY_WHEN_FULL) - ms->txdisable = 1; - } - } - if (ms->inwritebuf < 0) { - /* The filler doesn't have a place to put data. Now - that we're done with this buffer, notify them. */ - ms->inwritebuf = oldbuf; - } -/* In the very orignal driver, it was quite well known to me (Jim) that there -was a possibility that a channel sleeping on a write block needed to -be potentially woken up EVERY time a buffer was emptied, not just on the first -one, because if only done on the first one there is a slight timing potential -of missing the wakeup (between where it senses the (lack of) active condition -(with interrupts disabled) and where it does the sleep (interrupts enabled) -in the read or iomux call, etc). That is why the write and iomux calls start -with an infinite loop that gets broken out of upon an active condition, -otherwise keeps sleeping and looking. The part in this code got "optimized" -out in the later versions, and is put back now. */ - if (!(ms->flags & (ZT_FLAG_NETDEV | ZT_FLAG_PPP))) { - wake_up_interruptible(&ms->writebufq); - wake_up_interruptible(&ms->sel); - if (ms->iomask & ZT_IOMUX_WRITE) - wake_up_interruptible(&ms->eventbufq); - } - /* Transmit a flag if this is an HDLC channel */ - if (ms->flags & ZT_FLAG_HDLC) - fasthdlc_tx_frame_nocheck(&ms->txhdlc); -#ifdef CONFIG_ZAPATA_NET - if (ms->flags & ZT_FLAG_NETDEV) - netif_wake_queue(ztchan_to_dev(ms)); -#endif -#ifdef CONFIG_ZAPATA_PPP - if (ms->flags & ZT_FLAG_PPP) { - ms->do_ppp_wakeup = 1; - tasklet_schedule(&ms->ppp_calls); - } -#endif - } - } else if (ms->curtone && !(ms->flags & ZT_FLAG_PSEUDO)) { - left = ms->curtone->tonesamples - ms->tonep; - if (left > bytes) - left = bytes; - for (x=0;xts, ms->curtone); - *(txb++) = ZT_LIN2X(getlin, ms); - } - ms->tonep+=left; - bytes -= left; - if (ms->tonep >= ms->curtone->tonesamples) { - struct zt_tone *last; - /* Go to the next sample of the tone */ - ms->tonep = 0; - last = ms->curtone; - ms->curtone = ms->curtone->next; - if (!ms->curtone) { - /* No more tones... Is this dtmf or mf? If so, go to the next digit */ - if (ms->dialing) - __do_dtmf(ms); - } else { - if (last != ms->curtone) - zt_init_tone_state(&ms->ts, ms->curtone); - } - } - } else if (ms->flags & ZT_FLAG_LOOPED) { - for (x = 0; x < bytes; x++) - txb[x] = ms->readchunk[x]; - bytes = 0; - } else if (ms->flags & ZT_FLAG_HDLC) { - for (x=0;xtxhdlc.bits < 8) - fasthdlc_tx_frame_nocheck(&ms->txhdlc); - *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc); - } - bytes = 0; - } else if (ms->flags & ZT_FLAG_CLEAR) { - /* Clear channels that are idle in audio mode need - to send silence; in non-audio mode, always send 0xff - so stupid switches won't consider the channel active - */ - if (ms->flags & ZT_FLAG_AUDIO) { - memset(txb, ZT_LIN2X(0, ms), bytes); - } else { - memset(txb, 0xFF, bytes); - } - bytes = 0; - } else { - memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */ - bytes = 0; - } - } -} - -static inline void rbs_itimer_expire(struct zt_chan *chan) -{ - /* the only way this could have gotten here, is if a channel - went onf hook longer then the wink or flash detect timeout */ - /* Called with chan->lock held */ - switch(chan->sig) - { - case ZT_SIG_FXOLS: /* if FXO, its definitely on hook */ - case ZT_SIG_FXOGS: - case ZT_SIG_FXOKS: - __qevent(chan,ZT_EVENT_ONHOOK); - chan->gotgs = 0; - break; -#if defined(EMFLASH) || defined(EMPULSE) - case ZT_SIG_EM: - case ZT_SIG_EM_E1: - if (chan->rxhooksig == ZT_RXSIG_ONHOOK) { - __qevent(chan,ZT_EVENT_ONHOOK); - break; - } - __qevent(chan,ZT_EVENT_RINGOFFHOOK); - break; -#endif -#ifdef FXSFLASH - case ZT_SIG_FXSKS: - if (chan->rxhooksig == ZT_RXSIG_ONHOOK) { - __qevent(chan, ZT_EVENT_ONHOOK); - break; - } -#endif - /* fall thru intentionally */ - default: /* otherwise, its definitely off hook */ - __qevent(chan,ZT_EVENT_RINGOFFHOOK); - break; - } -} - -static inline void __rbs_otimer_expire(struct zt_chan *chan) -{ - int len = 0; - /* Called with chan->lock held */ - - chan->otimer = 0; - /* Move to the next timer state */ - switch(chan->txstate) { - case ZT_TXSTATE_RINGOFF: - /* Turn on the ringer now that the silent time has passed */ - ++chan->cadencepos; - if (chan->cadencepos >= ZT_MAX_CADENCE) - chan->cadencepos = chan->firstcadencepos; - len = chan->ringcadence[chan->cadencepos]; - - if (!len) { - chan->cadencepos = chan->firstcadencepos; - len = chan->ringcadence[chan->cadencepos]; - } - - zt_rbs_sethook(chan, ZT_TXSIG_START, ZT_TXSTATE_RINGON, len); - __qevent(chan, ZT_EVENT_RINGERON); - break; - - case ZT_TXSTATE_RINGON: - /* Turn off the ringer now that the loud time has passed */ - ++chan->cadencepos; - if (chan->cadencepos >= ZT_MAX_CADENCE) - chan->cadencepos = 0; - len = chan->ringcadence[chan->cadencepos]; - - if (!len) { - chan->cadencepos = 0; - len = chan->curzone->ringcadence[chan->cadencepos]; - } - - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_RINGOFF, len); - __qevent(chan, ZT_EVENT_RINGEROFF); - break; - - case ZT_TXSTATE_START: - /* If we were starting, go off hook now ready to debounce */ - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_AFTERSTART, ZT_AFTERSTART_TIME); - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_PREWINK: - /* Actually wink */ - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_WINK, chan->winktime); - break; - - case ZT_TXSTATE_WINK: - /* Wink complete, go on hook and stabalize */ - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_ONHOOK, 0); - if (chan->file && (chan->file->f_flags & O_NONBLOCK)) - __qevent(chan, ZT_EVENT_HOOKCOMPLETE); - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_PREFLASH: - /* Actually flash */ - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_FLASH, chan->flashtime); - break; - - case ZT_TXSTATE_FLASH: - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_OFFHOOK, 0); - if (chan->file && (chan->file->f_flags & O_NONBLOCK)) - __qevent(chan, ZT_EVENT_HOOKCOMPLETE); - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_DEBOUNCE: - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_OFFHOOK, 0); - /* See if we've gone back on hook */ - if ((chan->rxhooksig == ZT_RXSIG_ONHOOK) && (chan->rxflashtime > 2)) - chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_AFTERSTART: - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_OFFHOOK, 0); - if (chan->file && (chan->file->f_flags & O_NONBLOCK)) - __qevent(chan, ZT_EVENT_HOOKCOMPLETE); - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_KEWL: - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_AFTERKEWL, ZT_AFTERKEWLTIME); - if (chan->file && (chan->file->f_flags & O_NONBLOCK)) - __qevent(chan, ZT_EVENT_HOOKCOMPLETE); - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_AFTERKEWL: - if (chan->kewlonhook) { - __qevent(chan,ZT_EVENT_ONHOOK); - } - chan->txstate = ZT_TXSTATE_ONHOOK; - chan->gotgs = 0; - break; - - case ZT_TXSTATE_PULSEBREAK: - zt_rbs_sethook(chan, ZT_TXSIG_OFFHOOK, ZT_TXSTATE_PULSEMAKE, - chan->pulsemaketime); - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_PULSEMAKE: - if (chan->pdialcount) - chan->pdialcount--; - if (chan->pdialcount) - { - zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, - ZT_TXSTATE_PULSEBREAK, chan->pulsebreaktime); - break; - } - chan->txstate = ZT_TXSTATE_PULSEAFTER; - chan->otimer = chan->pulseaftertime * ZT_CHUNKSIZE; - wake_up_interruptible(&chan->txstateq); - break; - - case ZT_TXSTATE_PULSEAFTER: - chan->txstate = ZT_TXSTATE_OFFHOOK; - __do_dtmf(chan); - wake_up_interruptible(&chan->txstateq); - break; - - default: - break; - } -} - -static void __zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig) -{ - - /* State machines for receive hookstate transitions - called with chan->lock held */ - - if ((chan->rxhooksig) == rxsig) return; - - if ((chan->flags & ZT_FLAG_SIGFREEZE)) return; - - chan->rxhooksig = rxsig; -#ifdef RINGBEGIN - if ((chan->sig & __ZT_SIG_FXS) && (rxsig == ZT_RXSIG_RING) && - (!chan->ringdebtimer)) - __qevent(chan,ZT_EVENT_RINGBEGIN); -#endif - switch(chan->sig) { - case ZT_SIG_EM: /* E and M */ - case ZT_SIG_EM_E1: - switch(rxsig) { - case ZT_RXSIG_OFFHOOK: /* went off hook */ - /* The interface is going off hook */ -#ifdef EMFLASH - if (chan->itimer) - { - __qevent(chan,ZT_EVENT_WINKFLASH); - chan->itimerset = chan->itimer = 0; - break; - } -#endif -#ifdef EMPULSE - if (chan->itimer) /* if timer still running */ - { - int plen = chan->itimerset - chan->itimer; - if (plen <= ZT_MAXPULSETIME) - { - if (plen >= ZT_MINPULSETIME) - { - chan->pulsecount++; - - chan->pulsetimer = ZT_PULSETIMEOUT; - chan->itimerset = chan->itimer = 0; - if (chan->pulsecount == 1) - __qevent(chan,ZT_EVENT_PULSE_START); - } - } - break; - } -#endif - /* set wink timer */ - chan->itimerset = chan->itimer = chan->rxwinktime * ZT_CHUNKSIZE; - break; - case ZT_RXSIG_ONHOOK: /* went on hook */ - /* This interface is now going on hook. - Check for WINK, etc */ - if (chan->itimer) - __qevent(chan,ZT_EVENT_WINKFLASH); -#if defined(EMFLASH) || defined(EMPULSE) - else { -#ifdef EMFLASH - chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; - -#else /* EMFLASH */ - chan->itimerset = chan->itimer = chan->rxwinktime * ZT_CHUNKSIZE; - -#endif /* EMFLASH */ - chan->gotgs = 0; - break; - } -#else /* EMFLASH || EMPULSE */ - else { - __qevent(chan,ZT_EVENT_ONHOOK); - chan->gotgs = 0; - } -#endif - chan->itimerset = chan->itimer = 0; - break; - default: - break; - } - break; - case ZT_SIG_FXSKS: /* FXS Kewlstart */ - /* ignore a bit poopy if loop not closed and stable */ - if (chan->txstate != ZT_TXSTATE_OFFHOOK) break; -#ifdef FXSFLASH - if (rxsig == ZT_RXSIG_ONHOOK) { - chan->itimer = ZT_FXSFLASHMAXTIME * ZT_CHUNKSIZE; - break; - } else if (rxsig == ZT_RXSIG_OFFHOOK) { - if (chan->itimer) { - /* did the offhook occur in the window? if not, ignore both events */ - if (chan->itimer <= ((ZT_FXSFLASHMAXTIME - ZT_FXSFLASHMINTIME) * ZT_CHUNKSIZE)) - __qevent(chan, ZT_EVENT_WINKFLASH); - } - chan->itimer = 0; - break; - } -#endif - /* fall through intentionally */ - case ZT_SIG_FXSGS: /* FXS Groundstart */ - if (rxsig == ZT_RXSIG_ONHOOK) { - chan->ringdebtimer = RING_DEBOUNCE_TIME; - chan->ringtrailer = 0; - if (chan->txstate != ZT_TXSTATE_DEBOUNCE) { - chan->gotgs = 0; - __qevent(chan,ZT_EVENT_ONHOOK); - } - } - break; - case ZT_SIG_FXOGS: /* FXO Groundstart */ - if (rxsig == ZT_RXSIG_START) { - /* if havent got gs, report it */ - if (!chan->gotgs) { - __qevent(chan,ZT_EVENT_RINGOFFHOOK); - chan->gotgs = 1; - } - } - /* fall through intentionally */ - case ZT_SIG_FXOLS: /* FXO Loopstart */ - case ZT_SIG_FXOKS: /* FXO Kewlstart */ - switch(rxsig) { - case ZT_RXSIG_OFFHOOK: /* went off hook */ - /* if asserti ng ring, stop it */ - if (chan->txstate == ZT_TXSTATE_START) { - zt_rbs_sethook(chan,ZT_TXSIG_OFFHOOK, ZT_TXSTATE_AFTERSTART, ZT_AFTERSTART_TIME); - } - chan->kewlonhook = 0; -#ifdef CONFIG_ZAPATA_DEBUG - printk("Off hook on channel %d, itimer = %d, gotgs = %d\n", chan->channo, chan->itimer, chan->gotgs); -#endif - if (chan->itimer) /* if timer still running */ - { - int plen = chan->itimerset - chan->itimer; - if (plen <= ZT_MAXPULSETIME) - { - if (plen >= ZT_MINPULSETIME) - { - chan->pulsecount++; - chan->pulsetimer = ZT_PULSETIMEOUT; - chan->itimer = chan->itimerset; - if (chan->pulsecount == 1) - __qevent(chan,ZT_EVENT_PULSE_START); - } - } else - __qevent(chan,ZT_EVENT_WINKFLASH); - } else { - /* if havent got GS detect */ - if (!chan->gotgs) { - __qevent(chan,ZT_EVENT_RINGOFFHOOK); - chan->gotgs = 1; - chan->itimerset = chan->itimer = 0; - } - } - chan->itimerset = chan->itimer = 0; - break; - case ZT_RXSIG_ONHOOK: /* went on hook */ - /* if not during offhook debounce time */ - if ((chan->txstate != ZT_TXSTATE_DEBOUNCE) && - (chan->txstate != ZT_TXSTATE_KEWL) && - (chan->txstate != ZT_TXSTATE_AFTERKEWL)) { - chan->itimerset = chan->itimer = chan->rxflashtime * ZT_CHUNKSIZE; - } - if (chan->txstate == ZT_TXSTATE_KEWL) - chan->kewlonhook = 1; - break; - default: - break; - } - default: - break; - } -} - -void zt_hooksig(struct zt_chan *chan, zt_rxsig_t rxsig) -{ - /* skip if no change */ - unsigned long flags; - spin_lock_irqsave(&chan->lock, flags); - __zt_hooksig_pvt(chan,rxsig); - spin_unlock_irqrestore(&chan->lock, flags); -} - -void zt_rbsbits(struct zt_chan *chan, int cursig) -{ - unsigned long flags; - if (cursig == chan->rxsig) - return; - - if ((chan->flags & ZT_FLAG_SIGFREEZE)) return; - - spin_lock_irqsave(&chan->lock, flags); - switch(chan->sig) { - case ZT_SIG_FXOGS: /* FXO Groundstart */ - /* B-bit only matters for FXO GS */ - if (!(cursig & ZT_BBIT)) { - __zt_hooksig_pvt(chan, ZT_RXSIG_START); - break; - } - /* Fall through */ - case ZT_SIG_EM: /* E and M */ - case ZT_SIG_EM_E1: - case ZT_SIG_FXOLS: /* FXO Loopstart */ - case ZT_SIG_FXOKS: /* FXO Kewlstart */ - if (cursig & ZT_ABIT) /* off hook */ - __zt_hooksig_pvt(chan,ZT_RXSIG_OFFHOOK); - else /* on hook */ - __zt_hooksig_pvt(chan,ZT_RXSIG_ONHOOK); - break; - - case ZT_SIG_FXSKS: /* FXS Kewlstart */ - case ZT_SIG_FXSGS: /* FXS Groundstart */ - /* Fall through */ - case ZT_SIG_FXSLS: - if (!(cursig & ZT_BBIT)) { - /* Check for ringing first */ - __zt_hooksig_pvt(chan, ZT_RXSIG_RING); - break; - } - if ((chan->sig != ZT_SIG_FXSLS) && (cursig & ZT_ABIT)) { - /* if went on hook */ - __zt_hooksig_pvt(chan, ZT_RXSIG_ONHOOK); - } else { - __zt_hooksig_pvt(chan, ZT_RXSIG_OFFHOOK); - } - break; - case ZT_SIG_CAS: - /* send event that something changed */ - __qevent(chan, ZT_EVENT_BITSCHANGED); - break; - - default: - break; - } - /* Keep track of signalling for next time */ - chan->rxsig = cursig; - spin_unlock_irqrestore(&chan->lock, flags); -} - -static inline void __zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char *txchunk) -{ - short rxlin, txlin; - int x; - unsigned long flags; - - spin_lock_irqsave(&ss->lock, flags); - - if (ss->readchunkpreec) { - /* Save a copy of the audio before the echo can has its way with it */ - for (x = 0; x < ZT_CHUNKSIZE; x++) - /* We only ever really need to deal with signed linear - let's just convert it now */ - ss->readchunkpreec[x] = ZT_XLAW(rxchunk[x], ss); - } - - /* Perform echo cancellation on a chunk if necessary */ - if (ss->ec) { -#if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP) - zt_kernel_fpu_begin(); -#endif - if (ss->echostate & __ECHO_STATE_MUTE) { - /* Special stuff for training the echo can */ - for (x=0;xechostate == ECHO_STATE_PRETRAINING) { - if (--ss->echotimer <= 0) { - ss->echotimer = 0; - ss->echostate = ECHO_STATE_STARTTRAINING; - } - } - if ((ss->echostate == ECHO_STATE_AWAITINGECHO) && (txlin > 8000)) { - ss->echolastupdate = 0; - ss->echostate = ECHO_STATE_TRAINING; - } - if (ss->echostate == ECHO_STATE_TRAINING) { - if (echo_can_traintap(ss->ec, ss->echolastupdate++, rxlin)) { -#if 0 - printk("Finished training (%d taps trained)!\n", ss->echolastupdate); -#endif - ss->echostate = ECHO_STATE_ACTIVE; - } - } - rxlin = 0; - rxchunk[x] = ZT_LIN2X((int)rxlin, ss); - } - } else { -#if !defined(ZT_EC_ARRAY_UPDATE) - for (x=0;xec, ZT_XLAW(txchunk[x], ss), rxlin); - rxchunk[x] = ZT_LIN2X((int) rxlin, ss); - } -#else /* defined(ZT_EC_ARRAY_UPDATE) */ - short rxlins[ZT_CHUNKSIZE], txlins[ZT_CHUNKSIZE]; - for (x = 0; x < ZT_CHUNKSIZE; x++) { - rxlins[x] = ZT_XLAW(rxchunk[x], ss); - txlins[x] = ZT_XLAW(txchunk[x], ss); - } - echo_can_array_update(ss->ec, rxlins, txlins); - for (x = 0; x < ZT_CHUNKSIZE; x++) - rxchunk[x] = ZT_LIN2X((int) rxlins[x], ss); -#endif /* defined(ZT_EC_ARRAY_UPDATE) */ - } -#if defined(CONFIG_ZAPTEL_MMX) || defined(ECHO_CAN_FP) - kernel_fpu_end(); -#endif - } - spin_unlock_irqrestore(&ss->lock, flags); -} - -void zt_ec_chunk(struct zt_chan *ss, unsigned char *rxchunk, const unsigned char *txchunk) -{ - __zt_ec_chunk(ss, rxchunk, txchunk); -} - -void zt_ec_span(struct zt_span *span) -{ - int x; - for (x = 0; x < span->channels; x++) { - if (span->chans[x].ec) - __zt_ec_chunk(&span->chans[x], span->chans[x].readchunk, span->chans[x].writechunk); - } -} - -/* return 0 if nothing detected, 1 if lack of tone, 2 if presence of tone */ -/* modifies buffer pointed to by 'amp' with notched-out values */ -static inline int sf_detect (sf_detect_state_t *s, - short *amp, - int samples,long p1, long p2, long p3) -{ -int i,rv = 0; -long x,y; - -#define SF_DETECT_SAMPLES (ZT_CHUNKSIZE * 5) -#define SF_DETECT_MIN_ENERGY 500 -#define NB 14 /* number of bits to shift left */ - - /* determine energy level before filtering */ - for(i = 0; i < samples; i++) - { - if (amp[i] < 0) s->e1 -= amp[i]; - else s->e1 += amp[i]; - } - /* do 2nd order IIR notch filter at given freq. and calculate - energy */ - for(i = 0; i < samples; i++) - { - x = amp[i] << NB; - y = s->x2 + (p1 * (s->x1 >> NB)) + x; - y += (p2 * (s->y2 >> NB)) + - (p3 * (s->y1 >> NB)); - s->x2 = s->x1; - s->x1 = x; - s->y2 = s->y1; - s->y1 = y; - amp[i] = y >> NB; - if (amp[i] < 0) s->e2 -= amp[i]; - else s->e2 += amp[i]; - } - s->samps += i; - /* if time to do determination */ - if ((s->samps) >= SF_DETECT_SAMPLES) - { - rv = 1; /* default to no tone */ - /* if enough energy, it is determined to be a tone */ - if (((s->e1 - s->e2) / s->samps) > SF_DETECT_MIN_ENERGY) rv = 2; - /* reset energy processing variables */ - s->samps = 0; - s->e1 = s->e2 = 0; - } - return(rv); -} - -static inline void __zt_process_putaudio_chunk(struct zt_chan *ss, unsigned char *rxb) -{ - /* We transmit data from our master channel */ - /* Called with ss->lock held */ - struct zt_chan *ms = ss->master; - /* Linear version of received data */ - short putlin[ZT_CHUNKSIZE],k[ZT_CHUNKSIZE]; - int x,r; - - if (ms->dialing) ms->afterdialingtimer = 50; - else if (ms->afterdialingtimer) ms->afterdialingtimer--; - if (ms->afterdialingtimer && (!(ms->flags & ZT_FLAG_PSEUDO))) { - /* Be careful since memset is likely a macro */ - rxb[0] = ZT_LIN2X(0, ms); - memset(&rxb[1], rxb[0], ZT_CHUNKSIZE - 1); /* receive as silence if dialing */ - } - for (x=0;xrxgain[rxb[x]]; - putlin[x] = ms->putlin_pseudo[x] = ZT_XLAW(rxb[x], ms); - } - -#ifndef NO_ECHOCAN_DISABLE - if (ms->ec) { - for (x=0;xrxecdis, putlin[x])) { - printk("zaptel Disabled echo canceller because of tone (rx) on channel %d\n", ss->channo); - ms->echocancel = 0; - ms->echostate = ECHO_STATE_IDLE; - ms->echolastupdate = 0; - ms->echotimer = 0; - echo_can_free(ms->ec); - ms->ec = NULL; - break; - } - } - } -#endif - /* if doing rx tone decoding */ - if (ms->rxp1 && ms->rxp2 && ms->rxp3) - { - r = sf_detect(&ms->rd,putlin,ZT_CHUNKSIZE,ms->rxp1, - ms->rxp2,ms->rxp3); - /* Convert back */ - for(x=0;xrd.lastdetect) - { - if (((r == 2) && !(ms->toneflags & ZT_REVERSE_RXTONE)) || - ((r == 1) && (ms->toneflags & ZT_REVERSE_RXTONE))) - { - __qevent(ms,ZT_EVENT_RINGOFFHOOK); - } - else - { - __qevent(ms,ZT_EVENT_ONHOOK); - } - ms->rd.lastdetect = r; - } - } - } - - if (!(ms->flags & ZT_FLAG_PSEUDO)) { - memcpy(ms->putlin, putlin, ZT_CHUNKSIZE * sizeof(short)); - memcpy(ms->putraw, rxb, ZT_CHUNKSIZE); - } - - /* Take the rxc, twiddle it for conferencing if appropriate and put it - back */ - if ((!ms->confmute && !ms->afterdialingtimer) || - (ms->flags & ZT_FLAG_PSEUDO)) { - switch(ms->confmode & ZT_CONF_MODE_MASK) { - case ZT_CONF_NORMAL: /* Normal mode */ - /* Do nothing. rx goes output */ - break; - case ZT_CONF_MONITOR: /* Monitor a channel's rx mode */ - /* if not a pseudo-channel, ignore */ - if (!(ms->flags & ZT_FLAG_PSEUDO)) break; - /* Add monitored channel */ - if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { - ACSS(putlin, chans[ms->confna]->getlin); - } else { - ACSS(putlin, chans[ms->confna]->putlin); - } - /* Convert back */ - for(x=0;xflags & ZT_FLAG_PSEUDO)) break; - /* Add monitored channel */ - if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { - ACSS(putlin, chans[ms->confna]->putlin); - } else { - ACSS(putlin, chans[ms->confna]->getlin); - } - /* Convert back */ - for(x=0;xflags & ZT_FLAG_PSEUDO)) break; - /* Note: Technically, saturation should be done at - the end of the whole addition, but for performance - reasons, we don't do that. Besides, it only matters - when you're so loud you're clipping anyway */ - ACSS(putlin, chans[ms->confna]->getlin); - ACSS(putlin, chans[ms->confna]->putlin); - /* Convert back */ - for(x=0;xflags & ZT_FLAG_PSEUDO)) - break; - - if (!chans[ms->confna]->readchunkpreec) - break; - - /* Add monitored channel */ - ACSS(putlin, chans[ms->confna]->flags & ZT_FLAG_PSEUDO ? - chans[ms->confna]->getlin : chans[ms->confna]->readchunkpreec); - for (x = 0; x < ZT_CHUNKSIZE; x++) - rxb[x] = ZT_LIN2X(putlin[x], ms); - - break; - case ZT_CONF_MONITOR_TX_PREECHO: /* Monitor a channel's tx mode */ - /* if not a pseudo-channel, ignore */ - if (!(ms->flags & ZT_FLAG_PSEUDO)) - break; - - if (!chans[ms->confna]->readchunkpreec) - break; - - /* Add monitored channel */ - ACSS(putlin, chans[ms->confna]->flags & ZT_FLAG_PSEUDO ? - chans[ms->confna]->readchunkpreec : chans[ms->confna]->getlin); - for (x = 0; x < ZT_CHUNKSIZE; x++) - rxb[x] = ZT_LIN2X(putlin[x], ms); - - break; - case ZT_CONF_MONITORBOTH_PREECHO: /* Monitor a channel's tx and rx mode */ - /* if not a pseudo-channel, ignore */ - if (!(ms->flags & ZT_FLAG_PSEUDO)) - break; - - if (!chans[ms->confna]->readchunkpreec) - break; - - /* Note: Technically, saturation should be done at - the end of the whole addition, but for performance - reasons, we don't do that. Besides, it only matters - when you're so loud you're clipping anyway */ - ACSS(putlin, chans[ms->confna]->getlin); - ACSS(putlin, chans[ms->confna]->readchunkpreec); - for (x = 0; x < ZT_CHUNKSIZE; x++) - rxb[x] = ZT_LIN2X(putlin[x], ms); - - break; - case ZT_CONF_REALANDPSEUDO: - /* do normal conf mode processing */ - if (ms->confmode & ZT_CONF_TALKER) { - /* Store temp value */ - memcpy(k, putlin, ZT_CHUNKSIZE * sizeof(short)); - /* Add conf value */ - ACSS(k, conf_sums_next[ms->_confn]); - /* get amount actually added */ - memcpy(ms->conflast, k, ZT_CHUNKSIZE * sizeof(short)); - SCSS(ms->conflast, conf_sums_next[ms->_confn]); - /* Really add in new value */ - ACSS(conf_sums_next[ms->_confn], ms->conflast); - } else memset(ms->conflast, 0, ZT_CHUNKSIZE * sizeof(short)); - /* do the pseudo-channel part processing */ - memset(putlin, 0, ZT_CHUNKSIZE * sizeof(short)); - if (ms->confmode & ZT_CONF_PSEUDO_LISTENER) { - /* Subtract out previous last sample written to conf */ - SCSS(putlin, ms->conflast2); - /* Add in conference */ - ACSS(putlin, conf_sums[ms->_confn]); - } - /* Convert back */ - for(x=0;xflags & ZT_FLAG_PSEUDO) /* if a pseudo-channel */ - { - if (ms->confmode & ZT_CONF_TALKER) { - /* Store temp value */ - memcpy(k, putlin, ZT_CHUNKSIZE * sizeof(short)); - /* Add conf value */ - ACSS(k, conf_sums_next[ms->_confn]); - /* get amount actually added */ - memcpy(ms->conflast, k, ZT_CHUNKSIZE * sizeof(short)); - SCSS(ms->conflast, conf_sums_next[ms->_confn]); - /* Really add in new value */ - ACSS(conf_sums_next[ms->_confn], ms->conflast); - } else memset(ms->conflast, 0, ZT_CHUNKSIZE * sizeof(short)); - if (ms->confmode & ZT_CONF_LISTENER) { - /* Subtract out last sample written to conf */ - SCSS(putlin, ms->conflast2); - /* Add in conference */ - ACSS(putlin, conf_sums[ms->_confn]); - } - /* Convert back */ - for(x=0;xputlin, putlin, ZT_CHUNKSIZE * sizeof(short)); - break; - } - /* fall through */ - case ZT_CONF_CONFANN: /* Conference with announce */ - if (ms->confmode & ZT_CONF_TALKER) { - /* Store temp value */ - memcpy(k, putlin, ZT_CHUNKSIZE * sizeof(short)); - /* Add conf value */ - ACSS(k, conf_sums_next[ms->_confn]); - /* get amount actually added */ - memcpy(ms->conflast, k, ZT_CHUNKSIZE * sizeof(short)); - SCSS(ms->conflast, conf_sums_next[ms->_confn]); - /* Really add in new value */ - ACSS(conf_sums_next[ms->_confn], ms->conflast); - } else - memset(ms->conflast, 0, ZT_CHUNKSIZE * sizeof(short)); - /* rxc unmodified */ - break; - case ZT_CONF_CONFMON: - case ZT_CONF_CONFANNMON: - if (ms->confmode & ZT_CONF_TALKER) { - /* Store temp value */ - memcpy(k, putlin, ZT_CHUNKSIZE * sizeof(short)); - /* Subtract last value */ - SCSS(conf_sums[ms->_confn], ms->conflast); - /* Add conf value */ - ACSS(k, conf_sums[ms->_confn]); - /* get amount actually added */ - memcpy(ms->conflast, k, ZT_CHUNKSIZE * sizeof(short)); - SCSS(ms->conflast, conf_sums[ms->_confn]); - /* Really add in new value */ - ACSS(conf_sums[ms->_confn], ms->conflast); - } else - memset(ms->conflast, 0, ZT_CHUNKSIZE * sizeof(short)); - for (x=0;x_confn][x], ms); - break; - case ZT_CONF_DIGITALMON: - /* if not a pseudo-channel, ignore */ - if (!(ms->flags & ZT_FLAG_PSEUDO)) break; - /* Add monitored channel */ - if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { - memcpy(rxb, chans[ms->confna]->getraw, ZT_CHUNKSIZE); - } else { - memcpy(rxb, chans[ms->confna]->putraw, ZT_CHUNKSIZE); - } - break; - } - } -} - -/* HDLC (or other) receiver buffer functions for read side */ -static inline void __putbuf_chunk(struct zt_chan *ss, unsigned char *rxb, int bytes) -{ - /* We transmit data from our master channel */ - /* Called with ss->lock held */ - struct zt_chan *ms = ss->master; - /* Our receive buffer */ - unsigned char *buf; -#if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP) - /* SKB for receiving network stuff */ - struct sk_buff *skb=NULL; -#endif - int oldbuf; - int eof=0; - int abort=0; - int res = 0; - int left, x; - - while(bytes) { -#if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP) - skb = NULL; -#endif - abort = 0; - eof = 0; - /* Next, figure out if we've got a buffer to receive into */ - if (ms->inreadbuf > -1) { - /* Read into the current buffer */ - buf = ms->readbuf[ms->inreadbuf]; - left = ms->blocksize - ms->readidx[ms->inreadbuf]; - if (left > bytes) - left = bytes; - if (ms->flags & ZT_FLAG_HDLC) { - for (x=0;xrxhdlc, *(rxb++)); - bytes--; - res = fasthdlc_rx_run(&ms->rxhdlc); - /* If there is nothing there, continue */ - if (res & RETURN_EMPTY_FLAG) - continue; - else if (res & RETURN_COMPLETE_FLAG) { - /* Only count this if it's a non-empty frame */ - if (ms->readidx[ms->inreadbuf]) { - if ((ms->flags & ZT_FLAG_FCS) && (ms->infcs != PPP_GOODFCS)) { - abort = ZT_EVENT_BADFCS; - } else - eof=1; - break; - } - continue; - } else if (res & RETURN_DISCARD_FLAG) { - /* This could be someone idling with - "idle" instead of "flag" */ - if (!ms->readidx[ms->inreadbuf]) - continue; - abort = ZT_EVENT_ABORT; - break; - } else { - unsigned char rxc; - rxc = res; - ms->infcs = PPP_FCS(ms->infcs, rxc); - buf[ms->readidx[ms->inreadbuf]++] = rxc; - /* Pay attention to the possibility of an overrun */ - if (ms->readidx[ms->inreadbuf] >= ms->blocksize) { - if (!ss->span->alarms) - printk(KERN_WARNING "HDLC Receiver overrun on channel %s (master=%s)\n", ss->name, ss->master->name); - abort=ZT_EVENT_OVERRUN; - /* Force the HDLC state back to frame-search mode */ - ms->rxhdlc.state = 0; - ms->rxhdlc.bits = 0; - ms->readidx[ms->inreadbuf]=0; - break; - } - } - } - } else { - /* Not HDLC */ - memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left); - rxb += left; - ms->readidx[ms->inreadbuf] += left; - bytes -= left; - /* End of frame is decided by block size of 'N' */ - eof = (ms->readidx[ms->inreadbuf] >= ms->blocksize); - if (eof && (ss->flags & ZT_FLAG_NOSTDTXRX)) { - eof = 0; - abort = ZT_EVENT_OVERRUN; - } - } - if (eof) { - /* Finished with this buffer, try another. */ - oldbuf = ms->inreadbuf; - ms->infcs = PPP_INITFCS; - ms->readn[ms->inreadbuf] = ms->readidx[ms->inreadbuf]; -#ifdef CONFIG_ZAPATA_DEBUG - printk("EOF, len is %d\n", ms->readn[ms->inreadbuf]); -#endif -#if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP) - if (ms->flags & (ZT_FLAG_NETDEV | ZT_FLAG_PPP)) { -#ifdef CONFIG_ZAPATA_NET -#endif /* CONFIG_ZAPATA_NET */ - /* Our network receiver logic is MUCH - different. We actually only use a single - buffer */ - if (ms->readn[ms->inreadbuf] > 1) { - /* Drop the FCS */ - ms->readn[ms->inreadbuf] -= 2; - /* Allocate an SKB */ -#ifdef CONFIG_ZAPATA_PPP - if (!ms->do_ppp_error) -#endif - skb = dev_alloc_skb(ms->readn[ms->inreadbuf]); - if (skb) { - /* XXX Get rid of this memcpy XXX */ - memcpy(skb->data, ms->readbuf[ms->inreadbuf], ms->readn[ms->inreadbuf]); - skb_put(skb, ms->readn[ms->inreadbuf]); -#ifdef CONFIG_ZAPATA_NET - if (ms->flags & ZT_FLAG_NETDEV) { -#ifdef LINUX26 - struct net_device_stats *stats = hdlc_stats(ms->hdlcnetdev->netdev); -#else /* LINUX26 */ - struct net_device_stats *stats = &ms->hdlcnetdev->netdev.stats; -#endif /* LINUX26 */ - stats->rx_packets++; - stats->rx_bytes += ms->readn[ms->inreadbuf]; - } -#endif - - } else { -#ifdef CONFIG_ZAPATA_NET - if (ms->flags & ZT_FLAG_NETDEV) { -#ifdef LINUX26 - struct net_device_stats *stats = hdlc_stats(ms->hdlcnetdev->netdev); -#else /* LINUX26 */ - struct net_device_stats *stats = &ms->hdlcnetdev->netdev.stats; -#endif /* LINUX26 */ - stats->rx_dropped++; - } -#endif -#ifdef CONFIG_ZAPATA_PPP - if (ms->flags & ZT_FLAG_PPP) { - abort = ZT_EVENT_OVERRUN; - } -#endif -#if 1 -#ifdef CONFIG_ZAPATA_PPP - if (!ms->do_ppp_error) -#endif - printk("Memory squeeze, dropped one\n"); -#endif - } - } - /* We don't cycle through buffers, just - reuse the same one */ - ms->readn[ms->inreadbuf] = 0; - ms->readidx[ms->inreadbuf] = 0; - } else -#endif - { - /* This logic might confuse and astound. Basically we need to find - * the previous buffer index. It should be safe because, regardless - * of whether or not it has been copied to user space, nothing should - * have messed around with it since then */ - - int comparemessage; - - if (ms->flags & ZT_FLAG_MTP2) { - comparemessage = (ms->inreadbuf - 1) & (ms->numbufs - 1); - - res = memcmp(ms->readbuf[comparemessage], ms->readbuf[ms->inreadbuf], ms->readn[ms->inreadbuf]); - } - - if ((ms->flags & ZT_FLAG_MTP2) && !res) { - /* Our messages are the same, so discard - - * Don't advance buffers, reset indexes and buffer sizes. */ - ms->readn[ms->inreadbuf] = 0; - ms->readidx[ms->inreadbuf] = 0; - } else { - ms->inreadbuf = (ms->inreadbuf + 1) % ms->numbufs; - if (ms->inreadbuf == ms->outreadbuf) { - /* Whoops, we're full, and have no where else - to store into at the moment. We'll drop it - until there's a buffer available */ -#ifdef CONFIG_ZAPATA_DEBUG - printk("Out of storage space\n"); -#endif - ms->inreadbuf = -1; - /* Enable the receiver in case they've got POLICY_WHEN_FULL */ - ms->rxdisable = 0; - } - if (ms->outreadbuf < 0) { /* start out buffer if not already */ - ms->outreadbuf = oldbuf; - } -/* In the very orignal driver, it was quite well known to me (Jim) that there -was a possibility that a channel sleeping on a receive block needed to -be potentially woken up EVERY time a buffer was filled, not just on the first -one, because if only done on the first one there is a slight timing potential -of missing the wakeup (between where it senses the (lack of) active condition -(with interrupts disabled) and where it does the sleep (interrupts enabled) -in the read or iomux call, etc). That is why the read and iomux calls start -with an infinite loop that gets broken out of upon an active condition, -otherwise keeps sleeping and looking. The part in this code got "optimized" -out in the later versions, and is put back now. */ - if (!ms->rxdisable) { /* if receiver enabled */ - /* Notify a blocked reader that there is data available - to be read, unless we're waiting for it to be full */ -#ifdef CONFIG_ZAPATA_DEBUG - printk("Notifying reader data in block %d\n", oldbuf); -#endif - wake_up_interruptible(&ms->readbufq); - wake_up_interruptible(&ms->sel); - if (ms->iomask & ZT_IOMUX_READ) - wake_up_interruptible(&ms->eventbufq); - } - } - } - } - if (abort) { - /* Start over reading frame */ - ms->readidx[ms->inreadbuf] = 0; - ms->infcs = PPP_INITFCS; - -#ifdef CONFIG_ZAPATA_NET - if (ms->flags & ZT_FLAG_NETDEV) { -#ifdef LINUX26 - struct net_device_stats *stats = hdlc_stats(ms->hdlcnetdev->netdev); -#else /* LINUX26 */ - struct net_device_stats *stats = &ms->hdlcnetdev->netdev.stats; -#endif /* LINUX26 */ - stats->rx_errors++; - if (abort == ZT_EVENT_OVERRUN) - stats->rx_over_errors++; - if (abort == ZT_EVENT_BADFCS) - stats->rx_crc_errors++; - if (abort == ZT_EVENT_ABORT) - stats->rx_frame_errors++; - } else -#endif -#ifdef CONFIG_ZAPATA_PPP - if (ms->flags & ZT_FLAG_PPP) { - ms->do_ppp_error = 1; - tasklet_schedule(&ms->ppp_calls); - } else -#endif - - if ((ms->flags & ZT_FLAG_OPEN) && !ss->span->alarms) - /* Notify the receiver... */ - __qevent(ss->master, abort); -#if 0 - printk("torintr_receive: Aborted %d bytes of frame on %d\n", amt, ss->master); -#endif - - } - } else /* No place to receive -- drop on the floor */ - break; -#ifdef CONFIG_ZAPATA_NET - if (skb && (ms->flags & ZT_FLAG_NETDEV)) -#ifdef NEW_HDLC_INTERFACE - { -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22) - skb->mac.raw = skb->data; -#else - skb_reset_mac_header(skb); -#endif - skb->dev = ztchan_to_dev(ms); -#ifdef ZAP_HDLC_TYPE_TRANS - skb->protocol = hdlc_type_trans(skb, ztchan_to_dev(ms)); -#else - skb->protocol = htons (ETH_P_HDLC); -#endif - netif_rx(skb); - } -#else - hdlc_netif_rx(&ms->hdlcnetdev->netdev, skb); -#endif -#endif -#ifdef CONFIG_ZAPATA_PPP - if (skb && (ms->flags & ZT_FLAG_PPP)) { - unsigned char *tmp; - tmp = skb->data; - skb_pull(skb, 2); - /* Make sure that it's addressed to ALL STATIONS and UNNUMBERED */ - if (!tmp || (tmp[0] != 0xff) || (tmp[1] != 0x03)) { - /* Invalid SKB -- drop */ - if (tmp) - printk("Received invalid SKB (%02x, %02x)\n", tmp[0], tmp[1]); - dev_kfree_skb_irq(skb); - } else { - skb_queue_tail(&ms->ppp_rq, skb); - tasklet_schedule(&ms->ppp_calls); - } - } -#endif - } -} - -static inline void __zt_putbuf_chunk(struct zt_chan *ss, unsigned char *rxb) -{ - __putbuf_chunk(ss, rxb, ZT_CHUNKSIZE); -} - -static void __zt_hdlc_abort(struct zt_chan *ss, int event) -{ - if (ss->inreadbuf >= 0) - ss->readidx[ss->inreadbuf] = 0; - if ((ss->flags & ZT_FLAG_OPEN) && !ss->span->alarms) - __qevent(ss->master, event); -} - -extern void zt_hdlc_abort(struct zt_chan *ss, int event) -{ - unsigned long flags; - spin_lock_irqsave(&ss->lock, flags); - __zt_hdlc_abort(ss, event); - spin_unlock_irqrestore(&ss->lock, flags); -} - -extern void zt_hdlc_putbuf(struct zt_chan *ss, unsigned char *rxb, int bytes) -{ - unsigned long flags; - int res; - int left; - - spin_lock_irqsave(&ss->lock, flags); - if (ss->inreadbuf < 0) { -#ifdef CONFIG_ZAPATA_DEBUG - printk("No place to receive HDLC frame\n"); -#endif - spin_unlock_irqrestore(&ss->lock, flags); - return; - } - /* Read into the current buffer */ - left = ss->blocksize - ss->readidx[ss->inreadbuf]; - if (left > bytes) - left = bytes; - if (left > 0) { - memcpy(ss->readbuf[ss->inreadbuf] + ss->readidx[ss->inreadbuf], rxb, left); - rxb += left; - ss->readidx[ss->inreadbuf] += left; - bytes -= left; - } - /* Something isn't fit into buffer */ - if (bytes) { -#ifdef CONFIG_ZAPATA_DEBUG - printk("HDLC frame isn't fit into buffer space\n"); -#endif - __zt_hdlc_abort(ss, ZT_EVENT_OVERRUN); - } - res = left; - spin_unlock_irqrestore(&ss->lock, flags); -} - -extern void zt_hdlc_finish(struct zt_chan *ss) -{ - int oldreadbuf; - unsigned long flags; - - spin_lock_irqsave(&ss->lock, flags); - - if ((oldreadbuf = ss->inreadbuf) < 0) { -#ifdef CONFIG_ZAPATA_DEBUG - printk("No buffers to finish\n"); -#endif - spin_unlock_irqrestore(&ss->lock, flags); - return; - } - - if (!ss->readidx[ss->inreadbuf]) { -#ifdef CONFIG_ZAPATA_DEBUG - printk("Empty HDLC frame received\n"); -#endif - spin_unlock_irqrestore(&ss->lock, flags); - return; - } - - ss->readn[ss->inreadbuf] = ss->readidx[ss->inreadbuf]; - ss->inreadbuf = (ss->inreadbuf + 1) % ss->numbufs; - if (ss->inreadbuf == ss->outreadbuf) { - ss->inreadbuf = -1; -#ifdef CONFIG_ZAPATA_DEBUG - printk("Notifying reader data in block %d\n", oldreadbuf); -#endif - ss->rxdisable = 0; - } - if (ss->outreadbuf < 0) { - ss->outreadbuf = oldreadbuf; - } - - if (!ss->rxdisable) { - wake_up_interruptible(&ss->readbufq); - wake_up_interruptible(&ss->sel); - if (ss->iomask & ZT_IOMUX_READ) - wake_up_interruptible(&ss->eventbufq); - } - spin_unlock_irqrestore(&ss->lock, flags); -} - -/* Returns 1 if EOF, 0 if data is still in frame, -1 if EOF and no buffers left */ -extern int zt_hdlc_getbuf(struct zt_chan *ss, unsigned char *bufptr, unsigned int *size) -{ - unsigned char *buf; - unsigned long flags; - int left = 0; - int res; - int oldbuf; - - spin_lock_irqsave(&ss->lock, flags); - if (ss->outwritebuf > -1) { - buf = ss->writebuf[ss->outwritebuf]; - left = ss->writen[ss->outwritebuf] - ss->writeidx[ss->outwritebuf]; - /* Strip off the empty HDLC CRC end */ - left -= 2; - if (left <= *size) { - *size = left; - res = 1; - } else - res = 0; - - memcpy(bufptr, &buf[ss->writeidx[ss->outwritebuf]], *size); - ss->writeidx[ss->outwritebuf] += *size; - - if (res) { - /* Rotate buffers */ - oldbuf = ss->outwritebuf; - ss->writeidx[oldbuf] = 0; - ss->writen[oldbuf] = 0; - ss->outwritebuf = (ss->outwritebuf + 1) % ss->numbufs; - if (ss->outwritebuf == ss->inwritebuf) { - ss->outwritebuf = -1; - if (ss->iomask & (ZT_IOMUX_WRITE | ZT_IOMUX_WRITEEMPTY)) - wake_up_interruptible(&ss->eventbufq); - /* If we're only supposed to start when full, disable the transmitter */ - if (ss->txbufpolicy == ZT_POLICY_WHEN_FULL) - ss->txdisable = 1; - res = -1; - } - - if (ss->inwritebuf < 0) - ss->inwritebuf = oldbuf; - - if (!(ss->flags & (ZT_FLAG_NETDEV | ZT_FLAG_PPP))) { - wake_up_interruptible(&ss->writebufq); - wake_up_interruptible(&ss->sel); - if ((ss->iomask & ZT_IOMUX_WRITE) && (res >= 0)) - wake_up_interruptible(&ss->eventbufq); - } - } - } else { - res = -1; - *size = 0; - } - spin_unlock_irqrestore(&ss->lock, flags); - - return res; -} - - -static void process_timers(void) -{ - unsigned long flags; - struct zt_timer *cur; - spin_lock_irqsave(&zaptimerlock, flags); - cur = zaptimers; - while(cur) { - if (cur->ms) { - cur->pos -= ZT_CHUNKSIZE; - if (cur->pos <= 0) { - cur->tripped++; - cur->pos = cur->ms; - wake_up_interruptible(&cur->sel); - } - } - cur = cur->next; - } - spin_unlock_irqrestore(&zaptimerlock, flags); -} - -static unsigned int zt_timer_poll(struct file *file, struct poll_table_struct *wait_table) -{ - struct zt_timer *timer = file->private_data; - unsigned long flags; - int ret = 0; - if (timer) { - poll_wait(file, &timer->sel, wait_table); - spin_lock_irqsave(&zaptimerlock, flags); - if (timer->tripped || timer->ping) - ret |= POLLPRI; - spin_unlock_irqrestore(&zaptimerlock, flags); - } else - ret = -EINVAL; - return ret; -} - -/* device poll routine */ -static unsigned int -zt_chan_poll(struct file *file, struct poll_table_struct *wait_table, int unit) -{ - - struct zt_chan *chan = chans[unit]; - int ret; - unsigned long flags; - - /* do the poll wait */ - if (chan) { - poll_wait(file, &chan->sel, wait_table); - ret = 0; /* start with nothing to return */ - spin_lock_irqsave(&chan->lock, flags); - /* if at least 1 write buffer avail */ - if (chan->inwritebuf > -1) { - ret |= POLLOUT | POLLWRNORM; - } - if ((chan->outreadbuf > -1) && !chan->rxdisable) { - ret |= POLLIN | POLLRDNORM; - } - if (chan->eventoutidx != chan->eventinidx) - { - /* Indicate an exception */ - ret |= POLLPRI; - } - spin_unlock_irqrestore(&chan->lock, flags); - } else - ret = -EINVAL; - return(ret); /* return what we found */ -} - -static int zt_mmap(struct file *file, struct vm_area_struct *vm) -{ - int unit = UNIT(file); - if (unit == 250) - return zt_transcode_fops->mmap(file, vm); - return -ENOSYS; -} - -static unsigned int zt_poll(struct file *file, struct poll_table_struct *wait_table) -{ - int unit = UNIT(file); - struct zt_chan *chan; - - if (!unit) - return -EINVAL; - - if (unit == 250) - return zt_transcode_fops->poll(file, wait_table); - - if (unit == 253) - return zt_timer_poll(file, wait_table); - - if (unit == 254) { - chan = file->private_data; - if (!chan) - return -EINVAL; - return zt_chan_poll(file, wait_table,chan->channo); - } - if (unit == 255) { - chan = file->private_data; - if (!chan) { - printk("No pseudo channel structure to read?\n"); - return -EINVAL; - } - return zt_chan_poll(file, wait_table, chan->channo); - } - return zt_chan_poll(file, wait_table, unit); -} - -static void __zt_transmit_chunk(struct zt_chan *chan, unsigned char *buf) -{ - unsigned char silly[ZT_CHUNKSIZE]; - /* Called with chan->lock locked */ -#ifdef OPTIMIZE_CHANMUTE - if(likely(chan->chanmute)) - return; -#endif - if (!buf) - buf = silly; - __zt_getbuf_chunk(chan, buf); - - if ((chan->flags & ZT_FLAG_AUDIO) || (chan->confmode)) { -#ifdef CONFIG_ZAPTEL_MMX - zt_kernel_fpu_begin(); -#endif - __zt_process_getaudio_chunk(chan, buf); -#ifdef CONFIG_ZAPTEL_MMX - kernel_fpu_end(); -#endif - } -} - -static inline void __zt_real_transmit(struct zt_chan *chan) -{ - /* Called with chan->lock held */ -#ifdef OPTIMIZE_CHANMUTE - if(likely(chan->chanmute)) - return; -#endif - if (chan->confmode) { - /* Pull queued data off the conference */ - __buf_pull(&chan->confout, chan->writechunk, chan, "zt_real_transmit"); - } else { - __zt_transmit_chunk(chan, chan->writechunk); - } -} - -static void __zt_getempty(struct zt_chan *ms, unsigned char *buf) -{ - int bytes = ZT_CHUNKSIZE; - int left; - unsigned char *txb = buf; - int x; - short getlin; - /* Called with ms->lock held */ - - while(bytes) { - /* Receive silence, or tone */ - if (ms->curtone) { - left = ms->curtone->tonesamples - ms->tonep; - if (left > bytes) - left = bytes; - for (x=0;xts, ms->curtone); - *(txb++) = ZT_LIN2X(getlin, ms); - } - ms->tonep+=left; - bytes -= left; - if (ms->tonep >= ms->curtone->tonesamples) { - struct zt_tone *last; - /* Go to the next sample of the tone */ - ms->tonep = 0; - last = ms->curtone; - ms->curtone = ms->curtone->next; - if (!ms->curtone) { - /* No more tones... Is this dtmf or mf? If so, go to the next digit */ - if (ms->dialing) - __do_dtmf(ms); - } else { - if (last != ms->curtone) - zt_init_tone_state(&ms->ts, ms->curtone); - } - } - } else { - /* Use silence */ - memset(txb, ZT_LIN2X(0, ms), bytes); - bytes = 0; - } - } - -} - -static void __zt_receive_chunk(struct zt_chan *chan, unsigned char *buf) -{ - /* Receive chunk of audio -- called with chan->lock held */ - unsigned char waste[ZT_CHUNKSIZE]; - -#ifdef OPTIMIZE_CHANMUTE - if(likely(chan->chanmute)) - return; -#endif - if (!buf) { - memset(waste, ZT_LIN2X(0, chan), sizeof(waste)); - buf = waste; - } - if ((chan->flags & ZT_FLAG_AUDIO) || (chan->confmode)) { -#ifdef CONFIG_ZAPTEL_MMX - zt_kernel_fpu_begin(); -#endif - __zt_process_putaudio_chunk(chan, buf); -#ifdef CONFIG_ZAPTEL_MMX - kernel_fpu_end(); -#endif - } - __zt_putbuf_chunk(chan, buf); -} - -static inline void __zt_real_receive(struct zt_chan *chan) -{ - /* Called with chan->lock held */ -#ifdef OPTIMIZE_CHANMUTE - if(likely(chan->chanmute)) - return; -#endif - if (chan->confmode) { - /* Load into queue if we have space */ - __buf_push(&chan->confin, chan->readchunk, "zt_real_receive"); - } else { - __zt_receive_chunk(chan, chan->readchunk); - } -} - -int zt_transmit(struct zt_span *span) -{ - int x,y,z; - unsigned long flags; - -#if 1 - for (x=0;xchannels;x++) { - spin_lock_irqsave(&span->chans[x].lock, flags); - if (span->chans[x].flags & ZT_FLAG_NOSTDTXRX) { - spin_unlock_irqrestore(&span->chans[x].lock, flags); - continue; - } - if (&span->chans[x] == span->chans[x].master) { - if (span->chans[x].otimer) { - span->chans[x].otimer -= ZT_CHUNKSIZE; - if (span->chans[x].otimer <= 0) { - __rbs_otimer_expire(&span->chans[x]); - } - } - if (span->chans[x].flags & ZT_FLAG_AUDIO) { - __zt_real_transmit(&span->chans[x]); - } else { - if (span->chans[x].nextslave) { - u_char data[ZT_CHUNKSIZE]; - int pos=ZT_CHUNKSIZE; - /* Process master/slaves one way */ - for (y=0;ychans[x], data); - pos = 0; - } - span->chans[z].writechunk[y] = data[pos++]; - z = span->chans[z].nextslave; - } while(z); - } - } else { - /* Process independents elsewise */ - __zt_real_transmit(&span->chans[x]); - } - } - if (span->chans[x].sig == ZT_SIG_DACS_RBS) { - if (chans[span->chans[x].confna]) { - /* Just set bits for our destination */ - if (span->chans[x].txsig != chans[span->chans[x].confna]->rxsig) { - span->chans[x].txsig = chans[span->chans[x].confna]->rxsig; - span->rbsbits(&span->chans[x], chans[span->chans[x].confna]->rxsig); - } - } - } - - } - spin_unlock_irqrestore(&span->chans[x].lock, flags); - } - if (span->mainttimer) { - span->mainttimer -= ZT_CHUNKSIZE; - if (span->mainttimer <= 0) { - span->mainttimer = 0; - if (span->maint) - span->maint(span, ZT_MAINT_LOOPSTOP); - span->maintstat = 0; - wake_up_interruptible(&span->maintq); - } - } -#endif - return 0; -} - -int zt_receive(struct zt_span *span) -{ - int x,y,z; - unsigned long flags, flagso; - -#if 1 -#ifdef CONFIG_ZAPTEL_WATCHDOG - span->watchcounter--; -#endif - for (x=0;xchannels;x++) { - if (span->chans[x].master == &span->chans[x]) { - spin_lock_irqsave(&span->chans[x].lock, flags); - if (span->chans[x].nextslave) { - /* Must process each slave at the same time */ - u_char data[ZT_CHUNKSIZE]; - int pos = 0; - for (y=0;ychans[z].readchunk[y]; - if (pos == ZT_CHUNKSIZE) { - if(!(span->chans[x].flags & ZT_FLAG_NOSTDTXRX)) - __zt_receive_chunk(&span->chans[x], data); - pos = 0; - } - z=span->chans[z].nextslave; - } while(z); - } - } else { - /* Process a normal channel */ - if (!(span->chans[x].flags & ZT_FLAG_NOSTDTXRX)) - __zt_real_receive(&span->chans[x]); - } - if (span->chans[x].itimer) { - span->chans[x].itimer -= ZT_CHUNKSIZE; - if (span->chans[x].itimer <= 0) { - rbs_itimer_expire(&span->chans[x]); - } - } - if (span->chans[x].ringdebtimer) - span->chans[x].ringdebtimer--; - if (span->chans[x].sig & __ZT_SIG_FXS) { - if (span->chans[x].rxhooksig == ZT_RXSIG_RING) - span->chans[x].ringtrailer = ZT_RINGTRAILER; - else if (span->chans[x].ringtrailer) { - span->chans[x].ringtrailer-= ZT_CHUNKSIZE; - /* See if RING trailer is expired */ - if (!span->chans[x].ringtrailer && !span->chans[x].ringdebtimer) - __qevent(&span->chans[x],ZT_EVENT_RINGOFFHOOK); - } - } - if (span->chans[x].pulsetimer) - { - span->chans[x].pulsetimer--; - if (span->chans[x].pulsetimer <= 0) - { - if (span->chans[x].pulsecount) - { - if (span->chans[x].pulsecount > 12) { - - printk("Got pulse digit %d on %s???\n", - span->chans[x].pulsecount, - span->chans[x].name); - } else if (span->chans[x].pulsecount > 11) { - __qevent(&span->chans[x], ZT_EVENT_PULSEDIGIT | '#'); - } else if (span->chans[x].pulsecount > 10) { - __qevent(&span->chans[x], ZT_EVENT_PULSEDIGIT | '*'); - } else if (span->chans[x].pulsecount > 9) { - __qevent(&span->chans[x], ZT_EVENT_PULSEDIGIT | '0'); - } else { - __qevent(&span->chans[x], ZT_EVENT_PULSEDIGIT | ('0' + - span->chans[x].pulsecount)); - } - span->chans[x].pulsecount = 0; - } - } - } - spin_unlock_irqrestore(&span->chans[x].lock, flags); - } - } - - if (span == master) { - /* Hold the big zap lock for the duration of major - activities which touch all sorts of channels */ - spin_lock_irqsave(&bigzaplock, flagso); - /* Process any timers */ - process_timers(); - /* If we have dynamic stuff, call the ioctl with 0,0 parameters to - make it run */ - if (zt_dynamic_ioctl) - zt_dynamic_ioctl(0,0); - for (x=1;xconfmode && !(chans[x]->flags & ZT_FLAG_PSEUDO)) { - u_char *data; - spin_lock_irqsave(&chans[x]->lock, flags); - data = __buf_peek(&chans[x]->confin); - __zt_receive_chunk(chans[x], data); - if (data) - __buf_pull(&chans[x]->confin, NULL,chans[x], "confreceive"); - spin_unlock_irqrestore(&chans[x]->lock, flags); - } - } - /* This is the master channel, so make things switch over */ - rotate_sums(); - /* do all the pseudo and/or conferenced channel receives (getbuf's) */ - for (x=1;xflags & ZT_FLAG_PSEUDO)) { - spin_lock_irqsave(&chans[x]->lock, flags); - __zt_transmit_chunk(chans[x], NULL); - spin_unlock_irqrestore(&chans[x]->lock, flags); - } - } - if (maxlinks) { -#ifdef CONFIG_ZAPTEL_MMX - zt_kernel_fpu_begin(); -#endif - /* process all the conf links */ - for(x = 1; x <= maxlinks; x++) { - /* if we have a destination conf */ - if (((z = confalias[conf_links[x].dst]) > 0) && - ((y = confalias[conf_links[x].src]) > 0)) { - ACSS(conf_sums[z], conf_sums[y]); - } - } -#ifdef CONFIG_ZAPTEL_MMX - kernel_fpu_end(); -#endif - } - /* do all the pseudo/conferenced channel transmits (putbuf's) */ - for (x=1;xflags & ZT_FLAG_PSEUDO)) { - unsigned char tmp[ZT_CHUNKSIZE]; - spin_lock_irqsave(&chans[x]->lock, flags); - __zt_getempty(chans[x], tmp); - __zt_receive_chunk(chans[x], tmp); - spin_unlock_irqrestore(&chans[x]->lock, flags); - } - } - for (x=1;xconfmode && !(chans[x]->flags & ZT_FLAG_PSEUDO)) { - u_char *data; - spin_lock_irqsave(&chans[x]->lock, flags); - data = __buf_pushpeek(&chans[x]->confout); - __zt_transmit_chunk(chans[x], data); - if (data) - __buf_push(&chans[x]->confout, NULL, "conftransmit"); - spin_unlock_irqrestore(&chans[x]->lock, flags); - } - } -#ifdef ZAPTEL_SYNC_TICK - for (x=0;xsync_tick) - s->sync_tick(s, s == master); - } -#endif - spin_unlock_irqrestore(&bigzaplock, flagso); - } -#endif - return 0; -} - -MODULE_AUTHOR("Mark Spencer "); -MODULE_DESCRIPTION("Zapata Telephony Interface"); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif -#ifdef MODULE_VERSION -MODULE_VERSION(ZAPTEL_VERSION); -#endif - -#ifdef LINUX26 -module_param(debug, int, 0644); -module_param(deftaps, int, 0644); -#else -MODULE_PARM(debug, "i"); -MODULE_PARM(deftaps, "i"); -#endif - -static struct file_operations zt_fops = { - owner: THIS_MODULE, - llseek: NULL, - open: zt_open, - release: zt_release, - ioctl: zt_ioctl, - read: zt_read, - write: zt_write, - poll: zt_poll, - mmap: zt_mmap, - flush: NULL, - fsync: NULL, - fasync: NULL, -}; - -#ifdef CONFIG_ZAPTEL_WATCHDOG -static struct timer_list watchdogtimer; - -static void watchdog_check(unsigned long ignored) -{ - int x; - unsigned long flags; - static int wdcheck=0; - - local_irq_save(flags); - for (x=0;xflags & ZT_FLAG_RUNNING)) { - if (spans[x]->watchcounter == ZT_WATCHDOG_INIT) { - /* Whoops, dead card */ - if ((spans[x]->watchstate == ZT_WATCHSTATE_OK) || - (spans[x]->watchstate == ZT_WATCHSTATE_UNKNOWN)) { - spans[x]->watchstate = ZT_WATCHSTATE_RECOVERING; - if (spans[x]->watchdog) { - printk("Kicking span %s\n", spans[x]->name); - spans[x]->watchdog(spans[x], ZT_WATCHDOG_NOINTS); - } else { - printk("Span %s is dead with no revival\n", spans[x]->name); - spans[x]->watchstate = ZT_WATCHSTATE_FAILED; - } - } - } else { - if ((spans[x]->watchstate != ZT_WATCHSTATE_OK) && - (spans[x]->watchstate != ZT_WATCHSTATE_UNKNOWN)) - printk("Span %s is alive!\n", spans[x]->name); - spans[x]->watchstate = ZT_WATCHSTATE_OK; - } - spans[x]->watchcounter = ZT_WATCHDOG_INIT; - } - } - local_irq_restore(flags); - if (!wdcheck) { - printk("Zaptel watchdog on duty!\n"); - wdcheck=1; - } - mod_timer(&watchdogtimer, jiffies + 2); -} - -static int __init watchdog_init(void) -{ - init_timer(&watchdogtimer); - watchdogtimer.expires = 0; - watchdogtimer.data =0; - watchdogtimer.function = watchdog_check; - /* Run every couple of jiffy or so */ - mod_timer(&watchdogtimer, jiffies + 2); - return 0; -} - -static void __exit watchdog_cleanup(void) -{ - del_timer(&watchdogtimer); -} - -#endif - -int zt_register_chardev(struct zt_chardev *dev) -{ -#ifdef CONFIG_DEVFS_FS - umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO; -#endif /* CONFIG_DEVFS_FS */ - -#ifdef CONFIG_ZAP_UDEV - char udevname[strlen(dev->name) + 3]; - - strcpy(udevname, "zap"); - strcat(udevname, dev->name); - CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, dev->minor), NULL, udevname); -#endif /* CONFIG_ZAP_UDEV */ - -#ifdef CONFIG_DEVFS_FS - dev->devfs_handle = devfs_register(zaptel_devfs_dir, dev->name, DEVFS_FL_DEFAULT, ZT_MAJOR, dev->minor, mode, &zt_fops, NULL); -#endif /* CONFIG_DEVFS_FS */ - - return 0; -} - -int zt_unregister_chardev(struct zt_chardev *dev) -{ -#ifdef CONFIG_ZAP_UDEV - CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, dev->minor)); -#endif /* CONFIG_ZAP_UDEV */ - -#ifdef CONFIG_DEVFS_FS - devfs_unregister(dev->devfs_handle); -#endif /* CONFIG_DEVFS_FS */ - - return 0; -} - -static int __init zt_init(void) { - int res = 0; - -#ifdef CONFIG_DEVFS_FS - { - umode_t mode = S_IFCHR|S_IRUGO|S_IWUGO; - - devfs_register_chrdev(ZT_MAJOR, "zaptel", &zt_fops); - if (!(zaptel_devfs_dir = devfs_mk_dir(NULL, "zap", NULL))) - return -EBUSY; /* This would be bad */ - timer = devfs_register(zaptel_devfs_dir, "timer", DEVFS_FL_DEFAULT, ZT_MAJOR, 253, mode, &zt_fops, NULL); - channel = devfs_register(zaptel_devfs_dir, "channel", DEVFS_FL_DEFAULT, ZT_MAJOR, 254, mode, &zt_fops, NULL); - pseudo = devfs_register(zaptel_devfs_dir, "pseudo", DEVFS_FL_DEFAULT, ZT_MAJOR, 255, mode, &zt_fops, NULL); - ctl = devfs_register(zaptel_devfs_dir, "ctl", DEVFS_FL_DEFAULT, ZT_MAJOR, 0, mode, &zt_fops, NULL); - } -#else - if ((res = register_chrdev(ZT_MAJOR, "zaptel", &zt_fops))) { - printk(KERN_ERR "Unable to register Zaptel character device handler on %d\n", ZT_MAJOR); - return res; - } -#endif /* CONFIG_DEVFS_FS */ - -#ifdef CONFIG_PROC_FS - proc_entries[0] = proc_mkdir("zaptel", NULL); -#endif - -#ifdef CONFIG_ZAP_UDEV /* udev support functions */ - zap_class = class_create(THIS_MODULE, "zaptel"); - CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 253), NULL, "zaptimer"); - CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 254), NULL, "zapchannel"); - CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 255), NULL, "zappseudo"); - CLASS_DEV_CREATE(zap_class, MKDEV(ZT_MAJOR, 0), NULL, "zapctl"); -#endif /* CONFIG_ZAP_UDEV */ - - printk(KERN_INFO "Zapata Telephony Interface Registered on major %d\n", ZT_MAJOR); - printk(KERN_INFO "Zaptel Version: %s\n", ZAPTEL_VERSION); - echo_can_init(); - zt_conv_init(); - fasthdlc_precalc(); - rotate_sums(); - rwlock_init(&chan_lock); -#ifdef CONFIG_ZAPTEL_WATCHDOG - watchdog_init(); -#endif - return res; -} - -static void __exit zt_cleanup(void) { - int x; - -#ifdef CONFIG_PROC_FS - remove_proc_entry("zaptel", NULL); -#endif - - printk(KERN_INFO "Zapata Telephony Interface Unloaded\n"); - for (x = 0; x < ZT_TONE_ZONE_MAX; x++) { - if (tone_zones[x]) - kfree(tone_zones[x]); - } - -#ifdef CONFIG_DEVFS_FS - devfs_unregister(timer); - devfs_unregister(channel); - devfs_unregister(pseudo); - devfs_unregister(ctl); - devfs_unregister(zaptel_devfs_dir); - devfs_unregister_chrdev(ZT_MAJOR, "zaptel"); -#else -#ifdef CONFIG_ZAP_UDEV - CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 253)); /* timer */ - CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 254)); /* channel */ - CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 255)); /* pseudo */ - CLASS_DEV_DESTROY(zap_class, MKDEV(ZT_MAJOR, 0)); /* ctl */ - class_destroy(zap_class); -#endif /* CONFIG_ZAP_UDEV */ - unregister_chrdev(ZT_MAJOR, "zaptel"); -#endif -#ifdef CONFIG_ZAPTEL_WATCHDOG - watchdog_cleanup(); -#endif - - echo_can_shutdown(); -} - -module_init(zt_init); -module_exit(zt_cleanup); diff --git a/zaptel/kernel/zaptel.h b/zaptel/kernel/zaptel.h deleted file mode 100644 index 671a8fb4..00000000 --- a/zaptel/kernel/zaptel.h +++ /dev/null @@ -1,2139 +0,0 @@ -/* - * Zapata Telephony Interface - * - * Written by Mark Spencer - * Based on previous works, designs, and architectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 - 2006 Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU Lesser General Public License Version 2.1 as published - * by the Free Software Foundation. See the LICENSE.LGPL file - * included with this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _LINUX_ZAPTEL_H -#define _LINUX_ZAPTEL_H - -#ifdef __KERNEL__ -#include "zconfig.h" -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#endif -#include -#include - -#ifdef CONFIG_ZAPATA_NET -#include -#endif - -#ifdef CONFIG_ZAPATA_PPP -#include -#include -#include -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#define LINUX26 -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) -#define zap_pci_module pci_register_driver -#else -#define zap_pci_module pci_module_init -#endif - -#ifdef LINUX26 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) -#define ZAP_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id) -#else -#define ZAP_IRQ_HANDLER(a) static irqreturn_t a(int irq, void *dev_id, struct pt_regs *regs) -#endif -#else -#define ZAP_IRQ_HANDLER(a) static void a(int irq, void *dev_id, struct pt_regs *regs) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) -#define ZAP_IRQ_SHARED IRQF_SHARED -#define ZAP_IRQ_DISABLED IRQF_DISABLED -#define ZAP_IRQ_SHARED_DISABLED IRQF_SHARED | IRQF_DISABLED -#else -#define ZAP_IRQ_SHARED SA_SHIRQ -#define ZAP_IRQ_DISABLED SA_INTERRUPT -#define ZAP_IRQ_SHARED_DISABLED SA_SHIRQ | SA_INTERRUPT -#endif - -#include "ecdis.h" -#include "fasthdlc.h" - -#ifdef CONFIG_DEVFS_FS -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#include -#else -#undef CONFIG_DEVFS_FS -//#warning "Zaptel doesn't support DEVFS in post 2.4 kernels. Disabling DEVFS in zaptel" -#endif -#endif /* CONFIG_DEVFS_FS */ -#endif /* __KERNEL__ */ - -#include - -#ifndef ELAST -#define ELAST 500 -#endif - -/* Per-span configuration values */ -#define ZT_CONFIG_TXLEVEL 7 /* bits 0-2 are tx level */ - -/* Line configuration */ -/* These apply to T1 */ -#define ZT_CONFIG_D4 (1 << 4) -#define ZT_CONFIG_ESF (1 << 5) -#define ZT_CONFIG_AMI (1 << 6) -#define ZT_CONFIG_B8ZS (1 << 7) -/* These apply to E1 */ -#define ZT_CONFIG_CCS (1 << 8) /* CCS (ISDN) instead of CAS (Robbed Bit) */ -#define ZT_CONFIG_HDB3 (1 << 9) /* HDB3 instead of AMI (line coding) */ -#define ZT_CONFIG_CRC4 (1 << 10) /* CRC4 framing */ -#define ZT_CONFIG_NOTOPEN (1 << 16) - -/* Signalling types */ -#define ZT_SIG_BROKEN (1 << 31) /* The port is broken and/or failed initialization */ - -#define __ZT_SIG_FXO (1 << 12) /* Never use directly */ -#define __ZT_SIG_FXS (1 << 13) /* Never use directly */ - -#define ZT_SIG_NONE (0) /* Channel not configured */ -#define ZT_SIG_FXSLS ((1 << 0) | __ZT_SIG_FXS) /* FXS, Loopstart */ -#define ZT_SIG_FXSGS ((1 << 1) | __ZT_SIG_FXS) /* FXS, Groundstart */ -#define ZT_SIG_FXSKS ((1 << 2) | __ZT_SIG_FXS) /* FXS, Kewlstart */ - -#define ZT_SIG_FXOLS ((1 << 3) | __ZT_SIG_FXO) /* FXO, Loopstart */ -#define ZT_SIG_FXOGS ((1 << 4) | __ZT_SIG_FXO) /* FXO, Groupstart */ -#define ZT_SIG_FXOKS ((1 << 5) | __ZT_SIG_FXO) /* FXO, Kewlstart */ - -#define ZT_SIG_EM (1 << 6) /* Ear & Mouth (E&M) */ - -/* The following are all variations on clear channel */ - -#define __ZT_SIG_DACS (1 << 16) - -#define ZT_SIG_CLEAR (1 << 7) /* Clear channel */ -#define ZT_SIG_HDLCRAW ((1 << 8) | ZT_SIG_CLEAR) /* Raw unchecked HDLC */ -#define ZT_SIG_HDLCFCS ((1 << 9) | ZT_SIG_HDLCRAW) /* HDLC with FCS calculation */ -#define ZT_SIG_HDLCNET ((1 << 10) | ZT_SIG_HDLCFCS) /* HDLC Network */ -#define ZT_SIG_SLAVE (1 << 11) /* Slave to another channel */ -#define ZT_SIG_SF (1 << 14) /* Single Freq. tone only, no sig bits */ -#define ZT_SIG_CAS (1 << 15) /* Just get bits */ -#define ZT_SIG_DACS (__ZT_SIG_DACS | ZT_SIG_CLEAR) /* Cross connect */ -#define ZT_SIG_EM_E1 (1 << 17) /* E1 E&M Variation */ -#define ZT_SIG_DACS_RBS ((1 << 18) | __ZT_SIG_DACS) /* Cross connect w/ RBS */ -#define ZT_SIG_HARDHDLC ((1 << 19) | ZT_SIG_CLEAR) -#define ZT_SIG_MTP2 ((1 << 20) | ZT_SIG_HDLCFCS) /* MTP2 support Need HDLC bitstuff and FCS calcuation too */ - -/* tone flag values */ -#define ZT_REVERSE_RXTONE 1 /* reverse polarity rx tone logic */ -#define ZT_REVERSE_TXTONE 2 /* reverse polarity tx tone logic */ - -#define ZT_ABIT 8 -#define ZT_BBIT 4 -#define ZT_CBIT 2 -#define ZT_DBIT 1 - -#define ZT_MAJOR 196 - -#define ZT_CODE 'J' - -/* Default chunk size for conferences and such -- static right now, might make - variable sometime. 8 samples = 1 ms = most frequent service interval possible - for a USB device */ -#define ZT_CHUNKSIZE 8 -#define ZT_MIN_CHUNKSIZE ZT_CHUNKSIZE -#define ZT_DEFAULT_CHUNKSIZE ZT_CHUNKSIZE -#define ZT_MAX_CHUNKSIZE ZT_CHUNKSIZE -#define ZT_CB_SIZE 2 - -#define ZT_MAX_BLOCKSIZE 8192 -#define ZT_DEFAULT_NUM_BUFS 2 -#define ZT_MAX_NUM_BUFS 32 -#define ZT_MAX_BUF_SPACE 32768 - -#define ZT_DEFAULT_BLOCKSIZE 1024 -#define ZT_DEFAULT_MTR_MRU 2048 - -#define ZT_POLICY_IMMEDIATE 0 /* Start play/record immediately */ -#define ZT_POLICY_WHEN_FULL 1 /* Start play/record when buffer is full */ - -#define RING_DEBOUNCE_TIME 2000 /* 2000 ms ring debounce time */ - -#define ZT_GET_PARAMS_RETURN_MASTER 0x40000000 - -/* Extended attributes in lineconfig structure */ -#define ZT_SPANINFO_HAS_LINECONFIG -#define ZT_SPANINFO_HAS_LBONAME - -struct zt_params_v1 -{ - int channo; /* Channel number */ - int spanno; /* Span itself */ - int chanpos; /* Channel number in span */ - int sigtype; /* read-only */ - int sigcap; /* read-only */ - int rxisoffhook; /* read-only */ - int rxbits; /* read-only */ - int txbits; /* read-only */ - int txhooksig; /* read-only */ - int rxhooksig; /* read-only */ - int curlaw; /* read-only -- one of ZT_LAW_MULAW or ZT_LAW_ALAW */ - int idlebits; /* read-only -- What is considered the idle state */ - char name[40]; /* Name of channel */ - int prewinktime; - int preflashtime; - int winktime; - int flashtime; - int starttime; - int rxwinktime; - int rxflashtime; - int debouncetime; - int pulsebreaktime; - int pulsemaketime; - int pulseaftertime; -}; - -typedef struct zt_params -{ - int channo; /* Channel number */ - int spanno; /* Span itself */ - int chanpos; /* Channel number in span */ - int sigtype; /* read-only */ - int sigcap; /* read-only */ - int rxisoffhook; /* read-only */ - int rxbits; /* read-only */ - int txbits; /* read-only */ - int txhooksig; /* read-only */ - int rxhooksig; /* read-only */ - int curlaw; /* read-only -- one of ZT_LAW_MULAW or ZT_LAW_ALAW */ - int idlebits; /* read-only -- What is considered the idle state */ - char name[40]; /* Name of channel */ - int prewinktime; - int preflashtime; - int winktime; - int flashtime; - int starttime; - int rxwinktime; - int rxflashtime; - int debouncetime; - int pulsebreaktime; - int pulsemaketime; - int pulseaftertime; - __u32 chan_alarms; /* alarms on this channel */ -} ZT_PARAMS; - -struct zt_spaninfo_v1 { - int spanno; /* span number */ - char name[20]; /* Name */ - char desc[40]; /* Description */ - int alarms; /* alarms status */ - int txlevel; /* what TX level is set to */ - int rxlevel; /* current RX level */ - int bpvcount; /* current BPV count */ - int crc4count; /* current CRC4 error count */ - int ebitcount; /* current E-bit error count */ - int fascount; /* current FAS error count */ - int irqmisses; /* current IRQ misses */ - int syncsrc; /* span # of current sync source, or 0 for free run */ - int numchans; /* number of configured channels on this span */ - int totalchans; /* total number of channels on the span */ - int totaflspans; /* total number of spans in entire system */ -}; - -struct zt_spaninfo_v2 { - int spanno; /* span number */ - char name[20]; /* Name */ - char desc[40]; /* Description */ - int alarms; /* alarms status */ - int txlevel; /* what TX level is set to */ - int rxlevel; /* current RX level */ - int bpvcount; /* current BPV count */ - int crc4count; /* current CRC4 error count */ - int ebitcount; /* current E-bit error count */ - int fascount; /* current FAS error count */ - int irqmisses; /* current IRQ misses */ - int syncsrc; /* span # of current sync source, or 0 for free run */ - int numchans; /* number of configured channels on this span */ - int totalchans; /* total number of channels on the span */ - int totalspans; /* total number of spans in entire system */ - int lbo; /* line build out */ - int lineconfig; /* framing/coding */ -}; - -typedef struct zt_spaninfo { - int spanno; /* span number */ - char name[20]; /* Name */ - char desc[40]; /* Description */ - int alarms; /* alarms status */ - int txlevel; /* what TX level is set to */ - int rxlevel; /* current RX level */ - int bpvcount; /* current BPV count */ - int crc4count; /* current CRC4 error count */ - int ebitcount; /* current E-bit error count */ - int fascount; /* current FAS error count */ - int irqmisses; /* current IRQ misses */ - int syncsrc; /* span # of current sync source, or 0 for free run */ - int numchans; /* number of configured channels on this span */ - int totalchans; /* total number of channels on the span */ - int totalspans; /* total number of spans in entire system */ - int lbo; /* line build out */ - int lineconfig; /* framing/coding */ - char lboname[40]; /* line build out in text form */ - char location[40]; /* span's device location in system */ - char manufacturer[40]; /* manufacturer of span's device */ - char devicetype[40]; /* span's device type */ - int irq; /* span's device IRQ */ - int linecompat; /* signaling modes possible on this span */ - char spantype[6]; /* type of span in text form */ -} ZT_SPANINFO; - -typedef struct zt_maintinfo -{ -int spanno; /* span number 1-2 */ -int command; /* command */ -} ZT_MAINTINFO; - -typedef struct zt_confinfo -{ -int chan; /* channel number, 0 for current */ -int confno; /* conference number */ -int confmode; /* conferencing mode */ -} ZT_CONFINFO; - -typedef struct zt_gains -{ -int chan; /* channel number, 0 for current */ -unsigned char rxgain[256]; /* Receive gain table */ -unsigned char txgain[256]; /* Transmit gain table */ -} ZT_GAINS; - -typedef struct zt_lineconfig -{ -int span; /* Which span number (0 to use name) */ -char name[20]; /* Name of span to use */ -int lbo; /* line build-outs */ -int lineconfig; /* line config parameters (framing, coding) */ -int sync; /* what level of sync source we are */ -} ZT_LINECONFIG; - -typedef struct zt_chanconfig -{ -int chan; /* Channel we're applying this to (0 to use name) */ -char name[40]; /* Name of channel to use */ -int sigtype; /* Signal type */ -int deflaw; /* Default law (ZT_LAW_DEFAULT, ZT_LAW_MULAW, or ZT_LAW_ALAW */ -int master; /* Master channel if sigtype is ZT_SLAVE */ -int idlebits; /* Idle bits (if this is a CAS channel) or - channel to monitor (if this is DACS channel) */ -char netdev_name[16]; /*name for the hdlc network device*/ -} ZT_CHANCONFIG; - -typedef struct zt_sfconfig -{ -int chan; /* Channel we're applying this to (0 to use name) */ -char name[40]; /* Name of channel to use */ -long rxp1; /* receive tone det. p1 */ -long rxp2; /* receive tone det. p2 */ -long rxp3; /* receive tone det. p3 */ -int txtone; /* Tx tone factor */ -int tx_v2; /* initial v2 value */ -int tx_v3; /* initial v3 value */ -int toneflag; /* Tone flags */ -} ZT_SFCONFIG; - -typedef struct zt_bufferinfo -{ -int txbufpolicy; /* Policy for handling receive buffers */ -int rxbufpolicy; /* Policy for handling receive buffers */ -int numbufs; /* How many buffers to use */ -int bufsize; /* How big each buffer is */ -int readbufs; /* How many read buffers are full (read-only) */ -int writebufs; /* How many write buffers are full (read-only) */ -} ZT_BUFFERINFO; - -typedef struct zt_dialparams { - int mfv1_tonelen; /* MF R1 tone length for digits */ - int dtmf_tonelen; /* DTMF tone length */ - int mfr2_tonelen; /* MF R2 tone length */ - int reserved[3]; /* Reserved for future expansion -- always set to 0 */ -} ZT_DIAL_PARAMS; - -typedef struct zt_dynamic_span { - char driver[20]; /* Which low-level driver to use */ - char addr[40]; /* Destination address */ - int numchans; /* Number of channels */ - int timing; /* Timing source preference */ - int spanno; /* Span number (filled in by zaptel) */ -} ZT_DYNAMIC_SPAN; - -/* Define the max # of outgoing DTMF, MFR1 or MFR2 digits to queue in-kernel */ -#define ZT_MAX_DTMF_BUF 256 - -#define ZT_DIAL_OP_APPEND 1 -#define ZT_DIAL_OP_REPLACE 2 -#define ZT_DIAL_OP_CANCEL 3 - -#define ZT_LAW_DEFAULT 0 /* Default law for span */ -#define ZT_LAW_MULAW 1 /* Mu-law */ -#define ZT_LAW_ALAW 2 /* A-law */ - -typedef struct zt_dialoperation { - int op; - char dialstr[ZT_MAX_DTMF_BUF]; -} ZT_DIAL_OPERATION; - - -typedef struct zt_indirect_data -{ -int chan; -int op; -void *data; -} ZT_INDIRECT_DATA; - -struct zt_versioninfo { - char version[80]; - char echo_canceller[80]; -}; - -struct zt_hwgain{ - __s32 newgain; /* desired gain in dB but x10. -3.5dB would be -35 */ - __u32 tx:1; /* 0=rx; 1=tx */ -}; - - -/* ioctl definitions */ -#define ZT_CODE 'J' - -/* - * Get Transfer Block Size. - */ -#define ZT_GET_BLOCKSIZE _IOR (ZT_CODE, 1, int) - -/* - * Set Transfer Block Size. - */ -#define ZT_SET_BLOCKSIZE _IOW (ZT_CODE, 2, int) - -/* - * Flush Buffer(s) and stop I/O - */ -#define ZT_FLUSH _IOW (ZT_CODE, 3, int) - -/* - * Wait for Write to Finish - */ -#define ZT_SYNC _IOW (ZT_CODE, 4, int) - -/* - * Get channel parameters - */ -#define ZT_GET_PARAMS_V1 _IOR (ZT_CODE, 5, struct zt_params_v1) -#define ZT_GET_PARAMS _IOR (ZT_CODE, 5, struct zt_params) - -/* - * Get channel parameters - */ -#define ZT_SET_PARAMS_V1 _IOW (ZT_CODE, 6, struct zt_params_v1) -#define ZT_SET_PARAMS _IOW (ZT_CODE, 6, struct zt_params) - -/* - * Set Hookswitch Status - */ -#define ZT_HOOK _IOW (ZT_CODE, 7, int) - -/* - * Get Signalling Event - */ -#define ZT_GETEVENT _IOR (ZT_CODE, 8, int) - -/* - * Wait for something to happen (IO Mux) - */ -#define ZT_IOMUX _IOWR (ZT_CODE, 9, int) - -/* - * Get Span Status - */ -#define ZT_SPANSTAT_V1 _IOWR (ZT_CODE, 10, struct zt_spaninfo_v1) -#define ZT_SPANSTAT_V2 _IOWR (ZT_CODE, 10, struct zt_spaninfo_v2) -#define ZT_SPANSTAT _IOWR (ZT_CODE, 10, struct zt_spaninfo) - -/* - * Set Maintenance Mode - */ -#define ZT_MAINT _IOW (ZT_CODE, 11, struct zt_maintinfo) - -/* - * Get Conference Mode - */ -#define ZT_GETCONF _IOWR (ZT_CODE, 12, struct zt_confinfo) - -/* - * Set Conference Mode - */ -#define ZT_SETCONF _IOWR (ZT_CODE, 13, struct zt_confinfo) - -/* - * Setup or Remove Conference Link - */ -#define ZT_CONFLINK _IOW (ZT_CODE, 14, struct zt_confinfo) - -/* - * Display Conference Diagnostic Information on Console - */ -#define ZT_CONFDIAG _IOR (ZT_CODE, 15, int) - -/* - * Get Channel audio gains - */ -#define ZT_GETGAINS _IOWR (ZT_CODE, 16, struct zt_gains) - -/* - * Set Channel audio gains - */ -#define ZT_SETGAINS _IOWR (ZT_CODE, 17, struct zt_gains) - -/* - * Set Line (T1) Configurations and start system - */ -#define ZT_SPANCONFIG _IOW (ZT_CODE, 18, struct zt_lineconfig) - -/* - * Set Channel Configuration - */ -#define ZT_CHANCONFIG _IOW (ZT_CODE, 19, struct zt_chanconfig) - -/* - * Set Conference to mute mode - */ -#define ZT_CONFMUTE _IOW (ZT_CODE, 20, int) - -/* - * Send a particular tone (see ZT_TONE_*) - */ -#define ZT_SENDTONE _IOW (ZT_CODE, 21, int) - -/* - * Set your region for tones (see ZT_TONE_ZONE_*) - */ -#define ZT_SETTONEZONE _IOW (ZT_CODE, 22, int) - -/* - * Retrieve current region for tones (see ZT_TONE_ZONE_*) - */ -#define ZT_GETTONEZONE _IOR (ZT_CODE, 23, int) - -/* - * Master unit only -- set default zone (see ZT_TONE_ZONE_*) - */ -#define ZT_DEFAULTZONE _IOW (ZT_CODE, 24, int) - -/* - * Load a tone zone from a zt_tone_def_header, see - * below... - */ -#define ZT_LOADZONE _IOW (ZT_CODE, 25, struct zt_tone_def_header) - -/* - * Free a tone zone - */ -#define ZT_FREEZONE _IOW (ZT_CODE, 26, int) - -/* - * Set buffer policy - */ -#define ZT_SET_BUFINFO _IOW (ZT_CODE, 27, struct zt_bufferinfo) - -/* - * Get current buffer info - */ -#define ZT_GET_BUFINFO _IOR (ZT_CODE, 28, struct zt_bufferinfo) - -/* - * Get dialing parameters - */ -#define ZT_GET_DIALPARAMS _IOR (ZT_CODE, 29, struct zt_dialparams) - -/* - * Set dialing parameters - */ -#define ZT_SET_DIALPARAMS _IOW (ZT_CODE, 30, struct zt_dialparams) - -/* - * Append, replace, or cancel a dial string - */ -#define ZT_DIAL _IOW (ZT_CODE, 31, struct zt_dialoperation) - -/* - * Set a clear channel into audio mode - */ -#define ZT_AUDIOMODE _IOW (ZT_CODE, 32, int) - -/* - * Enable or disable echo cancellation on a channel - * - * For ECHOCANCEL: - * The number is zero to disable echo cancellation and non-zero - * to enable echo cancellation. If the number is between 32 - * and 1024, it will also set the number of taps in the echo canceller - * - * For ECHOCANCEL_PARAMS: - * The structure contains parameters that should be passed to the - * echo canceler instance for the selected channel. - */ -#define ZT_ECHOCANCEL _IOW (ZT_CODE, 33, int) -#define ZT_ECHOCANCEL_PARAMS _IOW (ZT_CODE, 33, struct zt_echocanparams) - -/* - * Return a channel's channel number (useful for the /dev/zap/pseudo type interfaces - */ -#define ZT_CHANNO _IOR (ZT_CODE, 34, int) - -/* - * Return a flag indicating whether channel is currently dialing - */ -#define ZT_DIALING _IOR (ZT_CODE, 35, int) - -/* Numbers 60 to 90 are reserved for private use of low level hardware - drivers */ - -/* - * Set a clear channel into HDLC w/out FCS checking/calculation mode - */ -#define ZT_HDLCRAWMODE _IOW (ZT_CODE, 36, int) - -/* - * Set a clear channel into HDLC w/ FCS mode - */ -#define ZT_HDLCFCSMODE _IOW (ZT_CODE, 37, int) - -/* - * Specify a channel on /dev/zap/chan -- must be done before any other ioctl's and is only - * valid on /dev/zap/chan - */ -#define ZT_SPECIFY _IOW (ZT_CODE, 38, int) - -/* - * Temporarily set the law on a channel to - * ZT_LAW_DEFAULT, ZT_LAW_ALAW, or ZT_LAW_MULAW. Is reset on close. - */ -#define ZT_SETLAW _IOW (ZT_CODE, 39, int) - -/* - * Temporarily set the channel to operate in linear mode when non-zero - * or default law if 0 - */ -#define ZT_SETLINEAR _IOW (ZT_CODE, 40, int) - -/* - * Set a clear channel into HDLC w/ PPP interface mode - */ -#define ZT_HDLCPPP _IOW (ZT_CODE, 41, int) - -/* - * Set the ring cadence for FXS interfaces - */ -#define ZT_SETCADENCE _IOW (ZT_CODE, 42, struct zt_ring_cadence) - -/* - * Set the bits going out for CAS interface - */ -#define ZT_SETTXBITS _IOW (ZT_CODE, 43, int) - - -/* - * Display Channel Diagnostic Information on Console - */ -#define ZT_CHANDIAG _IOR (ZT_CODE, 44, int) - -/* - * Obtain received signalling - */ -#define ZT_GETRXBITS _IOR (ZT_CODE, 45, int) - -/* - * Set Channel's SF Tone Configuration - */ -#define ZT_SFCONFIG _IOW (ZT_CODE, 46, struct zt_sfconfig) - -/* - * Set timer expiration (in samples) - */ -#define ZT_TIMERCONFIG _IOW (ZT_CODE, 47, int) - -/* - * Acknowledge timer expiration (number to acknowledge, or -1 for all) - */ -#define ZT_TIMERACK _IOW (ZT_CODE, 48, int) - -/* - * Get Conference to mute mode - */ -#define ZT_GETCONFMUTE _IOR (ZT_CODE, 49, int) - -/* - * Request echo training in some number of ms (with muting in the mean time) - */ -#define ZT_ECHOTRAIN _IOW (ZT_CODE, 50, int) - -/* - * Set on hook transfer for n number of ms -- implemnted by low level driver - */ -#define ZT_ONHOOKTRANSFER _IOW (ZT_CODE, 51, int) - -/* - * Queue Ping - */ -#define ZT_TIMERPING _IOW (ZT_CODE, 42, int) /* Should be 52, but works */ - -/* - * Acknowledge ping - */ -#define ZT_TIMERPONG _IOW (ZT_CODE, 53, int) - -/* - * Set/get signalling freeze - */ -#define ZT_SIGFREEZE _IOW (ZT_CODE, 54, int) -#define ZT_GETSIGFREEZE _IOR (ZT_CODE, 55, int) - -/* - * Do a channel IOCTL from the /dev/zap/ctl interface - */ -#define ZT_INDIRECT _IOWR (ZT_CODE, 56, struct zt_indirect_data) - - -/* - * Get the version of Zaptel that is running, and a description - * of the compiled-in echo canceller (if any) - */ -#define ZT_GETVERSION _IOR(ZT_CODE, 57, struct zt_versioninfo) - -/* - * Put the channel in loopback mode (receive from the channel is - * transmitted back on the interface) - */ -#define ZT_LOOPBACK _IOW(ZT_CODE, 58, int) - - -/* - * 60-80 are reserved for private drivers - * 80-85 are reserved for dynamic span stuff - */ - -/* - * Create a dynamic span - */ -#define ZT_DYNAMIC_CREATE _IOWR (ZT_CODE, 80, struct zt_dynamic_span) - -/* - * Destroy a dynamic span - */ -#define ZT_DYNAMIC_DESTROY _IOW (ZT_CODE, 81, struct zt_dynamic_span) - -/* - * Set the HW gain for a device - */ -#define ZT_SET_HWGAIN _IOW (ZT_CODE, 86, struct zt_hwgain) - -/* - * Enable tone detection -- implemented by low level driver - */ -#define ZT_TONEDETECT _IOW (ZT_CODE, 91, int) - -/* - * Set polarity -- implemented by individual driver. 0 = forward, 1 = reverse - */ -#define ZT_SETPOLARITY _IOW (ZT_CODE, 92, int) - -/* - * Transcoder operations - */ - -/* ZT_TRANSCODE_OP is an older interface that is deprecated and no longer - * supported. - */ -#define ZT_TRANSCODE_OP _IOWR(ZT_CODE, 93, int) - -/* Transcoder related definitions */ - -struct zt_transcoder_formats { - __u32 srcfmt; - __u32 dstfmt; -}; -struct zt_transcoder_info { - __u32 tcnum; - char name[80]; - __u32 numchannels; - __u32 dstfmts; - __u32 srcfmts; -}; - -#define ZT_TC_CODE 'T' -#define ZT_TC_ALLOCATE _IOW(ZT_TC_CODE, 1, struct zt_transcoder_formats) -#define ZT_TC_GETINFO _IOWR(ZT_TC_CODE, 2, struct zt_transcoder_info) - -/* - * VoiceMail Waiting Indication (WMWI) -- implemented by low-level driver. - * Value: number of waiting messages (hence 0: switch messages off). - */ -#define ZT_VMWI _IOWR(ZT_CODE, 94, int) - -/* - * Startup or Shutdown a span - */ -#define ZT_STARTUP _IOW (ZT_CODE, 99, int) -#define ZT_SHUTDOWN _IOW (ZT_CODE, 100, int) - -#define ZT_TONE_ZONE_MAX 128 - -#define ZT_TONE_ZONE_DEFAULT -1 /* To restore default */ - -#define ZT_TONE_STOP -1 -#define ZT_TONE_DIALTONE 0 -#define ZT_TONE_BUSY 1 -#define ZT_TONE_RINGTONE 2 -#define ZT_TONE_CONGESTION 3 -#define ZT_TONE_CALLWAIT 4 -#define ZT_TONE_DIALRECALL 5 -#define ZT_TONE_RECORDTONE 6 -#define ZT_TONE_INFO 7 -#define ZT_TONE_CUST1 8 -#define ZT_TONE_CUST2 9 -#define ZT_TONE_STUTTER 10 -#define ZT_TONE_MAX 16 - -#define ZT_TONE_DTMF_BASE 64 -#define ZT_TONE_MFR1_BASE 80 -#define ZT_TONE_MFR2_FWD_BASE 96 -#define ZT_TONE_MFR2_REV_BASE 112 - -enum { - ZT_TONE_DTMF_0 = ZT_TONE_DTMF_BASE, - ZT_TONE_DTMF_1, - ZT_TONE_DTMF_2, - ZT_TONE_DTMF_3, - ZT_TONE_DTMF_4, - ZT_TONE_DTMF_5, - ZT_TONE_DTMF_6, - ZT_TONE_DTMF_7, - ZT_TONE_DTMF_8, - ZT_TONE_DTMF_9, - ZT_TONE_DTMF_s, - ZT_TONE_DTMF_p, - ZT_TONE_DTMF_A, - ZT_TONE_DTMF_B, - ZT_TONE_DTMF_C, - ZT_TONE_DTMF_D -}; - -#define ZT_TONE_DTMF_MAX ZT_TONE_DTMF_D - -enum { - ZT_TONE_MFR1_0 = ZT_TONE_MFR1_BASE, - ZT_TONE_MFR1_1, - ZT_TONE_MFR1_2, - ZT_TONE_MFR1_3, - ZT_TONE_MFR1_4, - ZT_TONE_MFR1_5, - ZT_TONE_MFR1_6, - ZT_TONE_MFR1_7, - ZT_TONE_MFR1_8, - ZT_TONE_MFR1_9, - ZT_TONE_MFR1_KP, - ZT_TONE_MFR1_ST, - ZT_TONE_MFR1_STP, - ZT_TONE_MFR1_ST2P, - ZT_TONE_MFR1_ST3P, -}; - -#define ZT_TONE_MFR1_MAX ZT_TONE_MFR1_ST3P - -enum { - ZT_TONE_MFR2_FWD_1 = ZT_TONE_MFR2_FWD_BASE, - ZT_TONE_MFR2_FWD_2, - ZT_TONE_MFR2_FWD_3, - ZT_TONE_MFR2_FWD_4, - ZT_TONE_MFR2_FWD_5, - ZT_TONE_MFR2_FWD_6, - ZT_TONE_MFR2_FWD_7, - ZT_TONE_MFR2_FWD_8, - ZT_TONE_MFR2_FWD_9, - ZT_TONE_MFR2_FWD_10, - ZT_TONE_MFR2_FWD_11, - ZT_TONE_MFR2_FWD_12, - ZT_TONE_MFR2_FWD_13, - ZT_TONE_MFR2_FWD_14, - ZT_TONE_MFR2_FWD_15, -}; - -#define ZT_TONE_MFR2_FWD_MAX ZT_TONE_MFR2_FWD_15 - -enum { - ZT_TONE_MFR2_REV_1 = ZT_TONE_MFR2_REV_BASE, - ZT_TONE_MFR2_REV_2, - ZT_TONE_MFR2_REV_3, - ZT_TONE_MFR2_REV_4, - ZT_TONE_MFR2_REV_5, - ZT_TONE_MFR2_REV_6, - ZT_TONE_MFR2_REV_7, - ZT_TONE_MFR2_REV_8, - ZT_TONE_MFR2_REV_9, - ZT_TONE_MFR2_REV_10, - ZT_TONE_MFR2_REV_11, - ZT_TONE_MFR2_REV_12, - ZT_TONE_MFR2_REV_13, - ZT_TONE_MFR2_REV_14, - ZT_TONE_MFR2_REV_15, -}; - -#define ZT_TONE_MFR2_REV_MAX ZT_TONE_MFR2_REV_15 - -#define ZT_MAX_CADENCE 16 - -#define ZT_TONEDETECT_ON (1 << 0) /* Detect tones */ -#define ZT_TONEDETECT_MUTE (1 << 1) /* Mute audio in received channel */ - -struct zt_ring_cadence { - int ringcadence[ZT_MAX_CADENCE]; -}; - -#define ZT_MAX_ECHOCANPARAMS 8 - -struct zt_echocanparam { - char name[16]; - __s32 value; -}; - -struct zt_echocanparams { - __u32 tap_length; /* 8 taps per millisecond */ - __u32 param_count; /* number of parameters supplied */ - /* immediately follow this structure with zt_echocanparam structures */ - struct zt_echocanparam params[0]; -}; - -struct zt_tone_def_header { - int count; /* How many samples follow */ - int zone; /* Which zone we are loading */ - int ringcadence[ZT_MAX_CADENCE]; /* Ring cadence in ms (0=on, 1=off, ends with 0 value) */ - char name[40]; /* Informational name of zone */ - /* Immediately follow the zt_tone_def_header by zt_tone_def's */ -}; - -struct zt_tone_def { /* Structure for zone programming */ - int tone; /* See ZT_TONE_* */ - int next; /* What the next position in the cadence is - (They're numbered by the order the appear here) */ - int samples; /* How many samples to play for this cadence */ - /* Now come the constants we need to make tones */ - int shift; /* How much to scale down the volume (2 is nice) */ - - /* - Calculate the next 6 factors using the following equations: - l = , f1 = , f2 = - gain = pow(10.0, (l - 3.14) / 20.0) * 65536.0 / 2.0; - - // Frequency factor 1 - fac_1 = 2.0 * cos(2.0 * M_PI * (f1/8000.0)) * 32768.0; - // Last previous two samples - init_v2_1 = sin(-4.0 * M_PI * (f1/8000.0)) * gain; - init_v3_1 = sin(-2.0 * M_PI * (f1/8000.0)) * gain; - - // Frequency factor 2 - fac_2 = 2.0 * cos(2.0 * M_PI * (f2/8000.0)) * 32768.0; - // Last previous two samples - init_v2_2 = sin(-4.0 * M_PI * (f2/8000.0)) * gain; - init_v3_2 = sin(-2.0 * M_PI * (f2/8000.0)) * gain; - */ - int fac1; - int init_v2_1; - int init_v3_1; - int fac2; - int init_v2_2; - int init_v3_2; - int modulate; - -}; - -#ifdef __KERNEL__ -#endif /* KERNEL */ - -/* Define the maximum block size */ -#define ZT_MAX_BLOCKSIZE 8192 - -/* Define the default network block size */ -#define ZT_DEFAULT_MTU_MRU 2048 - -/* Flush and stop the read (input) process */ -#define ZT_FLUSH_READ 1 - -/* Flush and stop the write (output) process */ -#define ZT_FLUSH_WRITE 2 - -/* Flush and stop both (input and output) processes */ -#define ZT_FLUSH_BOTH (ZT_FLUSH_READ | ZT_FLUSH_WRITE) - -/* Flush the event queue */ -#define ZT_FLUSH_EVENT 4 - -/* Flush everything */ -#define ZT_FLUSH_ALL (ZT_FLUSH_READ | ZT_FLUSH_WRITE | ZT_FLUSH_EVENT) - - -/* Value for ZT_HOOK, set to ON hook */ -#define ZT_ONHOOK 0 - -/* Value for ZT_HOOK, set to OFF hook */ -#define ZT_OFFHOOK 1 - -/* Value for ZT_HOOK, wink (off hook momentarily) */ -#define ZT_WINK 2 - -/* Value for ZT_HOOK, flash (on hook momentarily) */ -#define ZT_FLASH 3 - -/* Value for ZT_HOOK, start line */ -#define ZT_START 4 - -/* Value for ZT_HOOK, ring line (same as start line) */ -#define ZT_RING 5 - -/* Value for ZT_HOOK, turn ringer off */ -#define ZT_RINGOFF 6 - -/* Ret. Value for GET/WAIT Event, no event */ -#define ZT_EVENT_NONE 0 - -/* Ret. Value for GET/WAIT Event, Went Onhook */ -#define ZT_EVENT_ONHOOK 1 - -/* Ret. Value for GET/WAIT Event, Went Offhook or got Ring */ -#define ZT_EVENT_RINGOFFHOOK 2 - -/* Ret. Value for GET/WAIT Event, Got Wink or Flash */ -#define ZT_EVENT_WINKFLASH 3 - -/* Ret. Value for GET/WAIT Event, Got Alarm */ -#define ZT_EVENT_ALARM 4 - -/* Ret. Value for GET/WAIT Event, Got No Alarm (after alarm) */ -#define ZT_EVENT_NOALARM 5 - -/* Ret. Value for GET/WAIT Event, HDLC Abort frame */ -#define ZT_EVENT_ABORT 6 - -/* Ret. Value for GET/WAIT Event, HDLC Frame overrun */ -#define ZT_EVENT_OVERRUN 7 - -/* Ret. Value for GET/WAIT Event, Bad FCS */ -#define ZT_EVENT_BADFCS 8 - -/* Ret. Value for dial complete */ -#define ZT_EVENT_DIALCOMPLETE 9 - -/* Ret Value for ringer going on */ -#define ZT_EVENT_RINGERON 10 - -/* Ret Value for ringer going off */ -#define ZT_EVENT_RINGEROFF 11 - -/* Ret Value for hook change complete */ -#define ZT_EVENT_HOOKCOMPLETE 12 - -/* Ret Value for bits changing on a CAS / User channel */ -#define ZT_EVENT_BITSCHANGED 13 - -/* Ret value for the beginning of a pulse coming on its way */ -#define ZT_EVENT_PULSE_START 14 - -/* Timer event -- timer expired */ -#define ZT_EVENT_TIMER_EXPIRED 15 - -/* Timer event -- ping ready */ -#define ZT_EVENT_TIMER_PING 16 - -/* Polarity reversal event */ -#define ZT_EVENT_POLARITY 17 - -/* Ring Begin event */ -#define ZT_EVENT_RINGBEGIN 18 - -/* Echo can disabled event */ -#define ZT_EVENT_EC_DISABLED 19 - -/* Channel was disconnected. Hint user to close channel */ -#define ZT_EVENT_REMOVED 20 - -/* A neon MWI pulse was detected */ -#define ZT_EVENT_NEONMWI_ACTIVE 21 - -/* No neon MWI pulses were detected over some period of time */ -#define ZT_EVENT_NEONMWI_INACTIVE 22 - -#define ZT_EVENT_PULSEDIGIT (1 << 16) /* This is OR'd with the digit received */ -#define ZT_EVENT_DTMFDOWN (1 << 17) /* Ditto for DTMF key down event */ -#define ZT_EVENT_DTMFUP (1 << 18) /* Ditto for DTMF key up event */ - -/* Flag Value for IOMUX, read avail */ -#define ZT_IOMUX_READ 1 - -/* Flag Value for IOMUX, write avail */ -#define ZT_IOMUX_WRITE 2 - -/* Flag Value for IOMUX, write done */ -#define ZT_IOMUX_WRITEEMPTY 4 - -/* Flag Value for IOMUX, signalling event avail */ -#define ZT_IOMUX_SIGEVENT 8 - -/* Flag Value for IOMUX, Do Not Wait if nothing to report */ -#define ZT_IOMUX_NOWAIT 0x100 - -/* Alarm Condition bits */ -#define ZT_ALARM_NONE 0 /* No alarms */ -#define ZT_ALARM_RECOVER 1 /* Recovering from alarm */ -#define ZT_ALARM_LOOPBACK 2 /* In loopback */ -#define ZT_ALARM_YELLOW 4 /* Yellow Alarm */ -#define ZT_ALARM_RED 8 /* Red Alarm */ -#define ZT_ALARM_BLUE 16 /* Blue Alarm */ -#define ZT_ALARM_NOTOPEN 32 -/* Maintenance modes */ -#define ZT_MAINT_NONE 0 /* Normal Mode */ -#define ZT_MAINT_LOCALLOOP 1 /* Local Loopback */ -#define ZT_MAINT_REMOTELOOP 2 /* Remote Loopback */ -#define ZT_MAINT_LOOPUP 3 /* send loopup code */ -#define ZT_MAINT_LOOPDOWN 4 /* send loopdown code */ -#define ZT_MAINT_LOOPSTOP 5 /* stop sending loop codes */ - - -/* Conference modes */ -#define ZT_CONF_MODE_MASK 0xff /* mask for modes */ -#define ZT_CONF_NORMAL 0 /* normal mode */ -#define ZT_CONF_MONITOR 1 /* monitor mode (rx of other chan) */ -#define ZT_CONF_MONITORTX 2 /* monitor mode (tx of other chan) */ -#define ZT_CONF_MONITORBOTH 3 /* monitor mode (rx & tx of other chan) */ -#define ZT_CONF_CONF 4 /* conference mode */ -#define ZT_CONF_CONFANN 5 /* conference announce mode */ -#define ZT_CONF_CONFMON 6 /* conference monitor mode */ -#define ZT_CONF_CONFANNMON 7 /* conference announce/monitor mode */ -#define ZT_CONF_REALANDPSEUDO 8 /* real and pseudo port both on conf */ -#define ZT_CONF_DIGITALMON 9 /* Do not decode or interpret */ -#define ZT_CONF_MONITOR_RX_PREECHO 10 /* monitor mode (rx of other chan) - before echo can is done */ -#define ZT_CONF_MONITOR_TX_PREECHO 11 /* monitor mode (tx of other chan) - before echo can is done */ -#define ZT_CONF_MONITORBOTH_PREECHO 12 /* monitor mode (rx & tx of other chan) - before echo can is done */ -#define ZT_CONF_FLAG_MASK 0xff00 /* mask for flags */ -#define ZT_CONF_LISTENER 0x100 /* is a listener on the conference */ -#define ZT_CONF_TALKER 0x200 /* is a talker on the conference */ -#define ZT_CONF_PSEUDO_LISTENER 0x400 /* pseudo is a listener on the conference */ -#define ZT_CONF_PSEUDO_TALKER 0x800 /* pseudo is a talker on the conference */ - - -#define ZT_DEFAULT_WINKTIME 150 /* 150 ms default wink time */ -#define ZT_DEFAULT_FLASHTIME 750 /* 750 ms default flash time */ - -#define ZT_DEFAULT_PREWINKTIME 50 /* 50 ms before wink */ -#define ZT_DEFAULT_PREFLASHTIME 50 /* 50 ms before flash */ -#define ZT_DEFAULT_STARTTIME 1500 /* 1500 ms of start */ -#define ZT_DEFAULT_RINGTIME 2000 /* 2000 ms of ring on (start, FXO) */ -#if 0 -#define ZT_DEFAULT_RXWINKTIME 250 /* 250ms longest rx wink */ -#endif -#define ZT_DEFAULT_RXWINKTIME 300 /* 300ms longest rx wink (to work with the Atlas) */ -#define ZT_DEFAULT_RXFLASHTIME 1250 /* 1250ms longest rx flash */ -#define ZT_DEFAULT_DEBOUNCETIME 600 /* 600ms of FXS GS signalling debounce */ -#define ZT_DEFAULT_PULSEMAKETIME 50 /* 50 ms of line closed when dial pulsing */ -#define ZT_DEFAULT_PULSEBREAKTIME 50 /* 50 ms of line open when dial pulsing */ -#define ZT_DEFAULT_PULSEAFTERTIME 750 /* 750ms between dial pulse digits */ - -#define ZT_MINPULSETIME (15 * 8) /* 15 ms minimum */ - -#ifdef SHORT_FLASH_TIME -#define ZT_MAXPULSETIME (80 * 8) /* we need 80 ms, not 200ms, as we have a short flash */ -#else -#define ZT_MAXPULSETIME (200 * 8) /* 200 ms maximum */ -#endif - -#define ZT_PULSETIMEOUT ((ZT_MAXPULSETIME / 8) + 50) - -#define ZT_RINGTRAILER (50 * 8) /* Don't consider a ring "over" until it's been gone at least this - much time */ - -#define ZT_LOOPCODE_TIME 10000 /* send loop codes for 10 secs */ -#define ZT_ALARMSETTLE_TIME 5000 /* allow alarms to settle for 5 secs */ -#define ZT_AFTERSTART_TIME 500 /* 500ms after start */ - -#define ZT_RINGOFFTIME 4000 /* Turn off ringer for 4000 ms */ -#define ZT_KEWLTIME 500 /* 500ms for kewl pulse */ -#define ZT_AFTERKEWLTIME 300 /* 300ms after kewl pulse */ - -#define ZT_MAX_PRETRAINING 1000 /* 1000ms max pretraining time */ - -#define ZT_MAX_SPANS 128 /* Max, 128 spans */ -#define ZT_MAX_CHANNELS 1024 /* Max, 1024 channels */ -#define ZT_MAX_CONF 1024 /* Max, 1024 conferences */ - -#ifdef FXSFLASH -#define ZT_FXSFLASHMINTIME 450 /* min 450ms */ -#define ZT_FXSFLASHMAXTIME 550 /* max 550ms */ -#endif - -#ifdef __KERNEL__ - -#include - -#define ZT_MAX_EVENTSIZE 64 /* 64 events max in buffer */ - -struct zt_span; -struct zt_chan; - -struct zt_tone_state { - int v1_1; - int v2_1; - int v3_1; - int v1_2; - int v2_2; - int v3_2; - int modulate; -}; - -struct zt_chardev { - const char *name; - __u8 minor; -#ifdef CONFIG_DEVFS_FS - devfs_handle_t devfs_handle; -#endif -}; - -int zt_register_chardev(struct zt_chardev *dev); -int zt_unregister_chardev(struct zt_chardev *dev); - -#ifdef CONFIG_ZAPATA_NET -struct zt_hdlc { -#ifdef LINUX26 - struct net_device *netdev; -#else - hdlc_device netdev; -#endif - struct zt_chan *chan; -}; -#endif - -/* Echo cancellation */ -struct echo_can_state; -#if 0 -/* echo can API consists of these functions */ -void echo_can_init(void); -void echo_chan_shutdown(void); -void echo_can_identify(char *buf, size_t len); -int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, struct echo_can_state **ec); -void echo_can_free(struct echo_can_state *ec); -short echo_can_update(struct echo_can_state *ec, short iref, short isig); -void echo_can_array_update(struct echo_can_state *ec, short *iref, short *isig); -int echo_can_traintap(struct echo_can_state *ec, int pos, short val); -#endif - -/* Conference queue stucture */ -struct confq { - u_char buffer[ZT_CHUNKSIZE * ZT_CB_SIZE]; - u_char *buf[ZT_CB_SIZE]; - int inbuf; - int outbuf; -}; - -typedef struct -{ - long x1; - long x2; - long y1; - long y2; - long e1; - long e2; - int samps; - int lastdetect; -} sf_detect_state_t; - -struct zt_chan { -#ifdef CONFIG_ZAPATA_NET - /* Must be first */ - struct zt_hdlc *hdlcnetdev; -#endif -#ifdef CONFIG_ZAPATA_PPP - struct ppp_channel *ppp; - struct tasklet_struct ppp_calls; - int do_ppp_wakeup; - int do_ppp_error; - struct sk_buff_head ppp_rq; -#endif - spinlock_t lock; - char name[40]; /* Name */ - /* Specified by zaptel */ - int channo; /* Zaptel Channel number */ - int chanpos; - unsigned long flags; - long rxp1; - long rxp2; - long rxp3; - int txtone; - int tx_v2; - int tx_v3; - int v1_1; - int v2_1; - int v3_1; - int toneflags; - sf_detect_state_t rd; - - struct zt_chan *master; /* Our Master channel (could be us) */ - /* Next slave (if appropriate) */ - int nextslave; - - u_char *writechunk; /* Actual place to write to */ - u_char swritechunk[ZT_MAX_CHUNKSIZE]; /* Buffer to be written */ - u_char *readchunk; /* Actual place to read from */ - u_char sreadchunk[ZT_MAX_CHUNKSIZE]; /* Preallocated static area */ - short *readchunkpreec; - - /* Pointer to tx and rx gain tables */ - u_char *rxgain; - u_char *txgain; - - /* Whether or not we have allocated gains or are using the default */ - int gainalloc; - - /* Specified by driver, readable by zaptel */ - void *pvt; /* Private channel data */ - struct file *file; /* File structure */ - - - struct zt_span *span; /* Span we're a member of */ - int sig; /* Signalling */ - int sigcap; /* Capability for signalling */ - __u32 chan_alarms; /* alarms status */ - - /* Used only by zaptel -- NO DRIVER SERVICEABLE PARTS BELOW */ - /* Buffer declarations */ - u_char *readbuf[ZT_MAX_NUM_BUFS]; /* read buffer */ - int inreadbuf; - int outreadbuf; - wait_queue_head_t readbufq; /* read wait queue */ - - u_char *writebuf[ZT_MAX_NUM_BUFS]; /* write buffers */ - int inwritebuf; - int outwritebuf; - wait_queue_head_t writebufq; /* write wait queue */ - - int blocksize; /* Block size */ - - int eventinidx; /* out index in event buf (circular) */ - int eventoutidx; /* in index in event buf (circular) */ - unsigned int eventbuf[ZT_MAX_EVENTSIZE]; /* event circ. buffer */ - wait_queue_head_t eventbufq; /* event wait queue */ - - wait_queue_head_t txstateq; /* waiting on the tx state to change */ - - int readn[ZT_MAX_NUM_BUFS]; /* # of bytes ready in read buf */ - int readidx[ZT_MAX_NUM_BUFS]; /* current read pointer */ - int writen[ZT_MAX_NUM_BUFS]; /* # of bytes ready in write buf */ - int writeidx[ZT_MAX_NUM_BUFS]; /* current write pointer */ - - int numbufs; /* How many buffers in channel */ - int txbufpolicy; /* Buffer policy */ - int rxbufpolicy; /* Buffer policy */ - int txdisable; /* Disable transmitter */ - int rxdisable; /* Disable receiver */ - - - /* Tone zone stuff */ - struct zt_zone *curzone; /* Zone for selecting tones */ - int tonezone; /* Tone zone for this channel */ - struct zt_tone *curtone; /* Current tone we're playing (if any) */ - int tonep; /* Current position in tone */ - struct zt_tone_state ts; /* Tone state */ - - /* Pulse dial stuff */ - int pdialcount; /* pulse dial count */ - - /* Ring cadence */ - int ringcadence[ZT_MAX_CADENCE]; - int firstcadencepos; /* Where to restart ring cadence */ - - /* Digit string dialing stuff */ - int digitmode; /* What kind of tones are we sending? */ - char txdialbuf[ZT_MAX_DTMF_BUF]; - int dialing; - int afterdialingtimer; - int cadencepos; /* Where in the cadence we are */ - - /* I/O Mask */ - int iomask; /* I/O Mux signal mask */ - wait_queue_head_t sel; /* thingy for select stuff */ - - /* HDLC state machines */ - struct fasthdlc_state txhdlc; - struct fasthdlc_state rxhdlc; - int infcs; - - /* Conferencing stuff */ - int confna; /* conference number (alias) */ - int _confn; /* Actual conference number */ - int confmode; /* conference mode */ - int confmute; /* conference mute mode */ - - /* Incoming and outgoing conference chunk queues for - communicating between zaptel master time and - other boards */ - struct confq confin; - struct confq confout; - - short getlin[ZT_MAX_CHUNKSIZE]; /* Last transmitted samples */ - unsigned char getraw[ZT_MAX_CHUNKSIZE]; /* Last received raw data */ - short getlin_lastchunk[ZT_MAX_CHUNKSIZE]; /* Last transmitted samples from last chunk */ - short putlin[ZT_MAX_CHUNKSIZE]; /* Last received samples */ - short putlin_pseudo[ZT_MAX_CHUNKSIZE]; /* Last received samples -- pseudo channel */ - unsigned char putraw[ZT_MAX_CHUNKSIZE]; /* Last received raw data */ - short conflast[ZT_MAX_CHUNKSIZE]; /* Last conference sample -- base part of channel */ - short conflast1[ZT_MAX_CHUNKSIZE]; /* Last conference sample -- pseudo part of channel */ - short conflast2[ZT_MAX_CHUNKSIZE]; /* Previous last conference sample -- pseudo part of channel */ - - - /* Is echo cancellation enabled or disabled */ - int echocancel; - struct echo_can_state *ec; - echo_can_disable_detector_state_t txecdis; - echo_can_disable_detector_state_t rxecdis; - - int echostate; /* State of echo canceller */ - int echolastupdate; /* Last echo can update pos */ - int echotimer; /* Timer for echo update */ - - /* RBS timings */ - int prewinktime; /* pre-wink time (ms) */ - int preflashtime; /* pre-flash time (ms) */ - int winktime; /* wink time (ms) */ - int flashtime; /* flash time (ms) */ - int starttime; /* start time (ms) */ - int rxwinktime; /* rx wink time (ms) */ - int rxflashtime; /* rx flash time (ms) */ - int debouncetime; /* FXS GS sig debounce time (ms) */ - int pulsebreaktime; /* pulse line open time (ms) */ - int pulsemaketime; /* pulse line closed time (ms) */ - int pulseaftertime; /* pulse time between digits (ms) */ - - /* RING debounce timer */ - int ringdebtimer; - - /* RING trailing detector to make sure a RING is really over */ - int ringtrailer; - - /* PULSE digit receiver stuff */ - int pulsecount; - int pulsetimer; - - /* RBS timers */ - int itimerset; /* what the itimer was set to last */ - int itimer; - int otimer; - - /* RBS state */ - int gotgs; - int txstate; - int rxsig; - int txsig; - int rxsigstate; - - /* non-RBS rx state */ - int rxhooksig; - int txhooksig; - int kewlonhook; - - /* Idle signalling if CAS signalling */ - int idlebits; - - int deflaw; /* 1 = mulaw, 2=alaw, 0=undefined */ - short *xlaw; -#ifdef OPTIMIZE_CHANMUTE - int chanmute; /*!< no need for PCM data */ -#endif -#ifdef CONFIG_CALC_XLAW - unsigned char (*lineartoxlaw)(short a); -#else - unsigned char *lin2x; -#endif - -#ifdef CONFIG_DEVFS_FS - devfs_handle_t fhandle; /* File handle in devfs for the channel */ - devfs_handle_t fhandle_symlink; -#endif /* CONFIG_DEVFS_FS */ -}; - -/* defines for transmit signalling */ -typedef enum { - ZT_TXSIG_ONHOOK, /* On hook */ - ZT_TXSIG_OFFHOOK, /* Off hook */ - ZT_TXSIG_START, /* Start / Ring */ - ZT_TXSIG_KEWL /* Drop battery if possible */ -} zt_txsig_t; - -typedef enum { - ZT_RXSIG_ONHOOK, - ZT_RXSIG_OFFHOOK, - ZT_RXSIG_START, - ZT_RXSIG_RING, - ZT_RXSIG_INITIAL -} zt_rxsig_t; - -/* Span flags */ -#define ZT_FLAG_REGISTERED (1 << 0) -#define ZT_FLAG_RUNNING (1 << 1) -#define ZT_FLAG_RBS (1 << 12) /* Span uses RBS signalling */ - -/* Channel flags */ -#define ZT_FLAG_DTMFDECODE (1 << 2) /* Channel supports native DTMF decode */ -#define ZT_FLAG_MFDECODE (1 << 3) /* Channel supports native MFr2 decode */ -#define ZT_FLAG_ECHOCANCEL (1 << 4) /* Channel supports native echo cancellation */ - -#define ZT_FLAG_HDLC (1 << 5) /* Perform HDLC */ -#define ZT_FLAG_NETDEV (1 << 6) /* Send to network */ -#define ZT_FLAG_PSEUDO (1 << 7) /* Pseudo channel */ -#define ZT_FLAG_CLEAR (1 << 8) /* Clear channel */ -#define ZT_FLAG_AUDIO (1 << 9) /* Audio mode channel */ - -#define ZT_FLAG_OPEN (1 << 10) /* Channel is open */ -#define ZT_FLAG_FCS (1 << 11) /* Calculate FCS */ -/* Reserve 12 for uniqueness with span flags */ -#define ZT_FLAG_LINEAR (1 << 13) /* Talk to user space in linear */ -#define ZT_FLAG_PPP (1 << 14) /* PPP is available */ -#define ZT_FLAG_T1PPP (1 << 15) -#define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */ -#define ZT_FLAG_NOSTDTXRX (1 << 17) /* Do NOT do standard transmit and receive on every interrupt */ -#define ZT_FLAG_LOOPED (1 << 18) /* Loopback the receive data from the channel to the transmit */ -#define ZT_FLAG_MTP2 (1 << 19) /* Repeats last message in buffer and also discards repeating messages sent to us */ - -/* This is a redefinition of the flags from above to allow use of the kernel atomic bit testing and changing routines. - * See the above descriptions for ZT_FLAG_.... for documentation about function. */ -enum { - ZT_FLAGBIT_REGISTERED = 0, - ZT_FLAGBIT_RUNNING = 1, - ZT_FLAGBIT_RBS = 12, - ZT_FLAGBIT_DTMFDECODE = 2, - ZT_FLAGBIT_MFDECODE = 3, - ZT_FLAGBIT_ECHOCANCEL = 4, - ZT_FLAGBIT_HDLC = 5, - ZT_FLAGBIT_NETDEV = 6, - ZT_FLAGBIT_PSEUDO = 7, - ZT_FLAGBIT_CLEAR = 8, - ZT_FLAGBIT_AUDIO = 9, - ZT_FLAGBIT_OPEN = 10, - ZT_FLAGBIT_FCS = 11, - ZT_FLAGBIT_LINEAR = 13, - ZT_FLAGBIT_PPP = 14, - ZT_FLAGBIT_T1PPP = 15, - ZT_FLAGBIT_SIGFREEZE = 16, - ZT_FLAGBIT_NOSTDTXRX = 17, - ZT_FLAGBIT_LOOPED = 18, - ZT_FLAGBIT_MTP2 = 19, -}; - -struct zt_span { - spinlock_t lock; - void *pvt; /* Private stuff */ - 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 (ZT_MULAW or ZT_ALAW) */ - int alarms; /* Pending alarms on span */ - int flags; - int irq; /* IRQ for this span's hardware */ - int lbo; /* Span Line-Buildout */ - int lineconfig; /* Span line configuration */ - int linecompat; /* Span line compatibility */ - int channels; /* Number of channels in span */ - int txlevel; /* Tx level */ - int rxlevel; /* Rx level */ - int syncsrc; /* current sync src (gets copied here) */ - unsigned int bpvcount; /* BPV counter */ - unsigned int crc4count; /* CRC4 error counter */ - unsigned int ebitcount; /* current E-bit error count */ - unsigned int fascount; /* current FAS error count */ - - int maintstat; /* Maintenance state */ - wait_queue_head_t maintq; /* Maintenance queue */ - int mainttimer; /* Maintenance timer */ - - int irqmisses; /* Interrupt misses */ - - int timingslips; /* Clock slips */ - - struct zt_chan *chans; /* Member channel structures */ - - /* ==== Span Callback Operations ==== */ - /* Req: Set the requested chunk size. This is the unit in which you must - report results for conferencing, etc */ - int (*setchunksize)(struct zt_span *span, int chunksize); - - /* Opt: Configure the span (if appropriate) */ - int (*spanconfig)(struct zt_span *span, struct zt_lineconfig *lc); - - /* Opt: Start the span */ - int (*startup)(struct zt_span *span); - - /* Opt: Shutdown the span */ - int (*shutdown)(struct zt_span *span); - - /* Opt: Enable maintenance modes */ - int (*maint)(struct zt_span *span, int mode); - -#ifdef ZAPTEL_SYNC_TICK - /* Opt: send sync to spans */ - int (*sync_tick)(struct zt_span *span, int is_master); -#endif - - /* ==== Channel Callback Operations ==== */ - /* Opt: Set signalling type (if appropriate) */ - int (*chanconfig)(struct zt_chan *chan, int sigtype); - - /* Opt: Prepare a channel for I/O */ - int (*open)(struct zt_chan *chan); - - /* Opt: Close channel for I/O */ - int (*close)(struct zt_chan *chan); - - /* Opt: IOCTL */ - int (*ioctl)(struct zt_chan *chan, unsigned int cmd, unsigned long data); - - /* Opt: Native echo cancellation (simple) */ - int (*echocan)(struct zt_chan *chan, int ecval); - - int (*echocan_with_params)(struct zt_chan *chan, struct zt_echocanparams *ecp, struct zt_echocanparam *p); - - /* Okay, now we get to the signalling. You have several options: */ - - /* Option 1: If you're a T1 like interface, you can just provide a - rbsbits function and we'll assert robbed bits for you. Be sure to - set the ZT_FLAG_RBS in this case. */ - - /* Opt: If the span uses A/B bits, set them here */ - int (*rbsbits)(struct zt_chan *chan, int bits); - - /* Option 2: If you don't know about sig bits, but do have their - equivalents (i.e. you can disconnect battery, detect off hook, - generate ring, etc directly) then you can just specify a - sethook function, and we'll call you with appropriate hook states - to set. Still set the ZT_FLAG_RBS in this case as well */ - int (*hooksig)(struct zt_chan *chan, zt_txsig_t hookstate); - - /* Option 3: If you can't use sig bits, you can write a function - which handles the individual hook states */ - int (*sethook)(struct zt_chan *chan, int hookstate); - - /* Opt: Dacs the contents of chan2 into chan1 if possible */ - int (*dacs)(struct zt_chan *chan1, struct zt_chan *chan2); - - /* Opt: Used to tell an onboard HDLC controller that there is data ready to transmit */ - void (*hdlc_hard_xmit)(struct zt_chan *chan); - - /* Used by zaptel only -- no user servicable parts inside */ - int spanno; /* Span number for zaptel */ - int offset; /* Offset within a given card */ - int lastalarms; /* Previous alarms */ - -#ifdef CONFIG_DEVFS_FS - devfs_handle_t dhandle; /* Directory name */ -#endif - /* If the watchdog detects no received data, it will call the - watchdog routine */ - int (*watchdog)(struct zt_span *span, int cause); -#ifdef CONFIG_ZAPTEL_WATCHDOG - int watchcounter; - int watchstate; -#endif -}; - -struct zt_transcoder_channel { - void *pvt; - struct zt_transcoder *parent; - wait_queue_head_t ready; - __u32 built_fmts; -#define ZT_TC_FLAG_BUSY 1 -#define ZT_TC_FLAG_CHAN_BUILT 2 -#define ZT_TC_FLAG_NONBLOCK 3 -#define ZT_TC_FLAG_DATA_WAITING 4 - unsigned long flags; - u32 dstfmt; - u32 srcfmt; -}; - -static inline int -zt_tc_is_built(struct zt_transcoder_channel *dtc) { - return test_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags); -} -static inline void -zt_tc_set_built(struct zt_transcoder_channel *dtc) { - set_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags); -} -static inline void -zt_tc_clear_built(struct zt_transcoder_channel *dtc) { - clear_bit(ZT_TC_FLAG_CHAN_BUILT, &dtc->flags); -} -static inline int -zt_tc_is_nonblock(struct zt_transcoder_channel *dtc) { - return test_bit(ZT_TC_FLAG_NONBLOCK, &dtc->flags); -} -static inline void -zt_tc_set_nonblock(struct zt_transcoder_channel *dtc) { - set_bit(ZT_TC_FLAG_NONBLOCK, &dtc->flags); -} -static inline void -zt_tc_clear_nonblock(struct zt_transcoder_channel *dtc) { - clear_bit(ZT_TC_FLAG_NONBLOCK, &dtc->flags); -} -static inline int -zt_tc_is_data_waiting(struct zt_transcoder_channel *dtc) { - return test_bit(ZT_TC_FLAG_DATA_WAITING, &dtc->flags); -} -static inline int -zt_tc_is_busy(struct zt_transcoder_channel *dtc) { - return test_bit(ZT_TC_FLAG_BUSY, &dtc->flags); -} -static inline void -zt_tc_set_busy(struct zt_transcoder_channel *dtc) { - set_bit(ZT_TC_FLAG_BUSY, &dtc->flags); -} -static inline void -zt_tc_clear_busy(struct zt_transcoder_channel *dtc) { - clear_bit(ZT_TC_FLAG_BUSY, &dtc->flags); -} -static inline void -zt_tc_set_data_waiting(struct zt_transcoder_channel *dtc) { - set_bit(ZT_TC_FLAG_DATA_WAITING, &dtc->flags); -} -static inline void -zt_tc_clear_data_waiting(struct zt_transcoder_channel *dtc) { - clear_bit(ZT_TC_FLAG_DATA_WAITING, &dtc->flags); -} - -struct zt_transcoder { - struct list_head node; - char name[80]; - int pos; - int numchannels; - unsigned int srcfmts; - unsigned int dstfmts; - struct file_operations fops; - int (*allocate)(struct zt_transcoder_channel *channel); - int (*release)(struct zt_transcoder_channel *channel); - /* Transcoder channels */ - struct zt_transcoder_channel channels[0]; -}; - -#define ZT_WATCHDOG_NOINTS (1 << 0) - -#define ZT_WATCHDOG_INIT 1000 - -#define ZT_WATCHSTATE_UNKNOWN 0 -#define ZT_WATCHSTATE_OK 1 -#define ZT_WATCHSTATE_RECOVERING 2 -#define ZT_WATCHSTATE_FAILED 3 - - -struct zt_dynamic_driver { - /* Driver name (e.g. Eth) */ - char name[20]; - - /* Driver description */ - char desc[80]; - - /* Create a new transmission pipe */ - void *(*create)(struct zt_span *span, char *address); - - /* Destroy a created transmission pipe */ - void (*destroy)(void *tpipe); - - /* Transmit a given message */ - int (*transmit)(void *tpipe, unsigned char *msg, int msglen); - - /* Flush any pending messages */ - int (*flush)(void); - - struct zt_dynamic_driver *next; -}; - -/* Receive a dynamic span message */ -void zt_dynamic_receive(struct zt_span *span, unsigned char *msg, int msglen); - -/* Register a dynamic driver */ -int zt_dynamic_register(struct zt_dynamic_driver *driver); - -/* Unregister a dynamic driver */ -void zt_dynamic_unregister(struct zt_dynamic_driver *driver); - -/* Receive on a span. The zaptel interface will handle all the calculations for - all member channels of the span, pulling the data from the readchunk buffer */ -int zt_receive(struct zt_span *span); - -/* Prepare writechunk buffers on all channels for this span */ -int zt_transmit(struct zt_span *span); - -/* Abort the buffer currently being receive with event "event" */ -void zt_hdlc_abort(struct zt_chan *ss, int event); - -/* Indicate to zaptel that the end of frame was received and rotate buffers */ -void zt_hdlc_finish(struct zt_chan *ss); - -/* Put a chunk of data into the current receive buffer */ -void zt_hdlc_putbuf(struct zt_chan *ss, unsigned char *rxb, int bytes); - -/* Get a chunk of data from the current transmit buffer. Returns -1 if no data - * is left to send, 0 if there is data remaining in the current message to be sent - * and 1 if the currently transmitted message is now done */ -int zt_hdlc_getbuf(struct zt_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 zt_register(struct zt_span *span, int prefmaster); - -/* Allocate / free memory for a transcoder */ -struct zt_transcoder *zt_transcoder_alloc(int numchans); -void zt_transcoder_free(struct zt_transcoder *ztc); - -/* Register a transcoder */ -int zt_transcoder_register(struct zt_transcoder *tc); - -/* Unregister a transcoder */ -int zt_transcoder_unregister(struct zt_transcoder *tc); - -/* Alert a transcoder */ -int zt_transcoder_alert(struct zt_transcoder_channel *ztc); - -/* Unregister a span */ -int zt_unregister(struct zt_span *span); - -/* Gives a name to an LBO */ -char *zt_lboname(int lbo); - -/* Tell Zaptel about changes in received rbs bits */ -void zt_rbsbits(struct zt_chan *chan, int bits); - -/* Tell Zaptel abou changes in received signalling */ -void zt_hooksig(struct zt_chan *chan, zt_rxsig_t rxsig); - -/* Queue an event on a channel */ -void zt_qevent_nolock(struct zt_chan *chan, int event); - -/* Queue an event on a channel, locking it first */ -void zt_qevent_lock(struct zt_chan *chan, int event); - -/* Notify a change possible change in alarm status on a channel */ -void zt_alarm_channel(struct zt_chan *chan, int alarms); - -/* Notify a change possible change in alarm status on a span */ -void zt_alarm_notify(struct zt_span *span); - -/* Initialize a tone state */ -void zt_init_tone_state(struct zt_tone_state *ts, struct zt_tone *zt); - -/* Get a given MF tone struct, suitable for zt_tone_nextsample. */ -struct zt_tone *zt_mf_tone(const struct zt_chan *chan, char digit, int digitmode); - -/* Echo cancel a receive and transmit chunk for a given channel. This - should be called by the low-level driver as close to the interface - as possible. ECHO CANCELLATION IS NO LONGER AUTOMATICALLY DONE - AT THE ZAPTEL LEVEL. zt_ec_chunk will not echo cancel if it should - not be doing so. rxchunk is modified in-place */ - -void zt_ec_chunk(struct zt_chan *chan, unsigned char *rxchunk, const unsigned char *txchunk); -void zt_ec_span(struct zt_span *span); - -extern struct file_operations *zt_transcode_fops; - -/* Don't use these directly -- they're not guaranteed to - be there. */ -extern short __zt_mulaw[256]; -extern short __zt_alaw[256]; -#ifdef CONFIG_CALC_XLAW -u_char __zt_lineartoulaw(short a); -u_char __zt_lineartoalaw(short a); -#else -extern u_char __zt_lin2mu[16384]; -extern u_char __zt_lin2a[16384]; -#endif - -/* Used by dynamic zaptel -- don't use directly */ -void zt_set_dynamic_ioctl(int (*func)(unsigned int cmd, unsigned long data)); - -/* Used privately by zaptel. Avoid touching directly */ -struct zt_tone { - int fac1; - int init_v2_1; - int init_v3_1; - - int fac2; - int init_v2_2; - int init_v3_2; - - int tonesamples; /* How long to play this tone before - going to the next (in samples) */ - struct zt_tone *next; /* Next tone in this sequence */ - - int modulate; -}; - -static inline short zt_tone_nextsample(struct zt_tone_state *ts, struct zt_tone *zt) -{ - /* follow the curves, return the sum */ - - int p; - - ts->v1_1 = ts->v2_1; - ts->v2_1 = ts->v3_1; - ts->v3_1 = (zt->fac1 * ts->v2_1 >> 15) - ts->v1_1; - - ts->v1_2 = ts->v2_2; - ts->v2_2 = ts->v3_2; - ts->v3_2 = (zt->fac2 * ts->v2_2 >> 15) - ts->v1_2; - - /* Return top 16 bits */ - if (!ts->modulate) return ts->v3_1 + ts->v3_2; - /* we are modulating */ - p = ts->v3_2 - 32768; - if (p < 0) p = -p; - p = ((p * 9) / 10) + 1; - return (ts->v3_1 * p) >> 15; - -} - -static inline short zt_txtone_nextsample(struct zt_chan *ss) -{ - /* follow the curves, return the sum */ - - ss->v1_1 = ss->v2_1; - ss->v2_1 = ss->v3_1; - ss->v3_1 = (ss->txtone * ss->v2_1 >> 15) - ss->v1_1; - return ss->v3_1; -} - -/* These are the right functions to use. */ - -#define ZT_MULAW(a) (__zt_mulaw[(a)]) -#define ZT_ALAW(a) (__zt_alaw[(a)]) -#define ZT_XLAW(a,c) (c->xlaw[(a)]) - -#ifdef CONFIG_CALC_XLAW -#define ZT_LIN2MU(a) (__zt_lineartoulaw((a))) -#define ZT_LIN2A(a) (__zt_lineartoalaw((a))) - -#define ZT_LIN2X(a,c) ((c)->lineartoxlaw((a))) - -#else -/* Use tables */ -#define ZT_LIN2MU(a) (__zt_lin2mu[((unsigned short)(a)) >> 2]) -#define ZT_LIN2A(a) (__zt_lin2a[((unsigned short)(a)) >> 2]) - -/* Manipulate as appropriate for x-law */ -#define ZT_LIN2X(a,c) ((c)->lin2x[((unsigned short)(a)) >> 2]) - -#endif /* CONFIG_CALC_XLAW */ - -#endif /* __KERNEL__ */ - -/* The following is for the PCI RADIO interface only. This is specified in -this file because external processes need to interact with the device. -Some devices have private functions used for test/diagnostic only, but -this is not the case here. */ - -struct zt_radio_stat { - unsigned short ctcode_rx; /* code of currently received CTCSS - or DCS, 0 for none */ - unsigned short ctclass; /* class of currently received CTCSS or - DCS code */ - unsigned short ctcode_tx; /* code of currently encoded CTCSS or - DCS, 0 for none */ - unsigned char radstat; /* status bits of radio */ -}; - -#define RAD_SERIAL_BUFLEN 128 - -struct zt_radio_param { - unsigned short radpar; /* param identifier */ - unsigned short index; /* tone number */ - int data; /* param */ - int data2; /* param 2 */ - unsigned char buf[RAD_SERIAL_BUFLEN]; -}; - - -/* Get current status IOCTL */ -#define ZT_RADIO_GETSTAT _IOR (ZT_CODE, 57, struct zt_radio_stat) -/* Set a channel parameter IOCTL */ -#define ZT_RADIO_SETPARAM _IOW (ZT_CODE, 58, struct zt_radio_param) -/* Get a channel parameter IOCTL */ -#define ZT_RADIO_GETPARAM _IOR (ZT_CODE, 59, struct zt_radio_param) - - -/* Defines for Radio Status (zt_radio_stat.radstat) bits */ - -#define ZT_RADSTAT_RX 1 /* currently "receiving " */ -#define ZT_RADSTAT_TX 2 /* currently "transmitting" */ -#define ZT_RADSTAT_RXCT 4 /* currently receiving continuous tone with - current settings */ -#define ZT_RADSTAT_RXCOR 8 /* currently receiving COR (irrelevant of COR - ignore) */ -#define ZT_RADSTAT_IGNCOR 16 /* currently ignoring COR */ -#define ZT_RADSTAT_IGNCT 32 /* currently ignoring CTCSS/DCS decode */ -#define ZT_RADSTAT_NOENCODE 64 /* currently blocking CTCSS/DCS encode */ - -/* Defines for Radio Parameters (zt_radio_param.radpar) */ - -#define ZT_RADPAR_INVERTCOR 1 /* invert the COR signal (0/1) */ -#define ZT_RADPAR_IGNORECOR 2 /* ignore the COR signal (0/1) */ -#define ZT_RADPAR_IGNORECT 3 /* ignore the CTCSS/DCS decode (0/1) */ -#define ZT_RADPAR_NOENCODE 4 /* block the CTCSS/DCS encode (0/1) */ -#define ZT_RADPAR_CORTHRESH 5 /* COR trigger threshold (0-7) */ - -#define ZT_RADPAR_EXTRXTONE 6 /* 0 means use internal decoder, 1 means UIOA - logic true is CT decode, 2 means UIOA logic - false is CT decode */ -#define ZT_RADPAR_NUMTONES 7 /* returns maximum tone index (curently 15) */ -#define ZT_RADPAR_INITTONE 8 /* init all tone indexes to 0 (no tones) */ -#define ZT_RADPAR_RXTONE 9 /* CTCSS tone, (1-32) or DCS tone (1-777), - or 0 meaning no tone, set index also (1-15) */ -#define ZT_RADPAR_RXTONECLASS 10 /* Tone class (0-65535), set index also (1-15) */ -#define ZT_RADPAR_TXTONE 11 /* CTCSS tone (1-32) or DCS tone (1-777) or 0 - to indicate no tone, to transmit - for this tone index (0-32, 0 disables - transmit CTCSS), set index also (0-15) */ -#define ZT_RADPAR_DEBOUNCETIME 12 /* receive indication debounce time, - milliseconds (1-999) */ -#define ZT_RADPAR_BURSTTIME 13 /* end of transmit with no CT tone in - milliseconds (0-999) */ - - -#define ZT_RADPAR_UIODATA 14 /* read/write UIOA and UIOB data. Bit 0 is - UIOA, bit 1 is UIOB */ -#define ZT_RADPAR_UIOMODE 15 /* 0 means UIOA and UIOB are both outputs, 1 - means UIOA is input, UIOB is output, 2 - means UIOB is input and UIOA is output, - 3 means both UIOA and UIOB are inputs. Note - mode for UIOA is overridden when in - EXTRXTONE mode. */ - -#define ZT_RADPAR_REMMODE 16 /* Remote control data mode */ - #define ZT_RADPAR_REM_NONE 0 /* no remote control data mode */ - #define ZT_RADPAR_REM_RBI1 1 /* Doug Hall RBI-1 data mode */ - #define ZT_RADPAR_REM_SERIAL 2 /* Serial Data, 9600 BPS */ - #define ZT_RADPAR_REM_SERIAL_ASCII 3 /* Serial Ascii Data, 9600 BPS */ - -#define ZT_RADPAR_REMCOMMAND 17 /* Remote conrtol write data block & do cmd */ - -/* Data formats for capabilities and frames alike (from Asterisk) */ -/*! G.723.1 compression */ -#define ZT_FORMAT_G723_1 (1 << 0) -/*! GSM compression */ -#define ZT_FORMAT_GSM (1 << 1) -/*! Raw mu-law data (G.711) */ -#define ZT_FORMAT_ULAW (1 << 2) -/*! Raw A-law data (G.711) */ -#define ZT_FORMAT_ALAW (1 << 3) -/*! ADPCM (G.726, 32kbps) */ -#define ZT_FORMAT_G726 (1 << 4) -/*! ADPCM (IMA) */ -#define ZT_FORMAT_ADPCM (1 << 5) -/*! Raw 16-bit Signed Linear (8000 Hz) PCM */ -#define ZT_FORMAT_SLINEAR (1 << 6) -/*! LPC10, 180 samples/frame */ -#define ZT_FORMAT_LPC10 (1 << 7) -/*! G.729A audio */ -#define ZT_FORMAT_G729A (1 << 8) -/*! SpeeX Free Compression */ -#define ZT_FORMAT_SPEEX (1 << 9) -/*! iLBC Free Compression */ -#define ZT_FORMAT_ILBC (1 << 10) -/*! Maximum audio format */ -#define ZT_FORMAT_MAX_AUDIO (1 << 15) -/*! Maximum audio mask */ -#define ZT_FORMAT_AUDIO_MASK ((1 << 16) - 1) - -#define ZT_RADPAR_DEEMP 18 /* Audio De-empahsis (on or off) */ - -#define ZT_RADPAR_PREEMP 19 /* Audio Pre-empahsis (on or off) */ - -#define ZT_RADPAR_RXGAIN 20 /* Audio (In to system) Rx Gain */ - -#define ZT_RADPAR_TXGAIN 21 /* Audio (Out from system) Tx Gain */ - -#define ZT_RADPAR_CTCSSACQUIRETIME 22 /* CTCSS Aquire time */ -#define ZT_RADPAR_CTCSSTALKOFFTIME 23 /* CTCSS Talk off time */ - - - -struct torisa_debug { - unsigned int txerrors; - unsigned int irqcount; - unsigned int taskletsched; - unsigned int taskletrun; - unsigned int taskletexec; - int span1flags; - int span2flags; -}; - -/* Special torisa ioctl */ -#define TORISA_GETDEBUG _IOW (ZT_CODE, 60, struct torisa_debug) - -/*! - \brief Size-limited null-terminating string copy. - \param dst The destination buffer - \param src The source string - \param size The size of the destination buffer - \return Nothing. - - This is similar to \a strncpy, with two important differences: - - the destination buffer will \b always be null-terminated - - the destination buffer is not filled with zeros past the copied string length - These differences make it slightly more efficient, and safer to use since it will - not leave the destination buffer unterminated. There is no need to pass an artificially - reduced buffer size to this function (unlike \a strncpy), and the buffer does not need - to be initialized to zeroes prior to calling this function. -*/ -static inline void zap_copy_string(char *dst, const char *src, unsigned int size) -{ - while (*src && size) { - *dst++ = *src++; - size--; - } - if (__builtin_expect(!size, 0)) - dst--; - *dst = '\0'; -} - -#endif /* _LINUX_ZAPTEL_H */ diff --git a/zaptel/kernel/zconfig.h b/zaptel/kernel/zconfig.h deleted file mode 100644 index 26d1755f..00000000 --- a/zaptel/kernel/zconfig.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* - * Zaptel configuration options - * - */ -#ifndef _ZCONFIG_H -#define _ZCONFIG_H - -#ifdef __KERNEL__ -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#include -#else -#include -#endif -#endif - -/* Zaptel compile time options */ - -/* - * Uncomment if you have a European phone, or any other phone with a - * short flash time. - * This will stop the flash being mis-detected as a pulse dial "1" on - * phones with short flashes - */ -/* #define SHORT_FLASH_TIME */ - -/* - * Uncomment to disable calibration and/or DC/DC converter tests - * (not generally recommended) - */ -/* #define NO_CALIBRATION */ -/* #define NO_DCDC */ - -/* - * Boost ring voltage (Higher ring voltage, takes more power) - * Note: this only affects the wcfxsusb and wcusb drivers; all other - * drivers have a 'boostringer' module parameter. - */ -/* #define BOOST_RINGER */ - -/* - * Define CONFIG_CALC_XLAW if you have a small number of channels and/or - * a small level 2 cache, to optimize for few channels - * - */ -/* #define CONFIG_CALC_XLAW */ - -/* - * Define if you want MMX optimizations in zaptel - * - * Note: CONFIG_ZAPTEL_MMX is generally incompatible with AMD - * processors and can cause system instability! - * - */ -/* #define CONFIG_ZAPTEL_MMX */ - -/** If defined: the user must define exactly one ECHO_CAN_ var: */ -#ifndef ECHO_CAN_FROMENV - -/* - * Pick your echo canceller: MARK2, MARK3, STEVE, or STEVE2 :) - * - */ -/* #define ECHO_CAN_STEVE */ -/* #define ECHO_CAN_STEVE2 */ -/* #define ECHO_CAN_KB1 */ -/* This is the new latest and greatest */ -#define ECHO_CAN_MG2 - -/* - * This is only technically an "echo canceller"... - * It purposely drops 2 out of 3 samples and sounds horrible. - * You really only want this for testing "echo cancelled" audio. - */ -/* #define ECHO_CAN_JP1 */ - -/* - * Uncomment for aggressive residual echo suppression under - * MARK2, KB1, and MG2 echo canceler - */ -/* #define AGGRESSIVE_SUPPRESSOR */ -#endif /* ifndef ECHO_CAN_FROMENV */ -/* - * Define to turn off the echo canceler disable tone detector, - * which will cause zaptel to ignore the 2100 Hz echo cancel disable - * tone. - */ -/* #define NO_ECHOCAN_DISABLE */ - -/* udev support */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,1) -#define CONFIG_ZAP_UDEV -#endif - -/* We now use the linux kernel config to detect which options to use */ -/* You can still override them below */ -#if defined(CONFIG_HDLC) || defined(CONFIG_HDLC_MODULE) -/* #define CONFIG_ZAPATA_NET */ /* NEVER implicitly turn on ZAPATA_NET */ -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,20) -#define CONFIG_OLD_HDLC_API -#else -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,23) -/* Starting with 2.4.23 the kernel hdlc api changed again */ -/* Now we have to use hdlc_type_trans(skb, dev) instead of htons(ETH_P_HDLC) */ -#define ZAP_HDLC_TYPE_TRANS -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,3) -#define HDLC_MAINTAINERS_ARE_MORE_STUPID_THAN_I_THOUGHT -#endif -#endif -#endif -#ifdef CONFIG_PPP -#define CONFIG_ZAPATA_PPP -#endif - -/* - * Uncomment CONFIG_ZAPATA_NET to enable SyncPPP, CiscoHDLC, and Frame Relay - * support. - */ -/* #define CONFIG_ZAPATA_NET */ - -/* - * Uncomment CONFIG_OLD_HDLC_API if your are compiling with ZAPATA_NET - * defined and you are using the old kernel HDLC interface (or if you get - * an error about ETH_P_HDLC while compiling). - */ -/* #define CONFIG_OLD_HDLC_API */ - -/* - * Uncomment for Generic PPP support (i.e. ZapRAS) - */ -/* #define CONFIG_ZAPATA_PPP */ -/* - * Uncomment to enable "watchdog" to monitor if interfaces - * stop taking interrupts or otherwise misbehave - */ -/* #define CONFIG_ZAPTEL_WATCHDOG */ - -/* - * Uncomment for Non-standard FXS groundstart start state (A=Low, B=Low) - * particularly for CAC channel bank groundstart FXO ports. - */ -/* #define CONFIG_CAC_GROUNDSTART */ - -/* - * Uncomment if you happen have an early TDM400P Rev H which - * sometimes forgets its PCI ID to have wcfxs match essentially all - * subvendor ID's - */ -/* #define TDM_REVH_MATCHALL */ - -/* - * Uncomment the following if you want to support E&M trunks being - * able to "flash" after going off-hook (dont ask why, just nod :-) ). - * - * NOTE: *DO NOT* Enable "EMFLASH" and "EMPULSE" at the same time!! - * - */ -/* #define EMFLASH */ - -/* - * Uncomment the following if you want to support E&M trunks being - * able to recognize Dial Pulse digits. This can validly be enabled - * so that either Dial Pulse or DTMF/MF tones will be recognized, but - * the drawback is that the ONHOOK will take an extra {rxwinktime} - * to be recognized. - * - * NOTE: *DO NOT* Enable "EMFLASH" and "EMPULSE" at the same time!! - * - */ -/* #define EMPULSE */ - -/* - * Comment out the following if you dont want events to indicate the - * beginning of an incoming ring. Most non-Asterisk applications will - * want this commented out. - */ -#define RINGBEGIN - -/* - * Uncomment the following if you need to support FXS Flash events. - * Most applications will want this commented out. - */ -/* #define FXSFLASH */ - -/* - * Enable sync_tick() calls. Allows low-level drivers to synchronize - * their internal clocks to the zaptel master clock. - */ -#define ZAPTEL_SYNC_TICK - -/* - * Skip processing PCM if low-level driver won't use it anyway - */ -/* #define OPTIMIZE_CHANMUTE */ - -#endif diff --git a/zaptel/kernel/ztd-eth.c b/zaptel/kernel/ztd-eth.c deleted file mode 100644 index 0bdc2e45..00000000 --- a/zaptel/kernel/ztd-eth.c +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Dynamic Span Interface for Zaptel (Ethernet Interface) - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_DEVFS_FS -#include -#endif -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif - -#define ETH_P_ZTDETH 0xd00d - -struct ztdeth_header { - unsigned short subaddr; -}; - -/* We take the raw message, put it in an ethernet frame, and add a - two byte addressing header at the top for future use */ -#ifdef DEFINE_SPINLOCK -static DEFINE_SPINLOCK(zlock); -#else -static spinlock_t zlock = SPIN_LOCK_UNLOCKED; -#endif - -static struct sk_buff_head skbs; - -static struct ztdeth { - unsigned char addr[ETH_ALEN]; - unsigned short subaddr; /* Network byte order */ - struct zt_span *span; - char ethdev[IFNAMSIZ]; - struct net_device *dev; - struct ztdeth *next; -} *zdevs = NULL; - -struct zt_span *ztdeth_getspan(unsigned char *addr, unsigned short subaddr) -{ - unsigned long flags; - struct ztdeth *z; - struct zt_span *span = NULL; - spin_lock_irqsave(&zlock, flags); - z = zdevs; - while(z) { - if (!memcmp(addr, z->addr, ETH_ALEN) && - z->subaddr == subaddr) - break; - z = z->next; - } - if (z) - span = z->span; - spin_unlock_irqrestore(&zlock, flags); - return span; -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) -static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) -#else -static int ztdeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) -#endif -{ - struct zt_span *span; - struct ztdeth_header *zh; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - zh = (struct ztdeth_header *)skb_network_header(skb); -#else - zh = (struct ztdeth_header *)skb->nh.raw; -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9) - span = ztdeth_getspan(eth_hdr(skb)->h_source, zh->subaddr); -#else - span = ztdeth_getspan(skb->mac.ethernet->h_source, zh->subaddr); -#endif - if (span) { - skb_pull(skb, sizeof(struct ztdeth_header)); - zt_dynamic_receive(span, (unsigned char *)skb->data, skb->len); - } - kfree_skb(skb); - return 0; -} - -static int ztdeth_notifier(struct notifier_block *block, unsigned long event, void *ptr) -{ - struct net_device *dev = ptr; - struct ztdeth *z; - unsigned long flags; - switch(event) { - case NETDEV_GOING_DOWN: - case NETDEV_DOWN: - spin_lock_irqsave(&zlock, flags); - z = zdevs; - while(z) { - /* Note that the device no longer exists */ - if (z->dev == dev) - z->dev = NULL; - z = z->next; - } - spin_unlock_irqrestore(&zlock, flags); - break; - case NETDEV_UP: - spin_lock_irqsave(&zlock, flags); - z = zdevs; - while(z) { - /* Now that the device exists again, use it */ - if (!strcmp(z->ethdev, dev->name)) - z->dev = dev; - z = z->next; - } - spin_unlock_irqrestore(&zlock, flags); - break; - } - return 0; -} - -static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen) -{ - struct ztdeth *z; - struct sk_buff *skb; - struct ztdeth_header *zh; - unsigned long flags; - struct net_device *dev; - unsigned char addr[ETH_ALEN]; - unsigned short subaddr; /* Network byte order */ - - spin_lock_irqsave(&zlock, flags); - z = pvt; - if (z->dev) { - /* Copy fields to local variables to remove spinlock ASAP */ - dev = z->dev; - memcpy(addr, z->addr, sizeof(z->addr)); - subaddr = z->subaddr; - spin_unlock_irqrestore(&zlock, flags); - skb = dev_alloc_skb(msglen + dev->hard_header_len + sizeof(struct ztdeth_header) + 32); - if (skb) { - /* Reserve header space */ - skb_reserve(skb, dev->hard_header_len + sizeof(struct ztdeth_header)); - - /* Copy message body */ - memcpy(skb_put(skb, msglen), msg, msglen); - - /* Throw on header */ - zh = (struct ztdeth_header *)skb_push(skb, sizeof(struct ztdeth_header)); - zh->subaddr = subaddr; - - /* Setup protocol and such */ - skb->protocol = __constant_htons(ETH_P_ZTDETH); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) - skb_set_network_header(skb, 0); -#else - skb->nh.raw = skb->data; -#endif - skb->dev = dev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) - dev_hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len); -#else - if (dev->hard_header) - dev->hard_header(skb, dev, ETH_P_ZTDETH, addr, dev->dev_addr, skb->len); -#endif - skb_queue_tail(&skbs, skb); - } - } - else - spin_unlock_irqrestore(&zlock, flags); - return 0; -} - - -static int ztdeth_flush(void) -{ - struct sk_buff *skb; - - /* Handle all transmissions now */ - while ((skb = skb_dequeue(&skbs))) { - dev_queue_xmit(skb); - } - return 0; -} - -static struct packet_type ztdeth_ptype = { - type: __constant_htons(ETH_P_ZTDETH), /* Protocol */ - dev: NULL, /* Device (NULL = wildcard) */ - func: ztdeth_rcv, /* Receiver */ -}; - -static int digit2int(char d) -{ - switch(d) { - case 'F': - case 'E': - case 'D': - case 'C': - case 'B': - case 'A': - return d - 'A' + 10; - case 'f': - case 'e': - case 'd': - case 'c': - case 'b': - case 'a': - return d - 'a' + 10; - case '9': - case '8': - case '7': - case '6': - case '5': - case '4': - case '3': - case '2': - case '1': - case '0': - return d - '0'; - } - return -1; -} - -static int hex2int(char *s) -{ - int res; - int tmp; - /* Gotta be at least one digit */ - if (strlen(s) < 1) - return -1; - /* Can't be more than two */ - if (strlen(s) > 2) - return -1; - /* Grab the first digit */ - res = digit2int(s[0]); - if (res < 0) - return -1; - tmp = res; - /* Grab the next */ - if (strlen(s) > 1) { - res = digit2int(s[1]); - if (res < 0) - return -1; - tmp = tmp * 16 + res; - } - return tmp; -} - -static void ztdeth_destroy(void *pvt) -{ - struct ztdeth *z = pvt; - unsigned long flags; - struct ztdeth *prev=NULL, *cur; - spin_lock_irqsave(&zlock, flags); - cur = zdevs; - while(cur) { - if (cur == z) { - if (prev) - prev->next = cur->next; - else - zdevs = cur->next; - break; - } - prev = cur; - cur = cur->next; - } - spin_unlock_irqrestore(&zlock, flags); - if (cur == z) { /* Successfully removed */ - printk("TDMoE: Removed interface for %s\n", z->span->name); - kfree(z); -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - } -} - -static void *ztdeth_create(struct zt_span *span, char *addr) -{ - struct ztdeth *z; - char src[256]; - char tmp[256], *tmp2, *tmp3, *tmp4 = NULL; - int res,x; - unsigned long flags; - - z = kmalloc(sizeof(struct ztdeth), GFP_KERNEL); - if (z) { - /* Zero it out */ - memset(z, 0, sizeof(struct ztdeth)); - - /* Address should be /[/subaddr] */ - zap_copy_string(tmp, addr, sizeof(tmp)); - tmp2 = strchr(tmp, '/'); - if (tmp2) { - *tmp2 = '\0'; - tmp2++; - zap_copy_string(z->ethdev, tmp, sizeof(z->ethdev)); - } else { - printk("Invalid TDMoE address (no device) '%s'\n", addr); - kfree(z); - return NULL; - } - if (tmp2) { - tmp4 = strchr(tmp2+1, '/'); - if (tmp4) { - *tmp4 = '\0'; - tmp4++; - } - /* We don't have SSCANF :( Gotta do this the hard way */ - tmp3 = strchr(tmp2, ':'); - for (x=0;x<6;x++) { - if (tmp2) { - if (tmp3) { - *tmp3 = '\0'; - tmp3++; - } - res = hex2int(tmp2); - if (res < 0) - break; - z->addr[x] = res & 0xff; - } else - break; - if ((tmp2 = tmp3)) - tmp3 = strchr(tmp2, ':'); - } - if (x != 6) { - printk("TDMoE: Invalid MAC address in: %s\n", addr); - kfree(z); - return NULL; - } - } else { - printk("TDMoE: Missing MAC address\n"); - kfree(z); - return NULL; - } - if (tmp4) { - int sub = 0; - int mul = 1; - - /* We have a subaddr */ - tmp3 = tmp4 + strlen (tmp4) - 1; - while (tmp3 >= tmp4) { - if (*tmp3 >= '0' && *tmp3 <= '9') { - sub += (*tmp3 - '0') * mul; - } else { - printk("TDMoE: Invalid subaddress\n"); - kfree(z); - return NULL; - } - mul *= 10; - tmp3--; - } - z->subaddr = htons(sub); - } - z->dev = dev_get_by_name( -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) - &init_net, -#endif - z->ethdev); - if (!z->dev) { - printk("TDMoE: Invalid device '%s'\n", z->ethdev); - kfree(z); - return NULL; - } - z->span = span; - src[0] ='\0'; - for (x=0;x<5;x++) - sprintf(src + strlen(src), "%02x:", z->dev->dev_addr[x]); - sprintf(src + strlen(src), "%02x", z->dev->dev_addr[5]); - printk("TDMoE: Added new interface for %s at %s (addr=%s, src=%s, subaddr=%d)\n", span->name, z->dev->name, addr, src, ntohs(z->subaddr)); - - spin_lock_irqsave(&zlock, flags); - z->next = zdevs; - zdevs = z; - spin_unlock_irqrestore(&zlock, flags); -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - if(!try_module_get(THIS_MODULE)) - printk("TDMoE: Unable to increment module use count\n"); -#endif - } - return z; -} - -static struct zt_dynamic_driver ztd_eth = { - "eth", - "Ethernet", - ztdeth_create, - ztdeth_destroy, - ztdeth_transmit, - ztdeth_flush -}; - -static struct notifier_block ztdeth_nblock = { - notifier_call: ztdeth_notifier, -}; - -static int __init ztdeth_init(void) -{ - dev_add_pack(&ztdeth_ptype); - register_netdevice_notifier(&ztdeth_nblock); - zt_dynamic_register(&ztd_eth); - - skb_queue_head_init(&skbs); - - return 0; -} - -static void __exit ztdeth_exit(void) -{ - dev_remove_pack(&ztdeth_ptype); - unregister_netdevice_notifier(&ztdeth_nblock); - zt_dynamic_unregister(&ztd_eth); -} - -MODULE_DESCRIPTION("Zaptel Dynamic TDMoE Support"); -MODULE_AUTHOR("Mark Spencer "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(ztdeth_init); -module_exit(ztdeth_exit); diff --git a/zaptel/kernel/ztd-loc.c b/zaptel/kernel/ztd-loc.c deleted file mode 100644 index d454322d..00000000 --- a/zaptel/kernel/ztd-loc.c +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Dynamic Span Interface for Zaptel (Local Interface) - * - * Written by Nicolas Bougues - * - * Copyright (C) 2004, Axialys Interactive - * - * All rights reserved. - * - * Note : a Zaptel source must exist prior to loading this driver - * - * Address syntax : - * :[:] - * - * As of now, keys and ids are single digit only - * - * One span may have up to one "normal" peer, and one "monitor" peer - * - * Example : - * - * Say you have two spans cross connected, a thrid one monitoring RX on the - * first one, a fourth one monitoring RX on the second one - * - * 1:0 - * 1:1 - * 1:2:0 - * 1:3:1 - * - * Contrary to TDMoE, no frame loss can occur. - * - * See bug #2021 for more details - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_DEVFS_FS -#include -#endif -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif - -#ifdef DEFINE_SPINLOCK -static DEFINE_SPINLOCK(zlock); -#else -static spinlock_t zlock = SPIN_LOCK_UNLOCKED; -#endif - -static struct ztdlocal { - unsigned short key; - unsigned short id; - struct ztdlocal *monitor_rx_peer; /* Indicates the peer span that monitors this span */ - struct ztdlocal *peer; /* Indicates the rw peer for this span */ - struct zt_span *span; - struct ztdlocal *next; -} *zdevs = NULL; - -/*static*/ int ztdlocal_transmit(void *pvt, unsigned char *msg, int msglen) -{ - struct ztdlocal *z; - unsigned long flags; - - spin_lock_irqsave(&zlock, flags); - z = pvt; - if (z->peer && z->peer->span) { - zt_dynamic_receive(z->peer->span, msg, msglen); - } - if (z->monitor_rx_peer && z->monitor_rx_peer->span) { - zt_dynamic_receive(z->monitor_rx_peer->span, msg, msglen); - } - spin_unlock_irqrestore(&zlock, flags); - return 0; -} - -static int digit2int(char d) -{ - switch(d) { - case 'F': - case 'E': - case 'D': - case 'C': - case 'B': - case 'A': - return d - 'A' + 10; - case 'f': - case 'e': - case 'd': - case 'c': - case 'b': - case 'a': - return d - 'a' + 10; - case '9': - case '8': - case '7': - case '6': - case '5': - case '4': - case '3': - case '2': - case '1': - case '0': - return d - '0'; - } - return -1; -} - -/*static*/ void ztdlocal_destroy(void *pvt) -{ - struct ztdlocal *z = pvt; - unsigned long flags; - struct ztdlocal *prev=NULL, *cur; - - spin_lock_irqsave(&zlock, flags); - cur = zdevs; - while(cur) { - if (cur->peer == z) - cur->peer = NULL; - if (cur->monitor_rx_peer == z) - cur->monitor_rx_peer = NULL; - cur = cur->next; - } - cur = zdevs; - while(cur) { - if (cur == z) { - if (prev) - prev->next = cur->next; - else - zdevs = cur->next; - break; - } - prev = cur; - cur = cur->next; - } - spin_unlock_irqrestore(&zlock, flags); - if (cur == z) { - printk("TDMoL: Removed interface for %s, key %d id %d\n", z->span->name, z->key, z->id); -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - kfree(z); - } -} - -/*static*/ void *ztdlocal_create(struct zt_span *span, char *address) -{ - struct ztdlocal *z, *l; - unsigned long flags; - int key = -1, id = -1, monitor = -1; - - if (strlen(address) >= 3) { - if (address[1] != ':') - goto INVALID_ADDRESS; - key = digit2int(address[0]); - id = digit2int(address[2]); - } - if (strlen (address) == 5) { - if (address[3] != ':') - goto INVALID_ADDRESS; - monitor = digit2int(address[4]); - } - - if (key == -1 || id == -1) - goto INVALID_ADDRESS; - - z = kmalloc(sizeof(struct ztdlocal), GFP_KERNEL); - if (z) { - /* Zero it out */ - memset(z, 0, sizeof(struct ztdlocal)); - - z->key = key; - z->id = id; - z->span = span; - - spin_lock_irqsave(&zlock, flags); - /* Add this peer to any existing spans with same key - And add them as peers to this one */ - for (l = zdevs; l; l = l->next) - if (l->key == z->key) { - if (l->id == z->id) { - printk ("TDMoL: Duplicate id (%d) for key %d\n", z->id, z->key); - goto CLEAR_AND_DEL_FROM_PEERS; - } - if (monitor == -1) { - if (l->peer) { - printk ("TDMoL: Span with key %d and id %d already has a R/W peer\n", z->key, z->id); - goto CLEAR_AND_DEL_FROM_PEERS; - } else { - l->peer = z; - z->peer = l; - } - } - if (monitor == l->id) { - if (l->monitor_rx_peer) { - printk ("TDMoL: Span with key %d and id %d already has a monitoring peer\n", z->key, z->id); - goto CLEAR_AND_DEL_FROM_PEERS; - } else { - l->monitor_rx_peer = z; - } - } - } - z->next = zdevs; - zdevs = z; - spin_unlock_irqrestore(&zlock, flags); -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - if(!try_module_get(THIS_MODULE)) - printk("TDMoL: Unable to increment module use count\n"); -#endif - - printk("TDMoL: Added new interface for %s, key %d id %d\n", span->name, z->key, z->id); - } - return z; - -CLEAR_AND_DEL_FROM_PEERS: - for (l = zdevs; l; l = l->next) { - if (l->peer == z) - l->peer = NULL; - if (l->monitor_rx_peer == z) - l->monitor_rx_peer = NULL; - } - kfree (z); - return NULL; - -INVALID_ADDRESS: - printk ("TDMoL: Invalid address %s\n", address); - return NULL; -} - -static struct zt_dynamic_driver ztd_local = { - "loc", - "Local", - ztdlocal_create, - ztdlocal_destroy, - ztdlocal_transmit, - NULL /* flush */ -}; - -/*static*/ int __init ztdlocal_init(void) -{ - zt_dynamic_register(&ztd_local); - return 0; -} - -/*static*/ void __exit ztdlocal_exit(void) -{ - zt_dynamic_unregister(&ztd_local); -} - -module_init(ztdlocal_init); -module_exit(ztdlocal_exit); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif diff --git a/zaptel/kernel/ztdummy.c b/zaptel/kernel/ztdummy.c deleted file mode 100644 index 4d344de6..00000000 --- a/zaptel/kernel/ztdummy.c +++ /dev/null @@ -1,441 +0,0 @@ -/* - * Dummy Zaptel Driver for Zapata Telephony interface - * - * Required: usb-uhci module and kernel > 2.4.4 OR kernel > 2.6.0 - * - * Written by Robert Pleh - * 2.6 version by Tony Hoyle - * Unified by Mark Spencer - * Converted to use RTC on i386 by Tony Mountifield - * - * Converted to use HighResTimers on i386 by Jeffery Palmer - * - * Copyright (C) 2002, Hermes Softlab - * Copyright (C) 2004, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* - * To use the high resolution timers, in your kernel CONFIG_HIGH_RES_TIMERS - * needs to be enabled (Processor type and features -> High Resolution - * Timer Support), and optionally HPET (Processor type and features -> - * HPET Timer Support) provides a better clock source. - */ - -#include - -#ifndef VERSION_CODE -# define VERSION_CODE(vers,rel,seq) ( ((vers)<<16) | ((rel)<<8) | (seq) ) -#endif - - -#if LINUX_VERSION_CODE < VERSION_CODE(2,4,5) -# error "This kernel is too old: not supported by this file" -#endif - -/* - * NOTE: (only applies to kernel 2.6) - * If using an i386 architecture without a PC real-time clock, - * the #define USE_RTC should be commented out. - */ -#if defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_7A__) -#if LINUX_VERSION_CODE >= VERSION_CODE(2,6,13) -/* The symbol hrtimer_forward is only exported as of 2.6.22: */ -#if defined(CONFIG_HIGH_RES_TIMERS) && LINUX_VERSION_CODE >= VERSION_CODE(2,6,22) -#define USE_HIGHRESTIMER -#else -#define USE_RTC -#endif -#else -#if 0 -#define USE_RTC -#endif -#endif -#endif - -#include -#include -#include -#include -#include -#include "zaptel.h" -#ifndef LINUX26 -#include -#include -#include -#endif -#ifdef LINUX26 -#include -#ifdef USE_HIGHRESTIMER -#include -#endif -#ifdef USE_RTC -#include -#endif -#include -#endif -#include "ztdummy.h" - -#if defined(USE_HIGHRESTIMER) && ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) ) -/* compatibility with new hrtimer interface */ -static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) -{ - return timer->expires; -} - -static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) -{ - timer->expires = time; -} -#endif - -static struct ztdummy *ztd; - -static int debug = 0; - -#ifdef LINUX26 -#ifdef USE_HIGHRESTIMER -#define CLOCK_SRC "HRtimer" -struct hrtimer zaptimer; -#elif defined(USE_RTC) -#define CLOCK_SRC "RTC" -static int rtc_rate = 0; -static int current_rate = 0; -static int taskletpending = 0; -static struct tasklet_struct ztd_tlet; -static void ztd_tasklet(unsigned long data); -#else /* Linux 2.6, but no RTC or HRTIMER used */ -#define CLOCK_SRC "Linux26" -/* 2.6 kernel timer stuff */ -static struct timer_list timer; -#endif -#else -#if LINUX_VERSION_CODE < VERSION_CODE(2,4,5) -# error "This kernel is too old: not supported by this file" -#endif -#define CLOCK_SRC "UHCI" -/* Old UCHI stuff */ -static uhci_desc_t *td; -static uhci_t *s; -static int monitor = 0; - -/* exported kernel symbols */ -extern int insert_td (uhci_t *s, uhci_desc_t *qh, uhci_desc_t* new, int flags); -extern int alloc_td (uhci_t *s, uhci_desc_t ** new, int flags); -extern int insert_td_horizontal (uhci_t *s, uhci_desc_t *td, uhci_desc_t* new); -extern int unlink_td (uhci_t *s, uhci_desc_t *element, int phys_unlink); -extern void fill_td (uhci_desc_t *td, int status, int info, __u32 buffer); -extern void uhci_interrupt (int irq, void *__uhci, struct pt_regs *regs); -extern int delete_desc (uhci_t *s, uhci_desc_t *element); -extern uhci_t **uhci_devices; - -#endif - - -#define ZAPTEL_RATE 1000 /* zaptel ticks per second */ -#define ZAPTEL_TIME (1000000 / ZAPTEL_RATE) /* zaptel tick time in us */ -#define ZAPTEL_TIME_NS (ZAPTEL_TIME * 1000) /* zaptel tick time in ns */ - -/* Different bits of the debug variable: */ -#define DEBUG_GENERAL (1 << 0) -#define DEBUG_TICKS (1 << 1) - - -#ifdef LINUX26 -#ifdef USE_RTC -static void update_rtc_rate(struct ztdummy *ztd) -{ - if (((rtc_rate & (rtc_rate - 1)) != 0) || (rtc_rate > 8192) || (rtc_rate < 2)) { - printk(KERN_NOTICE "Invalid RTC rate %d specified\n", rtc_rate); - rtc_rate = current_rate; /* Set default RTC rate */ - } - if (!rtc_rate || (rtc_rate != current_rate)) { - rtc_control(&ztd->rtc_task, RTC_IRQP_SET, current_rate = (rtc_rate ? rtc_rate : 1024)); /* 1024 Hz */ - printk(KERN_INFO "ztdummy: RTC rate is %d\n", rtc_rate); - ztd->counter = 0; - } -} - -static void ztd_tasklet(unsigned long data) -{ - if (taskletpending) - update_rtc_rate((struct ztdummy *)ztd); - taskletpending = 0; -} - -/* rtc_interrupt - called at 1024Hz from hook in RTC handler */ -static void ztdummy_rtc_interrupt(void *private_data) -{ - struct ztdummy *ztd = private_data; - unsigned long flags; - - /* Is spinlock required here??? */ - spin_lock_irqsave(&ztd->rtclock, flags); - ztd->counter += ZAPTEL_TIME; - while (ztd->counter >= current_rate) { - ztd->counter -= current_rate; - /* Update of RTC IRQ rate isn't possible from interrupt handler :( */ - if (!taskletpending && (current_rate != rtc_rate)) { - taskletpending = 1; - tasklet_hi_schedule(&ztd_tlet); - } - zt_receive(&ztd->span); - zt_transmit(&ztd->span); - } - spin_unlock_irqrestore(&ztd->rtclock, flags); -} -#elif defined(USE_HIGHRESTIMER) -static enum hrtimer_restart ztdummy_hr_int(struct hrtimer *htmr) -{ - unsigned long overrun; - - /* Trigger Zaptel */ - zt_receive(&ztd->span); - zt_transmit(&ztd->span); - - /* Overrun should always return 1, since we are in the timer that - * expired. - * We should worry if overrun is 2 or more; then we really missed - * a tick */ - overrun = hrtimer_forward(&zaptimer, hrtimer_get_expires(htmr), - ktime_set(0, ZAPTEL_TIME_NS)); - if(overrun > 1) { - if(printk_ratelimit()) - printk(KERN_NOTICE "ztdummy: HRTimer missed %lu ticks\n", - overrun - 1); - } - - if(debug && DEBUG_TICKS) { - static int count = 0; - /* Printk every 5 seconds, good test to see if timer is - * running properly */ - if (count++ % 5000 == 0) - printk(KERN_DEBUG "ztdummy: 5000 ticks from hrtimer\n"); - } - - /* Always restart the timer */ - return HRTIMER_RESTART; -} -#else -/* use kernel system tick timer if PC architecture RTC is not available */ -static void ztdummy_timer(unsigned long param) -{ - hrtimer_set_expires(timer, jiffies + 1); - add_timer(&timer); - - ztd->counter += ZAPTEL_TIME; - while (ztd->counter >= HZ) { - ztd->counter -= HZ; - zt_receive(&ztd->span); - zt_transmit(&ztd->span); - } -} -#endif -#else -static void ztdummy_interrupt(int irq, void *dev_id, struct pt_regs *regs) -{ - unsigned short status; - unsigned int io_addr = s->io_addr; - - status = inw (io_addr + USBSTS); - if (status != 0) { /* interrupt from our USB port */ - static int check_int = 0; - zt_receive(&ztd->span); - zt_transmit(&ztd->span); - /* TODO: What's the relation between monitor and - * DEBUG_TICKS */ - if (monitor && check_int) { - check_int = 1; - printk(KERN_NOTICE "ztdummy: interrupt triggered \n"); - } - } - return; -} -#endif - -static int ztdummy_initialize(struct ztdummy *ztd) -{ - /* Zapata stuff */ - sprintf(ztd->span.name, "ZTDUMMY/1"); - snprintf(ztd->span.desc, sizeof(ztd->span.desc) - 1, "%s (source: " CLOCK_SRC ") %d", ztd->span.name, 1); - sprintf(ztd->chan.name, "ZTDUMMY/%d/%d", 1, 0); - zap_copy_string(ztd->span.devicetype, "Zaptel Dummy Timing Driver", sizeof(ztd->span.devicetype)); - ztd->chan.chanpos = 1; - ztd->span.chans = &ztd->chan; - ztd->span.channels = 0; /* no channels on our span */ - ztd->span.deflaw = ZT_LAW_MULAW; - init_waitqueue_head(&ztd->span.maintq); - ztd->span.pvt = ztd; - ztd->chan.pvt = ztd; - if (zt_register(&ztd->span, 0)) { - return -1; - } - return 0; -} - -int init_module(void) -{ -#ifdef LINUX26 -#ifdef USE_RTC - int err; -#endif -#else - int irq; -#ifdef DEFINE_SPINLOCK - DEFINE_SPINLOCK(mylock); -#else - spinlock_t mylock = SPIN_LOCK_UNLOCKED; -#endif - - if (uhci_devices==NULL) { - printk (KERN_ERR "ztdummy: Uhci_devices pointer error.\n"); - return -ENODEV; - } - s=*uhci_devices; /* uhci device */ - if (s==NULL) { - printk (KERN_ERR "ztdummy: No uhci_device found.\n"); - return -ENODEV; - } -#endif - - ztd = kmalloc(sizeof(struct ztdummy), GFP_KERNEL); - if (ztd == NULL) { - printk(KERN_ERR "ztdummy: Unable to allocate memory\n"); - return -ENOMEM; - } - - memset(ztd, 0x0, sizeof(struct ztdummy)); - - if (ztdummy_initialize(ztd)) { - printk(KERN_ERR "ztdummy: Unable to intialize zaptel driver\n"); - kfree(ztd); - return -ENODEV; - } - -#ifdef LINUX26 - ztd->counter = 0; -#ifdef USE_RTC - ztd->rtclock = SPIN_LOCK_UNLOCKED; - ztd->rtc_task.func = ztdummy_rtc_interrupt; - ztd->rtc_task.private_data = ztd; - err = rtc_register(&ztd->rtc_task); - if (err < 0) { - printk(KERN_ERR "ztdummy: Unable to register zaptel rtc driver\n"); - zt_unregister(&ztd->span); - kfree(ztd); - return err; - } - /* Set default RTC interrupt rate to 1024Hz */ - if (!rtc_rate) - rtc_rate = 1024; - update_rtc_rate(ztd); - rtc_control(&ztd->rtc_task, RTC_PIE_ON, 0); - tasklet_init(&ztd_tlet, ztd_tasklet, 0); -#elif defined(USE_HIGHRESTIMER) - printk(KERN_DEBUG "ztdummy: Trying to load High Resolution Timer\n"); - hrtimer_init(&zaptimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - printk(KERN_DEBUG "ztdummy: Initialized High Resolution Timer\n"); - - /* Set timer callback function */ - zaptimer.function = ztdummy_hr_int; - - printk(KERN_DEBUG "ztdummy: Starting High Resolution Timer\n"); - hrtimer_start(&zaptimer, ktime_set(0, ZAPTEL_TIME_NS), HRTIMER_MODE_REL); - printk(KERN_INFO "ztdummy: High Resolution Timer started, good to go\n"); -#else - init_timer(&timer); - timer.function = ztdummy_timer; - timer.expires = jiffies + 1; - add_timer(&timer); -#endif -#else - irq=s->irq; - spin_lock_irq(&mylock); - free_irq(s->irq, s); /* remove uhci_interrupt temporaly */ - if (request_irq (irq, ztdummy_interrupt, ZAP_IRQ_SHARED, "ztdummy", ztd)) { - spin_unlock_irq(&mylock); - err("Our request_irq %d failed!",irq); - kfree(ztd); - return -EIO; - } /* we add our handler first, to assure, that our handler gets called first */ - if (request_irq (irq, uhci_interrupt, ZAP_IRQ_SHARED, s->uhci_pci->driver->name, s)) { - spin_unlock_irq(&mylock); - err("Original request_irq %d failed!",irq); - } - spin_unlock_irq(&mylock); - - /* add td to usb host controller interrupt queue */ - alloc_td(s, &td, 0); - fill_td(td, TD_CTRL_IOC, 0, 0); - insert_td_horizontal(s, s->int_chain[0], td); /* use int_chain[0] to get 1ms interrupts */ -#endif - - if (debug) - printk(KERN_DEBUG "ztdummy: init() finished\n"); - return 0; -} - - -void cleanup_module(void) -{ -#ifdef LINUX26 -#ifdef USE_RTC - if (taskletpending) { - tasklet_disable(&ztd_tlet); - tasklet_kill(&ztd_tlet); - } - rtc_control(&ztd->rtc_task, RTC_PIE_OFF, 0); - rtc_unregister(&ztd->rtc_task); -#elif defined(USE_HIGHRESTIMER) - /* Stop high resolution timer */ - hrtimer_cancel(&zaptimer); -#else - del_timer(&timer); -#endif -#else - free_irq(s->irq, ztd); /* disable interrupts */ -#endif - zt_unregister(&ztd->span); - kfree(ztd); -#ifndef LINUX26 - unlink_td(s, td, 1); - delete_desc(s, td); -#endif - if (debug) - printk("ztdummy: cleanup() finished\n"); -} - - - -#ifdef LINUX26 -module_param(debug, int, 0600); -#ifdef USE_RTC -module_param(rtc_rate, int, 0600); -#endif -#else -MODULE_PARM(debug, "i"); -#endif - -#ifndef LINUX26 -MODULE_PARM(monitor, "i"); -#endif -MODULE_DESCRIPTION("Dummy Zaptel Driver"); -MODULE_AUTHOR("Robert Pleh "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif diff --git a/zaptel/kernel/ztdummy.h b/zaptel/kernel/ztdummy.h deleted file mode 100644 index 68fb2e22..00000000 --- a/zaptel/kernel/ztdummy.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Dummy Zaptel Driver for Zapata Telephony interface - * - * Written by Robert Pleh - * - * Copyright (C) 2002, Hermes Softlab - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19) -#define USB2420 -#endif - -struct ztdummy { - struct zt_span span; - struct zt_chan chan; -#ifdef LINUX26 - unsigned int counter; -#ifdef USE_RTC - spinlock_t rtclock; - rtc_task_t rtc_task; -#endif -#endif -}; - - -#ifndef LINUX26 -/* Uhci definitions and structures - from file usb-uhci.h */ -#define TD_CTRL_IOC (1 << 24) /* Interrupt on Complete */ -#define USBSTS 2 - -typedef enum { - TD_TYPE, QH_TYPE -} uhci_desc_type_t; - -typedef struct { - __u32 link; - __u32 status; - __u32 info; - __u32 buffer; -} uhci_td_t, *puhci_td_t; - - -typedef struct { - __u32 head; - __u32 element; /* Queue element pointer */ -} uhci_qh_t, *puhci_qh_t; - -typedef struct { - union { - uhci_td_t td; - uhci_qh_t qh; - } hw; - uhci_desc_type_t type; - dma_addr_t dma_addr; - struct list_head horizontal; - struct list_head vertical; - struct list_head desc_list; - int last_used; -} uhci_desc_t, *puhci_desc_t; - -typedef struct { - struct list_head desc_list; // list pointer to all corresponding TDs/QHs associated with this request - dma_addr_t setup_packet_dma; - dma_addr_t transfer_buffer_dma; - unsigned long started; -#ifdef USB2420 - struct urb *next_queued_urb; // next queued urb for this EP - struct urb *prev_queued_urb; -#else - urb_t *next_queued_urb; - urb_t *prev_queued_urb; -#endif - uhci_desc_t *bottom_qh; - uhci_desc_t *next_qh; // next helper QH - char use_loop; - char flags; -} urb_priv_t, *purb_priv_t; - -struct virt_root_hub { - int devnum; /* Address of Root Hub endpoint */ - void *urb; - void *int_addr; - int send; - int interval; - int numports; - int c_p_r[8]; - struct timer_list rh_int_timer; -}; - -typedef struct uhci { - int irq; - unsigned int io_addr; - unsigned int io_size; - unsigned int maxports; - int running; - - int apm_state; - - struct uhci *next; // chain of uhci device contexts - - struct list_head urb_list; // list of all pending urbs - - spinlock_t urb_list_lock; // lock to keep consistency - - int unlink_urb_done; - atomic_t avoid_bulk; - - struct usb_bus *bus; // our bus - - __u32 *framelist; - dma_addr_t framelist_dma; - uhci_desc_t **iso_td; - uhci_desc_t *int_chain[8]; - uhci_desc_t *ls_control_chain; - uhci_desc_t *control_chain; - uhci_desc_t *bulk_chain; - uhci_desc_t *chain_end; - uhci_desc_t *td1ms; - uhci_desc_t *td32ms; - struct list_head free_desc; - spinlock_t qh_lock; - spinlock_t td_lock; - struct virt_root_hub rh; //private data of the virtual root hub - int loop_usage; // URBs using bandwidth reclamation - - struct list_head urb_unlinked; // list of all unlinked urbs - long timeout_check; - int timeout_urbs; - struct pci_dev *uhci_pci; - struct pci_pool *desc_pool; - long last_error_time; // last error output in uhci_interrupt() -} uhci_t, *puhci_t; -#endif diff --git a/zaptel/kernel/ztdynamic.c b/zaptel/kernel/ztdynamic.c deleted file mode 100644 index 4db7e1e3..00000000 --- a/zaptel/kernel/ztdynamic.c +++ /dev/null @@ -1,875 +0,0 @@ -/* - * Dynamic Span Interface for Zaptel - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_DEVFS_FS -#include -#endif -#ifdef STANDALONE_ZAPATA -#include "zaptel.h" -#else -#include -#endif -#ifdef LINUX26 -#include -#endif - -/* - * Tasklets provide better system interactive response at the cost of the - * possibility of losing a frame of data at very infrequent intervals. If - * you are more concerned with the performance of your machine, enable the - * tasklets. If you are strict about absolutely no drops, then do not enable - * tasklets. - */ - -#define ENABLE_TASKLETS - -/* - * Dynamic spans implemented using TDM over X with standard message - * types. Message format is as follows: - * - * Byte #: Meaning - * 0 Number of samples per channel - * 1 Current flags on span - * Bit 0: Yellow Alarm - * Bit 1: Sig bits present - * Bits 2-7: reserved for future use - * 2-3 16-bit counter value for detecting drops, network byte order. - * 4-5 Number of channels in the message, network byte order - * 6... 16-bit words, containing sig bits for each - * four channels, least significant 4 bits being - * the least significant channel, network byte order. - * the rest data for each channel, all samples per channel - before moving to the next. - */ - -/* Arbitrary limit to the max # of channels in a span */ -#define ZT_DYNAMIC_MAX_CHANS 256 - -#define ZTD_FLAG_YELLOW_ALARM (1 << 0) -#define ZTD_FLAG_SIGBITS_PRESENT (1 << 1) -#define ZTD_FLAG_LOOPBACK (1 << 2) - -#define ERR_NSAMP (1 << 16) -#define ERR_NCHAN (1 << 17) -#define ERR_LEN (1 << 18) - -EXPORT_SYMBOL(zt_dynamic_register); -EXPORT_SYMBOL(zt_dynamic_unregister); -EXPORT_SYMBOL(zt_dynamic_receive); - -#ifdef ENABLE_TASKLETS -static int taskletrun; -static int taskletsched; -static int taskletpending; -static int taskletexec; -static int txerrors; -static struct tasklet_struct ztd_tlet; - -static void ztd_tasklet(unsigned long data); -#endif - - -static struct zt_dynamic { - char addr[40]; - char dname[20]; - int err; - int usecount; - int dead; - long rxjif; - unsigned short txcnt; - unsigned short rxcnt; - struct zt_span span; - struct zt_chan *chans; - struct zt_dynamic *next; - struct zt_dynamic_driver *driver; - void *pvt; - int timing; - int master; - unsigned char *msgbuf; -} *dspans; - -static struct zt_dynamic_driver *drivers = NULL; - -static int debug = 0; - -static int hasmaster = 0; -#ifdef DEFINE_SPINLOCK -static DEFINE_SPINLOCK(dlock); -#else -static spinlock_t dlock = SPIN_LOCK_UNLOCKED; -#endif - -#ifdef DEFINE_RWLOCK -static DEFINE_RWLOCK(drvlock); -#else -static rwlock_t drvlock = RW_LOCK_UNLOCKED; -#endif - -static void checkmaster(void) -{ - unsigned long flags; - int newhasmaster=0; - int best = 9999999; - struct zt_dynamic *z, *master=NULL; - spin_lock_irqsave(&dlock, flags); - z = dspans; - while(z) { - if (z->timing) { - z->master = 0; - if (!(z->span.alarms & ZT_ALARM_RED) && - (z->timing < best) && !z->dead) { - /* If not in alarm and they're - a better timing source, use them */ - master = z; - best = z->timing; - newhasmaster = 1; - } - } - z = z->next; - } - hasmaster = newhasmaster; - /* Mark the new master if there is one */ - if (master) - master->master = 1; - spin_unlock_irqrestore(&dlock, flags); - if (master) - printk("TDMoX: New master: %s\n", master->span.name); - else - printk("TDMoX: No master.\n"); -} - -static void ztd_sendmessage(struct zt_dynamic *z) -{ - unsigned char *buf = z->msgbuf; - unsigned short bits; - int msglen = 0; - int x; - int offset; - - /* Byte 0: Number of samples per channel */ - *buf = ZT_CHUNKSIZE; - buf++; msglen++; - - /* Byte 1: Flags */ - *buf = 0; - if (z->span.alarms & ZT_ALARM_RED) - *buf |= ZTD_FLAG_YELLOW_ALARM; - *buf |= ZTD_FLAG_SIGBITS_PRESENT; - buf++; msglen++; - - /* Bytes 2-3: Transmit counter */ - *((unsigned short *)buf) = htons((unsigned short)z->txcnt); - z->txcnt++; - buf++; msglen++; - buf++; msglen++; - - /* Bytes 4-5: Number of channels */ - *((unsigned short *)buf) = htons((unsigned short)z->span.channels); - buf++; msglen++; - buf++; msglen++; - bits = 0; - offset = 0; - for (x=0;xspan.channels;x++) { - offset = x % 4; - bits |= (z->chans[x].txsig & 0xf) << (offset << 2); - if (offset == 3) { - /* Write the bits when we have four channels */ - *((unsigned short *)buf) = htons(bits); - buf++; msglen++; - buf++; msglen++; - bits = 0; - } - } - - if (offset != 3) { - /* Finish it off if it's not done already */ - *((unsigned short *)buf) = htons(bits); - buf++; msglen++; - buf++; msglen++; - } - - for (x=0;xspan.channels;x++) { - memcpy(buf, z->chans[x].writechunk, ZT_CHUNKSIZE); - buf += ZT_CHUNKSIZE; - msglen += ZT_CHUNKSIZE; - } - - z->driver->transmit(z->pvt, z->msgbuf, msglen); - -} - -static void __ztdynamic_run(void) -{ - unsigned long flags; - struct zt_dynamic *z; - struct zt_dynamic_driver *drv; - int y; - spin_lock_irqsave(&dlock, flags); - z = dspans; - while(z) { - if (!z->dead) { - /* Ignore dead spans */ - for (y=0;yspan.channels;y++) { - /* Echo cancel double buffered data */ - zt_ec_chunk(&z->span.chans[y], z->span.chans[y].readchunk, z->span.chans[y].writechunk); - } - zt_receive(&z->span); - zt_transmit(&z->span); - /* Handle all transmissions now */ - ztd_sendmessage(z); - } - z = z->next; - } - spin_unlock_irqrestore(&dlock, flags); - - read_lock(&drvlock); - drv = drivers; - while(drv) { - /* Flush any traffic still pending in the driver */ - if (drv->flush) { - drv->flush(); - } - drv = drv->next; - } - read_unlock(&drvlock); -} - -#ifdef ENABLE_TASKLETS -static void ztdynamic_run(void) -{ - if (!taskletpending) { - taskletpending = 1; - taskletsched++; - tasklet_hi_schedule(&ztd_tlet); - } else { - txerrors++; - } -} -#else -#define ztdynamic_run __ztdynamic_run -#endif - -void zt_dynamic_receive(struct zt_span *span, unsigned char *msg, int msglen) -{ - struct zt_dynamic *ztd = span->pvt; - int newerr=0; - unsigned long flags; - int sflags; - int xlen; - int x, bits, sig; - int nchans, master; - int newalarm; - unsigned short rxpos, rxcnt; - - - spin_lock_irqsave(&dlock, flags); - if (msglen < 6) { - spin_unlock_irqrestore(&dlock, flags); - newerr = ERR_LEN; - if (newerr != ztd->err) { - printk("Span %s: Insufficient samples for header (only %d)\n", span->name, msglen); - } - ztd->err = newerr; - return; - } - - /* First, check the chunksize */ - if (*msg != ZT_CHUNKSIZE) { - spin_unlock_irqrestore(&dlock, flags); - newerr = ERR_NSAMP | msg[0]; - if (newerr != ztd->err) { - printk("Span %s: Expected %d samples, but receiving %d\n", span->name, ZT_CHUNKSIZE, msg[0]); - } - ztd->err = newerr; - return; - } - msg++; - sflags = *msg; - msg++; - - rxpos = ntohs(*((unsigned short *)msg)); - msg++; - msg++; - - nchans = ntohs(*((unsigned short *)msg)); - if (nchans != span->channels) { - spin_unlock_irqrestore(&dlock, flags); - newerr = ERR_NCHAN | nchans; - if (newerr != ztd->err) { - printk("Span %s: Expected %d channels, but receiving %d\n", span->name, span->channels, nchans); - } - ztd->err = newerr; - return; - } - msg++; - msg++; - - /* Okay now we've accepted the header, lets check our message - length... */ - - /* Start with header */ - xlen = 6; - /* Add samples of audio */ - xlen += nchans * ZT_CHUNKSIZE; - /* If RBS info is there, add that */ - if (sflags & ZTD_FLAG_SIGBITS_PRESENT) { - /* Account for sigbits -- one short per 4 channels*/ - xlen += ((nchans + 3) / 4) * 2; - } - - if (xlen != msglen) { - spin_unlock_irqrestore(&dlock, flags); - newerr = ERR_LEN | xlen; - if (newerr != ztd->err) { - printk("Span %s: Expected message size %d, but was %d instead\n", span->name, xlen, msglen); - } - ztd->err = newerr; - return; - } - - bits = 0; - - /* Record sigbits if present */ - if (sflags & ZTD_FLAG_SIGBITS_PRESENT) { - for (x=0;x> ((x % 4) << 2)) & 0xff; - - /* Update signalling if appropriate */ - if (sig != span->chans[x].rxsig) - zt_rbsbits(&span->chans[x], sig); - - } - } - - /* Record data for channels */ - for (x=0;xchans[x].readchunk, msg, ZT_CHUNKSIZE); - msg += ZT_CHUNKSIZE; - } - - master = ztd->master; - - rxcnt = ztd->rxcnt; - ztd->rxcnt = rxpos+1; - - spin_unlock_irqrestore(&dlock, flags); - - /* Check for Yellow alarm */ - newalarm = span->alarms & ~(ZT_ALARM_YELLOW | ZT_ALARM_RED); - if (sflags & ZTD_FLAG_YELLOW_ALARM) - newalarm |= ZT_ALARM_YELLOW; - - if (newalarm != span->alarms) { - span->alarms = newalarm; - zt_alarm_notify(span); - checkmaster(); - } - - /* Keep track of last received packet */ - ztd->rxjif = jiffies; - - /* note if we had a missing packet */ - if (rxpos != rxcnt) - printk("Span %s: Expected seq no %d, but received %d instead\n", span->name, rxcnt, rxpos); - - /* If this is our master span, then run everything */ - if (master) - ztdynamic_run(); - -} - -static void dynamic_destroy(struct zt_dynamic *z) -{ - /* Unregister span if appropriate */ - if (z->span.flags & ZT_FLAG_REGISTERED) - zt_unregister(&z->span); - - /* Destroy the pvt stuff if there */ - if (z->pvt) - z->driver->destroy(z->pvt); - - /* Free message buffer if appropriate */ - if (z->msgbuf) - kfree(z->msgbuf); - - /* Free channels */ - if (z->chans) - vfree(z->chans); - /* Free z */ - kfree(z); - - checkmaster(); -} - -static struct zt_dynamic *find_dynamic(ZT_DYNAMIC_SPAN *zds) -{ - struct zt_dynamic *z; - z = dspans; - while(z) { - if (!strcmp(z->dname, zds->driver) && - !strcmp(z->addr, zds->addr)) - break; - z = z->next; - } - return z; -} - -static struct zt_dynamic_driver *find_driver(char *name) -{ - struct zt_dynamic_driver *ztd; - ztd = drivers; - while(ztd) { - /* here's our driver */ - if (!strcmp(name, ztd->name)) - break; - ztd = ztd->next; - } - return ztd; -} - -static int destroy_dynamic(ZT_DYNAMIC_SPAN *zds) -{ - unsigned long flags; - struct zt_dynamic *z, *cur, *prev=NULL; - spin_lock_irqsave(&dlock, flags); - z = find_dynamic(zds); - if (!z) { - spin_unlock_irqrestore(&dlock, flags); - return -EINVAL; - } - /* Don't destroy span until it is in use */ - if (z->usecount) { - spin_unlock_irqrestore(&dlock, flags); - printk("Attempt to destroy dynamic span while it is in use\n"); - return -EBUSY; - } - /* Unlink it */ - cur = dspans; - while(cur) { - if (cur == z) { - if (prev) - prev->next = z->next; - else - dspans = z->next; - break; - } - prev = cur; - cur = cur->next; - } - spin_unlock_irqrestore(&dlock, flags); - - /* Destroy it */ - dynamic_destroy(z); - - return 0; -} - -static int ztd_rbsbits(struct zt_chan *chan, int bits) -{ - /* Don't have to do anything */ - return 0; -} - -static int ztd_open(struct zt_chan *chan) -{ - struct zt_dynamic *z; - z = chan->span->pvt; - if (z) { - if (z->dead) - return -ENODEV; - z->usecount++; - } -#ifndef LINUX26 - MOD_INC_USE_COUNT; -#else - if(!try_module_get(THIS_MODULE)) - printk("TDMoX: Unable to increment module use count\n"); -#endif - return 0; -} - -static int ztd_chanconfig(struct zt_chan *chan, int sigtype) -{ - return 0; -} - -static int ztd_close(struct zt_chan *chan) -{ - struct zt_dynamic *z; - z = chan->span->pvt; - if (z) - z->usecount--; - if (z->dead && !z->usecount) - dynamic_destroy(z); -#ifndef LINUX26 - MOD_DEC_USE_COUNT; -#else - module_put(THIS_MODULE); -#endif - return 0; -} - -static int create_dynamic(ZT_DYNAMIC_SPAN *zds) -{ - struct zt_dynamic *z; - struct zt_dynamic_driver *ztd; - unsigned long flags; - int x; - int bufsize; - - if (zds->numchans < 1) { - printk("Can't be less than 1 channel (%d)!\n", zds->numchans); - return -EINVAL; - } - if (zds->numchans >= ZT_DYNAMIC_MAX_CHANS) { - printk("Can't create dynamic span with greater than %d channels. See ztdynamic.c and increase ZT_DYNAMIC_MAX_CHANS\n", zds->numchans); - return -EINVAL; - } - - spin_lock_irqsave(&dlock, flags); - z = find_dynamic(zds); - spin_unlock_irqrestore(&dlock, flags); - if (z) - return -EEXIST; - - /* XXX There is a silly race here. We check it doesn't exist, but - someone could create it between now and then and we'd end up - with two of them. We don't want to hold the spinlock - for *too* long though, especially not if there is a possibility - of kmalloc. XXX */ - - - /* Allocate memory */ - z = (struct zt_dynamic *)kmalloc(sizeof(struct zt_dynamic), GFP_KERNEL); - if (!z) - return -ENOMEM; - - /* Zero it out */ - memset(z, 0, sizeof(struct zt_dynamic)); - - /* Allocate other memories */ - z->chans = vmalloc(sizeof(struct zt_chan) * zds->numchans); - if (!z->chans) { - dynamic_destroy(z); - return -ENOMEM; - } - - /* Zero out channel stuff */ - memset(z->chans, 0, sizeof(struct zt_chan) * zds->numchans); - - /* Allocate message buffer with sample space and header space */ - bufsize = zds->numchans * ZT_CHUNKSIZE + zds->numchans / 4 + 48; - - z->msgbuf = kmalloc(bufsize, GFP_KERNEL); - - if (!z->msgbuf) { - dynamic_destroy(z); - return -ENOMEM; - } - - /* Zero out -- probably not needed but why not */ - memset(z->msgbuf, 0, bufsize); - - /* Setup parameters properly assuming we're going to be okay. */ - zap_copy_string(z->dname, zds->driver, sizeof(z->dname)); - zap_copy_string(z->addr, zds->addr, sizeof(z->addr)); - z->timing = zds->timing; - sprintf(z->span.name, "ZTD/%s/%s", zds->driver, zds->addr); - sprintf(z->span.desc, "Dynamic '%s' span at '%s'", zds->driver, zds->addr); - z->span.channels = zds->numchans; - z->span.pvt = z; - z->span.deflaw = ZT_LAW_MULAW; - z->span.flags |= ZT_FLAG_RBS; - z->span.chans = z->chans; - z->span.rbsbits = ztd_rbsbits; - z->span.open = ztd_open; - z->span.close = ztd_close; - z->span.chanconfig = ztd_chanconfig; - for (x=0;xnumchans;x++) { - sprintf(z->chans[x].name, "ZTD/%s/%s/%d", zds->driver, zds->addr, x+1); - z->chans[x].sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_FXSLS | - ZT_SIG_FXSKS | ZT_SIG_FXSGS | ZT_SIG_FXOLS | - ZT_SIG_FXOKS | ZT_SIG_FXOGS | ZT_SIG_SF | - ZT_SIG_DACS_RBS | ZT_SIG_CAS; - z->chans[x].chanpos = x + 1; - z->chans[x].pvt = z; - } - - spin_lock_irqsave(&dlock, flags); - ztd = find_driver(zds->driver); - if (!ztd) { - /* Try loading the right module */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,70) - char fn[80]; -#endif - spin_unlock_irqrestore(&dlock, flags); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,70) - request_module("ztd-%s", zds->driver); -#else - sprintf(fn, "ztd-%s", zds->driver); - request_module(fn); -#endif - spin_lock_irqsave(&dlock, flags); - ztd = find_driver(zds->driver); - } - spin_unlock_irqrestore(&dlock, flags); - - - /* Another race -- should let the module get unloaded while we - have it here */ - if (!ztd) { - printk("No such driver '%s' for dynamic span\n", zds->driver); - dynamic_destroy(z); - return -EINVAL; - } - - /* Create the stuff */ - z->pvt = ztd->create(&z->span, z->addr); - if (!z->pvt) { - printk("Driver '%s' (%s) rejected address '%s'\n", ztd->name, ztd->desc, z->addr); - /* Creation failed */ - return -EINVAL; - } - - /* Remember the driver */ - z->driver = ztd; - - /* Whee! We're created. Now register the span */ - if (zt_register(&z->span, 0)) { - printk("Unable to register span '%s'\n", z->span.name); - dynamic_destroy(z); - return -EINVAL; - } - - /* Okay, created and registered. add it to the list */ - spin_lock_irqsave(&dlock, flags); - z->next = dspans; - dspans = z; - spin_unlock_irqrestore(&dlock, flags); - - checkmaster(); - - /* All done */ - return z->span.spanno; - -} - -#ifdef ENABLE_TASKLETS -static void ztd_tasklet(unsigned long data) -{ - taskletrun++; - if (taskletpending) { - taskletexec++; - __ztdynamic_run(); - } - taskletpending = 0; -} -#endif - -static int ztdynamic_ioctl(unsigned int cmd, unsigned long data) -{ - ZT_DYNAMIC_SPAN zds; - int res; - switch(cmd) { - case 0: - /* This is called just before rotation. If none of our - spans are pulling timing, then now is the time to process - them */ - if (!hasmaster) - ztdynamic_run(); - return 0; - case ZT_DYNAMIC_CREATE: - if (copy_from_user(&zds, (ZT_DYNAMIC_SPAN *)data, sizeof(zds))) - return -EFAULT; - if (debug) - printk("Dynamic Create\n"); - res = create_dynamic(&zds); - if (res < 0) - return res; - zds.spanno = res; - /* Let them know the new span number */ - if (copy_to_user((ZT_DYNAMIC_SPAN *)data, &zds, sizeof(zds))) - return -EFAULT; - return 0; - case ZT_DYNAMIC_DESTROY: - if (copy_from_user(&zds, (ZT_DYNAMIC_SPAN *)data, sizeof(zds))) - return -EFAULT; - if (debug) - printk("Dynamic Destroy\n"); - return destroy_dynamic(&zds); - } - - return -ENOTTY; -} - -int zt_dynamic_register(struct zt_dynamic_driver *dri) -{ - unsigned long flags; - int res = 0; - write_lock_irqsave(&drvlock, flags); - if (find_driver(dri->name)) - res = -1; - else { - dri->next = drivers; - drivers = dri; - } - write_unlock_irqrestore(&drvlock, flags); - return res; -} - -void zt_dynamic_unregister(struct zt_dynamic_driver *dri) -{ - struct zt_dynamic_driver *cur, *prev=NULL; - struct zt_dynamic *z, *zp, *zn; - unsigned long flags; - write_lock_irqsave(&drvlock, flags); - cur = drivers; - while(cur) { - if (cur == dri) { - if (prev) - prev->next = cur->next; - else - drivers = cur->next; - break; - } - prev = cur; - cur = cur->next; - } - write_unlock_irqrestore(&drvlock, flags); - spin_lock_irqsave(&dlock, flags); - z = dspans; - zp = NULL; - while(z) { - zn = z->next; - if (z->driver == dri) { - /* Unlink */ - if (zp) - zp->next = z->next; - else - dspans = z->next; - if (!z->usecount) - dynamic_destroy(z); - else - z->dead = 1; - } else { - zp = z; - } - z = zn; - } - spin_unlock_irqrestore(&dlock, flags); -} - -struct timer_list alarmcheck; - -static void check_for_red_alarm(unsigned long ignored) -{ - unsigned long flags; - int newalarm; - int alarmchanged = 0; - struct zt_dynamic *z; - spin_lock_irqsave(&dlock, flags); - z = dspans; - while(z) { - newalarm = z->span.alarms & ~ZT_ALARM_RED; - /* If nothing received for a second, consider that RED ALARM */ - if ((jiffies - z->rxjif) > 1 * HZ) { - newalarm |= ZT_ALARM_RED; - if (z->span.alarms != newalarm) { - z->span.alarms = newalarm; - zt_alarm_notify(&z->span); - alarmchanged++; - } - } - z = z->next; - } - spin_unlock_irqrestore(&dlock, flags); - if (alarmchanged) - checkmaster(); - - /* Do the next one */ - mod_timer(&alarmcheck, jiffies + 1 * HZ); - -} - -int ztdynamic_init(void) -{ - zt_set_dynamic_ioctl(ztdynamic_ioctl); - /* Start process to check for RED ALARM */ - init_timer(&alarmcheck); - alarmcheck.expires = 0; - alarmcheck.data = 0; - alarmcheck.function = check_for_red_alarm; - /* Check once per second */ - mod_timer(&alarmcheck, jiffies + 1 * HZ); -#ifdef ENABLE_TASKLETS - tasklet_init(&ztd_tlet, ztd_tasklet, 0); -#endif - printk("Zaptel Dynamic Span support LOADED\n"); - return 0; -} - -void ztdynamic_cleanup(void) -{ -#ifdef ENABLE_TASKLETS - if (taskletpending) { - tasklet_disable(&ztd_tlet); - tasklet_kill(&ztd_tlet); - } -#endif - zt_set_dynamic_ioctl(NULL); - del_timer(&alarmcheck); - printk("Zaptel Dynamic Span support unloaded\n"); -} - -#ifdef LINUX26 -module_param(debug, int, 0600); -#else -MODULE_PARM(debug, "i"); -#endif -MODULE_DESCRIPTION("Zaptel Dynamic Span Support"); -MODULE_AUTHOR("Mark Spencer "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(ztdynamic_init); -module_exit(ztdynamic_cleanup); diff --git a/zaptel/kernel/zttranscode.c b/zaptel/kernel/zttranscode.c deleted file mode 100644 index cc26492a..00000000 --- a/zaptel/kernel/zttranscode.c +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Transcoder Interface for Zaptel - * - * Written by Mark Spencer - * - * Copyright (C) 2006-2008, Digium, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static int debug; -LIST_HEAD(trans); -static spinlock_t translock = SPIN_LOCK_UNLOCKED; - -EXPORT_SYMBOL(zt_transcoder_register); -EXPORT_SYMBOL(zt_transcoder_unregister); -EXPORT_SYMBOL(zt_transcoder_alert); -EXPORT_SYMBOL(zt_transcoder_alloc); -EXPORT_SYMBOL(zt_transcoder_free); - -struct zt_transcoder *zt_transcoder_alloc(int numchans) -{ - struct zt_transcoder *tc; - unsigned int x; - size_t size = sizeof(*tc) + (sizeof(tc->channels[0]) * numchans); - - if (!(tc = kmalloc(size, GFP_KERNEL))) - return NULL; - - memset(tc, 0, size); - strcpy(tc->name, ""); - tc->numchannels = numchans; - INIT_LIST_HEAD(&tc->node); - for (x=0;xnumchannels;x++) { - init_waitqueue_head(&tc->channels[x].ready); - tc->channels[x].parent = tc; - } - - WARN_ON(!zt_transcode_fops); - /* Individual transcoders should supply their own file_operations for - * write and read. But they will by default use the file_operations - * provided by the zt_transcode layer. */ - memcpy(&tc->fops, zt_transcode_fops, sizeof(*zt_transcode_fops)); - return tc; -} - -void zt_transcoder_free(struct zt_transcoder *tc) -{ - kfree(tc); -} - -/* Returns 1 if the item is on the list pointed to by head, otherwise, returns - * 0 */ -static int is_on_list(struct list_head *entry, struct list_head *head) -{ - struct list_head *cur; - list_for_each(cur, head) { - if (cur == entry) return 1; - } - return 0; -} - -/* Register a transcoder */ -int zt_transcoder_register(struct zt_transcoder *tc) -{ - static int count = 0; - tc->pos = count++; - spin_lock(&translock); - BUG_ON(is_on_list(&tc->node, &trans)); - list_add_tail(&tc->node, &trans); - spin_unlock(&translock); - - printk(KERN_INFO "%s: Registered codec translator '%s' " \ - "with %d transcoders (srcs=%08x, dsts=%08x)\n", - THIS_MODULE->name, tc->name, tc->numchannels, - tc->srcfmts, tc->dstfmts); - - return 0; -} - -/* Unregister a transcoder */ -int zt_transcoder_unregister(struct zt_transcoder *tc) -{ - int res = -EINVAL; - - /* \todo Perhaps we should check to make sure there isn't a channel - * that is still in use? */ - - spin_lock(&translock); - if (!is_on_list(&tc->node, &trans)) { - spin_unlock(&translock); - printk(KERN_WARNING "%s: Failed to unregister %s, which is " \ - "not currently registerd.\n", THIS_MODULE->name, tc->name); - return -EINVAL; - } - list_del_init(&tc->node); - spin_unlock(&translock); - - printk(KERN_INFO "Unregistered codec translator '%s' with %d " \ - "transcoders (srcs=%08x, dsts=%08x)\n", - tc->name, tc->numchannels, tc->srcfmts, tc->dstfmts); - res = 0; - - return res; -} - -/* Alert a transcoder */ -int zt_transcoder_alert(struct zt_transcoder_channel *chan) -{ - wake_up_interruptible(&chan->ready); - return 0; -} - -static int zt_tc_open(struct inode *inode, struct file *file) -{ - const struct file_operations *original_fops; - BUG_ON(!zt_transcode_fops); - original_fops = file->f_op; - file->f_op = zt_transcode_fops; - file->private_data = NULL; - /* Under normal operation, this releases the reference on the Zaptel - * module that was created when the file was opened. zt_open is - * responsible for taking a reference out on this module before - * calling this function. */ - module_put(original_fops->owner); - return 0; -} - -static void dtc_release(struct zt_transcoder_channel *chan) -{ - BUG_ON(!chan); - if (chan->parent && chan->parent->release) { - chan->parent->release(chan); - } - zt_tc_clear_busy(chan); -} - -static int zt_tc_release(struct inode *inode, struct file *file) -{ - struct zt_transcoder_channel *chan = file->private_data; - /* There will not be a transcoder channel associated with this file if - * the ALLOCATE ioctl never succeeded. - */ - if (chan) { - dtc_release(chan); - } - return 0; -} - -/* Find a free channel on the transcoder and mark it busy. */ -static inline struct zt_transcoder_channel * -get_free_channel(struct zt_transcoder *tc) - -{ - struct zt_transcoder_channel *chan; - int i; - /* Should be called with the translock held. */ - WARN_ON(!spin_is_locked(&translock)); - - for (i = 0; i < tc->numchannels; i++) { - chan = &tc->channels[i]; - if (!zt_tc_is_busy(chan)) { - zt_tc_set_busy(chan); - return chan; - } - } - return NULL; -} - -/* Search the list for a transcoder that supports the specified format, and - * allocate and return an available channel on it. - * - * Returns either a pointer to the allocated channel, -EBUSY if the format is - * supported but all the channels are busy, or -ENODEV if there are not any - * transcoders that support the formats. - */ -static struct zt_transcoder_channel * -__find_free_channel(struct list_head *list, const struct zt_transcoder_formats *fmts) -{ - struct zt_transcoder *tc; - struct zt_transcoder_channel *chan = NULL; - unsigned int match = 0; - - list_for_each_entry(tc, list, node) { - if ((tc->dstfmts & fmts->dstfmt)) { - /* We found a transcoder that can handle our formats. - * Now look for an available channel. */ - match = 1; - if ((chan = get_free_channel(tc))) { - /* transcoder tc has a free channel. In order - * to spread the load among available - * transcoders (when there are more than one - * transcoder in the system) we'll move tc - * to the end of the list. */ - list_move_tail(&tc->node, list); - return chan; - } - } - } - return (void*)((long)((match) ? -EBUSY : -ENODEV)); -} - -static long zt_tc_allocate(struct file *file, unsigned long data) -{ - struct zt_transcoder_channel *chan = NULL; - struct zt_transcoder_formats fmts; - - if (copy_from_user(&fmts, - (struct zt_transcoder_formats*) data, sizeof(fmts))) { - return -EFAULT; - } - - spin_lock(&translock); - chan = __find_free_channel(&trans, &fmts); - spin_unlock(&translock); - - if (IS_ERR(chan)) { - return PTR_ERR(chan); - } - - /* Every transcoder channel must be associated with a parent - * transcoder. */ - BUG_ON(!chan->parent); - - chan->srcfmt = fmts.srcfmt; - chan->dstfmt = fmts.dstfmt; - - if (file->private_data) { - /* This open file is moving to a new channel. Cleanup and - * close the old channel here. */ - dtc_release(file->private_data); - } - - file->private_data = chan; - if (chan->parent->fops.owner != file->f_op->owner) { - if (!try_module_get(chan->parent->fops.owner)) { - /* Failed to get a reference on the driver for the - * actual transcoding hardware. */ - return -EINVAL; - } - /* Release the reference on the existing driver. */ - module_put(file->f_op->owner); - file->f_op = &chan->parent->fops; - } - - if (file->f_flags & O_NONBLOCK) { - zt_tc_set_nonblock(chan); - } else { - zt_tc_clear_nonblock(chan); - } - - /* Actually reset the transcoder channel */ - if (chan->parent->allocate) - return chan->parent->allocate(chan); - - return -EINVAL; -} - -static long zt_tc_getinfo(unsigned long data) -{ - struct zt_transcoder_info info; - struct zt_transcoder *cur; - struct zt_transcoder *tc = NULL; - - if (copy_from_user(&info, (const void *) data, sizeof(info))) { - return -EFAULT; - } - - spin_lock(&translock); - list_for_each_entry(cur, &trans, node) { - if (cur->pos == info.tcnum) { - tc = cur; - break; - } - } - spin_unlock(&translock); - - if (!tc) { - return -ENOSYS; - } - - zap_copy_string(info.name, tc->name, sizeof(info.name)); - info.numchannels = tc->numchannels; - info.srcfmts = tc->srcfmts; - info.dstfmts = tc->dstfmts; - - return copy_to_user((void *) data, &info, sizeof(info)) ? -EFAULT : 0; -} - -static ssize_t zt_tc_write(struct file *file, __user const char *usrbuf, size_t count, loff_t *ppos) -{ - if (file->private_data) { - /* file->private_data will not be NULL if ZT_TC_ALLOCATE was - * called, and therefore indicates that the transcoder driver - * did not export a read function. */ - WARN_ON(1); - return -ENOSYS; - } else { - printk(KERN_INFO "%s: Attempt to write to unallocated " \ - "channel.\n", THIS_MODULE->name); - return -EINVAL; - } -} - -static ssize_t zt_tc_read(struct file *file, __user char *usrbuf, size_t count, loff_t *ppos) -{ - if (file->private_data) { - /* file->private_data will not be NULL if ZT_TC_ALLOCATE was - * called, and therefore indicates that the transcoder driver - * did not export a write function. */ - WARN_ON(1); - return -ENOSYS; - } else { - printk(KERN_INFO "%s: Attempt to read from unallocated " \ - "channel.\n", THIS_MODULE->name); - return -EINVAL; - } -} - -static long zt_tc_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long data) -{ - switch (cmd) { - case ZT_TC_ALLOCATE: - return zt_tc_allocate(file, data); - case ZT_TC_GETINFO: - return zt_tc_getinfo(data); - case ZT_TRANSCODE_OP: - /* This is a deprecated call from the previous transcoder - * interface, which was all routed through the zt_ioctl in - * zaptel-base.c, and this ioctl request was used to indicate - * that the call should be forwarded to this function. Now - * when the file is opened, the f_ops pointer is updated to - * point directly to this function, and we don't need a - * general indication that the ioctl is destined for the - * transcoder. - * - * I'm keeping this ioctl here in order to explain why there - * might be a hole in the ioctl numbering scheme in the header - * files. - */ - printk(KERN_WARNING "%s: ZT_TRANSCODE_OP is no longer " \ - "supported. Please call ZT_TC ioctls directly.\n", - THIS_MODULE->name); - return -EINVAL; - default: - return -EINVAL; - }; -} - -static int zt_tc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data) -{ - return (int)zt_tc_unlocked_ioctl(file, cmd, data); -} - -static int zt_tc_mmap(struct file *file, struct vm_area_struct *vma) -{ - printk(KERN_ERR "%s: mmap interface deprecated.\n", THIS_MODULE->name); - return -ENOSYS; -} - -static unsigned int zt_tc_poll(struct file *file, struct poll_table_struct *wait_table) -{ - int ret; - struct zt_transcoder_channel *chan = file->private_data; - - if (!chan) { - /* This is because the ZT_TC_ALLOCATE ioctl was not called - * before calling poll, which is invalid. */ - return -EINVAL; - } - - poll_wait(file, &chan->ready, wait_table); - - ret = zt_tc_is_busy(chan) ? 0 : POLLPRI; - ret |= zt_tc_is_built(chan) ? POLLOUT : 0; - ret |= zt_tc_is_data_waiting(chan) ? POLLIN : 0; - return ret; -} - -static struct file_operations __zt_transcode_fops = { - owner: THIS_MODULE, - open: zt_tc_open, - release: zt_tc_release, - ioctl: zt_tc_ioctl, - read: zt_tc_read, - write: zt_tc_write, - poll: zt_tc_poll, - mmap: zt_tc_mmap, -#if HAVE_UNLOCKED_IOCTL - unlocked_ioctl: zt_tc_unlocked_ioctl, -#endif -}; - -static struct zt_chardev transcode_chardev = { - .name = "transcode", - .minor = 250, -}; - -int zt_transcode_init(void) -{ - int res; - - if (zt_transcode_fops) { - printk(KERN_WARNING "zt_transcode_fops already set.\n"); - return -EBUSY; - } - - zt_transcode_fops = &__zt_transcode_fops; - - if ((res = zt_register_chardev(&transcode_chardev))) - return res; - - printk(KERN_INFO "%s: Loaded.\n", THIS_MODULE->name); - return 0; -} - -void zt_transcode_cleanup(void) -{ - zt_unregister_chardev(&transcode_chardev); - - zt_transcode_fops = NULL; - - printk(KERN_DEBUG "%s: Unloaded.\n", THIS_MODULE->name); -} - -module_param(debug, int, S_IRUGO | S_IWUSR); -MODULE_DESCRIPTION("Zaptel Transcoder Support"); -MODULE_AUTHOR("Mark Spencer "); -#ifdef MODULE_LICENSE -MODULE_LICENSE("GPL"); -#endif - -module_init(zt_transcode_init); -module_exit(zt_transcode_cleanup); diff --git a/zaptel/live_zap b/zaptel/live_zap deleted file mode 100755 index da98f0d1..00000000 --- a/zaptel/live_zap +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh - -set -e - -DESTDIR=$PWD/live -KVERS=${KVERS:-`uname -r`} -MODULES_DIR="$DESTDIR/lib/modules/$KVERS/misc" -XPP_SYNC=auto -AST_SCRIPT=/etc/init.d/asterisk -# Use this file to pass options to modules: -PERLLIBDIR=`perl -V:sitelib | cut -d "'" -f 2` - -# Manual list of modules. They will be loaded by insmod. -# If reside in a subdir, add it explicitly. - -MODULES_LOAD="zaptel" - -# this one *is* resolved recusively. -# the only reason to set a different value is if you use hpec / oslec, -# as Zaptel depends on them. -REMOVE_MODULES="zaptel" - -if [ -r $DESTDIR/live.conf ]; then . $DESTDIR/live.conf; fi - -# Give priority to our installed binaries: -PATH=$DESTDIR/sbin:$DESTDIR/usr/sbin:$PATH -export PATH - -# TODO: If you already use PERL5DIR, please fix this part: -PERL5LIB="$DESTDIR/$PERLLIBDIR" -export PERL5LIB - -# used in xpp_fxloader: -FIRMWARE_DIR="$DESTDIR/usr/share/zaptel" -export FIRMWARE_DIR - -# make sure Astribank initialization scripts are from our tree. -xpp_ARGS="$xpp_ARGS initdir=$FIRMWARE_DIR" - -# the same as xpp/utils/zaptel_drivers . -# With the remote mode, I can't rely on files in the source directory. -zaptel_drivers() { - perl -MZaptel::Hardware -e ' - my $hardware = Zaptel::Hardware->scan; - print join(" ", $hardware->drivers); - ' -} - -# Detect the modules used in the system: -for mod in `zaptel_drivers`; do - case "$mod" in - xpp_usb) - MODULES_LOAD="$MODULES_LOAD xpp/xpp xpp/xpd_fxs" - MODULES_LOAD="$MODULES_LOAD xpp/xpd_fxo xpp/xpd_pri" - if [ -r "$MODULES_DIR/xpp/xpd_bri.ko" ]; then - MODULES_LOAD="$MODULES_LOAD xpp/xpd_bri" - fi - MODULES_LOAD="$MODULES_LOAD xpp/xpp_usb" - ;; - wctdm24xxp | wct4xxp | wcte12xp | wctc4xp) - MODULES_LOAD="$MODULES_LOAD $mod/$mod" - ;; - wanpipe) - : # requires different handling - ;; - *) - MODULES_LOAD="$MODULES_LOAD $mod" - ;; - esac -done - -# Initialize the Xorcom Astribank (xpp/) using perl utiliites: -# intended to replace all the the three functions below if user has -# installed the zaptel-perl utilities. -xpp_startup() { - # do nothing if there are no astribank devices: - if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi - - echo "Waiting for Astribank devices to initialize:" - cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true - - # overriding locales for the above two, as perl can be noisy - # when locales are missing. - # No register all the devices if they didn't auto-register: - LC_ALL=C zt_registration on - - # this one could actually be run after ztcfg: - LC_ALL=C xpp_sync "$XPP_SYNC" -} - -# recursively unload a module and its dependencies, if possible. -# where's modprobe -r when you need it? -# inputs: module to unload. -# returns: the result from -unload_module() { - module="$1" - line=`lsmod 2>/dev/null | grep "^$1 "` - if [ "$line" = '' ]; then return; fi # module was not loaded - - set -- $line - # $1: the original module, $2: size, $3: refcount, $4: deps list - mods=`echo $4 | tr , ' '` - # xpp_usb keeps the xpds below busy if an xpp hardware is - # connected. Hence must be removed before them: - case "$module" in xpd_*) mods="xpp_usb $mods";; esac - for mod in $mods; do - # run in a subshell, so it won't step over our vars: - (unload_module $mod) - # TODO: the following is probably the error handling we want: - # if [ $? != 0 ]; then return 1; fi - done - rmmod $module -} - -usage() { - me=`basename $0` - echo "$me: Run Zaptel in a test environment" - echo 'Version: $Id: live_zap 4504 2008-08-22 13:48:43Z tzafrir $' - echo '' - echo "Usage: equivalent of:" - echo "$me install make install" - echo "$me config make config" - echo "$me unload /etc/init.d/zaptel stop" - echo "$me load /etc/init.d/zaptel start" - echo "$me reload /etc/init.d/zaptel restart" - echo "$me rsync TARGET (copies file to /tmp/live in TARGET)" - echo "$me exec COMMAND (Runs COMMAND in 'live' environment)" -} - -case "$1" in -install) - shift - make install DESTDIR=$DESTDIR DYNFS=yes "$@" - ;; -config) - shift - make config DESTDIR=$DESTDIR "$@" - mkdir -p $DESTDIR/etc/asterisk - ;; -rsync) - if [ $# -ne 2 ]; then - echo >&2 "$0: Error: rsync requires a target parameter". - exit 1 - fi - # copy the script itself and the installed directory to the - # target host: - rsync -ai "$0" $DESTDIR "$2:/tmp/" - ;; -unload) - $AST_SCRIPT stop - for mod in $REMOVE_MODULES; do - unload_module $mod - done - ;; -load) - # TODO: Find a way to use modprobe. - # Or implement a way to pass arguments to modules here (yuck) - for module in $MODULES_LOAD; do - eval module_args="\$`basename ${module}`_ARGS" - insmod $MODULES_DIR/$module.ko $module_args - done - xpp_startup - ZAPTEL_DEFAULTS=$DESTDIR/live.conf \ - ZAPTEL_BOOT_DEBIAN=$DESTDIR/live.conf \ - ZAPTEL_BOOT_FEDORA=$DESTDIR/live.conf \ - ZAPCONF_FILE=$DESTDIR/etc/zaptel.conf \ - ZAPATA_FILE=$DESTDIR/etc/asterisk/zapata-channels.conf \ - zapconf - ztcfg -c $DESTDIR/etc/zaptel.conf - # TODO: fxotune, hpec - # or find a way to reuse init.d start sequence. - - # TODO: A local copy of Asterisk, configured with zapconf. - # doable, but trickier. - $AST_SCRIPT start - ;; -reload) - $0 unload - $0 load - ;; -exec) - if [ $# -lt 2 ]; then - # No command given: start a subshell in the environemnt - # of the "live" system: - echo >&2 "$0: Error: exec requires a command to run" - exit 1 - fi - - # Command given: run it: - shift - "$@" - ;; -help) - usage - ;; -*) - echo >&2 "$0: Error: incorrect command \"$1\". Aborting" - usage - exit 1 -esac diff --git a/zaptel/makeopts.in b/zaptel/makeopts.in deleted file mode 100644 index c2bf075e..00000000 --- a/zaptel/makeopts.in +++ /dev/null @@ -1,47 +0,0 @@ -CC=@CC@ -HOSTCC=@HOSTCC@ -CFLAGS=@CFLAGS@ -LDFLAGS=@LDFLAGS@ - -INSTALL=@INSTALL@ -GREP=@GREP@ -SHELL=@SHELL@ -LN=@LN@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -datarootdir = @datarootdir@ -datadir = @datadir@ -includedir = @includedir@ -infodir = @infodir@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ - -DOWNLOAD=@DOWNLOAD@ - -PBX_LIBNEWT=@PBX_LIBNEWT@ -NEWT_LIB=@NEWT_LIB@ -NEWT_INCLUDE=@NEWT_INCLUDE@ - -CURSES_LIB=@CURSES_LIB@ -CURSES_INCLUDE=@CURSES_INCLUDE@ - -NCURSES_LIB=@NCURSES_LIB@ -NCURSES_INCLUDE=@NCURSES_INCLUDE@ - -PBX_LIBUSB=@PBX_LIBUSB@ -USB_LIB=@USB_LIB@ -USB_INCLUDE=@USB_INCLUDE@ - -USE_SELINUX=@USE_SELINUX@ - -PPPD_VERSION=@PPPD_VERSION@ - -ASCIIDOC=@ASCIIDOC@ diff --git a/zaptel/menuselect.makedeps b/zaptel/menuselect.makedeps deleted file mode 100644 index cc3af13d..00000000 --- a/zaptel/menuselect.makedeps +++ /dev/null @@ -1,8 +0,0 @@ -MENUSELECT_DEPENDS_wctc4xxp=ZTTRANSCODE -MENUSELECT_DEPENDS_ztd-eth=ZTDYNAMIC -MENUSELECT_DEPENDS_ztd-loc=ZTDYNAMIC -MENUSELECT_DEPENDS_zttool=LIBNEWT -MENUSELECT_DEPENDS_FIRMWARE-OCT6114-064=WCT4XXP -MENUSELECT_DEPENDS_FIRMWARE-OCT6114-128=WCT4XXP -MENUSELECT_DEPENDS_FIRMWARE-TC400M=WCTC4XXP -MENUSELECT_DEPENDS_FIRMWARE-VPMADT032=WCTDM24XXP diff --git a/zaptel/menuselect.makeopts b/zaptel/menuselect.makeopts deleted file mode 100644 index 06596956..00000000 --- a/zaptel/menuselect.makeopts +++ /dev/null @@ -1,4 +0,0 @@ -MENUSELECT_MODULES=tor2 torisa wct4xxp wctc4xxp wcte12xp wcusb xpp -MENUSELECT_UTILS=fxotune fxstest sethdlc-new ztdiag -MENUSELECT_FIRMWARE= -MENUSELECT_BUILD_DEPS=ztdynamic wct4xxp wctc4xxp wctdm24xxp diff --git a/zaptel/menuselect/Makefile b/zaptel/menuselect/Makefile deleted file mode 100644 index ba907807..00000000 --- a/zaptel/menuselect/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# -# Asterisk -- A telephony toolkit for Linux. -# -# Makefile for Menuselect -# -# Copyright (C) 2005-2006, Digium, Inc. -# -# Russell Bryant -# -# This program is free software, distributed under the terms of -# the GNU General Public License -# - -# read local makeopts settings --include makeopts - -.PHONY: clean dist-clean distclean - -# Basic set of sources and flags/libraries/includes -OBJS:=menuselect.o strcompat.o -CFLAGS:=-g -c -D_GNU_SOURCE -Wall -LIBS:= mxml/libmxml.a - -# pick gtk library if available -ifneq ($(GTK2_LIB),) - G_OBJS += menuselect_gtk.o - INCLUDE += $(GTK2_INCLUDE) - G_LIBS += $(GTK2_LIB) -else - G_OBJS += menuselect_stub.o -endif - -# pick a curses library if available -ifneq ($(NCURSES_LIB),) - M_OBJS += menuselect_curses.o - M_LIBS +=$(NCURSES_LIB) - INCLUDE += $(NCURSES_INCLUDE) -else - ifneq ($(CURSES_LIB),) - M_OBJS += menuselect_curses.o - M_LIBS +=$(CURSES_LIB) - INCLUDE += $(CURSES_INCLUDE) - else - M_OBJS += menuselect_stub.o - endif -endif - -CFLAGS+= $(INCLUDE) -all: - @$(MAKE) menuselect - -$(OBJS) menuselect_gtk.o menuselect_curses.o menuselect_stub.o: autoconfig.h menuselect.h - -makeopts autoconfig.h: autoconfig.h.in makeopts.in - @./configure $(CONFIGURE_SILENT) CC= LD= AR= CFLAGS= - -menuselect gmenuselect: mxml/libmxml.a - -gmenuselect: $(OBJS) $(G_OBJS) - $(CC) -o $@ $^ $(LIBS) $(G_LIBS) - -menuselect: $(OBJS) $(M_OBJS) - $(CC) -o $@ $^ $(LIBS) $(M_LIBS) - -mxml/libmxml.a: - @if test ! -f mxml/Makefile ; then cd mxml && ./configure ; fi - @$(MAKE) -C mxml libmxml.a - -clean: - rm -f menuselect gmenuselect $(OBJS) $(M_OBJS) $(G_OBJS) - @if test -f mxml/Makefile ; then $(MAKE) -C mxml clean ; fi - -dist-clean: distclean - -distclean: clean - @if test -f mxml/Makefile ; then $(MAKE) -C mxml distclean ; fi - rm -f autoconfig.h config.status config.log makeopts - rm -rf autom4te.cache diff --git a/zaptel/menuselect/README b/zaptel/menuselect/README deleted file mode 100644 index 95d054c2..00000000 --- a/zaptel/menuselect/README +++ /dev/null @@ -1,159 +0,0 @@ -MENUSELECT -Copyright (C) 2005-2006, Digium, Inc. -Russell Bryant -------------------------------------------------------------------------------- - - -ABOUT - -Menuselect is a tool designed to be used in conjunction with GNU make. It -allows for an XML specification of Makefile variables and optional space -delimeted values of these variables. These values can then be used in the -Makefile to make various decisions during the build process. - -Menuselect also provides a mechanism for dependency checking for each possible -member (value) of each category (Makefile variable). These dependencies are -generally checked by using autoconf and the results provided to menuselect. If -dependencies for a member are not met, the user will not be allowed to make -that selection. In the same way the menuselect does dependency checking, it -also does conflict checking. If a listed conflict for a member is met, then -the user will not be allowed to select it. - -For use with automated builds or when the user has no desire to make selections -different than the defined defaults, menuselect can generate a default output -file for use in the build. - -Menuselect can also do a sanity check on existing input files. If any member -has been selected that has conflicts or unmet dependencies, then menuselect -will exit with an error and output to notify the user of the situation. This is -typically done at the beginning of the build process to ensure that given all -of the known information, the build is going to be successful. - - -MENUSELECT DEPENDENCIES - -libncurses -- This is needed for the curses frontend. -libmxml -- This library, Mini-XML, is used for XML parsing. - (http://www.easysw.com/~mike/mxml/) - - -ENVIRONMENT SETUP - -The file menuselect.h contains a couple of defines which specify locations for -various files. These locations are relative to the directory from which -menuselect will be executed. - -#define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts" -This is the location where the menuselect output will be saved. - -#define MENUSELECT_DEPS "build_tools/menuselect-deps" -This is the location where menuselect will expect to find the input file that -provides dependency and conflict information. More information on the format of -this file can be found in the section about dependency and conflict checking. - - -DEPENDENCY AND CONFLICT CHECKING - -Members may have as many conflicts and dependencies specified as needed. An -example of the MENUSELECT_DEPS file would look like this: - -DEPENDENCY1=1 -DEPENDENCY2=0 -CONFLICT1=0 - -In this case, "DEPENDENCY1" has been met, "DEPENDENCY2" has not been met, and -"CONFLICT1" is not present. - -To ask menuselect to do a background sanity check on dependencies and -conflicts, it can be called like this: - -./menuselect --check-deps [input_file2] [...] - -The format of the input files must be of the same format menuselect uses to -create the OUPUT_MAKEOPTS_DEFAULT. - - -SETTING UP AVAILABLE OPTIONS - -The XML specification for the menu lives in the file "menuselect-tree" and should -be in the same directory that menuselect will be executed from. An example -menuselect-tree file as used in the Asterisk project (http://www.asterisk.org) is -provided in example_menuselect-tree - -Menu: - The top level tag in menuselect-tree is the tag. All of the categories - reside inside of the ... block. - -Menu Attributes: - name="Asterisk Module Selection" - This specifies the title of the menu. It is displayed at the top of the - screen when using the curses frontend - -Categories: - A contains members. The category tag can contain a number of - different attributes to specify different behavior. - -Category Attributes: - name="MENUSELECT_APPS" - The name attribute is required. This is the name of the variable that will - be in the output from menuselect. - - displayname="Applications" - If this is specfied, this is what will be shown in the menu to the user. - - positive_output="yes" - The default for menuselect is to output all of the members of a category - that are *not* selected. This is because it is often convenient to be able - to define a full list in the Makefile and then filter out the results from - menuselect. Using GNU make, an example of this would be: - APPS:=$(filter-out $(MENUSELECT_APPS),$(APPS)) - - remove_on_change=".lastclean" - This attribute can contain a space delimited list of files to be deleted - when it is time to build an output file if any of the members of this - category have changed values from their values for existing input when the - application was started. - -Members: - A contains conflicts and dependencies. The member tag can contain a - number of different attributes to specify different behavior. - -Member Attributes: - name="app_meetme" - The name attribute is required. This is the value that will be added to the - variable specified by the category when selected (or not selected) depending - on the setting of the positive_output attribute of the category. - - displayname="Call Conferencing Application" - If this is specified, this will be provided as a description of this member - when the cursor is on it in the menu. - - remove_on_change="apps/app_meetme.o apps/app_meetme.so" - This attribute can contain a space delimeted list of files to be deleted - when it is time to build an output file if the value of this member has - changed from its value in any existing input when the application was - started. - -Dependencies: - A dependency for a is specified using a tag. The name of - the dependency corresponds to names in the MENUSELECT_DEPS file. This is an - example of specifying a dependency for a member: - - zaptel - - -Conflicts: - A conflict for a is specified using a tag. The name of - the conflict corresponds to names in the MENUSELECT_DEPS file. This is an - example of specifying a dependency for a member: - - win32 - - - -REPORTING BUGS - -Any bug reports or feature enhancement submissions to menuselect should be -submitted at http://bugs.digium.com/ - -Thank you! diff --git a/zaptel/menuselect/acinclude.m4 b/zaptel/menuselect/acinclude.m4 deleted file mode 100644 index 19c5300a..00000000 --- a/zaptel/menuselect/acinclude.m4 +++ /dev/null @@ -1,177 +0,0 @@ -# AST_GCC_ATTRIBUTE([attribute name]) - -AC_DEFUN([AST_GCC_ATTRIBUTE], -[ -AC_MSG_CHECKING(checking for compiler 'attribute $1' support) -AC_COMPILE_IFELSE( - AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}], - []), - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), - AC_MSG_RESULT(no)) -]) - -# AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text]) - -AC_DEFUN([AST_EXT_LIB_SETUP], -[ -$1_DESCRIP="$2" -$1_OPTION="$3" -AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[ -case ${withval} in - n|no) - USE_$1=no - ;; - y|ye|yes) - $1_MANDATORY="yes" - ;; - *) - $1_DIR="${withval}" - $1_MANDATORY="yes" - ;; -esac -]) -PBX_$1=0 -AC_SUBST([$1_LIB]) -AC_SUBST([$1_INCLUDE]) -AC_SUBST([PBX_$1]) -]) - -# AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data]) - -AC_DEFUN([AST_EXT_LIB_CHECK], -[ -if test "${USE_$1}" != "no"; then - pbxlibdir="" - if test "x${$1_DIR}" != "x"; then - if test -d ${$1_DIR}/lib; then - pbxlibdir="-L${$1_DIR}/lib" - else - pbxlibdir="-L${$1_DIR}" - fi - fi - AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5) - - if test "${AST_$1_FOUND}" = "yes"; then - $1_LIB="-l$2 $5" - $1_HEADER_FOUND="1" - if test "x${$1_DIR}" != "x"; then - $1_LIB="${pbxlibdir} ${$1_LIB}" - $1_INCLUDE="-I${$1_DIR}/include" - if test "x$4" != "x" ; then - AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] ) - fi - else - if test "x$4" != "x" ; then - AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] ) - fi - fi - if test "x${$1_HEADER_FOUND}" = "x0" ; then - if test ! -z "${$1_MANDATORY}" ; - then - AC_MSG_NOTICE( ***) - AC_MSG_NOTICE( *** It appears that you do not have the $2 development package installed.) - AC_MSG_NOTICE( *** Please install it to include ${$1_DESCRIP} support, or re-run configure) - AC_MSG_NOTICE( *** without explicitly specifying --with-${$1_OPTION}) - exit 1 - fi - $1_LIB="" - $1_INCLUDE="" - PBX_$1=0 - else - PBX_$1=1 - AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library]) - fi - elif test ! -z "${$1_MANDATORY}"; - then - AC_MSG_NOTICE(***) - AC_MSG_NOTICE(*** The ${$1_DESCRIP} installation on this system appears to be broken.) - AC_MSG_NOTICE(*** Either correct the installation, or run configure) - AC_MSG_NOTICE(*** without explicitly specifying --with-${$1_OPTION}) - exit 1 - fi -fi -]) - - -AC_DEFUN( -[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE, - GNU_MAKE='Not Found' ; - GNU_MAKE_VERSION_MAJOR=0 ; - GNU_MAKE_VERSION_MINOR=0 ; - for a in make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - GNU_MAKE=$a ; - GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` - GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` - break; - fi - done ; -) ; -if test "x$GNU_MAKE" = "xNot Found" ; then - AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!) - exit 1 -fi -AC_SUBST([GNU_MAKE]) -]) - -# AST_FUNC_FORK -# ------------- -AN_FUNCTION([fork], [AST_FUNC_FORK]) -AN_FUNCTION([vfork], [AST_FUNC_FORK]) -AC_DEFUN([AST_FUNC_FORK], -[AC_REQUIRE([AC_TYPE_PID_T])dnl -AC_CHECK_HEADERS(vfork.h) -AC_CHECK_FUNCS(fork vfork) -if test "x$ac_cv_func_fork" = xyes; then - _AST_FUNC_FORK -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* | *-*-linux-uclibc* ) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation]) -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - _AC_FUNC_VFORK -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation]) -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.]) -else - AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.]) -fi -if test "x$ac_cv_func_fork_works" = xyes; then - AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.]) -fi -])# AST_FUNC_FORK - - -# _AST_FUNC_FORK -# ------------- -AC_DEFUN([_AST_FUNC_FORK], - [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works, - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], - [ - /* By Ruediger Kuhlmann. */ - return fork () < 0; - ])], - [ac_cv_func_fork_works=yes], - [ac_cv_func_fork_works=no], - [ac_cv_func_fork_works=cross])])] -)# _AST_FUNC_FORK diff --git a/zaptel/menuselect/aclocal.m4 b/zaptel/menuselect/aclocal.m4 deleted file mode 100644 index 1e4ae301..00000000 --- a/zaptel/menuselect/aclocal.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_include([acinclude.m4]) diff --git a/zaptel/menuselect/autoconfig.h.in b/zaptel/menuselect/autoconfig.h.in deleted file mode 100644 index d9f0576c..00000000 --- a/zaptel/menuselect/autoconfig.h.in +++ /dev/null @@ -1,96 +0,0 @@ -/* autoconfig.h.in. Generated from configure.ac by autoheader. */ - -#ifndef MENUSELECT_AUTOCONFIG_H -#define MENUSELECT_AUTOCONFIG_H - -#ifndef _REENTRANT -#define _REENTRANT -#endif - - -/* Define to 1 if you have the `asprintf' function. */ -#undef HAVE_ASPRINTF - -/* Define to indicate the ${CURSES_DESCRIP} library */ -#undef HAVE_CURSES - -/* Define to 1 if you have the `getloadavg' function. */ -#undef HAVE_GETLOADAVG - -/* Define if your system has the GTK2 libraries. */ -#undef HAVE_GTK2 - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to indicate the ${NCURSES_DESCRIP} library */ -#undef HAVE_NCURSES - -/* Define to 1 if you have the `setenv' function. */ -#undef HAVE_SETENV - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strcasestr' function. */ -#undef HAVE_STRCASESTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strndup' function. */ -#undef HAVE_STRNDUP - -/* Define to 1 if you have the `strnlen' function. */ -#undef HAVE_STRNLEN - -/* Define to 1 if you have the `strsep' function. */ -#undef HAVE_STRSEP - -/* Define to 1 if you have the `strtoq' function. */ -#undef HAVE_STRTOQ - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `unsetenv' function. */ -#undef HAVE_UNSETENV - -/* Define to 1 if you have the `vasprintf' function. */ -#undef HAVE_VASPRINTF - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -#endif - diff --git a/zaptel/menuselect/bootstrap.sh b/zaptel/menuselect/bootstrap.sh deleted file mode 100755 index cbc26aa2..00000000 --- a/zaptel/menuselect/bootstrap.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -check_for_app() { - $1 --version 2>&1 >/dev/null - if [ $? != 0 ] - then - echo "Please install $1 and run bootstrap.sh again!" - exit 1 - fi -} - -uname -s | grep -q FreeBSD -if [ $? = 0 ] -then - check_for_app autoconf259 - check_for_app autoheader259 - check_for_app automake19 - check_for_app aclocal19 - echo "Generating the configure script ..." - aclocal19 2>/dev/null - autoconf259 - autoheader259 - automake19 --add-missing --copy 2>/dev/null -else - AUTOCONF_VERSION=2.59 - AUTOMAKE_VERSION=1.9 - export AUTOCONF_VERSION - export AUTOMAKE_VERSION - - check_for_app autoconf - check_for_app autoheader - check_for_app automake - check_for_app aclocal - echo "Generating the configure script ..." - aclocal 2>/dev/null - autoconf - autoheader - automake --add-missing --copy 2>/dev/null -fi - -exit 0 diff --git a/zaptel/menuselect/config.guess b/zaptel/menuselect/config.guess deleted file mode 100755 index 22906b33..00000000 --- a/zaptel/menuselect/config.guess +++ /dev/null @@ -1,1495 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-03-13' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - x86:Interix*:[345]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[345]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/zaptel/menuselect/config.sub b/zaptel/menuselect/config.sub deleted file mode 100755 index 5705e543..00000000 --- a/zaptel/menuselect/config.sub +++ /dev/null @@ -1,1609 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-03-07' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m32c) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - m32c-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/zaptel/menuselect/configure b/zaptel/menuselect/configure deleted file mode 100755 index 7c4149b8..00000000 --- a/zaptel/menuselect/configure +++ /dev/null @@ -1,5283 +0,0 @@ -#! /bin/sh -# From configure.ac Revision: 40837 . -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -# -# "Menuselect" -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="menuselect" -ac_unique_file="menuselect.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -ac_subdirs_all="$ac_subdirs_all mxml" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HOST_OS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNU_MAKE CURSES_LIB CURSES_INCLUDE PBX_CURSES NCURSES_LIB NCURSES_INCLUDE PBX_NCURSES CPP EGREP PKGCONFIG ac_ct_PKGCONFIG PBX_GTK2 GTK2_INCLUDE GTK2_LIB subdirs LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-curses=PATH use curses files in PATH - --with-ncurses=PATH use ncurses files in PATH - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. - -"Menuselect" -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - -# check existence of the package - - -# specify output header file - ac_config_headers="$ac_config_headers autoconfig.h" - - - - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - - -HOST_OS=${host_os} - - - - - - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -echo "$as_me:$LINENO: checking for GNU make" >&5 -echo $ECHO_N "checking for GNU make... $ECHO_C" >&6 -if test "${GNU_MAKE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - GNU_MAKE='Not Found' ; - GNU_MAKE_VERSION_MAJOR=0 ; - GNU_MAKE_VERSION_MINOR=0 ; - for a in make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - GNU_MAKE=$a ; - GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` - GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` - break; - fi - done ; - -fi -echo "$as_me:$LINENO: result: $GNU_MAKE" >&5 -echo "${ECHO_T}$GNU_MAKE" >&6 ; -if test "x$GNU_MAKE" = "xNot Found" ; then - { { echo "$as_me:$LINENO: error: *** Please install GNU make. It is required to build Asterisk!" >&5 -echo "$as_me: error: *** Please install GNU make. It is required to build Asterisk!" >&2;} - { (exit 1); exit 1; }; } - exit 1 -fi - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - -for ac_func in asprintf getloadavg setenv strcasestr strndup strnlen strsep strtoq unsetenv vasprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -# The frontend can use curses, ncurses or GTK2 so check for all of them - - -CURSES_DESCRIP="curses" -CURSES_OPTION="curses" - -# Check whether --with-curses or --without-curses was given. -if test "${with_curses+set}" = set; then - withval="$with_curses" - -case ${withval} in - n|no) - USE_CURSES=no - ;; - y|ye|yes) - CURSES_MANDATORY="yes" - ;; - *) - CURSES_DIR="${withval}" - CURSES_MANDATORY="yes" - ;; -esac - -fi; -PBX_CURSES=0 - - - - - -NCURSES_DESCRIP="ncurses" -NCURSES_OPTION="ncurses" - -# Check whether --with-ncurses or --without-ncurses was given. -if test "${with_ncurses+set}" = set; then - withval="$with_ncurses" - -case ${withval} in - n|no) - USE_NCURSES=no - ;; - y|ye|yes) - NCURSES_MANDATORY="yes" - ;; - *) - NCURSES_DIR="${withval}" - NCURSES_MANDATORY="yes" - ;; -esac - -fi; -PBX_NCURSES=0 - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -if test "${USE_CURSES}" != "no"; then - pbxlibdir="" - if test "x${CURSES_DIR}" != "x"; then - if test -d ${CURSES_DIR}/lib; then - pbxlibdir="-L${CURSES_DIR}/lib" - else - pbxlibdir="-L${CURSES_DIR}" - fi - fi - echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 -echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6 -if test "${ac_cv_lib_curses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcurses ${pbxlibdir} $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main () -{ -initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_curses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_curses_initscr=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6 -if test $ac_cv_lib_curses_initscr = yes; then - AST_CURSES_FOUND=yes -else - AST_CURSES_FOUND=no -fi - - - if test "${AST_CURSES_FOUND}" = "yes"; then - CURSES_LIB="-lcurses " - CURSES_HEADER_FOUND="1" - if test "x${CURSES_DIR}" != "x"; then - CURSES_LIB="${pbxlibdir} ${CURSES_LIB}" - CURSES_INCLUDE="-I${CURSES_DIR}/include" - if test "xcurses.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${CURSES_DIR}/include/curses.h" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h usability" >&5 -echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${CURSES_DIR}/include/curses.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h presence" >&5 -echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${CURSES_DIR}/include/curses.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - CURSES_HEADER_FOUND=1 -else - CURSES_HEADER_FOUND=0 -fi - - - fi - else - if test "xcurses.h" != "x" ; then - if test "${ac_cv_header_curses_h+set}" = set; then - echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6 -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking curses.h usability" >&5 -echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking curses.h presence" >&5 -echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6 -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_curses_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6 - -fi -if test $ac_cv_header_curses_h = yes; then - CURSES_HEADER_FOUND=1 -else - CURSES_HEADER_FOUND=0 -fi - - - fi - fi - if test "x${CURSES_HEADER_FOUND}" = "x0" ; then - if test ! -z "${CURSES_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the curses development package installed." >&5 -echo "$as_me: *** It appears that you do not have the curses development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include ${CURSES_DESCRIP} support" >&5 -echo "$as_me: *** Please install it to include ${CURSES_DESCRIP} support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-${CURSES_OPTION}" >&5 -echo "$as_me: *** without explicitly specifying --with-${CURSES_OPTION}" >&6;} - exit 1 - fi - CURSES_LIB="" - CURSES_INCLUDE="" - PBX_CURSES=0 - else - PBX_CURSES=1 - -cat >>confdefs.h <<_ACEOF -#define HAVE_CURSES 1 -_ACEOF - - fi - elif test ! -z "${CURSES_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The ${CURSES_DESCRIP} installation on this system appears to be broken." >&5 -echo "$as_me: *** The ${CURSES_DESCRIP} installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-${CURSES_OPTION}" >&5 -echo "$as_me: *** without explicitly specifying --with-${CURSES_OPTION}" >&6;} - exit 1 - fi -fi - - -if test "${USE_NCURSES}" != "no"; then - pbxlibdir="" - if test "x${NCURSES_DIR}" != "x"; then - if test -d ${NCURSES_DIR}/lib; then - pbxlibdir="-L${NCURSES_DIR}/lib" - else - pbxlibdir="-L${NCURSES_DIR}" - fi - fi - echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 -echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6 -if test "${ac_cv_lib_ncurses_initscr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses ${pbxlibdir} $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char initscr (); -int -main () -{ -initscr (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_ncurses_initscr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_ncurses_initscr=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6 -if test $ac_cv_lib_ncurses_initscr = yes; then - AST_NCURSES_FOUND=yes -else - AST_NCURSES_FOUND=no -fi - - - if test "${AST_NCURSES_FOUND}" = "yes"; then - NCURSES_LIB="-lncurses " - NCURSES_HEADER_FOUND="1" - if test "x${NCURSES_DIR}" != "x"; then - NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}" - NCURSES_INCLUDE="-I${NCURSES_DIR}/include" - if test "xcurses.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5 -echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${NCURSES_DIR}/include/curses.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5 -echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${NCURSES_DIR}/include/curses.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - NCURSES_HEADER_FOUND=1 -else - NCURSES_HEADER_FOUND=0 -fi - - - fi - else - if test "xcurses.h" != "x" ; then - if test "${ac_cv_header_curses_h+set}" = set; then - echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6 -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking curses.h usability" >&5 -echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking curses.h presence" >&5 -echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for curses.h" >&5 -echo $ECHO_N "checking for curses.h... $ECHO_C" >&6 -if test "${ac_cv_header_curses_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_curses_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 -echo "${ECHO_T}$ac_cv_header_curses_h" >&6 - -fi -if test $ac_cv_header_curses_h = yes; then - NCURSES_HEADER_FOUND=1 -else - NCURSES_HEADER_FOUND=0 -fi - - - fi - fi - if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then - if test ! -z "${NCURSES_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the ncurses development package installed." >&5 -echo "$as_me: *** It appears that you do not have the ncurses development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include ${NCURSES_DESCRIP} support" >&5 -echo "$as_me: *** Please install it to include ${NCURSES_DESCRIP} support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-${NCURSES_OPTION}" >&5 -echo "$as_me: *** without explicitly specifying --with-${NCURSES_OPTION}" >&6;} - exit 1 - fi - NCURSES_LIB="" - NCURSES_INCLUDE="" - PBX_NCURSES=0 - else - PBX_NCURSES=1 - -cat >>confdefs.h <<_ACEOF -#define HAVE_NCURSES 1 -_ACEOF - - fi - elif test ! -z "${NCURSES_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The ${NCURSES_DESCRIP} installation on this system appears to be broken." >&5 -echo "$as_me: *** The ${NCURSES_DESCRIP} installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-${NCURSES_OPTION}" >&5 -echo "$as_me: *** without explicitly specifying --with-${NCURSES_OPTION}" >&6;} - exit 1 - fi -fi - - -PBX_GTK2=0 -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_PKGCONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$PKGCONFIG"; then - ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PKGCONFIG="${ac_tool_prefix}pkg-config" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -PKGCONFIG=$ac_cv_prog_PKGCONFIG -if test -n "$PKGCONFIG"; then - echo "$as_me:$LINENO: result: $PKGCONFIG" >&5 -echo "${ECHO_T}$PKGCONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_PKGCONFIG"; then - ac_ct_PKGCONFIG=$PKGCONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_PKGCONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_PKGCONFIG"; then - ac_cv_prog_ac_ct_PKGCONFIG="$ac_ct_PKGCONFIG" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_PKGCONFIG="pkg-config" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_PKGCONFIG" && ac_cv_prog_ac_ct_PKGCONFIG="No" -fi -fi -ac_ct_PKGCONFIG=$ac_cv_prog_ac_ct_PKGCONFIG -if test -n "$ac_ct_PKGCONFIG"; then - echo "$as_me:$LINENO: result: $ac_ct_PKGCONFIG" >&5 -echo "${ECHO_T}$ac_ct_PKGCONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKGCONFIG=$ac_ct_PKGCONFIG -else - PKGCONFIG="$ac_cv_prog_PKGCONFIG" -fi - -if test ! "x${PKGCONFIG}" = xNo; then - GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null) - GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs) - PBX_GTK2=1 - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GTK2 1 -_ACEOF - -fi - - - - -test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent" - - ac_config_files="$ac_config_files makeopts" - - - -subdirs="$subdirs mxml" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "makeopts" ) CONFIG_FILES="$CONFIG_FILES makeopts" ;; - "autoconfig.h" ) CONFIG_HEADERS="$CONFIG_HEADERS autoconfig.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@HOST_OS@,$HOST_OS,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@GNU_MAKE@,$GNU_MAKE,;t t -s,@CURSES_LIB@,$CURSES_LIB,;t t -s,@CURSES_INCLUDE@,$CURSES_INCLUDE,;t t -s,@PBX_CURSES@,$PBX_CURSES,;t t -s,@NCURSES_LIB@,$NCURSES_LIB,;t t -s,@NCURSES_INCLUDE@,$NCURSES_INCLUDE,;t t -s,@PBX_NCURSES@,$PBX_NCURSES,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@PKGCONFIG@,$PKGCONFIG,;t t -s,@ac_ct_PKGCONFIG@,$ac_ct_PKGCONFIG,;t t -s,@PBX_GTK2@,$PBX_GTK2,;t t -s,@GTK2_INCLUDE@,$GTK2_INCLUDE,;t t -s,@GTK2_LIB@,$GTK2_LIB,;t t -s,@subdirs@,$subdirs,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - -# -# CONFIG_SUBDIRS section. -# -if test "$no_recursion" != yes; then - - # Remove --cache-file and --srcdir arguments so they do not pile up. - ac_sub_configure_args= - ac_prev= - for ac_arg in $ac_configure_args; do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case $ac_arg in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ - | --c=*) - ;; - --config-cache | -C) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - ;; - *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; - esac - done - - # Always prepend --prefix to ensure using the same prefix - # in subdir configurations. - ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" - - ac_popdir=`pwd` - for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - test -d $srcdir/$ac_dir || continue - - { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 -echo "$as_me: configuring in $ac_dir" >&6;} - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - cd $ac_dir - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" - elif test -f $ac_srcdir/configure; then - ac_sub_configure="$SHELL '$ac_srcdir/configure'" - elif test -f $ac_srcdir/configure.in; then - ac_sub_configure=$ac_configure - else - { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 -echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - # Make the cache file name correct relative to the subdirectory. - case $cache_file in - [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file=$ac_top_builddir$cache_file ;; - esac - - { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 -echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} - # The eval makes quoting arguments work. - eval $ac_sub_configure $ac_sub_configure_args \ - --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || - { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 -echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} - { (exit 1); exit 1; }; } - fi - - cd $ac_popdir - done -fi - - -{ echo "$as_me:$LINENO: Menuselect build configuration successfully completed" >&5 -echo "$as_me: Menuselect build configuration successfully completed" >&6;} diff --git a/zaptel/menuselect/configure.ac b/zaptel/menuselect/configure.ac deleted file mode 100644 index ee973e57..00000000 --- a/zaptel/menuselect/configure.ac +++ /dev/null @@ -1,74 +0,0 @@ -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) - -m4_define([MENUSELECT_VERSION], - m4_bpatsubst(m4_esyscmd([./make_version .]), - [\([0-9.]*\)\(\w\|\W\)*], - [\1])) -AC_INIT(menuselect, MENUSELECT_VERSION, www.asterisk.org) - -# check existence of the package -AC_CONFIG_SRCDIR([menuselect.c]) - -# specify output header file -AC_CONFIG_HEADER(autoconfig.h) - -AC_COPYRIGHT("Menuselect") -AC_REVISION($Revision: 40837 $) - -AC_CANONICAL_BUILD -AC_CANONICAL_HOST - -HOST_OS=${host_os} -AC_SUBST(HOST_OS) - -AH_TOP( -#ifndef MENUSELECT_AUTOCONFIG_H -#define MENUSELECT_AUTOCONFIG_H - -#ifndef _REENTRANT -#define _REENTRANT -#endif -) - -AH_BOTTOM( -#endif -) - -# Checks for programs. -AC_PROG_CC -AST_CHECK_GNU_MAKE - - -AC_LANG(C) - -AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep strtoq unsetenv vasprintf]) - -# The frontend can use curses, ncurses or GTK2 so check for all of them - -AST_EXT_LIB_SETUP([CURSES], [curses], [curses]) -AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses]) - -AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h]) -AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h]) - -PBX_GTK2=0 -AC_CHECK_TOOL(PKGCONFIG, pkg-config, No) -if test ! "x${PKGCONFIG}" = xNo; then - GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null) - GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs) - PBX_GTK2=1 - AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.]) -fi -AC_SUBST(PBX_GTK2) -AC_SUBST(GTK2_INCLUDE) -AC_SUBST(GTK2_LIB) - -test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent" - -AC_CONFIG_FILES([makeopts]) -AC_CONFIG_SUBDIRS([mxml]) -AC_OUTPUT - -AC_MSG_NOTICE(Menuselect build configuration successfully completed) diff --git a/zaptel/menuselect/example_menuselect-tree b/zaptel/menuselect/example_menuselect-tree deleted file mode 100644 index 9cf98587..00000000 --- a/zaptel/menuselect/example_menuselect-tree +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - zaptel - - - - - - - - - - - - - - - no - - - - - - - - - zaptel - - - - - - - - - - - - - libosptk - ssl - - - zaptel - - - - - - - - - - - - - - - - - - - - - zaptel - no - - - - - - - - - - - - - - - no - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - zaptel - - - zaptel - - - zaptel - - - - - - - - - - - unixodbc - - - pgsql - - - radiusclient - - - sqlite - - - freetds - - - - - - - asound - - - - - h323 - - - - - iksemel - - - - - - - - - nbs - - - ossaudio - - - ixjuser - - - - - - - vpbapi - - - zaptel - - - - - - - - - - - no - - - - - libgsm - - - - - - - libspeex - - - - - zaptel - - - - - - - - - - - - - - - - - - - - - libvorbis - ogg - - - - - - - - - - - - - - - - - - - - - - - curl - - - - - - - - - - - - - - - - - - - - - - - - - unixodbc - - - - - - - - - - - - - - - - - - - - - zlib - - - gtk - no - - - - - - - - - - - - - - - - - unixodbc - - - pgsql - - - - - ssl - - - - - - - iksemel - - - - - win32 - - - unixodbc - - - libosptk - ssl - - - - - netsnmp - no - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - yes - - - - - - - - - - - - - - - - - - - - - - - - - - - yes - - - - - - - - - - - - - - - - - - - - - - - - - unixodbc - no - - - unixodbc - no - - - diff --git a/zaptel/menuselect/install-sh b/zaptel/menuselect/install-sh deleted file mode 100755 index 4d4a9519..00000000 --- a/zaptel/menuselect/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/zaptel/menuselect/linkedlists.h b/zaptel/menuselect/linkedlists.h deleted file mode 100644 index c3efca63..00000000 --- a/zaptel/menuselect/linkedlists.h +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 1999 - 2006, Digium, Inc. - * - * Mark Spencer - * Kevin P. Fleming - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -#ifndef ASTERISK_LINKEDLISTS_H -#define ASTERISK_LINKEDLISTS_H - -/*! - \brief Defines a structure to be used to hold a list of specified type (with no lock). - \param name This will be the name of the defined structure. - \param type This is the type of each list entry. - - This macro creates a structure definition that can be used - to hold a list of the entries of type \a type. It does not actually - declare (allocate) a structure; to do that, either follow this - macro with the desired name of the instance you wish to declare, - or use the specified \a name to declare instances elsewhere. - - Example usage: - \code - static AST_LIST_HEAD_NOLOCK(entry_list, entry) entries; - \endcode - - This would define \c struct \c entry_list, and declare an instance of it named - \a entries, all intended to hold a list of type \c struct \c entry. -*/ -#define AST_LIST_HEAD_NOLOCK(name, type) \ -struct name { \ - struct type *first; \ - struct type *last; \ -} - -/*! - \brief Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK -*/ -#define AST_LIST_HEAD_NOLOCK_INIT_VALUE { \ - .first = NULL, \ - .last = NULL, \ - } - -/*! - \brief Defines a structure to be used to hold a list of specified type, statically initialized. - - This is the same as AST_LIST_HEAD_STATIC, except without the lock included. -*/ -#define AST_LIST_HEAD_NOLOCK_STATIC(name, type) \ -struct name { \ - struct type *first; \ - struct type *last; \ -} name = AST_LIST_HEAD_NOLOCK_INIT_VALUE - -/*! - \brief Initializes a list head structure with a specified first entry. - \param head This is a pointer to the list head structure - \param entry pointer to the list entry that will become the head of the list - - This macro initializes a list head structure by setting the head - entry to the supplied value. -*/ -#define AST_LIST_HEAD_SET_NOLOCK(head, entry) do { \ - (head)->first = (entry); \ - (head)->last = (entry); \ -} while (0) - -/*! - \brief Declare a forward link structure inside a list entry. - \param type This is the type of each list entry. - - This macro declares a structure to be used to link list entries together. - It must be used inside the definition of the structure named in - \a type, as follows: - - \code - struct list_entry { - ... - AST_LIST_ENTRY(list_entry) list; - } - \endcode - - The field name \a list here is arbitrary, and can be anything you wish. -*/ -#define AST_LIST_ENTRY(type) \ -struct { \ - struct type *next; \ -} - -/*! - \brief Returns the first entry contained in a list. - \param head This is a pointer to the list head structure - */ -#define AST_LIST_FIRST(head) ((head)->first) - -/*! - \brief Returns the last entry contained in a list. - \param head This is a pointer to the list tail structure - */ -#define AST_LIST_LAST(head) ((head)->last) - -/*! - \brief Returns the next entry in the list after the given entry. - \param elm This is a pointer to the current entry. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. -*/ -#define AST_LIST_NEXT(elm, field) ((elm)->field.next) - -/*! - \brief Checks whether the specified list contains any entries. - \param head This is a pointer to the list head structure - - Returns non-zero if the list has entries, zero if not. - */ -#define AST_LIST_EMPTY(head) (AST_LIST_FIRST(head) == NULL) - -/*! - \brief Loops over (traverses) the entries in a list. - \param head This is a pointer to the list head structure - \param var This is the name of the variable that will hold a pointer to the - current list entry on each iteration. It must be declared before calling - this macro. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - - This macro is use to loop over (traverse) the entries in a list. It uses a - \a for loop, and supplies the enclosed code with a pointer to each list - entry as it loops. It is typically used as follows: - \code - static AST_LIST_HEAD(entry_list, list_entry) entries; - ... - struct list_entry { - ... - AST_LIST_ENTRY(list_entry) list; - } - ... - struct list_entry *current; - ... - AST_LIST_TRAVERSE(&entries, current, list) { - (do something with current here) - } - \endcode - \warning If you modify the forward-link pointer contained in the \a current entry while - inside the loop, the behavior will be unpredictable. At a minimum, the following - macros will modify the forward-link pointer, and should not be used inside - AST_LIST_TRAVERSE() against the entry pointed to by the \a current pointer without - careful consideration of their consequences: - \li AST_LIST_NEXT() (when used as an lvalue) - \li AST_LIST_INSERT_AFTER() - \li AST_LIST_INSERT_HEAD() - \li AST_LIST_INSERT_TAIL() -*/ -#define AST_LIST_TRAVERSE(head,var,field) \ - for((var) = (head)->first; (var); (var) = (var)->field.next) - -/*! - \brief Loops safely over (traverses) the entries in a list. - \param head This is a pointer to the list head structure - \param var This is the name of the variable that will hold a pointer to the - current list entry on each iteration. It must be declared before calling - this macro. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - - This macro is used to safely loop over (traverse) the entries in a list. It - uses a \a for loop, and supplies the enclosed code with a pointer to each list - entry as it loops. It is typically used as follows: - - \code - static AST_LIST_HEAD(entry_list, list_entry) entries; - ... - struct list_entry { - ... - AST_LIST_ENTRY(list_entry) list; - } - ... - struct list_entry *current; - ... - AST_LIST_TRAVERSE_SAFE_BEGIN(&entries, current, list) { - (do something with current here) - } - AST_LIST_TRAVERSE_SAFE_END; - \endcode - - It differs from AST_LIST_TRAVERSE() in that the code inside the loop can modify - (or even free, after calling AST_LIST_REMOVE_CURRENT()) the entry pointed to by - the \a current pointer without affecting the loop traversal. -*/ -#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field) { \ - typeof((head)->first) __list_next; \ - typeof((head)->first) __list_prev = NULL; \ - typeof((head)->first) __new_prev = NULL; \ - for ((var) = (head)->first, __new_prev = (var), \ - __list_next = (var) ? (var)->field.next : NULL; \ - (var); \ - __list_prev = __new_prev, (var) = __list_next, \ - __new_prev = (var), \ - __list_next = (var) ? (var)->field.next : NULL \ - ) - -/*! - \brief Removes the \a current entry from a list during a traversal. - \param head This is a pointer to the list head structure - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - - \note This macro can \b only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN() - block; it is used to unlink the current entry from the list without affecting - the list traversal (and without having to re-traverse the list to modify the - previous entry, if any). - */ -#define AST_LIST_REMOVE_CURRENT(head, field) \ - __new_prev = __list_prev; \ - if (__list_prev) \ - __list_prev->field.next = __list_next; \ - else \ - (head)->first = __list_next; \ - if (!__list_next) \ - (head)->last = __list_prev; - -/*! - \brief Inserts a list entry before the current entry during a traversal. - \param head This is a pointer to the list head structure - \param elm This is a pointer to the entry to be inserted. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - - \note This macro can \b only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN() - block. - */ -#define AST_LIST_INSERT_BEFORE_CURRENT(head, elm, field) do { \ - if (__list_prev) { \ - (elm)->field.next = __list_prev->field.next; \ - __list_prev->field.next = elm; \ - } else { \ - (elm)->field.next = (head)->first; \ - (head)->first = (elm); \ - } \ - __new_prev = (elm); \ -} while (0) - -/*! - \brief Closes a safe loop traversal block. - */ -#define AST_LIST_TRAVERSE_SAFE_END } - -/*! - \brief Initializes a list head structure. - \param head This is a pointer to the list head structure - - This macro initializes a list head structure by setting the head - entry to \a NULL (empty list). There is no embedded lock handling - with this macro. -*/ -#define AST_LIST_HEAD_INIT_NOLOCK(head) { \ - (head)->first = NULL; \ - (head)->last = NULL; \ -} - -/*! - \brief Inserts a list entry after a given entry. - \param head This is a pointer to the list head structure - \param listelm This is a pointer to the entry after which the new entry should - be inserted. - \param elm This is a pointer to the entry to be inserted. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - */ -#define AST_LIST_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.next = (listelm)->field.next; \ - (listelm)->field.next = (elm); \ - if ((head)->last == (listelm)) \ - (head)->last = (elm); \ -} while (0) - -/*! - \brief Inserts a list entry at the head of a list. - \param head This is a pointer to the list head structure - \param elm This is a pointer to the entry to be inserted. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - */ -#define AST_LIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.next = (head)->first; \ - (head)->first = (elm); \ - if (!(head)->last) \ - (head)->last = (elm); \ -} while (0) - -/*! - \brief Appends a list entry to the tail of a list. - \param head This is a pointer to the list head structure - \param elm This is a pointer to the entry to be appended. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - - Note: The link field in the appended entry is \b not modified, so if it is - actually the head of a list itself, the entire list will be appended - temporarily (until the next AST_LIST_INSERT_TAIL is performed). - */ -#define AST_LIST_INSERT_TAIL(head, elm, field) do { \ - if (!(head)->first) { \ - (head)->first = (elm); \ - (head)->last = (elm); \ - } else { \ - (head)->last->field.next = (elm); \ - (head)->last = (elm); \ - } \ -} while (0) - -/*! - \brief Removes and returns the head entry from a list. - \param head This is a pointer to the list head structure - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - - Removes the head entry from the list, and returns a pointer to it. - This macro is safe to call on an empty list. - */ -#define AST_LIST_REMOVE_HEAD(head, field) ({ \ - typeof((head)->first) cur = (head)->first; \ - if (cur) { \ - (head)->first = cur->field.next; \ - cur->field.next = NULL; \ - if ((head)->last == cur) \ - (head)->last = NULL; \ - } \ - cur; \ - }) - -/*! - \brief Removes a specific entry from a list. - \param head This is a pointer to the list head structure - \param elm This is a pointer to the entry to be removed. - \param field This is the name of the field (declared using AST_LIST_ENTRY()) - used to link entries of this list together. - \warning The removed entry is \b not freed nor modified in any way. - */ -#define AST_LIST_REMOVE(head, elm, field) do { \ - if ((head)->first == (elm)) { \ - (head)->first = (elm)->field.next; \ - if ((head)->last == (elm)) \ - (head)->last = NULL; \ - } else { \ - typeof(elm) curelm = (head)->first; \ - while (curelm && (curelm->field.next != (elm))) \ - curelm = curelm->field.next; \ - if (curelm) { \ - curelm->field.next = (elm)->field.next; \ - if ((head)->last == (elm)) \ - (head)->last = curelm; \ - } \ - } \ - (elm)->field.next = NULL; \ -} while (0) - -#endif /* _ASTERISK_LINKEDLISTS_H */ diff --git a/zaptel/menuselect/make_version b/zaptel/menuselect/make_version deleted file mode 100755 index c6bef89f..00000000 --- a/zaptel/menuselect/make_version +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -if [ -f ${1}/.version ]; then - cat ${1}.version -elif [ -f ${1}/.svnrevision ]; then - echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision` -elif [ -d .svn ]; then - PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e 's:^.*/svn/menuselect/::' | sed -e 's:/: :g'` - BRANCH=0 - TEAM=0 - - REV=`svnversion -c ${1} | cut -d: -f2` - - if [ "${PARTS}" = "trunk" ] - then - echo SVN-'trunk'-r${REV} - exit 0 - fi - - for PART in $PARTS - do - if [ ${BRANCH} != 0 ] - then - RESULT="${RESULT}-${PART}" - break - fi - - if [ ${TEAM} != 0 ] - then - RESULT="${RESULT}-${PART}" - continue - fi - - if [ "${PART}" = "branches" ] - then - BRANCH=1 - RESULT="branch" - continue - fi - - if [ "${PART}" = "tags" ] - then - BRANCH=1 - RESULT="tag" - continue - fi - - if [ "${PART}" = "team" ] - then - TEAM=1 - continue - fi - done - - echo SVN-${RESULT##-}-r${REV} -fi diff --git a/zaptel/menuselect/makeopts.in b/zaptel/menuselect/makeopts.in deleted file mode 100644 index 4b5b8d05..00000000 --- a/zaptel/menuselect/makeopts.in +++ /dev/null @@ -1,18 +0,0 @@ -# NOTE: Names of _INCLUDE and _LIB entries in this file must be -# the exact uppercase equivalents of the names used for -# dependencies in menuselect for the same package. - -CC=@CC@ - -OSARCH=@HOST_OS@ - -# The frontend can use curses, ncurses or gtk2 - -CURSES_INCLUDE=@CURSES_INCLUDE@ -CURSES_LIB=@CURSES_LIB@ - -GTK2_INCLUDE=@GTK2_INCLUDE@ -GTK2_LIB=@GTK2_LIB@ - -NCURSES_INCLUDE=@NCURSES_INCLUDE@ -NCURSES_LIB=@NCURSES_LIB@ diff --git a/zaptel/menuselect/menuselect.c b/zaptel/menuselect/menuselect.c deleted file mode 100644 index 37e730f7..00000000 --- a/zaptel/menuselect/menuselect.c +++ /dev/null @@ -1,1282 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 2005 - 2006, Russell Bryant - * - * Russell Bryant - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/*! - * \file - * - * \author Russell Bryant - * - * \brief A menu-driven system for Asterisk module selection - */ - -#include -#include -#include -#include -#include - -#include "mxml/mxml.h" -#include "linkedlists.h" -#include "menuselect.h" - -#undef MENUSELECT_DEBUG -#ifdef MENUSELECT_DEBUG -static FILE *debug; -#endif - -/*! The list of categories */ -struct categories categories = AST_LIST_HEAD_NOLOCK_INIT_VALUE; - -/*! - We have to maintain a pointer to the root of the trees generated from reading - the build options XML files so that we can free it when we're done. We don't - copy any of the information over from these trees. Our list is just a - convenient mapping to the information contained in these lists with one - additional piece of information - whether the build option is enabled or not. -*/ -struct tree { - /*! the root of the tree */ - mxml_node_t *root; - /*! for linking */ - AST_LIST_ENTRY(tree) list; -}; - -/*! The list of trees from menuselect-tree files */ -static AST_LIST_HEAD_NOLOCK_STATIC(trees, tree); - -static const char * const tree_files[] = { - "menuselect-tree" -}; - -static char *output_makeopts = OUTPUT_MAKEOPTS_DEFAULT; -static char *output_makedeps = OUTPUT_MAKEDEPS_DEFAULT; - -/*! This is set to 1 if menuselect.makeopts pre-existed the execution of this app */ -static int existing_config = 0; - -/*! This is set when the --check-deps argument is provided. */ -static int check_deps = 0; - -/*! This variable is non-zero when any changes are made */ -int changes_made = 0; - -/*! Menu name */ -const char *menu_name = "Menuselect"; - -/*! Global list of dependencies that are external to the tree */ -struct dep_file { - char name[32]; - int met; - AST_LIST_ENTRY(dep_file) list; -} *dep_file; -AST_LIST_HEAD_NOLOCK_STATIC(deps_file, dep_file); - -#if !defined(ast_strdupa) && defined(__GNUC__) -#define ast_strdupa(s) \ - (__extension__ \ - ({ \ - const char *__old = (s); \ - size_t __len = strlen(__old) + 1; \ - char *__new = __builtin_alloca(__len); \ - memcpy (__new, __old, __len); \ - __new; \ - })) -#endif - -/*! \brief return a pointer to the first non-whitespace character */ -static inline char *skip_blanks(char *str) -{ - if (!str) - return NULL; - - while (*str && *str < 33) - str++; - - return str; -} - -static void print_debug(const char *format, ...) -{ -#ifdef MENUSELECT_DEBUG - va_list ap; - - va_start(ap, format); - vfprintf(debug, format, ap); - va_end(ap); - - fflush(debug); -#endif -} - -/*! \brief Add a category to the category list, ensuring that there are no duplicates */ -static struct category *add_category(struct category *cat) -{ - struct category *tmp; - - AST_LIST_TRAVERSE(&categories, tmp, list) { - if (!strcmp(tmp->name, cat->name)) { - return tmp; - } - } - AST_LIST_INSERT_TAIL(&categories, cat, list); - - return cat; -} - -/*! \brief Add a member to the member list of a category, ensuring that there are no duplicates */ -static int add_member(struct member *mem, struct category *cat) -{ - struct member *tmp; - - AST_LIST_TRAVERSE(&cat->members, tmp, list) { - if (!strcmp(tmp->name, mem->name)) { - fprintf(stderr, "Member '%s' already exists in category '%s', ignoring.\n", mem->name, cat->name); - return -1; - } - } - AST_LIST_INSERT_TAIL(&cat->members, mem, list); - - return 0; -} - -/*! \brief Free a member structure and all of its members */ -static void free_member(struct member *mem) -{ - struct depend *dep; - struct conflict *cnf; - struct use *use; - - while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list))) - free(dep); - while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list))) - free(cnf); - while ((use = AST_LIST_REMOVE_HEAD(&mem->uses, list))) - free(use); - free(mem); -} - -/*! \brief Parse an input makeopts file */ -static int parse_tree(const char *tree_file) -{ - FILE *f; - struct tree *tree; - struct member *mem; - struct depend *dep; - struct conflict *cnf; - struct use *use; - mxml_node_t *cur; - mxml_node_t *cur2; - mxml_node_t *cur3; - mxml_node_t *menu; - const char *tmp; - - if (!(f = fopen(tree_file, "r"))) { - fprintf(stderr, "Unable to open '%s' for reading!\n", tree_file); - return -1; - } - - if (!(tree = calloc(1, sizeof(*tree)))) { - fclose(f); - return -1; - } - - if (!(tree->root = mxmlLoadFile(NULL, f, MXML_OPAQUE_CALLBACK))) { - fclose(f); - free(tree); - return -1; - } - - AST_LIST_INSERT_HEAD(&trees, tree, list); - - menu = mxmlFindElement(tree->root, tree->root, "menu", NULL, NULL, MXML_DESCEND); - if ((tmp = mxmlElementGetAttr(menu, "name"))) - menu_name = tmp; - for (cur = mxmlFindElement(menu, menu, "category", NULL, NULL, MXML_DESCEND); - cur; - cur = mxmlFindElement(cur, menu, "category", NULL, NULL, MXML_DESCEND)) - { - struct category *cat; - struct category *newcat; - - if (!(cat = calloc(1, sizeof(*cat)))) - return -1; - - cat->name = mxmlElementGetAttr(cur, "name"); - - newcat = add_category(cat); - - if (newcat != cat) { - /* want to append members, and potentially update the category. */ - free(cat); - cat = newcat; - } - - if ((tmp = mxmlElementGetAttr(cur, "displayname"))) - cat->displayname = tmp; - if ((tmp = mxmlElementGetAttr(cur, "positive_output"))) - cat->positive_output = !strcasecmp(tmp, "yes"); - if ((tmp = mxmlElementGetAttr(cur, "exclusive"))) - cat->exclusive = !strcasecmp(tmp, "yes"); - if ((tmp = mxmlElementGetAttr(cur, "remove_on_change"))) - cat->remove_on_change = tmp; - - for (cur2 = mxmlFindElement(cur, cur, "member", NULL, NULL, MXML_DESCEND); - cur2; - cur2 = mxmlFindElement(cur2, cur, "member", NULL, NULL, MXML_DESCEND)) - { - if (!(mem = calloc(1, sizeof(*mem)))) - return -1; - - mem->name = mxmlElementGetAttr(cur2, "name"); - mem->displayname = mxmlElementGetAttr(cur2, "displayname"); - - mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change"); - - if (!cat->positive_output) - mem->was_enabled = mem->enabled = 1; - - cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND); - if (cur3 && cur3->child) - mem->defaultenabled = cur3->child->value.opaque; - - for (cur3 = mxmlFindElement(cur2, cur2, "depend", NULL, NULL, MXML_DESCEND); - cur3 && cur3->child; - cur3 = mxmlFindElement(cur3, cur2, "depend", NULL, NULL, MXML_DESCEND)) - { - if (!(dep = calloc(1, sizeof(*dep)))) { - free_member(mem); - return -1; - } - if (!strlen_zero(cur3->child->value.opaque)) { - dep->name = cur3->child->value.opaque; - AST_LIST_INSERT_TAIL(&mem->deps, dep, list); - } else - free(dep); - } - - for (cur3 = mxmlFindElement(cur2, cur2, "conflict", NULL, NULL, MXML_DESCEND); - cur3 && cur3->child; - cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_DESCEND)) - { - if (!(cnf = calloc(1, sizeof(*cnf)))) { - free_member(mem); - return -1; - } - if (!strlen_zero(cur3->child->value.opaque)) { - cnf->name = cur3->child->value.opaque; - AST_LIST_INSERT_TAIL(&mem->conflicts, cnf, list); - } else - free(cnf); - } - - for (cur3 = mxmlFindElement(cur2, cur2, "use", NULL, NULL, MXML_DESCEND); - cur3 && cur3->child; - cur3 = mxmlFindElement(cur3, cur2, "use", NULL, NULL, MXML_DESCEND)) - { - if (!(use = calloc(1, sizeof(*use)))) { - free_member(mem); - return -1; - } - if (!strlen_zero(cur3->child->value.opaque)) { - use->name = cur3->child->value.opaque; - AST_LIST_INSERT_TAIL(&mem->uses, use, list); - } else - free(use); - } - - if (add_member(mem, cat)) - free_member(mem); - } - } - - fclose(f); - - return 0; -} - -/*! - * \arg interactive Set to non-zero if being called while user is making changes - */ -static unsigned int calc_dep_failures(int interactive) -{ - unsigned int result = 0; - struct category *cat; - struct member *mem; - struct depend *dep; - unsigned int changed, old_failure; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - old_failure = mem->depsfailed; - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - if (dep->member) - continue; - - mem->depsfailed = HARD_FAILURE; - AST_LIST_TRAVERSE(&deps_file, dep_file, list) { - if (!strcasecmp(dep_file->name, dep->name)) { - if (dep_file->met) - mem->depsfailed = NO_FAILURE; - break; - } - } - if (mem->depsfailed != NO_FAILURE) { - break; /* This dependency is not met, so we can stop now */ - } - } - if (old_failure == SOFT_FAILURE && mem->depsfailed != HARD_FAILURE) - mem->depsfailed = SOFT_FAILURE; - } - } - - do { - changed = 0; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - old_failure = mem->depsfailed; - - if (mem->depsfailed == HARD_FAILURE) - continue; - - mem->depsfailed = NO_FAILURE; - - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - if (!dep->member) - continue; - if (dep->member->depsfailed == HARD_FAILURE) { - mem->depsfailed = HARD_FAILURE; - break; - } else if (dep->member->depsfailed == SOFT_FAILURE) { - mem->depsfailed = SOFT_FAILURE; - } else if (!dep->member->enabled) { - mem->depsfailed = SOFT_FAILURE; - } - } - - if (mem->depsfailed != old_failure) { - if ((mem->depsfailed == NO_FAILURE) && mem->was_defaulted) { - mem->enabled = !strcasecmp(mem->defaultenabled, "yes"); - } else { - mem->enabled = interactive ? 0 : mem->was_enabled; - } - changed = 1; - break; /* This dependency is not met, so we can stop now */ - } - } - if (changed) - break; - } - - if (changed) - result = 1; - - } while (changed); - - return result; -} - -static unsigned int calc_conflict_failures(int interactive) -{ - unsigned int result = 0; - struct category *cat; - struct member *mem; - struct conflict *cnf; - unsigned int changed, old_failure; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - old_failure = mem->conflictsfailed; - AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { - if (cnf->member) - continue; - - mem->conflictsfailed = NO_FAILURE; - AST_LIST_TRAVERSE(&deps_file, dep_file, list) { - if (!strcasecmp(dep_file->name, cnf->name)) { - if (dep_file->met) - mem->conflictsfailed = HARD_FAILURE; - break; - } - } - - if (mem->conflictsfailed != NO_FAILURE) - break; /* This conflict was found, so we can stop now */ - } - if (old_failure == SOFT_FAILURE && mem->conflictsfailed != HARD_FAILURE) - mem->conflictsfailed = SOFT_FAILURE; - } - } - - do { - changed = 0; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - old_failure = mem->conflictsfailed; - - if (mem->conflictsfailed == HARD_FAILURE) - continue; - - mem->conflictsfailed = NO_FAILURE; - - AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { - if (!cnf->member) - continue; - - if (cnf->member->enabled) { - mem->conflictsfailed = SOFT_FAILURE; - break; - } - } - - if (mem->conflictsfailed != old_failure && mem->conflictsfailed != NO_FAILURE) { - mem->enabled = 0; - changed = 1; - break; /* This conflict has been found, so we can stop now */ - } - } - if (changed) - break; - } - - if (changed) - result = 1; - - } while (changed); - - return result; -} - -/*! \brief Process dependencies against the input dependencies file */ -static int process_deps(void) -{ - FILE *f; - char buf[80]; - char *p; - int res = 0; - - if (!(f = fopen(MENUSELECT_DEPS, "r"))) { - fprintf(stderr, "Unable to open '%s' for reading! Did you run ./configure ?\n", MENUSELECT_DEPS); - return -1; - } - - /* Build a dependency list from the file generated by configure */ - while (memset(buf, 0, sizeof(buf)), fgets(buf, sizeof(buf), f)) { - p = buf; - strsep(&p, "="); - if (!p) - continue; - if (!(dep_file = calloc(1, sizeof(*dep_file)))) - break; - strncpy(dep_file->name, buf, sizeof(dep_file->name) - 1); - dep_file->met = atoi(p); - AST_LIST_INSERT_TAIL(&deps_file, dep_file, list); - } - - fclose(f); - - return res; -} - -static void free_deps_file(void) -{ - /* Free the dependency list we built from the file */ - while ((dep_file = AST_LIST_REMOVE_HEAD(&deps_file, list))) - free(dep_file); -} - -static int match_member_relations(void) -{ - struct category *cat, *cat2; - struct member *mem, *mem2; - struct depend *dep; - struct conflict *cnf; - struct use *use; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - AST_LIST_TRAVERSE(&cat->members, mem2, list) { - if (strcasecmp(mem2->name, dep->name)) - continue; - - dep->member = mem2; - break; - } - if (dep->member) - break; - - AST_LIST_TRAVERSE(&categories, cat2, list) { - AST_LIST_TRAVERSE(&cat2->members, mem2, list) { - if (strcasecmp(mem2->name, dep->name)) - continue; - - dep->member = mem2; - break; - } - if (dep->member) - break; - } - } - } - } - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - AST_LIST_TRAVERSE(&mem->uses, use, list) { - AST_LIST_TRAVERSE(&cat->members, mem2, list) { - if (strcasecmp(mem2->name, use->name)) - continue; - - use->member = mem2; - break; - } - if (use->member) - break; - - AST_LIST_TRAVERSE(&categories, cat2, list) { - AST_LIST_TRAVERSE(&cat2->members, mem2, list) { - if (strcasecmp(mem2->name, use->name)) - continue; - - use->member = mem2; - break; - } - if (use->member) - break; - } - } - } - } - - AST_LIST_TRAVERSE(&categories, cat, list) { - if (!cat->exclusive) - continue; - - AST_LIST_TRAVERSE(&cat->members, mem, list) { - AST_LIST_TRAVERSE(&cat->members, mem2, list) { - if (mem2 == mem) - continue; - - if (!(cnf = calloc(1, sizeof(*cnf)))) - return -1; - - cnf->name = mem2->name; - cnf->member = mem2; - AST_LIST_INSERT_TAIL(&mem->conflicts, cnf, list); - } - } - } - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { - AST_LIST_TRAVERSE(&cat->members, mem2, list) { - if (strcasecmp(mem2->name, cnf->name)) - continue; - - cnf->member = mem2; - break; - } - if (cnf->member) - break; - - AST_LIST_TRAVERSE(&categories, cat2, list) { - AST_LIST_TRAVERSE(&cat2->members, mem2, list) { - if (strcasecmp(mem2->name, cnf->name)) - continue; - - cnf->member = mem2; - break; - } - if (cnf->member) - break; - } - } - } - } - - return 0; -} - -/*! \brief Iterate through all of the input tree files and call the parse function on them */ -static int build_member_list(void) -{ - int i; - int res = -1; - - for (i = 0; i < (sizeof(tree_files) / sizeof(tree_files[0])); i++) { - if ((res = parse_tree(tree_files[i]))) { - fprintf(stderr, "Error parsing '%s'!\n", tree_files[i]); - break; - } - } - - if (!res) - res = match_member_relations(); - - return res; -} - -/*! \brief Given the string representation of a member and category, mark it as present in a given input file */ -static void mark_as_present(const char *member, const char *category) -{ - struct category *cat; - struct member *mem; - char negate = 0; - - if (*member == '-') { - member++; - negate = 1; - } - - AST_LIST_TRAVERSE(&categories, cat, list) { - if (strcmp(category, cat->name)) - continue; - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (!strcmp(member, mem->name)) { - mem->was_enabled = mem->enabled = (negate ? !cat->positive_output : cat->positive_output); - break; - } - } - if (!mem) - fprintf(stderr, "member '%s' in category '%s' not found, ignoring.\n", member, category); - break; - } - - if (!cat) - fprintf(stderr, "category '%s' not found! Can't mark '%s' as disabled.\n", category, member); -} - -unsigned int enable_member(struct member *mem) -{ - struct depend *dep; - unsigned int can_enable = 1; - - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - if (!dep->member) - continue; - - if (!dep->member->enabled) { - if (dep->member->conflictsfailed != NO_FAILURE) { - can_enable = 0; - break; - } - - if (dep->member->depsfailed == HARD_FAILURE) { - can_enable = 0; - break; - } - - if (!(can_enable = enable_member(dep->member))) - break; - } - } - - if ((mem->enabled = can_enable)) - while (calc_dep_failures(1) || calc_conflict_failures(1)); - - return can_enable; -} - -void toggle_enabled(struct member *mem) -{ - if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) - return; - - if (!mem->enabled) - enable_member(mem); - else - mem->enabled = 0; - - fprintf(stderr, "3- changed %s to %d\n", mem->name, mem->enabled); - mem->was_defaulted = 0; - changes_made++; - - while (calc_dep_failures(1) || calc_conflict_failures(1)); -} - -/*! \brief Toggle a member of a category at the specified index to enabled/disabled */ -void toggle_enabled_index(struct category *cat, int index) -{ - struct member *mem; - int i = 0; - - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (i++ == index) - break; - } - - if (!mem) - return; - - toggle_enabled(mem); -} - -void set_enabled(struct category *cat, int index) -{ - struct member *mem; - int i = 0; - - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (i++ == index) - break; - } - - if (!mem) - return; - - if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) - return; - - if (mem->enabled) - return; - - enable_member(mem); - mem->was_defaulted = 0; - changes_made++; - - while (calc_dep_failures(1) || calc_conflict_failures(1)); -} - -void clear_enabled(struct category *cat, int index) -{ - struct member *mem; - int i = 0; - - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (i++ == index) - break; - } - - if (!mem) - return; - - if (!mem->enabled) - return; - - mem->enabled = 0; - mem->was_defaulted = 0; - changes_made++; - - while (calc_dep_failures(1) || calc_conflict_failures(1)); -} - -/*! \brief Process a previously failed dependency - * - * If a module was previously disabled because of a failed dependency - * or a conflict, and not because the user selected it to be that way, - * then it needs to be re-enabled by default if the problem is no longer present. - */ -static void process_prev_failed_deps(char *buf) -{ - const char *cat_name, *mem_name; - struct category *cat; - struct member *mem; - - cat_name = strsep(&buf, "="); - mem_name = strsep(&buf, "\n"); - - if (!cat_name || !mem_name) - return; - - AST_LIST_TRAVERSE(&categories, cat, list) { - if (strcasecmp(cat->name, cat_name)) - continue; - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (strcasecmp(mem->name, mem_name)) - continue; - - if (!mem->depsfailed && !mem->conflictsfailed) { - mem->enabled = 1; - mem->was_defaulted = 0; - } - - break; - } - break; - } - - if (!cat || !mem) - fprintf(stderr, "Unable to find '%s' in category '%s'\n", mem_name, cat_name); -} - -/*! \brief Parse an existing output makeopts file and enable members previously selected */ -static int parse_existing_config(const char *infile) -{ - FILE *f; - char buf[2048]; - char *category, *parse, *member; - int lineno = 0; - - if (!(f = fopen(infile, "r"))) { -#ifdef MENUSELECT_DEBUG - /* This isn't really an error, so only print the message in debug mode */ - fprintf(stderr, "Unable to open '%s' for reading existing config.\n", infile); -#endif - return -1; - } - - while (fgets(buf, sizeof(buf), f)) { - lineno++; - - if (strlen_zero(buf)) - continue; - - /* skip lines that are not for this tool */ - if (strncasecmp(buf, "MENUSELECT_", strlen("MENUSELECT_"))) - continue; - - if (!strncasecmp(buf, "MENUSELECT_DEPENDS_", strlen("MENUSELECT_DEPENDS_"))) - continue; - - if (!strncasecmp(buf, "MENUSELECT_BUILD_DEPS", strlen("MENUSELECT_BUILD_DEPS"))) - continue; - - parse = buf; - parse = skip_blanks(parse); - if (strlen_zero(parse)) - continue; - - /* Grab the category name */ - category = strsep(&parse, "="); - if (!parse) { - fprintf(stderr, "Invalid string in '%s' at line '%d'!\n", output_makeopts, lineno); - continue; - } - - parse = skip_blanks(parse); - - if (!strcasecmp(category, "MENUSELECT_DEPSFAILED")) { - process_prev_failed_deps(parse); - continue; - } - - while ((member = strsep(&parse, " \n"))) { - member = skip_blanks(member); - if (strlen_zero(member)) - continue; - mark_as_present(member, category); - } - } - - fclose(f); - - return 0; -} - -/*! \brief Create the output dependencies file */ -static int generate_makedeps_file(void) -{ - FILE *f; - struct category *cat; - struct member *mem; - struct depend *dep; - struct use *use; - - if (!(f = fopen(output_makedeps, "w"))) { - fprintf(stderr, "Unable to open dependencies file (%s) for writing!\n", output_makedeps); - return -1; - } - - /* Traverse all categories and members and output dependencies for each member */ - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (AST_LIST_EMPTY(&mem->deps) && AST_LIST_EMPTY(&mem->uses)) - continue; - - fprintf(f, "MENUSELECT_DEPENDS_%s=", mem->name); - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - const char *c; - - for (c = dep->name; *c; c++) - fputc(toupper(*c), f); - fputc(' ', f); - } - AST_LIST_TRAVERSE(&mem->uses, use, list) { - const char *c; - - for (c = use->name; *c; c++) - fputc(toupper(*c), f); - fputc(' ', f); - } - fprintf(f, "\n"); - } - } - - fclose(f); - - return 0; -} - -/*! \brief Create the output makeopts file that results from the user's selections */ -static int generate_makeopts_file(void) -{ - FILE *f; - struct category *cat; - struct member *mem; - struct depend *dep; - struct use *use; - - if (!(f = fopen(output_makeopts, "w"))) { - fprintf(stderr, "Unable to open build configuration file (%s) for writing!\n", output_makeopts); - return -1; - } - - /* Traverse all categories and members and output them as var/val pairs */ - AST_LIST_TRAVERSE(&categories, cat, list) { - fprintf(f, "%s=", cat->name); - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if ((!cat->positive_output && (!mem->enabled || mem->depsfailed || mem->conflictsfailed)) || - (cat->positive_output && mem->enabled && !mem->depsfailed && !mem->conflictsfailed)) - fprintf(f, "%s ", mem->name); - } - fprintf(f, "\n"); - } - - /* Traverse all categories and members, and for every member that is not disabled, - if it has internal dependencies (other members), list those members one time only - in a special variable */ - fprintf(f, "MENUSELECT_BUILD_DEPS="); - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if ((!cat->positive_output && (!mem->enabled || mem->depsfailed || mem->conflictsfailed)) || - (cat->positive_output && mem->enabled && !mem->depsfailed && !mem->conflictsfailed)) - continue; - - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - /* we only care about dependencies between members (internal, not external) */ - if (!dep->member) - continue; - /* if this has already been output, continue */ - if (dep->member->build_deps_output) - continue; - fprintf(f, "%s ", dep->member->name); - dep->member->build_deps_output = 1; - } - AST_LIST_TRAVERSE(&mem->uses, use, list) { - /* we only care about dependencies between members (internal, not external) */ - if (!use->member) - continue; - /* if the dependency module is not going to be built, don't list it */ - if (!use->member->enabled) - continue; - /* if this has already been output, continue */ - if (use->member->build_deps_output) - continue; - fprintf(f, "%s ", use->member->name); - use->member->build_deps_output = 1; - } - } - } - fprintf(f, "\n"); - - /* Output which members were disabled because of failed dependencies or conflicts */ - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (mem->depsfailed != HARD_FAILURE && mem->conflictsfailed != HARD_FAILURE) - continue; - - if (!mem->defaultenabled || !strcasecmp(mem->defaultenabled, "yes")) - fprintf(f, "MENUSELECT_DEPSFAILED=%s=%s\n", cat->name, mem->name); - } - } - - fclose(f); - - /* there is no need to process remove_on_change rules if we did not have - configuration information to start from - */ - if (!existing_config) - return 0; - - /* Traverse all categories and members and remove any files that are supposed - to be removed when an item has been changed */ - AST_LIST_TRAVERSE(&categories, cat, list) { - unsigned int had_changes = 0; - char rmcommand[256] = "rm -rf "; - char *file, *buf; - - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if ((mem->enabled == mem->was_enabled) && !mem->was_defaulted) - continue; - - had_changes = 1; - - if (mem->remove_on_change) { - for (buf = ast_strdupa(mem->remove_on_change), file = strsep(&buf, " "); - file; - file = strsep(&buf, " ")) { - strcpy(&rmcommand[7], file); - system(rmcommand); - } - } - } - - if (cat->remove_on_change && had_changes) { - for (buf = ast_strdupa(cat->remove_on_change), file = strsep(&buf, " "); - file; - file = strsep(&buf, " ")) { - strcpy(&rmcommand[7], file); - system(rmcommand); - } - } - } - - return 0; -} - -#ifdef MENUSELECT_DEBUG -/*! \brief Print out all of the information contained in our tree */ -static void dump_member_list(void) -{ - struct category *cat; - struct member *mem; - struct depend *dep; - struct conflict *cnf; - - AST_LIST_TRAVERSE(&categories, cat, list) { - fprintf(stderr, "Category: '%s'\n", cat->name); - AST_LIST_TRAVERSE(&cat->members, mem, list) { - fprintf(stderr, " ==>> Member: '%s' (%s)", mem->name, mem->enabled ? "Enabled" : "Disabled"); - fprintf(stderr, " Was %s\n", mem->was_enabled ? "Enabled" : "Disabled"); - if (mem->defaultenabled) - fprintf(stderr, " Defaults to %s\n", !strcasecmp(mem->defaultenabled, "yes") ? "Enabled" : "Disabled"); - AST_LIST_TRAVERSE(&mem->deps, dep, list) - fprintf(stderr, " --> Depends on: '%s'\n", dep->name); - if (!AST_LIST_EMPTY(&mem->deps)) - fprintf(stderr, " --> Dependencies Met: %s\n", mem->depsfailed ? "No" : "Yes"); - AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) - fprintf(stderr, " --> Conflicts with: '%s'\n", cnf->name); - if (!AST_LIST_EMPTY(&mem->conflicts)) - fprintf(stderr, " --> Conflicts Found: %s\n", mem->conflictsfailed ? "Yes" : "No"); - } - } -} -#endif - -/*! \brief Free all categories and their members */ -static void free_member_list(void) -{ - struct category *cat; - struct member *mem; - struct depend *dep; - struct conflict *cnf; - - while ((cat = AST_LIST_REMOVE_HEAD(&categories, list))) { - while ((mem = AST_LIST_REMOVE_HEAD(&cat->members, list))) { - while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list))) - free(dep); - while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list))) - free(cnf); - free(mem); - } - free(cat); - } -} - -/*! \brief Free all of the XML trees */ -static void free_trees(void) -{ - struct tree *tree; - - while ((tree = AST_LIST_REMOVE_HEAD(&trees, list))) { - mxmlDelete(tree->root); - free(tree); - } -} - -/*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */ -void set_all(struct category *cat, int val) -{ - struct member *mem; - - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (mem->enabled == val) - continue; - - if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) - continue; - - if (val) { - enable_member(mem); - } else { - mem->enabled = 0; - } - - mem->was_defaulted = 0; - changes_made++; - } -} - -int count_categories(void) -{ - struct category *cat; - int count = 0; - - AST_LIST_TRAVERSE(&categories, cat, list) - count++; - - return count; -} - -int count_members(struct category *cat) -{ - struct member *mem; - int count = 0; - - AST_LIST_TRAVERSE(&cat->members, mem, list) - count++; - - return count; -} - -/*! \brief Make sure an existing menuselect.makeopts disabled everything it should have */ -static int sanity_check(void) -{ - struct category *cat; - struct member *mem; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if ((mem->depsfailed || mem->conflictsfailed) && mem->enabled) { - fprintf(stderr, "\n***********************************************************\n" - " The existing menuselect.makeopts file did not specify \n" - " that '%s' should not be included. However, either some \n" - " dependencies for this module were not found or a \n" - " conflict exists. \n" - " \n" - " Either run 'make menuselect' or remove the existing \n" - " menuselect.makeopts file to resolve this issue. \n" - "***********************************************************\n\n", mem->name); - return -1; - } - } - } - return 0; /* all good... */ -} - -/* \brief Set the forced default values if they exist */ -static void process_defaults(void) -{ - struct category *cat; - struct member *mem; - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (!mem->defaultenabled) - continue; - - if (mem->depsfailed == HARD_FAILURE) - continue; - - if (mem->conflictsfailed == HARD_FAILURE) - continue; - - if (!strcasecmp(mem->defaultenabled, "yes")) { - mem->enabled = 1; - mem->was_defaulted = 1; - } else if (!strcasecmp(mem->defaultenabled, "no")) { - mem->enabled = 0; - mem->was_defaulted = 1; - } else - fprintf(stderr, "Invalid defaultenabled value for '%s' in category '%s'\n", mem->name, cat->name); - } - } - -} - -int main(int argc, char *argv[]) -{ - int res = 0; - unsigned int x; - - /* Make the compiler happy */ - print_debug(""); - -#ifdef MENUSELECT_DEBUG - if (!(debug = fopen("menuselect_debug.txt", "w"))) { - fprintf(stderr, "Failed to open menuselect_debug.txt for debug output.\n"); - exit(1); - } -#endif - - /* Parse the input XML files to build the list of available options */ - if ((res = build_member_list())) - exit(res); - - /* Process module dependencies */ - if ((res = process_deps())) - exit(res); - - while (calc_dep_failures(0) || calc_conflict_failures(0)); - - /* The --check-deps option is used to ask this application to check to - * see if that an existing menuselect.makeopts file contains all of the - * modules that have dependencies that have not been met. If this - * is not the case, an informative message will be printed to the - * user and the build will fail. */ - for (x = 1; x < argc; x++) { - if (!strcmp(argv[x], "--check-deps")) - check_deps = 1; - else { - res = parse_existing_config(argv[x]); - if (!res && !strcasecmp(argv[x], OUTPUT_MAKEOPTS_DEFAULT)) - existing_config = 1; - res = 0; - } - } - -#ifdef MENUSELECT_DEBUG - /* Dump the list produced by parsing the various input files */ - dump_member_list(); -#endif - - while (calc_dep_failures(0) || calc_conflict_failures(0)); - - if (!existing_config) - process_defaults(); - else if (check_deps) - res = sanity_check(); - - while (calc_dep_failures(0) || calc_conflict_failures(0)); - - /* Run the menu to let the user enable/disable options */ - if (!check_deps && !res) - res = run_menu(); - - if (!res) - res = generate_makeopts_file(); - - /* Always generate the dependencies file */ - if (!res) - generate_makedeps_file(); - - /* free everything we allocated */ - free_deps_file(); - free_trees(); - free_member_list(); - -#ifdef MENUSELECT_DEBUG - if (debug) - fclose(debug); -#endif - - exit(res); -} diff --git a/zaptel/menuselect/menuselect.h b/zaptel/menuselect/menuselect.h deleted file mode 100644 index beb9c704..00000000 --- a/zaptel/menuselect/menuselect.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 2005-2006, Russell Bryant - * - * Russell Bryant - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/*! - * \file - * - * \brief public data structures and defaults for menuselect - * - */ - -#ifndef MENUSELECT_H -#define MENUSELECT_H - -#include "linkedlists.h" - -#define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts" -#define OUTPUT_MAKEDEPS_DEFAULT "menuselect.makedeps" -#define MENUSELECT_DEPS "build_tools/menuselect-deps" - -struct member; - -struct depend { - /*! the name of the dependency */ - const char *name; - /*! if this dependency is a member, not an external object */ - struct member *member; - /*! for linking */ - AST_LIST_ENTRY(depend) list; -}; - -struct conflict { - /*! the name of the conflict */ - const char *name; - /*! if this conflict is a member, not an external object */ - const struct member *member; - /*! for linking */ - AST_LIST_ENTRY(conflict) list; -}; - -struct use { - /*! the name of the used package */ - const char *name; - /*! if this dependency is a member, not an external object */ - struct member *member; - /*! for linking */ - AST_LIST_ENTRY(use) list; -}; - -enum failure_types { - NO_FAILURE = 0, - SOFT_FAILURE = 1, - HARD_FAILURE = 2, -}; - -struct member { - /*! What will be sent to the makeopts file */ - const char *name; - /*! Display name if known */ - const char *displayname; - /*! Default setting */ - const char *defaultenabled; - /*! Delete these file(s) if this member changes */ - const char *remove_on_change; - /*! This module is currently selected */ - unsigned int enabled:1; - /*! This module was enabled when the config was loaded */ - unsigned int was_enabled:1; - /*! This module has failed dependencies */ - unsigned int depsfailed:2; - /*! This module has failed conflicts */ - unsigned int conflictsfailed:2; - /*! This module's 'enabled' flag was changed by a default only */ - unsigned int was_defaulted:1; - /*! This module is a dependency, and if it is selected then - we have included it in the MENUSELECT_BUILD_DEPS line - in the output file */ - unsigned int build_deps_output:1; - /*! dependencies of this module */ - AST_LIST_HEAD_NOLOCK(, depend) deps; - /*! conflicts of this module */ - AST_LIST_HEAD_NOLOCK(, conflict) conflicts; - /*! optional packages used by this module */ - AST_LIST_HEAD_NOLOCK(, use) uses; - /*! for making a list of modules */ - AST_LIST_ENTRY(member) list; -}; - -struct category { - /*! the Makefile variable */ - const char *name; - /*! the name displayed in the menu */ - const char *displayname; - /*! Delete these file(s) if anything in this category changes */ - const char *remove_on_change; - /*! Output what is selected, as opposed to not selected */ - unsigned int positive_output:1; - /*! All choices in this category are mutually exclusive */ - unsigned int exclusive:1; - /*! the list of possible values to be set in this variable */ - AST_LIST_HEAD_NOLOCK(, member) members; - /*! for linking */ - AST_LIST_ENTRY(category) list; -}; - -extern AST_LIST_HEAD_NOLOCK(categories, category) categories; - -extern const char *menu_name; - -/*! This is implemented by the frontend */ -int run_menu(void); - -int count_categories(void); - -int count_members(struct category *cat); - -/*! \brief Toggle a member of a category at the specified index to enabled/disabled */ -void toggle_enabled_index(struct category *cat, int index); - -void toggle_enabled(struct member *mem); - -/*! \brief Set a member of a category at the specified index to enabled */ -void set_enabled(struct category *cat, int index); -/*! \brief Set a member of a category at the specified index to not enabled */ -void clear_enabled(struct category *cat, int index); - -/*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */ -void set_all(struct category *cat, int val); - -/*! \brief returns non-zero if the string is not defined, or has zero length */ -static inline int strlen_zero(const char *s) -{ - return (!s || (*s == '\0')); -} - -#endif /* MENUSELECT_H */ diff --git a/zaptel/menuselect/menuselect_curses.c b/zaptel/menuselect/menuselect_curses.c deleted file mode 100644 index 077bea21..00000000 --- a/zaptel/menuselect/menuselect_curses.c +++ /dev/null @@ -1,867 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 2005 - 2006, Russell Bryant - * - * Russell Bryant - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/* - * \file - * - * \author Russell Bryant - * - * \brief curses frontend for selection maintenance - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "menuselect.h" - -#define MENU_HELP "Press 'h' for help." - -#define TITLE_HEIGHT 7 - -#define MIN_X 80 -#define MIN_Y 21 - -#define PAGE_OFFSET 10 - -#define SCROLL_NONE 0 -#define SCROLL_DOWN 1 - -#define SCROLL_DOWN_INDICATOR "... More ..." - -#define MIN(x,y) ((x)<(y)?(x):(y)) -#define MAX(x,y) ((x)<(y)?(y):(x)) - -extern int changes_made; - -/*! Maximum number of characters horizontally */ -static int max_x = 0; -/*! Maximum number of characters vertically */ -static int max_y = 0; - -static const char * const help_info[] = { - "scroll => up/down arrows", - "toggle selection => Enter", - "select => y", - "deselect => n", - "select all => F8", - "deselect all => F7", - "back => left arrow", - "quit => q", - "save and quit => x", - "", - "XXX means dependencies have not been met", - " or a conflict exists", - "", - "< > means a dependency has been deselected", - " and will be automatically re-selected", - " if this item is selected", - "", - "( ) means a conflicting item has been", - " selected", -}; - -/*! \brief Handle a window resize in xterm */ -static void winch_handler(int sig) -{ - getmaxyx(stdscr, max_y, max_x); - - if (max_x < MIN_X || max_y < MIN_Y) { - fprintf(stderr, "Terminal must be at least %d x %d.\n", MIN_X, MIN_Y); - max_x = MIN_X - 1; - max_y = MIN_Y - 1; - } -} - -/*! \brief Handle a SIGQUIT */ -static void sigint_handler(int sig) -{ - -} - -/*! \brief Display help information */ -static void show_help(WINDOW *win) -{ - int i; - - wclear(win); - for (i = 0; i < (sizeof(help_info) / sizeof(help_info[0])); i++) { - wmove(win, i, max_x / 2 - 15); - waddstr(win, help_info[i]); - } - wrefresh(win); - getch(); /* display the help until the user hits a key */ -} - -static int really_quit(WINDOW *win) -{ - int c; - wclear(win); - wmove(win, 2, max_x / 2 - 15); - waddstr(win, "ARE YOU SURE?"); - wmove(win, 3, max_x / 2 - 12); - waddstr(win, "--- It appears you have made some changes, and"); - wmove(win, 4, max_x / 2 - 12); - waddstr(win, "you have opted to Quit without saving these changes!"); - wmove(win, 6, max_x / 2 - 12); - waddstr(win, " Please Enter Y to exit without saving;"); - wmove(win, 7, max_x / 2 - 12); - waddstr(win, " Enter N to cancel your decision to quit,"); - wmove(win, 8, max_x / 2 - 12); - waddstr(win, " and keep working in menuselect, or"); - wmove(win, 9, max_x / 2 - 12); - waddstr(win, " Enter S to save your changes, and exit"); - wmove(win, 10, max_x / 2 - 12); - wrefresh(win); - while ((c=getch())) { - if (c == 'Y' || c == 'y') { - c = 'q'; - break; - } - if (c == 'S' || c == 's') { - c = 'S'; - break; - } - if (c == 'N' || c == 'n') { - c = '%'; - break; - } - } - return c; -} - -static void draw_main_menu(WINDOW *menu, int curopt) -{ - struct category *cat; - char buf[64]; - int i = 0; - - wclear(menu); - - AST_LIST_TRAVERSE(&categories, cat, list) { - wmove(menu, i++, max_x / 2 - 10); - if (!strlen_zero(cat->displayname)) - snprintf(buf, sizeof(buf), "%d.%s %s", i, i < 10 ? " " : "", cat->displayname); - else - snprintf(buf, sizeof(buf), "%d.%s %s", i, i < 10 ? " " : "", cat->name); - waddstr(menu, buf); - } - - wmove(menu, curopt, (max_x / 2) - 15); - waddstr(menu, "--->"); - wmove(menu, 0, 0); - - wrefresh(menu); -} - -static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end) -{ - char buf[64]; - struct depend *dep; - struct conflict *con; - struct use *use; - - wmove(menu, end - start + 2, max_x / 2 - 16); - wclrtoeol(menu); - wmove(menu, end - start + 3, max_x / 2 - 16); - wclrtoeol(menu); - wmove(menu, end - start + 4, max_x / 2 - 16); - wclrtoeol(menu); - wmove(menu, end - start + 5, max_x / 2 - 16); - wclrtoeol(menu); - - if (mem->displayname) { - wmove(menu, end - start + 2, max_x / 2 - 16); - waddstr(menu, mem->displayname); - } - if (!AST_LIST_EMPTY(&mem->deps)) { - wmove(menu, end - start + 3, max_x / 2 - 16); - strcpy(buf, "Depends on: "); - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - strncat(buf, dep->name, sizeof(buf) - strlen(buf) - 1); - strncat(buf, dep->member ? "(M)" : "(E)", sizeof(buf) - strlen(buf) - 1); - if (AST_LIST_NEXT(dep, list)) - strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1); - } - waddstr(menu, buf); - } - if (!AST_LIST_EMPTY(&mem->uses)) { - wmove(menu, end - start + 4, max_x / 2 - 16); - strcpy(buf, "Can use: "); - AST_LIST_TRAVERSE(&mem->uses, use, list) { - strncat(buf, use->name, sizeof(buf) - strlen(buf) - 1); - strncat(buf, use->member ? "(M)" : "(E)", sizeof(buf) - strlen(buf) - 1); - if (AST_LIST_NEXT(use, list)) - strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1); - } - waddstr(menu, buf); - } - if (!AST_LIST_EMPTY(&mem->conflicts)) { - wmove(menu, end - start + 5, max_x / 2 - 16); - strcpy(buf, "Conflicts with: "); - AST_LIST_TRAVERSE(&mem->conflicts, con, list) { - strncat(buf, con->name, sizeof(buf) - strlen(buf) - 1); - strncat(buf, con->member ? "(M)" : "(E)", sizeof(buf) - strlen(buf) - 1); - if (AST_LIST_NEXT(con, list)) - strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1); - } - waddstr(menu, buf); - } - -} - -static void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed, int flags) -{ - int i = 0; - int j = 0; - struct member *mem; - char buf[64]; - - if (!changed) { - /* If all we have to do is move the cursor, - * then don't clear the screen and start over */ - AST_LIST_TRAVERSE(&cat->members, mem, list) { - i++; - if (curopt + 1 == i) { - display_mem_info(menu, mem, start, end); - break; - } - } - wmove(menu, curopt - start, max_x / 2 - 9); - wrefresh(menu); - return; - } - - wclear(menu); - - i = 0; - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (i < start) { - i++; - continue; - } - wmove(menu, j++, max_x / 2 - 10); - i++; - if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) { - snprintf(buf, sizeof(buf), "XXX %d.%s %s", i, i < 10 ? " " : "", mem->name); - } else if (mem->depsfailed == SOFT_FAILURE) { - snprintf(buf, sizeof(buf), "<%s> %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name); - } else if (mem->conflictsfailed == SOFT_FAILURE) { - snprintf(buf, sizeof(buf), "(%s) %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name); - } else { - snprintf(buf, sizeof(buf), "[%s] %d.%s %s", mem->enabled ? "*" : " ", i, i < 10 ? " " : "", mem->name); - } - waddstr(menu, buf); - - if (curopt + 1 == i) - display_mem_info(menu, mem, start, end); - - if (i == end - (flags & SCROLL_DOWN ? 1 : 0)) - break; - } - - if (flags & SCROLL_DOWN) { - wmove(menu, j, max_x / 2 - sizeof(SCROLL_DOWN_INDICATOR) / 2); - waddstr(menu, SCROLL_DOWN_INDICATOR); - } - - wmove(menu, curopt - start, max_x / 2 - 9); - wrefresh(menu); -} - -static void play_space(void); - -static int move_up(int *current, int itemcount, int delta, int *start, int *end, int scroll) -{ - if (*current > 0) { - *current = MAX(*current - delta, 0); - if (*current < *start) { - int diff = *start - MAX(*start - delta, 0); - *start -= diff; - *end -= diff; - return 1; - } - } - return 0; -} - -static int move_down(int *current, int itemcount, int delta, int *start, int *end, int scroll) -{ - if (*current < itemcount) { - *current = MIN(*current + delta, itemcount); - if (*current > *end - 1 - (scroll & SCROLL_DOWN ? 1 : 0)) { - int diff = MIN(*end + delta - 1, itemcount) - *end + 1; - *start += diff; - *end += diff; - return 1; - } - } - return 0; -} - -static int run_category_menu(WINDOW *menu, int cat_num) -{ - struct category *cat; - int i = 0; - int start = 0; - int end = max_y - TITLE_HEIGHT - 6; - int c; - int curopt = 0; - int maxopt; - int changed = 1; - int scroll = SCROLL_NONE; - - AST_LIST_TRAVERSE(&categories, cat, list) { - if (i++ == cat_num) - break; - } - if (!cat) - return -1; - - maxopt = count_members(cat) - 1; - - if (maxopt > end) { - scroll = SCROLL_DOWN; - } - - draw_category_menu(menu, cat, start, end, curopt, changed, scroll); - - while ((c = getch())) { - changed = 0; - switch (c) { - case KEY_UP: - changed = move_up(&curopt, maxopt, 1, &start, &end, scroll); - break; - case KEY_DOWN: - changed = move_down(&curopt, maxopt, 1, &start, &end, scroll); - break; - case KEY_PPAGE: - changed = move_up(&curopt, maxopt, MIN(PAGE_OFFSET, max_y - TITLE_HEIGHT - 6 - (scroll & SCROLL_DOWN ? 1 : 0)), &start, &end, scroll); - break; - case KEY_NPAGE: - changed = move_down(&curopt, maxopt, MIN(PAGE_OFFSET, max_y - TITLE_HEIGHT - 6 - (scroll & SCROLL_DOWN ? 1 : 0)), &start, &end, scroll); - break; - case KEY_HOME: - changed = move_up(&curopt, maxopt, curopt, &start, &end, scroll); - break; - case KEY_END: - changed = move_down(&curopt, maxopt, maxopt - curopt, &start, &end, scroll); - break; - case KEY_LEFT: - case 27: /* Esc key */ - return 0; - case KEY_RIGHT: - case KEY_ENTER: - case '\n': - case ' ': - toggle_enabled_index(cat, curopt); - changed = 1; - break; - case 'y': - case 'Y': - set_enabled(cat, curopt); - changed = 1; - break; - case 'n': - case 'N': - clear_enabled(cat, curopt); - changed = 1; - break; - case 'h': - case 'H': - show_help(menu); - changed = 1; - break; - case KEY_F(7): - set_all(cat, 0); - changed = 1; - break; - case KEY_F(8): - set_all(cat, 1); - changed = 1; - default: - break; - } - if (c == 'x' || c == 'X' || c == 'Q' || c == 'q') - break; - - if (end <= maxopt) { - scroll |= SCROLL_DOWN; - } else { - scroll &= ~SCROLL_DOWN; - } - - draw_category_menu(menu, cat, start, end, curopt, changed, scroll); - } - - wrefresh(menu); - - return c; -} - -static void draw_title_window(WINDOW *title) -{ - char titlebar[strlen(menu_name) + 9]; - - memset(titlebar, '*', sizeof(titlebar) - 1); - titlebar[sizeof(titlebar) - 1] = '\0'; - wclear(title); - wmove(title, 1, (max_x / 2) - (strlen(titlebar) / 2)); - waddstr(title, titlebar); - wmove(title, 2, (max_x / 2) - (strlen(menu_name) / 2)); - waddstr(title, menu_name); - wmove(title, 3, (max_x / 2) - (strlen(titlebar) / 2)); - waddstr(title, titlebar); - wmove(title, 5, (max_x / 2) - (strlen(MENU_HELP) / 2)); - waddstr(title, MENU_HELP); - wrefresh(title); -} - -int run_menu(void) -{ - WINDOW *title; - WINDOW *menu; - int maxopt; - int curopt = 0; - int c; - int res = 0; - - setenv("ESCDELAY", "0", 1); /* So that ESC is processed immediately */ - - initscr(); - getmaxyx(stdscr, max_y, max_x); - signal(SIGWINCH, winch_handler); /* handle window resizing in xterm */ - signal(SIGINT, sigint_handler); /* handle window resizing in xterm */ - - if (max_x < MIN_X || max_y < MIN_Y) { - fprintf(stderr, "Terminal must be at least %d x %d.\n", MIN_X, MIN_Y); - endwin(); - return -1; - } - - cbreak(); /* don't buffer input until the enter key is pressed */ - noecho(); /* don't echo user input to the screen */ - keypad(stdscr, TRUE); /* allow the use of arrow keys */ - clear(); - refresh(); - - maxopt = count_categories() - 1; - - /* We have two windows - the title window at the top, and the menu window gets the rest */ - title = newwin(TITLE_HEIGHT, max_x, 0, 0); - menu = newwin(max_y - TITLE_HEIGHT, max_x, TITLE_HEIGHT, 0); - draw_title_window(title); - draw_main_menu(menu, curopt); - - while ((c = getch())) { - switch (c) { - case KEY_UP: - if (curopt > 0) - curopt--; - break; - case KEY_DOWN: - if (curopt < maxopt) - curopt++; - break; - case KEY_HOME: - curopt = 0; - break; - case KEY_END: - curopt = maxopt; - break; - case KEY_RIGHT: - case KEY_ENTER: - case '\n': - case ' ': - c = run_category_menu(menu, curopt); - break; - case 'h': - case 'H': - show_help(menu); - break; - case 'i': - case 'I': - play_space(); - draw_title_window(title); - default: - break; - } - if (c == 'q' || c == 'Q' || c == 27 || c == 3) { - if (changes_made) { - c = really_quit(menu); - if (c == 'q') { - res = -1; - break; - } - } else { - res = -1; - break; - } - } - if (c == 'x' || c == 'X' || c == 's' || c == 'S') - break; - draw_main_menu(menu, curopt); - } - - endwin(); - - return res; -} - -enum blip_type { - BLIP_TANK = 0, - BLIP_SHOT, - BLIP_BOMB, - BLIP_ALIEN -}; - -struct blip { - enum blip_type type; - int x; - int y; - int goingleft; - AST_LIST_ENTRY(blip) entry; -}; - -static AST_LIST_HEAD_NOLOCK(, blip) blips; - -static int score = 0; -static int num_aliens = 0; -struct blip *tank = NULL; - -/*! Probability of a bomb, out of 100 */ -#define BOMB_PROB 1 - -static int init_blips(void) -{ - int i, j; - struct blip *cur; - - srandom(time(NULL) + getpid()); - - /* make tank */ - cur = calloc(1, sizeof(struct blip)); - if (!cur) - return -1; - cur->type = BLIP_TANK; - cur->x = max_x / 2; - cur->y = max_y - 1; - AST_LIST_INSERT_HEAD(&blips, cur, entry); - tank = cur; - - /* 3 rows of 10 aliens */ - num_aliens = 0; - for (i = 0; i < 3; i++) { - for (j = 0; j < 10; j++) { - cur = calloc(1, sizeof(struct blip)); - if (!cur) - return -1; - cur->type = BLIP_ALIEN; - cur->x = (j * 2) + 1; - cur->y = (i * 2) + 1; - AST_LIST_INSERT_HEAD(&blips, cur, entry); - num_aliens++; - } - } - - return 0; -} - -static inline chtype type2chtype(enum blip_type type) -{ - switch (type) { - case BLIP_TANK: - return 'A'; - case BLIP_ALIEN: - return 'X'; - case BLIP_SHOT: - return '|'; - case BLIP_BOMB: - return 'o'; - default: - break; - } - return '?'; -} - -static int repaint_screen(void) -{ - struct blip *cur; - - clear(); - - wmove(stdscr, 0, 0); - wprintw(stdscr, "Score: %d", score); - - AST_LIST_TRAVERSE(&blips, cur, entry) { - wmove(stdscr, cur->y, cur->x); - waddch(stdscr, type2chtype(cur->type)); - } - - wmove(stdscr, 0, max_x - 1); - - wrefresh(stdscr); - - return 0; -} - -static int tank_move_left(void) -{ - if (tank->x > 0) - tank->x--; - - return 0; -} - -static int tank_move_right(void) -{ - if (tank->x < (max_x - 1)) - tank->x++; - - return 0; -} - -static int count_shots(void) -{ - struct blip *cur; - int count = 0; - - AST_LIST_TRAVERSE(&blips, cur, entry) { - if (cur->type == BLIP_SHOT) - count++; - } - - return count; -} - -static int tank_shoot(void) -{ - struct blip *shot; - - if (count_shots() == 3) - return 0; - - score--; - - shot = calloc(1, sizeof(struct blip)); - if (!shot) - return -1; - shot->type = BLIP_SHOT; - shot->x = tank->x; - shot->y = max_y - 2; - AST_LIST_INSERT_HEAD(&blips, shot, entry); - - return 0; -} - -static int move_aliens(void) -{ - struct blip *cur; - - AST_LIST_TRAVERSE(&blips, cur, entry) { - if (cur->type != BLIP_ALIEN) { - /* do nothing if it's not an alien */ - continue; - } - if (cur->goingleft && (cur->x == 0)) { - cur->y++; - cur->goingleft = 0; - } else if (!cur->goingleft && cur->x == (max_x - 1)) { - cur->y++; - cur->goingleft = 1; - } else if (cur->goingleft) { - cur->x--; - } else { - cur->x++; - } - /* Alien into the tank == game over */ - if (cur->x == tank->x && cur->y == tank->y) - return 1; - if (random() % 100 < BOMB_PROB && cur->y != max_y) { - struct blip *bomb = calloc(1, sizeof(struct blip)); - if (!bomb) - continue; - bomb->type = BLIP_BOMB; - bomb->x = cur->x; - bomb->y = cur->y + 1; - AST_LIST_INSERT_HEAD(&blips, bomb, entry); - } - } - - return 0; -} - -static int move_bombs(void) -{ - struct blip *cur; - - AST_LIST_TRAVERSE(&blips, cur, entry) { - if (cur->type != BLIP_BOMB) - continue; - cur->y++; - if (cur->x == tank->x && cur->y == tank->y) - return 1; - } - - return 0; -} - -static void move_shots(void) -{ - struct blip *cur; - - AST_LIST_TRAVERSE(&blips, cur, entry) { - if (cur->type != BLIP_SHOT) - continue; - cur->y--; - } -} - -static int remove_blip(struct blip *blip) -{ - if (!blip) - return -1; - - AST_LIST_REMOVE(&blips, blip, entry); - - if (blip->type == BLIP_ALIEN) - num_aliens--; - - free(blip); - - return 0; -} - -static void game_over(int win) -{ - clear(); - - wmove(stdscr, max_y / 2, max_x / 2 - 10); - wprintw(stdscr, "Game over! You %s!", win ? "win" : "lose"); - - wmove(stdscr, 0, max_x - 1); - - wrefresh(stdscr); - - sleep(1); - - while (getch() != ' '); - - return; -} - -static int check_shot(struct blip *shot) -{ - struct blip *cur; - - AST_LIST_TRAVERSE(&blips, cur, entry) { - if (cur->type != BLIP_ALIEN) - continue; - if (cur->x == shot->x && cur->y == shot->y) { - score += 20; - remove_blip(shot); - remove_blip(cur); - if (!num_aliens) { - game_over(1); - return 1; - } - } - } - - return 0; -} - -static int check_placement(void) -{ - struct blip *cur; - - AST_LIST_TRAVERSE_SAFE_BEGIN(&blips, cur, entry) { - if (cur->y <= 0 || cur->y >= max_y) { - AST_LIST_REMOVE_CURRENT(&blips, entry); - remove_blip(cur); - } else if (cur->type == BLIP_SHOT && check_shot(cur)) - return 1; - } - AST_LIST_TRAVERSE_SAFE_END - - return 0; -} - -static void play_space(void) -{ - int c; - unsigned int jiffies = 1; - int quit = 0; - struct blip *blip; - - clear(); - nodelay(stdscr, TRUE); - init_blips(); - repaint_screen(); - - for (;;) { - c = getch(); - switch (c) { - case ' ': - tank_shoot(); - break; - case KEY_LEFT: - tank_move_left(); - break; - case KEY_RIGHT: - tank_move_right(); - break; - case 'x': - case 'X': - case 'q': - case 'Q': - quit = 1; - default: - /* ignore unknown input */ - break; - } - if (quit) - break; - if (!(jiffies % 25)) { - if (move_aliens() || move_bombs()) { - game_over(0); - break; - } - if (check_placement()) - break; - } - if (!(jiffies % 10)) { - move_shots(); - if (check_placement()) - break; - } - repaint_screen(); - jiffies++; - usleep(1000); - } - - while ((blip = AST_LIST_REMOVE_HEAD(&blips, entry))) - free(blip); - - nodelay(stdscr, FALSE); -} diff --git a/zaptel/menuselect/menuselect_gtk.c b/zaptel/menuselect/menuselect_gtk.c deleted file mode 100644 index ad6a92c9..00000000 --- a/zaptel/menuselect/menuselect_gtk.c +++ /dev/null @@ -1,351 +0,0 @@ -#include -#include -#include -#include - -#include "menuselect.h" - -enum { - /*! The row name */ - COLUMN_NAME, - /*! Whether this row is enabled */ - COLUMN_SELECTED, - /*! Dependencies */ - COLUMN_DEPS, - /*! Optional dependencies */ - COLUMN_USES, - /*! Conflicts */ - COLUMN_CNFS, - /*! Number of columns, must be the last element in the enum */ - NUM_COLUMNS, -}; - -static void handle_save(GtkWidget *w, gpointer data); -static void handle_about(GtkWidget *w, gpointer data); -static void handle_quit(GtkWidget *w, gpointer data); - -static GtkItemFactoryEntry menu_items[] = { - { "/_File", NULL, NULL, 0, "" }, - { "/File/_Save And Quit", "S", handle_save, 0, "", GTK_STOCK_SAVE }, - { "/File/sep1", NULL, NULL, 0, "" }, - { "/File/_Quit", "Q", handle_quit, 0, "", GTK_STOCK_QUIT }, - { "/_Help", NULL, NULL, 0, "" }, - { "/_Help/About", NULL, handle_about, 0, "" }, -}; - -static gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); - -static GtkTreeView *tree; -static GtkWidget *window; - -/* 0, save ... non-zero, don't save */ -static int main_res = 1; -static int change_made = 0; - -static void handle_save(GtkWidget *w, gpointer data) -{ - main_res = 0; - gtk_main_quit(); -} - -static void handle_about(GtkWidget *w, gpointer data) -{ - GtkWidget *dialog; - - dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, - GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - "GMenuselect - http://www.asterisk.org/\n" - "Russell Bryant \n" - "Copyright (C) 2007\n"); - - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); -} - -static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) -{ - return FALSE; -} - -static void handle_quit(GtkWidget *widget, gpointer data) -{ - gtk_main_quit(); -} - -static void destroy(GtkWidget *widget, gpointer data) -{ - GtkWidget *dialog; - gint response; - - if (!main_res || !change_made) { - gtk_main_quit(); - return; - } - - dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Save before quit?"); - response = gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - if (response == GTK_RESPONSE_YES) - main_res = 0; - - gtk_main_quit(); -} - -static void toggled_handler(GtkCellRendererToggle *renderer, gchar *path, gpointer data) -{ - gchar *cat_num_str, *mem_num_str; - int cat_num, mem_num; - int i = 0; - struct category *cat; - struct member *mem; - GtkTreeStore *store = data; - GtkTreeModel *model; - GtkTreeIter cat_iter, mem_iter; - - mem_num_str = alloca(strlen(path)) + 1; - strcpy(mem_num_str, path); - cat_num_str = strsep(&mem_num_str, ":"); - - if (!mem_num_str || !*mem_num_str) - return; - - cat_num = atoi(cat_num_str); - mem_num = atoi(mem_num_str); - - AST_LIST_TRAVERSE(&categories, cat, list) { - if (i == cat_num) - break; - i++; - } - if (!cat) - return; - - i = 0; - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (i == mem_num) - break; - i++; - } - if (!mem) - return; - - toggle_enabled(mem); - - model = gtk_tree_view_get_model(tree); - - gtk_tree_model_get_iter_first(model, &cat_iter); - for (i = 0; i < cat_num; i++) { - if (!gtk_tree_model_iter_next(model, &cat_iter)) - break; - } - if (i != cat_num) - return; - - if (!gtk_tree_model_iter_children(model, &mem_iter, &cat_iter)) - return; - - for (i = 0; i < mem_num; i++) { - if (!gtk_tree_model_iter_next(model, &mem_iter)) - break; - } - if (i != mem_num) - return; - - gtk_tree_store_set(store, &mem_iter, COLUMN_SELECTED, mem->enabled, -1); - - change_made = 1; -} - -static void row_activated_handler(GtkTreeView *treeview, GtkTreePath *path, - GtkTreeViewColumn *col, gpointer data) -{ - GtkTreeIter iter; - GtkTreeModel *model; - GtkTreeStore *store = data; - gchar *name; - struct category *cat; - struct member *mem; - - model = gtk_tree_view_get_model(treeview); - - if (!gtk_tree_model_get_iter(model, &iter, path)) - return; - - gtk_tree_model_get(model, &iter, COLUMN_NAME, &name, -1); - - AST_LIST_TRAVERSE(&categories, cat, list) { - AST_LIST_TRAVERSE(&cat->members, mem, list) { - if (strcmp(name, mem->name)) - continue; - - toggle_enabled(mem); - gtk_tree_store_set(store, &iter, COLUMN_SELECTED, mem->enabled, -1); - change_made = 1; - break; - } - if (mem) - break; - } - - g_free(name); -} - -static GtkWidget *get_menubar_menu(GtkWidget *window) -{ - GtkItemFactory *item_factory; - GtkAccelGroup *accel_group; - - /* Make an accelerator group (shortcut keys) */ - accel_group = gtk_accel_group_new(); - - /* Make an ItemFactory (that makes a menubar) */ - item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", - accel_group); - - /* This function generates the menu items. Pass the item factory, - the number of items in the array, the array itself, and any - callback data for the the menu items. */ - gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL); - - /* Attach the new accelerator group to the window. */ - gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); - - /* Finally, return the actual menu bar created by the item factory. */ - return gtk_item_factory_get_widget(item_factory, "
"); -} - -int run_menu(void) -{ - int argc = 0; - char **argv = NULL; - GtkWidget *s_window; - GtkCellRenderer *renderer; - GtkTreeViewColumn *column; - GtkTreeStore *store; - struct category *cat; - struct member *mem; - GtkWidget *main_vbox; - GtkWidget *menubar; - - gtk_init(&argc, &argv); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_size_request(window, 640, 480); - gtk_window_set_title(GTK_WINDOW(window), "GMenuselect"); - - main_vbox = gtk_vbox_new(FALSE, 1); - gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1); - gtk_container_add(GTK_CONTAINER(window), main_vbox); - - menubar = get_menubar_menu(window); - gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, FALSE, 0); - - s_window = gtk_scrolled_window_new(NULL, NULL); - - g_signal_connect(G_OBJECT(window), "delete_event", - G_CALLBACK(delete_event), NULL); - g_signal_connect(G_OBJECT(window), "destroy", - G_CALLBACK(destroy), NULL); - - store = gtk_tree_store_new(NUM_COLUMNS, - G_TYPE_STRING, /* COLUMN_NAME */ - G_TYPE_BOOLEAN, /* COLUMN_SELECTED */ - G_TYPE_STRING, /* COLUMN_DEPS */ - G_TYPE_STRING, /* COLUMN_USES */ - G_TYPE_STRING); /* COLUMN_CNFS */ - - AST_LIST_TRAVERSE(&categories, cat, list) { - GtkTreeIter iter, iter2; - gtk_tree_store_append(store, &iter, NULL); - gtk_tree_store_set(store, &iter, - COLUMN_NAME, cat->name, - COLUMN_SELECTED, TRUE, - -1); - AST_LIST_TRAVERSE(&cat->members, mem, list) { - char name_buf[64]; - char dep_buf[64] = ""; - char use_buf[64] = ""; - char cnf_buf[64] = ""; - struct depend *dep; - struct use *use; - struct conflict *cnf; - - AST_LIST_TRAVERSE(&mem->deps, dep, list) { - strncat(dep_buf, dep->name, sizeof(dep_buf) - strlen(dep_buf) - 1); - strncat(dep_buf, dep->member ? "(M)" : "(E)", sizeof(dep_buf) - strlen(dep_buf) - 1); - if (AST_LIST_NEXT(dep, list)) - strncat(dep_buf, ", ", sizeof(dep_buf) - strlen(dep_buf) - 1); - } - AST_LIST_TRAVERSE(&mem->uses, use, list) { - strncat(use_buf, use->name, sizeof(use_buf) - strlen(use_buf) - 1); - if (AST_LIST_NEXT(use, list)) - strncat(use_buf, ", ", sizeof(use_buf) - strlen(use_buf) - 1); - } - AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { - strncat(cnf_buf, cnf->name, sizeof(cnf_buf) - strlen(cnf_buf) - 1); - strncat(cnf_buf, cnf->member ? "(M)" : "(E)", sizeof(cnf_buf) - strlen(cnf_buf) - 1); - if (AST_LIST_NEXT(cnf, list)) - strncat(cnf_buf, ", ", sizeof(cnf_buf) - strlen(cnf_buf) - 1); - } - - snprintf(name_buf, sizeof(name_buf), "%s", mem->name); - if (mem->depsfailed == HARD_FAILURE) - strncat(name_buf, " (Failed Deps.)", sizeof(name_buf) - strlen(name_buf) - 1); - if (mem->conflictsfailed == HARD_FAILURE) - strncat(name_buf, " (In Conflict)", sizeof(name_buf) - strlen(name_buf) - 1); - - gtk_tree_store_append(store, &iter2, &iter); - gtk_tree_store_set(store, &iter2, - COLUMN_NAME, name_buf, - COLUMN_SELECTED, mem->enabled, - COLUMN_DEPS, dep_buf, - COLUMN_USES, use_buf, - COLUMN_CNFS, cnf_buf, - -1); - } - } - - tree = (GtkTreeView *) gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); - gtk_tree_view_set_enable_tree_lines(tree, TRUE); - gtk_tree_view_set_grid_lines(tree, GTK_TREE_VIEW_GRID_LINES_BOTH); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Name", - renderer, "text", COLUMN_NAME, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); - - renderer = gtk_cell_renderer_toggle_new(); - column = gtk_tree_view_column_new_with_attributes("Selected", - renderer, "active", COLUMN_SELECTED, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); - g_signal_connect(renderer, "toggled", (GCallback) toggled_handler, store); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Depends On", - renderer, "text", COLUMN_DEPS, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Can Use", - renderer, "text", COLUMN_USES, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); - - renderer = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes("Conflicts With", - renderer, "text", COLUMN_CNFS, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); - - g_signal_connect(tree, "row-activated", (GCallback) row_activated_handler, store); - - gtk_container_add(GTK_CONTAINER(s_window), GTK_WIDGET(tree)); - - gtk_box_pack_end(GTK_BOX(main_vbox), s_window, TRUE, TRUE, 0); - - gtk_widget_show_all(window); - - gtk_main(); - - return main_res; -} diff --git a/zaptel/menuselect/menuselect_stub.c b/zaptel/menuselect/menuselect_stub.c deleted file mode 100644 index 8d91c44d..00000000 --- a/zaptel/menuselect/menuselect_stub.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Asterisk -- An open source telephony toolkit. - * - * Copyright (C) 2005 - 2006, Russell Bryant - * - * Russell Bryant - * - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2. See the LICENSE file - * at the top of the source tree. - */ - -/* - * \file - * - * \author Russell Bryant - * - * \brief Menu stub - */ - -#include -#include - -#include "menuselect.h" - -int run_menu(void) -{ - fprintf(stderr, "**************************************************\n"); - fprintf(stderr, "*** Install ncurses to use the menu interface! ***\n"); - fprintf(stderr, "**************************************************\n"); - - return -1; -} diff --git a/zaptel/menuselect/missing b/zaptel/menuselect/missing deleted file mode 100755 index 894e786e..00000000 --- a/zaptel/menuselect/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-06-08.21 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/zaptel/menuselect/mxml/ANNOUNCEMENT b/zaptel/menuselect/mxml/ANNOUNCEMENT deleted file mode 100644 index 7b49102d..00000000 --- a/zaptel/menuselect/mxml/ANNOUNCEMENT +++ /dev/null @@ -1,5 +0,0 @@ -Mini-XML 2.2.2 is now available for download from: - - http://www.easysw.com/~mike/mxml/software.php - -Mini-XML 2.2.2 fixes a bug in the reading of custom data nodes. diff --git a/zaptel/menuselect/mxml/CHANGES b/zaptel/menuselect/mxml/CHANGES deleted file mode 100644 index fd92104f..00000000 --- a/zaptel/menuselect/mxml/CHANGES +++ /dev/null @@ -1,213 +0,0 @@ -CHANGES - 05/19/2005 --------------------- - -CHANGES IN Mini-XML 2.2.2 - - - mxmlLoad*() did not treat custom data as opaque, so - whitespace characters would be lost. - - -CHANGES IN Mini-XML 2.2.1 - - - mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now - correctly return NULL on error (STR #21) - - mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), - mxmlNewText(), and mxmlNewTextf() incorrectly required - a parent node (STR #22) - - Fixed an XML output bug in mxmldoc. - - The "make install" target now uses the install command - to set the proper permissions on UNIX/Linux/OSX. - - Fixed a MingW/Cygwin compilation problem (STR #18) - - -CHANGES IN Mini-XML 2.2 - - - Added shared library support (STR #17) - - mxmlLoad*() now returns an error when an XML stream - contains illegal control characters (STR #10) - - mxmlLoad*() now returns an error when an element - contains two attributes with the same name in - conformance with the XML spec (STR #16) - - Added support for CDATA (STR #14, STR #15) - - Updated comment and processing instruction handling - - no entity support per XML specification. - - Added checking for invalid comment termination ("--->" - is not allowed) - - -CHANGES IN Mini-XML 2.1 - - - Added support for custom data nodes (STR #6) - - Now treat UTF-8 sequences which are longer than - necessary as an error (STR #4) - - Fixed entity number support (STR #8) - - Fixed mxmlLoadString() bug with UTF-8 (STR #7) - - Fixed entity lookup bug (STR #5) - - Added mxmlLoadFd() and mxmlSaveFd() functions. - - Fixed multi-word UTF-16 handling. - - -CHANGES IN Mini-XML 2.0 - - - New programmers manual. - - Added Visual C++ project files for Microsoft Windows - users. - - Added optimizations to mxmldoc, mxmlSaveFile(), and - mxmlIndexNew() (STR #2) - - mxmlEntityAddCallback() now returns an integer status - (STR #2) - - Added UTF-16 support (input only; all output is UTF-8) - - Added index functions to build a searchable index of - XML nodes. - - Added character entity callback interface to support - additional character entities beyond those defined in - the XHTML specification. - - Added support for XHTML character entities. - - The mxmldoc utility now produces XML output which - conforms to an updated XML schema, described in the file - "doc/mxmldoc.xsd". - - Changed the whitespace callback interface to return - strings instead of a single character, allowing for - greater control over the formatting of XML files - written using Mini-XML. THIS CHANGE WILL REQUIRE - CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE - CALLBACKS. - - The mxmldoc utility is now capable of documenting C++ - classes, functions, and structures, and correctly - handles C++ comments. - - Added new modular tests for mxmldoc. - - Updated the mxmldoc output to be more compatible with - embedding in manuals produced with HTMLDOC. - - The makefile incorrectly included a "/" separator - between the destination path and install path. This - caused problems when building and installing with - MingW. - - -CHANGES IN Mini-XML 1.3 - - - Fixes for mxmldoc. - - Added support for reading standard HTML entity names. - - mxmlLoadString/File() did not decode character - entities in element names, attribute names, or - attribute values. - - mxmlLoadString/File() would crash when loading non- - conformant XML data under an existing parent (top) - node. - - Fixed several bugs in the mxmldoc utility. - - Added new error callback function to catch a variety - of errors and log them to someplace other than stderr. - - The mxmlElementSetAttr() function now allows for NULL - attribute values. - - The load and save functions now properly handle quoted - element and attribute name strings properly, e.g. for - !DOCTYPE declarations. - - -CHANGES IN Mini-XML 1.2 - - - Added new "set" methods to set the value of a node. - - Added new formatted text methods mxmlNewTextf() and - mxmlSetTextf() to create/set a text node value using - printf-style formats. - - Added new standard callbacks for use with the mxmlLoad - functions. - - Updated the HTML documentation to include examples of - the walk and load function output. - - Added --with/without-ansi configure option to control - the strdup() function check. - - Added --with/without-snprintf configure option to - control the snprintf() and vsnprintf() function - checks. - - -CHANGES IN Mini-XML 1.1.2 - - - The mxml(3) man page wasn't updated for the string - functions. - - mxmlSaveString() returned the wrong number of - characters. - - mxml_add_char() updated the buffer pointer in the - wrong place. - - -CHANGES IN Mini-XML 1.1.1 - - - The private mxml_add_ch() function did not update the - start-of-buffer pointer which could cause a crash when - using mxmlSaveString(). - - The private mxml_write_ws() function called putc() - instead of using the proper callback which could cause - a crash when using mxmlSaveString(). - - Added a mxmlSaveAllocString() convenience function for - saving an XML node tree to an allocated string. - - -CHANGES IN Mini-XML 1.1 - - - The mxmlLoadFile() function now uses dynamically - allocated string buffers for element names, attribute - names, and attribute values. Previously they were - capped at 16383, 255, and 255 bytes, respectively. - - Added a new mxmlLoadString() function for loading an - XML node tree from a string. - - Added a new mxmlSaveString() function for saving an - XML node tree to a string. - - Add emulation of strdup() if the local platform does - not provide the function. - - -CHANGES IN Mini-XML 1.0 - - - The mxmldoc program now handles function arguments, - structures, unions, enumerations, classes, and - typedefs properly. - - Documentation provided via mxmldoc and more in-line - comments in the code. - - Added man pages and packaging files. - - -CHANGES IN Mini-XML 0.93 - - - New mxmldoc example program that is also used to - create and update code documentation using XML and - produce HTML reference pages. - - Added mxmlAdd() and mxmlRemove() functions to add and - remove nodes from a tree. This provides more - flexibility over where the nodes are inserted and - allows nodes to be moved within the tree as needed. - - mxmlLoadFile() now correctly handles comments. - - mxmlLoadFile() now supports the required "gt", "quot", - and "nbsp" character entities. - - mxmlSaveFile() now uses newlines as whitespace - when valid to do so. - - mxmlFindElement() now also takes attribute name and - attribute value string arguments to limit the search - to specific elements with attributes and/or values. - NULL pointers can be used as "wildcards". - - Added uninstall target to makefile, and auto-reconfig - if Makefile.in or configure.in are changed. - - mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() - now all provide "descend" arguments to control whether - they descend into child nodes in the tree. - - Fixed some whitespace issues in mxmlLoadFile(). - - Fixed Unicode output and whitespace issues in - mxmlSaveFile(). - - mxmlSaveFile() now supports a whitespace callback to - provide more human-readable XML output under program - control. - - -CHANGES IN Mini-XML 0.92 - - - mxmlSaveFile() didn't return a value on success. - - -CHANGES IN Mini-XML 0.91 - - - mxmlWalkNext() would go into an infinite loop. - - -CHANGES IN Mini-XML 0.9 - - - Initial public release. diff --git a/zaptel/menuselect/mxml/COPYING b/zaptel/menuselect/mxml/COPYING deleted file mode 100644 index 43433c49..00000000 --- a/zaptel/menuselect/mxml/COPYING +++ /dev/null @@ -1,482 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - [This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/zaptel/menuselect/mxml/Makefile.in b/zaptel/menuselect/mxml/Makefile.in deleted file mode 100644 index 9ae70465..00000000 --- a/zaptel/menuselect/mxml/Makefile.in +++ /dev/null @@ -1,353 +0,0 @@ -# -# "$Id: Makefile.in 23382 2006-04-29 15:44:02Z russell $" -# -# Makefile for Mini-XML, a small XML-like file parsing library. -# -# Copyright 2003-2005 by Michael Sweet. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# - -# -# Compiler tools definitions... -# - -AR = @AR@ -ARFLAGS = @ARFLAGS@ -CC = @CC@ -CFLAGS = $(OPTIM) @CFLAGS@ @CPPFLAGS@ -CP = @CP@ -DSO = @DSO@ -DSOFLAGS = @DSOFLAGS@ -LDFLAGS = $(OPTIM) @LDFLAGS@ -INSTALL = @INSTALL@ -LIBMXML = @LIBMXML@ -LN = @LN@ -s -MKDIR = @MKDIR@ -NROFF = @NROFF@ -OPTIM = @OPTIM@ -RANLIB = @RANLIB@ -RM = @RM@ -f -SHELL = /bin/sh - - -# -# Configured directories... -# - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -includedir = @includedir@ -libdir = @libdir@ -mandir = @mandir@ -docdir = @docdir@ -BUILDROOT = $(DSTROOT) - - -# -# Manpage extensions... -# - -CAT1EXT = @CAT1EXT@ -CAT3EXT = @CAT3EXT@ -MAN1EXT = @MAN1EXT@ -MAN3EXT = @MAN3EXT@ - - -# -# Install commands... -# - -INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 -s -INSTALL_DATA = $(INSTALL) -m 644 -INSTALL_DIR = $(INSTALL) -d -INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755 -INSTALL_MAN = $(INSTALL) -m 644 -INSTALL_SCRIPT = $(INSTALL) -m 755 - - -# -# Rules... -# - -.SUFFIXES: .0 .1 .3 .c .man .o -.c.o: - $(CC) $(CFLAGS) -c $< -.man.0 .man.1 .man.3: - $(RM) $@ - $(NROFF) -man $< >$@ - - -# -# Targets... -# - -DOCFILES = doc/mxml.html doc/mxmldoc.xsd \ - README COPYING CHANGES -PUBLIBOBJS = mxml-attr.o mxml-entity.o mxml-file.o mxml-index.o \ - mxml-node.o mxml-search.o mxml-set.o -LIBOBJS = $(PUBLIBOBJS) mxml-private.o mxml-string.o -OBJS = mxmldoc.o testmxml.o $(LIBOBJS) -TARGETS = $(LIBMXML) mxmldoc doc/mxml.$(CAT3EXT) \ - doc/mxmldoc.$(CAT1EXT) testmxml mxml.xml - - -# -# Make everything... -# - -all: Makefile configure config.h $(TARGETS) - - -# -# Clean everything... -# - -clean: - $(RM) $(OBJS) $(TARGETS) - $(RM) mxmldoc-static libmxml.a - $(RM) *.bck *.bak - $(RM) config.cache config.log config.status config.h - $(RM) -r autom4te*.cache - -distclean: clean - $(RM) mxml.list Makefile - -# -# Install everything... -# - -install: $(TARGETS) install-$(LIBMXML) install-libmxml.a - $(INSTALL_DIR) $(BUILDROOT)$(bindir) - $(INSTALL_BIN) mxmldoc $(BUILDROOT)$(bindir) - $(INSTALL_DIR) $(BUILDROOT)$(docdir) - for file in $(DOCFILES); do \ - $(INSTALL_MAN) $$file $(BUILDROOT)$(docdir); \ - done - $(INSTALL_DIR) $(BUILDROOT)$(includedir) - $(INSTALL_DATA) mxml.h $(BUILDROOT)$(includedir) - $(INSTALL_DIR) $(BUILDROOT)$(libdir)/pkgconfig - $(INSTALL_DATA) mxml.pc $(BUILDROOT)$(libdir)/pkgconfig - $(INSTALL_DIR) $(BUILDROOT)$(mandir)/cat1 - $(INSTALL_MAN) doc/mxmldoc.$(CAT1EXT) $(BUILDROOT)$(mandir)/cat1/mxmldoc.$(CAT1EXT) - $(INSTALL_DIR) $(BUILDROOT)$(mandir)/cat3 - $(INSTALL_MAN) doc/mxml.$(CAT3EXT) $(BUILDROOT)$(mandir)/cat3/mxml.$(CAT3EXT) - $(INSTALL_DIR) $(BUILDROOT)$(mandir)/man1 - $(INSTALL_MAN) doc/mxmldoc.man $(BUILDROOT)$(mandir)/man1/mxmldoc.$(MAN1EXT) - $(INSTALL_DIR) $(BUILDROOT)$(mandir)/man3 - $(INSTALL_MAN) doc/mxml.man $(BUILDROOT)$(mandir)/man3/mxml.$(MAN3EXT) - -install-libmxml.a: - $(INSTALL_DIR) $(BUILDROOT)$(libdir) - $(INSTALL_LIB) libmxml.a $(BUILDROOT)$(libdir) - -install-libmxml.so.1.0: - $(INSTALL_DIR) $(BUILDROOT)$(libdir) - $(INSTALL_LIB) libmxml.so.1.0 $(BUILDROOT)$(libdir) - $(RM) $(BUILDROOT)$(libdir)/libmxml.so - $(LN) libmxml.so.1.0 $(BUILDROOT)$(libdir)/libmxml.so - $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1 - $(LN) libmxml.so.1.0 $(BUILDROOT)$(libdir)/libmxml.so.1 - -install-libmxml.sl.1: - $(INSTALL_DIR) $(BUILDROOT)$(libdir) - $(INSTALL_LIB) libmxml.sl.1 $(BUILDROOT)$(libdir) - $(RM) $(BUILDROOT)$(libdir)/libmxml.so - $(LN) libmxml.sl.1 $(BUILDROOT)$(libdir)/libmxml.sl - -install-libmxml.1.dylib: - $(INSTALL_DIR) $(BUILDROOT)$(libdir) - $(INSTALL_LIB) libmxml.1.dylib $(BUILDROOT)$(libdir) - $(RM) $(BUILDROOT)$(libdir)/libmxml.dylib - $(LN) libmxml.1.dylib $(BUILDROOT)$(libdir)/libmxml.dylib - - -# -# Uninstall everything... -# - -uninstall: uninstall-$(LIBMXML) uninstall-libmxml.a - $(RM) $(BUILDROOT)$(bindir)/mxmldoc - $(RM) -r $(BUILDROOT)$(docdir) - $(RM) $(BUILDROOT)$(includedir)/mxml.h - $(RM) $(BUILDROOT)$(libdir)/pkgconfig/mxml.pc - $(RM) $(BUILDROOT)$(mandir)/cat1/mxmldoc.$(CAT1EXT) - $(RM) $(BUILDROOT)$(mandir)/cat3/mxml.$(CAT3EXT) - $(RM) $(BUILDROOT)$(mandir)/man1/mxmldoc.$(MAN1EXT) - $(RM) $(BUILDROOT)$(mandir)/man3/mxml.$(MAN3EXT) - -uninstall-libmxml.a: - $(RM) $(BUILDROOT)$(libdir)/libmxml.a - -uninstall-libmxml.so.1.0: - $(RM) $(BUILDROOT)$(libdir)/libmxml.so - $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1 - $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1.0 - -uninstall-libmxml.sl.1: - $(RM) $(BUILDROOT)$(libdir)/libmxml.sl - $(RM) $(BUILDROOT)$(libdir)/libmxml.sl.1 - -uninstall-libmxml.1.dylib: - $(RM) $(BUILDROOT)$(libdir)/libmxml.dylib - $(RM) $(BUILDROOT)$(libdir)/libmxml.1.dylib - - -# -# Make packages using EPM (http://www.easysw.com/epm/) -# - -epm: all - epm --output-dir dist -v -f native mxml - epm --output-dir dist -v -f portable mxml - - -# -# autoconf stuff... -# - -Makefile: Makefile.in - if test -f config.status; then \ - ./config.status --recheck; \ - ./config.status; \ - else \ - ./configure; \ - fi - touch config.h - - -config.h: configure config.h.in - if test -f config.status; then \ - ./config.status --recheck; \ - ./config.status; \ - else \ - ./configure; \ - fi - touch config.h - - -# -# libmxml.a -# - -libmxml.a: $(LIBOBJS) - $(RM) $@ - $(AR) $(ARFLAGS) $@ $(LIBOBJS) - $(RANLIB) $@ - -$(LIBOBJS): mxml.h - - -# -# libmxml.so.1.0 -# - -libmxml.so.1.0: $(LIBOBJS) - $(DSO) $(DSOFLAGS) -o libmxml.so.1.0 $(LIBOBJS) - $(RM) libmxml.so libmxml.so.1 - $(LN) libmxml.so.1.0 libmxml.so - $(LN) libmxml.so.1.0 libmxml.so.1 - - -# -# libmxml.sl.1 -# - -libmxml.sl.1: $(LIBOBJS) - $(DSO) $(DSOFLAGS) -o libmxml.sl.1 $(LIBOBJS) - $(RM) libmxml.sl libmxml.sl.1 - $(LN) libmxml.sl.1 libmxml.sl - - -# -# libmxml.1.dylib -# - -libmxml.1.dylib: $(LIBOBJS) - $(DSO) $(DSOFLAGS) -o libmxml.1.dylib \ - -install_name $(libdir)/libmxml.dylib \ - -current_version 1.0.0 \ - -compatibility_version 1.0.0 \ - $(LIBOBJS) - $(RM) libmxml.dylib libmxml.1.dylib - $(LN) libmxml.1.dylib libmxml.dylib - - -# -# mxmldoc -# - -mxmldoc: $(LIBMXML) mxmldoc.o - $(CC) $(LDFLAGS) -o $@ mxmldoc.o -L. -lmxml - -mxmldoc-static: libmxml.a mxmldoc.o - $(CC) $(LDFLAGS) -o $@ mxmldoc.o libmxml.a - -mxmldoc.o: mxml.h - - -# -# testmxml -# - -testmxml: libmxml.a testmxml.o - $(CC) $(LDFLAGS) -o $@ testmxml.o libmxml.a - @echo Testing library... - ./testmxml test.xml >temp1.xml 2>temp1s.xml - ./testmxml temp1.xml >temp2.xml 2>temp2s.xml - @if cmp temp1.xml temp2.xml; then \ - echo Stdio file test passed!; \ - $(RM) temp2.xml temp2s.xml; \ - else \ - echo Stdio file test failed!; \ - fi - @if cmp temp1.xml temp1s.xml; then \ - echo String test passed!; \ - $(RM) temp1.xml temp1s.xml; \ - else \ - echo String test failed!; \ - fi - @if cmp test.xml test.xmlfd; then \ - echo File descriptor test passed!; \ - $(RM) test.xmlfd; \ - else \ - echo File descriptor test failed!; \ - fi - -testmxml.o: mxml.h - - -# -# mxml.xml -# - -mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c) - $(RM) mxml.xml - ./mxmldoc-static mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html - -valgrind: mxmldoc-static - $(RM) valgrind.xml - valgrind --tool=memcheck --leak-check=yes ./mxmldoc-static \ - valgrind.xml mxml.h $(PUBLIBOBJS:.o=.c) \ - >valgrind.html 2>valgrind.out - - -# -# All object files depend on the makefile... -# - -$(OBJS): Makefile config.h - - -# -# End of "$Id: Makefile.in 23382 2006-04-29 15:44:02Z russell $". -# diff --git a/zaptel/menuselect/mxml/README b/zaptel/menuselect/mxml/README deleted file mode 100644 index 31a02664..00000000 --- a/zaptel/menuselect/mxml/README +++ /dev/null @@ -1,204 +0,0 @@ -README - 05/19/2005 -------------------- - - -INTRODUCTION - - This README file describes the Mini-XML library version - 2.2.2. - - Mini-XML is a small XML parsing library that you can use to - read XML and XML-like data files in your application without - requiring large non-standard libraries. Mini-XML only - requires an ANSI C compatible compiler (GCC works, as do - most vendors' ANSI C compilers) and a "make" program. - - Mini-XML provides the following functionality: - - - Reading of UTF-8 and UTF-16 and writing of UTF-8 - encoded XML files and strings. - - Data is stored in a linked-list tree structure, - preserving the XML data hierarchy. - - Supports arbitrary element names, attributes, and - attribute values with no preset limits, just available - memory. - - Supports integer, real, opaque ("cdata"), and text - data types in "leaf" nodes. - - Functions for creating and managing trees of data. - - "Find" and "walk" functions for easily locating and - navigating trees of data. - - Mini-XML doesn't do validation or other types of processing - on the data based upon schema files or other sources of - definition information. - - -BUILDING Mini-XML - - Mini-XML comes with an autoconf-based configure script; just - type the following command to get things going: - - ./configure - - The default install prefix is /usr/local, which can be - overridden using the --prefix option: - - ./configure --prefix=/foo - - Other configure options can be found using the --help - option: - - ./configure --help - - Once you have configured the software, type "make" to do the - build and run the test program to verify that things are - working, as follows: - - make - - If you are using Mini-XML under Microsoft Windows with - Visual C++, use the included project files in the "vcnet" - subdirectory to build the library instead. - - -INSTALLING Mini-XML - - The "install" target will install Mini-XML in the lib and - include directories: - - make install - - Once you have installed it, use the "-lmxml" option to link - your application against it. - - -DOCUMENTATION - - The documentation is available in the "doc" subdirectory in - the files "mxml.html" (HTML) and "mxml.pdf" (PDF). You can - also look at the "testmxml.c" and "mxmldoc.c" source files - for examples of using Mini-XML. - - Mini-XML provides a single header file which you include: - - #include - - Nodes are defined by the "mxml_node_t" structure; the "type" - member defines the node type (element, integer, opaque, - real, or text) which determines which value you want to look - at in the "value" union. New nodes can be created using the - "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", - "mxmlNewReal()", and "mxmlNewText()" functions. Only - elements can have child nodes, and the top node must be an - element, usually "?xml". - - You load an XML file using the "mxmlLoadFile()" function: - - FILE *fp; - mxml_node_t *tree; - - fp = fopen("filename.xml", "r"); - tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK); - fclose(fp); - - Similarly, you save an XML file using the "mxmlSaveFile()" - function: - - FILE *fp; - mxml_node_t *tree; - - fp = fopen("filename.xml", "w"); - mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); - fclose(fp); - - The "mxmlLoadString()", "mxmlSaveAllocString()", and - "mxmlSaveString()" functions load XML node trees from and - save XML node trees to strings: - - char buffer[8192]; - char *ptr; - mxml_node_t *tree; - - ... - tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK); - - ... - mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK); - - ... - ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); - - You can find a named element/node using the - "mxmlFindElement()" function: - - mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr", - "value", MXML_DESCEND); - - The "name", "attr", and "value" arguments can be passed as - NULL to act as wildcards, e.g.: - - /* Find the first "a" element */ - node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND); - - /* Find the first "a" element with "href" attribute */ - node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND); - - /* Find the first "a" element with "href" to a URL */ - node = mxmlFindElement(tree, tree, "a", "href", - "http://www.easysw.com/~mike/mxml/", - MXML_DESCEND); - - /* Find the first element with a "src" attribute*/ - node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND); - - /* Find the first element with a "src" = "foo.jpg" */ - node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg", - MXML_DESCEND); - - You can also iterate with the same function: - - mxml_node_t *node; - - for (node = mxmlFindElement(tree, tree, "name", NULL, NULL, - MXML_DESCEND); - node != NULL; - node = mxmlFindElement(node, tree, "name", NULL, NULL, - MXML_DESCEND)) - { - ... do something ... - } - - Finally, once you are done with the XML data, use the - "mxmlDelete()" function to recursively free the memory that - is used for a particular node or the entire tree: - - mxmlDelete(tree); - - -GETTING HELP AND REPORTING PROBLEMS - - You can email me at "mxml@easysw.com" to report problems - and/or ask for help. Just don't expect an instant response, - as I get a *lot* of email... - - -LEGAL STUFF - - The Mini-XML library is Copyright 2003-2005 by Michael Sweet. - - This library is free software; you can redistribute it - and/or modify it under the terms of the GNU Library General - Public License as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any - later version. - - This library is distributed in the hope that it will be - useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU Library General Public License for - more details. - - You should have received a copy of the GNU Library General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA - 02139, USA. diff --git a/zaptel/menuselect/mxml/config.h.in b/zaptel/menuselect/mxml/config.h.in deleted file mode 100644 index 9008e23a..00000000 --- a/zaptel/menuselect/mxml/config.h.in +++ /dev/null @@ -1,69 +0,0 @@ -/* - * "$Id: config.h.in 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Configuration file for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* - * Include necessary headers... - */ - -#include -#include -#include -#include -#include - - -/* - * Version number... - */ - -#define MXML_VERSION "" - - -/* - * Do we have the vsnprintf() function? - */ - -#undef HAVE_VSNPRINTF - - -/* - * Do we have the strXXX() functions? - */ - -#undef HAVE_STRDUP - - -/* - * Define prototypes for string functions as needed... - */ - -# ifndef HAVE_STRDUP -extern char *mxml_strdup(const char *); -# define strdup mxml_strdup -# endif /* !HAVE_STRDUP */ - -extern char *mxml_strdupf(const char *, va_list); - -# ifndef HAVE_VSNPRINTF -extern int mxml_vsnprintf(char *, size_t, const char *, va_list); -# define vsnprintf mxml_vsnprintf -# endif /* !HAVE_VSNPRINTF */ - -/* - * End of "$Id: config.h.in 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/configure b/zaptel/menuselect/mxml/configure deleted file mode 100755 index 3a725707..00000000 --- a/zaptel/menuselect/mxml/configure +++ /dev/null @@ -1,4620 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. -# -# Copyright (C) 2003 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="mxml.h" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION LDFLAGS OPTIM docdir CC CFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB AR CP LN MKDIR NROFF GROFF RM ARFLAGS DSO DSOFLAGS LIBMXML PICFLAG CAT1EXT CAT3EXT MAN1EXT MAN3EXT PC_CFLAGS PC_LIBS LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-debug turn on debugging, default=no - --enable-shared turn on shared libraries, default=no - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-ansi set full ANSI C mode, default=no - --with-docdir set directory for documentation, default=${prefix}/share/doc/mxml - --with-vsnprintf use vsnprintf emulation functions, default=auto - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright (C) 2003 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers config.h" - - -VERSION=2.2.2 - -cat >>confdefs.h <<_ACEOF -#define MXML_VERSION "Mini-XML v$VERSION" -_ACEOF - - -CFLAGS="${CFLAGS:=}" -CXXFLAGS="${CXXFLAGS:=}" -LDFLAGS="${LDFLAGS:=}" - -OPTIM="-O" - - - -# Check whether --with-ansi or --without-ansi was given. -if test "${with_ansi+set}" = set; then - withval="$with_ansi" - use_ansi="$withval" -else - use_ansi="no" -fi; - -# Check whether --enable-debug or --disable-debug was given. -if test "${enable_debug+set}" = set; then - enableval="$enable_debug" - if eval "test x$enable_debug = xyes"; then - OPTIM="-g" -else - LDFLAGS="$LDFLAGS -s" -fi -fi; - - -# Check whether --with-docdir or --without-docdir was given. -if test "${with_docdir+set}" = set; then - withval="$with_docdir" - docdir="$withval" -else - docdir="NONE" -fi; - - - - -# Check whether --with-vsnprintf or --without-vsnprintf was given. -if test "${with_vsnprintf+set}" = set; then - withval="$with_vsnprintf" - use_vsnprintf="$withval" -else - use_vsnprintf="no" -fi; - -uname=`uname` -uversion=`uname -r | sed -e '1,$s/[^0-9]//g'` -if test x$uname = xIRIX64; then - uname="IRIX" -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -if test "$INSTALL" = "$ac_install_sh"; then - # Use full path to install-sh script... - INSTALL="`pwd`/install-sh -c" -fi -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -# Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $AR in - [\\/]* | ?:[\\/]*) - ac_cv_path_AR="$AR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -AR=$ac_cv_path_AR - -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -# Extract the first word of "cp", so it can be a program name with args. -set dummy cp; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_CP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $CP in - [\\/]* | ?:[\\/]*) - ac_cv_path_CP="$CP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -CP=$ac_cv_path_CP - -if test -n "$CP"; then - echo "$as_me:$LINENO: result: $CP" >&5 -echo "${ECHO_T}$CP" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -# Extract the first word of "ln", so it can be a program name with args. -set dummy ln; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_LN+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $LN in - [\\/]* | ?:[\\/]*) - ac_cv_path_LN="$LN" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -LN=$ac_cv_path_LN - -if test -n "$LN"; then - echo "$as_me:$LINENO: result: $LN" >&5 -echo "${ECHO_T}$LN" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -# Extract the first word of "mkdir", so it can be a program name with args. -set dummy mkdir; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_MKDIR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MKDIR in - [\\/]* | ?:[\\/]*) - ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -MKDIR=$ac_cv_path_MKDIR - -if test -n "$MKDIR"; then - echo "$as_me:$LINENO: result: $MKDIR" >&5 -echo "${ECHO_T}$MKDIR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -# Extract the first word of "nroff", so it can be a program name with args. -set dummy nroff; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_NROFF+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $NROFF in - [\\/]* | ?:[\\/]*) - ac_cv_path_NROFF="$NROFF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -NROFF=$ac_cv_path_NROFF - -if test -n "$NROFF"; then - echo "$as_me:$LINENO: result: $NROFF" >&5 -echo "${ECHO_T}$NROFF" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test x$NROFF = x; then - # Extract the first word of "groff", so it can be a program name with args. -set dummy groff; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_GROFF+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $GROFF in - [\\/]* | ?:[\\/]*) - ac_cv_path_GROFF="$GROFF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -GROFF=$ac_cv_path_GROFF - -if test -n "$GROFF"; then - echo "$as_me:$LINENO: result: $GROFF" >&5 -echo "${ECHO_T}$GROFF" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - if test x$GROFF = x; then - NROFF="echo" - else - NROFF="$GROFF -T ascii" - fi -fi -# Extract the first word of "rm", so it can be a program name with args. -set dummy rm; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_RM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $RM in - [\\/]* | ?:[\\/]*) - ac_cv_path_RM="$RM" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -RM=$ac_cv_path_RM - -if test -n "$RM"; then - echo "$as_me:$LINENO: result: $RM" >&5 -echo "${ECHO_T}$RM" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - -case "$uname" in - Darwin* | *BSD*) - ARFLAGS="-rcv" - ;; - *) - ARFLAGS="crvs" - ;; -esac - - - -if test "x$use_ansi" != xyes; then - - -for ac_func in strdup -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -fi - -if test "x$use_vsnprintf" != xyes; then - -for ac_func in vsnprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -fi - -DSO="${DSO:=:}" -DSOFLAGS="${DSOFLAGS:=}" - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - -fi; - -if test x$enable_shared = xyes; then - echo "$as_me:$LINENO: checking for shared library support" >&5 -echo $ECHO_N "checking for shared library support... $ECHO_C" >&6 - PICFLAG=1 - - case "$uname" in - SunOS* | UNIX_S*) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBMXML="libmxml.so.1.0" - DSO="\$(CC)" - DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)" - LDFLAGS="$LDFLAGS -R\$(libdir)" - ;; - - HP-UX*) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBMXML="libmxml.sl.1" - DSO="ld" - DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)" - LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)" - ;; - - IRIX) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBMXML="libmxml.so.1.0" - DSO="\$(CC)" - DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)" - ;; - - OSF1* | Linux | GNU) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBMXML="libmxml.so.1.0" - DSO="\$(CC)" - DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)" - LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)" - ;; - - *BSD*) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBMXML="libmxml.so.1.0" - DSO="\$(CC)" - DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)" - LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)" - ;; - - Darwin*) - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBMXML="libmxml.1.dylib" - DSO="\$(CC)" - DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc" - ;; - - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - { echo "$as_me:$LINENO: WARNING: shared libraries not supported on this platform." >&5 -echo "$as_me: WARNING: shared libraries not supported on this platform." >&2;} - PICFLAG=0 - LIBMXML="libmxml.a" - ;; - esac -else - PICFLAG=0 - LIBMXML="libmxml.a" -fi - - - - - - -if test -n "$GCC"; then - CFLAGS="-Wall $CFLAGS" - - if test "x$use_ansi" = xyes; then - CFLAGS="-ansi -pedantic $CFLAGS" - fi - - if test $PICFLAG = 1 -a $uname != AIX; then - OPTIM="-fPIC $OPTIM" - fi -else - case $uname in - HP-UX*) - CFLAGS="-Ae $CFLAGS" - OPTIM="+DAportable $OPTIM" - - if test $PICFLAG = 1; then - OPTIM="+z $OPTIM" - fi - ;; - - UNIX_SVR* | SunOS*) - if test $PICFLAG = 1; then - OPTIM="-KPIC $OPTIM" - fi - ;; - esac -fi - -if test "$prefix" = "NONE"; then - prefix="/usr/local" -fi - -if test "$exec_prefix" = "NONE"; then - exec_prefix="$prefix" -fi - -if test "$docdir" = "NONE"; then - docdir="$datadir/doc/mxml" -fi - -if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then - case "$uname" in - *BSD* | Darwin* | Linux*) - # BSD, Darwin (MacOS X), and Linux - mandir="/usr/share/man" - ;; - IRIX*) - # SGI IRIX - mandir="/usr/share/catman/u_man" - ;; - *) - # All others - mandir="/usr/man" - ;; - esac -fi - -case "$uname" in - *BSD* | Darwin*) - # *BSD - CAT1EXT="0" - MAN1EXT="1" - CAT3EXT="0" - MAN3EXT="3" - ;; - *) - # All others - CAT1EXT="1" - MAN1EXT="1" - CAT3EXT="3" - MAN3EXT="3" - ;; -esac - - - - - - -if test "$includedir" != /usr/include; then - PC_CFLAGS="-I$includedir" -else - PC_CFLAGS="" -fi - -if test "$libdir" != /usr/lib; then - PC_LIBS="-L$libdir -lmxml" -else - PC_LIBS="-lmxml" -fi - - - - - ac_config_files="$ac_config_files Makefile mxml.list mxml.pc" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "mxml.list" ) CONFIG_FILES="$CONFIG_FILES mxml.list" ;; - "mxml.pc" ) CONFIG_FILES="$CONFIG_FILES mxml.pc" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@VERSION@,$VERSION,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@OPTIM@,$OPTIM,;t t -s,@docdir@,$docdir,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@AR@,$AR,;t t -s,@CP@,$CP,;t t -s,@LN@,$LN,;t t -s,@MKDIR@,$MKDIR,;t t -s,@NROFF@,$NROFF,;t t -s,@GROFF@,$GROFF,;t t -s,@RM@,$RM,;t t -s,@ARFLAGS@,$ARFLAGS,;t t -s,@DSO@,$DSO,;t t -s,@DSOFLAGS@,$DSOFLAGS,;t t -s,@LIBMXML@,$LIBMXML,;t t -s,@PICFLAG@,$PICFLAG,;t t -s,@CAT1EXT@,$CAT1EXT,;t t -s,@CAT3EXT@,$CAT3EXT,;t t -s,@MAN1EXT@,$MAN1EXT,;t t -s,@MAN3EXT@,$MAN3EXT,;t t -s,@PC_CFLAGS@,$PC_CFLAGS,;t t -s,@PC_LIBS@,$PC_LIBS,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - - diff --git a/zaptel/menuselect/mxml/install-sh b/zaptel/menuselect/mxml/install-sh deleted file mode 100755 index 398a88e1..00000000 --- a/zaptel/menuselect/mxml/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - : - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - : - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - : - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/zaptel/menuselect/mxml/mxml-attr.c b/zaptel/menuselect/mxml/mxml-attr.c deleted file mode 100644 index 7aa7d1ba..00000000 --- a/zaptel/menuselect/mxml/mxml-attr.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * "$Id: mxml-attr.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Attribute support code for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlElementGetAttr() - Get an attribute. - * mxmlElementSetAttr() - Set an attribute. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * 'mxmlElementGetAttr()' - Get an attribute. - * - * This function returns NULL if the node is not an element or the - * named attribute does not exist. - */ - -const char * /* O - Attribute value or NULL */ -mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */ - const char *name) /* I - Name of attribute */ -{ - int i; /* Looping var */ - mxml_attr_t *attr; /* Cirrent attribute */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlElementGetAttr(node=%p, name=\"%s\")\n", - node, name ? name : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!node || node->type != MXML_ELEMENT || !name) - return (NULL); - - /* - * Look for the attribute... - */ - - for (i = node->value.element.num_attrs, attr = node->value.element.attrs; - i > 0; - i --, attr ++) - if (!strcmp(attr->name, name)) - return (attr->value); - - /* - * Didn't find attribute, so return NULL... - */ - - return (NULL); -} - - -/* - * 'mxmlElementSetAttr()' - Set an attribute. - * - * If the named attribute already exists, the value of the attribute - * is replaced by the new string value. The string value is copied - * into the element node. This function does nothing if the node is - * not an element. - */ - -void -mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ - const char *name, /* I - Name of attribute */ - const char *value) /* I - Attribute value */ -{ - int i; /* Looping var */ - mxml_attr_t *attr; /* New attribute */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlElementSetAttr(node=%p, name=\"%s\", value=\"%s\")\n", - node, name ? name : "(null)", value ? value : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!node || node->type != MXML_ELEMENT || !name) - return; - - /* - * Look for the attribute... - */ - - for (i = node->value.element.num_attrs, attr = node->value.element.attrs; - i > 0; - i --, attr ++) - if (!strcmp(attr->name, name)) - { - /* - * Replace the attribute value and return... - */ - - if (attr->value) - free(attr->value); - - if (value) - { - if ((attr->value = strdup(value)) == NULL) - mxml_error("Unable to allocate memory for attribute '%s' in element %s!", - name, node->value.element.name); - } - else - attr->value = NULL; - - return; - } - - /* - * Attribute not found, so add a new one... - */ - - if (node->value.element.num_attrs == 0) - attr = malloc(sizeof(mxml_attr_t)); - else - attr = realloc(node->value.element.attrs, - (node->value.element.num_attrs + 1) * sizeof(mxml_attr_t)); - - if (!attr) - { - mxml_error("Unable to allocate memory for attribute '%s' in element %s!", - name, node->value.element.name); - return; - } - - node->value.element.attrs = attr; - attr += node->value.element.num_attrs; - - attr->name = strdup(name); - if (value) - attr->value = strdup(value); - else - attr->value = NULL; - - if (!attr->name || (!attr->value && value)) - { - if (attr->name) - free(attr->name); - - if (attr->value) - free(attr->value); - - mxml_error("Unable to allocate memory for attribute '%s' in element %s!", - name, node->value.element.name); - - return; - } - - node->value.element.num_attrs ++; -} - - -/* - * End of "$Id: mxml-attr.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-entity.c b/zaptel/menuselect/mxml/mxml-entity.c deleted file mode 100644 index 08094c23..00000000 --- a/zaptel/menuselect/mxml/mxml-entity.c +++ /dev/null @@ -1,472 +0,0 @@ -/* - * "$Id: mxml-entity.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Character entity support code for Mini-XML, a small XML-like - * file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlEntityAddCallback() - Add a callback to convert entities to - * Unicode. - * mxmlEntityGetName() - Get the name that corresponds to the - * character value. - * mxmlEntityGetValue() - Get the character corresponding to a named - * entity. - * mxmlEntityRemoveCallback() - Remove a callback. - * default_callback() - Lookup standard (X)HTML entities. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * Local functions... - */ - -static int default_callback(const char *name); - - -/* - * Callback array... - */ - -static int num_callbacks = 1; -static int (*callbacks[100])(const char *name) = - { - default_callback - }; - - -/* - * 'mxmlEntityAddCallback()' - Add a callback to convert entities to Unicode. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlEntityAddCallback(int (*cb)(const char *name)) - /* I - Callback function to add */ -{ - if (num_callbacks < (int)(sizeof(callbacks) / sizeof(callbacks[0]))) - { - callbacks[num_callbacks] = cb; - num_callbacks ++; - - return (0); - } - else - { - mxml_error("Unable to add entity callback!"); - - return (-1); - } -} - - -/* - * 'mxmlEntityGetName()' - Get the name that corresponds to the character value. - * - * If val does not need to be represented by a named entity, NULL is returned. - */ - -const char * /* O - Entity name or NULL */ -mxmlEntityGetName(int val) /* I - Character value */ -{ - switch (val) - { - case '&' : - return ("amp"); - - case '<' : - return ("lt"); - - case '>' : - return ("gt"); - - case '\"' : - return ("quot"); - - default : - return (NULL); - } -} - - -/* - * 'mxmlEntityGetValue()' - Get the character corresponding to a named entity. - * - * The entity name can also be a numeric constant. -1 is returned if the - * name is not known. - */ - -int /* O - Character value or -1 on error */ -mxmlEntityGetValue(const char *name) /* I - Entity name */ -{ - int i; /* Looping var */ - int ch; /* Character value */ - - - for (i = 0; i < num_callbacks; i ++) - if ((ch = (callbacks[i])(name)) >= 0) - return (ch); - - return (-1); -} - - -/* - * 'mxmlEntityRemoveCallback()' - Remove a callback. - */ - -void -mxmlEntityRemoveCallback(int (*cb)(const char *name)) - /* I - Callback function to remove */ -{ - int i; /* Looping var */ - - - for (i = 0; i < num_callbacks; i ++) - if (cb == callbacks[i]) - { - /* - * Remove the callback... - */ - - num_callbacks --; - - if (i < num_callbacks) - memmove(callbacks + i, callbacks + i + 1, - (num_callbacks - i) * sizeof(callbacks[0])); - - return; - } -} - - -/* - * 'default_callback()' - Lookup standard (X)HTML entities. - */ - -static int /* O - Unicode value or -1 */ -default_callback(const char *name) /* I - Entity name */ -{ - int diff, /* Difference between names */ - current, /* Current entity in search */ - first, /* First entity in search */ - last; /* Last entity in search */ - static const struct - { - const char *name; /* Entity name */ - int val; /* Character value */ - } entities[] = - { - { "AElig", 198 }, - { "Aacute", 193 }, - { "Acirc", 194 }, - { "Agrave", 192 }, - { "Alpha", 913 }, - { "Aring", 197 }, - { "Atilde", 195 }, - { "Auml", 196 }, - { "Beta", 914 }, - { "Ccedil", 199 }, - { "Chi", 935 }, - { "Dagger", 8225 }, - { "Delta", 916 }, - { "Dstrok", 208 }, - { "ETH", 208 }, - { "Eacute", 201 }, - { "Ecirc", 202 }, - { "Egrave", 200 }, - { "Epsilon", 917 }, - { "Eta", 919 }, - { "Euml", 203 }, - { "Gamma", 915 }, - { "Iacute", 205 }, - { "Icirc", 206 }, - { "Igrave", 204 }, - { "Iota", 921 }, - { "Iuml", 207 }, - { "Kappa", 922 }, - { "Lambda", 923 }, - { "Mu", 924 }, - { "Ntilde", 209 }, - { "Nu", 925 }, - { "OElig", 338 }, - { "Oacute", 211 }, - { "Ocirc", 212 }, - { "Ograve", 210 }, - { "Omega", 937 }, - { "Omicron", 927 }, - { "Oslash", 216 }, - { "Otilde", 213 }, - { "Ouml", 214 }, - { "Phi", 934 }, - { "Pi", 928 }, - { "Prime", 8243 }, - { "Psi", 936 }, - { "Rho", 929 }, - { "Scaron", 352 }, - { "Sigma", 931 }, - { "THORN", 222 }, - { "Tau", 932 }, - { "Theta", 920 }, - { "Uacute", 218 }, - { "Ucirc", 219 }, - { "Ugrave", 217 }, - { "Upsilon", 933 }, - { "Uuml", 220 }, - { "Xi", 926 }, - { "Yacute", 221 }, - { "Yuml", 376 }, - { "Zeta", 918 }, - { "aacute", 225 }, - { "acirc", 226 }, - { "acute", 180 }, - { "aelig", 230 }, - { "agrave", 224 }, - { "alefsym", 8501 }, - { "alpha", 945 }, - { "amp", '&' }, - { "and", 8743 }, - { "ang", 8736 }, - { "aring", 229 }, - { "asymp", 8776 }, - { "atilde", 227 }, - { "auml", 228 }, - { "bdquo", 8222 }, - { "beta", 946 }, - { "brkbar", 166 }, - { "brvbar", 166 }, - { "bull", 8226 }, - { "cap", 8745 }, - { "ccedil", 231 }, - { "cedil", 184 }, - { "cent", 162 }, - { "chi", 967 }, - { "circ", 710 }, - { "clubs", 9827 }, - { "cong", 8773 }, - { "copy", 169 }, - { "crarr", 8629 }, - { "cup", 8746 }, - { "curren", 164 }, - { "dArr", 8659 }, - { "dagger", 8224 }, - { "darr", 8595 }, - { "deg", 176 }, - { "delta", 948 }, - { "diams", 9830 }, - { "die", 168 }, - { "divide", 247 }, - { "eacute", 233 }, - { "ecirc", 234 }, - { "egrave", 232 }, - { "empty", 8709 }, - { "emsp", 8195 }, - { "ensp", 8194 }, - { "epsilon", 949 }, - { "equiv", 8801 }, - { "eta", 951 }, - { "eth", 240 }, - { "euml", 235 }, - { "euro", 8364 }, - { "exist", 8707 }, - { "fnof", 402 }, - { "forall", 8704 }, - { "frac12", 189 }, - { "frac14", 188 }, - { "frac34", 190 }, - { "frasl", 8260 }, - { "gamma", 947 }, - { "ge", 8805 }, - { "gt", '>' }, - { "hArr", 8660 }, - { "harr", 8596 }, - { "hearts", 9829 }, - { "hellip", 8230 }, - { "hibar", 175 }, - { "iacute", 237 }, - { "icirc", 238 }, - { "iexcl", 161 }, - { "igrave", 236 }, - { "image", 8465 }, - { "infin", 8734 }, - { "int", 8747 }, - { "iota", 953 }, - { "iquest", 191 }, - { "isin", 8712 }, - { "iuml", 239 }, - { "kappa", 954 }, - { "lArr", 8656 }, - { "lambda", 955 }, - { "lang", 9001 }, - { "laquo", 171 }, - { "larr", 8592 }, - { "lceil", 8968 }, - { "ldquo", 8220 }, - { "le", 8804 }, - { "lfloor", 8970 }, - { "lowast", 8727 }, - { "loz", 9674 }, - { "lrm", 8206 }, - { "lsaquo", 8249 }, - { "lsquo", 8216 }, - { "lt", '<' }, - { "macr", 175 }, - { "mdash", 8212 }, - { "micro", 181 }, - { "middot", 183 }, - { "minus", 8722 }, - { "mu", 956 }, - { "nabla", 8711 }, - { "nbsp", 160 }, - { "ndash", 8211 }, - { "ne", 8800 }, - { "ni", 8715 }, - { "not", 172 }, - { "notin", 8713 }, - { "nsub", 8836 }, - { "ntilde", 241 }, - { "nu", 957 }, - { "oacute", 243 }, - { "ocirc", 244 }, - { "oelig", 339 }, - { "ograve", 242 }, - { "oline", 8254 }, - { "omega", 969 }, - { "omicron", 959 }, - { "oplus", 8853 }, - { "or", 8744 }, - { "ordf", 170 }, - { "ordm", 186 }, - { "oslash", 248 }, - { "otilde", 245 }, - { "otimes", 8855 }, - { "ouml", 246 }, - { "para", 182 }, - { "part", 8706 }, - { "permil", 8240 }, - { "perp", 8869 }, - { "phi", 966 }, - { "pi", 960 }, - { "piv", 982 }, - { "plusmn", 177 }, - { "pound", 163 }, - { "prime", 8242 }, - { "prod", 8719 }, - { "prop", 8733 }, - { "psi", 968 }, - { "quot", '\"' }, - { "rArr", 8658 }, - { "radic", 8730 }, - { "rang", 9002 }, - { "raquo", 187 }, - { "rarr", 8594 }, - { "rceil", 8969 }, - { "rdquo", 8221 }, - { "real", 8476 }, - { "reg", 174 }, - { "rfloor", 8971 }, - { "rho", 961 }, - { "rlm", 8207 }, - { "rsaquo", 8250 }, - { "rsquo", 8217 }, - { "sbquo", 8218 }, - { "scaron", 353 }, - { "sdot", 8901 }, - { "sect", 167 }, - { "shy", 173 }, - { "sigma", 963 }, - { "sigmaf", 962 }, - { "sim", 8764 }, - { "spades", 9824 }, - { "sub", 8834 }, - { "sube", 8838 }, - { "sum", 8721 }, - { "sup", 8835 }, - { "sup1", 185 }, - { "sup2", 178 }, - { "sup3", 179 }, - { "supe", 8839 }, - { "szlig", 223 }, - { "tau", 964 }, - { "there4", 8756 }, - { "theta", 952 }, - { "thetasym", 977 }, - { "thinsp", 8201 }, - { "thorn", 254 }, - { "tilde", 732 }, - { "times", 215 }, - { "trade", 8482 }, - { "uArr", 8657 }, - { "uacute", 250 }, - { "uarr", 8593 }, - { "ucirc", 251 }, - { "ugrave", 249 }, - { "uml", 168 }, - { "upsih", 978 }, - { "upsilon", 965 }, - { "uuml", 252 }, - { "weierp", 8472 }, - { "xi", 958 }, - { "yacute", 253 }, - { "yen", 165 }, - { "yuml", 255 }, - { "zeta", 950 }, - { "zwj", 8205 }, - { "zwnj", 8204 } - }; - - - /* - * Do a binary search for the named entity... - */ - - first = 0; - last = (int)(sizeof(entities) / sizeof(entities[0]) - 1); - - while ((last - first) > 1) - { - current = (first + last) / 2; - - if ((diff = strcmp(name, entities[current].name)) == 0) - return (entities[current].val); - else if (diff < 0) - last = current; - else - first = current; - } - - /* - * If we get here, there is a small chance that there is still - * a match; check first and last... - */ - - if (!strcmp(name, entities[first].name)) - return (entities[first].val); - else if (!strcmp(name, entities[last].name)) - return (entities[last].val); - else - return (-1); -} - - -/* - * End of "$Id: mxml-entity.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-file.c b/zaptel/menuselect/mxml/mxml-file.c deleted file mode 100644 index 80345bbf..00000000 --- a/zaptel/menuselect/mxml/mxml-file.c +++ /dev/null @@ -1,2843 +0,0 @@ -/* - * "$Id: mxml-file.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * File loading code for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlLoadFd() - Load a file descriptor into an XML node tree. - * mxmlLoadFile() - Load a file into an XML node tree. - * mxmlLoadString() - Load a string into an XML node tree. - * mxmlSaveAllocString() - Save an XML node tree to an allocated string. - * mxmlSaveFd() - Save an XML tree to a file descriptor. - * mxmlSaveFile() - Save an XML tree to a file. - * mxmlSaveString() - Save an XML node tree to a string. - * mxmlSetCustomHandlers() - Set the handling functions for custom data. - * mxmlSetErrorCallback() - Set the error message callback. - * mxml_add_char() - Add a character to a buffer, expanding as needed. - * mxml_fd_getc() - Read a character from a file descriptor. - * mxml_fd_putc() - Write a character to a file descriptor. - * mxml_fd_read() - Read a buffer of data from a file descriptor. - * mxml_fd_write() - Write a buffer of data to a file descriptor. - * mxml_file_getc() - Get a character from a file. - * mxml_file_putc() - Write a character to a file. - * mxml_get_entity() - Get the character corresponding to an entity... - * mxml_load_data() - Load data into an XML node tree. - * mxml_parse_element() - Parse an element for any attributes... - * mxml_string_getc() - Get a character from a string. - * mxml_string_putc() - Write a character to a string. - * mxml_write_name() - Write a name string. - * mxml_write_node() - Save an XML node to a file. - * mxml_write_string() - Write a string, escaping & and < as needed. - * mxml_write_ws() - Do whitespace callback... - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" -#ifdef WIN32 -# include -#else -# include -#endif /* WIN32 */ - - -/* - * Character encoding... - */ - -#define ENCODE_UTF8 0 /* UTF-8 */ -#define ENCODE_UTF16BE 1 /* UTF-16 Big-Endian */ -#define ENCODE_UTF16LE 2 /* UTF-16 Little-Endian */ - - -/* - * Macro to test for a bad XML character... - */ - -#define mxml_bad_char(ch) ((ch) < ' ' && (ch) != '\n' && (ch) != '\r' && (ch) != '\t') - - -/* - * Structures... - */ - -typedef struct mxml_fdbuf_s /**** File descriptor buffer (@private) ****/ -{ - int fd; /* File descriptor */ - unsigned char *current, /* Current position in buffer */ - *end, /* End of buffer */ - buffer[8192]; /* Character buffer */ -} mxml_fdbuf_t; - - -/* - * Global error handler... - */ - -extern void (*mxml_error_cb)(const char *); - - -/* - * Custom data handlers... - */ - -static mxml_custom_load_cb_t mxml_custom_load_cb = NULL; -static mxml_custom_save_cb_t mxml_custom_save_cb = NULL; - - -/* - * Local functions... - */ - -static int mxml_add_char(int ch, char **ptr, char **buffer, - int *bufsize); -static int mxml_fd_getc(void *p, int *encoding); -static int mxml_fd_putc(int ch, void *p); -static int mxml_fd_read(mxml_fdbuf_t *buf); -static int mxml_fd_write(mxml_fdbuf_t *buf); -static int mxml_file_getc(void *p, int *encoding); -static int mxml_file_putc(int ch, void *p); -static int mxml_get_entity(mxml_node_t *parent, void *p, - int *encoding, - int (*getc_cb)(void *, int *)); -static mxml_node_t *mxml_load_data(mxml_node_t *top, void *p, - mxml_type_t (*cb)(mxml_node_t *), - int (*getc_cb)(void *, int *)); -static int mxml_parse_element(mxml_node_t *node, void *p, - int *encoding, - int (*getc_cb)(void *, int *)); -static int mxml_string_getc(void *p, int *encoding); -static int mxml_string_putc(int ch, void *p); -static int mxml_write_name(const char *s, void *p, - int (*putc_cb)(int, void *)); -static int mxml_write_node(mxml_node_t *node, void *p, - const char *(*cb)(mxml_node_t *, int), - int col, - int (*putc_cb)(int, void *)); -static int mxml_write_string(const char *s, void *p, - int (*putc_cb)(int, void *)); -static int mxml_write_ws(mxml_node_t *node, void *p, - const char *(*cb)(mxml_node_t *, int), int ws, - int col, int (*putc_cb)(int, void *)); - - -/* - * 'mxmlLoadFd()' - Load a file descriptor into an XML node tree. - * - * The nodes in the specified file are added to the specified top node. - * If no top node is provided, the XML file MUST be well-formed with a - * single parent node like for the entire file. The callback - * function returns the value type that should be used for child nodes. - * If MXML_NO_CALLBACK is specified then all child nodes will be either - * MXML_ELEMENT or MXML_TEXT nodes. - * - * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, - * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading - * child nodes of the specified type. - */ - -mxml_node_t * /* O - First node or NULL if the file could not be read. */ -mxmlLoadFd(mxml_node_t *top, /* I - Top node */ - int fd, /* I - File descriptor to read from */ - mxml_type_t (*cb)(mxml_node_t *node)) - /* I - Callback function or MXML_NO_CALLBACK */ -{ - mxml_fdbuf_t buf; /* File descriptor buffer */ - - - /* - * Initialize the file descriptor buffer... - */ - - buf.fd = fd; - buf.current = buf.buffer; - buf.end = buf.buffer; - - /* - * Read the XML data... - */ - - return (mxml_load_data(top, &buf, cb, mxml_fd_getc)); -} - - -/* - * 'mxmlLoadFile()' - Load a file into an XML node tree. - * - * The nodes in the specified file are added to the specified top node. - * If no top node is provided, the XML file MUST be well-formed with a - * single parent node like for the entire file. The callback - * function returns the value type that should be used for child nodes. - * If MXML_NO_CALLBACK is specified then all child nodes will be either - * MXML_ELEMENT or MXML_TEXT nodes. - * - * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, - * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading - * child nodes of the specified type. - */ - -mxml_node_t * /* O - First node or NULL if the file could not be read. */ -mxmlLoadFile(mxml_node_t *top, /* I - Top node */ - FILE *fp, /* I - File to read from */ - mxml_type_t (*cb)(mxml_node_t *node)) - /* I - Callback function or MXML_NO_CALLBACK */ -{ - /* - * Read the XML data... - */ - - return (mxml_load_data(top, fp, cb, mxml_file_getc)); -} - - -/* - * 'mxmlLoadString()' - Load a string into an XML node tree. - * - * The nodes in the specified string are added to the specified top node. - * If no top node is provided, the XML string MUST be well-formed with a - * single parent node like for the entire string. The callback - * function returns the value type that should be used for child nodes. - * If MXML_NO_CALLBACK is specified then all child nodes will be either - * MXML_ELEMENT or MXML_TEXT nodes. - * - * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, - * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading - * child nodes of the specified type. - */ - -mxml_node_t * /* O - First node or NULL if the string has errors. */ -mxmlLoadString(mxml_node_t *top, /* I - Top node */ - const char *s, /* I - String to load */ - mxml_type_t (*cb)(mxml_node_t *node)) - /* I - Callback function or MXML_NO_CALLBACK */ -{ - /* - * Read the XML data... - */ - - return (mxml_load_data(top, &s, cb, mxml_string_getc)); -} - - -/* - * 'mxmlSaveAllocString()' - Save an XML node tree to an allocated string. - * - * This function returns a pointer to a string containing the textual - * representation of the XML node tree. The string should be freed - * using the free() function when you are done with it. NULL is returned - * if the node would produce an empty string or if the string cannot be - * allocated. - * - * The callback argument specifies a function that returns a whitespace - * string or NULL before and after each element. If MXML_NO_CALLBACK - * is specified, whitespace will only be added before MXML_TEXT nodes - * with leading whitespace and before attribute names inside opening - * element tags. - */ - -char * /* O - Allocated string or NULL */ -mxmlSaveAllocString(mxml_node_t *node, /* I - Node to write */ - const char *(*cb)(mxml_node_t *node, int ws)) - /* I - Whitespace callback or MXML_NO_CALLBACK */ -{ - int bytes; /* Required bytes */ - char buffer[8192]; /* Temporary buffer */ - char *s; /* Allocated string */ - - - /* - * Write the node to the temporary buffer... - */ - - bytes = mxmlSaveString(node, buffer, sizeof(buffer), cb); - - if (bytes <= 0) - return (NULL); - - if (bytes < (int)(sizeof(buffer) - 1)) - { - /* - * Node fit inside the buffer, so just duplicate that string and - * return... - */ - - return (strdup(buffer)); - } - - /* - * Allocate a buffer of the required size and save the node to the - * new buffer... - */ - - if ((s = malloc(bytes + 1)) == NULL) - return (NULL); - - mxmlSaveString(node, s, bytes + 1, cb); - - /* - * Return the allocated string... - */ - - return (s); -} - - -/* - * 'mxmlSaveFd()' - Save an XML tree to a file descriptor. - * - * The callback argument specifies a function that returns a whitespace - * string or NULL before and after each element. If MXML_NO_CALLBACK - * is specified, whitespace will only be added before MXML_TEXT nodes - * with leading whitespace and before attribute names inside opening - * element tags. - */ - -int /* O - 0 on success, -1 on error. */ -mxmlSaveFd(mxml_node_t *node, /* I - Node to write */ - int fd, /* I - File descriptor to write to */ - const char *(*cb)(mxml_node_t *node, int ws)) - /* I - Whitespace callback or MXML_NO_CALLBACK */ -{ - int col; /* Final column */ - mxml_fdbuf_t buf; /* File descriptor buffer */ - - - /* - * Initialize the file descriptor buffer... - */ - - buf.fd = fd; - buf.current = buf.buffer; - buf.end = buf.buffer + sizeof(buf.buffer) - 4; - - /* - * Write the node... - */ - - if ((col = mxml_write_node(node, &buf, cb, 0, mxml_fd_putc)) < 0) - return (-1); - - if (col > 0) - if (mxml_fd_putc('\n', &buf) < 0) - return (-1); - - /* - * Flush and return... - */ - - return (mxml_fd_write(&buf)); -} - - -/* - * 'mxmlSaveFile()' - Save an XML tree to a file. - * - * The callback argument specifies a function that returns a whitespace - * string or NULL before and after each element. If MXML_NO_CALLBACK - * is specified, whitespace will only be added before MXML_TEXT nodes - * with leading whitespace and before attribute names inside opening - * element tags. - */ - -int /* O - 0 on success, -1 on error. */ -mxmlSaveFile(mxml_node_t *node, /* I - Node to write */ - FILE *fp, /* I - File to write to */ - const char *(*cb)(mxml_node_t *node, int ws)) - /* I - Whitespace callback or MXML_NO_CALLBACK */ -{ - int col; /* Final column */ - - - /* - * Write the node... - */ - - if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc)) < 0) - return (-1); - - if (col > 0) - if (putc('\n', fp) < 0) - return (-1); - - /* - * Return 0 (success)... - */ - - return (0); -} - - -/* - * 'mxmlSaveString()' - Save an XML node tree to a string. - * - * This function returns the total number of bytes that would be - * required for the string but only copies (bufsize - 1) characters - * into the specified buffer. - * - * The callback argument specifies a function that returns a whitespace - * string or NULL before and after each element. If MXML_NO_CALLBACK - * is specified, whitespace will only be added before MXML_TEXT nodes - * with leading whitespace and before attribute names inside opening - * element tags. - */ - -int /* O - Size of string */ -mxmlSaveString(mxml_node_t *node, /* I - Node to write */ - char *buffer, /* I - String buffer */ - int bufsize, /* I - Size of string buffer */ - const char *(*cb)(mxml_node_t *node, int ws)) - /* I - Whitespace callback or MXML_NO_CALLBACK */ -{ - int col; /* Final column */ - char *ptr[2]; /* Pointers for putc_cb */ - - - /* - * Write the node... - */ - - ptr[0] = buffer; - ptr[1] = buffer + bufsize; - - if ((col = mxml_write_node(node, ptr, cb, 0, mxml_string_putc)) < 0) - return (-1); - - if (col > 0) - mxml_string_putc('\n', ptr); - - /* - * Nul-terminate the buffer... - */ - - if (ptr[0] >= ptr[1]) - buffer[bufsize - 1] = '\0'; - else - ptr[0][0] = '\0'; - - /* - * Return the number of characters... - */ - - return (ptr[0] - buffer); -} - - -/* - * 'mxmlSetCustomHandlers()' - Set the handling functions for custom data. - * - * The load function accepts a node pointer and a data string and must - * return 0 on success and non-zero on error. - * - * The save function accepts a node pointer and must return a malloc'd - * string on success and NULL on error. - * - */ - -void -mxmlSetCustomHandlers(mxml_custom_load_cb_t load, - /* I - Load function */ - mxml_custom_save_cb_t save) - /* I - Save function */ -{ - mxml_custom_load_cb = load; - mxml_custom_save_cb = save; -} - - -/* - * 'mxmlSetErrorCallback()' - Set the error message callback. - */ - -void -mxmlSetErrorCallback(void (*cb)(const char *)) - /* I - Error callback function */ -{ - mxml_error_cb = cb; -} - - -/* - * 'mxml_add_char()' - Add a character to a buffer, expanding as needed. - */ - -static int /* O - 0 on success, -1 on error */ -mxml_add_char(int ch, /* I - Character to add */ - char **bufptr, /* IO - Current position in buffer */ - char **buffer, /* IO - Current buffer */ - int *bufsize) /* IO - Current buffer size */ -{ - char *newbuffer; /* New buffer value */ - - - if (*bufptr >= (*buffer + *bufsize - 4)) - { - /* - * Increase the size of the buffer... - */ - - if (*bufsize < 1024) - (*bufsize) *= 2; - else - (*bufsize) += 1024; - - if ((newbuffer = realloc(*buffer, *bufsize)) == NULL) - { - free(*buffer); - - mxml_error("Unable to expand string buffer to %d bytes!", *bufsize); - - return (-1); - } - - *bufptr = newbuffer + (*bufptr - *buffer); - *buffer = newbuffer; - } - - if (ch < 0x80) - { - /* - * Single byte ASCII... - */ - - *(*bufptr)++ = ch; - } - else if (ch < 0x800) - { - /* - * Two-byte UTF-8... - */ - - *(*bufptr)++ = 0xc0 | (ch >> 6); - *(*bufptr)++ = 0x80 | (ch & 0x3f); - } - else if (ch < 0x10000) - { - /* - * Three-byte UTF-8... - */ - - *(*bufptr)++ = 0xe0 | (ch >> 12); - *(*bufptr)++ = 0x80 | ((ch >> 6) & 0x3f); - *(*bufptr)++ = 0x80 | (ch & 0x3f); - } - else - { - /* - * Four-byte UTF-8... - */ - - *(*bufptr)++ = 0xf0 | (ch >> 18); - *(*bufptr)++ = 0x80 | ((ch >> 12) & 0x3f); - *(*bufptr)++ = 0x80 | ((ch >> 6) & 0x3f); - *(*bufptr)++ = 0x80 | (ch & 0x3f); - } - - return (0); -} - - -/* - * 'mxml_fd_getc()' - Read a character from a file descriptor. - */ - -static int /* O - Character or EOF */ -mxml_fd_getc(void *p, /* I - File descriptor buffer */ - int *encoding) /* IO - Encoding */ -{ - mxml_fdbuf_t *buf; /* File descriptor buffer */ - int ch, /* Current character */ - temp; /* Temporary character */ - - - /* - * Grab the next character in the buffer... - */ - - buf = (mxml_fdbuf_t *)p; - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - ch = *(buf->current)++; - - switch (*encoding) - { - case ENCODE_UTF8 : - /* - * Got a UTF-8 character; convert UTF-8 to Unicode and return... - */ - - if (!(ch & 0x80)) - { -#if DEBUG > 1 - printf("mxml_fd_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - - return (ch); - } - else if (ch == 0xfe) - { - /* - * UTF-16 big-endian BOM? - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - ch = *(buf->current)++; - - if (ch != 0xff) - return (EOF); - - *encoding = ENCODE_UTF16BE; - - return (mxml_fd_getc(p, encoding)); - } - else if (ch == 0xff) - { - /* - * UTF-16 little-endian BOM? - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - ch = *(buf->current)++; - - if (ch != 0xfe) - return (EOF); - - *encoding = ENCODE_UTF16LE; - - return (mxml_fd_getc(p, encoding)); - } - else if ((ch & 0xe0) == 0xc0) - { - /* - * Two-byte value... - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - if ((temp & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x1f) << 6) | (temp & 0x3f); - - if (ch < 0x80) - return (EOF); - } - else if ((ch & 0xf0) == 0xe0) - { - /* - * Three-byte value... - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - if ((temp & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x0f) << 6) | (temp & 0x3f); - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - if ((temp & 0xc0) != 0x80) - return (EOF); - - ch = (ch << 6) | (temp & 0x3f); - - if (ch < 0x800) - return (EOF); - } - else if ((ch & 0xf8) == 0xf0) - { - /* - * Four-byte value... - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - if ((temp & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x07) << 6) | (temp & 0x3f); - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - if ((temp & 0xc0) != 0x80) - return (EOF); - - ch = (ch << 6) | (temp & 0x3f); - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - if ((temp & 0xc0) != 0x80) - return (EOF); - - ch = (ch << 6) | (temp & 0x3f); - - if (ch < 0x10000) - return (EOF); - } - else - return (EOF); - break; - - case ENCODE_UTF16BE : - /* - * Read UTF-16 big-endian char... - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - ch = (ch << 8) | temp; - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - else if (ch >= 0xd800 && ch <= 0xdbff) - { - /* - * Multi-word UTF-16 char... - */ - - int lch; - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - lch = *(buf->current)++; - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - lch = (lch << 8) | temp; - - if (lch < 0xdc00 || lch >= 0xdfff) - return (EOF); - - ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; - } - break; - - case ENCODE_UTF16LE : - /* - * Read UTF-16 little-endian char... - */ - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - ch |= (temp << 8); - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - else if (ch >= 0xd800 && ch <= 0xdbff) - { - /* - * Multi-word UTF-16 char... - */ - - int lch; - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - lch = *(buf->current)++; - - if (buf->current >= buf->end) - if (mxml_fd_read(buf) < 0) - return (EOF); - - temp = *(buf->current)++; - - lch |= (temp << 8); - - if (lch < 0xdc00 || lch >= 0xdfff) - return (EOF); - - ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; - } - break; - } - -#if DEBUG > 1 - printf("mxml_fd_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); -} - - -/* - * 'mxml_fd_putc()' - Write a character to a file descriptor. - */ - -static int /* O - 0 on success, -1 on error */ -mxml_fd_putc(int ch, /* I - Character */ - void *p) /* I - File descriptor buffer */ -{ - mxml_fdbuf_t *buf; /* File descriptor buffer */ - - - /* - * Flush the write buffer as needed - note above that "end" still leaves - * 4 characters at the end so that we can avoid a lot of extra tests... - */ - - buf = (mxml_fdbuf_t *)p; - - if (buf->current >= buf->end) - if (mxml_fd_write(buf) < 0) - return (-1); - - if (ch < 0x80) - { - /* - * Write ASCII character directly... - */ - - *(buf->current)++ = ch; - } - else if (ch < 0x800) - { - /* - * Two-byte UTF-8 character... - */ - - *(buf->current)++ = 0xc0 | (ch >> 6); - *(buf->current)++ = 0x80 | (ch & 0x3f); - } - else if (ch < 0x10000) - { - /* - * Three-byte UTF-8 character... - */ - - *(buf->current)++ = 0xe0 | (ch >> 12); - *(buf->current)++ = 0x80 | ((ch >> 6) & 0x3f); - *(buf->current)++ = 0x80 | (ch & 0x3f); - } - else - { - /* - * Four-byte UTF-8 character... - */ - - *(buf->current)++ = 0xf0 | (ch >> 18); - *(buf->current)++ = 0x80 | ((ch >> 12) & 0x3f); - *(buf->current)++ = 0x80 | ((ch >> 6) & 0x3f); - *(buf->current)++ = 0x80 | (ch & 0x3f); - } - - /* - * Return successfully... - */ - - return (0); -} - - -/* - * 'mxml_fd_read()' - Read a buffer of data from a file descriptor. - */ - -static int /* O - 0 on success, -1 on error */ -mxml_fd_read(mxml_fdbuf_t *buf) /* I - File descriptor buffer */ -{ - int bytes; /* Bytes read... */ - - - /* - * Range check input... - */ - - if (!buf) - return (-1); - - /* - * Read from the file descriptor... - */ - - while ((bytes = read(buf->fd, buf->buffer, sizeof(buf->buffer))) < 0) - if (errno != EAGAIN && errno != EINTR) - return (-1); - - if (bytes == 0) - return (-1); - - /* - * Update the pointers and return success... - */ - - buf->current = buf->buffer; - buf->end = buf->buffer + bytes; - - return (0); -} - - -/* - * 'mxml_fd_write()' - Write a buffer of data to a file descriptor. - */ - -static int /* O - 0 on success, -1 on error */ -mxml_fd_write(mxml_fdbuf_t *buf) /* I - File descriptor buffer */ -{ - int bytes; /* Bytes written */ - unsigned char *ptr; /* Pointer into buffer */ - - - /* - * Range check... - */ - - if (!buf) - return (-1); - - /* - * Return 0 if there is nothing to write... - */ - - if (buf->current == buf->buffer) - return (0); - - /* - * Loop until we have written everything... - */ - - for (ptr = buf->buffer; ptr < buf->current; ptr += bytes) - if ((bytes = write(buf->fd, ptr, buf->current - ptr)) < 0) - return (-1); - - /* - * All done, reset pointers and return success... - */ - - buf->current = buf->buffer; - - return (0); -} - - -/* - * 'mxml_file_getc()' - Get a character from a file. - */ - -static int /* O - Character or EOF */ -mxml_file_getc(void *p, /* I - Pointer to file */ - int *encoding) /* IO - Encoding */ -{ - int ch, /* Character from file */ - temp; /* Temporary character */ - FILE *fp; /* Pointer to file */ - - - /* - * Read a character from the file and see if it is EOF or ASCII... - */ - - fp = (FILE *)p; - ch = getc(fp); - - if (ch == EOF) - return (EOF); - - switch (*encoding) - { - case ENCODE_UTF8 : - /* - * Got a UTF-8 character; convert UTF-8 to Unicode and return... - */ - - if (!(ch & 0x80)) - { - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - -#if DEBUG > 1 - printf("mxml_file_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); - } - else if (ch == 0xfe) - { - /* - * UTF-16 big-endian BOM? - */ - - ch = getc(fp); - if (ch != 0xff) - return (EOF); - - *encoding = ENCODE_UTF16BE; - - return (mxml_file_getc(p, encoding)); - } - else if (ch == 0xff) - { - /* - * UTF-16 little-endian BOM? - */ - - ch = getc(fp); - if (ch != 0xfe) - return (EOF); - - *encoding = ENCODE_UTF16LE; - - return (mxml_file_getc(p, encoding)); - } - else if ((ch & 0xe0) == 0xc0) - { - /* - * Two-byte value... - */ - - if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x1f) << 6) | (temp & 0x3f); - - if (ch < 0x80) - return (EOF); - } - else if ((ch & 0xf0) == 0xe0) - { - /* - * Three-byte value... - */ - - if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x0f) << 6) | (temp & 0x3f); - - if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) - return (EOF); - - ch = (ch << 6) | (temp & 0x3f); - - if (ch < 0x800) - return (EOF); - } - else if ((ch & 0xf8) == 0xf0) - { - /* - * Four-byte value... - */ - - if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x07) << 6) | (temp & 0x3f); - - if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) - return (EOF); - - ch = (ch << 6) | (temp & 0x3f); - - if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) - return (EOF); - - ch = (ch << 6) | (temp & 0x3f); - - if (ch < 0x10000) - return (EOF); - } - else - return (EOF); - break; - - case ENCODE_UTF16BE : - /* - * Read UTF-16 big-endian char... - */ - - ch = (ch << 8) | getc(fp); - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - else if (ch >= 0xd800 && ch <= 0xdbff) - { - /* - * Multi-word UTF-16 char... - */ - - int lch = (getc(fp) << 8) | getc(fp); - - if (lch < 0xdc00 || lch >= 0xdfff) - return (EOF); - - ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; - } - break; - - case ENCODE_UTF16LE : - /* - * Read UTF-16 little-endian char... - */ - - ch |= (getc(fp) << 8); - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - else if (ch >= 0xd800 && ch <= 0xdbff) - { - /* - * Multi-word UTF-16 char... - */ - - int lch = getc(fp) | (getc(fp) << 8); - - if (lch < 0xdc00 || lch >= 0xdfff) - return (EOF); - - ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; - } - break; - } - -#if DEBUG > 1 - printf("mxml_file_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); -} - - -/* - * 'mxml_file_putc()' - Write a character to a file. - */ - -static int /* O - 0 on success, -1 on failure */ -mxml_file_putc(int ch, /* I - Character to write */ - void *p) /* I - Pointer to file */ -{ - char buffer[4], /* Buffer for character */ - *bufptr; /* Pointer into buffer */ - int buflen; /* Number of bytes to write */ - - - if (ch < 0x80) - return (putc(ch, (FILE *)p) == EOF ? -1 : 0); - - bufptr = buffer; - - if (ch < 0x800) - { - /* - * Two-byte UTF-8 character... - */ - - *bufptr++ = 0xc0 | (ch >> 6); - *bufptr++ = 0x80 | (ch & 0x3f); - } - else if (ch < 0x10000) - { - /* - * Three-byte UTF-8 character... - */ - - *bufptr++ = 0xe0 | (ch >> 12); - *bufptr++ = 0x80 | ((ch >> 6) & 0x3f); - *bufptr++ = 0x80 | (ch & 0x3f); - } - else - { - /* - * Four-byte UTF-8 character... - */ - - *bufptr++ = 0xf0 | (ch >> 18); - *bufptr++ = 0x80 | ((ch >> 12) & 0x3f); - *bufptr++ = 0x80 | ((ch >> 6) & 0x3f); - *bufptr++ = 0x80 | (ch & 0x3f); - } - - buflen = bufptr - buffer; - - return (fwrite(buffer, 1, buflen, (FILE *)p) < buflen ? -1 : 0); -} - - -/* - * 'mxml_get_entity()' - Get the character corresponding to an entity... - */ - -static int /* O - Character value or EOF on error */ -mxml_get_entity(mxml_node_t *parent, /* I - Parent node */ - void *p, /* I - Pointer to source */ - int *encoding, /* IO - Character encoding */ - int (*getc_cb)(void *, int *)) - /* I - Get character function */ -{ - int ch; /* Current character */ - char entity[64], /* Entity string */ - *entptr; /* Pointer into entity */ - - - entptr = entity; - - while ((ch = (*getc_cb)(p, encoding)) != EOF) - if (ch > 126 || (!isalnum(ch) && ch != '#')) - break; - else if (entptr < (entity + sizeof(entity) - 1)) - *entptr++ = ch; - else - { - mxml_error("Entity name too long under parent <%s>!", - parent ? parent->value.element.name : "null"); - break; - } - - *entptr = '\0'; - - if (ch != ';') - { - mxml_error("Character entity \"%s\" not terminated under parent <%s>!", - entity, parent ? parent->value.element.name : "null"); - return (EOF); - } - - if (entity[0] == '#') - { - if (entity[1] == 'x') - ch = strtol(entity + 2, NULL, 16); - else - ch = strtol(entity + 1, NULL, 10); - } - else if ((ch = mxmlEntityGetValue(entity)) < 0) - mxml_error("Entity name \"%s;\" not supported under parent <%s>!", - entity, parent ? parent->value.element.name : "null"); - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x under parent <%s> not allowed by XML standard!", - ch, parent ? parent->value.element.name : "null"); - return (EOF); - } - - return (ch); -} - - -/* - * 'mxml_load_data()' - Load data into an XML node tree. - */ - -static mxml_node_t * /* O - First node or NULL if the file could not be read. */ -mxml_load_data(mxml_node_t *top, /* I - Top node */ - void *p, /* I - Pointer to data */ - mxml_type_t (*cb)(mxml_node_t *), - /* I - Callback function or MXML_NO_CALLBACK */ - int (*getc_cb)(void *, int *)) - /* I - Read function */ -{ - mxml_node_t *node, /* Current node */ - *first, /* First node added */ - *parent; /* Current parent node */ - int ch, /* Character from file */ - whitespace; /* Non-zero if whitespace seen */ - char *buffer, /* String buffer */ - *bufptr; /* Pointer into buffer */ - int bufsize; /* Size of buffer */ - mxml_type_t type; /* Current node type */ - int encoding; /* Character encoding */ - static const char * const types[] = /* Type strings... */ - { - "MXML_ELEMENT", /* XML element with attributes */ - "MXML_INTEGER", /* Integer value */ - "MXML_OPAQUE", /* Opaque string */ - "MXML_REAL", /* Real value */ - "MXML_TEXT", /* Text fragment */ - "MXML_CUSTOM" /* Custom data */ - }; - - - /* - * Read elements and other nodes from the file... - */ - - if ((buffer = malloc(64)) == NULL) - { - mxml_error("Unable to allocate string buffer!"); - return (NULL); - } - - bufsize = 64; - bufptr = buffer; - parent = top; - first = NULL; - whitespace = 0; - encoding = ENCODE_UTF8; - - if (cb && parent) - type = (*cb)(parent); - else - type = MXML_TEXT; - - while ((ch = (*getc_cb)(p, &encoding)) != EOF) - { - if ((ch == '<' || - (isspace(ch) && type != MXML_OPAQUE && type != MXML_CUSTOM)) && - bufptr > buffer) - { - /* - * Add a new value node... - */ - - *bufptr = '\0'; - - switch (type) - { - case MXML_INTEGER : - node = mxmlNewInteger(parent, strtol(buffer, &bufptr, 0)); - break; - - case MXML_OPAQUE : - node = mxmlNewOpaque(parent, buffer); - break; - - case MXML_REAL : - node = mxmlNewReal(parent, strtod(buffer, &bufptr)); - break; - - case MXML_TEXT : - node = mxmlNewText(parent, whitespace, buffer); - break; - - case MXML_CUSTOM : - if (mxml_custom_load_cb) - { - /* - * Use the callback to fill in the custom data... - */ - - node = mxmlNewCustom(parent, NULL, NULL); - - if ((*mxml_custom_load_cb)(node, buffer)) - { - mxml_error("Bad custom value '%s' in parent <%s>!", - buffer, parent ? parent->value.element.name : "null"); - mxmlDelete(node); - node = NULL; - } - break; - } - - default : /* Should never happen... */ - node = NULL; - break; - } - - if (*bufptr) - { - /* - * Bad integer/real number value... - */ - - mxml_error("Bad %s value '%s' in parent <%s>!", - type == MXML_INTEGER ? "integer" : "real", buffer, - parent ? parent->value.element.name : "null"); - break; - } - - bufptr = buffer; - whitespace = isspace(ch) && type == MXML_TEXT; - - if (!node) - { - /* - * Print error and return... - */ - - mxml_error("Unable to add value node of type %s to parent <%s>!", - types[type], parent ? parent->value.element.name : "null"); - goto error; - } - - if (!first) - first = node; - } - else if (isspace(ch) && type == MXML_TEXT) - whitespace = 1; - - /* - * Add lone whitespace node if we have an element and existing - * whitespace... - */ - - if (ch == '<' && whitespace && type == MXML_TEXT) - { - mxmlNewText(parent, whitespace, ""); - whitespace = 0; - } - - if (ch == '<') - { - /* - * Start of open/close tag... - */ - - bufptr = buffer; - - while ((ch = (*getc_cb)(p, &encoding)) != EOF) - if (isspace(ch) || ch == '>' || (ch == '/' && bufptr > buffer)) - break; - else if (ch == '&') - { - if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - else if (((bufptr - buffer) == 1 && buffer[0] == '?') || - ((bufptr - buffer) == 3 && !strncmp(buffer, "!--", 3)) || - ((bufptr - buffer) == 8 && !strncmp(buffer, "![CDATA[", 8))) - break; - - *bufptr = '\0'; - - if (!strcmp(buffer, "!--")) - { - /* - * Gather rest of comment... - */ - - while ((ch = (*getc_cb)(p, &encoding)) != EOF) - { - if (ch == '>' && bufptr > (buffer + 4) && - bufptr[-3] != '-' && bufptr[-2] == '-' && bufptr[-1] == '-') - break; - else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - - /* - * Error out if we didn't get the whole comment... - */ - - if (ch != '>') - { - /* - * Print error and return... - */ - - mxml_error("Early EOF in comment node!"); - goto error; - } - - - /* - * Otherwise add this as an element under the current parent... - */ - - *bufptr = '\0'; - - if (!mxmlNewElement(parent, buffer)) - { - /* - * Just print error for now... - */ - - mxml_error("Unable to add comment node to parent <%s>!", - parent ? parent->value.element.name : "null"); - break; - } - } - else if (!strcmp(buffer, "![CDATA[")) - { - /* - * Gather CDATA section... - */ - - while ((ch = (*getc_cb)(p, &encoding)) != EOF) - { - if (ch == '>' && !strncmp(bufptr - 2, "]]", 2)) - break; - else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - - /* - * Error out if we didn't get the whole comment... - */ - - if (ch != '>') - { - /* - * Print error and return... - */ - - mxml_error("Early EOF in CDATA node!"); - goto error; - } - - - /* - * Otherwise add this as an element under the current parent... - */ - - *bufptr = '\0'; - - if (!mxmlNewElement(parent, buffer)) - { - /* - * Print error and return... - */ - - mxml_error("Unable to add CDATA node to parent <%s>!", - parent ? parent->value.element.name : "null"); - goto error; - } - } - else if (buffer[0] == '?') - { - /* - * Gather rest of processing instruction... - */ - - while ((ch = (*getc_cb)(p, &encoding)) != EOF) - { - if (ch == '>' && bufptr > buffer && bufptr[-1] == '?') - break; - else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - - /* - * Error out if we didn't get the whole processing instruction... - */ - - if (ch != '>') - { - /* - * Print error and return... - */ - - mxml_error("Early EOF in processing instruction node!"); - goto error; - } - - - /* - * Otherwise add this as an element under the current parent... - */ - - *bufptr = '\0'; - - if (!(parent = mxmlNewElement(parent, buffer))) - { - /* - * Print error and return... - */ - - mxml_error("Unable to add processing instruction node to parent <%s>!", - parent ? parent->value.element.name : "null"); - goto error; - } - - if (cb) - type = (*cb)(parent); - } - else if (buffer[0] == '!') - { - /* - * Gather rest of declaration... - */ - - do - { - if (ch == '>') - break; - else - { - if (ch == '&') - if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - } - while ((ch = (*getc_cb)(p, &encoding)) != EOF); - - /* - * Error out if we didn't get the whole declaration... - */ - - if (ch != '>') - { - /* - * Print error and return... - */ - - mxml_error("Early EOF in declaration node!"); - goto error; - } - - /* - * Otherwise add this as an element under the current parent... - */ - - *bufptr = '\0'; - - node = mxmlNewElement(parent, buffer); - if (!node) - { - /* - * Print error and return... - */ - - mxml_error("Unable to add declaration node to parent <%s>!", - parent ? parent->value.element.name : "null"); - goto error; - } - - /* - * Descend into this node, setting the value type as needed... - */ - - parent = node; - - if (cb) - type = (*cb)(parent); - } - else if (buffer[0] == '/') - { - /* - * Handle close tag... - */ - - if (!parent || strcmp(buffer + 1, parent->value.element.name)) - { - /* - * Close tag doesn't match tree; print an error for now... - */ - - mxml_error("Mismatched close tag <%s> under parent <%s>!", - buffer, parent->value.element.name); - goto error; - } - - /* - * Keep reading until we see >... - */ - - while (ch != '>' && ch != EOF) - ch = (*getc_cb)(p, &encoding); - - /* - * Ascend into the parent and set the value type as needed... - */ - - parent = parent->parent; - - if (cb && parent) - type = (*cb)(parent); - } - else - { - /* - * Handle open tag... - */ - - node = mxmlNewElement(parent, buffer); - - if (!node) - { - /* - * Just print error for now... - */ - - mxml_error("Unable to add element node to parent <%s>!", - parent ? parent->value.element.name : "null"); - goto error; - } - - if (isspace(ch)) - ch = mxml_parse_element(node, p, &encoding, getc_cb); - else if (ch == '/') - { - if ((ch = (*getc_cb)(p, &encoding)) != '>') - { - mxml_error("Expected > but got '%c' instead for element <%s/>!", - ch, buffer); - goto error; - } - - ch = '/'; - } - - if (ch == EOF) - break; - - if (ch != '/') - { - /* - * Descend into this node, setting the value type as needed... - */ - - parent = node; - - if (cb && parent) - type = (*cb)(parent); - } - } - - bufptr = buffer; - } - else if (ch == '&') - { - /* - * Add character entity to current buffer... - */ - - if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - else if (type == MXML_OPAQUE || type == MXML_CUSTOM || !isspace(ch)) - { - /* - * Add character to current buffer... - */ - - if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) - goto error; - } - } - - /* - * Free the string buffer - we don't need it anymore... - */ - - free(buffer); - - /* - * Find the top element and return it... - */ - - if (parent) - { - while (parent->parent != top && parent->parent) - parent = parent->parent; - } - - return (parent); - - /* - * Common error return... - */ - -error: - - mxmlDelete(first); - - free(buffer); - - return (NULL); -} - - -/* - * 'mxml_parse_element()' - Parse an element for any attributes... - */ - -static int /* O - Terminating character */ -mxml_parse_element(mxml_node_t *node, /* I - Element node */ - void *p, /* I - Data to read from */ - int *encoding, - /* IO - Encoding */ - int (*getc_cb)(void *, int *)) - /* I - Data callback */ -{ - int ch, /* Current character in file */ - quote; /* Quoting character */ - char *name, /* Attribute name */ - *value, /* Attribute value */ - *ptr; /* Pointer into name/value */ - int namesize, /* Size of name string */ - valsize; /* Size of value string */ - - - - - /* - * Initialize the name and value buffers... - */ - - if ((name = malloc(64)) == NULL) - { - mxml_error("Unable to allocate memory for name!"); - return (EOF); - } - - namesize = 64; - - if ((value = malloc(64)) == NULL) - { - free(name); - mxml_error("Unable to allocate memory for value!"); - return (EOF); - } - - valsize = 64; - - /* - * Loop until we hit a >, /, ?, or EOF... - */ - - while ((ch = (*getc_cb)(p, encoding)) != EOF) - { -#if DEBUG > 1 - fprintf(stderr, "parse_element: ch='%c'\n", ch); -#endif /* DEBUG > 1 */ - - /* - * Skip leading whitespace... - */ - - if (isspace(ch)) - continue; - - /* - * Stop at /, ?, or >... - */ - - if (ch == '/' || ch == '?') - { - /* - * Grab the > character and print an error if it isn't there... - */ - - quote = (*getc_cb)(p, encoding); - - if (quote != '>') - { - mxml_error("Expected '>' after '%c' for element %s, but got '%c'!", - ch, node->value.element.name, quote); - ch = EOF; - } - - break; - } - else if (ch == '>') - break; - - /* - * Read the attribute name... - */ - - name[0] = ch; - ptr = name + 1; - - if (ch == '\"' || ch == '\'') - { - /* - * Name is in quotes, so get a quoted string... - */ - - quote = ch; - - while ((ch = (*getc_cb)(p, encoding)) != EOF) - { - if (ch == '&') - if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &ptr, &name, &namesize)) - goto error; - - if (ch == quote) - break; - } - } - else - { - /* - * Grab an normal, non-quoted name... - */ - - while ((ch = (*getc_cb)(p, encoding)) != EOF) - if (isspace(ch) || ch == '=' || ch == '/' || ch == '>' || ch == '?') - break; - else - { - if (ch == '&') - if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &ptr, &name, &namesize)) - goto error; - } - } - - *ptr = '\0'; - - if (mxmlElementGetAttr(node, name)) - goto error; - - if (ch == '=') - { - /* - * Read the attribute value... - */ - - if ((ch = (*getc_cb)(p, encoding)) == EOF) - { - mxml_error("Missing value for attribute '%s' in element %s!", - name, node->value.element.name); - return (EOF); - } - - if (ch == '\'' || ch == '\"') - { - /* - * Read quoted value... - */ - - quote = ch; - ptr = value; - - while ((ch = (*getc_cb)(p, encoding)) != EOF) - if (ch == quote) - break; - else - { - if (ch == '&') - if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &ptr, &value, &valsize)) - goto error; - } - - *ptr = '\0'; - } - else - { - /* - * Read unquoted value... - */ - - value[0] = ch; - ptr = value + 1; - - while ((ch = (*getc_cb)(p, encoding)) != EOF) - if (isspace(ch) || ch == '=' || ch == '/' || ch == '>') - break; - else - { - if (ch == '&') - if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) - goto error; - - if (mxml_add_char(ch, &ptr, &value, &valsize)) - goto error; - } - - *ptr = '\0'; - } - - /* - * Set the attribute with the given string value... - */ - - mxmlElementSetAttr(node, name, value); - } - else - { - /* - * Set the attribute with a NULL value... - */ - - mxmlElementSetAttr(node, name, NULL); - } - - /* - * Check the end character... - */ - - if (ch == '/' || ch == '?') - { - /* - * Grab the > character and print an error if it isn't there... - */ - - quote = (*getc_cb)(p, encoding); - - if (quote != '>') - { - mxml_error("Expected '>' after '%c' for element %s, but got '%c'!", - ch, node->value.element.name, quote); - ch = EOF; - } - - break; - } - else if (ch == '>') - break; - } - - /* - * Free the name and value buffers and return... - */ - - free(name); - free(value); - - return (ch); - - /* - * Common error return point... - */ - -error: - - free(name); - free(value); - - return (EOF); -} - - -/* - * 'mxml_string_getc()' - Get a character from a string. - */ - -static int /* O - Character or EOF */ -mxml_string_getc(void *p, /* I - Pointer to file */ - int *encoding) /* IO - Encoding */ -{ - int ch; /* Character */ - const char **s; /* Pointer to string pointer */ - - - s = (const char **)p; - - if ((ch = (*s)[0] & 255) != 0 || *encoding == ENCODE_UTF16LE) - { - /* - * Got character; convert UTF-8 to integer and return... - */ - - (*s)++; - - switch (*encoding) - { - case ENCODE_UTF8 : - if (!(ch & 0x80)) - { -#if DEBUG > 1 - printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - - return (ch); - } - else if (ch == 0xfe) - { - /* - * UTF-16 big-endian BOM? - */ - - if (((*s)[0] & 255) != 0xff) - return (EOF); - - *encoding = ENCODE_UTF16BE; - (*s)++; - - return (mxml_string_getc(p, encoding)); - } - else if (ch == 0xff) - { - /* - * UTF-16 little-endian BOM? - */ - - if (((*s)[0] & 255) != 0xfe) - return (EOF); - - *encoding = ENCODE_UTF16LE; - (*s)++; - - return (mxml_string_getc(p, encoding)); - } - else if ((ch & 0xe0) == 0xc0) - { - /* - * Two-byte value... - */ - - if (((*s)[0] & 0xc0) != 0x80) - return (EOF); - - ch = ((ch & 0x1f) << 6) | ((*s)[0] & 0x3f); - - (*s)++; - - if (ch < 0x80) - return (EOF); - -#if DEBUG > 1 - printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); - } - else if ((ch & 0xf0) == 0xe0) - { - /* - * Three-byte value... - */ - - if (((*s)[0] & 0xc0) != 0x80 || - ((*s)[1] & 0xc0) != 0x80) - return (EOF); - - ch = ((((ch & 0x0f) << 6) | ((*s)[0] & 0x3f)) << 6) | ((*s)[1] & 0x3f); - - (*s) += 2; - - if (ch < 0x800) - return (EOF); - -#if DEBUG > 1 - printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); - } - else if ((ch & 0xf8) == 0xf0) - { - /* - * Four-byte value... - */ - - if (((*s)[0] & 0xc0) != 0x80 || - ((*s)[1] & 0xc0) != 0x80 || - ((*s)[2] & 0xc0) != 0x80) - return (EOF); - - ch = ((((((ch & 0x07) << 6) | ((*s)[0] & 0x3f)) << 6) | - ((*s)[1] & 0x3f)) << 6) | ((*s)[2] & 0x3f); - - (*s) += 3; - - if (ch < 0x10000) - return (EOF); - -#if DEBUG > 1 - printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); - } - else - return (EOF); - - case ENCODE_UTF16BE : - /* - * Read UTF-16 big-endian char... - */ - - ch = (ch << 8) | ((*s)[0] & 255); - (*s) ++; - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - else if (ch >= 0xd800 && ch <= 0xdbff) - { - /* - * Multi-word UTF-16 char... - */ - - int lch; /* Lower word */ - - - if (!(*s)[0]) - return (EOF); - - lch = (((*s)[0] & 255) << 8) | ((*s)[1] & 255); - (*s) += 2; - - if (lch < 0xdc00 || lch >= 0xdfff) - return (EOF); - - ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; - } - -#if DEBUG > 1 - printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); - - case ENCODE_UTF16LE : - /* - * Read UTF-16 little-endian char... - */ - - ch = ch | (((*s)[0] & 255) << 8); - - if (!ch) - { - (*s) --; - return (EOF); - } - - (*s) ++; - - if (mxml_bad_char(ch)) - { - mxml_error("Bad control character 0x%02x not allowed by XML standard!", - ch); - return (EOF); - } - else if (ch >= 0xd800 && ch <= 0xdbff) - { - /* - * Multi-word UTF-16 char... - */ - - int lch; /* Lower word */ - - - if (!(*s)[1]) - return (EOF); - - lch = (((*s)[1] & 255) << 8) | ((*s)[0] & 255); - (*s) += 2; - - if (lch < 0xdc00 || lch >= 0xdfff) - return (EOF); - - ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; - } - -#if DEBUG > 1 - printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); -#endif /* DEBUG > 1 */ - - return (ch); - } - } - - return (EOF); -} - - -/* - * 'mxml_string_putc()' - Write a character to a string. - */ - -static int /* O - 0 on success, -1 on failure */ -mxml_string_putc(int ch, /* I - Character to write */ - void *p) /* I - Pointer to string pointers */ -{ - char **pp; /* Pointer to string pointers */ - - - pp = (char **)p; - - if (ch < 0x80) - { - /* - * Plain ASCII doesn't need special encoding... - */ - - if (pp[0] < pp[1]) - pp[0][0] = ch; - - pp[0] ++; - } - else if (ch < 0x800) - { - /* - * Two-byte UTF-8 character... - */ - - if ((pp[0] + 1) < pp[1]) - { - pp[0][0] = 0xc0 | (ch >> 6); - pp[0][1] = 0x80 | (ch & 0x3f); - } - - pp[0] += 2; - } - else if (ch < 0x10000) - { - /* - * Three-byte UTF-8 character... - */ - - if ((pp[0] + 2) < pp[1]) - { - pp[0][0] = 0xe0 | (ch >> 12); - pp[0][1] = 0x80 | ((ch >> 6) & 0x3f); - pp[0][2] = 0x80 | (ch & 0x3f); - } - - pp[0] += 3; - } - else - { - /* - * Four-byte UTF-8 character... - */ - - if ((pp[0] + 2) < pp[1]) - { - pp[0][0] = 0xf0 | (ch >> 18); - pp[0][1] = 0x80 | ((ch >> 12) & 0x3f); - pp[0][2] = 0x80 | ((ch >> 6) & 0x3f); - pp[0][3] = 0x80 | (ch & 0x3f); - } - - pp[0] += 4; - } - - return (0); -} - - -/* - * 'mxml_write_name()' - Write a name string. - */ - -static int /* O - 0 on success, -1 on failure */ -mxml_write_name(const char *s, /* I - Name to write */ - void *p, /* I - Write pointer */ - int (*putc_cb)(int, void *)) - /* I - Write callback */ -{ - char quote; /* Quote character */ - const char *name; /* Entity name */ - - - if (*s == '\"' || *s == '\'') - { - /* - * Write a quoted name string... - */ - - if ((*putc_cb)(*s, p) < 0) - return (-1); - - quote = *s++; - - while (*s && *s != quote) - { - if ((name = mxmlEntityGetName(*s)) != NULL) - { - if ((*putc_cb)('&', p) < 0) - return (-1); - - while (*name) - { - if ((*putc_cb)(*name, p) < 0) - return (-1); - - name ++; - } - - if ((*putc_cb)(';', p) < 0) - return (-1); - } - else if ((*putc_cb)(*s, p) < 0) - return (-1); - - s ++; - } - - /* - * Write the end quote... - */ - - if ((*putc_cb)(quote, p) < 0) - return (-1); - } - else - { - /* - * Write a non-quoted name string... - */ - - while (*s) - { - if ((*putc_cb)(*s, p) < 0) - return (-1); - - s ++; - } - } - - return (0); -} - - -/* - * 'mxml_write_node()' - Save an XML node to a file. - */ - -static int /* O - Column or -1 on error */ -mxml_write_node(mxml_node_t *node, /* I - Node to write */ - void *p, /* I - File to write to */ - const char *(*cb)(mxml_node_t *, int), - /* I - Whitespace callback */ - int col, /* I - Current column */ - int (*putc_cb)(int, void *)) -{ - int i, /* Looping var */ - width; /* Width of attr + value */ - mxml_attr_t *attr; /* Current attribute */ - char s[255]; /* Temporary string */ - - - while (node != NULL) - { - /* - * Print the node value... - */ - - switch (node->type) - { - case MXML_ELEMENT : - col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_OPEN, col, putc_cb); - - if ((*putc_cb)('<', p) < 0) - return (-1); - if (node->value.element.name[0] == '?' || - !strncmp(node->value.element.name, "!--", 3) || - !strncmp(node->value.element.name, "![CDATA[", 8)) - { - /* - * Comments, CDATA, and processing instructions do not - * use character entities. - */ - - const char *ptr; /* Pointer into name */ - - - for (ptr = node->value.element.name; *ptr; ptr ++) - if ((*putc_cb)(*ptr, p) < 0) - return (-1); - - /* - * Prefer a newline for whitespace after ?xml... - */ - - if (!strncmp(node->value.element.name, "?xml", 4)) - col = MXML_WRAP; - } - else if (mxml_write_name(node->value.element.name, p, putc_cb) < 0) - return (-1); - - col += strlen(node->value.element.name) + 1; - - for (i = node->value.element.num_attrs, attr = node->value.element.attrs; - i > 0; - i --, attr ++) - { - width = strlen(attr->name); - - if (attr->value) - width += strlen(attr->value) + 3; - - if ((col + width) > MXML_WRAP) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else - { - if ((*putc_cb)(' ', p) < 0) - return (-1); - - col ++; - } - - if (mxml_write_name(attr->name, p, putc_cb) < 0) - return (-1); - - if (attr->value) - { - if ((*putc_cb)('=', p) < 0) - return (-1); - if ((*putc_cb)('\"', p) < 0) - return (-1); - if (mxml_write_string(attr->value, p, putc_cb) < 0) - return (-1); - if ((*putc_cb)('\"', p) < 0) - return (-1); - } - - col += width; - } - - if (node->child) - { - /* - * Write children... - */ - - if ((*putc_cb)('>', p) < 0) - return (-1); - else - col ++; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); - - if ((col = mxml_write_node(node->child, p, cb, col, putc_cb)) < 0) - return (-1); - - /* - * The ? and ! elements are special-cases and have no end tags... - */ - - if (node->value.element.name[0] != '!' && - node->value.element.name[0] != '?') - { - col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_CLOSE, col, putc_cb); - - if ((*putc_cb)('<', p) < 0) - return (-1); - if ((*putc_cb)('/', p) < 0) - return (-1); - if (mxml_write_string(node->value.element.name, p, putc_cb) < 0) - return (-1); - if ((*putc_cb)('>', p) < 0) - return (-1); - - col += strlen(node->value.element.name) + 3; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_CLOSE, col, putc_cb); - } - } - else if (node->value.element.name[0] == '!' || - node->value.element.name[0] == '?') - { - /* - * The ? and ! elements are special-cases... - */ - - if ((*putc_cb)('>', p) < 0) - return (-1); - else - col ++; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); - } - else - { - if ((*putc_cb)(' ', p) < 0) - return (-1); - if ((*putc_cb)('/', p) < 0) - return (-1); - if ((*putc_cb)('>', p) < 0) - return (-1); - - col += 3; - - col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); - } - break; - - case MXML_INTEGER : - if (node->prev) - { - if (col > MXML_WRAP) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else if ((*putc_cb)(' ', p) < 0) - return (-1); - else - col ++; - } - - sprintf(s, "%d", node->value.integer); - if (mxml_write_string(s, p, putc_cb) < 0) - return (-1); - - col += strlen(s); - break; - - case MXML_OPAQUE : - if (mxml_write_string(node->value.opaque, p, putc_cb) < 0) - return (-1); - - col += strlen(node->value.opaque); - break; - - case MXML_REAL : - if (node->prev) - { - if (col > MXML_WRAP) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else if ((*putc_cb)(' ', p) < 0) - return (-1); - else - col ++; - } - - sprintf(s, "%f", node->value.real); - if (mxml_write_string(s, p, putc_cb) < 0) - return (-1); - - col += strlen(s); - break; - - case MXML_TEXT : - if (node->value.text.whitespace && col > 0) - { - if (col > MXML_WRAP) - { - if ((*putc_cb)('\n', p) < 0) - return (-1); - - col = 0; - } - else if ((*putc_cb)(' ', p) < 0) - return (-1); - else - col ++; - } - - if (mxml_write_string(node->value.text.string, p, putc_cb) < 0) - return (-1); - - col += strlen(node->value.text.string); - break; - - case MXML_CUSTOM : - if (mxml_custom_save_cb) - { - char *data; /* Custom data string */ - const char *newline; /* Last newline in string */ - - - if ((data = (*mxml_custom_save_cb)(node)) == NULL) - return (-1); - - if (mxml_write_string(data, p, putc_cb) < 0) - return (-1); - - if ((newline = strrchr(data, '\n')) == NULL) - col += strlen(data); - else - col = strlen(newline); - - free(data); - break; - } - - default : /* Should never happen */ - return (-1); - } - - /* - * Next node... - */ - - node = node->next; - } - - return (col); -} - - -/* - * 'mxml_write_string()' - Write a string, escaping & and < as needed. - */ - -static int /* O - 0 on success, -1 on failure */ -mxml_write_string(const char *s, /* I - String to write */ - void *p, /* I - Write pointer */ - int (*putc_cb)(int, void *)) - /* I - Write callback */ -{ - const char *name; /* Entity name, if any */ - - - while (*s) - { - if ((name = mxmlEntityGetName(*s)) != NULL) - { - if ((*putc_cb)('&', p) < 0) - return (-1); - - while (*name) - { - if ((*putc_cb)(*name, p) < 0) - return (-1); - name ++; - } - - if ((*putc_cb)(';', p) < 0) - return (-1); - } - else if ((*putc_cb)(*s, p) < 0) - return (-1); - - s ++; - } - - return (0); -} - - -/* - * 'mxml_write_ws()' - Do whitespace callback... - */ - -static int /* O - New column */ -mxml_write_ws(mxml_node_t *node, /* I - Current node */ - void *p, /* I - Write pointer */ - const char *(*cb)(mxml_node_t *, int), - /* I - Callback function */ - int ws, /* I - Where value */ - int col, /* I - Current column */ - int (*putc_cb)(int, void *)) - /* I - Write callback */ -{ - const char *s; /* Whitespace string */ - - - if (cb && (s = (*cb)(node, ws)) != NULL) - { - while (*s) - { - if ((*putc_cb)(*s, p) < 0) - return (-1); - else if (*s == '\n') - col = 0; - else if (*s == '\t') - { - col += MXML_TAB; - col = col - (col % MXML_TAB); - } - else - col ++; - - s ++; - } - } - - return (col); -} - - -/* - * End of "$Id: mxml-file.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-index.c b/zaptel/menuselect/mxml/mxml-index.c deleted file mode 100644 index aebb3d8d..00000000 --- a/zaptel/menuselect/mxml/mxml-index.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * "$Id: mxml-index.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Index support code for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlIndexDelete() - Delete an index. - * mxmlIndexEnum() - Return the next node in the index. - * mxmlIndexFind() - Find the next matching node. - * mxmlIndexNew() - Create a new index. - * mxmlIndexReset() - Reset the enumeration/find pointer in the index and - * return the first node in the index. - * index_compare() - Compare two nodes. - * index_find() - Compare a node with index values. - * index_sort() - Sort the nodes in the index... - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * Sort functions... - */ - -static int index_compare(mxml_index_t *ind, mxml_node_t *first, - mxml_node_t *second); -static int index_find(mxml_index_t *ind, const char *element, - const char *value, mxml_node_t *node); -static void index_sort(mxml_index_t *ind, int left, int right); - - -/* - * 'mxmlIndexDelete()' - Delete an index. - */ - -void -mxmlIndexDelete(mxml_index_t *ind) /* I - Index to delete */ -{ - /* - * Range check input.. - */ - - if (!ind) - return; - - /* - * Free memory... - */ - - if (ind->attr) - free(ind->attr); - - if (ind->alloc_nodes) - free(ind->nodes); - - free(ind); -} - - -/* - * 'mxmlIndexEnum()' - Return the next node in the index. - * - * Nodes are returned in the sorted order of the index. - */ - -mxml_node_t * /* O - Next node or NULL if there is none */ -mxmlIndexEnum(mxml_index_t *ind) /* I - Index to enumerate */ -{ - /* - * Range check input... - */ - - if (!ind) - return (NULL); - - /* - * Return the next node... - */ - - if (ind->cur_node < ind->num_nodes) - return (ind->nodes[ind->cur_node ++]); - else - return (NULL); -} - - -/* - * 'mxmlIndexFind()' - Find the next matching node. - * - * You should call mxmlIndexReset() prior to using this function for - * the first time with a particular set of "element" and "value" - * strings. Passing NULL for both "element" and "value" is equivalent - * to calling mxmlIndexEnum(). - */ - -mxml_node_t * /* O - Node or NULL if none found */ -mxmlIndexFind(mxml_index_t *ind, /* I - Index to search */ - const char *element, /* I - Element name to find, if any */ - const char *value) /* I - Attribute value, if any */ -{ - int diff, /* Difference between names */ - current, /* Current entity in search */ - first, /* First entity in search */ - last; /* Last entity in search */ - - -#ifdef DEBUG - printf("mxmlIndexFind(ind=%p, element=\"%s\", value=\"%s\")\n", - ind, element ? element : "(null)", value ? value : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!ind || (!ind->attr && value)) - { -#ifdef DEBUG - puts(" returning NULL..."); - printf(" ind->attr=\"%s\"\n", ind->attr ? ind->attr : "(null)"); -#endif /* DEBUG */ - - return (NULL); - } - - /* - * If both element and value are NULL, just enumerate the nodes in the - * index... - */ - - if (!element && !value) - return (mxmlIndexEnum(ind)); - - /* - * If there are no nodes in the index, return NULL... - */ - - if (!ind->num_nodes) - { -#ifdef DEBUG - puts(" returning NULL..."); - puts(" no nodes!"); -#endif /* DEBUG */ - - return (NULL); - } - - /* - * If cur_node == 0, then find the first matching node... - */ - - if (ind->cur_node == 0) - { - /* - * Find the first node using a modified binary search algorithm... - */ - - first = 0; - last = ind->num_nodes - 1; - -#ifdef DEBUG - printf(" find first time, num_nodes=%d...\n", ind->num_nodes); -#endif /* DEBUG */ - - while ((last - first) > 1) - { - current = (first + last) / 2; - -#ifdef DEBUG - printf(" first=%d, last=%d, current=%d\n", first, last, current); -#endif /* DEBUG */ - - if ((diff = index_find(ind, element, value, ind->nodes[current])) == 0) - { - /* - * Found a match, move back to find the first... - */ - -#ifdef DEBUG - puts(" match!"); -#endif /* DEBUG */ - - while (current > 0 && - !index_find(ind, element, value, ind->nodes[current - 1])) - current --; - -#ifdef DEBUG - printf(" returning first match=%d\n", current); -#endif /* DEBUG */ - - /* - * Return the first match and save the index to the next... - */ - - ind->cur_node = current + 1; - - return (ind->nodes[current]); - } - else if (diff < 0) - last = current; - else - first = current; - -#ifdef DEBUG - printf(" diff=%d\n", diff); -#endif /* DEBUG */ - } - - /* - * If we get this far, then we found exactly 0 or 1 matches... - */ - - for (current = first; current <= last; current ++) - if (!index_find(ind, element, value, ind->nodes[current])) - { - /* - * Found exactly one (or possibly two) match... - */ - -#ifdef DEBUG - printf(" returning only match %d...\n", current); -#endif /* DEBUG */ - - ind->cur_node = current + 1; - - return (ind->nodes[current]); - } - - /* - * No matches... - */ - - ind->cur_node = ind->num_nodes; - -#ifdef DEBUG - puts(" returning NULL..."); -#endif /* DEBUG */ - - return (NULL); - } - else if (ind->cur_node < ind->num_nodes && - !index_find(ind, element, value, ind->nodes[ind->cur_node])) - { - /* - * Return the next matching node... - */ - -#ifdef DEBUG - printf(" returning next match %d...\n", ind->cur_node); -#endif /* DEBUG */ - - return (ind->nodes[ind->cur_node ++]); - } - - /* - * If we get this far, then we have no matches... - */ - - ind->cur_node = ind->num_nodes; - -#ifdef DEBUG - puts(" returning NULL..."); -#endif /* DEBUG */ - - return (NULL); -} - - -/* - * 'mxmlIndexNew()' - Create a new index. - * - * The index will contain all nodes that contain the named element and/or - * attribute. If both "element" and "attr" are NULL, then the index will - * contain a sorted list of the elements in the node tree. Nodes are - * sorted by element name and optionally by attribute value if the "attr" - * argument is not NULL. - */ - -mxml_index_t * /* O - New index */ -mxmlIndexNew(mxml_node_t *node, /* I - XML node tree */ - const char *element, /* I - Element to index or NULL for all */ - const char *attr) /* I - Attribute to index or NULL for none */ -{ - mxml_index_t *ind; /* New index */ - mxml_node_t *current, /* Current node in index */ - **temp; /* Temporary node pointer array */ - - - /* - * Range check input... - */ - -#ifdef DEBUG - printf("mxmlIndexNew(node=%p, element=\"%s\", attr=\"%s\")\n", - node, element ? element : "(null)", attr ? attr : "(null)"); -#endif /* DEBUG */ - - if (!node) - return (NULL); - - /* - * Create a new index... - */ - - if ((ind = calloc(1, sizeof(mxml_index_t))) == NULL) - { - mxml_error("Unable to allocate %d bytes for index - %s", - sizeof(mxml_index_t), strerror(errno)); - return (NULL); - } - - if (attr) - ind->attr = strdup(attr); - - if (!element && !attr) - current = node; - else - current = mxmlFindElement(node, node, element, attr, NULL, MXML_DESCEND); - - while (current) - { - if (ind->num_nodes >= ind->alloc_nodes) - { - if (!ind->alloc_nodes) - temp = malloc(64 * sizeof(mxml_node_t *)); - else - temp = realloc(ind->nodes, (ind->alloc_nodes + 64) * sizeof(mxml_node_t *)); - - if (!temp) - { - /* - * Unable to allocate memory for the index, so abort... - */ - - mxml_error("Unable to allocate %d bytes for index: %s", - (ind->alloc_nodes + 64) * sizeof(mxml_node_t *), - strerror(errno)); - - mxmlIndexDelete(ind); - return (NULL); - } - - ind->nodes = temp; - ind->alloc_nodes += 64; - } - - ind->nodes[ind->num_nodes ++] = current; - - current = mxmlFindElement(current, node, element, attr, NULL, MXML_DESCEND); - } - - /* - * Sort nodes based upon the search criteria... - */ - -#ifdef DEBUG - { - int i; /* Looping var */ - - - printf("%d node(s) in index.\n\n", ind->num_nodes); - - if (attr) - { - printf("Node Address Element %s\n", attr); - puts("-------- -------- -------------- ------------------------------"); - - for (i = 0; i < ind->num_nodes; i ++) - printf("%8d %-8p %-14.14s %s\n", i, ind->nodes[i], - ind->nodes[i]->value.element.name, - mxmlElementGetAttr(ind->nodes[i], attr)); - } - else - { - puts("Node Address Element"); - puts("-------- -------- --------------"); - - for (i = 0; i < ind->num_nodes; i ++) - printf("%8d %-8p %s\n", i, ind->nodes[i], - ind->nodes[i]->value.element.name); - } - - putchar('\n'); - } -#endif /* DEBUG */ - - if (ind->num_nodes > 1) - index_sort(ind, 0, ind->num_nodes - 1); - -#ifdef DEBUG - { - int i; /* Looping var */ - - - puts("After sorting:\n"); - - if (attr) - { - printf("Node Address Element %s\n", attr); - puts("-------- -------- -------------- ------------------------------"); - - for (i = 0; i < ind->num_nodes; i ++) - printf("%8d %-8p %-14.14s %s\n", i, ind->nodes[i], - ind->nodes[i]->value.element.name, - mxmlElementGetAttr(ind->nodes[i], attr)); - } - else - { - puts("Node Address Element"); - puts("-------- -------- --------------"); - - for (i = 0; i < ind->num_nodes; i ++) - printf("%8d %-8p %s\n", i, ind->nodes[i], - ind->nodes[i]->value.element.name); - } - - putchar('\n'); - } -#endif /* DEBUG */ - - /* - * Return the new index... - */ - - return (ind); -} - - -/* - * 'mxmlIndexReset()' - Reset the enumeration/find pointer in the index and - * return the first node in the index. - * - * This function should be called prior to using mxmlIndexEnum() or - * mxmlIndexFind() for the first time. - */ - -mxml_node_t * /* O - First node or NULL if there is none */ -mxmlIndexReset(mxml_index_t *ind) /* I - Index to reset */ -{ -#ifdef DEBUG - printf("mxmlIndexReset(ind=%p)\n", ind); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!ind) - return (NULL); - - /* - * Set the index to the first element... - */ - - ind->cur_node = 0; - - /* - * Return the first node... - */ - - if (ind->num_nodes) - return (ind->nodes[0]); - else - return (NULL); -} - - -/* - * 'index_compare()' - Compare two nodes. - */ - -static int /* O - Result of comparison */ -index_compare(mxml_index_t *ind, /* I - Index */ - mxml_node_t *first, /* I - First node */ - mxml_node_t *second) /* I - Second node */ -{ - int diff; /* Difference */ - - - /* - * Check the element name... - */ - - if ((diff = strcmp(first->value.element.name, - second->value.element.name)) != 0) - return (diff); - - /* - * Check the attribute value... - */ - - if (ind->attr) - { - if ((diff = strcmp(mxmlElementGetAttr(first, ind->attr), - mxmlElementGetAttr(second, ind->attr))) != 0) - return (diff); - } - - /* - * No difference, return 0... - */ - - return (0); -} - - -/* - * 'index_find()' - Compare a node with index values. - */ - -static int /* O - Result of comparison */ -index_find(mxml_index_t *ind, /* I - Index */ - const char *element, /* I - Element name or NULL */ - const char *value, /* I - Attribute value or NULL */ - mxml_node_t *node) /* I - Node */ -{ - int diff; /* Difference */ - - - /* - * Check the element name... - */ - - if (element) - { - if ((diff = strcmp(element, node->value.element.name)) != 0) - return (diff); - } - - /* - * Check the attribute value... - */ - - if (value) - { - if ((diff = strcmp(value, mxmlElementGetAttr(node, ind->attr))) != 0) - return (diff); - } - - /* - * No difference, return 0... - */ - - return (0); -} - - -/* - * 'index_sort()' - Sort the nodes in the index... - * - * This function implements the classic quicksort algorithm... - */ - -static void -index_sort(mxml_index_t *ind, /* I - Index to sort */ - int left, /* I - Left node in partition */ - int right) /* I - Right node in partition */ -{ - mxml_node_t *pivot, /* Pivot node */ - *temp; /* Swap node */ - int templ, /* Temporary left node */ - tempr; /* Temporary right node */ - - - /* - * Loop until we have sorted all the way to the right... - */ - - do - { - /* - * Sort the pivot in the current partition... - */ - - pivot = ind->nodes[left]; - - for (templ = left, tempr = right; templ < tempr;) - { - /* - * Move left while left node <= pivot node... - */ - - while ((templ < right) && - index_compare(ind, ind->nodes[templ], pivot) <= 0) - templ ++; - - /* - * Move right while right node > pivot node... - */ - - while ((tempr > left) && - index_compare(ind, ind->nodes[tempr], pivot) > 0) - tempr --; - - /* - * Swap nodes if needed... - */ - - if (templ < tempr) - { - temp = ind->nodes[templ]; - ind->nodes[templ] = ind->nodes[tempr]; - ind->nodes[tempr] = temp; - } - } - - /* - * When we get here, the right (tempr) node is the new position for the - * pivot node... - */ - - if (index_compare(ind, pivot, ind->nodes[tempr]) > 0) - { - ind->nodes[left] = ind->nodes[tempr]; - ind->nodes[tempr] = pivot; - } - - /* - * Recursively sort the left partition as needed... - */ - - if (left < (tempr - 1)) - index_sort(ind, left, tempr - 1); - } - while (right > (left = tempr + 1)); -} - - -/* - * End of "$Id: mxml-index.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-node.c b/zaptel/menuselect/mxml/mxml-node.c deleted file mode 100644 index f4ab4214..00000000 --- a/zaptel/menuselect/mxml/mxml-node.c +++ /dev/null @@ -1,664 +0,0 @@ -/* - * "$Id: mxml-node.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Node support code for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlAdd() - Add a node to a tree. - * mxmlDelete() - Delete a node and all of its children. - * mxmlNewElement() - Create a new element node. - * mxmlNewInteger() - Create a new integer node. - * mxmlNewOpaque() - Create a new opaque string. - * mxmlNewReal() - Create a new real number node. - * mxmlNewText() - Create a new text fragment node. - * mxmlNewTextf() - Create a new formatted text fragment node. - * mxmlRemove() - Remove a node from its parent. - * mxml_new() - Create a new node. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * Local functions... - */ - -static mxml_node_t *mxml_new(mxml_node_t *parent, mxml_type_t type); - - -/* - * 'mxmlAdd()' - Add a node to a tree. - * - * Adds the specified node to the parent. If the child argument is not - * NULL, puts the new node before or after the specified child depending - * on the value of the where argument. If the child argument is NULL, - * puts the new node at the beginning of the child list (MXML_ADD_BEFORE) - * or at the end of the child list (MXML_ADD_AFTER). The constant - * MXML_ADD_TO_PARENT can be used to specify a NULL child pointer. - */ - -void -mxmlAdd(mxml_node_t *parent, /* I - Parent node */ - int where, /* I - Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER */ - mxml_node_t *child, /* I - Child node for where or MXML_ADD_TO_PARENT */ - mxml_node_t *node) /* I - Node to add */ -{ -#ifdef DEBUG - fprintf(stderr, "mxmlAdd(parent=%p, where=%d, child=%p, node=%p)\n", parent, - where, child, node); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!parent || !node) - return; - -#if DEBUG > 1 - fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); - if (parent) - { - fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child); - fprintf(stderr, " BEFORE: parent->last_child=%p\n", parent->last_child); - fprintf(stderr, " BEFORE: parent->prev=%p\n", parent->prev); - fprintf(stderr, " BEFORE: parent->next=%p\n", parent->next); - } -#endif /* DEBUG > 1 */ - - /* - * Remove the node from any existing parent... - */ - - if (node->parent) - mxmlRemove(node); - - /* - * Reset pointers... - */ - - node->parent = parent; - - switch (where) - { - case MXML_ADD_BEFORE : - if (!child || child == parent->child || child->parent != parent) - { - /* - * Insert as first node under parent... - */ - - node->next = parent->child; - - if (parent->child) - parent->child->prev = node; - else - parent->last_child = node; - - parent->child = node; - } - else - { - /* - * Insert node before this child... - */ - - node->next = child; - node->prev = child->prev; - - if (child->prev) - child->prev->next = node; - else - parent->child = node; - - child->prev = node; - } - break; - - case MXML_ADD_AFTER : - if (!child || child == parent->last_child || child->parent != parent) - { - /* - * Insert as last node under parent... - */ - - node->parent = parent; - node->prev = parent->last_child; - - if (parent->last_child) - parent->last_child->next = node; - else - parent->child = node; - - parent->last_child = node; - } - else - { - /* - * Insert node after this child... - */ - - node->prev = child; - node->next = child->next; - - if (child->next) - child->next->prev = node; - else - parent->last_child = node; - - child->next = node; - } - break; - } - -#if DEBUG > 1 - fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); - if (parent) - { - fprintf(stderr, " AFTER: parent->child=%p\n", parent->child); - fprintf(stderr, " AFTER: parent->last_child=%p\n", parent->last_child); - fprintf(stderr, " AFTER: parent->prev=%p\n", parent->prev); - fprintf(stderr, " AFTER: parent->next=%p\n", parent->next); - } -#endif /* DEBUG > 1 */ -} - - -/* - * 'mxmlDelete()' - Delete a node and all of its children. - * - * If the specified node has a parent, this function first removes the - * node from its parent using the mxmlRemove() function. - */ - -void -mxmlDelete(mxml_node_t *node) /* I - Node to delete */ -{ - int i; /* Looping var */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlDelete(node=%p)\n", node); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!node) - return; - - /* - * Remove the node from its parent, if any... - */ - - mxmlRemove(node); - - /* - * Delete children... - */ - - while (node->child) - mxmlDelete(node->child); - - /* - * Now delete any node data... - */ - - switch (node->type) - { - case MXML_ELEMENT : - if (node->value.element.name) - free(node->value.element.name); - - if (node->value.element.num_attrs) - { - for (i = 0; i < node->value.element.num_attrs; i ++) - { - if (node->value.element.attrs[i].name) - free(node->value.element.attrs[i].name); - if (node->value.element.attrs[i].value) - free(node->value.element.attrs[i].value); - } - - free(node->value.element.attrs); - } - break; - case MXML_INTEGER : - /* Nothing to do */ - break; - case MXML_OPAQUE : - if (node->value.opaque) - free(node->value.opaque); - break; - case MXML_REAL : - /* Nothing to do */ - break; - case MXML_TEXT : - if (node->value.text.string) - free(node->value.text.string); - break; - case MXML_CUSTOM : - if (node->value.custom.data && - node->value.custom.destroy) - (*(node->value.custom.destroy))(node->value.custom.data); - break; - } - - /* - * Free this node... - */ - - free(node); -} - - -/* - * 'mxmlNewCustom()' - Create a new custom data node. - * - * The new custom node is added to the end of the specified parent's child - * list. The constant MXML_NO_PARENT can be used to specify that the new - * element node has no parent. NULL can be passed when the data in the - * node is not dynamically allocated or is separately managed. - */ - -mxml_node_t * /* O - New node */ -mxmlNewCustom(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - void *data, /* I - Pointer to data */ - void (*destroy)(void *)) - /* I - Function to destroy data */ -{ - mxml_node_t *node; /* New node */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewCustom(parent=%p, data=%p, destroy=%p)\n", parent, - data, destroy); -#endif /* DEBUG */ - - /* - * Create the node and set the value... - */ - - if ((node = mxml_new(parent, MXML_CUSTOM)) != NULL) - { - node->value.custom.data = data; - node->value.custom.destroy = destroy; - } - - return (node); -} - - -/* - * 'mxmlNewElement()' - Create a new element node. - * - * The new element node is added to the end of the specified parent's child - * list. The constant MXML_NO_PARENT can be used to specify that the new - * element node has no parent. - */ - -mxml_node_t * /* O - New node */ -mxmlNewElement(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - const char *name) /* I - Name of element */ -{ - mxml_node_t *node; /* New node */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewElement(parent=%p, name=\"%s\")\n", parent, - name ? name : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!name) - return (NULL); - - /* - * Create the node and set the element name... - */ - - if ((node = mxml_new(parent, MXML_ELEMENT)) != NULL) - node->value.element.name = strdup(name); - - return (node); -} - - -/* - * 'mxmlNewInteger()' - Create a new integer node. - * - * The new integer node is added to the end of the specified parent's child - * list. The constant MXML_NO_PARENT can be used to specify that the new - * integer node has no parent. - */ - -mxml_node_t * /* O - New node */ -mxmlNewInteger(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - int integer) /* I - Integer value */ -{ - mxml_node_t *node; /* New node */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewInteger(parent=%p, integer=%d)\n", parent, integer); -#endif /* DEBUG */ - - /* - * Create the node and set the element name... - */ - - if ((node = mxml_new(parent, MXML_INTEGER)) != NULL) - node->value.integer = integer; - - return (node); -} - - -/* - * 'mxmlNewOpaque()' - Create a new opaque string. - * - * The new opaque node is added to the end of the specified parent's child - * list. The constant MXML_NO_PARENT can be used to specify that the new - * opaque node has no parent. The opaque string must be nul-terminated and - * is copied into the new node. - */ - -mxml_node_t * /* O - New node */ -mxmlNewOpaque(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - const char *opaque) /* I - Opaque string */ -{ - mxml_node_t *node; /* New node */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewOpaque(parent=%p, opaque=\"%s\")\n", parent, - opaque ? opaque : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!opaque) - return (NULL); - - /* - * Create the node and set the element name... - */ - - if ((node = mxml_new(parent, MXML_OPAQUE)) != NULL) - node->value.opaque = strdup(opaque); - - return (node); -} - - -/* - * 'mxmlNewReal()' - Create a new real number node. - * - * The new real number node is added to the end of the specified parent's - * child list. The constant MXML_NO_PARENT can be used to specify that - * the new real number node has no parent. - */ - -mxml_node_t * /* O - New node */ -mxmlNewReal(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - double real) /* I - Real number value */ -{ - mxml_node_t *node; /* New node */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewReal(parent=%p, real=%g)\n", parent, real); -#endif /* DEBUG */ - - /* - * Create the node and set the element name... - */ - - if ((node = mxml_new(parent, MXML_REAL)) != NULL) - node->value.real = real; - - return (node); -} - - -/* - * 'mxmlNewText()' - Create a new text fragment node. - * - * The new text node is added to the end of the specified parent's child - * list. The constant MXML_NO_PARENT can be used to specify that the new - * text node has no parent. The whitespace parameter is used to specify - * whether leading whitespace is present before the node. The text - * string must be nul-terminated and is copied into the new node. - */ - -mxml_node_t * /* O - New node */ -mxmlNewText(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ - const char *string) /* I - String */ -{ - mxml_node_t *node; /* New node */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewText(parent=%p, whitespace=%d, string=\"%s\")\n", - parent, whitespace, string ? string : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!string) - return (NULL); - - /* - * Create the node and set the text value... - */ - - if ((node = mxml_new(parent, MXML_TEXT)) != NULL) - { - node->value.text.whitespace = whitespace; - node->value.text.string = strdup(string); - } - - return (node); -} - - -/* - * 'mxmlNewTextf()' - Create a new formatted text fragment node. - * - * The new text node is added to the end of the specified parent's child - * list. The constant MXML_NO_PARENT can be used to specify that the new - * text node has no parent. The whitespace parameter is used to specify - * whether leading whitespace is present before the node. The format - * string must be nul-terminated and is formatted into the new node. - */ - -mxml_node_t * /* O - New node */ -mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ - int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ - const char *format, /* I - Printf-style frmat string */ - ...) /* I - Additional args as needed */ -{ - mxml_node_t *node; /* New node */ - va_list ap; /* Pointer to arguments */ - - -#ifdef DEBUG - fprintf(stderr, "mxmlNewTextf(parent=%p, whitespace=%d, format=\"%s\", ...)\n", - parent, whitespace, format ? format : "(null)"); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!format) - return (NULL); - - /* - * Create the node and set the text value... - */ - - if ((node = mxml_new(parent, MXML_TEXT)) != NULL) - { - va_start(ap, format); - - node->value.text.whitespace = whitespace; - node->value.text.string = mxml_strdupf(format, ap); - - va_end(ap); - } - - return (node); -} - - -/* - * 'mxmlRemove()' - Remove a node from its parent. - * - * Does not free memory used by the node - use mxmlDelete() for that. - * This function does nothing if the node has no parent. - */ - -void -mxmlRemove(mxml_node_t *node) /* I - Node to remove */ -{ -#ifdef DEBUG - fprintf(stderr, "mxmlRemove(node=%p)\n", node); -#endif /* DEBUG */ - - /* - * Range check input... - */ - - if (!node || !node->parent) - return; - - /* - * Remove from parent... - */ - -#if DEBUG > 1 - fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); - if (node->parent) - { - fprintf(stderr, " BEFORE: node->parent->child=%p\n", node->parent->child); - fprintf(stderr, " BEFORE: node->parent->last_child=%p\n", node->parent->last_child); - } - fprintf(stderr, " BEFORE: node->child=%p\n", node->child); - fprintf(stderr, " BEFORE: node->last_child=%p\n", node->last_child); - fprintf(stderr, " BEFORE: node->prev=%p\n", node->prev); - fprintf(stderr, " BEFORE: node->next=%p\n", node->next); -#endif /* DEBUG > 1 */ - - if (node->prev) - node->prev->next = node->next; - else - node->parent->child = node->next; - - if (node->next) - node->next->prev = node->prev; - else - node->parent->last_child = node->prev; - - node->parent = NULL; - node->prev = NULL; - node->next = NULL; - -#if DEBUG > 1 - fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); - if (node->parent) - { - fprintf(stderr, " AFTER: node->parent->child=%p\n", node->parent->child); - fprintf(stderr, " AFTER: node->parent->last_child=%p\n", node->parent->last_child); - } - fprintf(stderr, " AFTER: node->child=%p\n", node->child); - fprintf(stderr, " AFTER: node->last_child=%p\n", node->last_child); - fprintf(stderr, " AFTER: node->prev=%p\n", node->prev); - fprintf(stderr, " AFTER: node->next=%p\n", node->next); -#endif /* DEBUG > 1 */ -} - - -/* - * 'mxml_new()' - Create a new node. - */ - -static mxml_node_t * /* O - New node */ -mxml_new(mxml_node_t *parent, /* I - Parent node */ - mxml_type_t type) /* I - Node type */ -{ - mxml_node_t *node; /* New node */ - - -#if DEBUG > 1 - fprintf(stderr, "mxml_new(parent=%p, type=%d)\n", parent, type); -#endif /* DEBUG > 1 */ - - /* - * Allocate memory for the node... - */ - - if ((node = calloc(1, sizeof(mxml_node_t))) == NULL) - { -#if DEBUG > 1 - fputs(" returning NULL\n", stderr); -#endif /* DEBUG > 1 */ - - return (NULL); - } - -#if DEBUG > 1 - fprintf(stderr, " returning %p\n", node); -#endif /* DEBUG > 1 */ - - /* - * Set the node type... - */ - - node->type = type; - - /* - * Add to the parent if present... - */ - - if (parent) - mxmlAdd(parent, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node); - - /* - * Return the new node... - */ - - return (node); -} - - -/* - * End of "$Id: mxml-node.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-private.c b/zaptel/menuselect/mxml/mxml-private.c deleted file mode 100644 index 6d84013a..00000000 --- a/zaptel/menuselect/mxml/mxml-private.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * "$Id: mxml-private.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Private functions for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxml_error() - Display an error message. - * mxml_integer_cb() - Default callback for integer values. - * mxml_opaque_cb() - Default callback for opaque values. - * mxml_real_cb() - Default callback for real number values. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * Error callback function... - */ - -void (*mxml_error_cb)(const char *) = NULL; - - -/* - * 'mxml_error()' - Display an error message. - */ - -void -mxml_error(const char *format, /* I - Printf-style format string */ - ...) /* I - Additional arguments as needed */ -{ - va_list ap; /* Pointer to arguments */ - char *s; /* Message string */ - - - /* - * Range check input... - */ - - if (!format) - return; - - /* - * Format the error message string... - */ - - va_start(ap, format); - - s = mxml_strdupf(format, ap); - - va_end(ap); - - /* - * And then display the error message... - */ - - if (mxml_error_cb) - (*mxml_error_cb)(s); - else - fprintf(stderr, "mxml: %s\n", s); - - /* - * Free the string... - */ - - free(s); -} - - -/* - * 'mxml_integer_cb()' - Default callback for integer values. - */ - -mxml_type_t /* O - Node type */ -mxml_integer_cb(mxml_node_t *node) /* I - Current node */ -{ - (void)node; - - return (MXML_INTEGER); -} - - -/* - * 'mxml_opaque_cb()' - Default callback for opaque values. - */ - -mxml_type_t /* O - Node type */ -mxml_opaque_cb(mxml_node_t *node) /* I - Current node */ -{ - (void)node; - - return (MXML_OPAQUE); -} - - -/* - * 'mxml_real_cb()' - Default callback for real number values. - */ - -mxml_type_t /* O - Node type */ -mxml_real_cb(mxml_node_t *node) /* I - Current node */ -{ - (void)node; - - return (MXML_REAL); -} - - -/* - * End of "$Id: mxml-private.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-search.c b/zaptel/menuselect/mxml/mxml-search.c deleted file mode 100644 index cb4c086b..00000000 --- a/zaptel/menuselect/mxml/mxml-search.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * "$Id: mxml-search.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Search/navigation functions for Mini-XML, a small XML-like file - * parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlFindElement() - Find the named element. - * mxmlWalkNext() - Walk to the next logical node in the tree. - * mxmlWalkPrev() - Walk to the previous logical node in the tree. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * 'mxmlFindElement()' - Find the named element. - * - * The search is constrained by the name, attribute name, and value; any - * NULL names or values are treated as wildcards, so different kinds of - * searches can be implemented by looking for all elements of a given name - * or all elements with a specific attribute. The descend argument determines - * whether the search descends into child nodes; normally you will use - * MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find - * additional direct descendents of the node. The top node argument - * constrains the search to a particular node's children. - */ - -mxml_node_t * /* O - Element node or NULL */ -mxmlFindElement(mxml_node_t *node, /* I - Current node */ - mxml_node_t *top, /* I - Top node */ - const char *name, /* I - Element name or NULL for any */ - const char *attr, /* I - Attribute name, or NULL for none */ - const char *value, /* I - Attribute value, or NULL for any */ - int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ -{ - const char *temp; /* Current attribute value */ - - - /* - * Range check input... - */ - - if (!node || !top || (!attr && value)) - return (NULL); - - /* - * Start with the next node... - */ - - node = mxmlWalkNext(node, top, descend); - - /* - * Loop until we find a matching element... - */ - - while (node != NULL) - { - /* - * See if this node matches... - */ - - if (node->type == MXML_ELEMENT && - node->value.element.name && - (!name || !strcmp(node->value.element.name, name))) - { - /* - * See if we need to check for an attribute... - */ - - if (!attr) - return (node); /* No attribute search, return it... */ - - /* - * Check for the attribute... - */ - - if ((temp = mxmlElementGetAttr(node, attr)) != NULL) - { - /* - * OK, we have the attribute, does it match? - */ - - if (!value || !strcmp(value, temp)) - return (node); /* Yes, return it... */ - } - } - - /* - * No match, move on to the next node... - */ - - if (descend == MXML_DESCEND) - node = mxmlWalkNext(node, top, MXML_DESCEND); - else - node = node->next; - } - - return (NULL); -} - - -/* - * 'mxmlWalkNext()' - Walk to the next logical node in the tree. - * - * The descend argument controls whether the first child is considered - * to be the next node. The top node argument constrains the walk to - * the node's children. - */ - -mxml_node_t * /* O - Next node or NULL */ -mxmlWalkNext(mxml_node_t *node, /* I - Current node */ - mxml_node_t *top, /* I - Top node */ - int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ -{ - if (!node) - return (NULL); - else if (node->child && descend) - return (node->child); - else if (node->next) - return (node->next); - else if (node->parent && node->parent != top) - { - node = node->parent; - - while (!node->next) - if (node->parent == top || !node->parent) - return (NULL); - else - node = node->parent; - - return (node->next); - } - else - return (NULL); -} - - -/* - * 'mxmlWalkPrev()' - Walk to the previous logical node in the tree. - * - * The descend argument controls whether the previous node's last child - * is considered to be the previous node. The top node argument constrains - * the walk to the node's children. - */ - -mxml_node_t * /* O - Previous node or NULL */ -mxmlWalkPrev(mxml_node_t *node, /* I - Current node */ - mxml_node_t *top, /* I - Top node */ - int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ -{ - if (!node) - return (NULL); - else if (node->prev) - { - if (node->prev->last_child && descend) - { - /* - * Find the last child under the previous node... - */ - - node = node->prev->last_child; - - while (node->last_child) - node = node->last_child; - - return (node); - } - else - return (node->prev); - } - else if (node->parent != top) - return (node->parent); - else - return (NULL); -} - - -/* - * End of "$Id: mxml-search.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-set.c b/zaptel/menuselect/mxml/mxml-set.c deleted file mode 100644 index ae18952a..00000000 --- a/zaptel/menuselect/mxml/mxml-set.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * "$Id: mxml-set.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Node set functions for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxmlSetElement() - Set the name of an element node. - * mxmlSetInteger() - Set the value of an integer node. - * mxmlSetOpaque() - Set the value of an opaque node. - * mxmlSetReal() - Set the value of a real number node. - * mxmlSetText() - Set the value of a text node. - * mxmlSetTextf() - Set the value of a text node to a formatted string. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" -#include "mxml.h" - - -/* - * 'mxmlSetCustom()' - Set the data and destructor of a custom data node. - * - * The node is not changed if it is not a custom node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetCustom(mxml_node_t *node, /* I - Node to set */ - void *data, /* I - New data pointer */ - void (*destroy)(void *)) - /* I - New destructor function */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_CUSTOM) - return (-1); - - /* - * Free any old element value and set the new value... - */ - - if (node->value.custom.data && node->value.custom.destroy) - (*(node->value.custom.destroy))(node->value.custom.data); - - node->value.custom.data = data; - node->value.custom.destroy = destroy; - - return (0); -} - - -/* - * 'mxmlSetElement()' - Set the name of an element node. - * - * The node is not changed if it is not an element node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetElement(mxml_node_t *node, /* I - Node to set */ - const char *name) /* I - New name string */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_ELEMENT || !name) - return (-1); - - /* - * Free any old element value and set the new value... - */ - - if (node->value.element.name) - free(node->value.element.name); - - node->value.element.name = strdup(name); - - return (0); -} - - -/* - * 'mxmlSetInteger()' - Set the value of an integer node. - * - * The node is not changed if it is not an integer node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetInteger(mxml_node_t *node, /* I - Node to set */ - int integer) /* I - Integer value */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_INTEGER) - return (-1); - - /* - * Set the new value and return... - */ - - node->value.integer = integer; - - return (0); -} - - -/* - * 'mxmlSetOpaque()' - Set the value of an opaque node. - * - * The node is not changed if it is not an opaque node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */ - const char *opaque) /* I - Opaque string */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_OPAQUE || !opaque) - return (-1); - - /* - * Free any old opaque value and set the new value... - */ - - if (node->value.opaque) - free(node->value.opaque); - - node->value.opaque = strdup(opaque); - - return (0); -} - - -/* - * 'mxmlSetReal()' - Set the value of a real number node. - * - * The node is not changed if it is not a real number node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetReal(mxml_node_t *node, /* I - Node to set */ - double real) /* I - Real number value */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_REAL) - return (-1); - - /* - * Set the new value and return... - */ - - node->value.real = real; - - return (0); -} - - -/* - * 'mxmlSetText()' - Set the value of a text node. - * - * The node is not changed if it is not a text node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetText(mxml_node_t *node, /* I - Node to set */ - int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ - const char *string) /* I - String */ -{ - /* - * Range check input... - */ - - if (!node || node->type != MXML_TEXT || !string) - return (-1); - - /* - * Free any old string value and set the new value... - */ - - if (node->value.text.string) - free(node->value.text.string); - - node->value.text.whitespace = whitespace; - node->value.text.string = strdup(string); - - return (0); -} - - -/* - * 'mxmlSetTextf()' - Set the value of a text node to a formatted string. - * - * The node is not changed if it is not a text node. - */ - -int /* O - 0 on success, -1 on failure */ -mxmlSetTextf(mxml_node_t *node, /* I - Node to set */ - int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ - const char *format, /* I - Printf-style format string */ - ...) /* I - Additional arguments as needed */ -{ - va_list ap; /* Pointer to arguments */ - - - /* - * Range check input... - */ - - if (!node || node->type != MXML_TEXT || !format) - return (-1); - - /* - * Free any old string value and set the new value... - */ - - if (node->value.text.string) - free(node->value.text.string); - - va_start(ap, format); - - node->value.text.whitespace = whitespace; - node->value.text.string = mxml_strdupf(format, ap); - - va_end(ap); - - return (0); -} - - -/* - * End of "$Id: mxml-set.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml-string.c b/zaptel/menuselect/mxml/mxml-string.c deleted file mode 100644 index 5c032018..00000000 --- a/zaptel/menuselect/mxml/mxml-string.c +++ /dev/null @@ -1,377 +0,0 @@ -/* - * "$Id: mxml-string.c 22267 2006-04-24 17:11:45Z kpfleming $" - * - * String functions for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Contents: - * - * mxml_strdup() - Duplicate a string. - * mxml_strdupf() - Format and duplicate a string. - * mxml_vsnprintf() - Format a string into a fixed size buffer. - */ - -/* - * Include necessary headers... - */ - -#include "config.h" - - -/* - * 'mxml_strdup()' - Duplicate a string. - */ - -#ifndef HAVE_STRDUP -char * /* O - New string pointer */ -mxml_strdup(const char *s) /* I - String to duplicate */ -{ - char *t; /* New string pointer */ - - - if (s == NULL) - return (NULL); - - if ((t = malloc(strlen(s) + 1)) == NULL) - return (NULL); - - return (strcpy(t, s)); -} -#endif /* !HAVE_STRDUP */ - - -/* - * 'mxml_strdupf()' - Format and duplicate a string. - */ - -char * /* O - New string pointer */ -mxml_strdupf(const char *format, /* I - Printf-style format string */ - va_list ap) /* I - Pointer to additional arguments */ -{ - int bytes; /* Number of bytes required */ - char *buffer, /* String buffer */ - temp[256]; /* Small buffer for first vsnprintf */ - - - /* - * First format with a tiny buffer; this will tell us how many bytes are - * needed... - */ - - bytes = vsnprintf(temp, sizeof(temp), format, ap); - - if (bytes < sizeof(temp)) - { - /* - * Hey, the formatted string fits in the tiny buffer, so just dup that... - */ - - return (strdup(temp)); - } - - /* - * Allocate memory for the whole thing and reformat to the new, larger - * buffer... - */ - - if ((buffer = calloc(1, bytes + 1)) != NULL) - vsnprintf(buffer, bytes + 1, format, ap); - - /* - * Return the new string... - */ - - return (buffer); -} - - -#ifndef HAVE_VSNPRINTF -/* - * 'mxml_vsnprintf()' - Format a string into a fixed size buffer. - */ - -int /* O - Number of bytes formatted */ -mxml_vsnprintf(char *buffer, /* O - Output buffer */ - size_t bufsize, /* O - Size of output buffer */ - const char *format, /* I - Printf-style format string */ - va_list ap) /* I - Pointer to additional arguments */ -{ - char *bufptr, /* Pointer to position in buffer */ - *bufend, /* Pointer to end of buffer */ - sign, /* Sign of format width */ - size, /* Size character (h, l, L) */ - type; /* Format type character */ - const char *bufformat; /* Start of format */ - int width, /* Width of field */ - prec; /* Number of characters of precision */ - char tformat[100], /* Temporary format string for sprintf() */ - temp[1024]; /* Buffer for formatted numbers */ - char *s; /* Pointer to string */ - int slen; /* Length of string */ - int bytes; /* Total number of bytes needed */ - - - /* - * Loop through the format string, formatting as needed... - */ - - bufptr = buffer; - bufend = buffer + bufsize - 1; - bytes = 0; - - while (*format) - { - if (*format == '%') - { - bufformat = format; - format ++; - - if (*format == '%') - { - *bufptr++ = *format++; - continue; - } - else if (strchr(" -+#\'", *format)) - sign = *format++; - else - sign = 0; - - width = 0; - while (isdigit(*format)) - width = width * 10 + *format++ - '0'; - - if (*format == '.') - { - format ++; - prec = 0; - - while (isdigit(*format)) - prec = prec * 10 + *format++ - '0'; - } - else - prec = -1; - - if (*format == 'l' && format[1] == 'l') - { - size = 'L'; - format += 2; - } - else if (*format == 'h' || *format == 'l' || *format == 'L') - size = *format++; - - if (!*format) - break; - - type = *format++; - - switch (type) - { - case 'E' : /* Floating point formats */ - case 'G' : - case 'e' : - case 'f' : - case 'g' : - if ((format - bufformat + 1) > sizeof(tformat) || - (width + 2) > sizeof(temp)) - break; - - strncpy(tformat, bufformat, format - bufformat); - tformat[format - bufformat] = '\0'; - - sprintf(temp, tformat, va_arg(ap, double)); - - bytes += strlen(temp); - - if (bufptr) - { - if ((bufptr + strlen(temp)) > bufend) - { - strncpy(bufptr, temp, bufend - bufptr); - bufptr = bufend; - break; - } - else - { - strcpy(bufptr, temp); - bufptr += strlen(temp); - } - } - break; - - case 'B' : /* Integer formats */ - case 'X' : - case 'b' : - case 'd' : - case 'i' : - case 'o' : - case 'u' : - case 'x' : - if ((format - bufformat + 1) > sizeof(tformat) || - (width + 2) > sizeof(temp)) - break; - - strncpy(tformat, bufformat, format - bufformat); - tformat[format - bufformat] = '\0'; - - sprintf(temp, tformat, va_arg(ap, int)); - - bytes += strlen(temp); - - if (bufptr) - { - if ((bufptr + strlen(temp)) > bufend) - { - strncpy(bufptr, temp, bufend - bufptr); - bufptr = bufend; - break; - } - else - { - strcpy(bufptr, temp); - bufptr += strlen(temp); - } - } - break; - - case 'p' : /* Pointer value */ - if ((format - bufformat + 1) > sizeof(tformat) || - (width + 2) > sizeof(temp)) - break; - - strncpy(tformat, bufformat, format - bufformat); - tformat[format - bufformat] = '\0'; - - sprintf(temp, tformat, va_arg(ap, void *)); - - bytes += strlen(temp); - - if (bufptr) - { - if ((bufptr + strlen(temp)) > bufend) - { - strncpy(bufptr, temp, bufend - bufptr); - bufptr = bufend; - break; - } - else - { - strcpy(bufptr, temp); - bufptr += strlen(temp); - } - } - break; - - case 'c' : /* Character or character array */ - bytes += width; - - if (bufptr) - { - if (width <= 1) - *bufptr++ = va_arg(ap, int); - else - { - if ((bufptr + width) > bufend) - width = bufend - bufptr; - - memcpy(bufptr, va_arg(ap, char *), width); - bufptr += width; - } - } - break; - - case 's' : /* String */ - if ((s = va_arg(ap, char *)) == NULL) - s = "(null)"; - - slen = strlen(s); - if (slen > width && prec != width) - width = slen; - - bytes += width; - - if (bufptr) - { - if ((bufptr + width) > bufend) - width = bufend - bufptr; - - if (slen > width) - slen = width; - - if (sign == '-') - { - strncpy(bufptr, s, slen); - memset(bufptr + slen, ' ', width - slen); - } - else - { - memset(bufptr, ' ', width - slen); - strncpy(bufptr + width - slen, s, slen); - } - - bufptr += width; - } - break; - - case 'n' : /* Output number of chars so far */ - if ((format - bufformat + 1) > sizeof(tformat) || - (width + 2) > sizeof(temp)) - break; - - strncpy(tformat, bufformat, format - bufformat); - tformat[format - bufformat] = '\0'; - - sprintf(temp, tformat, va_arg(ap, int)); - - bytes += strlen(temp); - - if (bufptr) - { - if ((bufptr + strlen(temp)) > bufend) - { - strncpy(bufptr, temp, bufend - bufptr); - bufptr = bufend; - break; - } - else - { - strcpy(bufptr, temp); - bufptr += strlen(temp); - } - } - break; - } - } - else - { - bytes ++; - - if (bufptr && bufptr < bufend) - *bufptr++ = *format++; - } - } - - /* - * Nul-terminate the string and return the number of characters needed. - */ - - *bufptr = '\0'; - - return (bytes); -} -#endif /* !HAVE_VSNPRINTF */ - - -/* - * End of "$Id: mxml-string.c 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml.h b/zaptel/menuselect/mxml/mxml.h deleted file mode 100644 index 8d14f884..00000000 --- a/zaptel/menuselect/mxml/mxml.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * "$Id: mxml.h 22267 2006-04-24 17:11:45Z kpfleming $" - * - * Header file for Mini-XML, a small XML-like file parsing library. - * - * Copyright 2003-2005 by Michael Sweet. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* - * Prevent multiple inclusion... - */ - -#ifndef _mxml_h_ -# define _mxml_h_ - -/* - * Include necessary headers... - */ - -# include -# include -# include -# include -# include - - -/* - * Constants... - */ - -# define MXML_WRAP 72 /* Wrap XML output at this column position */ -# define MXML_TAB 8 /* Tabs every N columns */ - -# define MXML_NO_CALLBACK 0 /* Don't use a type callback */ -# define MXML_INTEGER_CALLBACK mxml_integer_cb - /* Treat all data as integers */ -# define MXML_OPAQUE_CALLBACK mxml_opaque_cb - /* Treat all data as opaque */ -# define MXML_REAL_CALLBACK mxml_real_cb - /* Treat all data as real numbers */ -# define MXML_TEXT_CALLBACK 0 /* Treat all data as text */ - -# define MXML_NO_PARENT 0 /* No parent for the node */ - -# define MXML_DESCEND 1 /* Descend when finding/walking */ -# define MXML_NO_DESCEND 0 /* Don't descend when finding/walking */ -# define MXML_DESCEND_FIRST -1 /* Descend for first find */ - -# define MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */ -# define MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */ -# define MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */ -# define MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */ - -# define MXML_ADD_BEFORE 0 /* Add node before specified node */ -# define MXML_ADD_AFTER 1 /* Add node after specified node */ -# define MXML_ADD_TO_PARENT NULL /* Add node relative to parent */ - - -/* - * Data types... - */ - -typedef enum mxml_type_e /**** The XML node type. ****/ -{ - MXML_ELEMENT, /* XML element with attributes */ - MXML_INTEGER, /* Integer value */ - MXML_OPAQUE, /* Opaque string */ - MXML_REAL, /* Real value */ - MXML_TEXT, /* Text fragment */ - MXML_CUSTOM /* Custom data */ -} mxml_type_t; - -typedef struct mxml_attr_s /**** An XML element attribute value. ****/ -{ - char *name; /* Attribute name */ - char *value; /* Attribute value */ -} mxml_attr_t; - -typedef struct mxml_value_s /**** An XML element value. ****/ -{ - char *name; /* Name of element */ - int num_attrs; /* Number of attributes */ - mxml_attr_t *attrs; /* Attributes */ -} mxml_element_t; - -typedef struct mxml_text_s /**** An XML text value. ****/ -{ - int whitespace; /* Leading whitespace? */ - char *string; /* Fragment string */ -} mxml_text_t; - -typedef struct mxml_custom_s /**** An XML custom value. ****/ -{ - void *data; /* Pointer to (allocated) custom data */ - void (*destroy)(void *); - /* Pointer to destructor function */ -} mxml_custom_t; - -typedef union mxml_value_u /**** An XML node value. ****/ -{ - mxml_element_t element; /* Element */ - int integer; /* Integer number */ - char *opaque; /* Opaque string */ - double real; /* Real number */ - mxml_text_t text; /* Text fragment */ - mxml_custom_t custom; /* Custom data */ -} mxml_value_t; - -typedef struct mxml_node_s /**** An XML node. ****/ -{ - mxml_type_t type; /* Node type */ - struct mxml_node_s *next; /* Next node under same parent */ - struct mxml_node_s *prev; /* Previous node under same parent */ - struct mxml_node_s *parent; /* Parent node */ - struct mxml_node_s *child; /* First child node */ - struct mxml_node_s *last_child; /* Last child node */ - mxml_value_t value; /* Node value */ -} mxml_node_t; - -typedef struct mxml_index_s /**** An XML node index. ****/ -{ - char *attr; /* Attribute used for indexing or NULL */ - int num_nodes; /* Number of nodes in index */ - int alloc_nodes; /* Allocated nodes in index */ - int cur_node; /* Current node */ - mxml_node_t **nodes; /* Node array */ -} mxml_index_t; - -typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); - /**** Custom data load callback function ****/ - -typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *); - /**** Custom data save callback function ****/ - - -/* - * C++ support... - */ - -# ifdef __cplusplus -extern "C" { -# endif /* __cplusplus */ - -/* - * Prototypes... - */ - -extern void mxmlAdd(mxml_node_t *parent, int where, - mxml_node_t *child, mxml_node_t *node); -extern void mxmlDelete(mxml_node_t *node); -extern const char *mxmlElementGetAttr(mxml_node_t *node, const char *name); -extern void mxmlElementSetAttr(mxml_node_t *node, const char *name, - const char *value); -extern int mxmlEntityAddCallback(int (*cb)(const char *name)); -extern const char *mxmlEntityGetName(int val); -extern int mxmlEntityGetValue(const char *name); -extern void mxmlEntityRemoveCallback(int (*cb)(const char *name)); -extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top, - const char *name, const char *attr, - const char *value, int descend); -extern void mxmlIndexDelete(mxml_index_t *ind); -extern mxml_node_t *mxmlIndexEnum(mxml_index_t *ind); -extern mxml_node_t *mxmlIndexFind(mxml_index_t *ind, - const char *element, - const char *value); -extern mxml_index_t *mxmlIndexNew(mxml_node_t *node, const char *element, - const char *attr); -extern mxml_node_t *mxmlIndexReset(mxml_index_t *ind); -extern mxml_node_t *mxmlLoadFd(mxml_node_t *top, int fd, - mxml_type_t (*cb)(mxml_node_t *)); -extern mxml_node_t *mxmlLoadFile(mxml_node_t *top, FILE *fp, - mxml_type_t (*cb)(mxml_node_t *)); -extern mxml_node_t *mxmlLoadString(mxml_node_t *top, const char *s, - mxml_type_t (*cb)(mxml_node_t *)); -extern mxml_node_t *mxmlNewCustom(mxml_node_t *parent, void *data, - void (*destroy)(void *)); -extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name); -extern mxml_node_t *mxmlNewInteger(mxml_node_t *parent, int integer); -extern mxml_node_t *mxmlNewOpaque(mxml_node_t *parent, const char *opaque); -extern mxml_node_t *mxmlNewReal(mxml_node_t *parent, double real); -extern mxml_node_t *mxmlNewText(mxml_node_t *parent, int whitespace, - const char *string); -extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace, - const char *format, ...) -# ifdef __GNUC__ -__attribute__ ((__format__ (__printf__, 3, 4))) -# endif /* __GNUC__ */ -; -extern void mxmlRemove(mxml_node_t *node); -extern char *mxmlSaveAllocString(mxml_node_t *node, - const char *(*cb)(mxml_node_t *, int)); -extern int mxmlSaveFd(mxml_node_t *node, int fd, - const char *(*cb)(mxml_node_t *, int)); -extern int mxmlSaveFile(mxml_node_t *node, FILE *fp, - const char *(*cb)(mxml_node_t *, int)); -extern int mxmlSaveString(mxml_node_t *node, char *buffer, - int bufsize, - const char *(*cb)(mxml_node_t *, int)); -extern int mxmlSetCustom(mxml_node_t *node, void *data, - void (*destroy)(void *)); -extern void mxmlSetCustomHandlers(mxml_custom_load_cb_t load, - mxml_custom_save_cb_t save); -extern int mxmlSetElement(mxml_node_t *node, const char *name); -extern void mxmlSetErrorCallback(void (*cb)(const char *)); -extern int mxmlSetInteger(mxml_node_t *node, int integer); -extern int mxmlSetOpaque(mxml_node_t *node, const char *opaque); -extern int mxmlSetReal(mxml_node_t *node, double real); -extern int mxmlSetText(mxml_node_t *node, int whitespace, - const char *string); -extern int mxmlSetTextf(mxml_node_t *node, int whitespace, - const char *format, ...) -# ifdef __GNUC__ -__attribute__ ((__format__ (__printf__, 3, 4))) -# endif /* __GNUC__ */ -; -extern mxml_node_t *mxmlWalkNext(mxml_node_t *node, mxml_node_t *top, - int descend); -extern mxml_node_t *mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top, - int descend); - - -/* - * Private functions... - */ - -extern void mxml_error(const char *format, ...); -extern mxml_type_t mxml_integer_cb(mxml_node_t *node); -extern mxml_type_t mxml_opaque_cb(mxml_node_t *node); -extern mxml_type_t mxml_real_cb(mxml_node_t *node); - - -/* - * C++ support... - */ - -# ifdef __cplusplus -} -# endif /* __cplusplus */ -#endif /* !_mxml_h_ */ - - -/* - * End of "$Id: mxml.h 22267 2006-04-24 17:11:45Z kpfleming $". - */ diff --git a/zaptel/menuselect/mxml/mxml.list.in b/zaptel/menuselect/mxml/mxml.list.in deleted file mode 100644 index 4bf1c178..00000000 --- a/zaptel/menuselect/mxml/mxml.list.in +++ /dev/null @@ -1,114 +0,0 @@ -# -# "$Id: mxml.list.in 22267 2006-04-24 17:11:45Z kpfleming $" -# -# EPM software list file for Mini-XML, a small XML library. -# -# Copyright 2003-2005 by Michael Sweet. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# - -# Directories... -$prefix=@prefix@ -$exec_prefix=@exec_prefix@ -$bindir=@bindir@ -$docdir=@docdir@ -$includedir=@includedir@ -$libdir=@libdir@ -$mandir=@mandir@ -$srcdir=@srcdir@ - -$PICFLAG=@PICFLAG@ - -# Product information -%product mxml -%copyright 2003-2005 by Michael Sweet -%vendor Michael Sweet -%license ${srcdir}/COPYING -%readme ${srcdir}/README -%version @VERSION@ - -%description < -#include -#include -#include -#include -#include - -#ifdef HAVE_ALLOCA_H -#include -#endif - -#ifndef HAVE_STRSEP -char *strsep(char **str, const char *delims) -{ - char *token; - - if (!*str) { - /* No more tokens */ - return NULL; - } - - token = *str; - while (**str != '\0') { - if (strchr(delims, **str)) { - **str = '\0'; - (*str)++; - return token; - } - (*str)++; - } - - /* There is no other token */ - *str = NULL; - - return token; -} -#endif - -#ifndef HAVE_SETENV -int setenv(const char *name, const char *value, int overwrite) -{ - unsigned char *buf; - int buflen; - - buflen = strlen(name) + strlen(value) + 2; - buf = alloca(buflen); - - if (!overwrite && getenv(name)) - return 0; - - snprintf(buf, buflen, "%s=%s", name, value); - - return putenv(buf); -} -#endif - -#ifndef HAVE_UNSETENV -int unsetenv(const char *name) -{ - return setenv(name, "", 0); -} -#endif - -#ifndef HAVE_STRCASESTR -static char *upper(const char *orig, char *buf, int bufsize) -{ - int i = 0; - - while (i < (bufsize - 1) && orig[i]) { - buf[i] = toupper(orig[i]); - i++; - } - - buf[i] = '\0'; - - return buf; -} - -char *strcasestr(const char *haystack, const char *needle) -{ - char *u1, *u2; - int u1len = strlen(haystack) + 1, u2len = strlen(needle) + 1; - - u1 = alloca(u1len); - u2 = alloca(u2len); - if (u1 && u2) { - char *offset; - if (u2len > u1len) { - /* Needle bigger than haystack */ - return NULL; - } - offset = strstr(upper(haystack, u1, u1len), upper(needle, u2, u2len)); - if (offset) { - /* Return the offset into the original string */ - return ((char *)((unsigned long)haystack + (unsigned long)(offset - u1))); - } else { - return NULL; - } - } else { - return NULL; - } -} -#endif /* !HAVE_STRCASESTR */ - -#ifndef HAVE_STRNLEN -size_t strnlen(const char *s, size_t n) -{ - size_t len; - - for (len = 0; len < n; len++) - if (s[len] == '\0') - break; - - return len; -} -#endif /* !HAVE_STRNLEN */ - -#if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC) -char *strndup(const char *s, size_t n) -{ - size_t len = strnlen(s, n); - char *new = malloc(len + 1); - - if (!new) - return NULL; - - new[len] = '\0'; - return memcpy(new, s, len); -} -#endif /* !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC) */ - -#if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) -int vasprintf(char **strp, const char *fmt, va_list ap) -{ - int size; - va_list ap2; - char s; - - *strp = NULL; - va_copy(ap2, ap); - size = vsnprintf(&s, 1, fmt, ap2); - va_end(ap2); - *strp = malloc(size + 1); - if (!*strp) - return -1; - vsnprintf(*strp, size + 1, fmt, ap); - - return size; -} -#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */ - -/* - * Based on Code from bsd-asprintf from OpenSSH - * Copyright (c) 2004 Darren Tucker. - * - * Based originally on asprintf.c from OpenBSD: - * Copyright (c) 1997 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC) -int asprintf(char **str, const char *fmt, ...) -{ - va_list ap; - int ret; - - *str = NULL; - va_start(ap, fmt); - ret = vasprintf(str, fmt, ap); - va_end(ap); - - return ret; -} -#endif /* !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC) */ - -#ifndef HAVE_STRTOQ -#ifndef LONG_MIN -#define LONG_MIN (-9223372036854775807L-1L) - /* min value of a "long int" */ -#endif -#ifndef LONG_MAX -#define LONG_MAX 9223372036854775807L - /* max value of a "long int" */ -#endif - -/*! \brief - * Convert a string to a quad integer. - * - * \note Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - */ -uint64_t strtoq(const char *nptr, char **endptr, int base) -{ - const char *s; - uint64_t acc; - unsigned char c; - uint64_t qbase, cutoff; - int neg, any, cutlim; - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - s = nptr; - do { - c = *s++; - } while (isspace(c)); - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '\0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '\0' ? 8 : 10; - - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for quads is - * [-9223372036854775808..9223372036854775807] and the input base - * is 10, cutoff will be set to 922337203685477580 and cutlim to - * either 7 (neg==0) or 8 (neg==1), meaning that if we have - * accumulated a value > 922337203685477580, or equal but the - * next digit is > 7 (or 8), the number is too big, and we will - * return a range error. - * - * Set any if any `digits' consumed; make it negative to indicate - * overflow. - */ - qbase = (unsigned)base; - cutoff = neg ? (uint64_t)-(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX; - cutlim = cutoff % qbase; - cutoff /= qbase; - for (acc = 0, any = 0;; c = *s++) { - if (!isascii(c)) - break; - if (isdigit(c)) - c -= '\0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= qbase; - acc += c; - } - } - if (any < 0) { - acc = neg ? LONG_MIN : LONG_MAX; - } else if (neg) - acc = -acc; - if (endptr != 0) - *((const char **)endptr) = any ? s - 1 : nptr; - return acc; -} -#endif /* !HAVE_STRTOQ */ - -#ifndef HAVE_GETLOADAVG -#ifdef linux -/*! \brief Alternative method of getting load avg on Linux only */ -int getloadavg(double *list, int nelem) -{ - FILE *LOADAVG; - double avg[3] = { 0.0, 0.0, 0.0 }; - int i, res = -1; - - if ((LOADAVG = fopen("/proc/loadavg", "r"))) { - fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]); - res = 0; - fclose(LOADAVG); - } - - for (i = 0; (i < nelem) && (i < 3); i++) { - list[i] = avg[i]; - } - - return res; -} -#else /* !linux */ -/*! \brief Return something that won't cancel the call, but still return -1, in case - * we correct the implementation to check return value */ -int getloadavg(double *list, int nelem) -{ - int i; - - for (i = 0; i < nelem; i++) { - list[i] = 0.1; - } - return -1; -} -#endif /* linux */ -#endif /* !HAVE_GETLOADAVG */ diff --git a/zaptel/mkfilter.h b/zaptel/mkfilter.h deleted file mode 100644 index 1e80d338..00000000 --- a/zaptel/mkfilter.h +++ /dev/null @@ -1,62 +0,0 @@ -/* mkfilter -- given n, compute recurrence relation - to implement Butterworth, Bessel or Chebyshev filter of order n - A.J. Fisher, University of York - September 1992 */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include - -/* Header file */ - -#define global -#define unless(x) if(!(x)) -#define until(x) while(!(x)) - -#define VERSION "4.6" -#undef PI -#define PI 3.14159265358979323846 /* Microsoft C++ does not define M_PI ! */ -#define TWOPI (2.0 * PI) -#define EPS 1e-10 -#define MAXORDER 10 -#define MAXPZ 512 /* .ge. 2*MAXORDER, to allow for doubling of poles in BP filter; - high values needed for FIR filters */ -#define MAXSTRING 256 - -typedef void (*proc)(); -typedef unsigned int uint; - -extern "C" - { double atof(const char*); - int atoi(char*); - void exit(int); - }; - -extern const char *progname; -extern void readdata(char*, double&, int&, double*, int&, double*); - -inline double sqr(double x) { return x*x; } -inline bool seq(char *s1, char *s2) { return strcmp(s1,s2) == 0; } -inline bool onebit(uint m) { return (m != 0) && ((m & m-1) == 0); } - -inline double asinh(double x) - { /* Microsoft C++ does not define */ - return log(x + sqrt(1.0 + sqr(x))); - } - -inline double fix(double x) - { /* nearest integer */ - return (x >= 0.0) ? floor(0.5+x) : -floor(0.5-x); - } - diff --git a/zaptel/mknotch.cc b/zaptel/mknotch.cc deleted file mode 100644 index 98a247bc..00000000 --- a/zaptel/mknotch.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* mknotch -- Make IIR notch filter parameters, based upon mkfilter; - A.J. Fisher, University of York - September 1992 */ - -#include -#include -#include - -#include "mkfilter.h" -#include "complex.h" - -#define opt_be 0x00001 /* -Be Bessel characteristic */ -#define opt_bu 0x00002 /* -Bu Butterworth characteristic */ -#define opt_ch 0x00004 /* -Ch Chebyshev characteristic */ -#define opt_re 0x00008 /* -Re Resonator */ -#define opt_pi 0x00010 /* -Pi proportional-integral */ - -#define opt_lp 0x00020 /* -Lp lowpass */ -#define opt_hp 0x00040 /* -Hp highpass */ -#define opt_bp 0x00080 /* -Bp bandpass */ -#define opt_bs 0x00100 /* -Bs bandstop */ -#define opt_ap 0x00200 /* -Ap allpass */ - -#define opt_a 0x00400 /* -a alpha value */ -#define opt_l 0x00800 /* -l just list filter parameters */ -#define opt_o 0x01000 /* -o order of filter */ -#define opt_p 0x02000 /* -p specified poles only */ -#define opt_w 0x04000 /* -w don't pre-warp */ -#define opt_z 0x08000 /* -z use matched z-transform */ -#define opt_Z 0x10000 /* -Z additional zero */ - -struct pzrep - { complex poles[MAXPZ], zeros[MAXPZ]; - int numpoles, numzeros; - }; - -static pzrep splane, zplane; -static double raw_alpha1, raw_alpha2; -static complex dc_gain, fc_gain, hf_gain; -static uint options; -static double qfactor; -static bool infq; -static uint polemask; -static double xcoeffs[MAXPZ+1], ycoeffs[MAXPZ+1]; - -static void compute_notch(); -static void expandpoly(), expand(complex[], int, complex[]), multin(complex, int, complex[]); - -static void compute_bpres() - { /* compute Z-plane pole & zero positions for bandpass resonator */ - zplane.numpoles = zplane.numzeros = 2; - zplane.zeros[0] = 1.0; zplane.zeros[1] = -1.0; - double theta = TWOPI * raw_alpha1; /* where we want the peak to be */ - if (infq) - { /* oscillator */ - complex zp = expj(theta); - zplane.poles[0] = zp; zplane.poles[1] = cconj(zp); - } - else - { /* must iterate to find exact pole positions */ - complex topcoeffs[MAXPZ+1]; expand(zplane.zeros, zplane.numzeros, topcoeffs); - double r = exp(-theta / (2.0 * qfactor)); - double thm = theta, th1 = 0.0, th2 = PI; - bool cvg = false; - for (int i=0; i < 50 && !cvg; i++) - { complex zp = r * expj(thm); - zplane.poles[0] = zp; zplane.poles[1] = cconj(zp); - complex botcoeffs[MAXPZ+1]; expand(zplane.poles, zplane.numpoles, botcoeffs); - complex g = evaluate(topcoeffs, zplane.numzeros, botcoeffs, zplane.numpoles, expj(theta)); - double phi = g.im / g.re; /* approx to atan2 */ - if (phi > 0.0) th2 = thm; else th1 = thm; - if (fabs(phi) < EPS) cvg = true; - thm = 0.5 * (th1+th2); - } - unless (cvg) fprintf(stderr, "mkfilter: warning: failed to converge\n"); - } - } - -static void compute_notch() - { /* compute Z-plane pole & zero positions for bandstop resonator (notch filter) */ - compute_bpres(); /* iterate to place poles */ - double theta = TWOPI * raw_alpha1; - complex zz = expj(theta); /* place zeros exactly */ - zplane.zeros[0] = zz; zplane.zeros[1] = cconj(zz); - } - -static void expandpoly() /* given Z-plane poles & zeros, compute top & bot polynomials in Z, and then recurrence relation */ - { complex topcoeffs[MAXPZ+1], botcoeffs[MAXPZ+1]; int i; - expand(zplane.zeros, zplane.numzeros, topcoeffs); - expand(zplane.poles, zplane.numpoles, botcoeffs); - dc_gain = evaluate(topcoeffs, zplane.numzeros, botcoeffs, zplane.numpoles, 1.0); - double theta = TWOPI * 0.5 * (raw_alpha1 + raw_alpha2); /* "jwT" for centre freq. */ - fc_gain = evaluate(topcoeffs, zplane.numzeros, botcoeffs, zplane.numpoles, expj(theta)); - hf_gain = evaluate(topcoeffs, zplane.numzeros, botcoeffs, zplane.numpoles, -1.0); - for (i = 0; i <= zplane.numzeros; i++) xcoeffs[i] = +(topcoeffs[i].re / botcoeffs[zplane.numpoles].re); - for (i = 0; i <= zplane.numpoles; i++) ycoeffs[i] = -(botcoeffs[i].re / botcoeffs[zplane.numpoles].re); - } - - -static void expand(complex pz[], int npz, complex coeffs[]) - { /* compute product of poles or zeros as a polynomial of z */ - int i; - coeffs[0] = 1.0; - for (i=0; i < npz; i++) coeffs[i+1] = 0.0; - for (i=0; i < npz; i++) multin(pz[i], npz, coeffs); - /* check computed coeffs of z^k are all real */ - for (i=0; i < npz+1; i++) - { if (fabs(coeffs[i].im) > EPS) - { fprintf(stderr, "mkfilter: coeff of z^%d is not real; poles/zeros are not complex conjugates\n", i); - exit(1); - } - } - } - -static void multin(complex w, int npz, complex coeffs[]) - { /* multiply factor (z-w) into coeffs */ - complex nw = -w; - for (int i = npz; i >= 1; i--) coeffs[i] = (nw * coeffs[i]) + coeffs[i-1]; - coeffs[0] = nw * coeffs[0]; - } - -extern "C" void mknotch(float freq,float bw,long *p1, long *p2, long *p3); - -void mknotch(float freq,float bw,long *p1, long *p2, long *p3) -{ -#define NB 14 - - options = opt_re; - qfactor = freq / bw; - infq = false; - raw_alpha1 = freq / 8000.0; - polemask = ~0; - - compute_notch(); - expandpoly(); - - float fsh = (float) (1 << NB); - *p1 = (long)(xcoeffs[1] * fsh); - *p2 = (long)(ycoeffs[0] * fsh); - *p3 = (long)(ycoeffs[1] * fsh); -} - - - - diff --git a/zaptel/orig.ee b/zaptel/orig.ee deleted file mode 100644 index 231616d184733e675e4bb54d73fc11fb5d2c2d86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 172 zcmcb>`+?UjF}Wnas8Yctu_TcJ3t%+ZDlmbGfuVtok-=cXRsjYE2aqa8Mh`|0h;lX` z1_ow^|Nj{tK={ZcBQl2ps2QlcQK11y!!VEu1dJdlI4}URDu7spfnfqju;Jt1Z2 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "bittest.h" - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -/* #define BLOCK_SIZE 2048 */ -#define BLOCK_SIZE 2041 - -void print_packet(unsigned char *buf, int len) -{ - int x; - printf("{ "); - for (x=0;x\n", argv[0]); - exit(1); - } - fd = open(argv[1], O_RDWR, 0600); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs)) { - fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_GET_PARAMS, &tp)) { - fprintf(stderr, "Unable to get channel parameters\n"); - exit(1); - } - ioctl(fd, ZT_GETEVENT); -#if 0 - print_packet(outbuf, res); - printf("FCS is %x, PPP_GOODFCS is %x\n", - fcs,PPP_GOODFCS); -#endif - for(;;) { - res = bs; - for (x=0;x -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -#define BLOCK_SIZE 2039 - -void print_packet(unsigned char *buf, int len) -{ - int x; - printf("{ "); - for (x=0;x 3 ) { - fprintf(stderr, "Usage: %s [timeout]\n",argv[0]); - exit(1); - } - fd = open(argv[1], O_RDWR, 0600); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs)) { - fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_GET_PARAMS, &tp)) { - fprintf(stderr, "Unable to get channel parameters\n"); - exit(1); - } - ioctl(fd, ZT_GETEVENT); - - i = ZT_FLUSH_ALL; - if (ioctl(fd,ZT_FLUSH,&i) == -1) - { - perror("tor_flush"); - exit(255); - } - if(argc==3){ - timeout=atoi(argv[2]); - start_time=time(NULL); - printf("Using Timeout of %d Seconds\n",timeout); - } - - for(;;) { - res = bs; - for (x=0;x 1) read(fd,inbuf,bs); - skipcount--; - if (!skipcount) puts("Going for it..."); - continue; - } - - res = read(fd, inbuf, bs); - if (res < bs) { - printf("Res is %d\n", res); - exit(1); - } - if (!setup) { - c = inbuf[0]; - setup++; - } - for (x=0;xtimeout){ - printf("Timeout achieved Ending Program\n"); - return errors; - } - } - -} diff --git a/zaptel/pattest.c b/zaptel/pattest.c deleted file mode 100644 index dcc47dde..00000000 --- a/zaptel/pattest.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "bittest.h" - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -#define BLOCK_SIZE 2039 - -void print_packet(unsigned char *buf, int len) -{ - int x; - printf("{ "); - for (x=0;x\n"); - exit(1); - } - fd = open(argv[1], O_RDWR, 0600); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs)) { - fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); - exit(1); - } - if (ioctl(fd, ZT_GET_PARAMS, &tp)) { - fprintf(stderr, "Unable to get channel parameters\n"); - exit(1); - } - ioctl(fd, ZT_GETEVENT); - for(;;) { - res = bs; - res = read(fd, outbuf, res); - if (res < bs) { - int e; - ZT_SPANINFO zi; - res = ioctl(fd,ZT_GETEVENT,&e); - if (res == -1) - { - perror("ZT_GETEVENT"); - exit(1); - } - if (e == ZT_EVENT_NOALARM) - printf("ALARMS CLEARED\n"); - if (e == ZT_EVENT_ALARM) - { - zi.spanno = 0; - res = ioctl(fd,ZT_SPANSTAT,&zi); - if (res == -1) - { - perror("ZT_SPANSTAT"); - exit(1); - } - printf("Alarm mask %x hex\n",zi.alarms); - } - continue; - } - if (!setup) { - c = outbuf[0]; - setup++; - } - for (x=0;x - * - * Borrows from PPPoE by Michal Ostrowski , - * Jamal Hadi Salim - * - * which in turn... - * - * Borrows heavily from the PPPoATM plugin by Mitchell Blank Jr., - * which is based in part on work from Jens Axboe and Paul Mackerras. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "zaptel.h" - -extern int new_style_driver; - -const char pppd_version[] = VERSION; - -#define _PATH_ZAPOPT _ROOT_PATH "/etc/ppp/options." - -#define ZAP_MTU (ZT_DEFAULT_MTU_MRU - 16) -extern int kill_link; -int retries = 0; - -int setdevname_zaptel(const char *cp); - -static option_t zaptel_options[] = { - { "device name", o_wild, (void *) &setdevname_zaptel, - "Serial port device name", - OPT_DEVNAM | OPT_PRIVFIX | OPT_NOARG | OPT_A2STRVAL | OPT_STATIC, - devnam}, - { NULL } -}; - -static int zapfd = -1; -static int zapchan = 0; - -static int connect_zaptel(void) -{ - - ZT_PARAMS ztp; - int res; - int x; - - info("Zaptel device is '%s'\n", devnam); - - strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam)); - - if (strlen(devnam) && strcmp(devnam, "stdin")) { - /* Get the channel number */ - zapchan = atoi(devnam); - if (zapchan < 1) { - fatal("'%s' is not a valid device name\n", devnam); - return -1; - } - - /* Open /dev/zap/channel interface */ - zapfd = open("/dev/zap/channel", O_RDWR); - if (zapfd < 0) { - fatal("Unable to open zaptel channel interface: '%s'\n", strerror(errno)); - return zapfd; - } - - /* Specify which channel we really want */ - x = zapchan; - res = ioctl(zapfd, ZT_SPECIFY, &x); - if (res) { - fatal("Unable to specify channel %d: %s\n", zapchan, strerror(errno)); - close(zapfd); - zapfd = -1; - return -1; - } - } else - zapfd = STDIN_FILENO; - - - /* Get channel parameters */ - memset(&ztp, 0, sizeof(ztp)); - ztp.channo = -1; - - res = ioctl(zapfd, ZT_GET_PARAMS, &ztp); - - if (res) { - fatal("Device '%s' does not appear to be a zaptel device\n", devnam ? devnam : ""); - } - - x = 1; - - /* Throw into HDLC/PPP mode */ - res = ioctl(zapfd, ZT_HDLCPPP, &x); - - if (res) { - fatal("Unable to put device '%s' into HDLC mode\n", devnam); - close(zapfd); - zapfd = -1; - return -1; - } - - /* Once the logging is fixed, print a message here indicating - connection parameters */ - zapchan = ztp.channo; - info("Connected to zaptel device '%s' (%d)\n", ztp.name, ztp.channo); - - return zapfd; -} - -static void disconnect_zaptel(void) -{ - int res; - int x = 0; - /* Throw out of HDLC mode */ - res = ioctl(zapfd, ZT_HDLCPPP, &x); - - if (res) { - warn("Unable to take device '%s' out of HDLC mode\n", devnam); - } - - /* Close if it's not stdin */ - if (strlen(devnam)) - close(zapfd); - warn("Disconnect from zaptel"); - -} - - -static int setspeed_zaptel(const char *cp) -{ - return 0; -} - -static void zaptel_extra_options() -{ - int ret; - char buf[256]; - snprintf(buf, 256, _PATH_ZAPOPT "%s",devnam); - if(!options_from_file(buf, 0, 0, 1)) - exit(EXIT_OPTION_ERROR); - -} - - - -static void send_config_zaptel(int mtu, - u_int32_t asyncmap, - int pcomp, - int accomp) -{ - int sock; - - if (mtu > ZAP_MTU) { - warn("Couldn't increase MTU to %d.", mtu); - mtu = ZAP_MTU; - } -} - - -static void recv_config_zaptel(int mru, - u_int32_t asyncmap, - int pcomp, - int accomp) -{ - if (mru > ZAP_MTU) - error("Couldn't increase MRU to %d", mru); -} - -static void set_xaccm_pppoe(int unit, ext_accm accm) -{ - /* NOTHING */ -} - - - -struct channel zaptel_channel; - -/* Check is cp is a valid zaptel device - * return either 1 if "cp" is a reasonable thing to name a device - * or die. - * Note that we don't actually open the device at this point - * We do need to fill in: - * devnam: a string representation of the device - */ - -int (*old_setdevname_hook)(const char* cp) = NULL; -int setdevname_zaptel(const char *cp) -{ - int ret; - int chan; - - /* If already set, forgoe */ - if (strlen(devnam)) - return 1; - - - if (strcmp(cp, "stdin")) { - ret = sscanf(cp, "%d", &chan); - if (ret != 1) { - fatal("Zaptel: Invalid channel: '%s'\n", cp); - return -1; - } - } - - zap_copy_string(devnam, cp, sizeof(devnam)); - - info("Using zaptel device '%s'\n", devnam); - - ret = 1; - - if( ret == 1 && the_channel != &zaptel_channel ){ - - the_channel = &zaptel_channel; - - modem = 0; - - lcp_allowoptions[0].neg_accompression = 0; - lcp_wantoptions[0].neg_accompression = 0; - - lcp_allowoptions[0].neg_pcompression = 0; - lcp_wantoptions[0].neg_pcompression = 0; - - ccp_allowoptions[0].deflate = 0 ; - ccp_wantoptions[0].deflate = 0 ; - - ipcp_allowoptions[0].neg_vj=0; - ipcp_wantoptions[0].neg_vj=0; - - ccp_allowoptions[0].bsd_compress = 0; - ccp_wantoptions[0].bsd_compress = 0; - - lcp_allowoptions[0].neg_asyncmap = 0; - lcp_wantoptions[0].neg_asyncmap = 0; - - } - return ret; -} - - - -void plugin_init(void) -{ - if (!ppp_available() && !new_style_driver) - fatal("Kernel doesn't support ppp_generic needed for Zaptel PPP"); - add_options(zaptel_options); - - info("Zaptel Plugin Initialized"); -} - -struct channel zaptel_channel = { - options: zaptel_options, - process_extra_options: &zaptel_extra_options, - check_options: NULL, - connect: &connect_zaptel, - disconnect: &disconnect_zaptel, - establish_ppp: &generic_establish_ppp, - disestablish_ppp: &generic_disestablish_ppp, - send_config: &send_config_zaptel, - recv_config: &recv_config_zaptel, - close: NULL, - cleanup: NULL -}; - diff --git a/zaptel/sethdlc-new.c b/zaptel/sethdlc-new.c deleted file mode 100644 index e0cb1d63..00000000 --- a/zaptel/sethdlc-new.c +++ /dev/null @@ -1,702 +0,0 @@ -/* - * sethdlc.c - * - * Copyright (C) 1999 - 2002 Krzysztof Halasa - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "kernel/zaptel.h" - -#if GENERIC_HDLC_VERSION != 4 -#error Generic HDLC layer version mismatch, please get correct sethdlc.c -#endif - -#if !defined(IF_PROTO_HDLC_ETH) || !defined(IF_PROTO_FR_ETH_PVC) -#warning "No kernel support for Ethernet over Frame Relay / HDLC, skipping it" -#endif - - -static struct ifreq req; /* for ioctl */ -static int argc; -static char **argv; -int sock; - - -static void error(const char *format, ...) __attribute__ ((noreturn)); - -static void error(const char *format, ...) -{ - va_list args; - - va_start(args, format); - fprintf(stderr, "%s: ", req.ifr_name); - vfprintf(stderr, format, args); - va_end(args); - exit(1); -} - - - -typedef struct { - const char *name; - const unsigned int value; -} parsertab; - - - -static int checkkey(const char* name) -{ - if (argc < 1) - return -1; /* no enough parameters */ - - if (strcmp(name, argv[0])) - return -1; - argc--; - argv++; - return 0; -} - - - -static int checktab(parsertab *tab, unsigned int *value) -{ - int i; - - if (argc < 1) - return -1; /* no enough parameters */ - - for (i = 0; tab[i].name; i++) - if (!strcmp(tab[i].name, argv[0])) { - argc--; - argv++; - *value = tab[i].value; - return 0; - } - - return -1; /* Not found */ -} - - - -static const char* tabstr(unsigned int value, parsertab *tab, - const char* unknown) -{ - int i; - for (i = 0; tab[i].name; i++) - if (tab[i].value == value) - return tab[i].name; - - return unknown; /* Not found */ -} - - - -static unsigned int match(const char* name, unsigned int *value, - unsigned int minimum, unsigned int maximum) -{ - char test; - - if (argc < 1) - return -1; /* no enough parameters */ - - if (name) { - if (strcmp(name, argv[0])) - return -1; - argc--; - argv++; - } - - if (argc < 1) - error("Missing parameter\n"); - - if (sscanf(argv[0], "%u%c", value, &test) != 1) - error("Invalid parameter: %s\n", argv[0]); - - if ((*value > maximum) || (*value < minimum)) - error("Parameter out of range [%u - %u]: %u\n", - minimum, maximum, *value); - - argc--; - argv++; - return 0; -} - - -static parsertab ifaces[] = {{ "v35", IF_IFACE_V35 }, - { "v24", IF_IFACE_V24 }, - { "x21", IF_IFACE_X21 }, - { "e1", IF_IFACE_E1 }, - { "t1", IF_IFACE_T1 }, - { NULL, 0 }}; - -static parsertab clocks[] = {{ "int", CLOCK_INT }, - { "ext", CLOCK_EXT }, - { "txint", CLOCK_TXINT }, - { "txfromrx", CLOCK_TXFROMRX }, - { NULL, 0 }}; - - -static parsertab protos[] = {{ "hdlc", IF_PROTO_HDLC}, - { "cisco", IF_PROTO_CISCO}, - { "fr", IF_PROTO_FR}, - { "ppp", IF_PROTO_PPP}, - { "x25", IF_PROTO_X25}, -#ifdef IF_PROTO_HDLC_ETH - { "hdlc-eth", IF_PROTO_HDLC_ETH}, -#endif - { NULL, 0 }}; - - -static parsertab hdlc_enc[] = {{ "nrz", ENCODING_NRZ }, - { "nrzi", ENCODING_NRZI }, - { "fm-mark", ENCODING_FM_MARK }, - { "fm-space", ENCODING_FM_SPACE }, - { "manchester", ENCODING_MANCHESTER }, - { NULL, 0 }}; - -static parsertab hdlc_par[] = {{ "no-parity", PARITY_NONE }, - { "crc16", PARITY_CRC16_PR1 }, - { "crc16-pr0", PARITY_CRC16_PR0 }, - { "crc16-itu", PARITY_CRC16_PR1_CCITT }, - { "crc16-itu-pr0", PARITY_CRC16_PR0_CCITT }, - { "crc32-itu", PARITY_CRC32_PR1_CCITT }, - { NULL, 0 }}; - -static parsertab lmi[] = {{ "none", LMI_NONE }, - { "ansi", LMI_ANSI }, - { "ccitt", LMI_CCITT }, - { NULL, 0 }}; - - -static void set_iface(void) -{ - int orig_argc = argc; - te1_settings te1; - - memset(&te1, 0, sizeof(te1)); - req.ifr_settings.type = IF_IFACE_SYNC_SERIAL; - - while (argc > 0) { - if (req.ifr_settings.type == IF_IFACE_SYNC_SERIAL) - if (!checktab(ifaces, &req.ifr_settings.type)) - continue; - - if (!te1.clock_type) - if (!checkkey("clock")) { - if (!checktab(clocks, &te1.clock_type)) - continue; - error("Invalid clock type\n"); - } - - if (!te1.clock_rate && - (te1.clock_type == CLOCK_INT || - te1.clock_type == CLOCK_TXINT)) - if (!match("rate", &te1.clock_rate, 1, 0xFFFFFFFF)) - continue; - if (!te1.loopback) { - if (!checkkey("loopback") || - !checkkey("lb")) { - te1.loopback = 1; - continue; - } - } - /* slotmap goes here */ - - if (orig_argc == argc) - return; /* not an iface definition */ - error("Invalid parameter: %s\n", argv[0]); - } - - if (!te1.clock_rate && - (te1.clock_type == CLOCK_INT || - te1.clock_type == CLOCK_TXINT)) - te1.clock_rate = 64000; - - /* FIXME stupid hack, will remove it later */ - req.ifr_settings.ifs_ifsu.te1 = &te1; - if (req.ifr_settings.type == IF_IFACE_E1 || - req.ifr_settings.type == IF_IFACE_T1) - req.ifr_settings.size = sizeof(te1_settings); - else - req.ifr_settings.size = sizeof(sync_serial_settings); - - if (ioctl(sock, SIOCWANDEV, &req)) - error("Unable to set interface information: %s\n", - strerror(errno)); - - exit(0); -} - - - -static void set_proto_fr(void) -{ - unsigned int lmi_type = 0; - fr_proto fr; - - memset(&fr, 0, sizeof(fr)); - - while (argc > 0) { - if (!lmi_type) - if (!checkkey("lmi")) { - if (!checktab(lmi, &lmi_type)) - continue; - error("Invalid LMI type: %s\n", - argv[0]); - } - - if (lmi_type && lmi_type != LMI_NONE) { - if (!fr.dce) - if (!checkkey("dce")) { - fr.dce = 1; - continue; - } - - if (!fr.t391) - if (!match("t391", &fr.t391, - 1, 1000)) - continue; - if (!fr.t392) - if (!match("t392", &fr.t392, - 1, 1000)) - continue; - if (!fr.n391) - if (!match("n391", &fr.n391, - 1, 1000)) - continue; - if (!fr.n392) - if (!match("n392", &fr.n392, - 1, 1000)) - continue; - if (!fr.n393) - if (!match("n393", &fr.n393, - 1, 1000)) - continue; - } - error("Invalid parameter: %s\n", argv[0]); - } - - /* polling verification timer*/ - if (!fr.t391) fr.t391 = 10; - /* link integrity verification polling timer */ - if (!fr.t392) fr.t392 = 15; - /* full status polling counter*/ - if (!fr.n391) fr.n391 = 6; - /* error threshold */ - if (!fr.n392) fr.n392 = 3; - /* monitored events count */ - if (!fr.n393) fr.n393 = 4; - - if (!lmi_type) - fr.lmi = LMI_DEFAULT; - else - fr.lmi = lmi_type; - - req.ifr_settings.ifs_ifsu.fr = &fr; - req.ifr_settings.size = sizeof(fr); - - if (ioctl(sock, SIOCWANDEV, &req)) - error("Unable to set FR protocol information: %s\n", - strerror(errno)); -} - - - -static void set_proto_hdlc(int eth) -{ - unsigned int enc = 0, par = 0; - raw_hdlc_proto raw; - - memset(&raw, 0, sizeof(raw)); - - while (argc > 0) { - if (!enc) - if (!checktab(hdlc_enc, &enc)) - continue; - if (!par) - if (!checktab(hdlc_par, &par)) - continue; - - error("Invalid parameter: %s\n", argv[0]); - } - - if (!enc) - raw.encoding = ENCODING_DEFAULT; - else - raw.encoding = enc; - - if (!par) - raw.parity = ENCODING_DEFAULT; - else - raw.parity = par; - - req.ifr_settings.ifs_ifsu.raw_hdlc = &raw; - req.ifr_settings.size = sizeof(raw); - - if (ioctl(sock, SIOCWANDEV, &req)) - error("Unable to set HDLC%s protocol information: %s\n", - eth ? "-ETH" : "", strerror(errno)); -} - - - -static void set_proto_cisco(void) -{ - cisco_proto cisco; - memset(&cisco, 0, sizeof(cisco)); - - while (argc > 0) { - if (!cisco.interval) - if (!match("interval", &cisco.interval, - 1, 100)) - continue; - if (!cisco.timeout) - if (!match("timeout", &cisco.timeout, - 1, 100)) - continue; - - error("Invalid parameter: %s\n", - argv[0]); - } - - if (!cisco.interval) - cisco.interval = 10; - if (!cisco.timeout) - cisco.timeout = 25; - - req.ifr_settings.ifs_ifsu.cisco = &cisco; - req.ifr_settings.size = sizeof(cisco); - - if (ioctl(sock, SIOCWANDEV, &req)) - error("Unable to set Cisco HDLC protocol information: %s\n", - strerror(errno)); -} - - - -static void set_proto(void) -{ - if (checktab(protos, &req.ifr_settings.type)) - return; - - switch(req.ifr_settings.type) { - case IF_PROTO_HDLC: set_proto_hdlc(0); break; -#ifdef IF_PROTO_HDLC_ETH - case IF_PROTO_HDLC_ETH: set_proto_hdlc(1); break; -#endif - case IF_PROTO_CISCO: set_proto_cisco(); break; - case IF_PROTO_FR: set_proto_fr(); break; - - case IF_PROTO_PPP: - case IF_PROTO_X25: - req.ifr_settings.ifs_ifsu.sync = NULL; /* FIXME */ - req.ifr_settings.size = 0; - - if (!ioctl(sock, SIOCWANDEV, &req)) - break; - - error("Unable to set %s protocol information: %s\n", - req.ifr_settings.type == IF_PROTO_PPP - ? "PPP" : "X.25", strerror(errno)); - - default: error("Unknown protocol %u\n", req.ifr_settings.type); - } - - if (argc > 0) - error("Unexpected parameter: %s\n", argv[0]); - - close(sock); - exit(0); -} - - - -static void set_pvc(void) -{ - char *op = argv[0]; - parsertab ops[] = {{ "create", IF_PROTO_FR_ADD_PVC }, - { "delete", IF_PROTO_FR_DEL_PVC }, - { NULL, 0 }}; - fr_proto_pvc pvc; - - memset(&pvc, 0, sizeof(pvc)); - - if (checktab(ops, &req.ifr_settings.type)) - return; - -#ifdef IF_PROTO_FR_ETH_PVC - if (!match("ether", &pvc.dlci, 0, 1023)) { - if (req.ifr_settings.type == IF_PROTO_FR_ADD_PVC) - req.ifr_settings.type = IF_PROTO_FR_ADD_ETH_PVC; - else - req.ifr_settings.type = IF_PROTO_FR_DEL_ETH_PVC; - - } else -#endif - if (match(NULL, &pvc.dlci, 0, 1023)) - return; - - if (argc != 0) - return; - - req.ifr_settings.ifs_ifsu.fr_pvc = &pvc; - req.ifr_settings.size = sizeof(pvc); - - if (ioctl(sock, SIOCWANDEV, &req)) - error("Unable to %s PVC: %s\n", op, strerror(errno)); - exit(0); -} - - - -static void private(void) -{ - if (argc < 1) - return; - - if (!strcmp(argv[0], "private")) { - if (argc != 1) - return; - if (ioctl(sock, SIOCDEVPRIVATE, &req)) - error("SIOCDEVPRIVATE: %s\n", strerror(errno)); - exit(0); - } -} - - - -static void show_port(void) -{ - const char *s; - char buffer[128]; - const te1_settings *te1 = (void*)buffer; - const raw_hdlc_proto *raw = (void*)buffer; - const cisco_proto *cisco = (void*)buffer; - const fr_proto *fr = (void*)buffer; -#ifdef IF_PROTO_FR_PVC - const fr_proto_pvc_info *pvc = (void*)buffer; -#endif - req.ifr_settings.ifs_ifsu.sync = (void*)buffer; /* FIXME */ - - printf("%s: ", req.ifr_name); - - req.ifr_settings.size = sizeof(buffer); - req.ifr_settings.type = IF_GET_IFACE; - - if (ioctl(sock, SIOCWANDEV, &req)) - if (errno != EINVAL) { - printf("unable to get interface information: %s\n", - strerror(errno)); - close(sock); - exit(1); - } - - /* Get and print physical interface settings */ - if (req.ifr_settings.type == IF_IFACE_SYNC_SERIAL) - s = ""; /* Unspecified serial interface */ - else - s = tabstr(req.ifr_settings.type, ifaces, NULL); - - if (!s) - printf("unknown interface 0x%x\n", req.ifr_settings.type); - else { - if (*s) - printf("interface %s ", s); - - printf("clock %s", tabstr(te1->clock_type, clocks, - "type unknown")); - if (te1->clock_type == CLOCK_INT || - te1->clock_type == CLOCK_TXINT) - printf(" rate %u", te1->clock_rate); - - if (te1->loopback) - printf(" loopback"); - - if (req.ifr_settings.type == IF_IFACE_E1 || - req.ifr_settings.type == IF_IFACE_T1) { - unsigned int u; - printf(" slotmap "); - for (u = te1->slot_map; u != 0; u /= 2) - printf("%u", u % 2); - } - printf("\n"); - } - - /* Get and print protocol settings */ - do { - printf("\t"); - req.ifr_settings.size = sizeof(buffer); - req.ifr_settings.type = IF_GET_PROTO; - - if (ioctl(sock, SIOCWANDEV, &req)) { - if (errno == EINVAL) - printf("no protocol set\n"); - else - printf("unable to get protocol information: " - "%s\n", strerror(errno)); - break; - } - - switch(req.ifr_settings.type) { - case IF_PROTO_FR: - printf("protocol fr lmi %s", - tabstr(fr->lmi, lmi, "unknown")); - if (fr->lmi == LMI_ANSI || - fr->lmi == LMI_CCITT) - printf("%s t391 %u t392 %u n391 %u n392 %u " - "n393 %u\n", - fr->dce ? " dce" : "", - fr->t391, - fr->t392, - fr->n391, - fr->n392, - fr->n393); - else - putchar('\n'); - break; - -#ifdef IF_PROTO_FR_PVC - case IF_PROTO_FR_PVC: - printf("Frame-Relay PVC: DLCI %u, master device %s\n", - pvc->dlci, pvc->master); - break; -#endif - -#ifdef IF_PROTO_FR_ETH_PVC - case IF_PROTO_FR_ETH_PVC: - printf("Frame-Relay PVC (Ethernet emulation): DLCI %u," - " master device %s\n", pvc->dlci, pvc->master); - break; -#endif - - case IF_PROTO_HDLC: - printf("protocol hdlc %s %s\n", - tabstr(raw->encoding, hdlc_enc, "unknown"), - tabstr(raw->parity, hdlc_par, "unknown")); - break; - -#ifdef IF_PROTO_HDLC_ETH - case IF_PROTO_HDLC_ETH: - printf("protocol hdlc-eth %s %s\n", - tabstr(raw->encoding, hdlc_enc, "unknown"), - tabstr(raw->parity, hdlc_par, "unknown")); - break; -#endif - - case IF_PROTO_CISCO: - printf("protocol cisco interval %u timeout %u\n", - cisco->interval, - cisco->timeout); - break; - - case IF_PROTO_PPP: - printf("protocol ppp\n"); - break; - - case IF_PROTO_X25: - printf("protocol x25\n"); - break; - - default: - printf("unknown protocol %u\n", req.ifr_settings.type); - } - }while(0); - - close(sock); - exit(0); -} - - - -static void usage(void) -{ - fprintf(stderr, "sethdlc version 1.15\n" - "Copyright (C) 2000 - 2003 Krzysztof Halasa \n" - "\n" - "Usage: sethdlc INTERFACE [PHYSICAL] [clock CLOCK] [LOOPBACK] " - "[slotmap SLOTMAP]\n" - " sethdlc INTERFACE [PROTOCOL]\n" - " sethdlc INTERFACE create | delete" -#ifdef IF_PROTO_FR_ETH_PVC - " [ether]" -#endif - " DLCI\n" - " sethdlc INTERFACE private...\n" - "\n" - "PHYSICAL := v24 | v35 | x21 | e1 | t1\n" - "CLOCK := int [rate RATE] | ext | txint [rate RATE] | txfromrx\n" - "LOOPBACK := loopback | lb\n" - "\n" - "PROTOCOL := hdlc [ENCODING] [PARITY] |\n" -#ifdef IF_PROTO_HDLC_ETH - " hdlc-eth [ENCODING] [PARITY] |\n" -#endif - " cisco [interval val] [timeout val] |\n" - " fr [lmi LMI] |\n" - " ppp |\n" - " x25\n" - "\n" - "ENCODING := nrz | nrzi | fm-mark | fm-space | manchester\n" - "PARITY := no-parity | crc16 | crc16-pr0 | crc16-itu | crc16-itu-pr0 | crc32-itu\n" - "LMI := none | ansi [LMI_SPEC] | ccitt [LMI_SPEC]\n" - "LMI_SPEC := [dce] [t391 val] [t392 val] [n391 val] [n392 val] [n393 val]\n"); - exit(0); -} - - - -int main(int arg_c, char *arg_v[]) -{ - argc = arg_c; - argv = arg_v; - - if (argc <= 1) - usage(); - - sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sock < 0) - error("Unable to create socket: %s\n", strerror(errno)); - - zap_copy_string(req.ifr_name, argv[1], sizeof(req.ifr_name)); /* Device name */ - - if (argc == 2) - show_port(); - - argc -= 2; - argv += 2; - - set_iface(); - set_proto(); - set_pvc(); - private(); - - close(sock); - usage(); - exit(0); -} diff --git a/zaptel/sethdlc.c b/zaptel/sethdlc.c deleted file mode 100644 index fd395173..00000000 --- a/zaptel/sethdlc.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "kernel/zaptel.h" - - -struct ifreq req; /* for ioctl */ - - - -void error(const char *format, ...) __attribute__ ((noreturn)); - -void error(const char *format, ...) -{ - va_list args; - - va_start(args, format); - fprintf(stderr, "%s: ", req.ifr_name); - vfprintf(stderr, format, args); - va_end(args); - exit(1); -} - - - -typedef struct { - const char *name; - const int value; -} parsertab; - - - -int parser(const char *name, parsertab *tab) -{ - int i; - for (i = 0; tab[i].name; i++) { - if (!strcmp(tab[i].name, name)) { - req.ifr_ifru.ifru_ivalue = tab[i].value; - return 0; - } - } - return -1; /* Not found */ -} - - - -void run_board(const int sock, const char *filename) -{ - __u32 length; - FILE *fw; - - fw=fopen(filename, "rb"); - if (fw==NULL) - error("Unable to open firmware file: %s\n", strerror(errno)); - - fseek(fw, 0, SEEK_END); - length=ftell(fw); - fseek(fw, 0, SEEK_SET); - req.ifr_data=malloc(length+sizeof(__u32)); - if (req.ifr_data==NULL) { - fclose(fw); - error("Out of memory\n"); - } - - *(__u32*)req.ifr_data = length; - if (fread(req.ifr_data+sizeof(__u32), 1, length, fw)!=length) { - fclose(fw); - error("Error reading firmware file: %s\n", strerror(errno)); - } - - fclose(fw); - - if (ioctl(sock, HDLCRUN, &req)) - error("Running failed: %s\n", strerror(errno)); - - free(req.ifr_data); -} - - - -void set_clock(const int sock, int *arg, int argc, char *argv[]) -{ - int rate = 0, type = 0; - - parsertab tab[]={{ "ext", CLOCK_EXT }, - { "int", CLOCK_INT }, - { "txint", CLOCK_TXINT }, - { "txfromrx", CLOCK_TXFROMRX }, - { NULL }}; - - if (!(argc > *arg)) - error("Missing clock rate/type\n"); - - while((rate == 0 || type == 0) && argc > *arg) { - int speed; - char test; - if ((rate == 0) && - (sscanf(argv[*arg], "%i%c", &speed, &test) == 1)) { - req.ifr_ifru.ifru_ivalue = speed; - if (ioctl(sock, HDLCSCLOCKRATE, &req)) - error("Unable to set clock rate: %s\n", - strerror(errno)); - - if (req.ifr_ifru.ifru_ivalue != speed) - printf("%s: Using clock rate %i bps\n", - req.ifr_name, - req.ifr_ifru.ifru_ivalue); - rate = 1; - (*arg)++; - continue; - } - - if ((type == 0) && !parser(argv[*arg], tab)) { - if (ioctl(sock, HDLCSCLOCK, &req)) - error("Unable to set clock: %s\n", - strerror(errno)); - type = 1; - (*arg)++; - continue; - } - - break; - } - - if (rate == 0 && type == 0) - error("Invalid clock rate/type %s\n", argv[*arg]); -} - - - -void fr_pvc(const int sock, char *arg, const int creat_del) -{ - int dlci; - char test; - - if (sscanf(arg, "%u%c", &dlci, &test)==1) - if (dlci>0 && dlci<1023) { - req.ifr_ifru.ifru_ivalue = dlci * creat_del; - if (ioctl(sock, HDLCPVC, &req)) - error("Unable to %s PVC: %s\n", - (creat_del == 1) ? "create" : "delete", - strerror(errno)); - return; - } - - error("Invalid dlci %s\n", arg); -} - - - -void show_port(const int sock) -{ - char *proto, *dce = "", *soft = "", *line, *loopback = ""; - char *clock, rate[64] = "", slots[64] = ""; - int clkint = 0; - - if (ioctl(sock, HDLCGMODE, &req)) - error("Error getting protocol: %s\n", strerror(errno)); - switch(req.ifr_ifru.ifru_ivalue & ~(MODE_DCE | MODE_SOFT)) { - case MODE_NONE: proto = "none"; break; - case MODE_HDLC: proto = "raw HDLC"; break; - case MODE_CISCO: proto = "Cisco HDLC"; break; - case MODE_PPP: proto = "PPP"; break; - case MODE_FR_ANSI: proto = "Frame Relay (ANSI LMI)"; break; - case MODE_FR_CCITT: proto = "Frame Relay (CCITT LMI)"; break; - case MODE_X25: proto = "X.25"; break; - default: proto = "unknown - upgrade sethdlc"; break; - } - - if (req.ifr_ifru.ifru_ivalue & MODE_DCE) - dce = " (DCE)"; - - if (req.ifr_ifru.ifru_ivalue & MODE_SOFT) - soft = " (soft)"; - - if (ioctl(sock, HDLCGLINE, &req)) - error("Error getting physical interface: %s\n", - strerror(errno)); - switch(req.ifr_ifru.ifru_ivalue & ~LINE_LOOPBACK) { - case LINE_DEFAULT: line = "default"; break; - case LINE_V35: line = "V.35"; break; - case LINE_RS232: line = "RS232"; break; - case LINE_X21: line = "X.21"; break; - case LINE_T1: line = "T1"; break; - case LINE_E1: line = "E1"; break; - default: line = "unknown - upgrade sethdlc"; break; - } - - if (req.ifr_ifru.ifru_ivalue & LINE_LOOPBACK) - loopback = " (loopback)"; - - if (ioctl(sock, HDLCGCLOCK, &req)) - clock = "default"; /* Not supported */ - else - switch(req.ifr_ifru.ifru_ivalue) { - case CLOCK_EXT: clock = "external"; break; - case CLOCK_INT: clock = "internal"; clkint = 1; break; - case CLOCK_TXINT: clock = "TX internal RX external"; - clkint = 1; break; - case CLOCK_TXFROMRX: clock = "TX derived from external RX"; - break; - default: clock = "unknown - upgrade sethdlc"; break; - } - - if (clkint) { - if (ioctl(sock, HDLCGCLOCKRATE, &req)) - error("Error getting clock rate: %s\n", - strerror(errno)); - else - sprintf(rate, " rate: %i bps", - req.ifr_ifru.ifru_ivalue); - } - - if (!ioctl(sock, HDLCGSLOTMAP, &req)) { - int i, j, mask; - - strcpy(slots, "\tslots in use: "); - for (i = j = strlen(slots), mask = 1 << 31; - i < 32 + j; - i++, mask >>= 1) - slots[i] = (req.ifr_ifru.ifru_ivalue & mask) ? - '1' : '0'; - slots[i++] = '\n'; - slots[i] = '\x0'; - } - - printf("%s:\tmode: %s%s%s\n" -"\tline: %s%s\n" -"\tclock: %s%s\n" -"%s\n", req.ifr_name, proto, dce, soft, line, loopback, clock, rate, slots); -} - - - -void usage(void) -{ - error("\nsethdlc version 1.01 for Linux 2.4\n" -"\n" -"Copyright (C) 2000 Krzysztof Halasa \n" -"\n" -"This program is free software; you can redistribute it and/or modify it\n" -"under the terms of the GNU General Public License as published by\n" -"the Free Software Foundation; either version 2 of the License, or\n" -"(at your option) any later version.\n" -"\n" -"Usage: sethdlc interface command [parameters] ...\n" -"\n" -"commands:\n" -"\trun \n" -"\tclock ( | int | ext | txint | txfromrx )\n" -"\tmode [soft] [dce] (hdlc | cisco | ppp | [fr-]ansi | [fr-]ccitt | x25)\n" -"\tv35[-lb] | rs232[-lb] | x21[-lb] | t1[-lb] | e1[-lb] | lb | default\n" -"\tslotmap \n" -"\t(create | delete) \n" -"\n" -"Some commands and parameters may not be supported by some drivers or hardware\n" -); - exit(0); -} - - - -int main(int argc, char *argv[]) -{ - int sock, arg = 2; - parsertab lines[] = {{ "v35", LINE_V35 }, - { "v35-lb", LINE_V35 | LINE_LOOPBACK }, - { "rs232", LINE_RS232 }, - { "rs232-lb", LINE_RS232 | LINE_LOOPBACK }, - { "x21", LINE_X21 }, - { "x21-lb", LINE_X21 | LINE_LOOPBACK }, - { "t1", LINE_T1 }, - { "t1-lb", LINE_T1 | LINE_LOOPBACK }, - { "e1", LINE_E1 }, - { "e1-lb", LINE_E1 | LINE_LOOPBACK }, - { "default", LINE_DEFAULT }, - { "lb", LINE_LOOPBACK }, - { "loopback", LINE_LOOPBACK }, - { NULL }}; - - if (argc <= 1) - usage(); - - sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sock<0) - error("Unable to create socket: %s\n", strerror(errno)); - - zap_copy_string(req.ifr_name, argv[1], sizeof(req.ifr_name)); /* Device name */ - - if (argc == 2) { - show_port(sock); - exit(0); - } - - while (argc > arg) { - if (!strcmp(argv[arg], "clock")) { - arg++; - set_clock(sock, &arg, argc, argv); - continue; - } - - if (!parser(argv[arg], lines)) { - if (ioctl(sock, HDLCSLINE, &req)) - error("Unable to set physical interface: %s\n", - strerror(errno)); - arg++; - continue; - } - - if (argc > arg+1 && !strcmp(argv[arg], "create")) /* PVC */ { - fr_pvc(sock, argv[++arg], 1); - arg++; - continue; - } - - if (argc > arg+1 && !strcmp(argv[arg], "delete")) /* PVC */ { - fr_pvc(sock, argv[++arg], -1); - arg++; - continue; - } - - /* Download firmware and run board */ - if (argc > arg+1 && !strcmp(argv[arg], "run")) { - run_board(sock, argv[++arg]); - arg++; - continue; - } - - /* Set mode */ - if (argc > arg+1 && !strcmp(argv[arg], "mode")) { - int mode = 0; - arg++; - - if (argc > arg+1 && !strcmp(argv[arg], "soft")) { - mode |= MODE_SOFT; - arg++; - } - - if (argc > arg+1 && !strcmp(argv[arg], "dce")) { - mode |= MODE_DCE; - arg++; - } - - if (!strcmp(argv[arg], "hdlc")) - mode |= MODE_HDLC; - else if (!strcmp(argv[arg], "cisco")) - mode |= MODE_CISCO; - else if (!strcmp(argv[arg], "ppp")) - mode |= MODE_PPP; - else if (!strcmp(argv[arg], "ansi") || - !strcmp(argv[arg], "fr_ansi") || - !strcmp(argv[arg], "fr-ansi")) - mode |= MODE_FR_ANSI; - else if (!strcmp(argv[arg], "ccitt")|| - !strcmp(argv[arg], "fr_ccitt")|| - !strcmp(argv[arg], "fr-ccitt")) - mode |= MODE_FR_CCITT; - else if (!strcmp(argv[arg], "x25")) - mode |= MODE_X25; - else - mode = 0; - - if (mode) { - req.ifr_ifru.ifru_ivalue = mode; - if (ioctl(sock, HDLCSMODE, &req)) - error("Error setting mode: %s\n", - strerror(errno)); - arg++; - continue; - } - } - - error("\nInvalid parameter: %s\n", argv[arg]); - } - - close(sock); - exit(0); -} diff --git a/zaptel/timertest.c b/zaptel/timertest.c deleted file mode 100644 index 7af738d5..00000000 --- a/zaptel/timertest.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -int main(int argc, char *argv[]) -{ - int fd; - int x = 8000; - int res; - fd_set fds; - struct timeval orig, now; - fd = open("/dev/zap/timer", O_RDWR); - if (fd < 0) { - fprintf(stderr, "Unable to open timer: %s\n", strerror(errno)); - exit(1); - } - printf("Opened timer...\n"); - if (ioctl(fd, ZT_TIMERCONFIG, &x)) { - fprintf(stderr, "Unable to set timer: %s\n", strerror(errno)); - exit(1); - } - printf("Set timer duration to %d samples (%d ms)\n", x, x/8); - printf("Waiting...\n"); - gettimeofday(&orig, NULL); - for(;;) { - FD_ZERO(&fds); - FD_SET(fd, &fds); - res = select(fd + 1, NULL, NULL, &fds, NULL); - if (res != 1) { - fprintf(stderr, "Unexpected result %d: %s\n", res, strerror(errno)); - exit(1); - } - x = -1; - if (ioctl(fd, ZT_TIMERACK, &x)) { - fprintf(stderr, "Unable to ack timer: %s\n", strerror(errno)); - exit(1); - } - gettimeofday(&now, NULL); - printf("Timer Expired (%ld ms)!\n", (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000); - } - exit(0); -} diff --git a/zaptel/tonezone.c b/zaptel/tonezone.c deleted file mode 100644 index 14025014..00000000 --- a/zaptel/tonezone.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 - * - * Working with the "Tormenta ISA" Card - * - * Primary Author: Mark Spencer - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU Lesser General Public License Version 2.1 as published - * by the Free Software Foundation. See the LICENSE.LGPL file - * included with this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kernel/zaptel.h" -#include "tonezone.h" - -#define DEFAULT_ZT_DEV "/dev/zap/ctl" - -#define MAX_SIZE 16384 -#define CLIP 32635 -#define BIAS 0x84 - -struct tone_zone *tone_zone_find(char *country) -{ - struct tone_zone *z; - z = builtin_zones; - while(z->zone > -1) { - if (!strcasecmp(country, z->country)) - return z; - z++; - } - return NULL; -} - -struct tone_zone *tone_zone_find_by_num(int id) -{ - struct tone_zone *z; - z = builtin_zones; - while(z->zone > -1) { - if (z->zone == id) - return z; - z++; - } - return NULL; -} - -#define LEVEL -10 - -static int build_tone(void *data, int size, struct tone_zone_sound *t, int *count) -{ - char *dup, *s; - struct zt_tone_def *td=NULL; - int firstnobang = -1; - int freq1, freq2, time; - int modulate = 0; - float gain; - int used = 0; - dup = strdup(t->data); - s = strtok(dup, ","); - while(s && strlen(s)) { - /* Handle optional ! which signifies don't start here*/ - if (s[0] == '!') - s++; - else if (firstnobang < 0) { -#if 0 - printf("First no bang: %s\n", s); -#endif - firstnobang = *count; - } - if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) { - /* f1+f2/time format */ -#if 0 - printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time); -#endif - } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) { - /* f1*f2/time format */ - modulate = 1; -#if 0 - printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time); -#endif - } else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) { -#if 0 - printf("f1+f2 format: %d, %d\n", freq1, freq2); -#endif - time = 0; - } else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) { - modulate = 1; -#if 0 - printf("f1+f2 format: %d, %d\n", freq1, freq2); -#endif - time = 0; - } else if (sscanf(s, "%d/%d", &freq1, &time) == 2) { -#if 0 - printf("f1/time format: %d, %d\n", freq1, time); -#endif - freq2 = 0; - } else if (sscanf(s, "%d", &freq1) == 1) { -#if 0 - printf("f1 format: %d\n", freq1); -#endif - firstnobang = *count; - freq2 = 0; - time = 0; - } else { - fprintf(stderr, "tone component '%s' of '%s' is a syntax error\n", s,t->data); - return -1; - } -#if 0 - printf("Using %d samples for %d and %d\n", time * 8, freq1, freq2); -#endif - if (size < sizeof(*td)) { - fprintf(stderr, "Not enough space for tones\n"); - return -1; - } - td = data; - - /* Bring it down -8 dbm */ - gain = pow(10.0, (LEVEL - 3.14) / 20.0) * 65536.0 / 2.0; - - td->fac1 = 2.0 * cos(2.0 * M_PI * (freq1 / 8000.0)) * 32768.0; - td->init_v2_1 = sin(-4.0 * M_PI * (freq1 / 8000.0)) * gain; - td->init_v3_1 = sin(-2.0 * M_PI * (freq1 / 8000.0)) * gain; - - td->fac2 = 2.0 * cos(2.0 * M_PI * (freq2 / 8000.0)) * 32768.0; - td->init_v2_2 = sin(-4.0 * M_PI * (freq2 / 8000.0)) * gain; - td->init_v3_2 = sin(-2.0 * M_PI * (freq2 / 8000.0)) * gain; - - td->modulate = modulate; - - data += sizeof(*td); - used += sizeof(*td); - size -= sizeof(*td); - td->tone = t->toneid; - if (time) { - /* We should move to the next tone */ - td->next = *count + 1; - td->samples = time * 8; - } else { - /* Stay with us */ - td->next = *count; - td->samples = 8000; - } - *count += 1; - s = strtok(NULL, ","); - } - if (td && time) { - /* If we don't end on a solid tone, return */ - td->next = firstnobang; - } - if (firstnobang < 0) - fprintf(stderr, "tone '%s' does not end with a solid tone or silence (all tone components have an exclamation mark)\n", t->data); - - return used; -} - -char *tone_zone_tone_name(int id) -{ - static char tmp[80]; - switch(id) { - case ZT_TONE_DIALTONE: - return "Dialtone"; - case ZT_TONE_BUSY: - return "Busy"; - case ZT_TONE_RINGTONE: - return "Ringtone"; - case ZT_TONE_CONGESTION: - return "Congestion"; - case ZT_TONE_CALLWAIT: - return "Call Waiting"; - case ZT_TONE_DIALRECALL: - return "Dial Recall"; - case ZT_TONE_RECORDTONE: - return "Record Tone"; - case ZT_TONE_CUST1: - return "Custom 1"; - case ZT_TONE_CUST2: - return "Custom 2"; - case ZT_TONE_INFO: - return "Special Information"; - case ZT_TONE_STUTTER: - return "Stutter Dialtone"; - default: - snprintf(tmp, sizeof(tmp), "Unknown tone %d", id); - return tmp; - } -} - -#ifdef TONEZONE_DRIVER -static void dump_tone_zone(void *data, int size) -{ - struct zt_tone_def_header *z; - struct zt_tone_def *td; - int x; - int len = sizeof(*z); - - z = data; - data += sizeof(*z); - printf("Header: %d tones, %d bytes of data, zone %d (%s)\n", - z->count, size, z->zone, z->name); - for (x = 0; x < z->count; x++) { - td = data; - printf("Tone Fragment %d: tone is %d, next is %d, %d samples\n", - x, td->tone, td->next, td->samples); - data += sizeof(*td); - len += sizeof(*td); - } - printf("Total measured bytes of data: %d\n", len); -} -#endif - -/* Tone frequency tables */ -struct mf_tone { - int tone; - float f1; /* first freq */ - float f2; /* second freq */ -}; - -static struct mf_tone dtmf_tones[] = { - { ZT_TONE_DTMF_0, 941.0, 1336.0 }, - { ZT_TONE_DTMF_1, 697.0, 1209.0 }, - { ZT_TONE_DTMF_2, 697.0, 1336.0 }, - { ZT_TONE_DTMF_3, 697.0, 1477.0 }, - { ZT_TONE_DTMF_4, 770.0, 1209.0 }, - { ZT_TONE_DTMF_5, 770.0, 1336.0 }, - { ZT_TONE_DTMF_6, 770.0, 1477.0 }, - { ZT_TONE_DTMF_7, 852.0, 1209.0 }, - { ZT_TONE_DTMF_8, 852.0, 1336.0 }, - { ZT_TONE_DTMF_9, 852.0, 1477.0 }, - { ZT_TONE_DTMF_s, 941.0, 1209.0 }, - { ZT_TONE_DTMF_p, 941.0, 1477.0 }, - { ZT_TONE_DTMF_A, 697.0, 1633.0 }, - { ZT_TONE_DTMF_B, 770.0, 1633.0 }, - { ZT_TONE_DTMF_C, 852.0, 1633.0 }, - { ZT_TONE_DTMF_D, 941.0, 1633.0 }, - { 0, 0, 0 } -}; - -static struct mf_tone mfr1_tones[] = { - { ZT_TONE_MFR1_0, 1300.0, 1500.0 }, - { ZT_TONE_MFR1_1, 700.0, 900.0 }, - { ZT_TONE_MFR1_2, 700.0, 1100.0 }, - { ZT_TONE_MFR1_3, 900.0, 1100.0 }, - { ZT_TONE_MFR1_4, 700.0, 1300.0 }, - { ZT_TONE_MFR1_5, 900.0, 1300.0 }, - { ZT_TONE_MFR1_6, 1100.0, 1300.0 }, - { ZT_TONE_MFR1_7, 700.0, 1500.0 }, - { ZT_TONE_MFR1_8, 900.0, 1500.0 }, - { ZT_TONE_MFR1_9, 1100.0, 1500.0 }, - { ZT_TONE_MFR1_KP, 1100.0, 1700.0 }, /* KP */ - { ZT_TONE_MFR1_ST, 1500.0, 1700.0 }, /* ST */ - { ZT_TONE_MFR1_STP, 900.0, 1700.0 }, /* KP' or ST' */ - { ZT_TONE_MFR1_ST2P, 1300.0, 1700.0 }, /* KP'' or ST'' */ - { ZT_TONE_MFR1_ST3P, 700.0, 1700.0 }, /* KP''' or ST''' */ - { 0, 0, 0 } -}; - -static struct mf_tone mfr2_fwd_tones[] = { - { ZT_TONE_MFR2_FWD_1, 1380.0, 1500.0 }, - { ZT_TONE_MFR2_FWD_2, 1380.0, 1620.0 }, - { ZT_TONE_MFR2_FWD_3, 1500.0, 1620.0 }, - { ZT_TONE_MFR2_FWD_4, 1380.0, 1740.0 }, - { ZT_TONE_MFR2_FWD_5, 1500.0, 1740.0 }, - { ZT_TONE_MFR2_FWD_6, 1620.0, 1740.0 }, - { ZT_TONE_MFR2_FWD_7, 1380.0, 1860.0 }, - { ZT_TONE_MFR2_FWD_8, 1500.0, 1860.0 }, - { ZT_TONE_MFR2_FWD_9, 1620.0, 1860.0 }, - { ZT_TONE_MFR2_FWD_10, 1740.0, 1860.0 }, - { ZT_TONE_MFR2_FWD_11, 1380.0, 1980.0 }, - { ZT_TONE_MFR2_FWD_12, 1500.0, 1980.0 }, - { ZT_TONE_MFR2_FWD_13, 1620.0, 1980.0 }, - { ZT_TONE_MFR2_FWD_14, 1740.0, 1980.0 }, - { ZT_TONE_MFR2_FWD_15, 1860.0, 1980.0 }, - { 0, 0, 0 } -}; - -static struct mf_tone mfr2_rev_tones[] = { - { ZT_TONE_MFR2_REV_1, 1020.0, 1140.0 }, - { ZT_TONE_MFR2_REV_2, 900.0, 1140.0 }, - { ZT_TONE_MFR2_REV_3, 900.0, 1020.0 }, - { ZT_TONE_MFR2_REV_4, 780.0, 1140.0 }, - { ZT_TONE_MFR2_REV_5, 780.0, 1020.0 }, - { ZT_TONE_MFR2_REV_6, 780.0, 900.0 }, - { ZT_TONE_MFR2_REV_7, 660.0, 1140.0 }, - { ZT_TONE_MFR2_REV_8, 660.0, 1020.0 }, - { ZT_TONE_MFR2_REV_9, 660.0, 900.0 }, - { ZT_TONE_MFR2_REV_10, 660.0, 780.0 }, - { ZT_TONE_MFR2_REV_11, 540.0, 1140.0 }, - { ZT_TONE_MFR2_REV_12, 540.0, 1020.0 }, - { ZT_TONE_MFR2_REV_13, 540.0, 900.0 }, - { ZT_TONE_MFR2_REV_14, 540.0, 780.0 }, - { ZT_TONE_MFR2_REV_15, 540.0, 660.0 }, - { 0, 0, 0 } -}; - -static int build_mf_tones(void *data, int size, int *count, struct mf_tone *tone, int low_tone_level, int high_tone_level) -{ - struct zt_tone_def *td; - float gain; - int used = 0; - - while (tone->tone) { - if (size < sizeof(*td)) { - fprintf(stderr, "Not enough space for samples\n"); - return -1; - } - td = data; - data += sizeof(*td); - used += sizeof(*td); - size -= sizeof(*td); - td->tone = tone->tone; - *count += 1; - - /* Bring it down 6 dBm */ - gain = pow(10.0, (low_tone_level - 3.14) / 20.0) * 65536.0 / 2.0; - td->fac1 = 2.0 * cos(2.0 * M_PI * (tone->f1 / 8000.0)) * 32768.0; - td->init_v2_1 = sin(-4.0 * M_PI * (tone->f1 / 8000.0)) * gain; - td->init_v3_1 = sin(-2.0 * M_PI * (tone->f1 / 8000.0)) * gain; - - gain = pow(10.0, (high_tone_level - 3.14) / 20.0) * 65536.0 / 2.0; - td->fac2 = 2.0 * cos(2.0 * M_PI * (tone->f2 / 8000.0)) * 32768.0; - td->init_v2_2 = sin(-4.0 * M_PI * (tone->f2 / 8000.0)) * gain; - td->init_v3_2 = sin(-2.0 * M_PI * (tone->f2 / 8000.0)) * gain; - - tone++; - } - - return used; -} - -int tone_zone_register_zone(int fd, struct tone_zone *z) -{ - char buf[MAX_SIZE]; - int res; - int count = 0; - int x; - int space = MAX_SIZE; - void *ptr = buf; - int iopenedit = 1; - struct zt_tone_def_header *h; - - memset(buf, 0, sizeof(buf)); - - h = ptr; - ptr += sizeof(*h); - space -= sizeof(*h); - h->zone = z->zone; - - zap_copy_string(h->name, z->description, sizeof(h->name)); - - for (x = 0; x < ZT_MAX_CADENCE; x++) - h->ringcadence[x] = z->ringcadence[x]; - - for (x = 0; x < ZT_TONE_MAX; x++) { - if (!strlen(z->tones[x].data)) - continue; - -#if 0 - printf("Tone: %d, string: %s\n", z->tones[x].toneid, z->tones[x].data); -#endif - if ((res = build_tone(ptr, space, &z->tones[x], &count)) < 0) { - fprintf(stderr, "Tone %d not built.\n", x); - return -1; - } - ptr += res; - space -= res; - } - - if ((res = build_mf_tones(ptr, space, &count, dtmf_tones, z->dtmf_low_level, z->dtmf_high_level)) < 0) { - fprintf(stderr, "Could not build DTMF tones.\n"); - return -1; - } - ptr += res; - space -= res; - - if ((res = build_mf_tones(ptr, space, &count, mfr1_tones, z->mfr1_level, z->mfr1_level)) < 0) { - fprintf(stderr, "Could not build MFR1 tones.\n"); - return -1; - } - ptr += res; - space -= res; - - if ((res = build_mf_tones(ptr, space, &count, mfr2_fwd_tones, z->mfr2_level, z->mfr2_level)) < 0) { - fprintf(stderr, "Could not build MFR2 FWD tones.\n"); - return -1; - } - ptr += res; - space -= res; - - if ((res = build_mf_tones(ptr, space, &count, mfr2_rev_tones, z->mfr2_level, z->mfr2_level)) < 0) { - fprintf(stderr, "Could not build MFR2 REV tones.\n"); - return -1; - } - ptr += res; - space -= res; - - h->count = count; - - if (fd < 0) { - if ((fd = open(DEFAULT_ZT_DEV, O_RDWR)) < 0) { - fprintf(stderr, "Unable to open %s and fd not provided\n", DEFAULT_ZT_DEV); - return -1; - } - iopenedit = 1; - } - - x = z->zone; - if ((res = ioctl(fd, ZT_FREEZONE, &x))) { - if (errno != EBUSY) - fprintf(stderr, "ioctl(ZT_FREEZONE) failed: %s\n", strerror(errno)); - return res; - } - -#if defined(TONEZONE_DRIVER) - dump_tone_zone(h, MAX_SIZE - space); -#endif - - if ((res = ioctl(fd, ZT_LOADZONE, h))) { - fprintf(stderr, "ioctl(ZT_LOADZONE) failed: %s\n", strerror(errno)); - return res; - } - - if (iopenedit) - close(fd); - - return res; -} - -int tone_zone_register(int fd, char *country) -{ - struct tone_zone *z; - z = tone_zone_find(country); - if (z) { - return tone_zone_register_zone(-1, z); - } else { - return -1; - } -} - -int tone_zone_set_zone(int fd, char *country) -{ - int res=-1; - struct tone_zone *z; - if (fd > -1) { - z = tone_zone_find(country); - if (z) - res = ioctl(fd, ZT_SETTONEZONE, &z->zone); - if ((res < 0) && (errno == ENODATA)) { - tone_zone_register_zone(fd, z); - res = ioctl(fd, ZT_SETTONEZONE, &z->zone); - } - } - return res; -} - -int tone_zone_get_zone(int fd) -{ - int x=-1; - if (fd > -1) { - ioctl(fd, ZT_GETTONEZONE, &x); - return x; - } - return -1; -} - -int tone_zone_play_tone(int fd, int tone) -{ - struct tone_zone *z; - int res = -1; - int zone; - -#if 0 - fprintf(stderr, "Playing tone %d (%s) on %d\n", tone, tone_zone_tone_name(tone), fd); -#endif - if (fd > -1) { - res = ioctl(fd, ZT_SENDTONE, &tone); - if ((res < 0) && (errno == ENODATA)) { - ioctl(fd, ZT_GETTONEZONE, &zone); - z = tone_zone_find_by_num(zone); - if (z) { - res = tone_zone_register_zone(fd, z); - /* Recall the zone */ - ioctl(fd, ZT_SETTONEZONE, &zone); - if (res < 0) { - fprintf(stderr, "Failed to register zone '%s': %s\n", z->description, strerror(errno)); - } else { - res = ioctl(fd, ZT_SENDTONE, &tone); - } - } else - fprintf(stderr, "Don't know anything about zone %d\n", zone); - } - } - return res; -} diff --git a/zaptel/tonezone.h b/zaptel/tonezone.h deleted file mode 100644 index 1e54479e..00000000 --- a/zaptel/tonezone.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 - * - * Working with the "Tormenta ISA" Card - * - * Primary Author: Mark Spencer - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU Lesser General Public License Version 2.1 as published - * by the Free Software Foundation. See the LICENSE.LGPL file - * included with this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _TONEZONE_H -#define _TONEZONE_H - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -struct tone_zone_sound { - int toneid; - char data[256]; /* Actual zone description */ - /* Description is a series of tones of the format: - [!]freq1[+freq2][/time] separated by commas. There - are no spaces. The sequence is repeated back to the - first tone description not preceeded by !. time is - specified in milliseconds */ -}; - -struct tone_zone { - int zone; /* Zone number */ - char country[10]; /* Country code */ - char description[40]; /* Description */ - int ringcadence[ZT_MAX_CADENCE]; /* Ring cadence */ - struct tone_zone_sound tones[ZT_TONE_MAX]; - int dtmf_high_level; /* Power level of high frequency component - of DTMF, expressed in dBm0. */ - int dtmf_low_level; /* Power level of low frequency component - of DTMF, expressed in dBm0. */ - int mfr1_level; /* Power level of MFR1, expressed in dBm0. */ - int mfr2_level; /* Power level of MFR2, expressed in dBm0. */ -}; - -extern struct tone_zone builtin_zones[]; - -/* Register a given two-letter tone zone if we can */ -int tone_zone_register(int fd, char *country); - -/* Register a given two-letter tone zone if we can */ -int tone_zone_register_zone(int fd, struct tone_zone *z); - -/* Retrieve a raw tone zone structure */ -struct tone_zone *tone_zone_find(char *country); - -/* Retrieve a raw tone zone structure by id instead of country*/ -struct tone_zone *tone_zone_find_by_num(int id); - -/* Retrieve a string name for a given tone id */ -char *tone_zone_tone_name(int id); - -/* Set a given file descriptor into a given country -- USE THIS - INTERFACE INSTEAD OF THE IOCTL ITSELF. Auto-loads tone - zone if necessary */ -int tone_zone_set_zone(int fd, char *country); - -/* Get the current tone zone */ -int tone_zone_get_zone(int fd); - -/* Play a given tone, loading tone zone automatically - if necessary */ -int tone_zone_play_tone(int fd, int toneid); - -#endif diff --git a/zaptel/tor2.ee b/zaptel/tor2.ee deleted file mode 100644 index 97b1cda8509130e43045512d19c0823ddf98ac0b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 172 zcmcb>`+?UjF}Wnas8Yctu_TcJ3*f!5RbT=W149EFBZI+&tpW@T4j@&Gj2?_05anz> z3=GT+|M?kyfG|W1Mlynwa=>^%%?u3;K*NBz0n7#xSbzagtOAIcnHUm4(hVPtHUa>T COccNX diff --git a/zaptel/torisatool.c b/zaptel/torisatool.c deleted file mode 100644 index dd4d4267..00000000 --- a/zaptel/torisatool.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * BSD Telephony Of Mexico "Tormenta" card LINUX driver, version 1.8 4/8/01 - * - * Working with the "Tormenta ISA" Card - * - * Modified from original tor.c by Mark Spencer - * original by Jim Dixon - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "kernel/zaptel.h" - -static void usage(void) -{ - fprintf(stderr, "Usage: torisatool showerrors\n"); - exit(1); -} - -int main(int argc, char *argv[]) -{ - int fd; - struct torisa_debug td; - int res; - if (argc < 3) - usage(); - - fd = open(argv[1], O_RDWR); - if (fd < 0) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - if (!strcasecmp(argv[2], "showerrors")) { - res = ioctl(fd, TORISA_GETDEBUG, &td); - if (res) { - fprintf(stderr, "IOCTL failed: %s\n", strerror(errno)); - exit(1); - } - printf("Recorded misses: %u\n", td.txerrors); - printf("IRQ execs: %u\n", td.irqcount); - printf("Tasklet Schedules: %u\n", td.taskletsched); - printf("Tasklets Run: %u\n", td.taskletrun); - printf("Tasklets Executed: %u\n", td.taskletexec); - } else - usage(); - exit(0); -} diff --git a/zaptel/tormenta2.ucf b/zaptel/tormenta2.ucf deleted file mode 100644 index 2ec1fac9..00000000 --- a/zaptel/tormenta2.ucf +++ /dev/null @@ -1,194 +0,0 @@ -#### UCF file created by Project Navigator -NET "addr<10>" LOC = "P101"; -NET "addr<11>" LOC = "P102"; -NET "addr<2>" LOC = "P90"; -NET "addr<3>" LOC = "P94"; -NET "addr<4>" LOC = "P95"; -NET "addr<5>" LOC = "P96"; -NET "addr<6>" LOC = "P97"; -NET "addr<7>" LOC = "P98"; -NET "addr<8>" LOC = "P99"; -NET "addr<9>" LOC = "P100"; -NET "be<0>" LOC = "P109"; -NET "be<1>" LOC = "P110"; -NET "be<2>" LOC = "P111"; -NET "be<3>" LOC = "P112"; -NET "clk8192" LOC = "P77"; -NET "cs<1>" LOC = "P120"; -NET "cs<2>" LOC = "P121"; -NET "cs<3>" LOC = "P122"; -NET "cs<4>" LOC = "P123"; -NET "d<0>" LOC = "P153"; -NET "d<10>" LOC = "P59"; -NET "d<11>" LOC = "P60"; -NET "d<12>" LOC = "P61"; -NET "d<13>" LOC = "P62"; -NET "d<14>" LOC = "P63"; -NET "d<15>" LOC = "P67"; -NET "d<16>" LOC = "P68"; -NET "d<17>" LOC = "P69"; -NET "d<18>" LOC = "P70"; -NET "d<19>" LOC = "P71"; -NET "d<1>" LOC = "P146"; -NET "d<20>" LOC = "P73"; -NET "d<21>" LOC = "P74"; -NET "d<22>" LOC = "P75"; -NET "d<23>" LOC = "P150"; -NET "d<24>" LOC = "P81"; -NET "d<25>" LOC = "P82"; -NET "d<26>" LOC = "P83"; -NET "d<27>" LOC = "P84"; -NET "d<28>" LOC = "P86"; -NET "d<29>" LOC = "P87"; -NET "d<2>" LOC = "P142"; -NET "d<30>" LOC = "P88"; -NET "d<31>" LOC = "P89"; -NET "d<3>" LOC = "P135"; -NET "d<4>" LOC = "P126"; -NET "d<5>" LOC = "P119"; -NET "d<6>" LOC = "P115"; -NET "d<7>" LOC = "P108"; -NET "d<8>" LOC = "P57"; -NET "d<9>" LOC = "P58"; -NET "dint" LOC = "P148"; -NET "drd" LOC = "P127"; -NET "dwr" LOC = "P125"; -NET "int" LOC = "P114"; -NET "khz8000" LOC = "P149"; -NET "rclk<0>" LOC = "P136"; -NET "rclk<1>" LOC = "P138"; -NET "rclk<2>" LOC = "P139"; -NET "rclk<3>" LOC = "P140"; -NET "rclk<4>" LOC = "P141"; -NET "rclko" LOC = "P147"; -NET "rd" LOC = "P113"; -NET "ready" LOC = "P154"; -NET "rser" LOC = "P133"; -NET "rsync" LOC = "P129"; -NET "tssync" LOC = "P132"; -NET "tser" LOC = "P134"; -NET "wr" LOC = "P160"; -NET "addr<2>" IOSTANDARD = LVTTL; -NET "addr<3>" IOSTANDARD = LVTTL; -NET "addr<4>" IOSTANDARD = LVTTL; -NET "addr<5>" IOSTANDARD = LVTTL; -NET "addr<6>" IOSTANDARD = LVTTL; -NET "addr<7>" IOSTANDARD = LVTTL; -NET "addr<8>" IOSTANDARD = LVTTL; -NET "addr<9>" IOSTANDARD = LVTTL; -NET "addr<10>" IOSTANDARD = LVTTL; -NET "addr<11>" IOSTANDARD = LVTTL; -NET "be<0>" IOSTANDARD = LVTTL; -NET "be<1>" IOSTANDARD = LVTTL; -NET "be<2>" IOSTANDARD = LVTTL; -NET "be<3>" IOSTANDARD = LVTTL; -NET "clk8192" IOSTANDARD = LVTTL; -NET "cs<1>" IOSTANDARD = LVTTL; -NET "cs<2>" IOSTANDARD = LVTTL; -NET "cs<3>" IOSTANDARD = LVTTL; -NET "cs<4>" IOSTANDARD = LVTTL; -NET "d<0>" IOSTANDARD = LVTTL; -NET "d<1>" IOSTANDARD = LVTTL; -NET "d<2>" IOSTANDARD = LVTTL; -NET "d<3>" IOSTANDARD = LVTTL; -NET "d<4>" IOSTANDARD = LVTTL; -NET "d<5>" IOSTANDARD = LVTTL; -NET "d<6>" IOSTANDARD = LVTTL; -NET "d<7>" IOSTANDARD = LVTTL; -NET "d<8>" IOSTANDARD = LVTTL; -NET "d<9>" IOSTANDARD = LVTTL; -NET "d<10>" IOSTANDARD = LVTTL; -NET "d<11>" IOSTANDARD = LVTTL; -NET "d<12>" IOSTANDARD = LVTTL; -NET "d<13>" IOSTANDARD = LVTTL; -NET "d<14>" IOSTANDARD = LVTTL; -NET "d<15>" IOSTANDARD = LVTTL; -NET "d<16>" IOSTANDARD = LVTTL; -NET "d<17>" IOSTANDARD = LVTTL; -NET "d<18>" IOSTANDARD = LVTTL; -NET "d<19>" IOSTANDARD = LVTTL; -NET "d<20>" IOSTANDARD = LVTTL; -NET "d<21>" IOSTANDARD = LVTTL; -NET "d<22>" IOSTANDARD = LVTTL; -NET "d<23>" IOSTANDARD = LVTTL; -NET "d<24>" IOSTANDARD = LVTTL; -NET "d<25>" IOSTANDARD = LVTTL; -NET "d<26>" IOSTANDARD = LVTTL; -NET "d<27>" IOSTANDARD = LVTTL; -NET "d<28>" IOSTANDARD = LVTTL; -NET "d<29>" IOSTANDARD = LVTTL; -NET "d<30>" IOSTANDARD = LVTTL; -NET "d<31>" IOSTANDARD = LVTTL; -NET "dint" IOSTANDARD = LVTTL; -NET "drd" IOSTANDARD = LVTTL; -NET "dwr" IOSTANDARD = LVTTL; -NET "int" IOSTANDARD = LVTTL; -NET "khz8000" IOSTANDARD = LVTTL; -NET "rclk<0>" IOSTANDARD = LVTTL; -NET "rclk<1>" IOSTANDARD = LVTTL; -NET "rclk<2>" IOSTANDARD = LVTTL; -NET "rclk<3>" IOSTANDARD = LVTTL; -NET "rclk<4>" IOSTANDARD = LVTTL; -NET "rclko" IOSTANDARD = LVTTL; -NET "rd" IOSTANDARD = LVTTL; -NET "ready" IOSTANDARD = LVTTL; -NET "rser" IOSTANDARD = LVTTL; -NET "rsync" IOSTANDARD = LVTTL; -NET "tssync" IOSTANDARD = LVTTL; -NET "tser" IOSTANDARD = LVTTL; -NET "wr" IOSTANDARD = LVTTL; -NET "clk" LOC = "P80"; -NET "clk" IOSTANDARD = LVTTL; -NET "clk8192" IOSTANDARD = LVTTL; -NET "clk" IOSTANDARD = LVTTL; -NET "bterm" LOC = "P151"; -NET "master" LOC = "P175"; -NET "bterm" IOSTANDARD = LVTTL; -NET "clk" IOSTANDARD = LVTTL; -NET "clk8192" IOSTANDARD = LVTTL; -NET "leds<0>" IOSTANDARD = LVTTL; -NET "leds<1>" IOSTANDARD = LVTTL; -NET "leds<2>" IOSTANDARD = LVTTL; -NET "leds<3>" IOSTANDARD = LVTTL; -NET "leds<4>" IOSTANDARD = LVTTL; -NET "leds<5>" IOSTANDARD = LVTTL; -NET "leds<7>" IOSTANDARD = LVTTL; -NET "leds<6>" IOSTANDARD = LVTTL; -NET "master" IOSTANDARD = LVTTL; -NET "test1" IOSTANDARD = LVTTL; -NET "test2" IOSTANDARD = LVTTL; -NET "test3" IOSTANDARD = LVTTL; -NET "test4" IOSTANDARD = LVTTL; -NET "test1" LOC = "P203"; -NET "test2" LOC = "P204"; -NET "test3" LOC = "P205"; -NET "test4" LOC = "P206"; -NET "leds<0>" LOC = "P180"; -NET "leds<1>" LOC = "P179"; -NET "leds<2>" LOC = "P187"; -NET "leds<3>" LOC = "P181"; -NET "leds<4>" LOC = "P189"; -NET "leds<5>" LOC = "P188"; -NET "leds<6>" LOC = "P192"; -NET "leds<7>" LOC = "P191"; -NET "tssync" FAST; -NET "tser" FAST; -NET "rsync" FAST; -NET "boardid<0>" PULLUP; -NET "boardid<1>" PULLUP; -NET "boardid<2>" PULLUP; -NET "boardid<3>" PULLUP; -NET "boardid<0>" IOSTANDARD = LVTTL; -NET "boardid<1>" IOSTANDARD = LVTTL; -NET "boardid<2>" IOSTANDARD = LVTTL; -NET "boardid<3>" IOSTANDARD = LVTTL; -NET "boardid<0>" LOC = "P199"; -NET "boardid<1>" LOC = "P200"; -NET "boardid<2>" LOC = "P201"; -NET "boardid<3>" LOC = "P202"; -NET "xsyncin" IOSTANDARD = LVTTL; -NET "xsyncout" IOSTANDARD = LVTTL; -NET "xsyncin" LOC = "P176"; -NET "xsyncout" LOC = "P178"; -NET "clk" IOSTANDARD = LVTTL; -NET "clk8192" IOSTANDARD = LVTTL; diff --git a/zaptel/tormenta2.vhd b/zaptel/tormenta2.vhd deleted file mode 100644 index d82da294..00000000 --- a/zaptel/tormenta2.vhd +++ /dev/null @@ -1,657 +0,0 @@ --- Tormenta2 -- PCI Telephony Interface Card -- VHDL for Xilinx Part --- version 1.4, 10/10/2002. --- Copyright (c) 2001-2002, Jim Dixon. --- --- Jim Dixon --- Mark Spencer --- --- This program is free software, and the design, schematics, layout, --- and artwork for the hardware on which it runs is free, and all are --- distributed under the terms of the GNU General Public License. --- --- Thanks to Mark and the gang at Linux Support Services for the contribution --- of the initial buffering code. --- --- - --- The A4 die of the Dallas 21Q352 chip has a bug in it (well, it has several actually, --- but this is the one that effects us the most) where when you have it in IBO mode --- (where all 4 framers are combined into 1 8.192 Mhz backplane), the receive data --- comes out of the chip late. So late, in fact, that its an entire HALF clock cycle --- off. So what we had to do is have a separate RSYSCLK signal (which was the TSYSCLK --- signal inverted) and a separate RSYNC signal (which corresponds to the RSYSCLK inverted --- signal as opposed to the TSYSCLK) that was 1/2 clock cycle early, so that the data comes --- out at the correct time. - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use IEEE.STD_LOGIC_ARITH.ALL; -use IEEE.STD_LOGIC_UNSIGNED.ALL; - -entity tormenta2 is - Port ( --- GCK0 signal (Local bus clock) - CLK : in std_logic; --- GCK1 signal 8.192 Mhz clock from mk1574 and drives SYSCLK's on Dallas chip - CLK8192 : in std_logic; --- Tx Framing Pulse to Dallas chip - TSSYNC : out std_logic; --- Rx Framing Pulse to Dallas chip - RSYNC : out std_logic; --- 8 Khz square wave for input to mk1574 (RCLKO divided by 193) - KHZ8000 : out std_logic; --- RSER from Dallas chip (received serial data) - RSER : in std_logic; --- TSER to Dallas chip (transmitted serial data) - TSER : out std_logic; --- RCLK output to Dallas chip (TCLK) (1.544 Mhz) - RCLKO : out std_logic; --- RCLK 1-4 are RCLK inputs from SCT's, 0 is 1.544 Mhz oscillator - RCLK : in std_logic_vector(4 downto 0); --- LCLK is tied to GCK0, so you dont specify it here. --- CCLK, CPROGRAM, and CDONE are tied to dedicated pins, so you dont either. --- Local bus Data Bus - D : inout std_logic_vector(31 downto 0); --- Local bus Address Bus - ADDR : in std_logic_vector(11 downto 2); --- Local bus Byte Enable lines (also BE0 is A0 and BE1 is A1 for 8 bit operations) - BE : in std_logic_vector(3 downto 0); --- Local bus "WR" signal - WR : in std_logic; --- Local bus "RD" signal - RD : in std_logic; --- Local bus READY signal out (also Configuration BUSY signal) - READY : out std_logic; --- Local bus INTerrupt signal - INT : out std_logic; --- Chip selects for Dallas chip SCT's 1 thru 4 - CS : out std_logic_vector(4 downto 1); --- Dallas chip WRite signal - DWR : out std_logic; --- Dallas chip ReaD signal - DRD : out std_logic; --- Dallas chip INTerrupt signal in - DINT : in std_logic; --- LED's output - LEDS : out std_logic_vector(7 downto 0); --- Board ID input - BOARDID : in std_logic_vector(3 downto 0); --- TEST pins - TEST1 : inout std_logic; - TEST2 : inout std_logic; - TEST3 : inout std_logic; - TEST4 : inout std_logic; --- BTERM output - BTERM : out std_logic; --- MASTER output - MASTER : out std_logic; --- XSYNCIN input - XSYNCIN: in std_logic; --- XSYNCOUT output - XSYNCOUT: out std_logic); -end tormenta2; - -architecture behavioral of tormenta2 is - -component RAMB4_S1_S16 - port ( - ADDRA: IN std_logic_vector(11 downto 0); - ADDRB: IN std_logic_vector(7 downto 0); - DIA: IN std_logic_vector(0 downto 0); - DIB: IN std_logic_vector(15 downto 0); - WEA: IN std_logic; - WEB: IN std_logic; - CLKA: IN std_logic; - CLKB: IN std_logic; - RSTA: IN std_logic; - RSTB: IN std_logic; - ENA: IN std_logic; - ENB: IN std_logic; - DOA: OUT std_logic_vector(0 downto 0); - DOB: OUT std_logic_vector(15 downto 0)); -END component; - --- Counter for wait state/Dallas generator -signal waitcnt : std_logic_vector(2 downto 0); --- Global counter -signal counter: std_logic_vector(13 downto 0); --- Local copy of Global counter -signal lcounter: std_logic_vector(13 downto 0); --- Position in a given buffer -signal position: std_logic_vector(11 downto 0); --- Latched buffer position -signal lposition: std_logic_vector(11 downto 0); --- dbuf represents the buffer that is currently being --- operated upon by the T1 part, while not dbuf represents --- the buffer that the bus side is operating with -signal dbuf: std_logic; --- Lathed dbuf signal -signal ldbuf: std_logic; --- Which ram of the buffer we are currently operating with --- (0 = top, 1 = bottom) -signal ramno: std_logic; --- Latched ramno signal -signal lramno: std_logic; --- Serial output from first upper 16-bit memory -signal txqt1out: std_logic; --- Serial output from second upper 16-bit memory -signal txqt2out: std_logic; --- Serial output from first lower 16-bit memory -signal txqb1out: std_logic; --- Serial output from second lower 16-bit memory -signal txqb2out: std_logic; --- Parallel output from first 32-bits of memory -signal rxq1out: std_logic_vector(31 downto 0); --- Parallel output from second 32-bits of memory -signal rxq2out: std_logic_vector(31 downto 0); --- Ground bus for unnecessary inputs -signal gndbus: std_logic_vector(15 downto 0); --- RWR: Write enable for ram -signal RWR: std_logic; --- RRD: Read enable for ram -signal RRD: std_logic; --- Local version of 1.544 Mhz clock to be output -signal lclk: std_logic; --- 8khz counter -signal cnt193: std_logic_vector(7 downto 0); --- Which of the received clocks to propagate -signal clkreg: std_logic_vector(2 downto 0); --- First Control register -signal ctlreg: std_logic_vector(7 downto 0); --- Second Control register -signal ctlreg1: std_logic_vector(7 downto 0); --- Status register -signal statreg: std_logic_vector(2 downto 0); --- LED register -signal ledreg: std_logic_vector(7 downto 0); --- LED cycle counter -signal ledcnt: std_logic_vector(1 downto 0); --- Signal actually driving Rx buffers (after Rxserial loopback mux) -signal xrser: std_logic; --- Signal actually driven by Tx buffers (before Txserial loopback mux) -signal xtser: std_logic; -signal tssync_local: std_logic; -signal rsync_reva: std_logic; - --- Register definitions: - --- Write: --- 0xC00 -- clkreg (sync source) 0=free run, 1=span 1, 2=span 2, 3=span 3, 4=span 4, 5=external. --- 0xC01 -- ctlreg as follows: --- bit 0 - Interrupt Enable --- bit 1 - Drives "TEST1" signal ("Interrupt" outbit) --- bit 2 - Dallas Interrupt Enable (Allows DINT signal to drive INT) --- bit 3 - Enable External Synronization Drive (MASTER signal). --- bit 4 - Select E1 Divisor Mode (0 for T1, 1 for E1) --- bit 5 - Remote serial loopback (When set to 1, TSER is driven from RSER) --- bit 6 - Local serial loopback (When set to 1, Rx buffers are driven from Tx buffers) --- bit 7 - Interrupt Acknowledge (set to 1 to acknowledge interrupt) --- 0xC02 -- LED register as follows: --- bit 0 - Span 1 Green --- bit 1 - Span 1 Red --- bit 2 - Span 2 Green --- bit 3 - Span 2 Red --- bit 4 - Span 3 Green --- bit 5 - Span 3 Red --- bit 6 - Span 4 Green --- bit 7 - Span 4 Red --- NOTE: turning on both red and green yields yellow. --- 0xC03 -- TEST2, writing to bit 0 drives TEST2 pin. --- 0xC04 -- ctlreg1 as follows: --- bit 0 - Non-REV.A Timing mode (set for REV. B Dallas chip and higher) --- --- Read: --- 0xC00 -- statreg as follows: --- bit 0 - Interrupt Enabled --- bit 1 - Interrupt Active --- bit 2 - Dallas Chip Interrupt Active --- 0xC01 -- boardid as follows: --- bits 0-3 Board ID bits 0-3 (from rotary dip switch) - -begin - - -- Create statreg for user to be able to read - statreg(0) <= ctlreg(0); -- Interrupt enable status - statreg(2) <= not DINT; -- Dallas chip interrupt request - -- Tie INT signal to bit in statreg - INT <= statreg(1) or ((not DINT) and ctlreg(2)); - - MASTER <= ctlreg(3); -- Control Bit to enable External Sync Driver - - TEST1 <= ctlreg(1); -- Reflect "Interrupt" Outbit - TEST3 <= statreg(1); -- Reflect Interrupt Status - TEST4 <= RSER; - - BTERM <= '1'; -- Leave this not enabled for now. - - -- Which ram we read into is from the 5th LSB of the counter - ramno <= lcounter(4); - -- Which buffer we're using is the most significant - dbuf <= lcounter(13); - -- Our position is the bottom 4 bits, inverted, and then - -- the skip one, and then the next 8 bits. - position(3 downto 0) <= not lcounter(3 downto 0); - position(11 downto 4) <= lcounter(12 downto 5); - - gndbus <= "0000000000000000"; - - txqt1: RAMB4_S1_S16 port map ( - ADDRA => position, -- Where are we in transmission - ADDRB => ADDR(9 downto 2), -- Address into our 16-bit words - DIA(0) => '0', -- We never write from the serial side - DIB => D(31 downto 16), -- Top 16-bits of data bus - WEA => '0', -- Never write from serial side - WEB => not WR, -- Write when requested - CLKA => CLK8192, -- Clock output at 8.192 Mhz - CLKB => RWR, -- Clock input when asked to by PCI bus - ENA => '1', -- Always enable output - ENB => dbuf, -- Enable when dbuf is set. - DOA(0) => txqt1out, -- Serial output to be MUXed - RSTA => '0', -- No need for silly reset - RSTB => '0' - ); - - txqt2: RAMB4_S1_S16 port map ( - ADDRA => position, -- Where are we in transmission - ADDRB => ADDR(9 downto 2), -- Address into our 16-bit words - DIA(0) => '0', -- We never write from the serial side - DIB => D(31 downto 16), -- Top 16-bits of data bus - WEA => '0', -- Never write from serial side - WEB => not WR, -- Write when requested - CLKA => CLK8192, -- Clock output at 8.192 Mhz - CLKB => RWR, -- Clock input when asked to by PCI bus - ENA => '1', -- Always enable output - ENB => not dbuf, -- Take input from user when not in use. - DOA(0) => txqt2out, -- Serial output to be MUXed - RSTA => '0', -- No need for silly reset - RSTB => '0' - ); - - txqb1: RAMB4_S1_S16 port map ( - ADDRA => position, -- Where are we in transmission - ADDRB => ADDR(9 downto 2), -- Address into our 16-bit words - DIA(0) => '0', -- We never write from the serial side - DIB => D(15 downto 0), -- Top 16-bits of data bus - WEA => '0', -- Never write from serial side - WEB => not WR, -- Write when requested - CLKA => CLK8192, -- Clock output at 8.192 Mhz - CLKB => RWR, -- Clock input when asked to by PCI bus - ENA => '1', -- Always enable output - ENB => dbuf, -- Enable input when not in use - DOA(0) => txqb1out, -- Serial output to be MUXed - RSTA => '0', -- No need for silly reset - RSTB => '0' - ); - - txqb2: RAMB4_S1_S16 port map ( - ADDRA => position, -- Where are we in transmission - ADDRB => ADDR(9 downto 2), -- Address into our 16-bit words - DIA(0) => '0', -- We never write from the serial side - DIB => D(15 downto 0), -- Top 16-bits of data bus - WEA => '0', -- Never write from serial side - WEB => not WR, -- Write when requested - CLKA => CLK8192, -- Clock output at 8.192 Mhz - CLKB => RWR, -- Clock input when asked to by PCI bus - ENA => '1', -- Always enable output - ENB => not dbuf, -- Enable when dbuf is set. - DOA(0) => txqb2out, -- Serial output to be MUXed - RSTA => '0', -- No need for silly reset - RSTB => '0' - ); - - rxqt1: RAMB4_S1_S16 port map ( - ADDRA => lposition, -- Where to put the next sample - ADDRB => ADDR(9 downto 2), -- Addressable output - DIA(0) => XRSER, -- Input from serial from T1 - DIB => gndbus, -- Never input from bus - WEA => not lramno, -- Enable writing when we're in the top - WEB => '0', - CLKA => not CLK8192, -- Clock input from T1 - CLKB => RRD, -- Clock output from bus - ENA => not ldbuf, -- Enable when we're the selected buffer - ENB => '1', -- Always enable output (it gets MUXed) - DOB => rxq1out(31 downto 16), -- Data output to MUX - RSTA => '0', - RSTB => '0' - ); - - rxqt2: RAMB4_S1_S16 port map ( - ADDRA => lposition, -- Where to put the next sample - ADDRB => ADDR(9 downto 2), -- Addressable output - DIA(0) => XRSER, -- Input from serial from T1 - DIB => gndbus, -- Never input from bus - WEA => not lramno, -- Enable writing when we're in the top - WEB => '0', - CLKA => not CLK8192, -- Clock input from T1 - CLKB => RRD, -- Clock output from bus - ENA => ldbuf, -- Enable when we're the selected buffer - ENB => '1', -- Always enable output (it gets MUXed) - DOB => rxq2out(31 downto 16), -- Data output to MUX - RSTA => '0', - RSTB => '0' - ); - - rxqb1: RAMB4_S1_S16 port map ( - ADDRA => lposition, -- Where to put the next sample - ADDRB => ADDR(9 downto 2), -- Addressable output - DIA(0) => XRSER, -- Input from serial from T1 - DIB => gndbus, -- Never input from bus - WEA => lramno, -- Enable writing when we're in the top - WEB => '0', - CLKA => not CLK8192, -- Clock input from T1 - CLKB => RRD, -- Clock output from bus - ENA => not ldbuf, -- Enable when we're the selected buffer - ENB => '1', -- Always enable output (it gets MUXed) - DOB => rxq1out(15 downto 0), -- Data output to MUX - RSTA => '0', - RSTB => '0' - ); - - rxqb2: RAMB4_S1_S16 port map ( - ADDRA => lposition, -- Where to put the next sample - ADDRB => ADDR(9 downto 2), -- Addressable output - DIA(0) => XRSER, -- Input from serial from T1 - DIB => gndbus, -- Never input from bus - WEA => lramno, -- Enable writing when we're in the top - WEB => '0', - CLKA => not CLK8192, -- Clock input from T1 - CLKB => RRD, -- Clock output from bus - ENA => ldbuf, -- Enable when we're the selected buffer - ENB => '1', -- Always enable output (it gets MUXed) - DOB => rxq2out(15 downto 0), -- Data output to MUX - RSTA => '0', - RSTB => '0' - ); - - -clkdiv193: process(lclk,ctlreg(4)) -- Divider from 1.544 Mhz (or 2.048 MHZ for E1) to 8 Khz to drive MK1574 via KHZ8000 pin -begin - if (lclk'event and lclk = '1') then - cnt193 <= cnt193 + 1; - if (ctlreg(4) = '0') then -- For T1 operation - -- Go high after 96 samples and - -- low after 193 samples - if (cnt193 = "01100000") then - KHZ8000 <= '1'; - elsif (cnt193 = "11000000") then -- *YES* C0 hex *IS* the correct value. I even checked it on a freq. counter! - KHZ8000 <= '0'; - cnt193 <= "00000000"; - end if; - else -- For E1 operation, it naturally divides by 256 (being an 8 bit counter) - KHZ8000 <= cnt193(7); - end if; - end if; -end process clkdiv193; - - --- Serial transmit data (TSER) output mux (from RAM outputs) -txmux: process (txqt1out, txqt2out, txqb1out, txqb2out,dbuf,ramno,rser) -begin - if (dbuf = '0') then - if (ramno = '0') then - XTSER <= txqt1out; - else - XTSER <= txqb1out; - end if; - else - if (ramno = '0') then - XTSER <= txqt2out; - else - XTSER <= txqb2out; - end if; - end if; - if (ctlreg(5)='1') then -- If in remote serial loopback - TSER <= RSER; - else - TSER <= XTSER; - end if; -end process txmux; - --- Stuff to do on rising edge of TSYSCLK -process(CLK8192,lcounter(12 downto 0),ctlreg(7)) -begin - -- Make sure we're on the rising edge - if (CLK8192'event and CLK8192 = '1') then - counter <= counter + 1; - -- We latch copies of ramno, dbuf, and position on this clock so that they - -- will be stable when the RX buffer stuff needs them on the other edge of the clock - lramno <= ramno; - ldbuf <= dbuf; - lposition <= position; - if (lcounter(9 downto 0)="0000000000") then -- Generate TSSYNC signal - TSSYNC_LOCAL <= '1'; - else - TSSYNC_LOCAL <= '0'; - end if; - -- If we are on an 8 sample boundary, and interrupts are enabled, - if (((lcounter(12 downto 0)="0000000000000") and (ctlreg(0)='1'))) then - statreg(1) <= '1'; - elsif (ctlreg(7)='1' or ctlreg(0)='0') then - statreg(1) <= '0'; -- If interrupt ack-ed - end if; - -- If we are on an 16 sample boundary, twiddle LED's - if (lcounter="00000000000000") then - -- We make this 3 count sequence, because we need 2/3 green and 1/3 red to make - -- yellow. Half and half makes sorta orange (yuch!). Bit 1 of the ledcnt will - -- be 0 for 2 counts, then 1 for 1 count. Perfict for making yellow! - if (ledcnt="10") then - ledcnt <= "00"; -- 3 count sequence - else - ledcnt <= ledcnt + 1; - end if; - -- Logic for LED 1 - if (ledreg(1 downto 0)="11") then -- If yellow, use count seq. - LEDS(0) <= ledcnt(1); - LEDS(1) <= not ledcnt(1); - else -- Otherwise is static - LEDS(1 downto 0) <= not ledreg(1 downto 0); - end if; - -- Logic for LED 2 - if (ledreg(3 downto 2)="11") then -- If yellow, use count seq. - LEDS(2) <= ledcnt(1); - LEDS(3) <= not ledcnt(1); - else -- Otherwise is static - LEDS(3 downto 2) <= not ledreg(3 downto 2); - end if; - -- Logic for LED 3 - if (ledreg(5 downto 4)="11") then -- If yellow, use count seq. - LEDS(4) <= ledcnt(1); - LEDS(5) <= not ledcnt(1); - else -- Otherwise is static - LEDS(5 downto 4) <= not ledreg(5 downto 4); - end if; - -- Logic for LED 4 - if (ledreg(7 downto 6)="11") then -- If yellow, use count seq. - LEDS(6) <= ledcnt(1); - LEDS(7) <= not ledcnt(1); - else -- Otherwise is static - LEDS(7 downto 6) <= not ledreg(7 downto 6); - end if; - end if; - end if; -end process; - --- Stuff to do on Falling edge of TSYSCLK -process(CLK8192,counter(9 downto 0)) -begin -if (CLK8192'event and CLK8192='0') then - lcounter <= counter; -- save local copy of counter - if (counter(9 downto 0)="0000000000") then - RSYNC_REVA <= '1'; -- Generate RSYNC pulse - else - RSYNC_REVA <= '0'; - end if; -end if; -end process; - --- Handle Data input requests -rxdata: process (ADDR(11 downto 10), rxq1out, rxq2out, RD, dbuf, statreg) -begin - -- If in 32 bit space, Send data from the block we're not using - if (RD = '0' and ADDR(11) = '0') then - RRD <= '1'; -- Assert clock to output RAM - -- Mux DATA bus to proper RAMs - if (dbuf = '1') then - D <= rxq1out; - else - D <= rxq2out; - end if; - -- If in 8 bit space, return statreg - elsif ((RD='0') and (ADDR(11 downto 10)="11")) then - if (BE(1 downto 0) = "00") then -- if C00, return status - D(2 downto 0) <= statreg; - D(31 downto 3) <= "ZZZZZZZZZZZZZZZZZZZZZZZZ00000"; - else -- if C01, return board id - D(3 downto 0) <= NOT BOARDID; - D(31 downto 4) <= "ZZZZZZZZZZZZZZZZZZZZZZZZ0000"; - end if; - RRD <= '0'; - else -- If in outer space, Data bus should be tri-state - D <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"; - RRD <= '0'; - end if; -end process rxdata; - --- rx serial loopback mux -rxmux: process(rser,xtser) -begin - if (ctlreg(6)='1') then - XRSER <= XTSER; - else - XRSER <= RSER; - end if; -end process rxmux; - --- Handle Writing of RAMs when in 32 bit space -txdecode: process (WR, CLK, BE, dbuf, D, ADDR) -begin - -- Make sure when we write to memory that we only - -- enable the clock on the actual RAM units if the - -- top bit of address is '0', and is a full 32 bit access. - if ((addr(11) = '0') and (BE="0000") and (WR='0') and (CLK='1')) then - RWR <= '1'; - else - RWR <= '0'; - end if; -end process txdecode; - --- Select the proper output 1.544 Mhz clock -clkmux: process(clkreg, RCLK) -begin - if (clkreg = "001") then - lclk <= RCLK(1); - elsif (clkreg = "010") then - lclk <= RCLK(2); - elsif (clkreg = "011") then - lclk <= RCLK(3); - elsif (clkreg = "100") then - lclk <= RCLK(4); - elsif (clkreg = "101") then - lclk <= XSYNCIN; - else - lclk <= RCLK(0); - end if; - RCLKO <= lclk; - XSYNCOUT <= lclk; -end process clkmux; - --- Stuff to do on positive edge of Local bus clock -process(CLK,ADDR(11 downto 10),RD,WR) -begin -if (CLK'event and CLK='1') then -- On positive transition of clock - if ((WR='0' or RD='0') and ADDR(11 downto 10)="10") then -- If in our address range - waitcnt <= waitcnt + 1; -- Bump state counter if in Dallas' address range - else - waitcnt <= "000"; -- Otherwise, leave reset - end if; - if (WR='0' and ADDR(11 downto 10)="11") then -- If to write to our configuration space - if (ADDR(7 downto 2)="000000") then - if (BE(1 downto 0)="11") then - TEST2 <= D(0); -- Write to TEST2 pin (0xC03) - elsif (BE(1 downto 0)="10") then - ledreg <= D(7 downto 0); -- Write to the LED register (0xC02) - elsif (BE(1 downto 0)="01") then - ctlreg <= D(7 downto 0); -- Write to the ctlreg register (0xC01) - else - clkreg <= D(2 downto 0); -- Write to the clkreg register (0xC00) - end if; - end if; - if (ADDR(7 downto 2)="000001") then - if (BE(1 downto 0)="00") then - ctlreg1 <= D(7 downto 0); -- Write to the ctlreg1 register (0xC04) - end if; - end if; - end if; - if ((statreg(1)='0') and (ctlreg(7)='1')) then -- if interrupt acked and de-asserted, ack the ack - ctlreg(7) <= '0'; - end if; - if (ctlreg(0)='0') then -- if interrupts disabled, make sure ack is de-acked - ctlreg(7) <= '0'; - end if; -end if; -end process; - --- Generate Dallas Read and Write Signals and Wait states -process(CLK,ADDR(11 downto 8),RD,WR,waitcnt) -begin -if ((WR='0' or RD='0') and ADDR(11 downto 10)="10") then -- If during valid read or write - -- Stuff for CS for Dallas Chips - if (ADDR(9 downto 8)="00") then - CS(4 downto 1) <= "1110"; -- Activate CS1 - end if; - if (ADDR(9 downto 8)="01") then - CS(4 downto 1) <= "1101"; -- Activate CS2 - end if; - if (ADDR(9 downto 8)="10") then - CS(4 downto 1) <= "1011"; -- Activate CS3 - end if; - if (ADDR(9 downto 8)="11") then - CS(4 downto 1) <= "0111"; -- Activate CS4 - end if; - if (waitcnt <= "100") then -- An intermediate cycle (before ready) - if (WR='0') then -- If a write cycle, output it - DWR <= '0'; - else - DWR <= '1'; - end if; - if (RD='0') then -- If a read cycle, output it - DRD <= '0'; - else - DRD <= '1'; - end if; - end if; - if ((waitcnt = "011") and (CLK='0')) then -- If were at 4, were ready, and this will be real one - READY <= '0'; - end if; - if (waitcnt > "100") then -- Count is greater then 4, time to reset everything - READY <= '1'; - DWR <= '1'; - DRD <= '1'; - end if; -else -- Not in read or write in the appropriate range, reset the stuff - READY <= '1'; - DWR <= '1'; - DRD <= '1'; - CS(4 downto 1) <= "1111"; -- No CS outputs -end if; -if (waitcnt="100" and CLK='1' and WR='0') then -- De-activate the DWR signal at the final half cycle - DWR <= '1'; - DWR <= '1'; -end if; -if ((WR='0' or RD='0') and ADDR(11 downto 10)/="10") then -- If during not valid read or write - READY <= '0'; -- Dont hang the bus for them -end if; -end process; - --- MUX for Frame sync lines depending upon part revision -process(tssync_local,rsync_reva,ctlreg1(0 downto 0)) -begin - if (ctlreg1(0 downto 0) = "0") then -- Do output for Rev. A part - TSSYNC <= TSSYNC_LOCAL; - RSYNC <= RSYNC_REVA; - else - TSSYNC <= TSSYNC_LOCAL; - RSYNC <= TSSYNC_LOCAL; - end if; -end process; -end behavioral; diff --git a/zaptel/usbfxstest.c b/zaptel/usbfxstest.c deleted file mode 100644 index d1544e41..00000000 --- a/zaptel/usbfxstest.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "zap.h" -#include - -int main(int argc, char *argv[]) -{ - ZAP *z; - ZT_PARAMS p; - char tmp[1024]; - int len; - int res; - int firstpass=1; - int linear=0; - if (argc < 2) { - fprintf(stderr, "Usage: usbfxstest [options]\n"); - exit(1); - } - if (argc > 2) { - if (!strcasecmp(argv[2], "linear")) { - linear=1; - } - } - z = zap_open(argv[1], 0); - if (!z) { - fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); - exit(1); - } - /* Ring phone until it goes off hook. This shows how you mix direct - and indirect calls */ - for (;;) { - p.channo = 0; - res = ioctl(zap_fd(z), ZT_GET_PARAMS, &p); - if (res) { - fprintf(stderr, "Failed to get parameters: %s\n", strerror(errno)); - exit(1); - } - if (p.rxisoffhook) - break; - if (firstpass) - res = zap_ringclid(z, "2565551212", "Nifty Cool"); - else - res = zap_ring(z, 1); - } - if (linear) { - printf("Going linear!\n"); - zap_setlinear(z, linear); - } - printf("Off Hook!\n"); - len = 204; - for (;;) { - /* Record, play, and check for events */ - res = zap_recchunk(z, tmp, len, ZAP_DTMFINT); - if (res == len) { - res = zap_playchunk(z, tmp, len, 0); - } - if (res < len) { - res = zap_getevent(z); - if (zap_dtmfwaiting(z)) { - zap_getdtmf(z, 1, NULL, 0, 1, 1, 0); - printf("Got DTMF: %s\n", zap_dtmfbuf(z)); - zap_clrdtmfn(z); - } else if (res) { - switch(res) { - case ZAP_EVENT_ONHOOK: - printf("On Hook!\n"); - break; - case ZAP_EVENT_RINGANSWER: - printf("Off hook!\n"); - break; - case ZAP_EVENT_WINKFLASH: - printf("Flash!\n"); - break; - default: - printf("Unknown event %d\n", res); - } - } - } - } - return 0; -} diff --git a/zaptel/zaptel.conf.sample b/zaptel/zaptel.conf.sample deleted file mode 100644 index e4a62b9c..00000000 --- a/zaptel/zaptel.conf.sample +++ /dev/null @@ -1,291 +0,0 @@ -# -# Zaptel Configuration File -# -# This file is parsed by the Zaptel Configurator, ztcfg -# -# Span Configuration -# ~~~~~~~~~~~~~~~~~~ -# First come the span definitions, in the format -# -# span=,,,,[,yellow] -# -# All T1/E1 spans generate a clock signal on their transmit side. The -# parameter determines whether the clock signal from the far -# end of the T1/E1 is used as the master source of clock timing. If it is, our -# own clock will synchronise to it. T1/E1's connected directly or indirectly to -# a PSTN provider (telco) should generally be the first choice to sync to. The -# PSTN will never be a slave to you. You must be a slave to it. -# -# Choose 1 to make the equipment at the far end of the E1/T1 link the preferred -# source of the master clock. Choose 2 to make it the second choice for the master -# clock, if the first choice port fails (the far end dies, a cable breaks, or -# whatever). Choose 3 to make a port the third choice, and so on. If you have, say, -# 2 ports connected to the PSTN, mark those as 1 and 2. The number used for each -# port should be different. -# -# If you choose 0, the port will never be used as a source of timing. This is -# appropriate when you know the far end should always be a slave to you. If the -# port is connected to a channel bank, for example, you should always be its -# master. Any number of ports can be marked as 0. -# -# Incorrect timing sync may cause clicks/noise in the audio, poor quality or failed -# faxes, unreliable modem operation, and is a general all round bad thing. -# -# The line build-out (or LBO) is an integer, from the following table: -# -# 0: 0 db (CSU) / 0-133 feet (DSX-1) -# 1: 133-266 feet (DSX-1) -# 2: 266-399 feet (DSX-1) -# 3: 399-533 feet (DSX-1) -# 4: 533-655 feet (DSX-1) -# 5: -7.5db (CSU) -# 6: -15db (CSU) -# 7: -22.5db (CSU) -# -# framing:: -# one of 'd4' or 'esf' for T1 or 'cas' or 'ccs' for E1 and BRI. -# 'd4' could be referred to as 'sf' or 'superframe' -# -# coding:: -# one of 'ami' or 'b8zs' for T1 or 'ami' or 'hdb3' for E1 and BRI. -# * For E1 there is the optional keyword 'crc4' to enable CRC4 checking. -# * If the keyword 'yellow' follows, yellow alarm is transmitted when no -# channels are open. -# -#span=1,0,0,esf,b8zs -#span=2,1,0,esf,b8zs -#span=3,0,0,ccs,hdb3,crc4 -# -# Dynamic Spans -# ~~~~~~~~~~~~~ -# Next come the dynamic span definitions, in the form: -# -# dynamic=,
,, -# -# Where is the name of the driver (e.g. eth),
is the -# driver specific address (like a MAC for eth), is the number -# of channels, and is a timing priority, like for a normal span. -# use "0" to not use this as a timing source, or prioritize them as -# primary, secondard, etc. Note that you MUST have a REAL zaptel device -# if you are not using external timing. -# -# dynamic=eth,eth0/00:02:b3:35:43:9c,24,0 -# -# If a non-zero timing value is used, as above, only the last span should -# have the non-zero value. -# -# Channel Configuration -# ~~~~~~~~~~~~~~~~~~~~~ -# Next come the definitions for using the channels. The format is: -# = -# -# Valid devices are: -# -# e&m:: -# Channel(s) are signalled using E&M signalling (specific -# implementation, such as Immediate, Wink, or Feature Group D -# are handled by the userspace library). -# fxsls:: -# Channel(s) are signalled using FXS Loopstart protocol. -# fxsgs:: -# Channel(s) are signalled using FXS Groundstart protocol. -# fxsks:: -# Channel(s) are signalled using FXS Koolstart protocol. -# fxols:: -# Channel(s) are signalled using FXO Loopstart protocol. -# fxogs:: -# Channel(s) are signalled using FXO Groundstart protocol. -# fxoks:: -# Channel(s) are signalled using FXO Koolstart protocol. -# sf:: -# Channel(s) are signalled using in-band single freq tone. -# Syntax as follows: -# -# channel# => sf:,,,,, -# -# rxfreq is rx tone freq in Hz, rxbw is rx notch (and decode) -# bandwith in hz (typically 10.0), rxflag is either 'normal' or -# 'inverted', txfreq is tx tone freq in hz, txlevel is tx tone -# level in dbm, txflag is either 'normal' or 'inverted'. Set -# rxfreq or txfreq to 0.0 if that tone is not desired. -# -# unused:: -# No signalling is performed, each channel in the list remains idle -# clear:: -# Channel(s) are bundled into a single span. No conversion or -# signalling is performed, and raw data is available on the master. -# bchan:: -# Like 'clear' except all channels are treated individually and -# are not bundled. 'inclear' is an alias for this. -# rawhdlc:: -# The zaptel driver performs HDLC encoding and decoding on the -# bundle, and the resulting data is communicated via the master -# device. -# dchan:: -# The zaptel driver performs HDLC encoding and decoding on the -# bundle and also performs incoming and outgoing FCS insertion -# and verification. 'fcshdlc' is an alias for this. -# hardhdlc:: -# The hardware driver performs HDLC encoding and decoding on the -# bundle and also performs incoming and outgoing FCS insertion -# and verification. Is subject to limitations and support of underlying -# hardware. -# nethdlc:: -# The zaptel driver bundles the channels together into an -# hdlc network device, which in turn can be configured with -# sethdlc (available separately). In 2.6.x kernels you can also optionally -# pass the name for the network interface after the channel list. -# Syntax: -# -# nethdlc=[:interface name] -# Use original names, don't use the names which have been already registered -# in system e.g eth. -# -# dacs:: -# The zaptel driver cross connects the channels starting at -# the channel number listed at the end, after a colon -# dacsrbs:: -# The zaptel driver cross connects the channels starting at -# the channel number listed at the end, after a colon and -# also performs the DACSing of RBS bits -# -# The channel list is a comma-separated list of channels or ranges, for -# example: -# -# 1,3,5 (channels one, three, and five) -# 16-23, 29 (channels 16 through 23, as well as channel 29) -# -# So, some complete examples are: -# -# e&m=1-12 -# nethdlc=13-24 -# fxsls=25,26,27,28 -# fxols=29-32 -# -#fxoks=1-24 -#bchan=25-47 -#dchan=48 -#fxols=1-12 -#fxols=13-24 -#e&m=25-29 -#nethdlc=30-33 -#clear=44 -#clear=45 -#clear=46 -#clear=47 -#fcshdlc=48 -#dacs=1-24:48 -#dacsrbs=1-24:48 -# -# Tone Zone Data -# ~~~~~~~~~~~~~~ -# Finally, you can preload some tone zones, to prevent them from getting -# overwritten by other users (if you allow non-root users to open /dev/zap/* -# interfaces anyway. Also this means they won't have to be loaded at runtime. -# The format is "loadzone=" where the zone is a two letter country code. -# -# You may also specify a default zone with "defaultzone=" where zone -# is a two letter country code. -# -# An up-to-date list of the zones can be found in the file zaptel/zonedata.c -# -loadzone = us -#loadzone = us-old -#loadzone=gr -#loadzone=it -#loadzone=fr -#loadzone=de -#loadzone=uk -#loadzone=fi -#loadzone=jp -#loadzone=sp -#loadzone=no -#loadzone=hu -#loadzone=lt -#loadzone=pl -defaultzone=us -# -# PCI Radio Interface -# ~~~~~~~~~~~~~~~~~~~ -# (see http://www.zapatatelephony.org/app_rpt.html) -# -# The PCI Radio Interface card interfaces up to 4 two-way radios (either -# a base/mobile radio or repeater system) to Zaptel channels. The driver -# may work either independent of an application, or with it, through -# the driver;s ioctl() interface. This file gives you access to specify -# load-time parameters for Radio channels, so that the driver may run -# by itself, and just act like a generic Zaptel radio interface. -# -# Unlike the rest of this file, you specify a block of parameters, and -# then the channel(s) to which they apply. CTCSS is specified as a frequency -# in tenths of hertz, for example 131.8 HZ is specified as 1318. DCS -# for receive is specified as the code directly, for example 223. DCS for -# transmit is specified as D and then the code, for example D223. -# -# The hardware supports a "community" CTCSS decoder system that has -# arbitrary transmit CTCSS or DCS codes associated with them, unlike -# traditional "community" systems that encode the same tone they decode. -# -# this example is a single tone DCS transmit and receive -# -# specify the transmit tone (in DCS mode this stays constant): -#tx=D371 -# -# specify the receive DCS code: -#dcsrx=223 -# -# this example is a "community" CTCSS (if you only want a single tone, then -# only specify 1 in the ctcss list) -# -# specify the default transmit tone (when not receiving): -#tx=1000 -# -# Specify the receive freq, the tag (use 0 if none), and the transmit code. -# The tag may be used by applications to determine classification of tones. -# The tones are to be specified in order of presedence, most important first. -# Currently, 15 tones may be specified.. -# -#ctcss=1318,1,1318 -#ctcss=1862,1,1862 -# -# The following parameters may be omitted if their default value is acceptible -# -# Set the receive debounce time in milliseconds: -#debouncetime=123 -# -# set the transmit quiet dropoff burst time in milliseconds: -#bursttime=234 -# -# set the COR level threshold (specified in tenths of millivolts) -# valid values are {3125,6250,9375,12500,15625,18750,21875,25000} -#corthresh=12500 -# -# Invert COR signal {y,n} -#invertcor=y -# Set the external tone mode; yes, no, inverted external {y,n,i} -# exttone=y # High true External CTCSS on UIOB -# exttone=i # Low true External CTCSS on UIOB -# exttone=n # Use internal MX828 decoder on Quad Radio PCI card -# # (not recommended) -# -# Now apply the configuration to the specified channels: -# -# We are all done with our channel parameters, so now we specify what -# channels they apply to -#channels=1-4 -# -# Overiding PCM encoding -# ~~~~~~~~~~~~~~~~~~~~~~ -# Usually the channel driver sets the encoding of the PCM for the -# channel (mulaw / alaw. That is: g711u or g711a). However there are -# some cases where you would like to override that. 'mulaw' and 'alaw' -# set different such encoding. Use them for channels you have already -# defined with e.g. 'bchan' or 'fxoks'. -#mulaw=1-4 -#alaw=1-4 -# -# 'deflaw' is similar, but resets the encoding to the channel driver's -# default. It must be useful for something, I guess. -#mulaw=1-10 -#deflaw=5 -# diff --git a/zaptel/zaptel.init b/zaptel/zaptel.init deleted file mode 100644 index 1677c38e..00000000 --- a/zaptel/zaptel.init +++ /dev/null @@ -1,260 +0,0 @@ -#!/bin/sh -# -# zaptel This shell script takes care of loading and unloading \ -# Zapata Telephony interfaces -# chkconfig: 2345 9 92 -# description: The zapata telephony drivers allow you to use your linux \ -# computer to accept incoming data and voice interfaces -# -# config: /etc/sysconfig/zaptel - -initdir=/etc/init.d - -# Don't edit the following values. Edit /etc/sysconfig/zaptel or -# /etc/defualt/zaptel (depending on your system) instead. - -ZTCFG=/sbin/ztcfg -ZTCFG_CMD="$ZTCFG" # e.g: for a custom zaptel.conf location - -FXOTUNE=/sbin/fxotune - -# The default syncer Astribank. Usually set automatically to a sane -# value by xpp_sync(1) if you have an Astribank. You can set this to an -# explicit Astribank (e.g: 01). -XPP_SYNC=auto - -# The maximal timeout (seconds) to wait for udevd to finish generating -# device nodes after the modules have loaded and before running ztcfg. -ZAP_DEV_TIMEOUT=20 - -# -# Determine which kind of configuration we're using -# -system=redhat # assume redhat -if [ -f /etc/debian_version ]; then - system=debian -fi - -# Source function library. -if [ $system = redhat ]; then - . $initdir/functions || exit 0 -fi - -# Source zaptel configuration. -if [ $system = debian ]; then - [ -f /etc/default/zaptel ] && . /etc/default/zaptel - LOCKFILE=/var/lock/zaptel -elif [ $system = redhat ]; then - [ -f /etc/sysconfig/zaptel ] && . /etc/sysconfig/zaptel - LOCKFILE=/var/lock/subsys/zaptel -fi - -# recursively unload a module and its dependencies, if possible. -# where's modprobe -r when you need it? -# inputs: module to unload. -# returns: the result from -unload_module() { - module="$1" - line=`lsmod 2>/dev/null | grep "^$1 "` - if [ "$line" = '' ]; then return; fi # module was not loaded - - set -- $line - # $1: the original module, $2: size, $3: refcount, $4: deps list - mods=`echo $4 | tr , ' '` - # xpp_usb keeps the xpds below busy if an xpp hardware is - # connected. Hence must be removed before them: - case "$module" in xpd_*) mods="xpp_usb $mods";; esac - for mod in $mods; do - # run in a subshell, so it won't step over our vars: - (unload_module $mod) - # TODO: the following is probably the error handling we want: - # if [ $? != 0 ]; then return 1; fi - done - rmmod $module -} - -# Initialize the Xorcom Astribank (xpp/) using perl utiliites: -# intended to replace all the the three functions below if user has -# installed the zaptel-perl utilities. -xpp_startup() { - # do nothing if there are no astribank devices: - if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi - - echo "Waiting for Astribank devices to initialize:" - cat /proc/xpp/XBUS-[0-9]*/waitfor_xpds 2>/dev/null || true - - # overriding locales for the above two, as perl can be noisy - # when locales are missing. - # No register all the devices if they didn't auto-register: - LC_ALL=C zt_registration on - - # this one could actually be run after ztcfg: - LC_ALL=C xpp_sync "$XPP_SYNC" -} - - -hpec_start() { - # HPEC license found - if ! echo /var/lib/digium/licenses/HPEC-*.lic | grep -v '\*' | grep -q .; then - return - fi - - # zaphpec_enable not installed in /usr/sbin - if [ ! -f /usr/sbin/zaphpec_enable ]; then - echo -n "Running zaphpec_enable: Failed" - echo -n "." - echo " The zaphpec_enable binary is not installed in /usr/sbin." - return - fi - - # zaphpec_enable not set executable - if [ ! -x /usr/sbin/zaphpec_enable ]; then - echo -n "Running zaphpec_enable: Failed" - echo -n "." - echo " /usr/sbin/zaphpec_enable is not set as executable." - return - fi - - # zaphpec_enable properly installed - if [ $system = debian ]; then - echo -n "Running zaphpec_enable: " - /usr/sbin/zaphpec_enable 2> /dev/null - elif [ $system = redhat ]; then - action "Running zaphpec_enable: " /usr/sbin/zaphpec_enable - fi - if [ $? = 0 ]; then - echo -n "done" - echo "." - else - echo -n "Failed" - echo -n "." - echo " This can be caused if you had already run zaphpec_enable, or if your HPEC license is no longer valid." - fi -} - -shutdown_dynamic() { - if ! grep -q ' ZTD/' /proc/* 2>/dev/null; then return; fi - - # we should only get here if we have dynamic spans. Right? - $ZTCFG_CMD -s -} - -# Check that telephony is up. -if [ "${TELEPHONY}" != "yes" ]; then - echo "No TELEPHONY found" - exit 0 -fi - -if [ ! -x "$ZTCFG" ]; then - echo "ztcfg not executable" - exit 0 -fi - -if [ ! -f /etc/zaptel.conf ]; then - echo "/etc/zaptel.conf not found" - exit 0 -fi - -if [ "${DEBUG}" = "yes" ]; then - ARGS="debug=1" -fi - -RETVAL=0 - -# See how we were called. -case "$1" in - start) - # Load drivers - rmmod wcusb 2> /dev/null - rmmod wcfxsusb 2> /dev/null - rmmod audio 2> /dev/null - if [ $system = debian ]; then - echo -n "Loading zaptel framework: " - modprobe zaptel ${ARGS} 2> /dev/null && echo -n "done" - echo "." - elif [ $system = redhat ]; then - action "Loading zaptel framework: " modprobe zaptel ${ARGS} - fi - echo -n "Waiting for zap to come online..." - TMOUT=$ZAP_DEV_TIMEOUT # max secs to wait - while [ ! -d /dev/zap ] ; do - sleep 1 - TMOUT=`expr $TMOUT - 1` - if [ $TMOUT -eq 0 ] ; then - echo "Error: missing /dev/zap!" - exit 1 - fi - done - echo "OK" - echo -n "Loading zaptel hardware modules:" - for x in $MODULES; do - eval localARGS="\$${x}_ARGS" - if modprobe ${x} ${ARGS} ${localARGS} 2> /dev/null; then - echo -n " $x" - echo "." - fi - done - sleep 3 # TODO: remove it - - # If you have zaptel-perl, the three below can be replaced with: - xpp_startup - - if [ ! -e /proc/zaptel/1 ]; then - echo "No hardware timing source found in /proc/zaptel, loading ztdummy" - modprobe ztdummy 2> /dev/null - fi - - if [ $system = debian ]; then - echo -n "Running ztcfg: " - $ZTCFG_CMD 2> /dev/null && echo -n "done" - echo "." - elif [ $system = redhat ]; then - action "Running ztcfg: " $ZTCFG_CMD - fi - RETVAL=$? - - [ $RETVAL -eq 0 ] && touch $LOCKFILE - - if [ -x "$FXOTUNE" ] && [ -r /etc/fxotune.conf ]; then - # Allowed to fail if e.g. Asterisk already uses channels: - $FXOTUNE -s || : - fi - - hpec_start - ;; - stop) - # Unload drivers - #shutdown_dynamic # FIXME: needs test from someone with dynamic spans - echo -n "Unloading zaptel hardware drivers:" - unload_module zaptel - RETVAL=$? - echo "." - - [ $RETVAL -eq 0 ] && rm -f $LOCKFILE - ;; - unload) - # We don't have zaptel helper, so let's not replicate too much code: - # allow others to use the unload command. - unload_module zaptel - ;; - restart) - $0 stop - $0 start - ;; - reload) - if [ $system = debian ]; then - echo -n "Reloading ztcfg: " - $ZTCFG_CMD 2> /dev/null && echo -n "done" - echo "." - elif [ $system = redhat ]; then - action "Reloading ztcfg: " $ZTCFG_CMD - fi - RETVAL=$? - ;; - *) - echo "Usage: zaptel {start|stop|restart|reload}" - exit 1 -esac - -exit $RETVAL - diff --git a/zaptel/zaptel.sysconfig b/zaptel/zaptel.sysconfig deleted file mode 100644 index 4db92227..00000000 --- a/zaptel/zaptel.sysconfig +++ /dev/null @@ -1,69 +0,0 @@ -TELEPHONY=yes -# DEBUG: Pass debug=1 to modules you load. -# May break xpp_usb. -#DEBUG=yes -# -#Alternatively set: options zaptel debug=1 -#in /etc/modprobe.d/zaptel or /etc/modprobe.conf. -# -# ZTCFG: The full path to ztcfg. default: /sbin/ztcfg . -#ZTCFG=/usr/local/sbin/ztcfg -# -# ZTCFG_CMD: allow adding extra parameters to the ztcfg command. -# May be handy for -v, but mostly for: -#ZTCFG_CMD=/sbin/ztcfg -c /home/tzafrir/myzaptel.conf -# -# XPP_SYNC: Can be used to set an explicit Astribank unit as the -# synchronizing Astribank. Passed to xpp_sync(8) . -# Default is 'auto' and is almost always a good choice. -#XPP_SYNC=01 - -# Un-comment as per your requirements; modules to load/unload -#Module Name Hardware -MODULES="$MODULES tor2" # T400P - Quad Span T1 Card - # E400P - Quad Span E1 Card - -MODULES="$MODULES wct4xxp" # TE405P - Quad Span T1/E1 Card (5v version) - # TE410P - Quad Span T1/E1 Card (3.3v version) -#wct4xxp_ARGS="t1e1override=15" # Additional parameters for TE4xxP driver -# or use /etc/modprobe.d/zaptel or /etc/modprobe.conf . - -MODULES="$MODULES wcte12xp" # TE120P - Single Span T1/E1 Card - -MODULES="$MODULES wct1xxp" # T100P - Single Span T1 Card - # E100P - Single Span E1 Card - -MODULES="$MODULES wcte11xp" # TE110P - Single Span T1/E1 Card - -MODULES="$MODULES wctdm24xxp" # TDM2400P - Modular FXS/FXO interface (1-24 ports) - -MODULES="$MODULES wcfxo" # X100P - Single port FXO interface - # X101P - Single port FXO interface - -MODULES="$MODULES wctdm" # TDM400P - Modular FXS/FXO interface (1-4 ports) - -MODULES="$MODULES wcusb" # S100U - Single port FXS USB Interface - -#MODULES="$MODULES torisa" # Old Tormenta1 ISA Card - -#MODULES="$MODULES ztdummy" # Zaptel Timing Only Interface - -MODULES="$MODULES xpp_usb" # Xorcom Astribank Device - -# Disables Astribank hotplug firmware loading -#XPP_HOTPLUG_DISABLED=yes -# -# Disables Astribank udev hook called when an astribank is added and ready -# or removed. -#ASTRIBANK_HOOK_DISABLED=yes -# -# Setup the configuration for the PRI module of the Astribank. -# Default: all E1,TE . See xpp/README.Astribank . -#XPP_PRI_SETUP='NUM/*/XPD-01=NT,E1' - -# Extensions genzaptelconf are (base + channel_number) -# base is by default 6000: -#base_exten=6000 -# -# There are a host of other variables you can set to affect -# genzaptelconf. See the beginning of the script. diff --git a/zaptel/zaptel.xml b/zaptel/zaptel.xml deleted file mode 100644 index 5943ed16..00000000 --- a/zaptel/zaptel.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - zttranscode - - - - - - - - - - - - - - - ztdynamic - - - ztdynamic - - - - - - - - - - - - - - no - - - no - - - - - no - - - - - - - - - - - libnewt - - diff --git a/zaptel/zonedata.c b/zaptel/zonedata.c deleted file mode 100644 index 5f7eb6bb..00000000 --- a/zaptel/zonedata.c +++ /dev/null @@ -1,938 +0,0 @@ -/* - * BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 - * - * Working with the "Tormenta ISA" Card - * - * Primary Author: Mark Spencer - * - * This information from ITU E.180 Supplement 2. - * UK information from BT SIN 350 Issue 1.1 - * Helpful reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU Lesser General Public License Version 2.1 as published - * by the Free Software Foundation. See the LICENSE.LGPL file - * included with this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include "tonezone.h" - -struct tone_zone builtin_zones[] = -{ - { .zone = 0, - .country = "us", - .description = "United States / North America", - .ringcadence = { 2000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "350+440" }, - { ZT_TONE_BUSY, "480+620/500,0/500" }, - { ZT_TONE_RINGTONE, "440+480/2000,0/4000" }, - { ZT_TONE_CONGESTION, "480+620/250,0/250" }, - { ZT_TONE_CALLWAIT, "440/300,0/10000" }, - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, - { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 1, - .country = "au", - .description = "Australia", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - { ZT_TONE_DIALTONE, "413+438" }, - { ZT_TONE_BUSY, "425/375,0/375" }, - { ZT_TONE_RINGTONE, "413+438/400,0/200,413+438/400,0/2000" }, - /* XXX Congestion: Should reduce by 10 db every other cadence XXX */ - { ZT_TONE_CONGESTION, "425/375,0/375,420/375,0/375" }, - { ZT_TONE_CALLWAIT, "425/100,0/200,425/200,0/4400" }, - { ZT_TONE_DIALRECALL, "413+428" }, - { ZT_TONE_RECORDTONE, "!425/1000,!0/15000,425/360,0/15000" }, - { ZT_TONE_INFO, "425/2500,0/500" }, - { ZT_TONE_STUTTER, "413+438/100,0/40" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 2, - .country = "fr", - .description = "France", - .ringcadence = { 1500, 3500 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - /* Dialtone can also be 440+330 */ - { ZT_TONE_DIALTONE, "440" }, - { ZT_TONE_BUSY, "440/500,0/500" }, - { ZT_TONE_RINGTONE, "440/1500,0/3500" }, - /* CONGESTION - not specified */ - { ZT_TONE_CONGESTION, "440/250,0/250" }, - { ZT_TONE_CALLWAIT, "440/300,0/10000" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, - { ZT_TONE_STUTTER, "!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,440" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 3, - .country = "nl", - .description = "Netherlands", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - /* Most of these 425's can also be 450's */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/250,0/250" }, - { ZT_TONE_CALLWAIT, "425/500,0/9500" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "425/500,0/50" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 4, - .country = "uk", - .description = "United Kingdom", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - /* From British Telecom SIN350 v1.2 */ - { ZT_TONE_DIALTONE, "350+440" }, - { ZT_TONE_BUSY, "400/375,0/375" }, - { ZT_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" }, - { ZT_TONE_CONGESTION, "400/400,0/350,400/225,0/525" }, - { ZT_TONE_CALLWAIT, "400/100,0/4000" }, - { ZT_TONE_DIALRECALL, "350+440" }, - { ZT_TONE_RECORDTONE, "1400/500,0/60000" }, - { ZT_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "350+440/750,440/750" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -13, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 5, - .country = "fi", - .description = "Finland", - .ringcadence = { 1000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/300,0/300" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" }, - { ZT_TONE_DIALRECALL, "425/650,0/25" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/650,0/325,950/325,0/30,1400/1300,0/2600" }, - { ZT_TONE_STUTTER, "425/650,0/25" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 6, - .country = "es", - .description = "Spain", - .ringcadence = { 1500, 3000}, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/200,0/200" }, - { ZT_TONE_RINGTONE, "425/1500,0/3000" }, - { ZT_TONE_CONGESTION, "425/200,0/200,425/200,0/200,425/200,0/600" }, - { ZT_TONE_CALLWAIT, "425/175,0/175,425/175,0/3500" }, - { ZT_TONE_DIALRECALL, "!425/200,!0/200,!425/200,!0/200,!425/200,!0/200,425" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/330,0/1000" }, - { ZT_TONE_STUTTER, "425/500,0/50" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -13, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 7, - .country = "jp", - .description = "Japan", - .ringcadence = { 1000, 2000 }, - .tones = { - { ZT_TONE_DIALTONE, "400" }, - { ZT_TONE_BUSY, "400/500,0/500" }, - { ZT_TONE_RINGTONE, "400+15/1000,0/2000" }, - { ZT_TONE_CONGESTION, "400/500,0/500" }, - { ZT_TONE_CALLWAIT, "400+16/500,0/8000" }, - { ZT_TONE_DIALRECALL, "!400/200,!0/200,!400/200,!0/200,!400/200,!0/200,400" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, - { ZT_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" }, - }, - .dtmf_high_level = -7, - .dtmf_low_level = -7, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 8, - .country = "no", - .description = "Norway", - .ringcadence = { 1000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" }, - { ZT_TONE_DIALRECALL, "470/400,425/400" }, - { ZT_TONE_RECORDTONE, "1400/400,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, - { ZT_TONE_STUTTER, "470/400,425/400" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 9, - .country = "at", - .description = "Austria", - .ringcadence = { 1000, 5000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "420" }, - { ZT_TONE_BUSY, "420/400,0/400" }, - { ZT_TONE_RINGTONE, "420/1000,0/5000" }, - { ZT_TONE_CONGESTION, "420/200,0/200" }, - { ZT_TONE_CALLWAIT, "420/40,0/1960" }, - { ZT_TONE_DIALRECALL, "420" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/80,0/14920" }, - { ZT_TONE_INFO, "950/330,1450/330,1850/330,0/1000" }, - { ZT_TONE_STUTTER, "380+420" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 10, - .country = "nz", - .description = "New Zealand", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - { ZT_TONE_DIALTONE, "400" }, - { ZT_TONE_BUSY, "400/500,0/500" }, - { ZT_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" }, - { ZT_TONE_CONGESTION, "400/250,0/250" }, - { ZT_TONE_CALLWAIT, "400/250,0/250,400/250,0/3250" }, - { ZT_TONE_DIALRECALL, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" }, - { ZT_TONE_RECORDTONE, "1400/425,0/15000" }, - { ZT_TONE_INFO, "400/750,0/100,400/750,0/100,400/750,0/100,400/750,0/400" }, - { ZT_TONE_STUTTER, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 11, - .country = "it", - .description = "Italy", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425/200,0/200,425/600,0/1000" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/400,0/100,425/250,0/100,425/150,0/14000" }, - { ZT_TONE_DIALRECALL, "470/400,425/400" }, - { ZT_TONE_RECORDTONE, "1400/400,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, - { ZT_TONE_STUTTER, "470/400,425/400" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 12, - .country = "us-old", - .description = "United States Circa 1950 / North America", - .ringcadence = { 2000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "600*120" }, - { ZT_TONE_BUSY, "500*100/500,0/500" }, - { ZT_TONE_RINGTONE, "420*40/2000,0/4000" }, - { ZT_TONE_CONGESTION, "500*100/250,0/250" }, - { ZT_TONE_CALLWAIT, "440/300,0/10000" }, - { ZT_TONE_DIALRECALL, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, - { ZT_TONE_STUTTER, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 13, - .country = "gr", - .description = "Greece", - .ringcadence = { 1000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "425/200,0/300,425/700,0/800" }, - { ZT_TONE_BUSY, "425/300,0/300" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" }, - { ZT_TONE_DIALRECALL, "425/650,0/25" }, - { ZT_TONE_RECORDTONE, "1400/400,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, - { ZT_TONE_STUTTER, "425/650,0/25" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 14, - .country = "tw", - .description = "Taiwan", - .ringcadence = { 1000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "350+440" }, - { ZT_TONE_BUSY, "480+620/500,0/500" }, - { ZT_TONE_RINGTONE, "440+480/1000,0/2000" }, - { ZT_TONE_CONGESTION, "480+620/250,0/250" }, - { ZT_TONE_CALLWAIT, "350+440/250,0/250,350+440/250,0/3250" }, - { ZT_TONE_DIALRECALL, "300/1500,0/500" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, - { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 15, - .country = "cl", - .description = "Chile", - .ringcadence = { 1000, 3000 }, - .tones = { - { ZT_TONE_DIALTONE, "400" }, - { ZT_TONE_BUSY, "400/500,0/500" }, - { ZT_TONE_RINGTONE, "400/1000,0/3000" }, - { ZT_TONE_CONGESTION, "400/200,0/200" }, - { ZT_TONE_CALLWAIT, "400/250,0/8750" }, - { ZT_TONE_DIALRECALL, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/333,!1400/333,!1800/333,0" }, - { ZT_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 16, - .country = "se", - .description = "Sweden", - .ringcadence = { 1000, 5000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/250,0/250" }, - { ZT_TONE_RINGTONE, "425/1000,0/5000" }, - { ZT_TONE_CONGESTION, "425/250,0/750" }, - { ZT_TONE_CALLWAIT, "425/200,0/500,425/200,0/9100" }, - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," - "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," - "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," - "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," - "!950/332,!0/24,!1400/332,!0/24,!1800/332,0" }, - /*{ ZT_TONE_STUTTER, "425/320,0/20" }, Real swedish standard, not used for now */ - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -9, - .dtmf_low_level = -10, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 17, - .country = "be", - .description = "Belgium", - .ringcadence = { 1000, 3000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/3000" }, - { ZT_TONE_CONGESTION, "425/167,0/167" }, - { ZT_TONE_CALLWAIT, "1400/175,0/175,1400/175,0/3500" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "900/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "425/1000,0/250" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 18, - .country = "sg", - .description = "Singapore", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - /* Reference: http://www.ida.gov.sg/idaweb/doc/download/I397/ida_ts_pstn1_i4r2.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/750,0/750" }, - { ZT_TONE_RINGTONE, "425*24/400,0/200,425*24/400,0/2000" }, - { ZT_TONE_CONGESTION, "425/250,0/250" }, - { ZT_TONE_CALLWAIT, "425*24/300,0/200,425*24/300,0/3200" }, - /* DIALRECALL - not specified - use repeating Holding Tone A,B*/ - { ZT_TONE_DIALRECALL, "425*24/500,0/500,425/500,0/2500" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,425" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 19, - .country = "il", - .description = "Israel", - .ringcadence = { 1000, 3000 }, - .tones = { - { ZT_TONE_DIALTONE, "414" }, - { ZT_TONE_BUSY, "414/500,0/500" }, - { ZT_TONE_RINGTONE, "414/1000,0/3000" }, - { ZT_TONE_CONGESTION, "414/250,0/250" }, - { ZT_TONE_CALLWAIT, "414/100,0/100,414/100,0/100,414/600,0/3000" }, - { ZT_TONE_DIALRECALL, "!414/100,!0/100,!414/100,!0/100,!414/100,!0/100,414" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "1000/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,414" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 20, - .country = "br", - .description = "Brazil", - .ringcadence = { 1000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/250,0/250" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/250,0/250,425/750,0/250" }, - { ZT_TONE_CALLWAIT, "425/50,0/1000" }, - { ZT_TONE_DIALRECALL, "350+440" }, - { ZT_TONE_RECORDTONE, "425/250,0/250" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330" }, - { ZT_TONE_STUTTER, "350+440" } }, - .dtmf_high_level = -10, - .dtmf_low_level = -12, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 21, - .country = "hu", - .description = "Hungary", - .ringcadence = { 1250, 3750 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/300,0/300" }, - { ZT_TONE_RINGTONE, "425/1250,0/3750" }, - { ZT_TONE_CONGESTION, "425/300,0/300" }, - { ZT_TONE_CALLWAIT, "425/40,0/1960" }, - { ZT_TONE_DIALRECALL, "425+450" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/400,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, - { ZT_TONE_STUTTER, "350+375+400" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 22, - .country = "lt", - .description = "Lithuania", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/350,0/350" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, - /* STUTTER not specified */ - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 23, - .country = "pl", - .description = "Poland", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/500,0/500" }, - { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,0" }, - /* STUTTER not specified */ - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 24, - .country = "za", - .description = "South Africa", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - { ZT_TONE_DIALTONE, "400*33" }, - { ZT_TONE_BUSY, "400/500,0/500" }, - { ZT_TONE_RINGTONE, "400*33/400,0/200,400*33/400,0/2000" }, - { ZT_TONE_CONGESTION, "400/250,0/250" }, - { ZT_TONE_CALLWAIT, "400*33/250,0/250,400*33/250,0/250,400*33/250,0/250,400*33/250,0/250" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "350+440" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, - /* STUTTER not specified */ - { ZT_TONE_STUTTER, "!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,400*33" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -13, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 25, - .country = "pt", - .description = "Portugal", - .ringcadence = { 1000, 5000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/5000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/200,425/200,425/200,0/5000" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "425/1000,0/200" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - /* STUTTER not specified */ - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 26, - .country = "ee", - .description = "Estonia", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/300,0/300" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "950/650,0/325,950/325,0/30,1400/1300,0/2600" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "425/650,0/25" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/0,0/325,950/325,0/30,1400/1300,0/2600" }, - /* STUTTER not specified */ - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 27, - .country = "mx", - .description = "Mexico", - .ringcadence = { 2000, 4000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/250,0/250" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/250,0/250" }, - { ZT_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" }, - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - }, - .dtmf_high_level = -8, - .dtmf_low_level = -6, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 28, - .country = "in", - .description = "India", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "400*25" }, - { ZT_TONE_BUSY, "400/750,0/750" }, - { ZT_TONE_RINGTONE, "400*25/400,0/200,400*25/400,0/2000" }, - { ZT_TONE_CONGESTION, "400/250,0/250" }, - { ZT_TONE_CALLWAIT, "400/200,0/100,400/200,0/7500" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - /* INFO - not specified */ - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0/1000" }, - /* STUTTER - not specified */ - { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 29, - .country = "de", - .description = "Germany", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/480,0/480" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/240,0/240" }, - { ZT_TONE_CALLWAIT, "!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,0" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/80,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "425+400" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 30, - .country = "ch", - .description = "Switzerland", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "425/200,0/200,425/200,0/4000" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/80,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "425+340/1100,0/1100" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 31, - .country = "dk", - .description = "Denmark", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/200,0/200" }, - { ZT_TONE_CALLWAIT, "!425/200,!0/600,!425/200,!0/3000,!425/200,!0/200,!425/200,0" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/80,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - /* STUTTER - not specified */ - { ZT_TONE_STUTTER, "425/450,0/50" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 32, - .country = "cz", - .description = "Czech Republic", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425/330,0/330,425/660,0/660" }, - { ZT_TONE_BUSY, "425/330,0/330" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/165,0/165" }, - { ZT_TONE_CALLWAIT, "425/330,0/9000" }, - /* DIALRECALL - not specified */ - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/14000" }, - { ZT_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" }, - /* STUTTER - not specified */ - { ZT_TONE_STUTTER, "425/450,0/50" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 33, - .country = "cn", - .description = "China", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "450" }, - { ZT_TONE_BUSY, "450/350,0/350" }, - { ZT_TONE_RINGTONE, "450/1000,0/4000" }, - { ZT_TONE_CONGESTION, "450/700,0/700" }, - { ZT_TONE_CALLWAIT, "450/400,0/4000" }, - { ZT_TONE_DIALRECALL, "450" }, - { ZT_TONE_RECORDTONE, "950/400,0/10000" }, - { ZT_TONE_INFO, "450/100,0/100,450/100,0/100,450/100,0/100,450/400,0/400" }, - /* STUTTER - not specified */ - { ZT_TONE_STUTTER, "450+425" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 34, - .country = "ar", - .description = "Argentina", - .ringcadence = { 1000, 4500 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/300,0/300" }, - { ZT_TONE_RINGTONE, "425/1000,0/4500" }, - { ZT_TONE_CONGESTION, "425/200,0/300" }, - { ZT_TONE_CALLWAIT, "425/200,0/9000" }, - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" }, - { ZT_TONE_RECORDTONE, "1400/500,0/14000" }, - { ZT_TONE_INFO, "425/100,0/100" }, - { ZT_TONE_STUTTER, "425/450,0/50" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 35, - .country = "my", - .description = "Malaysia", - .ringcadence = { 400, 200, 400, 2000 }, - .tones = { - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/400,0/200,425/400,0/2000" }, - { ZT_TONE_CONGESTION, "425/500,0/500" }, - { ZT_TONE_CALLWAIT, "425/100,0/4000" }, - { ZT_TONE_DIALRECALL, "350+440" }, - { ZT_TONE_RECORDTONE, "1400/500,0/60000" }, - { ZT_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "450+425" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 36, - .country = "th", - .description = "Thailand", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "400*50" }, - { ZT_TONE_BUSY, "400/500,0/500" }, - { ZT_TONE_RINGTONE, "400/1000,0/4000" }, - { ZT_TONE_CONGESTION, "400/300,0/300" }, - { ZT_TONE_CALLWAIT, "1000/400,10000/400,1000/400" }, - /* DIALRECALL - not specified - use special dial tone instead. */ - { ZT_TONE_DIALRECALL, "400*50/400,0/100,400*50/400,0/100" }, - /* RECORDTONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - /* INFO - specified as an announcement - use tones instead. */ - { ZT_TONE_INFO, "950/330,1400/330,1800/330" }, - /* STUTTER - not specified */ - { ZT_TONE_STUTTER, "!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,400" }, - }, - .dtmf_high_level = -11, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 37, - .country = "bg", - .description = "Bulgaria", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/250,0/250" }, - { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" }, - { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - { ZT_TONE_RECORDTONE, "1400/425,0/15000" }, - { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "425/1500,0/100" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 38, - .country = "ve", - .description = "Venezuela", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/500,0/500" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/250,0/250" }, - { ZT_TONE_CALLWAIT, "400+450/300,0/6000" }, - { ZT_TONE_DIALRECALL, "425" }, - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - { ZT_TONE_INFO, "!950/330,!1440/330,!1800/330,0/1000" }, - /* STUTTER - not specified */ - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -7, - .dtmf_low_level = -9, - .mfr1_level = -7, - .mfr2_level = -8, - }, - { .zone = 39, - .country = "ph", - .description = "Philippines", - .ringcadence = { 1000, 4000 }, - .tones = { - /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "480+620/500,0/500" }, - { ZT_TONE_RINGTONE, "425+480/1000,0/4000" }, - { ZT_TONE_CONGESTION, "480+620/250,0/250" }, - { ZT_TONE_CALLWAIT, "440/300,0/10000" }, - /* DIAL RECALL - not specified */ - { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - /* RECORD TONE - not specified */ - { ZT_TONE_RECORDTONE, "1400/500,0/15000" }, - /* INFO TONE - not specified */ - { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, - /* STUTTER TONE - not specified */ - { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = 40, - .country = "ru", - .description = "Russian Federation", - .ringcadence = { 1000, 4000 }, - .tones = { - /* References: - http://www.minsvyaz.ru/site.shtml?id=1806 - http://www.aboutphone.info/lib/gost/45-223-2001.html */ - { ZT_TONE_DIALTONE, "425" }, - { ZT_TONE_BUSY, "425/350,0/350" }, - { ZT_TONE_RINGTONE, "425/1000,0/4000" }, - { ZT_TONE_CONGESTION, "425/175,0/175" }, - { ZT_TONE_CALLWAIT, "425/200,0/5000" }, - { ZT_TONE_RECORDTONE, "1400/400,0/15000" }, - { ZT_TONE_INFO, "950/330,1440/330,1800/330,0/1000" }, - { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, - }, - .dtmf_high_level = -10, - .dtmf_low_level = -10, - .mfr1_level = -10, - .mfr2_level = -8, - }, - { .zone = -1 } -}; diff --git a/zaptel/ztcfg-dude.c b/zaptel/ztcfg-dude.c deleted file mode 100644 index 672b40cd..00000000 --- a/zaptel/ztcfg-dude.c +++ /dev/null @@ -1,863 +0,0 @@ -/* - * Configuration program for Zapata Telephony Interface - * - * Written by Mark Spencer - * Based on previous works, designs, and architectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#include "tonezone.h" -#else -#include -#include -#endif -#include "ztcfg.h" - -#define NUM_SPANS ZT_MAX_SPANS - -/* Assume no more than 1024 dynamics */ -#define NUM_DYNAMIC 1024 - -static int lineno=0; - -static FILE *cf; - -static char *filename=CONFIG_FILENAME; - -#define DEBUG_READER (1 << 0) -#define DEBUG_PARSER (1 << 1) -#define DEBUG_APPLY (1 << 2) -static int debug = 0; - -static int errcnt = 0; - -static int deftonezone = -1; - -static struct zt_lineconfig lc[ZT_MAX_SPANS]; - -static struct zt_chanconfig cc[ZT_MAX_CHANNELS]; - -static struct zt_sfconfig sf[ZT_MAX_CHANNELS]; - -static struct zt_dynamic_span zds[NUM_DYNAMIC]; - -static char *sig[ZT_MAX_CHANNELS]; /* Signalling */ - -static int slineno[ZT_MAX_CHANNELS]; /* Line number where signalling specified */ - -static int spans=0; - -static int fo_real = 1; - -static int verbose = 0; - -static int stopmode = 0; - -static int numdynamic = 0; - -static char zonestoload[ZT_TONE_ZONE_MAX][10]; - -static int numzones = 0; - -static char *lbostr[] = { -"0 db (CSU)/0-133 feet (DSX-1)", -"133-266 feet (DSX-1)", -"266-399 feet (DSX-1)", -"399-533 feet (DSX-1)", -"533-655 feet (DSX-1)", -"-7.5db (CSU)", -"-15db (CSU)", -"-22.5db (CSU)" -}; - -static char *laws[] = { - "Default", - "Mu-law", - "A-law" -}; - -static int error(char *fmt, ...) -{ - int res; - static int shown=0; - va_list ap; - if (!shown) { - fprintf(stderr, "Notice: Configuration file is %s\n", filename); - shown++; - } - res = fprintf(stderr, "line %d: ", lineno); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errcnt++; - return res; -} - -static void trim(char *buf) -{ - /* Trim off trailing spaces, tabs, etc */ - while(strlen(buf) && (buf[strlen(buf) -1] < 33)) - buf[strlen(buf) -1] = '\0'; -} - -static int parseargs(char *input, char *output[], int maxargs, char sep) -{ - char *c; - int pos=0; - c = input; - output[pos++] = c; - while(*c) { - while(*c && (*c != sep)) c++; - if (*c) { - *c = '\0'; - c++; - while(*c && (*c < 33)) c++; - if (*c) { - if (pos >= maxargs) - return -1; - output[pos] = c; - trim(output[pos]); - pos++; - output[pos] = NULL; - /* Return error if we have too many */ - } else - return pos; - } - } - return pos; -} - -int dspanconfig(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int chans; - int timing; - argc = res = parseargs(args, realargs, 4, ','); - if (res != 4) { - error("Incorrect number of arguments to 'dynamic' (should be ,
,, )\n"); - } - res = sscanf(realargs[2], "%d", &chans); - if ((res == 1) && (chans < 1)) - res = -1; - if (res != 1) { - error("Invalid number of channels '%s', should be a number > 0.\n", realargs[2]); - } - - res = sscanf(realargs[3], "%d", &timing); - if ((res == 1) && (timing < 0)) - res = -1; - if (res != 1) { - error("Invalid timing '%s', should be a number > 0.\n", realargs[3]); - } - - - zap_copy_string(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver)); - zap_copy_string(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr)); - zds[numdynamic].numchans = chans; - zds[numdynamic].timing = timing; - - numdynamic++; - return 0; -} - -int spanconfig(char *keyword, char *args) -{ - static char *realargs[10]; - int res; - int argc; - int span; - int timing; - argc = res = parseargs(args, realargs, 6, ','); - if ((res < 5) || (res > 6)) { - error("Incorrect number of arguments to 'span' (should be ,,,,[,yellow])\n"); - } - res = sscanf(realargs[0], "%i", &span); - if (res != 1) { - error("Span number should be a valid span number, not '%s'\n", realargs[0]); - return -1; - } - res = sscanf(realargs[1], "%i", &timing); - if ((res != 1) || (timing < 0) || (timing > 15)) { - error("Timing should be a number from 0 to 15, not '%s'\n", realargs[1]); - return -1; - } - res = sscanf(realargs[2], "%i", &lc[spans].lbo); - if (res != 1) { - error("Line build-out (LBO) should be a number from 0 to 7 (usually 0) not '%s'\n", realargs[2]); - return -1; - } - if ((lc[spans].lbo < 0) || (lc[spans].lbo > 7)) { - error("Line build-out should be in the range 0 to 7, not %d\n", lc[spans].lbo); - return -1; - } - if (!strcasecmp(realargs[3], "d4")) { - lc[spans].lineconfig |= ZT_CONFIG_D4; - lc[spans].lineconfig &= ~ZT_CONFIG_ESF; - lc[spans].lineconfig &= ~ZT_CONFIG_CCS; - } else if (!strcasecmp(realargs[3], "esf")) { - lc[spans].lineconfig |= ZT_CONFIG_ESF; - lc[spans].lineconfig &= ~ZT_CONFIG_D4; - lc[spans].lineconfig &= ~ZT_CONFIG_CCS; - } else if (!strcasecmp(realargs[3], "ccs")) { - lc[spans].lineconfig |= ZT_CONFIG_CCS; - lc[spans].lineconfig &= ~(ZT_CONFIG_ESF | ZT_CONFIG_D4); - } else if (!strcasecmp(realargs[3], "cas")) { - lc[spans].lineconfig &= ~ZT_CONFIG_CCS; - lc[spans].lineconfig &= ~(ZT_CONFIG_ESF | ZT_CONFIG_D4); - } else { - error("Framing(T1)/Signalling(E1) must be one of 'd4', 'esf', 'cas' or 'ccs', not '%s'\n", realargs[3]); - return -1; - } - if (!strcasecmp(realargs[4], "ami")) { - lc[spans].lineconfig &= ~(ZT_CONFIG_B8ZS | ZT_CONFIG_HDB3); - lc[spans].lineconfig |= ZT_CONFIG_AMI; - } else if (!strcasecmp(realargs[4], "b8zs")) { - lc[spans].lineconfig |= ZT_CONFIG_B8ZS; - lc[spans].lineconfig &= ~(ZT_CONFIG_AMI | ZT_CONFIG_HDB3); - } else if (!strcasecmp(realargs[4], "hdb3")) { - lc[spans].lineconfig |= ZT_CONFIG_HDB3; - lc[spans].lineconfig &= ~(ZT_CONFIG_AMI | ZT_CONFIG_B8ZS); - } else { - error("Coding must be one of 'ami', 'b8zs' or 'hdb3', not '%s'\n", realargs[4]); - return -1; - } - if (argc > 5) { - if (!strcasecmp(realargs[5], "yellow")) - lc[spans].lineconfig |= ZT_CONFIG_NOTOPEN; - else if (!strcasecmp(realargs[5], "crc4")) { - lc[spans].lineconfig |= ZT_CONFIG_CRC4; - } else { - error("Only valid fifth arguments are 'yellow' or 'crc4', not '%s'\n", realargs[5]); - return -1; - } - } - if (argc > 6) { - if (!strcasecmp(realargs[6], "yellow")) - lc[spans].lineconfig |= ZT_CONFIG_NOTOPEN; - else { - error("Only valid sixth argument is 'yellow', not '%s'\n", realargs[6]); - return -1; - } - } - lc[spans].span = spans + 1; - lc[spans].sync = timing; - /* Valid span */ - spans++; - return 0; -} - -int apply_channels(int chans[], char *argstr) -{ - char *args[ZT_MAX_CHANNELS+1]; - char *range[3]; - int res,x, res2,y; - int chan; - int start, finish; - char argcopy[256]; - res = parseargs(argstr, args, ZT_MAX_CHANNELS, ','); - if (res < 0) - error("Too many arguments... Max is %d\n", ZT_MAX_CHANNELS); - for (x=0;x-.\n", args[x]); - return -1; - } - res2 =sscanf(range[0], "%i", &start); - if (res2 != 1) { - error("Syntax error. Start of range '%s' should be a number from 1 to %d\n", args[x], ZT_MAX_CHANNELS - 1); - return -1; - } else if ((start < 1) || (start >= ZT_MAX_CHANNELS)) { - error("Start of range '%s' must be between 1 and %d (not '%d')\n", args[x], ZT_MAX_CHANNELS - 1, start); - return -1; - } - res2 =sscanf(range[1], "%i", &finish); - if (res2 != 1) { - error("Syntax error. End of range '%s' should be a number from 1 to %d\n", args[x], ZT_MAX_CHANNELS - 1); - return -1; - } else if ((finish < 1) || (finish >= ZT_MAX_CHANNELS)) { - error("end of range '%s' must be between 1 and %d (not '%d')\n", args[x], ZT_MAX_CHANNELS - 1, finish); - return -1; - } - if (start > finish) { - error("Range '%s' should start before it ends\n", args[x]); - return -1; - } - for (y=start;y<=finish;y++) - chans[y]=1; - } else { - /* It's a single channel */ - res2 =sscanf(args[x], "%i", &chan); - if (res2 != 1) { - error("Syntax error. Channel should be a number from 1 to %d, not '%s'\n", ZT_MAX_CHANNELS - 1, args[x]); - return -1; - } else if ((chan < 1) || (chan >= ZT_MAX_CHANNELS)) { - error("Channel must be between 1 and %d (not '%d')\n", ZT_MAX_CHANNELS - 1, chan); - return -1; - } - chans[chan]=1; - } - } - return res; -} - -int parse_idle(int *i, char *s) -{ - char a,b,c,d; - if (s) { - if (sscanf(s, "%c%c%c%c", &a,&b,&c,&d) == 4) { - if (((a == '0') || (a == '1')) && ((b == '0') || (b == '1')) && ((c == '0') || (c == '1')) && ((d == '0') || (d == '1'))) { - *i = 0; - if (a == '1') - *i |= ZT_ABIT; - if (b == '1') - *i |= ZT_BBIT; - if (c == '1') - *i |= ZT_CBIT; - if (d == '1') - *i |= ZT_DBIT; - return 0; - } - } - } - error("CAS Signalling requires idle definition in the form ':xxxx' at the end of the channel definition, where xxxx represent the a, b, c, and d bits\n"); - return -1; -} - -void mknotch(float freq, float bw, long *p1, long *p2, long *p3); - -static void mktxtone(float freq, float l, int *fac, int *init_v2, int *init_v3) -{ -float gain; - - /* Bring it down -8 dbm */ - gain = pow(10.0, (l - 3.14) / 20.0) * 65536.0 / 2.0; - - *fac = 2.0 * cos(2.0 * M_PI * (freq / 8000.0)) * 32768.0; - *init_v2 = sin(-4.0 * M_PI * (freq / 8000.0)) * gain; - *init_v3 = sin(-2.0 * M_PI * (freq / 8000.0)) * gain; -} - -static int parse_sf(struct zt_sfconfig *sf, char *str) -{ -char *realargs[10],*args; -int res; -float rxfreq,rxbw,txfreq,txlevel; -int flags = 0; - - args = strdup(str); - res = parseargs(args, realargs, 6, ','); - if (res != 6) - { - error("Incorrect number of arguments to 'sf' (should be :,,,,,)\n"); - free(args); - return -1; - } - res = sscanf(realargs[0],"%f",&rxfreq); - if ((res < 1) || (rxfreq && ((rxfreq < 100.0) || (rxfreq >= 4000.0)))) - { - error("Invalid rx freq. specification (should be between 100.0 and 4000.0 hertz\n"); - free(args); - return -1; - } - res = sscanf(realargs[1],"%f",&rxbw); - if ((res < 1) || (rxfreq && ((rxbw < 5.0) || (rxbw >= 1000.0)))) - { - error("Invalid rx bandwidth specification (should be between 5.0 and 1000.0 hertz\n"); - free(args); - return -1; - } - res = sscanf(realargs[3],"%f",&txfreq); - if ((res < 1) || (txfreq && ((txfreq < 100.0) || (txfreq >= 4000.0)))) - { - error("Invalid tx freq. specification (should be between 100.0 and 4000.0 hertz\n"); - free(args); - return -1; - } - res = sscanf(realargs[4],"%f",&txlevel); - if ((res < 1) || (txfreq && ((txlevel < -50.0) || (txlevel > 3.0)))) - { - error("Invalid tx level specification (should be between -50.0 and 3.0 dbm\n"); - free(args); - return -1; - } - if ((*realargs[2] == 'i') || (*realargs[2] == 'I') || - (*realargs[2] == 'r') || (*realargs[2] == 'R')) - flags |= ZT_REVERSE_RXTONE; - if ((*realargs[5] == 'i') || (*realargs[5] == 'I') || - (*realargs[5] == 'r') || (*realargs[5] == 'R')) - flags |= ZT_REVERSE_TXTONE; - if (rxfreq) mknotch(rxfreq,rxbw,&sf->rxp1,&sf->rxp2,&sf->rxp3); - if (txfreq) mktxtone(txfreq,txlevel,&sf->txtone,&sf->tx_v2,&sf->tx_v3); - sf->toneflag = flags; - free(args); - return 0; -} - -static int chanconfig(char *keyword, char *args) -{ - int chans[ZT_MAX_CHANNELS]; - int res; - int x; - int master=0; - char *idle; - bzero(chans, sizeof(chans)); - strtok(args, ":"); - idle = strtok(NULL, ":"); - res = apply_channels(chans, args); - if (res <= 0) - return -1; - for (x=1;x= ZT_TONE_ZONE_MAX) { - error("Too many tone zones specified\n"); - return 0; - } - zap_copy_string(zonestoload[numzones++], args, sizeof(zonestoload[0])); - return 0; -} - -static int defaultzone(char *keyword, char *args) -{ - struct tone_zone *z; - if (!(z = tone_zone_find(args))) { - error("No such tone zone known: %s\n", args); - return 0; - } - deftonezone = z->zone; - return 0; -} - -#if 0 -static int unimplemented(char *keyword, char *args) -{ - fprintf(stderr, "Warning: '%s' is not yet implemented\n", keyword); - return 0; -} -#endif - -static void printconfig() -{ - int x,y; - int ps; - int configs=0; - printf("\nZaptel Configuration\n" - "======================\n\n"); - for (x=0;x 1) { - printf("\nChannel map:\n\n"); - for (x=1;x -- Use instead of " CONFIG_FILENAME "\n" - " -h -- Generate this help statement\n" - " -v -- Verbose (more -v's means more verbose)\n" - " -t -- Test mode only, do not apply\n" - " -s -- Shutdown spans only\n" - ,c); - exit(exitcode); -} - -int main(int argc, char *argv[]) -{ - char c; - char *buf; - char *key, *value; - int x,found; - int fd; - while((c = getopt(argc, argv, "hc:vs")) != -1) { - switch(c) { - case 'c': - filename=optarg; - break; - case 'h': - usage(argv[0], 0); - break; - case '?': - usage(argv[0], 1); - break; - case 'v': - verbose++; - break; - case 't': - fo_real = 0; - break; - case 's': - stopmode = 1; - break; - } - } - cf = fopen(filename, "r"); - if (cf) { - while((buf = readline())) { - if (debug & DEBUG_READER) - fprintf(stderr, "Line %d: %s\n", lineno, buf); - key = value = buf; - while(value && *value && (*value != '=')) value++; - if (value) - *value='\0'; - if (value) - value++; - while(value && *value && (*value < 33)) value++; - if (*value) { - trim(key); - if (debug & DEBUG_PARSER) - fprintf(stderr, "Keyword: [%s], Value: [%s]\n", key, value); - } else - error("Syntax error. Should be =\n"); - found=0; - for (x=0;x\n"); - fclose(cf); - } else { - error("Unable to open configuration file '%s'\n", filename); - } - - if (!errcnt) { - if (verbose) { - printconfig(); - } - if (fo_real) { - if (debug & DEBUG_APPLY) { - printf("About to open Master device\n"); - fflush(stdout); - } - fd = open(MASTER_DEVICE, O_RDWR); - if (fd < 0) - error("Unable to open master device '%s'\n", MASTER_DEVICE); - else { - for (x=0;x -1) { - if (ioctl(fd, ZT_DEFAULTZONE, &deftonezone)) { - fprintf(stderr, "ZT_DEFAULTZONE failed: %s (%d)\n", strerror(errno), errno); - close(fd); - exit(1); - } - } - for (x=0;x - * Based on previous works, designs, and architectures conceived and - * written by Jim Dixon . - * Radio Support by Jim Dixon - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#include "tonezone.h" -#else -#include -#include -#endif -#include "ztcfg.h" - -#define NUM_SPANS ZT_MAX_SPANS - -#define NUM_TONES 15 - -/* Assume no more than 1024 dynamics */ -#define NUM_DYNAMIC 1024 - -static int lineno=0; - -static FILE *cf; - -static char *filename=CONFIG_FILENAME; - -int rxtones[NUM_TONES + 1],rxtags[NUM_TONES + 1],txtones[NUM_TONES + 1]; -int bursttime = 0, debouncetime = 0, invertcor = 0, exttone = 0, corthresh = 0; -int txgain = 0, rxgain = 0, deemp = 0, preemp = 0; - -int corthreshes[] = {3125,6250,9375,12500,15625,18750,21875,25000,0} ; - -static int toneindex = 1; - -#define DEBUG_READER (1 << 0) -#define DEBUG_PARSER (1 << 1) -#define DEBUG_APPLY (1 << 2) -static int debug = 0; - -static int errcnt = 0; - -static int deftonezone = -1; - -static struct zt_lineconfig lc[ZT_MAX_SPANS]; - -static struct zt_chanconfig cc[ZT_MAX_CHANNELS]; - -static struct zt_dynamic_span zds[NUM_DYNAMIC]; - -static const char *sig[ZT_MAX_CHANNELS]; /* Signalling */ - -static int slineno[ZT_MAX_CHANNELS]; /* Line number where signalling specified */ - -static int spans=0; - -static int fo_real = 1; - -static int verbose = 0; - -static int force = 0; - -static int stopmode = 0; - -static int numdynamic = 0; - -static char zonestoload[ZT_TONE_ZONE_MAX][10]; - -static int numzones = 0; - -static int fd = -1; - -static const char *lbostr[] = { -"0 db (CSU)/0-133 feet (DSX-1)", -"133-266 feet (DSX-1)", -"266-399 feet (DSX-1)", -"399-533 feet (DSX-1)", -"533-655 feet (DSX-1)", -"-7.5db (CSU)", -"-15db (CSU)", -"-22.5db (CSU)" -}; - -static const char *laws[] = { - "Default", - "Mu-law", - "A-law" -}; - -static const char *sigtype_to_str(const int sig) -{ - switch (sig) { - case 0: - return "Unused"; - case ZT_SIG_EM: - return "E & M"; - case ZT_SIG_EM_E1: - return "E & M E1"; - case ZT_SIG_FXSLS: - return "FXS Loopstart"; - case ZT_SIG_FXSGS: - return "FXS Groundstart"; - case ZT_SIG_FXSKS: - return "FXS Kewlstart"; - case ZT_SIG_FXOLS: - return "FXO Loopstart"; - case ZT_SIG_FXOGS: - return "FXO Groundstart"; - case ZT_SIG_FXOKS: - return "FXO Kewlstart"; - case ZT_SIG_CAS: - return "CAS / User"; - case ZT_SIG_DACS: - return "DACS"; - case ZT_SIG_DACS_RBS: - return "DACS w/RBS"; - case ZT_SIG_CLEAR: - return "Clear channel"; - case ZT_SIG_SLAVE: - return "Slave channel"; - case ZT_SIG_HDLCRAW: - return "Raw HDLC"; - case ZT_SIG_HDLCNET: - return "Network HDLC"; - case ZT_SIG_HDLCFCS: - return "HDLC with FCS check"; - case ZT_SIG_HARDHDLC: - return "Hardware assisted D-channel"; - case ZT_SIG_MTP2: - return "MTP2"; - default: - return "Unknown"; - } -} - -int ind_ioctl(int channo, int fd, int op, void *data) -{ -ZT_INDIRECT_DATA ind; - - ind.chan = channo; - ind.op = op; - ind.data = data; - return ioctl(fd,ZT_INDIRECT,&ind); -} - -static void clear_fields() -{ - - memset(rxtones,0,sizeof(rxtones)); - memset(rxtags,0,sizeof(rxtags)); - memset(txtones,0,sizeof(txtones)); - bursttime = 0; - debouncetime = 0; - invertcor = 0; - exttone = 0; - txgain = 0; - rxgain = 0; - deemp = 0; - preemp = 0; -} - -static int error(char *fmt, ...) -{ - int res; - static int shown=0; - va_list ap; - if (!shown) { - fprintf(stderr, "Notice: Configuration file is %s\n", filename); - shown++; - } - res = fprintf(stderr, "line %d: ", lineno); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errcnt++; - return res; -} - -static void trim(char *buf) -{ - /* Trim off trailing spaces, tabs, etc */ - while(strlen(buf) && (buf[strlen(buf) -1] < 33)) - buf[strlen(buf) -1] = '\0'; -} - -static int parseargs(char *input, char *output[], int maxargs, char sep) -{ - char *c; - int pos=0; - c = input; - output[pos++] = c; - while(*c) { - while(*c && (*c != sep)) c++; - if (*c) { - *c = '\0'; - c++; - while(*c && (*c < 33)) c++; - if (*c) { - if (pos >= maxargs) - return -1; - output[pos] = c; - trim(output[pos]); - pos++; - output[pos] = NULL; - /* Return error if we have too many */ - } else - return pos; - } - } - return pos; -} - -int dspanconfig(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int chans; - int timing; - argc = res = parseargs(args, realargs, 4, ','); - if (res != 4) { - error("Incorrect number of arguments to 'dynamic' (should be ,
,, )\n"); - } - res = sscanf(realargs[2], "%d", &chans); - if ((res == 1) && (chans < 1)) - res = -1; - if (res != 1) { - error("Invalid number of channels '%s', should be a number > 0.\n", realargs[2]); - } - - res = sscanf(realargs[3], "%d", &timing); - if ((res == 1) && (timing < 0)) - res = -1; - if (res != 1) { - error("Invalid timing '%s', should be a number > 0.\n", realargs[3]); - } - - - zap_copy_string(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver)); - zap_copy_string(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr)); - zds[numdynamic].numchans = chans; - zds[numdynamic].timing = timing; - - numdynamic++; - return 0; -} - -int spanconfig(char *keyword, char *args) -{ - static char *realargs[10]; - int res; - int argc; - int span; - int timing; - argc = res = parseargs(args, realargs, 7, ','); - if ((res < 5) || (res > 7)) { - error("Incorrect number of arguments to 'span' (should be ,,,,[, crc4 | yellow [, yellow]])\n"); - } - res = sscanf(realargs[0], "%i", &span); - if (res != 1) { - error("Span number should be a valid span number, not '%s'\n", realargs[0]); - return -1; - } - res = sscanf(realargs[1], "%i", &timing); - if ((res != 1) || (timing < 0) || (timing > 15)) { - error("Timing should be a number from 0 to 15, not '%s'\n", realargs[1]); - return -1; - } - res = sscanf(realargs[2], "%i", &lc[spans].lbo); - if (res != 1) { - error("Line build-out (LBO) should be a number from 0 to 7 (usually 0) not '%s'\n", realargs[2]); - return -1; - } - if ((lc[spans].lbo < 0) || (lc[spans].lbo > 7)) { - error("Line build-out should be in the range 0 to 7, not %d\n", lc[spans].lbo); - return -1; - } - if (!strcasecmp(realargs[3], "d4")) { - lc[spans].lineconfig |= ZT_CONFIG_D4; - lc[spans].lineconfig &= ~ZT_CONFIG_ESF; - lc[spans].lineconfig &= ~ZT_CONFIG_CCS; - } else if (!strcasecmp(realargs[3], "esf")) { - lc[spans].lineconfig |= ZT_CONFIG_ESF; - lc[spans].lineconfig &= ~ZT_CONFIG_D4; - lc[spans].lineconfig &= ~ZT_CONFIG_CCS; - } else if (!strcasecmp(realargs[3], "ccs")) { - lc[spans].lineconfig |= ZT_CONFIG_CCS; - lc[spans].lineconfig &= ~(ZT_CONFIG_ESF | ZT_CONFIG_D4); - } else if (!strcasecmp(realargs[3], "cas")) { - lc[spans].lineconfig &= ~ZT_CONFIG_CCS; - lc[spans].lineconfig &= ~(ZT_CONFIG_ESF | ZT_CONFIG_D4); - } else { - error("Framing(T1)/Signalling(E1) must be one of 'd4', 'esf', 'cas' or 'ccs', not '%s'\n", realargs[3]); - return -1; - } - if (!strcasecmp(realargs[4], "ami")) { - lc[spans].lineconfig &= ~(ZT_CONFIG_B8ZS | ZT_CONFIG_HDB3); - lc[spans].lineconfig |= ZT_CONFIG_AMI; - } else if (!strcasecmp(realargs[4], "b8zs")) { - lc[spans].lineconfig |= ZT_CONFIG_B8ZS; - lc[spans].lineconfig &= ~(ZT_CONFIG_AMI | ZT_CONFIG_HDB3); - } else if (!strcasecmp(realargs[4], "hdb3")) { - lc[spans].lineconfig |= ZT_CONFIG_HDB3; - lc[spans].lineconfig &= ~(ZT_CONFIG_AMI | ZT_CONFIG_B8ZS); - } else { - error("Coding must be one of 'ami', 'b8zs' or 'hdb3', not '%s'\n", realargs[4]); - return -1; - } - if (argc > 5) { - if (!strcasecmp(realargs[5], "yellow")) - lc[spans].lineconfig |= ZT_CONFIG_NOTOPEN; - else if (!strcasecmp(realargs[5], "crc4")) { - lc[spans].lineconfig |= ZT_CONFIG_CRC4; - } else { - error("Only valid fifth arguments are 'yellow' or 'crc4', not '%s'\n", realargs[5]); - return -1; - } - } - if (argc > 6) { - if (!strcasecmp(realargs[6], "yellow")) - lc[spans].lineconfig |= ZT_CONFIG_NOTOPEN; - else { - error("Only valid sixth argument is 'yellow', not '%s'\n", realargs[6]); - return -1; - } - } - lc[spans].span = span; - lc[spans].sync = timing; - /* Valid span */ - spans++; - return 0; -} - -int apply_channels(int chans[], char *argstr) -{ - char *args[ZT_MAX_CHANNELS+1]; - char *range[3]; - int res,x, res2,y; - int chan; - int start, finish; - char argcopy[256]; - res = parseargs(argstr, args, ZT_MAX_CHANNELS, ','); - if (res < 0) - error("Too many arguments... Max is %d\n", ZT_MAX_CHANNELS); - for (x=0;x-.\n", args[x]); - return -1; - } - res2 =sscanf(range[0], "%i", &start); - if (res2 != 1) { - error("Syntax error. Start of range '%s' should be a number from 1 to %d\n", args[x], ZT_MAX_CHANNELS - 1); - return -1; - } else if ((start < 1) || (start >= ZT_MAX_CHANNELS)) { - error("Start of range '%s' must be between 1 and %d (not '%d')\n", args[x], ZT_MAX_CHANNELS - 1, start); - return -1; - } - res2 =sscanf(range[1], "%i", &finish); - if (res2 != 1) { - error("Syntax error. End of range '%s' should be a number from 1 to %d\n", args[x], ZT_MAX_CHANNELS - 1); - return -1; - } else if ((finish < 1) || (finish >= ZT_MAX_CHANNELS)) { - error("end of range '%s' must be between 1 and %d (not '%d')\n", args[x], ZT_MAX_CHANNELS - 1, finish); - return -1; - } - if (start > finish) { - error("Range '%s' should start before it ends\n", args[x]); - return -1; - } - for (y=start;y<=finish;y++) - chans[y]=1; - } else { - /* It's a single channel */ - res2 =sscanf(args[x], "%i", &chan); - if (res2 != 1) { - error("Syntax error. Channel should be a number from 1 to %d, not '%s'\n", ZT_MAX_CHANNELS - 1, args[x]); - return -1; - } else if ((chan < 1) || (chan >= ZT_MAX_CHANNELS)) { - error("Channel must be between 1 and %d (not '%d')\n", ZT_MAX_CHANNELS - 1, chan); - return -1; - } - chans[chan]=1; - } - } - return res; -} - -int parse_idle(int *i, char *s) -{ - char a,b,c,d; - if (s) { - if (sscanf(s, "%c%c%c%c", &a,&b,&c,&d) == 4) { - if (((a == '0') || (a == '1')) && ((b == '0') || (b == '1')) && ((c == '0') || (c == '1')) && ((d == '0') || (d == '1'))) { - *i = 0; - if (a == '1') - *i |= ZT_ABIT; - if (b == '1') - *i |= ZT_BBIT; - if (c == '1') - *i |= ZT_CBIT; - if (d == '1') - *i |= ZT_DBIT; - return 0; - } - } - } - error("CAS Signalling requires idle definition in the form ':xxxx' at the end of the channel definition, where xxxx represent the a, b, c, and d bits\n"); - return -1; -} - -static int parse_channel(char *channel, int *startchan) -{ - if (!channel || (sscanf(channel, "%i", startchan) != 1) || - (*startchan < 1)) { - error("DACS requires a starting channel in the form ':x' where x is the channel\n"); - return -1; - } - return 0; -} - -static int chanconfig(char *keyword, char *args) -{ - int chans[ZT_MAX_CHANNELS]; - int res = 0; - int x; - int master=0; - int dacschan = 0; - char *idle; - bzero(chans, sizeof(chans)); - strtok(args, ":"); - idle = strtok(NULL, ":"); - if (!strcasecmp(keyword, "dacs") || !strcasecmp(keyword, "dacsrbs")) { - res = parse_channel(idle, &dacschan); - } - if (!res) - res = apply_channels(chans, args); - if (res <= 0) - return -1; - for (x=1;x= ZT_TONE_ZONE_MAX) { - error("Too many tone zones specified\n"); - return 0; - } - zap_copy_string(zonestoload[numzones++], args, sizeof(zonestoload[0])); - return 0; -} - -static int defaultzone(char *keyword, char *args) -{ - struct tone_zone *z; - if (!(z = tone_zone_find(args))) { - error("No such tone zone known: %s\n", args); - return 0; - } - deftonezone = z->zone; - return 0; -} - -#if 0 -static int unimplemented(char *keyword, char *args) -{ - fprintf(stderr, "Warning: '%s' is not yet implemented\n", keyword); - return 0; -} -#endif - - -/* Radio functions */ - -int ctcss(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int rxtone; - int rxtag; - int txtone; - int isdcs = 0; - argc = res = parseargs(args, realargs, 3, ','); - if (res != 3) { - error("Incorrect number of arguments to 'ctcss' (should be ,,)\n"); - } - res = sscanf(realargs[0], "%d", &rxtone); - if ((res == 1) && (rxtone < 1)) - res = -1; - if (res != 1) { - error("Invalid rxtone '%s', should be a number > 0.\n", realargs[0]); - } - res = sscanf(realargs[1], "%i", &rxtag); - if ((res == 1) && (rxtag < 0)) - res = -1; - if (res != 1) { - error("Invalid rxtag '%s', should be a number > 0.\n", realargs[1]); - } - if ((*realargs[2] == 'D') || (*realargs[2] == 'd')) - { - realargs[2]++; - isdcs = 0x8000; - } - res = sscanf(realargs[2], "%d", &txtone); - if ((res == 1) && (rxtag < 0)) - res = -1; - if (res != 1) { - error("Invalid txtone '%s', should be a number > 0.\n", realargs[2]); - } - - if (toneindex >= NUM_TONES) - { - error("Cannot specify more then %d CTCSS tones\n",NUM_TONES); - } - rxtones[toneindex] = rxtone; - rxtags[toneindex] = rxtag; - txtones[toneindex] = txtone | isdcs; - toneindex++; - return 0; -} - -int dcsrx(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int rxtone; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'dcsrx' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &rxtone); - if ((res == 1) && (rxtone < 1)) - res = -1; - if (res != 1) { - error("Invalid rxtone '%s', should be a number > 0.\n", realargs[0]); - } - - rxtones[0] = rxtone; - return 0; -} - -int tx(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int txtone; - int isdcs = 0; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'tx' (should be )\n"); - } - if ((*realargs[0] == 'D') || (*realargs[0] == 'd')) - { - realargs[0]++; - isdcs = 0x8000; - } - res = sscanf(realargs[0], "%d", &txtone); - if ((res == 1) && (txtone < 1)) - res = -1; - if (res != 1) { - error("Invalid tx (tone) '%s', should be a number > 0.\n", realargs[0]); - } - - txtones[0] = txtone | isdcs; - return 0; -} - -int debounce_time(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'debouncetime' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 1)) - res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - - debouncetime = val; - return 0; -} - -int burst_time(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'bursttime' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 1)) - res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - - bursttime = val; - return 0; -} - -int tx_gain(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'txgain' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - - txgain = val; - return 0; -} - -int rx_gain(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'rxgain' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - - rxgain = val; - return 0; -} - -int de_emp(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'de-emp' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 1)) - res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - - deemp = val; - return 0; -} - -int pre_emp(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'pre_emp' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 1)) - res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - - preemp = val; - return 0; -} - -int invert_cor(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'invertcor' (should be )\n"); - } - if ((*realargs[0] == 'y') || (*realargs[0] == 'Y')) val = 1; - else if ((*realargs[0] == 'n') || (*realargs[0] == 'N')) val = 0; - else - { - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 0)) - res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - } - invertcor = (val > 0); - return 0; -} - -int ext_tone(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'exttone' (should be )\n"); - } - if ((*realargs[0] == 'y') || (*realargs[0] == 'Y')) val = 1; - else if ((*realargs[0] == 'n') || (*realargs[0] == 'N')) val = 0; - else if ((*realargs[0] == 'i') || (*realargs[0] == 'I')) val = 2; - else - { - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 0)) - res = -1; - if (val > 2) res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - } - exttone = val; - return 0; -} - -int cor_thresh(char *keyword, char *args) -{ - static char *realargs[10]; - int argc; - int res; - int val; - int x = 0; - argc = res = parseargs(args, realargs, 1, ','); - if (res != 1) { - error("Incorrect number of arguments to 'corthresh' (should be )\n"); - } - res = sscanf(realargs[0], "%d", &val); - if ((res == 1) && (val < 1)) - res = -1; - for(x = 0; corthreshes[x]; x++) - { - if (corthreshes[x] == val) break; - } - if (!corthreshes[x]) res = -1; - if (res != 1) { - error("Invalid value '%s', should be a number > 0.\n", realargs[0]); - } - corthresh = x + 1; - return 0; -} - -int rad_apply_channels(int chans[], char *argstr) -{ - char *args[ZT_MAX_CHANNELS+1]; - char *range[3]; - int res,x, res2,y; - int chan; - int start, finish; - char argcopy[256]; - res = parseargs(argstr, args, ZT_MAX_CHANNELS, ','); - if (res < 0) - error("Too many arguments... Max is %d\n", ZT_MAX_CHANNELS); - for (x=0;x-.\n", args[x]); - return -1; - } - res2 =sscanf(range[0], "%i", &start); - if (res2 != 1) { - error("Syntax error. Start of range '%s' should be a number from 1 to %d\n", args[x], ZT_MAX_CHANNELS - 1); - return -1; - } else if ((start < 1) || (start >= ZT_MAX_CHANNELS)) { - error("Start of range '%s' must be between 1 and %d (not '%d')\n", args[x], ZT_MAX_CHANNELS - 1, start); - return -1; - } - res2 =sscanf(range[1], "%i", &finish); - if (res2 != 1) { - error("Syntax error. End of range '%s' should be a number from 1 to %d\n", args[x], ZT_MAX_CHANNELS - 1); - return -1; - } else if ((finish < 1) || (finish >= ZT_MAX_CHANNELS)) { - error("end of range '%s' must be between 1 and %d (not '%d')\n", args[x], ZT_MAX_CHANNELS - 1, finish); - return -1; - } - if (start > finish) { - error("Range '%s' should start before it ends\n", args[x]); - return -1; - } - for (y=start;y<=finish;y++) - chans[y]=1; - } else { - /* It's a single channel */ - res2 =sscanf(args[x], "%i", &chan); - if (res2 != 1) { - error("Syntax error. Channel should be a number from 1 to %d, not '%s'\n", ZT_MAX_CHANNELS - 1, args[x]); - return -1; - } else if ((chan < 1) || (chan >= ZT_MAX_CHANNELS)) { - error("Channel must be between 1 and %d (not '%d')\n", ZT_MAX_CHANNELS - 1, chan); - return -1; - } - chans[chan]=1; - } - } - return res; -} - -static int rad_chanconfig(char *keyword, char *args) -{ - int chans[ZT_MAX_CHANNELS]; - int res = 0; - int x,i,n; - struct zt_radio_param p; - - toneindex = 1; - bzero(chans, sizeof(chans)); - res = rad_apply_channels(chans, args); - if (res <= 0) - return -1; - for (x=1;x 1) { - printf("\nChannel map:\n\n"); - for (x=1;x -- Use instead of " CONFIG_FILENAME "\n" - " -d [level] -- Generate debugging output. (Default level is 1.)\n" - " -f -- Always reconfigure every channel\n" - " -h -- Generate this help statement\n" - " -s -- Shutdown spans only\n" - " -t -- Test mode only, do not apply\n" - " -v -- Verbose (more -v's means more verbose)\n" - ,c); - exit(exitcode); -} - -int main(int argc, char *argv[]) -{ - int c; - char *buf; - char *key, *value; - int x,found; - while((c = getopt(argc, argv, "fthc:vsd::")) != -1) { - switch(c) { - case 'c': - filename=optarg; - break; - case 'h': - usage(argv[0], 0); - break; - case '?': - usage(argv[0], 1); - break; - case 'v': - verbose++; - break; - case 'f': - force++; - break; - case 't': - fo_real = 0; - break; - case 's': - stopmode = 1; - break; - case 'd': - if (optarg) - debug = atoi(optarg); - else - debug = 1; - break; - } - } - if (fd == -1) fd = open(MASTER_DEVICE, O_RDWR); - if (fd < 0) - error("Unable to open master device '%s'\n", MASTER_DEVICE); - cf = fopen(filename, "r"); - if (cf) { - while((buf = readline())) { - if (debug & DEBUG_READER) - fprintf(stderr, "Line %d: %s\n", lineno, buf); - key = value = buf; - while(value && *value && (*value != '=')) value++; - if (value) - *value='\0'; - if (value) - value++; - while(value && *value && (*value < 33)) value++; - if (*value) { - trim(key); - if (debug & DEBUG_PARSER) - fprintf(stderr, "Keyword: [%s], Value: [%s]\n", key, value); - } else - error("Syntax error. Should be =\n"); - found=0; - for (x=0;x\n"); - fclose(cf); - } else { - error("Unable to open configuration file '%s'\n", filename); - } - - if (!errcnt) { - if (verbose) { - printconfig(fd); - } - if (fo_real) { - if (debug & DEBUG_APPLY) { - printf("About to open Master device\n"); - fflush(stdout); - } - for (x=0;x> 16; - - if (cc[x].sigtype != current_state.sigtype) { - needupdate++; - if (verbose > 1) - printf("Changing signalling on channel %d from %s to %s\n", - cc[x].chan, sigtype_to_str(current_state.sigtype), - sigtype_to_str(cc[x].sigtype)); - } - - if ((cc[x].deflaw != ZT_LAW_DEFAULT) && (cc[x].deflaw != current_state.curlaw)) { - needupdate++; - if (verbose > 1) - printf("Changing law on channel %d from %s to %s\n", - cc[x].chan, laws[current_state.curlaw], - laws[cc[x].deflaw]); - } - - if (cc[x].master != master) { - needupdate++; - if (verbose > 1) - printf("Changing master of channel %d from %d to %d\n", - cc[x].chan, master, - cc[x].master); - } - - if (cc[x].idlebits != current_state.idlebits) { - needupdate++; - if (verbose > 1) - printf("Changing idle bits of channel %d from %d to %d\n", - cc[x].chan, current_state.idlebits, - cc[x].idlebits); - } - } - - if (needupdate && ioctl(fd, ZT_CHANCONFIG, &cc[x])) { - fprintf(stderr, "ZT_CHANCONFIG failed on channel %d: %s (%d)\n", x, strerror(errno), errno); - if (errno == EINVAL) { - fprintf(stderr, "Did you forget that FXS interfaces are configured with FXO signalling\n" - "and that FXO interfaces use FXS signalling?\n"); - } - close(fd); - exit(1); - } - } - for (x=0;x -1) { - if (ioctl(fd, ZT_DEFAULTZONE, &deftonezone)) { - fprintf(stderr, "ZT_DEFAULTZONE failed: %s (%d)\n", strerror(errno), errno); - close(fd); - exit(1); - } - } - for (x=0;x -#include -#include -#include -#include - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -int main(int argc, char *argv[]) -{ - int fd; - int chan; - if ((argc < 2) || (sscanf(argv[1], "%d", &chan) != 1)) { - fprintf(stderr, "Usage: ztdiag \n"); - exit(1); - } - fd = open("/dev/zap/ctl", O_RDWR); - if (fd < 0) { - perror("open(/dev/zap/ctl"); - exit(1); - } - if (ioctl(fd, ZT_CHANDIAG, &chan)) { - perror("ioctl(ZT_CHANDIAG)"); - exit(1); - } - exit(0); -} diff --git a/zaptel/ztmonitor.c b/zaptel/ztmonitor.c deleted file mode 100644 index ee01a401..00000000 --- a/zaptel/ztmonitor.c +++ /dev/null @@ -1,650 +0,0 @@ -/* - * Monitor a Zaptel Channel - * - * Written by Mark Spencer - * Based on previous works, designs, and architectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#include "tonezone.h" -#else -#include -#include -#endif -#include - -/* -* defines for file handle numbers -*/ -#define MON_BRX 0 /*!< both channels if multichannel==1 or receive otherwise */ -#define MON_TX 1 /*!< transmit channel */ -#define MON_PRE_BRX 2 /*!< same as MON_BRX but before echo cancellation */ -#define MON_PRE_TX 3 /*!< same as MON_TX but before echo cancellation */ -#define MON_STEREO 4 /*!< stereo mix of rx/tx streams */ -#define MON_PRE_STEREO 5 /*!< stereo mix of rx/tx before echo can. This is exactly what is fed into the echo can */ - -#define BLOCK_SIZE 240 - -#define BUFFERS 4 - -#define FRAG_SIZE 8 - -/* Put the ofh (output file handles) outside - * the main loop in case we ever add a signal - * handler. - */ -static FILE *ofh[6]; - -static int stereo; -static int verbose; - -int audio_open(void) -{ - int fd; - int speed = 8000; - int fmt = AFMT_S16_LE; - int fragsize = (BUFFERS << 16) | (FRAG_SIZE); - struct audio_buf_info ispace, ospace; - fd = open("/dev/dsp", O_WRONLY); - if (fd < 0) { - fprintf(stderr, "Unable to open /dev/dsp: %s\n", strerror(errno)); - return -1; - } - /* Step 1: Signed linear */ - if (ioctl(fd, SNDCTL_DSP_SETFMT, &fmt) < 0) { - fprintf(stderr, "ioctl(SETFMT) failed: %s\n", strerror(errno)); - close(fd); - return -1; - } - /* Step 2: Make non-stereo */ - if (ioctl(fd, SNDCTL_DSP_STEREO, &stereo) < 0) { - fprintf(stderr, "ioctl(STEREO) failed: %s\n", strerror(errno)); - close(fd); - return -1; - } - if (stereo != 0) { - fprintf(stderr, "Can't turn stereo off :(\n"); - } - /* Step 3: Make 8000 Hz */ - if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) < 0) { - fprintf(stderr, "ioctl(SPEED) failed: %s\n", strerror(errno)); - close(fd); - return -1; - } - if (speed != 8000) - fprintf(stderr, "Warning: Requested 8000 Hz, got %d\n", speed); - if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fragsize)) { - fprintf(stderr, "Sound card won't let me set fragment size to %u %u-byte buffers (%x)\n" - "so sound may be choppy: %s.\n", BUFFERS, (1 << FRAG_SIZE), fragsize, strerror(errno)); - } - bzero(&ispace, sizeof(ispace)); - bzero(&ospace, sizeof(ospace)); - - if (ioctl(fd, SNDCTL_DSP_GETISPACE, &ispace)) { - /* They don't support block size stuff, so just return but notify the user */ - fprintf(stderr, "Sound card won't let me know the input buffering...\n"); - } - if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &ospace)) { - /* They don't support block size stuff, so just return but notify the user */ - fprintf(stderr, "Sound card won't let me know the output buffering...\n"); - } - fprintf(stderr, "New input space: %d of %d %d byte fragments (%d bytes left)\n", - ispace.fragments, ispace.fragstotal, ispace.fragsize, ispace.bytes); - fprintf(stderr, "New output space: %d of %d %d byte fragments (%d bytes left)\n", - ospace.fragments, ospace.fragstotal, ospace.fragsize, ospace.bytes); - return fd; -} - -int pseudo_open(void) -{ - int fd; - int x = 1; - fd = open("/dev/zap/pseudo", O_RDWR); - if (fd < 0) { - fprintf(stderr, "Unable to open pseudo channel: %s\n", strerror(errno)); - return -1; - } - if (ioctl(fd, ZT_SETLINEAR, &x)) { - fprintf(stderr, "Unable to set linear mode: %s\n", strerror(errno)); - close(fd); - return -1; - } - x = BLOCK_SIZE; - if (ioctl(fd, ZT_SET_BLOCKSIZE, &x)) { - fprintf(stderr, "unable to set sane block size: %s\n", strerror(errno)); - close(fd); - return -1; - } - return fd; -} - -#define barlen 35 -#define baroptimal 3250 -//define barlevel 200 -#define barlevel ((baroptimal/barlen)*2) -#define maxlevel (barlen*barlevel) - -void draw_barheader() -{ - char bar[barlen+5]; - - memset(bar, '-', sizeof(bar)); - memset(bar, '<', 1); - memset(bar+barlen+2, '>', 1); - memset(bar+barlen+3, '\0', 1); - - zap_copy_string(bar+(barlen/2), "(RX)", 4); - printf("%s", bar); - - zap_copy_string(bar+(barlen/2), "(TX)", 4); - printf(" %s\n", bar); -} - -void draw_bar(int avg, int max) -{ - char bar[barlen+5]; - - memset(bar, ' ', sizeof(bar)); - - max /= barlevel; - avg /= barlevel; - if (avg > barlen) - avg = barlen; - if (max > barlen) - max = barlen; - - if (avg > 0) - memset(bar, '#', avg); - if (max > 0) - memset(bar + max, '*', 1); - - bar[barlen+1] = '\0'; - printf("%s", bar); - fflush(stdout); -} - -void visualize(short *tx, short *rx, int cnt) -{ - int x; - float txavg = 0; - float rxavg = 0; - static int txmax = 0; - static int rxmax = 0; - static int sametxmax = 0; - static int samerxmax = 0; - static int txbest = 0; - static int rxbest = 0; - float ms; - static struct timeval last; - struct timeval tv; - - gettimeofday(&tv, NULL); - ms = (tv.tv_sec - last.tv_sec) * 1000.0 + (tv.tv_usec - last.tv_usec) / 1000.0; - for (x=0;x txbest) - txbest = txavg; - if (rxavg > rxbest) - rxbest = rxavg; - - /* Update no more than 10 times a second */ - if (ms < 100) - return; - - /* Save as max levels, if greater */ - if (txbest > txmax) { - txmax = txbest; - sametxmax = 0; - } - if (rxbest > rxmax) { - rxmax = rxbest; - samerxmax = 0; - } - - memcpy(&last, &tv, sizeof(last)); - - /* Clear screen */ - printf("\r "); - draw_bar(rxbest, rxmax); - printf(" "); - draw_bar(txbest, txmax); - if (verbose) - printf(" Rx: %5d (%5d) Tx: %5d (%5d)", rxbest, rxmax, txbest, txmax); - txbest = 0; - rxbest = 0; - - /* If we have had the same max hits for x times, clear the values */ - sametxmax++; - samerxmax++; - if (sametxmax > 6) { - txmax = 0; - sametxmax = 0; - } - if (samerxmax > 6) { - rxmax = 0; - samerxmax = 0; - } -} - -int main(int argc, char *argv[]) -{ - int afd = -1; - int pfd[4] = {-1, -1, -1, -1}; - short buf_brx[BLOCK_SIZE * 2]; - short buf_tx[BLOCK_SIZE * 4]; - short stereobuf[BLOCK_SIZE * 4]; - int res_brx, res_tx; - int visual = 0; - int multichannel = 0; - int ossoutput = 0; - int preecho = 0; - int savefile = 0; - int stereo_output = 0; - int limit = 0; - int readcount = 0; - int x, chan; - struct zt_confinfo zc; - char opt; - extern char *optarg; - - if ((argc < 2) || (atoi(argv[1]) < 1)) { - fprintf(stderr, "Usage: ztmonitor [-v[v]] [-m] [-o] [-p] [-l limit] [-f FILE | -s FILE | -r FILE1 -t FILE2] [-F FILE | -S FILE | -R FILE1 -T FILE2]\n"); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -v: Visual mode. Implies -m.\n"); - fprintf(stderr, " -vv: Visual/Verbose mode. Implies -m.\n"); - fprintf(stderr, " -l LIMIT: Stop after reading LIMIT bytes\n"); - fprintf(stderr, " -m: Separate rx/tx streams.\n"); - fprintf(stderr, " -o: Output audio via OSS. Note: Only 'normal' combined rx/tx streams are output via OSS.\n"); - fprintf(stderr, " -f FILE: Save combined rx/tx stream to FILE. Cannot be used with -m.\n"); - fprintf(stderr, " -r FILE: Save rx stream to FILE. Implies -m.\n"); - fprintf(stderr, " -t FILE: Save tx stream to FILE. Implies -m.\n"); - fprintf(stderr, " -s FILE: Save stereo rx/tx stream to FILE. Implies -m.\n"); - fprintf(stderr, " -F FILE: Save combined pre-echocanceled rx/tx stream to FILE. Cannot be used with -m.\n"); - fprintf(stderr, " -R FILE: Save pre-echocanceled rx stream to FILE. Implies -m.\n"); - fprintf(stderr, " -T FILE: Save pre-echocanceled tx stream to FILE. Implies -m.\n"); - fprintf(stderr, " -S FILE: Save pre-echocanceled stereo rx/tx stream to FILE. Implies -m.\n"); - fprintf(stderr, "Examples:\n"); - fprintf(stderr, "Save a stream to a file\n"); - fprintf(stderr, " ztmonitor 1 -f stream.raw\n"); - fprintf(stderr, "Visualize an rx/tx stream and save them to separate files.\n"); - fprintf(stderr, " ztmonitor 1 -v -r streamrx.raw -t streamtx.raw\n"); - fprintf(stderr, "Play a combined rx/tx stream via OSS and save it to a file\n"); - fprintf(stderr, " ztmonitor 1 -o -f stream.raw\n"); - fprintf(stderr, "Save a combined normal rx/tx stream and a combined 'preecho' rx/tx stream to files\n"); - fprintf(stderr, " ztmonitor 1 -p -f stream.raw -F streampreecho.raw\n"); - fprintf(stderr, "Save a normal rx/tx stream and a 'preecho' rx/tx stream to separate files\n"); - fprintf(stderr, " ztmonitor 1 -m -p -r streamrx.raw -t streamtx.raw -R streampreechorx.raw -T streampreechotx.raw\n"); - exit(1); - } - - chan = atoi(argv[1]); - - while ((opt = getopt(argc, argv, "vmol:f:r:t:s:F:R:T:S:")) != -1) { - switch (opt) { - case '?': - exit(EXIT_FAILURE); - case 'v': - if (visual) - verbose = 1; - visual = 1; - multichannel = 1; - break; - case 'm': - multichannel = 1; - break; - case 'o': - ossoutput = 1; - break; - case 'l': - if (sscanf(optarg, "%d", &limit) != 1 || limit < 0) - limit = 0; - fprintf(stderr, "Will stop reading after %d bytes\n", limit); - break; - case 'f': - if (multichannel) { - fprintf(stderr, "'%c' mode cannot be used when multichannel mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_BRX]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_BRX] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing combined stream to %s\n", optarg); - break; - case 'F': - if (multichannel) { - fprintf(stderr, "'%c' mode cannot be used when multichannel mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_PRE_BRX]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing pre-echo combined stream to %s\n", optarg); - preecho = 1; - savefile = 1; - break; - case 'r': - if (!multichannel && ofh[MON_BRX]) { - fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_BRX]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_BRX] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing receive stream to %s\n", optarg); - multichannel = 1; - savefile = 1; - break; - case 'R': - if (!multichannel && ofh[MON_PRE_BRX]) { - fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_PRE_BRX]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing pre-echo receive stream to %s\n", optarg); - preecho = 1; - multichannel = 1; - savefile = 1; - break; - case 't': - if (!multichannel && ofh[MON_BRX]) { - fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_TX]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_TX] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing transmit stream to %s\n", optarg); - multichannel = 1; - savefile = 1; - break; - case 'T': - if (!multichannel && ofh[MON_PRE_BRX]) { - fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_PRE_TX]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_PRE_TX] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing pre-echo transmit stream to %s\n", optarg); - preecho = 1; - multichannel = 1; - savefile = 1; - break; - case 's': - if (!multichannel && ofh[MON_BRX]) { - fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_STEREO]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_STEREO] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing stereo stream to %s\n", optarg); - multichannel = 1; - savefile = 1; - break; - case 'S': - if (!multichannel && ofh[MON_PRE_BRX]) { - fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); - exit(EXIT_FAILURE); - } - if (ofh[MON_PRE_STEREO]) { - fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); - exit(EXIT_FAILURE); - } - if ((ofh[MON_PRE_STEREO] = fopen(optarg, "w")) < 0) { - fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - fprintf(stderr, "Writing pre-echo stereo stream to %s\n", optarg); - preecho = 1; - multichannel = 1; - savefile = 1; - break; - } - } - - if (ossoutput) { - if (multichannel) { - printf("Multi-channel audio is enabled. OSS output will be disabled.\n"); - ossoutput = 0; - } else { - /* Open audio */ - if ((afd = audio_open()) < 0) { - printf("Cannot open audio ...\n"); - ossoutput = 0; - } - } - } - if (!ossoutput && !multichannel && !savefile) { - fprintf(stderr, "Nothing to do with the stream(s) ...\n"); - exit(1); - } - - /* Open Pseudo device */ - if ((pfd[MON_BRX] = pseudo_open()) < 0) - exit(1); - if (multichannel && ((pfd[MON_TX] = pseudo_open()) < 0)) - exit(1); - if (preecho) { - if ((pfd[MON_PRE_BRX] = pseudo_open()) < 0) - exit(1); - if (multichannel && ((pfd[MON_PRE_TX] = pseudo_open()) < 0)) - exit(1); - } - /* Conference them */ - if (multichannel) { - memset(&zc, 0, sizeof(zc)); - zc.chan = 0; - zc.confno = chan; - /* Two pseudo's, one for tx, one for rx */ - zc.confmode = ZT_CONF_MONITOR; - if (ioctl(pfd[MON_BRX], ZT_SETCONF, &zc) < 0) { - fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); - exit(1); - } - memset(&zc, 0, sizeof(zc)); - zc.chan = 0; - zc.confno = chan; - zc.confmode = ZT_CONF_MONITORTX; - if (ioctl(pfd[MON_TX], ZT_SETCONF, &zc) < 0) { - fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); - exit(1); - } - if (preecho) { - memset(&zc, 0, sizeof(zc)); - zc.chan = 0; - zc.confno = chan; - /* Two pseudo's, one for tx, one for rx */ - zc.confmode = ZT_CONF_MONITOR_RX_PREECHO; - if (ioctl(pfd[MON_PRE_BRX], ZT_SETCONF, &zc) < 0) { - fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); - exit(1); - } - memset(&zc, 0, sizeof(zc)); - zc.chan = 0; - zc.confno = chan; - zc.confmode = ZT_CONF_MONITOR_TX_PREECHO; - if (ioctl(pfd[MON_PRE_TX], ZT_SETCONF, &zc) < 0) { - fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); - exit(1); - } - } - } else { - memset(&zc, 0, sizeof(zc)); - zc.chan = 0; - zc.confno = chan; - zc.confmode = ZT_CONF_MONITORBOTH; - if (ioctl(pfd[MON_BRX], ZT_SETCONF, &zc) < 0) { - fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); - exit(1); - } - if (preecho) { - memset(&zc, 0, sizeof(zc)); - zc.chan = 0; - zc.confno = chan; - zc.confmode = ZT_CONF_MONITORBOTH_PREECHO; - if (ioctl(pfd[MON_PRE_BRX], ZT_SETCONF, &zc) < 0) { - fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); - exit(1); - } - } - } - if (visual) { - printf("\nVisual Audio Levels.\n"); - printf("--------------------\n"); - printf(" Use zapata.conf file to adjust the gains if needed.\n\n"); - printf("( # = Audio Level * = Max Audio Hit )\n"); - draw_barheader(); - } - /* Now, copy from pseudo to audio */ - for (;;) { - res_brx = read(pfd[MON_BRX], buf_brx, sizeof(buf_brx)); - if (res_brx < 1) - break; - readcount += res_brx; - if (ofh[MON_BRX]) - fwrite(buf_brx, 1, res_brx, ofh[MON_BRX]); - - if (multichannel) { - res_tx = read(pfd[MON_TX], buf_tx, res_brx); - if (res_tx < 1) - break; - if (ofh[MON_TX]) - fwrite(buf_tx, 1, res_tx, ofh[MON_TX]); - - if (stereo_output && ofh[MON_STEREO]) { - for (x=0;x= limit) { - /* bail if we've read too much */ - break; - } - } - if (ofh[MON_BRX]) fclose(ofh[MON_BRX]); - if (ofh[MON_TX]) fclose(ofh[MON_TX]); - if (ofh[MON_PRE_BRX]) fclose(ofh[MON_PRE_BRX]); - if (ofh[MON_PRE_TX]) fclose(ofh[MON_PRE_TX]); - if (ofh[MON_STEREO]) fclose(ofh[MON_STEREO]); - if (ofh[MON_PRE_STEREO]) fclose(ofh[MON_PRE_STEREO]); - exit(0); -} diff --git a/zaptel/ztscan.c b/zaptel/ztscan.c deleted file mode 100644 index e526e833..00000000 --- a/zaptel/ztscan.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Scan and output information about Zaptel spans and ports. - * - * Written by Brandon Kruse - * and Kevin P. Fleming - * Copyright (C) 2007 Digium, Inc. - * - * Based on zttool written by Mark Spencer - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#else -#include -#endif - -int main(int argc, char *argv[]) -{ - int ctl; - int x, y; - struct zt_params params; - unsigned int basechan = 1; - struct zt_spaninfo s; - char buf[100]; - char alarms[50]; - - if ((ctl = open("/dev/zap/ctl", O_RDWR)) < 0) { - fprintf(stderr, "Unable to open /dev/zap/ctl: %s\n", strerror(errno)); - exit(1); - } - - for (x = 1; x < ZT_MAX_SPANS; x++) { - memset(&s, 0, sizeof(s)); - s.spanno = x; - if (ioctl(ctl, ZT_SPANSTAT, &s)) - continue; - - alarms[0] = '\0'; - if (s.alarms) { - if (s.alarms & ZT_ALARM_BLUE) - strcat(alarms,"BLU/"); - if (s.alarms & ZT_ALARM_YELLOW) - strcat(alarms, "YEL/"); - if (s.alarms & ZT_ALARM_RED) - strcat(alarms, "RED/"); - if (s.alarms & ZT_ALARM_LOOPBACK) - strcat(alarms,"LB/"); - if (s.alarms & ZT_ALARM_RECOVER) - strcat(alarms,"REC/"); - if (s.alarms & ZT_ALARM_NOTOPEN) - strcat(alarms, "NOP/"); - if (!strlen(alarms)) - strcat(alarms, "UUU/"); - if (strlen(alarms)) { - /* Strip trailing / */ - alarms[strlen(alarms)-1]='\0'; - } - } else { - if (s.numchans) - strcpy(alarms, "OK"); - else - strcpy(alarms, "UNCONFIGURED"); - } - - fprintf(stdout, "[%d]\n", x); - fprintf(stdout, "active=yes\n"); - fprintf(stdout, "alarms=%s\n", alarms); - fprintf(stdout, "description=%s\n", s.desc); - fprintf(stdout, "name=%s\n", s.name); - fprintf(stdout, "manufacturer=%s\n", s.manufacturer); - fprintf(stdout, "devicetype=%s\n", s.devicetype); - fprintf(stdout, "location=%s\n", s.location); - fprintf(stdout, "basechan=%d\n", basechan); - fprintf(stdout, "totchans=%d\n", s.totalchans); - fprintf(stdout, "irq=%d\n", s.irq); - y = basechan; - memset(¶ms, 0, sizeof(params)); - params.channo = y; - if (ioctl(ctl, ZT_GET_PARAMS, ¶ms)) { - basechan += s.totalchans; - continue; - } - - if (params.sigcap & (__ZT_SIG_DACS | ZT_SIG_CAS)) { - /* this is a digital span */ - fprintf(stdout, "type=digital-%s\n", s.spantype); - fprintf(stdout, "syncsrc=%d\n", s.syncsrc); - fprintf(stdout, "lbo=%s\n", s.lboname); - fprintf(stdout, "coding_opts="); - buf[0] = '\0'; - if (s.linecompat & ZT_CONFIG_B8ZS) strcat(buf, "B8ZS,"); - if (s.linecompat & ZT_CONFIG_AMI) strcat(buf, "AMI,"); - if (s.linecompat & ZT_CONFIG_HDB3) strcat(buf, "HDB3,"); - buf[strlen(buf) - 1] = '\0'; - fprintf(stdout, "%s\n", buf); - fprintf(stdout, "framing_opts="); - buf[0] = '\0'; - if (s.linecompat & ZT_CONFIG_ESF) strcat(buf, "ESF,"); - if (s.linecompat & ZT_CONFIG_D4) strcat(buf, "D4,"); - if (s.linecompat & ZT_CONFIG_CCS) strcat(buf, "CCS,"); - if (s.linecompat & ZT_CONFIG_CRC4) strcat(buf, "CRC4,"); - buf[strlen(buf) - 1] = '\0'; - fprintf(stdout, "%s\n", buf); - fprintf(stdout, "coding="); - if (s.lineconfig & ZT_CONFIG_B8ZS) fprintf(stdout, "B8ZS"); - else if (s.lineconfig & ZT_CONFIG_AMI) fprintf(stdout, "AMI"); - else if (s.lineconfig & ZT_CONFIG_HDB3) fprintf(stdout, "HDB3"); - fprintf(stdout, "\n"); - fprintf(stdout, "framing="); - if (s.lineconfig & ZT_CONFIG_ESF) fprintf(stdout, "ESF"); - else if (s.lineconfig & ZT_CONFIG_D4) fprintf(stdout, "D4"); - else if (s.lineconfig & ZT_CONFIG_CCS) fprintf(stdout, "CCS"); - else if (s.lineconfig & ZT_CONFIG_CRC4) fprintf(stdout, "/CRC4"); - fprintf(stdout, "\n"); - } else { - /* this is an analog span */ - fprintf(stdout, "type=analog\n"); - for (y = basechan; y < (basechan + s.totalchans); y++) { - memset(¶ms, 0, sizeof(params)); - params.channo = y; - if (ioctl(ctl, ZT_GET_PARAMS, ¶ms)) { - fprintf(stdout, "port=%d,unknown\n", y); - continue; - }; - fprintf(stdout, "port=%d,", y); - switch (params.sigcap & (__ZT_SIG_FXO | __ZT_SIG_FXS)) { - case __ZT_SIG_FXO: - fprintf(stdout, "FXS"); - break; - case __ZT_SIG_FXS: - fprintf(stdout, "FXO"); - break; - default: - fprintf(stdout, "none"); - } - if (params.sigcap & ZT_SIG_BROKEN) - fprintf(stdout, " FAILED"); - fprintf(stdout, "\n"); - } - } - - basechan += s.totalchans; - } - - exit(0); -} diff --git a/zaptel/ztspeed.c b/zaptel/ztspeed.c deleted file mode 100644 index 045d2b37..00000000 --- a/zaptel/ztspeed.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/* - * - * Generic speed test -- Run an infinite loop and - * see how high we can count (in 5 seconds). You - * can use this to measure how much CPU zaptel REALLY - * is taking. - * - * MUST BE COMPILED WITHOUT OPTIMIZATION - * - */ - -#include -#include -#include -#include - -static long count=0; - -static void alm(int sig) -{ - printf("Count: %ld\n", count); - exit(0); -} - - -int main(int argc, char *argv[]) -{ - int a=0,b=0,c; - signal(SIGALRM, alm); - alarm(5); - for (;;) { - for (c=0;c<1000;c++) - a = a * b; - count++; - } -} diff --git a/zaptel/zttest.c b/zaptel/zttest.c deleted file mode 100644 index 83df64a7..00000000 --- a/zaptel/zttest.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SIZE 8000 - -static int pass = 0; -static float best = 0.0; -static float worst = 100.0; -static double total = 0.0; -static double delay_total = 0.0; - -void hup_handler(int sig) -{ - printf("\n--- Results after %d passes ---\n", pass); - printf("Best: %.3f -- Worst: %.3f -- Average: %f, Difference: %f\n", - best, worst, pass ? total/pass : 100.00, pass ? delay_total/pass : 100); - exit(0); -} - -static void usage(char *argv0) -{ - char *c; - c = strrchr(argv0, '/'); - if (!c) - c = argv0; - else - c++; - fprintf(stderr, - "Usage: %s [-c COUNT] [-v]\n" - " Valid options are:\n" - " -c COUNT Run just COUNT cycles (otherwise: forever).\n" - " -v More verbose output.\n" - " -h This help text.\n" - ,c); -} - -int main(int argc, char *argv[]) -{ - int fd; - int res; - int c; - int count=0; - int seconds = 0; - int curarg = 1; - int verbose=0; - char buf[8192]; - float score; - float ms; - struct timeval start, now; - fd = open("/dev/zap/pseudo", O_RDWR); - if (fd < 0) { - fprintf(stderr, "Unable to open zap interface: %s\n", strerror(errno)); - exit(1); - } - - while((c = getopt(argc, argv, "c:hv")) != -1) { - switch(c) { - case 'c': - seconds = atoi(optarg); - break; - case 'h': - usage(argv[0]); - exit(0); - break; - case '?': - usage(argv[0]); - exit(1); - break; - case 'v': - verbose++; - break; - } - } - while(curarg < argc) { - if (!strcasecmp(argv[curarg], "-v")) - verbose++; - if (!strcasecmp(argv[curarg], "-c") && argc > curarg) - seconds = atoi(argv[curarg + 1]); - curarg++; - } - printf("Opened pseudo zap interface, measuring accuracy...\n"); - signal(SIGHUP, hup_handler); - signal(SIGINT, hup_handler); - signal(SIGALRM, hup_handler); - /* Flush input buffer */ - for (count = 0;count < 4; count++) - res = read(fd, buf, sizeof(buf)); - count = 0; - ms = 0; /* Makes the compiler happy */ - if (seconds > 0) - alarm(seconds + 1); /* This will give 'seconds' cycles */ - for(;;) { - if (count == 0) - ms = 0; - gettimeofday(&start, NULL); - res = read(fd, buf, sizeof(buf)); - if (res < 0) { - fprintf(stderr, "Failed to read from pseudo interface: %s\n", strerror(errno)); - exit(1); - } - count += res; - gettimeofday(&now, NULL); - ms += (now.tv_sec - start.tv_sec) * 8000; - ms += (now.tv_usec - start.tv_usec) / 125.0; - if (count >= SIZE) { - double percent; - - percent = 100.0 * (count - ms) / count; - if (verbose) - printf("\n%d zaptel samples in %0.3f system clock sample intervals (%.3f%%)", - count, ms, 100 - percent); - else if ((pass % 8) == 7) printf("\n"); - score = 100.0 - fabs(percent); - if (score > best) - best = score; - if (score < worst) - worst = score; - if (!verbose) - printf("%f%% ", score); - total += score; - delay_total += 100 - percent; - fflush(stdout); - count = 0; - pass++; - } - } -} diff --git a/zaptel/zttool.c b/zaptel/zttool.c deleted file mode 100644 index f6376381..00000000 --- a/zaptel/zttool.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Configuration program for Zapata Telephony Interface - * - * Written by Mark Spencer - * Based on previous works, designs, and architectures conceived and - * written by Jim Dixon . - * - * Copyright (C) 2001 Jim Dixon / Zapata Telephony. - * Copyright (C) 2001 Linux Support Services, Inc. - * - * All rights reserved. - * - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - */ - -/*** MODULEINFO - newt - ***/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef STANDALONE_ZAPATA -#include "kernel/zaptel.h" -#include "tonezone.h" -#else -#include -#include -#endif - -static int ctl = -1; -static int span_max_chan_pos; - -static ZT_SPANINFO s[ZT_MAX_SPANS]; - -static char *zt_txlevelnames[] = { -"0 db (CSU)/0-133 feet (DSX-1)", -"133-266 feet (DSX-1)", -"266-399 feet (DSX-1)", -"399-533 feet (DSX-1)", -"533-655 feet (DSX-1)", -"-7.5db (CSU)", -"-15db (CSU)", -"-22.5db (CSU)" -} ; - -static char *alarmstr(int span) -{ - static char alarms[80]; - strcpy(alarms, ""); - if (s[span].alarms > 0) { - if (s[span].alarms & ZT_ALARM_BLUE) - strcat(alarms,"Blue Alarm/"); - if (s[span].alarms & ZT_ALARM_YELLOW) - strcat(alarms, "Yellow Alarm/"); - if (s[span].alarms & ZT_ALARM_RED) - strcat(alarms, "Red Alarm/"); - if (s[span].alarms & ZT_ALARM_LOOPBACK) - strcat(alarms,"Loopback/"); - if (s[span].alarms & ZT_ALARM_RECOVER) - strcat(alarms,"Recovering/"); - if (s[span].alarms & ZT_ALARM_NOTOPEN) - strcat(alarms, "Not Open/"); - if (!strlen(alarms)) - strcat(alarms, "/"); - if (strlen(alarms)) { - /* Strip trailing / */ - alarms[strlen(alarms)-1]='\0'; - } - } else - strcpy(alarms, "No alarms."); - return alarms; -} - -static char *getalarms(int span, int err) -{ - int res; - static char tmp[256]; - char alarms[50]; - s[span].spanno = span; - res = ioctl(ctl, ZT_SPANSTAT, &s[span]); - if (res) { - if (err) - fprintf(stderr, "Unable to get span info on span %d: %s\n", span, strerror(errno)); - return NULL; - } - strcpy(alarms, ""); - if (s[span].alarms > 0) { - if (s[span].alarms & ZT_ALARM_BLUE) - strcat(alarms,"BLU/"); - if (s[span].alarms & ZT_ALARM_YELLOW) - strcat(alarms, "YEL/"); - if (s[span].alarms & ZT_ALARM_RED) - strcat(alarms, "RED/"); - if (s[span].alarms & ZT_ALARM_LOOPBACK) - strcat(alarms,"LB/"); - if (s[span].alarms & ZT_ALARM_RECOVER) - strcat(alarms,"REC/"); - if (s[span].alarms & ZT_ALARM_NOTOPEN) - strcat(alarms, "NOP/"); - if (!strlen(alarms)) - strcat(alarms, "UUU/"); - if (strlen(alarms)) { - /* Strip trailing / */ - alarms[strlen(alarms)-1]='\0'; - } - } else { - if (s[span].numchans) - strcpy(alarms, "OK"); - else - strcpy(alarms, "UNCONFIGURED"); - } - - snprintf(tmp, sizeof(tmp), "%-15s %s", alarms, s[span].desc); - return tmp; -} - -static void add_cards(newtComponent spans) -{ - int x; - char *s; - void *prev=NULL; - - if (spans) - prev = newtListboxGetCurrent(spans); - newtListboxClear(spans); - for (x=0;x -1)) { - if (zp.rxbits & ZT_ABIT) - rabits[zp.chanpos - 1] = '1'; - else - rabits[zp.chanpos - 1] = '0'; - if (zp.rxbits & ZT_BBIT) - rbbits[zp.chanpos - 1] = '1'; - else - rbbits[zp.chanpos - 1] = '0'; - - if (zp.rxbits & ZT_CBIT) - rcbits[zp.chanpos - 1] = '1'; - else - rcbits[zp.chanpos - 1] = '0'; - if (zp.rxbits & ZT_DBIT) - rdbits[zp.chanpos - 1] = '1'; - else - rdbits[zp.chanpos - 1] = '0'; - - if (zp.txbits & ZT_ABIT) - tabits[zp.chanpos - 1] = '1'; - else - tabits[zp.chanpos - 1] = '0'; - if (zp.txbits & ZT_BBIT) - tbbits[zp.chanpos - 1] = '1'; - else - tbbits[zp.chanpos - 1] = '0'; - if (zp.txbits & ZT_CBIT) - tcbits[zp.chanpos - 1] = '1'; - else - tcbits[zp.chanpos - 1] = '0'; - if (zp.txbits & ZT_DBIT) - tdbits[zp.chanpos - 1] = '1'; - else - tdbits[zp.chanpos - 1] = '0'; - } else { - c = '-'; - if (!zp.sigtype) - c = ' '; - tabits[zp.chanpos - 1] = c; - tbbits[zp.chanpos - 1] = c; - tcbits[zp.chanpos - 1] = c; - tdbits[zp.chanpos - 1] = c; - rabits[zp.chanpos - 1] = c; - rbbits[zp.chanpos - 1] = c; - rcbits[zp.chanpos - 1] = c; - rdbits[zp.chanpos - 1] = c; - } - if (zp.rxisoffhook) - use++; - } - } - } - snprintf(tmp, sizeof(tmp), "%s\n%s\n%s\n%s\n\n%s\n%s\n%s\n%s", tabits, tbbits,tcbits,tdbits,rabits,rbbits,rcbits,rdbits); - newtTextboxSetText(bitbox, tmp); - sprintf(tmp, "%3d/%3d/%3d", s[span].totalchans, s[span].numchans, use); - newtTextboxSetText(inuse, tmp); - sprintf(tmp, "%s/", zt_txlevelnames[s[span].txlevel]); - strcat(tmp, zt_txlevelnames[s[span].rxlevel]); - sprintf(tmp, "%3d/%3d", s[span].txlevel, s[span].rxlevel); - newtTextboxSetText(levels, tmp); - sprintf(tmp, "%7d", s[span].bpvcount); - newtTextboxSetText(bpvcount, tmp); - sprintf(tmp, "%7d", s[span].irqmisses); - newtTextboxSetText(irqmisses, tmp); - newtTextboxSetText(alarms, alarmstr(span)); - if (s[span].syncsrc > 0) - strcpy(tmp, s[s[span].syncsrc].desc); - else - strcpy(tmp, "Internally clocked"); - newtTextboxSetText(syncsrc, tmp); - - -} - -static void do_loop(int span, int looped) -{ - newtComponent form; - newtComponent label; - char s1[256]; - struct zt_maintinfo m; - int res; - struct newtExitStruct es; - - newtOpenWindow(20,12,40,4, s[span].desc); - - form = newtForm(NULL, NULL, 0); - m.spanno = span; - if (looped) { - snprintf(s1, sizeof(s1), "Looping UP span %d...\n", span); - m.command = ZT_MAINT_LOOPUP; - } else { - snprintf(s1, sizeof(s1), "Looping DOWN span %d...\n", span); - m.command = ZT_MAINT_LOOPDOWN; - } - - label = newtLabel(3,1,s1); - newtFormAddComponent(form, label); - newtPushHelpLine("Please wait..."); - - newtFormSetTimer(form, 200); - newtFormRun(form, &es); - res = ioctl(ctl, ZT_MAINT, &m); - newtFormDestroy(form); - newtPopWindow(); - newtPopHelpLine(); -} - -static newtComponent spans; -static void show_span(int span) -{ - newtComponent form; - newtComponent back; - newtComponent loop; - newtComponent label; - newtComponent bitbox; - newtComponent inuse; - newtComponent levels; - newtComponent bpvcount; - newtComponent alarms; - newtComponent syncsrc; - newtComponent irqmisses; - - char s1[] = " 1111111111222222222233"; - char s2[] = "1234567890123456789012345678901"; - int x; - int looped = 0; - struct newtExitStruct es; - - void *ss; - char info2[256]; - - if (span < 0) { - /* Display info on a span */ - ss = newtListboxGetCurrent(spans); - if (ss) { - span = (long)(ss); - } - } - - snprintf(info2, sizeof(info2), "%-59s F10=Back", s[span].desc); - newtOpenWindow(10,2,60,20, s[span].desc); - newtPushHelpLine(info2); - - back = newtButton(48,8,"Back"); - loop = newtButton(48,14,"Loop"); - form = newtForm(NULL, NULL, 0); - - newtFormAddComponents(form, back, loop, NULL); - - span_max_chan_pos = s[span].totalchans; - for (x=0;x span_max_chan_pos ) - span_max_chan_pos = zp.chanpos; - } - - if (span_max_chan_pos > 32) - span_max_chan_pos = 32; - - s1[span_max_chan_pos] = '\0'; - s2[span_max_chan_pos] = '\0'; - - bitbox = newtTextbox(8,10,span_max_chan_pos,9,0); - newtFormAddComponent(form, bitbox); - - label = newtLabel(8,8,s1); - newtFormAddComponent(form, label); - - label = newtLabel(8,9,s2); - newtFormAddComponent(form, label); - - newtFormAddHotKey(form, NEWT_KEY_F10); - newtFormSetTimer(form, 200); - - label = newtLabel(4,10,"TxA"); - newtFormAddComponent(form, label); - - label = newtLabel(4,11,"TxB"); - newtFormAddComponent(form, label); - - label = newtLabel(4,12,"TxC"); - newtFormAddComponent(form, label); - - label = newtLabel(4,13,"TxD"); - newtFormAddComponent(form, label); - - label = newtLabel(4,15,"RxA"); - newtFormAddComponent(form, label); - - label = newtLabel(4,16,"RxB"); - newtFormAddComponent(form, label); - - label = newtLabel(4,17,"RxC"); - newtFormAddComponent(form, label); - - label = newtLabel(4,18,"RxD"); - newtFormAddComponent(form, label); - - - label = newtLabel(4,7,"Total/Conf/Act: "); - newtFormAddComponent(form, label); - - inuse = newtTextbox(24,7,12,1,0); - newtFormAddComponent(form, inuse); - - label = newtLabel(4,6,"Tx/Rx Levels: "); - newtFormAddComponent(form, label); - - levels = newtTextbox(24,6,30,1,0); - newtFormAddComponent(form, levels); - - label = newtLabel(4,5,"Bipolar Viol: "); - newtFormAddComponent(form, label); - - bpvcount = newtTextbox(24,5,30,1,0); - newtFormAddComponent(form, bpvcount); - - label = newtLabel(4,4,"IRQ Misses: "); - newtFormAddComponent(form, label); - - irqmisses = newtTextbox(24,4,30,1,0); - newtFormAddComponent(form, irqmisses); - - label = newtLabel(4,3,"Sync Source: "); - newtFormAddComponent(form, label); - - syncsrc = newtTextbox(24,3,30,1,0); - newtFormAddComponent(form, syncsrc); - - label = newtLabel(4,2,"Current Alarms: "); - newtFormAddComponent(form, label); - - alarms = newtTextbox(24,2,30,1,0); - newtFormAddComponent(form, alarms); - - for(;;) { - /* Wait for user to select something */ - do { - add_cards(NULL); - show_bits(span, bitbox, inuse, levels, bpvcount, alarms, syncsrc, irqmisses); - newtFormRun(form, &es); - } while(es.reason == NEWT_EXIT_TIMER); - switch(es.reason) { - case NEWT_EXIT_COMPONENT: - if (es.u.co == loop) { - looped = !looped; - do_loop(span, looped); - newtFormSetTimer(form, 200); - } - if (es.u.co == back) { - goto out; - } - break; - case NEWT_EXIT_HOTKEY: - switch(es.u.key) { -#if 0 - case NEWT_KEY_F1: - show_span(-1); - break; -#endif - case NEWT_KEY_F10: - goto out; - } - break; - default: - break; - } - } - -out: - newtFormDestroy(form); - newtPopWindow(); - newtPopHelpLine(); - span_max_chan_pos = 0; -} - -static void show_spans(void) -{ - newtComponent form; - newtComponent quit; - newtComponent label; - newtComponent sel; - - - struct newtExitStruct es; - - - quit = newtButton(50,14,"Quit"); - sel = newtButton(10,14,"Select"); - - spans = newtListbox(5, 2, 10, NEWT_FLAG_SCROLL); - newtListboxSetWidth(spans, 65); - - label = newtLabel(5,1,"Alarms Span"); - - newtCenteredWindow(72,18, "Zapata Telephony Interfaces"); - form = newtForm(NULL, NULL, 0); - - newtFormSetTimer(form, 200); - - newtFormAddComponents(form, spans, sel, quit, label, NULL); - - newtComponentAddCallback(spans, sel_callback, NULL); - - newtFormAddHotKey(form, NEWT_KEY_F1); - newtFormAddHotKey(form, NEWT_KEY_F10); - - for(;;) { - /* Wait for user to select something */ - do { - add_cards(spans); - newtFormRun(form, &es); - } while(es.reason == NEWT_EXIT_TIMER); - - switch(es.reason) { - case NEWT_EXIT_COMPONENT: - if (es.u.co == quit) { - /* Quit if appropriate */ - newtFormDestroy(form); - return; - } else if (es.u.co == sel) { - show_span(-1); - } - break; - case NEWT_EXIT_HOTKEY: - switch(es.u.key) { - case NEWT_KEY_F1: - show_span(-1); - break; - case NEWT_KEY_F10: - newtFormDestroy(form); - return; - } - break; - default: - break; - } - } -} - -static void cleanup(void) -{ - newtPopWindow(); -} - -int main(int argc, char *argv[]) -{ - - ctl = open("/dev/zap/ctl", O_RDWR); - if (ctl < 0) { - fprintf(stderr, "Unable to open /dev/zap/ctl: %s\n", strerror(errno)); - exit(1); - } - newtInit(); - newtCls(); - - newtDrawRootText(0,0,"Zaptel Tool (C)2002 Linux Support Services, Inc."); - newtPushHelpLine("Welcome to the Zaptel Tool!"); - show_spans(); - cleanup(); - newtFinished(); - return 0; -} From bb0e7a55a6020cb66809a57cf49826ef6b93a3ee Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Wed, 8 Mar 2017 10:45:41 -0500 Subject: [PATCH 07/96] Update makefile --- asterisk/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/asterisk/Makefile b/asterisk/Makefile index 1db2220e..34fe6bbb 100644 --- a/asterisk/Makefile +++ b/asterisk/Makefile @@ -258,13 +258,13 @@ endif ASTERISKVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .) -ifneq ($(wildcard .version),) - ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version) -endif +# ifneq ($(wildcard .version),) +# ASTERISKVERSIONNUM:=$(shell $(AWK) -F. '{printf "%01d%02d%02d", $$1, $$2, $$3}' .version) +# endif -ifneq ($(wildcard .svn),) - ASTERISKVERSIONNUM=999999 -endif +# ifneq ($(wildcard .svn),) +# ASTERISKVERSIONNUM=999999 +# endif ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS) @@ -674,7 +674,7 @@ config: if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ elif [ -f /etc/debian_version ]; then \ $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \ - if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \ + if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 0 1 6 .; fi; \ elif [ -f /etc/gentoo-release ]; then \ $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \ if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \ From 6e712fead4711ce18c96efa05075e132d69d2e5f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 8 Mar 2017 15:42:32 -0500 Subject: [PATCH 08/96] Add support for systemd --- asterisk/Makefile | 11 +++++--- asterisk/contrib/systemd/asterisk.service | 27 +++++++++++++++++++ .../contrib/systemd/updatenodelist.service | 20 ++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 asterisk/contrib/systemd/asterisk.service create mode 100644 asterisk/contrib/systemd/updatenodelist.service diff --git a/asterisk/Makefile b/asterisk/Makefile index 34fe6bbb..15889cb2 100644 --- a/asterisk/Makefile +++ b/asterisk/Makefile @@ -672,9 +672,14 @@ config: if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \ $(INSTALL) -m 755 contrib/init.d/rc.redhat.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \ if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ - elif [ -f /etc/debian_version ]; then \ - $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \ - if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 0 1 6 .; fi; \ + elif [ -f /etc/debian_version ] && [ -f /etc/systemd/system.conf ]; then \ + $(INSTALL) -m 755 contrib/systemd/asterisk.service $(DESTDIR)/lib/systemd/system/asterisk.service; \ + $(INSTALL) -m 755 contrib/systemd/updatenodelist.service $(DESTDIR)/lib/systemd/system/updatenodelist.service; \ + if [ -z "$(DESTDIR)" ]; then /bin/systemctl enable asterisk.service; fi; \ + if [ -z "$(DESTDIR)" ]; then /bin/systemctl enable updatenodelist.service; fi; \ + elif [ -f /etc/debian_version ] && [ ! -f /etc/systemd/system.conf ]; then \ + $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \ + if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 0 1 6 .; fi; \ elif [ -f /etc/gentoo-release ]; then \ $(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \ if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \ diff --git a/asterisk/contrib/systemd/asterisk.service b/asterisk/contrib/systemd/asterisk.service new file mode 100644 index 00000000..8e9837e9 --- /dev/null +++ b/asterisk/contrib/systemd/asterisk.service @@ -0,0 +1,27 @@ +#/usr/lib/systemd/system/asterisk.service +[Unit] +Description=Asterisk PBX and telephony daemon +Documentation=man:asterisk(8) +Wants=network.target +After=network.target +BindsTo=dev-dahdi-pseudo.device +# Below requires a addition to udev rules +# See /srv//patches/patch-dahdi.rules +After=dev-dahdi-pseudo.device + + +[Service] +Type=simple +StandardOutput=null +ExecStart=/usr/sbin/asterisk -g -f -C /etc/asterisk/asterisk.conf +ExecStop=/usr/sbin/asterisk -rx 'stop now' +ExecReload=/usr/sbin/asterisk -rx 'module reload' + +# safe_asterisk emulation +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target + + diff --git a/asterisk/contrib/systemd/updatenodelist.service b/asterisk/contrib/systemd/updatenodelist.service new file mode 100644 index 00000000..7ca5a239 --- /dev/null +++ b/asterisk/contrib/systemd/updatenodelist.service @@ -0,0 +1,20 @@ +#/usr/lib/systemd/system/updatenodelist.service +[Unit] +Description=AllStar NodeList updater +Wants=network.target +After=network-online.target +BindsTo=asterisk.service + +[Service] +Type=simple +StandardOutput=null +ExecStart=/usr/local/bin/rc.updatenodelist & +ExecStop=/usr/bin/killall -9 rc.updatenodelist + +# safe_emulation +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target + From 60f64586aa75aaf0a5502c00cc6c0949081066da Mon Sep 17 00:00:00 2001 From: Steve Zingman Date: Thu, 9 Mar 2017 11:08:54 -0500 Subject: [PATCH 09/96] feature/add_allstar_node_enabled_sound --- sounds/rpt/node_enabled.ulaw | 1 + 1 file changed, 1 insertion(+) create mode 100644 sounds/rpt/node_enabled.ulaw diff --git a/sounds/rpt/node_enabled.ulaw b/sounds/rpt/node_enabled.ulaw new file mode 100644 index 00000000..a6a0cb12 --- /dev/null +++ b/sounds/rpt/node_enabled.ulaw @@ -0,0 +1 @@ +~~~}~~}}}}}~~~~~~~~}}}~}}~~~~~}}}}}}~~~~~}}}~~~~~~~~}~~~~~~~~}}}~~}~~~~~~}~~~~~~~}}}}}}}~~~~~~~~~}}}~~~~~~~~}~~~~~~~~~~}~~~~~~~~}~}}}~||}~|{|~~}}~~~~~|}}|}~iepQ@98:A>9/+.;R"ȝC..B­C+$/51+*]Z+$*LJ0.9^xC637EPQ:," (~2#L9-6\oN<305:=4+" &E3 $B?07SnO;0,.3:5-%!!'L652!!/̫D(!'9;+#"%-:A;ίA:=IʾL3++/9=7*'.ާ2.AF57IUE:41232-&(;?*,L:/1@`>4//263-.<èl53P8-1GоxSC930013209uB2;ۯO63:K`D:30/.,)-F;')D5)*4ZǼpC81///.+/JF*)**?O3.6EzK7+'$$,LI/-?~:15>SQ;-(%'/M|;6AϱH86OxnF7,'$&0󫟝>/3WZ;5:C_A0&" $5-'-VQ6/2;QA.#$73+/MA417F>,"&8>5:ZĴPC?ALo[=-&!!-դ=-/?ɰB2/2?r@,"&8H;>XͺXA99>QY:*#!/ȢI34AеP3,,6R:&%K\96Bظd90/9OE-"!+UOBH\νW:34Zɳ;.,0>i>+"&6~_̼L935=KZR?2*&%(6حY=547A>7/+)+/BαkJ?:::<<:6/-,.8IϹWG@=<:99864369?KȸkLB=;778::::::;>IiǷfL@<979;>?=:99=DKNzҾxNC==??>??@?<9>HLLLNlq[TLH?<::;@84/.;ZηH/& "+͠>53)!5Y]ȸM?SԾB.+)&% ?k/9ȪF/,?X.%%'))$%5¦fٳF9:K״F6/11-$AIg_JҮU:̯>578<93("KZb^ū;57SɽYF?;813+%N]AIQ=31YxIF<>A:9*+ȣDgBUȶO7+(*+&#)c46ep^Ŷ]iO9-)&"%ʟ7/FJU˸fA721/+ !-)DCEٺ=/-.+$/)*T{M~\C/)('",+&>ķb_:-**(!)((H˽W6+*-)1,*DǶx޿:+)+)#&ƥ80>ȲŶʷ8+),-+"$N99cŹH6/./2(*s08ׯɾJ2-...+!;,,MϺüL2*))(%Ÿbֿ|O:,))*++)('""')/=OX̸]?HW]H?NO;-&'/0*'')+(#%+2<=>̪hccJ>NŷK=Cb[BJH8741,(&%(+)&(,..0:åEIgL78̫^203.(+BY.'++# *:<.'*5;2ǖڬMW@-4̯DC?.'/YSXV9,)),37335-'(4g?=̬mL8/7ܳkN<-(+6A@><4+$$+10..12-*6NTOXPKLONH?==>>2%"''#"$''+9_ϪK9:=:4/9Y* %%#"'//$ (6>ХD;<:204Ab'#%%.- 3N:њt;./41-2NB( $'$#)$%:JGK;;:0(';2';%'&  2N;OٿXFP-%*3.&&,,!'("%#(9ذ?..,*,*#(-$"(&#$&(*)-;RG>6571-+(%" &.HλJ;2-+(# '3Zg@5.+(&"%.Jű[@5.+)&# ")6Xñ\B70.+'#$-<溬V?71-($ '0IʲpK=5.)$'0JȲZD:2-($ '0H̴YA82-)$  '/GʹN>6/+'" &.CҷJ;4/,($ &->ẬYA94.*%"$+6SïU?84/*&#")0DͳoH<6/+($!$+7fL=5/-)%"!(/?޷wK>61,+&# ")1Jӷ^B=6/.&%.)"'ɰȸǸ671% (0=H8+)++ $" %'(',.06K៖WAa1B̿rG=K-*-.!%(),!,41;YK<<<.)-( ! &$*47IiZMI@D5.1-"!#+!!;K=J5ҲSְM;md/-I:($((% $249TY۹徼=HkF067-%$#  !%,1=JھP7>G>41-*%#&,:JV9/6D=,%(&!)8븣M?8323,%!!(8ȺfF91/,'!#*Ab=3/+&###$" #)0>̨iALqfSVӶM1$$*LOG@98vA6/,-5N͹:*" ,ML9.+,2B?.%#1ҭI2*().8HܼE1&)G8+&$'*0?๯O1&%6hD-'#"#'-CμD.& "->:.("!"'2InɺU8-%""$-8HU:-#!%+8>Pƽl=8,%%'-7?װE/%!!%)-5GN;/(")953n]:--/2;LWoL>6/+)(*.49JT@80-+*)*+-/59>DIQexVG?<:8765311/../026;DSʽyUF;3.*'%##$%(,4=M̽XA7.($! !$'-4>Q¶rF7.*&"  $*0:KȻaI<3.+(&# #'.8GaSD;3.+'&&)09NǭA5.(#!1A( HG& #ϞJϮKD16U6-49$&) )0.(1N85JǴ/)*-*)?µuB8*&!&'+1;JP>,)&,00Zþ<2:#""#,2NꞕU6,)%44/ѵ<,) #+46I>/3;8;]źL50&#&,:SަL6.+364SȼU1)!!)/4AŻ945774RZ67*$&*7GܻOAEIFFfuB1,%!"#&*.5831/,*'$!!$(.?óQ>5.*(%#  $*6sXC:1,)'%!#+9_R=6/,)%"&2MغwK;1-+)&$"  (8[˸eF90,(%"'0B۹^?5.+(%" $0Iݼ`D92.+(&$!'4MջN<2.+(%" '1A纮gH:1-*'%" &3BTD80-*)&#!(8CҮM?7,)*$ E_N4,+(%+1-171-,+(')#קf¸mK7530-6>2:8-,*%"$&&ʥŬ诶<04/3;7=4/,%$#!9QݥN>4/.,4;5=9/,($ #$#ƥֱĺ²^~>04439;>971+*(! #!*(̹w^R9/:83A=93/,&#""!#ŷVvL;5::2>7.2,('" ! )&צa~HF=6;442.-*'%!ϪN\кiC;87/62-0-**%#\ۛlnƻ_L<70/-+,+()%" ϯĘUNxIx^8<2++)()$%$ *.꬯`HNAn˳V?5/)')'#&%"! ""ίeD@2>GN¼d;3+'$!!!! %%ҫK?/7<<ŷD1+%" &(ͫ[@1264VijN0+' '*ʩk?/./,<DNc^G<5/-,,-06=Nʽ`MA:50.,,,-/37=CL[zZI>952////259=BGNRTUTRSV[jjQHA>=<=>@CGJKLID?;86446:?Lkúub\WVZYZZTMGA=96422359U;/1A϶W6**4Kf>*)57/*,6tN<3/7Kѽ^<.))1MK/&%).22.,+-H];13CҺYEFUWD5.0@ϸ|/#$-44.**2[n@747>X\=21=ݷM-# #&(,4?IRd:;DMIAFgǻuPO_iXG>A\̿?) &,//03>XWOQaULI]м\D@DHGA>@ME1'""%)-26889<ϧ|U^|SC@JZB>DNSJ?;=EZ\=.& #+5>CDGԬjQZ`[SYȿP>;Of^l^ZSa[MIFB<7228I>,"%.9><87?_k_LBDNmMB=<:6337?TzI2(""&.:CD;65Aݮ\nzx[RNU_hOD<830/1:L?,#%-:B>5//;mZ[A77;Km_F;3/..2;LH2)$$'-8??;537H׮d]VJ=649JJ8/,-.15:CwżP/$ '0>D=407QoXTOF<8:B^L<4/--.08EtD0(#$*7ITF800<ߵ|HCBB?=SR<2-,-./15;Gd`C7/--./1236=TʯcPJC>;<::=DR\YJ>7423457:@OǾf>0*'%')-28?NܼSCAB@=::>KsiI<631247OдWF@><;GN^ܿ{eWNKMYL=3-*((*-3CN\cRB6/+++.03690*'&(,2;EO]ɸfPD<879>BFB=5/+)'(*-32,+-4;AB>9520/-,,.4=J]ǼG70/158:HID>:75310037I`ҾZA4-+-3;9;<<94116>L`ŻJ7/..//137=KsĻu?3-+,-./158:<<;;7422124:ANzĽ^B9520/.//235555688:;=?FNiXKDDDFFFFKXyɾPC=:74200132358;=>@CEGIHGJLS\hpaYVRQQMKIGFEEE@=>>>?@DHLQZ_f}zsf]WRONNOQRUW[^bhklida_^^cjy}}}~ytqnkiihgghiiijkmnptttqomkllqvzpmhdcabbaaaadegilouz{}~}~vnkjihkllnnqrrtqooowz}|~zolhfa_^^]\`cikmpyzڽI7O`RKVde^\munr^F<6<=IF8Oetҿdz>*5OJ:;nɸN6;D7/@ź@3EuJKPEkdF<=IB3/?[M?HVuSTJ?:;>:4264/-./.,-05:=JhULE=861-(%#  #&)+07=GX̾qX>53/*$!#$  &((*1;<>MĶZA::81,,,+)')*+)).268?UmɻdYT\YW\WPGDB??>><97898889;;99 Date: Mon, 13 Mar 2017 10:36:30 -0400 Subject: [PATCH 10/96] Use git describe --always to generate version number --- asterisk/build_tools/make_version | 103 +++++++----------------------- 1 file changed, 24 insertions(+), 79 deletions(-) diff --git a/asterisk/build_tools/make_version b/asterisk/build_tools/make_version index e55727f4..f9f918c4 100755 --- a/asterisk/build_tools/make_version +++ b/asterisk/build_tools/make_version @@ -1,83 +1,28 @@ #!/bin/sh -if [ -f ${1}/.version ]; then - cat ${1}/.version -elif [ -d .svn ]; then - PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/asterisk/::' | sed -e 's:/: :g'` - BRANCH=0 - TEAM=0 - TAG=0 - - REV=`svnversion -c ${1} | cut -d: -f2` +# +# Update the .version file, if necessary +# - BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1` - - if [ "${PARTS}" = "trunk" ] - then - echo SVN-trunk-r${REV} - exit 0 - fi - - for PART in $PARTS - do - if [ ${TAG} != 0 ] - then - if [ "${PART}" = "autotag_for_be" ] ; then - continue - fi - if [ "${PART}" = "autotag_for_sx00i" ] ; then - continue - fi - RESULT="${PART}" - break - fi - - if [ ${BRANCH} != 0 ] - then - if [ -z ${RESULT} ] - then - RESULT="${PART}" - else - RESULT="${RESULT}-${PART}" - fi - break - fi - - if [ ${TEAM} != 0 ] - then - if [ -z ${RESULT} ] - then - RESULT="${PART}" - else - RESULT="${RESULT}-${PART}" - fi - continue - fi - - if [ "${PART}" = "branches" ] - then - BRANCH=1 - RESULT="branch" - continue - fi - - if [ "${PART}" = "tags" ] - then - TAG=1 - continue - fi - - if [ "${PART}" = "team" ] - then - TEAM=1 - continue - fi - done - - if [ ${TAG} != 0 ] - then - echo ${RESULT} - else - echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}} - fi +set -e + +if test -d ../.git; then + VERSION=$(git describe --always) +else + VERSION=unknown +fi + +if test -f .version; then + if test "${VERSION}" = "$(cat .version)"; then + # .version file up to date + exit 0 + fi + + if test "${VERSION}" = "unknown"; then + # don't overwrite an existing .version with "unknown" + exit 0 + fi fi + +echo "${VERSION}" > .version + From 9f9d45521752b41ceea38b99887ea11a5b06e634 Mon Sep 17 00:00:00 2001 From: Stacy Olivas Date: Tue, 21 Mar 2017 19:55:16 -0700 Subject: [PATCH 11/96] Added comments --- asterisk/apps/app_rpt.c | 179 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index 9a2cf5a1..fe099c04 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -15,6 +15,32 @@ * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file * at the top of the source tree. + * + * ------------------------------------- + * Notes on app_rpt.c + * ------------------------------------- + * By: Stacy Olivas, KG7QIN - 20 March 2017 + * This application, the heart of the AllStar network and using asterisk as a repeater, + * is largely undocumented code. It uses a multi-threaded approach to fulfilling its functions + * and can be quite a chore to follow for debugging. + * + * The entry point in the code , rpt_exec, is called by the main pbx call handing routine. + * The code handles the initial setup and then passes the call/connection off to + * the threaded routines, which do the actual work of keeping multiple + * connections open, passing telemetry, etc. rpt_master handles the management of the threaded + * routines used (rpt_master_thread is the p_thread structure). + * + * Having gone through this code during an attempt at porting to this Asterisk 1.8, I recommend + * that anyone who is serious about trying to understand this code, to liberally sprinkle + * debugging statements throughout it and run it. The program flow may surprise you. + * + * Note that due changes in later versions of asterisk, you cannot simply drop this module into + * the build tree and expect it to work. There has been some significant renaming of + * key variables and structures between 1.4 and later versions of Asterisk. Additionally, + * the changes to how the pbx module passes calls off to applications has changed as well, + * which causes app_rpt to fail without a modification of the base Asterisk code in these + * later versions. + * -------------------------------------- */ /*! \file * @@ -481,6 +507,10 @@ enum{DAQ_TYPE_UCHAMELEON}; #include "asterisk.h" #include "../astver.h" +/* + * Defines for the "old" way to manage module hooks into Asterisk +*/ + #ifdef OLD_ASTERISK #define ast_free free #define ast_malloc malloc @@ -704,6 +734,10 @@ static char *remote_rig_rtx150="rtx150"; static char *remote_rig_rtx450="rtx450"; static char *remote_rig_ppp16="ppp16"; // parallel port programmable 16 channels +/* + * DTMF Tones - frequency pairs used to generate them along with the required timings + */ + static char* dtmf_tones[] = { "!941+1336/200,!0/200", /* 0 */ "!697+1209/200,!0/200", /* 1 */ @@ -783,8 +817,14 @@ static time_t starttime = 0; static pthread_t rpt_master_thread; +/* + * Structure that holds information regarding app_rpt operation +*/ struct rpt; +/* + * Structure used to manage links +*/ struct rpt_link { struct rpt_link *next; @@ -851,6 +891,9 @@ struct rpt_link #endif } ; +/* + * Structure used to manage link status +*/ struct rpt_lstat { struct rpt_lstat *next; @@ -1016,6 +1059,9 @@ typedef struct } tone_detect_state_t; +/* + * Populate rpt structure with data +*/ static struct rpt { ast_mutex_t lock; @@ -1425,6 +1471,9 @@ int i; return(NULL); } +/* + * Functions related to the threading used in app_rpt dealing with locking +*/ static void rpt_mutex_spew(void) { @@ -1700,6 +1749,9 @@ static int dovox(struct vox *v,short *buf,int bs) } +/* + * Multi-thread safe sleep routine +*/ static void rpt_safe_sleep(struct rpt *rpt,struct ast_channel *chan, int ms) { struct ast_frame *f; @@ -1723,6 +1775,10 @@ static void rpt_safe_sleep(struct rpt *rpt,struct ast_channel *chan, int ms) return; } +/* + * Routine to forward a "call" from one channel to another +*/ + static void rpt_forward(struct ast_channel *chan, char *dialstr, char *nodefrom) { @@ -2057,6 +2113,11 @@ static inline void goertzel_reset(goertzel_state_t *s) s->v2 = s->v3 = s->chunky = 0.0; } +/* + * Code used to detect tones +*/ + + static void tone_detect_init(tone_detect_state_t *s, int freq, int duration, int amp) { int duration_samples; @@ -4354,6 +4415,11 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) /* */ + +/* + * Routine that hangs up all links and frees all threads related to them + * hence taking a "bird bath". Makes a lot of noise/cleans up the mess + */ static void birdbath(struct rpt *myrpt) { struct rpt_tele *telem; @@ -4500,6 +4566,10 @@ char digit; } } +/* + * Routine to set the Data Terminal Ready (DTR) pin on a serial interface +*/ + static int setdtr(struct rpt *myrpt,int fd, int enable) { struct termios mode; @@ -4526,6 +4596,10 @@ struct termios mode; return 0; } +/* + * open the serial port + */ + static int openserial(struct rpt *myrpt,char *fname) { struct termios mode; @@ -4564,6 +4638,11 @@ static int openserial(struct rpt *myrpt,char *fname) return(fd); } + +/* + * Process DTMF keys passed + */ + static void local_dtmfkey_helper(struct rpt *myrpt,char c) { int i; @@ -4725,6 +4804,10 @@ struct mdcparams *mdcp; #endif #endif +/* + * Translate function + */ + static char func_xlat(struct rpt *myrpt,char c,struct rpt_xlat *xlat) { time_t now; @@ -4780,6 +4863,10 @@ static char *eatwhite(char *s) return s; } +/* + * Function to translate characters to APRSTT data + */ + static char aprstt_xlat(char *instr,char *outstr) { int i,j; @@ -5126,6 +5213,10 @@ struct rpt_link *l; return; } +/* + * Routine to process events for rpt_master threads + */ + static void rpt_event_process(struct rpt *myrpt) { char *myval,*argv[5],*cmpvar,*var,*var1,*cmd,c; @@ -5371,6 +5462,10 @@ struct ast_var_t *newvariable; return; } +/* + * Routine to update boolean values used in currently referenced rpt structure + */ + static void rpt_update_boolean(struct rpt *myrpt,char *varname, int newval) { @@ -5385,6 +5480,11 @@ char buf[10]; return; } +/* + * Updates the active links (channels) list that that the repeater has + */ + + static void rpt_update_links(struct rpt *myrpt) { char buf[MAXLINKLIST],obuf[MAXLINKLIST + 20],*strs[MAXLINKLIST]; @@ -5497,6 +5597,11 @@ unsigned int seq; return; } + +/* + * Function stream data + */ + static void startoutstream(struct rpt *myrpt) { char *str; @@ -5561,6 +5666,12 @@ int n; return; } +/* + * AllStar Network node lookup function. This function will take the nodelist that has been read into memory + * and try to match the node number that was passed to it. If it is found, the function requested will succeed. + * If not, it will fail. Called when a connection to a remote node is requested. + */ + static int node_lookup(struct rpt *myrpt,char *digitbuf,char *str, int strmax, int wilds) { @@ -5895,6 +6006,13 @@ static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int return ret; } +/* + * This is the initialization function. This routine takes the data in rpt.conf and setup up the variables needed for each of + * the repeaters that it finds. There is some minor sanity checking done on the data passed, but not much. + * + * Note that this is kind of a mess to read. It uses the asterisk native function to read config files and pass back values assigned to + * keywords. + */ static void load_rpt_vars(int n,int init) { @@ -7346,6 +7464,8 @@ static int rpt_do_sendtext(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +//## Paging function + static int rpt_do_page(int fd, int argc, char *argv[]) { int i; @@ -7392,6 +7512,8 @@ static int rpt_do_page(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +//## Send to all nodes + static int rpt_do_sendall(int fd, int argc, char *argv[]) { int i; @@ -7663,6 +7785,10 @@ static int play_tone(struct ast_channel *chan, int freq, int duration, int ampli #ifdef NEW_ASTERISK +/* + * Hooks for CLI functions + */ + static char *res2cli(int r) { @@ -7983,6 +8109,9 @@ static struct ast_cli_entry rpt_cli[] = { #endif +/* + * End of CLI hooks + */ static int morse_cat(char *str, int freq, int duration) { @@ -8006,6 +8135,7 @@ static int morse_cat(char *str, int freq, int duration) } +//## Convert string into morse code static int send_morse(struct ast_channel *chan, char *string, int speed, int freq, int amplitude) { @@ -8172,6 +8302,8 @@ static struct morse_bits mbits[] = { return res; } +//# Send telemetry tones + static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) { char *p,*stringp; @@ -8229,6 +8361,8 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) } +//# Say a file - streams file to output channel + static int sayfile(struct ast_channel *mychannel,char *fname) { int res; @@ -8255,6 +8389,8 @@ int res; return res; } +//# Say a number -- streams corresponding sound file + static int saynum(struct ast_channel *mychannel, int num) { int res; @@ -8267,6 +8403,8 @@ static int saynum(struct ast_channel *mychannel, int num) return res; } +//# Say a phonetic words -- streams corresponding sound file + static int sayphoneticstr(struct ast_channel *mychannel,char *str) { int res; @@ -8514,6 +8652,21 @@ static int wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan) static int split_freq(char *mhz, char *decimals, char *freq); +//### BEGIN TELEMETRY CODE SECTION +/* + * Routine to process various telemetry commands that are in the myrpt structure + * Used extensively when links and build/torn down and other events are processed by the + * rpt_master threads. + */ + + /* + * + * WARNING: YOU ARE NOW HEADED INTO ONE GIANT MAZE OF SWITCH STATEMENTS THAT DO MOST OF THE WORK FOR + * APP_RPT. THE MAJORITY OF THIS IS VERY UNDOCUMENTED CODE AND CAN BE VERY HARD TO READ. + * IT IS ALSO PROBABLY THE MOST ERROR PRONE PART OF THE CODE, ESPECIALLY THE PORTIONS + * RELATED TO THREADED OPERATIONS. + */ + static void handle_varcmd_tele(struct rpt *myrpt,struct ast_channel *mychannel,char *varcmd) { char *strs[100],*p,buf[100],c; @@ -8832,6 +8985,13 @@ struct tm localtm; return; } +/* + * Threaded telemetry handling routines - goes hand in hand with the previous routine (see above) + * This routine does a lot of processing of what you "hear" when app_rpt is running. + * Note that this routine could probably benefit from an overhaul to make it easier to read/debug. + * Many of the items here seem to have been bolted onto this routine as it app_rpt has evolved. + */ + static void *rpt_tele_thread(void *this) { struct dahdi_confinfo ci; /* conference info */ @@ -10542,6 +10702,10 @@ struct mdcparams *mdcp; static void send_tele_link(struct rpt *myrpt,char *cmd); +/* + * More repeater telemetry routines. + */ + static void rpt_telemetry(struct rpt *myrpt,int mode, void *data) { struct rpt_tele *tele; @@ -10853,6 +11017,18 @@ struct rpt_link *l; return; } +//## END TELEMETRY SECTION + +/* + * This is the main entry point from the Asterisk call handler to app_rpt when a new "call" is detected and passed off + * This code sets up all the necessary variables for the rpt_master threads to take over handling/processing anything + * related to this call. Calls are actually channels that are passed from the pbx application to app_rpt. + * + * NOTE: DUE TO THE WAY LATER VERSIONS OF ASTERISK PASS CALLS, ANY ATTEMPTS TO USE APP_RPT.C WITHOUT ADDING BACK IN THE + * "MISSING" PIECES TO THE ASTERISK CALL HANDLER WILL RESULT IN APP_RPT DROPPING ALL CALLS (CHANNELS) PASSED TO IT + * IMMEDIATELY AFTER THIS ROUTINE ATTEMPTS TO PASS IT TO RPT_MASTER'S THREADS. + */ + static void *rpt_call(void *this) { struct dahdi_confinfo ci; /* conference info */ @@ -25304,6 +25480,9 @@ char *val,*this; return(0); } +/* + * Code to handle the "old" way of registering module hooks in asterisk +*/ #ifndef OLD_ASTERISK AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Radio Repeater/Remote Base Application", From d7c0c01824b19d23e81b9b56d6baaead7631c4b8 Mon Sep 17 00:00:00 2001 From: Leighton Date: Wed, 22 Mar 2017 21:35:31 +1100 Subject: [PATCH 12/96] CM108B USB sound card Code added for CM108B USB sound card --- asterisk/channels/chan_simpleusb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/asterisk/channels/chan_simpleusb.c b/asterisk/channels/chan_simpleusb.c index 67810610..6c786535 100644 --- a/asterisk/channels/chan_simpleusb.c +++ b/asterisk/channels/chan_simpleusb.c @@ -128,6 +128,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") #define C108_VENDOR_ID 0x0d8c #define C108_PRODUCT_ID 0x000c +#define C108B_PRODUCT_ID 0x0012 #define C108AH_PRODUCT_ID 0x013c #define N1KDO_PRODUCT_ID 0x6a00 #define C119_PRODUCT_ID 0x0008 @@ -996,6 +997,7 @@ static struct usb_device *hid_device_init(char *desired_device) if ((dev->descriptor.idVendor == C108_VENDOR_ID) && (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || + (dev->descriptor.idProduct == C108B_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || @@ -1080,6 +1082,7 @@ static int hid_device_mklist(void) if ((dev->descriptor.idVendor == C108_VENDOR_ID) && (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || + (dev->descriptor.idProduct == C108B_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || From 5645bc2c2292d3c8c110e35e54358cffcde90a8b Mon Sep 17 00:00:00 2001 From: Leighton Date: Wed, 22 Mar 2017 21:37:33 +1100 Subject: [PATCH 13/96] CM108B USB sound card Code added for CM108B USB sound card --- asterisk/channels/chan_usbradio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/asterisk/channels/chan_usbradio.c b/asterisk/channels/chan_usbradio.c index b94a41c8..31dfec0f 100644 --- a/asterisk/channels/chan_usbradio.c +++ b/asterisk/channels/chan_usbradio.c @@ -155,6 +155,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") #define C108_VENDOR_ID 0x0d8c #define C108_PRODUCT_ID 0x000c +#define C108B_PRODUCT_ID 0x0012 #define C108AH_PRODUCT_ID 0x013c #define C119_PRODUCT_ID 0x0008 #define C119A_PRODUCT_ID 0x013a @@ -1084,6 +1085,7 @@ static struct usb_device *hid_device_init(char *desired_device) if ((dev->descriptor.idVendor == C108_VENDOR_ID) && (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || + (dev->descriptor.idProduct == C108B_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || @@ -1168,6 +1170,7 @@ static int hid_device_mklist(void) if ((dev->descriptor.idVendor == C108_VENDOR_ID) && (((dev->descriptor.idProduct & 0xfffc) == C108_PRODUCT_ID) || + (dev->descriptor.idProduct == C108B_PRODUCT_ID) || (dev->descriptor.idProduct == C108AH_PRODUCT_ID) || (dev->descriptor.idProduct == C119A_PRODUCT_ID) || ((dev->descriptor.idProduct & 0xff00) == N1KDO_PRODUCT_ID) || From 2dc010e16cd2ede2ef591c23d7c95590919d4179 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Wed, 12 Jul 2017 13:55:15 -0400 Subject: [PATCH 14/96] Remove no longer used RADIO_RTX RADIO_XPMRX --- asterisk/menuselect.makeopts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asterisk/menuselect.makeopts b/asterisk/menuselect.makeopts index e5749cf7..f8f25370 100644 --- a/asterisk/menuselect.makeopts +++ b/asterisk/menuselect.makeopts @@ -1,6 +1,6 @@ MENUSELECT_APPS=app_ivrdemo app_osplookup app_skel MENUSELECT_CDR=cdr_odbc cdr_pgsql cdr_radius cdr_sqlite cdr_tds -MENUSELECT_CHANNELS=chan_alsa chan_features chan_gtalk chan_h323 chan_mgcp chan_misdn chan_nbs chan_oss chan_phone chan_rtpdir chan_skinny RADIO_RTX RADIO_XPMRX chan_vpb +MENUSELECT_CHANNELS=chan_alsa chan_features chan_gtalk chan_h323 chan_mgcp chan_misdn chan_nbs chan_oss chan_phone chan_rtpdir chan_skinny chan_vpb MENUSELECT_CODECS=codec_ilbc codec_lpc10 codec_speex MENUSELECT_FORMATS=format_ogg_vorbis MENUSELECT_FUNCS=func_curl func_odbc From b608f95c5b2246497846c0b3b3db617bed053960 Mon Sep 17 00:00:00 2001 From: Steve Zingman Date: Mon, 31 Jul 2017 10:33:35 -0400 Subject: [PATCH 15/96] Update Makefile Uses pthread for ARM --- asterisk/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asterisk/Makefile b/asterisk/Makefile index 15889cb2..f4857ef1 100644 --- a/asterisk/Makefile +++ b/asterisk/Makefile @@ -217,7 +217,7 @@ ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations UNAME_M:=$(shell uname -m) ifeq ($(UNAME_M),armv7l) -ASTCFLAGS+=-Wno-unused-result +ASTCFLAGS+=-lpthread -Wno-unused-result endif ifeq ($(AST_DEVMODE),yes) From 166de8e6f1a4c5f45f6d3fbfcc00c86f82c0afbe Mon Sep 17 00:00:00 2001 From: root Date: Sun, 19 Nov 2017 06:55:35 -0500 Subject: [PATCH 16/96] Extend sign-on --- asterisk/main/asterisk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/asterisk/main/asterisk.c b/asterisk/main/asterisk.c index 338f1b7d..cf00b7dc 100644 --- a/asterisk/main/asterisk.c +++ b/asterisk/main/asterisk.c @@ -138,7 +138,9 @@ int daemon(int, int); /* defined in libresolv of all places */ /*! \brief Welcome message when starting a CLI interface */ #define WELCOME_MESSAGE \ - ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2017 Digium, Inc. Jim Dixon, AllStarLink Inc. and others.\n"); \ + ast_verbose("\n"); \ + ast_verbose("AllStarLink Asterisk Version 1.00 11/11/2017 "ASTERISK_VERSION"\n"); \ + ast_verbose("Copyright (C) 1999 - 2017 Digium, Inc. Jim Dixon, AllStarLink Inc. and others.\n"); \ ast_verbose("Created by Mark Spencer \n"); \ ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n"); \ ast_verbose("This is free software, with components licensed under the GNU General Public\n"); \ From c01516038053e4713d4a951f4a4a5ff115b20f1d Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Sun, 19 Nov 2017 08:05:11 -0500 Subject: [PATCH 17/96] Update time calc --- asterisk/Makefile | 2 -- asterisk/apps/app_rpt.c | 48 ++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/asterisk/Makefile b/asterisk/Makefile index f4857ef1..1f760ba6 100644 --- a/asterisk/Makefile +++ b/asterisk/Makefile @@ -674,9 +674,7 @@ config: if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \ elif [ -f /etc/debian_version ] && [ -f /etc/systemd/system.conf ]; then \ $(INSTALL) -m 755 contrib/systemd/asterisk.service $(DESTDIR)/lib/systemd/system/asterisk.service; \ - $(INSTALL) -m 755 contrib/systemd/updatenodelist.service $(DESTDIR)/lib/systemd/system/updatenodelist.service; \ if [ -z "$(DESTDIR)" ]; then /bin/systemctl enable asterisk.service; fi; \ - if [ -z "$(DESTDIR)" ]; then /bin/systemctl enable updatenodelist.service; fi; \ elif [ -f /etc/debian_version ] && [ ! -f /etc/systemd/system.conf ]; then \ $(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \ if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 0 1 6 .; fi; \ diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index fe099c04..cbc5e8ba 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -45,7 +45,7 @@ /*! \file * * \brief Radio Repeater / Remote Base program - * version 0.327 11/24/2016 + * version 0.328 07/13/2017 * * \author Jim Dixon, WB6NIL * @@ -6863,7 +6863,7 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) ast_cli(fd, "Keyups since system initialization...............: %d\n", totalkeyups); ast_cli(fd, "DTMF commands today..............................: %d\n", dailyexecdcommands); ast_cli(fd, "DTMF commands since system initialization........: %d\n", totalexecdcommands); - ast_cli(fd, "Last DTMF command executed.......................: %s\n", + ast_cli(fd, "Last DTMF command executed.......................: %s\n", (lastdtmfcommand && strlen(lastdtmfcommand)) ? lastdtmfcommand : not_applicable); hours = dailytxtime/3600000; dailytxtime %= 3600000; @@ -6872,7 +6872,7 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) seconds = dailytxtime/1000; dailytxtime %= 1000; - ast_cli(fd, "TX time today....................................: %02d:%02d:%02d.%d\n", + ast_cli(fd, "TX time today....................................: %02d:%02d:%02d:%02d\n", hours, minutes, seconds, dailytxtime); hours = (int) totaltxtime/3600000; @@ -6882,7 +6882,7 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) seconds = (int) totaltxtime/1000; totaltxtime %= 1000; - ast_cli(fd, "TX time since system initialization..............: %02d:%02d:%02d.%d\n", + ast_cli(fd, "TX time since system initialization..............: %02d:%02d:%02d:%02d\n", hours, minutes, seconds, (int) totaltxtime); hours = uptime/3600; @@ -6995,13 +6995,13 @@ static int rpt_do_lstats(int fd, int argc, char *argv[]) int hours, minutes, seconds; long long connecttime = s->connecttime; char conntime[21]; - hours = (int) connecttime/3600000; - connecttime %= 3600000; - minutes = (int) connecttime/60000; - connecttime %= 60000; - seconds = (int) connecttime/1000; - connecttime %= 1000; - snprintf(conntime, 20, "%02d:%02d:%02d.%d", + hours = connecttime/3600000L; + connecttime %= 3600000L; + minutes = connecttime/60000L; + connecttime %= 60000L; + seconds = connecttime/1000L; + connecttime %= 1000L; + snprintf(conntime, 20, "%02d:%02d:%02d:%02d", hours, minutes, seconds, (int) connecttime); conntime[20] = 0; if(s->thisconnected) @@ -7185,11 +7185,11 @@ static int rpt_do_xnode(int fd, int argc, char *argv[]) int hours, minutes, seconds; long long connecttime = s->connecttime; char conntime[21]; - hours = (int) connecttime/3600000; - connecttime %= 3600000; - minutes = (int) connecttime/60000; - connecttime %= 60000; - seconds = (int) connecttime/1000; + hours = connecttime/3600000L; + connecttime %= 3600000L; + minutes = connecttime/60000L; + connecttime %= 60000L; + seconds = (int) connecttime/1000L; connecttime %= 1000; snprintf(conntime, 20, "%02d:%02d:%02d", hours, minutes, seconds); @@ -24488,12 +24488,12 @@ static int rpt_manager_do_xstat(struct mansession *ses, const struct message *m, int hours, minutes, seconds; long long connecttime = s->connecttime; char conntime[21]; - hours = (int) connecttime/3600000; - connecttime %= 3600000; - minutes = (int) connecttime/60000; - connecttime %= 60000; - seconds = (int) connecttime/1000; - connecttime %= 1000; + hours = connecttime/3600000L; + connecttime %= 3600000L; + minutes = connecttime/60000L; + connecttime %= 60000L; + seconds = (int) connecttime/1000L; + connecttime %= 1000L; snprintf(conntime, 20, "%02d:%02d:%02d", hours, minutes, seconds); conntime[20] = 0; @@ -24857,7 +24857,7 @@ static int rpt_manager_do_stats(struct mansession *s, const struct message *m, c seconds = dailytxtime/1000; dailytxtime %= 1000; - astman_append(s, "TxTimeToday: %02d:%02d:%02d.%d\r\n", + astman_append(s, "TxTimeToday: %02d:%02d:%02d:%02d\r\n", hours, minutes, seconds, dailytxtime); hours = (int) totaltxtime/3600000; @@ -24867,7 +24867,7 @@ static int rpt_manager_do_stats(struct mansession *s, const struct message *m, c seconds = (int) totaltxtime/1000; totaltxtime %= 1000; - astman_append(s, "TxTimeSinceSystemInitialization: %02d:%02d:%02d.%d\r\n", + astman_append(s, "TxTimeSinceSystemInitialization: %02d:%02d:%02d:%02d\r\n", hours, minutes, seconds, (int) totaltxtime); sprintf(str, "NodesCurrentlyConnectedToUs: "); From 0557d29e85e957561510031a5ea9d9c5b68e5c38 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Mon, 20 Nov 2017 06:12:33 -0500 Subject: [PATCH 18/96] Support GIT version --- asterisk/build_tools/make_version | 27 ++------------------------- asterisk/main/asterisk.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/asterisk/build_tools/make_version b/asterisk/build_tools/make_version index f9f918c4..e9d1e656 100755 --- a/asterisk/build_tools/make_version +++ b/asterisk/build_tools/make_version @@ -1,28 +1,5 @@ #!/bin/sh -# -# Update the .version file, if necessary -# - -set -e - -if test -d ../.git; then - VERSION=$(git describe --always) -else - VERSION=unknown -fi - -if test -f .version; then - if test "${VERSION}" = "$(cat .version)"; then - # .version file up to date - exit 0 - fi - - if test "${VERSION}" = "unknown"; then - # don't overwrite an existing .version with "unknown" - exit 0 - fi -fi - +VERSION="GIT Version "$(git log -1 --format="%h") +echo "${VERSION}" echo "${VERSION}" > .version - diff --git a/asterisk/main/asterisk.c b/asterisk/main/asterisk.c index cf00b7dc..2e499a54 100644 --- a/asterisk/main/asterisk.c +++ b/asterisk/main/asterisk.c @@ -22,11 +22,11 @@ * \mainpage Asterisk -- An Open Source Telephony Toolkit * * \par Developer Documentation for Asterisk - * This is the main developer documentation for Asterisk. It is + * This is the main developer documentation for Asterisk. It is * generated by running "make progdocs". * \par Additional documentation * \arg \ref Licensing - * \arg \ref DevDoc + * \arg \ref DevDoc * \arg \ref ConfigFiles * * \section copyright Copyright and author @@ -47,12 +47,12 @@ /*! \file \brief Top level source file for Asterisk - the Open Source PBX. Implementation of PBX core functions and CLI interface. - + */ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 147386 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 148000 $") #undef sched_setscheduler #undef setpriority @@ -139,7 +139,7 @@ int daemon(int, int); /* defined in libresolv of all places */ /*! \brief Welcome message when starting a CLI interface */ #define WELCOME_MESSAGE \ ast_verbose("\n"); \ - ast_verbose("AllStarLink Asterisk Version 1.00 11/11/2017 "ASTERISK_VERSION"\n"); \ + ast_verbose("AllStarLink Asterisk Version 1.0 11/11/2018 "ASTERISK_VERSION"\n"); \ ast_verbose("Copyright (C) 1999 - 2017 Digium, Inc. Jim Dixon, AllStarLink Inc. and others.\n"); \ ast_verbose("Created by Mark Spencer \n"); \ ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n"); \ @@ -149,9 +149,9 @@ int daemon(int, int); /* defined in libresolv of all places */ ast_verbose("=========================================================================\n") /*! \defgroup main_options Main Configuration Options - \brief Main configuration options from \ref Config_ast "asterisk.conf" or - the operating system command line when starting Asterisk - Some of them can be changed in the CLI + \brief Main configuration options from \ref Config_ast "asterisk.conf" or + the operating system command line when starting Asterisk + Some of them can be changed in the CLI */ /*! @{ */ From 72830c1e52fc5bf52e60e52fed4d39213d744067 Mon Sep 17 00:00:00 2001 From: Steve Zingman Date: Wed, 27 Dec 2017 21:03:26 -0500 Subject: [PATCH 19/96] Update copyright --- asterisk/main/asterisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asterisk/main/asterisk.c b/asterisk/main/asterisk.c index 2e499a54..552db6c0 100644 --- a/asterisk/main/asterisk.c +++ b/asterisk/main/asterisk.c @@ -139,8 +139,8 @@ int daemon(int, int); /* defined in libresolv of all places */ /*! \brief Welcome message when starting a CLI interface */ #define WELCOME_MESSAGE \ ast_verbose("\n"); \ - ast_verbose("AllStarLink Asterisk Version 1.0 11/11/2018 "ASTERISK_VERSION"\n"); \ - ast_verbose("Copyright (C) 1999 - 2017 Digium, Inc. Jim Dixon, AllStarLink Inc. and others.\n"); \ + ast_verbose("AllStarLink Asterisk Version 1.01 1/1/2018 "ASTERISK_VERSION"\n"); \ + ast_verbose("Copyright (C) 1999 - 2018 Digium, Inc. Jim Dixon, AllStarLink Inc. and others.\n"); \ ast_verbose("Created by Mark Spencer \n"); \ ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n"); \ ast_verbose("This is free software, with components licensed under the GNU General Public\n"); \ From 41a6221cfe75ebc0fb6e5810d98ead16db7a0244 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Dec 2017 21:15:23 -0500 Subject: [PATCH 20/96] Update systemd --- asterisk/contrib/systemd/asterisk.service | 1 - asterisk/contrib/systemd/netcheck.service | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 asterisk/contrib/systemd/netcheck.service diff --git a/asterisk/contrib/systemd/asterisk.service b/asterisk/contrib/systemd/asterisk.service index 8e9837e9..b3b941d5 100644 --- a/asterisk/contrib/systemd/asterisk.service +++ b/asterisk/contrib/systemd/asterisk.service @@ -24,4 +24,3 @@ RestartSec=10 [Install] WantedBy=multi-user.target - diff --git a/asterisk/contrib/systemd/netcheck.service b/asterisk/contrib/systemd/netcheck.service new file mode 100644 index 00000000..f33a3ea2 --- /dev/null +++ b/asterisk/contrib/systemd/netcheck.service @@ -0,0 +1,13 @@ +[Unit] +Description=Check for internet connectivity +# Description=Place this file in /lib/systemd/system +# Description=N4IRS 6/09/2017 +After=syslog.target + +[Service] +Type=forking +StandardOutput=null +ExecStart=/usr/local/sbin/netcheck + +[Install] +WantedBy=network-online.target From add4bd615dbf254f6fe2099e68d297f61a585a19 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Dec 2017 22:31:17 -0500 Subject: [PATCH 21/96] More cleanup --- asterisk/apps/app_rpt.c | 600 ++++++++--------- configs/asterisk.conf | 44 +- configs/beagleboard/modules.conf | 211 +++++- configs/beagleboard/rpt.conf | 663 ++++++++++++++----- configs/beagleboard/zapata.conf | 13 - configs/beagleboard/zaptel.conf | 8 - configs/examples/echolink/echolink.conf | 60 +- configs/examples/echolink/modules.conf | 216 ++++++ configs/extensions.conf | 95 ++- configs/iax.conf | 162 +++-- configs/pi/modules.conf | 212 +++++- configs/pi/rpt.conf | 663 ++++++++++++++----- configs/simpleusb/modules.conf | 211 +++++- configs/simpleusb/rpt.conf | 663 ++++++++++++++----- configs/simpleusb/simpleusb.conf | 74 ++- configs/simpleusb/zapata.conf | 13 - configs/simpleusb/zaptel.conf | 8 - configs/sip.conf | 10 +- configs/usbradio/modules.conf | 211 +++++- configs/usbradio/rpt.conf | 663 ++++++++++++++----- configs/usbradio/usbradio.conf | 195 +++--- configs/usbradio/zapata.conf | 13 - configs/usbradio/zaptel.conf | 8 - fixed-dahdi-patches/README | 7 - fixed-dahdi-patches/patch-dahdi-dude-fixed.1 | 12 - fixed-dahdi-patches/patch-dahdi-dude-fixed.2 | 130 ---- 26 files changed, 3774 insertions(+), 1391 deletions(-) delete mode 100644 configs/beagleboard/zapata.conf delete mode 100644 configs/beagleboard/zaptel.conf create mode 100644 configs/examples/echolink/modules.conf delete mode 100644 configs/simpleusb/zapata.conf delete mode 100644 configs/simpleusb/zaptel.conf delete mode 100644 configs/usbradio/zapata.conf delete mode 100644 configs/usbradio/zaptel.conf delete mode 100644 fixed-dahdi-patches/README delete mode 100644 fixed-dahdi-patches/patch-dahdi-dude-fixed.1 delete mode 100644 fixed-dahdi-patches/patch-dahdi-dude-fixed.2 diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index cbc5e8ba..f2b06620 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -22,7 +22,7 @@ * By: Stacy Olivas, KG7QIN - 20 March 2017 * This application, the heart of the AllStar network and using asterisk as a repeater, * is largely undocumented code. It uses a multi-threaded approach to fulfilling its functions - * and can be quite a chore to follow for debugging. + * and can be quite a chore to follow for debugging. * * The entry point in the code , rpt_exec, is called by the main pbx call handing routine. * The code handles the initial setup and then passes the call/connection off to @@ -35,18 +35,18 @@ * debugging statements throughout it and run it. The program flow may surprise you. * * Note that due changes in later versions of asterisk, you cannot simply drop this module into - * the build tree and expect it to work. There has been some significant renaming of + * the build tree and expect it to work. There has been some significant renaming of * key variables and structures between 1.4 and later versions of Asterisk. Additionally, - * the changes to how the pbx module passes calls off to applications has changed as well, + * the changes to how the pbx module passes calls off to applications has changed as well, * which causes app_rpt to fail without a modification of the base Asterisk code in these * later versions. * -------------------------------------- */ /*! \file * - * \brief Radio Repeater / Remote Base program + * \brief Radio Repeater / Remote Base program * version 0.328 07/13/2017 - * + * * \author Jim Dixon, WB6NIL * * \note Serious contributions by Steve RoDgers, WA6ZFT @@ -60,7 +60,7 @@ * Normal mode: * See the function list in rpt.conf (autopatchup, autopatchdn) * autopatchup can optionally take comma delimited setting=value pairs: - * + * * * context=string : Override default context with "string" * dialtime=ms : Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) @@ -106,7 +106,7 @@ * 17 - User functions (time, id, etc) enable * 18 - User functions (time, id, etc) disable * 19 - Select alternate hang timer - * 20 - Select standard hang timer + * 20 - Select standard hang timer * 21 - Enable Parrot Mode * 22 - Disable Parrot Mode * 23 - Birdbath (Current Parrot Cleanup/Flush) @@ -130,7 +130,7 @@ * 44 - Echolink announce node # & Callsign * 45 - Link Activity timer enable * 46 - Link Activity timer disable - * 47 - Reset "Link Config Changed" Flag + * 47 - Reset "Link Config Changed" Flag * 48 - Send Page Tone (Tone specs separated by parenthesis) * 49 - Disable incoming connections (control state noice) * 50 - Enable incoming connections (control state noicd) @@ -144,11 +144,11 @@ * 58 - Tx CTCSS On Input only Enable * 59 - Tx CTCSS On Input only Disable * 60 - Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) - * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call * (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. * DestID and subcode are only specified for the 'C' type message. * UnitID is the local systems UnitID. DestID is the MDC1200 ID of - * the radio being called, and the subcodes are as follows: + * the radio being called, and the subcodes are as follows: * Subcode '8205' is Voice Selective Call for Spectra ('Call') * Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or * Astro-Saber('Call') @@ -156,7 +156,7 @@ * 61 - Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) * 62 - Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) * 63 - Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) - * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) + * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) * 65 - Send POCSAG page (equipped channel types only) * * ilink cmds: @@ -229,13 +229,13 @@ * * "events" subsystem: * - * in the "events" section of the rpt.conf file (if any), the user may - * specify actions to take place when ceratin events occur. + * in the "events" section of the rpt.conf file (if any), the user may + * specify actions to take place when ceratin events occur. * * It is implemented as acripting, based heavily upon expression evaluation built * into Asterisk. Each line of the section contains an action, a type, and variable info. * Each line either sets a variable, or executes an action based on a transitional state - * of a specified (already defined) variable (such as going true, going false, no change, + * of a specified (already defined) variable (such as going true, going false, no change, * or getting set initially). * * The syntax for each line is as follows: @@ -260,7 +260,7 @@ * "RANGER" mode configuration: * in the node stanza in rpt.conf ONLY the following need be specified for a RANGER node: * - * + * * * [90101] * @@ -344,7 +344,7 @@ #define DEFAULT_EANNMODE 1 #define DEFAULT_TANNMODE 1 -#define DEFAULT_RXBURST_TIME 250 +#define DEFAULT_RXBURST_TIME 250 #define DEFAULT_RXBURST_THRESHOLD 16 #define DEFAULT_SPLIT_2M 600 @@ -443,11 +443,11 @@ #define MAX_DAQ_NAME 32 /* Max length of a device name */ #define MAX_DAQ_DEV 64 /* Max length of a daq device path */ #define MAX_METER_FILES 10 /* Max number of sound files in a meter def. */ -#define DAQ_RX_TIMEOUT 50 /* Receive time out for DAQ subsystem */ +#define DAQ_RX_TIMEOUT 50 /* Receive time out for DAQ subsystem */ #define DAQ_ADC_ACQINT 10 /* Acquire interval in sec. for ADC channels */ #define ADC_HIST_TIME 300 /* Time in sec. to calculate short term avg, high and low peaks from. */ #define ADC_HISTORY_DEPTH ADC_HIST_TIME/DAQ_ADC_ACQINT - + enum {REM_OFF,REM_MONITOR,REM_TX}; @@ -523,7 +523,7 @@ enum{DAQ_TYPE_UCHAMELEON}; #define START_DELAY 2 #endif -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 122717 $") #include #include @@ -737,7 +737,7 @@ static char *remote_rig_ppp16="ppp16"; // parallel port programmable 16 chan /* * DTMF Tones - frequency pairs used to generate them along with the required timings */ - + static char* dtmf_tones[] = { "!941+1336/200,!0/200", /* 0 */ "!697+1209/200,!0/200", /* 1 */ @@ -858,8 +858,8 @@ struct rpt_link int max_retries; int reconnects; long long connecttime; - struct ast_channel *chan; - struct ast_channel *pchan; + struct ast_channel *chan; + struct ast_channel *pchan; char linklist[MAXLINKLIST]; time_t linklistreceived; long linklisttimer; @@ -930,7 +930,7 @@ struct rpt_tele struct function_table_tag { char action[ACTIONSIZE]; - int (*function)(struct rpt *myrpt, char *param, char *digitbuf, + int (*function)(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink); } ; @@ -987,7 +987,7 @@ struct daq_tag{ /* Used to store the morse code patterns */ struct morse_bits -{ +{ int len; int ddcomb; } ; @@ -1160,7 +1160,7 @@ static struct rpt int simplexpatchdelay; int simplexphonedelay; char telemdefault; - char telemdynamic; + char telemdynamic; char lnkactenable; char *statpost_program; char *statpost_url; @@ -1189,7 +1189,7 @@ static struct rpt int litztime; char *litzchar; char *litzcmd; - int itxctcss; + int itxctcss; int gpsfeet; int default_split_2m; int default_split_70cm; @@ -1218,7 +1218,7 @@ static struct rpt char txkeyed; char exttx; char localtx; - char remrx; + char remrx; char remoterx; char remotetx; char remoteon; @@ -1295,7 +1295,7 @@ static struct rpt int link_longestfunc; int longestfunc; int longestnode; - int threadrestarts; + int threadrestarts; int tailmessagen; time_t disgorgetime; time_t lastthreadrestarttime; @@ -1320,9 +1320,9 @@ static struct rpt char wasvox; int voxtotimer; char voxtostate; - int linkposttimer; - int keyposttimer; - int lastkeytimer; + int linkposttimer; + int keyposttimer; + int lastkeytimer; char newkey; char iaxkey; char inpadtest; @@ -1381,7 +1381,7 @@ static struct rpt struct timeval paging; char deferid; struct timeval lastlinktime; -} rpt_vars[MAXRPTS]; +} rpt_vars[MAXRPTS]; struct nodelog { struct nodelog *next; @@ -1640,7 +1640,7 @@ static int multimode_capable(struct rpt *myrpt) if(!strcmp(myrpt->remoterig, remote_rig_ic706)) return 1; return 0; -} +} /* * Return 1 if rig is narrow capable */ @@ -1654,7 +1654,7 @@ static int narrow_capable(struct rpt *myrpt) if(!strcmp(myrpt->remoterig, remote_rig_tm271)) return 1; return 0; -} +} static char is_paging(struct rpt *myrpt) { @@ -1705,7 +1705,7 @@ static int dovox(struct vox *v,short *buf,int bs) float esquare = 0.0; float energy = 0.0; float threshold = 0.0; - + if (v->voxena < 0) return(v->lastvox); for(i = 0; i < bs; i++) { @@ -1722,7 +1722,7 @@ static int dovox(struct vox *v,short *buf,int bs) v->noise_energy += (energy - v->noise_energy) / 64; else v->noise_energy += (energy - v->noise_energy) / 4; - + if (v->voxena) threshold = v->speech_energy / 8; else { @@ -2068,10 +2068,10 @@ static struct telem_defaults tele_defs[] = { static inline void goertzel_sample(goertzel_state_t *s, short sample) { int v1; - + v1 = s->v2; s->v2 = s->v3; - + s->v3 = (s->fac * s->v2) >> 15; s->v3 = s->v3 - v1 + (sample >> s->chunky); if (abs(s->v3) > 32768) { @@ -2085,7 +2085,7 @@ static inline void goertzel_sample(goertzel_state_t *s, short sample) static inline void goertzel_update(goertzel_state_t *s, short *samps, int count) { int i; - + for (i = 0; i < count; i++) { goertzel_sample(s, samps[i]); } @@ -2332,7 +2332,7 @@ static struct function_table_tag function_table[] = { /* - * Generic serial port open command + * Generic serial port open command */ static int serial_open(char *fname, int speed, int stop2) @@ -2347,7 +2347,7 @@ static int serial_open(char *fname, int speed, int stop2) ast_log(LOG_WARNING,"Cannot open serial port %s\n",fname); return -1; } - + memset(&mode, 0, sizeof(mode)); if (tcgetattr(fd, &mode)) { if(debug >= 1){ @@ -2366,20 +2366,20 @@ static int serial_open(char *fname, int speed, int stop2) if(stop2) mode.c_cflag |= CSTOPB; mode.c_cc[VTIME] = 3; - mode.c_cc[VMIN] = 1; + mode.c_cc[VMIN] = 1; #endif cfsetispeed(&mode, speed); cfsetospeed(&mode, speed); if (tcsetattr(fd, TCSANOW, &mode)){ - if(debug >= 1) + if(debug >= 1) ast_log(LOG_WARNING, "Unable to set serial parameters on %s: %s\n", fname, strerror(errno)); return -1; } usleep(100000); if (debug >= 3) ast_log(LOG_NOTICE,"Opened serial port %s\n",fname); - return(fd); + return(fd); } /* @@ -2410,14 +2410,14 @@ static int serial_rxflush(int fd, int timeoutms) { int res, flushed = 0; char c; - + while((res = serial_rxready(fd, timeoutms)) == 1){ if(read(fd, &c, 1) == -1){ res = -1; break; flushed++; } - } + } return (res == -1)? res : flushed; } /* @@ -2429,7 +2429,7 @@ static int serial_rx(int fd, char *rxbuf, int rxmaxbytes, unsigned timeoutms, ch char c; int i, j, res; - if ((!rxmaxbytes) || (rxbuf == NULL)){ + if ((!rxmaxbytes) || (rxbuf == NULL)){ return 0; } memset(rxbuf,0,rxmaxbytes); @@ -2454,7 +2454,7 @@ static int serial_rx(int fd, char *rxbuf, int rxmaxbytes, unsigned timeoutms, ch rxbuf[i + 1] = 0; if (c == termchr) break; } - } + } if(i && debug >= 6) { printf("i = %d\n",i); printf("String returned was:\n"); @@ -2484,7 +2484,7 @@ static int serial_txstring(int fd, char *txstring) } return 0; } - + /* * Write some bytes to the serial port, then optionally expect a fixed response */ @@ -2598,7 +2598,7 @@ static int uchameleon_connect(struct daq_entry_tag *t) return -1; } /* uchameleon LED on solid once we communicate with it successfully */ - + if(serial_io(t->fd, ledbuf, NULL, strlen(ledbuf), 0, DAQ_RX_TIMEOUT, 0) == -1){ ast_log(LOG_WARNING, "Can't set LED on uchameleon device\n"); close(t->fd); @@ -2626,7 +2626,7 @@ static void uchameleon_alarm_handler(struct daq_pin_entry_tag *p) ast_log(LOG_ERROR,"Out of memory\n"); return; } - + argc = explode_string(valuecopy, argv, 6, ',', 0); if(debug >= 3){ @@ -2775,7 +2775,7 @@ static int uchameleon_pin_init(struct daq_entry_tag *t) } ast_config_destroy(ourcfg); - time(&t->adcacqtime); /* Start ADC Acquisition */ + time(&t->adcacqtime); /* Start ADC Acquisition */ return -0; } @@ -2855,8 +2855,8 @@ static int uchameleon_close(struct daq_entry_tag *t) } t->txhead = t->txtail = NULL; } - - if(t->fd > 0){ + + if(t->fd > 0){ res = close(t->fd); if(res) ast_log(LOG_WARNING, "Error closing serial port"); @@ -2873,7 +2873,7 @@ static int uchameleon_close(struct daq_entry_tag *t) static int uchameleon_do_long( struct daq_entry_tag *t, int pin, int cmd, void (*exec)(struct daq_pin_entry_tag *), int *arg1, void *arg2) -{ +{ int i,j,x; struct daq_pin_entry_tag *p, *listl, *listp; @@ -3012,7 +3012,7 @@ int cmd, void (*exec)(struct daq_pin_entry_tag *), int *arg1, void *arg2) if(arg1) *arg1 = listp->value; } - ast_mutex_unlock(&t->lock); + ast_mutex_unlock(&t->lock); return 0; } @@ -3102,7 +3102,7 @@ int cmd, void (*exec)(struct daq_pin_entry_tag *), int *arg1, void *arg2) ast_mutex_unlock(&t->lock); return -1; } - + /* * Reset a minimum or maximum reading */ @@ -3146,7 +3146,7 @@ static void uchameleon_queue_tx(struct daq_entry_tag *t, char *txbuff) if(!t) return; - + if(!(q = (struct daq_tx_entry_tag *) ast_malloc(sizeof(struct daq_tx_entry_tag)))){ ast_log(LOG_WARNING, "Out of memory\n"); return; @@ -3263,11 +3263,11 @@ static void *uchameleon_monitor_thread(void *this) break; } p = p->next; - } + } ast_mutex_unlock(&t->lock); } } - + if(time(&now) >= t->adcacqtime){ t->adcacqtime = now + DAQ_ADC_ACQINT; @@ -3277,7 +3277,7 @@ static void *uchameleon_monitor_thread(void *this) } /* Go through the pin linked list looking for new work */ - ast_mutex_lock(&t->lock); + ast_mutex_lock(&t->lock); p = t->pinhead; while(p){ /* Time to acquire all ADC channels ? */ @@ -3325,7 +3325,7 @@ static void *uchameleon_monitor_thread(void *this) p->state = DAQ_PS_IDLE; } break; - + case DAQ_CMD_ADC: if(p->pintype == DAQ_PT_INADC){ snprintf(txbuff,sizeof(txbuff),"adc %d\n", p->num); @@ -3351,7 +3351,7 @@ static void *uchameleon_monitor_thread(void *this) "Invalid ADC pin number %d\n", p->num); p->state = DAQ_PS_IDLE; break; - } + } if((p->pintype == DAQ_PT_INP) && (p->num < 9)){ ast_log(LOG_WARNING, "Invalid INP pin number %d\n", p->num); @@ -3390,7 +3390,7 @@ static void *uchameleon_monitor_thread(void *this) } /* if */ p = p->next; } /* while */ - + /* Transmit queued commands */ while(t->txhead){ q = t->txhead; @@ -3412,7 +3412,7 @@ static void *uchameleon_monitor_thread(void *this) ast_log(LOG_ERROR,"Tx failed, terminating monitor thread\n"); return this; /* Now, we die */ } - + ast_mutex_lock(&t->lock); }/* while */ ast_mutex_unlock(&t->lock); @@ -3569,7 +3569,7 @@ static int daq_reset_minmax(char *device, int pin, int minmax) { int res = -1; struct daq_entry_tag *t; - + if(!(t = daq_devtoentry(device))) return -1; switch(t->type){ @@ -3621,14 +3621,14 @@ static void daq_init(struct ast_config *cfg) *t_next = t; t_next = &t->next; - daq.ndaqs++; + daq.ndaqs++; if(daq.ndaqs >= MAX_DAQ_ENTRIES) break; var = var->next; } -} +} /* * Uninitialize DAQ Subsystem @@ -3675,15 +3675,15 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c char *argv[5]; char *sound_files[MAX_METER_FILES+1]; char *range_strings[MAX_DAQ_RANGES+1]; - char *bitphrases[3]; + char *bitphrases[3]; static char *filter_keywords[]={"none","max","min","stmin","stmax","stavg",NULL}; struct daq_entry_tag *entry; - + if(!(myargs = ast_strdup(args))){ /* Make a local copy to slice and dice */ ast_log(LOG_WARNING, "Out of memory\n"); return -1; } - + i = explode_string(myargs, argv, 4, ',', 0); if((i != 4) && (i != 3)){ /* Must have 3 or 4 substrings, no more, no less */ ast_log(LOG_WARNING,"Wrong number of arguments for meter telemetry function is: %d s/b 3 or 4", i); @@ -3692,7 +3692,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c } if(debug >= 3){ ast_log(LOG_NOTICE,"Device: %s, Pin: %s, Meter Face: %s Filter: %s\n", - argv[0],argv[1],argv[2], argv[3]); + argv[0],argv[1],argv[2], argv[3]); } if(i == 4){ @@ -3705,8 +3705,8 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c filter--; } else - filter = DAQ_SUB_CUR; - + filter = DAQ_SUB_CUR; + /* Find our device */ if(!(entry = daq_devtoentry(argv[0]))){ ast_log(LOG_WARNING,"Cannot find device %s in daq-list\n",argv[0]); @@ -3747,7 +3747,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c if(!(p = ast_variable_retrieve(myrpt->cfg,"meter-faces", argv[2]))){ ast_log(LOG_WARNING,"Meter face %s not found", argv[2]); - ast_free(myargs); + ast_free(myargs); return -1; } @@ -3756,7 +3756,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_free(myargs); return -1; } - + if(!strncmp("scale", meter_face, 5)){ /* scale function? */ metertype = 1; if((!(end = strchr(meter_face,')')))|| @@ -3782,7 +3782,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_free(meter_face); return -1; - } + } } else if(!strncmp("range", meter_face, 5)){ /* range function */ metertype = 2; @@ -3796,7 +3796,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c } *start++ = 0; *end = 0; - sounds = end + 2; + sounds = end + 2; /* * Parse range entries */ @@ -3826,7 +3826,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_free(myargs); ast_free(meter_face); return -1; - } + } } else{ ast_log(LOG_WARNING,"Meter face %s needs to specify one of scale, range or bit\n", argv[2]); @@ -3899,14 +3899,14 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_log(LOG_NOTICE,"sounds = %s\n", sounds); } - + /* Wait the normal telemetry delay time */ - + if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) goto done; - + /* Split up the sounds string */ - + files = explode_string(sounds, sound_files, MAX_METER_FILES, ',', 0); if(files == 0){ ast_log(LOG_WARNING,"No sound files to say for meter %s\n",argv[2]); @@ -3947,13 +3947,13 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c if(metertype == 3){ res = sayfile(mychannel, bitphrases[(val) ? 1: 0]); } - + } else{ res = sayfile(mychannel, sound_files[i]); /* Say the next word in the list */ - } + } } -done: +done: /* Done */ ast_free(myargs); ast_free(meter_face); @@ -3987,7 +3987,7 @@ static int handle_userout_tele(struct rpt *myrpt, struct ast_channel *mychannel, } if(debug >= 3){ ast_log(LOG_NOTICE,"USEROUT Device: %s, Pin: %s, Requested state: %s\n", - argv[0],argv[1],argv[2]); + argv[0],argv[1],argv[2]); } pin = atoi(argv[1]); reqstate = atoi(argv[2]); @@ -4006,17 +4006,17 @@ static int handle_userout_tele(struct rpt *myrpt, struct ast_channel *mychannel, /* Set or reset the bit */ res = daq_do( t, pin, DAQ_CMD_OUT, reqstate); - + /* Wait the normal telemetry delay time */ - + if(!res) if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) goto done; /* Say the files one by one at argc index 3 */ for(i = 3; i < argc && !res; i++){ res = sayfile(mychannel, argv[i]); /* Say the next word in the list */ - } - + } + done: ast_free(myargs); return 0; @@ -4035,7 +4035,7 @@ static int function_meter(struct rpt *myrpt, char *param, char *digitbuf, int co if(debug) ast_log(LOG_NOTICE, "meter param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - + rpt_telem_select(myrpt,command_source,mylink); rpt_telemetry(myrpt,METER,param); return DC_COMPLETE; @@ -4054,7 +4054,7 @@ static int function_userout(struct rpt *myrpt, char *param, char *digitbuf, int return DC_ERROR; ast_log(LOG_NOTICE, "userout param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - + rpt_telem_select(myrpt,command_source,mylink); rpt_telemetry(myrpt,USEROUT,param); return DC_COMPLETE; @@ -4073,14 +4073,14 @@ static int function_cmd(struct rpt *myrpt, char *param, char *digitbuf, int comm return DC_ERROR; ast_log(LOG_NOTICE, "cmd param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - + if (param) { if (*param == '#') /* to execute asterisk cli command */ { ast_cli_command(nullfd,param + 1); } else - { + { cp = ast_malloc(strlen(param) + 10); if (!cp) { @@ -4098,9 +4098,9 @@ static int function_cmd(struct rpt *myrpt, char *param, char *digitbuf, int comm /* - ********************** -* End of DAQ functions* -* ********************* +************************ +* End of DAQ functions * +************************ */ @@ -4249,9 +4249,9 @@ int nonlocals; { while(tlist != &myrpt->tele) { - if ((tlist->mode == PLAYBACK) || + if ((tlist->mode == PLAYBACK) || (tlist->mode == STATS_GPS_LEGACY) || - (tlist->mode == ID1) || + (tlist->mode == ID1) || (tlist->mode == TEST_TONE)) nonlocals++; tlist = tlist->next; } @@ -4301,7 +4301,7 @@ static int linkcount(struct rpt *myrpt) // continue; //} numoflinks++; - + l = l->next; } // ast_log(LOG_NOTICE, "numoflinks=%i\n",numoflinks); @@ -4322,13 +4322,13 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.memory, memory); if (!val){ return -1; - } + } strncpy(tmp,val,sizeof(tmp) - 1); tmp[sizeof(tmp)-1] = 0; s = strchr(tmp,','); if (!s) - return 1; + return 1; *s++ = 0; s1 = strchr(s,','); if (!s1) @@ -4352,7 +4352,7 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) case 'a': strcpy(myrpt->rxpl, "100.0"); strcpy(myrpt->txpl, "100.0"); - myrpt->remmode = REM_MODE_AM; + myrpt->remmode = REM_MODE_AM; break; case 'B': case 'b': @@ -4366,35 +4366,35 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) case 'L': case 'l': myrpt->powerlevel = REM_LOWPWR; - break; + break; case 'H': case 'h': myrpt->powerlevel = REM_HIPWR; break; - + case 'M': case 'm': myrpt->powerlevel = REM_MEDPWR; break; - + case '-': myrpt->offset = REM_MINUS; break; - + case '+': myrpt->offset = REM_PLUS; break; - + case 'S': case 's': myrpt->offset = REM_SIMPLEX; break; - + case 'T': case 't': myrpt->txplon = 1; break; - + case 'R': case 'r': myrpt->rxplon = 1; @@ -4596,10 +4596,10 @@ struct termios mode; return 0; } -/* +/* * open the serial port */ - + static int openserial(struct rpt *myrpt,char *fname) { struct termios mode; @@ -4641,7 +4641,7 @@ static int openserial(struct rpt *myrpt,char *fname) /* * Process DTMF keys passed - */ + */ static void local_dtmfkey_helper(struct rpt *myrpt,char c) { @@ -4687,7 +4687,7 @@ static void mdc1200_notify(struct rpt *myrpt,char *fromnode, char *data) fl.l_pid = pthread_self(); if (fcntl(fileno(fp),F_SETLKW,&fl) == -1) { - ast_log(LOG_ERROR,"Cannot get lock on MDC1200 log file %s\n",myrpt->p.mdclog); + ast_log(LOG_ERROR,"Cannot get lock on MDC1200 log file %s\n",myrpt->p.mdclog); fclose(fp); return; } @@ -4723,7 +4723,7 @@ char str[200]; wf.subclass = 0; wf.offset = 0; wf.mallocd = 0; - AST_FRAME_DATA(wf) = str; + AST_FRAME_DATA(wf) = str; wf.datalen = strlen(str) + 1; // Isuani, 20141001 wf.samples = 0; wf.src = "mdc1200_send"; @@ -4739,7 +4739,7 @@ char str[200]; l = l->next; continue; } - if (l->chan) rpt_qwrite(l,&wf); + if (l->chan) rpt_qwrite(l,&wf); l = l->next; } return; @@ -4753,7 +4753,7 @@ static void mdc1200_cmd(struct rpt *myrpt, char *data) busy = 0; if ((data[0] == 'I') && (!strcmp(data,myrpt->lastmdc))) return; myval = (char *) my_variable_match(myrpt->cfg, myrpt->p.mdcmacro, data); - if (myval) + if (myval) { if (option_verbose) ast_verbose("MDCMacro for %s doing %s on node %s\n",data,myval,myrpt->name); if ((*myval == 'K') || (*myval == 'k')) @@ -4964,7 +4964,7 @@ char *str = instr; * * Returns number of substrings found. */ - + static int explode_string(char *str, char *strp[], int limit, char delim, char quote) { @@ -4983,7 +4983,7 @@ int i,l,inquo; if(quote) { if (*str == quote) - { + { if (inquo) { *str = 0; @@ -4995,7 +4995,7 @@ int i,l,inquo; inquo = 1; } } - } + } if ((*str == delim) && (!inquo)) { *str = 0; @@ -5014,7 +5014,7 @@ int i,l,inquo; * strp- list of pointers to substrings (this is built by this function), NULL will be placed at end of list * limit- maximum number of substrings to process */ - + static int finddelim(char *str, char *strp[], int limit) @@ -5093,7 +5093,7 @@ int n; static int send_usb_txt(struct rpt *myrpt, char *txt) { struct ast_frame wf; - + /* if (debug) */ ast_log(LOG_NOTICE, "send_usb_txt %s\n",txt); wf.frametype = AST_FRAME_TEXT; wf.subclass = 0; @@ -5114,7 +5114,7 @@ static int send_link_pl(struct rpt *myrpt, char *txt) struct ast_frame wf; struct rpt_link *l; char str[300]; - + if (!strcmp(myrpt->p.ctgroup,"0")) return 0; snprintf(str, sizeof(str), "C %s %s %s", myrpt->name, myrpt->p.ctgroup, txt); /* if (debug) */ ast_log(LOG_NOTICE, "send_link_pl %s\n",str); @@ -5183,7 +5183,7 @@ int i,spos; { snprintf(buf + spos,MAXLINKLIST - spos, "%c%s",mode,l->name); - } + } } /* if we are in tranceive mode, let all modes stand */ if (mode == 'T') continue; @@ -5297,7 +5297,7 @@ struct ast_var_t *newvariable; var1p = ((pbx_checkcondition(var1) > 0)); } // pbx_builtin_setvar_helper(myrpt->rxchannel,cmpvar,var); - ast_free(cmpvar); + ast_free(cmpvar); c = toupper(c); if (!strchr("TFNI",c)) { @@ -5372,13 +5372,13 @@ struct ast_var_t *newvariable; { thisAction = i; break; - } - } + } + } if (thisAction < 0) { ast_log(LOG_ERROR, "Unknown action name %s.\n", argv[0]); continue; - } + } if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Event on node %s doing rpt command %s for condition %s\n", myrpt->name,cmd,v->value); @@ -5395,7 +5395,7 @@ struct ast_var_t *newvariable; strncpy(myrpt->cmdAction.digits, argv[2], MAXDTMF); myrpt->cmdAction.command_source = SOURCE_RPT; myrpt->cmdAction.state = CMD_STATE_READY; - } + } else { ast_log(LOG_NOTICE,"Could not execute event %s for %s: Command buffer in use\n",cmd,argv[1]); @@ -5447,7 +5447,7 @@ struct ast_var_t *newvariable; sprintf(cmpvar,"XX_%s",argv[2]); var1 = (char *) pbx_builtin_getvar_helper(myrpt->rxchannel,cmpvar); pbx_builtin_setvar_helper(myrpt->rxchannel,cmpvar,var); - ast_free(cmpvar); + ast_free(cmpvar); } if (option_verbose < 5) return; i = 0; @@ -5465,7 +5465,7 @@ struct ast_var_t *newvariable; /* * Routine to update boolean values used in currently referenced rpt structure */ - + static void rpt_update_boolean(struct rpt *myrpt,char *varname, int newval) { @@ -5483,7 +5483,7 @@ char buf[10]; /* * Updates the active links (channels) list that that the repeater has */ - + static void rpt_update_links(struct rpt *myrpt) { @@ -5522,7 +5522,7 @@ int i; if (!myrpt->p.discpgm) return; i = strlen(them) + strlen(myrpt->p.discpgm) + 100; a = ast_malloc(i); - if (!a) + if (!a) { ast_log(LOG_NOTICE,"Unable to alloc"); return; @@ -5543,7 +5543,7 @@ int i; if (!myrpt->p.connpgm) return; i = strlen(them) + strlen(myrpt->p.connpgm) + + 100; a = ast_malloc(i); - if (!a) + if (!a) { ast_log(LOG_NOTICE,"Unable to alloc"); return; @@ -5598,10 +5598,10 @@ unsigned int seq; } -/* - * Function stream data +/* + * Function stream data */ - + static void startoutstream(struct rpt *myrpt) { char *str; @@ -5666,7 +5666,7 @@ int n; return; } -/* +/* * AllStar Network node lookup function. This function will take the nodelist that has been read into memory * and try to match the node number that was passed to it. If it is found, the function requested will succeed. * If not, it will fail. Called when a connection to a remote node is requested. @@ -5704,12 +5704,12 @@ struct ast_variable *vp; } } ast_mutex_lock(&nodelookuplock); - if (!myrpt->p.extnodefilesn) + if (!myrpt->p.extnodefilesn) { ast_mutex_unlock(&nodelookuplock); return(0); } - /* determine longest node length again */ + /* determine longest node length again */ longestnode = 0; vp = ast_variable_browse(myrpt->cfg, myrpt->p.nodes); while(vp) @@ -5772,7 +5772,7 @@ static struct ast_config *ourcfg; if (!enod) enod = EXTNODES; ast_mutex_lock(&nodelookuplock); efil = ast_strdup(val); - if (!efil) + if (!efil) { ast_config_destroy(ourcfg); if (ourcfg) ast_config_destroy(ourcfg); @@ -5833,7 +5833,7 @@ int i,ls; if(!strncmp(string, keywords[i], ls)){ if(param) *param = string + ls; - return i + 1; + return i + 1; } } if(param) @@ -5848,7 +5848,7 @@ int i,ls; static char *skipchars(char *string, char *charlist) { -int i; +int i; while(*string){ for(i = 0; charlist[i] ; i++){ if(*string == charlist[i]){ @@ -5860,8 +5860,8 @@ int i; return string; } return string; -} - +} + static int myatoi(char *str) @@ -5927,7 +5927,7 @@ struct rptfilter *f; If /etc/localtime is not present, you will get GMT time! This is especially important on systems running embedded linux distributions as they don't usually - have support for locales. + have support for locales. If OLD_ASTERISK is defined, then the older localtime_r function will be used. The /etc/localtime file is not @@ -5979,7 +5979,7 @@ static time_t rpt_mktime(struct tm *tm,char *zone) #endif /* Retrieve an int from a config file */ - + static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int min, int max, int defl) { char *var; @@ -5989,8 +5989,8 @@ static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int if(min < 0){ /* If min is negative, this means include 0 as a valid entry */ min = -min; include_zero = 1; - } - + } + var = (char *) ast_variable_retrieve(myrpt->cfg, category, name); if(var){ ret = myatoi(var); @@ -6006,10 +6006,10 @@ static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int return ret; } -/* +/* * This is the initialization function. This routine takes the data in rpt.conf and setup up the variables needed for each of * the repeaters that it finds. There is some minor sanity checking done on the data passed, but not much. - * + * * Note that this is kind of a mess to read. It uses the asterisk native function to read config files and pass back values assigned to * keywords. */ @@ -6097,8 +6097,8 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis else rpt_vars[n].p.statpost_program = STATPOST_PROGRAM; rpt_vars[n].p.statpost_url = (char *) ast_variable_retrieve(cfg,this,"statpost_url"); - rpt_vars[n].p.tailmessagetime = retrieve_astcfgint(&rpt_vars[n],this, "tailmessagetime", 0, 200000000, 0); - rpt_vars[n].p.tailsquashedtime = retrieve_astcfgint(&rpt_vars[n],this, "tailsquashedtime", 0, 200000000, 0); + rpt_vars[n].p.tailmessagetime = retrieve_astcfgint(&rpt_vars[n],this, "tailmessagetime", 0, 200000000, 0); + rpt_vars[n].p.tailsquashedtime = retrieve_astcfgint(&rpt_vars[n],this, "tailsquashedtime", 0, 200000000, 0); rpt_vars[n].p.duplex = retrieve_astcfgint(&rpt_vars[n],this,"duplex",0,4,(ISRANGER(rpt_vars[n].name) ? 0 : 2)); rpt_vars[n].p.idtime = retrieve_astcfgint(&rpt_vars[n],this, "idtime", -60000, 2400000, IDTIME); /* Enforce a min max including zero */ rpt_vars[n].p.politeid = retrieve_astcfgint(&rpt_vars[n],this, "politeid", 30000, 300000, POLITEID); /* Enforce a min max */ @@ -6144,11 +6144,11 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis { val = FUNCTIONS; rpt_vars[n].p.simple = 1; - } + } rpt_vars[n].p.functions = val; val = (char *) ast_variable_retrieve(cfg,this,"link_functions"); if (val) rpt_vars[n].p.link_functions = val; - else + else rpt_vars[n].p.link_functions = rpt_vars[n].p.functions; val = (char *) ast_variable_retrieve(cfg,this,"phone_functions"); if (val) rpt_vars[n].p.phone_functions = val; @@ -6159,11 +6159,11 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis val = (char *) ast_variable_retrieve(cfg,this,"alt_functions"); if (val) rpt_vars[n].p.alt_functions = val; val = (char *) ast_variable_retrieve(cfg,this,"funcchar"); - if (!val) rpt_vars[n].p.funcchar = FUNCCHAR; else - rpt_vars[n].p.funcchar = *val; + if (!val) rpt_vars[n].p.funcchar = FUNCCHAR; else + rpt_vars[n].p.funcchar = *val; val = (char *) ast_variable_retrieve(cfg,this,"endchar"); - if (!val) rpt_vars[n].p.endchar = ENDCHAR; else - rpt_vars[n].p.endchar = *val; + if (!val) rpt_vars[n].p.endchar = ENDCHAR; else + rpt_vars[n].p.endchar = *val; val = (char *) ast_variable_retrieve(cfg,this,"nobusyout"); if (val) rpt_vars[n].p.nobusyout = ast_true(val); val = (char *) ast_variable_retrieve(cfg,this,"notelemtx"); @@ -6182,7 +6182,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis rpt_vars[n].p.extnodes = val; val = (char *) ast_variable_retrieve(cfg,this,"extnodefile"); if (!val) val = EXTNODEFILE; - rpt_vars[n].p.extnodefilesn = + rpt_vars[n].p.extnodefilesn = explode_string(val,rpt_vars[n].p.extnodefiles,MAX_EXTNODEFILES,',',0); val = (char *) ast_variable_retrieve(cfg,this,"locallinknodes"); if (val) rpt_vars[n].p.locallinknodesn = explode_string(ast_strdup(val),rpt_vars[n].p.locallinknodes,MAX_LOCALLINKNODES,',',0); @@ -6195,40 +6195,40 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis val = (char *) ast_variable_retrieve(cfg,this,"archivedir"); if (val) rpt_vars[n].p.archivedir = val; val = (char *) ast_variable_retrieve(cfg,this,"authlevel"); - if (val) rpt_vars[n].p.authlevel = atoi(val); + if (val) rpt_vars[n].p.authlevel = atoi(val); else rpt_vars[n].p.authlevel = 0; val = (char *) ast_variable_retrieve(cfg,this,"parrot"); if (val) rpt_vars[n].p.parrotmode = (ast_true(val)) ? 2 : 0; else rpt_vars[n].p.parrotmode = 0; val = (char *) ast_variable_retrieve(cfg,this,"parrottime"); - if (val) rpt_vars[n].p.parrottime = atoi(val); + if (val) rpt_vars[n].p.parrottime = atoi(val); else rpt_vars[n].p.parrottime = PARROTTIME; val = (char *) ast_variable_retrieve(cfg,this,"rptnode"); rpt_vars[n].p.rptnode = val; val = (char *) ast_variable_retrieve(cfg,this,"mars"); - if (val) rpt_vars[n].p.remote_mars = atoi(val); + if (val) rpt_vars[n].p.remote_mars = atoi(val); else rpt_vars[n].p.remote_mars = 0; val = (char *) ast_variable_retrieve(cfg,this,"monminblocks"); - if (val) rpt_vars[n].p.monminblocks = atol(val); + if (val) rpt_vars[n].p.monminblocks = atol(val); else rpt_vars[n].p.monminblocks = DEFAULT_MONITOR_MIN_DISK_BLOCKS; val = (char *) ast_variable_retrieve(cfg,this,"remote_inact_timeout"); - if (val) rpt_vars[n].p.remoteinacttimeout = atoi(val); + if (val) rpt_vars[n].p.remoteinacttimeout = atoi(val); else rpt_vars[n].p.remoteinacttimeout = DEFAULT_REMOTE_INACT_TIMEOUT; val = (char *) ast_variable_retrieve(cfg,this,"civaddr"); - if (val) rpt_vars[n].p.civaddr = atoi(val); + if (val) rpt_vars[n].p.civaddr = atoi(val); else rpt_vars[n].p.civaddr = DEFAULT_CIV_ADDR; val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout"); - if (val) rpt_vars[n].p.remotetimeout = atoi(val); + if (val) rpt_vars[n].p.remotetimeout = atoi(val); else rpt_vars[n].p.remotetimeout = DEFAULT_REMOTE_TIMEOUT; val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning"); - if (val) rpt_vars[n].p.remotetimeoutwarning = atoi(val); + if (val) rpt_vars[n].p.remotetimeoutwarning = atoi(val); else rpt_vars[n].p.remotetimeoutwarning = DEFAULT_REMOTE_TIMEOUT_WARNING; val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning_freq"); - if (val) rpt_vars[n].p.remotetimeoutwarningfreq = atoi(val); + if (val) rpt_vars[n].p.remotetimeoutwarningfreq = atoi(val); else rpt_vars[n].p.remotetimeoutwarningfreq = DEFAULT_REMOTE_TIMEOUT_WARNING_FREQ; val = (char *) ast_variable_retrieve(cfg,this,"erxgain"); if (!val) val = DEFAULT_ERXGAIN; - rpt_vars[n].p.erxgain = pow(10.0,atof(val) / 20.0); + rpt_vars[n].p.erxgain = pow(10.0,atof(val) / 20.0); val = (char *) ast_variable_retrieve(cfg,this,"etxgain"); if (!val) val = DEFAULT_ETXGAIN; rpt_vars[n].p.etxgain = pow(10.0,atof(val) / 20.0); @@ -6239,7 +6239,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis if (rpt_vars[n].p.eannmode > 3) rpt_vars[n].p.eannmode = 3; val = (char *) ast_variable_retrieve(cfg,this,"trxgain"); if (!val) val = DEFAULT_TRXGAIN; - rpt_vars[n].p.trxgain = pow(10.0,atof(val) / 20.0); + rpt_vars[n].p.trxgain = pow(10.0,atof(val) / 20.0); val = (char *) ast_variable_retrieve(cfg,this,"ttxgain"); if (!val) val = DEFAULT_TTXGAIN; rpt_vars[n].p.ttxgain = pow(10.0,atof(val) / 20.0); @@ -6252,7 +6252,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis if (!val) val = DEFAULT_LINKMONGAIN; rpt_vars[n].p.linkmongain = pow(10.0,atof(val) / 20.0); val = (char *) ast_variable_retrieve(cfg,this,"discpgm"); - rpt_vars[n].p.discpgm = val; + rpt_vars[n].p.discpgm = val; val = (char *) ast_variable_retrieve(cfg,this,"connpgm"); rpt_vars[n].p.connpgm = val; val = (char *) ast_variable_retrieve(cfg,this,"mdclog"); @@ -6275,7 +6275,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis val = (char *) ast_variable_retrieve(cfg, this, "holdofftelem"); rpt_vars[n].p.holdofftelem = ast_true(val); val = (char *) ast_variable_retrieve(cfg, this, "beaconing"); - rpt_vars[n].p.beaconing = ast_true(val); + rpt_vars[n].p.beaconing = ast_true(val); val = (char *) ast_variable_retrieve(cfg,this,"rxburstfreq"); if (val) rpt_vars[n].p.rxburstfreq = atoi(val); else rpt_vars[n].p.rxburstfreq = 0; @@ -6410,7 +6410,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis /* retrieve the stanza name for the control states if there is one */ val = (char *) ast_variable_retrieve(cfg,this,"controlstates"); rpt_vars[n].p.csstanzaname = val; - + /* retrieve the stanza name for the scheduler if there is one */ val = (char *) ast_variable_retrieve(cfg,this,"scheduler"); rpt_vars[n].p.skedstanzaname = val; @@ -6459,7 +6459,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis longestnode = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.nodes); - + while(vp){ j = strlen(vp->name); if (j > longestnode) @@ -6468,9 +6468,9 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis } rpt_vars[n].longestnode = longestnode; - + /* - * For this repeater, Determine the length of the longest function + * For this repeater, Determine the length of the longest function */ rpt_vars[n].longestfunc = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.functions); @@ -6481,7 +6481,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis vp = vp->next; } /* - * For this repeater, Determine the length of the longest function + * For this repeater, Determine the length of the longest function */ rpt_vars[n].link_longestfunc = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.link_functions); @@ -6532,7 +6532,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis rpt_vars[n].macro_longest = j; vp = vp->next; } - + /* Browse for control states */ if(rpt_vars[n].p.csstanzaname) vp = ast_variable_browse(cfg, rpt_vars[n].p.csstanzaname); @@ -6544,8 +6544,8 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis strncpy(s1, vp->value, 255); s1[255] = 0; nukw = finddelim(s1,strs,32); - - for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */ + + for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */ for(j = 0 ; cs_keywords[j] != NULL ; j++){ /* try to match to one in our internal table */ if(!strcmp(strs[k],cs_keywords[j])){ switch(j){ @@ -6555,7 +6555,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis case 1: /* rptdis */ rpt_vars[n].p.s[statenum].txdisable = 1; break; - + case 2: /* apena */ rpt_vars[n].p.s[statenum].autopatchdisable = 0; break; @@ -6567,7 +6567,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis case 4: /* lnkena */ rpt_vars[n].p.s[statenum].linkfundisable = 0; break; - + case 5: /* lnkdis */ rpt_vars[n].p.s[statenum].linkfundisable = 1; break; @@ -6575,7 +6575,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis case 6: /* totena */ rpt_vars[n].p.s[statenum].totdisable = 0; break; - + case 7: /* totdis */ rpt_vars[n].p.s[statenum].totdisable = 1; break; @@ -6636,7 +6636,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis /* * Enable or disable debug output at a given level at the console */ - + static int rpt_do_debug(int fd, int argc, char *argv[]) { int newlevel; @@ -6651,14 +6651,14 @@ static int rpt_do_debug(int fd, int argc, char *argv[]) else ast_cli(fd, "app_rpt Debugging disabled\n"); - debug = newlevel; + debug = newlevel; return RESULT_SUCCESS; } /* * Dump rpt struct debugging onto console */ - + static int rpt_do_dump(int fd, int argc, char *argv[]) { int i; @@ -6692,7 +6692,7 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) int uptime; long long totaltxtime; struct rpt_link *l; - char *listoflinks[MAX_STAT_LINKS]; + char *listoflinks[MAX_STAT_LINKS]; char *lastdtmfcommand,*parrot_ena; char *tot_state, *ider_state, *patch_state; char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena; @@ -6705,8 +6705,8 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) if(argc != 3) return RESULT_SHOWUSAGE; - tot_state = ider_state = - patch_state = reverse_patch_state = + tot_state = ider_state = + patch_state = reverse_patch_state = input_signal = not_applicable; called_number = lastdtmfcommand = NULL; @@ -6903,8 +6903,8 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) if(j % 4 == 3){ ast_cli(fd, "\n"); ast_cli(fd, " : "); - } - else{ + } +\ else{ if((numoflinks - 1) - j > 0) ast_cli(fd, ", "); } @@ -7010,7 +7010,7 @@ static int rpt_do_lstats(int fd, int argc, char *argv[]) connstate = "CONNECTING"; ast_cli(fd, "%-10s%-20s%-12d%-11s%-20s%-20s\n", s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime, connstate); - } + } /* destroy our local link queue */ s = s_head.next; while(s != &s_head){ @@ -7018,7 +7018,7 @@ static int rpt_do_lstats(int fd, int argc, char *argv[]) s = s->next; remque((struct qelem *)t); ast_free(t); - } + } return RESULT_SUCCESS; } } @@ -7150,20 +7150,20 @@ static int rpt_do_xnode(int fd, int argc, char *argv[]) //### GET CONNECTED NODE INFO #################### - // Traverse the list of connected nodes + // Traverse the list of connected nodes __mklinklist(myrpt,NULL,lbuf,0); j = 0; l = myrpt->links.next; while(l && (l != &myrpt->links)){ - if (l->name[0] == '0'){ // Skip '0' nodes + if (l->name[0] == '0'){ // Skip '0' nodes l = l->next; continue; } if((s = (struct rpt_lstat *) ast_malloc(sizeof(struct rpt_lstat))) == NULL){ ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n"); - rpt_mutex_unlock(&myrpt->lock); // UNLOCK + rpt_mutex_unlock(&myrpt->lock); // UNLOCK return RESULT_FAILURE; } memset(s, 0, sizeof(struct rpt_lstat)); @@ -7200,16 +7200,16 @@ static int rpt_do_xnode(int fd, int argc, char *argv[]) connstate = "CONNECTING"; ast_cli(fd, "%-10s%-20s%-12d%-11s%-20s%-20s~", s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime, connstate); - } + } ast_cli(fd,"\n\n"); - // destroy our local link queue + // destroy our local link queue s = s_head.next; while(s != &s_head){ t = s; s = s->next; remque((struct qelem *)t); ast_free(t); - } + } //### GET ALL LINKED NODES INFO #################### /* parse em */ @@ -7323,15 +7323,15 @@ static int rpt_do_local_nodes(int fd, int argc, char *argv[]) for (i=0; i< nrpts; i++) { if (rpt_vars[i].name[0]) - ast_cli(fd, "%s\n", rpt_vars[i].name); + ast_cli(fd, "%s\n", rpt_vars[i].name); } /* for i */ ast_cli(fd,"\n"); return RESULT_SUCCESS; -} +} /* -* reload vars +* reload vars */ static int rpt_do_reload(int fd, int argc, char *argv[]) @@ -7346,7 +7346,7 @@ static int rpt_do_reload(int fd, int argc, char *argv[]) /* * restart app_rpt */ - + static int rpt_do_restart(int fd, int argc, char *argv[]) { int i; @@ -7363,7 +7363,7 @@ int i; /* * send an app_rpt DTMF function from the CLI */ - + static int rpt_do_fun(int fd, int argc, char *argv[]) { int i,busy=0; @@ -7393,7 +7393,7 @@ static int rpt_do_fun(int fd, int argc, char *argv[]) /* * send an Audio File from the CLI */ - + static int rpt_do_playback(int fd, int argc, char *argv[]) { int i; @@ -7403,7 +7403,7 @@ static int rpt_do_playback(int fd, int argc, char *argv[]) for(i = 0; i < nrpts; i++){ if(!strcmp(argv[2], rpt_vars[i].name)){ struct rpt *myrpt = &rpt_vars[i]; - rpt_telemetry(myrpt,PLAYBACK,argv[3]); + rpt_telemetry(myrpt,PLAYBACK,argv[3]); } } return RESULT_SUCCESS; @@ -7439,7 +7439,7 @@ static int rpt_do_sendtext(int fd, int argc, char *argv[]) { if (i > 3) strncat(str," ",sizeof(str) - 1); strncat(str,argv[i],sizeof(str) - 1); - } + } for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7450,7 +7450,7 @@ static int rpt_do_sendtext(int fd, int argc, char *argv[]) /* otherwise, send it to all of em */ while(l != &myrpt->links) { - if (l->name[0] == '0') + if (l->name[0] == '0') { l = l->next; continue; @@ -7483,7 +7483,7 @@ static int rpt_do_page(int fd, int argc, char *argv[]) { if (i > 5) strncat(str," ",sizeof(str) - 1); strncat(str,argv[i],sizeof(str) - 1); - } + } for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7496,7 +7496,7 @@ static int rpt_do_page(int fd, int argc, char *argv[]) telem = myrpt->tele.next; while(telem != &myrpt->tele) { - if (((telem->mode == ID) || (telem->mode == ID1) || + if (((telem->mode == ID) || (telem->mode == ID1) || (telem->mode == IDTALKOVER)) && (!telem->killed)) { if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */ @@ -7528,7 +7528,7 @@ static int rpt_do_sendall(int fd, int argc, char *argv[]) { if (i > 3) strncat(str," ",sizeof(str) - 1); strncat(str,argv[i],sizeof(str) - 1); - } + } for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7539,7 +7539,7 @@ static int rpt_do_sendall(int fd, int argc, char *argv[]) /* otherwise, send it to all of em */ while(l != &myrpt->links) { - if (l->name[0] == '0') + if (l->name[0] == '0') { l = l->next; continue; @@ -7616,7 +7616,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) int thisAction = -1; struct rpt *myrpt = NULL; if (argc != 6) return RESULT_SHOWUSAGE; - + for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7632,7 +7632,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) ast_cli(fd, "Unknown node number %s.\n", argv[2]); return RESULT_FAILURE; } /* if thisRpt < 0 */ - + /* Look up the action */ l = strlen(argv[3]); for(i = 0 ; i < maxActions; i++) @@ -7643,7 +7643,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) break; } /* if !strncasecmp... */ } /* for i */ - + if (thisAction < 0) { ast_cli(fd, "Unknown action name %s.\n", argv[3]); @@ -7673,7 +7673,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) } /* rpt_do_cmd() */ /* -* set a node's main channel variable from the command line +* set a node's main channel variable from the command line */ static int rpt_do_setvar(int fd, int argc, char *argv[]) { @@ -7687,15 +7687,15 @@ static int rpt_do_setvar(int fd, int argc, char *argv[]) { thisRpt = i; break; - } - } + } + } if (thisRpt < 0) { ast_cli(fd, "Unknown node number %s.\n", argv[2]); return RESULT_FAILURE; - } - + } + for (x = 3; x < argc; x++) { name = argv[x]; if ((value = strchr(name, '='))) { @@ -7708,7 +7708,7 @@ static int rpt_do_setvar(int fd, int argc, char *argv[]) } /* -* Display a node's main channel variables from the command line +* Display a node's main channel variables from the command line */ static int rpt_do_showvars(int fd, int argc, char *argv[]) { @@ -7722,14 +7722,14 @@ static int rpt_do_showvars(int fd, int argc, char *argv[]) { thisRpt = i; break; - } - } + } + } if (thisRpt < 0) { ast_cli(fd, "Unknown node number %s.\n", argv[2]); return RESULT_FAILURE; - } + } i = 0; ast_cli(fd,"Variable listing for node %s:\n",argv[2]); ast_channel_lock(rpt_vars[thisRpt].rxchannel); @@ -7743,10 +7743,10 @@ static int rpt_do_showvars(int fd, int argc, char *argv[]) } /* -* Perform frong-in-a-blender calculations (Jacobsen Corollary) +* Perform frong-in-a-blender calculations (Jacobsen Corollary) */ - - + + static int rpt_do_frog(int fd, int argc, char *argv[]) { double warpone = 75139293848.398696166028333356763; @@ -7770,7 +7770,7 @@ static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude))) return res; - + while(chan->generatordata) { if (ast_safe_sleep(chan,1)) return -1; } @@ -7788,7 +7788,7 @@ static int play_tone(struct ast_channel *chan, int freq, int duration, int ampli /* * Hooks for CLI functions */ - + static char *res2cli(int r) { @@ -8121,7 +8121,7 @@ static int morse_cat(char *str, int freq, int duration) if(!str) return -1; - len = strlen(str); + len = strlen(str); p = str+len; if(len){ @@ -8130,7 +8130,7 @@ static int morse_cat(char *str, int freq, int duration) } snprintf(p, 62,"!%d/%d", freq, duration); - + return 0; } @@ -8212,7 +8212,7 @@ static struct morse_bits mbits[] = { int res; int c; char *str = NULL; - + res = 0; @@ -8220,34 +8220,34 @@ static struct morse_bits mbits[] = { if(!str) return -1; str[0] = '\0'; - + /* Approximate the dot time from the speed arg. */ - + dottime = 900/speed; - + /* Establish timing releationships */ - + dashtime = 3 * dottime; intralettertime = dottime; interlettertime = dottime * 4 ; interwordtime = dottime * 7; - + for(;(*string) && (!res); string++){ - + c = *string; - + /* Convert lower case to upper case */ - + if((c >= 'a') && (c <= 'z')) c -= 0x20; - + /* Can't deal with any char code greater than Z, skip it */ - + if(c > 'Z') continue; - + /* If space char, wait the inter word time */ - + if(c == ' '){ if(!res){ if((res = morse_cat(str, 0, interwordtime))) @@ -8255,18 +8255,18 @@ static struct morse_bits mbits[] = { } continue; } - + /* Subtract out control char offset to match our table */ - + c -= 0x20; - + /* Get the character data */ - + len = mbits[c].len; ddcomb = mbits[c].ddcomb; - + /* Send the character */ - + for(; len ; len--){ if(!res) res = morse_cat(str, freq, (ddcomb & 1) ? dashtime : dottime); @@ -8274,14 +8274,14 @@ static struct morse_bits mbits[] = { res = morse_cat(str, 0, intralettertime); ddcomb >>= 1; } - + /* Wait the interletter time */ - + if(!res) res = morse_cat(str, 0, interlettertime - intralettertime); } - + /* Wait for all the characters to be sent */ if(!res){ @@ -8294,8 +8294,8 @@ static struct morse_bits mbits[] = { res = -1; break; } - } - + } + } if(str) ast_free(str); @@ -8314,12 +8314,12 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) int res; int i; int flags; - + res = 0; if(!tonestring) return res; - + p = stringp = ast_strdup(tonestring); for(;tonestring;){ @@ -8336,8 +8336,8 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) ast_free(p); if(!res) res = play_tone_pair(chan, 0, 0, 100, 0); /* This is needed to ensure the last tone segment is timed correctly */ - - if (!res) + + if (!res) res = ast_waitstream(chan, ""); ast_stopstream(chan); @@ -8347,7 +8347,7 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) */ for(i = 0; i < 20 ; i++){ - flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; + flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags); if(flags & DAHDI_IOMUX_WRITEEMPTY) break; @@ -8356,9 +8356,9 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) break; } } - + return res; - + } //# Say a file - streams file to output channel @@ -8368,7 +8368,7 @@ static int sayfile(struct ast_channel *mychannel,char *fname) int res; res = ast_streamfile(mychannel, fname, mychannel->language); - if (!res) + if (!res) res = ast_waitstream(mychannel, ""); else ast_log(LOG_WARNING, "ast_streamfile %s failed on %s\n", fname, mychannel->name); @@ -8447,7 +8447,7 @@ char *val,fname[300],str[100]; } if (name[0] != '3') return res; if (myrpt->p.eannmode < 2) return res; - sprintf(str,"%d",atoi(name + 1)); + sprintf(str,"%d",atoi(name + 1)); if (elink_db_get(str,'n',NULL,fname,NULL) < 1) return res; res = sayphoneticstr(mychannel,fname); return res; @@ -8457,37 +8457,37 @@ static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry) { int res; char c; - + int morsespeed; int morsefreq; int morseampl; int morseidfreq; int morseidampl; - + res = 0; - + morsespeed = retrieve_astcfgint(myrpt, myrpt->p.morse, "speed", 5, 20, 20); morsefreq = retrieve_astcfgint(myrpt, myrpt->p.morse, "frequency", 300, 3000, 800); morseampl = retrieve_astcfgint(myrpt, myrpt->p.morse, "amplitude", 200, 8192, 4096); morseidampl = retrieve_astcfgint(myrpt, myrpt->p.morse, "idamplitude", 200, 8192, 2048); morseidfreq = retrieve_astcfgint(myrpt, myrpt->p.morse, "idfrequency", 300, 3000, 330); - + /* Is it a file, or a tone sequence? */ - + if(entry[0] == '|'){ c = entry[1]; if((c >= 'a')&&(c <= 'z')) c -= 0x20; - + switch(c){ case 'I': /* Morse ID */ res = send_morse(chan, entry + 2, morsespeed, morseidfreq, morseidampl); break; - + case 'M': /* Morse Message */ res = send_morse(chan, entry + 2, morsespeed, morsefreq, morseampl); break; - + case 'T': /* Tone sequence */ res = send_tone_telemetry(chan, entry + 2); break; @@ -8508,7 +8508,7 @@ static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry) static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, char *name) { - + int res; int i; char *entry; @@ -8517,8 +8517,8 @@ static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, entry = NULL; entry = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.telemetry, name); - - /* Try to look up the telemetry name */ + + /* Try to look up the telemetry name */ if(!entry){ /* Telemetry name wasn't found in the config file, use the default */ @@ -8527,7 +8527,7 @@ static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, entry = tele_defs[i].value; } } - if(entry){ + if(entry){ if(strlen(entry)) if (chan) telem_any(myrpt,chan, entry); } @@ -8546,17 +8546,17 @@ static int get_wait_interval(struct rpt *myrpt, int type) int interval; char *wait_times; char *wait_times_save; - + wait_times_save = NULL; wait_times = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "wait_times"); - + if(wait_times){ wait_times_save = ast_strdup(wait_times); if(!wait_times_save) return 0; - + } - + switch(type){ case DLY_TELEM: if(wait_times) @@ -8564,42 +8564,42 @@ static int get_wait_interval(struct rpt *myrpt, int type) else interval = 1000; break; - + case DLY_ID: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "idwait",250,5000,500); else interval = 500; break; - + case DLY_UNKEY: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "unkeywait",50,5000,1000); else interval = 1000; break; - + case DLY_LINKUNKEY: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "linkunkeywait",500,5000,1000); else interval = 1000; break; - + case DLY_CALLTERM: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "calltermwait",500,5000,1500); else interval = 1500; break; - + case DLY_COMP: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "compwait",500,5000,200); else interval = 200; break; - + case DLY_PARROT: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "parrotwait",500,5000,200); @@ -8619,18 +8619,18 @@ static int get_wait_interval(struct rpt *myrpt, int type) if(wait_times_save) ast_free(wait_times_save); return interval; -} +} /* -* Wait a configurable interval of time +* Wait a configurable interval of time */ static int wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan) { int interval; do { - while (myrpt->p.holdofftelem && + while (myrpt->p.holdofftelem && (myrpt->keyed || (myrpt->remrx && (type != DLY_ID)))) { if (ast_safe_sleep(chan,100) < 0) return -1; @@ -8655,18 +8655,18 @@ static int split_freq(char *mhz, char *decimals, char *freq); //### BEGIN TELEMETRY CODE SECTION /* * Routine to process various telemetry commands that are in the myrpt structure - * Used extensively when links and build/torn down and other events are processed by the - * rpt_master threads. + * Used extensively when links and build/torn down and other events are processed by the + * rpt_master threads. */ - + /* * * WARNING: YOU ARE NOW HEADED INTO ONE GIANT MAZE OF SWITCH STATEMENTS THAT DO MOST OF THE WORK FOR - * APP_RPT. THE MAJORITY OF THIS IS VERY UNDOCUMENTED CODE AND CAN BE VERY HARD TO READ. + * APP_RPT. THE MAJORITY OF THIS IS VERY UNDOCUMENTED CODE AND CAN BE VERY HARD TO READ. * IT IS ALSO PROBABLY THE MOST ERROR PRONE PART OF THE CODE, ESPECIALLY THE PORTIONS * RELATED TO THREADED OPERATIONS. */ - + static void handle_varcmd_tele(struct rpt *myrpt,struct ast_channel *mychannel,char *varcmd) { char *strs[100],*p,buf[100],c; @@ -8767,20 +8767,20 @@ struct tm localtm; if (!strcasecmp(strs[0],"CONNFAIL")) { - if (n < 2) return; + if (n < 2) return; if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) return; res = saynode(myrpt,mychannel,strs[1]); - if (!res) + if (!res) sayfile(mychannel, "rpt/connection_failed"); return; } if (!strcasecmp(strs[0],"REMDISC")) { - if (n < 2) return; + if (n < 2) return; if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) return; res = saynode(myrpt,mychannel,strs[1]); - if (!res) + if (!res) sayfile(mychannel, "rpt/remote_disc"); return; } diff --git a/configs/asterisk.conf b/configs/asterisk.conf index f55e6311..a04983ae 100644 --- a/configs/asterisk.conf +++ b/configs/asterisk.conf @@ -1,2 +1,44 @@ +[directories] +astetcdir => /etc/asterisk +astmoddir => /usr/lib/asterisk/modules +astvarlibdir => /var/lib/asterisk +astdatadir => /var/lib/asterisk +astagidir => /var/lib/asterisk/agi-bin +astspooldir => /var/spool/asterisk +astrundir => /var/run +astlogdir => /var/log/asterisk + [options] -nocolor=yes +languageprefix = yes ; Use the new sound prefix path syntax +;verbose = 3 +;debug = 3 +;alwaysfork = yes ; same as -F at startup +;nofork = yes ; same as -f at startup +;quiet = yes ; same as -q at startup +;timestamp = yes ; same as -T at startup +;execincludes = yes ; support #exec in config files +;console = yes ; Run as console (same as -c at startup) +;highpriority = yes ; Run realtime priority (same as -p at startup) +;initcrypto = yes ; Initialize crypto keys (same as -i at startup) +;nocolor = yes ; Disable console colors +;dontwarn = yes ; Disable some warnings +;dumpcore = yes ; Dump core on crash (same as -g at startup) +;internal_timing = yes +;systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues +;maxcalls = 10 ; Maximum amount of calls allowed +;maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit +;cache_record_files = yes ; Cache recorded sound files to another directory during recording +;record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files) +;transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded +;transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated +;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly +;runuser = asterisk ; The user to run as +;rungroup = asterisk ; The group to run as +;dahdichanname = yes ; Channels created by chan_dahdi will be called 'DAHDI', otherwise 'Zap' + +; Changing the following lines may compromise your security. +;[files] +;astctlpermissions = 0660 +;astctlowner = root +;astctlgroup = apache +;astctl = asterisk.ctl diff --git a/configs/beagleboard/modules.conf b/configs/beagleboard/modules.conf index 4e23dd41..d20cbd53 100644 --- a/configs/beagleboard/modules.conf +++ b/configs/beagleboard/modules.conf @@ -3,11 +3,214 @@ ; ; Module Loader configuration file ; +; By default DIAL does NOT load every module, only what is needed + +; You can enable or disable any of the asterisk modules +; All modules are compiled and installed. + +; To enable a module: load => module_name.so +; To disable a module: noload => module_name.so + +; You will want to enable the channel driver modules you will be using. +; There are below in the Channel Driver section +; The most common Channel drivers for app_rpt are: +; chan_echolink.so echolink channel driver +; chan_simpleusb.so Simple USB Radio Interface Channel Drive +; chan_usbradio.so USB Console Channel Driver +; chan_usrp.so USRP Channel Module +; chan_voter.so radio Voter channel driver [modules] -autoload=yes -noload=chan_oss.so -noload=chan_alsa.so -noload=chan_phone.so + +autoload=no + +; Applications + +noload => app_adsiprog.so ; Asterisk ADSI Programming Application +noload => app_alarmreceiver.so ; Alarm Receiver for Asterisk +noload => app_amd.so ; Answering Machine Detection Application +load => app_authenticate.so ; Authentication Application +noload => app_cdr.so ; Tell Asterisk to not maintain a CDR for +noload => app_chanisavail.so ; Check channel availability +noload => app_channelredirect.so ; Channel Redirect +noload => app_chanspy.so ; Listen to the audio of an active channel +noload => app_controlplayback.so ; Control Playback Application +noload => app_dahdibarge.so ; Barge in on channel application +noload => app_dahdiras.so ; DAHDI RAS Application +noload => app_dahdiscan.so ; Scan Zap channels application +noload => app_db.so ; Database Access Functions +load => app_dial.so ; Dialing Application +noload => app_dictate.so ; Virtual Dictation Machine +noload => app_directed_pickup.so ; Directed Call Pickup Application +noload => app_directory.so ; Extension Directory +noload => app_disa.so ; DISA (Direct Inward System Access) Appli +noload => app_dumpchan.so ; Dump Info About The Calling Channel +noload => app_echo.so ; Simple Echo Application +load => app_exec.so ; Executes dialplan applications +noload => app_externalivr.so ; External IVR Interface Application +noload => app_festival.so ; Simple Festival Interface +noload => app_flash.so ; Flash channel application +noload => app_followme.so ; Find-Me/Follow-Me Application +noload => app_forkcdr.so ; Fork The CDR into 2 separate entities +noload => app_getcpeid.so ; Get ADSI CPE ID +noload => app_gps.so ; GPS interface module +noload => app_hasnewvoicemail.so ; Indicator for whether a voice mailbox ha +noload => app_ices.so ; Encode and Stream via icecast and ices +noload => app_image.so ; Image Transmission Application +noload => app_lookupblacklist.so ; Look up Caller*ID name/number from black +noload => app_lookupcidname.so ; Look up CallerID Name from local databas +load => app_macro.so ; Extension Macros +noload => app_meetme.so ; MeetMe conference bridge +noload => app_milliwatt.so ; Digital Milliwatt (mu-law) Test Applicat +noload => app_mixmonitor.so ; Mixed Audio Monitoring Application +noload => app_morsecode.so ; Morse code +noload => app_mp3.so ; Silly MP3 Application +noload => app_nbscat.so ; Silly NBS Stream Application +noload => app_page.so ; Page Multiple Phones +noload => app_parkandannounce.so ; Call Parking and Announce Application +load => app_playback.so ; Sound File Playback Application +noload => app_privacy.so ; Require phone number to be entered, if n +noload => app_queue.so ; True Call Queueing +noload => app_radbridge.so ; Radio Bridging interface module +noload => app_random.so ; Random goto +noload => app_readfile.so ; Stores output of file into a variable +noload => app_read.so ; Read Variable Application +noload => app_realtime.so ; Realtime Data Lookup/Rewrite +noload => app_record.so ; Trivial Record Application +load => app_rpt.so ; Radio Repeater/Remote Base Application +noload => app_sayunixtime.so ; Say time +noload => app_senddtmf.so ; Send DTMF digits Application +load => app_sendtext.so ; Send Text Applications +noload => app_setcallerid.so ; Set CallerID Application +noload => app_setcdruserfield.so ; CDR user field apps +noload => app_settransfercapability.so ; Set ISDN Transfer Capability +noload => app_sms.so ; SMS/PSTN handler +noload => app_softhangup.so ; Hangs up the requested channel +noload => app_speech_utils.so ; Dialplan Speech Applications +noload => app_stack.so ; Stack Routines +load => app_system.so ; Generic System() application +noload => app_talkdetect.so ; Playback with Talk Detection +noload => app_test.so ; Interface Test Application +load => app_transfer.so ; Transfer +noload => app_url.so ; Send URL Applications +noload => app_userevent.so ; Custom User Event Application +noload => app_verbose.so ; Send verbose output +noload => app_voicemail.so ; Comedian Mail (Voicemail System) +noload => app_waitforring.so ; Waits until first ring after time +noload => app_waitforsilence.so ; Wait For Silence +noload => app_while.so ; While Loops and Conditional Execution +noload => app_zapateller.so ; Block Telemarketers with Special Informa + +; CDR + +noload => cdr_csv.so ; Comma Separated Values CDR Backend +noload => cdr_custom.so ; Customizable Comma Separated Values CDR +noload => cdr_manager.so ; Asterisk Manager Interface CDR Backend + +; Channels + +noload => chan_agent.so ; Agent Proxy Channel +noload => chan_alsa.so ; ALSA Console Channel Driver +load => chan_beagle.so ; Beagleboard Radio Interface Channel Driver +load => chan_dahdi.so ; DAHDI Telephony +noload => chan_echolink.so ; echolink Channel Driver +noload => chan_features.so ; Feature Proxy Channel +noload => chan_gtalk.so ; Gtalk Channel Driver +load => chan_iax2.so ; Inter Asterisk eXchange (Ver 2) +load => chan_local.so ; Local Proxy Channel (Note: used internal +noload => chan_oss.so ; Channel driver for OSS sound cards +noload => chan_phone.so ; Generic Linux Telephony Interface driver +noload => chan_pi.so ; DMK Engineering "PITA" Board on Rpi2/3 Channel Driver +noload => chan_simpleusb.so ; CM1xx USB Cards with Radio Interface Channel Driver (No DSP) +noload => chan_sip.so ; Session Initiation Protocol (SIP) +noload => chan_tlb.so ; TheLinkBox Channel Driver +noload => chan_usbradio.so ; CM1xx USB Cards with Radio Interface Channel Driver (DSP) +noload => chan_usrp.so ; GNU Radio interface USRP Channel Driver +noload => chan_voter.so ; Radio Voter Channel Driver + +; Codecs + +; CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers) +; ULAW best 87 kilobits per second (kbps) +; ADPCM good 55 kbps +; GSM mediocre 36 kbps +; g726aal2 +; ilbc + +load => codec_adpcm.so ; Adaptive Differential PCM Coder/Decoder +load => codec_alaw.so ; A-law Coder/Decoder +load => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder +noload => codec_dahdi.so ; Generic DAHDI Transcoder Codec Translato +load => codec_g726.so ; ITU G.726-32kbps G726 Transcoder +load => codec_gsm.so ; GSM Coder/Decoder +load => codec_ulaw.so ; mu-Law Coder/Decoder +noload => codec_ilbc.so ; http://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec + +; Formats + +load => format_g723.so ; G.723.1 Simple Timestamp File Format +load => format_g726.so ; Raw G.726 (16/24/32/40kbps) data +load => format_g729.so ; Raw G729 data +load => format_gsm.so ; Raw GSM data +load => format_h263.so ; Raw H.263 data +load => format_h264.so ; Raw H.264 data +load => format_ilbc.so ; Raw iLBC data +noload => format_jpeg.so ; JPEG (Joint Picture Experts Group) Image +load => format_pcm.so ; Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. +load => format_sln.so ; Raw Signed Linear Audio support (SLN) +load => format_vox.so ; Dialogic VOX (ADPCM) File Format +load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) +load => format_wav.so ; Microsoft WAV format (8000Hz Signed Line + +; Functions + +load => func_base64.so ; base64 encode/decode dialplan functions +load => func_callerid.so ; Caller ID related dialplan function +load => func_cdr.so ; CDR dialplan function +load => func_channel.so ; Channel information dialplan function +load => func_curl.so ; Load external URL +load => func_cut.so ; Cut out information from a string +load => func_db.so ; Database (astdb) related dialplan functi +load => func_enum.so ; ENUM related dialplan functions +load => func_env.so ; Environment/filesystem dialplan function +load => func_global.so ; Global variable dialplan functions +load => func_groupcount.so ; Channel group dialplan functions +load => func_language.so ; Channel language dialplan function +load => func_logic.so ; Logical dialplan functions +load => func_math.so ; Mathematical dialplan function +load => func_md5.so ; MD5 digest dialplan functions +load => func_moh.so ; Music-on-hold dialplan function +load => func_rand.so ; Random number dialplan function +load => func_realtime.so ; Read/Write values from a RealTime reposi +noload => func_sha1.so ; SHA-1 computation dialplan function +noload => func_strings.so ; String handling dialplan functions +noload => func_timeout.so ; Channel timeout dialplan functions +noload => func_uri.so ; URI encode/decode dialplan functions + +; PBX + +noload => pbx_ael.so ; Asterisk Extension Language Compiler +load => pbx_config.so ; Text Extension Configuration +noload => pbx_dundi.so ; Distributed Universal Number Discovery ( +noload => pbx_loopback.so ; Loopback Switch +noload => pbx_realtime.so ; Realtime Switch +noload => pbx_spool.so ; Outgoing Spool Support + +; Resources + +load => res_adsi.so ; ADSI Resource +noload => res_agi.so ; Asterisk Gateway Interface (AGI) +noload => res_clioriginate.so ; Call origination from the CLI +noload => res_convert.so ; File format conversion CLI command +load => res_crypto.so ; Cryptographic Digital Signatures +load => res_features.so ; Call Features Resource +load => res_indications.so ; Indications Resource +noload => res_jabber.so ; AJI - Asterisk Jabber Interface +noload => res_monitor.so ; Call Monitoring Resource +noload => res_musiconhold.so ; Music On Hold Resource +noload => res_smdi.so ; Simplified Message Desk Interface (SMDI) +noload => res_snmp.so ; SNMP [Sub]Agent for Asterisk +noload => res_speech.so ; Generic Speech Recognition API [global] + diff --git a/configs/beagleboard/rpt.conf b/configs/beagleboard/rpt.conf index 40bab8ab..94eccf33 100644 --- a/configs/beagleboard/rpt.conf +++ b/configs/beagleboard/rpt.conf @@ -1,106 +1,444 @@ ; Radio Repeater configuration file (for use with app_rpt) -; -; ; Your Repeater -; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [1999] ; Change this to your assigned node number -rxchannel = Beagle/1 ; Rx audio/signalling channel -erxgain=-3 ; Echolink receive gain adjustment + ; Must also be enabled in modules.conf + ; Rx audio/signalling channel. Choose ONLY 1 per node stanza + + ; Enable the selected channel driver in modules.conf !!! +; rxchannel = dahdi/pseudo ; No radio (hub) +; rxchannel = SimpleUSB/usb_1999 ; SimpleUSB +; rxchannel = Pi/1 ; Raspberry Pi PiTA +; rxchannel = Radio/usb_1999 ; USBRadio (DSP) +; rxchannel = Dahdi/1 ; PCI Quad card +rxchannel = Beagle/1 ; BeagleBoard +; rxchannel = USRP/127.0.0.1:34001:32001; GNU Radio interface USRP + +duplex = 1 ; 0 = Half duplex with no telemetry tones or hang time. + ; Special Case: Full duplex if linktolink is set to yes. + ; This mode is preferred when interfacing with an external multiport repeater controller. + ; Comment out idrecording and idtalkover to suppress IDs also + ; 1 = Half duplex with telemetry tones and hang time. Does not repeat audio. + ; This mode is preferred when interfacing a simplex node. + ; 2 = Full Duplex with telemetry tones and hang time. + ; This mode is preferred when interfacing a repeater. + ; 3 = Full Duplex with telemetry tones and hang time, but no repeated audio. + ; 4 = Full Duplex with telemetry tones and hang time. Repeated audio only when the autopatch is down. + +linktolink = no ; disables forcing physical half-duplex operation of main repeater while + ; still keeping half-duplex semantics (optional) + +linkmongain = 0 ; Link Monitor Gain adjusts the audio level of monitored nodes when a signal from another node or the local receiver is received. + ; If linkmongain is set to a negative number the monitored audio will decrease by the set amount in db. + ; If linkmongain set to a positive number monitored audio will increase by the set amount in db. + ; The value of linkmongain is in db. The default value is 0 db. + +erxgain = -3 ; Echolink receive gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -etxgain=3 ; Echolink transmit gain adjustment +etxgain = 3 ; Echolink transmit gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -;controlstates=controlstates ; system control state list -;scheduler=schedule; ; scheduler entries -functions=functions ; Repeater Function Table -phone_functions=functions ; Repeater Function Table -link_functions=functions ; Link Function Table -telemetry=telemetry ; Telemetry descriptions -wait_times=wait-times ; Wait times -context = radio ; dialing context for phone -callerid = "Repeater" <0000000000> ; callerid for phone calls -idrecording = |iid ; id recording or morse string -accountcode=RADIO ; account code (optional) -hangtime=1000 ; squelch tail hang time (in ms) (optional) -althangtime=4000 ; longer squelch tail -totime=170000 ; transmit time-out time (in ms) (optional) -idtime=540000 ; id interval time (in ms) (optional) -; The default values for hangtime, time-out time, and id interval time are -; 5 seconds (5000 ms), 3 minutes (180000 ms), and 5 minutes (300000 ms) -; respectively - -politeid=30000 ; time in milliseconds before ID timer - - ; expires to try and ID in the tail. - ; (optional, default is 30000). -idtalkover=|iid ; Talkover ID (optional) default is none -unlinkedct=ct2 ; unlinked courtesy tone (optional) default is none -remotect=ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) -linkunkeyct=ct8 ; sent when a transmission received over the link unkeys -;nolocallinkct=0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). -;eannmode=1 ; Default: 1 = Say only node number on echolink connects - ; 2 = say phonetic call sign only on echolink connects - ; 3 = say phonetic call sign and node number on echolink connects -;connpgm=yourconnectprogram ; Default: Disabled. Execute a program you specify on connect. +;eannmode = 1 ; 1 = Say only node number on echolink connects (default = 1) + ; 2 = say phonetic call sign only on echolink connects + ; 3 = say phonetic call sign and node number on echolink connects + +;controlstates = controlstates ; system control state stanza + +scheduler = schedule ; scheduler stanza +functions = functions ; Repeater Function stanza +phone_functions = functions ; Phone Function stanza +link_functions = functions ; Link Function stanza + +telemetry = telemetry ; Telemetry stanza +morse = morse ; Morse stanza +wait_times = wait-times ; Wait times stanza + +context = radio ; dialing context for phone +callerid = "Repeater" <0000000000> ; callerid for phone calls +accountcode = RADIO ; account code (optional) + +hangtime = 5000 ; squelch tail hang time (in ms) (optional, default 5 seconds, 5000 ms) +althangtime = 4000 ; longer squelch tail +totime = 180000 ; transmit time-out time (in ms) (optional, default 3 minutes 180000 ms) + +idrecording = |iWA4XYZ ; cording or morse string see http://ohnosec.org/drupal/node/87 +idtalkover = |iWA4XYZ ; Talkover ID (optional) default is none see http://ohnosec.org/drupal/node/129 + ; See Telemetry section Example: idrecording = rpt/nodenames/1999 +idtime = 540000 ; id interval time (in ms) (optional) Default 5 minutes (300000 ms) +politeid = 30000 ; time in milliseconds before ID timer expires to try and ID in the tail. (optional, default 30000) + +unlinkedct = ct2 ; Send a this courtesy tone when the user unkeys if the node is not connected to any other nodes. (optional, default is none) +remotect = ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) +linkunkeyct = ct8 ; sent when a transmission received over the link unkeys +;nolocallinkct = 0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). + +;connpgm = yourconnectprogram ; Disabled. Execute a program you specify on connect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being connected to us (them) -;discpgm=yourdisconnectprogram ; Default: Disabled. Execute a program you specify on disconnect. +;discpgm = yourdisconnectprogram ; Disabled. Execute a program you specify on disconnect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being disconnected from us (them) -;lnkactenable=0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. -;lnkacttime=1800 ; Link activity timer time in seconds. -;lnkactmacro=*52 ; Function to execute when link activity timer expires. -;lnkacttimerwarn=30seconds ; Message to play when the link activity timer has 30 seconds left. -;remote_inact_timeout=1800 ; Inactivity timer for remote base nodes only (set to 0 to disable). -;remote_timeout=3600 ; Session time out for remote base. (set to 0 to disable) -;nounkeyct=0 ; Set to a 1 to eliminate courtesy tones and associated delays. -;holdofftelem=0 ; Hold off all telemetry when signal is present on receiver or from connected nodes -; ; except when an ID needs to be done and there is a signal coming from a connected node. -;beaconing=0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) -; -; + +;lnkactenable = 0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. + +;lnkacttime = 1800 ; Link activity timer time in seconds. +;lnkactmacro = *52 ; Function to execute when link activity timer expires. +;lnkacttimerwarn = 30seconds ; Message to play when the link activity timer has 30 seconds left. + +;remote_inact_timeout = ; Specifies the amount of time without keying from the link. Set to 0 to disable timeout. (15 * 60) +;remote_timeout = ; Session time out for remote base. Set to 0 to disable. (60 * 60) +;remote_timeout_warning_freq = ; 30 +;remote_timeout_warning = ; (3 * 60) + +;nounkeyct = 0 ; Set to a 1 to eliminate courtesy tones and associated delays. + +holdofftelem = 0 ; Hold off all telemetry when signal is present on receiver or from connected nodes + ; except when an ID needs to be done and there is a signal coming from a connected node. + +telemdefault = 1 ; 0 = telemetry output off + ; 1 = telemetry output on (default = 1) + ; 2 = timed telemetry output on command execution and for a short time thereafter. + +telemdynamic = 1 ; 0 = disallow users to change the local telemetry setting with a COP command, + ; 1 = Allow users to change the setting with a COP command. (default = 1) + +;beaconing = 0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) + +parrotmode = 0 ; 0 = Parrot Off (default = 0) + ; 1 = Parrot On Command + ; 2 = Parrot Always + ; 3 = Parrot Once by Command + +parrottime = 1000 ; Set the amount of time in milliseconds + ; to wait before parroting what was received + +;rxnotch=1065,40 ; (Optional) Notch a particular frequency for a specified + ; b/w. app_rpt must have been compiled with + ; the notch option + +startup_macro = + +; nodenames = /var/lib/asterisk/sounds/rpt/nodenames.callsign ; Point to alternate nodename sound directory + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Need more information on these + +;extnodes = extnodes-different ; section in extnodefile containing dynamic node information (optional) +;extnodefile = /foo/nodes ; Points to nodelist file containing dynamic node info default = /var/lib/asterisk/rpt_extnodes (optional) +;extnodefile2 = ; Is this a list of node files? Possible a list of private nodes or a list of static IPs for known nodes???? +;nodenames = /foo/names ; locaton of node sound files default = /var/lib/asterisk/sounds/rpt/nodenames +;archivedir = /tmp ; defines and enables activity recording into specified directory (optional) +;monminblocks = 2048 ; Min 1K blocks to be left on partition (will not save monitor output if disk too full) + +; ; The tailmessagetime,tailsquashedtime, and tailmessagelist need to be set +; ; to support tail messages. They can be omitted otherwise. +;tailmessagetime = 300000 ; Play a tail message every 5 mins +;tailsquashedtime = 30000 ; If squashed by another user, +; ; try again after 30 seconds +;tailmessagelist = msg1,msg2 ; list of messages to be played for tail message + +; alt_functions +; ctgroup +; dphone_functions +; idtime +; iobase +; iospeed +; locallist +; mars Remote Base +; memory +; nobusyout +; nodes +; nolocallinkct +; notelemtx +; outxlat +; parrot +; propagate_phonedtmf +; rptnode +; rptinactmacro Macro to execute when inactivity timer expires +; rptinacttime Inactivity timer time in seconds (0 seconds disables feature) +; rxnotch Optional Audio notch +; simplexphonedelay +; tonemacro +; tonezone +; txlimits + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ; *** Status Reporting *** -; -; Uncomment the either group following two statpost lines to report the status of your node to stats.allstarlink.org -; depending on whether you are running ACID or Limey Linux. -; ** For ACID *** -;statpost_program=/usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +; Uncomment either group following two statpost lines to report the status of your node to stats.allstarlink.org +; depending on whether you are running ACID, Debian or Limey Linux. +; The difference is simply where your wget is located. + +; ** For ACID and Debian *** +;statpost_program = /usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates ; ** For Limey Linux ** -;statpost_program=/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +;statpost_program = /bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates +[functions] +; Prefix Functions +; *1 Disconnect Link +; *2 Monitor Link +; *3 Connect Link +; *4 Command Mode +; *5 Macros +; *6 User Functions +; *7 Connection Status/Functions +; *8 User Functions +; *9 User Functions +; *0 User Functions + +; *A User Functions +; *B User Functions +; *C User Functions +; *D User Functions + + +; Mandatory Command Codes +; http://docs.allstarlink.org/drupal/node/91 + +1 = ilink,1 ; Disconnect specified link +2 = ilink,2 ; Connect specified link -- monitor only +3 = ilink,3 ; Connect specified link -- tranceive +4 = ilink,4 ; Enter command mode on specified link +70 = ilink,5 ; System status +99 = cop,6 ; PTT (phone mode only) + +; End Mandatory Command Codes + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Macro Commands +5 = macro + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Autopatch Commands +; Note, This may be a good place for other 2 digit frequently used commands + +61 = autopatchup,noct = 1,farenddisconnect = 1,dialtime = 20000 ; Autopatch up +62 = autopatchdn ; Autopatch down + +; autopatchup can optionally take comma delimited setting=value pairs: + +; context = string ; Override default context with "string" +; dialtime = ms ; Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) +; farenddisconnect = 1 ; Automatically disconnect when called party hangs up +; noct = 1 ; Don't send repeater courtesy tone during autopatch calls +; quiet = 1 ; Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up + ; Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Status Commands + +; 1 - Force ID (global) +; 2 - Give Time of Day (global) +; 3 - Give software Version (global) +; 4 - Give GPS location info +; 5 - Last (dtmf) user +; 11 - Force ID (local only) +; 12 - Give Time of Day (local only) + +721 = status,1 ; Force ID (global) +722 = status,2 ; Give Time of Day (global) +723 = status,3 ; Give software Version (global) +724 = status,4 ; Give GPS location info +725 = status,5 ; Last (dtmf) user +711 = status,11 ; Force ID (local only) +712 = status,12 ; Give Time of Day (local only) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Link Commands + +; 1 - Disconnect specified link +; 2 - Connect specified link -- monitor only +; 3 - Connect specified link -- tranceive +; 4 - Enter command mode on specified link +; 5 - System status +; 6 - Disconnect all links +; 7 - Last Node to Key Up +; 8 - Connect specified link -- local monitor only +; 9 - Send Text Message (9,,Message Text, etc. +; 10 - Disconnect all RANGER links (except permalinks) +; 11 - Disconnect a previously permanently connected link +; 12 - Permanently connect specified link -- monitor only +; 13 - Permanently connect specified link -- tranceive +; 15 - Full system status (all nodes) +; 16 - Reconnect links disconnected with "disconnect all links" +; 17 - MDC test (for diag purposes) +; 18 - Permanently Connect specified link -- local monitor only + +; ilink commands 1 through 5 are defined in the Mandatory Command section + +806 = ilink,6 ; Disconnect all links +807 = ilink,7 ; Last Node to Key Up +808 = ilink,8 ; Connect specified link -- local monitor only +809 = ilink,9,1999,"Testing" ; would send a text message to node 1999 replace 1999 with 0 for all connected nodes +810 = ilink,10 ; Disconnect all RANGER links (except permalinks) +811 = ilink,11 ; Disconnect a previously permanently connected link +812 = ilink,12 ; Permanently connect specified link -- monitor only +813 = ilink,13 ; Permanently connect specified link -- tranceive +815 = ilink,15 ; Full system status (all nodes) +816 = ilink,16 ; Reconnect links disconnected with "disconnect all links" +817 = ilink,17 ; MDC test (for diag purposes) +818 = ilink 18 ; Permanently Connect specified link -- local monitor only + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Control operator (cop) functions. Change these to something other than these codes listed below! + +901 = cop,1 ; System warm boot +902 = cop,2 ; System enable +903 = cop,3 ; System disable + +904 = cop,4 ; Test tone on/off (toggle) +905 = cop,5 ; Dump system variables on console (debug use only) + +907 = cop,7 ; Time out timer enable +908 = cop,8 ; Time out timer disable + +909 = cop,9 ; Autopatch enable +910 = cop,10 ; Autopatch disable + +911 = cop,11 ; User linking functions enable +912 = cop,12 ; User linking functions disable + +913 = cop,13 ; Query system control state +914 = cop,14 ; Set system control state + +915 = cop,15 ; Scheduler enable +916 = cop,16 ; Scheduler disable + +917 = cop,17 ; User functions enable (time, id, etc) +918 = cop,18 ; User functions disable + +919 = cop,19 ; Select alternate hang time (althangtime) +920 = cop,20 ; Select standard hangtime (hangtime) + +921 = cop,21 ; Enable Parrot Mode +922 = cop,22 ; Disable Parrot Mode +923 = cop,23 ; Birdbath (Current Parrot Cleanup/Flush) + +924 = cop,24 ; Flush all telemetry +925 = cop,25 ; Query last node un-keyed +926 = cop,26 ; Query all nodes keyed/unkeyed +927 = cop,27 ; Reset DAQ minimum on a pin +928 = cop,28 ; Reset DAQ maximum on a pin + +930 = cop,30 ; Recall Memory Setting in Attached Xcvr + +931 = cop,31 ; Channel Selector for Parallel Programmed Xcvr + +932 = cop,32 ; Touchtone pad test: command + Digit string + # to playback all digits pressed + +933 = cop,33 ; Local Telemetry Output Enable +934 = cop,34 ; Local Telemetry Output Disable +935 = cop,35 ; Local Telemetry Output on Demand + +936 = cop,36 ; Foreign Link Local Output Path Enable +937 = cop,37 ; Foreign Link Local Output Path Disable +938 = cop,38 ; Foreign Link Local Output Path Follows Local Telemetry +939 = cop,39 ; Foreign Link Local Output Path on Demand + +942 = cop,42 ; Echolink announce node # only +943 = cop,43 ; Echolink announce node Callsign only +944 = cop,44 ; Echolink announce node # & Callsign + +945 = cop,45 ; Link Activity timer enable +945 = cop,46 ; Link Activity timer disable +947 = cop,47 ; Reset "Link Config Changed" Flag + +948 = cop,48 ; Send Page Tone (Tone specs separated by parenthesis) + +949 = cop,49 ; Disable incoming connections (control state noice) +950 = cop,50 ; Enable incoming connections (control state noicd) + +951 = cop,51 ; Enable sleep mode +952 = cop,52 ; Disable sleep mode +953 = cop,53 ; Wake up from sleep +954 = cop,54 ; Go to sleep +955 = cop,55 ; Parrot Once if parrot mode is disabled + +956 = cop,56 ; Rx CTCSS Enable +957 = cop,57 ; Rx CTCSS Disable + +958 = cop.58 ; Tx CTCSS On Input only Enable +959 = cop,59 ; Tx CTCSS On Input only Disable + +960 = cop,60 ; Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) + ; Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + ; (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. + ; DestID and subcode are only specified for the 'C' type message. + ; UnitID is the local systems UnitID. DestID is the MDC1200 ID of + ; the radio being called, and the subcodes are as follows: + ; Subcode '8205' is Voice Selective Call for Spectra ('Call') + ; Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or + ; Astro-Saber('Call') + ; Subcode '810D' is Call Alert (like Maxtrac 'CA') + +961 = cop,61 ; Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) +962 = cop,62 ; Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) + +963 = cop,63 ; Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) +964 = cop,64 ; Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) +965 = cop,65 ; Send POCSAG page (equipped channel types only) + +[functions-remote] + +0 = remote,1 ; Retrieve Memory +1 = remote,2 ; Set freq. +2 = remote,3 ; Set tx PL tone +3 = remote,4 ; Set rx PL tone +40 = remote,100 ; Rx PL off +41 = remote,101 ; Rx PL on +42 = remote,102 ; Tx PL off +43 = remote,103 ; Tx PL on +44 = remote,104 ; Low Power +45 = remote,105 ; Medium Power +46 = remote,106 ; High Power +711 = remote,107 ; Bump -20 +714 = remote,108 ; Bump -100 +717 = remote,109 ; Bump -500 +713 = remote,110 ; Bump +20 +716 = remote,111 ; Bump +100 +719 = remote,112 ; Bump +500 +721 = remote,113 ; Scan - slow +724 = remote,114 ; Scan - quick +727 = remote,115 ; Scan - fast +723 = remote,116 ; Scan + slow +726 = remote,117 ; Scan + quick +729 = remote,118 ; Scan + fast +79 = remote,119 ; Tune +51 = remote,5 ; Long status query +52 = remote,140 ; Short status query +67 = remote,210 ; Send a * +69 = remote,211 ; Send a # +;91 = remote,99,CALLSIGN,LICENSETAG ; Remote base login. + ; Define a different dtmf sequence for each user which is + ; authorized to use the remote base to control access to it. + ; For examble 9139583=remote,99,WB6NIL,G would grant access to + ; the remote base and announce WB6NIL as being logged in. + ; Another entry, 9148351=remote,99,WA6ZFT,E would grant access to + ; the remote base and announce WA6ZFT as being logged in. + ; When the remote base is disconnected from the originating node, the + ; user will be logged out. The LICENSETAG argument is used to enforce + ; tx frequency limits. See [txlimits] below. +85 = cop,6 ; Remote base telephone key -[functions] -1=ilink,1 -2=ilink,2 -3=ilink,3 -4=ilink,4 -5=macro,1 -70=ilink,5 -71=ilink,6 -72=ilink,7 -73=ilink,15 -74=ilink,16 -75=ilink,8 - -80=status,1 -81=status,2 - -6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 ; Autopatch up -0=autopatchdn ; Autopatch down - -989=cop,4 -980=status,3 -99=cop,6 [telemetry] @@ -124,35 +462,49 @@ linkunkeyct=ct8 ; sent when a transmission received over the link unkeys ; Sends Morse code at the ID amplitude and ID frequency as defined in the ; [morse] section. ; -; Follow with an alphanumeric string - - -ct1=|t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) -ct2=|t(660,880,150,2048) -ct3=|t(440,0,150,4096) -ct4=|t(550,0,150,2048) -ct5=|t(660,0,150,2048) -ct6=|t(880,0,150,2048) -ct7=|t(660,440,150,2048) -ct8=|t(700,1100,150,2048) -remotetx=|t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000); -remotemon=|t(1209,0,50,2048) -cmdmode=|t(900,903,200,2048) -functcomplete=|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) -patchup=rpt/callproceeding -patchdown=rpt/callterminated +; path/to/sound/file/without/extension +; +; Send the sound if in place of a constructed tone. Do not include the file extension +; Example: ct8 = rpt/bloop +; Example: idrecording = rpt/nodenames/1999 + +ct1 = |t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) +ct2 = |t(660,880,150,2048) +ct3 = |t(440,0,150,4096) +ct4 = |t(550,0,150,2048) +ct5 = |t(660,0,150,2048) +ct6 = |t(880,0,150,2048) +ct7 = |t(660,440,150,2048) +ct8 = |t(700,1100,150,2048) +ranger = |t(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,150,0) +remotemon = |t(1209,0,50,2048) ; local courtesy tone when receive only +remotetx = |t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000) ; local courtesy tone when linked Trancieve mode +cmdmode = |t(900,903,200,2048) +functcomplete = |t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) +remcomplete = |t(650,0,100,2048)(0,0,100,0)(650,0,100,2048)(0,0,100,0)(650,0,100,2048) +pfxtone = |t(350,440,30000,3072) +patchup = rpt/callproceeding +patchdown = rpt/callterminated + +; As far as what the numbers mean, +; (000,000,010,000) +; | | | |-------amplitude +; | | |-------------duration +; | |-------------------Tone 2 +; |-------------------------Tone 1 + +; So, with 0,0,10,0 That says No Tone1, No Tone2, 10ms duration, 0 Amplitude. +; Use it for a delay. Fine tuning for how long before telemetry is sent, in conjunction with the telemdelay parameter) +; The numbers, like 350,440,10,2048 are 350Hz, 440Hz, 10ms delay, amplitude of 2048. -; ; Morse code parameters, these are common to all repeaters. -; [morse] - -speed=20 ; Approximate speed in WPM -frequency=800 ; Morse Telemetry Frequency -amplitude=4096 ; Morse Telemetry Amplitude -idfrequency=1065 ; Morse ID Frequency -idamplitude=1024 ; Morse ID Amplitude +speed = 20 ; Approximate speed in WPM +frequency = 800 ; Morse Telemetry Frequency +amplitude = 4096 ; Morse Telemetry Amplitude +idfrequency = 1065 ; Morse ID Frequency +idamplitude = 1024 ; Morse ID Amplitude ; ; This section allows wait times for telemetry events to be adjusted @@ -160,10 +512,10 @@ idamplitude=1024 ; Morse ID Amplitude ; [wait-times] -telemwait=2000 ; Time to wait before sending most telemetry -idwait=500 ; Time to wait before starting ID -unkeywait=2000 ; Time to wait after unkey before sending CT's and link telemetry -calltermwait=2000 ; Time to wait before announcing "call terminated" +telemwait = 2000 ; Time to wait before sending most telemetry +idwait = 500 ; Time to wait before starting ID +unkeywait = 2000 ; Time to wait after unkey before sending CT's and link telemetry +calltermwait = 2000 ; Time to wait before announcing "call terminated" ; ; This is where you define your nodes which cam be connected to. @@ -172,14 +524,13 @@ calltermwait=2000 ; Time to wait before announcing "call t [nodes] ; Note, if you are using automatic update for allstar link nodes, ; no allstar link nodes should be defined here. Only place a definition -; for your locak nodes, and private (off of allstar link) nodes here. - -1999 = radio@127.0.0.1/1999,NONE ; This must be changed to your node number +; for your local nodes, and private (off of allstar link) nodes here. +1999 = radio@127.0.0.1:4569/1999,NONE ; This must be changed to your node number + ; and iax port number if not the default ; Memories for remote bases [memory] - ;00 = 146.580,100.0,m ;01 = 147.030,103.5,m+t ;02 = 147.240,103.5,m+t @@ -193,70 +544,69 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = *32011# ;2 = *12001*12011*12043*12040*12050*12060*12009*12002*12003*12004*1113*12030# ;3 = *32001*32011*32050*32030*32060# -; -; -; Data Ackquisition configuration -; + + +; Data Acquisition configuration + ;[daq-list] -;device=device_name1 -;device=device_name2 -; +;device = device_name1 +;device = device_name2 + ;Where: device_name1 and device_name2 are stanzas you define in this file -; -;device=daq-cham-1 +;device = daq-cham-1 ; Device name ;[daq-cham-1] ; Defined in [daq-list] -;hwtype=uchameleon ; DAQ hardware type -;devnode=/dev/ttyUSB0 ; DAQ device node (if required) -;1=inadc ; Pin definition for an ADC channel -;2=inadc -;3=inadc -;4=inadc -;5=inadc -;6=inadc -;7=inadc -;8=inadc -;9=inp ; Pin definition for an input with a weak pullup resistor -;10=inp -;11=inp -;12=inp -;13=in ; Pin definition for an input without a weak pullup resistor -;14=out ; Pin definition for an output -;15=out -;16=out -;17=out -;18=out +;hwtype = uchameleon ; DAQ hardware type +;devnode = /dev/ttyUSB0 ; DAQ device node (if required) +;1 = inadc ; Pin definition for an ADC channel +;2 = inadc +;3 = inadc +;4 = inadc +;5 = inadc +;6 = inadc +;7 = inadc +;8 = inadc +;9 = inp ; Pin definition for an input with a weak pullup resistor +;10 = inp +;11 = inp +;12 = inp +;13 = in ; Pin definition for an input without a weak pullup resistor +;14 = out ; Pin definition for an output +;15 = out +;16 = out +;17 = out +;18 = out ;[meter-faces] -;face=scale(scalepre,scalediv,scalepost),word/?,... +;face = scale(scalepre,scalediv,scalepost),word/?,... ; ; scalepre = offset to add before dividing with scalediv ; scalediv = full scale/number of whole units (e.g. 256/20 or 12.8 for 20 volts). ; scalepost = offset to add after dividing with scalediv ; -;face=range(X-Y:word,X2-Y2:word,...),word/?,... -;face=bit(low-word,high-word),word/?,... +;face = range(X-Y:word,X2-Y2:word,...),word/?,... +;face = bit(low-word,high-word),word/?,... ; ; word/? is either a word in /var/lib/asterisk/sounds or one of its subdirectories, ; or a question mark which is a placeholder for the measured value. ; ; ; Battery voltage 0-20 volts -;batvolts=scale(0,12.8,0),rpt/thevoltageis,?,ha/volts +;batvolts = scale(0,12.8,0),rpt/thevoltageis,?,ha/volts ; 4 quadrant wind direction -;winddir=range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? +;winddir = range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? ; LM34 temperature sensor with 130 deg. F full scale -;lm34f=scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit +;lm34f = scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit ; Status poll (non alarmed) -;light=bit(ha/off,ha/on),ha/light,? +;light = bit(ha/off,ha/on),ha/light,? ;[alarms] ; -;tag=device,pin,node,ignorefirst,func-low,func-hi +;tag = device,pin,node,ignorefirst,func-low,func-hi ; ;tag = a unique name for the alarm ;device = daq device to poll @@ -268,8 +618,8 @@ calltermwait=2000 ; Time to wait before announcing "call t ; ; a '-' as a function name is shorthand for no-operation ; -;door=daq-cham-1,9,1,2017,*7,- -;pwrfail=daq-cham-1,10,0,2017,*911111,- +;door = daq-cham-1,9,1,2017,*7,- +;pwrfail = daq-cham-1,10,0,2017,*911111,- ; ; Control states ; Allow several control operator functions to be changed at once using one command (good for scheduling) @@ -280,13 +630,12 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = rptena,lnkena,apdis,totdis,ufena,noice ; Net and news operation ;2 = rptena,lnkdis,apdis,totena,ufdis,noice ; Repeater only operation -; ; Scheduler - execute a macro at a given time -; -;[schedule] + +[schedule] ;dtmf_function = m h dom mon dow ; ala cron, star is implied ;2 = 00 00 * * * ; at midnight, execute macro 2. - +#includeifexists custom/rpt.conf diff --git a/configs/beagleboard/zapata.conf b/configs/beagleboard/zapata.conf deleted file mode 100644 index b8897e86..00000000 --- a/configs/beagleboard/zapata.conf +++ /dev/null @@ -1,13 +0,0 @@ -; -; zapata.conf for systems with usbradio fobs -; - -[channels] -signalling=em_txrx -group=9 -channel=pseudo - -; -; End of file -; - diff --git a/configs/beagleboard/zaptel.conf b/configs/beagleboard/zaptel.conf deleted file mode 100644 index c940c858..00000000 --- a/configs/beagleboard/zaptel.conf +++ /dev/null @@ -1,8 +0,0 @@ -# -# zaptel.conf -# -loadzone = us -defaultzone=us -# -# End of file -# diff --git a/configs/examples/echolink/echolink.conf b/configs/examples/echolink/echolink.conf index 73ffac98..a6f9ca54 100644 --- a/configs/examples/echolink/echolink.conf +++ b/configs/examples/echolink/echolink.conf @@ -1,16 +1,46 @@ [el0] -confmode=no -call=W6ABC-R ; Change this! -pwd=XXXXX ; Change this! -name=Asterisk-EL-channel-driver ; Change this to your real name! -qth=Asterisk-EL-channel-driver ; Change this to your actual QTH! -email=foo@bar.com ; Change this! -maxstns=20 -rtcptimeout=10 -node=123456 ; Change this! -recfile=/tmp/recorded.gsm -astnode=2345 ; Change this to your active Allstar node number! -context=radio-secure -server1=server1.echolink.org -server2=server2.echolink.org -server3=server3.echolink.org +call = INVALID ; Change this! +pwd = INVALID ; Change this! +name = YOUR NAME ; Change this! +qth = INVALID ; Change this! +email = INVALID ; Change this! +node = 000000 ; Change this! +; Data for EchoLink Status Page +lat = 0.0 ; Latitude in decimal degrees +lon = 0.0 ; Longitude in decimal degrees +freq = 0.0 ; not mandatory Frequency in MHz +tone = 0.0 ; not mandatory CTCSS Tone (0 for none) +power = 0 ; 0=0W, 1=1W, 2=4W, 3=9W, 4=16W, 5=25W, 6=36W, 7=49W, 8=64W, 9=81W (Power in Watts) +height = 0 ; 0=10 1=20 2=40 3=80 4=160 5=320 6=640 7=1280 8=2560 9=5120 (AMSL in Feet) +gain = 0 ; Gain in db (0-9) +dir = 0 ; 0=omni 1=45deg 2=90deg 3=135deg 4=180deg 5=225deg 6=270deg 7=315deg 8=360deg (Direction) + +maxstns = 20 ; Max Stations + +rtcptimeout = 10 ; Max number of missed heartbeats from EL +recfile = /tmp/echolink_recorded.gsm ; +astnode = 1999 ; Change this! +context = radio-secure ; Default in code is echolink-in + +; Max 3 servers +server1 = nasouth.echolink.org +server2 = naeast.echolink.org +server3 = server3.echolink.org + +; To deny w6xxx you would add the statement: deny = w6xxx +; To prohibit computer-based connections you would write: permit = *-* +; To allow access to only a select group of callsigns: permit = w6abc,w6def,... + +; permit ; comma delimited list of callsign, type (-r) +; deny + + +; Remote text commands thru netcat: +; o.conip (request a connect) +; o.dconip (request a disconnect) +; o.rec (turn on/off recording) + +; ipaddr +; port + +#includeifexists custom/echolink.conf diff --git a/configs/examples/echolink/modules.conf b/configs/examples/echolink/modules.conf new file mode 100644 index 00000000..67a0e705 --- /dev/null +++ b/configs/examples/echolink/modules.conf @@ -0,0 +1,216 @@ +; +; Asterisk configuration file +; +; Module Loader configuration file +; +; By default DIAL does NOT load every module, only what is needed + +; You can enable or disable any of the asterisk modules +; All modules are compiled and installed. + +; To enable a module: load => module_name.so +; To disable a module: noload => module_name.so + +; You will want to enable the channel driver modules you will be using. +; There are below in the Channel Driver section +; The most common Channel drivers for app_rpt are: +; chan_echolink.so echolink channel driver +; chan_simpleusb.so Simple USB Radio Interface Channel Drive +; chan_usbradio.so USB Console Channel Driver +; chan_usrp.so USRP Channel Module +; chan_voter.so radio Voter channel driver + +[modules] + +autoload=no + +; Applications + +noload => app_adsiprog.so ; Asterisk ADSI Programming Application +noload => app_alarmreceiver.so ; Alarm Receiver for Asterisk +noload => app_amd.so ; Answering Machine Detection Application +load => app_authenticate.so ; Authentication Application +noload => app_cdr.so ; Tell Asterisk to not maintain a CDR for +noload => app_chanisavail.so ; Check channel availability +noload => app_channelredirect.so ; Channel Redirect +noload => app_chanspy.so ; Listen to the audio of an active channel +noload => app_controlplayback.so ; Control Playback Application +noload => app_dahdibarge.so ; Barge in on channel application +noload => app_dahdiras.so ; DAHDI RAS Application +noload => app_dahdiscan.so ; Scan Zap channels application +noload => app_db.so ; Database Access Functions +load => app_dial.so ; Dialing Application +noload => app_dictate.so ; Virtual Dictation Machine +noload => app_directed_pickup.so ; Directed Call Pickup Application +noload => app_directory.so ; Extension Directory +noload => app_disa.so ; DISA (Direct Inward System Access) Appli +noload => app_dumpchan.so ; Dump Info About The Calling Channel +noload => app_echo.so ; Simple Echo Application +load => app_exec.so ; Executes dialplan applications +noload => app_externalivr.so ; External IVR Interface Application +noload => app_festival.so ; Simple Festival Interface +noload => app_flash.so ; Flash channel application +noload => app_followme.so ; Find-Me/Follow-Me Application +noload => app_forkcdr.so ; Fork The CDR into 2 separate entities +noload => app_getcpeid.so ; Get ADSI CPE ID +noload => app_gps.so ; GPS interface module +noload => app_hasnewvoicemail.so ; Indicator for whether a voice mailbox ha +noload => app_ices.so ; Encode and Stream via icecast and ices +noload => app_image.so ; Image Transmission Application +noload => app_lookupblacklist.so ; Look up Caller*ID name/number from black +noload => app_lookupcidname.so ; Look up CallerID Name from local databas +load => app_macro.so ; Extension Macros +noload => app_meetme.so ; MeetMe conference bridge +noload => app_milliwatt.so ; Digital Milliwatt (mu-law) Test Applicat +noload => app_mixmonitor.so ; Mixed Audio Monitoring Application +noload => app_morsecode.so ; Morse code +noload => app_mp3.so ; Silly MP3 Application +noload => app_nbscat.so ; Silly NBS Stream Application +noload => app_page.so ; Page Multiple Phones +noload => app_parkandannounce.so ; Call Parking and Announce Application +load => app_playback.so ; Sound File Playback Application +noload => app_privacy.so ; Require phone number to be entered, if n +noload => app_queue.so ; True Call Queueing +noload => app_radbridge.so ; Radio Bridging interface module +noload => app_random.so ; Random goto +noload => app_readfile.so ; Stores output of file into a variable +noload => app_read.so ; Read Variable Application +noload => app_realtime.so ; Realtime Data Lookup/Rewrite +noload => app_record.so ; Trivial Record Application +load => app_rpt.so ; Radio Repeater/Remote Base Application +noload => app_sayunixtime.so ; Say time +noload => app_senddtmf.so ; Send DTMF digits Application +load => app_sendtext.so ; Send Text Applications +noload => app_setcallerid.so ; Set CallerID Application +noload => app_setcdruserfield.so ; CDR user field apps +noload => app_settransfercapability.so ; Set ISDN Transfer Capability +noload => app_sms.so ; SMS/PSTN handler +noload => app_softhangup.so ; Hangs up the requested channel +noload => app_speech_utils.so ; Dialplan Speech Applications +noload => app_stack.so ; Stack Routines +load => app_system.so ; Generic System() application +noload => app_talkdetect.so ; Playback with Talk Detection +noload => app_test.so ; Interface Test Application +load => app_transfer.so ; Transfer +noload => app_url.so ; Send URL Applications +noload => app_userevent.so ; Custom User Event Application +noload => app_verbose.so ; Send verbose output +noload => app_voicemail.so ; Comedian Mail (Voicemail System) +noload => app_waitforring.so ; Waits until first ring after time +noload => app_waitforsilence.so ; Wait For Silence +noload => app_while.so ; While Loops and Conditional Execution +noload => app_zapateller.so ; Block Telemarketers with Special Informa + +; CDR + +noload => cdr_csv.so ; Comma Separated Values CDR Backend +noload => cdr_custom.so ; Customizable Comma Separated Values CDR +noload => cdr_manager.so ; Asterisk Manager Interface CDR Backend + +; Channels + +noload => chan_agent.so ; Agent Proxy Channel +noload => chan_alsa.so ; ALSA Console Channel Driver +noload => chan_beagle.so ; Beagleboard Radio Interface Channel Driver +load => chan_dahdi.so ; DAHDI Telephony +load => chan_echolink.so ; echolink Channel Driver +noload => chan_features.so ; Feature Proxy Channel +noload => chan_gtalk.so ; Gtalk Channel Driver +load => chan_iax2.so ; Inter Asterisk eXchange (Ver 2) +load => chan_local.so ; Local Proxy Channel (Note: used internal +noload => chan_oss.so ; Channel driver for OSS sound cards +noload => chan_phone.so ; Generic Linux Telephony Interface driver +noload => chan_pi.so ; DMK Engineering "PITA" Board on Rpi2/3 Channel Driver +noload => chan_simpleusb.so ; CM1xx USB Cards with Radio Interface Channel Driver (No DSP) +noload => chan_sip.so ; Session Initiation Protocol (SIP) +noload => chan_tlb.so ; TheLinkBox Channel Driver +noload => chan_usbradio.so ; CM1xx USB Cards with Radio Interface Channel Driver (DSP) +noload => chan_usrp.so ; GNU Radio interface USRP Channel Driver +noload => chan_voter.so ; Radio Voter Channel Driver + +; Codecs + +; CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers) +; ULAW best 87 kilobits per second (kbps) +; ADPCM good 55 kbps +; GSM mediocre 36 kbps +; g726aal2 +; ilbc + +load => codec_adpcm.so ; Adaptive Differential PCM Coder/Decoder +load => codec_alaw.so ; A-law Coder/Decoder +load => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder +noload => codec_dahdi.so ; Generic DAHDI Transcoder Codec Translato +load => codec_g726.so ; ITU G.726-32kbps G726 Transcoder +load => codec_gsm.so ; GSM Coder/Decoder +load => codec_ulaw.so ; mu-Law Coder/Decoder +noload => codec_ilbc.so ; http://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec + +; Formats + +load => format_g723.so ; G.723.1 Simple Timestamp File Format +load => format_g726.so ; Raw G.726 (16/24/32/40kbps) data +load => format_g729.so ; Raw G729 data +load => format_gsm.so ; Raw GSM data +load => format_h263.so ; Raw H.263 data +load => format_h264.so ; Raw H.264 data +load => format_ilbc.so ; Raw iLBC data +noload => format_jpeg.so ; JPEG (Joint Picture Experts Group) Image +load => format_pcm.so ; Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. +load => format_sln.so ; Raw Signed Linear Audio support (SLN) +load => format_vox.so ; Dialogic VOX (ADPCM) File Format +load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) +load => format_wav.so ; Microsoft WAV format (8000Hz Signed Line + +; Functions + +load => func_base64.so ; base64 encode/decode dialplan functions +load => func_callerid.so ; Caller ID related dialplan function +load => func_cdr.so ; CDR dialplan function +load => func_channel.so ; Channel information dialplan function +load => func_curl.so ; Load external URL +load => func_cut.so ; Cut out information from a string +load => func_db.so ; Database (astdb) related dialplan functi +load => func_enum.so ; ENUM related dialplan functions +load => func_env.so ; Environment/filesystem dialplan function +load => func_global.so ; Global variable dialplan functions +load => func_groupcount.so ; Channel group dialplan functions +load => func_language.so ; Channel language dialplan function +load => func_logic.so ; Logical dialplan functions +load => func_math.so ; Mathematical dialplan function +load => func_md5.so ; MD5 digest dialplan functions +load => func_moh.so ; Music-on-hold dialplan function +load => func_rand.so ; Random number dialplan function +load => func_realtime.so ; Read/Write values from a RealTime reposi +noload => func_sha1.so ; SHA-1 computation dialplan function +noload => func_strings.so ; String handling dialplan functions +noload => func_timeout.so ; Channel timeout dialplan functions +noload => func_uri.so ; URI encode/decode dialplan functions + +; PBX + +noload => pbx_ael.so ; Asterisk Extension Language Compiler +load => pbx_config.so ; Text Extension Configuration +noload => pbx_dundi.so ; Distributed Universal Number Discovery ( +noload => pbx_loopback.so ; Loopback Switch +noload => pbx_realtime.so ; Realtime Switch +noload => pbx_spool.so ; Outgoing Spool Support + +; Resources + +load => res_adsi.so ; ADSI Resource +noload => res_agi.so ; Asterisk Gateway Interface (AGI) +noload => res_clioriginate.so ; Call origination from the CLI +noload => res_convert.so ; File format conversion CLI command +load => res_crypto.so ; Cryptographic Digital Signatures +load => res_features.so ; Call Features Resource +load => res_indications.so ; Indications Resource +noload => res_jabber.so ; AJI - Asterisk Jabber Interface +noload => res_monitor.so ; Call Monitoring Resource +noload => res_musiconhold.so ; Music On Hold Resource +noload => res_smdi.so ; Simplified Message Desk Interface (SMDI) +noload => res_snmp.so ; SNMP [Sub]Agent for Asterisk +noload => res_speech.so ; Generic Speech Recognition API + +[global] + diff --git a/configs/extensions.conf b/configs/extensions.conf index cd87e2b0..85ace8b2 100644 --- a/configs/extensions.conf +++ b/configs/extensions.conf @@ -1,11 +1,11 @@ [general] -static=yes ; These two lines prevent the command-line interface -writeprotect=yes ; from overwriting the config file. Leave them here. +static = yes ; These two lines prevent the command-line interface +writeprotect = yes ; from overwriting the config file. Leave them here. [globals] -HOMENPA=619 -NODE=1999 +HOMENPA = 999 ; change this to your Area Code +NODE = 1999 ; change this to your node number [default] @@ -14,61 +14,83 @@ exten => i,1,Hangup [radio-secure] exten => ${NODE},1,rpt,${NODE} +[iaxrpt] ; entered from iaxrpt in iax.conf +exten => ${NODE},1,rpt(${NODE}|X) ; NODE is the Name field in iaxrpt + ; Info: The X option passed to the Rpt application + ; disables the normal security checks. + ; Because incoming connections are validated in iax.conf, + ; and we don't know where the user will be coming from in advance, + ; the X option is required. + +[iax-client] ; for IAX VIOP clients. +exten => ${NODE},1,Ringing +exten => ${NODE},n,Wait(3) +exten => ${NODE},n,Answer +exten => ${NODE},n,Set(NODENUM=${CALLERID(number)}) +exten => ${NODE},n,Playback(rpt/node|noanswer) +exten => ${NODE},n,SayDigits(${EXTEN}) +exten => ${NODE},n,Set(CALLERID(num)=0) +exten => ${NODE},n,Rpt,${NODE}|P|${CALLERID(name)} +exten => ${NODE},n,Hangup +exten => ${NODE},n(hangit),Answer +exten => ${NODE},n(hangit),Wait(1) +exten => ${NODE},n(hangit),Hangup + ; Comment-out the following clause if you want Allstar Autopatch service [pstn-out] -exten=_NXXNXXXXXX,1,playback(ss-noservice) -exten=_NXXNXXXXXX,2,Congestion +exten = _NXXNXXXXXX,1,playback(ss-noservice) +exten = _NXXNXXXXXX,2,Congestion ; Un-comment out the following clause if you want Allstar Autopatch service ;[pstn-out] -;exten=_NXXNXXXXXX,1,Dial(IAX2/allstar-autopatch/\${EXTEN}) -;exten=_NXXNXXXXXX,2,Busy +;exten = _NXXNXXXXXX,1,Dial(IAX2/allstar-autopatch/\${EXTEN}) +;exten = _NXXNXXXXXX,2,Busy [invalidnum] -exten=s,1,Wait,3 -exten=s,n,Playback,ss-noservice -exten=s,n,Wait,1 -exten=s,n,Hangup +exten = s,1,Wait,3 +exten = s,n,Playback,ss-noservice +exten = s,n,Wait,1 +exten = s,n,Hangup [radio] -exten=_X11,1,Goto(check_route|${EXTEN}|1); -exten=_NXXXXXX,1,Goto(check_route|1${HOMENPA}${EXTEN}|1) -exten=_1XXXXXXXXXX,1,Goto(check_route|${EXTEN}|1) -exten=_07XX,1,Goto(parkedcalls|${EXTEN:1}|1) -exten=00,1,Goto(my-ip|s|1) +exten = _X11,1,Goto(check_route|${EXTEN}|1); +exten = _NXXXXXX,1,Goto(check_route|1${HOMENPA}${EXTEN}|1) +exten = _1XXXXXXXXXX,1,Goto(check_route|${EXTEN}|1) +exten = _07XX,1,Goto(parkedcalls|${EXTEN:1}|1) +exten = 00,1,Goto(my-ip|s|1) [check_route] -exten=_X.,1,Noop(${EXTEN}) +exten =_X.,1,Noop(${EXTEN}) ; no 800 -exten=_1800NXXXXXX,2,Goto(invalidnum|s|1) -exten=_1888NXXXXXX,2,Goto(invalidnum|s|1) -exten=_1877NXXXXXX,2,Goto(invalidnum|s|1) -exten=_1866NXXXXXX,2,Goto(invalidnum|s|1) -exten=_1855NXXXXXX,2,Goto(invalidnum|s|1) +exten = _1800NXXXXXX,2,Goto(invalidnum|s|1) +exten = _1888NXXXXXX,2,Goto(invalidnum|s|1) +exten = _1877NXXXXXX,2,Goto(invalidnum|s|1) +exten = _1866NXXXXXX,2,Goto(invalidnum|s|1) +exten = _1855NXXXXXX,2,Goto(invalidnum|s|1) ; no X00 NPA -exten=_1X00XXXXXXX,2,Goto(invalidnum|s|1) +exten = _1X00XXXXXXX,2,Goto(invalidnum|s|1) ; no X11 NPA -exten=_1X11XXXXXXX,2,Goto(invalidnum|s|1) +exten = _1X11XXXXXXX,2,Goto(invalidnum|s|1) ; no X11 -exten=_X11,2,Goto(invalidnum|s|1) +exten = _X11,2,Goto(invalidnum|s|1) ; no 555 Prefix in any NPA -exten=_1NXX555XXXX,2,Goto(invalidnum|s|1) +exten = _1NXX555XXXX,2,Goto(invalidnum|s|1) ; no 976 Prefix in any NPA -exten=_1NXX976XXXX,2,Goto(invalidnum|s|1) +exten = _1NXX976XXXX,2,Goto(invalidnum|s|1) ; no NPA=809 -exten=_1809XXXXXXX,2,Goto(invalidnum|s|1) +exten = _1809XXXXXXX,2,Goto(invalidnum|s|1) ; no NPA=900 -exten=_1900XXXXXXX,2,Goto(invalidnum|s|1) +exten = _1900XXXXXXX,2,Goto(invalidnum|s|1) ; okay, route it -exten=_1NXXXXXXXXX,2,Goto(pstn-out|${EXTEN:1}|1) -exten=_X.,2,Goto(invalidnum|s|1) +exten = _1NXXXXXXXXX,2,Goto(pstn-out|${EXTEN:1}|1) +exten = _X.,2,Goto(invalidnum|s|1) [my-ip] -exten=s,1,Set(MYADDR=${CURL(http://myip.vg)}) -exten=s,2,Wait,1 -exten=s,3,SayAlpha(${MYADDR}) -exten=s,4,Hangup +exten = s,1,Set(MYADDR=${CURL(http://myip.vg)}) +exten = s,2,Wait,1 +exten = s,3,SayAlpha(${MYADDR}) +exten = s,4,Hangup [allstar-sys] exten => _1.,1,Rpt(${EXTEN:1}|Rrpt/node:NODE:rpt/in-call:digits/0:PARKED|120) @@ -126,3 +148,4 @@ exten => s,n(hangit),Answer exten => s,n(hangit),Wait(1) exten => s,n(hangit),Hangup +#includeifexists custom/extensions.conf diff --git a/configs/iax.conf b/configs/iax.conf index e45e6d8b..a0ccb4a3 100644 --- a/configs/iax.conf +++ b/configs/iax.conf @@ -1,67 +1,119 @@ - ; Inter-Asterisk eXchange driver definition -; -; +; http://docs.allstarlink.org/drupal/node/15 + +; ulaw, alaw, GSM and ADPCM should only be used, +; the rest of the standard Asterisk codecs +; (speex, ilbc, lpc10, etc) should be avoided. + +; The ulaw and alaw codecs have the best audio quality, +; followed by ADPCM, and lastly GSM, +; Bandwidth used is in the reverse order to audio quality. +; GSM uses the least bandwidth, and alaw/ulaw the most. + +; CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers) +; ULAW best 87 kbps +; ADPCM good 55 kbps +; GSM mediocre 36 kbps + [general] -bindaddr=0.0.0.0 -disallow=all -allow=gsm -allow=g726aal2 -allow=ulaw -jitterbuffer=yes -forcejitterbuffer=yes -dropcount=2 -maxjitterbuffer=4000 -maxjitterinterps=10 -resyncthreshold=1000 -maxexcessbuffer=80 -minexcessbuffer=10 -jittershrinkrate=1 -tos=0x1E -autokill=yes -delayreject=yes -;iaxthreadcount=30 -;iaxmaxthreadcount=150 - -register=1999:1234567@register.allstarlink.org +bindport = 4569 ; bindport and bindaddr may be specified + ; NOTE: bindport must be specified BEFORE + ; bindaddr or may be specified on a specific + ; bindaddr if followed by colon and port + ; (e.g. bindaddr=192.168.0.1:4569) + +; bindaddr = 192.168.0.1 ; more than once to bind to multiple + ; addresses, but the first will be the + ; default + +disallow = all ; The permitted codecs for outgoing connections + ; Audio Quality Bandwidth +allow = ulaw ; best 87 kbps +allow = adpcm ; good 55 kbps +allow = gsm ; medicore 36 kbps + +jitterbuffer = yes +forcejitterbuffer = yes +dropcount = 2 +maxjitterbuffer = 4000 +maxjitterinterps = 10 +resyncthreshold = 1000 +maxexcessbuffer = 80 +minexcessbuffer = 10 +jittershrinkrate = 1 +tos = 0x1E +autokill = yes +delayreject = yes +; iaxthreadcount = 30 +; iaxmaxthreadcount = 150 + +; register = 1999:123456@register.allstarlink.org ; This must be changed to your node number, password + ; remove the leading ";" ; Incoming radio connections [radio] -type=user -disallow=all -allow=g726aal2 -allow=gsm -codecpriority=host -context=radio-secure -transfer=no +type = user +disallow = all +allow = ulaw +allow = adpcm +allow = gsm + +codecpriority = host +context = radio-secure +transfer = no + +[iaxrpt] ; Connect from iaxrpt Username field (PC AllStar Client) +type = user ; Notice type is user here <--------------- +context = iaxrpt ; Context to jump to in extensions.conf +auth = md5 +secret = Your_Secret_Pasword_Here +host = dynamic +disallow = all +allow = ulaw +allow = adpcm +allow = gsm +transfer = no + +[iaxclient] ; Connect from iax client (Zoiper...) +type = friend ; Notice type here is friend <-------------- +context = iax-client ; Context to jump to in extensions.conf +auth = md5 +secret = Your_Secret_Password_Here +host = dynamic +disallow = all +allow = ulaw +allow = adpcm +allow = gsm +transfer = no [allstar-sys] -type=user -context=allstar-sys -auth=rsa -inkeys=allstar -disallow=all -allow=ulaw +type = user +context = allstar-sys +auth = rsa +inkeys = allstar +disallow = all +allow = ulaw [allstar-public] -type=user -context=allstar-public -auth=md5 -secret=allstar -disallow=all -allow=ulaw -allow=gsm - -; Yhe following should be un-commented to support Allstar Autopatch service -;[allstar-autopatch] -;type=peer -;host=register.allstarlink.org -;username= -;secret= -;auth=md5 -;disallow=all -;allow=ulaw -;transfer=no +type = user +context = allstar-public +auth = md5 +secret = allstar +disallow = all +allow = ulaw +allow = gsm + +; The following should be un-commented to support Allstar Autopatch service +; [allstar-autopatch] +; type = peer +; host = register.allstarlink.org +; username = +; secret = +; auth = md5 +; disallow = all +; allow = ulaw +; transfer = no +#includeifexists custom/iax.conf diff --git a/configs/pi/modules.conf b/configs/pi/modules.conf index 20e865d1..f58b6a69 100644 --- a/configs/pi/modules.conf +++ b/configs/pi/modules.conf @@ -3,12 +3,214 @@ ; ; Module Loader configuration file ; +; By default DIAL does NOT load every module, only what is needed + +; You can enable or disable any of the asterisk modules +; All modules are compiled and installed. + +; To enable a module: load => module_name.so +; To disable a module: noload => module_name.so + +; You will want to enable the channel driver modules you will be using. +; There are below in the Channel Driver section +; The most common Channel drivers for app_rpt are: +; chan_echolink.so echolink channel driver +; chan_simpleusb.so Simple USB Radio Interface Channel Drive +; chan_usbradio.so USB Console Channel Driver +; chan_usrp.so USRP Channel Module +; chan_voter.so radio Voter channel driver [modules] -autoload=yes -noload=chan_oss.so -noload=chan_alsa.so -noload=chan_phone.so -noload=chan_beagle.so + +autoload=no + +; Applications + +noload => app_adsiprog.so ; Asterisk ADSI Programming Application +noload => app_alarmreceiver.so ; Alarm Receiver for Asterisk +noload => app_amd.so ; Answering Machine Detection Application +load => app_authenticate.so ; Authentication Application +noload => app_cdr.so ; Tell Asterisk to not maintain a CDR for +noload => app_chanisavail.so ; Check channel availability +noload => app_channelredirect.so ; Channel Redirect +noload => app_chanspy.so ; Listen to the audio of an active channel +noload => app_controlplayback.so ; Control Playback Application +noload => app_dahdibarge.so ; Barge in on channel application +noload => app_dahdiras.so ; DAHDI RAS Application +noload => app_dahdiscan.so ; Scan Zap channels application +noload => app_db.so ; Database Access Functions +load => app_dial.so ; Dialing Application +noload => app_dictate.so ; Virtual Dictation Machine +noload => app_directed_pickup.so ; Directed Call Pickup Application +noload => app_directory.so ; Extension Directory +noload => app_disa.so ; DISA (Direct Inward System Access) Appli +noload => app_dumpchan.so ; Dump Info About The Calling Channel +noload => app_echo.so ; Simple Echo Application +load => app_exec.so ; Executes dialplan applications +noload => app_externalivr.so ; External IVR Interface Application +noload => app_festival.so ; Simple Festival Interface +noload => app_flash.so ; Flash channel application +noload => app_followme.so ; Find-Me/Follow-Me Application +noload => app_forkcdr.so ; Fork The CDR into 2 separate entities +noload => app_getcpeid.so ; Get ADSI CPE ID +noload => app_gps.so ; GPS interface module +noload => app_hasnewvoicemail.so ; Indicator for whether a voice mailbox ha +noload => app_ices.so ; Encode and Stream via icecast and ices +noload => app_image.so ; Image Transmission Application +noload => app_lookupblacklist.so ; Look up Caller*ID name/number from black +noload => app_lookupcidname.so ; Look up CallerID Name from local databas +load => app_macro.so ; Extension Macros +noload => app_meetme.so ; MeetMe conference bridge +noload => app_milliwatt.so ; Digital Milliwatt (mu-law) Test Applicat +noload => app_mixmonitor.so ; Mixed Audio Monitoring Application +noload => app_morsecode.so ; Morse code +noload => app_mp3.so ; Silly MP3 Application +noload => app_nbscat.so ; Silly NBS Stream Application +noload => app_page.so ; Page Multiple Phones +noload => app_parkandannounce.so ; Call Parking and Announce Application +load => app_playback.so ; Sound File Playback Application +noload => app_privacy.so ; Require phone number to be entered, if n +noload => app_queue.so ; True Call Queueing +noload => app_radbridge.so ; Radio Bridging interface module +noload => app_random.so ; Random goto +noload => app_readfile.so ; Stores output of file into a variable +noload => app_read.so ; Read Variable Application +noload => app_realtime.so ; Realtime Data Lookup/Rewrite +noload => app_record.so ; Trivial Record Application +load => app_rpt.so ; Radio Repeater/Remote Base Application +noload => app_sayunixtime.so ; Say time +noload => app_senddtmf.so ; Send DTMF digits Application +load => app_sendtext.so ; Send Text Applications +noload => app_setcallerid.so ; Set CallerID Application +noload => app_setcdruserfield.so ; CDR user field apps +noload => app_settransfercapability.so ; Set ISDN Transfer Capability +noload => app_sms.so ; SMS/PSTN handler +noload => app_softhangup.so ; Hangs up the requested channel +noload => app_speech_utils.so ; Dialplan Speech Applications +noload => app_stack.so ; Stack Routines +load => app_system.so ; Generic System() application +noload => app_talkdetect.so ; Playback with Talk Detection +noload => app_test.so ; Interface Test Application +load => app_transfer.so ; Transfer +noload => app_url.so ; Send URL Applications +noload => app_userevent.so ; Custom User Event Application +noload => app_verbose.so ; Send verbose output +noload => app_voicemail.so ; Comedian Mail (Voicemail System) +noload => app_waitforring.so ; Waits until first ring after time +noload => app_waitforsilence.so ; Wait For Silence +noload => app_while.so ; While Loops and Conditional Execution +noload => app_zapateller.so ; Block Telemarketers with Special Informa + +; CDR + +noload => cdr_csv.so ; Comma Separated Values CDR Backend +noload => cdr_custom.so ; Customizable Comma Separated Values CDR +noload => cdr_manager.so ; Asterisk Manager Interface CDR Backend + +; Channels + +noload => chan_agent.so ; Agent Proxy Channel +noload => chan_alsa.so ; ALSA Console Channel Driver +noload => chan_beagle.so ; Beagleboard Radio Interface Channel Driver +load => chan_dahdi.so ; DAHDI Telephony +noload => chan_echolink.so ; echolink Channel Driver +noload => chan_features.so ; Feature Proxy Channel +noload => chan_gtalk.so ; Gtalk Channel Driver +load => chan_iax2.so ; Inter Asterisk eXchange (Ver 2) +load => chan_local.so ; Local Proxy Channel (Note: used internal +noload => chan_oss.so ; Channel driver for OSS sound cards +noload => chan_phone.so ; Generic Linux Telephony Interface driver +load => chan_pi.so ; DMK Engineering "PITA" Board on Rpi2/3 Channel Driver +noload => chan_simpleusb.so ; CM1xx USB Cards with Radio Interface Channel Driver (No DSP) +noload => chan_sip.so ; Session Initiation Protocol (SIP) +noload => chan_tlb.so ; TheLinkBox Channel Driver +noload => chan_usbradio.so ; CM1xx USB Cards with Radio Interface Channel Driver (DSP) +noload => chan_usrp.so ; GNU Radio interface USRP Channel Driver +noload => chan_voter.so ; Radio Voter Channel Driver + +; Codecs + +; CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers) +; ULAW best 87 kilobits per second (kbps) +; ADPCM good 55 kbps +; GSM mediocre 36 kbps +; g726aal2 +; ilbc + +load => codec_adpcm.so ; Adaptive Differential PCM Coder/Decoder +load => codec_alaw.so ; A-law Coder/Decoder +load => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder +noload => codec_dahdi.so ; Generic DAHDI Transcoder Codec Translato +load => codec_g726.so ; ITU G.726-32kbps G726 Transcoder +load => codec_gsm.so ; GSM Coder/Decoder +load => codec_ulaw.so ; mu-Law Coder/Decoder +noload => codec_ilbc.so ; http://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec + +; Formats + +load => format_g723.so ; G.723.1 Simple Timestamp File Format +load => format_g726.so ; Raw G.726 (16/24/32/40kbps) data +load => format_g729.so ; Raw G729 data +load => format_gsm.so ; Raw GSM data +load => format_h263.so ; Raw H.263 data +load => format_h264.so ; Raw H.264 data +load => format_ilbc.so ; Raw iLBC data +noload => format_jpeg.so ; JPEG (Joint Picture Experts Group) Image +load => format_pcm.so ; Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. +load => format_sln.so ; Raw Signed Linear Audio support (SLN) +load => format_vox.so ; Dialogic VOX (ADPCM) File Format +load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) +load => format_wav.so ; Microsoft WAV format (8000Hz Signed Line + +; Functions + +load => func_base64.so ; base64 encode/decode dialplan functions +load => func_callerid.so ; Caller ID related dialplan function +load => func_cdr.so ; CDR dialplan function +load => func_channel.so ; Channel information dialplan function +load => func_curl.so ; Load external URL +load => func_cut.so ; Cut out information from a string +load => func_db.so ; Database (astdb) related dialplan functi +load => func_enum.so ; ENUM related dialplan functions +load => func_env.so ; Environment/filesystem dialplan function +load => func_global.so ; Global variable dialplan functions +load => func_groupcount.so ; Channel group dialplan functions +load => func_language.so ; Channel language dialplan function +load => func_logic.so ; Logical dialplan functions +load => func_math.so ; Mathematical dialplan function +load => func_md5.so ; MD5 digest dialplan functions +load => func_moh.so ; Music-on-hold dialplan function +load => func_rand.so ; Random number dialplan function +load => func_realtime.so ; Read/Write values from a RealTime reposi +noload => func_sha1.so ; SHA-1 computation dialplan function +noload => func_strings.so ; String handling dialplan functions +noload => func_timeout.so ; Channel timeout dialplan functions +noload => func_uri.so ; URI encode/decode dialplan functions + +; PBX + +noload => pbx_ael.so ; Asterisk Extension Language Compiler +load => pbx_config.so ; Text Extension Configuration +noload => pbx_dundi.so ; Distributed Universal Number Discovery ( +noload => pbx_loopback.so ; Loopback Switch +noload => pbx_realtime.so ; Realtime Switch +noload => pbx_spool.so ; Outgoing Spool Support + +; Resources + +load => res_adsi.so ; ADSI Resource +noload => res_agi.so ; Asterisk Gateway Interface (AGI) +noload => res_clioriginate.so ; Call origination from the CLI +noload => res_convert.so ; File format conversion CLI command +load => res_crypto.so ; Cryptographic Digital Signatures +load => res_features.so ; Call Features Resource +load => res_indications.so ; Indications Resource +noload => res_jabber.so ; AJI - Asterisk Jabber Interface +noload => res_monitor.so ; Call Monitoring Resource +noload => res_musiconhold.so ; Music On Hold Resource +noload => res_smdi.so ; Simplified Message Desk Interface (SMDI) +noload => res_snmp.so ; SNMP [Sub]Agent for Asterisk +noload => res_speech.so ; Generic Speech Recognition API [global] + diff --git a/configs/pi/rpt.conf b/configs/pi/rpt.conf index 21a8960e..17b264b8 100644 --- a/configs/pi/rpt.conf +++ b/configs/pi/rpt.conf @@ -1,106 +1,444 @@ ; Radio Repeater configuration file (for use with app_rpt) -; -; ; Your Repeater -; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [1999] ; Change this to your assigned node number -rxchannel = Pi/1 ; Rx audio/signalling channel -erxgain=-3 ; Echolink receive gain adjustment + ; Must also be enabled in modules.conf + ; Rx audio/signalling channel. Choose ONLY 1 per node stanza + + ; Enable the selected channel driver in modules.conf !!! +; rxchannel = dahdi/pseudo ; No radio (hub) +; rxchannel = SimpleUSB/usb_1999 ; SimpleUSB +rxchannel = Pi/1 ; Raspberry Pi PiTA +; rxchannel = Radio/usb_1999 ; USBRadio (DSP) +; rxchannel = Dahdi/1 ; PCI Quad card +; rxchannel = Beagle/1 ; BeagleBoard +; rxchannel = USRP/127.0.0.1:34001:32001; GNU Radio interface USRP + +duplex = 1 ; 0 = Half duplex with no telemetry tones or hang time. + ; Special Case: Full duplex if linktolink is set to yes. + ; This mode is preferred when interfacing with an external multiport repeater controller. + ; Comment out idrecording and idtalkover to suppress IDs also + ; 1 = Half duplex with telemetry tones and hang time. Does not repeat audio. + ; This mode is preferred when interfacing a simplex node. + ; 2 = Full Duplex with telemetry tones and hang time. + ; This mode is preferred when interfacing a repeater. + ; 3 = Full Duplex with telemetry tones and hang time, but no repeated audio. + ; 4 = Full Duplex with telemetry tones and hang time. Repeated audio only when the autopatch is down. + +linktolink = no ; disables forcing physical half-duplex operation of main repeater while + ; still keeping half-duplex semantics (optional) + +linkmongain = 0 ; Link Monitor Gain adjusts the audio level of monitored nodes when a signal from another node or the local receiver is received. + ; If linkmongain is set to a negative number the monitored audio will decrease by the set amount in db. + ; If linkmongain set to a positive number monitored audio will increase by the set amount in db. + ; The value of linkmongain is in db. The default value is 0 db. + +erxgain = -3 ; Echolink receive gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -etxgain=3 ; Echolink transmit gain adjustment +etxgain = 3 ; Echolink transmit gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -;controlstates=controlstates ; system control state list -;scheduler=schedule; ; scheduler entries -functions=functions ; Repeater Function Table -phone_functions=functions ; Repeater Function Table -link_functions=functions ; Link Function Table -telemetry=telemetry ; Telemetry descriptions -wait_times=wait-times ; Wait times -context = radio ; dialing context for phone -callerid = "Repeater" <0000000000> ; callerid for phone calls -idrecording = |iid ; id recording or morse string -accountcode=RADIO ; account code (optional) -hangtime=1000 ; squelch tail hang time (in ms) (optional) -althangtime=4000 ; longer squelch tail -totime=170000 ; transmit time-out time (in ms) (optional) -idtime=540000 ; id interval time (in ms) (optional) -; The default values for hangtime, time-out time, and id interval time are -; 5 seconds (5000 ms), 3 minutes (180000 ms), and 5 minutes (300000 ms) -; respectively - -politeid=30000 ; time in milliseconds before ID timer - - ; expires to try and ID in the tail. - ; (optional, default is 30000). -idtalkover=|iid ; Talkover ID (optional) default is none -unlinkedct=ct2 ; unlinked courtesy tone (optional) default is none -remotect=ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) -linkunkeyct=ct8 ; sent when a transmission received over the link unkeys -;nolocallinkct=0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). -;eannmode=1 ; Default: 1 = Say only node number on echolink connects - ; 2 = say phonetic call sign only on echolink connects - ; 3 = say phonetic call sign and node number on echolink connects -;connpgm=yourconnectprogram ; Default: Disabled. Execute a program you specify on connect. +;eannmode = 1 ; 1 = Say only node number on echolink connects (default = 1) + ; 2 = say phonetic call sign only on echolink connects + ; 3 = say phonetic call sign and node number on echolink connects + +;controlstates = controlstates ; system control state stanza + +scheduler = schedule ; scheduler stanza +functions = functions ; Repeater Function stanza +phone_functions = functions ; Phone Function stanza +link_functions = functions ; Link Function stanza + +telemetry = telemetry ; Telemetry stanza +morse = morse ; Morse stanza +wait_times = wait-times ; Wait times stanza + +context = radio ; dialing context for phone +callerid = "Repeater" <0000000000> ; callerid for phone calls +accountcode = RADIO ; account code (optional) + +hangtime = 5000 ; squelch tail hang time (in ms) (optional, default 5 seconds, 5000 ms) +althangtime = 4000 ; longer squelch tail +totime = 180000 ; transmit time-out time (in ms) (optional, default 3 minutes 180000 ms) + +idrecording = |iWA4XYZ ; cording or morse string see http://ohnosec.org/drupal/node/87 +idtalkover = |iWA4XYZ ; Talkover ID (optional) default is none see http://ohnosec.org/drupal/node/129 + ; See Telemetry section Example: idrecording = rpt/nodenames/1999 +idtime = 540000 ; id interval time (in ms) (optional) Default 5 minutes (300000 ms) +politeid = 30000 ; time in milliseconds before ID timer expires to try and ID in the tail. (optional, default 30000) + +unlinkedct = ct2 ; Send a this courtesy tone when the user unkeys if the node is not connected to any other nodes. (optional, default is none) +remotect = ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) +linkunkeyct = ct8 ; sent when a transmission received over the link unkeys +;nolocallinkct = 0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). + +;connpgm = yourconnectprogram ; Disabled. Execute a program you specify on connect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being connected to us (them) -;discpgm=yourdisconnectprogram ; Default: Disabled. Execute a program you specify on disconnect. +;discpgm = yourdisconnectprogram ; Disabled. Execute a program you specify on disconnect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being disconnected from us (them) -;lnkactenable=0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. -;lnkacttime=1800 ; Link activity timer time in seconds. -;lnkactmacro=*52 ; Function to execute when link activity timer expires. -;lnkacttimerwarn=30seconds ; Message to play when the link activity timer has 30 seconds left. -;remote_inact_timeout=1800 ; Inactivity timer for remote base nodes only (set to 0 to disable). -;remote_timeout=3600 ; Session time out for remote base. (set to 0 to disable) -;nounkeyct=0 ; Set to a 1 to eliminate courtesy tones and associated delays. -;holdofftelem=0 ; Hold off all telemetry when signal is present on receiver or from connected nodes -; ; except when an ID needs to be done and there is a signal coming from a connected node. -;beaconing=0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) -; -; + +;lnkactenable = 0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. + +;lnkacttime = 1800 ; Link activity timer time in seconds. +;lnkactmacro = *52 ; Function to execute when link activity timer expires. +;lnkacttimerwarn = 30seconds ; Message to play when the link activity timer has 30 seconds left. + +;remote_inact_timeout = ; Specifies the amount of time without keying from the link. Set to 0 to disable timeout. (15 * 60) +;remote_timeout = ; Session time out for remote base. Set to 0 to disable. (60 * 60) +;remote_timeout_warning_freq = ; 30 +;remote_timeout_warning = ; (3 * 60) + +;nounkeyct = 0 ; Set to a 1 to eliminate courtesy tones and associated delays. + +holdofftelem = 0 ; Hold off all telemetry when signal is present on receiver or from connected nodes + ; except when an ID needs to be done and there is a signal coming from a connected node. + +telemdefault = 1 ; 0 = telemetry output off + ; 1 = telemetry output on (default = 1) + ; 2 = timed telemetry output on command execution and for a short time thereafter. + +telemdynamic = 1 ; 0 = disallow users to change the local telemetry setting with a COP command, + ; 1 = Allow users to change the setting with a COP command. (default = 1) + +;beaconing = 0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) + +parrotmode = 0 ; 0 = Parrot Off (default = 0) + ; 1 = Parrot On Command + ; 2 = Parrot Always + ; 3 = Parrot Once by Command + +parrottime = 1000 ; Set the amount of time in milliseconds + ; to wait before parroting what was received + +;rxnotch=1065,40 ; (Optional) Notch a particular frequency for a specified + ; b/w. app_rpt must have been compiled with + ; the notch option + +startup_macro = + +; nodenames = /var/lib/asterisk/sounds/rpt/nodenames.callsign ; Point to alternate nodename sound directory + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Need more information on these + +;extnodes = extnodes-different ; section in extnodefile containing dynamic node information (optional) +;extnodefile = /foo/nodes ; Points to nodelist file containing dynamic node info default = /var/lib/asterisk/rpt_extnodes (optional) +;extnodefile2 = ; Is this a list of node files? Possible a list of private nodes or a list of static IPs for known nodes???? +;nodenames = /foo/names ; locaton of node sound files default = /var/lib/asterisk/sounds/rpt/nodenames +;archivedir = /tmp ; defines and enables activity recording into specified directory (optional) +;monminblocks = 2048 ; Min 1K blocks to be left on partition (will not save monitor output if disk too full) + +; ; The tailmessagetime,tailsquashedtime, and tailmessagelist need to be set +; ; to support tail messages. They can be omitted otherwise. +;tailmessagetime = 300000 ; Play a tail message every 5 mins +;tailsquashedtime = 30000 ; If squashed by another user, +; ; try again after 30 seconds +;tailmessagelist = msg1,msg2 ; list of messages to be played for tail message + +; alt_functions +; ctgroup +; dphone_functions +; idtime +; iobase +; iospeed +; locallist +; mars Remote Base +; memory +; nobusyout +; nodes +; nolocallinkct +; notelemtx +; outxlat +; parrot +; propagate_phonedtmf +; rptnode +; rptinactmacro Macro to execute when inactivity timer expires +; rptinacttime Inactivity timer time in seconds (0 seconds disables feature) +; rxnotch Optional Audio notch +; simplexphonedelay +; tonemacro +; tonezone +; txlimits + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ; *** Status Reporting *** -; -; Uncomment the either group following two statpost lines to report the status of your node to stats.allstarlink.org -; depending on whether you are running ACID or Limey Linux. -; ** For ACID *** -;statpost_program=/usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +; Uncomment either group following two statpost lines to report the status of your node to stats.allstarlink.org +; depending on whether you are running ACID, Debian or Limey Linux. +; The difference is simply where your wget is located. + +; ** For ACID and Debian *** +;statpost_program = /usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates ; ** For Limey Linux ** -;statpost_program=/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +;statpost_program = /bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates +[functions] +; Prefix Functions +; *1 Disconnect Link +; *2 Monitor Link +; *3 Connect Link +; *4 Command Mode +; *5 Macros +; *6 User Functions +; *7 Connection Status/Functions +; *8 User Functions +; *9 User Functions +; *0 User Functions + +; *A User Functions +; *B User Functions +; *C User Functions +; *D User Functions + + +; Mandatory Command Codes +; http://docs.allstarlink.org/drupal/node/91 + +1 = ilink,1 ; Disconnect specified link +2 = ilink,2 ; Connect specified link -- monitor only +3 = ilink,3 ; Connect specified link -- tranceive +4 = ilink,4 ; Enter command mode on specified link +70 = ilink,5 ; System status +99 = cop,6 ; PTT (phone mode only) + +; End Mandatory Command Codes + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Macro Commands +5 = macro + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Autopatch Commands +; Note, This may be a good place for other 2 digit frequently used commands + +61 = autopatchup,noct = 1,farenddisconnect = 1,dialtime = 20000 ; Autopatch up +62 = autopatchdn ; Autopatch down + +; autopatchup can optionally take comma delimited setting=value pairs: + +; context = string ; Override default context with "string" +; dialtime = ms ; Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) +; farenddisconnect = 1 ; Automatically disconnect when called party hangs up +; noct = 1 ; Don't send repeater courtesy tone during autopatch calls +; quiet = 1 ; Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up + ; Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Status Commands + +; 1 - Force ID (global) +; 2 - Give Time of Day (global) +; 3 - Give software Version (global) +; 4 - Give GPS location info +; 5 - Last (dtmf) user +; 11 - Force ID (local only) +; 12 - Give Time of Day (local only) + +721 = status,1 ; Force ID (global) +722 = status,2 ; Give Time of Day (global) +723 = status,3 ; Give software Version (global) +724 = status,4 ; Give GPS location info +725 = status,5 ; Last (dtmf) user +711 = status,11 ; Force ID (local only) +712 = status,12 ; Give Time of Day (local only) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Link Commands + +; 1 - Disconnect specified link +; 2 - Connect specified link -- monitor only +; 3 - Connect specified link -- tranceive +; 4 - Enter command mode on specified link +; 5 - System status +; 6 - Disconnect all links +; 7 - Last Node to Key Up +; 8 - Connect specified link -- local monitor only +; 9 - Send Text Message (9,,Message Text, etc. +; 10 - Disconnect all RANGER links (except permalinks) +; 11 - Disconnect a previously permanently connected link +; 12 - Permanently connect specified link -- monitor only +; 13 - Permanently connect specified link -- tranceive +; 15 - Full system status (all nodes) +; 16 - Reconnect links disconnected with "disconnect all links" +; 17 - MDC test (for diag purposes) +; 18 - Permanently Connect specified link -- local monitor only + +; ilink commands 1 through 5 are defined in the Mandatory Command section + +806 = ilink,6 ; Disconnect all links +807 = ilink,7 ; Last Node to Key Up +808 = ilink,8 ; Connect specified link -- local monitor only +809 = ilink,9,1999,"Testing" ; would send a text message to node 1999 replace 1999 with 0 for all connected nodes +810 = ilink,10 ; Disconnect all RANGER links (except permalinks) +811 = ilink,11 ; Disconnect a previously permanently connected link +812 = ilink,12 ; Permanently connect specified link -- monitor only +813 = ilink,13 ; Permanently connect specified link -- tranceive +815 = ilink,15 ; Full system status (all nodes) +816 = ilink,16 ; Reconnect links disconnected with "disconnect all links" +817 = ilink,17 ; MDC test (for diag purposes) +818 = ilink 18 ; Permanently Connect specified link -- local monitor only + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Control operator (cop) functions. Change these to something other than these codes listed below! + +901 = cop,1 ; System warm boot +902 = cop,2 ; System enable +903 = cop,3 ; System disable + +904 = cop,4 ; Test tone on/off (toggle) +905 = cop,5 ; Dump system variables on console (debug use only) + +907 = cop,7 ; Time out timer enable +908 = cop,8 ; Time out timer disable + +909 = cop,9 ; Autopatch enable +910 = cop,10 ; Autopatch disable + +911 = cop,11 ; User linking functions enable +912 = cop,12 ; User linking functions disable + +913 = cop,13 ; Query system control state +914 = cop,14 ; Set system control state + +915 = cop,15 ; Scheduler enable +916 = cop,16 ; Scheduler disable + +917 = cop,17 ; User functions enable (time, id, etc) +918 = cop,18 ; User functions disable + +919 = cop,19 ; Select alternate hang time (althangtime) +920 = cop,20 ; Select standard hangtime (hangtime) + +921 = cop,21 ; Enable Parrot Mode +922 = cop,22 ; Disable Parrot Mode +923 = cop,23 ; Birdbath (Current Parrot Cleanup/Flush) + +924 = cop,24 ; Flush all telemetry +925 = cop,25 ; Query last node un-keyed +926 = cop,26 ; Query all nodes keyed/unkeyed +927 = cop,27 ; Reset DAQ minimum on a pin +928 = cop,28 ; Reset DAQ maximum on a pin + +930 = cop,30 ; Recall Memory Setting in Attached Xcvr + +931 = cop,31 ; Channel Selector for Parallel Programmed Xcvr + +932 = cop,32 ; Touchtone pad test: command + Digit string + # to playback all digits pressed + +933 = cop,33 ; Local Telemetry Output Enable +934 = cop,34 ; Local Telemetry Output Disable +935 = cop,35 ; Local Telemetry Output on Demand + +936 = cop,36 ; Foreign Link Local Output Path Enable +937 = cop,37 ; Foreign Link Local Output Path Disable +938 = cop,38 ; Foreign Link Local Output Path Follows Local Telemetry +939 = cop,39 ; Foreign Link Local Output Path on Demand + +942 = cop,42 ; Echolink announce node # only +943 = cop,43 ; Echolink announce node Callsign only +944 = cop,44 ; Echolink announce node # & Callsign + +945 = cop,45 ; Link Activity timer enable +945 = cop,46 ; Link Activity timer disable +947 = cop,47 ; Reset "Link Config Changed" Flag + +948 = cop,48 ; Send Page Tone (Tone specs separated by parenthesis) + +949 = cop,49 ; Disable incoming connections (control state noice) +950 = cop,50 ; Enable incoming connections (control state noicd) + +951 = cop,51 ; Enable sleep mode +952 = cop,52 ; Disable sleep mode +953 = cop,53 ; Wake up from sleep +954 = cop,54 ; Go to sleep +955 = cop,55 ; Parrot Once if parrot mode is disabled + +956 = cop,56 ; Rx CTCSS Enable +957 = cop,57 ; Rx CTCSS Disable + +958 = cop.58 ; Tx CTCSS On Input only Enable +959 = cop,59 ; Tx CTCSS On Input only Disable + +960 = cop,60 ; Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) + ; Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + ; (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. + ; DestID and subcode are only specified for the 'C' type message. + ; UnitID is the local systems UnitID. DestID is the MDC1200 ID of + ; the radio being called, and the subcodes are as follows: + ; Subcode '8205' is Voice Selective Call for Spectra ('Call') + ; Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or + ; Astro-Saber('Call') + ; Subcode '810D' is Call Alert (like Maxtrac 'CA') + +961 = cop,61 ; Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) +962 = cop,62 ; Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) + +963 = cop,63 ; Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) +964 = cop,64 ; Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) +965 = cop,65 ; Send POCSAG page (equipped channel types only) + +[functions-remote] + +0 = remote,1 ; Retrieve Memory +1 = remote,2 ; Set freq. +2 = remote,3 ; Set tx PL tone +3 = remote,4 ; Set rx PL tone +40 = remote,100 ; Rx PL off +41 = remote,101 ; Rx PL on +42 = remote,102 ; Tx PL off +43 = remote,103 ; Tx PL on +44 = remote,104 ; Low Power +45 = remote,105 ; Medium Power +46 = remote,106 ; High Power +711 = remote,107 ; Bump -20 +714 = remote,108 ; Bump -100 +717 = remote,109 ; Bump -500 +713 = remote,110 ; Bump +20 +716 = remote,111 ; Bump +100 +719 = remote,112 ; Bump +500 +721 = remote,113 ; Scan - slow +724 = remote,114 ; Scan - quick +727 = remote,115 ; Scan - fast +723 = remote,116 ; Scan + slow +726 = remote,117 ; Scan + quick +729 = remote,118 ; Scan + fast +79 = remote,119 ; Tune +51 = remote,5 ; Long status query +52 = remote,140 ; Short status query +67 = remote,210 ; Send a * +69 = remote,211 ; Send a # +;91 = remote,99,CALLSIGN,LICENSETAG ; Remote base login. + ; Define a different dtmf sequence for each user which is + ; authorized to use the remote base to control access to it. + ; For examble 9139583=remote,99,WB6NIL,G would grant access to + ; the remote base and announce WB6NIL as being logged in. + ; Another entry, 9148351=remote,99,WA6ZFT,E would grant access to + ; the remote base and announce WA6ZFT as being logged in. + ; When the remote base is disconnected from the originating node, the + ; user will be logged out. The LICENSETAG argument is used to enforce + ; tx frequency limits. See [txlimits] below. +85 = cop,6 ; Remote base telephone key -[functions] -1=ilink,1 -2=ilink,2 -3=ilink,3 -4=ilink,4 -5=macro,1 -70=ilink,5 -71=ilink,6 -72=ilink,7 -73=ilink,15 -74=ilink,16 -75=ilink,8 - -80=status,1 -81=status,2 - -6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 ; Autopatch up -0=autopatchdn ; Autopatch down - -989=cop,4 -980=status,3 -99=cop,6 [telemetry] @@ -124,35 +462,49 @@ linkunkeyct=ct8 ; sent when a transmission received over the link unkeys ; Sends Morse code at the ID amplitude and ID frequency as defined in the ; [morse] section. ; -; Follow with an alphanumeric string - - -ct1=|t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) -ct2=|t(660,880,150,2048) -ct3=|t(440,0,150,4096) -ct4=|t(550,0,150,2048) -ct5=|t(660,0,150,2048) -ct6=|t(880,0,150,2048) -ct7=|t(660,440,150,2048) -ct8=|t(700,1100,150,2048) -remotetx=|t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000); -remotemon=|t(1209,0,50,2048) -cmdmode=|t(900,903,200,2048) -functcomplete=|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) -patchup=rpt/callproceeding -patchdown=rpt/callterminated +; path/to/sound/file/without/extension +; +; Send the sound if in place of a constructed tone. Do not include the file extension +; Example: ct8 = rpt/bloop +; Example: idrecording = rpt/nodenames/1999 + +ct1 = |t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) +ct2 = |t(660,880,150,2048) +ct3 = |t(440,0,150,4096) +ct4 = |t(550,0,150,2048) +ct5 = |t(660,0,150,2048) +ct6 = |t(880,0,150,2048) +ct7 = |t(660,440,150,2048) +ct8 = |t(700,1100,150,2048) +ranger = |t(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,150,0) +remotemon = |t(1209,0,50,2048) ; local courtesy tone when receive only +remotetx = |t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000) ; local courtesy tone when linked Trancieve mode +cmdmode = |t(900,903,200,2048) +functcomplete = |t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) +remcomplete = |t(650,0,100,2048)(0,0,100,0)(650,0,100,2048)(0,0,100,0)(650,0,100,2048) +pfxtone = |t(350,440,30000,3072) +patchup = rpt/callproceeding +patchdown = rpt/callterminated + +; As far as what the numbers mean, +; (000,000,010,000) +; | | | |-------amplitude +; | | |-------------duration +; | |-------------------Tone 2 +; |-------------------------Tone 1 + +; So, with 0,0,10,0 That says No Tone1, No Tone2, 10ms duration, 0 Amplitude. +; Use it for a delay. Fine tuning for how long before telemetry is sent, in conjunction with the telemdelay parameter) +; The numbers, like 350,440,10,2048 are 350Hz, 440Hz, 10ms delay, amplitude of 2048. -; ; Morse code parameters, these are common to all repeaters. -; [morse] - -speed=20 ; Approximate speed in WPM -frequency=800 ; Morse Telemetry Frequency -amplitude=4096 ; Morse Telemetry Amplitude -idfrequency=1065 ; Morse ID Frequency -idamplitude=1024 ; Morse ID Amplitude +speed = 20 ; Approximate speed in WPM +frequency = 800 ; Morse Telemetry Frequency +amplitude = 4096 ; Morse Telemetry Amplitude +idfrequency = 1065 ; Morse ID Frequency +idamplitude = 1024 ; Morse ID Amplitude ; ; This section allows wait times for telemetry events to be adjusted @@ -160,10 +512,10 @@ idamplitude=1024 ; Morse ID Amplitude ; [wait-times] -telemwait=2000 ; Time to wait before sending most telemetry -idwait=500 ; Time to wait before starting ID -unkeywait=2000 ; Time to wait after unkey before sending CT's and link telemetry -calltermwait=2000 ; Time to wait before announcing "call terminated" +telemwait = 2000 ; Time to wait before sending most telemetry +idwait = 500 ; Time to wait before starting ID +unkeywait = 2000 ; Time to wait after unkey before sending CT's and link telemetry +calltermwait = 2000 ; Time to wait before announcing "call terminated" ; ; This is where you define your nodes which cam be connected to. @@ -172,14 +524,13 @@ calltermwait=2000 ; Time to wait before announcing "call t [nodes] ; Note, if you are using automatic update for allstar link nodes, ; no allstar link nodes should be defined here. Only place a definition -; for your locak nodes, and private (off of allstar link) nodes here. - -1999 = radio@127.0.0.1/1999,NONE ; This must be changed to your node number +; for your local nodes, and private (off of allstar link) nodes here. +1999 = radio@127.0.0.1:4569/1999,NONE ; This must be changed to your node number + ; and iax port number if not the default ; Memories for remote bases [memory] - ;00 = 146.580,100.0,m ;01 = 147.030,103.5,m+t ;02 = 147.240,103.5,m+t @@ -193,70 +544,69 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = *32011# ;2 = *12001*12011*12043*12040*12050*12060*12009*12002*12003*12004*1113*12030# ;3 = *32001*32011*32050*32030*32060# -; -; -; Data Ackquisition configuration -; + + +; Data Acquisition configuration + ;[daq-list] -;device=device_name1 -;device=device_name2 -; +;device = device_name1 +;device = device_name2 + ;Where: device_name1 and device_name2 are stanzas you define in this file -; -;device=daq-cham-1 +;device = daq-cham-1 ; Device name ;[daq-cham-1] ; Defined in [daq-list] -;hwtype=uchameleon ; DAQ hardware type -;devnode=/dev/ttyUSB0 ; DAQ device node (if required) -;1=inadc ; Pin definition for an ADC channel -;2=inadc -;3=inadc -;4=inadc -;5=inadc -;6=inadc -;7=inadc -;8=inadc -;9=inp ; Pin definition for an input with a weak pullup resistor -;10=inp -;11=inp -;12=inp -;13=in ; Pin definition for an input without a weak pullup resistor -;14=out ; Pin definition for an output -;15=out -;16=out -;17=out -;18=out +;hwtype = uchameleon ; DAQ hardware type +;devnode = /dev/ttyUSB0 ; DAQ device node (if required) +;1 = inadc ; Pin definition for an ADC channel +;2 = inadc +;3 = inadc +;4 = inadc +;5 = inadc +;6 = inadc +;7 = inadc +;8 = inadc +;9 = inp ; Pin definition for an input with a weak pullup resistor +;10 = inp +;11 = inp +;12 = inp +;13 = in ; Pin definition for an input without a weak pullup resistor +;14 = out ; Pin definition for an output +;15 = out +;16 = out +;17 = out +;18 = out ;[meter-faces] -;face=scale(scalepre,scalediv,scalepost),word/?,... +;face = scale(scalepre,scalediv,scalepost),word/?,... ; ; scalepre = offset to add before dividing with scalediv ; scalediv = full scale/number of whole units (e.g. 256/20 or 12.8 for 20 volts). ; scalepost = offset to add after dividing with scalediv ; -;face=range(X-Y:word,X2-Y2:word,...),word/?,... -;face=bit(low-word,high-word),word/?,... +;face = range(X-Y:word,X2-Y2:word,...),word/?,... +;face = bit(low-word,high-word),word/?,... ; ; word/? is either a word in /var/lib/asterisk/sounds or one of its subdirectories, ; or a question mark which is a placeholder for the measured value. ; ; ; Battery voltage 0-20 volts -;batvolts=scale(0,12.8,0),rpt/thevoltageis,?,ha/volts +;batvolts = scale(0,12.8,0),rpt/thevoltageis,?,ha/volts ; 4 quadrant wind direction -;winddir=range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? +;winddir = range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? ; LM34 temperature sensor with 130 deg. F full scale -;lm34f=scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit +;lm34f = scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit ; Status poll (non alarmed) -;light=bit(ha/off,ha/on),ha/light,? +;light = bit(ha/off,ha/on),ha/light,? ;[alarms] ; -;tag=device,pin,node,ignorefirst,func-low,func-hi +;tag = device,pin,node,ignorefirst,func-low,func-hi ; ;tag = a unique name for the alarm ;device = daq device to poll @@ -268,8 +618,8 @@ calltermwait=2000 ; Time to wait before announcing "call t ; ; a '-' as a function name is shorthand for no-operation ; -;door=daq-cham-1,9,1,2017,*7,- -;pwrfail=daq-cham-1,10,0,2017,*911111,- +;door = daq-cham-1,9,1,2017,*7,- +;pwrfail = daq-cham-1,10,0,2017,*911111,- ; ; Control states ; Allow several control operator functions to be changed at once using one command (good for scheduling) @@ -280,13 +630,12 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = rptena,lnkena,apdis,totdis,ufena,noice ; Net and news operation ;2 = rptena,lnkdis,apdis,totena,ufdis,noice ; Repeater only operation -; ; Scheduler - execute a macro at a given time -; -;[schedule] + +[schedule] ;dtmf_function = m h dom mon dow ; ala cron, star is implied ;2 = 00 00 * * * ; at midnight, execute macro 2. - +#includeifexists custom/rpt.conf diff --git a/configs/simpleusb/modules.conf b/configs/simpleusb/modules.conf index 4e23dd41..8bf9e638 100644 --- a/configs/simpleusb/modules.conf +++ b/configs/simpleusb/modules.conf @@ -3,11 +3,214 @@ ; ; Module Loader configuration file ; +; By default DIAL does NOT load every module, only what is needed + +; You can enable or disable any of the asterisk modules +; All modules are compiled and installed. + +; To enable a module: load => module_name.so +; To disable a module: noload => module_name.so + +; You will want to enable the channel driver modules you will be using. +; There are below in the Channel Driver section +; The most common Channel drivers for app_rpt are: +; chan_echolink.so echolink channel driver +; chan_simpleusb.so Simple USB Radio Interface Channel Drive +; chan_usbradio.so USB Console Channel Driver +; chan_usrp.so USRP Channel Module +; chan_voter.so radio Voter channel driver [modules] -autoload=yes -noload=chan_oss.so -noload=chan_alsa.so -noload=chan_phone.so + +autoload=no + +; Applications + +noload => app_adsiprog.so ; Asterisk ADSI Programming Application +noload => app_alarmreceiver.so ; Alarm Receiver for Asterisk +noload => app_amd.so ; Answering Machine Detection Application +load => app_authenticate.so ; Authentication Application +noload => app_cdr.so ; Tell Asterisk to not maintain a CDR for +noload => app_chanisavail.so ; Check channel availability +noload => app_channelredirect.so ; Channel Redirect +noload => app_chanspy.so ; Listen to the audio of an active channel +noload => app_controlplayback.so ; Control Playback Application +noload => app_dahdibarge.so ; Barge in on channel application +noload => app_dahdiras.so ; DAHDI RAS Application +noload => app_dahdiscan.so ; Scan Zap channels application +noload => app_db.so ; Database Access Functions +load => app_dial.so ; Dialing Application +noload => app_dictate.so ; Virtual Dictation Machine +noload => app_directed_pickup.so ; Directed Call Pickup Application +noload => app_directory.so ; Extension Directory +noload => app_disa.so ; DISA (Direct Inward System Access) Appli +noload => app_dumpchan.so ; Dump Info About The Calling Channel +noload => app_echo.so ; Simple Echo Application +load => app_exec.so ; Executes dialplan applications +noload => app_externalivr.so ; External IVR Interface Application +noload => app_festival.so ; Simple Festival Interface +noload => app_flash.so ; Flash channel application +noload => app_followme.so ; Find-Me/Follow-Me Application +noload => app_forkcdr.so ; Fork The CDR into 2 separate entities +noload => app_getcpeid.so ; Get ADSI CPE ID +noload => app_gps.so ; GPS interface module +noload => app_hasnewvoicemail.so ; Indicator for whether a voice mailbox ha +noload => app_ices.so ; Encode and Stream via icecast and ices +noload => app_image.so ; Image Transmission Application +noload => app_lookupblacklist.so ; Look up Caller*ID name/number from black +noload => app_lookupcidname.so ; Look up CallerID Name from local databas +load => app_macro.so ; Extension Macros +noload => app_meetme.so ; MeetMe conference bridge +noload => app_milliwatt.so ; Digital Milliwatt (mu-law) Test Applicat +noload => app_mixmonitor.so ; Mixed Audio Monitoring Application +noload => app_morsecode.so ; Morse code +noload => app_mp3.so ; Silly MP3 Application +noload => app_nbscat.so ; Silly NBS Stream Application +noload => app_page.so ; Page Multiple Phones +noload => app_parkandannounce.so ; Call Parking and Announce Application +load => app_playback.so ; Sound File Playback Application +noload => app_privacy.so ; Require phone number to be entered, if n +noload => app_queue.so ; True Call Queueing +noload => app_radbridge.so ; Radio Bridging interface module +noload => app_random.so ; Random goto +noload => app_readfile.so ; Stores output of file into a variable +noload => app_read.so ; Read Variable Application +noload => app_realtime.so ; Realtime Data Lookup/Rewrite +noload => app_record.so ; Trivial Record Application +load => app_rpt.so ; Radio Repeater/Remote Base Application +noload => app_sayunixtime.so ; Say time +noload => app_senddtmf.so ; Send DTMF digits Application +load => app_sendtext.so ; Send Text Applications +noload => app_setcallerid.so ; Set CallerID Application +noload => app_setcdruserfield.so ; CDR user field apps +noload => app_settransfercapability.so ; Set ISDN Transfer Capability +noload => app_sms.so ; SMS/PSTN handler +noload => app_softhangup.so ; Hangs up the requested channel +noload => app_speech_utils.so ; Dialplan Speech Applications +noload => app_stack.so ; Stack Routines +load => app_system.so ; Generic System() application +noload => app_talkdetect.so ; Playback with Talk Detection +noload => app_test.so ; Interface Test Application +load => app_transfer.so ; Transfer +noload => app_url.so ; Send URL Applications +noload => app_userevent.so ; Custom User Event Application +noload => app_verbose.so ; Send verbose output +noload => app_voicemail.so ; Comedian Mail (Voicemail System) +noload => app_waitforring.so ; Waits until first ring after time +noload => app_waitforsilence.so ; Wait For Silence +noload => app_while.so ; While Loops and Conditional Execution +noload => app_zapateller.so ; Block Telemarketers with Special Informa + +; CDR + +noload => cdr_csv.so ; Comma Separated Values CDR Backend +noload => cdr_custom.so ; Customizable Comma Separated Values CDR +noload => cdr_manager.so ; Asterisk Manager Interface CDR Backend + +; Channels + +noload => chan_agent.so ; Agent Proxy Channel +noload => chan_alsa.so ; ALSA Console Channel Driver +noload => chan_beagle.so ; Beagleboard Radio Interface Channel Driver +load => chan_dahdi.so ; DAHDI Telephony +noload => chan_echolink.so ; echolink Channel Driver +noload => chan_features.so ; Feature Proxy Channel +noload => chan_gtalk.so ; Gtalk Channel Driver +load => chan_iax2.so ; Inter Asterisk eXchange (Ver 2) +load => chan_local.so ; Local Proxy Channel (Note: used internal +noload => chan_oss.so ; Channel driver for OSS sound cards +noload => chan_phone.so ; Generic Linux Telephony Interface driver +noload => chan_pi.so ; DMK Engineering "PITA" Board on Rpi2/3 Channel Driver +load => chan_simpleusb.so ; CM1xx USB Cards with Radio Interface Channel Driver (No DSP) +noload => chan_sip.so ; Session Initiation Protocol (SIP) +noload => chan_tlb.so ; TheLinkBox Channel Driver +noload => chan_usbradio.so ; CM1xx USB Cards with Radio Interface Channel Driver (DSP) +noload => chan_usrp.so ; GNU Radio interface USRP Channel Driver +noload => chan_voter.so ; Radio Voter Channel Driver + +; Codecs + +; CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers) +; ULAW best 87 kilobits per second (kbps) +; ADPCM good 55 kbps +; GSM mediocre 36 kbps +; g726aal2 +; ilbc + +load => codec_adpcm.so ; Adaptive Differential PCM Coder/Decoder +load => codec_alaw.so ; A-law Coder/Decoder +load => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder +noload => codec_dahdi.so ; Generic DAHDI Transcoder Codec Translato +load => codec_g726.so ; ITU G.726-32kbps G726 Transcoder +load => codec_gsm.so ; GSM Coder/Decoder +load => codec_ulaw.so ; mu-Law Coder/Decoder +noload => codec_ilbc.so ; http://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec + +; Formats + +load => format_g723.so ; G.723.1 Simple Timestamp File Format +load => format_g726.so ; Raw G.726 (16/24/32/40kbps) data +load => format_g729.so ; Raw G729 data +load => format_gsm.so ; Raw GSM data +load => format_h263.so ; Raw H.263 data +load => format_h264.so ; Raw H.264 data +load => format_ilbc.so ; Raw iLBC data +noload => format_jpeg.so ; JPEG (Joint Picture Experts Group) Image +load => format_pcm.so ; Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. +load => format_sln.so ; Raw Signed Linear Audio support (SLN) +load => format_vox.so ; Dialogic VOX (ADPCM) File Format +load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) +load => format_wav.so ; Microsoft WAV format (8000Hz Signed Line + +; Functions + +load => func_base64.so ; base64 encode/decode dialplan functions +load => func_callerid.so ; Caller ID related dialplan function +load => func_cdr.so ; CDR dialplan function +load => func_channel.so ; Channel information dialplan function +load => func_curl.so ; Load external URL +load => func_cut.so ; Cut out information from a string +load => func_db.so ; Database (astdb) related dialplan functi +load => func_enum.so ; ENUM related dialplan functions +load => func_env.so ; Environment/filesystem dialplan function +load => func_global.so ; Global variable dialplan functions +load => func_groupcount.so ; Channel group dialplan functions +load => func_language.so ; Channel language dialplan function +load => func_logic.so ; Logical dialplan functions +load => func_math.so ; Mathematical dialplan function +load => func_md5.so ; MD5 digest dialplan functions +load => func_moh.so ; Music-on-hold dialplan function +load => func_rand.so ; Random number dialplan function +load => func_realtime.so ; Read/Write values from a RealTime reposi +noload => func_sha1.so ; SHA-1 computation dialplan function +noload => func_strings.so ; String handling dialplan functions +noload => func_timeout.so ; Channel timeout dialplan functions +noload => func_uri.so ; URI encode/decode dialplan functions + +; PBX + +noload => pbx_ael.so ; Asterisk Extension Language Compiler +load => pbx_config.so ; Text Extension Configuration +noload => pbx_dundi.so ; Distributed Universal Number Discovery ( +noload => pbx_loopback.so ; Loopback Switch +noload => pbx_realtime.so ; Realtime Switch +noload => pbx_spool.so ; Outgoing Spool Support + +; Resources + +load => res_adsi.so ; ADSI Resource +noload => res_agi.so ; Asterisk Gateway Interface (AGI) +noload => res_clioriginate.so ; Call origination from the CLI +noload => res_convert.so ; File format conversion CLI command +load => res_crypto.so ; Cryptographic Digital Signatures +load => res_features.so ; Call Features Resource +load => res_indications.so ; Indications Resource +noload => res_jabber.so ; AJI - Asterisk Jabber Interface +noload => res_monitor.so ; Call Monitoring Resource +noload => res_musiconhold.so ; Music On Hold Resource +noload => res_smdi.so ; Simplified Message Desk Interface (SMDI) +noload => res_snmp.so ; SNMP [Sub]Agent for Asterisk +noload => res_speech.so ; Generic Speech Recognition API [global] + diff --git a/configs/simpleusb/rpt.conf b/configs/simpleusb/rpt.conf index 1f723a08..ac6fe291 100644 --- a/configs/simpleusb/rpt.conf +++ b/configs/simpleusb/rpt.conf @@ -1,106 +1,444 @@ ; Radio Repeater configuration file (for use with app_rpt) -; -; ; Your Repeater -; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [1999] ; Change this to your assigned node number -rxchannel = SimpleUSB/usb ; Rx audio/signalling channel -erxgain=-3 ; Echolink receive gain adjustment + ; Must also be enabled in modules.conf + ; Rx audio/signalling channel. Choose ONLY 1 per node stanza + + ; Enable the selected channel driver in modules.conf !!! +; rxchannel = dahdi/pseudo ; No radio (hub) +rxchannel = SimpleUSB/usb_1999 ; SimpleUSB +; rxchannel = Pi/1 ; Raspberry Pi PiTA +; rxchannel = Radio/usb_1999 ; USBRadio (DSP) +; rxchannel = Dahdi/1 ; PCI Quad card +; rxchannel = Beagle/1 ; BeagleBoard +; rxchannel = USRP/127.0.0.1:34001:32001; GNU Radio interface USRP + +duplex = 1 ; 0 = Half duplex with no telemetry tones or hang time. + ; Special Case: Full duplex if linktolink is set to yes. + ; This mode is preferred when interfacing with an external multiport repeater controller. + ; Comment out idrecording and idtalkover to suppress IDs also + ; 1 = Half duplex with telemetry tones and hang time. Does not repeat audio. + ; This mode is preferred when interfacing a simplex node. + ; 2 = Full Duplex with telemetry tones and hang time. + ; This mode is preferred when interfacing a repeater. + ; 3 = Full Duplex with telemetry tones and hang time, but no repeated audio. + ; 4 = Full Duplex with telemetry tones and hang time. Repeated audio only when the autopatch is down. + +linktolink = no ; disables forcing physical half-duplex operation of main repeater while + ; still keeping half-duplex semantics (optional) + +linkmongain = 0 ; Link Monitor Gain adjusts the audio level of monitored nodes when a signal from another node or the local receiver is received. + ; If linkmongain is set to a negative number the monitored audio will decrease by the set amount in db. + ; If linkmongain set to a positive number monitored audio will increase by the set amount in db. + ; The value of linkmongain is in db. The default value is 0 db. + +erxgain = -3 ; Echolink receive gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -etxgain=3 ; Echolink transmit gain adjustment +etxgain = 3 ; Echolink transmit gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -;controlstates=controlstates ; system control state list -;scheduler=schedule; ; scheduler entries -functions=functions ; Repeater Function Table -phone_functions=functions ; Repeater Function Table -link_functions=functions ; Link Function Table -telemetry=telemetry ; Telemetry descriptions -wait_times=wait-times ; Wait times -context = radio ; dialing context for phone -callerid = "Repeater" <0000000000> ; callerid for phone calls -idrecording = |iid ; id recording or morse string -accountcode=RADIO ; account code (optional) -hangtime=1000 ; squelch tail hang time (in ms) (optional) -althangtime=4000 ; longer squelch tail -totime=170000 ; transmit time-out time (in ms) (optional) -idtime=540000 ; id interval time (in ms) (optional) -; The default values for hangtime, time-out time, and id interval time are -; 5 seconds (5000 ms), 3 minutes (180000 ms), and 5 minutes (300000 ms) -; respectively - -politeid=30000 ; time in milliseconds before ID timer - - ; expires to try and ID in the tail. - ; (optional, default is 30000). -idtalkover=|iid ; Talkover ID (optional) default is none -unlinkedct=ct2 ; unlinked courtesy tone (optional) default is none -remotect=ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) -linkunkeyct=ct8 ; sent when a transmission received over the link unkeys -;nolocallinkct=0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). -;eannmode=1 ; Default: 1 = Say only node number on echolink connects - ; 2 = say phonetic call sign only on echolink connects - ; 3 = say phonetic call sign and node number on echolink connects -;connpgm=yourconnectprogram ; Default: Disabled. Execute a program you specify on connect. +;eannmode = 1 ; 1 = Say only node number on echolink connects (default = 1) + ; 2 = say phonetic call sign only on echolink connects + ; 3 = say phonetic call sign and node number on echolink connects + +;controlstates = controlstates ; system control state stanza + +scheduler = schedule ; scheduler stanza +functions = functions ; Repeater Function stanza +phone_functions = functions ; Phone Function stanza +link_functions = functions ; Link Function stanza + +telemetry = telemetry ; Telemetry stanza +morse = morse ; Morse stanza +wait_times = wait-times ; Wait times stanza + +context = radio ; dialing context for phone +callerid = "Repeater" <0000000000> ; callerid for phone calls +accountcode = RADIO ; account code (optional) + +hangtime = 5000 ; squelch tail hang time (in ms) (optional, default 5 seconds, 5000 ms) +althangtime = 4000 ; longer squelch tail +totime = 180000 ; transmit time-out time (in ms) (optional, default 3 minutes 180000 ms) + +idrecording = |iWA4XYZ ; cording or morse string see http://ohnosec.org/drupal/node/87 +idtalkover = |iWA4XYZ ; Talkover ID (optional) default is none see http://ohnosec.org/drupal/node/129 + ; See Telemetry section Example: idrecording = rpt/nodenames/1999 +idtime = 540000 ; id interval time (in ms) (optional) Default 5 minutes (300000 ms) +politeid = 30000 ; time in milliseconds before ID timer expires to try and ID in the tail. (optional, default 30000) + +unlinkedct = ct2 ; Send a this courtesy tone when the user unkeys if the node is not connected to any other nodes. (optional, default is none) +remotect = ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) +linkunkeyct = ct8 ; sent when a transmission received over the link unkeys +;nolocallinkct = 0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). + +;connpgm = yourconnectprogram ; Disabled. Execute a program you specify on connect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being connected to us (them) -;discpgm=yourdisconnectprogram ; Default: Disabled. Execute a program you specify on disconnect. +;discpgm = yourdisconnectprogram ; Disabled. Execute a program you specify on disconnect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being disconnected from us (them) -;lnkactenable=0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. -;lnkacttime=1800 ; Link activity timer time in seconds. -;lnkactmacro=*52 ; Function to execute when link activity timer expires. -;lnkacttimerwarn=30seconds ; Message to play when the link activity timer has 30 seconds left. -;remote_inact_timeout=1800 ; Inactivity timer for remote base nodes only (set to 0 to disable). -;remote_timeout=3600 ; Session time out for remote base. (set to 0 to disable) -;nounkeyct=0 ; Set to a 1 to eliminate courtesy tones and associated delays. -;holdofftelem=0 ; Hold off all telemetry when signal is present on receiver or from connected nodes -; ; except when an ID needs to be done and there is a signal coming from a connected node. -;beaconing=0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) -; -; + +;lnkactenable = 0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. + +;lnkacttime = 1800 ; Link activity timer time in seconds. +;lnkactmacro = *52 ; Function to execute when link activity timer expires. +;lnkacttimerwarn = 30seconds ; Message to play when the link activity timer has 30 seconds left. + +;remote_inact_timeout = ; Specifies the amount of time without keying from the link. Set to 0 to disable timeout. (15 * 60) +;remote_timeout = ; Session time out for remote base. Set to 0 to disable. (60 * 60) +;remote_timeout_warning_freq = ; 30 +;remote_timeout_warning = ; (3 * 60) + +;nounkeyct = 0 ; Set to a 1 to eliminate courtesy tones and associated delays. + +holdofftelem = 0 ; Hold off all telemetry when signal is present on receiver or from connected nodes + ; except when an ID needs to be done and there is a signal coming from a connected node. + +telemdefault = 1 ; 0 = telemetry output off + ; 1 = telemetry output on (default = 1) + ; 2 = timed telemetry output on command execution and for a short time thereafter. + +telemdynamic = 1 ; 0 = disallow users to change the local telemetry setting with a COP command, + ; 1 = Allow users to change the setting with a COP command. (default = 1) + +;beaconing = 0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) + +parrotmode = 0 ; 0 = Parrot Off (default = 0) + ; 1 = Parrot On Command + ; 2 = Parrot Always + ; 3 = Parrot Once by Command + +parrottime = 1000 ; Set the amount of time in milliseconds + ; to wait before parroting what was received + +;rxnotch=1065,40 ; (Optional) Notch a particular frequency for a specified + ; b/w. app_rpt must have been compiled with + ; the notch option + +startup_macro = + +; nodenames = /var/lib/asterisk/sounds/rpt/nodenames.callsign ; Point to alternate nodename sound directory + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Need more information on these + +;extnodes = extnodes-different ; section in extnodefile containing dynamic node information (optional) +;extnodefile = /foo/nodes ; Points to nodelist file containing dynamic node info default = /var/lib/asterisk/rpt_extnodes (optional) +;extnodefile2 = ; Is this a list of node files? Possible a list of private nodes or a list of static IPs for known nodes???? +;nodenames = /foo/names ; locaton of node sound files default = /var/lib/asterisk/sounds/rpt/nodenames +;archivedir = /tmp ; defines and enables activity recording into specified directory (optional) +;monminblocks = 2048 ; Min 1K blocks to be left on partition (will not save monitor output if disk too full) + +; ; The tailmessagetime,tailsquashedtime, and tailmessagelist need to be set +; ; to support tail messages. They can be omitted otherwise. +;tailmessagetime = 300000 ; Play a tail message every 5 mins +;tailsquashedtime = 30000 ; If squashed by another user, +; ; try again after 30 seconds +;tailmessagelist = msg1,msg2 ; list of messages to be played for tail message + +; alt_functions +; ctgroup +; dphone_functions +; idtime +; iobase +; iospeed +; locallist +; mars Remote Base +; memory +; nobusyout +; nodes +; nolocallinkct +; notelemtx +; outxlat +; parrot +; propagate_phonedtmf +; rptnode +; rptinactmacro Macro to execute when inactivity timer expires +; rptinacttime Inactivity timer time in seconds (0 seconds disables feature) +; rxnotch Optional Audio notch +; simplexphonedelay +; tonemacro +; tonezone +; txlimits + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ; *** Status Reporting *** -; -; Uncomment the either group following two statpost lines to report the status of your node to stats.allstarlink.org -; depending on whether you are running ACID or Limey Linux. -; ** For ACID *** -;statpost_program=/usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +; Uncomment either group following two statpost lines to report the status of your node to stats.allstarlink.org +; depending on whether you are running ACID, Debian or Limey Linux. +; The difference is simply where your wget is located. + +; ** For ACID and Debian *** +;statpost_program = /usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates ; ** For Limey Linux ** -;statpost_program=/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +;statpost_program = /bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates +[functions] +; Prefix Functions +; *1 Disconnect Link +; *2 Monitor Link +; *3 Connect Link +; *4 Command Mode +; *5 Macros +; *6 User Functions +; *7 Connection Status/Functions +; *8 User Functions +; *9 User Functions +; *0 User Functions + +; *A User Functions +; *B User Functions +; *C User Functions +; *D User Functions + + +; Mandatory Command Codes +; http://docs.allstarlink.org/drupal/node/91 + +1 = ilink,1 ; Disconnect specified link +2 = ilink,2 ; Connect specified link -- monitor only +3 = ilink,3 ; Connect specified link -- tranceive +4 = ilink,4 ; Enter command mode on specified link +70 = ilink,5 ; System status +99 = cop,6 ; PTT (phone mode only) + +; End Mandatory Command Codes + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Macro Commands +5 = macro + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Autopatch Commands +; Note, This may be a good place for other 2 digit frequently used commands + +61 = autopatchup,noct = 1,farenddisconnect = 1,dialtime = 20000 ; Autopatch up +62 = autopatchdn ; Autopatch down + +; autopatchup can optionally take comma delimited setting=value pairs: + +; context = string ; Override default context with "string" +; dialtime = ms ; Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) +; farenddisconnect = 1 ; Automatically disconnect when called party hangs up +; noct = 1 ; Don't send repeater courtesy tone during autopatch calls +; quiet = 1 ; Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up + ; Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Status Commands + +; 1 - Force ID (global) +; 2 - Give Time of Day (global) +; 3 - Give software Version (global) +; 4 - Give GPS location info +; 5 - Last (dtmf) user +; 11 - Force ID (local only) +; 12 - Give Time of Day (local only) + +721 = status,1 ; Force ID (global) +722 = status,2 ; Give Time of Day (global) +723 = status,3 ; Give software Version (global) +724 = status,4 ; Give GPS location info +725 = status,5 ; Last (dtmf) user +711 = status,11 ; Force ID (local only) +712 = status,12 ; Give Time of Day (local only) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Link Commands + +; 1 - Disconnect specified link +; 2 - Connect specified link -- monitor only +; 3 - Connect specified link -- tranceive +; 4 - Enter command mode on specified link +; 5 - System status +; 6 - Disconnect all links +; 7 - Last Node to Key Up +; 8 - Connect specified link -- local monitor only +; 9 - Send Text Message (9,,Message Text, etc. +; 10 - Disconnect all RANGER links (except permalinks) +; 11 - Disconnect a previously permanently connected link +; 12 - Permanently connect specified link -- monitor only +; 13 - Permanently connect specified link -- tranceive +; 15 - Full system status (all nodes) +; 16 - Reconnect links disconnected with "disconnect all links" +; 17 - MDC test (for diag purposes) +; 18 - Permanently Connect specified link -- local monitor only + +; ilink commands 1 through 5 are defined in the Mandatory Command section + +806 = ilink,6 ; Disconnect all links +807 = ilink,7 ; Last Node to Key Up +808 = ilink,8 ; Connect specified link -- local monitor only +809 = ilink,9,1999,"Testing" ; would send a text message to node 1999 replace 1999 with 0 for all connected nodes +810 = ilink,10 ; Disconnect all RANGER links (except permalinks) +811 = ilink,11 ; Disconnect a previously permanently connected link +812 = ilink,12 ; Permanently connect specified link -- monitor only +813 = ilink,13 ; Permanently connect specified link -- tranceive +815 = ilink,15 ; Full system status (all nodes) +816 = ilink,16 ; Reconnect links disconnected with "disconnect all links" +817 = ilink,17 ; MDC test (for diag purposes) +818 = ilink 18 ; Permanently Connect specified link -- local monitor only + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Control operator (cop) functions. Change these to something other than these codes listed below! + +901 = cop,1 ; System warm boot +902 = cop,2 ; System enable +903 = cop,3 ; System disable + +904 = cop,4 ; Test tone on/off (toggle) +905 = cop,5 ; Dump system variables on console (debug use only) + +907 = cop,7 ; Time out timer enable +908 = cop,8 ; Time out timer disable + +909 = cop,9 ; Autopatch enable +910 = cop,10 ; Autopatch disable + +911 = cop,11 ; User linking functions enable +912 = cop,12 ; User linking functions disable + +913 = cop,13 ; Query system control state +914 = cop,14 ; Set system control state + +915 = cop,15 ; Scheduler enable +916 = cop,16 ; Scheduler disable + +917 = cop,17 ; User functions enable (time, id, etc) +918 = cop,18 ; User functions disable + +919 = cop,19 ; Select alternate hang time (althangtime) +920 = cop,20 ; Select standard hangtime (hangtime) + +921 = cop,21 ; Enable Parrot Mode +922 = cop,22 ; Disable Parrot Mode +923 = cop,23 ; Birdbath (Current Parrot Cleanup/Flush) + +924 = cop,24 ; Flush all telemetry +925 = cop,25 ; Query last node un-keyed +926 = cop,26 ; Query all nodes keyed/unkeyed +927 = cop,27 ; Reset DAQ minimum on a pin +928 = cop,28 ; Reset DAQ maximum on a pin + +930 = cop,30 ; Recall Memory Setting in Attached Xcvr + +931 = cop,31 ; Channel Selector for Parallel Programmed Xcvr + +932 = cop,32 ; Touchtone pad test: command + Digit string + # to playback all digits pressed + +933 = cop,33 ; Local Telemetry Output Enable +934 = cop,34 ; Local Telemetry Output Disable +935 = cop,35 ; Local Telemetry Output on Demand + +936 = cop,36 ; Foreign Link Local Output Path Enable +937 = cop,37 ; Foreign Link Local Output Path Disable +938 = cop,38 ; Foreign Link Local Output Path Follows Local Telemetry +939 = cop,39 ; Foreign Link Local Output Path on Demand + +942 = cop,42 ; Echolink announce node # only +943 = cop,43 ; Echolink announce node Callsign only +944 = cop,44 ; Echolink announce node # & Callsign + +945 = cop,45 ; Link Activity timer enable +945 = cop,46 ; Link Activity timer disable +947 = cop,47 ; Reset "Link Config Changed" Flag + +948 = cop,48 ; Send Page Tone (Tone specs separated by parenthesis) + +949 = cop,49 ; Disable incoming connections (control state noice) +950 = cop,50 ; Enable incoming connections (control state noicd) + +951 = cop,51 ; Enable sleep mode +952 = cop,52 ; Disable sleep mode +953 = cop,53 ; Wake up from sleep +954 = cop,54 ; Go to sleep +955 = cop,55 ; Parrot Once if parrot mode is disabled + +956 = cop,56 ; Rx CTCSS Enable +957 = cop,57 ; Rx CTCSS Disable + +958 = cop.58 ; Tx CTCSS On Input only Enable +959 = cop,59 ; Tx CTCSS On Input only Disable + +960 = cop,60 ; Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) + ; Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + ; (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. + ; DestID and subcode are only specified for the 'C' type message. + ; UnitID is the local systems UnitID. DestID is the MDC1200 ID of + ; the radio being called, and the subcodes are as follows: + ; Subcode '8205' is Voice Selective Call for Spectra ('Call') + ; Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or + ; Astro-Saber('Call') + ; Subcode '810D' is Call Alert (like Maxtrac 'CA') + +961 = cop,61 ; Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) +962 = cop,62 ; Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) + +963 = cop,63 ; Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) +964 = cop,64 ; Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) +965 = cop,65 ; Send POCSAG page (equipped channel types only) + +[functions-remote] + +0 = remote,1 ; Retrieve Memory +1 = remote,2 ; Set freq. +2 = remote,3 ; Set tx PL tone +3 = remote,4 ; Set rx PL tone +40 = remote,100 ; Rx PL off +41 = remote,101 ; Rx PL on +42 = remote,102 ; Tx PL off +43 = remote,103 ; Tx PL on +44 = remote,104 ; Low Power +45 = remote,105 ; Medium Power +46 = remote,106 ; High Power +711 = remote,107 ; Bump -20 +714 = remote,108 ; Bump -100 +717 = remote,109 ; Bump -500 +713 = remote,110 ; Bump +20 +716 = remote,111 ; Bump +100 +719 = remote,112 ; Bump +500 +721 = remote,113 ; Scan - slow +724 = remote,114 ; Scan - quick +727 = remote,115 ; Scan - fast +723 = remote,116 ; Scan + slow +726 = remote,117 ; Scan + quick +729 = remote,118 ; Scan + fast +79 = remote,119 ; Tune +51 = remote,5 ; Long status query +52 = remote,140 ; Short status query +67 = remote,210 ; Send a * +69 = remote,211 ; Send a # +;91 = remote,99,CALLSIGN,LICENSETAG ; Remote base login. + ; Define a different dtmf sequence for each user which is + ; authorized to use the remote base to control access to it. + ; For examble 9139583=remote,99,WB6NIL,G would grant access to + ; the remote base and announce WB6NIL as being logged in. + ; Another entry, 9148351=remote,99,WA6ZFT,E would grant access to + ; the remote base and announce WA6ZFT as being logged in. + ; When the remote base is disconnected from the originating node, the + ; user will be logged out. The LICENSETAG argument is used to enforce + ; tx frequency limits. See [txlimits] below. +85 = cop,6 ; Remote base telephone key -[functions] -1=ilink,1 -2=ilink,2 -3=ilink,3 -4=ilink,4 -5=macro,1 -70=ilink,5 -71=ilink,6 -72=ilink,7 -73=ilink,15 -74=ilink,16 -75=ilink,8 - -80=status,1 -81=status,2 - -6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 ; Autopatch up -0=autopatchdn ; Autopatch down - -989=cop,4 -980=status,3 -99=cop,6 [telemetry] @@ -124,35 +462,49 @@ linkunkeyct=ct8 ; sent when a transmission received over the link unkeys ; Sends Morse code at the ID amplitude and ID frequency as defined in the ; [morse] section. ; -; Follow with an alphanumeric string - - -ct1=|t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) -ct2=|t(660,880,150,2048) -ct3=|t(440,0,150,4096) -ct4=|t(550,0,150,2048) -ct5=|t(660,0,150,2048) -ct6=|t(880,0,150,2048) -ct7=|t(660,440,150,2048) -ct8=|t(700,1100,150,2048) -remotetx=|t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000); -remotemon=|t(1209,0,50,2048) -cmdmode=|t(900,903,200,2048) -functcomplete=|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) -patchup=rpt/callproceeding -patchdown=rpt/callterminated +; path/to/sound/file/without/extension +; +; Send the sound if in place of a constructed tone. Do not include the file extension +; Example: ct8 = rpt/bloop +; Example: idrecording = rpt/nodenames/1999 + +ct1 = |t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) +ct2 = |t(660,880,150,2048) +ct3 = |t(440,0,150,4096) +ct4 = |t(550,0,150,2048) +ct5 = |t(660,0,150,2048) +ct6 = |t(880,0,150,2048) +ct7 = |t(660,440,150,2048) +ct8 = |t(700,1100,150,2048) +ranger = |t(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,150,0) +remotemon = |t(1209,0,50,2048) ; local courtesy tone when receive only +remotetx = |t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000) ; local courtesy tone when linked Trancieve mode +cmdmode = |t(900,903,200,2048) +functcomplete = |t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) +remcomplete = |t(650,0,100,2048)(0,0,100,0)(650,0,100,2048)(0,0,100,0)(650,0,100,2048) +pfxtone = |t(350,440,30000,3072) +patchup = rpt/callproceeding +patchdown = rpt/callterminated + +; As far as what the numbers mean, +; (000,000,010,000) +; | | | |-------amplitude +; | | |-------------duration +; | |-------------------Tone 2 +; |-------------------------Tone 1 + +; So, with 0,0,10,0 That says No Tone1, No Tone2, 10ms duration, 0 Amplitude. +; Use it for a delay. Fine tuning for how long before telemetry is sent, in conjunction with the telemdelay parameter) +; The numbers, like 350,440,10,2048 are 350Hz, 440Hz, 10ms delay, amplitude of 2048. -; ; Morse code parameters, these are common to all repeaters. -; [morse] - -speed=20 ; Approximate speed in WPM -frequency=800 ; Morse Telemetry Frequency -amplitude=4096 ; Morse Telemetry Amplitude -idfrequency=1065 ; Morse ID Frequency -idamplitude=1024 ; Morse ID Amplitude +speed = 20 ; Approximate speed in WPM +frequency = 800 ; Morse Telemetry Frequency +amplitude = 4096 ; Morse Telemetry Amplitude +idfrequency = 1065 ; Morse ID Frequency +idamplitude = 1024 ; Morse ID Amplitude ; ; This section allows wait times for telemetry events to be adjusted @@ -160,10 +512,10 @@ idamplitude=1024 ; Morse ID Amplitude ; [wait-times] -telemwait=2000 ; Time to wait before sending most telemetry -idwait=500 ; Time to wait before starting ID -unkeywait=2000 ; Time to wait after unkey before sending CT's and link telemetry -calltermwait=2000 ; Time to wait before announcing "call terminated" +telemwait = 2000 ; Time to wait before sending most telemetry +idwait = 500 ; Time to wait before starting ID +unkeywait = 2000 ; Time to wait after unkey before sending CT's and link telemetry +calltermwait = 2000 ; Time to wait before announcing "call terminated" ; ; This is where you define your nodes which cam be connected to. @@ -172,14 +524,13 @@ calltermwait=2000 ; Time to wait before announcing "call t [nodes] ; Note, if you are using automatic update for allstar link nodes, ; no allstar link nodes should be defined here. Only place a definition -; for your locak nodes, and private (off of allstar link) nodes here. - -1999 = radio@127.0.0.1/1999,NONE ; This must be changed to your node number +; for your local nodes, and private (off of allstar link) nodes here. +1999 = radio@127.0.0.1:4569/1999,NONE ; This must be changed to your node number + ; and iax port number if not the default ; Memories for remote bases [memory] - ;00 = 146.580,100.0,m ;01 = 147.030,103.5,m+t ;02 = 147.240,103.5,m+t @@ -193,70 +544,69 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = *32011# ;2 = *12001*12011*12043*12040*12050*12060*12009*12002*12003*12004*1113*12030# ;3 = *32001*32011*32050*32030*32060# -; -; -; Data Ackquisition configuration -; + + +; Data Acquisition configuration + ;[daq-list] -;device=device_name1 -;device=device_name2 -; +;device = device_name1 +;device = device_name2 + ;Where: device_name1 and device_name2 are stanzas you define in this file -; -;device=daq-cham-1 +;device = daq-cham-1 ; Device name ;[daq-cham-1] ; Defined in [daq-list] -;hwtype=uchameleon ; DAQ hardware type -;devnode=/dev/ttyUSB0 ; DAQ device node (if required) -;1=inadc ; Pin definition for an ADC channel -;2=inadc -;3=inadc -;4=inadc -;5=inadc -;6=inadc -;7=inadc -;8=inadc -;9=inp ; Pin definition for an input with a weak pullup resistor -;10=inp -;11=inp -;12=inp -;13=in ; Pin definition for an input without a weak pullup resistor -;14=out ; Pin definition for an output -;15=out -;16=out -;17=out -;18=out +;hwtype = uchameleon ; DAQ hardware type +;devnode = /dev/ttyUSB0 ; DAQ device node (if required) +;1 = inadc ; Pin definition for an ADC channel +;2 = inadc +;3 = inadc +;4 = inadc +;5 = inadc +;6 = inadc +;7 = inadc +;8 = inadc +;9 = inp ; Pin definition for an input with a weak pullup resistor +;10 = inp +;11 = inp +;12 = inp +;13 = in ; Pin definition for an input without a weak pullup resistor +;14 = out ; Pin definition for an output +;15 = out +;16 = out +;17 = out +;18 = out ;[meter-faces] -;face=scale(scalepre,scalediv,scalepost),word/?,... +;face = scale(scalepre,scalediv,scalepost),word/?,... ; ; scalepre = offset to add before dividing with scalediv ; scalediv = full scale/number of whole units (e.g. 256/20 or 12.8 for 20 volts). ; scalepost = offset to add after dividing with scalediv ; -;face=range(X-Y:word,X2-Y2:word,...),word/?,... -;face=bit(low-word,high-word),word/?,... +;face = range(X-Y:word,X2-Y2:word,...),word/?,... +;face = bit(low-word,high-word),word/?,... ; ; word/? is either a word in /var/lib/asterisk/sounds or one of its subdirectories, ; or a question mark which is a placeholder for the measured value. ; ; ; Battery voltage 0-20 volts -;batvolts=scale(0,12.8,0),rpt/thevoltageis,?,ha/volts +;batvolts = scale(0,12.8,0),rpt/thevoltageis,?,ha/volts ; 4 quadrant wind direction -;winddir=range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? +;winddir = range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? ; LM34 temperature sensor with 130 deg. F full scale -;lm34f=scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit +;lm34f = scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit ; Status poll (non alarmed) -;light=bit(ha/off,ha/on),ha/light,? +;light = bit(ha/off,ha/on),ha/light,? ;[alarms] ; -;tag=device,pin,node,ignorefirst,func-low,func-hi +;tag = device,pin,node,ignorefirst,func-low,func-hi ; ;tag = a unique name for the alarm ;device = daq device to poll @@ -268,8 +618,8 @@ calltermwait=2000 ; Time to wait before announcing "call t ; ; a '-' as a function name is shorthand for no-operation ; -;door=daq-cham-1,9,1,2017,*7,- -;pwrfail=daq-cham-1,10,0,2017,*911111,- +;door = daq-cham-1,9,1,2017,*7,- +;pwrfail = daq-cham-1,10,0,2017,*911111,- ; ; Control states ; Allow several control operator functions to be changed at once using one command (good for scheduling) @@ -280,13 +630,12 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = rptena,lnkena,apdis,totdis,ufena,noice ; Net and news operation ;2 = rptena,lnkdis,apdis,totena,ufdis,noice ; Repeater only operation -; ; Scheduler - execute a macro at a given time -; -;[schedule] + +[schedule] ;dtmf_function = m h dom mon dow ; ala cron, star is implied ;2 = 00 00 * * * ; at midnight, execute macro 2. - +#includeifexists custom/rpt.conf diff --git a/configs/simpleusb/simpleusb.conf b/configs/simpleusb/simpleusb.conf index 5d10d965..713ece52 100644 --- a/configs/simpleusb/simpleusb.conf +++ b/configs/simpleusb/simpleusb.conf @@ -1,41 +1,63 @@ -; ; SimpleUSB configuration -; + [general] -[usb] +[usb_1999] -eeprom=0 +eeprom = 0 ; EEPROM installed: 0,1 + ; 0 = no (default) + ; 1 = yes -hdwtype=0 ; Leave this set to 0 for USB sound fobs modified using +hdwtype = 0 ; Leave this set to 0 for USB sound fobs modified using ; the instructions from usbfob.pdf. Use a setting of ; 1 is for Dingotel/Sph interfaces. - -rxboost=1 ; 0 = 20db attenuator inserted, 1= 20db attenuator removed - ; Set to 1 for additonal gain if using a low-level receiver output -carrierfrom=usbinvert ; no,usb,usbinvert - ; no - no carrier detection at all - ; usb - from the COR line on the modified USB sound fob - ; usbinvert - from the inverted COR line on the modified USB sound fob +; Receiver parameters + +rxboost = 0 ; 0 = 20db attenuator inserted, 1= 20db attenuator removed + ; Set to 1 for additonal gain if using a low-level receiver output + +carrierfrom = usbinvert ; no,usb,usbinvert + ; no - no carrier detection at all + ; usb - from the COR line on the USB sound fob (Active high) + ; usbinvert - from the inverted COR line on the USB sound fob (Active low) + +ctcssfrom = usbinvert ; no,usb,usbinvert + ; no - CTCSS decoding, system will be carrier squelch + ; usb - CTCSS decoding using input from USB sound fob (Active high) + ; usbinvert - from the inverted CTCSS line on the USB sound fob (Active low) + +deemphasis = no ; enable de-emphasis (input from discriminator) + +plfilter = no ; enable PL filter + +;rxondelay = 0 ; number of 20ms intervals to hold off receiver turn-on indication + + +; Transmitter parameters + +txmixa = voice ; Left channel output (A): no,voice + ; no - Do not output anything + ; voice - output voice only + +txmixb = no ; Right channel output (B): no,voice + ; no - Do not output anything + ; voice - output voice only -ctcssfrom=usbinvert ; no,usb,usbinvert - ; no - CTCSS decoding, system will be carrier squelch - ; usb - CTCSS decoding using input from USB FOB - ; usbinvert - from the inverted CTCSS line on the modified USB sound fob +txboost = 0 -txmixa=voice ; Left channel output: no,voice,tone,composite,auxvoice - ; no - Do not output anything - ; voice - output voice only +invertptt = 0 ; Invert PTT: 0,1 + ; 0 - ground to transmit + ; 1 - open to transmit -txmixb=no ; Right channel output: no,voice,tone,composite, auxvoice - ; See txmixa above. +preemphasis = 0 ; Perform standard 6db/octave pre-emphasis -invertptt=0 ; Invert PTT 0 = ground to transmit, 1 = open to transmit - ; This is the collector lead of the 2n4401 on the modified - ; usb sound fob. - ; please refer to the howto for the procedure to do this. +; pager = no ; no,a,b (e.g. pager = b means "put the normal repeat audio on channel A, and the pager audio on channel B") -duplex=1 ; Full Duplex +; duplex3 = 0 ; duplex 3 gain setting (0 to disable) +duplex = 0 ; Duplex 0,1 + ; 0 - half duplex + ; 1 - full duplex +#includeifexists custom/simpleusb.conf diff --git a/configs/simpleusb/zapata.conf b/configs/simpleusb/zapata.conf deleted file mode 100644 index b8897e86..00000000 --- a/configs/simpleusb/zapata.conf +++ /dev/null @@ -1,13 +0,0 @@ -; -; zapata.conf for systems with usbradio fobs -; - -[channels] -signalling=em_txrx -group=9 -channel=pseudo - -; -; End of file -; - diff --git a/configs/simpleusb/zaptel.conf b/configs/simpleusb/zaptel.conf deleted file mode 100644 index c940c858..00000000 --- a/configs/simpleusb/zaptel.conf +++ /dev/null @@ -1,8 +0,0 @@ -# -# zaptel.conf -# -loadzone = us -defaultzone=us -# -# End of file -# diff --git a/configs/sip.conf b/configs/sip.conf index fede11fb..e6efbf81 100644 --- a/configs/sip.conf +++ b/configs/sip.conf @@ -2,11 +2,11 @@ ; SIP Configuration example for Asterisk ; [general] -context=default ; Default context for incoming calls -allowoverlap=no ; Disable overlap dialing support. (Default is yes) -bindport=5060 ; UDP Port to bind to (SIP standard port is 5060) -bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all) -srvlookup=yes ; Enable DNS SRV lookups on outbound calls +context = default ; Default context for incoming calls +allowoverlap = no ; Disable overlap dialing support. (Default is yes) +bindport = 5060 ; UDP Port to bind to (SIP standard port is 5060) +bindaddr = 127.0.0.1 ; IP address to bind to (0.0.0.0 binds to all) +srvlookup = yes ; Enable DNS SRV lookups on outbound calls ; Note: Asterisk only uses the first host ; in SRV records ; Disabling DNS SRV lookups disables the diff --git a/configs/usbradio/modules.conf b/configs/usbradio/modules.conf index 4e23dd41..49e75fd3 100644 --- a/configs/usbradio/modules.conf +++ b/configs/usbradio/modules.conf @@ -3,11 +3,214 @@ ; ; Module Loader configuration file ; +; By default DIAL does NOT load every module, only what is needed + +; You can enable or disable any of the asterisk modules +; All modules are compiled and installed. + +; To enable a module: load => module_name.so +; To disable a module: noload => module_name.so + +; You will want to enable the channel driver modules you will be using. +; There are below in the Channel Driver section +; The most common Channel drivers for app_rpt are: +; chan_echolink.so echolink channel driver +; chan_simpleusb.so Simple USB Radio Interface Channel Drive +; chan_usbradio.so USB Console Channel Driver +; chan_usrp.so USRP Channel Module +; chan_voter.so radio Voter channel driver [modules] -autoload=yes -noload=chan_oss.so -noload=chan_alsa.so -noload=chan_phone.so + +autoload=no + +; Applications + +noload => app_adsiprog.so ; Asterisk ADSI Programming Application +noload => app_alarmreceiver.so ; Alarm Receiver for Asterisk +noload => app_amd.so ; Answering Machine Detection Application +load => app_authenticate.so ; Authentication Application +noload => app_cdr.so ; Tell Asterisk to not maintain a CDR for +noload => app_chanisavail.so ; Check channel availability +noload => app_channelredirect.so ; Channel Redirect +noload => app_chanspy.so ; Listen to the audio of an active channel +noload => app_controlplayback.so ; Control Playback Application +noload => app_dahdibarge.so ; Barge in on channel application +noload => app_dahdiras.so ; DAHDI RAS Application +noload => app_dahdiscan.so ; Scan Zap channels application +noload => app_db.so ; Database Access Functions +load => app_dial.so ; Dialing Application +noload => app_dictate.so ; Virtual Dictation Machine +noload => app_directed_pickup.so ; Directed Call Pickup Application +noload => app_directory.so ; Extension Directory +noload => app_disa.so ; DISA (Direct Inward System Access) Appli +noload => app_dumpchan.so ; Dump Info About The Calling Channel +noload => app_echo.so ; Simple Echo Application +load => app_exec.so ; Executes dialplan applications +noload => app_externalivr.so ; External IVR Interface Application +noload => app_festival.so ; Simple Festival Interface +noload => app_flash.so ; Flash channel application +noload => app_followme.so ; Find-Me/Follow-Me Application +noload => app_forkcdr.so ; Fork The CDR into 2 separate entities +noload => app_getcpeid.so ; Get ADSI CPE ID +noload => app_gps.so ; GPS interface module +noload => app_hasnewvoicemail.so ; Indicator for whether a voice mailbox ha +noload => app_ices.so ; Encode and Stream via icecast and ices +noload => app_image.so ; Image Transmission Application +noload => app_lookupblacklist.so ; Look up Caller*ID name/number from black +noload => app_lookupcidname.so ; Look up CallerID Name from local databas +load => app_macro.so ; Extension Macros +noload => app_meetme.so ; MeetMe conference bridge +noload => app_milliwatt.so ; Digital Milliwatt (mu-law) Test Applicat +noload => app_mixmonitor.so ; Mixed Audio Monitoring Application +noload => app_morsecode.so ; Morse code +noload => app_mp3.so ; Silly MP3 Application +noload => app_nbscat.so ; Silly NBS Stream Application +noload => app_page.so ; Page Multiple Phones +noload => app_parkandannounce.so ; Call Parking and Announce Application +load => app_playback.so ; Sound File Playback Application +noload => app_privacy.so ; Require phone number to be entered, if n +noload => app_queue.so ; True Call Queueing +noload => app_radbridge.so ; Radio Bridging interface module +noload => app_random.so ; Random goto +noload => app_readfile.so ; Stores output of file into a variable +noload => app_read.so ; Read Variable Application +noload => app_realtime.so ; Realtime Data Lookup/Rewrite +noload => app_record.so ; Trivial Record Application +load => app_rpt.so ; Radio Repeater/Remote Base Application +noload => app_sayunixtime.so ; Say time +noload => app_senddtmf.so ; Send DTMF digits Application +load => app_sendtext.so ; Send Text Applications +noload => app_setcallerid.so ; Set CallerID Application +noload => app_setcdruserfield.so ; CDR user field apps +noload => app_settransfercapability.so ; Set ISDN Transfer Capability +noload => app_sms.so ; SMS/PSTN handler +noload => app_softhangup.so ; Hangs up the requested channel +noload => app_speech_utils.so ; Dialplan Speech Applications +noload => app_stack.so ; Stack Routines +load => app_system.so ; Generic System() application +noload => app_talkdetect.so ; Playback with Talk Detection +noload => app_test.so ; Interface Test Application +load => app_transfer.so ; Transfer +noload => app_url.so ; Send URL Applications +noload => app_userevent.so ; Custom User Event Application +noload => app_verbose.so ; Send verbose output +noload => app_voicemail.so ; Comedian Mail (Voicemail System) +noload => app_waitforring.so ; Waits until first ring after time +noload => app_waitforsilence.so ; Wait For Silence +noload => app_while.so ; While Loops and Conditional Execution +noload => app_zapateller.so ; Block Telemarketers with Special Informa + +; CDR + +noload => cdr_csv.so ; Comma Separated Values CDR Backend +noload => cdr_custom.so ; Customizable Comma Separated Values CDR +noload => cdr_manager.so ; Asterisk Manager Interface CDR Backend + +; Channels + +noload => chan_agent.so ; Agent Proxy Channel +noload => chan_alsa.so ; ALSA Console Channel Driver +noload => chan_beagle.so ; Beagleboard Radio Interface Channel Driver +load => chan_dahdi.so ; DAHDI Telephony +noload => chan_echolink.so ; echolink Channel Driver +noload => chan_features.so ; Feature Proxy Channel +noload => chan_gtalk.so ; Gtalk Channel Driver +load => chan_iax2.so ; Inter Asterisk eXchange (Ver 2) +load => chan_local.so ; Local Proxy Channel (Note: used internal +noload => chan_oss.so ; Channel driver for OSS sound cards +noload => chan_phone.so ; Generic Linux Telephony Interface driver +noload => chan_pi.so ; DMK Engineering "PITA" Board on Rpi2/3 Channel Driver +noload => chan_simpleusb.so ; CM1xx USB Cards with Radio Interface Channel Driver (No DSP) +noload => chan_sip.so ; Session Initiation Protocol (SIP) +noload => chan_tlb.so ; TheLinkBox Channel Driver +load => chan_usbradio.so ; CM1xx USB Cards with Radio Interface Channel Driver (DSP) +noload => chan_usrp.so ; GNU Radio interface USRP Channel Driver +noload => chan_voter.so ; Radio Voter Channel Driver + +; Codecs + +; CODEC AUDIO QUALITY BANDWIDTH (including IP and Ethernet headers) +; ULAW best 87 kilobits per second (kbps) +; ADPCM good 55 kbps +; GSM mediocre 36 kbps +; g726aal2 +; ilbc + +load => codec_adpcm.so ; Adaptive Differential PCM Coder/Decoder +load => codec_alaw.so ; A-law Coder/Decoder +load => codec_a_mu.so ; A-law and Mulaw direct Coder/Decoder +noload => codec_dahdi.so ; Generic DAHDI Transcoder Codec Translato +load => codec_g726.so ; ITU G.726-32kbps G726 Transcoder +load => codec_gsm.so ; GSM Coder/Decoder +load => codec_ulaw.so ; mu-Law Coder/Decoder +noload => codec_ilbc.so ; http://en.wikipedia.org/wiki/Internet_Low_Bitrate_Codec + +; Formats + +load => format_g723.so ; G.723.1 Simple Timestamp File Format +load => format_g726.so ; Raw G.726 (16/24/32/40kbps) data +load => format_g729.so ; Raw G729 data +load => format_gsm.so ; Raw GSM data +load => format_h263.so ; Raw H.263 data +load => format_h264.so ; Raw H.264 data +load => format_ilbc.so ; Raw iLBC data +noload => format_jpeg.so ; JPEG (Joint Picture Experts Group) Image +load => format_pcm.so ; Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. +load => format_sln.so ; Raw Signed Linear Audio support (SLN) +load => format_vox.so ; Dialogic VOX (ADPCM) File Format +load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) +load => format_wav.so ; Microsoft WAV format (8000Hz Signed Line + +; Functions + +load => func_base64.so ; base64 encode/decode dialplan functions +load => func_callerid.so ; Caller ID related dialplan function +load => func_cdr.so ; CDR dialplan function +load => func_channel.so ; Channel information dialplan function +load => func_curl.so ; Load external URL +load => func_cut.so ; Cut out information from a string +load => func_db.so ; Database (astdb) related dialplan functi +load => func_enum.so ; ENUM related dialplan functions +load => func_env.so ; Environment/filesystem dialplan function +load => func_global.so ; Global variable dialplan functions +load => func_groupcount.so ; Channel group dialplan functions +load => func_language.so ; Channel language dialplan function +load => func_logic.so ; Logical dialplan functions +load => func_math.so ; Mathematical dialplan function +load => func_md5.so ; MD5 digest dialplan functions +load => func_moh.so ; Music-on-hold dialplan function +load => func_rand.so ; Random number dialplan function +load => func_realtime.so ; Read/Write values from a RealTime reposi +noload => func_sha1.so ; SHA-1 computation dialplan function +noload => func_strings.so ; String handling dialplan functions +noload => func_timeout.so ; Channel timeout dialplan functions +noload => func_uri.so ; URI encode/decode dialplan functions + +; PBX + +noload => pbx_ael.so ; Asterisk Extension Language Compiler +load => pbx_config.so ; Text Extension Configuration +noload => pbx_dundi.so ; Distributed Universal Number Discovery ( +noload => pbx_loopback.so ; Loopback Switch +noload => pbx_realtime.so ; Realtime Switch +noload => pbx_spool.so ; Outgoing Spool Support + +; Resources + +load => res_adsi.so ; ADSI Resource +noload => res_agi.so ; Asterisk Gateway Interface (AGI) +noload => res_clioriginate.so ; Call origination from the CLI +noload => res_convert.so ; File format conversion CLI command +load => res_crypto.so ; Cryptographic Digital Signatures +load => res_features.so ; Call Features Resource +load => res_indications.so ; Indications Resource +noload => res_jabber.so ; AJI - Asterisk Jabber Interface +noload => res_monitor.so ; Call Monitoring Resource +noload => res_musiconhold.so ; Music On Hold Resource +noload => res_smdi.so ; Simplified Message Desk Interface (SMDI) +noload => res_snmp.so ; SNMP [Sub]Agent for Asterisk +noload => res_speech.so ; Generic Speech Recognition API [global] + diff --git a/configs/usbradio/rpt.conf b/configs/usbradio/rpt.conf index d7ad6e63..de8ac5c7 100644 --- a/configs/usbradio/rpt.conf +++ b/configs/usbradio/rpt.conf @@ -1,106 +1,444 @@ ; Radio Repeater configuration file (for use with app_rpt) -; -; ; Your Repeater -; + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; [1999] ; Change this to your assigned node number -rxchannel = Radio/usb ; Rx audio/signalling channel -erxgain=-3 ; Echolink receive gain adjustment + ; Must also be enabled in modules.conf + ; Rx audio/signalling channel. Choose ONLY 1 per node stanza + + ; Enable the selected channel driver in modules.conf !!! +; rxchannel = dahdi/pseudo ; No radio (hub) +; rxchannel = SimpleUSB/usb_1999 ; SimpleUSB +; rxchannel = Pi/1 ; Raspberry Pi PiTA +rxchannel = Radio/usb_1999 ; USBRadio (DSP) +; rxchannel = Dahdi/1 ; PCI Quad card +; rxchannel = Beagle/1 ; BeagleBoard +; rxchannel = USRP/127.0.0.1:34001:32001; GNU Radio interface USRP + +duplex = 1 ; 0 = Half duplex with no telemetry tones or hang time. + ; Special Case: Full duplex if linktolink is set to yes. + ; This mode is preferred when interfacing with an external multiport repeater controller. + ; Comment out idrecording and idtalkover to suppress IDs also + ; 1 = Half duplex with telemetry tones and hang time. Does not repeat audio. + ; This mode is preferred when interfacing a simplex node. + ; 2 = Full Duplex with telemetry tones and hang time. + ; This mode is preferred when interfacing a repeater. + ; 3 = Full Duplex with telemetry tones and hang time, but no repeated audio. + ; 4 = Full Duplex with telemetry tones and hang time. Repeated audio only when the autopatch is down. + +linktolink = no ; disables forcing physical half-duplex operation of main repeater while + ; still keeping half-duplex semantics (optional) + +linkmongain = 0 ; Link Monitor Gain adjusts the audio level of monitored nodes when a signal from another node or the local receiver is received. + ; If linkmongain is set to a negative number the monitored audio will decrease by the set amount in db. + ; If linkmongain set to a positive number monitored audio will increase by the set amount in db. + ; The value of linkmongain is in db. The default value is 0 db. + +erxgain = -3 ; Echolink receive gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -etxgain=3 ; Echolink transmit gain adjustment +etxgain = 3 ; Echolink transmit gain adjustment ; Note: Gain is in db-volts (20logVI/VO) -;controlstates=controlstates ; system control state list -;scheduler=schedule; ; scheduler entries -functions=functions ; Repeater Function Table -phone_functions=functions ; Repeater Function Table -link_functions=functions ; Link Function Table -telemetry=telemetry ; Telemetry descriptions -wait_times=wait-times ; Wait times -context = radio ; dialing context for phone -callerid = "Repeater" <0000000000> ; callerid for phone calls -idrecording = |iid ; id recording or morse string -accountcode=RADIO ; account code (optional) -hangtime=1000 ; squelch tail hang time (in ms) (optional) -althangtime=4000 ; longer squelch tail -totime=170000 ; transmit time-out time (in ms) (optional) -idtime=540000 ; id interval time (in ms) (optional) -; The default values for hangtime, time-out time, and id interval time are -; 5 seconds (5000 ms), 3 minutes (180000 ms), and 5 minutes (300000 ms) -; respectively - -politeid=30000 ; time in milliseconds before ID timer - - ; expires to try and ID in the tail. - ; (optional, default is 30000). -idtalkover=|iid ; Talkover ID (optional) default is none -unlinkedct=ct2 ; unlinked courtesy tone (optional) default is none -remotect=ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) -linkunkeyct=ct8 ; sent when a transmission received over the link unkeys -;nolocallinkct=0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). -;eannmode=1 ; Default: 1 = Say only node number on echolink connects - ; 2 = say phonetic call sign only on echolink connects - ; 3 = say phonetic call sign and node number on echolink connects -;connpgm=yourconnectprogram ; Default: Disabled. Execute a program you specify on connect. +;eannmode = 1 ; 1 = Say only node number on echolink connects (default = 1) + ; 2 = say phonetic call sign only on echolink connects + ; 3 = say phonetic call sign and node number on echolink connects + +;controlstates = controlstates ; system control state stanza + +scheduler = schedule ; scheduler stanza +functions = functions ; Repeater Function stanza +phone_functions = functions ; Phone Function stanza +link_functions = functions ; Link Function stanza + +telemetry = telemetry ; Telemetry stanza +morse = morse ; Morse stanza +wait_times = wait-times ; Wait times stanza + +context = radio ; dialing context for phone +callerid = "Repeater" <0000000000> ; callerid for phone calls +accountcode = RADIO ; account code (optional) + +hangtime = 5000 ; squelch tail hang time (in ms) (optional, default 5 seconds, 5000 ms) +althangtime = 4000 ; longer squelch tail +totime = 180000 ; transmit time-out time (in ms) (optional, default 3 minutes 180000 ms) + +idrecording = |iWA4XYZ ; cording or morse string see http://ohnosec.org/drupal/node/87 +idtalkover = |iWA4XYZ ; Talkover ID (optional) default is none see http://ohnosec.org/drupal/node/129 + ; See Telemetry section Example: idrecording = rpt/nodenames/1999 +idtime = 540000 ; id interval time (in ms) (optional) Default 5 minutes (300000 ms) +politeid = 30000 ; time in milliseconds before ID timer expires to try and ID in the tail. (optional, default 30000) + +unlinkedct = ct2 ; Send a this courtesy tone when the user unkeys if the node is not connected to any other nodes. (optional, default is none) +remotect = ct3 ; remote linked courtesy tone (indicates a remote is in the list of links) +linkunkeyct = ct8 ; sent when a transmission received over the link unkeys +;nolocallinkct = 0 ; Send unlinkedct instead if another local node is connected to this node (hosted on the same PC). + +;connpgm = yourconnectprogram ; Disabled. Execute a program you specify on connect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being connected to us (them) -;discpgm=yourdisconnectprogram ; Default: Disabled. Execute a program you specify on disconnect. +;discpgm = yourdisconnectprogram ; Disabled. Execute a program you specify on disconnect. (default) ; passes 2 command line arguments to your program: ; 1. node number in this stanza (us) ; 2. node number being disconnected from us (them) -;lnkactenable=0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. -;lnkacttime=1800 ; Link activity timer time in seconds. -;lnkactmacro=*52 ; Function to execute when link activity timer expires. -;lnkacttimerwarn=30seconds ; Message to play when the link activity timer has 30 seconds left. -;remote_inact_timeout=1800 ; Inactivity timer for remote base nodes only (set to 0 to disable). -;remote_timeout=3600 ; Session time out for remote base. (set to 0 to disable) -;nounkeyct=0 ; Set to a 1 to eliminate courtesy tones and associated delays. -;holdofftelem=0 ; Hold off all telemetry when signal is present on receiver or from connected nodes -; ; except when an ID needs to be done and there is a signal coming from a connected node. -;beaconing=0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) -; -; + +;lnkactenable = 0 ; Set to 1 to enable the link activity timer. Applicable to standard nodes only. + +;lnkacttime = 1800 ; Link activity timer time in seconds. +;lnkactmacro = *52 ; Function to execute when link activity timer expires. +;lnkacttimerwarn = 30seconds ; Message to play when the link activity timer has 30 seconds left. + +;remote_inact_timeout = ; Specifies the amount of time without keying from the link. Set to 0 to disable timeout. (15 * 60) +;remote_timeout = ; Session time out for remote base. Set to 0 to disable. (60 * 60) +;remote_timeout_warning_freq = ; 30 +;remote_timeout_warning = ; (3 * 60) + +;nounkeyct = 0 ; Set to a 1 to eliminate courtesy tones and associated delays. + +holdofftelem = 0 ; Hold off all telemetry when signal is present on receiver or from connected nodes + ; except when an ID needs to be done and there is a signal coming from a connected node. + +telemdefault = 1 ; 0 = telemetry output off + ; 1 = telemetry output on (default = 1) + ; 2 = timed telemetry output on command execution and for a short time thereafter. + +telemdynamic = 1 ; 0 = disallow users to change the local telemetry setting with a COP command, + ; 1 = Allow users to change the setting with a COP command. (default = 1) + +;beaconing = 0 ; Send ID regardless of repeater activity (Required in the UK, but probably illegal in the US) + +parrotmode = 0 ; 0 = Parrot Off (default = 0) + ; 1 = Parrot On Command + ; 2 = Parrot Always + ; 3 = Parrot Once by Command + +parrottime = 1000 ; Set the amount of time in milliseconds + ; to wait before parroting what was received + +;rxnotch=1065,40 ; (Optional) Notch a particular frequency for a specified + ; b/w. app_rpt must have been compiled with + ; the notch option + +startup_macro = + +; nodenames = /var/lib/asterisk/sounds/rpt/nodenames.callsign ; Point to alternate nodename sound directory + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Need more information on these + +;extnodes = extnodes-different ; section in extnodefile containing dynamic node information (optional) +;extnodefile = /foo/nodes ; Points to nodelist file containing dynamic node info default = /var/lib/asterisk/rpt_extnodes (optional) +;extnodefile2 = ; Is this a list of node files? Possible a list of private nodes or a list of static IPs for known nodes???? +;nodenames = /foo/names ; locaton of node sound files default = /var/lib/asterisk/sounds/rpt/nodenames +;archivedir = /tmp ; defines and enables activity recording into specified directory (optional) +;monminblocks = 2048 ; Min 1K blocks to be left on partition (will not save monitor output if disk too full) + +; ; The tailmessagetime,tailsquashedtime, and tailmessagelist need to be set +; ; to support tail messages. They can be omitted otherwise. +;tailmessagetime = 300000 ; Play a tail message every 5 mins +;tailsquashedtime = 30000 ; If squashed by another user, +; ; try again after 30 seconds +;tailmessagelist = msg1,msg2 ; list of messages to be played for tail message + +; alt_functions +; ctgroup +; dphone_functions +; idtime +; iobase +; iospeed +; locallist +; mars Remote Base +; memory +; nobusyout +; nodes +; nolocallinkct +; notelemtx +; outxlat +; parrot +; propagate_phonedtmf +; rptnode +; rptinactmacro Macro to execute when inactivity timer expires +; rptinacttime Inactivity timer time in seconds (0 seconds disables feature) +; rxnotch Optional Audio notch +; simplexphonedelay +; tonemacro +; tonezone +; txlimits + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + ; *** Status Reporting *** -; -; Uncomment the either group following two statpost lines to report the status of your node to stats.allstarlink.org -; depending on whether you are running ACID or Limey Linux. -; ** For ACID *** -;statpost_program=/usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +; Uncomment either group following two statpost lines to report the status of your node to stats.allstarlink.org +; depending on whether you are running ACID, Debian or Limey Linux. +; The difference is simply where your wget is located. + +; ** For ACID and Debian *** +;statpost_program = /usr/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates ; ** For Limey Linux ** -;statpost_program=/bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null -;statpost_url=http://stats.allstarlink.org/uhandler.php ; Status updates +;statpost_program = /bin/wget,-q,--timeout=15,--tries=1,--output-document=/dev/null +;statpost_url = http://stats.allstarlink.org/uhandler.php ; Status updates +[functions] +; Prefix Functions +; *1 Disconnect Link +; *2 Monitor Link +; *3 Connect Link +; *4 Command Mode +; *5 Macros +; *6 User Functions +; *7 Connection Status/Functions +; *8 User Functions +; *9 User Functions +; *0 User Functions + +; *A User Functions +; *B User Functions +; *C User Functions +; *D User Functions + + +; Mandatory Command Codes +; http://docs.allstarlink.org/drupal/node/91 + +1 = ilink,1 ; Disconnect specified link +2 = ilink,2 ; Connect specified link -- monitor only +3 = ilink,3 ; Connect specified link -- tranceive +4 = ilink,4 ; Enter command mode on specified link +70 = ilink,5 ; System status +99 = cop,6 ; PTT (phone mode only) + +; End Mandatory Command Codes + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Macro Commands +5 = macro + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Autopatch Commands +; Note, This may be a good place for other 2 digit frequently used commands + +61 = autopatchup,noct = 1,farenddisconnect = 1,dialtime = 20000 ; Autopatch up +62 = autopatchdn ; Autopatch down + +; autopatchup can optionally take comma delimited setting=value pairs: + +; context = string ; Override default context with "string" +; dialtime = ms ; Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) +; farenddisconnect = 1 ; Automatically disconnect when called party hangs up +; noct = 1 ; Don't send repeater courtesy tone during autopatch calls +; quiet = 1 ; Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up + ; Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1 + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Status Commands + +; 1 - Force ID (global) +; 2 - Give Time of Day (global) +; 3 - Give software Version (global) +; 4 - Give GPS location info +; 5 - Last (dtmf) user +; 11 - Force ID (local only) +; 12 - Give Time of Day (local only) + +721 = status,1 ; Force ID (global) +722 = status,2 ; Give Time of Day (global) +723 = status,3 ; Give software Version (global) +724 = status,4 ; Give GPS location info +725 = status,5 ; Last (dtmf) user +711 = status,11 ; Force ID (local only) +712 = status,12 ; Give Time of Day (local only) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Link Commands + +; 1 - Disconnect specified link +; 2 - Connect specified link -- monitor only +; 3 - Connect specified link -- tranceive +; 4 - Enter command mode on specified link +; 5 - System status +; 6 - Disconnect all links +; 7 - Last Node to Key Up +; 8 - Connect specified link -- local monitor only +; 9 - Send Text Message (9,,Message Text, etc. +; 10 - Disconnect all RANGER links (except permalinks) +; 11 - Disconnect a previously permanently connected link +; 12 - Permanently connect specified link -- monitor only +; 13 - Permanently connect specified link -- tranceive +; 15 - Full system status (all nodes) +; 16 - Reconnect links disconnected with "disconnect all links" +; 17 - MDC test (for diag purposes) +; 18 - Permanently Connect specified link -- local monitor only + +; ilink commands 1 through 5 are defined in the Mandatory Command section + +806 = ilink,6 ; Disconnect all links +807 = ilink,7 ; Last Node to Key Up +808 = ilink,8 ; Connect specified link -- local monitor only +809 = ilink,9,1999,"Testing" ; would send a text message to node 1999 replace 1999 with 0 for all connected nodes +810 = ilink,10 ; Disconnect all RANGER links (except permalinks) +811 = ilink,11 ; Disconnect a previously permanently connected link +812 = ilink,12 ; Permanently connect specified link -- monitor only +813 = ilink,13 ; Permanently connect specified link -- tranceive +815 = ilink,15 ; Full system status (all nodes) +816 = ilink,16 ; Reconnect links disconnected with "disconnect all links" +817 = ilink,17 ; MDC test (for diag purposes) +818 = ilink 18 ; Permanently Connect specified link -- local monitor only + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Control operator (cop) functions. Change these to something other than these codes listed below! + +901 = cop,1 ; System warm boot +902 = cop,2 ; System enable +903 = cop,3 ; System disable + +904 = cop,4 ; Test tone on/off (toggle) +905 = cop,5 ; Dump system variables on console (debug use only) + +907 = cop,7 ; Time out timer enable +908 = cop,8 ; Time out timer disable + +909 = cop,9 ; Autopatch enable +910 = cop,10 ; Autopatch disable + +911 = cop,11 ; User linking functions enable +912 = cop,12 ; User linking functions disable + +913 = cop,13 ; Query system control state +914 = cop,14 ; Set system control state + +915 = cop,15 ; Scheduler enable +916 = cop,16 ; Scheduler disable + +917 = cop,17 ; User functions enable (time, id, etc) +918 = cop,18 ; User functions disable + +919 = cop,19 ; Select alternate hang time (althangtime) +920 = cop,20 ; Select standard hangtime (hangtime) + +921 = cop,21 ; Enable Parrot Mode +922 = cop,22 ; Disable Parrot Mode +923 = cop,23 ; Birdbath (Current Parrot Cleanup/Flush) + +924 = cop,24 ; Flush all telemetry +925 = cop,25 ; Query last node un-keyed +926 = cop,26 ; Query all nodes keyed/unkeyed +927 = cop,27 ; Reset DAQ minimum on a pin +928 = cop,28 ; Reset DAQ maximum on a pin + +930 = cop,30 ; Recall Memory Setting in Attached Xcvr + +931 = cop,31 ; Channel Selector for Parallel Programmed Xcvr + +932 = cop,32 ; Touchtone pad test: command + Digit string + # to playback all digits pressed + +933 = cop,33 ; Local Telemetry Output Enable +934 = cop,34 ; Local Telemetry Output Disable +935 = cop,35 ; Local Telemetry Output on Demand + +936 = cop,36 ; Foreign Link Local Output Path Enable +937 = cop,37 ; Foreign Link Local Output Path Disable +938 = cop,38 ; Foreign Link Local Output Path Follows Local Telemetry +939 = cop,39 ; Foreign Link Local Output Path on Demand + +942 = cop,42 ; Echolink announce node # only +943 = cop,43 ; Echolink announce node Callsign only +944 = cop,44 ; Echolink announce node # & Callsign + +945 = cop,45 ; Link Activity timer enable +945 = cop,46 ; Link Activity timer disable +947 = cop,47 ; Reset "Link Config Changed" Flag + +948 = cop,48 ; Send Page Tone (Tone specs separated by parenthesis) + +949 = cop,49 ; Disable incoming connections (control state noice) +950 = cop,50 ; Enable incoming connections (control state noicd) + +951 = cop,51 ; Enable sleep mode +952 = cop,52 ; Disable sleep mode +953 = cop,53 ; Wake up from sleep +954 = cop,54 ; Go to sleep +955 = cop,55 ; Parrot Once if parrot mode is disabled + +956 = cop,56 ; Rx CTCSS Enable +957 = cop,57 ; Rx CTCSS Disable + +958 = cop.58 ; Tx CTCSS On Input only Enable +959 = cop,59 ; Tx CTCSS On Input only Disable + +960 = cop,60 ; Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) + ; Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + ; (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. + ; DestID and subcode are only specified for the 'C' type message. + ; UnitID is the local systems UnitID. DestID is the MDC1200 ID of + ; the radio being called, and the subcodes are as follows: + ; Subcode '8205' is Voice Selective Call for Spectra ('Call') + ; Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or + ; Astro-Saber('Call') + ; Subcode '810D' is Call Alert (like Maxtrac 'CA') + +961 = cop,61 ; Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) +962 = cop,62 ; Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) + +963 = cop,63 ; Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) +964 = cop,64 ; Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) +965 = cop,65 ; Send POCSAG page (equipped channel types only) + +[functions-remote] + +0 = remote,1 ; Retrieve Memory +1 = remote,2 ; Set freq. +2 = remote,3 ; Set tx PL tone +3 = remote,4 ; Set rx PL tone +40 = remote,100 ; Rx PL off +41 = remote,101 ; Rx PL on +42 = remote,102 ; Tx PL off +43 = remote,103 ; Tx PL on +44 = remote,104 ; Low Power +45 = remote,105 ; Medium Power +46 = remote,106 ; High Power +711 = remote,107 ; Bump -20 +714 = remote,108 ; Bump -100 +717 = remote,109 ; Bump -500 +713 = remote,110 ; Bump +20 +716 = remote,111 ; Bump +100 +719 = remote,112 ; Bump +500 +721 = remote,113 ; Scan - slow +724 = remote,114 ; Scan - quick +727 = remote,115 ; Scan - fast +723 = remote,116 ; Scan + slow +726 = remote,117 ; Scan + quick +729 = remote,118 ; Scan + fast +79 = remote,119 ; Tune +51 = remote,5 ; Long status query +52 = remote,140 ; Short status query +67 = remote,210 ; Send a * +69 = remote,211 ; Send a # +;91 = remote,99,CALLSIGN,LICENSETAG ; Remote base login. + ; Define a different dtmf sequence for each user which is + ; authorized to use the remote base to control access to it. + ; For examble 9139583=remote,99,WB6NIL,G would grant access to + ; the remote base and announce WB6NIL as being logged in. + ; Another entry, 9148351=remote,99,WA6ZFT,E would grant access to + ; the remote base and announce WA6ZFT as being logged in. + ; When the remote base is disconnected from the originating node, the + ; user will be logged out. The LICENSETAG argument is used to enforce + ; tx frequency limits. See [txlimits] below. +85 = cop,6 ; Remote base telephone key -[functions] -1=ilink,1 -2=ilink,2 -3=ilink,3 -4=ilink,4 -5=macro,1 -70=ilink,5 -71=ilink,6 -72=ilink,7 -73=ilink,15 -74=ilink,16 -75=ilink,8 - -80=status,1 -81=status,2 - -6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 ; Autopatch up -0=autopatchdn ; Autopatch down - -989=cop,4 -980=status,3 -99=cop,6 [telemetry] @@ -124,35 +462,49 @@ linkunkeyct=ct8 ; sent when a transmission received over the link unkeys ; Sends Morse code at the ID amplitude and ID frequency as defined in the ; [morse] section. ; -; Follow with an alphanumeric string - - -ct1=|t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) -ct2=|t(660,880,150,2048) -ct3=|t(440,0,150,4096) -ct4=|t(550,0,150,2048) -ct5=|t(660,0,150,2048) -ct6=|t(880,0,150,2048) -ct7=|t(660,440,150,2048) -ct8=|t(700,1100,150,2048) -remotetx=|t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000); -remotemon=|t(1209,0,50,2048) -cmdmode=|t(900,903,200,2048) -functcomplete=|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) -patchup=rpt/callproceeding -patchdown=rpt/callterminated +; path/to/sound/file/without/extension +; +; Send the sound if in place of a constructed tone. Do not include the file extension +; Example: ct8 = rpt/bloop +; Example: idrecording = rpt/nodenames/1999 + +ct1 = |t(350,0,100,2048)(500,0,100,2048)(660,0,100,2048) +ct2 = |t(660,880,150,2048) +ct3 = |t(440,0,150,4096) +ct4 = |t(550,0,150,2048) +ct5 = |t(660,0,150,2048) +ct6 = |t(880,0,150,2048) +ct7 = |t(660,440,150,2048) +ct8 = |t(700,1100,150,2048) +ranger = |t(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,50,0)(1800,0,60,3072)(0,0,150,0) +remotemon = |t(1209,0,50,2048) ; local courtesy tone when receive only +remotetx = |t(1633,0,50,3000)(0,0,80,0)(1209,0,50,3000) ; local courtesy tone when linked Trancieve mode +cmdmode = |t(900,903,200,2048) +functcomplete = |t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048) +remcomplete = |t(650,0,100,2048)(0,0,100,0)(650,0,100,2048)(0,0,100,0)(650,0,100,2048) +pfxtone = |t(350,440,30000,3072) +patchup = rpt/callproceeding +patchdown = rpt/callterminated + +; As far as what the numbers mean, +; (000,000,010,000) +; | | | |-------amplitude +; | | |-------------duration +; | |-------------------Tone 2 +; |-------------------------Tone 1 + +; So, with 0,0,10,0 That says No Tone1, No Tone2, 10ms duration, 0 Amplitude. +; Use it for a delay. Fine tuning for how long before telemetry is sent, in conjunction with the telemdelay parameter) +; The numbers, like 350,440,10,2048 are 350Hz, 440Hz, 10ms delay, amplitude of 2048. -; ; Morse code parameters, these are common to all repeaters. -; [morse] - -speed=20 ; Approximate speed in WPM -frequency=800 ; Morse Telemetry Frequency -amplitude=4096 ; Morse Telemetry Amplitude -idfrequency=1065 ; Morse ID Frequency -idamplitude=1024 ; Morse ID Amplitude +speed = 20 ; Approximate speed in WPM +frequency = 800 ; Morse Telemetry Frequency +amplitude = 4096 ; Morse Telemetry Amplitude +idfrequency = 1065 ; Morse ID Frequency +idamplitude = 1024 ; Morse ID Amplitude ; ; This section allows wait times for telemetry events to be adjusted @@ -160,10 +512,10 @@ idamplitude=1024 ; Morse ID Amplitude ; [wait-times] -telemwait=2000 ; Time to wait before sending most telemetry -idwait=500 ; Time to wait before starting ID -unkeywait=2000 ; Time to wait after unkey before sending CT's and link telemetry -calltermwait=2000 ; Time to wait before announcing "call terminated" +telemwait = 2000 ; Time to wait before sending most telemetry +idwait = 500 ; Time to wait before starting ID +unkeywait = 2000 ; Time to wait after unkey before sending CT's and link telemetry +calltermwait = 2000 ; Time to wait before announcing "call terminated" ; ; This is where you define your nodes which cam be connected to. @@ -172,14 +524,13 @@ calltermwait=2000 ; Time to wait before announcing "call t [nodes] ; Note, if you are using automatic update for allstar link nodes, ; no allstar link nodes should be defined here. Only place a definition -; for your locak nodes, and private (off of allstar link) nodes here. - -1999 = radio@127.0.0.1/1999,NONE ; This must be changed to your node number +; for your local nodes, and private (off of allstar link) nodes here. +1999 = radio@127.0.0.1:4569/1999,NONE ; This must be changed to your node number + ; and iax port number if not the default ; Memories for remote bases [memory] - ;00 = 146.580,100.0,m ;01 = 147.030,103.5,m+t ;02 = 147.240,103.5,m+t @@ -193,70 +544,69 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = *32011# ;2 = *12001*12011*12043*12040*12050*12060*12009*12002*12003*12004*1113*12030# ;3 = *32001*32011*32050*32030*32060# -; -; -; Data Ackquisition configuration -; + + +; Data Acquisition configuration + ;[daq-list] -;device=device_name1 -;device=device_name2 -; +;device = device_name1 +;device = device_name2 + ;Where: device_name1 and device_name2 are stanzas you define in this file -; -;device=daq-cham-1 +;device = daq-cham-1 ; Device name ;[daq-cham-1] ; Defined in [daq-list] -;hwtype=uchameleon ; DAQ hardware type -;devnode=/dev/ttyUSB0 ; DAQ device node (if required) -;1=inadc ; Pin definition for an ADC channel -;2=inadc -;3=inadc -;4=inadc -;5=inadc -;6=inadc -;7=inadc -;8=inadc -;9=inp ; Pin definition for an input with a weak pullup resistor -;10=inp -;11=inp -;12=inp -;13=in ; Pin definition for an input without a weak pullup resistor -;14=out ; Pin definition for an output -;15=out -;16=out -;17=out -;18=out +;hwtype = uchameleon ; DAQ hardware type +;devnode = /dev/ttyUSB0 ; DAQ device node (if required) +;1 = inadc ; Pin definition for an ADC channel +;2 = inadc +;3 = inadc +;4 = inadc +;5 = inadc +;6 = inadc +;7 = inadc +;8 = inadc +;9 = inp ; Pin definition for an input with a weak pullup resistor +;10 = inp +;11 = inp +;12 = inp +;13 = in ; Pin definition for an input without a weak pullup resistor +;14 = out ; Pin definition for an output +;15 = out +;16 = out +;17 = out +;18 = out ;[meter-faces] -;face=scale(scalepre,scalediv,scalepost),word/?,... +;face = scale(scalepre,scalediv,scalepost),word/?,... ; ; scalepre = offset to add before dividing with scalediv ; scalediv = full scale/number of whole units (e.g. 256/20 or 12.8 for 20 volts). ; scalepost = offset to add after dividing with scalediv ; -;face=range(X-Y:word,X2-Y2:word,...),word/?,... -;face=bit(low-word,high-word),word/?,... +;face = range(X-Y:word,X2-Y2:word,...),word/?,... +;face = bit(low-word,high-word),word/?,... ; ; word/? is either a word in /var/lib/asterisk/sounds or one of its subdirectories, ; or a question mark which is a placeholder for the measured value. ; ; ; Battery voltage 0-20 volts -;batvolts=scale(0,12.8,0),rpt/thevoltageis,?,ha/volts +;batvolts = scale(0,12.8,0),rpt/thevoltageis,?,ha/volts ; 4 quadrant wind direction -;winddir=range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? +;winddir = range(0-33:north,34-96:west,97-160:south,161-224:east,225-255:north),rpt/thewindis,? ; LM34 temperature sensor with 130 deg. F full scale -;lm34f=scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit +;lm34f = scale(0,1.969,0),rpt/thetemperatureis,?,degrees,fahrenheit ; Status poll (non alarmed) -;light=bit(ha/off,ha/on),ha/light,? +;light = bit(ha/off,ha/on),ha/light,? ;[alarms] ; -;tag=device,pin,node,ignorefirst,func-low,func-hi +;tag = device,pin,node,ignorefirst,func-low,func-hi ; ;tag = a unique name for the alarm ;device = daq device to poll @@ -268,8 +618,8 @@ calltermwait=2000 ; Time to wait before announcing "call t ; ; a '-' as a function name is shorthand for no-operation ; -;door=daq-cham-1,9,1,2017,*7,- -;pwrfail=daq-cham-1,10,0,2017,*911111,- +;door = daq-cham-1,9,1,2017,*7,- +;pwrfail = daq-cham-1,10,0,2017,*911111,- ; ; Control states ; Allow several control operator functions to be changed at once using one command (good for scheduling) @@ -280,13 +630,12 @@ calltermwait=2000 ; Time to wait before announcing "call t ;1 = rptena,lnkena,apdis,totdis,ufena,noice ; Net and news operation ;2 = rptena,lnkdis,apdis,totena,ufdis,noice ; Repeater only operation -; ; Scheduler - execute a macro at a given time -; -;[schedule] + +[schedule] ;dtmf_function = m h dom mon dow ; ala cron, star is implied ;2 = 00 00 * * * ; at midnight, execute macro 2. - +#includeifexists custom/rpt.conf diff --git a/configs/usbradio/usbradio.conf b/configs/usbradio/usbradio.conf index ba68e39a..c89ba32c 100644 --- a/configs/usbradio/usbradio.conf +++ b/configs/usbradio/usbradio.conf @@ -4,101 +4,104 @@ [general] -[usb] +[usb_1999] -hdwtype=0 ; Leave this set to 0 for USB sound fobs modified using - ; the instructions from usbfob.pdf. Use a setting of - ; 1 is for Dingotel/Sph interfaces. - -rxboost=1 ; 0 = 20db attenuator inserted, 1= 20db attenuator removed - ; Set to 1 for additonal gain if using a low-level receiver output - -rxctcssrelax=1 ; reduce talkoff from radios w/o CTCSS Tx HPF - ; Do not change this, leave this as a 1 - -txctcssdefault=100.0 ; default tx ctcss freq, any frequency permitted -rxctcssfreqs=100.0 ; rx ctcss freqs in floating point. must be in table -txctcssfreqs=100.0 ; tx ctcss freqs, any frequency permitted -;rxctcssoverride=0 ; Set to 1 or yes to start out in carrier squelch mode - -carrierfrom=dsp ; no,usb,usbinvert,dsp,vox - ; no - no carrier detection at all - ; usb - from the COR line on the modified USB sound fob - ; usbinvert - from the inverted COR line on the modified USB sound fob - ; dsp - from RX noise using dsp techniques - ; vox - voice activated from RX audio - -ctcssfrom=dsp ; no,usb,dsp - ; no - CTCSS decoding, system will be carrier squelch - ; usb - CTCSS decoding using input from USB FOB - ; (currently not supported) - ; dsp - CTCSS decoding using RX audio in DSP. - ; rxdemod option must be set to flat for this to work. - -rxdemod=flat ; input type from radio: no,speaker,flat - ; no - RX audio input not used - ; flat - Use RX audio from discriminator (before de-emphasis) - ; speaker - use de-emphasized audio - -txprelim=yes ; Audio processing on left output channel: no,yes - ; no - Audio is not pre-emphasized and limited. - ; Suitable for use on a microphone input - ; yes - Audio is pre-emphasized and limited. - ; Suitable for direct connection to an FM modulator - -txlimonly=yes ; Audio limiting with no pre-emphasis on output channel: no,yes - ; no - Audio is not limited. - ; yes - Audio is limited. - ; Suitable for transmitters with no limiting but with pre-emphasis. - -txtoctype=notone ; Transmit tone control type: no,phase,notone - ; no - CTCSS tone encoding with no hang time - ; phase - encode CTCSS and reverse phase - ; AKA ("reverse burst") before unkeying TX - ; notone - encode CTCSS and stop sending tone before unkeying TX - ; AKA ("chicken burst") - -txmixa=composite ; Left channel output: no,voice,tone,composite,auxvoice - ; no - Do not output anything - ; voice - output voice only - ; tone - CTCSS tone only - ; composite - voice and tone - ; auxvoice - auxiliary voice output at headphone level for monitoring - -txmixb=no ; Right channel output: no,voice,tone,composite, auxvoice - ; See txmixa above. - -invertptt=0 ; Invert PTT 0 = ground to transmit, 1 = open to transmit - ; This is the collector lead of the 2n4401 on the modified - ; usb sound fob. - ; please refer to the howto for the procedure to do this. - -duplex=1 ; Full Duplex - -;rxondelay=20 ; Uncomment and/or adjust for simplex nodes to eliminate "Ping Ponging" - ; or "Relay Racing". - ; A positive value here will instruct the usbradio driver to ignore the - ; COR line for a specified number of 20mSec intervals following the - ; release of PTT. Use this only on simplex nodes, and leave commented - ; out for repeaters or other full duplex nodes. - -rxlpf = 0 ; Receiver Audio Low Pass Filter 0,1,2 - ; 0 - 3.0 kHz cutoff (Default) value for reduced noise and increased intelligibility. (default) - ; 1 - 3.3 kHz cutoff for increased high end, sibilance and brightness. - ; 2 - 3.5 kHz cutoff for even more high end, sibilance and brightness. - -rxhpf = 0 ; Receiver Audio High Pass Filter 0,1 - ; 0 - 300 Hz cutoff. (Default) value to reduce sub-audible signals for retransmission and in the receiver speaker. (default) - ; 1 - 250 Hz cutoff for additional received and retransmitted bass response. - ; recommend using this filter with a CTCSS tone no higher than 186.2 Hz. - -txlpf = 0 ; Transmitter Audio Low Pass Filter 0,1 - ; 0 - 3.0 kHz cutoff. (Default) - ; 1 - 3.3 kHz cutoff for increased high end, sibilance and brightness. - -txhpf = 0 ; Transmitter Audio High Pass Filter 0,1,2 - ; 0 - 300 Hz cutoff Reduce interference between voice and sub-audible signaling tones and codes (default) - ; 1 - 250 Hz cutoff Increase bass response in transmitted audio. - ; 2 - 120 Hz cutoff for special applications requiring additional bass response in transmitted audio - ; Not recommended due to the increased possibility of voice energy interfering with sub-audible signaling +eeprom = 0 ; EEPROM installed: 0,1 + ; 0 = no (default) + ; 1 = yes +hdwtype = 0 ; Leave this set to 0 for USB sound fobs modified using + ; the instructions from usbfob.pdf. Use a setting of + ; 1 is for Dingotel/Sph interfaces. + +rxboost = 1 ; 0 - 20db attenuator inserted + ; 1 - 20db attenuator removed + ; Set to 1 for additonal gain if using a low-level receiver output + +rxctcssrelax = 1 ; reduce talkoff from radios w/o CTCSS TX HPF + ; Do not change this, leave this as a 1 + +rxsqhyst = 3000 ; Setting Squelch Hysteresis + ; 3000 is the default amount. + ; An amount of 500 seems good. + ; Then set the squelch to the highest number revealed when doing a "radio + ; tune rxsquelch" - running the command multiple (like 20) times in a row. + ; + +txctcssdefault = 100.0 ; default TX CTCSS frequency, any frequency permitted +rxctcssfreqs = 100.0,91.5 ; RX CTCSS frequencies list in floating point. must be in table +txctcssfreqs = 100.0,91.5 ; TX CTCSS frequencies list. any frequency permitted. will follow RX CTCSS frequency +rxctcssoverride = 0 ; Set to 1 to start out in carrier squelch mode + +carrierfrom = dsp ; no,usb,usbinvert,dsp,vox + ; no - no carrier detection at all + ; usb - from the COR line on the USB sound fob (Active high) + ; usbinvert - from the inverted COR line on the USB sound fob (Active low) + ; dsp - from RX noise using DSP techniques + ; vox - voice activated from RX audio + +ctcssfrom = dsp ; no,usb,usbinvert,dsp + ; no - no CTCSS decoding, system will be carrier squelch + ; usb - from the CTCSS line on the USB sound fob (Active high) + ; usbinvert - from the inverted CTCSS line on the USB sound fob (Active low) + ; dsp - CTCSS decoding using RX audio in DSP. + ; rxdemod option must be set to flat for this to work. + +rxdemod = flat ; input type from radio: no,speaker,flat + ; no - RX audio input not used + ; flat - Use RX audio from discriminator (before de-emphasis) + ; speaker - use de-emphasized audio + +rxsquelchdelay = 30 ; delayline in ms carrier squelch tail eliminator + +rxondelay = 0 ; Number of 20mSec intervals following the release of PTT. + ; Uncomment and/or adjust for simplex nodes to eliminate "Ping Ponging" + ; or "Relay Racing". A positive value here will instruct the usbradio + ; driver to ignore the COR line for a specified number of 20mSec + ; intervals following the release of PTT. Use this ONLY on simplex + ; nodes, and leave commented out for repeaters or other full duplex nodes. + +txboost = 0 ; Add transmitter audio gain boost: 0,1 + +txprelim = yes ; Audio processing on left output channel: no,yes + ; no - Audio is not pre-emphasized and limited. + ; Suitable for use on a microphone input + ; yes - Audio is pre-emphasized and limited. + ; Suitable for direct connection to an FM modulator + +txlimonly = yes ; Audio limiting with no pre-emphasis on output channel: no,yes + ; no - Audio is not limited. + ; yes - Audio is limited. + ; Suitable for transmitters with no limiting but with pre-emphasis. + +txtoctype = notone ; Transmit tone control type: no,phase,notone + ; no - CTCSS tone encoding with no hang time + ; phase - encode CTCSS and reverse phase + ; AKA ("reverse burst") before unkeying TX + ; notone - encode CTCSS and stop sending tone before unkeying TX + ; AKA ("chicken burst") + +txmixa = composite ; Left channel output: no,voice,tone,composite,auxvoice + ; no - Do not output anything + ; voice - output voice only + ; tone - CTCSS tone only + ; composite - voice and tone + ; auxvoice - auxiliary voice output at headphone level for monitoring + +txmixb = no ; Right channel output: no,voice,tone,composite, auxvoice + ; no - Do not output anything + ; voice - output voice only + ; tone - CTCSS tone only + ; composite - voice and tone + ; auxvoice - auxiliary voice output at headphone level for monitoring + +invertptt = 0 ; Invert PTT: 0,1 + ; 0 - ground to transmit + ; 1 - open to transmit + +duplex = 0 ; Duplex 0,1 + ; 0 - half duplex + ; 1 - full duplex +duplex3 = 0 ; duplex 3 gain setting (0 to disable) ??? + +#includeifexists custom/usbradio.conf diff --git a/configs/usbradio/zapata.conf b/configs/usbradio/zapata.conf deleted file mode 100644 index b8897e86..00000000 --- a/configs/usbradio/zapata.conf +++ /dev/null @@ -1,13 +0,0 @@ -; -; zapata.conf for systems with usbradio fobs -; - -[channels] -signalling=em_txrx -group=9 -channel=pseudo - -; -; End of file -; - diff --git a/configs/usbradio/zaptel.conf b/configs/usbradio/zaptel.conf deleted file mode 100644 index c940c858..00000000 --- a/configs/usbradio/zaptel.conf +++ /dev/null @@ -1,8 +0,0 @@ -# -# zaptel.conf -# -loadzone = us -defaultzone=us -# -# End of file -# diff --git a/fixed-dahdi-patches/README b/fixed-dahdi-patches/README deleted file mode 100644 index 153efe0a..00000000 --- a/fixed-dahdi-patches/README +++ /dev/null @@ -1,7 +0,0 @@ -cd to the base directory of the dahdi installation - -patch -p1 < patch-dahdi-dude-fixed.1 -patch -p1 < patch-dahdi-dude-fixed.2 - -make install - diff --git a/fixed-dahdi-patches/patch-dahdi-dude-fixed.1 b/fixed-dahdi-patches/patch-dahdi-dude-fixed.1 deleted file mode 100644 index e5109a8c..00000000 --- a/fixed-dahdi-patches/patch-dahdi-dude-fixed.1 +++ /dev/null @@ -1,12 +0,0 @@ ---- a/linux/include/dahdi/kernel.h 2011-08-11 15:56:22.000000000 -0400 -+++ b/linux/include/dahdi/kernel.h 2011-09-29 08:10:08.000000000 -0400 -@@ -543,6 +543,9 @@ - unsigned char getraw[DAHDI_MAX_CHUNKSIZE]; /*!< Last received raw data */ - short getlin_lastchunk[DAHDI_MAX_CHUNKSIZE]; /*!< Last transmitted samples from last chunk */ - short putlin[DAHDI_MAX_CHUNKSIZE]; /*!< Last received samples */ -+#ifndef OLD_BROKEN_CODE -+ short putlin_pseudo[DAHDI_MAX_CHUNKSIZE]; /* Last received samples -- pseudo channel */ -+#endif - unsigned char putraw[DAHDI_MAX_CHUNKSIZE]; /*!< Last received raw data */ - short conflast[DAHDI_MAX_CHUNKSIZE]; /*!< Last conference sample -- base part of channel */ - short conflast1[DAHDI_MAX_CHUNKSIZE]; /*!< Last conference sample -- pseudo part of channel */ diff --git a/fixed-dahdi-patches/patch-dahdi-dude-fixed.2 b/fixed-dahdi-patches/patch-dahdi-dude-fixed.2 deleted file mode 100644 index f4a42e06..00000000 --- a/fixed-dahdi-patches/patch-dahdi-dude-fixed.2 +++ /dev/null @@ -1,130 +0,0 @@ ---- a/linux/drivers/dahdi/dahdi-base.c 2014-03-23 16:26:48.000000000 -0400 -+++ b/linux/drivers/dahdi/dahdi-base.c 2014-03-25 13:53:33.000000000 -0400 -@@ -982,8 +982,8 @@ - unsigned long flags; - - /* return if no valid conf number */ -- if (x <= 0) -- return; -+ if ((x <= 0) || (x >= DAHDI_MAX_CONF)) -+ return; - - /* Return if there is no alias */ - if (!confalias[x]) -@@ -1358,6 +1358,7 @@ - int res; - unsigned long flags; - -+ if (is_pseudo_chan(chan)) return 0; - spin_lock_irqsave(&chan->lock, flags); - if (chan->ec_factory != &hwec_factory) - res = -ENODEV; -@@ -1384,6 +1385,7 @@ - */ - static void dahdi_disable_hw_preechocan(struct dahdi_chan *chan) - { -+ if (is_pseudo_chan(chan)) return; - if (chan->span->ops->disable_hw_preechocan) - chan->span->ops->disable_hw_preechocan(chan); - } -@@ -2998,7 +3000,7 @@ - #endif - } - --static unsigned int max_pseudo_channels = 512; -+static unsigned int max_pseudo_channels = 2500; - static unsigned int num_pseudo_channels; - - static struct dahdi_chan *dahdi_alloc_pseudo(struct file *file) -@@ -7080,6 +7082,28 @@ - { - /* if to talk on conf */ - if (ms->confmode & DAHDI_CONF_TALKER) { -+#ifndef OLD_BROKEN_CODE -+ /* Store temp value */ -+ memcpy(k, getlin, DAHDI_CHUNKSIZE * sizeof(short)); -+ /* Add conf value */ -+ ACSS(k, conf_sums_next[ms->_confn]); -+ /* save last one */ -+ memcpy(ms->conflast2, ms->conflast1, DAHDI_CHUNKSIZE * sizeof(short)); -+ memcpy(ms->conflast1, k, DAHDI_CHUNKSIZE * sizeof(short)); -+ /* get amount actually added */ -+ SCSS(ms->conflast1, conf_sums_next[ms->_confn]); -+ /* Really add in new value */ -+ ACSS(conf_sums_next[ms->_confn], ms->conflast1); -+ /* add in stuff from pseudo-receive, too */ -+ ACSS(getlin,ms->putlin_pseudo); -+ memcpy(ms->getlin, getlin, DAHDI_CHUNKSIZE * sizeof(short)); -+ } else { -+ memset(ms->conflast1, 0, DAHDI_CHUNKSIZE * sizeof(short)); -+ memset(ms->conflast2, 0, DAHDI_CHUNKSIZE * sizeof(short)); -+ memset(getlin, 0, DAHDI_CHUNKSIZE * sizeof(short)); -+ } -+#else -+#error DONT USE THIS, ITS BROKEN - /* Store temp value */ - memcpy(k, getlin, DAHDI_CHUNKSIZE * sizeof(short)); - /* Add conf value */ -@@ -7094,6 +7118,7 @@ - memset(ms->conflast, 0, DAHDI_CHUNKSIZE * sizeof(short)); - memcpy(getlin, ms->getlin, DAHDI_CHUNKSIZE * sizeof(short)); - } -+#endif - txb[0] = DAHDI_LIN2X(0, ms); - memset(txb + 1, txb[0], DAHDI_CHUNKSIZE - 1); - break; -@@ -8018,7 +8043,12 @@ - } - for (x=0;xrxgain[rxb[x]]; -+#ifndef OLD_BROKEN_CODE -+ putlin[x] = ms->putlin_pseudo[x] = DAHDI_XLAW(rxb[x], ms); -+#else -+#error DONT USE THIS, ITS BROKEN - putlin[x] = DAHDI_XLAW(rxb[x], ms); -+#endif - } - - #ifndef CONFIG_DAHDI_NO_ECHOCAN_DISABLE -@@ -8188,9 +8218,28 @@ - case DAHDI_CONF_CONF: /* Normal conference mode */ - if (is_pseudo_chan(ms)) /* if a pseudo-channel */ - { -+#ifndef OLD_BROKEN_CODE -+ if (ms->confmode & DAHDI_CONF_TALKER) { -+ /* Store temp value */ -+ memcpy(k, putlin, DAHDI_CHUNKSIZE * sizeof(short)); -+ /* Add conf value */ -+ ACSS(k, conf_sums_next[ms->_confn]); -+ /* get amount actually added */ -+ memcpy(ms->conflast, k, DAHDI_CHUNKSIZE * sizeof(short)); -+ SCSS(ms->conflast, conf_sums_next[ms->_confn]); -+ /* Really add in new value */ -+ ACSS(conf_sums_next[ms->_confn], ms->conflast); -+ } else memset(ms->conflast, 0, DAHDI_CHUNKSIZE * sizeof(short)); -+#endif -+ - if (ms->confmode & DAHDI_CONF_LISTENER) { - /* Subtract out last sample written to conf */ -+#ifndef OLD_BROKEN_CODE -+ SCSS(putlin, ms->conflast2); -+#else -+#error DONT USE THIS, ITS BROKEN - SCSS(putlin, ms->conflast); -+#endif - /* Add in conference */ - ACSS(putlin, conf_sums[ms->_confn]); - } -@@ -8264,7 +8313,12 @@ - int oldbuf; - int eof=0; - int abort=0; -+#ifndef OLD_BROKEN_CODE -+ int res = 0; -+#else -+#error DONT USE THIS, ITS BROKEN - int res; -+#endif - int left, x; - - while(bytes) { From b39ced376d622f6aff146a213eda4735e35f1519 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Dec 2017 22:39:34 -0500 Subject: [PATCH 22/96] Update --- README | 48 ++---------------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/README b/README index 3ddd2c4f..f2b617ab 100644 --- a/README +++ b/README @@ -1,54 +1,10 @@ -This is the Asterisk source package for ACID and LIMEY LINUX +This is the Asterisk source package for AllStarLink asterisk-1.4.23pre libpri-1.4.7 -zaptel 1.4.12.1 -This a patched version of Asterisk to run with uClibc on an embedded mini-itx system and on an ACID automatic install disk. +This a patched version of Asterisk to run with uClibc on an embedded mini-itx system. -ACID BUILD INSTRUCTIONS ----------------------- - -The build is automatically handled by the astupd.sh script. - - -LIMEY LINUX BUILD INSTRUCTIONS ------------------------------ - -First, unpack this archive in /usr/src on the target system. - -If you are doing a new install, then use one of the following targets: - -make install_pciradio - -or - -make install_usbradio - - -Choose the correct target for your hardware configuration. install_pciradio -is for users with quad radio PCI cards, and install_usbradio is for users with -a modified USB sound FOB, or commercially available URI. - -When the build completes, run the savecfg script on the target to save the -Asterisk config files in /mnt/cf/syscfg.tgz so that they are loaded every -time the system boots up. - -If you are doing an upgrade on a target already configured, then use this -target: - -make upgrade - -DETAILS -------- - -The supplied Makefile will build zaptel, libpri and asterisk, then install them -in the correct directories. Once they are installed, then the Makefile runs the -svastbin script to generate the astbin.tgz file, and copies it to /mnt/cf. - -With a copy astbin.tgz the system will automatically unpack the asterisk -binaries each time it is booted, load the correct drivers, and then start -Asterisk. From 77e297ab20e4af9129662a711aa984947d017944 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Dec 2017 22:46:21 -0500 Subject: [PATCH 23/96] Minor edit --- configs/beagleboard/modules.conf | 2 +- configs/examples/echolink/modules.conf | 2 +- configs/pi/modules.conf | 2 +- configs/simpleusb/modules.conf | 2 +- configs/usbradio/modules.conf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/beagleboard/modules.conf b/configs/beagleboard/modules.conf index d20cbd53..dbaec224 100644 --- a/configs/beagleboard/modules.conf +++ b/configs/beagleboard/modules.conf @@ -3,7 +3,7 @@ ; ; Module Loader configuration file ; -; By default DIAL does NOT load every module, only what is needed +; By default AllStarLink does NOT load every module, only what is needed ; You can enable or disable any of the asterisk modules ; All modules are compiled and installed. diff --git a/configs/examples/echolink/modules.conf b/configs/examples/echolink/modules.conf index 67a0e705..089bb11b 100644 --- a/configs/examples/echolink/modules.conf +++ b/configs/examples/echolink/modules.conf @@ -3,7 +3,7 @@ ; ; Module Loader configuration file ; -; By default DIAL does NOT load every module, only what is needed +; By default AllStarLink does NOT load every module, only what is needed ; You can enable or disable any of the asterisk modules ; All modules are compiled and installed. diff --git a/configs/pi/modules.conf b/configs/pi/modules.conf index f58b6a69..40089e22 100644 --- a/configs/pi/modules.conf +++ b/configs/pi/modules.conf @@ -3,7 +3,7 @@ ; ; Module Loader configuration file ; -; By default DIAL does NOT load every module, only what is needed +; By default AllStarLink does NOT load every module, only what is needed ; You can enable or disable any of the asterisk modules ; All modules are compiled and installed. diff --git a/configs/simpleusb/modules.conf b/configs/simpleusb/modules.conf index 8bf9e638..d15857a4 100644 --- a/configs/simpleusb/modules.conf +++ b/configs/simpleusb/modules.conf @@ -3,7 +3,7 @@ ; ; Module Loader configuration file ; -; By default DIAL does NOT load every module, only what is needed +; By default AllStarLink does NOT load every module, only what is needed ; You can enable or disable any of the asterisk modules ; All modules are compiled and installed. diff --git a/configs/usbradio/modules.conf b/configs/usbradio/modules.conf index 49e75fd3..f2e863f4 100644 --- a/configs/usbradio/modules.conf +++ b/configs/usbradio/modules.conf @@ -3,7 +3,7 @@ ; ; Module Loader configuration file ; -; By default DIAL does NOT load every module, only what is needed +; By default AllStarLink does NOT load every module, only what is needed ; You can enable or disable any of the asterisk modules ; All modules are compiled and installed. From 0cfd74fc6cc79c4afa4036ff815b3e5262c317ab Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Thu, 28 Dec 2017 05:44:28 -0500 Subject: [PATCH 24/96] add rtpdir to compile defaults --- asterisk/menuselect.makeopts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asterisk/menuselect.makeopts b/asterisk/menuselect.makeopts index f8f25370..8bb5652f 100644 --- a/asterisk/menuselect.makeopts +++ b/asterisk/menuselect.makeopts @@ -1,6 +1,6 @@ MENUSELECT_APPS=app_ivrdemo app_osplookup app_skel MENUSELECT_CDR=cdr_odbc cdr_pgsql cdr_radius cdr_sqlite cdr_tds -MENUSELECT_CHANNELS=chan_alsa chan_features chan_gtalk chan_h323 chan_mgcp chan_misdn chan_nbs chan_oss chan_phone chan_rtpdir chan_skinny chan_vpb +MENUSELECT_CHANNELS=chan_alsa chan_features chan_gtalk chan_h323 chan_mgcp chan_misdn chan_nbs chan_oss chan_phone chan_skinny chan_vpb MENUSELECT_CODECS=codec_ilbc codec_lpc10 codec_speex MENUSELECT_FORMATS=format_ogg_vorbis MENUSELECT_FUNCS=func_curl func_odbc From 7c4933d115afe1ecc3ac0f4150e6271fb9a737eb Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Thu, 28 Dec 2017 07:01:03 -0500 Subject: [PATCH 25/96] revert --- asterisk/apps/app_rpt.c | 598 ++++++++++++++++++++-------------------- configs/cdr.conf | 11 + 2 files changed, 310 insertions(+), 299 deletions(-) create mode 100644 configs/cdr.conf diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index f2b06620..e638228a 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -22,7 +22,7 @@ * By: Stacy Olivas, KG7QIN - 20 March 2017 * This application, the heart of the AllStar network and using asterisk as a repeater, * is largely undocumented code. It uses a multi-threaded approach to fulfilling its functions - * and can be quite a chore to follow for debugging. + * and can be quite a chore to follow for debugging. * * The entry point in the code , rpt_exec, is called by the main pbx call handing routine. * The code handles the initial setup and then passes the call/connection off to @@ -35,18 +35,18 @@ * debugging statements throughout it and run it. The program flow may surprise you. * * Note that due changes in later versions of asterisk, you cannot simply drop this module into - * the build tree and expect it to work. There has been some significant renaming of + * the build tree and expect it to work. There has been some significant renaming of * key variables and structures between 1.4 and later versions of Asterisk. Additionally, - * the changes to how the pbx module passes calls off to applications has changed as well, + * the changes to how the pbx module passes calls off to applications has changed as well, * which causes app_rpt to fail without a modification of the base Asterisk code in these * later versions. * -------------------------------------- */ /*! \file * - * \brief Radio Repeater / Remote Base program + * \brief Radio Repeater / Remote Base program * version 0.328 07/13/2017 - * + * * \author Jim Dixon, WB6NIL * * \note Serious contributions by Steve RoDgers, WA6ZFT @@ -60,7 +60,7 @@ * Normal mode: * See the function list in rpt.conf (autopatchup, autopatchdn) * autopatchup can optionally take comma delimited setting=value pairs: - * + * * * context=string : Override default context with "string" * dialtime=ms : Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) @@ -106,7 +106,7 @@ * 17 - User functions (time, id, etc) enable * 18 - User functions (time, id, etc) disable * 19 - Select alternate hang timer - * 20 - Select standard hang timer + * 20 - Select standard hang timer * 21 - Enable Parrot Mode * 22 - Disable Parrot Mode * 23 - Birdbath (Current Parrot Cleanup/Flush) @@ -130,7 +130,7 @@ * 44 - Echolink announce node # & Callsign * 45 - Link Activity timer enable * 46 - Link Activity timer disable - * 47 - Reset "Link Config Changed" Flag + * 47 - Reset "Link Config Changed" Flag * 48 - Send Page Tone (Tone specs separated by parenthesis) * 49 - Disable incoming connections (control state noice) * 50 - Enable incoming connections (control state noicd) @@ -144,11 +144,11 @@ * 58 - Tx CTCSS On Input only Enable * 59 - Tx CTCSS On Input only Disable * 60 - Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) - * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call * (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. * DestID and subcode are only specified for the 'C' type message. * UnitID is the local systems UnitID. DestID is the MDC1200 ID of - * the radio being called, and the subcodes are as follows: + * the radio being called, and the subcodes are as follows: * Subcode '8205' is Voice Selective Call for Spectra ('Call') * Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or * Astro-Saber('Call') @@ -156,7 +156,7 @@ * 61 - Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) * 62 - Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) * 63 - Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) - * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) + * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) * 65 - Send POCSAG page (equipped channel types only) * * ilink cmds: @@ -229,13 +229,13 @@ * * "events" subsystem: * - * in the "events" section of the rpt.conf file (if any), the user may - * specify actions to take place when ceratin events occur. + * in the "events" section of the rpt.conf file (if any), the user may + * specify actions to take place when ceratin events occur. * * It is implemented as acripting, based heavily upon expression evaluation built * into Asterisk. Each line of the section contains an action, a type, and variable info. * Each line either sets a variable, or executes an action based on a transitional state - * of a specified (already defined) variable (such as going true, going false, no change, + * of a specified (already defined) variable (such as going true, going false, no change, * or getting set initially). * * The syntax for each line is as follows: @@ -260,7 +260,7 @@ * "RANGER" mode configuration: * in the node stanza in rpt.conf ONLY the following need be specified for a RANGER node: * - * + * * * [90101] * @@ -344,7 +344,7 @@ #define DEFAULT_EANNMODE 1 #define DEFAULT_TANNMODE 1 -#define DEFAULT_RXBURST_TIME 250 +#define DEFAULT_RXBURST_TIME 250 #define DEFAULT_RXBURST_THRESHOLD 16 #define DEFAULT_SPLIT_2M 600 @@ -443,11 +443,11 @@ #define MAX_DAQ_NAME 32 /* Max length of a device name */ #define MAX_DAQ_DEV 64 /* Max length of a daq device path */ #define MAX_METER_FILES 10 /* Max number of sound files in a meter def. */ -#define DAQ_RX_TIMEOUT 50 /* Receive time out for DAQ subsystem */ +#define DAQ_RX_TIMEOUT 50 /* Receive time out for DAQ subsystem */ #define DAQ_ADC_ACQINT 10 /* Acquire interval in sec. for ADC channels */ #define ADC_HIST_TIME 300 /* Time in sec. to calculate short term avg, high and low peaks from. */ #define ADC_HISTORY_DEPTH ADC_HIST_TIME/DAQ_ADC_ACQINT - + enum {REM_OFF,REM_MONITOR,REM_TX}; @@ -737,7 +737,7 @@ static char *remote_rig_ppp16="ppp16"; // parallel port programmable 16 chan /* * DTMF Tones - frequency pairs used to generate them along with the required timings */ - + static char* dtmf_tones[] = { "!941+1336/200,!0/200", /* 0 */ "!697+1209/200,!0/200", /* 1 */ @@ -858,8 +858,8 @@ struct rpt_link int max_retries; int reconnects; long long connecttime; - struct ast_channel *chan; - struct ast_channel *pchan; + struct ast_channel *chan; + struct ast_channel *pchan; char linklist[MAXLINKLIST]; time_t linklistreceived; long linklisttimer; @@ -930,7 +930,7 @@ struct rpt_tele struct function_table_tag { char action[ACTIONSIZE]; - int (*function)(struct rpt *myrpt, char *param, char *digitbuf, + int (*function)(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink); } ; @@ -987,7 +987,7 @@ struct daq_tag{ /* Used to store the morse code patterns */ struct morse_bits -{ +{ int len; int ddcomb; } ; @@ -1160,7 +1160,7 @@ static struct rpt int simplexpatchdelay; int simplexphonedelay; char telemdefault; - char telemdynamic; + char telemdynamic; char lnkactenable; char *statpost_program; char *statpost_url; @@ -1189,7 +1189,7 @@ static struct rpt int litztime; char *litzchar; char *litzcmd; - int itxctcss; + int itxctcss; int gpsfeet; int default_split_2m; int default_split_70cm; @@ -1218,7 +1218,7 @@ static struct rpt char txkeyed; char exttx; char localtx; - char remrx; + char remrx; char remoterx; char remotetx; char remoteon; @@ -1295,7 +1295,7 @@ static struct rpt int link_longestfunc; int longestfunc; int longestnode; - int threadrestarts; + int threadrestarts; int tailmessagen; time_t disgorgetime; time_t lastthreadrestarttime; @@ -1320,9 +1320,9 @@ static struct rpt char wasvox; int voxtotimer; char voxtostate; - int linkposttimer; - int keyposttimer; - int lastkeytimer; + int linkposttimer; + int keyposttimer; + int lastkeytimer; char newkey; char iaxkey; char inpadtest; @@ -1381,7 +1381,7 @@ static struct rpt struct timeval paging; char deferid; struct timeval lastlinktime; -} rpt_vars[MAXRPTS]; +} rpt_vars[MAXRPTS]; struct nodelog { struct nodelog *next; @@ -1640,7 +1640,7 @@ static int multimode_capable(struct rpt *myrpt) if(!strcmp(myrpt->remoterig, remote_rig_ic706)) return 1; return 0; -} +} /* * Return 1 if rig is narrow capable */ @@ -1654,7 +1654,7 @@ static int narrow_capable(struct rpt *myrpt) if(!strcmp(myrpt->remoterig, remote_rig_tm271)) return 1; return 0; -} +} static char is_paging(struct rpt *myrpt) { @@ -1705,7 +1705,7 @@ static int dovox(struct vox *v,short *buf,int bs) float esquare = 0.0; float energy = 0.0; float threshold = 0.0; - + if (v->voxena < 0) return(v->lastvox); for(i = 0; i < bs; i++) { @@ -1722,7 +1722,7 @@ static int dovox(struct vox *v,short *buf,int bs) v->noise_energy += (energy - v->noise_energy) / 64; else v->noise_energy += (energy - v->noise_energy) / 4; - + if (v->voxena) threshold = v->speech_energy / 8; else { @@ -2068,10 +2068,10 @@ static struct telem_defaults tele_defs[] = { static inline void goertzel_sample(goertzel_state_t *s, short sample) { int v1; - + v1 = s->v2; s->v2 = s->v3; - + s->v3 = (s->fac * s->v2) >> 15; s->v3 = s->v3 - v1 + (sample >> s->chunky); if (abs(s->v3) > 32768) { @@ -2085,7 +2085,7 @@ static inline void goertzel_sample(goertzel_state_t *s, short sample) static inline void goertzel_update(goertzel_state_t *s, short *samps, int count) { int i; - + for (i = 0; i < count; i++) { goertzel_sample(s, samps[i]); } @@ -2332,7 +2332,7 @@ static struct function_table_tag function_table[] = { /* - * Generic serial port open command + * Generic serial port open command */ static int serial_open(char *fname, int speed, int stop2) @@ -2347,7 +2347,7 @@ static int serial_open(char *fname, int speed, int stop2) ast_log(LOG_WARNING,"Cannot open serial port %s\n",fname); return -1; } - + memset(&mode, 0, sizeof(mode)); if (tcgetattr(fd, &mode)) { if(debug >= 1){ @@ -2366,20 +2366,20 @@ static int serial_open(char *fname, int speed, int stop2) if(stop2) mode.c_cflag |= CSTOPB; mode.c_cc[VTIME] = 3; - mode.c_cc[VMIN] = 1; + mode.c_cc[VMIN] = 1; #endif cfsetispeed(&mode, speed); cfsetospeed(&mode, speed); if (tcsetattr(fd, TCSANOW, &mode)){ - if(debug >= 1) + if(debug >= 1) ast_log(LOG_WARNING, "Unable to set serial parameters on %s: %s\n", fname, strerror(errno)); return -1; } usleep(100000); if (debug >= 3) ast_log(LOG_NOTICE,"Opened serial port %s\n",fname); - return(fd); + return(fd); } /* @@ -2410,14 +2410,14 @@ static int serial_rxflush(int fd, int timeoutms) { int res, flushed = 0; char c; - + while((res = serial_rxready(fd, timeoutms)) == 1){ if(read(fd, &c, 1) == -1){ res = -1; break; flushed++; } - } + } return (res == -1)? res : flushed; } /* @@ -2429,7 +2429,7 @@ static int serial_rx(int fd, char *rxbuf, int rxmaxbytes, unsigned timeoutms, ch char c; int i, j, res; - if ((!rxmaxbytes) || (rxbuf == NULL)){ + if ((!rxmaxbytes) || (rxbuf == NULL)){ return 0; } memset(rxbuf,0,rxmaxbytes); @@ -2454,7 +2454,7 @@ static int serial_rx(int fd, char *rxbuf, int rxmaxbytes, unsigned timeoutms, ch rxbuf[i + 1] = 0; if (c == termchr) break; } - } + } if(i && debug >= 6) { printf("i = %d\n",i); printf("String returned was:\n"); @@ -2484,7 +2484,7 @@ static int serial_txstring(int fd, char *txstring) } return 0; } - + /* * Write some bytes to the serial port, then optionally expect a fixed response */ @@ -2598,7 +2598,7 @@ static int uchameleon_connect(struct daq_entry_tag *t) return -1; } /* uchameleon LED on solid once we communicate with it successfully */ - + if(serial_io(t->fd, ledbuf, NULL, strlen(ledbuf), 0, DAQ_RX_TIMEOUT, 0) == -1){ ast_log(LOG_WARNING, "Can't set LED on uchameleon device\n"); close(t->fd); @@ -2626,7 +2626,7 @@ static void uchameleon_alarm_handler(struct daq_pin_entry_tag *p) ast_log(LOG_ERROR,"Out of memory\n"); return; } - + argc = explode_string(valuecopy, argv, 6, ',', 0); if(debug >= 3){ @@ -2775,7 +2775,7 @@ static int uchameleon_pin_init(struct daq_entry_tag *t) } ast_config_destroy(ourcfg); - time(&t->adcacqtime); /* Start ADC Acquisition */ + time(&t->adcacqtime); /* Start ADC Acquisition */ return -0; } @@ -2855,8 +2855,8 @@ static int uchameleon_close(struct daq_entry_tag *t) } t->txhead = t->txtail = NULL; } - - if(t->fd > 0){ + + if(t->fd > 0){ res = close(t->fd); if(res) ast_log(LOG_WARNING, "Error closing serial port"); @@ -2873,7 +2873,7 @@ static int uchameleon_close(struct daq_entry_tag *t) static int uchameleon_do_long( struct daq_entry_tag *t, int pin, int cmd, void (*exec)(struct daq_pin_entry_tag *), int *arg1, void *arg2) -{ +{ int i,j,x; struct daq_pin_entry_tag *p, *listl, *listp; @@ -3012,7 +3012,7 @@ int cmd, void (*exec)(struct daq_pin_entry_tag *), int *arg1, void *arg2) if(arg1) *arg1 = listp->value; } - ast_mutex_unlock(&t->lock); + ast_mutex_unlock(&t->lock); return 0; } @@ -3102,7 +3102,7 @@ int cmd, void (*exec)(struct daq_pin_entry_tag *), int *arg1, void *arg2) ast_mutex_unlock(&t->lock); return -1; } - + /* * Reset a minimum or maximum reading */ @@ -3146,7 +3146,7 @@ static void uchameleon_queue_tx(struct daq_entry_tag *t, char *txbuff) if(!t) return; - + if(!(q = (struct daq_tx_entry_tag *) ast_malloc(sizeof(struct daq_tx_entry_tag)))){ ast_log(LOG_WARNING, "Out of memory\n"); return; @@ -3263,11 +3263,11 @@ static void *uchameleon_monitor_thread(void *this) break; } p = p->next; - } + } ast_mutex_unlock(&t->lock); } } - + if(time(&now) >= t->adcacqtime){ t->adcacqtime = now + DAQ_ADC_ACQINT; @@ -3277,7 +3277,7 @@ static void *uchameleon_monitor_thread(void *this) } /* Go through the pin linked list looking for new work */ - ast_mutex_lock(&t->lock); + ast_mutex_lock(&t->lock); p = t->pinhead; while(p){ /* Time to acquire all ADC channels ? */ @@ -3325,7 +3325,7 @@ static void *uchameleon_monitor_thread(void *this) p->state = DAQ_PS_IDLE; } break; - + case DAQ_CMD_ADC: if(p->pintype == DAQ_PT_INADC){ snprintf(txbuff,sizeof(txbuff),"adc %d\n", p->num); @@ -3351,7 +3351,7 @@ static void *uchameleon_monitor_thread(void *this) "Invalid ADC pin number %d\n", p->num); p->state = DAQ_PS_IDLE; break; - } + } if((p->pintype == DAQ_PT_INP) && (p->num < 9)){ ast_log(LOG_WARNING, "Invalid INP pin number %d\n", p->num); @@ -3390,7 +3390,7 @@ static void *uchameleon_monitor_thread(void *this) } /* if */ p = p->next; } /* while */ - + /* Transmit queued commands */ while(t->txhead){ q = t->txhead; @@ -3412,7 +3412,7 @@ static void *uchameleon_monitor_thread(void *this) ast_log(LOG_ERROR,"Tx failed, terminating monitor thread\n"); return this; /* Now, we die */ } - + ast_mutex_lock(&t->lock); }/* while */ ast_mutex_unlock(&t->lock); @@ -3569,7 +3569,7 @@ static int daq_reset_minmax(char *device, int pin, int minmax) { int res = -1; struct daq_entry_tag *t; - + if(!(t = daq_devtoentry(device))) return -1; switch(t->type){ @@ -3621,14 +3621,14 @@ static void daq_init(struct ast_config *cfg) *t_next = t; t_next = &t->next; - daq.ndaqs++; + daq.ndaqs++; if(daq.ndaqs >= MAX_DAQ_ENTRIES) break; var = var->next; } -} +} /* * Uninitialize DAQ Subsystem @@ -3675,15 +3675,15 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c char *argv[5]; char *sound_files[MAX_METER_FILES+1]; char *range_strings[MAX_DAQ_RANGES+1]; - char *bitphrases[3]; + char *bitphrases[3]; static char *filter_keywords[]={"none","max","min","stmin","stmax","stavg",NULL}; struct daq_entry_tag *entry; - + if(!(myargs = ast_strdup(args))){ /* Make a local copy to slice and dice */ ast_log(LOG_WARNING, "Out of memory\n"); return -1; } - + i = explode_string(myargs, argv, 4, ',', 0); if((i != 4) && (i != 3)){ /* Must have 3 or 4 substrings, no more, no less */ ast_log(LOG_WARNING,"Wrong number of arguments for meter telemetry function is: %d s/b 3 or 4", i); @@ -3692,7 +3692,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c } if(debug >= 3){ ast_log(LOG_NOTICE,"Device: %s, Pin: %s, Meter Face: %s Filter: %s\n", - argv[0],argv[1],argv[2], argv[3]); + argv[0],argv[1],argv[2], argv[3]); } if(i == 4){ @@ -3705,8 +3705,8 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c filter--; } else - filter = DAQ_SUB_CUR; - + filter = DAQ_SUB_CUR; + /* Find our device */ if(!(entry = daq_devtoentry(argv[0]))){ ast_log(LOG_WARNING,"Cannot find device %s in daq-list\n",argv[0]); @@ -3747,7 +3747,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c if(!(p = ast_variable_retrieve(myrpt->cfg,"meter-faces", argv[2]))){ ast_log(LOG_WARNING,"Meter face %s not found", argv[2]); - ast_free(myargs); + ast_free(myargs); return -1; } @@ -3756,7 +3756,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_free(myargs); return -1; } - + if(!strncmp("scale", meter_face, 5)){ /* scale function? */ metertype = 1; if((!(end = strchr(meter_face,')')))|| @@ -3782,7 +3782,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_free(meter_face); return -1; - } + } } else if(!strncmp("range", meter_face, 5)){ /* range function */ metertype = 2; @@ -3796,7 +3796,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c } *start++ = 0; *end = 0; - sounds = end + 2; + sounds = end + 2; /* * Parse range entries */ @@ -3826,7 +3826,7 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_free(myargs); ast_free(meter_face); return -1; - } + } } else{ ast_log(LOG_WARNING,"Meter face %s needs to specify one of scale, range or bit\n", argv[2]); @@ -3899,14 +3899,14 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c ast_log(LOG_NOTICE,"sounds = %s\n", sounds); } - + /* Wait the normal telemetry delay time */ - + if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) goto done; - + /* Split up the sounds string */ - + files = explode_string(sounds, sound_files, MAX_METER_FILES, ',', 0); if(files == 0){ ast_log(LOG_WARNING,"No sound files to say for meter %s\n",argv[2]); @@ -3947,13 +3947,13 @@ static int handle_meter_tele(struct rpt *myrpt, struct ast_channel *mychannel, c if(metertype == 3){ res = sayfile(mychannel, bitphrases[(val) ? 1: 0]); } - + } else{ res = sayfile(mychannel, sound_files[i]); /* Say the next word in the list */ - } + } } -done: +done: /* Done */ ast_free(myargs); ast_free(meter_face); @@ -3987,7 +3987,7 @@ static int handle_userout_tele(struct rpt *myrpt, struct ast_channel *mychannel, } if(debug >= 3){ ast_log(LOG_NOTICE,"USEROUT Device: %s, Pin: %s, Requested state: %s\n", - argv[0],argv[1],argv[2]); + argv[0],argv[1],argv[2]); } pin = atoi(argv[1]); reqstate = atoi(argv[2]); @@ -4006,17 +4006,17 @@ static int handle_userout_tele(struct rpt *myrpt, struct ast_channel *mychannel, /* Set or reset the bit */ res = daq_do( t, pin, DAQ_CMD_OUT, reqstate); - + /* Wait the normal telemetry delay time */ - + if(!res) if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) goto done; /* Say the files one by one at argc index 3 */ for(i = 3; i < argc && !res; i++){ res = sayfile(mychannel, argv[i]); /* Say the next word in the list */ - } - + } + done: ast_free(myargs); return 0; @@ -4035,7 +4035,7 @@ static int function_meter(struct rpt *myrpt, char *param, char *digitbuf, int co if(debug) ast_log(LOG_NOTICE, "meter param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - + rpt_telem_select(myrpt,command_source,mylink); rpt_telemetry(myrpt,METER,param); return DC_COMPLETE; @@ -4054,7 +4054,7 @@ static int function_userout(struct rpt *myrpt, char *param, char *digitbuf, int return DC_ERROR; ast_log(LOG_NOTICE, "userout param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - + rpt_telem_select(myrpt,command_source,mylink); rpt_telemetry(myrpt,USEROUT,param); return DC_COMPLETE; @@ -4073,14 +4073,14 @@ static int function_cmd(struct rpt *myrpt, char *param, char *digitbuf, int comm return DC_ERROR; ast_log(LOG_NOTICE, "cmd param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf); - + if (param) { if (*param == '#') /* to execute asterisk cli command */ { ast_cli_command(nullfd,param + 1); } else - { + { cp = ast_malloc(strlen(param) + 10); if (!cp) { @@ -4098,9 +4098,9 @@ static int function_cmd(struct rpt *myrpt, char *param, char *digitbuf, int comm /* -************************ -* End of DAQ functions * -************************ + ********************** +* End of DAQ functions* +* ********************* */ @@ -4249,9 +4249,9 @@ int nonlocals; { while(tlist != &myrpt->tele) { - if ((tlist->mode == PLAYBACK) || + if ((tlist->mode == PLAYBACK) || (tlist->mode == STATS_GPS_LEGACY) || - (tlist->mode == ID1) || + (tlist->mode == ID1) || (tlist->mode == TEST_TONE)) nonlocals++; tlist = tlist->next; } @@ -4301,7 +4301,7 @@ static int linkcount(struct rpt *myrpt) // continue; //} numoflinks++; - + l = l->next; } // ast_log(LOG_NOTICE, "numoflinks=%i\n",numoflinks); @@ -4322,13 +4322,13 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.memory, memory); if (!val){ return -1; - } + } strncpy(tmp,val,sizeof(tmp) - 1); tmp[sizeof(tmp)-1] = 0; s = strchr(tmp,','); if (!s) - return 1; + return 1; *s++ = 0; s1 = strchr(s,','); if (!s1) @@ -4352,7 +4352,7 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) case 'a': strcpy(myrpt->rxpl, "100.0"); strcpy(myrpt->txpl, "100.0"); - myrpt->remmode = REM_MODE_AM; + myrpt->remmode = REM_MODE_AM; break; case 'B': case 'b': @@ -4366,35 +4366,35 @@ static int retrieve_memory(struct rpt *myrpt, char *memory) case 'L': case 'l': myrpt->powerlevel = REM_LOWPWR; - break; + break; case 'H': case 'h': myrpt->powerlevel = REM_HIPWR; break; - + case 'M': case 'm': myrpt->powerlevel = REM_MEDPWR; break; - + case '-': myrpt->offset = REM_MINUS; break; - + case '+': myrpt->offset = REM_PLUS; break; - + case 'S': case 's': myrpt->offset = REM_SIMPLEX; break; - + case 'T': case 't': myrpt->txplon = 1; break; - + case 'R': case 'r': myrpt->rxplon = 1; @@ -4596,10 +4596,10 @@ struct termios mode; return 0; } -/* +/* * open the serial port */ - + static int openserial(struct rpt *myrpt,char *fname) { struct termios mode; @@ -4641,7 +4641,7 @@ static int openserial(struct rpt *myrpt,char *fname) /* * Process DTMF keys passed - */ + */ static void local_dtmfkey_helper(struct rpt *myrpt,char c) { @@ -4687,7 +4687,7 @@ static void mdc1200_notify(struct rpt *myrpt,char *fromnode, char *data) fl.l_pid = pthread_self(); if (fcntl(fileno(fp),F_SETLKW,&fl) == -1) { - ast_log(LOG_ERROR,"Cannot get lock on MDC1200 log file %s\n",myrpt->p.mdclog); + ast_log(LOG_ERROR,"Cannot get lock on MDC1200 log file %s\n",myrpt->p.mdclog); fclose(fp); return; } @@ -4723,7 +4723,7 @@ char str[200]; wf.subclass = 0; wf.offset = 0; wf.mallocd = 0; - AST_FRAME_DATA(wf) = str; + AST_FRAME_DATA(wf) = str; wf.datalen = strlen(str) + 1; // Isuani, 20141001 wf.samples = 0; wf.src = "mdc1200_send"; @@ -4739,7 +4739,7 @@ char str[200]; l = l->next; continue; } - if (l->chan) rpt_qwrite(l,&wf); + if (l->chan) rpt_qwrite(l,&wf); l = l->next; } return; @@ -4753,7 +4753,7 @@ static void mdc1200_cmd(struct rpt *myrpt, char *data) busy = 0; if ((data[0] == 'I') && (!strcmp(data,myrpt->lastmdc))) return; myval = (char *) my_variable_match(myrpt->cfg, myrpt->p.mdcmacro, data); - if (myval) + if (myval) { if (option_verbose) ast_verbose("MDCMacro for %s doing %s on node %s\n",data,myval,myrpt->name); if ((*myval == 'K') || (*myval == 'k')) @@ -4964,7 +4964,7 @@ char *str = instr; * * Returns number of substrings found. */ - + static int explode_string(char *str, char *strp[], int limit, char delim, char quote) { @@ -4983,7 +4983,7 @@ int i,l,inquo; if(quote) { if (*str == quote) - { + { if (inquo) { *str = 0; @@ -4995,7 +4995,7 @@ int i,l,inquo; inquo = 1; } } - } + } if ((*str == delim) && (!inquo)) { *str = 0; @@ -5014,7 +5014,7 @@ int i,l,inquo; * strp- list of pointers to substrings (this is built by this function), NULL will be placed at end of list * limit- maximum number of substrings to process */ - + static int finddelim(char *str, char *strp[], int limit) @@ -5093,7 +5093,7 @@ int n; static int send_usb_txt(struct rpt *myrpt, char *txt) { struct ast_frame wf; - + /* if (debug) */ ast_log(LOG_NOTICE, "send_usb_txt %s\n",txt); wf.frametype = AST_FRAME_TEXT; wf.subclass = 0; @@ -5114,7 +5114,7 @@ static int send_link_pl(struct rpt *myrpt, char *txt) struct ast_frame wf; struct rpt_link *l; char str[300]; - + if (!strcmp(myrpt->p.ctgroup,"0")) return 0; snprintf(str, sizeof(str), "C %s %s %s", myrpt->name, myrpt->p.ctgroup, txt); /* if (debug) */ ast_log(LOG_NOTICE, "send_link_pl %s\n",str); @@ -5183,7 +5183,7 @@ int i,spos; { snprintf(buf + spos,MAXLINKLIST - spos, "%c%s",mode,l->name); - } + } } /* if we are in tranceive mode, let all modes stand */ if (mode == 'T') continue; @@ -5297,7 +5297,7 @@ struct ast_var_t *newvariable; var1p = ((pbx_checkcondition(var1) > 0)); } // pbx_builtin_setvar_helper(myrpt->rxchannel,cmpvar,var); - ast_free(cmpvar); + ast_free(cmpvar); c = toupper(c); if (!strchr("TFNI",c)) { @@ -5372,13 +5372,13 @@ struct ast_var_t *newvariable; { thisAction = i; break; - } - } + } + } if (thisAction < 0) { ast_log(LOG_ERROR, "Unknown action name %s.\n", argv[0]); continue; - } + } if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Event on node %s doing rpt command %s for condition %s\n", myrpt->name,cmd,v->value); @@ -5395,7 +5395,7 @@ struct ast_var_t *newvariable; strncpy(myrpt->cmdAction.digits, argv[2], MAXDTMF); myrpt->cmdAction.command_source = SOURCE_RPT; myrpt->cmdAction.state = CMD_STATE_READY; - } + } else { ast_log(LOG_NOTICE,"Could not execute event %s for %s: Command buffer in use\n",cmd,argv[1]); @@ -5447,7 +5447,7 @@ struct ast_var_t *newvariable; sprintf(cmpvar,"XX_%s",argv[2]); var1 = (char *) pbx_builtin_getvar_helper(myrpt->rxchannel,cmpvar); pbx_builtin_setvar_helper(myrpt->rxchannel,cmpvar,var); - ast_free(cmpvar); + ast_free(cmpvar); } if (option_verbose < 5) return; i = 0; @@ -5465,7 +5465,7 @@ struct ast_var_t *newvariable; /* * Routine to update boolean values used in currently referenced rpt structure */ - + static void rpt_update_boolean(struct rpt *myrpt,char *varname, int newval) { @@ -5483,7 +5483,7 @@ char buf[10]; /* * Updates the active links (channels) list that that the repeater has */ - + static void rpt_update_links(struct rpt *myrpt) { @@ -5522,7 +5522,7 @@ int i; if (!myrpt->p.discpgm) return; i = strlen(them) + strlen(myrpt->p.discpgm) + 100; a = ast_malloc(i); - if (!a) + if (!a) { ast_log(LOG_NOTICE,"Unable to alloc"); return; @@ -5543,7 +5543,7 @@ int i; if (!myrpt->p.connpgm) return; i = strlen(them) + strlen(myrpt->p.connpgm) + + 100; a = ast_malloc(i); - if (!a) + if (!a) { ast_log(LOG_NOTICE,"Unable to alloc"); return; @@ -5598,10 +5598,10 @@ unsigned int seq; } -/* - * Function stream data +/* + * Function stream data */ - + static void startoutstream(struct rpt *myrpt) { char *str; @@ -5666,7 +5666,7 @@ int n; return; } -/* +/* * AllStar Network node lookup function. This function will take the nodelist that has been read into memory * and try to match the node number that was passed to it. If it is found, the function requested will succeed. * If not, it will fail. Called when a connection to a remote node is requested. @@ -5704,12 +5704,12 @@ struct ast_variable *vp; } } ast_mutex_lock(&nodelookuplock); - if (!myrpt->p.extnodefilesn) + if (!myrpt->p.extnodefilesn) { ast_mutex_unlock(&nodelookuplock); return(0); } - /* determine longest node length again */ + /* determine longest node length again */ longestnode = 0; vp = ast_variable_browse(myrpt->cfg, myrpt->p.nodes); while(vp) @@ -5772,7 +5772,7 @@ static struct ast_config *ourcfg; if (!enod) enod = EXTNODES; ast_mutex_lock(&nodelookuplock); efil = ast_strdup(val); - if (!efil) + if (!efil) { ast_config_destroy(ourcfg); if (ourcfg) ast_config_destroy(ourcfg); @@ -5833,7 +5833,7 @@ int i,ls; if(!strncmp(string, keywords[i], ls)){ if(param) *param = string + ls; - return i + 1; + return i + 1; } } if(param) @@ -5848,7 +5848,7 @@ int i,ls; static char *skipchars(char *string, char *charlist) { -int i; +int i; while(*string){ for(i = 0; charlist[i] ; i++){ if(*string == charlist[i]){ @@ -5860,8 +5860,8 @@ int i; return string; } return string; -} - +} + static int myatoi(char *str) @@ -5927,7 +5927,7 @@ struct rptfilter *f; If /etc/localtime is not present, you will get GMT time! This is especially important on systems running embedded linux distributions as they don't usually - have support for locales. + have support for locales. If OLD_ASTERISK is defined, then the older localtime_r function will be used. The /etc/localtime file is not @@ -5979,7 +5979,7 @@ static time_t rpt_mktime(struct tm *tm,char *zone) #endif /* Retrieve an int from a config file */ - + static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int min, int max, int defl) { char *var; @@ -5989,8 +5989,8 @@ static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int if(min < 0){ /* If min is negative, this means include 0 as a valid entry */ min = -min; include_zero = 1; - } - + } + var = (char *) ast_variable_retrieve(myrpt->cfg, category, name); if(var){ ret = myatoi(var); @@ -6006,10 +6006,10 @@ static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int return ret; } -/* +/* * This is the initialization function. This routine takes the data in rpt.conf and setup up the variables needed for each of * the repeaters that it finds. There is some minor sanity checking done on the data passed, but not much. - * + * * Note that this is kind of a mess to read. It uses the asterisk native function to read config files and pass back values assigned to * keywords. */ @@ -6097,8 +6097,8 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis else rpt_vars[n].p.statpost_program = STATPOST_PROGRAM; rpt_vars[n].p.statpost_url = (char *) ast_variable_retrieve(cfg,this,"statpost_url"); - rpt_vars[n].p.tailmessagetime = retrieve_astcfgint(&rpt_vars[n],this, "tailmessagetime", 0, 200000000, 0); - rpt_vars[n].p.tailsquashedtime = retrieve_astcfgint(&rpt_vars[n],this, "tailsquashedtime", 0, 200000000, 0); + rpt_vars[n].p.tailmessagetime = retrieve_astcfgint(&rpt_vars[n],this, "tailmessagetime", 0, 200000000, 0); + rpt_vars[n].p.tailsquashedtime = retrieve_astcfgint(&rpt_vars[n],this, "tailsquashedtime", 0, 200000000, 0); rpt_vars[n].p.duplex = retrieve_astcfgint(&rpt_vars[n],this,"duplex",0,4,(ISRANGER(rpt_vars[n].name) ? 0 : 2)); rpt_vars[n].p.idtime = retrieve_astcfgint(&rpt_vars[n],this, "idtime", -60000, 2400000, IDTIME); /* Enforce a min max including zero */ rpt_vars[n].p.politeid = retrieve_astcfgint(&rpt_vars[n],this, "politeid", 30000, 300000, POLITEID); /* Enforce a min max */ @@ -6144,11 +6144,11 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis { val = FUNCTIONS; rpt_vars[n].p.simple = 1; - } + } rpt_vars[n].p.functions = val; val = (char *) ast_variable_retrieve(cfg,this,"link_functions"); if (val) rpt_vars[n].p.link_functions = val; - else + else rpt_vars[n].p.link_functions = rpt_vars[n].p.functions; val = (char *) ast_variable_retrieve(cfg,this,"phone_functions"); if (val) rpt_vars[n].p.phone_functions = val; @@ -6159,11 +6159,11 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis val = (char *) ast_variable_retrieve(cfg,this,"alt_functions"); if (val) rpt_vars[n].p.alt_functions = val; val = (char *) ast_variable_retrieve(cfg,this,"funcchar"); - if (!val) rpt_vars[n].p.funcchar = FUNCCHAR; else - rpt_vars[n].p.funcchar = *val; + if (!val) rpt_vars[n].p.funcchar = FUNCCHAR; else + rpt_vars[n].p.funcchar = *val; val = (char *) ast_variable_retrieve(cfg,this,"endchar"); - if (!val) rpt_vars[n].p.endchar = ENDCHAR; else - rpt_vars[n].p.endchar = *val; + if (!val) rpt_vars[n].p.endchar = ENDCHAR; else + rpt_vars[n].p.endchar = *val; val = (char *) ast_variable_retrieve(cfg,this,"nobusyout"); if (val) rpt_vars[n].p.nobusyout = ast_true(val); val = (char *) ast_variable_retrieve(cfg,this,"notelemtx"); @@ -6182,7 +6182,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis rpt_vars[n].p.extnodes = val; val = (char *) ast_variable_retrieve(cfg,this,"extnodefile"); if (!val) val = EXTNODEFILE; - rpt_vars[n].p.extnodefilesn = + rpt_vars[n].p.extnodefilesn = explode_string(val,rpt_vars[n].p.extnodefiles,MAX_EXTNODEFILES,',',0); val = (char *) ast_variable_retrieve(cfg,this,"locallinknodes"); if (val) rpt_vars[n].p.locallinknodesn = explode_string(ast_strdup(val),rpt_vars[n].p.locallinknodes,MAX_LOCALLINKNODES,',',0); @@ -6195,40 +6195,40 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis val = (char *) ast_variable_retrieve(cfg,this,"archivedir"); if (val) rpt_vars[n].p.archivedir = val; val = (char *) ast_variable_retrieve(cfg,this,"authlevel"); - if (val) rpt_vars[n].p.authlevel = atoi(val); + if (val) rpt_vars[n].p.authlevel = atoi(val); else rpt_vars[n].p.authlevel = 0; val = (char *) ast_variable_retrieve(cfg,this,"parrot"); if (val) rpt_vars[n].p.parrotmode = (ast_true(val)) ? 2 : 0; else rpt_vars[n].p.parrotmode = 0; val = (char *) ast_variable_retrieve(cfg,this,"parrottime"); - if (val) rpt_vars[n].p.parrottime = atoi(val); + if (val) rpt_vars[n].p.parrottime = atoi(val); else rpt_vars[n].p.parrottime = PARROTTIME; val = (char *) ast_variable_retrieve(cfg,this,"rptnode"); rpt_vars[n].p.rptnode = val; val = (char *) ast_variable_retrieve(cfg,this,"mars"); - if (val) rpt_vars[n].p.remote_mars = atoi(val); + if (val) rpt_vars[n].p.remote_mars = atoi(val); else rpt_vars[n].p.remote_mars = 0; val = (char *) ast_variable_retrieve(cfg,this,"monminblocks"); - if (val) rpt_vars[n].p.monminblocks = atol(val); + if (val) rpt_vars[n].p.monminblocks = atol(val); else rpt_vars[n].p.monminblocks = DEFAULT_MONITOR_MIN_DISK_BLOCKS; val = (char *) ast_variable_retrieve(cfg,this,"remote_inact_timeout"); - if (val) rpt_vars[n].p.remoteinacttimeout = atoi(val); + if (val) rpt_vars[n].p.remoteinacttimeout = atoi(val); else rpt_vars[n].p.remoteinacttimeout = DEFAULT_REMOTE_INACT_TIMEOUT; val = (char *) ast_variable_retrieve(cfg,this,"civaddr"); - if (val) rpt_vars[n].p.civaddr = atoi(val); + if (val) rpt_vars[n].p.civaddr = atoi(val); else rpt_vars[n].p.civaddr = DEFAULT_CIV_ADDR; val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout"); - if (val) rpt_vars[n].p.remotetimeout = atoi(val); + if (val) rpt_vars[n].p.remotetimeout = atoi(val); else rpt_vars[n].p.remotetimeout = DEFAULT_REMOTE_TIMEOUT; val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning"); - if (val) rpt_vars[n].p.remotetimeoutwarning = atoi(val); + if (val) rpt_vars[n].p.remotetimeoutwarning = atoi(val); else rpt_vars[n].p.remotetimeoutwarning = DEFAULT_REMOTE_TIMEOUT_WARNING; val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning_freq"); - if (val) rpt_vars[n].p.remotetimeoutwarningfreq = atoi(val); + if (val) rpt_vars[n].p.remotetimeoutwarningfreq = atoi(val); else rpt_vars[n].p.remotetimeoutwarningfreq = DEFAULT_REMOTE_TIMEOUT_WARNING_FREQ; val = (char *) ast_variable_retrieve(cfg,this,"erxgain"); if (!val) val = DEFAULT_ERXGAIN; - rpt_vars[n].p.erxgain = pow(10.0,atof(val) / 20.0); + rpt_vars[n].p.erxgain = pow(10.0,atof(val) / 20.0); val = (char *) ast_variable_retrieve(cfg,this,"etxgain"); if (!val) val = DEFAULT_ETXGAIN; rpt_vars[n].p.etxgain = pow(10.0,atof(val) / 20.0); @@ -6239,7 +6239,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis if (rpt_vars[n].p.eannmode > 3) rpt_vars[n].p.eannmode = 3; val = (char *) ast_variable_retrieve(cfg,this,"trxgain"); if (!val) val = DEFAULT_TRXGAIN; - rpt_vars[n].p.trxgain = pow(10.0,atof(val) / 20.0); + rpt_vars[n].p.trxgain = pow(10.0,atof(val) / 20.0); val = (char *) ast_variable_retrieve(cfg,this,"ttxgain"); if (!val) val = DEFAULT_TTXGAIN; rpt_vars[n].p.ttxgain = pow(10.0,atof(val) / 20.0); @@ -6252,7 +6252,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis if (!val) val = DEFAULT_LINKMONGAIN; rpt_vars[n].p.linkmongain = pow(10.0,atof(val) / 20.0); val = (char *) ast_variable_retrieve(cfg,this,"discpgm"); - rpt_vars[n].p.discpgm = val; + rpt_vars[n].p.discpgm = val; val = (char *) ast_variable_retrieve(cfg,this,"connpgm"); rpt_vars[n].p.connpgm = val; val = (char *) ast_variable_retrieve(cfg,this,"mdclog"); @@ -6275,7 +6275,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis val = (char *) ast_variable_retrieve(cfg, this, "holdofftelem"); rpt_vars[n].p.holdofftelem = ast_true(val); val = (char *) ast_variable_retrieve(cfg, this, "beaconing"); - rpt_vars[n].p.beaconing = ast_true(val); + rpt_vars[n].p.beaconing = ast_true(val); val = (char *) ast_variable_retrieve(cfg,this,"rxburstfreq"); if (val) rpt_vars[n].p.rxburstfreq = atoi(val); else rpt_vars[n].p.rxburstfreq = 0; @@ -6410,7 +6410,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis /* retrieve the stanza name for the control states if there is one */ val = (char *) ast_variable_retrieve(cfg,this,"controlstates"); rpt_vars[n].p.csstanzaname = val; - + /* retrieve the stanza name for the scheduler if there is one */ val = (char *) ast_variable_retrieve(cfg,this,"scheduler"); rpt_vars[n].p.skedstanzaname = val; @@ -6459,7 +6459,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis longestnode = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.nodes); - + while(vp){ j = strlen(vp->name); if (j > longestnode) @@ -6468,9 +6468,9 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis } rpt_vars[n].longestnode = longestnode; - + /* - * For this repeater, Determine the length of the longest function + * For this repeater, Determine the length of the longest function */ rpt_vars[n].longestfunc = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.functions); @@ -6481,7 +6481,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis vp = vp->next; } /* - * For this repeater, Determine the length of the longest function + * For this repeater, Determine the length of the longest function */ rpt_vars[n].link_longestfunc = 0; vp = ast_variable_browse(cfg, rpt_vars[n].p.link_functions); @@ -6532,7 +6532,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis rpt_vars[n].macro_longest = j; vp = vp->next; } - + /* Browse for control states */ if(rpt_vars[n].p.csstanzaname) vp = ast_variable_browse(cfg, rpt_vars[n].p.csstanzaname); @@ -6544,8 +6544,8 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis strncpy(s1, vp->value, 255); s1[255] = 0; nukw = finddelim(s1,strs,32); - - for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */ + + for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */ for(j = 0 ; cs_keywords[j] != NULL ; j++){ /* try to match to one in our internal table */ if(!strcmp(strs[k],cs_keywords[j])){ switch(j){ @@ -6555,7 +6555,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis case 1: /* rptdis */ rpt_vars[n].p.s[statenum].txdisable = 1; break; - + case 2: /* apena */ rpt_vars[n].p.s[statenum].autopatchdisable = 0; break; @@ -6567,7 +6567,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis case 4: /* lnkena */ rpt_vars[n].p.s[statenum].linkfundisable = 0; break; - + case 5: /* lnkdis */ rpt_vars[n].p.s[statenum].linkfundisable = 1; break; @@ -6575,7 +6575,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis case 6: /* totena */ rpt_vars[n].p.s[statenum].totdisable = 0; break; - + case 7: /* totdis */ rpt_vars[n].p.s[statenum].totdisable = 1; break; @@ -6636,7 +6636,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis /* * Enable or disable debug output at a given level at the console */ - + static int rpt_do_debug(int fd, int argc, char *argv[]) { int newlevel; @@ -6651,14 +6651,14 @@ static int rpt_do_debug(int fd, int argc, char *argv[]) else ast_cli(fd, "app_rpt Debugging disabled\n"); - debug = newlevel; + debug = newlevel; return RESULT_SUCCESS; } /* * Dump rpt struct debugging onto console */ - + static int rpt_do_dump(int fd, int argc, char *argv[]) { int i; @@ -6692,7 +6692,7 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) int uptime; long long totaltxtime; struct rpt_link *l; - char *listoflinks[MAX_STAT_LINKS]; + char *listoflinks[MAX_STAT_LINKS]; char *lastdtmfcommand,*parrot_ena; char *tot_state, *ider_state, *patch_state; char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena; @@ -6705,8 +6705,8 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) if(argc != 3) return RESULT_SHOWUSAGE; - tot_state = ider_state = - patch_state = reverse_patch_state = + tot_state = ider_state = + patch_state = reverse_patch_state = input_signal = not_applicable; called_number = lastdtmfcommand = NULL; @@ -6903,8 +6903,8 @@ static int rpt_do_stats(int fd, int argc, char *argv[]) if(j % 4 == 3){ ast_cli(fd, "\n"); ast_cli(fd, " : "); - } -\ else{ + } + else{ if((numoflinks - 1) - j > 0) ast_cli(fd, ", "); } @@ -7010,7 +7010,7 @@ static int rpt_do_lstats(int fd, int argc, char *argv[]) connstate = "CONNECTING"; ast_cli(fd, "%-10s%-20s%-12d%-11s%-20s%-20s\n", s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime, connstate); - } + } /* destroy our local link queue */ s = s_head.next; while(s != &s_head){ @@ -7018,7 +7018,7 @@ static int rpt_do_lstats(int fd, int argc, char *argv[]) s = s->next; remque((struct qelem *)t); ast_free(t); - } + } return RESULT_SUCCESS; } } @@ -7150,20 +7150,20 @@ static int rpt_do_xnode(int fd, int argc, char *argv[]) //### GET CONNECTED NODE INFO #################### - // Traverse the list of connected nodes + // Traverse the list of connected nodes __mklinklist(myrpt,NULL,lbuf,0); j = 0; l = myrpt->links.next; while(l && (l != &myrpt->links)){ - if (l->name[0] == '0'){ // Skip '0' nodes + if (l->name[0] == '0'){ // Skip '0' nodes l = l->next; continue; } if((s = (struct rpt_lstat *) ast_malloc(sizeof(struct rpt_lstat))) == NULL){ ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n"); - rpt_mutex_unlock(&myrpt->lock); // UNLOCK + rpt_mutex_unlock(&myrpt->lock); // UNLOCK return RESULT_FAILURE; } memset(s, 0, sizeof(struct rpt_lstat)); @@ -7200,16 +7200,16 @@ static int rpt_do_xnode(int fd, int argc, char *argv[]) connstate = "CONNECTING"; ast_cli(fd, "%-10s%-20s%-12d%-11s%-20s%-20s~", s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime, connstate); - } + } ast_cli(fd,"\n\n"); - // destroy our local link queue + // destroy our local link queue s = s_head.next; while(s != &s_head){ t = s; s = s->next; remque((struct qelem *)t); ast_free(t); - } + } //### GET ALL LINKED NODES INFO #################### /* parse em */ @@ -7323,15 +7323,15 @@ static int rpt_do_local_nodes(int fd, int argc, char *argv[]) for (i=0; i< nrpts; i++) { if (rpt_vars[i].name[0]) - ast_cli(fd, "%s\n", rpt_vars[i].name); + ast_cli(fd, "%s\n", rpt_vars[i].name); } /* for i */ ast_cli(fd,"\n"); return RESULT_SUCCESS; -} +} /* -* reload vars +* reload vars */ static int rpt_do_reload(int fd, int argc, char *argv[]) @@ -7346,7 +7346,7 @@ static int rpt_do_reload(int fd, int argc, char *argv[]) /* * restart app_rpt */ - + static int rpt_do_restart(int fd, int argc, char *argv[]) { int i; @@ -7363,7 +7363,7 @@ int i; /* * send an app_rpt DTMF function from the CLI */ - + static int rpt_do_fun(int fd, int argc, char *argv[]) { int i,busy=0; @@ -7393,7 +7393,7 @@ static int rpt_do_fun(int fd, int argc, char *argv[]) /* * send an Audio File from the CLI */ - + static int rpt_do_playback(int fd, int argc, char *argv[]) { int i; @@ -7403,7 +7403,7 @@ static int rpt_do_playback(int fd, int argc, char *argv[]) for(i = 0; i < nrpts; i++){ if(!strcmp(argv[2], rpt_vars[i].name)){ struct rpt *myrpt = &rpt_vars[i]; - rpt_telemetry(myrpt,PLAYBACK,argv[3]); + rpt_telemetry(myrpt,PLAYBACK,argv[3]); } } return RESULT_SUCCESS; @@ -7439,7 +7439,7 @@ static int rpt_do_sendtext(int fd, int argc, char *argv[]) { if (i > 3) strncat(str," ",sizeof(str) - 1); strncat(str,argv[i],sizeof(str) - 1); - } + } for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7450,7 +7450,7 @@ static int rpt_do_sendtext(int fd, int argc, char *argv[]) /* otherwise, send it to all of em */ while(l != &myrpt->links) { - if (l->name[0] == '0') + if (l->name[0] == '0') { l = l->next; continue; @@ -7483,7 +7483,7 @@ static int rpt_do_page(int fd, int argc, char *argv[]) { if (i > 5) strncat(str," ",sizeof(str) - 1); strncat(str,argv[i],sizeof(str) - 1); - } + } for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7496,7 +7496,7 @@ static int rpt_do_page(int fd, int argc, char *argv[]) telem = myrpt->tele.next; while(telem != &myrpt->tele) { - if (((telem->mode == ID) || (telem->mode == ID1) || + if (((telem->mode == ID) || (telem->mode == ID1) || (telem->mode == IDTALKOVER)) && (!telem->killed)) { if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */ @@ -7528,7 +7528,7 @@ static int rpt_do_sendall(int fd, int argc, char *argv[]) { if (i > 3) strncat(str," ",sizeof(str) - 1); strncat(str,argv[i],sizeof(str) - 1); - } + } for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7539,7 +7539,7 @@ static int rpt_do_sendall(int fd, int argc, char *argv[]) /* otherwise, send it to all of em */ while(l != &myrpt->links) { - if (l->name[0] == '0') + if (l->name[0] == '0') { l = l->next; continue; @@ -7616,7 +7616,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) int thisAction = -1; struct rpt *myrpt = NULL; if (argc != 6) return RESULT_SHOWUSAGE; - + for(i = 0; i < nrpts; i++) { if(!strcmp(argv[2], rpt_vars[i].name)) @@ -7632,7 +7632,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) ast_cli(fd, "Unknown node number %s.\n", argv[2]); return RESULT_FAILURE; } /* if thisRpt < 0 */ - + /* Look up the action */ l = strlen(argv[3]); for(i = 0 ; i < maxActions; i++) @@ -7643,7 +7643,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) break; } /* if !strncasecmp... */ } /* for i */ - + if (thisAction < 0) { ast_cli(fd, "Unknown action name %s.\n", argv[3]); @@ -7673,7 +7673,7 @@ static int rpt_do_cmd(int fd, int argc, char *argv[]) } /* rpt_do_cmd() */ /* -* set a node's main channel variable from the command line +* set a node's main channel variable from the command line */ static int rpt_do_setvar(int fd, int argc, char *argv[]) { @@ -7687,15 +7687,15 @@ static int rpt_do_setvar(int fd, int argc, char *argv[]) { thisRpt = i; break; - } - } + } + } if (thisRpt < 0) { ast_cli(fd, "Unknown node number %s.\n", argv[2]); return RESULT_FAILURE; - } - + } + for (x = 3; x < argc; x++) { name = argv[x]; if ((value = strchr(name, '='))) { @@ -7708,7 +7708,7 @@ static int rpt_do_setvar(int fd, int argc, char *argv[]) } /* -* Display a node's main channel variables from the command line +* Display a node's main channel variables from the command line */ static int rpt_do_showvars(int fd, int argc, char *argv[]) { @@ -7722,14 +7722,14 @@ static int rpt_do_showvars(int fd, int argc, char *argv[]) { thisRpt = i; break; - } - } + } + } if (thisRpt < 0) { ast_cli(fd, "Unknown node number %s.\n", argv[2]); return RESULT_FAILURE; - } + } i = 0; ast_cli(fd,"Variable listing for node %s:\n",argv[2]); ast_channel_lock(rpt_vars[thisRpt].rxchannel); @@ -7743,10 +7743,10 @@ static int rpt_do_showvars(int fd, int argc, char *argv[]) } /* -* Perform frong-in-a-blender calculations (Jacobsen Corollary) +* Perform frong-in-a-blender calculations (Jacobsen Corollary) */ - - + + static int rpt_do_frog(int fd, int argc, char *argv[]) { double warpone = 75139293848.398696166028333356763; @@ -7770,7 +7770,7 @@ static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude))) return res; - + while(chan->generatordata) { if (ast_safe_sleep(chan,1)) return -1; } @@ -7788,7 +7788,7 @@ static int play_tone(struct ast_channel *chan, int freq, int duration, int ampli /* * Hooks for CLI functions */ - + static char *res2cli(int r) { @@ -8121,7 +8121,7 @@ static int morse_cat(char *str, int freq, int duration) if(!str) return -1; - len = strlen(str); + len = strlen(str); p = str+len; if(len){ @@ -8130,7 +8130,7 @@ static int morse_cat(char *str, int freq, int duration) } snprintf(p, 62,"!%d/%d", freq, duration); - + return 0; } @@ -8212,7 +8212,7 @@ static struct morse_bits mbits[] = { int res; int c; char *str = NULL; - + res = 0; @@ -8220,34 +8220,34 @@ static struct morse_bits mbits[] = { if(!str) return -1; str[0] = '\0'; - + /* Approximate the dot time from the speed arg. */ - + dottime = 900/speed; - + /* Establish timing releationships */ - + dashtime = 3 * dottime; intralettertime = dottime; interlettertime = dottime * 4 ; interwordtime = dottime * 7; - + for(;(*string) && (!res); string++){ - + c = *string; - + /* Convert lower case to upper case */ - + if((c >= 'a') && (c <= 'z')) c -= 0x20; - + /* Can't deal with any char code greater than Z, skip it */ - + if(c > 'Z') continue; - + /* If space char, wait the inter word time */ - + if(c == ' '){ if(!res){ if((res = morse_cat(str, 0, interwordtime))) @@ -8255,18 +8255,18 @@ static struct morse_bits mbits[] = { } continue; } - + /* Subtract out control char offset to match our table */ - + c -= 0x20; - + /* Get the character data */ - + len = mbits[c].len; ddcomb = mbits[c].ddcomb; - + /* Send the character */ - + for(; len ; len--){ if(!res) res = morse_cat(str, freq, (ddcomb & 1) ? dashtime : dottime); @@ -8274,14 +8274,14 @@ static struct morse_bits mbits[] = { res = morse_cat(str, 0, intralettertime); ddcomb >>= 1; } - + /* Wait the interletter time */ - + if(!res) res = morse_cat(str, 0, interlettertime - intralettertime); } - + /* Wait for all the characters to be sent */ if(!res){ @@ -8294,8 +8294,8 @@ static struct morse_bits mbits[] = { res = -1; break; } - } - + } + } if(str) ast_free(str); @@ -8314,12 +8314,12 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) int res; int i; int flags; - + res = 0; if(!tonestring) return res; - + p = stringp = ast_strdup(tonestring); for(;tonestring;){ @@ -8336,8 +8336,8 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) ast_free(p); if(!res) res = play_tone_pair(chan, 0, 0, 100, 0); /* This is needed to ensure the last tone segment is timed correctly */ - - if (!res) + + if (!res) res = ast_waitstream(chan, ""); ast_stopstream(chan); @@ -8347,7 +8347,7 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) */ for(i = 0; i < 20 ; i++){ - flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; + flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags); if(flags & DAHDI_IOMUX_WRITEEMPTY) break; @@ -8356,9 +8356,9 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) break; } } - + return res; - + } //# Say a file - streams file to output channel @@ -8368,7 +8368,7 @@ static int sayfile(struct ast_channel *mychannel,char *fname) int res; res = ast_streamfile(mychannel, fname, mychannel->language); - if (!res) + if (!res) res = ast_waitstream(mychannel, ""); else ast_log(LOG_WARNING, "ast_streamfile %s failed on %s\n", fname, mychannel->name); @@ -8447,7 +8447,7 @@ char *val,fname[300],str[100]; } if (name[0] != '3') return res; if (myrpt->p.eannmode < 2) return res; - sprintf(str,"%d",atoi(name + 1)); + sprintf(str,"%d",atoi(name + 1)); if (elink_db_get(str,'n',NULL,fname,NULL) < 1) return res; res = sayphoneticstr(mychannel,fname); return res; @@ -8457,37 +8457,37 @@ static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry) { int res; char c; - + int morsespeed; int morsefreq; int morseampl; int morseidfreq; int morseidampl; - + res = 0; - + morsespeed = retrieve_astcfgint(myrpt, myrpt->p.morse, "speed", 5, 20, 20); morsefreq = retrieve_astcfgint(myrpt, myrpt->p.morse, "frequency", 300, 3000, 800); morseampl = retrieve_astcfgint(myrpt, myrpt->p.morse, "amplitude", 200, 8192, 4096); morseidampl = retrieve_astcfgint(myrpt, myrpt->p.morse, "idamplitude", 200, 8192, 2048); morseidfreq = retrieve_astcfgint(myrpt, myrpt->p.morse, "idfrequency", 300, 3000, 330); - + /* Is it a file, or a tone sequence? */ - + if(entry[0] == '|'){ c = entry[1]; if((c >= 'a')&&(c <= 'z')) c -= 0x20; - + switch(c){ case 'I': /* Morse ID */ res = send_morse(chan, entry + 2, morsespeed, morseidfreq, morseidampl); break; - + case 'M': /* Morse Message */ res = send_morse(chan, entry + 2, morsespeed, morsefreq, morseampl); break; - + case 'T': /* Tone sequence */ res = send_tone_telemetry(chan, entry + 2); break; @@ -8508,7 +8508,7 @@ static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry) static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, char *name) { - + int res; int i; char *entry; @@ -8517,8 +8517,8 @@ static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, entry = NULL; entry = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.telemetry, name); - - /* Try to look up the telemetry name */ + + /* Try to look up the telemetry name */ if(!entry){ /* Telemetry name wasn't found in the config file, use the default */ @@ -8527,7 +8527,7 @@ static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, entry = tele_defs[i].value; } } - if(entry){ + if(entry){ if(strlen(entry)) if (chan) telem_any(myrpt,chan, entry); } @@ -8546,17 +8546,17 @@ static int get_wait_interval(struct rpt *myrpt, int type) int interval; char *wait_times; char *wait_times_save; - + wait_times_save = NULL; wait_times = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "wait_times"); - + if(wait_times){ wait_times_save = ast_strdup(wait_times); if(!wait_times_save) return 0; - + } - + switch(type){ case DLY_TELEM: if(wait_times) @@ -8564,42 +8564,42 @@ static int get_wait_interval(struct rpt *myrpt, int type) else interval = 1000; break; - + case DLY_ID: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "idwait",250,5000,500); else interval = 500; break; - + case DLY_UNKEY: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "unkeywait",50,5000,1000); else interval = 1000; break; - + case DLY_LINKUNKEY: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "linkunkeywait",500,5000,1000); else interval = 1000; break; - + case DLY_CALLTERM: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "calltermwait",500,5000,1500); else interval = 1500; break; - + case DLY_COMP: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "compwait",500,5000,200); else interval = 200; break; - + case DLY_PARROT: if(wait_times) interval = retrieve_astcfgint(myrpt,wait_times_save, "parrotwait",500,5000,200); @@ -8619,18 +8619,18 @@ static int get_wait_interval(struct rpt *myrpt, int type) if(wait_times_save) ast_free(wait_times_save); return interval; -} +} /* -* Wait a configurable interval of time +* Wait a configurable interval of time */ static int wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan) { int interval; do { - while (myrpt->p.holdofftelem && + while (myrpt->p.holdofftelem && (myrpt->keyed || (myrpt->remrx && (type != DLY_ID)))) { if (ast_safe_sleep(chan,100) < 0) return -1; @@ -8655,18 +8655,18 @@ static int split_freq(char *mhz, char *decimals, char *freq); //### BEGIN TELEMETRY CODE SECTION /* * Routine to process various telemetry commands that are in the myrpt structure - * Used extensively when links and build/torn down and other events are processed by the - * rpt_master threads. + * Used extensively when links and build/torn down and other events are processed by the + * rpt_master threads. */ - + /* * * WARNING: YOU ARE NOW HEADED INTO ONE GIANT MAZE OF SWITCH STATEMENTS THAT DO MOST OF THE WORK FOR - * APP_RPT. THE MAJORITY OF THIS IS VERY UNDOCUMENTED CODE AND CAN BE VERY HARD TO READ. + * APP_RPT. THE MAJORITY OF THIS IS VERY UNDOCUMENTED CODE AND CAN BE VERY HARD TO READ. * IT IS ALSO PROBABLY THE MOST ERROR PRONE PART OF THE CODE, ESPECIALLY THE PORTIONS * RELATED TO THREADED OPERATIONS. */ - + static void handle_varcmd_tele(struct rpt *myrpt,struct ast_channel *mychannel,char *varcmd) { char *strs[100],*p,buf[100],c; @@ -8767,20 +8767,20 @@ struct tm localtm; if (!strcasecmp(strs[0],"CONNFAIL")) { - if (n < 2) return; + if (n < 2) return; if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) return; res = saynode(myrpt,mychannel,strs[1]); - if (!res) + if (!res) sayfile(mychannel, "rpt/connection_failed"); return; } if (!strcasecmp(strs[0],"REMDISC")) { - if (n < 2) return; + if (n < 2) return; if (wait_interval(myrpt, DLY_TELEM, mychannel) == -1) return; res = saynode(myrpt,mychannel,strs[1]); - if (!res) + if (!res) sayfile(mychannel, "rpt/remote_disc"); return; } diff --git a/configs/cdr.conf b/configs/cdr.conf new file mode 100644 index 00000000..416e4b3b --- /dev/null +++ b/configs/cdr.conf @@ -0,0 +1,11 @@ +[general] +enable = yes +loggingsafeshutdown = yes + +[csv] +usegmtime = yes +loguniqueid = yes +logusrfield = yes + +; Edit /etc/asterisk/modules.conf to enable +; load=cdr_csv.so From 37baf45ae01e5f8cf3247bf949b0e6b64d1f1685 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Thu, 28 Dec 2017 10:12:00 -0500 Subject: [PATCH 26/96] Replace unneeded command --- asterisk/apps/app_rpt.c | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index e638228a..7e5f233a 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -1874,7 +1874,7 @@ static int rpt_do_fun1(int fd, int argc, char *argv[]); static int rpt_do_cmd(int fd, int argc, char *argv[]); static int rpt_do_setvar(int fd, int argc, char *argv[]); static int rpt_do_showvars(int fd, int argc, char *argv[]); -static int rpt_do_frog(int fd, int argc, char *argv[]); +static int rpt_do_asl(int fd, int argc, char *argv[]); static int rpt_do_page(int fd, int argc, char *argv[]); static char debug_usage[] = @@ -1947,9 +1947,9 @@ static char showvars_usage[] = "Usage: rpt showvars \n" " Display all the Asterisk channel variables for a node.\n"; -static char frog_usage[] = -"Usage: frog [warp_factor]\n" -" Performs frog-in-a-blender calculations (Jacobsen Corollary)\n"; +static char asl_usage[] = +"Usage: asl [Unused value]\n" +" Do ASL Stuff\n"; static char page_usage[] = "Usage: rpt page <[ANT]Text....>\n" @@ -2032,9 +2032,9 @@ static struct ast_cli_entry cli_showvars = { { "rpt", "showvars" }, rpt_do_showvars, "Display Asterisk channel variables", showvars_usage }; -static struct ast_cli_entry cli_frog = - { { "frog" }, rpt_do_frog, - "Perform frog-in-a-blender calculations", frog_usage }; +static struct ast_cli_entry cli_asl = + { { "asl" }, rpt_do_asl, + "Do ASL stuff", asl_usage }; static struct ast_cli_entry cli_page = { { "rpt", "page" }, rpt_do_page, @@ -7743,11 +7743,11 @@ static int rpt_do_showvars(int fd, int argc, char *argv[]) } /* -* Perform frong-in-a-blender calculations (Jacobsen Corollary) +* Do ASL Stuff */ - - -static int rpt_do_frog(int fd, int argc, char *argv[]) + + +static int rpt_do_asl(int fd, int argc, char *argv[]) { double warpone = 75139293848.398696166028333356763; double warpfactor = 1.0; @@ -7756,10 +7756,10 @@ static int rpt_do_frog(int fd, int argc, char *argv[]) if ((argc > 1) && (sscanf(argv[1],"%lf",&warpfactor) != 1)) return RESULT_SHOWUSAGE; - ast_cli(fd, "A frog in a blender with a base diameter of 3 inches going\n"); - ast_cli(fd, "%lf RPM will be travelling at warp factor %lf,\n", + ast_cli(fd, "This command doe not do anything\n"); + ast_cli(fd, "73 Steve N4IRS\n", warpfactor * warpfactor * warpfactor * warpone,warpfactor); - ast_cli(fd,"based upon the Jacobsen Frog Corollary.\n"); + ast_cli(fd,"Replace a command that does nothing but waste space. RIP WB6NIL\n"); return RESULT_SUCCESS; } @@ -8014,18 +8014,18 @@ static char *handle_cli_showvars(struct ast_cli_entry *e, return res2cli(rpt_do_showvars(a->fd,a->argc,a->argv)); } -static char *handle_cli_frog(struct ast_cli_entry *e, +static char *handle_cli_asl(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { switch (cmd) { case CLI_INIT: - e->command = "frog"; - e->usage = frog_usage; + e->command = "asl"; + e->usage = asl_usage; return NULL; case CLI_GENERATE: return NULL; } - return res2cli(rpt_do_frog(a->fd,a->argc,a->argv)); + return res2cli(rpt_do_asl(a->fd,a->argc,a->argv)); } static char *handle_cli_localplay(struct ast_cli_entry *e, @@ -8103,7 +8103,7 @@ static struct ast_cli_entry rpt_cli[] = { AST_CLI_DEFINE(handle_cli_localplay,"Playback an audio file (local)"), AST_CLI_DEFINE(handle_cli_sendall,"Send a Text message to all connected nodes"), AST_CLI_DEFINE(handle_cli_sendtext,"Send a Text message to a specified nodes"), - AST_CLI_DEFINE(handle_cli_frog,"Perform frog-in-a-blender calculations"), + AST_CLI_DEFINE(handle_cli_asl,"Do ASL stuff"), AST_CLI_DEFINE(handle_cli_page,"Send a page to a user on a node") }; @@ -25277,7 +25277,7 @@ static int unload_module(void) ast_cli_unregister(&cli_fun1); ast_cli_unregister(&cli_setvar); ast_cli_unregister(&cli_showvars); - ast_cli_unregister(&cli_frog); + ast_cli_unregister(&cli_asl); ast_cli_unregister(&cli_page); res |= ast_cli_unregister(&cli_cmd); #endif @@ -25355,7 +25355,7 @@ static int load_module(void) ast_cli_register(&cli_fun1); ast_cli_register(&cli_setvar); ast_cli_register(&cli_showvars); - ast_cli_register(&cli_frog); + ast_cli_register(&cli_asl); ast_cli_register(&cli_page); res = ast_cli_register(&cli_cmd); #endif From 76a437adb95fccc16e9be248ccd20f03b9511880 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Fri, 12 Jan 2018 15:09:04 +0000 Subject: [PATCH 27/96] Update file versions --- asterisk/apps/app_rpt.c | 8 +++++++- asterisk/channels/chan_beagle.c | 8 +++++++- asterisk/channels/chan_echolink.c | 8 ++++++++ asterisk/channels/chan_pi.c | 8 +++++++- asterisk/channels/chan_rtpdir.c | 8 +++++++- asterisk/channels/chan_simpleusb.c | 8 +++++++- asterisk/channels/chan_tlb.c | 8 ++++++++ asterisk/channels/chan_usbradio.c | 8 +++++++- asterisk/channels/chan_usrp.c | 8 +++++++- asterisk/channels/chan_voter.c | 9 +++++++++ 10 files changed, 74 insertions(+), 7 deletions(-) diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index 7e5f233a..759808d8 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -523,7 +523,13 @@ enum{DAQ_TYPE_UCHAMELEON}; #define START_DELAY 2 #endif -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 122717 $") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_beagle.c b/asterisk/channels/chan_beagle.c index 77e03884..7bf2ff40 100644 --- a/asterisk/channels/chan_beagle.c +++ b/asterisk/channels/chan_beagle.c @@ -33,7 +33,13 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_echolink.c b/asterisk/channels/chan_echolink.c index 2513e2cb..916c91fe 100644 --- a/asterisk/channels/chan_echolink.c +++ b/asterisk/channels/chan_echolink.c @@ -90,6 +90,14 @@ do not use 127.0.0.1 #include "asterisk.h" +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") + #include #include #include diff --git a/asterisk/channels/chan_pi.c b/asterisk/channels/chan_pi.c index 7297de01..e77f9180 100644 --- a/asterisk/channels/chan_pi.c +++ b/asterisk/channels/chan_pi.c @@ -35,7 +35,13 @@ #include "asterisk.h" #include "../astver.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 535 $") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_rtpdir.c b/asterisk/channels/chan_rtpdir.c index ff982ee0..1c3f74d5 100644 --- a/asterisk/channels/chan_rtpdir.c +++ b/asterisk/channels/chan_rtpdir.c @@ -47,7 +47,13 @@ MYPORT (optional) is the UDP socket that Asterisk listens on for this channel #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision$") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_simpleusb.c b/asterisk/channels/chan_simpleusb.c index c2261c78..85a3bed7 100644 --- a/asterisk/channels/chan_simpleusb.c +++ b/asterisk/channels/chan_simpleusb.c @@ -33,7 +33,13 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 537 $") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_tlb.c b/asterisk/channels/chan_tlb.c index fa469d25..6be5297d 100644 --- a/asterisk/channels/chan_tlb.c +++ b/asterisk/channels/chan_tlb.c @@ -55,6 +55,14 @@ tlb.conf file. #include "asterisk.h" +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") + #include #include #include diff --git a/asterisk/channels/chan_usbradio.c b/asterisk/channels/chan_usbradio.c index a36fbac8..24f58d12 100644 --- a/asterisk/channels/chan_usbradio.c +++ b/asterisk/channels/chan_usbradio.c @@ -39,7 +39,13 @@ #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 536 $") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_usrp.c b/asterisk/channels/chan_usrp.c index 104cda52..0228c46a 100644 --- a/asterisk/channels/chan_usrp.c +++ b/asterisk/channels/chan_usrp.c @@ -44,7 +44,13 @@ MYPORT (optional) is the UDP socket that Asterisk listens on for this channel #include "asterisk.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1 $") +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include #include diff --git a/asterisk/channels/chan_voter.c b/asterisk/channels/chan_voter.c index 143ae6ad..1675d2d9 100644 --- a/asterisk/channels/chan_voter.c +++ b/asterisk/channels/chan_voter.c @@ -208,6 +208,15 @@ Obviously, it is not valid to use *ANY* of the duplex=3 modes in a voted and/or #include "asterisk.h" #include "../astver.h" +/* + * Please change this revision number when you make a edit + * use the simple format MMDDYY +*/ + +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +// ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") + + #include #include #include From cc730596d762325726fe9435ac7b341e906432b3 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Fri, 12 Jan 2018 16:43:24 +0000 Subject: [PATCH 28/96] Enable MDC support --- asterisk/apps/app_rpt.c | 26 ++- asterisk/apps/mdc_decode.c | 430 +++++++++++++++++++++++++++++++++++++ asterisk/apps/mdc_decode.h | 147 +++++++++++++ asterisk/apps/mdc_encode.c | 396 ++++++++++++++++++++++++++++++++++ asterisk/apps/mdc_encode.h | 132 ++++++++++++ 5 files changed, 1126 insertions(+), 5 deletions(-) create mode 100644 asterisk/apps/mdc_decode.c create mode 100644 asterisk/apps/mdc_decode.h create mode 100644 asterisk/apps/mdc_encode.c create mode 100644 asterisk/apps/mdc_encode.h diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index 759808d8..08a2e565 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -44,9 +44,9 @@ */ /*! \file * - * \brief Radio Repeater / Remote Base program - * version 0.328 07/13/2017 - * + * \brief Radio Repeater / Remote Base program + * version 0.329 01/12/2018 + * * \author Jim Dixon, WB6NIL * * \note Serious contributions by Steve RoDgers, WA6ZFT @@ -582,11 +582,11 @@ struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS }; /* Un-comment the following to include support decoding of MDC-1200 digital tone signalling protocol (using KA6SQG's GPL'ed implementation) */ -/* #include "mdc_decode.c" */ +#include "mdc_decode.c" /* Un-comment the following to include support encoding of MDC-1200 digital tone signalling protocol (using KA6SQG's GPL'ed implementation) */ -/* #include "mdc_encode.c" */ +#include "mdc_encode.c" /* Un-comment the following to include support for notch filters in the rx audio stream (using Tony Fisher's mknotch (mkfilter) implementation) */ @@ -20780,11 +20780,19 @@ char tmpstr[300],lstr[MAXLINKLIST],lat[100],lon[100],elev[100]; mdc1200_send(myrpt,ustr); mdc1200_cmd(myrpt,ustr); } + /* if for Stun ACK W9CR */ + if ((op == 0x0b) && (arg == 0x00)) + { + myrpt->lastunit = unitID; + sprintf(ustr,"STUN ACK %04X",unitID); + } /* if for STS (status) */ if (op == 0x46) { myrpt->lastunit = unitID; sprintf(ustr,"S%04X-%X",unitID,arg & 0xf); + + #ifdef _MDC_ENCODE_H_ mdc1200_ack_status(myrpt,unitID); #endif @@ -25100,6 +25108,14 @@ static void * mdcgen_alloc(struct ast_channel *chan, void *params) { mdc_encoder_set_packet(ps->mdc,0x23,0,p->UnitID); } + else if (p->type[0] == 'K') // kill a unit W9CR + { + mdc_encoder_set_packet(ps->mdc,0x22b,0x00,p->UnitID); + } + else if (p->type[0] == 'U') // UnKill a unit W9CR + { + mdc_encoder_set_packet(ps->mdc,0x2b,0x0c,p->UnitID); + } else { ast_log(LOG_ERROR, "Dont know MDC encode type '%s'\n", p->type); diff --git a/asterisk/apps/mdc_decode.c b/asterisk/apps/mdc_decode.c new file mode 100644 index 00000000..787ee6bd --- /dev/null +++ b/asterisk/apps/mdc_decode.c @@ -0,0 +1,430 @@ +/*- + * mdc_decode.c + * Decodes a specific format of 1200 BPS MSK data burst + * from input audio samples. + * + * 4 October 2010 - fixed for 64-bit + * + * Author: Matthew Kaufman (matthew@eeph.com) + * + * Copyright (c) 2005, 2010 Matthew Kaufman All rights reserved. + * + * This file is part of Matthew Kaufman's MDC Encoder/Decoder Library + * + * The MDC Encoder/Decoder Library is free software; you can + * redistribute it and/or modify it under the terms of version 2 of + * the GNU General Public License as published by the Free Software + * Foundation. + * + * If you cannot comply with the terms of this license, contact + * the author for alternative license arrangements or do not use + * or redistribute this software. + * + * The MDC Encoder/Decoder Library is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + * or see http://www.gnu.org/copyleft/gpl.html + * +-*/ + +#include +#include "mdc_decode.h" + +mdc_decoder_t * mdc_decoder_new(int sampleRate) +{ + mdc_decoder_t *decoder; + int i; + + decoder = (mdc_decoder_t *)malloc(sizeof(mdc_decoder_t)); + if(!decoder) + return (mdc_decoder_t *) 0L; + + decoder->hyst = 3; + decoder->incr = (1200.0 * TWOPI) / ((double)sampleRate); + decoder->good = 0; + decoder->level = 0; + + + for(i=0; ith[i] = 0.0 + ( ((double)i) * (TWOPI/(double)MDC_ND)); + decoder->zc[i] = 0; + decoder->xorb[i] = 0; + decoder->shstate[i] = 0; + decoder->shcount[i] = 0; + } + + return decoder; +} + +static void _clearbits(mdc_decoder_t *decoder, int x) +{ + int i; + for(i=0; i<112; i++) + decoder->bits[x][i] = 0; +} + +static unsigned int _flip(unsigned int crc, int bitnum) +{ + unsigned int i, j=1, crcout=0; + + for (i=1<<(bitnum-1); i; i>>=1) + { + if (crc & i) + crcout |= j; + j<<= 1; + } + return (crcout); +} + +static unsigned int docrc(unsigned char* p, int len) { + + int i, j; + unsigned int c; + unsigned int bit; + unsigned int crc = 0x0000; + + for (i=0; i>=1) + { + bit = crc & 0x8000; + crc<<= 1; + if (c & j) + bit^= 0x8000; + if (bit) + crc^= 0x1021; + } + } + + crc = _flip(crc, 16); + crc ^= 0xffff; + crc &= 0xFFFF;; + + return(crc); +} + + +static void _procbits(mdc_decoder_t *decoder, int x) +{ + int lbits[112]; + int lbc = 0; + int i, j, k; + unsigned char data[14]; + unsigned int ccrc; + unsigned int rcrc; + + for(i=0; i<16; i++) + { + for(j=0; j<7; j++) + { + k = (j*16) + i; + lbits[lbc] = decoder->bits[x][k]; + ++lbc; + } + } + + for(i=0; i<14; i++) + { + data[i] = 0; + for(j=0; j<8; j++) + { + k = (i*8)+j; + + if(lbits[k]) + data[i] |= 1<shstate[x] == 2) + { + decoder->extra0 = data[0]; + decoder->extra1 = data[1]; + decoder->extra2 = data[2]; + decoder->extra3 = data[3]; + + for(k=0; kshstate[k] = 0; + + decoder->good = 2; + } + else + { + decoder->good = 1; + decoder->op = data[0]; + decoder->arg = data[1]; + decoder->unitID = (data[2] << 8) | data[3]; + decoder->crc = (data[4] << 8) | data[5]; + + for(k=0; kshstate[k] = 0; + + switch(data[0]) + { + /* list of opcode that mean 'double packet' */ + case 0x35: + case 0x55: + decoder->good = 0; + decoder->shstate[x] = 2; + decoder->shcount[x] = 0; + _clearbits(decoder, x); + break; + default: + break; + } + } + + } + else + { +#if 0 + printf("bad: "); + for(i=0; i<14; i++) + printf("%02x ",data[i]); + printf("%x\n",ccrc); +#endif + + decoder->shstate[x] = 0; + } +} + + +static int _onebits(unsigned int n) +{ + int i=0; + while(n) + { + ++i; + n &= (n-1); + } + return i; +} + +static void _shiftin(mdc_decoder_t *decoder, int x) +{ + int bit = decoder->xorb[x]; + int gcount; + + switch(decoder->shstate[x]) + { + case 0: + decoder->synchigh[x] <<= 1; + if(decoder->synclow[x] & 0x80000000) + decoder->synchigh[x] |= 1; + decoder->synclow[x] <<= 1; + if(bit) + decoder->synclow[x] |= 1; + + gcount = _onebits(0x000000ff & (0x00000007 ^ decoder->synchigh[x])); + gcount += _onebits(0x092a446f ^ decoder->synclow[x]); + + if(gcount <= MDC_GDTHRESH) + { + // printf("sync %d %x %x \n",gcount,decoder->synchigh[x], decoder->synclow[x]); + decoder->shstate[x] = 1; + decoder->shcount[x] = 0; + _clearbits(decoder, x); + } + else if(gcount >= (40 - MDC_GDTHRESH)) + { + // printf("isync %d\n",gcount); + decoder->shstate[x] = 1; + decoder->shcount[x] = 0; + decoder->xorb[x] = !(decoder->xorb[x]); + _clearbits(decoder, x); + } + return; + case 1: + case 2: + decoder->bits[x][decoder->shcount[x]] = bit; + decoder->shcount[x]++; + if(decoder->shcount[x] > 111) + { + _procbits(decoder, x); + } + return; + + default: + return; + } +} + +static void _zcproc(mdc_decoder_t *decoder, int x) +{ + switch(decoder->zc[x]) + { + case 2: + case 4: + break; + case 3: + decoder->xorb[x] = !(decoder->xorb[x]); + break; + default: + return; + } + + _shiftin(decoder, x); +} + +int mdc_decoder_process_samples(mdc_decoder_t *decoder, + unsigned char *samples, + int numSamples) +{ + int i; + int j; + int k; + int v; + int d; + unsigned char s; + + if(!decoder) + return -1; + + for(i = 0; ilastv; + decoder->lastv = v; + + if(decoder->level == 0) + { + if(d > decoder->hyst) + { + for(k=0; kzc[k]++; + decoder->level = 1; + } + } + else + { + if(d < (-1 * decoder->hyst)) + { + for(k=0; kzc[k]++; + decoder->level = 0; + } + } +#else + if(decoder->level == 0) + { + if(s > 128 + decoder->hyst) + { + for(k=0; kzc[k]++; + decoder->level = 1; + } + } + else + { + if(s < 127 - decoder->hyst) + { + for(k=0; kzc[k]++; + decoder->level = 0; + } + } +#endif + + + for(j=0; jth[j] += decoder->incr; + if(decoder->th[j] >= TWOPI) + { + _zcproc(decoder, j); + decoder->th[j] -= TWOPI; + decoder->zc[j] = 0; + } + } + } + + if(decoder->good) + return decoder->good; + + return 0; +} + +int mdc_decoder_get_packet(mdc_decoder_t *decoder, + unsigned char *op, + unsigned char *arg, + unsigned short *unitID) +{ + if(!decoder) + return -1; + + if(decoder->good != 1) + return -1; + + if(op) + *op = decoder->op; + + if(arg) + *arg = decoder->arg; + + if(unitID) + *unitID = decoder->unitID; + + decoder->good = 0; + + return 0; +} + +int mdc_decoder_get_double_packet(mdc_decoder_t *decoder, + unsigned char *op, + unsigned char *arg, + unsigned short *unitID, + unsigned char *extra0, + unsigned char *extra1, + unsigned char *extra2, + unsigned char *extra3) +{ + if(!decoder) + return -1; + + if(decoder->good != 2) + return -1; + + if(op) + *op = decoder->op; + + if(arg) + *arg = decoder->arg; + + if(unitID) + *unitID = decoder->unitID; + + if(extra0) + *extra0 = decoder->extra0; + if(extra1) + *extra1 = decoder->extra1; + if(extra2) + *extra2 = decoder->extra2; + if(extra3) + *extra3 = decoder->extra3; + + decoder->good = 0; + + return 0; +} + diff --git a/asterisk/apps/mdc_decode.h b/asterisk/apps/mdc_decode.h new file mode 100644 index 00000000..7ec55b76 --- /dev/null +++ b/asterisk/apps/mdc_decode.h @@ -0,0 +1,147 @@ +/*- + * mdc_decode.h + * header for mdc_decode.c + * + * 4 October 2010 - fixed for 64-bit + * + * Author: Matthew Kaufman (matthew@eeph.com) + * + * Copyright (c) 2005, 2010 Matthew Kaufman All rights reserved. + * + * This file is part of Matthew Kaufman's MDC Encoder/Decoder Library + * + * The MDC Encoder/Decoder Library is free software; you can + * redistribute it and/or modify it under the terms of version 2 of + * the GNU General Public License as published by the Free Software + * Foundation. + * + * If you cannot comply with the terms of this license, contact + * the author for alternative license arrangements or do not use + * or redistribute this software. + * + * The MDC Encoder/Decoder Library is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + * or see http://www.gnu.org/copyleft/gpl.html + * +-*/ + +#ifndef _MDC_DECODE_H_ +#define _MDC_DECODE_H_ + +#ifndef TWOPI +#define TWOPI (2.0 * 3.1415926535) +#endif + +#define MDC_ND 4 // number of decoders +#define MDC_GDTHRESH 5 // "good bits" threshold + +#define DIFFERENTIATOR + +typedef struct { + int hyst; + double incr; + double th[MDC_ND]; + int level; + int lastv; + int zc[MDC_ND]; + int xorb[MDC_ND]; + unsigned int synclow[MDC_ND]; + unsigned int synchigh[MDC_ND]; + int shstate[MDC_ND]; + int shcount[MDC_ND]; + int bits[MDC_ND][112]; + int good; + unsigned char op; + unsigned char arg; + unsigned short unitID; + unsigned short crc; + unsigned char extra0; + unsigned char extra1; + unsigned char extra2; + unsigned char extra3; +} mdc_decoder_t; + + +/* + mdc_decoder_new + create a new mdc_decoder object + + parameters: int sampleRate - the sampling rate in Hz + + returns: an mdc_decoder object or null if failure + +*/ +mdc_decoder_t * mdc_decoder_new(int sampleRate); + +/* + mdc_decoder_process_samples + process incoming samples using an mdc_decoder object + (currently limited to 8-bit unsigned samples) + + parameters: mdc_decoder_t *decoder - pointer to the decoder object + unsigned char *samples - pointer to 8-bit unsigned samples + int numSamples - count of the number of samples in buffer + + returns: 0 if more samples are needed + -1 if an error occurs + 1 if a decoded single packet is available to read + 2 if a decoded double packet is available to read +*/ + +int mdc_decoder_process_samples(mdc_decoder_t *decoder, + unsigned char *samples, + int numSamples); + + +/* + mdc_decoder_get_packet + retrieve last successfully decoded data packet from decoder object + + parameters: mdc_decoder_t *decoder - pointer to the decoder object + unsigned char *op - pointer to where to store "opcode" + unsigned char *arg - pointer to where to store "argument" + unsigned short *unitID - pointer to where to store "unit ID" + + returns: -1 if error, 0 otherwise +*/ + +int mdc_decoder_get_packet(mdc_decoder_t *decoder, + unsigned char *op, + unsigned char *arg, + unsigned short *unitID); + +/* + mdc_decoder_get_double_packet + retrieve last successfully decoded double-length packet from decoder object + + parameters: mdc_decoder_t *decoder - pointer to the decoder object + unsigned char *op - pointer to where to store "opcode" + unsigned char *arg - pointer to where to store "argument" + unsigned short *unitID - pointer to where to store "unit ID" + unsigned char *extra0 - pointer to where to store 1st extra byte + unsigned char *extra1 - pointer to where to store 2nd extra byte + unsigned char *extra2 - pointer to where to store 3rd extra byte + unsigned char *extra3 - pointer to where to store 4th extra byte + + returns: -1 if error, 0 otherwise +*/ + +int mdc_decoder_get_double_packet(mdc_decoder_t *decoder, + unsigned char *op, + unsigned char *arg, + unsigned short *unitID, + unsigned char *extra0, + unsigned char *extra1, + unsigned char *extra2, + unsigned char *extra3); + + +#endif diff --git a/asterisk/apps/mdc_encode.c b/asterisk/apps/mdc_encode.c new file mode 100644 index 00000000..6ba6e3ac --- /dev/null +++ b/asterisk/apps/mdc_encode.c @@ -0,0 +1,396 @@ +/*- + * mdc_encode.c + * Encodes a specific format from 1200 BPS MSK data burst + * to output audio samples. + * + * Author: Matthew Kaufman (matthew@eeph.com) + * + * Copyright (c) 2005 Matthew Kaufman All rights reserved. + * + * This file is part of Matthew Kaufman's MDC Encoder/Decoder Library + * + * The MDC Encoder/Decoder Library is free software; you can + * redistribute it and/or modify it under the terms of version 2 of + * the GNU General Public License as published by the Free Software + * Foundation. + * + * If you cannot comply with the terms of this license, contact + * the author for alternative license arrangements or do not use + * or redistribute this software. + * + * The MDC Encoder/Decoder Library is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + * or see http://www.gnu.org/copyleft/gpl.html + * +-*/ + +#include +#include "mdc_encode.h" + +static unsigned char sin8[] = { + 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, + 163, 166, 169, 172, 175, 178, 180, 183, 186, 189, 191, 194, + 196, 199, 201, 204, 206, 209, 211, 213, 215, 218, 220, 222, + 224, 226, 227, 229, 231, 233, 234, 236, 237, 239, 240, 241, + 242, 244, 245, 246, 247, 247, 248, 249, 250, 250, 251, 251, + 251, 252, 252, 252, 252, 252, 252, 252, 251, 251, 251, 250, + 250, 249, 248, 247, 247, 246, 245, 244, 242, 241, 240, 239, + 237, 236, 234, 233, 231, 229, 227, 226, 224, 222, 220, 218, + 215, 213, 211, 209, 206, 204, 201, 199, 196, 194, 191, 189, + 186, 183, 180, 178, 175, 172, 169, 166, 163, 160, 157, 154, + 151, 148, 145, 142, 139, 136, 133, 130, 127, 124, 121, 118, + 115, 112, 109, 106, 103, 100, 97, 94, 91, 88, 85, 82, + 79, 76, 74, 71, 68, 65, 63, 60, 58, 55, 53, 50, + 48, 45, 43, 41, 39, 36, 34, 32, 30, 28, 27, 25, + 23, 21, 20, 18, 17, 15, 14, 13, 12, 10, 9, 8, + 7, 7, 6, 5, 4, 4, 3, 3, 3, 2, 2, 2, + 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 7, + 7, 8, 9, 10, 12, 13, 14, 15, 17, 18, 20, 21, + 23, 25, 27, 28, 30, 32, 34, 36, 39, 41, 43, 45, + 48, 50, 53, 55, 58, 60, 63, 65, 68, 71, 74, 76, + 79, 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, + 115, 118, 121, 124 }; + +#if 0 +static short sin16[] = { + 0, 784, 1569, 2352, 3134, 3914, 4692, 5467, + 6239, 7007, 7770, 8529, 9283, 10031, 10774, 11509, + 12238, 12960, 13673, 14379, 15075, 15763, 16441, 17109, + 17767, 18414, 19051, 19675, 20288, 20889, 21477, 22052, + 22613, 23162, 23696, 24216, 24721, 25212, 25687, 26147, + 26591, 27019, 27431, 27826, 28204, 28566, 28910, 29237, + 29546, 29838, 30111, 30366, 30603, 30822, 31022, 31203, + 31366, 31510, 31634, 31740, 31827, 31894, 31942, 31971, + 31981, 31971, 31942, 31894, 31827, 31740, 31634, 31510, + 31366, 31203, 31022, 30822, 30603, 30366, 30111, 29838, + 29546, 29237, 28910, 28566, 28204, 27826, 27431, 27019, + 26591, 26147, 25687, 25212, 24721, 24216, 23696, 23162, + 22613, 22052, 21477, 20889, 20288, 19675, 19051, 18414, + 17767, 17109, 16441, 15763, 15075, 14379, 13673, 12960, + 12238, 11509, 10774, 10031, 9283, 8529, 7770, 7007, + 6239, 5467, 4692, 3914, 3134, 2352, 1569, 784, + 0, -784, -1569, -2352, -3134, -3914, -4692, -5467, + -6239, -7007, -7770, -8529, -9283, -10031, -10774, -11509, + -12238, -12960, -13673, -14379, -15075, -15763, -16441, -17109, + -17767, -18414, -19051, -19675, -20288, -20889, -21477, -22052, + -22613, -23162, -23696, -24216, -24721, -25212, -25687, -26147, + -26591, -27019, -27431, -27826, -28204, -28566, -28910, -29237, + -29546, -29838, -30111, -30366, -30603, -30822, -31022, -31203, + -31366, -31510, -31634, -31740, -31827, -31894, -31942, -31971, + -31981, -31971, -31942, -31894, -31827, -31740, -31634, -31510, + -31366, -31203, -31022, -30822, -30603, -30366, -30111, -29838, + -29546, -29237, -28910, -28566, -28204, -27826, -27431, -27019, + -26591, -26147, -25687, -25212, -24721, -24216, -23696, -23162, + -22613, -22052, -21477, -20889, -20288, -19675, -19051, -18414, + -17767, -17109, -16441, -15763, -15075, -14379, -13673, -12960, + -12238, -11509, -10774, -10031, -9283, -8529, -7770, -7007, + -6239, -5467, -4692, -3914, -3134, -2352, -1569, -784 }; +#endif + +mdc_encoder_t * mdc_encoder_new(int sampleRate) +{ + mdc_encoder_t *encoder; + + encoder = (mdc_encoder_t *)malloc(sizeof(mdc_encoder_t)); + if(!encoder) + return (mdc_encoder_t *) 0L; + + encoder->incr = (1200.0 * TWOPI) / ((double)sampleRate); + encoder->loaded = 0; + + return encoder; +} + + +#ifndef _MDC_DECODE_H_ + +static unsigned long _flip(unsigned long crc, int bitnum) +{ + unsigned long i, j=1, crcout=0; + + for (i=1<<(bitnum-1); i; i>>=1) + { + if (crc & i) + crcout |= j; + j<<= 1; + } + return (crcout); +} + +static unsigned long docrc(unsigned char* p, int len) { + + int i, j, c; + unsigned long bit; + unsigned long crc = 0x0000; + + for (i=0; i>=1) + { + bit = crc & 0x8000; + crc<<= 1; + if (c & j) + bit^= 0x8000; + if (bit) + crc^= 0x1021; + } + } + + crc = _flip(crc, 16); + crc ^= 0xffff; + crc &= 0xFFFF;; + + return(crc); +} + +#endif + +static unsigned char * _enc_leader(unsigned char *data) +{ + data[0] = 0x55; + data[1] = 0x55; + data[2] = 0x55; + data[3] = 0x55; + data[4] = 0x55; + data[5] = 0x55; + data[6] = 0x55; + + data[7] = 0x07; + data[8] = 0x09; + data[9] = 0x2a; + data[10] = 0x44; + data[11] = 0x6f; + + return &(data[12]); +} + +static unsigned char * _enc_str(unsigned char *data) +{ + unsigned long ccrc; + int i, j; + int k; + int m; + int csr[7]; + int b; + int lbits[112]; + + ccrc = docrc(data, 4); + + data[4] = ccrc & 0x00ff; + data[5] = (ccrc >> 8) & 0x00ff; + + data[6] = 0; + + for(i=0; i<7; i++) + csr[i] = 0; + + for(i=0; i<7; i++) + { + data[i+7] = 0; + for(j=0; j<=7; j++) + { + for(k=6; k > 0; k--) + csr[k] = csr[k-1]; + csr[0] = (data[i] >> j) & 0x01; + b = csr[0] + csr[2] + csr[5] + csr[6]; + data[i+7] |= (b & 0x01) << j; + } + } + +#if 0 + for(i=0; i<14; i++) + { + printf("%02x ",data[i]); + } + printf("\n"); +#endif + + k=0; + m=0; + for(i=0; i<14; i++) + { + for(j=0; j<=7; j++) + { + b = 0x01 & (data[i] >> j); + lbits[k] = b; + k += 16; + if(k > 111) + k = ++m; + } + } + + k = 0; + for(i=0; i<14; i++) + { + data[i] = 0; + for(j=7; j>=0; j--) + { + if(lbits[k]) + data[i] |= 1<loaded) + return -1; + + encoder->state = 0; + + dp = _enc_leader(encoder->data); + + dp[0] = op; + dp[1] = arg; + dp[2] = (unitID >> 8) & 0x00ff; + dp[3] = unitID & 0x00ff; + + _enc_str(dp); + + encoder->loaded = 26; + + return 0; +} + +int mdc_encoder_set_double_packet(mdc_encoder_t *encoder, + unsigned char op, + unsigned char arg, + unsigned short unitID, + unsigned char extra0, + unsigned char extra1, + unsigned char extra2, + unsigned char extra3) +{ + unsigned char *dp; + + if(!encoder) + return -1; + + if(encoder->loaded) + return -1; + + encoder->state = 0; + + dp = _enc_leader(encoder->data); + + dp[0] = op; + dp[1] = arg; + dp[2] = (unitID >> 8) & 0x00ff; + dp[3] = unitID & 0x00ff; + + dp = _enc_str(dp); + + dp[0] = extra0; + dp[1] = extra1; + dp[2] = extra2; + dp[3] = extra3; + + _enc_str(dp); + + encoder->loaded = 40; + + return 0; +} + +static unsigned char _enc_get_samp(mdc_encoder_t *encoder) +{ + int b; + int ofs; + + encoder->th += encoder->incr; + + if(encoder->th >= TWOPI) + { + encoder->th -= TWOPI; + encoder->ipos++; + if(encoder->ipos > 7) + { + encoder->ipos = 0; + encoder->bpos++; + if(encoder->bpos > encoder->loaded) + { + encoder->state = 0; + return 127; + } + } + + b = 0x01 & (encoder->data[encoder->bpos] >> (7-(encoder->ipos))); + + if(b != encoder->lb) + { + encoder->xorb = 1; + encoder->lb = b; + } + else + encoder->xorb = 0; + } + + if(encoder->xorb) + encoder->tth += 1.5 * encoder->incr; + else + encoder->tth += 1.0 * encoder->incr; + + if(encoder->tth >= TWOPI) + encoder->tth -= TWOPI; + + ofs = (int)(encoder->tth * (256.0 / TWOPI)); + + return sin8[ofs]; +} + +int mdc_encoder_get_samples(mdc_encoder_t *encoder, + unsigned char *buffer, + int bufferSize) +{ + int i; + + if(!encoder) + return -1; + + if(!(encoder->loaded)) + return 0; + + if(encoder->state == 0) + { + encoder->th = 0.0; + encoder->tth = 0.0; + encoder->bpos = 0; + encoder->ipos = 0; + encoder->state = 1; + encoder->xorb = 1; + encoder->lb = 0; + } + + i = 0; + while((i < bufferSize) && encoder->state) + buffer[i++] = _enc_get_samp(encoder); + + if(encoder->state == 0) + encoder->loaded = 0; + return i; +} + diff --git a/asterisk/apps/mdc_encode.h b/asterisk/apps/mdc_encode.h new file mode 100644 index 00000000..742fe134 --- /dev/null +++ b/asterisk/apps/mdc_encode.h @@ -0,0 +1,132 @@ +/*- + * mdc_encode.h + * header for mdc_encode.c + * + * Author: Matthew Kaufman (matthew@eeph.com) + * + * Copyright (c) 2005 Matthew Kaufman All rights reserved. + * + * This file is part of Matthew Kaufman's MDC Encoder/Decoder Library + * + * The MDC Encoder/Decoder Library is free software; you can + * redistribute it and/or modify it under the terms of version 2 of + * the GNU General Public License as published by the Free Software + * Foundation. + * + * If you cannot comply with the terms of this license, contact + * the author for alternative license arrangements or do not use + * or redistribute this software. + * + * The MDC Encoder/Decoder Library is distributed in the hope + * that it will be useful, but WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 + * USA. + * + * or see http://www.gnu.org/copyleft/gpl.html + * +-*/ + +#ifndef _MDC_ENCODE_H_ +#define _MDC_ENCODE_H_ + +#ifndef TWOPI +#define TWOPI (2.0 * 3.1415926535) +#endif + + +typedef struct { + int loaded; + int bpos; + int ipos; + double th; + double tth; + double incr; + int state; + int lb; + int xorb; + unsigned char data[14+14+5+7]; +} mdc_encoder_t; + + +/* + mdc_encoder_new + create a new mdc_encoder object + + parameters: int sampleRate - the sampling rate in Hz + + returns: an mdc_encoder object or null if failure + +*/ +mdc_encoder_t * mdc_encoder_new(int sampleRate); + + +/* + mdc_encoder_set_packet + set up a normal-length MDC packet for transmission + + parameters: mdc_encoder_t *encoder - pointer to the encoder object + unsigned char op - the "opcode" + unsigned char arg - the "argument" + unsigned short unitID - the "unit ID + + returns: -1 for error, 0 otherwise + +*/ +int mdc_encoder_set_packet(mdc_encoder_t *encoder, + unsigned char op, + unsigned char arg, + unsigned short unitID); + +/* + mdc_encoder_set_double_packet + set up a double-length MDC packet for transmission + + parameters: mdc_encoder_t *encoder - pointer to the encoder object + unsigned char op - the "opcode" + unsigned char arg - the "argument" + unsigned short unitID - the "unit ID + unsigned char extra0 - the 1st "extra byte" + unsigned char extra1 - the 2nd "extra byte" + unsigned char extra2 - the 3rd "extra byte" + unsigned char extra3 - the 4th "extra byte" + + returns: -1 for error, 0 otherwise + +*/ +int mdc_encoder_set_double_packet(mdc_encoder_t *encoder, + unsigned char op, + unsigned char arg, + unsigned short unitID, + unsigned char extra0, + unsigned char extra1, + unsigned char extra2, + unsigned char extra3); + + +/* + mdc_encoder_get_samples + get generated output audio samples from encoder + (currently limited to 8-bit unsigned samples) + + parameters: mdc_encoder_t *encoder - the pointer to the encoder object + unsigned char *buffer - the sample buffer to write into + int bufferSize - the size (in bytes) of the sample buffer + + returns: -1 for error, otherwise returns the number of samples written + into the buffer (will be equal to bufferSize unless the end has + been reached, in which case the last block may be less than + bufferSize and all subsequent calls will return zero, until + a new packet is loaded for transmission + +*/ +int mdc_encoder_get_samples(mdc_encoder_t *encoder, + unsigned char *buffer, + int bufferSize); + +#endif + From 82e69eca0e32e11313397e8ee57e363c813ad887 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Fri, 12 Jan 2018 20:16:01 +0000 Subject: [PATCH 29/96] Add rpt_events --- asterisk/apps/app_rpt.c | 44 ++++++-- extras/mdc1200/README | 2 + extras/mdc1200/mdc.patch | 96 ++++++++++++++++ extras/mdc1200/rpt_events/README.md | 18 +++ extras/mdc1200/rpt_events/rpt_events.patch | 122 +++++++++++++++++++++ 5 files changed, 274 insertions(+), 8 deletions(-) create mode 100644 extras/mdc1200/mdc.patch create mode 100644 extras/mdc1200/rpt_events/README.md create mode 100644 extras/mdc1200/rpt_events/rpt_events.patch diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index 08a2e565..a11ac166 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -22,7 +22,7 @@ * By: Stacy Olivas, KG7QIN - 20 March 2017 * This application, the heart of the AllStar network and using asterisk as a repeater, * is largely undocumented code. It uses a multi-threaded approach to fulfilling its functions - * and can be quite a chore to follow for debugging. + * and can be quite a chore to follow for debugging. * * The entry point in the code , rpt_exec, is called by the main pbx call handing routine. * The code handles the initial setup and then passes the call/connection off to @@ -35,9 +35,9 @@ * debugging statements throughout it and run it. The program flow may surprise you. * * Note that due changes in later versions of asterisk, you cannot simply drop this module into - * the build tree and expect it to work. There has been some significant renaming of + * the build tree and expect it to work. There has been some significant renaming of * key variables and structures between 1.4 and later versions of Asterisk. Additionally, - * the changes to how the pbx module passes calls off to applications has changed as well, + * the changes to how the pbx module passes calls off to applications has changed as well, * which causes app_rpt to fail without a modification of the base Asterisk code in these * later versions. * -------------------------------------- @@ -45,12 +45,14 @@ /*! \file * * \brief Radio Repeater / Remote Base program - * version 0.329 01/12/2018 + * version 0.330 01/12/2018 * * \author Jim Dixon, WB6NIL * * \note Serious contributions by Steve RoDgers, WA6ZFT - * \note Steven Henke, W9SH, added a few features here and there. + * \note contributions by Steven Henke, W9SH, + * \note contributions by Mike Zingman, N4IRR + * \note contributions by Steve Zingman, N4IRS * * See http://www.zapatatelephony.org/app_rpt.html * @@ -60,7 +62,7 @@ * Normal mode: * See the function list in rpt.conf (autopatchup, autopatchdn) * autopatchup can optionally take comma delimited setting=value pairs: - * + * * * context=string : Override default context with "string" * dialtime=ms : Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second) @@ -1387,7 +1389,7 @@ static struct rpt struct timeval paging; char deferid; struct timeval lastlinktime; -} rpt_vars[MAXRPTS]; +} rpt_vars[MAXRPTS]; struct nodelog { struct nodelog *next; @@ -1408,6 +1410,7 @@ static int setrtx_check(struct rpt *myrpt); static int channel_revert(struct rpt *myrpt); static int channel_steer(struct rpt *myrpt, char *data); static void rpt_telemetry(struct rpt *myrpt,int mode, void *data); +static void rpt_manager_trigger(struct rpt *myrpt, char *event, char *value); AST_MUTEX_DEFINE_STATIC(nodeloglock); @@ -4674,6 +4677,8 @@ static void mdc1200_notify(struct rpt *myrpt,char *fromnode, char *data) struct flock fl; time_t t; + rpt_manager_trigger(myrpt, "MDC-1200", data); + if (!fromnode) { ast_verbose("Got MDC-1200 data %s from local system (%s)\n", @@ -5482,6 +5487,7 @@ char buf[10]; buf[1] = 0; if (newval > 0) buf[0] = '1'; pbx_builtin_setvar_helper(myrpt->rxchannel, varname, buf); + rpt_manager_trigger(myrpt, varname, buf); if (newval >= 0) rpt_event_process(myrpt); return; } @@ -5504,8 +5510,10 @@ int n; if (n) snprintf(obuf,sizeof(obuf) - 1,"%d,%s",n,buf); else strcpy(obuf,"0"); pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_ALINKS",obuf); + rpt_manager_trigger(myrpt, "RPT_ALINKS", obuf); snprintf(obuf,sizeof(obuf) - 1,"%d",n); pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_NUMALINKS",obuf); + rpt_manager_trigger(myrpt, "RPT_NUMALINKS", obuf); ast_mutex_lock(&myrpt->lock); __mklinklist(myrpt,NULL,buf,0); ast_mutex_unlock(&myrpt->lock); @@ -5514,8 +5522,10 @@ int n; if (n) snprintf(obuf,sizeof(obuf) - 1,"%d,%s",n,buf); else strcpy(obuf,"0"); pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_LINKS",obuf); + rpt_manager_trigger(myrpt, "RPT_LINKS", obuf); snprintf(obuf,sizeof(obuf) - 1,"%d",n); pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_NUMLINKS",obuf); + rpt_manager_trigger(myrpt, "RPT_NUMLINKS", obuf); rpt_event_process(myrpt); return; } @@ -18676,10 +18686,14 @@ static void local_dtmf_helper(struct rpt *myrpt,char c_in) { int res; pthread_attr_t attr; -char cmd[MAXDTMF+1] = "",c; +char cmd[MAXDTMF+1] = "",c,tone[10]; c = c_in & 0x7f; + + sprintf(tone,"%c",c); + rpt_manager_trigger(myrpt, "DTMF", tone); + if (myrpt->p.archivedir) { char str[100]; @@ -24269,10 +24283,24 @@ static int rpt_exec(struct ast_channel *chan, void *data) return res; } +static void rpt_manager_trigger(struct rpt *myrpt, char *event, char *value) +{ + manager_event(EVENT_FLAG_CALL, event, + "Node: %s\r\n" + "Channel: %s\r\n" + "EventValue: %s\r\n" + "LastKeyedTime: %s\r\n" + "LastTxKeyedTime: %s\r\n", + myrpt->name, myrpt->rxchannel->name, value, + ctime(&myrpt->lastkeyedtime), ctime(&myrpt->lasttxkeyedtime) + ); +} + #ifndef OLD_ASTERISK /*!\brief callback to display list of locally configured nodes \addtogroup Group_AMI */ + static int manager_rpt_local_nodes(struct mansession *s, const struct message *m) { int i; diff --git a/extras/mdc1200/README b/extras/mdc1200/README index b89d249f..062b238a 100644 --- a/extras/mdc1200/README +++ b/extras/mdc1200/README @@ -5,3 +5,5 @@ To enable MDC1200 decoding in app_rpt, copy mdc_decode.c and mdc_decode.h to /us /* #include "mdc_decode.c" */ +This code was enabled full time on 01/12/2018 +Additional features added by W9CR. Diff to follow diff --git a/extras/mdc1200/mdc.patch b/extras/mdc1200/mdc.patch new file mode 100644 index 00000000..7ef1c453 --- /dev/null +++ b/extras/mdc1200/mdc.patch @@ -0,0 +1,96 @@ +--- app_rpt_before_mdc.c 2018-01-12 19:35:41.659742662 +0000 ++++ app_rpt_after.c 2018-01-12 17:05:35.000000000 +0000 +@@ -44,9 +44,9 @@ + */ + /*! \file + * +- * \brief Radio Repeater / Remote Base program +- * version 0.328 07/13/2017 +- * ++ * \brief Radio Repeater / Remote Base program ++ * version 0.329 01/12/2018 ++ * + * \author Jim Dixon, WB6NIL + * + * \note Serious contributions by Steve RoDgers, WA6ZFT +@@ -130,7 +130,7 @@ + * 44 - Echolink announce node # & Callsign + * 45 - Link Activity timer enable + * 46 - Link Activity timer disable +- * 47 - Reset "Link Config Changed" Flag ++ * 47 - Reset "Link Config Changed" Flag + * 48 - Send Page Tone (Tone specs separated by parenthesis) + * 49 - Disable incoming connections (control state noice) + * 50 - Enable incoming connections (control state noicd) +@@ -144,11 +144,11 @@ + * 58 - Tx CTCSS On Input only Enable + * 59 - Tx CTCSS On Input only Disable + * 60 - Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) +- * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call ++ * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + * (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. + * DestID and subcode are only specified for the 'C' type message. + * UnitID is the local systems UnitID. DestID is the MDC1200 ID of +- * the radio being called, and the subcodes are as follows: ++ * the radio being called, and the subcodes are as follows: + * Subcode '8205' is Voice Selective Call for Spectra ('Call') + * Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or + * Astro-Saber('Call') +@@ -156,7 +156,7 @@ + * 61 - Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) + * 62 - Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) + * 63 - Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) +- * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) ++ * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) + * 65 - Send POCSAG page (equipped channel types only) + * + * ilink cmds: +@@ -582,11 +582,11 @@ + + /* Un-comment the following to include support decoding of MDC-1200 digital tone + signalling protocol (using KA6SQG's GPL'ed implementation) */ +-/* #include "mdc_decode.c" */ ++#include "mdc_decode.c" + + /* Un-comment the following to include support encoding of MDC-1200 digital tone + signalling protocol (using KA6SQG's GPL'ed implementation) */ +-/* #include "mdc_encode.c" */ ++#include "mdc_encode.c" + + /* Un-comment the following to include support for notch filters in the + rx audio stream (using Tony Fisher's mknotch (mkfilter) implementation) */ +@@ -20780,11 +20780,19 @@ + mdc1200_send(myrpt,ustr); + mdc1200_cmd(myrpt,ustr); + } ++ /* if for Stun ACK W9CR */ ++ if ((op == 0x0b) && (arg == 0x00)) ++ { ++ myrpt->lastunit = unitID; ++ sprintf(ustr,"STUN ACK %04X",unitID); ++ } + /* if for STS (status) */ + if (op == 0x46) + { + myrpt->lastunit = unitID; + sprintf(ustr,"S%04X-%X",unitID,arg & 0xf); ++ ++ + #ifdef _MDC_ENCODE_H_ + mdc1200_ack_status(myrpt,unitID); + #endif +@@ -25100,6 +25108,14 @@ + { + mdc_encoder_set_packet(ps->mdc,0x23,0,p->UnitID); + } ++ else if (p->type[0] == 'K') // kill a unit W9CR ++ { ++ mdc_encoder_set_packet(ps->mdc,0x22b,0x00,p->UnitID); ++ } ++ else if (p->type[0] == 'U') // UnKill a unit W9CR ++ { ++ mdc_encoder_set_packet(ps->mdc,0x2b,0x0c,p->UnitID); ++ } + else + { + ast_log(LOG_ERROR, "Dont know MDC encode type '%s'\n", p->type); diff --git a/extras/mdc1200/rpt_events/README.md b/extras/mdc1200/rpt_events/README.md new file mode 100644 index 00000000..fb09a4f4 --- /dev/null +++ b/extras/mdc1200/rpt_events/README.md @@ -0,0 +1,18 @@ +Asterisk/app_rpt AMI events + +rpt_events adds support to receive events via Asterisk Manager Interface (AMI) from app_rpt. + +Supported variables events: + - EventName: "RPT_RXKEYED", EventValue: 0|1 + - EventName: "RPT_ETXKEYED", EventValue: 0|1 + - EventName: "RPT_LINKS", EventValue: NUMLINKS,MODE NODEMUMx[,MODE NODEMUM...] + - EventName: "RPT_NUMLINKS", EventValue: NUMLINKS + - EventName: "RPT_TXKEYED", EventValue: 0|1 + - EventName: "RPT_ETXKEYED", EventValue: 0|1 + - EventName: "RPT_ALINKS", EventValue: NUMALINKS + - EventName: "RPT_NUMALINKS", EventValue: NUMALINKS,NODEMUM MODE RXKEYED[,NODEMUM MODE RXKEYED...] + - EventName: "RPT_AUTOPATCHUP", EventValue: 0|1 + +Supported decoders events: + - EventName: "MDC-1200", EventValue: UnitID + - EventName: "DTMF" , EventValue: DTMF character diff --git a/extras/mdc1200/rpt_events/rpt_events.patch b/extras/mdc1200/rpt_events/rpt_events.patch new file mode 100644 index 00000000..16783f48 --- /dev/null +++ b/extras/mdc1200/rpt_events/rpt_events.patch @@ -0,0 +1,122 @@ +--- app_rpt_after.c 2018-01-12 17:05:35.000000000 +0000 ++++ app_rpt_before.c 2018-01-12 18:33:37.000000000 +0000 +@@ -130,7 +130,7 @@ + * 44 - Echolink announce node # & Callsign + * 45 - Link Activity timer enable + * 46 - Link Activity timer disable +- * 47 - Reset "Link Config Changed" Flag ++ * 47 - Reset "Link Config Changed" Flag + * 48 - Send Page Tone (Tone specs separated by parenthesis) + * 49 - Disable incoming connections (control state noice) + * 50 - Enable incoming connections (control state noicd) +@@ -144,11 +144,11 @@ + * 58 - Tx CTCSS On Input only Enable + * 59 - Tx CTCSS On Input only Disable + * 60 - Send MDC-1200 Burst (cop,60,type,UnitID[,DestID,SubCode]) +- * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call ++ * Type is 'I' for PttID, 'E' for Emergency, and 'C' for Call + * (SelCall or Alert), or 'SX' for STS (ststus), where X is 0-F. + * DestID and subcode are only specified for the 'C' type message. + * UnitID is the local systems UnitID. DestID is the MDC1200 ID of +- * the radio being called, and the subcodes are as follows: ++ * the radio being called, and the subcodes are as follows: + * Subcode '8205' is Voice Selective Call for Spectra ('Call') + * Subcode '8015' is Voice Selective Call for Maxtrac ('SC') or + * Astro-Saber('Call') +@@ -156,7 +156,7 @@ + * 61 - Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,GPIO4=1].....) + * 62 - Send Message to USB to control GPIO pins, quietly (cop,62,GPIO1=0[,GPIO4=1].....) + * 63 - Send pre-configred APRSTT notification (cop,63,CALL[,OVERLAYCHR]) +- * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) ++ * 64 - Send pre-configred APRSTT notification, quietly (cop,64,CALL[,OVERLAYCHR]) + * 65 - Send POCSAG page (equipped channel types only) + * + * ilink cmds: +@@ -1408,6 +1408,7 @@ + static int channel_revert(struct rpt *myrpt); + static int channel_steer(struct rpt *myrpt, char *data); + static void rpt_telemetry(struct rpt *myrpt,int mode, void *data); ++static void rpt_manager_trigger(struct rpt *myrpt, char *event, char *value); + + AST_MUTEX_DEFINE_STATIC(nodeloglock); + +@@ -4674,6 +4675,8 @@ + struct flock fl; + time_t t; + ++ rpt_manager_trigger(myrpt, "MDC-1200", data); ++ + if (!fromnode) + { + ast_verbose("Got MDC-1200 data %s from local system (%s)\n", +@@ -5482,6 +5485,7 @@ + buf[1] = 0; + if (newval > 0) buf[0] = '1'; + pbx_builtin_setvar_helper(myrpt->rxchannel, varname, buf); ++ rpt_manager_trigger(myrpt, varname, buf); + if (newval >= 0) rpt_event_process(myrpt); + return; + } +@@ -5504,8 +5508,10 @@ + if (n) snprintf(obuf,sizeof(obuf) - 1,"%d,%s",n,buf); + else strcpy(obuf,"0"); + pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_ALINKS",obuf); ++ rpt_manager_trigger(myrpt, "RPT_ALINKS", obuf); + snprintf(obuf,sizeof(obuf) - 1,"%d",n); + pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_NUMALINKS",obuf); ++ rpt_manager_trigger(myrpt, "RPT_NUMALINKS", obuf); + ast_mutex_lock(&myrpt->lock); + __mklinklist(myrpt,NULL,buf,0); + ast_mutex_unlock(&myrpt->lock); +@@ -5514,8 +5520,10 @@ + if (n) snprintf(obuf,sizeof(obuf) - 1,"%d,%s",n,buf); + else strcpy(obuf,"0"); + pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_LINKS",obuf); ++ rpt_manager_trigger(myrpt, "RPT_LINKS", obuf); + snprintf(obuf,sizeof(obuf) - 1,"%d",n); + pbx_builtin_setvar_helper(myrpt->rxchannel,"RPT_NUMLINKS",obuf); ++ rpt_manager_trigger(myrpt, "RPT_NUMLINKS", obuf); + rpt_event_process(myrpt); + return; + } +@@ -18676,10 +18684,14 @@ + { + int res; + pthread_attr_t attr; +-char cmd[MAXDTMF+1] = "",c; ++char cmd[MAXDTMF+1] = "",c,tone[10]; + + + c = c_in & 0x7f; ++ ++ sprintf(tone,"%c",c); ++ rpt_manager_trigger(myrpt, "DTMF", tone); ++ + if (myrpt->p.archivedir) + { + char str[100]; +@@ -24269,10 +24281,24 @@ + return res; + } + ++static void rpt_manager_trigger(struct rpt *myrpt, char *event, char *value) ++{ ++ manager_event(EVENT_FLAG_CALL, event, ++ "Node: %s\r\n" ++ "Channel: %s\r\n" ++ "EventValue: %s\r\n" ++ "LastKeyedTime: %s\r\n" ++ "LastTxKeyedTime: %s\r\n", ++ myrpt->name, myrpt->rxchannel->name, value, ++ ctime(&myrpt->lastkeyedtime), ctime(&myrpt->lasttxkeyedtime) ++ ); ++} ++ + #ifndef OLD_ASTERISK + /*!\brief callback to display list of locally configured nodes + \addtogroup Group_AMI + */ ++ + static int manager_rpt_local_nodes(struct mansession *s, const struct message *m) + { + int i; From 53c0ca8135c5ddd2ee8e9a58139f96ff25ef4e56 Mon Sep 17 00:00:00 2001 From: Steve Zingman Date: Tue, 13 Feb 2018 14:00:02 -0500 Subject: [PATCH 30/96] Update README As of now, this will become the develop branch --- README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README b/README index f2b617ab..007dc4fd 100644 --- a/README +++ b/README @@ -1,9 +1,8 @@ This is the Asterisk source package for AllStarLink asterisk-1.4.23pre -libpri-1.4.7 -This a patched version of Asterisk to run with uClibc on an embedded mini-itx system. +This branch will be merged into dev From c5eba9faa19547dbee613004fca955de09034d83 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Tue, 13 Feb 2018 14:19:52 -0500 Subject: [PATCH 31/96] move mdc1200 to seperate directories --- asterisk/{apps => allstar}/mdc_decode.c | 2 +- asterisk/{apps => allstar}/mdc_encode.c | 2 +- asterisk/apps/app_rpt.c | 8 +- .../{apps => include/allstar}/mdc_decode.h | 0 .../{apps => include/allstar}/mdc_encode.h | 0 asterisk/include/allstar/readme.MD | 1 + asterisk/main/asterisk.c | 2 +- libpri/.version | 1 - libpri/ChangeLog | 347 -- libpri/LICENSE | 341 -- libpri/Makefile | 168 - libpri/README | 45 - libpri/TODO | 8 - libpri/build_tools/make_version | 72 - libpri/build_tools/make_version_c | 24 - libpri/compat.h | 10 - libpri/compiler.h | 36 - libpri/copy_string.c | 47 - libpri/libpri.h | 695 --- libpri/pri.c | 913 ---- libpri/pri_facility.c | 2438 ---------- libpri/pri_facility.h | 325 -- libpri/pri_internal.h | 284 -- libpri/pri_q921.h | 195 - libpri/pri_q931.h | 296 -- libpri/pri_timers.h | 97 - libpri/pridump.c | 149 - libpri/prisched.c | 129 - libpri/pritest.c | 410 -- libpri/q921.c | 1170 ----- libpri/q931.c | 4035 ----------------- libpri/testprilib.c | 288 -- 32 files changed, 8 insertions(+), 12530 deletions(-) rename asterisk/{apps => allstar}/mdc_decode.c (99%) rename asterisk/{apps => allstar}/mdc_encode.c (99%) rename asterisk/{apps => include/allstar}/mdc_decode.h (100%) rename asterisk/{apps => include/allstar}/mdc_encode.h (100%) create mode 100644 asterisk/include/allstar/readme.MD delete mode 100644 libpri/.version delete mode 100644 libpri/ChangeLog delete mode 100644 libpri/LICENSE delete mode 100644 libpri/Makefile delete mode 100644 libpri/README delete mode 100644 libpri/TODO delete mode 100755 libpri/build_tools/make_version delete mode 100755 libpri/build_tools/make_version_c delete mode 100644 libpri/compat.h delete mode 100644 libpri/compiler.h delete mode 100644 libpri/copy_string.c delete mode 100644 libpri/libpri.h delete mode 100644 libpri/pri.c delete mode 100644 libpri/pri_facility.c delete mode 100644 libpri/pri_facility.h delete mode 100644 libpri/pri_internal.h delete mode 100644 libpri/pri_q921.h delete mode 100644 libpri/pri_q931.h delete mode 100644 libpri/pri_timers.h delete mode 100644 libpri/pridump.c delete mode 100644 libpri/prisched.c delete mode 100644 libpri/pritest.c delete mode 100644 libpri/q921.c delete mode 100644 libpri/q931.c delete mode 100644 libpri/testprilib.c diff --git a/asterisk/apps/mdc_decode.c b/asterisk/allstar/mdc_decode.c similarity index 99% rename from asterisk/apps/mdc_decode.c rename to asterisk/allstar/mdc_decode.c index 787ee6bd..5195ccde 100644 --- a/asterisk/apps/mdc_decode.c +++ b/asterisk/allstar/mdc_decode.c @@ -35,7 +35,7 @@ -*/ #include -#include "mdc_decode.h" +#include "allstar/mdc_decode.h" mdc_decoder_t * mdc_decoder_new(int sampleRate) { diff --git a/asterisk/apps/mdc_encode.c b/asterisk/allstar/mdc_encode.c similarity index 99% rename from asterisk/apps/mdc_encode.c rename to asterisk/allstar/mdc_encode.c index 6ba6e3ac..706a5403 100644 --- a/asterisk/apps/mdc_encode.c +++ b/asterisk/allstar/mdc_encode.c @@ -33,7 +33,7 @@ -*/ #include -#include "mdc_encode.h" +#include "allstar/mdc_encode.h" static unsigned char sin8[] = { 127, 130, 133, 136, 139, 142, 145, 148, 151, 154, 157, 160, diff --git a/asterisk/apps/app_rpt.c b/asterisk/apps/app_rpt.c index a11ac166..cf02208e 100644 --- a/asterisk/apps/app_rpt.c +++ b/asterisk/apps/app_rpt.c @@ -527,10 +527,10 @@ enum{DAQ_TYPE_UCHAMELEON}; /* * Please change this revision number when you make a edit - * use the simple format MMDDYY + * use the simple format YYMMDD (better for sort) */ -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180213 $") // ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include @@ -584,11 +584,11 @@ struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS }; /* Un-comment the following to include support decoding of MDC-1200 digital tone signalling protocol (using KA6SQG's GPL'ed implementation) */ -#include "mdc_decode.c" +#include "../allstar/mdc_decode.c" /* Un-comment the following to include support encoding of MDC-1200 digital tone signalling protocol (using KA6SQG's GPL'ed implementation) */ -#include "mdc_encode.c" +#include "../allstar/mdc_encode.c" /* Un-comment the following to include support for notch filters in the rx audio stream (using Tony Fisher's mknotch (mkfilter) implementation) */ diff --git a/asterisk/apps/mdc_decode.h b/asterisk/include/allstar/mdc_decode.h similarity index 100% rename from asterisk/apps/mdc_decode.h rename to asterisk/include/allstar/mdc_decode.h diff --git a/asterisk/apps/mdc_encode.h b/asterisk/include/allstar/mdc_encode.h similarity index 100% rename from asterisk/apps/mdc_encode.h rename to asterisk/include/allstar/mdc_encode.h diff --git a/asterisk/include/allstar/readme.MD b/asterisk/include/allstar/readme.MD new file mode 100644 index 00000000..bb928fc3 --- /dev/null +++ b/asterisk/include/allstar/readme.MD @@ -0,0 +1 @@ +AllStarLink include files live here diff --git a/asterisk/main/asterisk.c b/asterisk/main/asterisk.c index 552db6c0..e22e0af6 100644 --- a/asterisk/main/asterisk.c +++ b/asterisk/main/asterisk.c @@ -139,7 +139,7 @@ int daemon(int, int); /* defined in libresolv of all places */ /*! \brief Welcome message when starting a CLI interface */ #define WELCOME_MESSAGE \ ast_verbose("\n"); \ - ast_verbose("AllStarLink Asterisk Version 1.01 1/1/2018 "ASTERISK_VERSION"\n"); \ + ast_verbose("AllStarLink Asterisk Version 1.01 2/13/2018 "ASTERISK_VERSION"\n"); \ ast_verbose("Copyright (C) 1999 - 2018 Digium, Inc. Jim Dixon, AllStarLink Inc. and others.\n"); \ ast_verbose("Created by Mark Spencer \n"); \ ast_verbose("Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n"); \ diff --git a/libpri/.version b/libpri/.version deleted file mode 100644 index be05bba9..00000000 --- a/libpri/.version +++ /dev/null @@ -1 +0,0 @@ -1.4.7 diff --git a/libpri/ChangeLog b/libpri/ChangeLog deleted file mode 100644 index 81360760..00000000 --- a/libpri/ChangeLog +++ /dev/null @@ -1,347 +0,0 @@ -2008-08-05 Kevin P. Fleming - - * libpri 1.4.7 released. - -2008-08-05 22:18 +0000 [r611] Kevin P. Fleming - - * pritest.c, pri.c, pri_internal.h, q921.c, q931.c, copy_string.c, - prisched.c, pri_q921.h, pri_q931.h, pri_facility.c, /, - compiler.h, pridump.c, testprilib.c, pri_timers.h, - pri_facility.h, libpri.h: Merged revisions 610 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r610 - | kpfleming | 2008-08-05 17:16:58 -0500 (Tue, 05 Aug 2008) | 2 - lines clean up license headers, and explicitly grant additional - permissions when used with Asterisk ........ - -2008-07-30 15:43 +0000 [r606-607] Kevin P. Fleming - - * /: update ignore list - - * Makefile, mkdep (removed): use better version.c creation process, - and better dependency tracking process too - -2008-07-29 22:47 +0000 [r598-602] Jason Parker - - * build_tools/make_version: I believe this is what was meant. (it - matches how Asterisk does it) - - * build_tools/make_version: libpri is not libss7 :D - -2008-07-22 22:36 +0000 [r594] Kevin P. Fleming - - * pri_internal.h, libpri.h: correct comments to match code - -2008-07-22 Kevin P. Fleming - - * Libpri 1.4.6 released. - -2008-07-22 19:43 +0000 [r589] Kevin P. Fleming - - * pri.c, pri_internal.h, q931.c, libpri.h: rename API call and - option (nothing has been released to use it yet so this should be - safe) to be more accurate in describing what it does (closes - issue #13042) - -2008-07-11 Jason Parker - - * Libpri 1.4.5 released. - -2008-07-11 16:44 +0000 [r574-579] Kevin P. Fleming - - * /: ignore generated files - - * pri.c, pri_internal.h, q931.c, libpri.h: modify work done for - issue #10552, making the support of inband audio after RELEASE a - configurable option, since it is causing problems for a number of - users (closes issue #13042) - -2008-06-04 17:02 +0000 [r562] Dwayne M. Hubbard - - * q931.c: While working on issue 3450 I noticed that the - information channel selection field in the channel identification - IE was displayed incorrectly when using 'pri intense debug'. I - wanted another pair of eyes to look at the code because - everything looked correct until Shaun Ruffell noticed the missing - comma in the msg_chan_sel array. - -2008-05-07 19:51 +0000 [r557] Matthew Fredrickson - - * pri.c, pritest.c, pri_internal.h, pri_q921.h, Makefile, q921.c, - q931.c, pri_facility.c, prisched.c, testprilib.c, pri_timers.h, - pri_facility.h, libpri.h: Moving trunk changes back into 1.4 - -2008-05-07 Matthew Fredrickson - - * Libpri 1.4.4 released. - -2008-05-06 16:43 +0000 [r553-555] Matthew Fredrickson - - * q921.c, pri.c: Remove some unnecessary debug messages - - * q931.c: We passed TBR3 layer 2 and layer 3 testing with this - commit in for BRI-TE PTMP. - - * q931.c: Final patch to pass certification - -2008-04-22 15:30 +0000 [r546] Russell Bryant - - * Makefile: All versions of libpri have been installed as - libpri.so.1.0, even though the API and ABI have changed over - time. This patch changes the Makefile to install the library as - libpri.so.1.4 to indicate that this is not compatible with - previous versions. In the future, this should be changed as we - make ABI changes. (closes issue #10376) Reported by: tzafrir - Patches: libpri-soname.diff uploaded by tzafrir (license 46) -- - with very minor changes by me - -2008-03-15 19:57 +0000 [r541-543] Matthew Fredrickson - - * libpri.h, pri.c: Remove some useless event items - - * q921.c, pri_internal.h: Make sure if we're a bri and in PTMP mode - that we release the TEI and try to get a new one with the other - end when we lose activity in multiframe mode - - * q921.c, pri.c, pri_q921.h: When we recieve a UA in any TEI - established state other than awaiting establishement make sure we - drop the TEI and get a new one. For passing tests PC37.2 - PC41.2 - in Q.921 - -2008-03-06 23:43 +0000 [r538-539] Matthew Fredrickson - - * q921.c: Make sure we are sending as command not as response - - * q921.c: Make sure C/R bit is correct - -2008-03-01 23:30 +0000 [r531-535] Matthew Fredrickson - - * q921.c: Remove some (currently) useless code - - * q921.c, pri.c, pri_internal.h: Some more updates to add code for - passing PC 27.1 in Q.921 - - * q921.c, pri.c: Various coding style cleanups as well as a bug fix - for TEI removal - - * q921.c, q931.c, pri.c, pri_internal.h: Initial checkin of code to - pass Q.921 PC25 and PC26 - - * q921.c: Add support for responding to TEI requests (Q.921 PC23.x) - -2008-02-18 20:31 +0000 [r525] Matthew Fredrickson - - * q931.c, libpri.h: Improve transmission, receiving, and dumping of - bearer capability IE (#11593) - -2008-01-16 18:06 +0000 [r518] Jason Parker - - * Makefile, /: Add logging for 'make update' command (also fixes - updates in some places). Issue #11766, initial patch by jmls. - -2007-12-26 17:35 +0000 [r505] Russell Bryant - - * libpri.h: Remove unnecessary usage of the extern keyword. - -2007-12-06 22:16 +0000 [r494-496] Russell Bryant - - * q921.c, q931.c, pri_facility.c, pri.c: Change malloc+memset to - calloc. Also, handle allocation failures early to reduce - indentation. (closes issue #11469) Reported by: eliel Patches: - pri.c.patch uploaded by eliel (license 64) q931.c.patch uploaded - by eliel (license 64) q921.c.patch uploaded by eliel (license 64) - pri_facility.c.patch uploaded by eliel (license 64) - - * pri.c: Change a use of malloc+memset to calloc. Also, reduce - indentation of a function by doing the check for memory - allocation failure at the beginning. - - * pri.c: Change the table used to hold the default timers to be - global and const, instead of allocating it on the stack each time - the function is called. - -2007-12-05 00:20 +0000 [r491-493] Matthew Fredrickson - - * q931.c: Improve the parameter name to better reflect its use - - * q921.c, q931.c: More PTMP fixes. Stand by, more changes to come - - * q921.c, q931.c, testprilib.c: More magic to make BRI CPE PTMP - work - -2007-11-21 22:30 +0000 [r486-487] Matthew Fredrickson - - * q931.c: Make sure we loop BRI call references for one byte CREFs - instead of two - - * q921.c, q931.c, libpri.h, pri.c, pritest.c, pri_internal.h: Add - BRI support to libpri - -2007-10-13 16:00 +0000 [r473] Matthew Fredrickson - - * q921.c: Make sure that we only output the message handling debug - when we're actually debugging - -2007-09-25 21:56 +0000 [r469] Matthew Fredrickson - - * q931.c: Fix user-user IE order in setup message (#10705) - -2007-06-20 15:18 +0000 [r428-430] Matthew Fredrickson - - * Makefile: Revert that back to how it was - - * Makefile, q921.c, q931.c, prisched.c, testprilib.c, pri_timers.h, - libpri.h, pri.c, pri_internal.h, pri_q921.h: Patch to add PTMP - mode (BRI support) - -2007-06-06 21:59 +0000 [r417-425] Matthew Fredrickson - - * q931.c, pri_facility.c, pri_facility.h, pri.c, pri_internal.h: - Preliminary patch plus mods for Q.SIG Path Replacement (Q.SIG - version of 2BCT) #7778 - -2007-05-25 17:36 +0000 [r413] Matthew Fredrickson - - * q931.c, pri_facility.c, pri_facility.h, libpri.h: Commit path for - ROSE-12 and ROSE-13 support (#9076) - -2006-11-03 18:16 +0000 [r382] Matthew Fredrickson - - * q921.c: Remove pointless recursion. (#8281) - -2008-05-07 19:51 +0000 [r557] Matthew Fredrickson - - * pri.c, pritest.c, pri_internal.h, pri_q921.h, Makefile, q921.c, - q931.c, pri_facility.c, prisched.c, testprilib.c, pri_timers.h, - pri_facility.h, libpri.h: Moving trunk changes back into 1.4 - -2008-05-02 20:21 +0000 [r552] Brett Bryant - - * Makefile, build_tools (added), build_tools/make_version (added), - build_tools/make_version_c (added), libpri.h: Add new API call - (pri_get_version) to show the current version of the branch for - support purposes. - -2008-04-16 00:21 +0000 [r544] Kevin P. Fleming - - * q921.c: fix the indentation in this function so that it is - actually possible to read it and understand the logic and flow - -2008-02-21 16:38 +0000 [r528] Joshua Colp - - * q931.c: If inband audio is being provided with a disconnect - message let the audio be heard before releasing the channel. - (closes issue #10552) Reported by: paravoid Patches: - disconnect-audio.diff uploaded by paravoid (license 200) - -2008-02-18 20:31 +0000 [r524] Matthew Fredrickson - - * q931.c, libpri.h: Improve transmission, receiving, and dumping of - bearer capability IE (#11593) - -2008-01-11 16:34 +0000 [r514] Matthew Fredrickson - - * q931.c, /: Merged revisions 513 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r513 - | mattf | 2008-01-11 10:33:52 -0600 (Fri, 11 Jan 2008) | 1 line - We should not be parsing further into the bearer capability IE if - the length does not confirm that there actually is data present - ........ - -2007-12-13 Russell Bryant - - * libpri 1.4.3 released. - -2007-10-22 15:10 +0000 [r479] Kevin P. Fleming - - * pri_internal.h, /: Merged revisions 478 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r478 - | kpfleming | 2007-10-22 10:09:27 -0500 (Mon, 22 Oct 2007) | 3 - lines we need to include stddef.h for 'size_t' ........ - -2007-10-16 Matthew Fredrickson - - * libpri 1.4.2 released. - -2007-10-05 16:45 +0000 [r470] Jason Parker - - * libpri.h: Fix an incorrect pri_event structure definition. Issue - 10832, patch by flefoll - -2007-09-25 21:37 +0000 [r468] Matthew Fredrickson - - * q931.c: Fix user-user IE order in setup message (#10705) - -2007-09-14 21:32 +0000 [r465] Matthew Fredrickson - - * q931.c, libpri.h: Fix for #10189. Make sure we properly report - the user layer 1 for H.223 and H.245 - -2007-09-06 15:11 +0000 [r462] Matthew Fredrickson - - * pri.c, pri_facility.c, /: Merged revisions 460 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r460 - | mattf | 2007-09-06 10:06:42 -0500 (Thu, 06 Sep 2007) | 1 line - TBCT now works. It should work for NI2, 4E, and 5E. This code was - tested on NI2. ........ - -2007-08-27 19:21 +0000 [r446] Jason Parker - - * Makefile, /: Merged revisions 445 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r445 - | qwell | 2007-08-27 14:20:23 -0500 (Mon, 27 Aug 2007) | 2 lines - Make sure we build both the static and shared modules with -fPIC. - ........ - -2007-08-06 19:58 +0000 [r441] Jason Parker - - * Makefile: Allow setting CC to something with a space, such as - `make CC="gcc -m32"` Issue 10253. - -2007-07-09 Russell Bryant - - * libpri 1.4.1 released. - -2007-06-19 18:23 +0000 [r427] Matthew Fredrickson - - * q931.c, /: Merged revisions 426 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r426 - | mattf | 2007-06-19 13:22:33 -0500 (Tue, 19 Jun 2007) | 1 line - Try to send pending facility messages if we receive alerting (for - when we don't get proceeding) (#9651) ........ - -2007-06-06 21:58 +0000 [r416-424] Matthew Fredrickson - - * pri_facility.c, /: Merged revisions 423 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r423 - | mattf | 2007-06-06 16:57:15 -0500 (Wed, 06 Jun 2007) | 1 line - Oops, that should not be on one line ........ - - * pri_facility.c, /: Merged revisions 415 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r415 - | mattf | 2007-06-06 08:20:05 -0500 (Wed, 06 Jun 2007) | 2 lines - Make sure we only send the NFE when we are talking QSIG ........ - -2007-01-22 22:29 +0000 [r390] Matthew Fredrickson - - * q931.c, /: Merged revisions 389 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r389 - | mattf | 2007-01-22 16:20:59 -0600 (Mon, 22 Jan 2007) | 2 lines - Make sure we send DISCONNECT if we reached the active state and a - call is disconnected, regardless of cause code. ........ - -2006-12-30 19:17 +0000 [r386] Joshua Colp - - * Makefile, /: Merged revisions 385 via svnmerge from - https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r385 - | file | 2006-12-30 14:16:17 -0500 (Sat, 30 Dec 2006) | 2 lines - Specify full path to restorecon instead of assuming it will be - available from what is in $PATH. (issue #8670 reported by djflux) - ........ - -2006-12-23 Kevin P. Fleming - - * libpri 1.4.0 released. - -2006-09-20 Kevin P. Fleming - - * libpri 1.4.0-beta1 released. diff --git a/libpri/LICENSE b/libpri/LICENSE deleted file mode 100644 index a52b16e4..00000000 --- a/libpri/LICENSE +++ /dev/null @@ -1,341 +0,0 @@ - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/libpri/Makefile b/libpri/Makefile deleted file mode 100644 index 197db4d8..00000000 --- a/libpri/Makefile +++ /dev/null @@ -1,168 +0,0 @@ -# -# libpri: An implementation of Primary Rate ISDN -# -# Written by Mark Spencer -# -# Copyright (C) 2001, Linux Support Services, Inc. -# All Rights Reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING -#ALERTING=-DALERTING_NO_PROGRESS - -# Uncomment if you want libpri to count number of Q921/Q931 sent/received -#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS - -CC=gcc -GREP=grep -AWK=awk - -OSARCH=$(shell uname -s) -PROC?=$(shell uname -m) - -# SONAME version; should be changed on every ABI change -# please don't change it needlessly; it's perfectly fine to have a SONAME -# of 1.2 and a version of 1.4.x -SONAME:=1.4 - -STATIC_LIBRARY=libpri.a -DYNAMIC_LIBRARY:=libpri.so.$(SONAME) -STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o version.o -DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo version.lo -CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS) -INSTALL_PREFIX=$(DESTDIR) -INSTALL_BASE=/usr -SOFLAGS:=-Wl,-h$(DYNAMIC_LIBRARY) -LDCONFIG = /sbin/ldconfig -ifneq (,$(findstring X$(OSARCH)X, XLinuxX XGNU/kFreeBSDX)) -LDCONFIG_FLAGS=-n -else -ifeq (${OSARCH},FreeBSD) -LDCONFIG_FLAGS=-m -CFLAGS += -I../zaptel -I../zapata -INSTALL_BASE=/usr/local -endif -endif -ifeq (${OSARCH},SunOS) -CFLAGS += -DSOLARIS -I../zaptel-solaris -LDCONFIG = -LDCONFIG_FLAGS = \# # Trick to comment out the period in the command below -#INSTALL_PREFIX = /opt/asterisk # Uncomment out to install in standard Solaris location for 3rd party code -endif - -export PRIVERSION - -PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .) - -#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only. -#This works for even old (2.96) versions of gcc and provides a small boost either way. -#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesnt support it. -ifeq ($(PROC),sparc64) -PROC=ultrasparc -CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8 -endif - -all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) - -update: - @if [ -d .svn ]; then \ - echo "Updating from Subversion..." ; \ - fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \ - svn update | tee update.out; \ - torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \ - echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \ - rm -f .version; \ - if [ `grep -c ^C update.out` -gt 0 ]; then \ - echo ; echo "The following files have conflicts:" ; \ - grep ^C update.out | cut -b4- ; \ - fi ; \ - rm -f update.out; \ - else \ - echo "Not under version control"; \ - fi - -install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) - mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/lib - mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/include -ifneq (${OSARCH},SunOS) - install -m 644 libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include - install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib - if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/$(DYNAMIC_LIBRARY); fi - ( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.$(SONAME) libpri.so) - install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib - if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib; fi -else - install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h - install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 755 $(DYNAMIC_LIBRARY) - ( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.$(SONAME) libpri.so) - install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 644 $(STATIC_LIBRARY) -endif - -uninstall: - @echo "Removing Libpri" - rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so.$(SONAME) - rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so - rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.a - rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h - -pritest: pritest.o - $(CC) -o pritest pritest.o -L. -lpri -lzap $(CFLAGS) - -testprilib.o: testprilib.c - $(CC) $(CFLAGS) -D_REENTRANT -D_GNU_SOURCE -o $@ -c $< - -testprilib: testprilib.o - $(CC) -o testprilib testprilib.o -L. -lpri -lpthread $(CFLAGS) - -pridump: pridump.o - $(CC) -o pridump pridump.o -L. -lpri $(CFLAGS) - -MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP - -%.o: %.c - $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< - -%.lo: %.c - $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< - -$(STATIC_LIBRARY): $(STATIC_OBJS) - ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS) - ranlib $(STATIC_LIBRARY) - -$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS) - $(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS) - $(LDCONFIG) $(LDCONFIG_FLAGS) . - ln -sf libpri.so.$(SONAME) libpri.so - -version.c: FORCE - @build_tools/make_version_c > $@.tmp - @cmp -s $@.tmp $@ || mv $@.tmp $@ - @rm -f $@.tmp - -clean: - rm -f *.o *.so *.lo *.so.$(SONAME) - rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) - rm -f pritest pridump - rm -f .*.d - -.PHONY: - -FORCE: - -ifneq ($(wildcard .*.d),) - include .*.d -endif diff --git a/libpri/README b/libpri/README deleted file mode 100644 index fad9a9cd..00000000 --- a/libpri/README +++ /dev/null @@ -1,45 +0,0 @@ -libpri: An implementation of Primary Rate ISDN - -Written by Mark Spencer - -What is libpri? -=============== - -libpri is a C implementation of the Primary Rate ISDN specification. It was -based on the Bellcore specification SR-NWT-002343 for National ISDN. As of -May 12, 2001, it has been tested work with NI-2, Nortel DMS-100, and -Lucent 5E Custom protocols on switches from Nortel and Lucent. - -What is the license for libpri? -=============================== -libpri is distributed under the terms of the GNU General Public License, -which permit its use and linking with other GPL'd software only. -The GNU GPL is included in the file LICENSE in this directory. - -As a special exception, libpri may also be linked to the OpenH323 -library, so long as the entirity of the derivative work (as defined -within the GPL) is licensed either under the MPL of the OpenH323 license -or the GPL of libpri. - -If you wish to use libpri in an application for which the GPL is not -appropriate (e.g. a proprietary embedded system), licenses for libpri -under more flexible terms can be readily obtained through Digium, Inc. -at reasonable cost. - - -How do I report bugs or contribute? -=================================== -For now, contact the author directly. In the future if there is -sufficient interest, we will setup a mailing list. - -Does anything use this library so far? -====================================== -Yes, the Asterisk Open Source PBX does. http://www.asterisk.org - -Also, the Zapata library has hooks for it. http://www.zapatatelephony.org - -Special thanks -============== -Special thanks to Jim Dixon for his help in -testing and fixing the implementation. - diff --git a/libpri/TODO b/libpri/TODO deleted file mode 100644 index 7bd3dc36..00000000 --- a/libpri/TODO +++ /dev/null @@ -1,8 +0,0 @@ -General: - -Q.921: --- Support unnumbered information frames --- Get TEI codes working for BRI interfaces - -Q.931: --- Implement the 11 missing Q.931 timers diff --git a/libpri/build_tools/make_version b/libpri/build_tools/make_version deleted file mode 100755 index 28af581a..00000000 --- a/libpri/build_tools/make_version +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -if [ -f ${1}/.version ]; then - cat ${1}/.version -elif [ -d .svn ]; then - PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'` - BRANCH=0 - TEAM=0 - TAG=0 - - REV=`svnversion -c ${1} | cut -d: -f2` - - BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1` - - if [ "${PARTS}" = "trunk" ] ; then - echo SVN-trunk-r${REV} - exit 0 - fi - - for PART in $PARTS ; do - if [ ${TAG} != 0 ] ; then - if [ "${PART}" = "autotag_for_be" ] ; then - continue - fi - if [ "${PART}" = "autotag_for_sx00i" ] ; then - continue - fi - RESULT="${PART}" - break - fi - - if [ ${BRANCH} != 0 ] ; then - if [ -z ${RESULT} ] ; then - RESULT="${PART}" - else - RESULT="${RESULT}-${PART}" - fi - break - fi - - if [ ${TEAM} != 0 ] ; then - if [ -z ${RESULT} ] ; then - RESULT="${PART}" - else - RESULT="${RESULT}-${PART}" - fi - continue - fi - - if [ "${PART}" = "branches" ] ; then - BRANCH=1 - RESULT="branch" - continue - fi - - if [ "${PART}" = "tags" ] ; then - TAG=1 - continue - fi - - if [ "${PART}" = "team" ] ; then - TEAM=1 - continue - fi - done - - if [ ${TAG} != 0 ] ; then - echo ${RESULT} - else - echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}} - fi -fi diff --git a/libpri/build_tools/make_version_c b/libpri/build_tools/make_version_c deleted file mode 100755 index f39f722a..00000000 --- a/libpri/build_tools/make_version_c +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -if [ ! -f ../.flavor ]; then - EXTRA="" -else - aadkver=`cat ../.version` - aadkflavor=`cat ../.flavor` - EXTRA=" (${aadkflavor} ${aadkver})" -fi -cat << END -/* - * version.c - * Automatically generated - */ - -#include "libpri.h" - -static const char pri_version[] = "${PRIVERSION}${EXTRA}"; - -const char *pri_get_version(void) -{ - return pri_version; -} - -END diff --git a/libpri/compat.h b/libpri/compat.h deleted file mode 100644 index 1cbb8fb2..00000000 --- a/libpri/compat.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __COMPAT_H -#define __COMPAT_H - -#ifdef SOLARIS -typedef unsigned char u_int8_t; -typedef unsigned short u_int16_t; -typedef unsigned int u_int32_t; -#endif - -#endif diff --git a/libpri/compiler.h b/libpri/compiler.h deleted file mode 100644 index 38a1269b..00000000 --- a/libpri/compiler.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Asterisk -- A telephony toolkit for Linux. - * - * Compiler-specific macros and other items - * - * Copyright (C) 2005, Digium, Inc. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _ASTERISK_COMPILER_H -#define _ASTERISK_COMPILER_H - -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) -#define __builtin_expect(exp, c) (exp) -#endif - -#endif /* _ASTERISK_COMPILER_H */ diff --git a/libpri/copy_string.c b/libpri/copy_string.c deleted file mode 100644 index ccc40c08..00000000 --- a/libpri/copy_string.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include -#include -#include - -#include "compiler.h" -#include "libpri.h" -#include "pri_internal.h" - -void libpri_copy_string(char *dst, const char *src, size_t size) -{ - while (*src && size) { - *dst++ = *src++; - size--; - } - if (__builtin_expect(!size, 0)) - dst--; - *dst = '\0'; -} diff --git a/libpri/libpri.h b/libpri/libpri.h deleted file mode 100644 index 5c3dfe47..00000000 --- a/libpri/libpri.h +++ /dev/null @@ -1,695 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _LIBPRI_H -#define _LIBPRI_H - -/* Node types */ -#define PRI_NETWORK 1 -#define PRI_CPE 2 - -/* Debugging */ -#define PRI_DEBUG_Q921_RAW (1 << 0) /* Show raw HDLC frames */ -#define PRI_DEBUG_Q921_DUMP (1 << 1) /* Show each interpreted Q.921 frame */ -#define PRI_DEBUG_Q921_STATE (1 << 2) /* Debug state machine changes */ -#define PRI_DEBUG_CONFIG (1 << 3) /* Display error events on stdout */ -#define PRI_DEBUG_Q931_DUMP (1 << 5) /* Show interpreted Q.931 frames */ -#define PRI_DEBUG_Q931_STATE (1 << 6) /* Debug Q.931 state machine changes */ -#define PRI_DEBUG_Q931_ANOMALY (1 << 7) /* Show unexpected events */ -#define PRI_DEBUG_APDU (1 << 8) /* Debug of APDU components such as ROSE */ -#define PRI_DEBUG_AOC (1 << 9) /* Debug of Advice of Charge ROSE Messages */ - -#define PRI_DEBUG_ALL (0xffff) /* Everything */ - -/* Switch types */ -#define PRI_SWITCH_UNKNOWN 0 -#define PRI_SWITCH_NI2 1 /* National ISDN 2 */ -#define PRI_SWITCH_DMS100 2 /* DMS 100 */ -#define PRI_SWITCH_LUCENT5E 3 /* Lucent 5E */ -#define PRI_SWITCH_ATT4ESS 4 /* AT&T 4ESS */ -#define PRI_SWITCH_EUROISDN_E1 5 /* Standard EuroISDN (CTR4, ETSI 300-102) */ -#define PRI_SWITCH_EUROISDN_T1 6 /* T1 EuroISDN variant (ETSI 300-102) */ -#define PRI_SWITCH_NI1 7 /* National ISDN 1 */ -#define PRI_SWITCH_GR303_EOC 8 /* GR-303 Embedded Operations Channel */ -#define PRI_SWITCH_GR303_TMC 9 /* GR-303 Timeslot Management Channel */ -#define PRI_SWITCH_QSIG 10 /* QSIG Switch */ -/* Switchtypes 11 - 20 are reserved for internal use */ - - -/* PRI D-Channel Events */ -#define PRI_EVENT_DCHAN_UP 1 /* D-channel is up */ -#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */ -#define PRI_EVENT_RESTART 3 /* B-channel is restarted */ -#define PRI_EVENT_CONFIG_ERR 4 /* Configuration Error Detected */ -#define PRI_EVENT_RING 5 /* Incoming call */ -#define PRI_EVENT_HANGUP 6 /* Call got hung up */ -#define PRI_EVENT_RINGING 7 /* Call is ringing (alerting) */ -#define PRI_EVENT_ANSWER 8 /* Call has been answered */ -#define PRI_EVENT_HANGUP_ACK 9 /* Call hangup has been acknowledged */ -#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel */ -#define PRI_EVENT_FACNAME 11 /* Caller*ID Name received on Facility */ -#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (keypad) received */ -#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING or PROGRESS */ -#define PRI_EVENT_SETUP_ACK 14 /* When we get SETUP_ACKNOWLEDGE */ -#define PRI_EVENT_HANGUP_REQ 15 /* Requesting the higher layer to hangup */ -#define PRI_EVENT_NOTIFY 16 /* Notification received */ -#define PRI_EVENT_PROGRESS 17 /* When we get CALL_PROCEEDING or PROGRESS */ -#define PRI_EVENT_KEYPAD_DIGIT 18 /* When we receive during ACTIVE state */ - -/* Simple states */ -#define PRI_STATE_DOWN 0 -#define PRI_STATE_UP 1 - -#define PRI_PROGRESS_MASK - -/* Progress indicator values */ -#define PRI_PROG_CALL_NOT_E2E_ISDN (1 << 0) -#define PRI_PROG_CALLED_NOT_ISDN (1 << 1) -#define PRI_PROG_CALLER_NOT_ISDN (1 << 2) -#define PRI_PROG_INBAND_AVAILABLE (1 << 3) -#define PRI_PROG_DELAY_AT_INTERF (1 << 4) -#define PRI_PROG_INTERWORKING_WITH_PUBLIC (1 << 5) -#define PRI_PROG_INTERWORKING_NO_RELEASE (1 << 6) -#define PRI_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER (1 << 7) -#define PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER (1 << 8) -#define PRI_PROG_CALLER_RETURNED_TO_ISDN (1 << 9) - -/* Numbering plan identifier */ -#define PRI_NPI_UNKNOWN 0x0 -#define PRI_NPI_E163_E164 0x1 -#define PRI_NPI_X121 0x3 -#define PRI_NPI_F69 0x4 -#define PRI_NPI_NATIONAL 0x8 -#define PRI_NPI_PRIVATE 0x9 -#define PRI_NPI_RESERVED 0xF - -/* Type of number */ -#define PRI_TON_UNKNOWN 0x0 -#define PRI_TON_INTERNATIONAL 0x1 -#define PRI_TON_NATIONAL 0x2 -#define PRI_TON_NET_SPECIFIC 0x3 -#define PRI_TON_SUBSCRIBER 0x4 -#define PRI_TON_ABBREVIATED 0x6 -#define PRI_TON_RESERVED 0x7 - -/* Redirection reasons */ -#define PRI_REDIR_UNKNOWN 0x0 -#define PRI_REDIR_FORWARD_ON_BUSY 0x1 -#define PRI_REDIR_FORWARD_ON_NO_REPLY 0x2 -#define PRI_REDIR_DEFLECTION 0x3 -#define PRI_REDIR_DTE_OUT_OF_ORDER 0x9 -#define PRI_REDIR_FORWARDED_BY_DTE 0xA -#define PRI_REDIR_UNCONDITIONAL 0xF - -/* Dialing plan */ -#define PRI_INTERNATIONAL_ISDN 0x11 -#define PRI_NATIONAL_ISDN 0x21 -#define PRI_LOCAL_ISDN 0x41 -#define PRI_PRIVATE 0x49 -#define PRI_UNKNOWN 0x0 - -/* Presentation */ -#define PRES_ALLOWED_USER_NUMBER_NOT_SCREENED 0x00 -#define PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN 0x01 -#define PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN 0x02 -#define PRES_ALLOWED_NETWORK_NUMBER 0x03 -#define PRES_PROHIB_USER_NUMBER_NOT_SCREENED 0x20 -#define PRES_PROHIB_USER_NUMBER_PASSED_SCREEN 0x21 -#define PRES_PROHIB_USER_NUMBER_FAILED_SCREEN 0x22 -#define PRES_PROHIB_NETWORK_NUMBER 0x23 -#define PRES_NUMBER_NOT_AVAILABLE 0x43 - -/* Causes for disconnection */ -#define PRI_CAUSE_UNALLOCATED 1 -#define PRI_CAUSE_NO_ROUTE_TRANSIT_NET 2 /* !Q.SIG */ -#define PRI_CAUSE_NO_ROUTE_DESTINATION 3 -#define PRI_CAUSE_CHANNEL_UNACCEPTABLE 6 -#define PRI_CAUSE_CALL_AWARDED_DELIVERED 7 /* !Q.SIG */ -#define PRI_CAUSE_NORMAL_CLEARING 16 -#define PRI_CAUSE_USER_BUSY 17 -#define PRI_CAUSE_NO_USER_RESPONSE 18 -#define PRI_CAUSE_NO_ANSWER 19 -#define PRI_CAUSE_CALL_REJECTED 21 -#define PRI_CAUSE_NUMBER_CHANGED 22 -#define PRI_CAUSE_DESTINATION_OUT_OF_ORDER 27 -#define PRI_CAUSE_INVALID_NUMBER_FORMAT 28 -#define PRI_CAUSE_FACILITY_REJECTED 29 /* !Q.SIG */ -#define PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30 -#define PRI_CAUSE_NORMAL_UNSPECIFIED 31 -#define PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION 34 -#define PRI_CAUSE_NETWORK_OUT_OF_ORDER 38 /* !Q.SIG */ -#define PRI_CAUSE_NORMAL_TEMPORARY_FAILURE 41 -#define PRI_CAUSE_SWITCH_CONGESTION 42 /* !Q.SIG */ -#define PRI_CAUSE_ACCESS_INFO_DISCARDED 43 /* !Q.SIG */ -#define PRI_CAUSE_REQUESTED_CHAN_UNAVAIL 44 -#define PRI_CAUSE_PRE_EMPTED 45 /* !Q.SIG */ -#define PRI_CAUSE_FACILITY_NOT_SUBSCRIBED 50 /* !Q.SIG */ -#define PRI_CAUSE_OUTGOING_CALL_BARRED 52 /* !Q.SIG */ -#define PRI_CAUSE_INCOMING_CALL_BARRED 54 /* !Q.SIG */ -#define PRI_CAUSE_BEARERCAPABILITY_NOTAUTH 57 -#define PRI_CAUSE_BEARERCAPABILITY_NOTAVAIL 58 -#define PRI_CAUSE_SERVICEOROPTION_NOTAVAIL 63 /* Q.SIG */ -#define PRI_CAUSE_BEARERCAPABILITY_NOTIMPL 65 -#define PRI_CAUSE_CHAN_NOT_IMPLEMENTED 66 /* !Q.SIG */ -#define PRI_CAUSE_FACILITY_NOT_IMPLEMENTED 69 /* !Q.SIG */ -#define PRI_CAUSE_INVALID_CALL_REFERENCE 81 -#define PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST 82 /* Q.SIG */ -#define PRI_CAUSE_INCOMPATIBLE_DESTINATION 88 -#define PRI_CAUSE_INVALID_MSG_UNSPECIFIED 95 /* !Q.SIG */ -#define PRI_CAUSE_MANDATORY_IE_MISSING 96 -#define PRI_CAUSE_MESSAGE_TYPE_NONEXIST 97 -#define PRI_CAUSE_WRONG_MESSAGE 98 -#define PRI_CAUSE_IE_NONEXIST 99 -#define PRI_CAUSE_INVALID_IE_CONTENTS 100 -#define PRI_CAUSE_WRONG_CALL_STATE 101 -#define PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102 -#define PRI_CAUSE_MANDATORY_IE_LENGTH_ERROR 103 /* !Q.SIG */ -#define PRI_CAUSE_PROTOCOL_ERROR 111 -#define PRI_CAUSE_INTERWORKING 127 /* !Q.SIG */ - -/* Transmit capabilities */ -#define PRI_TRANS_CAP_SPEECH 0x0 -#define PRI_TRANS_CAP_DIGITAL 0x08 -#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09 -#define PRI_TRANS_CAP_3_1K_AUDIO 0x10 -#define PRI_TRANS_CAP_7K_AUDIO 0x11 /* Depriciated ITU Q.931 (05/1998)*/ -#define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11 -#define PRI_TRANS_CAP_VIDEO 0x18 - -#define PRI_LAYER_1_ITU_RATE_ADAPT 0x21 -#define PRI_LAYER_1_ULAW 0x22 -#define PRI_LAYER_1_ALAW 0x23 -#define PRI_LAYER_1_G721 0x24 -#define PRI_LAYER_1_G722_G725 0x25 -#define PRI_LAYER_1_H223_H245 0x26 -#define PRI_LAYER_1_NON_ITU_ADAPT 0x27 -#define PRI_LAYER_1_V120_RATE_ADAPT 0x28 -#define PRI_LAYER_1_X31_RATE_ADAPT 0x29 - - -/* Intermediate rates for V.110 */ -#define PRI_INT_RATE_8K 1 -#define PRI_INT_RATE_16K 2 -#define PRI_INT_RATE_32K 3 - - -/* Rate adaption for bottom 5 bits of rateadaption */ -#define PRI_RATE_USER_RATE_MASK 0x1F -#define PRI_RATE_ADAPT_UNSPEC 0x00 -#define PRI_RATE_ADAPT_0K6 0x01 -#define PRI_RATE_ADAPT_1K2 0x02 -#define PRI_RATE_ADAPT_2K4 0x03 -#define PRI_RATE_ADAPT_3K6 0x04 -#define PRI_RATE_ADAPT_4K8 0x05 -#define PRI_RATE_ADAPT_7K2 0x06 -#define PRI_RATE_ADAPT_8K 0x07 -#define PRI_RATE_ADAPT_9K6 0x08 -#define PRI_RATE_ADAPT_14K4 0x09 -#define PRI_RATE_ADAPT_16K 0x0A -#define PRI_RATE_ADAPT_19K2 0x0B -#define PRI_RATE_ADAPT_32K 0x0C -#define PRI_RATE_ADAPT_38K4 0x0D -#define PRI_RATE_ADAPT_48K 0x0E -#define PRI_RATE_ADAPT_56K 0x0F -#define PRI_RATE_ADAPT_57K6 0x12 -#define PRI_RATE_ADAPT_28K8 0x13 -#define PRI_RATE_ADAPT_24K 0x14 -#define PRI_RATE_ADAPT_0K1345 0x15 -#define PRI_RATE_ADAPT_0K1 0x16 -#define PRI_RATE_ADAPT_0K075_1K2 0x17 -#define PRI_RATE_ADAPT_1K2_0K075 0x18 -#define PRI_RATE_ADAPT_0K05 0x19 -#define PRI_RATE_ADAPT_0K075 0x1A -#define PRI_RATE_ADAPT_0K110 0x1B -#define PRI_RATE_ADAPT_0K150 0x1C -#define PRI_RATE_ADAPT_0K200 0x1D -#define PRI_RATE_ADAPT_0K300 0x1E -#define PRI_RATE_ADAPT_12K 0x1F - -/* in-band negotiation flag for rateadaption bit 5 */ -#define PRI_RATE_ADAPT_NEGOTIATION_POSS 0x20 - -/* async flag for rateadaption bit 6 */ -#define PRI_RATE_ADAPT_ASYNC 0x40 - -/* Notifications */ -#define PRI_NOTIFY_USER_SUSPENDED 0x00 /* User suspended */ -#define PRI_NOTIFY_USER_RESUMED 0x01 /* User resumed */ -#define PRI_NOTIFY_BEARER_CHANGE 0x02 /* Bearer service change (DSS1) */ -#define PRI_NOTIFY_ASN1_COMPONENT 0x03 /* ASN.1 encoded component (DSS1) */ -#define PRI_NOTIFY_COMPLETION_DELAY 0x04 /* Call completion delay */ -#define PRI_NOTIFY_CONF_ESTABLISHED 0x42 /* Conference established */ -#define PRI_NOTIFY_CONF_DISCONNECTED 0x43 /* Conference disconnected */ -#define PRI_NOTIFY_CONF_PARTY_ADDED 0x44 /* Other party added */ -#define PRI_NOTIFY_CONF_ISOLATED 0x45 /* Isolated */ -#define PRI_NOTIFY_CONF_REATTACHED 0x46 /* Reattached */ -#define PRI_NOTIFY_CONF_OTHER_ISOLATED 0x47 /* Other party isolated */ -#define PRI_NOTIFY_CONF_OTHER_REATTACHED 0x48 /* Other party reattached */ -#define PRI_NOTIFY_CONF_OTHER_SPLIT 0x49 /* Other party split */ -#define PRI_NOTIFY_CONF_OTHER_DISCONNECTED 0x4a /* Other party disconnected */ -#define PRI_NOTIFY_CONF_FLOATING 0x4b /* Conference floating */ -#define PRI_NOTIFY_WAITING_CALL 0x60 /* Call is waiting call */ -#define PRI_NOTIFY_DIVERSION_ACTIVATED 0x68 /* Diversion activated (DSS1) */ -#define PRI_NOTIFY_TRANSFER_ALERTING 0x69 /* Call transfer, alerting */ -#define PRI_NOTIFY_TRANSFER_ACTIVE 0x6a /* Call transfer, active */ -#define PRI_NOTIFY_REMOTE_HOLD 0x79 /* Remote hold */ -#define PRI_NOTIFY_REMOTE_RETRIEVAL 0x7a /* Remote retrieval */ -#define PRI_NOTIFY_CALL_DIVERTING 0x7b /* Call is diverting */ - -#define PRI_COPY_DIGITS_CALLED_NUMBER - -/* Network Specific Facilities (AT&T) */ -#define PRI_NSF_NONE -1 -#define PRI_NSF_SID_PREFERRED 0xB1 -#define PRI_NSF_ANI_PREFERRED 0xB2 -#define PRI_NSF_SID_ONLY 0xB3 -#define PRI_NSF_ANI_ONLY 0xB4 -#define PRI_NSF_CALL_ASSOC_TSC 0xB9 -#define PRI_NSF_NOTIF_CATSC_CLEARING 0xBA -#define PRI_NSF_OPERATOR 0xB5 -#define PRI_NSF_PCCO 0xB6 -#define PRI_NSF_SDN 0xE1 -#define PRI_NSF_TOLL_FREE_MEGACOM 0xE2 -#define PRI_NSF_MEGACOM 0xE3 -#define PRI_NSF_ACCUNET 0xE6 -#define PRI_NSF_LONG_DISTANCE_SERVICE 0xE7 -#define PRI_NSF_INTERNATIONAL_TOLL_FREE 0xE8 -#define PRI_NSF_ATT_MULTIQUEST 0xF0 -#define PRI_NSF_CALL_REDIRECTION_SERVICE 0xF7 - -typedef struct q931_call q931_call; - -typedef struct pri_event_generic { - /* Events with no additional information fall in this category */ - int e; -} pri_event_generic; - -typedef struct pri_event_error { - int e; - char err[256]; -} pri_event_error; - -typedef struct pri_event_restart { - int e; - int channel; -} pri_event_restart; - -typedef struct pri_event_ringing { - int e; - int channel; - int cref; - int progress; - int progressmask; - q931_call *call; - char useruserinfo[260]; /* User->User info */ -} pri_event_ringing; - -typedef struct pri_event_answer { - int e; - int channel; - int cref; - int progress; - int progressmask; - q931_call *call; - char useruserinfo[260]; /* User->User info */ -} pri_event_answer; - -typedef struct pri_event_facname { - int e; - char callingname[256]; - char callingnum[256]; - int channel; - int cref; - q931_call *call; - int callingpres; /* Presentation of Calling CallerID */ - int callingplan; /* Dialing plan of Calling entity */ -} pri_event_facname; - -#define PRI_CALLINGPLANANI -#define PRI_CALLINGPLANRDNIS -typedef struct pri_event_ring { - int e; - int channel; /* Channel requested */ - int callingpres; /* Presentation of Calling CallerID */ - int callingplanani; /* Dialing plan of Calling entity ANI */ - int callingplan; /* Dialing plan of Calling entity */ - char callingani[256]; /* Calling ANI */ - char callingnum[256]; /* Calling number */ - char callingname[256]; /* Calling name (if provided) */ - int calledplan; /* Dialing plan of Called number */ - int ani2; /* ANI II */ - char callednum[256]; /* Called number */ - char redirectingnum[256]; /* Redirecting number */ - char redirectingname[256]; /* Redirecting name */ - int redirectingreason; /* Reason for redirect */ - int callingplanrdnis; /* Dialing plan of Redirecting Number */ - char useruserinfo[260]; /* User->User info */ - int flexible; /* Are we flexible with our channel selection? */ - int cref; /* Call Reference Number */ - int ctype; /* Call type (see PRI_TRANS_CAP_* */ - int layer1; /* User layer 1 */ - int complete; /* Have we seen "Complete" i.e. no more number? */ - q931_call *call; /* Opaque call pointer */ - char callingsubaddr[256]; /* Calling parties subaddress */ - int progress; - int progressmask; - char origcalledname[256]; - char origcallednum[256]; - int callingplanorigcalled; /* Dialing plan of Originally Called Number */ - int origredirectingreason; -} pri_event_ring; - -typedef struct pri_event_hangup { - int e; - int channel; /* Channel requested */ - int cause; - int cref; - q931_call *call; /* Opaque call pointer */ - long aoc_units; /* Advise of Charge number of charged units */ - char useruserinfo[260]; /* User->User info */ -} pri_event_hangup; - -typedef struct pri_event_restart_ack { - int e; - int channel; -} pri_event_restart_ack; - -#define PRI_PROGRESS_CAUSE -typedef struct pri_event_proceeding { - int e; - int channel; - int cref; - int progress; - int progressmask; - int cause; - q931_call *call; -} pri_event_proceeding; - -typedef struct pri_event_setup_ack { - int e; - int channel; - q931_call *call; -} pri_event_setup_ack; - -typedef struct pri_event_notify { - int e; - int channel; - int info; -} pri_event_notify; - -typedef struct pri_event_keypad_digit { - int e; - int channel; - q931_call *call; - char digits[64]; -} pri_event_keypad_digit; - -typedef union { - int e; - pri_event_generic gen; /* Generic view */ - pri_event_restart restart; /* Restart view */ - pri_event_error err; /* Error view */ - pri_event_facname facname; /* Caller*ID Name on Facility */ - pri_event_ring ring; /* Ring */ - pri_event_hangup hangup; /* Hang up */ - pri_event_ringing ringing; /* Ringing */ - pri_event_answer answer; /* Answer */ - pri_event_restart_ack restartack; /* Restart Acknowledge */ - pri_event_proceeding proceeding; /* Call proceeding & Progress */ - pri_event_setup_ack setup_ack; /* SETUP_ACKNOWLEDGE structure */ - pri_event_notify notify; /* Notification */ - pri_event_keypad_digit digit; /* Digits that come during a call */ -} pri_event; - -struct pri; -struct pri_sr; - -#define PRI_IO_FUNCS -/* Type declaration for callbacks to read or write a HDLC frame as below */ -typedef int (*pri_io_cb)(struct pri *pri, void *buf, int buflen); - -/* Create a D-channel on a given file descriptor. The file descriptor must be a - channel operating in HDLC mode with FCS computed by the fd's driver. Also it - must be NON-BLOCKING! Frames received on the fd should include FCS. Nodetype - must be one of PRI_NETWORK or PRI_CPE. switchtype should be PRI_SWITCH_* */ -struct pri *pri_new(int fd, int nodetype, int switchtype); -struct pri *pri_new_bri(int fd, int ptpmode, int nodetype, int switchtype); - -/* Create D-channel just as above with user defined I/O callbacks and data */ -struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata); - -/* Retrieve the user data associated with the D channel */ -void *pri_get_userdata(struct pri *pri); - -/* Set the user data associated with the D channel */ -void pri_set_userdata(struct pri *pri, void *userdata); - -/* Set Network Specific Facility for PRI */ -void pri_set_nsf(struct pri *pri, int nsf); - -/* Set debug parameters on PRI -- see above debug definitions */ -void pri_set_debug(struct pri *pri, int debug); - -/* Get debug parameters on PRI -- see above debug definitions */ -int pri_get_debug(struct pri *pri); - -#define PRI_FACILITY_ENABLE -/* Enable transmission support of Facility IEs on the pri */ -void pri_facility_enable(struct pri *pri); - -/* Run PRI on the given D-channel, taking care of any events that - need to be handled. If block is set, it will block until an event - occurs which needs to be handled */ -pri_event *pri_dchannel_run(struct pri *pri, int block); - -/* Check for an outstanding event on the PRI */ -pri_event *pri_check_event(struct pri *pri); - -/* Give a name to a given event ID */ -char *pri_event2str(int id); - -/* Give a name to a node type */ -char *pri_node2str(int id); - -/* Give a name to a switch type */ -char *pri_switch2str(int id); - -/* Print an event */ -void pri_dump_event(struct pri *pri, pri_event *e); - -/* Turn presentation into a string */ -char *pri_pres2str(int pres); - -/* Turn numbering plan into a string */ -char *pri_plan2str(int plan); - -/* Turn cause into a string */ -char *pri_cause2str(int cause); - -/* Acknowledge a call and place it on the given channel. Set info to non-zero if there - is in-band data available on the channel */ -int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info); - -/* Send a digit in overlap mode */ -int pri_information(struct pri *pri, q931_call *call, char digit); - -#define PRI_KEYPAD_FACILITY_TX -/* Send a keypad facility string of digits */ -int pri_keypad_facility(struct pri *pri, q931_call *call, char *digits); - -/* Answer the incomplete(call without called number) call on the given channel. - Set non-isdn to non-zero if you are not connecting to ISDN equipment */ -int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn); - -/* Answer the call on the given channel (ignored if you called acknowledge already). - Set non-isdn to non-zero if you are not connecting to ISDN equipment */ -int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn); - -/* Set CRV reference for GR-303 calls */ - - -#undef pri_release -#undef pri_disconnect - -/* backwards compatibility for those who don't use asterisk with libpri */ -#define pri_release(a,b,c) \ - pri_hangup(a,b,c) - -#define pri_disconnect(a,b,c) \ - pri_hangup(a,b,c) - -/* Hangup a call */ -#define PRI_HANGUP -int pri_hangup(struct pri *pri, q931_call *call, int cause); - -#define PRI_DESTROYCALL -void pri_destroycall(struct pri *pri, q931_call *call); - -#define PRI_RESTART -int pri_restart(struct pri *pri); - -int pri_reset(struct pri *pri, int channel); - -/* Create a new call */ -q931_call *pri_new_call(struct pri *pri); - -/* Retrieve CRV reference for GR-303 calls. Returns >0 on success. */ -int pri_get_crv(struct pri *pri, q931_call *call, int *callmode); - -/* Retrieve CRV reference for GR-303 calls. CRV must be >0, call mode should be 0 */ -int pri_set_crv(struct pri *pri, q931_call *call, int crv, int callmode); - -/* How long until you need to poll for a new event */ -struct timeval *pri_schedule_next(struct pri *pri); - -/* Run any pending schedule events */ -extern pri_event *pri_schedule_run(struct pri *pri); -extern pri_event *pri_schedule_run_tv(struct pri *pri, const struct timeval *now); - -int pri_call(struct pri *pri, q931_call *c, int transmode, int channel, - int exclusive, int nonisdn, char *caller, int callerplan, char *callername, int callerpres, - char *called,int calledplan, int ulayer1); - -struct pri_sr *pri_sr_new(void); -void pri_sr_free(struct pri_sr *sr); - -int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn); -int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1); -int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete); -int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres); -int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason); -#define PRI_USER_USER_TX -/* Set the user user field. Warning! don't send binary data accross this field */ -void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars); - -void pri_call_set_useruser(q931_call *sr, const char *userchars); - -int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req); - -/* Set a call has a call indpendent signalling connection (i.e. no bchan) */ -int pri_sr_set_connection_call_independent(struct pri_sr *req); - -/* Send an MWI indication to a remote location. If activate is non zero, activates, if zero, decativates */ -int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, int calledplan); - -/* Send an MWI deactivate request to a remote location */ -int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, int calledplan); - -#define PRI_2BCT -/* Attempt to pass the channels back to the NET side if compatable and - * suscribed. Sometimes called 2 bchannel transfer (2BCT) */ -int pri_channel_bridge(q931_call *call1, q931_call *call2); - -/* Override message and error stuff */ -#define PRI_NEW_SET_API -void pri_set_message(void (*__pri_error)(struct pri *pri, char *)); -void pri_set_error(void (*__pri_error)(struct pri *pri, char *)); - -/* Set overlap mode */ -#define PRI_SET_OVERLAPDIAL -void pri_set_overlapdial(struct pri *pri,int state); - -#define PRI_DUMP_INFO_STR -char *pri_dump_info_str(struct pri *pri); - -/* Get file descriptor */ -int pri_fd(struct pri *pri); - -#define PRI_PROGRESS -/* Send call proceeding */ -int pri_progress(struct pri *pri, q931_call *c, int channel, int info); - -#define PRI_PROCEEDING_FULL -/* Send call proceeding */ -int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info); - -/* Enable inband progress when a DISCONNECT is received */ -void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable); - -/* Enslave a PRI to another, so they share the same call list - (and maybe some timers) */ -void pri_enslave(struct pri *master, struct pri *slave); - -#define PRI_GR303_SUPPORT -#define PRI_ENSLAVE_SUPPORT -#define PRI_SETUP_CALL -#define PRI_RECEIVE_SUBADDR -#define PRI_REDIRECTING_REASON -#define PRI_AOC_UNITS -#define PRI_ANI - -/* Send notification */ -int pri_notify(struct pri *pri, q931_call *c, int channel, int info); - -/* Get/Set PRI Timers */ -#define PRI_GETSET_TIMERS -int pri_set_timer(struct pri *pri, int timer, int value); -int pri_get_timer(struct pri *pri, int timer); -int pri_timer2idx(char *timer); - -#define PRI_MAX_TIMERS 32 - -#define PRI_TIMER_N200 0 /* Maximum numer of q921 retransmissions */ -#define PRI_TIMER_N201 1 /* Maximum numer of octets in an information field */ -#define PRI_TIMER_N202 2 /* Maximum numer of transmissions of the TEI identity request message */ -#define PRI_TIMER_K 3 /* Maximum number of outstanding I-frames */ - -#define PRI_TIMER_T200 4 /* time between SABME's */ -#define PRI_TIMER_T201 5 /* minimum time between retransmissions of the TEI Identity check messages */ -#define PRI_TIMER_T202 6 /* minimum time between transmission of TEI Identity request messages */ -#define PRI_TIMER_T203 7 /* maxiumum time without exchanging packets */ - -#define PRI_TIMER_T300 8 -#define PRI_TIMER_T301 9 /* maximum time to respond to an ALERT */ -#define PRI_TIMER_T302 10 -#define PRI_TIMER_T303 11 /* maximum time to wait after sending a SETUP without a response */ -#define PRI_TIMER_T304 12 -#define PRI_TIMER_T305 13 -#define PRI_TIMER_T306 14 -#define PRI_TIMER_T307 15 -#define PRI_TIMER_T308 16 -#define PRI_TIMER_T309 17 -#define PRI_TIMER_T310 18 /* maximum time between receiving a CALLPROCEEDING and receiving a ALERT/CONNECT/DISCONNECT/PROGRESS */ -#define PRI_TIMER_T313 19 -#define PRI_TIMER_T314 20 -#define PRI_TIMER_T316 21 /* maximum time between transmitting a RESTART and receiving a RESTART ACK */ -#define PRI_TIMER_T317 22 -#define PRI_TIMER_T318 23 -#define PRI_TIMER_T319 24 -#define PRI_TIMER_T320 25 -#define PRI_TIMER_T321 26 -#define PRI_TIMER_T322 27 - -#define PRI_TIMER_TM20 28 /* maximum time avaiting XID response */ -#define PRI_TIMER_NM20 29 /* number of XID retransmits */ - -/* Get PRI version */ -const char *pri_get_version(void); - -#endif diff --git a/libpri/pri.c b/libpri/pri.c deleted file mode 100644 index c5732b23..00000000 --- a/libpri/pri.c +++ /dev/null @@ -1,913 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "compat.h" -#include "libpri.h" -#include "pri_internal.h" -#include "pri_facility.h" -#include "pri_q921.h" -#include "pri_q931.h" -#include "pri_timers.h" - -char *pri_node2str(int node) -{ - switch(node) { - case PRI_UNKNOWN: - return "Unknown node type"; - case PRI_NETWORK: - return "Network"; - case PRI_CPE: - return "CPE"; - default: - return "Invalid value"; - } -} - -char *pri_switch2str(int sw) -{ - switch(sw) { - case PRI_SWITCH_NI2: - return "National ISDN"; - case PRI_SWITCH_DMS100: - return "Nortel DMS100"; - case PRI_SWITCH_LUCENT5E: - return "Lucent 5E"; - case PRI_SWITCH_ATT4ESS: - return "AT&T 4ESS"; - case PRI_SWITCH_NI1: - return "National ISDN 1"; - case PRI_SWITCH_EUROISDN_E1: - return "EuroISDN"; - case PRI_SWITCH_GR303_EOC: - return "GR303 EOC"; - case PRI_SWITCH_GR303_TMC: - return "GR303 TMC"; - case PRI_SWITCH_QSIG: - return "Q.SIG switch"; - default: - return "Unknown switchtype"; - } -} - -static void pri_default_timers(struct pri *pri, int switchtype) -{ - static const int defaulttimers[20][PRI_MAX_TIMERS] = PRI_TIMERS_ALL; - int x; - - for (x = 0; xtimers[x] = defaulttimers[switchtype][x]; - } -} - -int pri_set_timer(struct pri *pri, int timer, int value) -{ - if (timer < 0 || timer > PRI_MAX_TIMERS || value < 0) - return -1; - - pri->timers[timer] = value; - return 0; -} - -int pri_get_timer(struct pri *pri, int timer) -{ - if (timer < 0 || timer > PRI_MAX_TIMERS) - return -1; - return pri->timers[timer]; -} - -int pri_timer2idx(char *timer) -{ - if (!strcasecmp(timer, "N200")) - return PRI_TIMER_N200; - else if (!strcasecmp(timer, "N201")) - return PRI_TIMER_N201; - else if (!strcasecmp(timer, "N202")) - return PRI_TIMER_N202; - else if (!strcasecmp(timer, "K")) - return PRI_TIMER_K; - else if (!strcasecmp(timer, "T200")) - return PRI_TIMER_T200; - else if (!strcasecmp(timer, "T202")) - return PRI_TIMER_T202; - else if (!strcasecmp(timer, "T203")) - return PRI_TIMER_T203; - else if (!strcasecmp(timer, "T300")) - return PRI_TIMER_T300; - else if (!strcasecmp(timer, "T301")) - return PRI_TIMER_T301; - else if (!strcasecmp(timer, "T302")) - return PRI_TIMER_T302; - else if (!strcasecmp(timer, "T303")) - return PRI_TIMER_T303; - else if (!strcasecmp(timer, "T304")) - return PRI_TIMER_T304; - else if (!strcasecmp(timer, "T305")) - return PRI_TIMER_T305; - else if (!strcasecmp(timer, "T306")) - return PRI_TIMER_T306; - else if (!strcasecmp(timer, "T307")) - return PRI_TIMER_T307; - else if (!strcasecmp(timer, "T308")) - return PRI_TIMER_T308; - else if (!strcasecmp(timer, "T309")) - return PRI_TIMER_T309; - else if (!strcasecmp(timer, "T310")) - return PRI_TIMER_T310; - else if (!strcasecmp(timer, "T313")) - return PRI_TIMER_T313; - else if (!strcasecmp(timer, "T314")) - return PRI_TIMER_T314; - else if (!strcasecmp(timer, "T316")) - return PRI_TIMER_T316; - else if (!strcasecmp(timer, "T317")) - return PRI_TIMER_T317; - else if (!strcasecmp(timer, "T318")) - return PRI_TIMER_T318; - else if (!strcasecmp(timer, "T319")) - return PRI_TIMER_T319; - else if (!strcasecmp(timer, "T320")) - return PRI_TIMER_T320; - else if (!strcasecmp(timer, "T321")) - return PRI_TIMER_T321; - else if (!strcasecmp(timer, "T322")) - return PRI_TIMER_T322; - else - return -1; -} - -static int __pri_read(struct pri *pri, void *buf, int buflen) -{ - int res = read(pri->fd, buf, buflen); - if (res < 0) { - if (errno != EAGAIN) - pri_error(pri, "Read on %d failed: %s\n", pri->fd, strerror(errno)); - return 0; - } - return res; -} - -static int __pri_write(struct pri *pri, void *buf, int buflen) -{ - int res = write(pri->fd, buf, buflen); - if (res < 0) { - if (errno != EAGAIN) - pri_error(pri, "Write to %d failed: %s\n", pri->fd, strerror(errno)); - return 0; - } - return res; -} - -/* Pass in the master for this function */ -void __pri_free_tei(struct pri * p) -{ - free (p); -} - -struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri) -{ - struct pri *p; - - if (!(p = calloc(1, sizeof(*p)))) - return NULL; - - p->bri = bri; - p->fd = fd; - p->read_func = rd; - p->write_func = wr; - p->userdata = userdata; - p->localtype = node; - p->switchtype = switchtype; - p->cref = 1; - p->sapi = (tei == Q921_TEI_GROUP) ? Q921_SAPI_LAYER2_MANAGEMENT : Q921_SAPI_CALL_CTRL; - p->tei = tei; - p->nsf = PRI_NSF_NONE; - p->protodisc = Q931_PROTOCOL_DISCRIMINATOR; - p->master = master; - p->callpool = &p->localpool; - pri_default_timers(p, switchtype); - if (master) { - pri_set_debug(p, master->debug); - if (master->sendfacility) - pri_facility_enable(p); - } -#ifdef LIBPRI_COUNTERS - p->q921_rxcount = 0; - p->q921_txcount = 0; - p->q931_rxcount = 0; - p->q931_txcount = 0; -#endif - if (switchtype == PRI_SWITCH_GR303_EOC) { - p->protodisc = GR303_PROTOCOL_DISCRIMINATOR; - p->sapi = Q921_SAPI_GR303_EOC; - p->tei = Q921_TEI_GR303_EOC_OPS; - p->subchannel = __pri_new_tei(-1, node, PRI_SWITCH_GR303_EOC_PATH, p, NULL, NULL, NULL, Q921_TEI_GR303_EOC_PATH, 0); - if (!p->subchannel) { - free(p); - p = NULL; - } - } else if (switchtype == PRI_SWITCH_GR303_TMC) { - p->protodisc = GR303_PROTOCOL_DISCRIMINATOR; - p->sapi = Q921_SAPI_GR303_TMC_CALLPROC; - p->tei = Q921_TEI_GR303_TMC_CALLPROC; - p->subchannel = __pri_new_tei(-1, node, PRI_SWITCH_GR303_TMC_SWITCHING, p, NULL, NULL, NULL, Q921_TEI_GR303_TMC_SWITCHING, 0); - if (!p->subchannel) { - free(p); - p = NULL; - } - } else if (switchtype == PRI_SWITCH_GR303_TMC_SWITCHING) { - p->protodisc = GR303_PROTOCOL_DISCRIMINATOR; - p->sapi = Q921_SAPI_GR303_TMC_SWITCHING; - p->tei = Q921_TEI_GR303_TMC_SWITCHING; - } else if (switchtype == PRI_SWITCH_GR303_EOC_PATH) { - p->protodisc = GR303_PROTOCOL_DISCRIMINATOR; - p->sapi = Q921_SAPI_GR303_EOC; - p->tei = Q921_TEI_GR303_EOC_PATH; - } - /* Start Q.921 layer, Wait if we're the network */ - if (p) - q921_start(p, p->localtype == PRI_CPE); - - return p; -} - -void pri_call_set_useruser(q931_call *c, const char *userchars) -{ - if (userchars) - libpri_copy_string(c->useruserinfo, userchars, sizeof(c->useruserinfo)); -} - -void pri_sr_set_useruser(struct pri_sr *sr, const char *userchars) -{ - sr->useruserinfo = userchars; -} - -int pri_restart(struct pri *pri) -{ - /* Restart Q.921 layer */ - if (pri) { - q921_reset(pri); - q921_start(pri, pri->localtype == PRI_CPE); - } - return 0; -} - -struct pri *pri_new(int fd, int nodetype, int switchtype) -{ - return __pri_new_tei(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL, Q921_TEI_PRI, 0); -} - -struct pri *pri_new_bri(int fd, int ptpmode, int nodetype, int switchtype) -{ - if (ptpmode) - return __pri_new_tei(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL, Q921_TEI_PRI, 1); - else - return __pri_new_tei(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL, Q921_TEI_GROUP, 1); -} - -struct pri *pri_new_cb(int fd, int nodetype, int switchtype, pri_io_cb io_read, pri_io_cb io_write, void *userdata) -{ - if (!io_read) - io_read = __pri_read; - if (!io_write) - io_write = __pri_write; - return __pri_new_tei(fd, nodetype, switchtype, NULL, io_read, io_write, userdata, Q921_TEI_PRI, 0); -} - -void *pri_get_userdata(struct pri *pri) -{ - return pri ? pri->userdata : NULL; -} - -void pri_set_userdata(struct pri *pri, void *userdata) -{ - if (pri) - pri->userdata = userdata; -} - -void pri_set_nsf(struct pri *pri, int nsf) -{ - if (pri) - pri->nsf = nsf; -} - -char *pri_event2str(int id) -{ - switch(id) { - case PRI_EVENT_DCHAN_UP: - return "D-Channel Up"; - case PRI_EVENT_DCHAN_DOWN: - return "D-channel Down"; - case PRI_EVENT_RESTART: - return "Restart channel"; - case PRI_EVENT_RING: - return "Ring"; - case PRI_EVENT_HANGUP: - return "Hangup"; - case PRI_EVENT_RINGING: - return "Ringing"; - case PRI_EVENT_ANSWER: - return "Answer"; - case PRI_EVENT_HANGUP_ACK: - return "Hangup ACK"; - case PRI_EVENT_RESTART_ACK: - return "Restart ACK"; - case PRI_EVENT_FACNAME: - return "FacName"; - case PRI_EVENT_INFO_RECEIVED: - return "Info Received"; - case PRI_EVENT_PROCEEDING: - return "Proceeding"; - case PRI_EVENT_SETUP_ACK: - return "Setup ACK"; - case PRI_EVENT_HANGUP_REQ: - return "Hangup Req"; - case PRI_EVENT_NOTIFY: - return "Notify"; - case PRI_EVENT_PROGRESS: - return "Progress"; - case PRI_EVENT_CONFIG_ERR: - return "Configuration Error"; - default: - return "Unknown Event"; - } -} - -pri_event *pri_check_event(struct pri *pri) -{ - char buf[1024]; - int res; - pri_event *e; - res = pri->read_func ? pri->read_func(pri, buf, sizeof(buf)) : 0; - if (!res) - return NULL; - /* Receive the q921 packet */ - e = q921_receive(pri, (q921_h *)buf, res); - return e; -} - -static int wait_pri(struct pri *pri) -{ - struct timeval *tv, real; - fd_set fds; - int res; - FD_ZERO(&fds); - FD_SET(pri->fd, &fds); - tv = pri_schedule_next(pri); - if (tv) { - gettimeofday(&real, NULL); - real.tv_sec = tv->tv_sec - real.tv_sec; - real.tv_usec = tv->tv_usec - real.tv_usec; - if (real.tv_usec < 0) { - real.tv_usec += 1000000; - real.tv_sec -= 1; - } - if (real.tv_sec < 0) { - real.tv_sec = 0; - real.tv_usec = 0; - } - } - res = select(pri->fd + 1, &fds, NULL, NULL, tv ? &real : tv); - if (res < 0) - return -1; - return res; -} - -pri_event *pri_mkerror(struct pri *pri, char *errstr) -{ - /* Return a configuration error */ - pri->ev.err.e = PRI_EVENT_CONFIG_ERR; - libpri_copy_string(pri->ev.err.err, errstr, sizeof(pri->ev.err.err)); - return &pri->ev; -} - - -pri_event *pri_dchannel_run(struct pri *pri, int block) -{ - pri_event *e; - int res; - if (!pri) - return NULL; - if (block) { - do { - e = NULL; - res = wait_pri(pri); - /* Check for error / interruption */ - if (res < 0) - return NULL; - if (!res) - e = pri_schedule_run(pri); - else - e = pri_check_event(pri); - } while(!e); - } else { - e = pri_check_event(pri); - return e; - } - return e; -} - -void pri_set_debug(struct pri *pri, int debug) -{ - if (!pri) - return; - pri->debug = debug; - if (pri->subchannel) - pri_set_debug(pri->subchannel, debug); -} - -int pri_get_debug(struct pri *pri) -{ - if (!pri) - return -1; - if (pri->subchannel) - return pri_get_debug(pri->subchannel); - return pri->debug; -} - -void pri_facility_enable(struct pri *pri) -{ - if (!pri) - return; - pri->sendfacility = 1; - if (pri->subchannel) - pri_facility_enable(pri->subchannel); - return; -} - -int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info) -{ - if (!pri || !call) - return -1; - return q931_alerting(pri, call, channel, info); -} - -int pri_proceeding(struct pri *pri, q931_call *call, int channel, int info) -{ - if (!pri || !call) - return -1; - return q931_call_proceeding(pri, call, channel, info); -} - -int pri_progress(struct pri *pri, q931_call *call, int channel, int info) -{ - if (!pri || !call) - return -1; - return q931_call_progress(pri, call, channel, info); -} - -int pri_information(struct pri *pri, q931_call *call, char digit) -{ - if (!pri || !call) - return -1; - return q931_information(pri, call, digit); -} - -int pri_keypad_facility(struct pri *pri, q931_call *call, char *digits) -{ - if (!pri || !call || !digits || !digits[0]) - return -1; - - return q931_keypad_facility(pri, call, digits); -} - -int pri_notify(struct pri *pri, q931_call *call, int channel, int info) -{ - if (!pri || !call) - return -1; - return q931_notify(pri, call, channel, info); -} - -void pri_destroycall(struct pri *pri, q931_call *call) -{ - if (pri && call) - __q931_destroycall(pri, call); - return; -} - -int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn) -{ - if (!pri || !call) - return -1; - return q931_setup_ack(pri, call, channel, nonisdn); -} - -int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn) -{ - if (!pri || !call) - return -1; - return q931_connect(pri, call, channel, nonisdn); -} - -#if 0 -/* deprecated routines, use pri_hangup */ -int pri_release(struct pri *pri, q931_call *call, int cause) -{ - if (!pri || !call) - return -1; - return q931_release(pri, call, cause); -} - -int pri_disconnect(struct pri *pri, q931_call *call, int cause) -{ - if (!pri || !call) - return -1; - return q931_disconnect(pri, call, cause); -} -#endif - -int pri_channel_bridge(q931_call *call1, q931_call *call2) -{ - if (!call1 || !call2) - return -1; - - /* Make sure we have compatible switchtypes */ - if (call1->pri->switchtype != call2->pri->switchtype) - return -1; - - /* Check for bearer capability */ - if (call1->transcapability != call2->transcapability) - return -1; - - /* Check to see if we're on the same PRI */ - if (call1->pri != call2->pri) - return -1; - - switch (call1->pri->switchtype) { - case PRI_SWITCH_NI2: - case PRI_SWITCH_LUCENT5E: - case PRI_SWITCH_ATT4ESS: - if (eect_initiate_transfer(call1->pri, call1, call2)) - return -1; - else - return 0; - break; - case PRI_SWITCH_DMS100: - if (rlt_initiate_transfer(call1->pri, call1, call2)) - return -1; - else - return 0; - break; - case PRI_SWITCH_QSIG: - call1->bridged_call = call2; - call2->bridged_call = call1; - if (anfpr_initiate_transfer(call1->pri, call1, call2)) - return -1; - else - return 0; - break; - default: - return -1; - } -} - -int pri_hangup(struct pri *pri, q931_call *call, int cause) -{ - if (!pri || !call) - return -1; - if (cause == -1) - /* normal clear cause */ - cause = 16; - return q931_hangup(pri, call, cause); -} - -int pri_reset(struct pri *pri, int channel) -{ - if (!pri) - return -1; - return q931_restart(pri, channel); -} - -q931_call *pri_new_call(struct pri *pri) -{ - if (!pri) - return NULL; - return q931_new_call(pri); -} - -void pri_dump_event(struct pri *pri, pri_event *e) -{ - if (!pri || !e) - return; - pri_message(pri, "Event type: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - switch(e->gen.e) { - case PRI_EVENT_DCHAN_UP: - case PRI_EVENT_DCHAN_DOWN: - break; - case PRI_EVENT_CONFIG_ERR: - pri_message(pri, "Error: %s", e->err.err); - break; - case PRI_EVENT_RESTART: - pri_message(pri, "Restart on channel %d\n", e->restart.channel); - case PRI_EVENT_RING: - pri_message(pri, "Calling number: %s (%s, %s)\n", e->ring.callingnum, pri_plan2str(e->ring.callingplan), pri_pres2str(e->ring.callingpres)); - pri_message(pri, "Called number: %s (%s)\n", e->ring.callednum, pri_plan2str(e->ring.calledplan)); - pri_message(pri, "Channel: %d (%s) Reference number: %d\n", e->ring.channel, e->ring.flexible ? "Flexible" : "Not Flexible", e->ring.cref); - break; - case PRI_EVENT_HANGUP: - pri_message(pri, "Hangup, reference number: %d, reason: %s\n", e->hangup.cref, pri_cause2str(e->hangup.cause)); - break; - default: - pri_message(pri, "Don't know how to dump events of type %d\n", e->gen.e); - } -} - -static void pri_sr_init(struct pri_sr *req) -{ - memset(req, 0, sizeof(struct pri_sr)); - -} - -int pri_sr_set_connection_call_independent(struct pri_sr *req) -{ - if (!req) - return -1; - - req->justsignalling = 1; /* have to set justsignalling for all those pesky IEs we need to setup */ - return 0; -} - -/* Don't call any other pri functions on this */ -int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, - int calledplan) -{ - struct pri_sr req; - if (!pri || !c) - return -1; - - pri_sr_init(&req); - pri_sr_set_connection_call_independent(&req); - - req.caller = caller; - req.callerplan = callerplan; - req.callername = callername; - req.callerpres = callerpres; - req.called = called; - req.calledplan = calledplan; - - if (mwi_message_send(pri, c, &req, 1) < 0) { - pri_message(pri, "Unable to send MWI activate message\n"); - return -1; - } - /* Do more stuff when we figure out that the CISC stuff works */ - return q931_setup(pri, c, &req); -} - -int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, - int calledplan) -{ - struct pri_sr req; - if (!pri || !c) - return -1; - - pri_sr_init(&req); - pri_sr_set_connection_call_independent(&req); - - req.caller = caller; - req.callerplan = callerplan; - req.callername = callername; - req.callerpres = callerpres; - req.called = called; - req.calledplan = calledplan; - - if(mwi_message_send(pri, c, &req, 0) < 0) { - pri_message(pri, "Unable to send MWI deactivate message\n"); - return -1; - } - - return q931_setup(pri, c, &req); -} - -int pri_setup(struct pri *pri, q931_call *c, struct pri_sr *req) -{ - if (!pri || !c) - return -1; - - return q931_setup(pri, c, req); -} - -int pri_call(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive, - int nonisdn, char *caller, int callerplan, char *callername, int callerpres, char *called, - int calledplan,int ulayer1) -{ - struct pri_sr req; - if (!pri || !c) - return -1; - pri_sr_init(&req); - req.transmode = transmode; - req.channel = channel; - req.exclusive = exclusive; - req.nonisdn = nonisdn; - req.caller = caller; - req.callerplan = callerplan; - req.callername = callername; - req.callerpres = callerpres; - req.called = called; - req.calledplan = calledplan; - req.userl1 = ulayer1; - return q931_setup(pri, c, &req); -} - -static void (*__pri_error)(struct pri *pri, char *stuff); -static void (*__pri_message)(struct pri *pri, char *stuff); - -void pri_set_message(void (*func)(struct pri *pri, char *stuff)) -{ - __pri_message = func; -} - -void pri_set_error(void (*func)(struct pri *pri, char *stuff)) -{ - __pri_error = func; -} - -void pri_message(struct pri *pri, char *fmt, ...) -{ - char tmp[1024]; - va_list ap; - va_start(ap, fmt); - vsnprintf(tmp, sizeof(tmp), fmt, ap); - va_end(ap); - if (__pri_message) - __pri_message(pri, tmp); - else - fputs(tmp, stdout); -} - -void pri_error(struct pri *pri, char *fmt, ...) -{ - char tmp[1024]; - va_list ap; - va_start(ap, fmt); - vsnprintf(tmp, sizeof(tmp), fmt, ap); - va_end(ap); - if (__pri_error) - __pri_error(pri, tmp); - else - fputs(tmp, stderr); -} - -/* Set overlap mode */ -void pri_set_overlapdial(struct pri *pri,int state) -{ - pri->overlapdial = state; -} - -void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable) -{ - pri->acceptinbanddisconnect = (enable != 0); -} - -int pri_fd(struct pri *pri) -{ - return pri->fd; -} - -char *pri_dump_info_str(struct pri *pri) -{ - char buf[4096]; - int len = 0; -#ifdef LIBPRI_COUNTERS - struct q921_frame *f; - int q921outstanding = 0; -#endif - if (!pri) - return NULL; - - /* Might be nice to format these a little better */ - len += sprintf(buf + len, "Switchtype: %s\n", pri_switch2str(pri->switchtype)); - len += sprintf(buf + len, "Type: %s\n", pri_node2str(pri->localtype)); -#ifdef LIBPRI_COUNTERS - /* Remember that Q921 Counters include Q931 packets (and any retransmissions) */ - len += sprintf(buf + len, "Q931 RX: %d\n", pri->q931_rxcount); - len += sprintf(buf + len, "Q931 TX: %d\n", pri->q931_txcount); - len += sprintf(buf + len, "Q921 RX: %d\n", pri->q921_rxcount); - len += sprintf(buf + len, "Q921 TX: %d\n", pri->q921_txcount); - f = pri->txqueue; - while (f) { - q921outstanding++; - f = f->next; - } - len += sprintf(buf + len, "Q921 Outstanding: %d\n", q921outstanding); -#endif - len += sprintf(buf + len, "Window Length: %d/%d\n", pri->windowlen, pri->window); - len += sprintf(buf + len, "Sentrej: %d\n", pri->sentrej); - len += sprintf(buf + len, "SolicitFbit: %d\n", pri->solicitfbit); - len += sprintf(buf + len, "Retrans: %d\n", pri->retrans); - len += sprintf(buf + len, "Busy: %d\n", pri->busy); - len += sprintf(buf + len, "Overlap Dial: %d\n", pri->overlapdial); - len += sprintf(buf + len, "T200 Timer: %d\n", pri->timers[PRI_TIMER_T200]); - len += sprintf(buf + len, "T203 Timer: %d\n", pri->timers[PRI_TIMER_T203]); - len += sprintf(buf + len, "T305 Timer: %d\n", pri->timers[PRI_TIMER_T305]); - len += sprintf(buf + len, "T308 Timer: %d\n", pri->timers[PRI_TIMER_T308]); - len += sprintf(buf + len, "T309 Timer: %d\n", pri->timers[PRI_TIMER_T309]); - len += sprintf(buf + len, "T313 Timer: %d\n", pri->timers[PRI_TIMER_T313]); - len += sprintf(buf + len, "N200 Counter: %d\n", pri->timers[PRI_TIMER_N200]); - - return strdup(buf); -} - -int pri_get_crv(struct pri *pri, q931_call *call, int *callmode) -{ - return q931_call_getcrv(pri, call, callmode); -} - -int pri_set_crv(struct pri *pri, q931_call *call, int crv, int callmode) -{ - return q931_call_setcrv(pri, call, crv, callmode); -} - -void pri_enslave(struct pri *master, struct pri *slave) -{ - if (master && slave) - slave->callpool = &master->localpool; -} - -struct pri_sr *pri_sr_new(void) -{ - struct pri_sr *req; - req = malloc(sizeof(*req)); - if (req) - pri_sr_init(req); - return req; -} - -void pri_sr_free(struct pri_sr *sr) -{ - free(sr); -} - -int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn) -{ - sr->channel = channel; - sr->exclusive = exclusive; - sr->nonisdn = nonisdn; - return 0; -} - -int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1) -{ - sr->transmode = transmode; - sr->userl1 = userl1; - return 0; -} - -int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int numcomplete) -{ - sr->called = called; - sr->calledplan = calledplan; - sr->numcomplete = numcomplete; - return 0; -} - -int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres) -{ - sr->caller = caller; - sr->callername = callername; - sr->callerplan = callerplan; - sr->callerpres = callerpres; - return 0; -} - -int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason) -{ - sr->redirectingnum = num; - sr->redirectingplan = plan; - sr->redirectingpres = pres; - sr->redirectingreason = reason; - return 0; -} diff --git a/libpri/pri_facility.c b/libpri/pri_facility.c deleted file mode 100644 index 9cb7a43d..00000000 --- a/libpri/pri_facility.c +++ /dev/null @@ -1,2438 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Matthew Fredrickson - * - * Copyright (C) 2004-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include "compat.h" -#include "libpri.h" -#include "pri_internal.h" -#include "pri_q921.h" -#include "pri_q931.h" -#include "pri_facility.h" - -#include -#include -#include -#include - -static char *asn1id2text(int id) -{ - static char data[32]; - static char *strings[] = { - "none", - "Boolean", - "Integer", - "Bit String", - "Octet String", - "NULL", - "Object Identifier", - "Object Descriptor", - "External Reference", - "Real Number", - "Enumerated", - "Embedded PDV", - "UTF-8 String", - "Relative Object ID", - "Reserved (0e)", - "Reserved (0f)", - "Sequence", - "Set", - "Numeric String", - "Printable String", - "Tele-Text String", - "IA-5 String", - "UTC Time", - "Generalized Time", - }; - if (id > 0 && id <= 0x18) { - return strings[id]; - } else { - sprintf(data, "Unknown (%02x)", id); - return data; - } -} - -static int asn1_dumprecursive(struct pri *pri, void *comp_ptr, int len, int level) -{ - unsigned char *vdata = (unsigned char *)comp_ptr; - struct rose_component *comp; - int i = 0; - int j, k, l; - int clen = 0; - - while (len > 0) { - GET_COMPONENT(comp, i, vdata, len); - pri_message(pri, "%*s%02X %04X", 2 * level, "", comp->type, comp->len); - if ((comp->type == 0) && (comp->len == 0)) - return clen + 2; - if ((comp->type & ASN1_PC_MASK) == ASN1_PRIMITIVE) { - for (j = 0; j < comp->len; ++j) - pri_message(pri, " %02X", comp->data[j]); - } - if ((comp->type & ASN1_CLAN_MASK) == ASN1_UNIVERSAL) { - switch (comp->type & ASN1_TYPE_MASK) { - case 0: - pri_message(pri, " (none)"); - break; - case ASN1_BOOLEAN: - pri_message(pri, " (BOOLEAN: %d)", comp->data[0]); - break; - case ASN1_INTEGER: - for (k = l = 0; k < comp->len; ++k) - l = (l << 8) | comp->data[k]; - pri_message(pri, " (INTEGER: %d)", l); - break; - case ASN1_BITSTRING: - pri_message(pri, " (BITSTRING:"); - for (k = 0; k < comp->len; ++k) - pri_message(pri, " %02x", comp->data[k]); - pri_message(pri, ")"); - break; - case ASN1_OCTETSTRING: - pri_message(pri, " (OCTETSTRING:"); - for (k = 0; k < comp->len; ++k) - pri_message(pri, " %02x", comp->data[k]); - pri_message(pri, ")"); - break; - case ASN1_NULL: - pri_message(pri, " (NULL)"); - break; - case ASN1_OBJECTIDENTIFIER: - pri_message(pri, " (OBJECTIDENTIFIER:"); - for (k = 0; k < comp->len; ++k) - pri_message(pri, " %02x", comp->data[k]); - pri_message(pri, ")"); - break; - case ASN1_ENUMERATED: - for (k = l = 0; k < comp->len; ++k) - l = (l << 8) | comp->data[k]; - pri_message(pri, " (ENUMERATED: %d)", l); - break; - case ASN1_SEQUENCE: - pri_message(pri, " (SEQUENCE)"); - break; - default: - pri_message(pri, " (component %02x - %s)", comp->type, asn1id2text(comp->type & ASN1_TYPE_MASK)); - break; - } - } - else if ((comp->type & ASN1_CLAN_MASK) == ASN1_CONTEXT_SPECIFIC) { - pri_message(pri, " (CONTEXT SPECIFIC [%d])", comp->type & ASN1_TYPE_MASK); - } - else { - pri_message(pri, " (component %02x)", comp->type); - } - pri_message(pri, "\n"); - if ((comp->type & ASN1_PC_MASK) == ASN1_CONSTRUCTOR) - j = asn1_dumprecursive(pri, comp->data, (comp->len ? comp->len : INT_MAX), level+1); - else - j = comp->len; - j += 2; - len -= j; - vdata += j; - clen += j; - } - return clen; -} - -int asn1_dump(struct pri *pri, void *comp, int len) -{ - return asn1_dumprecursive(pri, comp, len, 0); -} - -static unsigned char get_invokeid(struct pri *pri) -{ - return ++pri->last_invoke; -} - -struct addressingdataelements_presentednumberunscreened { - char partyaddress[21]; - char partysubaddress[21]; - int npi; /* Numbering Plan Indicator */ - int ton; /* Type Of Number */ - int pres; /* Presentation */ -}; - -struct addressingdataelements_presentednumberscreened { - char partyaddress[21]; - char partysubaddress[21]; - int npi; /* Numbering Plan Indicator */ - int ton; /* Type Of Number */ - int pres; /* Presentation */ - int scrind; /* Screening Indicator */ -}; - -#define PRI_CHECKOVERFLOW(size) \ - if (msgptr - message + (size) >= sizeof(message)) { \ - *msgptr = '\0'; \ - pri_message(pri, "%s", message); \ - msgptr = message; \ - } - -static void dump_apdu(struct pri *pri, unsigned char *c, int len) -{ - #define MAX_APDU_LENGTH 255 - static char hexs[16] = "0123456789ABCDEF"; - int i; - char message[(2 + MAX_APDU_LENGTH * 3 + 6 + MAX_APDU_LENGTH + 3)] = ""; /* please adjust here, if you make changes below! */ - char *msgptr; - - msgptr = message; - *msgptr++ = ' '; - *msgptr++ = '['; - for (i=0; i> 4) & 0x0f]; - *msgptr++ = hexs[(c[i]) & 0x0f]; - } - PRI_CHECKOVERFLOW(6); - strcpy(msgptr, " ] - ["); - msgptr += strlen(msgptr); - for (i=0; i '~')) ? '.' : c[i]; - } - PRI_CHECKOVERFLOW(2); - *msgptr++ = ']'; - *msgptr++ = '\n'; - *msgptr = '\0'; - pri_message(pri, "%s", message); -} -#undef PRI_CHECKOVERFLOW - -int redirectingreason_from_q931(struct pri *pri, int redirectingreason) -{ - switch(pri->switchtype) { - case PRI_SWITCH_QSIG: - switch(redirectingreason) { - case PRI_REDIR_UNKNOWN: - return QSIG_DIVERT_REASON_UNKNOWN; - case PRI_REDIR_FORWARD_ON_BUSY: - return QSIG_DIVERT_REASON_CFB; - case PRI_REDIR_FORWARD_ON_NO_REPLY: - return QSIG_DIVERT_REASON_CFNR; - case PRI_REDIR_UNCONDITIONAL: - return QSIG_DIVERT_REASON_CFU; - case PRI_REDIR_DEFLECTION: - case PRI_REDIR_DTE_OUT_OF_ORDER: - case PRI_REDIR_FORWARDED_BY_DTE: - pri_message(pri, "!! Don't know how to convert Q.931 redirection reason %d to Q.SIG\n", redirectingreason); - /* Fall through */ - default: - return QSIG_DIVERT_REASON_UNKNOWN; - } - default: - switch(redirectingreason) { - case PRI_REDIR_UNKNOWN: - return Q952_DIVERT_REASON_UNKNOWN; - case PRI_REDIR_FORWARD_ON_BUSY: - return Q952_DIVERT_REASON_CFB; - case PRI_REDIR_FORWARD_ON_NO_REPLY: - return Q952_DIVERT_REASON_CFNR; - case PRI_REDIR_DEFLECTION: - return Q952_DIVERT_REASON_CD; - case PRI_REDIR_UNCONDITIONAL: - return Q952_DIVERT_REASON_CFU; - case PRI_REDIR_DTE_OUT_OF_ORDER: - case PRI_REDIR_FORWARDED_BY_DTE: - pri_message(pri, "!! Don't know how to convert Q.931 redirection reason %d to Q.952\n", redirectingreason); - /* Fall through */ - default: - return Q952_DIVERT_REASON_UNKNOWN; - } - } -} - -static int redirectingreason_for_q931(struct pri *pri, int redirectingreason) -{ - switch(pri->switchtype) { - case PRI_SWITCH_QSIG: - switch(redirectingreason) { - case QSIG_DIVERT_REASON_UNKNOWN: - return PRI_REDIR_UNKNOWN; - case QSIG_DIVERT_REASON_CFU: - return PRI_REDIR_UNCONDITIONAL; - case QSIG_DIVERT_REASON_CFB: - return PRI_REDIR_FORWARD_ON_BUSY; - case QSIG_DIVERT_REASON_CFNR: - return PRI_REDIR_FORWARD_ON_NO_REPLY; - default: - pri_message(pri, "!! Unknown Q.SIG diversion reason %d\n", redirectingreason); - return PRI_REDIR_UNKNOWN; - } - default: - switch(redirectingreason) { - case Q952_DIVERT_REASON_UNKNOWN: - return PRI_REDIR_UNKNOWN; - case Q952_DIVERT_REASON_CFU: - return PRI_REDIR_UNCONDITIONAL; - case Q952_DIVERT_REASON_CFB: - return PRI_REDIR_FORWARD_ON_BUSY; - case Q952_DIVERT_REASON_CFNR: - return PRI_REDIR_FORWARD_ON_NO_REPLY; - case Q952_DIVERT_REASON_CD: - return PRI_REDIR_DEFLECTION; - case Q952_DIVERT_REASON_IMMEDIATE: - pri_message(pri, "!! Dont' know how to convert Q.952 diversion reason IMMEDIATE to PRI analog\n"); - return PRI_REDIR_UNKNOWN; /* ??? */ - default: - pri_message(pri, "!! Unknown Q.952 diversion reason %d\n", redirectingreason); - return PRI_REDIR_UNKNOWN; - } - } -} - -int typeofnumber_from_q931(struct pri *pri, int ton) -{ - switch(ton) { - case PRI_TON_INTERNATIONAL: - return Q932_TON_INTERNATIONAL; - case PRI_TON_NATIONAL: - return Q932_TON_NATIONAL; - case PRI_TON_NET_SPECIFIC: - return Q932_TON_NET_SPECIFIC; - case PRI_TON_SUBSCRIBER: - return Q932_TON_SUBSCRIBER; - case PRI_TON_ABBREVIATED: - return Q932_TON_ABBREVIATED; - case PRI_TON_RESERVED: - default: - pri_message(pri, "!! Unsupported Q.931 TypeOfNumber value (%d)\n", ton); - /* fall through */ - case PRI_TON_UNKNOWN: - return Q932_TON_UNKNOWN; - } -} - -static int typeofnumber_for_q931(struct pri *pri, int ton) -{ - switch (ton) { - case Q932_TON_UNKNOWN: - return PRI_TON_UNKNOWN; - case Q932_TON_INTERNATIONAL: - return PRI_TON_INTERNATIONAL; - case Q932_TON_NATIONAL: - return PRI_TON_NATIONAL; - case Q932_TON_NET_SPECIFIC: - return PRI_TON_NET_SPECIFIC; - case Q932_TON_SUBSCRIBER: - return PRI_TON_SUBSCRIBER; - case Q932_TON_ABBREVIATED: - return PRI_TON_ABBREVIATED; - default: - pri_message(pri, "!! Invalid Q.932 TypeOfNumber %d\n", ton); - return PRI_TON_UNKNOWN; - } -} - -int asn1_name_decode(void * data, int len, char *namebuf, int buflen) -{ - struct rose_component *comp = (struct rose_component*)data; - int datalen = 0, res = 0; - - if (comp->len == ASN1_LEN_INDEF) { - datalen = strlen((char *)comp->data); - res = datalen + 2; - } else - datalen = res = comp->len; - - if (datalen > buflen) { - /* Truncate */ - datalen = buflen; - } - memcpy(namebuf, comp->data, datalen); - return res + 2; -} - -int asn1_string_encode(unsigned char asn1_type, void *data, int len, int max_len, void *src, int src_len) -{ - struct rose_component *comp = NULL; - - if (len < 2 + src_len) - return -1; - - if (max_len && (src_len > max_len)) - src_len = max_len; - - comp = (struct rose_component *)data; - comp->type = asn1_type; - comp->len = src_len; - memcpy(comp->data, src, src_len); - - return 2 + src_len; -} - -int asn1_copy_string(char * buf, int buflen, struct rose_component *comp) -{ - int res; - int datalen; - - if ((comp->len > buflen) && (comp->len != ASN1_LEN_INDEF)) - return -1; - - if (comp->len == ASN1_LEN_INDEF) { - datalen = strlen((char*)comp->data); - res = datalen + 2; - } else - res = datalen = comp->len; - - memcpy(buf, comp->data, datalen); - buf[datalen] = 0; - - return res; -} - -static int rose_number_digits_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) -{ - int i = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - int datalen = 0; - int res = 0; - - do { - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_NUMERICSTRING, "Don't know what to do with PublicPartyNumber ROSE component type 0x%x\n"); - if(comp->len > 20 && comp->len != ASN1_LEN_INDEF) { - pri_message(pri, "!! Oversized NumberDigits component (%d)\n", comp->len); - return -1; - } - if (comp->len == ASN1_LEN_INDEF) { - datalen = strlen((char *)comp->data); - res = datalen + 2; - } else - res = datalen = comp->len; - - memcpy(value->partyaddress, comp->data, datalen); - value->partyaddress[datalen] = '\0'; - - return res + 2; - } - while(0); - - return -1; -} - -static int rose_public_party_number_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) -{ - int i = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - int ton; - int res = 0; - - if (len < 2) - return -1; - - do { - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Don't know what to do with PublicPartyNumber ROSE component type 0x%x\n"); - ASN1_GET_INTEGER(comp, ton); - NEXT_COMPONENT(comp, i); - ton = typeofnumber_for_q931(pri, ton); - - res = rose_number_digits_decode(pri, call, &vdata[i], len-i, value); - if (res < 0) - return -1; - value->ton = ton; - - return res + 3; - - } while(0); - return -1; -} - -static int rose_private_party_number_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) -{ - int i = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - int ton; - int res = 0; - - if (len < 2) - return -1; - - do { - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Don't know what to do with PrivatePartyNumber ROSE component type 0x%x\n"); - ASN1_GET_INTEGER(comp, ton); - NEXT_COMPONENT(comp, i); - ton = typeofnumber_for_q931(pri, ton); - - res = rose_number_digits_decode(pri, call, &vdata[i], len-i, value); - if (res < 0) - return -1; - value->ton = ton; - - return res + 3; - - } while(0); - return -1; -} - -static int rose_address_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) -{ - int i = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - int res = 0; - - do { - GET_COMPONENT(comp, i, vdata, len); - - switch(comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0): /* [0] unknownPartyNumber */ - res = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (res < 0) - return -1; - value->npi = PRI_NPI_UNKNOWN; - value->ton = PRI_TON_UNKNOWN; - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0): /* [0] unknownPartyNumber */ - res = asn1_copy_string(value->partyaddress, sizeof(value->partyaddress), comp); - if (res < 0) - return -1; - value->npi = PRI_NPI_UNKNOWN; - value->ton = PRI_TON_UNKNOWN; - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1): /* [1] publicPartyNumber */ - res = rose_public_party_number_decode(pri, call, comp->data, comp->len, value); - if (res < 0) - return -1; - value->npi = PRI_NPI_E163_E164; - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_2): /* [2] nsapEncodedNumber */ - pri_message(pri, "!! NsapEncodedNumber isn't handled\n"); - return -1; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_3): /* [3] dataPartyNumber */ - if(rose_number_digits_decode(pri, call, comp->data, comp->len, value)) - return -1; - value->npi = PRI_NPI_X121 /* ??? */; - value->ton = PRI_TON_UNKNOWN /* ??? */; - pri_message(pri, "!! dataPartyNumber isn't handled\n"); - return -1; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_4): /* [4] telexPartyNumber */ - res = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (res < 0) - return -1; - value->npi = PRI_NPI_F69 /* ??? */; - value->ton = PRI_TON_UNKNOWN /* ??? */; - pri_message(pri, "!! telexPartyNumber isn't handled\n"); - return -1; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_5): /* [5] priavePartyNumber */ - res = rose_private_party_number_decode(pri, call, comp->data, comp->len, value); - if (res < 0) - return -1; - value->npi = PRI_NPI_PRIVATE; - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_8): /* [8] nationalStandardPartyNumber */ - res = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (res < 0) - return -1; - value->npi = PRI_NPI_NATIONAL; - value->ton = PRI_TON_NATIONAL; - break; - default: - pri_message(pri, "!! Unknown Party number component received 0x%X\n", comp->type); - return -1; - } - ASN1_FIXUP_LEN(comp, res); - NEXT_COMPONENT(comp, i); - if(i < len) - pri_message(pri, "!! not all information is handled from Address component\n"); - return res + 2; - } - while (0); - - return -1; -} - -static int rose_presented_number_unscreened_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) -{ - int i = 0; - int size = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - - /* Fill in default values */ - value->ton = PRI_TON_UNKNOWN; - value->npi = PRI_NPI_E163_E164; - value->pres = -1; /* Data is not available */ - - do { - GET_COMPONENT(comp, i, vdata, len); - - switch(comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0): /* [0] presentationAllowedNumber */ - value->pres = PRES_ALLOWED_USER_NUMBER_NOT_SCREENED; - size = rose_address_decode(pri, call, comp->data, comp->len, value); - ASN1_FIXUP_LEN(comp, size); - return size + 2; - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1): /* [1] IMPLICIT presentationRestricted */ - if (comp->len != 0) { /* must be NULL */ - pri_error(pri, "!! Invalid PresentationRestricted component received (len != 0)\n"); - return -1; - } - value->pres = PRES_PROHIB_USER_NUMBER_NOT_SCREENED; - return 2; - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2): /* [2] IMPLICIT numberNotAvailableDueToInterworking */ - if (comp->len != 0) { /* must be NULL */ - pri_error(pri, "!! Invalid NumberNotAvailableDueToInterworking component received (len != 0)\n"); - return -1; - } - value->pres = PRES_NUMBER_NOT_AVAILABLE; - return 2; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_3): /* [3] presentationRestrictedNumber */ - value->pres = PRES_PROHIB_USER_NUMBER_NOT_SCREENED; - size = rose_address_decode(pri, call, comp->data, comp->len, value) + 2; - ASN1_FIXUP_LEN(comp, size); - return size + 2; - default: - pri_message(pri, "Invalid PresentedNumberUnscreened component 0x%X\n", comp->type); - } - return -1; - } - while (0); - - return -1; -} - -static int rose_diverting_leg_information2_decode(struct pri *pri, q931_call *call, struct rose_component *sequence, int len) -{ - int i = 0; - int diversion_counter; - int diversion_reason; - char origcalledname[50] = "", redirectingname[50] = ""; - struct addressingdataelements_presentednumberunscreened divertingnr; - struct addressingdataelements_presentednumberunscreened originalcallednr; - struct rose_component *comp = NULL; - unsigned char *vdata = sequence->data; - int res = 0; - memset(&divertingnr, 0, sizeof(divertingnr)); - memset(&originalcallednr, 0, sizeof(originalcallednr)); - - /* Data checks */ - if (sequence->type != (ASN1_CONSTRUCTOR | ASN1_SEQUENCE)) { /* Constructed Sequence */ - pri_message(pri, "Invalid DivertingLegInformation2Type argument\n"); - return -1; - } - - if (sequence->len == ASN1_LEN_INDEF) { - len -= 4; /* For the 2 extra characters at the end - * and two characters of header */ - } else - len -= 2; - - do { - /* diversionCounter stuff */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_INTEGER, "Don't know what to do it diversionCounter is of type 0x%x\n"); - ASN1_GET_INTEGER(comp, diversion_counter); - NEXT_COMPONENT(comp, i); - - /* diversionReason stuff */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Invalid diversionReason type 0x%X of ROSE divertingLegInformation2 component received\n"); - ASN1_GET_INTEGER(comp, diversion_reason); - NEXT_COMPONENT(comp, i); - - diversion_reason = redirectingreason_for_q931(pri, diversion_reason); - - if(pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Redirection reason: %d, total diversions: %d\n", diversion_reason, diversion_counter); - pri_message(NULL, "Length of message is %d\n", len); - - for(; i < len; NEXT_COMPONENT(comp, i)) { - GET_COMPONENT(comp, i, vdata, len); - switch(comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0): - call->origredirectingreason = redirectingreason_for_q931(pri, comp->data[0]); - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Received reason for original redirection %d\n", call->origredirectingreason); - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1): - res = rose_presented_number_unscreened_decode(pri, call, comp->data, comp->len, &divertingnr); - /* TODO: Fix indefinite length form hacks */ - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - if (res < 0) - return -1; - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, " Received divertingNr '%s'\n", divertingnr.partyaddress); - pri_message(pri, " ton = %d, pres = %d, npi = %d\n", divertingnr.ton, divertingnr.pres, divertingnr.npi); - } - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_2): - res = rose_presented_number_unscreened_decode(pri, call, comp->data, comp->len, &originalcallednr); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, " Received originalcallednr '%s'\n", originalcallednr.partyaddress); - pri_message(pri, " ton = %d, pres = %d, npi = %d\n", originalcallednr.ton, originalcallednr.pres, originalcallednr.npi); - } - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_3): - res = asn1_name_decode(comp->data, comp->len, redirectingname, sizeof(redirectingname)); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Received RedirectingName '%s'\n", redirectingname); - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_4): - res = asn1_name_decode(comp->data, comp->len, origcalledname, sizeof(origcalledname)); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Received Originally Called Name '%s'\n", origcalledname); - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_5): - pri_message(pri, "!! Ignoring DivertingLegInformation2 component 0x%X\n", comp->type); - break; - default: - if (comp->type == 0 && comp->len == 0) { - break; /* Found termination characters */ - } - pri_message(pri, "!! Invalid DivertingLegInformation2 component received 0x%X\n", comp->type); - return -1; - } - } - - if (divertingnr.pres >= 0) { - call->redirectingplan = divertingnr.npi; - call->redirectingpres = divertingnr.pres; - call->redirectingreason = diversion_reason; - libpri_copy_string(call->redirectingnum, divertingnr.partyaddress, sizeof(call->redirectingnum)); - pri_message(pri, " Received redirectingnum '%s' (%d)\n", call->redirectingnum, (int)call->redirectingnum[0]); - } - if (originalcallednr.pres >= 0) { - call->origcalledplan = originalcallednr.npi; - call->origcalledpres = originalcallednr.pres; - libpri_copy_string(call->origcallednum, originalcallednr.partyaddress, sizeof(call->origcallednum)); - pri_message(pri, " Received origcallednum '%s' (%d)\n", call->origcallednum, (int)call->origcallednum[0]); - } - libpri_copy_string(call->redirectingname, redirectingname, sizeof(call->redirectingname)); - libpri_copy_string(call->origcalledname, origcalledname, sizeof(call->origcalledname)); - return 0; - } - while (0); - - return -1; -} - -static int rose_diverting_leg_information2_encode(struct pri *pri, q931_call *call) -{ - int i = 0, j, compsp = 0; - struct rose_component *comp, *compstk[10]; - unsigned char buffer[256]; - int len = 253; - -#if 0 /* This is not required by specifications */ - if (!strlen(call->callername)) { - return -1; - } -#endif - - buffer[i] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - i++; - /* Interpretation component */ - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 0x00 /* Discard unrecognized invokes */); - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - - ASN1_PUSH(compstk, compsp, comp); - /* Invoke component contents */ - /* Invoke ID */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri)); - /* Operation Tag */ - - /* ROSE operationId component */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, ROSE_DIVERTING_LEG_INFORMATION2); - - /* ROSE ARGUMENT component */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - /* ROSE DivertingLegInformation2.diversionCounter component */ - /* Always is 1 because other isn't available in the current design */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, 1); - - /* ROSE DivertingLegInformation2.diversionReason component */ - ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, redirectingreason_from_q931(pri, call->redirectingreason)); - - /* ROSE DivertingLegInformation2.divertingNr component */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i); - - ASN1_PUSH(compstk, compsp, comp); - /* Redirecting information always not screened */ - - switch(call->redirectingpres) { - case PRES_ALLOWED_USER_NUMBER_NOT_SCREENED: - case PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN: - if (call->redirectingnum && strlen(call->redirectingnum)) { - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - /* NPI of redirected number is not supported in the current design */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, typeofnumber_from_q931(pri, call->redirectingplan >> 4)); - j = asn1_string_encode(ASN1_NUMERICSTRING, &buffer[i], len - i, 20, call->redirectingnum, strlen(call->redirectingnum)); - if (j < 0) - return -1; - - i += j; - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - break; - } - /* fall through */ - case PRES_PROHIB_USER_NUMBER_PASSED_SCREEN: - case PRES_PROHIB_USER_NUMBER_NOT_SCREENED: - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1), buffer, i); - break; - /* Don't know how to handle this */ - case PRES_ALLOWED_NETWORK_NUMBER: - case PRES_PROHIB_NETWORK_NUMBER: - case PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN: - case PRES_PROHIB_USER_NUMBER_FAILED_SCREEN: - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1), buffer, i); - break; - default: - pri_message(pri, "!! Undefined presentation value for redirecting number: %d\n", call->redirectingpres); - case PRES_NUMBER_NOT_AVAILABLE: - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i); - break; - } - ASN1_FIXUP(compstk, compsp, buffer, i); - - /* ROSE DivertingLegInformation2.originalCalledNr component */ - /* This information isn't supported by current design - duplicate divertingNr */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_2), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - /* Redirecting information always not screened */ - switch(call->redirectingpres) { - case PRES_ALLOWED_USER_NUMBER_NOT_SCREENED: - case PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN: - if (call->redirectingnum && strlen(call->redirectingnum)) { - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, typeofnumber_from_q931(pri, call->redirectingplan >> 4)); - - j = asn1_string_encode(ASN1_NUMERICSTRING, &buffer[i], len - i, 20, call->redirectingnum, strlen(call->redirectingnum)); - if (j < 0) - return -1; - - i += j; - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - break; - } - /* fall through */ - case PRES_PROHIB_USER_NUMBER_PASSED_SCREEN: - case PRES_PROHIB_USER_NUMBER_NOT_SCREENED: - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1), buffer, i); - break; - /* Don't know how to handle this */ - case PRES_ALLOWED_NETWORK_NUMBER: - case PRES_PROHIB_NETWORK_NUMBER: - case PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN: - case PRES_PROHIB_USER_NUMBER_FAILED_SCREEN: - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1), buffer, i); - break; - default: - pri_message(pri, "!! Undefined presentation value for redirecting number: %d\n", call->redirectingpres); - case PRES_NUMBER_NOT_AVAILABLE: - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i); - break; - } - ASN1_FIXUP(compstk, compsp, buffer, i); - - /* Fix length of stacked components */ - while(compsp > 0) { - ASN1_FIXUP(compstk, compsp, buffer, i); - } - - if (pri_call_apdu_queue(call, Q931_SETUP, buffer, i, NULL, NULL)) - return -1; - - return 0; -} - -/* Send the rltThirdParty: Invoke */ -int rlt_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2) -{ - int i = 0; - unsigned char buffer[256]; - struct rose_component *comp = NULL, *compstk[10]; - const unsigned char rlt_3rd_pty = RLT_THIRD_PARTY; - q931_call *callwithid = NULL, *apdubearer = NULL; - int compsp = 0; - - if (c2->transferable) { - apdubearer = c1; - callwithid = c2; - } else if (c1->transferable) { - apdubearer = c2; - callwithid = c1; - } else - return -1; - - buffer[i++] = (Q932_PROTOCOL_ROSE); - buffer[i++] = (0x80 | RLT_SERVICE_ID); /* Service Identifier octet */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* Invoke ID is set to the operation ID */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, rlt_3rd_pty); - - /* Operation Tag */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, rlt_3rd_pty); - - /* Additional RLT invoke info - Octet 12 */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - ASN1_ADD_WORDCOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, callwithid->rlt_call_id & 0xFFFFFF); /* Length is 3 octets */ - /* Reason for redirect - unused, set to 129 */ - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1), buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - - if (pri_call_apdu_queue(apdubearer, Q931_FACILITY, buffer, i, NULL, NULL)) - return -1; - - if (q931_facility(apdubearer->pri, apdubearer)) { - pri_message(pri, "Could not schedule facility message for call %d\n", apdubearer->cr); - return -1; - } - return 0; -} - -static int add_dms100_transfer_ability_apdu(struct pri *pri, q931_call *c) -{ - int i = 0; - unsigned char buffer[256]; - struct rose_component *comp = NULL, *compstk[10]; - const unsigned char rlt_op_ind = RLT_OPERATION_IND; - int compsp = 0; - - buffer[i++] = (Q932_PROTOCOL_ROSE); /* Note to self: DON'T set the EXT bit */ - buffer[i++] = (0x80 | RLT_SERVICE_ID); /* Service Identifier octet */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* Invoke ID is set to the operation ID */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, rlt_op_ind); - - /* Operation Tag - basically the same as the invoke ID tag */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, rlt_op_ind); - ASN1_FIXUP(compstk, compsp, buffer, i); - - if (pri_call_apdu_queue(c, Q931_SETUP, buffer, i, NULL, NULL)) - return -1; - else - return 0; -} - -/* Sending callername information functions */ -static int add_callername_facility_ies(struct pri *pri, q931_call *c, int cpe) -{ - int res = 0; - int i = 0; - unsigned char buffer[256]; - unsigned char namelen = 0; - struct rose_component *comp = NULL, *compstk[10]; - int compsp = 0; - int mymessage = 0; - static unsigned char op_tag[] = { - 0x2a, /* informationFollowing 42 */ - 0x86, - 0x48, - 0xce, - 0x15, - 0x00, - 0x04 - }; - - if (!strlen(c->callername)) { - return -1; - } - - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - /* Interpretation component */ - - if (pri->switchtype == PRI_SWITCH_QSIG) { - ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - } - - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 0); - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - /* Invoke ID */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri)); - - /* Operation Tag */ - res = asn1_string_encode(ASN1_OBJECTIDENTIFIER, &buffer[i], sizeof(buffer)-i, sizeof(op_tag), op_tag, sizeof(op_tag)); - if (res < 0) - return -1; - i += res; - - ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - - if (!cpe) { - if (pri_call_apdu_queue(c, Q931_SETUP, buffer, i, NULL, NULL)) - return -1; - } - - - /* Now the APDU that contains the information that needs sent. - * We can reuse the buffer since the queue function doesn't - * need it. */ - - i = 0; - namelen = strlen(c->callername); - if (namelen > 50) { - namelen = 50; /* truncate the name */ - } - - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - /* Interpretation component */ - - if (pri->switchtype == PRI_SWITCH_QSIG) { - ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - } - - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 0); - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* Invoke ID */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri)); - - /* Operation ID: Calling name */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, SS_CNID_CALLINGNAME); - - res = asn1_string_encode((ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), &buffer[i], sizeof(buffer)-i, 50, c->callername, namelen); - if (res < 0) - return -1; - i += res; - ASN1_FIXUP(compstk, compsp, buffer, i); - - if (cpe) - mymessage = Q931_SETUP; - else - mymessage = Q931_FACILITY; - - if (pri_call_apdu_queue(c, mymessage, buffer, i, NULL, NULL)) - return -1; - - return 0; -} -/* End Callername */ - -/* MWI related encode and decode functions */ -static void mwi_activate_encode_cb(void *data) -{ - return; -} - -int mwi_message_send(struct pri* pri, q931_call *call, struct pri_sr *req, int activate) -{ - int i = 0; - unsigned char buffer[255] = ""; - int destlen = strlen(req->called); - struct rose_component *comp = NULL, *compstk[10]; - int compsp = 0; - int res; - - if (destlen <= 0) { - return -1; - } else if (destlen > 20) - destlen = 20; /* Destination number cannot be greater then 20 digits */ - - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - /* Interpretation component */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 0); - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri)); - - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, (activate) ? SS_MWI_ACTIVATE : SS_MWI_DEACTIVATE); - ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - /* PartyNumber */ - res = asn1_string_encode((ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), &buffer[i], sizeof(buffer)-i, destlen, req->called, destlen); - - if (res < 0) - return -1; - i += res; - - /* Enumeration: basicService */ - ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 1 /* contents: Voice */); - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - - return pri_call_apdu_queue(call, Q931_SETUP, buffer, i, mwi_activate_encode_cb, NULL); -} -/* End MWI */ - -/* EECT functions */ -int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2) -{ - int i = 0; - int res = 0; - unsigned char buffer[255] = ""; - short call_reference = c2->cr ^ 0x8000; /* Let's do the trickery to make sure the flag is correct */ - struct rose_component *comp = NULL, *compstk[10]; - int compsp = 0; - static unsigned char op_tag[] = { - 0x2A, - 0x86, - 0x48, - 0xCE, - 0x15, - 0x00, - 0x08, - }; - - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_ROSE); - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri)); - - res = asn1_string_encode(ASN1_OBJECTIDENTIFIER, &buffer[i], sizeof(buffer)-i, sizeof(op_tag), op_tag, sizeof(op_tag)); - if (res < 0) - return -1; - i += res; - - ASN1_ADD_SIMPLE(comp, (ASN1_SEQUENCE | ASN1_CONSTRUCTOR), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer, i, call_reference); - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - - res = pri_call_apdu_queue(c1, Q931_FACILITY, buffer, i, NULL, NULL); - if (res) { - pri_message(pri, "Could not queue APDU in facility message\n"); - return -1; - } - - /* Remember that if we queue a facility IE for a facility message we - * have to explicitly send the facility message ourselves */ - - res = q931_facility(c1->pri, c1); - if (res) { - pri_message(pri, "Could not schedule facility message for call %d\n", c1->cr); - return -1; - } - - return 0; -} -/* End EECT */ - -static int anfpr_pathreplacement_respond(struct pri *pri, q931_call *call, q931_ie *ie) -{ - int res; - - res = pri_call_apdu_queue_cleanup(call->bridged_call); - if (res) { - pri_message(pri, "Could not Clear queue ADPU\n"); - return -1; - } - - /* Send message */ - res = pri_call_apdu_queue(call->bridged_call, Q931_FACILITY, ie->data, ie->len, NULL, NULL); - if (res) { - pri_message(pri, "Could not queue ADPU in facility message\n"); - return -1; - } - - /* Remember that if we queue a facility IE for a facility message we - * have to explicitly send the facility message ourselves */ - - res = q931_facility(call->bridged_call->pri, call->bridged_call); - if (res) { - pri_message(pri, "Could not schedule facility message for call %d\n", call->bridged_call->cr); - return -1; - } - - return 0; -} -/* AFN-PR */ -extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2) -{ - /* Did all the tests to see if we're on the same PRI and - * are on a compatible switchtype */ - /* TODO */ - int i = 0; - int res = 0; - unsigned char buffer[255] = ""; - unsigned short call_reference = c2->cr; - struct rose_component *comp = NULL, *compstk[10]; - unsigned char buffer2[255] = ""; - int compsp = 0; - static unsigned char op_tag[] = { - 0x0C, - }; - - /* Channel 1 */ - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - /* Interpretation component */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0); - ASN1_FIXUP(compstk, compsp, buffer, i); - - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 2); /* reject - to get feedback from QSIG switch */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri)); - - res = asn1_string_encode(ASN1_INTEGER, &buffer[i], sizeof(buffer)-i, sizeof(op_tag), op_tag, sizeof(op_tag)); - if (res < 0) - return -1; - i += res; - - ASN1_ADD_SIMPLE(comp, (ASN1_SEQUENCE | ASN1_CONSTRUCTOR), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - buffer[i++] = (0x0a); - buffer[i++] = (0x01); - buffer[i++] = (0x00); - buffer[i++] = (0x81); - buffer[i++] = (0x00); - buffer[i++] = (0x0a); - buffer[i++] = (0x01); - buffer[i++] = (0x01); - ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer, i, call_reference); - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - - res = pri_call_apdu_queue(c1, Q931_FACILITY, buffer, i, NULL, NULL); - if (res) { - pri_message(pri, "Could not queue ADPU in facility message\n"); - return -1; - } - - /* Remember that if we queue a facility IE for a facility message we - * have to explicitly send the facility message ourselves */ - - res = q931_facility(c1->pri, c1); - if (res) { - pri_message(pri, "Could not schedule facility message for call %d\n", c1->cr); - return -1; - } - - /* Channel 2 */ - i = 0; - res = 0; - compsp = 0; - - buffer2[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS); - /* Interpretation component */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer2, i); - ASN1_PUSH(compstk, compsp, comp); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer2, i, 0); - ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer2, i, 0); - ASN1_FIXUP(compstk, compsp, buffer2, i); - - ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer2, i, 2); /* reject */ - - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer2, i); - ASN1_PUSH(compstk, compsp, comp); - - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer2, i, get_invokeid(pri)); - - res = asn1_string_encode(ASN1_INTEGER, &buffer2[i], sizeof(buffer2)-i, sizeof(op_tag), op_tag, sizeof(op_tag)); - if (res < 0) - return -1; - i += res; - - ASN1_ADD_SIMPLE(comp, (ASN1_SEQUENCE | ASN1_CONSTRUCTOR), buffer2, i); - ASN1_PUSH(compstk, compsp, comp); - buffer2[i++] = (0x0a); - buffer2[i++] = (0x01); - buffer2[i++] = (0x01); - buffer2[i++] = (0x81); - buffer2[i++] = (0x00); - buffer2[i++] = (0x0a); - buffer2[i++] = (0x01); - buffer2[i++] = (0x01); - ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer2, i, call_reference); - ASN1_FIXUP(compstk, compsp, buffer2, i); - ASN1_FIXUP(compstk, compsp, buffer2, i); - - - res = pri_call_apdu_queue(c2, Q931_FACILITY, buffer2, i, NULL, NULL); - if (res) { - pri_message(pri, "Could not queue ADPU in facility message\n"); - return -1; - } - - /* Remember that if we queue a facility IE for a facility message we - * have to explicitly send the facility message ourselves */ - - res = q931_facility(c2->pri, c2); - if (res) { - pri_message(pri, "Could not schedule facility message for call %d\n", c1->cr); - return -1; - } - - return 0; -} -/* End AFN-PR */ - -/* AOC */ -static int aoc_aoce_charging_request_decode(struct pri *pri, q931_call *call, unsigned char *data, int len) -{ - int chargingcase = -1; - unsigned char *vdata = data; - struct rose_component *comp = NULL; - int pos1 = 0; - - if (pri->debug & PRI_DEBUG_AOC) - dump_apdu (pri, data, len); - - do { - GET_COMPONENT(comp, pos1, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "!! Invalid AOC Charging Request argument. Expected Enumerated (0x0A) but Received 0x%02X\n"); - ASN1_GET_INTEGER(comp, chargingcase); - if (chargingcase >= 0 && chargingcase <= 2) { - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "Channel %d/%d, Call %d - received AOC charging request - charging case: %i\n", - call->ds1no, call->channelno, call->cr, chargingcase); - } else { - pri_message(pri, "!! unkown AOC ChargingCase: 0x%02X", chargingcase); - chargingcase = -1; - } - NEXT_COMPONENT(comp, pos1); - } while (pos1 < len); - if (pos1 < len) { - pri_message(pri, "!! Only reached position %i in %i bytes long AOC-E structure:", pos1, len ); - dump_apdu (pri, data, len); - return -1; /* Aborted before */ - } - return 0; -} - - -static int aoc_aoce_charging_unit_decode(struct pri *pri, q931_call *call, unsigned char *data, int len) -{ - long chargingunits = 0, chargetype = -1, temp, chargeIdentifier = -1; - unsigned char *vdata = data; - struct rose_component *comp1 = NULL, *comp2 = NULL, *comp3 = NULL; - int pos1 = 0, pos2, pos3, sublen2, sublen3; - struct addressingdataelements_presentednumberunscreened chargednr; - - if (pri->debug & PRI_DEBUG_AOC) - dump_apdu (pri, data, len); - - do { - GET_COMPONENT(comp1, pos1, vdata, len); /* AOCEChargingUnitInfo */ - CHECK_COMPONENT(comp1, ASN1_SEQUENCE, "!! Invalid AOC-E Charging Unit argument. Expected Sequence (0x30) but Received 0x%02X\n"); - SUB_COMPONENT(comp1, pos1); - GET_COMPONENT(comp1, pos1, vdata, len); - switch (comp1->type) { - case (ASN1_SEQUENCE | ASN1_CONSTRUCTOR): /* specificChargingUnits */ - sublen2 = comp1->len; - pos2 = pos1; - comp2 = comp1; - SUB_COMPONENT(comp2, pos2); - do { - GET_COMPONENT(comp2, pos2, vdata, len); - switch (comp2->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1): /* RecordedUnitsList (0xA1) */ - SUB_COMPONENT(comp2, pos2); - GET_COMPONENT(comp2, pos2, vdata, len); - CHECK_COMPONENT(comp2, ASN1_SEQUENCE, "!! Invalid AOC-E Charging Unit argument. Expected Sequence (0x30) but received 0x02%X\n"); /* RecordedUnits */ - sublen3 = pos2 + comp2->len; - pos3 = pos2; - comp3 = comp2; - SUB_COMPONENT(comp3, pos3); - do { - GET_COMPONENT(comp3, pos3, vdata, len); - switch (comp3->type) { - case ASN1_INTEGER: /* numberOfUnits */ - ASN1_GET_INTEGER(comp3, temp); - chargingunits += temp; - case ASN1_NULL: /* notAvailable */ - break; - default: - pri_message(pri, "!! Don't know how to handle 0x%02X in AOC-E RecordedUnits\n", comp3->type); - } - NEXT_COMPONENT(comp3, pos3); - } while (pos3 < sublen3); - if (pri->debug & PRI_DEBUG_AOC) - pri_message(pri, "Channel %d/%d, Call %d - received AOC-E charging: %i unit%s\n", - call->ds1no, call->channelno, call->cr, chargingunits, (chargingunits == 1) ? "" : "s"); - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_2): /* AOCEBillingID (0xA2) */ - SUB_COMPONENT(comp2, pos2); - GET_COMPONENT(comp2, pos2, vdata, len); - ASN1_GET_INTEGER(comp2, chargetype); - pri_message(pri, "!! not handled: Channel %d/%d, Call %d - received AOC-E billing ID: %i\n", - call->ds1no, call->channelno, call->cr, chargetype); - break; - default: - pri_message(pri, "!! Don't know how to handle 0x%02X in AOC-E RecordedUnitsList\n", comp2->type); - } - NEXT_COMPONENT(comp2, pos2); - } while (pos2 < sublen2); - break; - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1): /* freeOfCharge (0x81) */ - if (pri->debug & PRI_DEBUG_AOC) - pri_message(pri, "Channel %d/%d, Call %d - received AOC-E free of charge\n", call->ds1no, call->channelno, call->cr); - chargingunits = 0; - break; - default: - pri_message(pri, "!! Invalid AOC-E specificChargingUnits. Expected Sequence (0x30) or Object Identifier (0x81/0x01) but received 0x%02X\n", comp1->type); - } - NEXT_COMPONENT(comp1, pos1); - GET_COMPONENT(comp1, pos1, vdata, len); /* get optional chargingAssociation. will 'break' when reached end of structure */ - switch (comp1->type) { - /* TODO: charged number is untested - please report! */ - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0): /* chargedNumber (0xA0) */ - if(rose_presented_number_unscreened_decode(pri, call, comp1->data, comp1->len, &chargednr) != 0) - return -1; - pri_message(pri, "!! not handled: Received ChargedNr '%s' \n", chargednr.partyaddress); - pri_message(pri, " ton = %d, pres = %d, npi = %d\n", chargednr.ton, chargednr.pres, chargednr.npi); - break; - case ASN1_INTEGER: - ASN1_GET_INTEGER(comp1, chargeIdentifier); - break; - default: - pri_message(pri, "!! Invalid AOC-E chargingAssociation. Expected Object Identifier (0xA0) or Integer (0x02) but received 0x%02X\n", comp1->type); - } - NEXT_COMPONENT(comp1, pos1); - } while (pos1 < len); - - if (pos1 < len) { - pri_message(pri, "!! Only reached position %i in %i bytes long AOC-E structure:", pos1, len ); - dump_apdu (pri, data, len); - return -1; /* oops - aborted before */ - } - call->aoc_units = chargingunits; - - return 0; -} - -static int aoc_aoce_charging_unit_encode(struct pri *pri, q931_call *c, long chargedunits) -{ - /* sample data: [ 91 a1 12 02 02 3a 78 02 01 24 30 09 30 07 a1 05 30 03 02 01 01 ] */ - int i = 0, res = 0, compsp = 0; - unsigned char buffer[255] = ""; - struct rose_component *comp = NULL, *compstk[10]; - - /* ROSE protocol (0x91)*/ - buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_ROSE); - - /* ROSE Component (0xA1,len)*/ - ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* ROSE invokeId component (0x02,len,id)*/ - ASN1_ADD_WORDCOMP(comp, INVOKE_IDENTIFIER, buffer, i, ++pri->last_invoke); - - /* ROSE operationId component (0x02,0x01,0x24)*/ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, ROSE_AOC_AOCE_CHARGING_UNIT); - - /* AOCEChargingUnitInfo (0x30,len) */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - if (chargedunits > 0) { - /* SpecificChargingUnits (0x30,len) */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* RecordedUnitsList (0xA1,len) */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* RecordedUnits (0x30,len) */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i); - ASN1_PUSH(compstk, compsp, comp); - - /* NumberOfUnits (0x02,len,charge) */ - ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, chargedunits); - - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - } else { - /* freeOfCharge (0x81,0) */ - ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1), buffer, i); - } - ASN1_FIXUP(compstk, compsp, buffer, i); - ASN1_FIXUP(compstk, compsp, buffer, i); - - if (pri->debug & PRI_DEBUG_AOC) - dump_apdu (pri, buffer, i); - - /* code below is untested */ - res = pri_call_apdu_queue(c, Q931_FACILITY, buffer, i, NULL, NULL); - if (res) { - pri_message(pri, "Could not queue APDU in facility message\n"); - return -1; - } - - /* Remember that if we queue a facility IE for a facility message we - * have to explicitly send the facility message ourselves */ - res = q931_facility(c->pri, c); - if (res) { - pri_message(pri, "Could not schedule facility message for call %d\n", c->cr); - return -1; - } - - return 0; -} -/* End AOC */ - -/* ===== Call Transfer Supplementary Service (ECMA-178) ===== */ - -static int rose_party_number_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value) -{ - int i = 0; - int size = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - - - do { - GET_COMPONENT(comp, i, vdata, len); - - switch(comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0): /* [0] IMPLICIT NumberDigits -- default: unknownPartyNumber */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PartyNumber: UnknownPartyNumber len=%d\n", len); - size = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - value->npi = PRI_NPI_UNKNOWN; - value->ton = PRI_TON_UNKNOWN; - break; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1): /* [1] IMPLICIT PublicPartyNumber */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PartyNumber: PublicPartyNumber len=%d\n", len); - size = rose_public_party_number_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - value->npi = PRI_NPI_E163_E164; - break; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_3): /* [3] IMPLICIT NumberDigits -- not used: dataPartyNumber */ - pri_message(pri, "!! PartyNumber: dataPartyNumber is reserved!\n"); - size = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - value->npi = PRI_NPI_X121 /* ??? */; - value->ton = PRI_TON_UNKNOWN /* ??? */; - break; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_4): /* [4] IMPLICIT NumberDigits -- not used: telexPartyNumber */ - pri_message(pri, "!! PartyNumber: telexPartyNumber is reserved!\n"); - size = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - value->npi = PRI_NPI_F69 /* ??? */; - value->ton = PRI_TON_UNKNOWN /* ??? */; - break; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_5): /* [5] IMPLICIT PrivatePartyNumber */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PartyNumber: PrivatePartyNumber len=%d\n", len); - size = rose_private_party_number_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - value->npi = PRI_NPI_PRIVATE; - break; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_8): /* [8] IMPLICIT NumberDigits -- not used: nationalStandatdPartyNumber */ - pri_message(pri, "!! PartyNumber: nationalStandardPartyNumber is reserved!\n"); - size = rose_number_digits_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - value->npi = PRI_NPI_NATIONAL; - value->ton = PRI_TON_NATIONAL; - break; - - default: - pri_message(pri, "Invalid PartyNumber component 0x%X\n", comp->type); - return -1; - } - ASN1_FIXUP_LEN(comp, size); - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PartyNumber: '%s' size=%d len=%d\n", value->partyaddress, size, len); - return size; - } - while (0); - - return -1; -} - - -static int rose_number_screened_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberscreened *value) -{ - int i = 0; - int size = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - - int scrind = -1; - - do { - /* Party Number */ - GET_COMPONENT(comp, i, vdata, len); - size = rose_party_number_decode(pri, call, (u_int8_t *)comp, comp->len + 2, (struct addressingdataelements_presentednumberunscreened*) value); - if (size < 0) - return -1; - comp->len = size; - NEXT_COMPONENT(comp, i); - - /* Screening Indicator */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Don't know what to do with NumberScreened ROSE component type 0x%x\n"); - ASN1_GET_INTEGER(comp, scrind); - // Todo: scrind = screeningindicator_for_q931(pri, scrind); - NEXT_COMPONENT(comp, i); - - value->scrind = scrind; - - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " NumberScreened: '%s' ScreeningIndicator=%d i=%d len=%d\n", value->partyaddress, scrind, i, len); - - return i-2; // We do not have a sequence header here. - } - while (0); - - return -1; -} - - -static int rose_presented_number_screened_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberscreened *value) -{ - int i = 0; - int size = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = data; - - /* Fill in default values */ - value->ton = PRI_TON_UNKNOWN; - value->npi = PRI_NPI_UNKNOWN; - value->pres = -1; /* Data is not available */ - - do { - GET_COMPONENT(comp, i, vdata, len); - - switch(comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0): /* [0] IMPLICIT presentationAllowedNumber */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PresentedNumberScreened: presentationAllowedNumber comp->len=%d\n", comp->len); - value->pres = PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN; - size = rose_number_screened_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - ASN1_FIXUP_LEN(comp, size); - return size + 2; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_1): /* [1] IMPLICIT presentationRestricted */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PresentedNumberScreened: presentationRestricted comp->len=%d\n", comp->len); - if (comp->len != 0) { /* must be NULL */ - pri_error(pri, "!! Invalid PresentationRestricted component received (len != 0)\n"); - return -1; - } - value->pres = PRES_PROHIB_USER_NUMBER_PASSED_SCREEN; - return 2; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2): /* [2] IMPLICIT numberNotAvailableDueToInterworking */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PresentedNumberScreened: NumberNotAvailableDueToInterworking comp->len=%d\n", comp->len); - if (comp->len != 0) { /* must be NULL */ - pri_error(pri, "!! Invalid NumberNotAvailableDueToInterworking component received (len != 0)\n"); - return -1; - } - value->pres = PRES_NUMBER_NOT_AVAILABLE; - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PresentedNumberScreened: numberNotAvailableDueToInterworking Type=0x%X i=%d len=%d size=%d\n", comp->type, i, len); - return 2; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_3): /* [3] IMPLICIT presentationRestrictedNumber */ - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " PresentedNumberScreened: presentationRestrictedNumber comp->len=%d\n", comp->len); - value->pres = PRES_PROHIB_USER_NUMBER_PASSED_SCREEN; - size = rose_number_screened_decode(pri, call, comp->data, comp->len, value); - if (size < 0) - return -1; - ASN1_FIXUP_LEN(comp, size); - return size + 2; - - default: - pri_message(pri, "Invalid PresentedNumberScreened component 0x%X\n", comp->type); - } - return -1; - } - while (0); - - return -1; -} - - -static int rose_call_transfer_complete_decode(struct pri *pri, q931_call *call, struct rose_component *sequence, int len) -{ - int i = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = sequence->data; - int res = 0; - - int end_designation = 0; - struct addressingdataelements_presentednumberscreened redirection_number; - char redirection_name[50] = ""; - int call_status = 0; - redirection_number.partyaddress[0] = 0; - redirection_number.partysubaddress[0] = 0; - call->callername[0] = 0; - call->callernum[0] = 0; - - - /* Data checks */ - if (sequence->type != (ASN1_CONSTRUCTOR | ASN1_SEQUENCE)) { /* Constructed Sequence */ - pri_message(pri, "Invalid callTransferComplete argument. (Not a sequence)\n"); - return -1; - } - - if (sequence->len == ASN1_LEN_INDEF) { - len -= 4; /* For the 2 extra characters at the end - * and two characters of header */ - } else - len -= 2; - - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: len=%d\n", len); - - do { - /* End Designation */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Invalid endDesignation type 0x%X of ROSE callTransferComplete component received\n"); - ASN1_GET_INTEGER(comp, end_designation); - NEXT_COMPONENT(comp, i); - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: Received endDesignation=%d\n", end_designation); - - - /* Redirection Number */ - GET_COMPONENT(comp, i, vdata, len); - res = rose_presented_number_screened_decode(pri, call, (u_int8_t *)comp, comp->len + 2, &redirection_number); - if (res < 0) - return -1; - comp->len = res; - if (res > 2) { - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: Received redirectionNumber=%s\n", redirection_number.partyaddress); - strncpy(call->callernum, redirection_number.partyaddress, 20); - call->callernum[20] = 0; - } - NEXT_COMPONENT(comp, i); - - -#if 0 /* This one is optional. How do we check if it is there? */ - /* Basic Call Info Elements */ - GET_COMPONENT(comp, i, vdata, len); - NEXT_COMPONENT(comp, i); -#endif - - - /* Redirection Name */ - GET_COMPONENT(comp, i, vdata, len); - res = asn1_name_decode((u_int8_t *)comp, comp->len + 2, redirection_name, sizeof(redirection_name)); - if (res < 0) - return -1; - memcpy(call->callername, comp->data, comp->len); - call->callername[comp->len] = 0; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - NEXT_COMPONENT(comp, i); - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: Received redirectionName '%s'\n", redirection_name); - - - /* Call Status */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_ENUMERATED, "Invalid callStatus type 0x%X of ROSE callTransferComplete component received\n"); - ASN1_GET_INTEGER(comp, call_status); - NEXT_COMPONENT(comp, i); - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: Received callStatus=%d\n", call_status); - - - /* Argument Extension */ -#if 0 /* Not supported */ - GET_COMPONENT(comp, i, vdata, len); - switch (comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_9): /* [9] IMPLICIT Extension */ - res = rose_extension_decode(pri, call, comp->data, comp->len, &redirection_number); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_10): /* [10] IMPLICIT SEQUENCE OF Extension */ - res = rose_sequence_of_extension_decode(pri, call, comp->data, comp->len, &redirection_number); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - - default: - pri_message(pri, " CT-Complete: !! Unknown argumentExtension received 0x%X\n", comp->type); - return -1; - } -#else - GET_COMPONENT(comp, i, vdata, len); - ASN1_FIXUP_LEN(comp, res); - NEXT_COMPONENT(comp, i); -#endif - - if(i < len) - pri_message(pri, " CT-Complete: !! not all information is handled !! i=%d / len=%d\n", i, len); - - return 0; - } - while (0); - - return -1; -} - - -static int rose_call_transfer_update_decode(struct pri *pri, q931_call *call, struct rose_component *sequence, int len) -{ - int i = 0; - struct rose_component *comp = NULL; - unsigned char *vdata = sequence->data; - int res = 0; - - struct addressingdataelements_presentednumberscreened redirection_number; - redirection_number.partyaddress[0] = 0; - redirection_number.partysubaddress[0] = 0; - char redirection_name[50] = ""; - call->callername[0] = 0; - call->callernum[0] = 0; - - - /* Data checks */ - if (sequence->type != (ASN1_CONSTRUCTOR | ASN1_SEQUENCE)) { /* Constructed Sequence */ - pri_message(pri, "Invalid callTransferComplete argument. (Not a sequence)\n"); - return -1; - } - - if (sequence->len == ASN1_LEN_INDEF) { - len -= 4; /* For the 2 extra characters at the end - * and two characters of header */ - } else - len -= 2; - - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: len=%d\n", len); - - do { - /* Redirection Number */ - GET_COMPONENT(comp, i, vdata, len); - res = rose_presented_number_screened_decode(pri, call, (u_int8_t *)comp, comp->len + 2, &redirection_number); - if (res < 0) - return -1; - comp->len = res; - if (res > 2) { - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: Received redirectionNumber=%s\n", redirection_number.partyaddress); - strncpy(call->callernum, redirection_number.partyaddress, 20); - call->callernum[20] = 0; - } - NEXT_COMPONENT(comp, i); - - /* Redirection Name */ - GET_COMPONENT(comp, i, vdata, len); - res = asn1_name_decode((u_int8_t *)comp, comp->len + 2, redirection_name, sizeof(redirection_name)); - if (res < 0) - return -1; - memcpy(call->callername, comp->data, comp->len); - call->callername[comp->len] = 0; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - NEXT_COMPONENT(comp, i); - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " CT-Complete: Received redirectionName '%s'\n", redirection_name); - - -#if 0 /* This one is optional. How do we check if it is there? */ - /* Basic Call Info Elements */ - GET_COMPONENT(comp, i, vdata, len); - NEXT_COMPONENT(comp, i); -#endif - - - /* Argument Extension */ -#if 0 /* Not supported */ - GET_COMPONENT(comp, i, vdata, len); - switch (comp->type) { - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_9): /* [9] IMPLICIT Extension */ - res = rose_extension_decode(pri, call, comp->data, comp->len, &redirection_number); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - - case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_10): /* [10] IMPLICIT SEQUENCE OF Extension */ - res = rose_sequence_of_extension_decode(pri, call, comp->data, comp->len, &redirection_number); - if (res < 0) - return -1; - ASN1_FIXUP_LEN(comp, res); - comp->len = res; - - default: - pri_message(pri, " CT-Complete: !! Unknown argumentExtension received 0x%X\n", comp->type); - return -1; - } -#else - GET_COMPONENT(comp, i, vdata, len); - ASN1_FIXUP_LEN(comp, res); - NEXT_COMPONENT(comp, i); -#endif - - if(i < len) - pri_message(pri, " CT-Complete: !! not all information is handled !! i=%d / len=%d\n", i, len); - - return 0; - } - while (0); - - return -1; -} - - -/* ===== End Call Transfer Supplementary Service (ECMA-178) ===== */ - - - -int rose_reject_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned char *data, int len) -{ - int i = 0; - int problemtag = -1; - int problem = -1; - int invokeidvalue = -1; - unsigned char *vdata = data; - struct rose_component *comp = NULL; - char *problemtagstr, *problemstr; - - do { - /* Invoke ID stuff */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, INVOKE_IDENTIFIER, "Don't know what to do if first ROSE component is of type 0x%x\n"); - ASN1_GET_INTEGER(comp, invokeidvalue); - NEXT_COMPONENT(comp, i); - - GET_COMPONENT(comp, i, vdata, len); - problemtag = comp->type; - problem = comp->data[0]; - - if (pri->switchtype == PRI_SWITCH_DMS100) { - switch (problemtag) { - case 0x80: - problemtagstr = "General problem"; - break; - case 0x81: - problemtagstr = "Invoke problem"; - break; - case 0x82: - problemtagstr = "Return result problem"; - break; - case 0x83: - problemtagstr = "Return error problem"; - break; - default: - problemtagstr = "Unknown"; - } - - switch (problem) { - case 0x00: - problemstr = "Unrecognized component"; - break; - case 0x01: - problemstr = "Mistyped component"; - break; - case 0x02: - problemstr = "Badly structured component"; - break; - default: - problemstr = "Unknown"; - } - - pri_error(pri, "ROSE REJECT:\n"); - pri_error(pri, "\tINVOKE ID: 0x%X\n", invokeidvalue); - pri_error(pri, "\tPROBLEM TYPE: %s (0x%x)\n", problemtagstr, problemtag); - pri_error(pri, "\tPROBLEM: %s (0x%x)\n", problemstr, problem); - - return 0; - } else { - pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype); - return -1; - } - - } while(0); - - return -1; -} -int rose_return_error_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned char *data, int len) -{ - int i = 0; - int errorvalue = -1; - int invokeidvalue = -1; - unsigned char *vdata = data; - struct rose_component *comp = NULL; - char *invokeidstr, *errorstr; - - do { - /* Invoke ID stuff */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, INVOKE_IDENTIFIER, "Don't know what to do if first ROSE component is of type 0x%x\n"); - ASN1_GET_INTEGER(comp, invokeidvalue); - NEXT_COMPONENT(comp, i); - - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_INTEGER, "Don't know what to do if second component in return error is 0x%x\n"); - ASN1_GET_INTEGER(comp, errorvalue); - - if (pri->switchtype == PRI_SWITCH_DMS100) { - switch (invokeidvalue) { - case RLT_OPERATION_IND: - invokeidstr = "RLT_OPERATION_IND"; - break; - case RLT_THIRD_PARTY: - invokeidstr = "RLT_THIRD_PARTY"; - break; - default: - invokeidstr = "Unknown"; - } - - switch (errorvalue) { - case 0x10: - errorstr = "RLT Bridge Fail"; - break; - case 0x11: - errorstr = "RLT Call ID Not Found"; - break; - case 0x12: - errorstr = "RLT Not Allowed"; - break; - case 0x13: - errorstr = "RLT Switch Equip Congs"; - break; - default: - errorstr = "Unknown"; - } - - pri_error(pri, "ROSE RETURN ERROR:\n"); - pri_error(pri, "\tOPERATION: %s\n", invokeidstr); - pri_error(pri, "\tERROR: %s\n", errorstr); - - return 0; - } else { - pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype); - return -1; - } - - } while(0); - - return -1; -} - -int rose_return_result_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned char *data, int len) -{ - int i = 0; - int operationidvalue = -1; - int invokeidvalue = -1; - unsigned char *vdata = data; - struct rose_component *comp = NULL; - - do { - /* Invoke ID stuff */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, INVOKE_IDENTIFIER, "Don't know what to do if first ROSE component is of type 0x%x\n"); - ASN1_GET_INTEGER(comp, invokeidvalue); - NEXT_COMPONENT(comp, i); - - if (pri->switchtype == PRI_SWITCH_DMS100) { - switch (invokeidvalue) { - case RLT_THIRD_PARTY: - if (pri->debug & PRI_DEBUG_APDU) pri_message(pri, "Successfully completed RLT transfer!\n"); - return 0; - case RLT_OPERATION_IND: - if (pri->debug & PRI_DEBUG_APDU) pri_message(pri, "Received RLT_OPERATION_IND\n"); - /* Have to take out the rlt_call_id */ - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_SEQUENCE, "Protocol error detected in parsing RLT_OPERATION_IND return result!\n"); - - /* Traverse the contents of this sequence */ - /* First is the Operation Value */ - SUB_COMPONENT(comp, i); - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_INTEGER, "RLT_OPERATION_IND should be of type ASN1_INTEGER!\n"); - ASN1_GET_INTEGER(comp, operationidvalue); - - if (operationidvalue != RLT_OPERATION_IND) { - pri_message(pri, "Invalid Operation ID value (0x%x) in return result!\n", operationidvalue); - return -1; - } - - /* Next is the Call ID */ - NEXT_COMPONENT(comp, i); - GET_COMPONENT(comp, i, vdata, len); - CHECK_COMPONENT(comp, ASN1_TAG_0, "Error check failed on Call ID!\n"); - ASN1_GET_INTEGER(comp, call->rlt_call_id); - /* We have enough data to transfer the call */ - call->transferable = 1; - - return 0; - - default: - pri_message(pri, "Could not parse invoke of type 0x%x!\n", invokeidvalue); - return -1; - } - } else { - pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype); - return -1; - } - - } while(0); - - return -1; -} - -int rose_invoke_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned char *data, int len) -{ - int i = 0; - int res = 0; - int operation_tag; - unsigned char *vdata = data; - struct rose_component *comp = NULL, *invokeid = NULL, *operationid = NULL; - - do { - /* Invoke ID stuff */ - GET_COMPONENT(comp, i, vdata, len); -#if 0 - CHECK_COMPONENT(comp, INVOKE_IDENTIFIER, "Don't know what to do if first ROSE component is of type 0x%x\n"); -#endif - invokeid = comp; - NEXT_COMPONENT(comp, i); - - /* Operation Tag */ - GET_COMPONENT(comp, i, vdata, len); -#if 0 - CHECK_COMPONENT(comp, ASN1_INTEGER, "Don't know what to do if second ROSE component is of type 0x%x\n"); -#endif - operationid = comp; - ASN1_GET_INTEGER(comp, operation_tag); - NEXT_COMPONENT(comp, i); - - /* No argument - return with error */ - if (i >= len) - return -1; - - /* Arguement Tag */ - GET_COMPONENT(comp, i, vdata, len); - if (!comp->type) - return -1; - - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " [ Handling operation %d ]\n", operation_tag); - switch (operation_tag) { - case SS_CNID_CALLINGNAME: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Handle Name display operation\n"); - switch (comp->type) { - case ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE: - memcpy(call->callername, comp->data, comp->len); - call->callername[comp->len] = 0; - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Received caller name '%s'\n", call->callername); - return 0; - default: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "Do not handle argument of type 0x%X\n", comp->type); - return -1; - } - break; - case ROSE_CALL_TRANSFER_IDENTIFY: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "ROSE %i: CallTransferIdentify - not handled!\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - return -1; - case ROSE_CALL_TRANSFER_ABANDON: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "ROSE %i: CallTransferAbandon - not handled!\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - return -1; - case ROSE_CALL_TRANSFER_INITIATE: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "ROSE %i: CallTransferInitiate - not handled!\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - return -1; - case ROSE_CALL_TRANSFER_SETUP: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "ROSE %i: CallTransferSetup - not handled!\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - return -1; - case ROSE_CALL_TRANSFER_ACTIVE: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "ROSE %i: CallTransferActive - not handled!\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - return -1; - case ROSE_CALL_TRANSFER_COMPLETE: - if (pri->debug & PRI_DEBUG_APDU) - { - pri_message(pri, "ROSE %i: Handle CallTransferComplete\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return rose_call_transfer_complete_decode(pri, call, comp, len-i); - case ROSE_CALL_TRANSFER_UPDATE: - if (pri->debug & PRI_DEBUG_APDU) - { - pri_message(pri, "ROSE %i: Handle CallTransferUpdate\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return rose_call_transfer_update_decode(pri, call, comp, len-i); - case ROSE_SUBADDRESS_TRANSFER: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "ROSE %i: SubaddressTransfer - not handled!\n", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - return -1; - case ROSE_DIVERTING_LEG_INFORMATION2: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, " Handle DivertingLegInformation2\n"); - return rose_diverting_leg_information2_decode(pri, call, comp, len-i); - case ROSE_AOC_NO_CHARGING_INFO_AVAILABLE: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC No Charging Info Available - not handled!", operation_tag); - dump_apdu (pri, comp->data, comp->len); - } - return -1; - case ROSE_AOC_CHARGING_REQUEST: - return aoc_aoce_charging_request_decode(pri, call, (u_int8_t *)comp, comp->len + 2); - case ROSE_AOC_AOCS_CURRENCY: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC-S Currency - not handled!", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - case ROSE_AOC_AOCS_SPECIAL_ARR: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC-S Special Array - not handled!", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - case ROSE_AOC_AOCD_CURRENCY: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC-D Currency - not handled!", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - case ROSE_AOC_AOCD_CHARGING_UNIT: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC-D Charging Unit - not handled!", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - case ROSE_AOC_AOCE_CURRENCY: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC-E Currency - not handled!", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - case ROSE_AOC_AOCE_CHARGING_UNIT: - return aoc_aoce_charging_unit_decode(pri, call, (u_int8_t *)comp, comp->len + 2); - if (0) { /* the following function is currently not used - just to make the compiler happy */ - aoc_aoce_charging_unit_encode(pri, call, call->aoc_units); /* use this function to forward the aoc-e on a bridged channel */ - return 0; - } - case ROSE_AOC_IDENTIFICATION_OF_CHARGE: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "ROSE %i: AOC Identification Of Charge - not handled!", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - case SS_ANFPR_PATHREPLACEMENT: - /* Clear Queue */ - res = pri_call_apdu_queue_cleanup(call->bridged_call); - if (res) { - pri_message(pri, "Could not Clear queue ADPU\n"); - return -1; - } - anfpr_pathreplacement_respond(pri, call, ie); - break; - default: - if (pri->debug & PRI_DEBUG_APDU) { - pri_message(pri, "!! Unable to handle ROSE operation %d", operation_tag); - dump_apdu (pri, (u_int8_t *)comp, comp->len + 2); - } - return -1; - } - } while(0); - - return -1; -} - -int pri_call_apdu_queue(q931_call *call, int messagetype, void *apdu, int apdu_len, void (*function)(void *data), void *data) -{ - struct apdu_event *cur = NULL; - struct apdu_event *new_event = NULL; - - if (!call || !messagetype || !apdu || (apdu_len < 1) || (apdu_len > 255)) - return -1; - - if (!(new_event = calloc(1, sizeof(*new_event)))) { - pri_error(call->pri, "!! Malloc failed!\n"); - return -1; - } - - new_event->message = messagetype; - new_event->callback = function; - new_event->data = data; - memcpy(new_event->apdu, apdu, apdu_len); - new_event->apdu_len = apdu_len; - - if (call->apdus) { - cur = call->apdus; - while (cur->next) { - cur = cur->next; - } - cur->next = new_event; - } else - call->apdus = new_event; - - return 0; -} - -int pri_call_apdu_queue_cleanup(q931_call *call) -{ - struct apdu_event *cur_event = NULL, *free_event = NULL; - - if (call && call->apdus) { - cur_event = call->apdus; - while (cur_event) { - /* TODO: callbacks, some way of giving return res on status of apdu */ - free_event = cur_event; - cur_event = cur_event->next; - free(free_event); - } - call->apdus = NULL; - } - - return 0; -} - -int pri_call_add_standard_apdus(struct pri *pri, q931_call *call) -{ - if (!pri->sendfacility) - return 0; - - if (pri->switchtype == PRI_SWITCH_QSIG) { /* For Q.SIG it does network and cpe operations */ - if (call->redirectingnum[0]) - rose_diverting_leg_information2_encode(pri, call); - add_callername_facility_ies(pri, call, 1); - return 0; - } - -#if 0 - if (pri->localtype == PRI_NETWORK) { - switch (pri->switchtype) { - case PRI_SWITCH_NI2: - add_callername_facility_ies(pri, call, 0); - break; - default: - break; - } - return 0; - } else if (pri->localtype == PRI_CPE) { - switch (pri->switchtype) { - case PRI_SWITCH_NI2: - add_callername_facility_ies(pri, call, 1); - break; - default: - break; - } - return 0; - } -#else - if (pri->switchtype == PRI_SWITCH_NI2) - add_callername_facility_ies(pri, call, (pri->localtype == PRI_CPE)); -#endif - - if ((pri->switchtype == PRI_SWITCH_DMS100) && (pri->localtype == PRI_CPE)) { - add_dms100_transfer_ability_apdu(pri, call); - } - - - - return 0; -} - diff --git a/libpri/pri_facility.h b/libpri/pri_facility.h deleted file mode 100644 index 83864aad..00000000 --- a/libpri/pri_facility.h +++ /dev/null @@ -1,325 +0,0 @@ -/* - This file contains all data structures and definitions associated - with facility message usage and the ROSE components included - within those messages. - - by Matthew Fredrickson - Copyright (C) Digium, Inc. 2004-2005 -*/ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _PRI_FACILITY_H -#define _PRI_FACILITY_H -#include "pri_q931.h" - -/* Protocol Profile field */ -#define Q932_PROTOCOL_ROSE 0x11 /* X.219 & X.229 */ -#define Q932_PROTOCOL_CMIP 0x12 /* Q.941 */ -#define Q932_PROTOCOL_ACSE 0x13 /* X.217 & X.227 */ -#define Q932_PROTOCOL_GAT 0x16 -#define Q932_PROTOCOL_EXTENSIONS 0x1F - -/* Argument values */ -#define ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE 0x80 -#define ROSE_NAME_PRESENTATION_RESTRICTED_NULL 0x87 -#define ROSE_NAME_NOT_AVAIL 0x84 - -/* Component types */ -#define COMP_TYPE_INTERPRETATION 0x8B -#define COMP_TYPE_NETWORK_PROTOCOL_PROFILE 0x92 -#define COMP_TYPE_INVOKE 0xA1 -#define COMP_TYPE_RETURN_RESULT 0xA2 -#define COMP_TYPE_RETURN_ERROR 0xA3 -#define COMP_TYPE_REJECT 0xA4 -#define COMP_TYPE_NFE 0xAA - -/* Operation ID values */ -/* Q.952.7 (ECMA-178) ROSE operations (Transfer) */ -#define ROSE_CALL_TRANSFER_IDENTIFY 7 -#define ROSE_CALL_TRANSFER_ABANDON 8 -#define ROSE_CALL_TRANSFER_INITIATE 9 -#define ROSE_CALL_TRANSFER_SETUP 10 -#define ROSE_CALL_TRANSFER_ACTIVE 11 -#define ROSE_CALL_TRANSFER_COMPLETE 12 -#define ROSE_CALL_TRANSFER_UPDATE 13 -#define ROSE_SUBADDRESS_TRANSFER 14 -/* Q.952 ROSE operations (Diverting) */ -#define ROSE_DIVERTING_LEG_INFORMATION1 18 -#define ROSE_DIVERTING_LEG_INFORMATION2 0x15 -#define ROSE_DIVERTING_LEG_INFORMATION3 19 -/* Q.956 ROSE operations (Advice Of Charge) */ -#define ROSE_AOC_NO_CHARGING_INFO_AVAILABLE 26 -#define ROSE_AOC_CHARGING_REQUEST 30 -#define ROSE_AOC_AOCS_CURRENCY 31 -#define ROSE_AOC_AOCS_SPECIAL_ARR 32 -#define ROSE_AOC_AOCD_CURRENCY 33 -#define ROSE_AOC_AOCD_CHARGING_UNIT 34 -#define ROSE_AOC_AOCE_CURRENCY 35 -#define ROSE_AOC_AOCE_CHARGING_UNIT 36 -#define ROSE_AOC_IDENTIFICATION_OF_CHARGE 37 -/* Q.SIG operations */ -#define SS_CNID_CALLINGNAME 0 -#define SS_ANFPR_PATHREPLACEMENT 4 -#define SS_DIVERTING_LEG_INFORMATION2 21 -#define SS_MWI_ACTIVATE 80 -#define SS_MWI_DEACTIVATE 81 -#define SS_MWI_INTERROGATE 82 - -/* ROSE definitions and data structures */ -#define INVOKE_IDENTIFIER 0x02 -#define INVOKE_LINKED_IDENTIFIER 0x80 -#define INVOKE_NULL_IDENTIFIER __USE_ASN1_NULL - -/* ASN.1 Identifier Octet - Data types */ -#define ASN1_TYPE_MASK 0x1f -#define ASN1_BOOLEAN 0x01 -#define ASN1_INTEGER 0x02 -#define ASN1_BITSTRING 0x03 -#define ASN1_OCTETSTRING 0x04 -#define ASN1_NULL 0x05 -#define ASN1_OBJECTIDENTIFIER 0x06 -#define ASN1_OBJECTDESCRIPTOR 0x07 -#define ASN1_EXTERN 0x08 -#define ASN1_REAL 0x09 -#define ASN1_ENUMERATED 0x0a -#define ASN1_EMBEDDEDPDV 0x0b -#define ASN1_UTF8STRING 0x0c -#define ASN1_RELATIVEOBJECTID 0x0d -/* 0x0e & 0x0f are reserved for future ASN.1 editions */ -#define ASN1_SEQUENCE 0x10 -#define ASN1_SET 0x11 -#define ASN1_NUMERICSTRING 0x12 -#define ASN1_PRINTABLESTRING 0x13 -#define ASN1_TELETEXSTRING 0x14 -#define ASN1_IA5STRING 0x16 -#define ASN1_UTCTIME 0x17 -#define ASN1_GENERALIZEDTIME 0x18 - -/* ASN.1 Identifier Octet - Tags */ -#define ASN1_TAG_0 0x00 -#define ASN1_TAG_1 0x01 -#define ASN1_TAG_2 0x02 -#define ASN1_TAG_3 0x03 -#define ASN1_TAG_4 0x04 -#define ASN1_TAG_5 0x05 -#define ASN1_TAG_6 0x06 -#define ASN1_TAG_7 0x07 -#define ASN1_TAG_8 0x08 -#define ASN1_TAG_9 0x09 - -/* ASN.1 Identifier Octet - Primitive/Constructor Bit */ -#define ASN1_PC_MASK 0x20 -#define ASN1_PRIMITIVE 0x00 -#define ASN1_CONSTRUCTOR 0x20 - -/* ASN.1 Identifier Octet - Clan Bits */ -#define ASN1_CLAN_MASK 0xc0 -#define ASN1_UNIVERSAL 0x00 -#define ASN1_APPLICATION 0x40 -#define ASN1_CONTEXT_SPECIFIC 0x80 -#define ASN1_PRIVATE 0xc0 - -/* ASN.1 Length masks */ -#define ASN1_LEN_INDEF 0x80 - - -#define INVOKE_OPERATION_INT __USE_ASN1_INTEGER -#define INVOKE_OBJECT_ID __USE_ASN1_OBJECTIDENTIFIER - -/* Q.952 Divert cause */ -#define Q952_DIVERT_REASON_UNKNOWN 0x00 -#define Q952_DIVERT_REASON_CFU 0x01 -#define Q952_DIVERT_REASON_CFB 0x02 -#define Q952_DIVERT_REASON_CFNR 0x03 -#define Q952_DIVERT_REASON_CD 0x04 -#define Q952_DIVERT_REASON_IMMEDIATE 0x05 -/* Q.SIG Divert cause. Listed in ECMA-174 */ -#define QSIG_DIVERT_REASON_UNKNOWN 0x00 /* Call forward unknown reason */ -#define QSIG_DIVERT_REASON_CFU 0x01 /* Call Forward Unconditional (other reason) */ -#define QSIG_DIVERT_REASON_CFB 0x02 /* Call Forward Busy */ -#define QSIG_DIVERT_REASON_CFNR 0x03 /* Call Forward No Reply */ - -/* Q.932 Type of number */ -#define Q932_TON_UNKNOWN 0x00 -#define Q932_TON_INTERNATIONAL 0x01 -#define Q932_TON_NATIONAL 0x02 -#define Q932_TON_NET_SPECIFIC 0x03 -#define Q932_TON_SUBSCRIBER 0x04 -#define Q932_TON_ABBREVIATED 0x06 - -/* RLT related Operations */ -#define RLT_SERVICE_ID 0x3e -#define RLT_OPERATION_IND 0x01 -#define RLT_THIRD_PARTY 0x02 - -struct rose_component { - u_int8_t type; - u_int8_t len; - u_int8_t data[0]; -}; - -#if 1 - #define GET_COMPONENT(component, idx, ptr, length) \ - if ((idx)+2 > (length)) \ - break; \ - (component) = (struct rose_component*)&((ptr)[idx]); \ - if ((idx)+(component)->len+2 > (length)) { \ - if ((component)->len != ASN1_LEN_INDEF) \ - pri_message(pri, "Length (%d) of 0x%X component is too long\n", (component)->len, (component)->type); \ - } -#else /* Debugging */ - #define GET_COMPONENT(component, idx, ptr, length) \ - if ((idx)+2 > (length)) \ - break; \ - (component) = (struct rose_component*)&((ptr)[idx]); \ - if ((idx)+(component)->len+2 > (length)) { \ - if ((component)->len != 128) \ - pri_message(pri, "Length (%d) of 0x%X component is too long\n", (component)->len, (component)->type); \ - } \ - pri_message(pri, "XX %s:%d Got component %d (0x%02X), length %d\n", __FUNCTION__, __LINE__, (component)->type, (component)->type, (component)->len); \ - if ((component)->len > 0) { \ - int zzz; \ - pri_message(pri, "XX Data:"); \ - for (zzz = 0; zzz < (component)->len; ++zzz) \ - pri_message(pri, " %02X", (component)->data[zzz]); \ - pri_message(pri, "\n"); \ - } -#endif - -#define NEXT_COMPONENT(component, idx) \ - (idx) += (component)->len + 2 - -#define SUB_COMPONENT(component, idx) \ - (idx) += 2 - -#define CHECK_COMPONENT(component, comptype, message) \ - if ((component)->type && ((component)->type & ASN1_TYPE_MASK) != (comptype)) { \ - pri_message(pri, (message), (component)->type); \ - asn1_dump(pri, (component), (component)->len+2); \ - break; \ - } - -#define ASN1_GET_INTEGER(component, variable) \ - do { \ - int comp_idx; \ - (variable) = 0; \ - for (comp_idx = 0; comp_idx < (component)->len; ++comp_idx) \ - (variable) = ((variable) << 8) | (component)->data[comp_idx]; \ - } while (0) - -#define ASN1_FIXUP_LEN(component, size) \ - do { \ - if ((component)->len == ASN1_LEN_INDEF) \ - size += 2; \ - } while (0) - -#define ASN1_ADD_SIMPLE(component, comptype, ptr, idx) \ - do { \ - (component) = (struct rose_component *)&((ptr)[(idx)]); \ - (component)->type = (comptype); \ - (component)->len = 0; \ - (idx) += 2; \ - } while (0) - -#define ASN1_ADD_BYTECOMP(component, comptype, ptr, idx, value) \ - do { \ - (component) = (struct rose_component *)&((ptr)[(idx)]); \ - (component)->type = (comptype); \ - (component)->len = 1; \ - (component)->data[0] = (value); \ - (idx) += 3; \ - } while (0) - -#define ASN1_ADD_WORDCOMP(component, comptype, ptr, idx, value) \ - do { \ - int __val = (value); \ - int __i = 0; \ - (component) = (struct rose_component *)&((ptr)[(idx)]); \ - (component)->type = (comptype); \ - if ((__val >> 24)) \ - (component)->data[__i++] = (__val >> 24) & 0xff; \ - if ((__val >> 16)) \ - (component)->data[__i++] = (__val >> 16) & 0xff; \ - if ((__val >> 8)) \ - (component)->data[__i++] = (__val >> 8) & 0xff; \ - (component)->data[__i++] = __val & 0xff; \ - (component)->len = __i; \ - (idx) += 2 + __i; \ - } while (0) - -#define ASN1_PUSH(stack, stackpointer, component) \ - (stack)[(stackpointer)++] = (component) - -#define ASN1_FIXUP(stack, stackpointer, data, idx) \ - do { \ - --(stackpointer); \ - (stack)[(stackpointer)]->len = (unsigned char *)&((data)[(idx)]) - (unsigned char *)(stack)[(stackpointer)] - 2; \ - } while (0) - -/* Decoder for the invoke ROSE component */ -int rose_invoke_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len); - -/* Decoder for the return result ROSE component */ -int rose_return_result_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len); - -/* Decoder for the return error ROSE component */ -int rose_return_error_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len); - -/* Decoder for the reject ROSE component */ -int rose_reject_decode(struct pri *pri, struct q931_call *call, q931_ie *ie, unsigned char *data, int len); - -int asn1_copy_string(char * buf, int buflen, struct rose_component *comp); - -int asn1_string_encode(unsigned char asn1_type, void *data, int len, int max_len, void *src, int src_len); - -/* Get Name types from ASN.1 */ -int asn1_name_decode(void * data, int len, char *namebuf, int buflen); - -int typeofnumber_from_q931(struct pri *pri, int ton); - -int redirectingreason_from_q931(struct pri *pri, int redirectingreason); - -/* Queues an MWI apdu on a the given call */ -int mwi_message_send(struct pri *pri, q931_call *call, struct pri_sr *req, int activate); - -/* starts a 2BCT */ -int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2); - -int rlt_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2); - -/* starts a QSIG Path Replacement */ -extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2); - -/* Use this function to queue a facility-IE born APDU onto a call - * call is the call to use, messagetype is any one of the Q931 messages, - * apdu is the apdu data, apdu_len is the length of the apdu data */ -int pri_call_apdu_queue(q931_call *call, int messagetype, void *apdu, int apdu_len, void (*function)(void *data), void *data); - -/* Used by q931.c to cleanup the apdu queue upon destruction of a call */ -int pri_call_apdu_queue_cleanup(q931_call *call); - -/* Adds the "standard" APDUs to a call */ -int pri_call_add_standard_apdus(struct pri *pri, q931_call *call); - -int asn1_dump(struct pri *pri, void *comp, int len); - -#endif /* _PRI_FACILITY_H */ diff --git a/libpri/pri_internal.h b/libpri/pri_internal.h deleted file mode 100644 index 3e39b221..00000000 --- a/libpri/pri_internal.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _PRI_INTERNAL_H -#define _PRI_INTERNAL_H - -#include -#include - -#define DBGHEAD __FILE__ ":%d %s: " -#define DBGINFO __LINE__,__PRETTY_FUNCTION__ - -struct pri_sched { - struct timeval when; - void (*callback)(void *data); - void *data; -}; - -struct q921_frame; -enum q931_state; -enum q931_mode; - -/* No more than 128 scheduled events */ -#define MAX_SCHED 128 - -#define MAX_TIMERS 32 - -struct pri { - int fd; /* File descriptor for D-Channel */ - pri_io_cb read_func; /* Read data callback */ - pri_io_cb write_func; /* Write data callback */ - void *userdata; - struct pri *subchannel; /* Sub-channel if appropriate */ - struct pri *master; /* Master channel if appropriate */ - struct pri_sched pri_sched[MAX_SCHED]; /* Scheduled events */ - int debug; /* Debug stuff */ - int state; /* State of D-channel */ - int switchtype; /* Switch type */ - int nsf; /* Network-Specific Facility (if any) */ - int localtype; /* Local network type (unknown, network, cpe) */ - int remotetype; /* Remote network type (unknown, network, cpe) */ - - int sapi; - int tei; - int protodisc; - unsigned int bri:1; - unsigned int acceptinbanddisconnect:1; /* Should we allow inband progress after DISCONNECT? */ - - /* Q.921 State */ - int q921_state; - int window; /* Max window size */ - int windowlen; /* Fullness of window */ - int v_s; /* Next N(S) for transmission */ - int v_a; /* Last acknowledged frame */ - int v_r; /* Next frame expected to be received */ - int v_na; /* What we've told our peer we've acknowledged */ - int solicitfbit; /* Have we sent an I or S frame with the F-bit set? */ - int retrans; /* Retransmissions */ - int sentrej; /* Are we in reject state */ - - int cref; /* Next call reference value */ - - int busy; /* Peer is busy */ - - /* Various timers */ - int sabme_timer; /* SABME retransmit */ - int sabme_count; /* SABME retransmit counter for BRI */ - int t203_timer; /* Max idle time */ - int t202_timer; - int n202_counter; - int ri; - int t200_timer; /* T-200 retransmission timer */ - /* All ISDN Timer values */ - int timers[MAX_TIMERS]; - - /* Used by scheduler */ - struct timeval tv; - int schedev; - pri_event ev; /* Static event thingy */ - - /* Q.921 Re-transmission queue */ - struct q921_frame *txqueue; - - /* Q.931 calls */ - q931_call **callpool; - q931_call *localpool; - - /* do we do overlap dialing */ - int overlapdial; - -#ifdef LIBPRI_COUNTERS - /* q921/q931 packet counters */ - unsigned int q921_txcount; - unsigned int q921_rxcount; - unsigned int q931_txcount; - unsigned int q931_rxcount; -#endif - - unsigned char last_invoke; /* Last ROSE invoke ID */ - unsigned char sendfacility; -}; - -struct pri_sr { - int transmode; - int channel; - int exclusive; - int nonisdn; - char *caller; - int callerplan; - char *callername; - int callerpres; - char *called; - int calledplan; - int userl1; - int numcomplete; - char *redirectingnum; - int redirectingplan; - int redirectingpres; - int redirectingreason; - int justsignalling; - const char *useruserinfo; - int transferable; -}; - -/* Internal switch types */ -#define PRI_SWITCH_GR303_EOC_PATH 19 -#define PRI_SWITCH_GR303_TMC_SWITCHING 20 - -struct apdu_event { - int message; /* What message to send the ADPU in */ - void (*callback)(void *data); /* Callback function for when response is received */ - void *data; /* Data to callback */ - unsigned char apdu[255]; /* ADPU to send */ - int apdu_len; /* Length of ADPU */ - int sent; /* Have we been sent already? */ - struct apdu_event *next; /* Linked list pointer */ -}; - -/* q931_call datastructure */ - -struct q931_call { - struct pri *pri; /* PRI */ - int cr; /* Call Reference */ - int forceinvert; /* Force inversion of call number even if 0 */ - q931_call *next; - /* Slotmap specified (bitmap of channels 31/24-1) (Channel Identifier IE) (-1 means not specified) */ - int slotmap; - /* An explicit channel (Channel Identifier IE) (-1 means not specified) */ - int channelno; - /* An explicit DS1 (-1 means not specified) */ - int ds1no; - /* Whether or not the ds1 is explicitly identified or implicit. If implicit - the bchan is on the same span as the current active dchan (NFAS) */ - int ds1explicit; - /* Channel flags (0 means none retrieved) */ - int chanflags; - - int alive; /* Whether or not the call is alive */ - int acked; /* Whether setup has been acked or not */ - int sendhangupack; /* Whether or not to send a hangup ack */ - int proc; /* Whether we've sent a call proceeding / alerting */ - - int ri; /* Restart Indicator (Restart Indicator IE) */ - - /* Bearer Capability */ - int transcapability; - int transmoderate; - int transmultiple; - int userl1; - int userl2; - int userl3; - int rateadaption; - - int sentchannel; - int justsignalling; /* for a signalling-only connection */ - - int progcode; /* Progress coding */ - int progloc; /* Progress Location */ - int progress; /* Progress indicator */ - int progressmask; /* Progress Indicator bitmask */ - - int notify; /* Notification */ - - int causecode; /* Cause Coding */ - int causeloc; /* Cause Location */ - int cause; /* Cause of clearing */ - - int peercallstate; /* Call state of peer as reported */ - int ourcallstate; /* Our call state */ - int sugcallstate; /* Status call state */ - - int callerplan; - int callerplanani; - int callerpres; /* Caller presentation */ - char callerani[256]; /* Caller */ - char callernum[256]; - char callername[256]; - - char keypad_digits[64]; /* Buffer for digits that come in KEYPAD_FACILITY */ - - int ani2; /* ANI II */ - - int calledplan; - int nonisdn; - char callednum[256]; /* Called Number */ - int complete; /* no more digits coming */ - int newcall; /* if the received message has a new call reference value */ - - int retranstimer; /* Timer for retransmitting DISC */ - int t308_timedout; /* Whether t308 timed out once */ - - int redirectingplan; - int redirectingpres; - int redirectingreason; - char redirectingnum[256]; /* Number of redirecting party */ - char redirectingname[256]; /* Name of redirecting party */ - - /* Filled in cases of multiple diversions */ - int origcalledplan; - int origcalledpres; - int origredirectingreason; /* Original reason for redirect (in cases of multiple redirects) */ - char origcalledname[256]; /* Original name of person being called */ - char origcallednum[256]; /* Orignal number of person being called */ - - int useruserprotocoldisc; - char useruserinfo[256]; - char callingsubaddr[256]; /* Calling parties sub address */ - - long aoc_units; /* Advice of Charge Units */ - - struct apdu_event *apdus; /* APDU queue for call */ - - int transferable; - unsigned int rlt_call_id; /* RLT call id */ - - /* Bridged call info */ - q931_call *bridged_call; /* Pointer to other leg of bridged call */ -}; - -extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data); - -extern pri_event *pri_schedule_run(struct pri *pri); - -extern void pri_schedule_del(struct pri *pri, int ev); - -extern pri_event *pri_mkerror(struct pri *pri, char *errstr); - -extern void pri_message(struct pri *pri, char *fmt, ...); - -extern void pri_error(struct pri *pri, char *fmt, ...); - -void libpri_copy_string(char *dst, const char *src, size_t size); - -struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri); - -void __pri_free_tei(struct pri *p); - -#endif diff --git a/libpri/pri_q921.h b/libpri/pri_q921.h deleted file mode 100644 index fcb81b8a..00000000 --- a/libpri/pri_q921.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _PRI_Q921_H -#define _PRI_Q921_H - -#include -#if defined(__linux__) -#include -#elif defined(__FreeBSD__) -#include -#define __BYTE_ORDER _BYTE_ORDER -#define __BIG_ENDIAN _BIG_ENDIAN -#define __LITTLE_ENDIAN _LITTLE_ENDIAN -#endif - -/* Timer values */ - -#define T_WAIT_MIN 2000 -#define T_WAIT_MAX 10000 - -#define Q921_FRAMETYPE_MASK 0x3 - -#define Q921_FRAMETYPE_U 0x3 -#define Q921_FRAMETYPE_I 0x0 -#define Q921_FRAMETYPE_S 0x1 - -#define Q921_TEI_GROUP 127 -#define Q921_TEI_PRI 0 -#define Q921_TEI_GR303_EOC_PATH 0 -#define Q921_TEI_GR303_EOC_OPS 4 -#define Q921_TEI_GR303_TMC_SWITCHING 0 -#define Q921_TEI_GR303_TMC_CALLPROC 0 - -#define Q921_SAPI_CALL_CTRL 0 -#define Q921_SAPI_GR303_EOC 1 -#define Q921_SAPI_GR303_TMC_SWITCHING 1 -#define Q921_SAPI_GR303_TMC_CALLPROC 0 - - -#define Q921_SAPI_PACKET_MODE 1 -#define Q921_SAPI_X25_LAYER3 16 -#define Q921_SAPI_LAYER2_MANAGEMENT 63 - - -#define Q921_TEI_IDENTITY_REQUEST 1 -#define Q921_TEI_IDENTITY_ASSIGNED 2 -#define Q921_TEI_IDENTITY_DENIED 3 -#define Q921_TEI_IDENTITY_CHECK_REQUEST 4 -#define Q921_TEI_IDENTITY_CHECK_RESPONSE 5 -#define Q921_TEI_IDENTITY_REMOVE 6 -#define Q921_TEI_IDENTITY_VERIFY 7 - -typedef struct q921_header { -#if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t sapi:6; /* Service Access Point Indentifier (always 0 for PRI) (0) */ - u_int8_t c_r:1; /* Command/Response (0 if CPE, 1 if network) */ - u_int8_t ea1:1; /* Extended Address (0) */ - u_int8_t tei:7; /* Terminal Endpoint Identifier (0) */ - u_int8_t ea2:1; /* Extended Address Bit (1) */ -#else - u_int8_t ea1:1; /* Extended Address (0) */ - u_int8_t c_r:1; /* Command/Response (0 if CPE, 1 if network) */ - u_int8_t sapi:6; /* Service Access Point Indentifier (always 0 for PRI) (0) */ - u_int8_t ea2:1; /* Extended Address Bit (1) */ - u_int8_t tei:7; /* Terminal Endpoint Identifier (0) */ -#endif - u_int8_t data[0]; /* Further data */ -} __attribute__ ((packed)) q921_header; - -/* A Supervisory Format frame */ -typedef struct q921_s { - struct q921_header h; /* Header */ -#if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t x0:4; /* Unused */ - u_int8_t ss:2; /* Supervisory frame bits */ - u_int8_t ft:2; /* Frame type bits (01) */ - u_int8_t n_r:7; /* Number Received */ - u_int8_t p_f:1; /* Poll/Final bit */ -#else - u_int8_t ft:2; /* Frame type bits (01) */ - u_int8_t ss:2; /* Supervisory frame bits */ - u_int8_t x0:4; /* Unused */ - u_int8_t p_f:1; /* Poll/Final bit */ - u_int8_t n_r:7; /* Number Received */ -#endif - u_int8_t data[0]; /* Any further data */ - u_int8_t fcs[2]; /* At least an FCS */ -} __attribute__ ((packed)) q921_s; - -/* An Unnumbered Format frame */ -typedef struct q921_u { - struct q921_header h; /* Header */ -#if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t m3:3; /* Top 3 modifier bits */ - u_int8_t p_f:1; /* Poll/Final bit */ - u_int8_t m2:2; /* Two more modifier bits */ - u_int8_t ft:2; /* Frame type bits (11) */ -#else - u_int8_t ft:2; /* Frame type bits (11) */ - u_int8_t m2:2; /* Two more modifier bits */ - u_int8_t p_f:1; /* Poll/Final bit */ - u_int8_t m3:3; /* Top 3 modifier bits */ -#endif - u_int8_t data[0]; /* Any further data */ - u_int8_t fcs[2]; /* At least an FCS */ -} __attribute__ ((packed)) q921_u; - -/* An Information frame */ -typedef struct q921_i { - struct q921_header h; /* Header */ -#if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t n_s:7; /* Number sent */ - u_int8_t ft:1; /* Frame type (0) */ - u_int8_t n_r:7; /* Number received */ - u_int8_t p_f:1; /* Poll/Final bit */ -#else - u_int8_t ft:1; /* Frame type (0) */ - u_int8_t n_s:7; /* Number sent */ - u_int8_t p_f:1; /* Poll/Final bit */ - u_int8_t n_r:7; /* Number received */ -#endif - u_int8_t data[0]; /* Any further data */ - u_int8_t fcs[2]; /* At least an FCS */ -} q921_i; - -typedef union { - u_int8_t raw[0]; - q921_u u; - q921_s s; - q921_i i; - struct q921_header h; -} q921_h; - -typedef struct q921_frame { - struct q921_frame *next; /* Next in list */ - int len; /* Length of header + body */ - int transmitted; /* Have we been transmitted */ - q921_i h; -} q921_frame; - -#define Q921_INC(j) (j) = (((j) + 1) % 128) - -typedef enum q921_state { - Q921_DOWN = 0, - Q921_TEI_UNASSIGNED, - Q921_TEI_AWAITING_ESTABLISH, - Q921_TEI_AWAITING_ASSIGN, - Q921_TEI_ASSIGNED, - Q921_NEGOTIATION, - Q921_LINK_CONNECTION_RELEASED, /* Also known as TEI_ASSIGNED */ - Q921_LINK_CONNECTION_ESTABLISHED, - Q921_AWAITING_ESTABLISH, - Q921_AWAITING_RELEASE -} q921_state; - -/* Dumps a *known good* Q.921 packet */ -extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx); - -/* Bring up the D-channel */ -extern void q921_start(struct pri *pri, int now); - -extern void q921_reset(struct pri *pri); - -extern pri_event *q921_receive(struct pri *pri, q921_h *h, int len); - -extern int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr); - -#endif diff --git a/libpri/pri_q931.h b/libpri/pri_q931.h deleted file mode 100644 index c0060f28..00000000 --- a/libpri/pri_q931.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _PRI_Q931_H -#define _PRI_Q931_H - -typedef enum q931_state { - /* User states */ - U0_NULL_STATE, - U1_CALL_INITIATED, - U2_OVERLAP_SENDING, - U3_OUTGOING_CALL_PROCEEDING, - U4_CALL_DELIVERED, - U6_CALL_PRESENT, - U7_CALL_RECEIVED, - U8_CONNECT_REQUEST, - U9_INCOMING_CALL_PROCEEDING, - U10_ACTIVE, - U11_DISCONNECT_REQUEST, - U12_DISCONNECT_INDICATION, - U15_SUSPEND_REQUEST, - U17_RESUME_REQUEST, - U19_RELEASE_REQUEST, - U25_OVERLAP_RECEIVING, - /* Network states */ - N0_NULL_STATE, - N1_CALL_INITIATED, - N2_OVERLAP_SENDING, - N3_OUTGOING_CALL_PROCEEDING, - N4_CALL_DELIVERED, - N6_CALL_PRESENT, - N7_CALL_RECEIVED, - N8_CONNECT_REQUEST, - N9_INCOMING_CALL_PROCEEDING, - N10_ACTIVE, - N11_DISCONNECT_REQUEST, - N12_DISCONNECT_INDICATION, - N15_SUSPEND_REQUEST, - N17_RESUME_REQUEST, - N19_RELEASE_REQUEST, - N22_CALL_ABORT, - N25_OVERLAP_RECEIVING -} q931_state; - -typedef enum q931_mode { - UNKNOWN_MODE, - CIRCUIT_MODE, - PACKET_MODE -} q931_mode; - -typedef struct q931_h { - unsigned char raw[0]; - u_int8_t pd; /* Protocol Discriminator */ -#if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t x0:4; - u_int8_t crlen:4; -#else - u_int8_t crlen:4; - u_int8_t x0:4; -#endif - u_int8_t contents[0]; - u_int8_t crv[3]; -} __attribute__ ((packed)) q931_h; - - -/* Message type header */ -typedef struct q931_mh { -#if __BYTE_ORDER == __BIG_ENDIAN - u_int8_t f:1; - u_int8_t msg:7; -#else - u_int8_t msg:7; - u_int8_t f:1; -#endif - u_int8_t data[0]; -} __attribute__ ((packed)) q931_mh; - -/* Information element format */ -typedef struct q931_ie { - u_int8_t ie; - u_int8_t len; - u_int8_t data[0]; -} __attribute__ ((packed)) q931_ie; - -#define Q931_RES_HAVEEVENT (1 << 0) -#define Q931_RES_INERRROR (1 << 1) - -#define Q931_PROTOCOL_DISCRIMINATOR 0x08 -#define GR303_PROTOCOL_DISCRIMINATOR 0x4f - -/* Q.931 / National ISDN Message Types */ - -/* Call Establishment Messages */ -#define Q931_ALERTING 0x01 -#define Q931_CALL_PROCEEDING 0x02 -#define Q931_CONNECT 0x07 -#define Q931_CONNECT_ACKNOWLEDGE 0x0f -#define Q931_PROGRESS 0x03 -#define Q931_SETUP 0x05 -#define Q931_SETUP_ACKNOWLEDGE 0x0d - -/* Call Disestablishment Messages */ -#define Q931_DISCONNECT 0x45 -#define Q931_RELEASE 0x4d -#define Q931_RELEASE_COMPLETE 0x5a -#define Q931_RESTART 0x46 -#define Q931_RESTART_ACKNOWLEDGE 0x4e - -/* Miscellaneous Messages */ -#define Q931_STATUS 0x7d -#define Q931_STATUS_ENQUIRY 0x75 -#define Q931_USER_INFORMATION 0x20 -#define Q931_SEGMENT 0x60 -#define Q931_CONGESTION_CONTROL 0x79 -#define Q931_INFORMATION 0x7b -#define Q931_FACILITY 0x62 -#define Q931_NOTIFY 0x6e - -/* Call Management Messages */ -#define Q931_HOLD 0x24 -#define Q931_HOLD_ACKNOWLEDGE 0x28 -#define Q931_HOLD_REJECT 0x30 -#define Q931_RETRIEVE 0x31 -#define Q931_RETRIEVE_ACKNOWLEDGE 0x33 -#define Q931_RETRIEVE_REJECT 0x37 -#define Q931_RESUME 0x26 -#define Q931_RESUME_ACKNOWLEDGE 0x2e -#define Q931_RESUME_REJECT 0x22 -#define Q931_SUSPEND 0x25 -#define Q931_SUSPEND_ACKNOWLEDGE 0x2d -#define Q931_SUSPEND_REJECT 0x21 - -/* Maintenance messages (codeset 0 only) */ -#define NATIONAL_SERVICE 0x0f -#define NATIONAL_SERVICE_ACKNOWLEDGE 0x07 - -/* Special codeset 0 IE */ -#define NATIONAL_CHANGE_STATUS 0x1 - -/* Q.931 / National ISDN Information Elements */ -#define Q931_LOCKING_SHIFT 0x90 -#define Q931_NON_LOCKING_SHIFT 0x98 -#define Q931_BEARER_CAPABILITY 0x04 -#define Q931_CAUSE 0x08 -#define Q931_CALL_STATE 0x14 -#define Q931_CHANNEL_IDENT 0x18 -#define Q931_PROGRESS_INDICATOR 0x1e -#define Q931_NETWORK_SPEC_FAC 0x20 -#define Q931_INFORMATION_RATE 0x40 -#define Q931_TRANSIT_DELAY 0x42 -#define Q931_TRANS_DELAY_SELECT 0x43 -#define Q931_BINARY_PARAMETERS 0x44 -#define Q931_WINDOW_SIZE 0x45 -#define Q931_PACKET_SIZE 0x46 -#define Q931_CLOSED_USER_GROUP 0x47 -#define Q931_REVERSE_CHARGE_INDIC 0x4a -#define Q931_CALLING_PARTY_NUMBER 0x6c -#define Q931_CALLING_PARTY_SUBADDR 0x6d -#define Q931_CALLED_PARTY_NUMBER 0x70 -#define Q931_CALLED_PARTY_SUBADDR 0x71 -#define Q931_REDIRECTING_NUMBER 0x74 -#define Q931_REDIRECTING_SUBADDR 0x75 -#define Q931_TRANSIT_NET_SELECT 0x78 -#define Q931_RESTART_INDICATOR 0x79 -#define Q931_LOW_LAYER_COMPAT 0x7c -#define Q931_HIGH_LAYER_COMPAT 0x7d - -#define Q931_CODESET(x) ((x) << 8) -#define Q931_IE_CODESET(x) ((x) >> 8) -#define Q931_IE_IE(x) ((x) & 0xff) -#define Q931_FULL_IE(codeset, ie) (((codeset) << 8) | ((ie) & 0xff)) - -#define Q931_DISPLAY 0x28 -#define Q931_IE_SEGMENTED_MSG 0x00 -#define Q931_IE_CHANGE_STATUS 0x01 -#define Q931_IE_ORIGINATING_LINE_INFO (0x01 | Q931_CODESET(6)) -#define Q931_IE_CONNECTED_ADDR 0x0C -#define Q931_IE_CONNECTED_NUM 0x4C -#define Q931_IE_CALL_IDENTITY 0x10 -#define Q931_IE_FACILITY 0x1c -#define Q931_IE_ENDPOINT_ID 0x26 -#define Q931_IE_NOTIFY_IND 0x27 -#define Q931_IE_TIME_DATE 0x29 -#define Q931_IE_KEYPAD_FACILITY 0x2c -#define Q931_IE_CALL_STATUS 0x2d -#define Q931_IE_UPDATE 0x31 -#define Q931_IE_INFO_REQUEST 0x32 -#define Q931_IE_SIGNAL 0x34 -#define Q931_IE_SWITCHHOOK 0x36 -#define Q931_IE_GENERIC_DIGITS (0x37 | Q931_CODESET(6)) -#define Q931_IE_FEATURE_ACTIVATE 0x38 -#define Q931_IE_FEATURE_IND 0x39 -#define Q931_IE_ORIGINAL_CALLED_NUMBER 0x73 -#define Q931_IE_REDIRECTION_NUMBER 0x76 -#define Q931_IE_REDIRECTION_SUBADDR 0x77 -#define Q931_IE_USER_USER_FACILITY 0x7A -#define Q931_IE_USER_USER 0x7E -#define Q931_IE_ESCAPE_FOR_EXT 0x7F - - -/* Call state stuff */ -#define Q931_CALL_STATE_NULL 0 -#define Q931_CALL_STATE_CALL_INITIATED 1 -#define Q931_CALL_STATE_OVERLAP_SENDING 2 -#define Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING 3 -#define Q931_CALL_STATE_CALL_DELIVERED 4 -#define Q931_CALL_STATE_CALL_PRESENT 6 -#define Q931_CALL_STATE_CALL_RECEIVED 7 -#define Q931_CALL_STATE_CONNECT_REQUEST 8 -#define Q931_CALL_STATE_INCOMING_CALL_PROCEEDING 9 -#define Q931_CALL_STATE_ACTIVE 10 -#define Q931_CALL_STATE_DISCONNECT_REQUEST 11 -#define Q931_CALL_STATE_DISCONNECT_INDICATION 12 -#define Q931_CALL_STATE_SUSPEND_REQUEST 15 -#define Q931_CALL_STATE_RESUME_REQUEST 17 -#define Q931_CALL_STATE_RELEASE_REQUEST 19 -#define Q931_CALL_STATE_OVERLAP_RECEIVING 25 -#define Q931_CALL_STATE_RESTART_REQUEST 61 -#define Q931_CALL_STATE_RESTART 62 - - -/* EuroISDN */ -#define Q931_SENDING_COMPLETE 0xa1 - - -/* Q.SIG specific */ -#define QSIG_IE_TRANSIT_COUNT 0x31 - -extern int q931_receive(struct pri *pri, q931_h *h, int len); - -extern int q931_alerting(struct pri *pri, q931_call *call, int channel, int info); - -extern int q931_call_progress(struct pri *pri, q931_call *call, int channel, int info); - -extern int q931_notify(struct pri *pri, q931_call *call, int channel, int info); - -extern int q931_call_proceeding(struct pri *pri, q931_call *call, int channel, int info); - -extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn); - -extern int q931_information(struct pri *pri, q931_call *call, char digit); - -extern int q931_keypad_facility(struct pri *pri, q931_call *call, char *digits); - -extern int q931_connect(struct pri *pri, q931_call *call, int channel, int nonisdn); - -extern int q931_release(struct pri *pri, q931_call *call, int cause); - -extern int q931_disconnect(struct pri *pri, q931_call *call, int cause); - -extern int q931_hangup(struct pri *pri, q931_call *call, int cause); - -extern int q931_restart(struct pri *pri, int channel); - -extern int q931_facility(struct pri *pri, q931_call *call); - -extern int q931_call_getcrv(struct pri *pri, q931_call *call, int *callmode); - -extern int q931_call_setcrv(struct pri *pri, q931_call *call, int crv, int callmode); - -extern q931_call *q931_new_call(struct pri *pri); - -extern int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req); -extern void q931_dump(struct pri *pri, q931_h *h, int len, int txrx); - -extern void __q931_destroycall(struct pri *pri, q931_call *c); - -extern void q931_dl_indication(struct pri *pri, int event); - -#endif diff --git a/libpri/pri_timers.h b/libpri/pri_timers.h deleted file mode 100644 index adb4d3c4..00000000 --- a/libpri/pri_timers.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#ifndef _PRI_TIMERS_H -#define _PRI_TIMERS_H - -/* -1 means we dont currently support the timer/counter */ -#define PRI_TIMERS_DEFAULT { \ - 3, /* N200 */ \ - -1, /* N201 */ \ - 3, /* N202 */ \ - 7, /* K */ \ - 1000, /* T200 */ \ - -1, /* T201 */ \ - 10000, /* T202 */ \ - 10000, /* T203 */ \ - -1, /* T300 */ \ - -1, /* T301 */ \ - -1, /* T302 */ \ - -1, /* T303 */ \ - -1, /* T304 */ \ - 30000, /* T305 */ \ - -1, /* T306 */ \ - -1, /* T307 */ \ - 4000, /* T308 */ \ - -1, /* T309 */ \ - -1, /* T310 */ \ - 4000, /* T313 */ \ - -1, /* T314 */ \ - -1, /* T316 */ \ - -1, /* T317 */ \ - -1, /* T318 */ \ - -1, /* T319 */ \ - -1, /* T320 */ \ - -1, /* T321 */ \ - -1, /* T322 */ \ - 2500, /* TM20 - Q.921 Appendix IV */ \ - 3, /* NM20 - Q.921 Appendix IV */ \ - } - -/* XXX Only our default timers are setup now XXX */ -#define PRI_TIMERS_UNKNOWN PRI_TIMERS_DEFAULT -#define PRI_TIMERS_NI2 PRI_TIMERS_DEFAULT -#define PRI_TIMERS_DMS100 PRI_TIMERS_DEFAULT -#define PRI_TIMERS_LUCENT5E PRI_TIMERS_DEFAULT -#define PRI_TIMERS_ATT4ESS PRI_TIMERS_DEFAULT -#define PRI_TIMERS_EUROISDN_E1 PRI_TIMERS_DEFAULT -#define PRI_TIMERS_EUROISDN_T1 PRI_TIMERS_DEFAULT -#define PRI_TIMERS_NI1 PRI_TIMERS_DEFAULT -#define PRI_TIMERS_GR303_EOC PRI_TIMERS_DEFAULT -#define PRI_TIMERS_GR303_TMC PRI_TIMERS_DEFAULT -#define PRI_TIMERS_QSIG PRI_TIMERS_DEFAULT -#define __PRI_TIMERS_GR303_EOC_INT PRI_TIMERS_DEFAULT -#define __PRI_TIMERS_GR303_TMC_INT PRI_TIMERS_DEFAULT - -#define PRI_TIMERS_ALL { PRI_TIMERS_UNKNOWN, \ - PRI_TIMERS_NI2, \ - PRI_TIMERS_DMS100, \ - PRI_TIMERS_LUCENT5E, \ - PRI_TIMERS_ATT4ESS, \ - PRI_TIMERS_EUROISDN_E1, \ - PRI_TIMERS_EUROISDN_T1, \ - PRI_TIMERS_NI1, \ - PRI_TIMERS_QSIG, \ - PRI_TIMERS_GR303_EOC, \ - PRI_TIMERS_GR303_TMC, \ - __PRI_TIMERS_GR303_EOC_INT, \ - __PRI_TIMERS_GR303_TMC_INT, \ - } - -#endif diff --git a/libpri/pridump.c b/libpri/pridump.c deleted file mode 100644 index 878fb20b..00000000 --- a/libpri/pridump.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -/* - * This program tests libpri call reception using a zaptel interface. - * Its state machines are setup for RECEIVING CALLS ONLY, so if you - * are trying to both place and receive calls you have to a bit more. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "libpri.h" -#include "pri_q921.h" -#include "pri_q931.h" - -static int pri_open(char *dev) -{ - int dfd; - struct zt_params p; - - dfd = open(dev, O_RDWR); - if (dfd < 0) { - fprintf(stderr, "Failed to open dchannel '%s': %s\n", dev, strerror(errno)); - return -1; - } - if (ioctl(dfd, ZT_GET_PARAMS, &p)) { - fprintf(stderr, "Unable to get parameters on '%s': %s\n", dev, strerror(errno)); - return -1; - } - if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) { - fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", dev, p.sigtype); - return -1; - } - return dfd; -} - -static void dump_packet(struct pri *pri, char *buf, int len, int txrx) -{ - q921_h *h = (q921_h *)buf; - q921_dump(pri, h, len, 1, txrx); - if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) { - q931_dump(pri, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx); - } - fflush(stdout); - fflush(stderr); -} - - -static int pri_bridge(int d1, int d2) -{ - char buf[1024]; - fd_set fds; - int max; - int e; - int res; - for(;;) { - FD_ZERO(&fds); - FD_SET(d1, &fds); - FD_SET(d2, &fds); - max = d1; - if (max < d2) - max = d2; - ioctl(d1, ZT_GETEVENT, &e); - ioctl(d2, ZT_GETEVENT, &e); - res = select(max + 1, &fds, NULL, NULL, NULL); - if (res < 0) { - fprintf(stderr, "Select returned %d: %s\n", res, strerror(errno)); - continue; - }; - if (FD_ISSET(d1, &fds)) { - /* Copy from d1 to d2 */ - res = read(d1, buf, sizeof(buf)); - dump_packet((struct pri *)NULL, buf, res, 1); - res = write(d2, buf, res); - } - if (FD_ISSET(d2, &fds)) { - /* Copy from d2 to d1 */ - res = read(d2, buf, sizeof(buf)); - dump_packet((struct pri *)NULL, buf, res, 0); - res = write(d1, buf, res); - } - } -} - -static void my_pri_message(struct pri *pri, char *stuff) -{ - fprintf(stdout, "%s", stuff); -} - -static void my_pri_error(struct pri *pri, char *stuff) -{ - fprintf(stderr, "%s", stuff); -} - -int main(int argc, char *argv[]) -{ - int d1, d2; - - if (argc < 3) { - fprintf(stderr, "Usage: pridump \n"); - exit(1); - } - - pri_set_message(my_pri_message); - pri_set_error(my_pri_error); - - d1 = pri_open(argv[1]); - if (d1 < 0) - exit(1); - d2 = pri_open(argv[2]); - if (d2 < 0) - exit(1); - pri_bridge(d1, d2); - return 0; -} diff --git a/libpri/prisched.c b/libpri/prisched.c deleted file mode 100644 index c5bc24b1..00000000 --- a/libpri/prisched.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include - -#include "libpri.h" -#include "pri_internal.h" - - -static int maxsched = 0; - -/* Scheduler routines */ -int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data) -{ - int x; - struct timeval tv; - /* Scheduling runs on master channels only */ - while (pri->master) - pri = pri->master; - for (x=1;xpri_sched[x].callback) - break; - if (x == MAX_SCHED) { - pri_error(pri, "No more room in scheduler\n"); - return -1; - } - if (x > maxsched) - maxsched = x; - gettimeofday(&tv, NULL); - tv.tv_sec += ms / 1000; - tv.tv_usec += (ms % 1000) * 1000; - if (tv.tv_usec > 1000000) { - tv.tv_usec -= 1000000; - tv.tv_sec += 1; - } - pri->pri_sched[x].when = tv; - pri->pri_sched[x].callback = function; - pri->pri_sched[x].data = data; - return x; -} - -struct timeval *pri_schedule_next(struct pri *pri) -{ - struct timeval *closest = NULL; - int x; - /* Check subchannels */ - if (pri->subchannel) - closest = pri_schedule_next(pri->subchannel); - for (x=1;xpri_sched[x].callback && - (!closest || (closest->tv_sec > pri->pri_sched[x].when.tv_sec) || - ((closest->tv_sec == pri->pri_sched[x].when.tv_sec) && - (closest->tv_usec > pri->pri_sched[x].when.tv_usec)))) - closest = &pri->pri_sched[x].when; - } - return closest; -} - -static pri_event *__pri_schedule_run(struct pri *pri, struct timeval *tv) -{ - int x; - void (*callback)(void *); - void *data; - pri_event *e; - if (pri->subchannel) { - if ((e = __pri_schedule_run(pri->subchannel, tv))) { - return e; - } - } - for (x=1;xpri_sched[x].callback && - ((pri->pri_sched[x].when.tv_sec < tv->tv_sec) || - ((pri->pri_sched[x].when.tv_sec == tv->tv_sec) && - (pri->pri_sched[x].when.tv_usec <= tv->tv_usec)))) { - pri->schedev = 0; - callback = pri->pri_sched[x].callback; - data = pri->pri_sched[x].data; - pri->pri_sched[x].callback = NULL; - pri->pri_sched[x].data = NULL; - callback(data); - if (pri->schedev) - return &pri->ev; - } - } - return NULL; -} - -pri_event *pri_schedule_run(struct pri *pri) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return __pri_schedule_run(pri, &tv); -} - - -void pri_schedule_del(struct pri *pri,int id) -{ - while (pri->master) - pri = pri->master; - if ((id >= MAX_SCHED) || (id < 0)) - pri_error(pri, "Asked to delete sched id %d???\n", id); - pri->pri_sched[id].callback = NULL; -} diff --git a/libpri/pritest.c b/libpri/pritest.c deleted file mode 100644 index 0baa3638..00000000 --- a/libpri/pritest.c +++ /dev/null @@ -1,410 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -/* - * This program tests libpri call reception using a zaptel interface. - * Its state machines are setup for RECEIVING CALLS ONLY, so if you - * are trying to both place and receive calls you have to a bit more. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "libpri.h" - -#define PRI_DEF_NODETYPE PRI_CPE -#define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2 - -#define MAX_CHAN 32 -#define DCHANNEL_TIMESLOT 16 - - -static int offset = 0; - -static void do_channel(ZAP *z) -{ - /* This is the part that runs on a given channel */ - zap_playf(z, "raw.ulaw", 0); -} - -struct pri_chan { - pid_t pid; - int needhangup; - int alreadyhungup; - q931_call *call; -} chans[MAX_CHAN]; - -static int str2node(char *node) -{ - if (!strcasecmp(node, "cpe")) - return PRI_CPE; - if (!strcasecmp(node, "network")) - return PRI_NETWORK; - return -1; -} - -static void chan_ended(int sig) -{ - int status; - int x; - struct rusage rusage; - pid_t pid; - pid = wait4(-1, &status, WNOHANG, &rusage); - - for (x=0;x -1) { - fprintf(stderr, "--!! Unknown PID %d exited\n", pid); - return; - } -} -static int str2switch(char *swtype) -{ - if (!strcasecmp(swtype, "ni2")) - return PRI_SWITCH_NI2; - if (!strcasecmp(swtype, "dms100")) - return PRI_SWITCH_DMS100; - if (!strcasecmp(swtype, "lucent5e")) - return PRI_SWITCH_LUCENT5E; - if (!strcasecmp(swtype, "att4ess")) - return PRI_SWITCH_ATT4ESS; - if (!strcasecmp(swtype, "euroisdn")) - return PRI_SWITCH_EUROISDN_E1; - if (!strcasecmp(swtype, "gr303eoc")) - return PRI_SWITCH_GR303_EOC; - if (!strcasecmp(swtype, "gr303tmc")) - return PRI_SWITCH_GR303_TMC; - return -1; -} - -static void hangup_channel(int channo) -{ - if (chans[channo].pid) { - -#if 0 - printf("Killing channel %d (pid = %d)\n", channo, chans[channo].pid); -#endif - chans[channo].alreadyhungup = 1; - kill(chans[channo].pid, SIGTERM); - } else if (chans[channo].needhangup) - chans[channo].needhangup = 0; -} - -static void launch_channel(int channo) -{ - pid_t pid; - ZAP *z; - char ch[80]; - - /* Make sure hangup state is reset */ - chans[channo].needhangup = 0; - chans[channo].alreadyhungup = 0; - - pid = fork(); - if (pid < 0) { - fprintf(stderr, "--!! Unable to fork\n"); - chans[channo].needhangup = 1; - } - if (pid) { - printf("-- Launching process %d to handle channel %d\n", pid, channo); - chans[channo].pid = pid; - } else { - sprintf(ch, "%d", channo + offset); - z = zap_open(ch, 0); - if (z) { - do_channel(z); - exit(0); - } else { - fprintf(stderr, "--!! Unable to open channel %d\n", channo); - exit(1); - } - } - -} - -static int get_free_channel(int channo) -{ - channo--; - if((channo>MAX_CHAN)||(channo<0)) { - fprintf(stderr, "Invalid Bchannel RANGE <%d", channo); - return 0; - }; - - while(chans[channo].pid) { - channo--; - } - - return channo; -} - -/* place here criteria for completion of destination number */ -static int number_incommplete(char *number) -{ - return strlen(number) < 3; -} - -static void start_channel(struct pri *pri, pri_event *e) -{ - int channo = e->ring.channel; - int flag = 1; - pri_event_ring *ring = &e->ring; - - if(channo == -1) { - channo = e->ring.channel = get_free_channel(MAX_CHAN); - - if(channo == DCHANNEL_TIMESLOT) - channo = e->ring.channel = get_free_channel(MAX_CHAN); - - - fprintf(stdout, "Any channel selected: %d\n", channo); - - if(!channo) { - pri_release(pri, ring->call, PRI_CAUSE_REQUESTED_CHAN_UNAVAIL); - fprintf(stdout, "Abort call due to no avl B channels\n"); - return; - } - - flag = 0; - } - /* Make sure it's a valid number */ - if ((channo >= MAX_CHAN) || (channo < 0)) { - fprintf(stderr, "--!! Channel %d is out of range\n", channo); - return; - } - - /* Make sure nothing is there */ - if (chans[channo].pid) { - fprintf(stderr, "--!! Channel %d still has a call on it, ending it...\n", channo); - hangup_channel(channo); - /* Wait for it to die */ - while(chans[channo].pid) - usleep(100); - } - - /* Record call number */ - chans[channo].call = e->ring.call; - - /* Answer the line */ - if(flag) { - pri_answer(pri, chans[channo].call, channo, 1); - } else { - pri_need_more_info(pri, chans[channo].call, channo, 1); - } - - /* Launch a process to handle it */ - launch_channel(channo); - -} - -static void handle_pri_event(struct pri *pri, pri_event *e) -{ - switch(e->e) { - case PRI_EVENT_DCHAN_UP: - printf("-- D-Channel is now up! :-)\n"); - break; - case PRI_EVENT_DCHAN_DOWN: - printf("-- D-Channel is now down! :-(\n"); - break; - case PRI_EVENT_RESTART: - printf("-- Restarting channel %d\n", e->restart.channel); - hangup_channel(e->restart.channel); - break; - case PRI_EVENT_CONFIG_ERR: - printf("-- Configuration error detected: %s\n", e->err.err); - break; - case PRI_EVENT_RING: - printf("-- Ring on channel %d (from %s to %s), answering...\n", e->ring.channel, e->ring.callingnum, e->ring.callednum); - start_channel(pri, e); - break; - case PRI_EVENT_HANGUP: - printf("-- Hanging up channel %d\n", e->hangup.channel); - hangup_channel(e->hangup.channel); - break; - case PRI_EVENT_RINGING: - case PRI_EVENT_ANSWER: - fprintf(stderr, "--!! What? We shouldn't be making any calls...\n"); - break; - case PRI_EVENT_HANGUP_ACK: - /* Ignore */ - break; - case PRI_EVENT_INFO_RECEIVED: - fprintf(stdout, "number is: %s\n", e->ring.callednum); - if(!number_incommplete(e->ring.callednum)) { - fprintf(stdout, "final number is: %s\n", e->ring.callednum); - pri_answer(pri, e->ring.call, 0, 1); - } - - break; - default: - fprintf(stderr, "--!! Unknown PRI event %d\n", e->e); - } -} - -static int run_pri(int dfd, int swtype, int node) -{ - struct pri *pri; - pri_event *e; - struct timeval tv = {0,0}, *next; - fd_set rfds, efds; - int res,x; - - pri = pri_new_bri(dfd, 1, node, swtype); - if (!pri) { - fprintf(stderr, "Unable to create PRI\n"); - return -1; - } - pri_set_debug(pri, -1); - for (;;) { - - /* Run the D-Channel */ - FD_ZERO(&rfds); - FD_ZERO(&efds); - FD_SET(dfd, &rfds); - FD_SET(dfd, &efds); - - if ((next = pri_schedule_next(pri))) { - gettimeofday(&tv, NULL); - tv.tv_sec = next->tv_sec - tv.tv_sec; - tv.tv_usec = next->tv_usec - tv.tv_usec; - if (tv.tv_usec < 0) { - tv.tv_usec += 1000000; - tv.tv_sec -= 1; - } - if (tv.tv_sec < 0) { - tv.tv_sec = 0; - tv.tv_usec = 0; - } - } - res = select(dfd + 1, &rfds, NULL, &efds, next ? &tv : NULL); - e = NULL; - - if (!res) { - e = pri_schedule_run(pri); - } else if (res > 0) { - e = pri_check_event(pri); - } else if (errno == ELAST) { - res = ioctl(dfd, ZT_GETEVENT, &x); - printf("Got Zaptel event: %d\n", x); - } else if (errno != EINTR) - fprintf(stderr, "Error (%d) on select: %s\n", ELAST, strerror(errno)); - - if (e) { - handle_pri_event(pri, e); - } - - res = ioctl(dfd, ZT_GETEVENT, &x); - - if (!res && x) { - fprintf(stderr, "Got event on PRI interface: %d\n", x); - } - - /* Check for lines that need hangups */ - for (x=0;x [swtypetype] [nodetype]\n"); - exit(1); - } - dfd = open(argv[1], O_RDWR); - if (dfd < 0) { - fprintf(stderr, "Failed to open dchannel '%s': %s\n", argv[1], strerror(errno)); - exit(1); - } - if (ioctl(dfd, ZT_GET_PARAMS, &p)) { - fprintf(stderr, "Unable to get parameters on '%s': %s\n", argv[1], strerror(errno)); - exit(1); - } - if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) { - fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", argv[1], p.sigtype); - exit(1); - } - - if (argc > 2) { - swtype = str2switch(argv[2]); - if (swtype < 0) { - fprintf(stderr, "Valid switchtypes are: ni2, dms100, lucent5e, att4ess, and euroisdn\n"); - exit(1); - } - } - - if (argc > 3) { - node = str2node(argv[3]); - if (node < 0) { - fprintf(stderr, "Valid node types are: network and cpe\n"); - exit(1); - } - } - - signal(SIGCHLD, chan_ended); - - if (run_pri(dfd, swtype, node)) - exit(1); - exit(0); - - return 0; -} diff --git a/libpri/q921.c b/libpri/q921.c deleted file mode 100644 index e3bc1749..00000000 --- a/libpri/q921.c +++ /dev/null @@ -1,1170 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include -#include -#include -#include -#include -#include "compat.h" -#include "libpri.h" -#include "pri_internal.h" -#include "pri_q921.h" -#include "pri_q931.h" - -/* - * Define RANDOM_DROPS To randomly drop packets in order to simulate loss for testing - * retransmission functionality - */ - -/* -#define RANDOM_DROPS -*/ - -#define Q921_INIT(pri, hf) do { \ - memset(&(hf),0,sizeof(hf)); \ - (hf).h.sapi = (pri)->sapi; \ - (hf).h.ea1 = 0; \ - (hf).h.ea2 = 1; \ - (hf).h.tei = (pri)->tei; \ -} while(0) - -static void reschedule_t203(struct pri *pri); -static void q921_restart(struct pri *pri, int now); -static void q921_tei_release_and_reacquire(struct pri *master); - -static void q921_discard_retransmissions(struct pri *pri) -{ - struct q921_frame *f, *p; - f = pri->txqueue; - while(f) { - p = f; - f = f->next; - /* Free frame */ - free(p); - } - pri->txqueue = NULL; -} - -static int q921_transmit(struct pri *pri, q921_h *h, int len) -{ - int res; - - if (pri->master) - pri = pri->master; - -#ifdef RANDOM_DROPS - if (!(random() % 3)) { - pri_message(pri, " === Dropping Packet ===\n"); - return 0; - } -#endif -#ifdef LIBPRI_COUNTERS - pri->q921_txcount++; -#endif - /* Just send it raw */ - if (pri->debug & (PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW)) - q921_dump(pri, h, len, pri->debug & PRI_DEBUG_Q921_RAW, 1); - /* Write an extra two bytes for the FCS */ - res = pri->write_func ? pri->write_func(pri, h, len + 2) : 0; - if (res != (len + 2)) { - pri_error(pri, "Short write: %d/%d (%s)\n", res, len + 2, strerror(errno)); - return -1; - } - reschedule_t203(pri); - return 0; -} - -static void q921_send_tei(struct pri *pri, int message, int ri, int ai, int iscommand) -{ - q921_u *f; - - if (!(f = calloc(1, sizeof(*f) + 5))) - return; - - Q921_INIT(pri, *f); - f->h.c_r = (pri->localtype == PRI_NETWORK) ? iscommand : !iscommand; - f->ft = Q921_FRAMETYPE_U; - f->data[0] = 0x0f; /* Management entity */ - f->data[1] = (ri >> 8) & 0xff; - f->data[2] = ri & 0xff; - f->data[3] = message; - f->data[4] = (ai << 1) | 1; - if (pri->debug & PRI_DEBUG_Q921_STATE) - pri_message(pri, "Sending TEI management message %d, TEI=%d\n", message, ai); - q921_transmit(pri, (q921_h *)f, 8); - free(f); -} - -static void q921_tei_request(void *vpri) -{ - struct pri *pri = (struct pri *)vpri; - - if (pri->subchannel) { - pri_error(pri, "Cannot request TEI while its already assigned\n"); - return; - } - pri->n202_counter++; -#if 0 - if (pri->n202_counter > pri->timers[PRI_TIMER_N202]) { - pri_error(pri, "Unable to assign TEI from network\n"); - return; - } -#endif - pri->ri = random() % 65535; - q921_send_tei(pri, Q921_TEI_IDENTITY_REQUEST, pri->ri, Q921_TEI_GROUP, 1); - if (pri->t202_timer) - pri_schedule_del(pri, pri->t202_timer); - pri->t202_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T202], q921_tei_request, pri); -} - -static void q921_send_ua(struct pri *pri, int pfbit) -{ - q921_h h; - Q921_INIT(pri, h); - h.u.m3 = 3; /* M3 = 3 */ - h.u.m2 = 0; /* M2 = 0 */ - h.u.p_f = pfbit; /* Final bit on */ - h.u.ft = Q921_FRAMETYPE_U; - switch(pri->localtype) { - case PRI_NETWORK: - h.h.c_r = 0; - break; - case PRI_CPE: - h.h.c_r = 1; - break; - default: - pri_error(pri, "Don't know how to U/A on a type %d node\n", pri->localtype); - return; - } - if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP)) - pri_message(pri, "Sending Unnumbered Acknowledgement\n"); - q921_transmit(pri, &h, 3); -} - -static void q921_send_sabme_now(void *vpri); - -static void q921_send_sabme(void *vpri, int now) -{ - struct pri *pri = vpri; - q921_h h; - pri_schedule_del(pri, pri->sabme_timer); - pri->sabme_timer = 0; - pri->sabme_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], q921_send_sabme_now, pri); - if (!now) - return; - Q921_INIT(pri, h); - h.u.m3 = 3; /* M3 = 3 */ - h.u.m2 = 3; /* M2 = 3 */ - h.u.p_f = 1; /* Poll bit set */ - h.u.ft = Q921_FRAMETYPE_U; - switch(pri->localtype) { - case PRI_NETWORK: - h.h.c_r = 1; - break; - case PRI_CPE: - h.h.c_r = 0; - break; - default: - pri_error(pri, "Don't know how to U/A on a type %d node\n", pri->localtype); - return; - } - if (pri->bri && (pri->state == Q921_AWAITING_ESTABLISH)) { - if (pri->sabme_count >= pri->timers[PRI_TIMER_N200]) { - pri_schedule_del(pri, pri->sabme_timer); - pri->sabme_timer = 0; - q921_tei_release_and_reacquire(pri->master); - } else { - pri->sabme_count++; - } - } - if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP)) - pri_message(pri, "Sending Set Asynchronous Balanced Mode Extended\n"); - q921_transmit(pri, &h, 3); - if (pri->debug & PRI_DEBUG_Q921_STATE && pri->q921_state != Q921_AWAITING_ESTABLISH) - pri_message(pri, DBGHEAD "q921_state now is Q921_AWAITING_ESTABLISH\n", DBGINFO); - pri->q921_state = Q921_AWAITING_ESTABLISH; -} - -static void q921_send_sabme_now(void *vpri) -{ - q921_send_sabme(vpri, 1); -} - -static int q921_ack_packet(struct pri *pri, int num) -{ - struct q921_frame *f, *prev = NULL; - f = pri->txqueue; - while(f) { - if (f->h.n_s == num) { - /* Cancel each packet as necessary */ - /* That's our packet */ - if (prev) - prev->next = f->next; - else - pri->txqueue = f->next; - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- ACKing packet %d, new txqueue is %d (-1 means empty)\n", f->h.n_s, pri->txqueue ? pri->txqueue->h.n_s : -1); - /* Update v_a */ - pri->v_a = num; - free(f); - /* Reset retransmission counter if we actually acked something */ - pri->retrans = 0; - /* Decrement window size */ - pri->windowlen--; - /* Search for something to send */ - f = pri->txqueue; - while(f) { - if (!f->transmitted) { - /* Send it now... */ - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Finally transmitting %d, since window opened up\n", f->h.n_s); - f->transmitted++; - pri->windowlen++; - f->h.n_r = pri->v_r; - q921_transmit(pri, (q921_h *)(&f->h), f->len); - break; - } - f = f->next; - } - return 1; - } - prev = f; - f = f->next; - } - return 0; -} - -static void t203_expire(void *); -static void t200_expire(void *); -static pri_event *q921_dchannel_down(struct pri *pri); - -static void reschedule_t203(struct pri *pri) -{ - if (pri->t203_timer) { - pri_schedule_del(pri, pri->t203_timer); - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Restarting T203 counter\n"); - /* Nothing to transmit, start the T203 counter instead */ - pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri); - } -} - -static pri_event *q921_ack_rx(struct pri *pri, int ack) -{ - int x; - int cnt=0; - pri_event *ev; - /* Make sure the ACK was within our window */ - for (x=pri->v_a; (x != pri->v_s) && (x != ack); Q921_INC(x)); - if (x != ack) { - /* ACK was outside of our window --- ignore */ - pri_error(pri, "ACK received for '%d' outside of window of '%d' to '%d', restarting\n", ack, pri->v_a, pri->v_s); - ev = q921_dchannel_down(pri); - q921_start(pri, 1); - pri->schedev = 1; - return ev; - } - /* Cancel each packet as necessary */ - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- ACKing all packets from %d to (but not including) %d\n", pri->v_a, ack); - for (x=pri->v_a; x != ack; Q921_INC(x)) - cnt += q921_ack_packet(pri, x); - if (!pri->txqueue) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Since there was nothing left, stopping T200 counter\n"); - /* Something was ACK'd. Stop T200 counter */ - pri_schedule_del(pri, pri->t200_timer); - pri->t200_timer = 0; - } - if (pri->t203_timer) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Stopping T203 counter since we got an ACK\n"); - pri_schedule_del(pri, pri->t203_timer); - pri->t203_timer = 0; - } - if (pri->txqueue) { - /* Something left to transmit, Start the T200 counter again if we stopped it */ - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Something left to transmit (%d), restarting T200 counter\n", pri->txqueue->h.n_s); - if (!pri->t200_timer) - pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri); - } else { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Nothing left, starting T203 counter\n"); - /* Nothing to transmit, start the T203 counter instead */ - pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri); - } - return NULL; -} - -static void q921_reject(struct pri *pri, int pf) -{ - q921_h h; - Q921_INIT(pri, h); - h.s.x0 = 0; /* Always 0 */ - h.s.ss = 2; /* Reject */ - h.s.ft = 1; /* Frametype (01) */ - h.s.n_r = pri->v_r; /* Where to start retransmission */ - h.s.p_f = pf; - switch(pri->localtype) { - case PRI_NETWORK: - h.h.c_r = 0; - break; - case PRI_CPE: - h.h.c_r = 1; - break; - default: - pri_error(pri, "Don't know how to U/A on a type %d node\n", pri->localtype); - return; - } - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "Sending Reject (%d)\n", pri->v_r); - pri->sentrej = 1; - q921_transmit(pri, &h, 4); -} - -static void q921_rr(struct pri *pri, int pbit, int cmd) { - q921_h h; - Q921_INIT(pri, h); - h.s.x0 = 0; /* Always 0 */ - h.s.ss = 0; /* Receive Ready */ - h.s.ft = 1; /* Frametype (01) */ - h.s.n_r = pri->v_r; /* N/R */ - h.s.p_f = pbit; /* Poll/Final set appropriately */ - switch(pri->localtype) { - case PRI_NETWORK: - if (cmd) - h.h.c_r = 1; - else - h.h.c_r = 0; - break; - case PRI_CPE: - if (cmd) - h.h.c_r = 0; - else - h.h.c_r = 1; - break; - default: - pri_error(pri, "Don't know how to U/A on a type %d node\n", pri->localtype); - return; - } - pri->v_na = pri->v_r; /* Make a note that we've already acked this */ - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "Sending Receiver Ready (%d)\n", pri->v_r); - q921_transmit(pri, &h, 4); -} - -static void t200_expire(void *vpri) -{ - struct pri *pri = vpri; - - if (pri->txqueue) { - /* Retransmit first packet in the queue, setting the poll bit */ - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- T200 counter expired, What to do...\n"); - /* Force Poll bit */ - pri->txqueue->h.p_f = 1; - /* Update nr */ - pri->txqueue->h.n_r = pri->v_r; - pri->v_na = pri->v_r; - pri->solicitfbit = 1; - pri->retrans++; - /* Up to three retransmissions */ - if (pri->retrans < pri->timers[PRI_TIMER_N200]) { - /* Reschedule t200_timer */ - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Retransmitting %d bytes\n", pri->txqueue->len); - if (pri->busy) - q921_rr(pri, 1, 1); - else { - if (!pri->txqueue->transmitted) - pri_error(pri, "!! Not good - head of queue has not been transmitted yet\n"); - q921_transmit(pri, (q921_h *)&pri->txqueue->h, pri->txqueue->len); - } - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Rescheduling retransmission (%d)\n", pri->retrans); - pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri); - } else { - if (pri->debug & PRI_DEBUG_Q921_STATE) - pri_message(pri, "-- Timeout occured, restarting PRI\n"); - if (pri->debug & PRI_DEBUG_Q921_STATE && pri->q921_state != Q921_LINK_CONNECTION_RELEASED) - pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_RELEASED\n",DBGINFO); - pri->q921_state = Q921_LINK_CONNECTION_RELEASED; - pri->t200_timer = 0; - q921_dchannel_down(pri); - q921_start(pri, 1); - pri->schedev = 1; - } - } else if (pri->solicitfbit) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Retrying poll with f-bit\n"); - pri->retrans++; - if (pri->retrans < pri->timers[PRI_TIMER_N200]) { - pri->solicitfbit = 1; - q921_rr(pri, 1, 1); - pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri); - } else { - if (pri->debug & PRI_DEBUG_Q921_STATE) - pri_message(pri, "-- Timeout occured, restarting PRI\n"); - if (pri->debug & PRI_DEBUG_Q921_STATE && pri->q921_state != Q921_LINK_CONNECTION_RELEASED) - pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_RELEASED\n", DBGINFO); - pri->q921_state = Q921_LINK_CONNECTION_RELEASED; - pri->t200_timer = 0; - if (pri->bri && pri->master) { - q921_tei_release_and_reacquire(pri->master); - return; - } else { - q921_dchannel_down(pri); - q921_start(pri, 1); - pri->schedev = 1; - } - } - } else { - pri_error(pri, "T200 counter expired, nothing to send...\n"); - pri->t200_timer = 0; - } -} - -int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr) -{ - q921_frame *f, *prev=NULL; - - for (f=pri->txqueue; f; f = f->next) prev = f; - f = calloc(1, sizeof(q921_frame) + len + 2); - if (f) { - Q921_INIT(pri, f->h); - switch(pri->localtype) { - case PRI_NETWORK: - if (cr) - f->h.h.c_r = 1; - else - f->h.h.c_r = 0; - break; - case PRI_CPE: - if (cr) - f->h.h.c_r = 0; - else - f->h.h.c_r = 1; - break; - } - f->next = NULL; - f->transmitted = 0; - f->len = len + 4; - memcpy(f->h.data, buf, len); - f->h.n_s = pri->v_s; - f->h.n_r = pri->v_r; - pri->v_s++; - pri->v_na = pri->v_r; - f->h.p_f = 0; - f->h.ft = 0; - if (prev) - prev->next = f; - else - pri->txqueue = f; - /* Immediately transmit unless we're in a recovery state, or the window - size is too big */ - if (!pri->retrans && !pri->busy) { - if (pri->windowlen < pri->window) { - pri->windowlen++; - q921_transmit(pri, (q921_h *)(&f->h), f->len); - f->transmitted++; - } else { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "Delaying transmission of %d, window is %d/%d long\n", - f->h.n_s, pri->windowlen, pri->window); - } - } - if (pri->t203_timer) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "Stopping T_203 timer\n"); - pri_schedule_del(pri, pri->t203_timer); - pri->t203_timer = 0; - } - if (!pri->t200_timer) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "Starting T_200 timer\n"); - pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri); - } else - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "T_200 timer already going (%d)\n", pri->t200_timer); - - } else { - pri_error(pri, "!! Out of memory for Q.921 transmit\n"); - return -1; - } - return 0; -} - -static void t203_expire(void *vpri) -{ - struct pri *pri = vpri; - if (pri->q921_state == Q921_LINK_CONNECTION_ESTABLISHED) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "T203 counter expired, sending RR and scheduling T203 again\n"); - /* Solicit an F-bit in the other's RR */ - pri->solicitfbit = 1; - pri->retrans = 0; - q921_rr(pri, 1, 1); - /* Start timer T200 to resend our RR if we don't get it */ - pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri); - } else { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "T203 counter expired in weird state %d\n", pri->q921_state); - pri->t203_timer = 0; - } -} - -static pri_event *q921_handle_iframe(struct pri *pri, q921_i *i, int len) -{ - int res; - pri_event *ev; - /* Make sure this is a valid packet */ - if (i->n_s == pri->v_r) { - /* Increment next expected I-frame */ - Q921_INC(pri->v_r); - /* Handle their ACK */ - pri->sentrej = 0; - ev = q921_ack_rx(pri, i->n_r); - if (ev) - return ev; - if (i->p_f) { - /* If the Poll/Final bit is set, immediate send the RR */ - q921_rr(pri, 1, 0); - } else if (pri->busy) { - q921_rr(pri, 0, 0); - } - /* Receive Q.931 data */ - res = q931_receive(pri, (q931_h *)i->data, len - 4); - /* Send an RR if one wasn't sent already */ - if (pri->v_na != pri->v_r) - q921_rr(pri, 0, 0); - if (res == -1) { - return NULL; - } - if (res & Q931_RES_HAVEEVENT) - return &pri->ev; - } else { - /* If we haven't already sent a reject, send it now, otherwise - we are obliged to RR */ - if (!pri->sentrej) - q921_reject(pri, i->p_f); - else if (i->p_f) - q921_rr(pri, 1, 0); - } - return NULL; -} - -void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx) -{ - int x; - char *type; - char direction_tag; - - direction_tag = txrx ? '>' : '<'; - if (showraw) { - char *buf = malloc(len * 3 + 1); - int buflen = 0; - if (buf) { - for (x=0;xraw[x]); - pri_message(pri, "\n%c [ %s]\n", direction_tag, buf); - free(buf); - } - } - - switch (h->h.data[0] & Q921_FRAMETYPE_MASK) { - case 0: - case 2: - pri_message(pri, "\n%c Informational frame:\n", direction_tag); - break; - case 1: - pri_message(pri, "\n%c Supervisory frame:\n", direction_tag); - break; - case 3: - pri_message(pri, "\n%c Unnumbered frame:\n", direction_tag); - break; - } - - pri_message(pri, -"%c SAPI: %02d C/R: %d EA: %d\n" -"%c TEI: %03d EA: %d\n", - direction_tag, - h->h.sapi, - h->h.c_r, - h->h.ea1, - direction_tag, - h->h.tei, - h->h.ea2); - switch (h->h.data[0] & Q921_FRAMETYPE_MASK) { - case 0: - case 2: - /* Informational frame */ - pri_message(pri, -"%c N(S): %03d 0: %d\n" -"%c N(R): %03d P: %d\n" -"%c %d bytes of data\n", - direction_tag, - h->i.n_s, - h->i.ft, - direction_tag, - h->i.n_r, - h->i.p_f, - direction_tag, - len - 4); - break; - case 1: - /* Supervisory frame */ - type = "???"; - switch (h->s.ss) { - case 0: - type = "RR (receive ready)"; - break; - case 1: - type = "RNR (receive not ready)"; - break; - case 2: - type = "REJ (reject)"; - break; - } - pri_message(pri, -"%c Zero: %d S: %d 01: %d [ %s ]\n" -"%c N(R): %03d P/F: %d\n" -"%c %d bytes of data\n", - direction_tag, - h->s.x0, - h->s.ss, - h->s.ft, - type, - direction_tag, - h->s.n_r, - h->s.p_f, - direction_tag, - len - 4); - break; - case 3: - /* Unnumbered frame */ - type = "???"; - if (h->u.ft == 3) { - switch (h->u.m3) { - case 0: - if (h->u.m2 == 3) - type = "DM (disconnect mode)"; - else if (h->u.m2 == 0) - type = "UI (unnumbered information)"; - break; - case 2: - if (h->u.m2 == 0) - type = "DISC (disconnect)"; - break; - case 3: - if (h->u.m2 == 3) - type = "SABME (set asynchronous balanced mode extended)"; - else if (h->u.m2 == 0) - type = "UA (unnumbered acknowledgement)"; - break; - case 4: - if (h->u.m2 == 1) - type = "FRMR (frame reject)"; - break; - case 5: - if (h->u.m2 == 3) - type = "XID (exchange identification note)"; - break; - } - } - pri_message(pri, -"%c M3: %d P/F: %d M2: %d 11: %d [ %s ]\n" -"%c %d bytes of data\n", - direction_tag, - h->u.m3, - h->u.p_f, - h->u.m2, - h->u.ft, - type, - direction_tag, - len - 3); - break; - }; -} - -static pri_event *q921_dchannel_up(struct pri *pri) -{ - /* Reset counters, etc */ - q921_reset(pri); - - /* Stop any SABME retransmissions */ - if (pri->sabme_timer) { - pri_schedule_del(pri, pri->sabme_timer); - pri->sabme_timer = 0; - } - - /* Reset any rejects */ - pri->sentrej = 0; - - /* Go into connection established state */ - if (pri->debug & PRI_DEBUG_Q921_STATE && pri->q921_state != Q921_LINK_CONNECTION_ESTABLISHED) - pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_ESTABLISHED\n", DBGINFO); - pri->q921_state = Q921_LINK_CONNECTION_ESTABLISHED; - - /* Start the T203 timer */ - pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri); - - /* Notify Layer 3 */ - q931_dl_indication(pri, PRI_EVENT_DCHAN_UP); - - /* Report event that D-Channel is now up */ - pri->ev.gen.e = PRI_EVENT_DCHAN_UP; - return &pri->ev; -} - -static pri_event *q921_dchannel_down(struct pri *pri) -{ - /* Reset counters, reset sabme timer etc */ - q921_reset(pri); - - /* Notify Layer 3 */ - q931_dl_indication(pri, PRI_EVENT_DCHAN_DOWN); - - /* Report event that D-Channel is now up */ - pri->ev.gen.e = PRI_EVENT_DCHAN_DOWN; - return &pri->ev; -} - -void q921_reset(struct pri *pri) -{ - /* Having gotten a SABME we MUST reset our entire state */ - pri->v_s = 0; - pri->v_a = 0; - pri->v_r = 0; - pri->v_na = 0; - pri->window = pri->timers[PRI_TIMER_K]; - pri->windowlen = 0; - if (pri->sabme_timer) - pri_schedule_del(pri, pri->sabme_timer); - if (pri->t203_timer) - pri_schedule_del(pri, pri->t203_timer); - if (pri->t200_timer) - pri_schedule_del(pri, pri->t200_timer); - pri->sabme_timer = 0; - pri->sabme_count = 0; - pri->t203_timer = 0; - pri->t200_timer = 0; - pri->busy = 0; - pri->solicitfbit = 0; - if (pri->debug & PRI_DEBUG_Q921_STATE && pri->q921_state != Q921_LINK_CONNECTION_RELEASED) - pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_RELEASED\n", DBGINFO); - pri->q921_state = Q921_LINK_CONNECTION_RELEASED; - pri->retrans = 0; - pri->sentrej = 0; - - /* Discard anything waiting to go out */ - q921_discard_retransmissions(pri); -} - -static void q921_tei_release_and_reacquire(struct pri *master) -{ - /* Make sure the master is passed into this function */ - q921_dchannel_down(master->subchannel); - __pri_free_tei(master->subchannel); - master->subchannel = NULL; - master->ev.gen.e = PRI_EVENT_DCHAN_DOWN; - master->schedev = 1; - q921_start(master, master->localtype == PRI_CPE); -} - -static pri_event *q921_receive_MDL(struct pri *pri, q921_u *h, int len) -{ - int ri; - struct pri *sub; - int tei; - if (pri->debug & PRI_DEBUG_Q921_STATE) - pri_message(pri, "Received MDL message\n"); - if (h->data[0] != 0x0f) { - pri_error(pri, "Received MDL with unsupported management entity %02x\n", h->data[0]); - return NULL; - } - if (!(h->data[4] & 0x01)) { - pri_error(pri, "Received MDL with multibyte TEI identifier\n"); - return NULL; - } - ri = (h->data[1] << 8) | h->data[2]; - tei = (h->data[4] >> 1); - switch(h->data[3]) { - case Q921_TEI_IDENTITY_REQUEST: - if (tei != 127) { - pri_error(pri, "Received TEI identity request with invalid TEI %d\n", tei); - q921_send_tei(pri, Q921_TEI_IDENTITY_DENIED, ri, tei, 1); - } - /* Go to master */ - for (sub = pri; sub->master; sub = sub->master); - tei = 64; - while(sub->subchannel) { - if(sub->subchannel->tei == tei) - ++tei; - } - sub->subchannel = __pri_new_tei(-1, pri->localtype, pri->switchtype, pri, NULL, NULL, NULL, tei, 1); - if (!sub->subchannel) { - pri_error(pri, "Unable to allocate D-channel for new TEI %d\n", tei); - return NULL; - } - q921_send_tei(pri, Q921_TEI_IDENTITY_ASSIGNED, ri, tei, 1); - break; - case Q921_TEI_IDENTITY_ASSIGNED: - if (ri != pri->ri) { - pri_message(pri, "TEI assignment received for invalid Ri %02x (our is %02x)\n", ri, pri->ri); - return NULL; - } - if (pri->t202_timer) { - pri_schedule_del(pri, pri->t202_timer); - pri->t202_timer = 0; - } - if (pri->subchannel && (pri->subchannel->tei == tei)) { - pri_error(pri, "TEI already assigned (new is %d, current is %d)\n", tei, pri->subchannel->tei); - q921_tei_release_and_reacquire(pri); - return NULL; - } - - pri_message(pri, "TEI assiged to %d\n", tei); - pri->subchannel = __pri_new_tei(-1, pri->localtype, pri->switchtype, pri, NULL, NULL, NULL, tei, 1); - if (!pri->subchannel) { - pri_error(pri, "Unable to allocate D-channel for new TEI %d\n", tei); - return NULL; - } - pri->q921_state = Q921_TEI_ASSIGNED; - break; - case Q921_TEI_IDENTITY_CHECK_REQUEST: - /* We're assuming one TEI per PRI in TE PTMP mode */ - - /* If no subchannel (TEI) ignore */ - if (!pri->subchannel) - return NULL; - - /* If it's addressed to the group TEI or to our TEI specifically, we respond */ - if ((tei == Q921_TEI_GROUP) || (tei == pri->subchannel->tei)) - q921_send_tei(pri, Q921_TEI_IDENTITY_CHECK_RESPONSE, random() % 65535, pri->subchannel->tei, 1); - - break; - case Q921_TEI_IDENTITY_REMOVE: - /* XXX: Assuming multiframe mode has been disconnected already */ - if (!pri->subchannel) - return NULL; - - if ((tei == Q921_TEI_GROUP) || (tei == pri->subchannel->tei)) { - q921_tei_release_and_reacquire(pri); - } - } - return NULL; /* Do we need to return something??? */ -} - -static pri_event *__q921_receive_qualified(struct pri *pri, q921_h *h, int len) -{ - q921_frame *f; - pri_event *ev; - int sendnow; - - switch(h->h.data[0] & Q921_FRAMETYPE_MASK) { - case 0: - case 2: - if (pri->q921_state != Q921_LINK_CONNECTION_ESTABLISHED) { - pri_error(pri, "!! Got I-frame while link state %d\n", pri->q921_state); - return NULL; - } - /* Informational frame */ - if (len < 4) { - pri_error(pri, "!! Received short I-frame (expected 4, got %d)\n", len); - break; - } - return q921_handle_iframe(pri, &h->i, len); - break; - case 1: - if (pri->q921_state != Q921_LINK_CONNECTION_ESTABLISHED) { - pri_error(pri, "!! Got S-frame while link down\n"); - return NULL; - } - if (len < 4) { - pri_error(pri, "!! Received short S-frame (expected 4, got %d)\n", len); - break; - } - switch(h->s.ss) { - case 0: - /* Receiver Ready */ - pri->busy = 0; - /* Acknowledge frames as necessary */ - ev = q921_ack_rx(pri, h->s.n_r); - if (ev) - return ev; - if (h->s.p_f) { - /* If it's a p/f one then send back a RR in return with the p/f bit set */ - if (pri->solicitfbit) { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Got RR response to our frame\n"); - } else { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Unsolicited RR with P/F bit, responding\n"); - q921_rr(pri, 1, 0); - } - pri->solicitfbit = 0; - } - break; - case 1: - /* Receiver not ready */ - if (pri->debug & PRI_DEBUG_Q921_STATE) - pri_message(pri, "-- Got receiver not ready\n"); - if(h->s.p_f) { - /* Send RR if poll bit set */ - q921_rr(pri, h->s.p_f, 0); - } - pri->busy = 1; - break; - case 2: - /* Just retransmit */ - if (pri->debug & PRI_DEBUG_Q921_STATE) - pri_message(pri, "-- Got reject requesting packet %d... Retransmitting.\n", h->s.n_r); - if (h->s.p_f) { - /* If it has the poll bit set, send an appropriate supervisory response */ - q921_rr(pri, 1, 0); - } - sendnow = 0; - /* Resend the proper I-frame */ - for(f=pri->txqueue;f;f=f->next) { - if ((sendnow || (f->h.n_s == h->s.n_r)) && f->transmitted) { - /* Matches the request, or follows in our window, and has - already been transmitted. */ - sendnow = 1; - pri_error(pri, "!! Got reject for frame %d, retransmitting frame %d now, updating n_r!\n", h->s.n_r, f->h.n_s); - f->h.n_r = pri->v_r; - q921_transmit(pri, (q921_h *)(&f->h), f->len); - } - } - if (!sendnow) { - if (pri->txqueue) { - /* This should never happen */ - if (!h->s.p_f || h->s.n_r) { - pri_error(pri, "!! Got reject for frame %d, but we only have others!\n", h->s.n_r); - } - } else { - /* Hrm, we have nothing to send, but have been REJ'd. Reset v_a, v_s, etc */ - pri_error(pri, "!! Got reject for frame %d, but we have nothing -- resetting!\n", h->s.n_r); - pri->v_a = h->s.n_r; - pri->v_s = h->s.n_r; - /* Reset t200 timer if it was somehow going */ - if (pri->t200_timer) { - pri_schedule_del(pri, pri->t200_timer); - pri->t200_timer = 0; - } - /* Reset and restart t203 timer */ - if (pri->t203_timer) - pri_schedule_del(pri, pri->t203_timer); - pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri); - } - } - break; - default: - pri_error(pri, "!! XXX Unknown Supervisory frame ss=0x%02x,pf=%02xnr=%02x vs=%02x, va=%02x XXX\n", h->s.ss, h->s.p_f, h->s.n_r, - pri->v_s, pri->v_a); - } - break; - case 3: - if (len < 3) { - pri_error(pri, "!! Received short unnumbered frame\n"); - break; - } - switch(h->u.m3) { - case 0: - if (h->u.m2 == 3) { - if (h->u.p_f) { - /* Section 5.7.1 says we should restart on receiving a DM response with the f-bit set to - one, but we wait T200 first */ - if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP)) - pri_message(pri, "-- Got DM Mode from peer.\n"); - /* Disconnected mode, try again after T200 */ - ev = q921_dchannel_down(pri); - q921_restart(pri, 0); - return ev; - - } else { - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "-- Ignoring unsolicited DM with p/f set to 0\n"); -#if 0 - /* Requesting that we start */ - q921_restart(pri, 0); -#endif - } - break; - } else if (!h->u.m2) { - if ((pri->sapi == Q921_SAPI_LAYER2_MANAGEMENT) && (pri->tei == Q921_TEI_GROUP)) - q921_receive_MDL(pri, (q921_u *)h, len); - else { - int res; - - res = q931_receive(pri, (q931_h *) h->u.data, len - 3); - if (res == -1) { - return NULL; - } - if (res & Q931_RES_HAVEEVENT) - return &pri->ev; - } - } - break; - case 2: - if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP)) - pri_message(pri, "-- Got Disconnect from peer.\n"); - /* Acknowledge */ - q921_send_ua(pri, h->u.p_f); - ev = q921_dchannel_down(pri); - q921_restart(pri, 0); - return ev; - case 3: - if (h->u.m2 == 3) { - /* SABME */ - if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP)) { - pri_message(pri, "-- Got SABME from %s peer.\n", h->h.c_r ? "network" : "cpe"); - } - if (h->h.c_r) { - pri->remotetype = PRI_NETWORK; - if (pri->localtype == PRI_NETWORK) { - /* We can't both be networks */ - return pri_mkerror(pri, "We think we're the network, but they think they're the network, too."); - } - } else { - pri->remotetype = PRI_CPE; - if (pri->localtype == PRI_CPE) { - /* We can't both be CPE */ - return pri_mkerror(pri, "We think we're the CPE, but they think they're the CPE too.\n"); - } - } - /* Send Unnumbered Acknowledgement */ - q921_send_ua(pri, h->u.p_f); - return q921_dchannel_up(pri); - } else if (h->u.m2 == 0) { - /* It's a UA */ - if (pri->q921_state == Q921_AWAITING_ESTABLISH) { - if (pri->debug & (PRI_DEBUG_Q921_STATE | PRI_DEBUG_Q921_DUMP)) { - pri_message(pri, "-- Got UA from %s peer Link up.\n", h->h.c_r ? "cpe" : "network"); - } - return q921_dchannel_up(pri); - } else if ((pri->q921_state >= Q921_TEI_ASSIGNED) && pri->bri) { - /* Possible duplicate TEI assignment */ - if (pri->master) - q921_tei_release_and_reacquire(pri->master); - else - pri_error(pri, "Huh!? no master found\n"); - } else { - /* Since we're not in the AWAITING_ESTABLISH STATE, it's unsolicited */ - pri_error(pri, "!! Got a UA, but i'm in state %d\n", pri->q921_state); - - } - } else - pri_error(pri, "!! Weird frame received (m3=3, m2 = %d)\n", h->u.m2); - break; - case 4: - pri_error(pri, "!! Frame got rejected!\n"); - break; - case 5: - pri_error(pri, "!! XID frames not supported\n"); - break; - default: - pri_error(pri, "!! Don't know what to do with M3=%d u-frames\n", h->u.m3); - } - break; - - } - return NULL; -} - -static pri_event *__q921_receive(struct pri *pri, q921_h *h, int len) -{ - pri_event *ev; - /* Discard FCS */ - len -= 2; - - if (!pri->master && pri->debug & (PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_RAW)) - q921_dump(pri, h, len, pri->debug & PRI_DEBUG_Q921_RAW, 0); - - /* Check some reject conditions -- Start by rejecting improper ea's */ - if (h->h.ea1 || !(h->h.ea2)) - return NULL; - -#if 0 /* Will be rejected by subchannel analyzis */ - /* Check for broadcasts - not yet handled */ - if (h->h.tei == Q921_TEI_GROUP) - return NULL; -#endif - - if (!((h->h.sapi == pri->sapi) && ((h->h.tei == pri->tei) || (h->h.tei == Q921_TEI_GROUP)))) { - /* Check for SAPIs we don't yet handle */ - /* If it's not us, try any subchannels we have */ - if (pri->subchannel) - return q921_receive(pri->subchannel, h, len + 2); - else { - return NULL; - } - - } - if (pri->debug & PRI_DEBUG_Q921_DUMP) - pri_message(pri, "Handling message for SAPI/TEI=%d/%d\n", h->h.sapi, h->h.tei); - ev = __q921_receive_qualified(pri, h, len); - reschedule_t203(pri); - return ev; -} - -pri_event *q921_receive(struct pri *pri, q921_h *h, int len) -{ - pri_event *e; - e = __q921_receive(pri, h, len); -#ifdef LIBPRI_COUNTERS - pri->q921_rxcount++; -#endif - return e; -} - -static void q921_restart(struct pri *pri, int now) -{ - if (pri->q921_state != Q921_LINK_CONNECTION_RELEASED) { - pri_error(pri, "!! q921_start: Not in 'Link Connection Released' state\n"); - return; - } - /* Reset our interface */ - q921_reset(pri); - /* Do the SABME XXX Maybe we should implement T_WAIT? XXX */ - q921_send_sabme(pri, now); -} - -void q921_start(struct pri *pri, int isCPE) -{ - q921_reset(pri); - if ((pri->sapi == Q921_SAPI_LAYER2_MANAGEMENT) && (pri->tei == Q921_TEI_GROUP)) { - pri->q921_state = Q921_DOWN; - if (isCPE) - q921_tei_request(pri); - } else { - q921_send_sabme(pri, isCPE); - } -} diff --git a/libpri/q931.c b/libpri/q931.c deleted file mode 100644 index 03762738..00000000 --- a/libpri/q931.c +++ /dev/null @@ -1,4035 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - -#include "compat.h" -#include "libpri.h" -#include "pri_internal.h" -#include "pri_q921.h" -#include "pri_q931.h" -#include "pri_facility.h" - -#include -#include -#include -#include -#include -#include - -#define MAX_MAND_IES 10 - -struct msgtype { - int msgnum; - char *name; - int mandies[MAX_MAND_IES]; -}; - -static struct msgtype msgs[] = { - /* Call establishment messages */ - { Q931_ALERTING, "ALERTING" }, - { Q931_CALL_PROCEEDING, "CALL PROCEEDING" }, - { Q931_CONNECT, "CONNECT" }, - { Q931_CONNECT_ACKNOWLEDGE, "CONNECT ACKNOWLEDGE" }, - { Q931_PROGRESS, "PROGRESS", { Q931_PROGRESS_INDICATOR } }, - { Q931_SETUP, "SETUP", { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT } }, - { Q931_SETUP_ACKNOWLEDGE, "SETUP ACKNOWLEDGE" }, - - /* Call disestablishment messages */ - { Q931_DISCONNECT, "DISCONNECT", { Q931_CAUSE } }, - { Q931_RELEASE, "RELEASE" }, - { Q931_RELEASE_COMPLETE, "RELEASE COMPLETE" }, - { Q931_RESTART, "RESTART", { Q931_RESTART_INDICATOR } }, - { Q931_RESTART_ACKNOWLEDGE, "RESTART ACKNOWLEDGE", { Q931_RESTART_INDICATOR } }, - - /* Miscellaneous */ - { Q931_STATUS, "STATUS", { Q931_CAUSE, Q931_CALL_STATE } }, - { Q931_STATUS_ENQUIRY, "STATUS ENQUIRY" }, - { Q931_USER_INFORMATION, "USER_INFORMATION" }, - { Q931_SEGMENT, "SEGMENT" }, - { Q931_CONGESTION_CONTROL, "CONGESTION CONTROL" }, - { Q931_INFORMATION, "INFORMATION" }, - { Q931_FACILITY, "FACILITY" }, - { Q931_NOTIFY, "NOTIFY", { Q931_IE_NOTIFY_IND } }, - - /* Call Management */ - { Q931_HOLD, "HOLD" }, - { Q931_HOLD_ACKNOWLEDGE, "HOLD ACKNOWLEDGE" }, - { Q931_HOLD_REJECT, "HOLD REJECT" }, - { Q931_RETRIEVE, "RETRIEVE" }, - { Q931_RETRIEVE_ACKNOWLEDGE, "RETRIEVE ACKNOWLEDGE" }, - { Q931_RETRIEVE_REJECT, "RETRIEVE REJECT" }, - { Q931_RESUME, "RESUME" }, - { Q931_RESUME_ACKNOWLEDGE, "RESUME ACKNOWLEDGE", { Q931_CHANNEL_IDENT } }, - { Q931_RESUME_REJECT, "RESUME REJECT", { Q931_CAUSE } }, - { Q931_SUSPEND, "SUSPEND" }, - { Q931_SUSPEND_ACKNOWLEDGE, "SUSPEND ACKNOWLEDGE" }, - { Q931_SUSPEND_REJECT, "SUSPEND REJECT" }, - - /* Maintenance */ - { NATIONAL_SERVICE, "SERVICE" }, - { NATIONAL_SERVICE_ACKNOWLEDGE, "SERVICE ACKNOWLEDGE" }, -}; - -static struct msgtype causes[] = { - { PRI_CAUSE_UNALLOCATED, "Unallocated (unassigned) number" }, - { PRI_CAUSE_NO_ROUTE_TRANSIT_NET, "No route to specified transmit network" }, - { PRI_CAUSE_NO_ROUTE_DESTINATION, "No route to destination" }, - { PRI_CAUSE_CHANNEL_UNACCEPTABLE, "Channel unacceptable" }, - { PRI_CAUSE_CALL_AWARDED_DELIVERED, "Call awarded and being delivered in an established channel" }, - { PRI_CAUSE_NORMAL_CLEARING, "Normal Clearing" }, - { PRI_CAUSE_USER_BUSY, "User busy" }, - { PRI_CAUSE_NO_USER_RESPONSE, "No user responding" }, - { PRI_CAUSE_NO_ANSWER, "User alerting, no answer" }, - { PRI_CAUSE_CALL_REJECTED, "Call Rejected" }, - { PRI_CAUSE_NUMBER_CHANGED, "Number changed" }, - { PRI_CAUSE_DESTINATION_OUT_OF_ORDER, "Destination out of order" }, - { PRI_CAUSE_INVALID_NUMBER_FORMAT, "Invalid number format" }, - { PRI_CAUSE_FACILITY_REJECTED, "Facility rejected" }, - { PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY, "Response to STATus ENQuiry" }, - { PRI_CAUSE_NORMAL_UNSPECIFIED, "Normal, unspecified" }, - { PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION, "Circuit/channel congestion" }, - { PRI_CAUSE_NETWORK_OUT_OF_ORDER, "Network out of order" }, - { PRI_CAUSE_NORMAL_TEMPORARY_FAILURE, "Temporary failure" }, - { PRI_CAUSE_SWITCH_CONGESTION, "Switching equipment congestion" }, - { PRI_CAUSE_ACCESS_INFO_DISCARDED, "Access information discarded" }, - { PRI_CAUSE_REQUESTED_CHAN_UNAVAIL, "Requested channel not available" }, - { PRI_CAUSE_PRE_EMPTED, "Pre-empted" }, - { PRI_CAUSE_FACILITY_NOT_SUBSCRIBED, "Facility not subscribed" }, - { PRI_CAUSE_OUTGOING_CALL_BARRED, "Outgoing call barred" }, - { PRI_CAUSE_INCOMING_CALL_BARRED, "Incoming call barred" }, - { PRI_CAUSE_BEARERCAPABILITY_NOTAUTH, "Bearer capability not authorized" }, - { PRI_CAUSE_BEARERCAPABILITY_NOTAVAIL, "Bearer capability not available" }, - { PRI_CAUSE_BEARERCAPABILITY_NOTIMPL, "Bearer capability not implemented" }, - { PRI_CAUSE_SERVICEOROPTION_NOTAVAIL, "Service or option not available, unspecified" }, - { PRI_CAUSE_CHAN_NOT_IMPLEMENTED, "Channel not implemented" }, - { PRI_CAUSE_FACILITY_NOT_IMPLEMENTED, "Facility not implemented" }, - { PRI_CAUSE_INVALID_CALL_REFERENCE, "Invalid call reference value" }, - { PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST, "Identified channel does not exist" }, - { PRI_CAUSE_INCOMPATIBLE_DESTINATION, "Incompatible destination" }, - { PRI_CAUSE_INVALID_MSG_UNSPECIFIED, "Invalid message unspecified" }, - { PRI_CAUSE_MANDATORY_IE_MISSING, "Mandatory information element is missing" }, - { PRI_CAUSE_MESSAGE_TYPE_NONEXIST, "Message type nonexist." }, - { PRI_CAUSE_WRONG_MESSAGE, "Wrong message" }, - { PRI_CAUSE_IE_NONEXIST, "Info. element nonexist or not implemented" }, - { PRI_CAUSE_INVALID_IE_CONTENTS, "Invalid information element contents" }, - { PRI_CAUSE_WRONG_CALL_STATE, "Message not compatible with call state" }, - { PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "Recover on timer expiry" }, - { PRI_CAUSE_MANDATORY_IE_LENGTH_ERROR, "Mandatory IE length error" }, - { PRI_CAUSE_PROTOCOL_ERROR, "Protocol error, unspecified" }, - { PRI_CAUSE_INTERWORKING, "Interworking, unspecified" }, -}; - -static struct msgtype facilities[] = { - { PRI_NSF_SID_PREFERRED, "CPN (SID) preferred" }, - { PRI_NSF_ANI_PREFERRED, "BN (ANI) preferred" }, - { PRI_NSF_SID_ONLY, "CPN (SID) only" }, - { PRI_NSF_ANI_ONLY, "BN (ANI) only" }, - { PRI_NSF_CALL_ASSOC_TSC, "Call Associated TSC" }, - { PRI_NSF_NOTIF_CATSC_CLEARING, "Notification of CATSC Clearing or Resource Unavailable" }, - { PRI_NSF_OPERATOR, "Operator" }, - { PRI_NSF_PCCO, "Pre-subscribed Common Carrier Operator (PCCO)" }, - { PRI_NSF_SDN, "SDN (including GSDN)" }, - { PRI_NSF_TOLL_FREE_MEGACOM, "Toll Free MEGACOM" }, - { PRI_NSF_MEGACOM, "MEGACOM" }, - { PRI_NSF_ACCUNET, "ACCUNET Switched Digital Service" }, - { PRI_NSF_LONG_DISTANCE_SERVICE, "Long Distance Service" }, - { PRI_NSF_INTERNATIONAL_TOLL_FREE, "International Toll Free Service" }, - { PRI_NSF_ATT_MULTIQUEST, "AT&T MultiQuest" }, - { PRI_NSF_CALL_REDIRECTION_SERVICE, "Call Redirection Service" } -}; - -#define FLAG_PREFERRED 2 -#define FLAG_EXCLUSIVE 4 - -#define RESET_INDICATOR_CHANNEL 0 -#define RESET_INDICATOR_DS1 6 -#define RESET_INDICATOR_PRI 7 - -#define TRANS_MODE_64_CIRCUIT 0x10 -#define TRANS_MODE_2x64_CIRCUIT 0x11 -#define TRANS_MODE_384_CIRCUIT 0x13 -#define TRANS_MODE_1536_CIRCUIT 0x15 -#define TRANS_MODE_1920_CIRCUIT 0x17 -#define TRANS_MODE_MULTIRATE 0x18 -#define TRANS_MODE_PACKET 0x40 - -#define RATE_ADAPT_56K 0x0f - -#define LAYER_2_LAPB 0x46 - -#define LAYER_3_X25 0x66 - -/* The 4ESS uses a different audio field */ -#define PRI_TRANS_CAP_AUDIO_4ESS 0x08 - -/* Don't forget to update PRI_PROG_xxx at libpri.h */ -#define Q931_PROG_CALL_NOT_E2E_ISDN 0x01 -#define Q931_PROG_CALLED_NOT_ISDN 0x02 -#define Q931_PROG_CALLER_NOT_ISDN 0x03 -#define Q931_PROG_CALLER_RETURNED_TO_ISDN 0x04 -#define Q931_PROG_INBAND_AVAILABLE 0x08 -#define Q931_PROG_DELAY_AT_INTERF 0x0a -#define Q931_PROG_INTERWORKING_WITH_PUBLIC 0x10 -#define Q931_PROG_INTERWORKING_NO_RELEASE 0x11 -#define Q931_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER 0x12 -#define Q931_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER 0x13 - -#define CODE_CCITT 0x0 -#define CODE_INTERNATIONAL 0x1 -#define CODE_NATIONAL 0x2 -#define CODE_NETWORK_SPECIFIC 0x3 - -#define LOC_USER 0x0 -#define LOC_PRIV_NET_LOCAL_USER 0x1 -#define LOC_PUB_NET_LOCAL_USER 0x2 -#define LOC_TRANSIT_NET 0x3 -#define LOC_PUB_NET_REMOTE_USER 0x4 -#define LOC_PRIV_NET_REMOTE_USER 0x5 -#define LOC_INTERNATIONAL_NETWORK 0x7 -#define LOC_NETWORK_BEYOND_INTERWORKING 0xa - -static char *ie2str(int ie); -static char *msg2str(int msg); - - -#define FUNC_DUMP(name) void ((name))(int full_ie, struct pri *pri, q931_ie *ie, int len, char prefix) -#define FUNC_RECV(name) int ((name))(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len) -#define FUNC_SEND(name) int ((name))(int full_ie, struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len, int order) - -#if 1 -/* Update call state with transition trace. */ -#define UPDATE_OURCALLSTATE(pri,c,newstate) do {\ - if (pri->debug & (PRI_DEBUG_Q931_STATE) && c->ourcallstate != newstate) \ - pri_message(pri, DBGHEAD "call %d on channel %d enters state %d (%s)\n", DBGINFO, \ - c->cr, c->channelno, newstate, callstate2str(newstate)); \ - c->ourcallstate = newstate; \ - } while (0) -#else -/* Update call state with no trace. */ -#define UPDATE_OURCALLSTATE(pri,c,newstate) c->ourcallstate = newstate -#endif - -struct ie { - /* Maximal count of same IEs at the message (0 - any, 1..n - limited) */ - int max_count; - /* IE code */ - int ie; - /* IE friendly name */ - char *name; - /* Dump an IE for debugging (preceed all lines by prefix) */ - FUNC_DUMP(*dump); - /* Handle IE returns 0 on success, -1 on failure */ - FUNC_RECV(*receive); - /* Add IE to a message, return the # of bytes added or -1 on failure */ - FUNC_SEND(*transmit); -}; - -static char *code2str(int code, struct msgtype *codes, int max) -{ - int x; - for (x=0;xforceinvert = -1; - c->cr = -1; - c->slotmap = -1; - c->channelno = -1; - c->newcall = 1; - c->ourcallstate = Q931_CALL_STATE_NULL; - c->peercallstate = Q931_CALL_STATE_NULL; -} - -static char *binary(int b, int len) { - static char res[33]; - int x; - memset(res, 0, sizeof(res)); - if (len > 32) - len = 32; - for (x=1;x<=len;x++) - res[x-1] = b & (1 << (len - x)) ? '1' : '0'; - return res; -} - -static FUNC_RECV(receive_channel_id) -{ - int x; - int pos=0; -#ifdef NO_BRI_SUPPORT - if (!ie->data[0] & 0x20) { - pri_error(pri, "!! Not PRI type!?\n"); - return -1; - } -#endif -#ifndef NOAUTO_CHANNEL_SELECTION_SUPPORT - if (pri->bri) { - if (!(ie->data[0] & 3)) - call->justsignalling = 1; - else - call->channelno = ie->data[0] & 3; - } else { - switch (ie->data[0] & 3) { - case 0: - call->justsignalling = 1; - break; - case 1: - break; - default: - pri_error(pri, "!! Unexpected Channel selection %d\n", ie->data[0] & 3); - return -1; - } - } -#endif - if (ie->data[0] & 0x08) - call->chanflags = FLAG_EXCLUSIVE; - else - call->chanflags = FLAG_PREFERRED; - pos++; - if (ie->data[0] & 0x40) { - /* DS1 specified -- stop here */ - call->ds1no = ie->data[1] & 0x7f; - call->ds1explicit = 1; - pos++; - } else - call->ds1explicit = 0; - - if (pos+2 < len) { - /* More coming */ - if ((ie->data[pos] & 0x0f) != 3) { - pri_error(pri, "!! Unexpected Channel Type %d\n", ie->data[1] & 0x0f); - return -1; - } - if ((ie->data[pos] & 0x60) != 0) { - pri_error(pri, "!! Invalid CCITT coding %d\n", (ie->data[1] & 0x60) >> 5); - return -1; - } - if (ie->data[pos] & 0x10) { - /* Expect Slot Map */ - call->slotmap = 0; - pos++; - for (x=0;x<3;x++) { - call->slotmap <<= 8; - call->slotmap |= ie->data[x + pos]; - } - return 0; - } else { - pos++; - /* Only expect a particular channel */ - call->channelno = ie->data[pos] & 0x7f; - return 0; - } - } else - return 0; - return -1; -} - -static FUNC_SEND(transmit_channel_id) -{ - int pos=0; - - - /* We are ready to transmit single IE only */ - if (order > 1) - return 0; - - if (call->justsignalling) { - ie->data[pos++] = 0xac; /* Read the standards docs to figure this out - ECMA-165 section 7.3 */ - return pos + 2; - } - - /* Start with standard stuff */ - if (pri->switchtype == PRI_SWITCH_GR303_TMC) - ie->data[pos] = 0x69; - else if (pri->bri) { - ie->data[pos] = 0x80; - if (call->channelno > -1) - ie->data[pos] |= (call->channelno & 0x3); - } else - ie->data[pos] = 0xa1; - /* Add exclusive flag if necessary */ - if (call->chanflags & FLAG_EXCLUSIVE) - ie->data[pos] |= 0x08; - else if (!(call->chanflags & FLAG_PREFERRED)) { - /* Don't need this IE */ - return 0; - } - - if (((pri->switchtype != PRI_SWITCH_QSIG) && (call->ds1no > 0)) || call->ds1explicit) { - /* Note that we are specifying the identifier */ - ie->data[pos++] |= 0x40; - /* We need to use the Channel Identifier Present thingy. Just specify it and we're done */ - ie->data[pos++] = 0x80 | call->ds1no; - } else - pos++; - - if (pri->bri) - return pos + 2; - - if ((call->channelno > -1) || (call->slotmap != -1)) { - /* We'll have the octet 8.2 and 8.3's present */ - ie->data[pos++] = 0x83; - if (call->channelno > -1) { - /* Channel number specified */ - ie->data[pos++] = 0x80 | call->channelno; - return pos + 2; - } - /* We have to send a channel map */ - if (call->slotmap != -1) { - ie->data[pos-1] |= 0x10; - ie->data[pos++] = (call->slotmap & 0xff0000) >> 16; - ie->data[pos++] = (call->slotmap & 0xff00) >> 8; - ie->data[pos++] = (call->slotmap & 0xff); - return pos + 2; - } - } - if (call->ds1no > 0) { - /* We're done */ - return pos + 2; - } - pri_error(pri, "!! No channel map, no channel, and no ds1? What am I supposed to identify?\n"); - return -1; -} - -static FUNC_DUMP(dump_channel_id) -{ - int pos=0; - int x; - int res = 0; - static const char* msg_chan_sel[] = { - "No channel selected", "B1 channel", "B2 channel","Any channel selected", - "No channel selected", "As indicated in following octets", "Reserved","Any channel selected" - }; - - pri_message(pri, "%c Channel ID (len=%2d) [ Ext: %d IntID: %s %s Spare: %d %s Dchan: %d\n", - prefix, len, (ie->data[0] & 0x80) ? 1 : 0, (ie->data[0] & 0x40) ? "Explicit" : "Implicit", - (ie->data[0] & 0x20) ? "PRI" : "Other", (ie->data[0] & 0x10) ? 1 : 0, - (ie->data[0] & 0x08) ? "Exclusive" : "Preferred", (ie->data[0] & 0x04) ? 1 : 0); - pri_message(pri, "%c ChanSel: %s\n", - prefix, msg_chan_sel[(ie->data[0] & 0x3) + ((ie->data[0]>>3) & 0x4)]); - pos++; - len--; - if (ie->data[0] & 0x40) { - /* Explicitly defined DS1 */ - pri_message(pri, "%c Ext: %d DS1 Identifier: %d \n", prefix, (ie->data[pos] & 0x80) >> 7, ie->data[pos] & 0x7f); - pos++; - } else { - /* Implicitly defined DS1 */ - } - if (pos+2 < len) { - /* Still more information here */ - pri_message(pri, "%c Ext: %d Coding: %d %s Specified Channel Type: %d\n", - prefix, (ie->data[pos] & 0x80) >> 7, (ie->data[pos] & 60) >> 5, - (ie->data[pos] & 0x10) ? "Slot Map" : "Number", ie->data[pos] & 0x0f); - if (!(ie->data[pos] & 0x10)) { - /* Number specified */ - pos++; - pri_message(pri, "%c Ext: %d Channel: %d ]\n", prefix, (ie->data[pos] & 0x80) >> 7, - (ie->data[pos]) & 0x7f); - } else { - pos++; - /* Map specified */ - for (x=0;x<3;x++) { - res <<= 8; - res |= ie->data[pos++]; - } - pri_message(pri, "%c Map: %s ]\n", prefix, binary(res, 24)); - } - } else pri_message(pri, " ]\n"); -} - -static char *ri2str(int ri) -{ - static struct msgtype ris[] = { - { 0, "Indicated Channel" }, - { 6, "Single DS1 Facility" }, - { 7, "All DS1 Facilities" }, - }; - return code2str(ri, ris, sizeof(ris) / sizeof(ris[0])); -} - -static FUNC_DUMP(dump_restart_indicator) -{ - pri_message(pri, "%c Restart Indentifier (len=%2d) [ Ext: %d Spare: %d Resetting %s (%d) ]\n", - prefix, len, (ie->data[0] & 0x80) >> 7, (ie->data[0] & 0x78) >> 3, ri2str(ie->data[0] & 0x7), ie->data[0] & 0x7); -} - -static FUNC_RECV(receive_restart_indicator) -{ - /* Pretty simple */ - call->ri = ie->data[0] & 0x7; - return 0; -} - -static FUNC_SEND(transmit_restart_indicator) -{ - /* Pretty simple */ - switch(call->ri) { - case 0: - case 6: - case 7: - ie->data[0] = 0x80 | (call->ri & 0x7); - break; - case 5: - /* Switch compatibility */ - ie->data[0] = 0xA0 | (call->ri & 0x7); - break; - default: - pri_error(pri, "!! Invalid restart indicator value %d\n", call->ri); - return-1; - } - return 3; -} - -static char *redirection_reason2str(int mode) -{ - static struct msgtype modes[] = { - { PRI_REDIR_UNKNOWN, "Unknown" }, - { PRI_REDIR_FORWARD_ON_BUSY, "Forwarded on busy" }, - { PRI_REDIR_FORWARD_ON_NO_REPLY, "Forwarded on no reply" }, - { PRI_REDIR_DEFLECTION, "Call deflected" }, - { PRI_REDIR_DTE_OUT_OF_ORDER, "Called DTE out of order" }, - { PRI_REDIR_FORWARDED_BY_DTE, "Forwarded by called DTE" }, - { PRI_REDIR_UNCONDITIONAL, "Forwarded unconditionally" }, - }; - return code2str(mode, modes, sizeof(modes) / sizeof(modes[0])); -} - -static char *cap2str(int mode) -{ - static struct msgtype modes[] = { - { PRI_TRANS_CAP_SPEECH, "Speech" }, - { PRI_TRANS_CAP_DIGITAL, "Unrestricted digital information" }, - { PRI_TRANS_CAP_RESTRICTED_DIGITAL, "Restricted digital information" }, - { PRI_TRANS_CAP_3_1K_AUDIO, "3.1kHz audio" }, - { PRI_TRANS_CAP_DIGITAL_W_TONES, "Unrestricted digital information with tones/announcements" }, - { PRI_TRANS_CAP_VIDEO, "Video" }, - { PRI_TRANS_CAP_AUDIO_4ESS, "3.1khz audio (4ESS)" }, - }; - return code2str(mode, modes, sizeof(modes) / sizeof(modes[0])); -} - -static char *mode2str(int mode) -{ - static struct msgtype modes[] = { - { TRANS_MODE_64_CIRCUIT, "64kbps, circuit-mode" }, - { TRANS_MODE_2x64_CIRCUIT, "2x64kbps, circuit-mode" }, - { TRANS_MODE_384_CIRCUIT, "384kbps, circuit-mode" }, - { TRANS_MODE_1536_CIRCUIT, "1536kbps, circuit-mode" }, - { TRANS_MODE_1920_CIRCUIT, "1920kbps, circuit-mode" }, - { TRANS_MODE_MULTIRATE, "Multirate (Nx64kbps)" }, - { TRANS_MODE_PACKET, "Packet Mode" }, - }; - return code2str(mode, modes, sizeof(modes) / sizeof(modes[0])); -} - -static char *l12str(int proto) -{ - static struct msgtype protos[] = { - { PRI_LAYER_1_ITU_RATE_ADAPT, "V.110 Rate Adaption" }, - { PRI_LAYER_1_ULAW, "u-Law" }, - { PRI_LAYER_1_ALAW, "A-Law" }, - { PRI_LAYER_1_G721, "G.721 ADPCM" }, - { PRI_LAYER_1_G722_G725, "G.722/G.725 7kHz Audio" }, - { PRI_LAYER_1_H223_H245, "H.223/H.245 Multimedia" }, - { PRI_LAYER_1_NON_ITU_ADAPT, "Non-ITU Rate Adaption" }, - { PRI_LAYER_1_V120_RATE_ADAPT, "V.120 Rate Adaption" }, - { PRI_LAYER_1_X31_RATE_ADAPT, "X.31 Rate Adaption" }, - }; - return code2str(proto, protos, sizeof(protos) / sizeof(protos[0])); -} - -static char *ra2str(int proto) -{ - static struct msgtype protos[] = { - { PRI_RATE_ADAPT_9K6, "9.6 kbit/s" }, - }; - return code2str(proto, protos, sizeof(protos) / sizeof(protos[0])); -} - -static char *l22str(int proto) -{ - static struct msgtype protos[] = { - { LAYER_2_LAPB, "LAPB" }, - }; - return code2str(proto, protos, sizeof(protos) / sizeof(protos[0])); -} - -static char *l32str(int proto) -{ - static struct msgtype protos[] = { - { LAYER_3_X25, "X.25" }, - }; - return code2str(proto, protos, sizeof(protos) / sizeof(protos[0])); -} - -static char *int_rate2str(int proto) -{ - static struct msgtype protos[] = { - { PRI_INT_RATE_8K, "8 kbit/s" }, - { PRI_INT_RATE_16K, "16 kbit/s" }, - { PRI_INT_RATE_32K, "32 kbit/s" }, - }; - return code2str(proto, protos, sizeof(protos) / sizeof(protos[0])); -} - -static FUNC_DUMP(dump_bearer_capability) -{ - int pos=2; - pri_message(pri, "%c Bearer Capability (len=%2d) [ Ext: %d Q.931 Std: %d Info transfer capability: %s (%d)\n", - prefix, len, (ie->data[0] & 0x80 ) >> 7, (ie->data[0] & 0x60) >> 5, cap2str(ie->data[0] & 0x1f), (ie->data[0] & 0x1f)); - pri_message(pri, "%c Ext: %d Trans mode/rate: %s (%d)\n", prefix, (ie->data[1] & 0x80) >> 7, mode2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f); - - /* octet 4.1 exists iff mode/rate is multirate */ - if ((ie->data[1] & 0x7f) == 0x18) { - pri_message(pri, "%c Ext: %d Transfer rate multiplier: %d x 64\n", prefix, (ie->data[2] & 0x80) >> 7, ie->data[2] & 0x7f); - pos++; - } - - /* don't count the IE num and length as part of the data */ - len -= 2; - - /* Look for octet 5; this is identified by bits 5,6 == 01 */ - if (pos < len && - (ie->data[pos] & 0x60) == 0x20) { - - /* although the layer1 is only the bottom 5 bits of the byte, - previous versions of this library passed bits 5&6 through - too, so we have to do the same for binary compatability */ - u_int8_t layer1 = ie->data[pos] & 0x7f; - - pri_message(pri, "%c User information layer 1: %s (%d)\n", - prefix, l12str(layer1), layer1); - pos++; - - /* octet 5a? */ - if (pos < len && !(ie->data[pos-1] & 0x80)) { - int ra = ie->data[pos] & 0x7f; - - pri_message(pri, "%c Async: %d, Negotiation: %d, " - "User rate: %s (%#x)\n", - prefix, - ra & PRI_RATE_ADAPT_ASYNC ? 1 : 0, - ra & PRI_RATE_ADAPT_NEGOTIATION_POSS ? 1 : 0, - ra2str(ra & PRI_RATE_USER_RATE_MASK), - ra & PRI_RATE_USER_RATE_MASK); - pos++; - } - - /* octet 5b? */ - if (pos < len && !(ie->data[pos-1] & 0x80)) { - u_int8_t data = ie->data[pos]; - if (layer1 == PRI_LAYER_1_ITU_RATE_ADAPT) { - pri_message(pri, "%c Intermediate rate: %s (%d), " - "NIC on Tx: %d, NIC on Rx: %d, " - "Flow control on Tx: %d, " - "Flow control on Rx: %d\n", - prefix, int_rate2str((data & 0x60)>>5), - (data & 0x60)>>5, - (data & 0x10)?1:0, - (data & 0x08)?1:0, - (data & 0x04)?1:0, - (data & 0x02)?1:0); - } else if (layer1 == PRI_LAYER_1_V120_RATE_ADAPT) { - pri_message(pri, "%c Hdr: %d, Multiframe: %d, Mode: %d, " - "LLI negot: %d, Assignor: %d, " - "In-band neg: %d\n", prefix, - (data & 0x40)?1:0, - (data & 0x20)?1:0, - (data & 0x10)?1:0, - (data & 0x08)?1:0, - (data & 0x04)?1:0, - (data & 0x02)?1:0); - } else { - pri_message(pri, "%c Unknown octet 5b: 0x%x\n", data ); - } - pos++; - } - - /* octet 5c? */ - if (pos < len && !(ie->data[pos-1] & 0x80)) { - u_int8_t data = ie->data[pos]; - const char *stop_bits[] = {"?","1","1.5","2"}; - const char *data_bits[] = {"?","5","7","8"}; - const char *parity[] = {"Odd","?","Even","None", - "zero","one","?","?"}; - - pri_message(pri, "%c Stop bits: %s, data bits: %s, " - "parity: %s\n", prefix, - stop_bits[(data & 0x60) >> 5], - data_bits[(data & 0x18) >> 3], - parity[(data & 0x7)]); - - pos++; - } - - /* octet 5d? */ - if (pos < len && !(ie->data[pos-1] & 0x80)) { - u_int8_t data = ie->data[pos]; - pri_message(pri, "%c Duplex mode: %d, modem type: %d\n", - prefix, (data & 0x40) ? 1 : 0,data & 0x3F); - pos++; - } - } - - - /* Look for octet 6; this is identified by bits 5,6 == 10 */ - if (pos < len && - (ie->data[pos] & 0x60) == 0x40) { - pri_message(pri, "%c User information layer 2: %s (%d)\n", - prefix, l22str(ie->data[pos] & 0x1f), - ie->data[pos] & 0x1f); - pos++; - } - - /* Look for octet 7; this is identified by bits 5,6 == 11 */ - if (pos < len && (ie->data[pos] & 0x60) == 0x60) { - pri_message(pri, "%c User information layer 3: %s (%d)\n", - prefix, l32str(ie->data[pos] & 0x1f), - ie->data[pos] & 0x1f); - pos++; - - /* octets 7a and 7b? */ - if (pos + 1 < len && !(ie->data[pos-1] & 0x80) && - !(ie->data[pos] & 0x80)) { - unsigned int proto; - proto = ((ie->data[pos] & 0xF) << 4 ) | - (ie->data[pos+1] & 0xF); - - pri_message(pri, "%c Network layer: 0x%x\n", prefix, - proto ); - pos += 2; - } - } -} - -static FUNC_RECV(receive_bearer_capability) -{ - int pos=2; - if (ie->data[0] & 0x60) { - pri_error(pri, "!! non-standard Q.931 standard field\n"); - return -1; - } - call->transcapability = ie->data[0] & 0x1f; - call->transmoderate = ie->data[1] & 0x7f; - - /* octet 4.1 exists iff mode/rate is multirate */ - if (call->transmoderate == TRANS_MODE_MULTIRATE) { - call->transmultiple = ie->data[pos++] & 0x7f; - } - - /* Look for octet 5; this is identified by bits 5,6 == 01 */ - if (pos < len && - (ie->data[pos] & 0x60) == 0x20 ) { - /* although the layer1 is only the bottom 5 bits of the byte, - previous versions of this library passed bits 5&6 through - too, so we have to do the same for binary compatability */ - call->userl1 = ie->data[pos] & 0x7f; - pos++; - - /* octet 5a? */ - if (pos < len && !(ie->data[pos-1] & 0x80)) { - call->rateadaption = ie->data[pos] & 0x7f; - pos++; - } - - /* octets 5b through 5d? */ - while (pos < len && !(ie->data[pos-1] & 0x80)) { - pos++; - } - - } - - /* Look for octet 6; this is identified by bits 5,6 == 10 */ - if (pos < len && - (ie->data[pos] & 0x60) == 0x40) { - call->userl2 = ie->data[pos++] & 0x1f; - } - - /* Look for octet 7; this is identified by bits 5,6 == 11 */ - if (pos < len && - (ie->data[pos] & 0x60) == 0x60) { - call->userl3 = ie->data[pos++] & 0x1f; - } - return 0; -} - -static FUNC_SEND(transmit_bearer_capability) -{ - int tc; - int pos; - - /* We are ready to transmit single IE only */ - if(order > 1) - return 0; - - tc = call->transcapability; - if (pri->subchannel && !pri->bri) { - /* Bearer capability is *hard coded* in GR-303 */ - ie->data[0] = 0x88; - ie->data[1] = 0x90; - return 4; - } - - if (call->justsignalling) { - ie->data[0] = 0xa8; - ie->data[1] = 0x80; - return 4; - } - - ie->data[0] = 0x80 | tc; - ie->data[1] = call->transmoderate | 0x80; - - pos = 2; - /* octet 4.1 exists iff mode/rate is multirate */ - if (call->transmoderate == TRANS_MODE_MULTIRATE ) { - ie->data[pos++] = call->transmultiple | 0x80; - } - - if ((tc & PRI_TRANS_CAP_DIGITAL) && (pri->switchtype == PRI_SWITCH_EUROISDN_E1) && - (call->transmoderate == TRANS_MODE_PACKET)) { - /* Apparently EuroISDN switches don't seem to like user layer 2/3 */ - return 4; - } - if (call->transmoderate != TRANS_MODE_PACKET) { - /* If you have an AT&T 4ESS, you don't send any more info */ - if ((pri->switchtype != PRI_SWITCH_ATT4ESS) && (call->userl1 > -1)) { - ie->data[pos++] = call->userl1 | 0x80; /* XXX Ext bit? XXX */ - if (call->userl1 == PRI_LAYER_1_ITU_RATE_ADAPT) { - ie->data[pos++] = call->rateadaption | 0x80; - } - return pos + 2; - } - - ie->data[pos++] = 0xa0 | (call->userl1 & 0x1f); - - if (call->userl1 == PRI_LAYER_1_ITU_RATE_ADAPT) { - ie->data[pos-1] &= ~0x80; /* clear EXT bit in octet 5 */ - ie->data[pos++] = call->rateadaption | 0x80; - } - } - - - if (call->userl2 != -1) - ie->data[pos++] = 0xc0 | (call->userl2 & 0x1f); - - if (call->userl3 != -1) - ie->data[pos++] = 0xe0 | (call->userl3 & 0x1f); - - return pos + 2; -} - -char *pri_plan2str(int plan) -{ - static struct msgtype plans[] = { - { PRI_INTERNATIONAL_ISDN, "International number in ISDN" }, - { PRI_NATIONAL_ISDN, "National number in ISDN" }, - { PRI_LOCAL_ISDN, "Local number in ISDN" }, - { PRI_PRIVATE, "Private numbering plan" }, - { PRI_UNKNOWN, "Unknown numbering plan" }, - }; - return code2str(plan, plans, sizeof(plans) / sizeof(plans[0])); -} - -static char *npi2str(int plan) -{ - static struct msgtype plans[] = { - { PRI_NPI_UNKNOWN, "Unknown Number Plan" }, - { PRI_NPI_E163_E164, "ISDN/Telephony Numbering Plan (E.164/E.163)" }, - { PRI_NPI_X121, "Data Numbering Plan (X.121)" }, - { PRI_NPI_F69, "Telex Numbering Plan (F.69)" }, - { PRI_NPI_NATIONAL, "National Standard Numbering Plan" }, - { PRI_NPI_PRIVATE, "Private Numbering Plan" }, - { PRI_NPI_RESERVED, "Reserved Number Plan" }, - }; - return code2str(plan, plans, sizeof(plans) / sizeof(plans[0])); -} - -static char *ton2str(int plan) -{ - static struct msgtype plans[] = { - { PRI_TON_UNKNOWN, "Unknown Number Type" }, - { PRI_TON_INTERNATIONAL, "International Number" }, - { PRI_TON_NATIONAL, "National Number" }, - { PRI_TON_NET_SPECIFIC, "Network Specific Number" }, - { PRI_TON_SUBSCRIBER, "Subscriber Number" }, - { PRI_TON_ABBREVIATED, "Abbreviated number" }, - { PRI_TON_RESERVED, "Reserved Number" }, - }; - return code2str(plan, plans, sizeof(plans) / sizeof(plans[0])); -} - -static char *subaddrtype2str(int plan) -{ - static struct msgtype plans[] = { - { 0, "NSAP (X.213/ISO 8348 AD2)" }, - { 2, "User Specified" }, - }; - return code2str(plan, plans, sizeof(plans) / sizeof(plans[0])); -} - -char *pri_pres2str(int pres) -{ - static struct msgtype press[] = { - { PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, "Presentation permitted, user number not screened" }, - { PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, "Presentation permitted, user number passed network screening" }, - { PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN, "Presentation permitted, user number failed network screening" }, - { PRES_ALLOWED_NETWORK_NUMBER, "Presentation allowed of network provided number" }, - { PRES_PROHIB_USER_NUMBER_NOT_SCREENED, "Presentation prohibited, user number not screened" }, - { PRES_PROHIB_USER_NUMBER_PASSED_SCREEN, "Presentation prohibited, user number passed network screening" }, - { PRES_PROHIB_USER_NUMBER_FAILED_SCREEN, "Presentation prohibited, user number failed network screening" }, - { PRES_PROHIB_NETWORK_NUMBER, "Presentation prohibited of network provided number" }, - { PRES_NUMBER_NOT_AVAILABLE, "Number not available" }, - }; - return code2str(pres, press, sizeof(press) / sizeof(press[0])); -} - -static void q931_get_number(unsigned char *num, int maxlen, unsigned char *src, int len) -{ - if ((len < 0) || (len > maxlen - 1)) { - num[0] = 0; - return; - } - memcpy(num, src, len); - num[len] = 0; -} - -static FUNC_DUMP(dump_called_party_number) -{ - unsigned char cnum[256]; - - q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3); - pri_message(pri, "%c Called Number (len=%2d) [ Ext: %d TON: %s (%d) NPI: %s (%d) '%s' ]\n", - prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f, cnum); -} - -static FUNC_DUMP(dump_called_party_subaddr) -{ - unsigned char cnum[256]; - q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3); - pri_message(pri, "%c Called Sub-Address (len=%2d) [ Ext: %d Type: %s (%d) O: %d '%s' ]\n", - prefix, len, ie->data[0] >> 7, - subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4, - (ie->data[0] & 0x08) >> 3, cnum); -} - -static FUNC_DUMP(dump_calling_party_number) -{ - unsigned char cnum[256]; - if (ie->data[0] & 0x80) - q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3); - else - q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4); - pri_message(pri, "%c Calling Number (len=%2d) [ Ext: %d TON: %s (%d) NPI: %s (%d)\n", prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f); - if (ie->data[0] & 0x80) - pri_message(pri, "%c Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(0), 0, cnum); - else - pri_message(pri, "%c Presentation: %s (%d) '%s' ]\n", prefix, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, cnum); -} - -static FUNC_DUMP(dump_calling_party_subaddr) -{ - unsigned char cnum[256]; - q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3); - pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d Type: %s (%d) O: %d '%s' ]\n", - prefix, len, ie->data[0] >> 7, - subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4, - (ie->data[0] & 0x08) >> 3, cnum); -} - -static FUNC_DUMP(dump_redirecting_number) -{ - unsigned char cnum[256]; - int i = 0; - /* To follow Q.931 (4.5.1), we must search for start of octet 4 by - walking through all bytes until one with ext bit (8) set to 1 */ - do { - switch(i) { - case 0: /* Octet 3 */ - pri_message(pri, "%c Redirecting Number (len=%2d) [ Ext: %d TON: %s (%d) NPI: %s (%d)", - prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f); - break; - case 1: /* Octet 3a */ - pri_message(pri, "\n%c Ext: %d Presentation: %s (%d)", - prefix, ie->data[1] >> 7, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f); - break; - case 2: /* Octet 3b */ - pri_message(pri, "\n%c Ext: %d Reason: %s (%d)", - prefix, ie->data[2] >> 7, redirection_reason2str(ie->data[2] & 0x7f), ie->data[2] & 0x7f); - break; - } - } - while(!(ie->data[i++]& 0x80)); - q931_get_number(cnum, sizeof(cnum), ie->data + i, ie->len - i); - pri_message(pri, " '%s' ]\n", cnum); -} - -static FUNC_DUMP(dump_connected_number) -{ - unsigned char cnum[256]; - int i = 0; - /* To follow Q.931 (4.5.1), we must search for start of octet 4 by - walking through all bytes until one with ext bit (8) set to 1 */ - do { - switch(i) { - case 0: /* Octet 3 */ - pri_message(pri, "%c Connected Number (len=%2d) [ Ext: %d TON: %s (%d) NPI: %s (%d)", - prefix, len, ie->data[0] >> 7, ton2str((ie->data[0] >> 4) & 0x07), (ie->data[0] >> 4) & 0x07, npi2str(ie->data[0] & 0x0f), ie->data[0] & 0x0f); - break; - case 1: /* Octet 3a */ - pri_message(pri, "\n%c Ext: %d Presentation: %s (%d)", - prefix, ie->data[1] >> 7, pri_pres2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f); - break; - } - } - while(!(ie->data[i++]& 0x80)); - q931_get_number(cnum, sizeof(cnum), ie->data + i, ie->len - i); - pri_message(pri, " '%s' ]\n", cnum); -} - - -static FUNC_RECV(receive_redirecting_number) -{ - int i = 0; - - /* To follow Q.931 (4.5.1), we must search for start of octet 4 by - walking through all bytes until one with ext bit (8) set to 1 */ - do { - switch(i) { - case 0: - call->redirectingplan = ie->data[i] & 0x7f; - break; - case 1: - call->redirectingpres = ie->data[i] & 0x7f; - break; - case 2: - call->redirectingreason = ie->data[i] & 0x0f; - break; - } - } - while(!(ie->data[i++] & 0x80)); - q931_get_number((unsigned char *) call->redirectingnum, sizeof(call->redirectingnum), ie->data + i, ie->len - i); - return 0; -} - -static FUNC_SEND(transmit_redirecting_number) -{ - if (order > 1) - return 0; - if (call->redirectingnum && *call->redirectingnum) { - ie->data[0] = call->redirectingplan; - ie->data[1] = call->redirectingpres; - ie->data[2] = (call->redirectingreason & 0x0f) | 0x80; - memcpy(ie->data + 3, call->redirectingnum, strlen(call->redirectingnum)); - return strlen(call->redirectingnum) + 3 + 2; - } - return 0; -} - -static FUNC_DUMP(dump_redirecting_subaddr) -{ - unsigned char cnum[256]; - q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4); - pri_message(pri, "%c Redirecting Sub-Address (len=%2d) [ Ext: %d Type: %s (%d) O: %d '%s' ]\n", - prefix, len, ie->data[0] >> 7, - subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4, - (ie->data[0] & 0x08) >> 3, cnum); -} - -static FUNC_RECV(receive_calling_party_subaddr) -{ - /* copy digits to call->callingsubaddr */ - q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3); - return 0; -} - -static FUNC_RECV(receive_called_party_number) -{ - /* copy digits to call->callednum */ - q931_get_number((unsigned char *) call->callednum, sizeof(call->callednum), ie->data + 1, len - 3); - call->calledplan = ie->data[0] & 0x7f; - return 0; -} - -static FUNC_SEND(transmit_called_party_number) -{ - ie->data[0] = 0x80 | call->calledplan; - if (*call->callednum) - memcpy(ie->data + 1, call->callednum, strlen(call->callednum)); - return strlen(call->callednum) + 3; -} - -static FUNC_RECV(receive_calling_party_number) -{ - u_int8_t *data; - size_t length; - - if (ie->data[0] & 0x80) { - data = ie->data + 1; - length = len - 3; - call->callerpres = 0; /* PI presentation allowed SI user-provided, not screened */ - } else { - data = ie->data + 2; - length = len - 4; - call->callerpres = ie->data[1] & 0x7f; - } - - if (call->callerpres == PRES_ALLOWED_NETWORK_NUMBER || - call->callerpres == PRES_PROHIB_NETWORK_NUMBER) { - q931_get_number((u_int8_t *)call->callerani, sizeof(call->callerani), data, length); - call->callerplanani = ie->data[0] & 0x7f; - - if (!*call->callernum) { /*Copy ANI to CallerID if CallerID is not already set */ - libpri_copy_string(call->callernum, call->callerani, sizeof(call->callernum)); - call->callerplan = call->callerplanani; - } - - } else { - q931_get_number((u_int8_t *)call->callernum, sizeof(call->callernum), data, length); - call->callerplan = ie->data[0] & 0x7f; - } - - return 0; -} - -static FUNC_SEND(transmit_calling_party_number) -{ - ie->data[0] = call->callerplan; - ie->data[1] = 0x80 | call->callerpres; - if (*call->callernum) - memcpy(ie->data + 2, call->callernum, strlen(call->callernum)); - return strlen(call->callernum) + 4; -} - -static FUNC_DUMP(dump_user_user) -{ - int x; - pri_message(pri, "%c User-User Information (len=%2d) [", prefix, len); - for (x=0;xlen;x++) - pri_message(pri, " %02x", ie->data[x] & 0x7f); - pri_message(pri, " ]\n"); -} - - -static FUNC_RECV(receive_user_user) -{ - call->useruserprotocoldisc = ie->data[0] & 0xff; - if (call->useruserprotocoldisc == 4) /* IA5 */ - q931_get_number((unsigned char *) call->useruserinfo, sizeof(call->useruserinfo), ie->data + 1, len - 3); - return 0; -} - -static FUNC_SEND(transmit_user_user) -{ - int datalen = strlen(call->useruserinfo); - if (datalen > 0) { - /* Restricted to 35 characters */ - if (msgtype == Q931_USER_INFORMATION) { - if (datalen > 260) - datalen = 260; - } else { - if (datalen > 35) - datalen = 35; - } - ie->data[0] = 4; /* IA5 characters */ - memcpy(&ie->data[1], call->useruserinfo, datalen); - call->useruserinfo[0] = '\0'; - return datalen + 3; - } - - return 0; -} - -static char *prog2str(int prog) -{ - static struct msgtype progs[] = { - { Q931_PROG_CALL_NOT_E2E_ISDN, "Call is not end-to-end ISDN; further call progress information may be available inband." }, - { Q931_PROG_CALLED_NOT_ISDN, "Called equipment is non-ISDN." }, - { Q931_PROG_CALLER_NOT_ISDN, "Calling equipment is non-ISDN." }, - { Q931_PROG_INBAND_AVAILABLE, "Inband information or appropriate pattern now available." }, - { Q931_PROG_DELAY_AT_INTERF, "Delay in response at called Interface." }, - { Q931_PROG_INTERWORKING_WITH_PUBLIC, "Interworking with a public network." }, - { Q931_PROG_INTERWORKING_NO_RELEASE, "Interworking with a network unable to supply a release signal." }, - { Q931_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER, "Interworking with a network unable to supply a release signal before answer." }, - { Q931_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER, "Interworking with a network unable to supply a release signal after answer." }, - }; - return code2str(prog, progs, sizeof(progs) / sizeof(progs[0])); -} - -static char *coding2str(int cod) -{ - static struct msgtype cods[] = { - { CODE_CCITT, "CCITT (ITU) standard" }, - { CODE_INTERNATIONAL, "Non-ITU international standard" }, - { CODE_NATIONAL, "National standard" }, - { CODE_NETWORK_SPECIFIC, "Network specific standard" }, - }; - return code2str(cod, cods, sizeof(cods) / sizeof(cods[0])); -} - -static char *loc2str(int loc) -{ - static struct msgtype locs[] = { - { LOC_USER, "User" }, - { LOC_PRIV_NET_LOCAL_USER, "Private network serving the local user" }, - { LOC_PUB_NET_LOCAL_USER, "Public network serving the local user" }, - { LOC_TRANSIT_NET, "Transit network" }, - { LOC_PUB_NET_REMOTE_USER, "Public network serving the remote user" }, - { LOC_PRIV_NET_REMOTE_USER, "Private network serving the remote user" }, - { LOC_INTERNATIONAL_NETWORK, "International network" }, - { LOC_NETWORK_BEYOND_INTERWORKING, "Network beyond the interworking point" }, - }; - return code2str(loc, locs, sizeof(locs) / sizeof(locs[0])); -} - -static FUNC_DUMP(dump_progress_indicator) -{ - pri_message(pri, "%c Progress Indicator (len=%2d) [ Ext: %d Coding: %s (%d) 0: %d Location: %s (%d)\n", - prefix, len, ie->data[0] >> 7, coding2str((ie->data[0] & 0x60) >> 5), (ie->data[0] & 0x60) >> 5, - (ie->data[0] & 0x10) >> 4, loc2str(ie->data[0] & 0xf), ie->data[0] & 0xf); - pri_message(pri, "%c Ext: %d Progress Description: %s (%d) ]\n", - prefix, ie->data[1] >> 7, prog2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f); -} - -static FUNC_RECV(receive_display) -{ - unsigned char *data; - data = ie->data; - if (data[0] & 0x80) { - /* Skip over character set */ - data++; - len--; - } - q931_get_number((unsigned char *) call->callername, sizeof(call->callername), data, len - 2); - return 0; -} - -static FUNC_SEND(transmit_display) -{ - int i; - - if ((pri->switchtype == PRI_SWITCH_QSIG) || - ((pri->switchtype == PRI_SWITCH_EUROISDN_E1) && (pri->localtype == PRI_CPE)) || - !call->callername[0]) - return 0; - - i = 0; - if(pri->switchtype != PRI_SWITCH_EUROISDN_E1) { - ie->data[0] = 0xb1; - ++i; - } - memcpy(ie->data + i, call->callername, strlen(call->callername)); - return 2 + i + strlen(call->callername); -} - -static FUNC_RECV(receive_progress_indicator) -{ - call->progloc = ie->data[0] & 0xf; - call->progcode = (ie->data[0] & 0x60) >> 5; - switch (call->progress = (ie->data[1] & 0x7f)) { - case Q931_PROG_CALL_NOT_E2E_ISDN: - call->progressmask |= PRI_PROG_CALL_NOT_E2E_ISDN; - break; - case Q931_PROG_CALLED_NOT_ISDN: - call->progressmask |= PRI_PROG_CALLED_NOT_ISDN; - break; - case Q931_PROG_CALLER_NOT_ISDN: - call->progressmask |= PRI_PROG_CALLER_NOT_ISDN; - break; - case Q931_PROG_CALLER_RETURNED_TO_ISDN: - call->progressmask |= PRI_PROG_CALLER_RETURNED_TO_ISDN; - break; - case Q931_PROG_INBAND_AVAILABLE: - call->progressmask |= PRI_PROG_INBAND_AVAILABLE; - break; - case Q931_PROG_DELAY_AT_INTERF: - call->progressmask |= PRI_PROG_DELAY_AT_INTERF; - break; - case Q931_PROG_INTERWORKING_WITH_PUBLIC: - call->progressmask |= PRI_PROG_INTERWORKING_WITH_PUBLIC; - break; - case Q931_PROG_INTERWORKING_NO_RELEASE: - call->progressmask |= PRI_PROG_INTERWORKING_NO_RELEASE; - break; - case Q931_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER: - call->progressmask |= PRI_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER; - break; - case Q931_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER: - call->progressmask |= PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER; - break; - default: - pri_error(pri, "XXX Invalid Progress indicator value received: %02x\n",(ie->data[1] & 0x7f)); - break; - } - return 0; -} - -static FUNC_SEND(transmit_facility) -{ - struct apdu_event *tmp; - int i = 0; - - for (tmp = call->apdus; tmp; tmp = tmp->next) { - if ((tmp->message == msgtype) && !tmp->sent) - break; - } - - if (!tmp) /* No APDU found */ - return 0; - - if (tmp->apdu_len > 235) { /* TODO: find out how much space we can use */ - pri_message(pri, "Requested APDU (%d bytes) is too long\n", tmp->apdu_len); - return 0; - } - - memcpy(&ie->data[i], tmp->apdu, tmp->apdu_len); - i += tmp->apdu_len; - tmp->sent = 1; - - return i + 2; -} - -static FUNC_RECV(receive_facility) -{ - int i = 0; - int protocol, next_protocol; - struct rose_component *comp = NULL; - enum { - Q932_STATE_NFE, /* Network facility extension */ - Q932_STATE_NPP, /* Network protocol profile */ - Q932_STATE_INTERPRETATION, /* Interpretation component */ - Q932_STATE_SERVICE /* Service component(s) */ - } state = Q932_STATE_SERVICE; -#define Q932_HANDLE_PROC(component, my_state, name, handler) \ - case component: \ - if(state > my_state) { \ - pri_error(pri, "!! %s component received in wrong place\n"); \ - break; \ - } \ - state = my_state; \ - if (pri->debug) \ - pri_message(pri, "Handle Q.932 %s component\n", name); \ - (handler)(pri, call, ie, comp->data, comp->len); \ - break; -#define Q932_HANDLE_NULL(component, my_state, name, handle) \ - case component: \ - if(state > my_state) { \ - pri_error(pri, "!! %s component received in wrong place\n"); \ - break; \ - } \ - state = my_state; \ - if (pri->debug & PRI_DEBUG_APDU) \ - pri_message(pri, "Q.932 %s component is not handled\n", name); \ - break; - - if (ie->len < 1) - return -1; - - switch(next_protocol = protocol = (ie->data[i] & 0x1f)) { - case Q932_PROTOCOL_CMIP: - case Q932_PROTOCOL_ACSE: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "!! Don't know how to handle Q.932 Protocol Profile of type 0x%X\n", protocol); - return -1; - case Q932_PROTOCOL_EXTENSIONS: - state = Q932_STATE_NFE; - next_protocol = Q932_PROTOCOL_ROSE; - break; - case Q932_PROTOCOL_ROSE: - break; - default: - pri_error(pri, "!! Invalid Q.932 Protocol Profile of type 0x%X received\n", protocol); - return -1; - } - /* Service indicator octet - Just ignore for now */ - if (!(ie->data[i] & 0x80)) - i++; - i++; - - if (ie->len < 3) - return -1; - - while ((i+1 < ie->len) && (&ie->data[i])) { - comp = (struct rose_component*)&ie->data[i]; - if (comp->type) { - if (protocol == Q932_PROTOCOL_EXTENSIONS) { - switch (comp->type) { - Q932_HANDLE_NULL(COMP_TYPE_INTERPRETATION, Q932_STATE_INTERPRETATION, "Interpretation", NULL); - Q932_HANDLE_NULL(COMP_TYPE_NFE, Q932_STATE_NFE, "Network facility extensions", NULL); - Q932_HANDLE_NULL(COMP_TYPE_NETWORK_PROTOCOL_PROFILE, Q932_STATE_NPP, "Network protocol profile", NULL); - default: - protocol = next_protocol; - break; - } - } - switch (protocol) { - case Q932_PROTOCOL_ROSE: - switch (comp->type) { - Q932_HANDLE_PROC(COMP_TYPE_INVOKE, Q932_STATE_SERVICE, "ROSE Invoke", rose_invoke_decode); - Q932_HANDLE_PROC(COMP_TYPE_RETURN_RESULT, Q932_STATE_SERVICE, "ROSE return result", rose_return_result_decode); - Q932_HANDLE_PROC(COMP_TYPE_RETURN_ERROR, Q932_STATE_SERVICE, "ROSE return error", rose_return_error_decode); - Q932_HANDLE_PROC(COMP_TYPE_REJECT, Q932_STATE_SERVICE, "ROSE reject", rose_reject_decode); - default: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "Don't know how to handle ROSE component of type 0x%X\n", comp->type); - break; - } - break; - case Q932_PROTOCOL_CMIP: - switch (comp->type) { - default: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "Don't know how to handle CMIP component of type 0x%X\n", comp->type); - break; - } - break; - case Q932_PROTOCOL_ACSE: - switch (comp->type) { - default: - if (pri->debug & PRI_DEBUG_APDU) - pri_message(pri, "Don't know how to handle ACSE component of type 0x%X\n", comp->type); - break; - } - break; - } - } - i += (comp->len + 2); - } -#undef Q932_HANDLE - - return 0; -} - -static FUNC_SEND(transmit_progress_indicator) -{ - int code, mask; - /* Can't send progress indicator on GR-303 -- EVER! */ - if (pri->subchannel && !pri->bri) - return 0; - if (call->progressmask > 0) { - if (call->progressmask & (mask = PRI_PROG_CALL_NOT_E2E_ISDN)) - code = Q931_PROG_CALL_NOT_E2E_ISDN; - else if (call->progressmask & (mask = PRI_PROG_CALLED_NOT_ISDN)) - code = Q931_PROG_CALLED_NOT_ISDN; - else if (call->progressmask & (mask = PRI_PROG_CALLER_NOT_ISDN)) - code = Q931_PROG_CALLER_NOT_ISDN; - else if (call->progressmask & (mask = PRI_PROG_INBAND_AVAILABLE)) - code = Q931_PROG_INBAND_AVAILABLE; - else if (call->progressmask & (mask = PRI_PROG_DELAY_AT_INTERF)) - code = Q931_PROG_DELAY_AT_INTERF; - else if (call->progressmask & (mask = PRI_PROG_INTERWORKING_WITH_PUBLIC)) - code = Q931_PROG_INTERWORKING_WITH_PUBLIC; - else if (call->progressmask & (mask = PRI_PROG_INTERWORKING_NO_RELEASE)) - code = Q931_PROG_INTERWORKING_NO_RELEASE; - else if (call->progressmask & (mask = PRI_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER)) - code = Q931_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER; - else if (call->progressmask & (mask = PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER)) - code = Q931_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER; - else { - code = 0; - pri_error(pri, "XXX Undefined progress bit: %x\n", call->progressmask); - } - if (code) { - ie->data[0] = 0x80 | (call->progcode << 5) | (call->progloc); - ie->data[1] = 0x80 | code; - call->progressmask &= ~mask; - return 4; - } - } - /* Leave off */ - return 0; -} -static FUNC_SEND(transmit_call_state) -{ - if (call->ourcallstate > -1 ) { - ie->data[0] = call->ourcallstate; - return 3; - } - return 0; -} - -static FUNC_RECV(receive_call_state) -{ - call->sugcallstate = ie->data[0] & 0x3f; - return 0; -} - -static char *callstate2str(int callstate) -{ - static struct msgtype callstates[] = { - { 0, "Null" }, - { 1, "Call Initiated" }, - { 2, "Overlap sending" }, - { 3, "Outgoing call Proceeding" }, - { 4, "Call Delivered" }, - { 6, "Call Present" }, - { 7, "Call Received" }, - { 8, "Connect Request" }, - { 9, "Incoming Call Proceeding" }, - { 10, "Active" }, - { 11, "Disconnect Request" }, - { 12, "Disconnect Indication" }, - { 15, "Suspend Request" }, - { 17, "Resume Request" }, - { 19, "Release Request" }, - { 22, "Call Abort" }, - { 25, "Overlap Receiving" }, - { 61, "Restart Request" }, - { 62, "Restart" }, - }; - return code2str(callstate, callstates, sizeof(callstates) / sizeof(callstates[0])); -} - -static FUNC_DUMP(dump_call_state) -{ - pri_message(pri, "%c Call State (len=%2d) [ Ext: %d Coding: %s (%d) Call state: %s (%d)\n", - prefix, len, ie->data[0] >> 7, coding2str((ie->data[0] & 0xC0) >> 6), (ie->data[0] & 0xC0) >> 6, - callstate2str(ie->data[0] & 0x3f), ie->data[0] & 0x3f); -} - -static FUNC_DUMP(dump_call_identity) -{ - int x; - pri_message(pri, "%c Call Identity (len=%2d) [ ", prefix, len); - for (x=0;xlen;x++) - pri_message(pri, "0x%02X ", ie->data[x]); - pri_message(pri, " ]\n"); -} - -static FUNC_DUMP(dump_time_date) -{ - pri_message(pri, "%c Time Date (len=%2d) [ ", prefix, len); - if (ie->len > 0) - pri_message(pri, "%02d", ie->data[0]); - if (ie->len > 1) - pri_message(pri, "-%02d", ie->data[1]); - if (ie->len > 2) - pri_message(pri, "-%02d", ie->data[2]); - if (ie->len > 3) - pri_message(pri, " %02d", ie->data[3]); - if (ie->len > 4) - pri_message(pri, ":%02d", ie->data[4]); - if (ie->len > 5) - pri_message(pri, ":%02d", ie->data[5]); - pri_message(pri, " ]\n"); -} - -static FUNC_DUMP(dump_keypad_facility) -{ - char tmp[64]; - - if (ie->len == 0 || ie->len > sizeof(tmp)) - return; - - memcpy(tmp, ie->data, ie->len); - tmp[ie->len] = '\0'; - pri_message(pri, "%c Keypad Facility (len=%2d) [ %s ]\n", prefix, ie->len, tmp ); -} - -static FUNC_RECV(receive_keypad_facility) -{ - int mylen; - - if (ie->len == 0) - return -1; - - if (ie->len > (sizeof(call->keypad_digits) - 1)) - mylen = (sizeof(call->keypad_digits) - 1); - else - mylen = ie->len; - - memcpy(call->keypad_digits, ie->data, mylen); - call->keypad_digits[mylen] = 0; - - return 0; -} - -static FUNC_SEND(transmit_keypad_facility) -{ - int sublen; - - sublen = strlen(call->keypad_digits); - - if (sublen > 32) { - sublen = 32; - call->keypad_digits[32] = '\0'; - } - - if (sublen) { - libpri_copy_string((char *)ie->data, (char *)call->keypad_digits, sizeof(call->keypad_digits)); - /* Make sure we clear the field */ - call->keypad_digits[0] = '\0'; - return sublen + 2; - } else - return 0; -} - -static FUNC_DUMP(dump_display) -{ - int x, y; - char *buf = malloc(len + 1); - char tmp[80] = ""; - if (buf) { - x=y=0; - if ((x < ie->len) && (ie->data[x] & 0x80)) { - sprintf(tmp, "Charset: %02x ", ie->data[x] & 0x7f); - ++x; - } - for (y=x; xlen; x++) - buf[x] = ie->data[x] & 0x7f; - buf[x] = '\0'; - pri_message(pri, "%c Display (len=%2d) %s[ %s ]\n", prefix, ie->len, tmp, &buf[y]); - free(buf); - } -} - -#define CHECK_OVERFLOW(limit) \ - if (tmpptr - tmp + limit >= sizeof(tmp)) { \ - *tmpptr = '\0'; \ - pri_message(pri, "%s", tmpptr = tmp); \ - } - -static void dump_ie_data(struct pri *pri, unsigned char *c, int len) -{ - static char hexs[16] = "0123456789ABCDEF"; - char tmp[1024], *tmpptr; - int lastascii = 0; - tmpptr = tmp; - for (; len; --len, ++c) { - CHECK_OVERFLOW(7); - if (isprint(*c)) { - if (!lastascii) { - if (tmpptr != tmp) { - *tmpptr++ = ','; - *tmpptr++ = ' '; - } - *tmpptr++ = '\''; - lastascii = 1; - } - *tmpptr++ = *c; - } else { - if (lastascii) { - *tmpptr++ = '\''; - lastascii = 0; - } - if (tmpptr != tmp) { - *tmpptr++ = ','; - *tmpptr++ = ' '; - } - *tmpptr++ = '0'; - *tmpptr++ = 'x'; - *tmpptr++ = hexs[(*c >> 4) & 0x0f]; - *tmpptr++ = hexs[(*c) & 0x0f]; - } - } - if (lastascii) - *tmpptr++ = '\''; - *tmpptr = '\0'; - pri_message(pri, "%s", tmp); -} - -static FUNC_DUMP(dump_facility) -{ - int dataat = (ie->data[0] & 0x80) ? 1 : 2; - pri_message(pri, "%c Facility (len=%2d, codeset=%d) [ ", prefix, len, Q931_IE_CODESET(full_ie)); - dump_ie_data(pri, ie->data, ie->len); - pri_message(NULL, " ]\n"); - if (ie->len > 1) { - pri_message(pri, "PROTOCOL %02X\n", ie->data[0] & ASN1_TYPE_MASK); - asn1_dump(pri, &ie->data[dataat], ie->len - dataat); - } - -} - -static FUNC_DUMP(dump_network_spec_fac) -{ - pri_message(pri, "%c Network-Specific Facilities (len=%2d) [ ", prefix, ie->len); - if (ie->data[0] == 0x00) { - pri_message(pri, "%s", code2str(ie->data[1], facilities, sizeof(facilities) / sizeof(facilities[0]))); - } - else - dump_ie_data(pri, ie->data, ie->len); - pri_message(pri, " ]\n"); -} - -static FUNC_RECV(receive_network_spec_fac) -{ - return 0; -} - -static FUNC_SEND(transmit_network_spec_fac) -{ - /* We are ready to transmit single IE only */ - if (order > 1) - return 0; - - if (pri->nsf != PRI_NSF_NONE) { - ie->data[0] = 0x00; - ie->data[1] = pri->nsf; - return 4; - } - /* Leave off */ - return 0; -} - -char *pri_cause2str(int cause) -{ - return code2str(cause, causes, sizeof(causes) / sizeof(causes[0])); -} - -static char *pri_causeclass2str(int cause) -{ - static struct msgtype causeclasses[] = { - { 0, "Normal Event" }, - { 1, "Normal Event" }, - { 2, "Network Congestion (resource unavailable)" }, - { 3, "Service or Option not Available" }, - { 4, "Service or Option not Implemented" }, - { 5, "Invalid message (e.g. parameter out of range)" }, - { 6, "Protocol Error (e.g. unknown message)" }, - { 7, "Interworking" }, - }; - return code2str(cause, causeclasses, sizeof(causeclasses) / sizeof(causeclasses[0])); -} - -static FUNC_DUMP(dump_cause) -{ - int x; - pri_message(pri, "%c Cause (len=%2d) [ Ext: %d Coding: %s (%d) Spare: %d Location: %s (%d)\n", - prefix, len, ie->data[0] >> 7, coding2str((ie->data[0] & 0x60) >> 5), (ie->data[0] & 0x60) >> 5, - (ie->data[0] & 0x10) >> 4, loc2str(ie->data[0] & 0xf), ie->data[0] & 0xf); - pri_message(pri, "%c Ext: %d Cause: %s (%d), class = %s (%d) ]\n", - prefix, (ie->data[1] >> 7), pri_cause2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f, - pri_causeclass2str((ie->data[1] & 0x7f) >> 4), (ie->data[1] & 0x7f) >> 4); - if (ie->len < 3) - return; - /* Dump cause data in readable form */ - switch(ie->data[1] & 0x7f) { - case PRI_CAUSE_IE_NONEXIST: - for (x=2;xlen;x++) - pri_message(pri, "%c Cause data %d: %02x (%d, %s IE)\n", prefix, x-1, ie->data[x], ie->data[x], ie2str(ie->data[x])); - break; - case PRI_CAUSE_WRONG_CALL_STATE: - for (x=2;xlen;x++) - pri_message(pri, "%c Cause data %d: %02x (%d, %s message)\n", prefix, x-1, ie->data[x], ie->data[x], msg2str(ie->data[x])); - break; - case PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE: - pri_message(pri, "%c Cause data:", prefix); - for (x=2;xlen;x++) - pri_message(pri, " %02x", ie->data[x]); - pri_message(pri, " (Timer T"); - for (x=2;xlen;x++) - pri_message(pri, "%c", ((ie->data[x] >= ' ') && (ie->data[x] < 0x7f)) ? ie->data[x] : '.'); - pri_message(pri, ")\n"); - break; - default: - for (x=2;xlen;x++) - pri_message(pri, "%c Cause data %d: %02x (%d)\n", prefix, x-1, ie->data[x], ie->data[x]); - break; - } -} - -static FUNC_RECV(receive_cause) -{ - call->causeloc = ie->data[0] & 0xf; - call->causecode = (ie->data[0] & 0x60) >> 5; - call->cause = (ie->data[1] & 0x7f); - return 0; -} - -static FUNC_SEND(transmit_cause) -{ - /* We are ready to transmit single IE only */ - if (order > 1) - return 0; - - if (call->cause > 0) { - ie->data[0] = 0x80 | (call->causecode << 5) | (call->causeloc); - ie->data[1] = 0x80 | (call->cause); - return 4; - } else { - /* Leave off */ - return 0; - } -} - -static FUNC_DUMP(dump_sending_complete) -{ - pri_message(pri, "%c Sending Complete (len=%2d)\n", prefix, len); -} - -static FUNC_RECV(receive_sending_complete) -{ - /* We've got a "Complete" message: Exect no further digits. */ - call->complete = 1; - return 0; -} - -static FUNC_SEND(transmit_sending_complete) -{ - if ((pri->overlapdial && call->complete) || /* Explicit */ - (!pri->overlapdial && ((pri->switchtype == PRI_SWITCH_EUROISDN_E1) || - /* Implicit */ (pri->switchtype == PRI_SWITCH_EUROISDN_T1)))) { - /* Include this single-byte IE */ - return 1; - } - return 0; -} - -static char *notify2str(int info) -{ - /* ITU-T Q.763 */ - static struct msgtype notifies[] = { - { PRI_NOTIFY_USER_SUSPENDED, "User suspended" }, - { PRI_NOTIFY_USER_RESUMED, "User resumed" }, - { PRI_NOTIFY_BEARER_CHANGE, "Bearer service change (DSS1)" }, - { PRI_NOTIFY_ASN1_COMPONENT, "ASN.1 encoded component (DSS1)" }, - { PRI_NOTIFY_COMPLETION_DELAY, "Call completion delay" }, - { PRI_NOTIFY_CONF_ESTABLISHED, "Conference established" }, - { PRI_NOTIFY_CONF_DISCONNECTED, "Conference disconnected" }, - { PRI_NOTIFY_CONF_PARTY_ADDED, "Other party added" }, - { PRI_NOTIFY_CONF_ISOLATED, "Isolated" }, - { PRI_NOTIFY_CONF_REATTACHED, "Reattached" }, - { PRI_NOTIFY_CONF_OTHER_ISOLATED, "Other party isolated" }, - { PRI_NOTIFY_CONF_OTHER_REATTACHED, "Other party reattached" }, - { PRI_NOTIFY_CONF_OTHER_SPLIT, "Other party split" }, - { PRI_NOTIFY_CONF_OTHER_DISCONNECTED, "Other party disconnected" }, - { PRI_NOTIFY_CONF_FLOATING, "Conference floating" }, - { PRI_NOTIFY_WAITING_CALL, "Call is waiting call" }, - { PRI_NOTIFY_DIVERSION_ACTIVATED, "Diversion activated (DSS1)" }, - { PRI_NOTIFY_TRANSFER_ALERTING, "Call transfer, alerting" }, - { PRI_NOTIFY_TRANSFER_ACTIVE, "Call transfer, active" }, - { PRI_NOTIFY_REMOTE_HOLD, "Remote hold" }, - { PRI_NOTIFY_REMOTE_RETRIEVAL, "Remote retrieval" }, - { PRI_NOTIFY_CALL_DIVERTING, "Call is diverting" }, - }; - return code2str(info, notifies, sizeof(notifies) / sizeof(notifies[0])); -} - -static FUNC_DUMP(dump_notify) -{ - pri_message(pri, "%c Notification indicator (len=%2d): Ext: %d %s (%d)\n", prefix, len, ie->data[0] >> 7, notify2str(ie->data[0] & 0x7f), ie->data[0] & 0x7f); -} - -static FUNC_RECV(receive_notify) -{ - call->notify = ie->data[0] & 0x7F; - return 0; -} - -static FUNC_SEND(transmit_notify) -{ - if (call->notify >= 0) { - ie->data[0] = 0x80 | call->notify; - return 3; - } - return 0; -} - -static FUNC_DUMP(dump_shift) -{ - pri_message(pri, "%c %sLocking Shift (len=%02d): Requested codeset %d\n", prefix, (full_ie & 8) ? "Non-" : "", len, full_ie & 7); -} - -static char *lineinfo2str(int info) -{ - /* NAPNA ANI II digits */ - static struct msgtype lineinfo[] = { - { 0, "Plain Old Telephone Service (POTS)" }, - { 1, "Multiparty line (more than 2)" }, - { 2, "ANI failure" }, - { 6, "Station Level Rating" }, - { 7, "Special Operator Handling Required" }, - { 20, "Automatic Identified Outward Dialing (AIOD)" }, - { 23, "Coing or Non-Coin" }, - { 24, "Toll free translated to POTS originated for non-pay station" }, - { 25, "Toll free translated to POTS originated from pay station" }, - { 27, "Pay station with coin control signalling" }, - { 29, "Prison/Inmate Service" }, - { 30, "Intercept (blank)" }, - { 31, "Intercept (trouble)" }, - { 32, "Intercept (regular)" }, - { 34, "Telco Operator Handled Call" }, - { 52, "Outward Wide Area Telecommunications Service (OUTWATS)" }, - { 60, "TRS call from unrestricted line" }, - { 61, "Cellular/Wireless PCS (Type 1)" }, - { 62, "Cellular/Wireless PCS (Type 2)" }, - { 63, "Cellular/Wireless PCS (Roaming)" }, - { 66, "TRS call from hotel/motel" }, - { 67, "TRS call from restricted line" }, - { 70, "Line connected to pay station" }, - { 93, "Private virtual network call" }, - }; - return code2str(info, lineinfo, sizeof(lineinfo) / sizeof(lineinfo[0])); -} - -static FUNC_DUMP(dump_line_information) -{ - pri_message(pri, "%c Originating Line Information (len=%02d): %s (%d)\n", prefix, len, lineinfo2str(ie->data[0]), ie->data[0]); -} - -static FUNC_RECV(receive_line_information) -{ - call->ani2 = ie->data[0]; - return 0; -} - -static FUNC_SEND(transmit_line_information) -{ -#if 0 /* XXX Is this IE possible for 4ESS only? XXX */ - if(pri->switchtype == PRI_SWITCH_ATT4ESS) { - ie->data[0] = 0; - return 3; - } -#endif - return 0; -} - - -static char *gdencoding2str(int encoding) -{ - static struct msgtype gdencoding[] = { - { 0, "BCD even" }, - { 1, "BCD odd" }, - { 2, "IA5" }, - { 3, "Binary" }, - }; - return code2str(encoding, gdencoding, sizeof(gdencoding) / sizeof(gdencoding[0])); -} - -static char *gdtype2str(int type) -{ - static struct msgtype gdtype[] = { - { 0, "Account Code" }, - { 1, "Auth Code" }, - { 2, "Customer ID" }, - { 3, "Universal Access" }, - { 4, "Info Digits" }, - { 5, "Callid" }, - { 6, "Opart" }, - { 7, "TCN" }, - { 9, "Adin" }, - }; - return code2str(type, gdtype, sizeof(gdtype) / sizeof(gdtype[0])); -} - -static FUNC_DUMP(dump_generic_digits) -{ - int encoding; - int type; - int idx; - int value; - if (len < 3) { - pri_message(pri, "%c Generic Digits (len=%02d): Invalid length\n", prefix, len); - return; - } - encoding = (ie->data[0] >> 5) & 7; - type = ie->data[0] & 0x1F; - pri_message(pri, "%c Generic Digits (len=%02d): Encoding %s Type %s\n", prefix, len, gdencoding2str(encoding), gdtype2str(type)); - if (encoding == 3) { /* Binary */ - pri_message(pri, "%c Don't know how to handle binary encoding\n"); - return; - } - if (len == 3) /* No number information */ - return; - pri_message(pri, "%c Digits: "); - value = 0; - for(idx = 3; idx < len; ++idx) { - switch(encoding) { - case 0: /* BCD even */ - case 1: /* BCD odd */ - pri_message(pri, "%d", ie->data[idx-2] & 0x0f); - value = value * 10 + (ie->data[idx-2] & 0x0f); - if(!encoding || (idx+1 < len)) { /* Special handling for BCD odd */ - pri_message(pri, "%d", (ie->data[idx-2] >> 4) & 0x0f); - value = value * 10 + ((ie->data[idx-2] >> 4) & 0x0f); - } - break; - case 2: /* IA5 */ - pri_message(pri, "%c", ie->data[idx-2]); - value = value * 10 + ie->data[idx-2] - '0'; - break; - } - } - switch(type) { - case 4: /* Info Digits */ - pri_message(pri, " - %s", lineinfo2str(value)); - break; - } - pri_message(pri, "\n"); -} - -static FUNC_RECV(receive_generic_digits) -{ - int encoding; - int type; - int idx; - int value; - int num_idx; - char number[260]; - - if (len < 3) { - pri_error(pri, "Invalid length of Generic Digits IE\n"); - return -1; - } - encoding = (ie->data[0] >> 5) & 7; - type = ie->data[0] & 0x1F; - if (encoding == 3) { /* Binary */ - pri_message(pri, "!! Unable to handle binary encoded Generic Digits IE\n"); - return 0; - } - if (len == 3) /* No number information */ - return 0; - value = 0; - switch(type) { - /* Integer value handling */ - case 4: /* Info Digits */ - for(idx = 3; idx < len; ++idx) { - switch(encoding) { - case 0: /* BCD even */ - case 1: /* BCD odd */ - value = value * 10 + (ie->data[idx-2] & 0x0f); - if(!encoding || (idx+1 < len)) /* Special handling for BCD odd */ - value = value * 10 + ((ie->data[idx-2] >> 4) & 0x0f); - break; - case 2: /* IA5 */ - value = value * 10 + (ie->data[idx-2] - '0'); - break; - } - } - break; - /* String value handling */ - case 5: /* Callid */ - num_idx = 0; - for(idx = 3; (idx < len) && (num_idx < sizeof(number) - 4); ++idx) { - switch(encoding) { - case 0: /* BCD even */ - case 1: /* BCD odd */ - number[num_idx++] = '0' + (ie->data[idx-2] & 0x0f); - if(!encoding || (idx+1 < len)) /* Special handling for BCD odd */ - number[num_idx++] = '0' + ((ie->data[idx-2] >> 4) & 0x0f); - break; - case 2: - number[num_idx++] = ie->data[idx-2]; - break; - } - } - number[num_idx] = '\0'; - break; - } - switch(type) { - case 4: /* Info Digits */ - call->ani2 = value; - break; -#if 0 - case 5: /* Callid */ - if (!call->callernum[0]) { - memcpy(call->callernum, number, sizeof(call->callernum)-1); - call->callerpres = 0; - call->callerplan = 0; - } - break; -#endif - } - return 0; -} - -static FUNC_SEND(transmit_generic_digits) -{ -#if 0 /* XXX Is this IE possible for other switches? XXX */ - if (order > 1) - return 0; - - if(pri->switchtype == PRI_SWITCH_NI1) { - ie->data[0] = 0x04; /* BCD even, Info Digits */ - ie->data[1] = 0x00; /* POTS */ - return 4; - } -#endif - return 0; -} - - -static char *signal2str(int signal) -{ - /* From Q.931 4.5.8 Table 4-24 */ - static struct msgtype mtsignal[] = { - { 0, "Dial tone" }, - { 1, "Ring back tone" }, - { 2, "Intercept tone" }, - { 3, "Network congestion tone" }, - { 4, "Busy tone" }, - { 5, "Confirm tone" }, - { 6, "Answer tone" }, - { 7, "Call waiting tone" }, - { 8, "Off-hook warning tone" }, - { 9, "Pre-emption tone" }, - { 63, "Tones off" }, - { 64, "Alerting on - pattern 0" }, - { 65, "Alerting on - pattern 1" }, - { 66, "Alerting on - pattern 2" }, - { 67, "Alerting on - pattern 3" }, - { 68, "Alerting on - pattern 4" }, - { 69, "Alerting on - pattern 5" }, - { 70, "Alerting on - pattern 6" }, - { 71, "Alerting on - pattern 7" }, - { 79, "Alerting off" }, - }; - return code2str(signal, mtsignal, sizeof(mtsignal) / sizeof(mtsignal[0])); -} - - -static FUNC_DUMP(dump_signal) -{ - pri_message(pri, "%c Signal (len=%02d): ", prefix, len); - if (len < 3) { - pri_message(pri, "Invalid length\n"); - return; - } - pri_message(pri, "Signal %s (%d)\n", signal2str(ie->data[0]), ie->data[0]); -} - -static FUNC_DUMP(dump_transit_count) -{ - /* Defined in ECMA-225 */ - pri_message(pri, "%c Transit Count (len=%02d): ", prefix, len); - if (len < 3) { - pri_message(pri, "Invalid length\n"); - return; - } - pri_message(pri, "Count=%d (0x%02x)\n", ie->data[0] & 0x1f, ie->data[0] & 0x1f); -} - - -static struct ie ies[] = { - /* Codeset 0 - Common */ - { 1, NATIONAL_CHANGE_STATUS, "Change Status" }, - { 0, Q931_LOCKING_SHIFT, "Locking Shift", dump_shift }, - { 0, Q931_BEARER_CAPABILITY, "Bearer Capability", dump_bearer_capability, receive_bearer_capability, transmit_bearer_capability }, - { 0, Q931_CAUSE, "Cause", dump_cause, receive_cause, transmit_cause }, - { 1, Q931_CALL_STATE, "Call State", dump_call_state, receive_call_state, transmit_call_state }, - { 0, Q931_CHANNEL_IDENT, "Channel Identification", dump_channel_id, receive_channel_id, transmit_channel_id }, - { 0, Q931_PROGRESS_INDICATOR, "Progress Indicator", dump_progress_indicator, receive_progress_indicator, transmit_progress_indicator }, - { 0, Q931_NETWORK_SPEC_FAC, "Network-Specific Facilities", dump_network_spec_fac, receive_network_spec_fac, transmit_network_spec_fac }, - { 1, Q931_INFORMATION_RATE, "Information Rate" }, - { 1, Q931_TRANSIT_DELAY, "End-to-End Transit Delay" }, - { 1, Q931_TRANS_DELAY_SELECT, "Transmit Delay Selection and Indication" }, - { 1, Q931_BINARY_PARAMETERS, "Packet-layer Binary Parameters" }, - { 1, Q931_WINDOW_SIZE, "Packet-layer Window Size" }, - { 1, Q931_CLOSED_USER_GROUP, "Closed User Group" }, - { 1, Q931_REVERSE_CHARGE_INDIC, "Reverse Charging Indication" }, - { 1, Q931_CALLING_PARTY_NUMBER, "Calling Party Number", dump_calling_party_number, receive_calling_party_number, transmit_calling_party_number }, - { 1, Q931_CALLING_PARTY_SUBADDR, "Calling Party Subaddress", dump_calling_party_subaddr, receive_calling_party_subaddr }, - { 1, Q931_CALLED_PARTY_NUMBER, "Called Party Number", dump_called_party_number, receive_called_party_number, transmit_called_party_number }, - { 1, Q931_CALLED_PARTY_SUBADDR, "Called Party Subaddress", dump_called_party_subaddr }, - { 0, Q931_REDIRECTING_NUMBER, "Redirecting Number", dump_redirecting_number, receive_redirecting_number, transmit_redirecting_number }, - { 1, Q931_REDIRECTING_SUBADDR, "Redirecting Subaddress", dump_redirecting_subaddr }, - { 0, Q931_TRANSIT_NET_SELECT, "Transit Network Selection" }, - { 1, Q931_RESTART_INDICATOR, "Restart Indicator", dump_restart_indicator, receive_restart_indicator, transmit_restart_indicator }, - { 0, Q931_LOW_LAYER_COMPAT, "Low-layer Compatibility" }, - { 0, Q931_HIGH_LAYER_COMPAT, "High-layer Compatibility" }, - { 1, Q931_PACKET_SIZE, "Packet Size" }, - { 0, Q931_IE_FACILITY, "Facility" , dump_facility, receive_facility, transmit_facility }, - { 1, Q931_IE_REDIRECTION_NUMBER, "Redirection Number" }, - { 1, Q931_IE_REDIRECTION_SUBADDR, "Redirection Subaddress" }, - { 1, Q931_IE_FEATURE_ACTIVATE, "Feature Activation" }, - { 1, Q931_IE_INFO_REQUEST, "Feature Request" }, - { 1, Q931_IE_FEATURE_IND, "Feature Indication" }, - { 1, Q931_IE_SEGMENTED_MSG, "Segmented Message" }, - { 1, Q931_IE_CALL_IDENTITY, "Call Identity", dump_call_identity }, - { 1, Q931_IE_ENDPOINT_ID, "Endpoint Identification" }, - { 1, Q931_IE_NOTIFY_IND, "Notification Indicator", dump_notify, receive_notify, transmit_notify }, - { 1, Q931_DISPLAY, "Display", dump_display, receive_display, transmit_display }, - { 1, Q931_IE_TIME_DATE, "Date/Time", dump_time_date }, - { 1, Q931_IE_KEYPAD_FACILITY, "Keypad Facility", dump_keypad_facility, receive_keypad_facility, transmit_keypad_facility }, - { 0, Q931_IE_SIGNAL, "Signal", dump_signal }, - { 1, Q931_IE_SWITCHHOOK, "Switch-hook" }, - { 1, Q931_IE_USER_USER, "User-User", dump_user_user, receive_user_user, transmit_user_user }, - { 1, Q931_IE_ESCAPE_FOR_EXT, "Escape for Extension" }, - { 1, Q931_IE_CALL_STATUS, "Call Status" }, - { 1, Q931_IE_CHANGE_STATUS, "Change Status" }, - { 1, Q931_IE_CONNECTED_ADDR, "Connected Number", dump_connected_number }, - { 1, Q931_IE_CONNECTED_NUM, "Connected Number", dump_connected_number }, - { 1, Q931_IE_ORIGINAL_CALLED_NUMBER, "Original Called Number", dump_redirecting_number, receive_redirecting_number, transmit_redirecting_number }, - { 1, Q931_IE_USER_USER_FACILITY, "User-User Facility" }, - { 1, Q931_IE_UPDATE, "Update" }, - { 1, Q931_SENDING_COMPLETE, "Sending Complete", dump_sending_complete, receive_sending_complete, transmit_sending_complete }, - /* Codeset 4 - Q.SIG specific */ - { 1, QSIG_IE_TRANSIT_COUNT | Q931_CODESET(4), "Transit Count", dump_transit_count }, - /* Codeset 6 - Network specific */ - { 1, Q931_IE_ORIGINATING_LINE_INFO, "Originating Line Information", dump_line_information, receive_line_information, transmit_line_information }, - { 1, Q931_IE_FACILITY | Q931_CODESET(6), "Facility", dump_facility, receive_facility, transmit_facility }, - { 1, Q931_DISPLAY | Q931_CODESET(6), "Display (CS6)", dump_display, receive_display, transmit_display }, - { 0, Q931_IE_GENERIC_DIGITS, "Generic Digits", dump_generic_digits, receive_generic_digits, transmit_generic_digits }, - /* Codeset 7 */ -}; - -static char *ie2str(int ie) -{ - unsigned int x; - - /* Special handling for Locking/Non-Locking Shifts */ - switch (ie & 0xf8) { - case Q931_LOCKING_SHIFT: - switch (ie & 7) { - case 0: - return "!! INVALID Locking Shift To Codeset 0"; - case 1: - return "Locking Shift To Codeset 1"; - case 2: - return "Locking Shift To Codeset 2"; - case 3: - return "Locking Shift To Codeset 3"; - case 4: - return "Locking Shift To Codeset 4"; - case 5: - return "Locking Shift To Codeset 5"; - case 6: - return "Locking Shift To Codeset 6"; - case 7: - return "Locking Shift To Codeset 7"; - } - case Q931_NON_LOCKING_SHIFT: - switch (ie & 7) { - case 0: - return "Non-Locking Shift To Codeset 0"; - case 1: - return "Non-Locking Shift To Codeset 1"; - case 2: - return "Non-Locking Shift To Codeset 2"; - case 3: - return "Non-Locking Shift To Codeset 3"; - case 4: - return "Non-Locking Shift To Codeset 4"; - case 5: - return "Non-Locking Shift To Codeset 5"; - case 6: - return "Non-Locking Shift To Codeset 6"; - case 7: - return "Non-Locking Shift To Codeset 7"; - } - default: - for (x=0;xie & 0x80) != 0) - return 1; - else - return 2 + ie->len; -} - -static char *msg2str(int msg) -{ - unsigned int x; - for (x=0;xcrlen > 3) { - pri_error(NULL, "Call Reference Length Too long: %d\n", h->crlen); - return -1; - } - switch (h->crlen) { - case 2: - for (x=0;xcrlen;x++) { - cr <<= 8; - cr |= h->crv[x]; - } - break; - case 1: - cr = h->crv[0]; - if (cr & 0x80) { - cr &= ~0x80; - cr |= 0x8000; - } - break; - default: - pri_error(NULL, "Call Reference Length not supported: %d\n", h->crlen); - } - return cr; -} - -static inline void q931_dumpie(struct pri *pri, int codeset, q931_ie *ie, char prefix) -{ - unsigned int x; - int full_ie = Q931_FULL_IE(codeset, ie->ie); - int base_ie; - char *buf = malloc(ielen(ie) * 3 + 1); - int buflen = 0; - - buf[0] = '\0'; - if (!(ie->ie & 0x80)) { - buflen += sprintf(buf, " %02x", ielen(ie)-2); - for (x = 0; x + 2 < ielen(ie); ++x) - buflen += sprintf(buf + buflen, " %02x", ie->data[x]); - } - pri_message(pri, "%c [%02x%s]\n", prefix, ie->ie, buf); - free(buf); - - /* Special treatment for shifts */ - if((full_ie & 0xf0) == Q931_LOCKING_SHIFT) - full_ie &= 0xff; - - base_ie = (((full_ie & ~0x7f) == Q931_FULL_IE(0, 0x80)) && ((full_ie & 0x70) != 0x20)) ? full_ie & ~0x0f : full_ie; - - for (x=0;xmaster) - master = pri->master; - else - master = pri; - - cur = *master->callpool; - prev = NULL; - while(cur) { - if (cur->cr == cr) - return cur; - prev = cur; - cur = cur->next; - } - /* No call exists, make a new one */ - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "-- Making new call for cr %d\n", cr); - - if (!(cur = calloc(1, sizeof(*cur)))) - return NULL; - - call_init(cur); - /* Call reference */ - cur->cr = cr; - /* PRI is set to whoever called us */ - if (pri->bri && (pri->localtype == PRI_CPE) && pri->subchannel && outboundnew) - cur->pri = pri->subchannel; - else - cur->pri = pri; - - /* Append to end of list */ - if (prev) - prev->next = cur; - else - *master->callpool = cur; - - return cur; -} - -q931_call *q931_new_call(struct pri *pri) -{ - q931_call *cur; - - do { - cur = *pri->callpool; - pri->cref++; - if (!pri->bri) { - if (pri->cref > 32767) - pri->cref = 1; - } else { - if (pri->cref > 127) - pri->cref = 1; - } - while(cur) { - if (cur->cr == (0x8000 | pri->cref)) - break; - cur = cur->next; - } - } while(cur); - - return q931_getcall(pri, pri->cref | 0x8000, 1); -} - -static void q931_destroy(struct pri *pri, int cr, q931_call *c) -{ - q931_call *cur, *prev; - - /* For destroying, make sure we are using the master span, since it maintains the call pool */ - for (;pri->master; pri = pri->master); - - prev = NULL; - cur = *pri->callpool; - while(cur) { - if ((c && (cur == c)) || (!c && (cur->cr == cr))) { - if (prev) - prev->next = cur->next; - else - *pri->callpool = cur->next; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "NEW_HANGUP DEBUG: Destroying the call, ourstate %s, peerstate %s\n",callstate2str(cur->ourcallstate),callstate2str(cur->peercallstate)); - if (cur->retranstimer) - pri_schedule_del(pri, cur->retranstimer); - pri_call_apdu_queue_cleanup(cur); - free(cur); - return; - } - prev = cur; - cur = cur->next; - } - pri_error(pri, "Can't destroy call %d!\n", cr); -} - -static void q931_destroycall(struct pri *pri, int cr) -{ - return q931_destroy(pri, cr, NULL); -} - - -void __q931_destroycall(struct pri *pri, q931_call *c) -{ - if (pri && c) - q931_destroy(pri,0, c); - return; -} - -static int add_ie(struct pri *pri, q931_call *call, int msgtype, int ie, q931_ie *iet, int maxlen, int *codeset) -{ - unsigned int x; - int res, total_res; - int have_shift; - int ies_count, order; - for (x=0;xie = Q931_IE_CODESET(ies[x].ie) | (Q931_IE_CODESET(ies[x].ie) ? Q931_LOCKING_SHIFT : Q931_NON_LOCKING_SHIFT); - have_shift = 1; - iet = (q931_ie *)((char *)iet + 1); - maxlen--; - } - else - have_shift = 0; - ies_count = ies[x].max_count; - if (ies_count == 0) - ies_count = INT_MAX; - order = 0; - total_res = 0; - do { - iet->ie = ie; - res = ies[x].transmit(ie, pri, call, msgtype, iet, maxlen, ++order); - /* Error if res < 0 or ignored if res == 0 */ - if (res < 0) - return res; - if (res > 0) { - if ((iet->ie & 0x80) == 0) /* Multibyte IE */ - iet->len = res - 2; - total_res += res; - maxlen -= res; - iet = (q931_ie *)((char *)iet + res); - } - } - while (res > 0 && order < ies_count); - if (have_shift && total_res) { - if (Q931_IE_CODESET(ies[x].ie)) - *codeset = Q931_IE_CODESET(ies[x].ie); - return total_res + 1; /* Shift is single-byte IE */ - } - return total_res; - } else { - pri_error(pri, "!! Don't know how to add an IE %s (%d)\n", ie2str(ie), ie); - return -1; - } - } - } - pri_error(pri, "!! Unknown IE %d (%s)\n", ie, ie2str(ie)); - return -1; -} - -static char *disc2str(int disc) -{ - static struct msgtype discs[] = { - { Q931_PROTOCOL_DISCRIMINATOR, "Q.931" }, - { GR303_PROTOCOL_DISCRIMINATOR, "GR-303" }, - { 0x3, "AT&T Maintenance" }, - { 0x43, "New AT&T Maintenance" }, - }; - return code2str(disc, discs, sizeof(discs) / sizeof(discs[0])); -} - -void q931_dump(struct pri *pri, q931_h *h, int len, int txrx) -{ - q931_mh *mh; - char c; - int x=0, r; - int cur_codeset; - int codeset; - c = txrx ? '>' : '<'; - pri_message(pri, "%c Protocol Discriminator: %s (%d) len=%d\n", c, disc2str(h->pd), h->pd, len); - pri_message(pri, "%c Call Ref: len=%2d (reference %d/0x%X) (%s)\n", c, h->crlen, q931_cr(h) & 0x7FFF, q931_cr(h) & 0x7FFF, (h->crv[0] & 0x80) ? "Terminator" : "Originator"); - /* Message header begins at the end of the call reference number */ - mh = (q931_mh *)(h->contents + h->crlen); - pri_message(pri, "%c Message type: %s (%d)\n", c, msg2str(mh->msg), mh->msg); - /* Drop length of header, including call reference */ - len -= (h->crlen + 3); - codeset = cur_codeset = 0; - while(x < len) { - r = ielen((q931_ie *)(mh->data + x)); - q931_dumpie(pri, cur_codeset, (q931_ie *)(mh->data + x), c); - switch (mh->data[x] & 0xf8) { - case Q931_LOCKING_SHIFT: - if ((mh->data[x] & 7) > 0) - codeset = cur_codeset = mh->data[x] & 7; - break; - case Q931_NON_LOCKING_SHIFT: - cur_codeset = mh->data[x] & 7; - break; - default: - /* Reset temporary codeset change */ - cur_codeset = codeset; - } - x += r; - } - if (x > len) - pri_error(pri, "XXX Message longer than it should be?? XXX\n"); -} - -static int q931_handle_ie(int codeset, struct pri *pri, q931_call *c, int msg, q931_ie *ie) -{ - unsigned int x; - int full_ie = Q931_FULL_IE(codeset, ie->ie); - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "-- Processing IE %d (cs%d, %s)\n", ie->ie, codeset, ie2str(full_ie)); - for (x=0;xdebug & PRI_DEBUG_Q931_ANOMALY) - pri_error(pri, "!! No handler for IE %d (cs%d, %s)\n", ie->ie, codeset, ie2str(full_ie)); - return -1; - } - } - } - pri_message(pri, "!! Unknown IE %d (cs%d, %s)\n", ie->ie, codeset, ie2str(full_ie)); - return -1; -} - -static void init_header(struct pri *pri, q931_call *call, unsigned char *buf, q931_h **hb, q931_mh **mhb, int *len) -{ - /* Returns header and message header and modifies length in place */ - q931_h *h = (q931_h *)buf; - q931_mh * mh; - h->pd = pri->protodisc; - h->x0 = 0; /* Reserved 0 */ - if (!pri->bri) { - h->crlen = 2; /* Two bytes of Call Reference. Invert the top bit to make it from our sense */ - if (call->cr || call->forceinvert) { - h->crv[0] = ((call->cr ^ 0x8000) & 0xff00) >> 8; - h->crv[1] = (call->cr & 0xff); - } else { - /* Unless of course this has no call reference */ - h->crv[0] = 0; - h->crv[1] = 0; - } - if (pri->subchannel && !pri->bri) { - /* On GR-303, top bit is always 0 */ - h->crv[0] &= 0x7f; - } - } else { - h->crlen = 1; - if (call->cr || call->forceinvert) { - h->crv[0] = (((call->cr ^ 0x8000) & 0x8000) >> 8) | (call->cr & 0x7f); - } else { - /* Unless of course this has no call reference */ - h->crv[0] = 0; - } - } - mh = (q931_mh *)(h->contents + h->crlen); - mh->f = 0; - *hb = h; - *mhb = mh; - if (h->crlen == 2) - *len -= 5; - else - *len -= 4; - -} - -static int q931_xmit(struct pri *pri, q931_h *h, int len, int cr) -{ - q921_transmit_iframe(pri, h, len, cr); - /* The transmit operation might dump the q921 header, so logging the q931 - message body after the transmit puts the sections of the message in the - right order in the log */ - if (pri->debug & PRI_DEBUG_Q931_DUMP) - q931_dump(pri, h, len, 1); -#ifdef LIBPRI_COUNTERS - pri->q931_txcount++; -#endif - return 0; -} - -static int send_message(struct pri *pri, q931_call *c, int msgtype, int ies[]) -{ - unsigned char buf[1024]; - q931_h *h; - q931_mh *mh; - int len; - int res; - int offset=0; - int x; - int codeset; - - memset(buf, 0, sizeof(buf)); - len = sizeof(buf); - init_header(pri, c, buf, &h, &mh, &len); - mh->msg = msgtype; - x=0; - codeset = 0; - while(ies[x] > -1) { - res = add_ie(pri, c, mh->msg, ies[x], (q931_ie *)(mh->data + offset), len, &codeset); - - if (res < 0) { - pri_error(pri, "!! Unable to add IE '%s'\n", ie2str(ies[x])); - return -1; - } - - offset += res; - len -= res; - x++; - } - /* Invert the logic */ - len = sizeof(buf) - len; - q931_xmit(c->pri, h, len, 1); - c->acked = 1; - return 0; -} - -static int status_ies[] = { Q931_CAUSE, Q931_CALL_STATE, -1 }; - -static int q931_status(struct pri *pri, q931_call *c, int cause) -{ - q931_call *cur = NULL; - if (!cause) - cause = PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY; - if (c->cr > -1) - cur = *pri->callpool; - while(cur) { - if (cur->cr == c->cr) { - cur->cause=cause; - cur->causecode = CODE_CCITT; - cur->causeloc = LOC_USER; - break; - } - cur = cur->next; - } - if (!cur) { - pri_message(pri, "YYY Here we get reset YYY\n"); - /* something went wrong, respond with "no such call" */ - c->ourcallstate = Q931_CALL_STATE_NULL; - c->peercallstate = Q931_CALL_STATE_NULL; - cur=c; - } - return send_message(pri, cur, Q931_STATUS, status_ies); -} - -static int information_ies[] = { Q931_IE_KEYPAD_FACILITY, Q931_CALLED_PARTY_NUMBER, -1 }; - -int q931_information(struct pri *pri, q931_call *c, char digit) -{ - c->callednum[0] = digit; - c->callednum[1] = '\0'; - return send_message(pri, c, Q931_INFORMATION, information_ies); -} - -static int keypad_facility_ies[] = { Q931_IE_KEYPAD_FACILITY, -1 }; - -int q931_keypad_facility(struct pri *pri, q931_call *call, char *digits) -{ - libpri_copy_string(call->keypad_digits, digits, sizeof(call->keypad_digits)); - return send_message(pri, call, Q931_INFORMATION, keypad_facility_ies); -} - -static int restart_ack_ies[] = { Q931_CHANNEL_IDENT, Q931_RESTART_INDICATOR, -1 }; - -static int restart_ack(struct pri *pri, q931_call *c) -{ - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - c->peercallstate = Q931_CALL_STATE_NULL; - return send_message(pri, c, Q931_RESTART_ACKNOWLEDGE, restart_ack_ies); -} - -static int facility_ies[] = { Q931_IE_FACILITY, -1 }; - -int q931_facility(struct pri*pri, q931_call *c) -{ - return send_message(pri, c, Q931_FACILITY, facility_ies); -} - -static int notify_ies[] = { Q931_IE_NOTIFY_IND, -1 }; - -int q931_notify(struct pri *pri, q931_call *c, int channel, int info) -{ - if ((pri->switchtype == PRI_SWITCH_EUROISDN_T1) || (pri->switchtype != PRI_SWITCH_EUROISDN_E1)) { - if ((info > 0x2) || (info < 0x00)) - return 0; - } - - if (info >= 0) - c->notify = info & 0x7F; - else - c->notify = -1; - return send_message(pri, c, Q931_NOTIFY, notify_ies); -} - -#ifdef ALERTING_NO_PROGRESS -static int call_progress_ies[] = { -1 }; -#else -static int call_progress_ies[] = { Q931_PROGRESS_INDICATOR, -1 }; -#endif - -int q931_call_progress(struct pri *pri, q931_call *c, int channel, int info) -{ - if (channel) { - c->ds1no = (channel & 0xff00) >> 8; - c->ds1explicit = (channel & 0x10000) >> 16; - channel &= 0xff; - c->channelno = channel; - } - if (info) { - c->progloc = LOC_PRIV_NET_LOCAL_USER; - c->progcode = CODE_CCITT; - c->progressmask = PRI_PROG_INBAND_AVAILABLE; - } else { - /* PI is mandatory IE for PROGRESS message - Q.931 3.1.8 */ - pri_error(pri, "XXX Progress message requested but no information is provided\n"); - c->progressmask = 0; - } - c->alive = 1; - return send_message(pri, c, Q931_PROGRESS, call_progress_ies); -} - -#ifdef ALERTING_NO_PROGRESS -static int call_proceeding_ies[] = { Q931_CHANNEL_IDENT, -1 }; -#else -static int call_proceeding_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 }; -#endif - -int q931_call_proceeding(struct pri *pri, q931_call *c, int channel, int info) -{ - if (channel) { - c->ds1no = (channel & 0xff00) >> 8; - c->ds1explicit = (channel & 0x10000) >> 16; - channel &= 0xff; - c->channelno = channel; - } - c->chanflags &= ~FLAG_PREFERRED; - c->chanflags |= FLAG_EXCLUSIVE; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_INCOMING_CALL_PROCEEDING); - c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING; - if (info) { - c->progloc = LOC_PRIV_NET_LOCAL_USER; - c->progcode = CODE_CCITT; - c->progressmask = PRI_PROG_INBAND_AVAILABLE; - } else - c->progressmask = 0; - c->proc = 1; - c->alive = 1; - return send_message(pri, c, Q931_CALL_PROCEEDING, call_proceeding_ies); -} -#ifndef ALERTING_NO_PROGRESS -static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, Q931_IE_USER_USER, -1 }; -#else -static int alerting_ies[] = { -1 }; -#endif - -int q931_alerting(struct pri *pri, q931_call *c, int channel, int info) -{ - if (!c->proc) - q931_call_proceeding(pri, c, channel, 0); - if (info) { - c->progloc = LOC_PRIV_NET_LOCAL_USER; - c->progcode = CODE_CCITT; - c->progressmask = PRI_PROG_INBAND_AVAILABLE; - } else - c->progressmask = 0; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CALL_RECEIVED); - c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED; - c->alive = 1; - return send_message(pri, c, Q931_ALERTING, alerting_ies); -} - -static int connect_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 }; - -int q931_setup_ack(struct pri *pri, q931_call *c, int channel, int nonisdn) -{ - if (channel) { - c->ds1no = (channel & 0xff00) >> 8; - c->ds1explicit = (channel & 0x10000) >> 16; - channel &= 0xff; - c->channelno = channel; - } - c->chanflags &= ~FLAG_PREFERRED; - c->chanflags |= FLAG_EXCLUSIVE; - if (nonisdn && (pri->switchtype != PRI_SWITCH_DMS100)) { - c->progloc = LOC_PRIV_NET_LOCAL_USER; - c->progcode = CODE_CCITT; - c->progressmask = PRI_PROG_CALLED_NOT_ISDN; - } else - c->progressmask = 0; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_OVERLAP_RECEIVING); - c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING; - c->alive = 1; - return send_message(pri, c, Q931_SETUP_ACKNOWLEDGE, connect_ies); -} - -/* T313 expiry, first time */ -static void pri_connect_timeout(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "Timed out looking for connect acknowledge\n"); - q931_disconnect(pri, c, PRI_CAUSE_NORMAL_CLEARING); - -} - -/* T308 expiry, first time */ -static void pri_release_timeout(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "Timed out looking for release complete\n"); - c->t308_timedout++; - c->alive = 1; - - /* The call to q931_release will re-schedule T308 */ - q931_release(pri, c, c->cause); -} - -/* T308 expiry, second time */ -static void pri_release_finaltimeout(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - c->alive = 1; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "Final time-out looking for release complete\n"); - c->t308_timedout++; - c->ourcallstate = Q931_CALL_STATE_NULL; - c->peercallstate = Q931_CALL_STATE_NULL; - pri->schedev = 1; - pri->ev.e = PRI_EVENT_HANGUP_ACK; - pri->ev.hangup.channel = c->channelno; - pri->ev.hangup.cause = c->cause; - pri->ev.hangup.cref = c->cr; - pri->ev.hangup.call = c; - pri->ev.hangup.aoc_units = c->aoc_units; - libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo)); - q931_hangup(pri, c, c->cause); -} - -/* T305 expiry, first time */ -static void pri_disconnect_timeout(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "Timed out looking for release\n"); - c->alive = 1; - q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING); -} - -int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn) -{ - if (channel) { - c->ds1no = (channel & 0xff00) >> 8; - c->ds1explicit = (channel & 0x10000) >> 16; - channel &= 0xff; - c->channelno = channel; - } - c->chanflags &= ~FLAG_PREFERRED; - c->chanflags |= FLAG_EXCLUSIVE; - if (nonisdn && (pri->switchtype != PRI_SWITCH_DMS100)) { - c->progloc = LOC_PRIV_NET_LOCAL_USER; - c->progcode = CODE_CCITT; - c->progressmask = PRI_PROG_CALLED_NOT_ISDN; - } else - c->progressmask = 0; - if(pri->localtype == PRI_NETWORK || pri->switchtype == PRI_SWITCH_QSIG) - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE); - else - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CONNECT_REQUEST); - c->peercallstate = Q931_CALL_STATE_ACTIVE; - c->alive = 1; - /* Connect request timer */ - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - c->retranstimer = 0; - if ((c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && (pri->bri || (!pri->subchannel))) - c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T313], pri_connect_timeout, c); - return send_message(pri, c, Q931_CONNECT, connect_ies); -} - -static int release_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 }; - -int q931_release(struct pri *pri, q931_call *c, int cause) -{ - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_RELEASE_REQUEST); - /* c->peercallstate stays the same */ - if (c->alive) { - c->alive = 0; - c->cause = cause; - c->causecode = CODE_CCITT; - c->causeloc = LOC_PRIV_NET_LOCAL_USER; - if (c->acked) { - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - if (!c->t308_timedout) { - c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T308], pri_release_timeout, c); - } else { - c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T308], pri_release_finaltimeout, c); - } - return send_message(pri, c, Q931_RELEASE, release_ies); - } else - return send_message(pri, c, Q931_RELEASE_COMPLETE, release_ies); /* Yes, release_ies, not release_complete_ies */ - } else - return 0; -} - -static int restart_ies[] = { Q931_CHANNEL_IDENT, Q931_RESTART_INDICATOR, -1 }; - -int q931_restart(struct pri *pri, int channel) -{ - struct q931_call *c; - c = q931_getcall(pri, 0 | 0x8000, 0); - if (!c) - return -1; - if (!channel) - return -1; - c->ri = 0; - c->ds1no = (channel & 0xff00) >> 8; - c->ds1explicit = (channel & 0x10000) >> 16; - channel &= 0xff; - c->channelno = channel; - c->chanflags &= ~FLAG_PREFERRED; - c->chanflags |= FLAG_EXCLUSIVE; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_RESTART); - c->peercallstate = Q931_CALL_STATE_RESTART_REQUEST; - return send_message(pri, c, Q931_RESTART, restart_ies); -} - -static int disconnect_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 }; - -int q931_disconnect(struct pri *pri, q931_call *c, int cause) -{ - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_DISCONNECT_REQUEST); - c->peercallstate = Q931_CALL_STATE_DISCONNECT_INDICATION; - if (c->alive) { - c->alive = 0; - c->cause = cause; - c->causecode = CODE_CCITT; - c->causeloc = LOC_PRIV_NET_LOCAL_USER; - c->sendhangupack = 1; - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - c->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T305], pri_disconnect_timeout, c); - return send_message(pri, c, Q931_DISCONNECT, disconnect_ies); - } else - return 0; -} - -static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY, - Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_REDIRECTING_NUMBER, Q931_IE_USER_USER, Q931_SENDING_COMPLETE, - Q931_IE_ORIGINATING_LINE_INFO, Q931_IE_GENERIC_DIGITS, -1 }; - -static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 }; - -static int cis_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_CALLED_PARTY_NUMBER, -1 }; - -int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req) -{ - int res; - - - c->transcapability = req->transmode; - c->transmoderate = TRANS_MODE_64_CIRCUIT; - if (!req->userl1) - req->userl1 = PRI_LAYER_1_ULAW; - c->userl1 = req->userl1; - c->userl2 = -1; - c->userl3 = -1; - c->ds1no = (req->channel & 0xff00) >> 8; - c->ds1explicit = (req->channel & 0x10000) >> 16; - req->channel &= 0xff; - if ((pri->localtype == PRI_CPE) && pri->subchannel && !pri->bri) { - req->channel = 0; - req->exclusive = 0; - } - - c->channelno = req->channel; - c->slotmap = -1; - c->nonisdn = req->nonisdn; - c->newcall = 0; - c->justsignalling = req->justsignalling; - c->complete = req->numcomplete; - if (req->exclusive) - c->chanflags = FLAG_EXCLUSIVE; - else if (c->channelno) - c->chanflags = FLAG_PREFERRED; - if (req->caller) { - libpri_copy_string(c->callernum, req->caller, sizeof(c->callernum)); - c->callerplan = req->callerplan; - if (req->callername) - libpri_copy_string(c->callername, req->callername, sizeof(c->callername)); - else - c->callername[0] = '\0'; - if ((pri->switchtype == PRI_SWITCH_DMS100) || - (pri->switchtype == PRI_SWITCH_ATT4ESS)) { - /* Doesn't like certain presentation types */ - if (!(req->callerpres & 0x7c)) - req->callerpres = PRES_ALLOWED_NETWORK_NUMBER; - } - c->callerpres = req->callerpres; - } else { - c->callernum[0] = '\0'; - c->callername[0] = '\0'; - c->callerplan = PRI_UNKNOWN; - c->callerpres = PRES_NUMBER_NOT_AVAILABLE; - } - if (req->redirectingnum) { - libpri_copy_string(c->redirectingnum, req->redirectingnum, sizeof(c->redirectingnum)); - c->redirectingplan = req->redirectingplan; - if ((pri->switchtype == PRI_SWITCH_DMS100) || - (pri->switchtype == PRI_SWITCH_ATT4ESS)) { - /* Doesn't like certain presentation types */ - if (!(req->redirectingpres & 0x7c)) - req->redirectingpres = PRES_ALLOWED_NETWORK_NUMBER; - } - c->redirectingpres = req->redirectingpres; - c->redirectingreason = req->redirectingreason; - } else { - c->redirectingnum[0] = '\0'; - c->redirectingplan = PRI_UNKNOWN; - c->redirectingpres = PRES_NUMBER_NOT_AVAILABLE; - c->redirectingreason = PRI_REDIR_UNKNOWN; - } - if (req->called) { - libpri_copy_string(c->callednum, req->called, sizeof(c->callednum)); - c->calledplan = req->calledplan; - } else - return -1; - - if (req->useruserinfo) - libpri_copy_string(c->useruserinfo, req->useruserinfo, sizeof(c->useruserinfo)); - else - c->useruserinfo[0] = '\0'; - - if (req->nonisdn && (pri->switchtype == PRI_SWITCH_NI2)) - c->progressmask = PRI_PROG_CALLER_NOT_ISDN; - else - c->progressmask = 0; - - pri_call_add_standard_apdus(pri, c); - - if (pri->subchannel && !pri->bri) - res = send_message(pri, c, Q931_SETUP, gr303_setup_ies); - else if (c->justsignalling) - res = send_message(pri, c, Q931_SETUP, cis_setup_ies); - else - res = send_message(pri, c, Q931_SETUP, setup_ies); - if (!res) { - c->alive = 1; - /* make sure we call PRI_EVENT_HANGUP_ACK once we send/receive RELEASE_COMPLETE */ - c->sendhangupack = 1; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CALL_INITIATED); - c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING; - } - return res; - -} - -static int release_complete_ies[] = { Q931_IE_USER_USER, -1 }; - -static int q931_release_complete(struct pri *pri, q931_call *c, int cause) -{ - int res = 0; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - c->peercallstate = Q931_CALL_STATE_NULL; - if (cause > -1) { - c->cause = cause; - c->causecode = CODE_CCITT; - c->causeloc = LOC_PRIV_NET_LOCAL_USER; - /* release_ies has CAUSE in it */ - res = send_message(pri, c, Q931_RELEASE_COMPLETE, release_ies); - } else - res = send_message(pri, c, Q931_RELEASE_COMPLETE, release_complete_ies); - c->alive = 0; - /* release the structure */ - res += q931_hangup(pri,c,cause); - return res; -} - -static int connect_acknowledge_ies[] = { -1 }; - -static int gr303_connect_acknowledge_ies[] = { Q931_CHANNEL_IDENT, -1 }; - -static int q931_connect_acknowledge(struct pri *pri, q931_call *c) -{ - if (pri->subchannel && !pri->bri) { - if (pri->localtype == PRI_CPE) - return send_message(pri, c, Q931_CONNECT_ACKNOWLEDGE, gr303_connect_acknowledge_ies); - } else - return send_message(pri, c, Q931_CONNECT_ACKNOWLEDGE, connect_acknowledge_ies); - return 0; -} - -int q931_hangup(struct pri *pri, q931_call *c, int cause) -{ - int disconnect = 1; - int release_compl = 0; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "NEW_HANGUP DEBUG: Calling q931_hangup, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate)); - if (!pri || !c) - return -1; - /* If mandatory IE was missing, insist upon that cause code */ - if (c->cause == PRI_CAUSE_MANDATORY_IE_MISSING) - cause = c->cause; - if (cause == 34 || cause == 44 || cause == 82 || cause == 1 || cause == 81) { - /* We'll send RELEASE_COMPLETE with these causes */ - disconnect = 0; - release_compl = 1; - } - if (cause == 6 || cause == 7 || cause == 26) { - /* We'll send RELEASE with these causes */ - disconnect = 0; - } - /* All other causes we send with DISCONNECT */ - switch(c->ourcallstate) { - case Q931_CALL_STATE_NULL: - if (c->peercallstate == Q931_CALL_STATE_NULL) - /* free the resources if we receive or send REL_COMPL */ - q931_destroycall(pri, c->cr); - else if (c->peercallstate == Q931_CALL_STATE_RELEASE_REQUEST) - q931_release_complete(pri,c,cause); - break; - case Q931_CALL_STATE_CALL_INITIATED: - /* we sent SETUP */ - case Q931_CALL_STATE_OVERLAP_SENDING: - /* received SETUP_ACKNOWLEDGE */ - case Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING: - /* received CALL_PROCEEDING */ - case Q931_CALL_STATE_CALL_DELIVERED: - /* received ALERTING */ - case Q931_CALL_STATE_CALL_PRESENT: - /* received SETUP */ - case Q931_CALL_STATE_CALL_RECEIVED: - /* sent ALERTING */ - case Q931_CALL_STATE_CONNECT_REQUEST: - /* sent CONNECT */ - case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING: - /* we sent CALL_PROCEEDING */ - case Q931_CALL_STATE_OVERLAP_RECEIVING: - /* received SETUP_ACKNOWLEDGE */ - /* send DISCONNECT in general */ - if (c->peercallstate != Q931_CALL_STATE_NULL && c->peercallstate != Q931_CALL_STATE_DISCONNECT_REQUEST && c->peercallstate != Q931_CALL_STATE_DISCONNECT_INDICATION && c->peercallstate != Q931_CALL_STATE_RELEASE_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART_REQUEST && c->peercallstate != Q931_CALL_STATE_RESTART) { - if (disconnect) - q931_disconnect(pri,c,cause); - else if (release_compl) - q931_release_complete(pri,c,cause); - else - q931_release(pri,c,cause); - } else - pri_error(pri, "Wierd, doing nothing but this shouldn't happen, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate)); - break; - case Q931_CALL_STATE_ACTIVE: - /* received CONNECT */ - q931_disconnect(pri,c,cause); - break; - case Q931_CALL_STATE_DISCONNECT_REQUEST: - /* sent DISCONNECT */ - q931_release(pri,c,cause); - break; - case Q931_CALL_STATE_DISCONNECT_INDICATION: - /* received DISCONNECT */ - if (c->peercallstate == Q931_CALL_STATE_DISCONNECT_REQUEST) { - c->alive = 1; - q931_release(pri,c,cause); - } - break; - case Q931_CALL_STATE_RELEASE_REQUEST: - /* sent RELEASE */ - /* don't do anything, waiting for RELEASE_COMPLETE */ - break; - case Q931_CALL_STATE_RESTART: - case Q931_CALL_STATE_RESTART_REQUEST: - /* sent RESTART */ - pri_error(pri, "q931_hangup shouldn't be called in this state, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate)); - break; - default: - pri_error(pri, "We're not yet handling hanging up when our state is %d, contact support@digium.com, ourstate %s, peerstate %s\n", - c->ourcallstate, - callstate2str(c->ourcallstate), - callstate2str(c->peercallstate)); - return -1; - } - /* we did handle hangup properly at this point */ - return 0; -} - -int q931_receive(struct pri *pri, q931_h *h, int len) -{ - q931_mh *mh; - q931_call *c; - q931_ie *ie; - unsigned int x; - int y; - int res; - int r; - int mandies[MAX_MAND_IES]; - int missingmand; - int codeset, cur_codeset; - int last_ie[8]; - struct apdu_event *cur = NULL; - - memset(last_ie, 0, sizeof(last_ie)); - if (pri->debug & PRI_DEBUG_Q931_DUMP) - q931_dump(pri, h, len, 0); -#ifdef LIBPRI_COUNTERS - pri->q931_rxcount++; -#endif - mh = (q931_mh *)(h->contents + h->crlen); - if ((h->pd == 0x3) || (h->pd == 0x43)) { - /* This is the weird maintenance stuff. We majorly - KLUDGE this by changing byte 4 from a 0xf (SERVICE) - to a 0x7 (SERVICE ACKNOWLEDGE) */ - h->raw[h->crlen + 2] -= 0x8; - q931_xmit(pri, h, len, 1); - return 0; - } else if (h->pd != pri->protodisc) { - pri_error(pri, "Warning: unknown/inappropriate protocol discriminator received (%02x/%d)\n", h->pd, h->pd); - return 0; - } - c = q931_getcall(pri, q931_cr(h), 0); - if (!c) { - pri_error(pri, "Unable to locate call %d\n", q931_cr(h)); - return -1; - } - /* Preliminary handling */ - switch(mh->msg) { - case Q931_RESTART: - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "-- Processing Q.931 Restart\n"); - /* Reset information */ - c->channelno = -1; - c->slotmap = -1; - c->chanflags = 0; - c->ds1no = 0; - c->ri = -1; - break; - case Q931_FACILITY: - c->callername[0] = '\0'; - break; - case Q931_SETUP: - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, "-- Processing Q.931 Call Setup\n"); - c->channelno = -1; - c->slotmap = -1; - c->chanflags = 0; - c->ds1no = 0; - c->ri = -1; - c->transcapability = -1; - c->transmoderate = -1; - c->transmultiple = -1; - c->userl1 = -1; - c->userl2 = -1; - c->userl3 = -1; - c->rateadaption = -1; - c->calledplan = -1; - c->callerplan = -1; - c->callerpres = -1; - c->callernum[0] = '\0'; - c->callednum[0] = '\0'; - c->callername[0] = '\0'; - c->callerani[0] = '\0'; - c->callerplanani = -1; - c->redirectingplan = -1; - c->redirectingpres = -1; - c->redirectingreason = -1; - c->origcalledplan = -1; - c->origcalledpres = -1; - c->origredirectingreason = -1; - c->redirectingnum[0] = '\0'; - c->origcallednum[0] = '\0'; - c->redirectingname[0] = '\0'; - c->origcalledname[0] = '\0'; - c->useruserprotocoldisc = -1; - c->useruserinfo[0] = '\0'; - c->complete = 0; - c->nonisdn = 0; - c->aoc_units = -1; - /* Fall through */ - case Q931_CONNECT: - case Q931_ALERTING: - case Q931_PROGRESS: - c->useruserinfo[0] = '\0'; - c->cause = -1; - /* Fall through */ - case Q931_CALL_PROCEEDING: - c->progress = -1; - c->progressmask = 0; - break; - case Q931_CONNECT_ACKNOWLEDGE: - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - c->retranstimer = 0; - break; - case Q931_RELEASE: - case Q931_DISCONNECT: - c->cause = -1; - c->causecode = -1; - c->causeloc = -1; - c->aoc_units = -1; - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - c->retranstimer = 0; - c->useruserinfo[0] = '\0'; - break; - case Q931_RELEASE_COMPLETE: - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - c->retranstimer = 0; - c->useruserinfo[0] = '\0'; - /* Fall through */ - case Q931_STATUS: - c->cause = -1; - c->causecode = -1; - c->causeloc = -1; - c->sugcallstate = -1; - c->aoc_units = -1; - break; - case Q931_RESTART_ACKNOWLEDGE: - c->channelno = -1; - break; - case Q931_INFORMATION: - c->callednum[0] = '\0'; - break; - case Q931_STATUS_ENQUIRY: - break; - case Q931_SETUP_ACKNOWLEDGE: - break; - case Q931_NOTIFY: - break; - case Q931_USER_INFORMATION: - case Q931_SEGMENT: - case Q931_CONGESTION_CONTROL: - case Q931_HOLD: - case Q931_HOLD_ACKNOWLEDGE: - case Q931_HOLD_REJECT: - case Q931_RETRIEVE: - case Q931_RETRIEVE_ACKNOWLEDGE: - case Q931_RETRIEVE_REJECT: - case Q931_RESUME: - case Q931_RESUME_ACKNOWLEDGE: - case Q931_RESUME_REJECT: - case Q931_SUSPEND: - case Q931_SUSPEND_ACKNOWLEDGE: - case Q931_SUSPEND_REJECT: - pri_error(pri, "!! Not yet handling pre-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg); - /* Fall through */ - default: - pri_error(pri, "!! Don't know how to pre-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg); - q931_status(pri,c, PRI_CAUSE_MESSAGE_TYPE_NONEXIST); - if (c->newcall) - q931_destroycall(pri,c->cr); - return -1; - } - /* Handle IEs */ - memset(mandies, 0, sizeof(mandies)); - missingmand = 0; - for (x=0;xmsg) { - memcpy(mandies, msgs[x].mandies, sizeof(mandies)); - } - } - x = 0; - /* Do real IE processing */ - len -= (h->crlen + 3); - codeset = cur_codeset = 0; - while(len) { - ie = (q931_ie *)(mh->data + x); - for (y=0;yie)) - mandies[y] = 0; - } - r = ielen(ie); - if (r > len) { - pri_error(pri, "XXX Message longer than it should be?? XXX\n"); - return -1; - } - /* Special processing for codeset shifts */ - switch (ie->ie & 0xf8) { - case Q931_LOCKING_SHIFT: - y = ie->ie & 7; /* Requested codeset */ - /* Locking shifts couldn't go to lower codeset, and couldn't follows non-locking shifts - verify this */ - if ((cur_codeset != codeset) && (pri->debug & PRI_DEBUG_Q931_ANOMALY)) - pri_message(pri, "XXX Locking shift immediately follows non-locking shift (from %d through %d to %d) XXX\n", codeset, cur_codeset, y); - if (y > 0) { - if ((y < codeset) && (pri->debug & PRI_DEBUG_Q931_ANOMALY)) - pri_error(pri, "!! Trying to locked downshift codeset from %d to %d !!\n", codeset, y); - codeset = cur_codeset = y; - } - else { - /* Locking shift to codeset 0 is forbidden by all specifications */ - pri_error(pri, "!! Invalid locking shift to codeset 0 !!\n"); - } - break; - case Q931_NON_LOCKING_SHIFT: - cur_codeset = ie->ie & 7; - break; - default: - /* Sanity check for IE code order */ - if (!(ie->ie & 0x80)) { - if (last_ie[cur_codeset] > ie->ie) { - if ((pri->debug & PRI_DEBUG_Q931_ANOMALY)) - pri_message(pri, "XXX Out-of-order IE %d at codeset %d (last was %d)\n", ie->ie, cur_codeset, last_ie[cur_codeset]); - } - else - last_ie[cur_codeset] = ie->ie; - } - /* Ignore non-locking shifts for TR41459-based signalling */ - switch (pri->switchtype) { - case PRI_SWITCH_LUCENT5E: - case PRI_SWITCH_ATT4ESS: - if (cur_codeset != codeset) { - if ((pri->debug & PRI_DEBUG_Q931_DUMP)) - pri_message(pri, "XXX Ignoring IE %d for temporary codeset %d XXX\n", ie->ie, cur_codeset); - break; - } - /* Fall through */ - default: - y = q931_handle_ie(cur_codeset, pri, c, mh->msg, ie); - /* XXX Applicable to codeset 0 only? XXX */ - if (!cur_codeset && !(ie->ie & 0xf0) && (y < 0)) - mandies[MAX_MAND_IES - 1] = Q931_FULL_IE(cur_codeset, ie->ie); - } - /* Reset current codeset */ - cur_codeset = codeset; - } - x += r; - len -= r; - } - missingmand = 0; - for (x=0;x that's not an error */ - if (((pri->localtype != PRI_NETWORK) || (mh->msg != Q931_SETUP) || (mandies[x] != Q931_CHANNEL_IDENT)) && - ((mh->msg != Q931_PROGRESS) || (mandies[x] != Q931_PROGRESS_INDICATOR))) { - pri_error(pri, "XXX Missing handling for mandatory IE %d (cs%d, %s) XXX\n", Q931_IE_IE(mandies[x]), Q931_IE_CODESET(mandies[x]), ie2str(mandies[x])); - missingmand++; - } - } - } - - /* Post handling */ - switch(mh->msg) { - case Q931_RESTART: - if (missingmand) { - q931_status(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING); - q931_destroycall(pri, c->cr); - break; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_RESTART); - c->peercallstate = Q931_CALL_STATE_RESTART_REQUEST; - /* Send back the Restart Acknowledge */ - restart_ack(pri, c); - /* Notify user of restart event */ - pri->ev.e = PRI_EVENT_RESTART; - pri->ev.restart.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - return Q931_RES_HAVEEVENT; - case Q931_SETUP: - if (missingmand) { - q931_release_complete(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING); - break; - } - /* Must be new call */ - if (!c->newcall) { - break; - } - if (c->progressmask & PRI_PROG_CALLER_NOT_ISDN) - c->nonisdn = 1; - c->newcall = 0; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CALL_PRESENT); - c->peercallstate = Q931_CALL_STATE_CALL_INITIATED; - /* it's not yet a call since higher level can respond with RELEASE or RELEASE_COMPLETE */ - c->alive = 0; - if (c->transmoderate != TRANS_MODE_64_CIRCUIT) { - q931_release_complete(pri, c, PRI_CAUSE_BEARERCAPABILITY_NOTIMPL); - break; - } - pri->ev.e = PRI_EVENT_RING; - pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.ring.callingpres = c->callerpres; - pri->ev.ring.callingplan = c->callerplan; - pri->ev.ring.callingplanani = c->callerplanani; - pri->ev.ring.callingplanrdnis = c->redirectingplan; - pri->ev.ring.callingplanorigcalled = c->origcalledplan; - pri->ev.ring.ani2 = c->ani2; - libpri_copy_string(pri->ev.ring.callingani, c->callerani, sizeof(pri->ev.ring.callingani)); - libpri_copy_string(pri->ev.ring.callingnum, c->callernum, sizeof(pri->ev.ring.callingnum)); - libpri_copy_string(pri->ev.ring.callingname, c->callername, sizeof(pri->ev.ring.callingname)); - pri->ev.ring.calledplan = c->calledplan; - libpri_copy_string(pri->ev.ring.callingsubaddr, c->callingsubaddr, sizeof(pri->ev.ring.callingsubaddr)); - libpri_copy_string(pri->ev.ring.callednum, c->callednum, sizeof(pri->ev.ring.callednum)); - libpri_copy_string(pri->ev.ring.origcalledname, c->origcalledname, sizeof(pri->ev.ring.origcalledname)); - libpri_copy_string(pri->ev.ring.origcallednum, c->origcallednum, sizeof(pri->ev.ring.origcallednum)); - libpri_copy_string(pri->ev.ring.redirectingnum, c->redirectingnum, sizeof(pri->ev.ring.redirectingnum)); - libpri_copy_string(pri->ev.ring.redirectingname, c->redirectingname, sizeof(pri->ev.ring.redirectingname)); - libpri_copy_string(pri->ev.ring.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo)); - c->useruserinfo[0] = '\0'; - pri->ev.ring.redirectingreason = c->redirectingreason; - pri->ev.ring.origredirectingreason = c->origredirectingreason; - pri->ev.ring.flexible = ! (c->chanflags & FLAG_EXCLUSIVE); - pri->ev.ring.cref = c->cr; - pri->ev.ring.call = c; - pri->ev.ring.layer1 = c->userl1; - pri->ev.ring.complete = c->complete; - pri->ev.ring.ctype = c->transcapability; - pri->ev.ring.redirectingreason = c->redirectingreason; - pri->ev.ring.progress = c->progress; - pri->ev.ring.progressmask = c->progressmask; - return Q931_RES_HAVEEVENT; - case Q931_ALERTING: - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_CALL_DELIVERED); - c->peercallstate = Q931_CALL_STATE_CALL_RECEIVED; - pri->ev.e = PRI_EVENT_RINGING; - pri->ev.ringing.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.ringing.cref = c->cr; - pri->ev.ringing.call = c; - pri->ev.ringing.progress = c->progress; - pri->ev.ringing.progressmask = c->progressmask; - libpri_copy_string(pri->ev.ringing.useruserinfo, c->useruserinfo, sizeof(pri->ev.ringing.useruserinfo)); - c->useruserinfo[0] = '\0'; - - cur = c->apdus; - while (cur) { - if (!cur->sent && cur->message == Q931_FACILITY) { - q931_facility(pri, c); - break; - } - cur = cur->next; - } - - return Q931_RES_HAVEEVENT; - case Q931_CONNECT: - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - if (c->ourcallstate == Q931_CALL_STATE_ACTIVE) { - q931_status(pri, c, PRI_CAUSE_WRONG_MESSAGE); - break; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE); - c->peercallstate = Q931_CALL_STATE_CONNECT_REQUEST; - pri->ev.e = PRI_EVENT_ANSWER; - pri->ev.answer.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.answer.cref = c->cr; - pri->ev.answer.call = c; - pri->ev.answer.progress = c->progress; - pri->ev.answer.progressmask = c->progressmask; - libpri_copy_string(pri->ev.answer.useruserinfo, c->useruserinfo, sizeof(pri->ev.answer.useruserinfo)); - c->useruserinfo[0] = '\0'; - q931_connect_acknowledge(pri, c); - if (c->justsignalling) { /* Make sure WE release when we initiatie a signalling only connection */ - q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING); - break; - } else - return Q931_RES_HAVEEVENT; - case Q931_FACILITY: - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - pri->ev.e = PRI_EVENT_FACNAME; - libpri_copy_string(pri->ev.facname.callingname, c->callername, sizeof(pri->ev.facname.callingname)); - libpri_copy_string(pri->ev.facname.callingnum, c->callernum, sizeof(pri->ev.facname.callingnum)); - pri->ev.facname.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.facname.callingpres = c->callerpres; - pri->ev.facname.callingplan = c->callerplan; - pri->ev.facname.cref = c->cr; - pri->ev.facname.call = c; -#if 0 - pri_message(pri, "Sending facility event (%s/%s)\n", pri->ev.facname.callingname, pri->ev.facname.callingnum); -#endif - return Q931_RES_HAVEEVENT; - case Q931_PROGRESS: - if (missingmand) { - q931_status(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING); - q931_destroycall(pri, c->cr); - break; - } - pri->ev.e = PRI_EVENT_PROGRESS; - pri->ev.proceeding.cause = c->cause; - /* Fall through */ - case Q931_CALL_PROCEEDING: - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - if ((c->ourcallstate != Q931_CALL_STATE_CALL_INITIATED) && - (c->ourcallstate != Q931_CALL_STATE_OVERLAP_SENDING) && - (c->ourcallstate != Q931_CALL_STATE_CALL_DELIVERED) && - (c->ourcallstate != Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING)) { - q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE); - break; - } - pri->ev.proceeding.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - if (mh->msg == Q931_CALL_PROCEEDING) { - pri->ev.e = PRI_EVENT_PROCEEDING; - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING); - c->peercallstate = Q931_CALL_STATE_INCOMING_CALL_PROCEEDING; - } - pri->ev.proceeding.progress = c->progress; - pri->ev.proceeding.progressmask = c->progressmask; - pri->ev.proceeding.cref = c->cr; - pri->ev.proceeding.call = c; - - cur = c->apdus; - while (cur) { - if (!cur->sent && cur->message == Q931_FACILITY) { - q931_facility(pri, c); - break; - } - cur = cur->next; - } - return Q931_RES_HAVEEVENT; - case Q931_CONNECT_ACKNOWLEDGE: - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - if (!(c->ourcallstate == Q931_CALL_STATE_CONNECT_REQUEST) && - !(c->ourcallstate == Q931_CALL_STATE_ACTIVE && - (pri->localtype == PRI_NETWORK || pri->switchtype == PRI_SWITCH_QSIG))) { - q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE); - break; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_ACTIVE); - c->peercallstate = Q931_CALL_STATE_ACTIVE; - break; - case Q931_STATUS: - if (missingmand) { - q931_status(pri, c, PRI_CAUSE_MANDATORY_IE_MISSING); - q931_destroycall(pri, c->cr); - break; - } - if (c->newcall) { - if (c->cr & 0x7fff) - q931_release_complete(pri,c,PRI_CAUSE_WRONG_CALL_STATE); - break; - } - /* Do nothing */ - /* Also when the STATUS asks for the call of an unexisting reference send RELEASE_COMPL */ - if ((pri->debug & PRI_DEBUG_Q931_ANOMALY) && - (c->cause != PRI_CAUSE_INTERWORKING)) - pri_error(pri, "Received unsolicited status: %s\n", pri_cause2str(c->cause)); - /* Workaround for S-12 ver 7.3 - it responds for invalid/non-implemented IEs at SETUP with null call state */ -#if 0 - if (!c->sugcallstate && (c->ourcallstate != Q931_CALL_STATE_CALL_INITIATED)) { -#else - /* Remove "workaround" since it breaks certification testing. If we receive a STATUS message of call state - * NULL and we are not in the call state NULL we must clear resources and return to the call state to pass - * testing. See section 5.8.11 of Q.931 */ - - if (!c->sugcallstate) { -#endif - pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.hangup.cause = c->cause; - pri->ev.hangup.cref = c->cr; - pri->ev.hangup.call = c; - pri->ev.hangup.aoc_units = c->aoc_units; - libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo)); - /* Free resources */ - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - c->peercallstate = Q931_CALL_STATE_NULL; - if (c->alive) { - pri->ev.e = PRI_EVENT_HANGUP; - res = Q931_RES_HAVEEVENT; - c->alive = 0; - } else if (c->sendhangupack) { - res = Q931_RES_HAVEEVENT; - pri->ev.e = PRI_EVENT_HANGUP_ACK; - q931_hangup(pri, c, c->cause); - } else { - q931_hangup(pri, c, c->cause); - res = 0; - } - if (res) - return res; - } - break; - case Q931_RELEASE_COMPLETE: - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - c->peercallstate = Q931_CALL_STATE_NULL; - pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.hangup.cause = c->cause; - pri->ev.hangup.cref = c->cr; - pri->ev.hangup.call = c; - pri->ev.hangup.aoc_units = c->aoc_units; - libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo)); - c->useruserinfo[0] = '\0'; - /* Free resources */ - if (c->alive) { - pri->ev.e = PRI_EVENT_HANGUP; - res = Q931_RES_HAVEEVENT; - c->alive = 0; - } else if (c->sendhangupack) { - res = Q931_RES_HAVEEVENT; - pri->ev.e = PRI_EVENT_HANGUP_ACK; - pri_hangup(pri, c, c->cause); - } else - res = 0; - if (res) - return res; - else - q931_hangup(pri,c,c->cause); - break; - case Q931_RELEASE: - if (missingmand) { - /* Force cause to be mandatory IE missing */ - c->cause = PRI_CAUSE_MANDATORY_IE_MISSING; - } - if (c->ourcallstate == Q931_CALL_STATE_RELEASE_REQUEST) - c->peercallstate = Q931_CALL_STATE_NULL; - else { - c->peercallstate = Q931_CALL_STATE_RELEASE_REQUEST; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - pri->ev.e = PRI_EVENT_HANGUP; - pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.hangup.cause = c->cause; - pri->ev.hangup.cref = c->cr; - pri->ev.hangup.call = c; - pri->ev.hangup.aoc_units = c->aoc_units; - libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo)); - c->useruserinfo[0] = '\0'; - /* Don't send release complete if they send us release - while we sent it, assume a NULL state */ - if (c->newcall) - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - else - return Q931_RES_HAVEEVENT; - break; - case Q931_DISCONNECT: - if (missingmand) { - /* Still let user call release */ - c->cause = PRI_CAUSE_MANDATORY_IE_MISSING; - } - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_DISCONNECT_INDICATION); - c->peercallstate = Q931_CALL_STATE_DISCONNECT_REQUEST; - c->sendhangupack = 1; - - /* wait for a RELEASE so that sufficient time has passed - for the inband audio to be heard */ - if (pri->acceptinbanddisconnect && (c->progressmask & PRI_PROG_INBAND_AVAILABLE)) - break; - - /* Return such an event */ - pri->ev.e = PRI_EVENT_HANGUP_REQ; - pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.hangup.cause = c->cause; - pri->ev.hangup.cref = c->cr; - pri->ev.hangup.call = c; - pri->ev.hangup.aoc_units = c->aoc_units; - libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo)); - c->useruserinfo[0] = '\0'; - if (c->alive) - return Q931_RES_HAVEEVENT; - else - q931_hangup(pri,c,c->cause); - break; - case Q931_RESTART_ACKNOWLEDGE: - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - c->peercallstate = Q931_CALL_STATE_NULL; - pri->ev.e = PRI_EVENT_RESTART_ACK; - pri->ev.restartack.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - return Q931_RES_HAVEEVENT; - case Q931_INFORMATION: - /* XXX We're handling only INFORMATION messages that contain - overlap dialing received digit - + the "Complete" msg which is basically an EOF on further digits - XXX */ - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - if (c->ourcallstate != Q931_CALL_STATE_OVERLAP_RECEIVING) { - pri->ev.e = PRI_EVENT_KEYPAD_DIGIT; - pri->ev.digit.call = c; - pri->ev.digit.channel = c->channelno | (c->ds1no << 8); - libpri_copy_string(pri->ev.digit.digits, c->keypad_digits, sizeof(pri->ev.digit.digits)); - /* Make sure we clear it out before we return */ - c->keypad_digits[0] = '\0'; - return Q931_RES_HAVEEVENT; - } - pri->ev.e = PRI_EVENT_INFO_RECEIVED; - pri->ev.ring.call = c; - pri->ev.ring.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - libpri_copy_string(pri->ev.ring.callednum, c->callednum, sizeof(pri->ev.ring.callednum)); - libpri_copy_string(pri->ev.ring.callingsubaddr, c->callingsubaddr, sizeof(pri->ev.ring.callingsubaddr)); - pri->ev.ring.complete = c->complete; /* this covers IE 33 (Sending Complete) */ - return Q931_RES_HAVEEVENT; - case Q931_STATUS_ENQUIRY: - if (c->newcall) { - q931_release_complete(pri, c, PRI_CAUSE_INVALID_CALL_REFERENCE); - } else - q931_status(pri,c, 0); - break; - case Q931_SETUP_ACKNOWLEDGE: - if (c->newcall) { - q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE); - break; - } - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_OVERLAP_SENDING); - c->peercallstate = Q931_CALL_STATE_OVERLAP_RECEIVING; - pri->ev.e = PRI_EVENT_SETUP_ACK; - pri->ev.setup_ack.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.setup_ack.call = c; - - cur = c->apdus; - while (cur) { - if (!cur->sent && cur->message == Q931_FACILITY) { - q931_facility(pri, c); - break; - } - cur = cur->next; - } - - return Q931_RES_HAVEEVENT; - case Q931_NOTIFY: - pri->ev.e = PRI_EVENT_NOTIFY; - pri->ev.notify.channel = c->channelno; - pri->ev.notify.info = c->notify; - return Q931_RES_HAVEEVENT; - case Q931_USER_INFORMATION: - case Q931_SEGMENT: - case Q931_CONGESTION_CONTROL: - case Q931_HOLD: - case Q931_HOLD_ACKNOWLEDGE: - case Q931_HOLD_REJECT: - case Q931_RETRIEVE: - case Q931_RETRIEVE_ACKNOWLEDGE: - case Q931_RETRIEVE_REJECT: - case Q931_RESUME: - case Q931_RESUME_ACKNOWLEDGE: - case Q931_RESUME_REJECT: - case Q931_SUSPEND: - case Q931_SUSPEND_ACKNOWLEDGE: - case Q931_SUSPEND_REJECT: - pri_error(pri, "!! Not yet handling post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg); - /* Fall through */ - default: - - pri_error(pri, "!! Don't know how to post-handle message type %s (%d)\n", msg2str(mh->msg), mh->msg); - q931_status(pri,c, PRI_CAUSE_MESSAGE_TYPE_NONEXIST); - if (c->newcall) - q931_destroycall(pri,c->cr); - return -1; - } - return 0; -} - -/* Clear a call, although we did not receive any hangup notification. */ -static int pri_internal_clear(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - int res; - - if (c->retranstimer) - pri_schedule_del(pri, c->retranstimer); - c->retranstimer = 0; - c->useruserinfo[0] = '\0'; - c->cause = -1; - c->causecode = -1; - c->causeloc = -1; - c->sugcallstate = -1; - c->aoc_units = -1; - - UPDATE_OURCALLSTATE(pri, c, Q931_CALL_STATE_NULL); - c->peercallstate = Q931_CALL_STATE_NULL; - pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16); - pri->ev.hangup.cause = c->cause; - pri->ev.hangup.cref = c->cr; - pri->ev.hangup.call = c; - pri->ev.hangup.aoc_units = c->aoc_units; - libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo)); - - /* Free resources */ - if (c->alive) { - pri->ev.e = PRI_EVENT_HANGUP; - res = Q931_RES_HAVEEVENT; - c->alive = 0; - } else if (c->sendhangupack) { - res = Q931_RES_HAVEEVENT; - pri->ev.e = PRI_EVENT_HANGUP_ACK; - q931_hangup(pri, c, c->cause); - } else { - res = 0; - q931_hangup(pri, c, c->cause); - } - - return res; -} - -/* Handle T309 timeout for an active call. */ -static void pri_dl_down_timeout(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, DBGHEAD "Timed out waiting for data link re-establishment\n", DBGINFO); - - c->cause = PRI_CAUSE_DESTINATION_OUT_OF_ORDER; - if (pri_internal_clear(c) == Q931_RES_HAVEEVENT) - pri->schedev = 1; -} - -/* Handle Layer 2 down event for a non active call. */ -static void pri_dl_down_cancelcall(void *data) -{ - struct q931_call *c = data; - struct pri *pri = c->pri; - if (pri->debug & PRI_DEBUG_Q931_STATE) - pri_message(pri, DBGHEAD "Cancel non active call after data link failure\n", DBGINFO); - - c->cause = PRI_CAUSE_DESTINATION_OUT_OF_ORDER; - if (pri_internal_clear(c) == Q931_RES_HAVEEVENT) - pri->schedev = 1; -} - -/* Receive an indication from Layer 2 */ -void q931_dl_indication(struct pri *pri, int event) -{ - q931_call *cur = NULL; - - /* Just return if T309 is not enabled. */ - if (!pri || pri->timers[PRI_TIMER_T309] < 0) - return; - - switch (event) { - case PRI_EVENT_DCHAN_DOWN: - pri_message(pri, DBGHEAD "link is DOWN\n", DBGINFO); - cur = *pri->callpool; - while(cur) { - if (cur->ourcallstate == Q931_CALL_STATE_ACTIVE) { - /* For a call in Active state, activate T309 only if there is no timer already running. */ - if (!cur->retranstimer) { - pri_message(pri, DBGHEAD "activate T309 for call %d on channel %d\n", DBGINFO, cur->cr, cur->channelno); - cur->retranstimer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T309], pri_dl_down_timeout, cur); - } - } else if (cur->ourcallstate != Q931_CALL_STATE_NULL) { - /* For a call that is not in Active state, schedule internal clearing of the call 'ASAP' (delay 0). */ - pri_message(pri, DBGHEAD "cancel call %d on channel %d in state %d (%s)\n", DBGINFO, - cur->cr, cur->channelno, cur->ourcallstate, callstate2str(cur->ourcallstate)); - if (cur->retranstimer) - pri_schedule_del(pri, cur->retranstimer); - cur->retranstimer = pri_schedule_event(pri, 0, pri_dl_down_cancelcall, cur); - } - cur = cur->next; - } - break; - case PRI_EVENT_DCHAN_UP: - pri_message(pri, DBGHEAD "link is UP\n", DBGINFO); - cur = *pri->callpool; - while(cur) { - if (cur->ourcallstate == Q931_CALL_STATE_ACTIVE && cur->retranstimer) { - pri_message(pri, DBGHEAD "cancel T309 for call %d on channel %d\n", DBGINFO, cur->cr, cur->channelno); - pri_schedule_del(pri, cur->retranstimer); - cur->retranstimer = 0; - q931_status(pri, cur, PRI_CAUSE_NORMAL_UNSPECIFIED); - } else if (cur->ourcallstate != Q931_CALL_STATE_NULL && - cur->ourcallstate != Q931_CALL_STATE_DISCONNECT_REQUEST && - cur->ourcallstate != Q931_CALL_STATE_DISCONNECT_INDICATION && - cur->ourcallstate != Q931_CALL_STATE_RELEASE_REQUEST) { - - /* The STATUS message sent here is not required by Q.931, but it may help anyway. */ - q931_status(pri, cur, PRI_CAUSE_NORMAL_UNSPECIFIED); - } - cur = cur->next; - } - break; - default: - pri_message(pri, DBGHEAD "unexpected event %d.\n", DBGINFO, event); - } -} - -int q931_call_getcrv(struct pri *pri, q931_call *call, int *callmode) -{ - if (callmode) - *callmode = call->cr & 0x7; - return ((call->cr & 0x7fff) >> 3); -} - -int q931_call_setcrv(struct pri *pri, q931_call *call, int crv, int callmode) -{ - call->cr = (crv << 3) & 0x7fff; - call->cr |= (callmode & 0x7); - return 0; -} diff --git a/libpri/testprilib.c b/libpri/testprilib.c deleted file mode 100644 index 264c9a3f..00000000 --- a/libpri/testprilib.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * libpri: An implementation of Primary Rate ISDN - * - * Written by Mark Spencer - * - * Copyright (C) 2001-2005, Digium, Inc. - * All Rights Reserved. - */ - -/* - * See http://www.asterisk.org for more information about - * the Asterisk project. Please do not directly contact - * any of the maintainers of this project for assistance; - * the project provides a web site, mailing lists and IRC - * channels for your use. - * - * This program is free software, distributed under the terms of - * the GNU General Public License Version 2 as published by the - * Free Software Foundation. See the LICENSE file included with - * this program for more details. - * - * In addition, when this program is distributed with Asterisk in - * any form that would qualify as a 'combined work' or as a - * 'derivative work' (but not mere aggregation), you can redistribute - * and/or modify the combination under the terms of the license - * provided with that copy of Asterisk, instead of the license - * terms granted here. - */ - - -/* - * This program tests libpri call reception using a zaptel interface. - * Its state machines are setup for RECEIVING CALLS ONLY, so if you - * are trying to both place and receive calls you have to a bit more. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef SOLARIS -#include -#endif -#include -#include -#include "libpri.h" -#include "pri_q931.h" - -#ifndef AF_LOCAL -#define AF_LOCAL AF_UNIX -#endif - -#define DEBUG_LEVEL PRI_DEBUG_ALL - -#define PRI_DEF_NODETYPE PRI_CPE -#define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2 - -static struct pri *first, *cur; - -static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; - -#define TEST_CALLS 1 - -static void event1(struct pri *pri, pri_event *e) -{ - /* Network */ - int x; - static q931_call *calls[TEST_CALLS]; - char name[256], num[256], dest[256]; - switch(e->gen.e) { - case PRI_EVENT_DCHAN_UP: - printf("Network is up. Sending blast of calls!\n"); - for (x=0;xgen.e), e->gen.e); - q931_facility(pri, e->ringing.call); - pri_answer(pri, e->ringing.call, e->ringing.channel, 0); - break; - case PRI_EVENT_HANGUP_REQ: - printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - pri_hangup(pri, e->hangup.call, e->hangup.cause); - break; - default: - printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - } -} - -static void event2(struct pri *pri, pri_event *e) -{ - /* CPE */ - switch(e->gen.e) { - case PRI_EVENT_RING: - printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - pri_proceeding(pri, e->ring.call, e->ring.channel, 0); - pri_acknowledge(pri, e->ring.call, e->ring.channel, 0); - break; - case PRI_EVENT_ANSWER: - printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - pri_hangup(pri, e->answer.call, PRI_CAUSE_NORMAL_UNSPECIFIED); - break; - case PRI_EVENT_HANGUP: - printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - pri_hangup(pri, e->hangup.call, e->hangup.cause); - break; - case PRI_EVENT_DCHAN_UP: - default: - printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e); - } -} - -static void testmsg(struct pri *pri, char *s) -{ - char *c; - static int keeplast = 0; - do { - c = strchr(s, '\n'); - if (c) { - *c = '\0'; - c++; - } - if (keeplast) - printf("%s", s); - else if (cur == first) - printf("-1 %s", s); - else - printf("-2 %s", s); - if (c) - printf("\n"); - s = c; - } while(c && *c); - if (!c) - keeplast = 1; - else - keeplast = 0; -} - -static void testerr(struct pri *pri, char *s) -{ - char *c; - static int keeplast = 0; - do { - c = strchr(s, '\n'); - if (c) { - *c = '\0'; - c++; - } - if (keeplast) - printf("%s", s); - else if (cur == first) - printf("=1 %s", s); - else - printf("=2 %s", s); - if (c) - printf("\n"); - s = c; - } while(c && *c); - if (!c) - keeplast = 1; - else - keeplast = 0; -} - - -static void *dchan(void *data) -{ - /* Joint D-channel */ - struct pri *pri = data; - struct timeval *next, tv; - pri_event *e; - fd_set fds; - int res; - for(;;) { - if ((next = pri_schedule_next(pri))) { - gettimeofday(&tv, NULL); - tv.tv_sec = next->tv_sec - tv.tv_sec; - tv.tv_usec = next->tv_usec - tv.tv_usec; - if (tv.tv_usec < 0) { - tv.tv_usec += 1000000; - tv.tv_sec -= 1; - } - if (tv.tv_sec < 0) { - tv.tv_sec = 0; - tv.tv_usec = 0; - } - } - FD_ZERO(&fds); - FD_SET(pri_fd(pri), &fds); - res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL); - pthread_mutex_lock(&lock); - cur = pri; - if (res < 0) { - perror("select"); - } else if (!res) { - e = pri_schedule_run(pri); - } else { - e = pri_check_event(pri); - } - if (e) { - if (first == pri) { - event1(e->gen.pri, e); - } else { - event2(e->gen.pri, e); - } - } - pthread_mutex_unlock(&lock); - } - return NULL; -} - - -int main(int argc, char *argv[]) -{ - int pair[2]; - pthread_t tmp; - struct pri *pri; - pri_set_message(testmsg); - pri_set_error(testerr); - if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, pair)) { - perror("socketpair"); - exit(1); - } - if (!(pri = pri_new_bri(pair[0], 0, PRI_NETWORK, PRI_DEF_SWITCHTYPE))) { - perror("pri(0)"); - exit(1); - } - first = pri; - pri_set_debug(pri, DEBUG_LEVEL); - pri_facility_enable(pri); - if (pthread_create(&tmp, NULL, dchan, pri)) { - perror("thread(0)"); - exit(1); - } - if (!(pri = pri_new_bri(pair[1], 0, PRI_CPE, PRI_DEF_SWITCHTYPE))) { - perror("pri(1)"); - exit(1); - } - pri_set_debug(pri, DEBUG_LEVEL); - pri_facility_enable(pri); - if (pthread_create(&tmp, NULL, dchan, pri)) { - perror("thread(1)"); - exit(1); - } - /* Wait for things to run */ - sleep(5); - exit(0); -} - From f4d8650b85dce993510a711a6d16f53212f717f6 Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Tue, 13 Feb 2018 14:36:14 -0500 Subject: [PATCH 32/96] Add ilbc support --- asterisk/codecs/codec_ilbc.c | 12 +- asterisk/codecs/ilbc/FrameClassify.c | 114 + asterisk/codecs/ilbc/FrameClassify.h | 27 + asterisk/codecs/ilbc/LPCdecode.c | 158 + asterisk/codecs/ilbc/LPCdecode.h | 52 + asterisk/codecs/ilbc/LPCencode.c | 241 + asterisk/codecs/ilbc/LPCencode.h | 28 + asterisk/codecs/ilbc/StateConstructW.c | 86 + asterisk/codecs/ilbc/StateConstructW.h | 31 + asterisk/codecs/ilbc/StateSearchW.c | 211 + asterisk/codecs/ilbc/StateSearchW.h | 52 + asterisk/codecs/ilbc/anaFilter.c | 72 + asterisk/codecs/ilbc/anaFilter.h | 30 + asterisk/codecs/ilbc/constants.c | 770 ++ asterisk/codecs/ilbc/constants.h | 80 + asterisk/codecs/ilbc/createCB.c | 231 + asterisk/codecs/ilbc/createCB.h | 58 + asterisk/codecs/ilbc/doCPLC.c | 270 + asterisk/codecs/ilbc/doCPLC.h | 29 + asterisk/codecs/ilbc/enhancer.c | 701 ++ asterisk/codecs/ilbc/enhancer.h | 36 + asterisk/codecs/ilbc/extract-cfile.awk | 24 + asterisk/codecs/ilbc/filter.c | 175 + asterisk/codecs/ilbc/filter.h | 80 + asterisk/codecs/ilbc/gainquant.c | 116 + asterisk/codecs/ilbc/gainquant.h | 30 + asterisk/codecs/ilbc/getCBvec.c | 193 + asterisk/codecs/ilbc/getCBvec.h | 25 + asterisk/codecs/ilbc/helpfun.c | 326 + asterisk/codecs/ilbc/helpfun.h | 106 + asterisk/codecs/ilbc/hpInput.c | 65 + asterisk/codecs/ilbc/hpInput.h | 24 + asterisk/codecs/ilbc/hpOutput.c | 61 + asterisk/codecs/ilbc/hpOutput.h | 24 + asterisk/codecs/ilbc/iCBConstruct.c | 112 + asterisk/codecs/ilbc/iCBConstruct.h | 40 + asterisk/codecs/ilbc/iCBSearch.c | 512 ++ asterisk/codecs/ilbc/iCBSearch.h | 37 + asterisk/codecs/ilbc/iLBC_decode.c | 652 ++ asterisk/codecs/ilbc/iLBC_decode.h | 42 + asterisk/codecs/ilbc/iLBC_define.h | 217 + asterisk/codecs/ilbc/iLBC_encode.c | 543 ++ asterisk/codecs/ilbc/iLBC_encode.h | 39 + asterisk/codecs/ilbc/iLBC_test.c | 310 + asterisk/codecs/ilbc/lsf.c | 283 + asterisk/codecs/ilbc/lsf.h | 27 + asterisk/codecs/ilbc/packing.c | 182 + asterisk/codecs/ilbc/packing.h | 68 + asterisk/codecs/ilbc/rfc3951.txt | 10867 +++++++++++++++++++++++ asterisk/codecs/ilbc/syntFilter.c | 80 + asterisk/codecs/ilbc/syntFilter.h | 24 + asterisk/codecs/ilbc_slin_ex.h | 3 +- asterisk/formats/format_ilbc.c | 10 +- asterisk/include/asterisk/frame.h | 2 +- asterisk/main/frame.c | 6 +- asterisk/menuselect.makeopts | 2 +- 56 files changed, 18578 insertions(+), 18 deletions(-) create mode 100644 asterisk/codecs/ilbc/FrameClassify.c create mode 100644 asterisk/codecs/ilbc/FrameClassify.h create mode 100644 asterisk/codecs/ilbc/LPCdecode.c create mode 100644 asterisk/codecs/ilbc/LPCdecode.h create mode 100644 asterisk/codecs/ilbc/LPCencode.c create mode 100644 asterisk/codecs/ilbc/LPCencode.h create mode 100644 asterisk/codecs/ilbc/StateConstructW.c create mode 100644 asterisk/codecs/ilbc/StateConstructW.h create mode 100644 asterisk/codecs/ilbc/StateSearchW.c create mode 100644 asterisk/codecs/ilbc/StateSearchW.h create mode 100644 asterisk/codecs/ilbc/anaFilter.c create mode 100644 asterisk/codecs/ilbc/anaFilter.h create mode 100644 asterisk/codecs/ilbc/constants.c create mode 100644 asterisk/codecs/ilbc/constants.h create mode 100644 asterisk/codecs/ilbc/createCB.c create mode 100644 asterisk/codecs/ilbc/createCB.h create mode 100644 asterisk/codecs/ilbc/doCPLC.c create mode 100644 asterisk/codecs/ilbc/doCPLC.h create mode 100644 asterisk/codecs/ilbc/enhancer.c create mode 100644 asterisk/codecs/ilbc/enhancer.h create mode 100644 asterisk/codecs/ilbc/extract-cfile.awk create mode 100644 asterisk/codecs/ilbc/filter.c create mode 100644 asterisk/codecs/ilbc/filter.h create mode 100644 asterisk/codecs/ilbc/gainquant.c create mode 100644 asterisk/codecs/ilbc/gainquant.h create mode 100644 asterisk/codecs/ilbc/getCBvec.c create mode 100644 asterisk/codecs/ilbc/getCBvec.h create mode 100644 asterisk/codecs/ilbc/helpfun.c create mode 100644 asterisk/codecs/ilbc/helpfun.h create mode 100644 asterisk/codecs/ilbc/hpInput.c create mode 100644 asterisk/codecs/ilbc/hpInput.h create mode 100644 asterisk/codecs/ilbc/hpOutput.c create mode 100644 asterisk/codecs/ilbc/hpOutput.h create mode 100644 asterisk/codecs/ilbc/iCBConstruct.c create mode 100644 asterisk/codecs/ilbc/iCBConstruct.h create mode 100644 asterisk/codecs/ilbc/iCBSearch.c create mode 100644 asterisk/codecs/ilbc/iCBSearch.h create mode 100644 asterisk/codecs/ilbc/iLBC_decode.c create mode 100644 asterisk/codecs/ilbc/iLBC_decode.h create mode 100644 asterisk/codecs/ilbc/iLBC_define.h create mode 100644 asterisk/codecs/ilbc/iLBC_encode.c create mode 100644 asterisk/codecs/ilbc/iLBC_encode.h create mode 100644 asterisk/codecs/ilbc/iLBC_test.c create mode 100644 asterisk/codecs/ilbc/lsf.c create mode 100644 asterisk/codecs/ilbc/lsf.h create mode 100644 asterisk/codecs/ilbc/packing.c create mode 100644 asterisk/codecs/ilbc/packing.h create mode 100644 asterisk/codecs/ilbc/rfc3951.txt create mode 100644 asterisk/codecs/ilbc/syntFilter.c create mode 100644 asterisk/codecs/ilbc/syntFilter.h diff --git a/asterisk/codecs/codec_ilbc.c b/asterisk/codecs/codec_ilbc.c index 3e48aef3..9317bbb6 100644 --- a/asterisk/codecs/codec_ilbc.c +++ b/asterisk/codecs/codec_ilbc.c @@ -55,11 +55,11 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 114611 $") #include "ilbc_slin_ex.h" #define USE_ILBC_ENHANCER 0 -#define ILBC_MS 30 -/* #define ILBC_MS 20 */ +/*#define ILBC_MS 30 */ +#define ILBC_MS 20 -#define ILBC_FRAME_LEN 50 /* apparently... */ -#define ILBC_SAMPLES 240 /* 30ms at 8000 hz */ +#define ILBC_FRAME_LEN 38 /* apparently... */ +#define ILBC_SAMPLES 160 /* 20ms at 8000 hz */ #define BUFFER_SAMPLES 8000 struct ilbc_coder_pvt { @@ -107,7 +107,7 @@ static struct ast_frame *ilbctolin_sample(void) f.frametype = AST_FRAME_VOICE; f.subclass = AST_FORMAT_ILBC; f.datalen = sizeof(ilbc_slin_ex); - /* All frames are 30 ms long */ + /* All frames are 20 ms long */ f.samples = ILBC_SAMPLES; f.mallocd = 0; f.offset = 0; @@ -135,7 +135,7 @@ static int ilbctolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) } if (f->datalen % ILBC_FRAME_LEN) { - ast_log(LOG_WARNING, "Huh? An ilbc frame that isn't a multiple of 50 bytes long from %s (%d)?\n", f->src, f->datalen); + ast_log(LOG_WARNING, "Huh? An ilbc frame that isn't a multiple of 38 bytes long from %s (%d)?\n", f->src, f->datalen); return -1; } diff --git a/asterisk/codecs/ilbc/FrameClassify.c b/asterisk/codecs/ilbc/FrameClassify.c new file mode 100644 index 00000000..80d72d91 --- /dev/null +++ b/asterisk/codecs/ilbc/FrameClassify.c @@ -0,0 +1,114 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + FrameClassify.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include "iLBC_define.h" + + /*---------------------------------------------------------------* + * Classification of subframes to localize start state + *--------------------------------------------------------------*/ + + int FrameClassify( /* index to the max-energy sub-frame */ + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i/o) the encoder state structure */ + float *residual /* (i) lpc residual signal */ + ) { + float max_ssqEn, fssqEn[NSUB_MAX], bssqEn[NSUB_MAX], *pp; + int n, l, max_ssqEn_n; + const float ssqEn_win[NSUB_MAX-1]={(float)0.8,(float)0.9, + (float)1.0,(float)0.9,(float)0.8}; + const float sampEn_win[5]={(float)1.0/(float)6.0, + (float)2.0/(float)6.0, (float)3.0/(float)6.0, + (float)4.0/(float)6.0, (float)5.0/(float)6.0}; + + /* init the front and back energies to zero */ + + memset(fssqEn, 0, NSUB_MAX*sizeof(float)); + memset(bssqEn, 0, NSUB_MAX*sizeof(float)); + + /* Calculate front of first seqence */ + + n=0; + pp=residual; + for (l=0; l<5; l++) { + fssqEn[n] += sampEn_win[l] * (*pp) * (*pp); + pp++; + } + for (l=5; lnsub-1; n++) { + pp=residual+n*SUBL; + for (l=0; l<5; l++) { + fssqEn[n] += sampEn_win[l] * (*pp) * (*pp); + bssqEn[n] += (*pp) * (*pp); + pp++; + } + for (l=5; lnsub-1; + pp=residual+n*SUBL; + for (l=0; lmode==20) l=1; + else l=0; + + max_ssqEn=(fssqEn[0]+bssqEn[1])*ssqEn_win[l]; + max_ssqEn_n=1; + for (n=2; nnsub; n++) { + + + + + + + l++; + if ((fssqEn[n-1]+bssqEn[n])*ssqEn_win[l] > max_ssqEn) { + max_ssqEn=(fssqEn[n-1]+bssqEn[n]) * + ssqEn_win[l]; + max_ssqEn_n=n; + } + } + + return max_ssqEn_n; + } + diff --git a/asterisk/codecs/ilbc/FrameClassify.h b/asterisk/codecs/ilbc/FrameClassify.h new file mode 100644 index 00000000..018ddbe5 --- /dev/null +++ b/asterisk/codecs/ilbc/FrameClassify.h @@ -0,0 +1,27 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + FrameClassify.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_FRAMECLASSIFY_H + #define __iLBC_FRAMECLASSIFY_H + + int FrameClassify( /* index to the max-energy sub-frame */ + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i/o) the encoder state structure */ + float *residual /* (i) lpc residual signal */ + ); + + + + + + #endif + diff --git a/asterisk/codecs/ilbc/LPCdecode.c b/asterisk/codecs/ilbc/LPCdecode.c new file mode 100644 index 00000000..81bab904 --- /dev/null +++ b/asterisk/codecs/ilbc/LPCdecode.c @@ -0,0 +1,158 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + LPC_decode.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + + #include "helpfun.h" + #include "lsf.h" + #include "iLBC_define.h" + #include "constants.h" + + /*---------------------------------------------------------------* + * interpolation of lsf coefficients for the decoder + *--------------------------------------------------------------*/ + + void LSFinterpolate2a_dec( + float *a, /* (o) lpc coefficients for a sub-frame */ + float *lsf1, /* (i) first lsf coefficient vector */ + float *lsf2, /* (i) second lsf coefficient vector */ + float coef, /* (i) interpolation weight */ + int length /* (i) length of lsf vectors */ + ){ + float lsftmp[LPC_FILTERORDER]; + + interpolate(lsftmp, lsf1, lsf2, coef, length); + lsf2a(a, lsftmp); + } + + /*---------------------------------------------------------------* + * obtain dequantized lsf coefficients from quantization index + *--------------------------------------------------------------*/ + + void SimplelsfDEQ( + float *lsfdeq, /* (o) dequantized lsf coefficients */ + int *index, /* (i) quantization index */ + int lpc_n /* (i) number of LPCs */ + ){ + int i, j, pos, cb_pos; + + + + + + /* decode first LSF */ + + pos = 0; + cb_pos = 0; + for (i = 0; i < LSF_NSPLIT; i++) { + for (j = 0; j < dim_lsfCbTbl[i]; j++) { + lsfdeq[pos + j] = lsfCbTbl[cb_pos + + (long)(index[i])*dim_lsfCbTbl[i] + j]; + } + pos += dim_lsfCbTbl[i]; + cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i]; + } + + if (lpc_n>1) { + + /* decode last LSF */ + + pos = 0; + cb_pos = 0; + for (i = 0; i < LSF_NSPLIT; i++) { + for (j = 0; j < dim_lsfCbTbl[i]; j++) { + lsfdeq[LPC_FILTERORDER + pos + j] = + lsfCbTbl[cb_pos + + (long)(index[LSF_NSPLIT + i])* + dim_lsfCbTbl[i] + j]; + } + pos += dim_lsfCbTbl[i]; + cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i]; + } + } + } + + /*----------------------------------------------------------------* + * obtain synthesis and weighting filters form lsf coefficients + *---------------------------------------------------------------*/ + + void DecoderInterpolateLSF( + float *syntdenum, /* (o) synthesis filter coefficients */ + float *weightdenum, /* (o) weighting denumerator + coefficients */ + float *lsfdeq, /* (i) dequantized lsf coefficients */ + int length, /* (i) length of lsf coefficient vector */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i) the decoder state structure */ + ){ + int i, pos, lp_length; + float lp[LPC_FILTERORDER + 1], *lsfdeq2; + + + + + + + lsfdeq2 = lsfdeq + length; + lp_length = length + 1; + + if (iLBCdec_inst->mode==30) { + /* sub-frame 1: Interpolation between old and first */ + + LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq, + lsf_weightTbl_30ms[0], length); + memcpy(syntdenum,lp,lp_length*sizeof(float)); + bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, + lp_length); + + /* sub-frames 2 to 6: interpolation between first + and last LSF */ + + pos = lp_length; + for (i = 1; i < 6; i++) { + LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2, + lsf_weightTbl_30ms[i], length); + memcpy(syntdenum + pos,lp,lp_length*sizeof(float)); + bwexpand(weightdenum + pos, lp, + LPC_CHIRP_WEIGHTDENUM, lp_length); + pos += lp_length; + } + } + else { + pos = 0; + for (i = 0; i < iLBCdec_inst->nsub; i++) { + LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, + lsfdeq, lsf_weightTbl_20ms[i], length); + memcpy(syntdenum+pos,lp,lp_length*sizeof(float)); + bwexpand(weightdenum+pos, lp, LPC_CHIRP_WEIGHTDENUM, + lp_length); + pos += lp_length; + } + } + + /* update memory */ + + if (iLBCdec_inst->mode==30) + memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2, + length*sizeof(float)); + else + memcpy(iLBCdec_inst->lsfdeqold, lsfdeq, + length*sizeof(float)); + + } + + + + + + diff --git a/asterisk/codecs/ilbc/LPCdecode.h b/asterisk/codecs/ilbc/LPCdecode.h new file mode 100644 index 00000000..abe1d7b3 --- /dev/null +++ b/asterisk/codecs/ilbc/LPCdecode.h @@ -0,0 +1,52 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + LPC_decode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_LPC_DECODE_H + #define __iLBC_LPC_DECODE_H + + void LSFinterpolate2a_dec( + float *a, /* (o) lpc coefficients for a sub-frame */ + float *lsf1, /* (i) first lsf coefficient vector */ + float *lsf2, /* (i) second lsf coefficient vector */ + float coef, /* (i) interpolation weight */ + int length /* (i) length of lsf vectors */ + ); + + void SimplelsfDEQ( + float *lsfdeq, /* (o) dequantized lsf coefficients */ + int *index, /* (i) quantization index */ + int lpc_n /* (i) number of LPCs */ + ); + + void DecoderInterpolateLSF( + float *syntdenum, /* (o) synthesis filter coefficients */ + float *weightdenum, /* (o) weighting denumerator + coefficients */ + float *lsfdeq, /* (i) dequantized lsf coefficients */ + int length, /* (i) length of lsf coefficient vector */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i) the decoder state structure */ + ); + + #endif + + + + + + + + + + + + diff --git a/asterisk/codecs/ilbc/LPCencode.c b/asterisk/codecs/ilbc/LPCencode.c new file mode 100644 index 00000000..19695c0f --- /dev/null +++ b/asterisk/codecs/ilbc/LPCencode.c @@ -0,0 +1,241 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + LPCencode.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + + #include "iLBC_define.h" + #include "helpfun.h" + #include "lsf.h" + #include "constants.h" + + + + + + /*----------------------------------------------------------------* + * lpc analysis (subrutine to LPCencode) + *---------------------------------------------------------------*/ + + void SimpleAnalysis( + float *lsf, /* (o) lsf coefficients */ + float *data, /* (i) new data vector */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ){ + int k, is; + float temp[BLOCKL_MAX], lp[LPC_FILTERORDER + 1]; + float lp2[LPC_FILTERORDER + 1]; + float r[LPC_FILTERORDER + 1]; + + is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl; + memcpy(iLBCenc_inst->lpc_buffer+is,data, + iLBCenc_inst->blockl*sizeof(float)); + + /* No lookahead, last window is asymmetric */ + + for (k = 0; k < iLBCenc_inst->lpc_n; k++) { + + is = LPC_LOOKBACK; + + if (k < (iLBCenc_inst->lpc_n - 1)) { + window(temp, lpc_winTbl, + iLBCenc_inst->lpc_buffer, BLOCKL_MAX); + } else { + window(temp, lpc_asymwinTbl, + iLBCenc_inst->lpc_buffer + is, BLOCKL_MAX); + } + + autocorr(r, temp, BLOCKL_MAX, LPC_FILTERORDER); + window(r, r, lpc_lagwinTbl, LPC_FILTERORDER + 1); + + levdurb(lp, temp, r, LPC_FILTERORDER); + bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, LPC_FILTERORDER+1); + + a2lsf(lsf + k*LPC_FILTERORDER, lp2); + } + is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl; + memmove(iLBCenc_inst->lpc_buffer, + iLBCenc_inst->lpc_buffer+LPC_LOOKBACK+BLOCKL_MAX-is, + is*sizeof(float)); + } + + /*----------------------------------------------------------------* + + + + + + * lsf interpolator and conversion from lsf to a coefficients + * (subrutine to SimpleInterpolateLSF) + *---------------------------------------------------------------*/ + + void LSFinterpolate2a_enc( + float *a, /* (o) lpc coefficients */ + float *lsf1,/* (i) first set of lsf coefficients */ + float *lsf2,/* (i) second set of lsf coefficients */ + float coef, /* (i) weighting coefficient to use between + lsf1 and lsf2 */ + long length /* (i) length of coefficient vectors */ + ){ + float lsftmp[LPC_FILTERORDER]; + + interpolate(lsftmp, lsf1, lsf2, coef, length); + lsf2a(a, lsftmp); + } + + /*----------------------------------------------------------------* + * lsf interpolator (subrutine to LPCencode) + *---------------------------------------------------------------*/ + + void SimpleInterpolateLSF( + float *syntdenum, /* (o) the synthesis filter denominator + resulting from the quantized + interpolated lsf */ + float *weightdenum, /* (o) the weighting filter denominator + resulting from the unquantized + interpolated lsf */ + float *lsf, /* (i) the unquantized lsf coefficients */ + float *lsfdeq, /* (i) the dequantized lsf coefficients */ + float *lsfold, /* (i) the unquantized lsf coefficients of + the previous signal frame */ + float *lsfdeqold, /* (i) the dequantized lsf coefficients of + the previous signal frame */ + int length, /* (i) should equate LPC_FILTERORDER */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ){ + int i, pos, lp_length; + float lp[LPC_FILTERORDER + 1], *lsf2, *lsfdeq2; + + lsf2 = lsf + length; + lsfdeq2 = lsfdeq + length; + lp_length = length + 1; + + if (iLBCenc_inst->mode==30) { + /* sub-frame 1: Interpolation between old and first + + + + + + set of lsf coefficients */ + + LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, + lsf_weightTbl_30ms[0], length); + memcpy(syntdenum,lp,lp_length*sizeof(float)); + LSFinterpolate2a_enc(lp, lsfold, lsf, + lsf_weightTbl_30ms[0], length); + bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length); + + /* sub-frame 2 to 6: Interpolation between first + and second set of lsf coefficients */ + + pos = lp_length; + for (i = 1; i < iLBCenc_inst->nsub; i++) { + LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2, + lsf_weightTbl_30ms[i], length); + memcpy(syntdenum + pos,lp,lp_length*sizeof(float)); + + LSFinterpolate2a_enc(lp, lsf, lsf2, + lsf_weightTbl_30ms[i], length); + bwexpand(weightdenum + pos, lp, + LPC_CHIRP_WEIGHTDENUM, lp_length); + pos += lp_length; + } + } + else { + pos = 0; + for (i = 0; i < iLBCenc_inst->nsub; i++) { + LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, + lsf_weightTbl_20ms[i], length); + memcpy(syntdenum+pos,lp,lp_length*sizeof(float)); + LSFinterpolate2a_enc(lp, lsfold, lsf, + lsf_weightTbl_20ms[i], length); + bwexpand(weightdenum+pos, lp, + LPC_CHIRP_WEIGHTDENUM, lp_length); + pos += lp_length; + } + } + + /* update memory */ + + if (iLBCenc_inst->mode==30) { + memcpy(lsfold, lsf2, length*sizeof(float)); + memcpy(lsfdeqold, lsfdeq2, length*sizeof(float)); + } + else { + memcpy(lsfold, lsf, length*sizeof(float)); + memcpy(lsfdeqold, lsfdeq, length*sizeof(float)); + + + + + + } + } + + /*----------------------------------------------------------------* + * lsf quantizer (subrutine to LPCencode) + *---------------------------------------------------------------*/ + + void SimplelsfQ( + float *lsfdeq, /* (o) dequantized lsf coefficients + (dimension FILTERORDER) */ + int *index, /* (o) quantization index */ + float *lsf, /* (i) the lsf coefficient vector to be + quantized (dimension FILTERORDER ) */ + int lpc_n /* (i) number of lsf sets to quantize */ + ){ + /* Quantize first LSF with memoryless split VQ */ + SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT, + dim_lsfCbTbl, size_lsfCbTbl); + + if (lpc_n==2) { + /* Quantize second LSF with memoryless split VQ */ + SplitVQ(lsfdeq + LPC_FILTERORDER, index + LSF_NSPLIT, + lsf + LPC_FILTERORDER, lsfCbTbl, LSF_NSPLIT, + dim_lsfCbTbl, size_lsfCbTbl); + } + } + + /*----------------------------------------------------------------* + * lpc encoder + *---------------------------------------------------------------*/ + + void LPCencode( + float *syntdenum, /* (i/o) synthesis filter coefficients + before/after encoding */ + float *weightdenum, /* (i/o) weighting denumerator + coefficients before/after + encoding */ + int *lsf_index, /* (o) lsf quantization index */ + float *data, /* (i) lsf coefficients to quantize */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ){ + float lsf[LPC_FILTERORDER * LPC_N_MAX]; + float lsfdeq[LPC_FILTERORDER * LPC_N_MAX]; + int change=0; + + SimpleAnalysis(lsf, data, iLBCenc_inst); + SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n); + + + + + + change=LSF_check(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n); + SimpleInterpolateLSF(syntdenum, weightdenum, + lsf, lsfdeq, iLBCenc_inst->lsfold, + iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst); + } + diff --git a/asterisk/codecs/ilbc/LPCencode.h b/asterisk/codecs/ilbc/LPCencode.h new file mode 100644 index 00000000..39a9b040 --- /dev/null +++ b/asterisk/codecs/ilbc/LPCencode.h @@ -0,0 +1,28 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + LPCencode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_LPCENCOD_H + #define __iLBC_LPCENCOD_H + + void LPCencode( + float *syntdenum, /* (i/o) synthesis filter coefficients + before/after encoding */ + float *weightdenum, /* (i/o) weighting denumerator coefficients + before/after encoding */ + int *lsf_index, /* (o) lsf quantization index */ + float *data, /* (i) lsf coefficients to quantize */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ); + + #endif + diff --git a/asterisk/codecs/ilbc/StateConstructW.c b/asterisk/codecs/ilbc/StateConstructW.c new file mode 100644 index 00000000..1d3e65fa --- /dev/null +++ b/asterisk/codecs/ilbc/StateConstructW.c @@ -0,0 +1,86 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + StateConstructW.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + + #include "iLBC_define.h" + #include "constants.h" + #include "filter.h" + + /*----------------------------------------------------------------* + * decoding of the start state + *---------------------------------------------------------------*/ + + void StateConstructW( + int idxForMax, /* (i) 6-bit index for the quantization of + max amplitude */ + int *idxVec, /* (i) vector of quantization indexes */ + float *syntDenum, /* (i) synthesis filter denumerator */ + + + + + + float *out, /* (o) the decoded state vector */ + int len /* (i) length of a state vector */ + ){ + float maxVal, tmpbuf[LPC_FILTERORDER+2*STATE_LEN], *tmp, + numerator[LPC_FILTERORDER+1]; + float foutbuf[LPC_FILTERORDER+2*STATE_LEN], *fout; + int k,tmpi; + + /* decoding of the maximum value */ + + maxVal = state_frgqTbl[idxForMax]; + maxVal = (float)pow(10,maxVal)/(float)4.5; + + /* initialization of buffers and coefficients */ + + memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float)); + memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float)); + for (k=0; k + #include + + #include "iLBC_define.h" + #include "constants.h" + #include "filter.h" + #include "helpfun.h" + + /*----------------------------------------------------------------* + * predictive noise shaping encoding of scaled start state + * (subrutine for StateSearchW) + *---------------------------------------------------------------*/ + + void AbsQuantW( + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i) Encoder instance */ + float *in, /* (i) vector to encode */ + float *syntDenum, /* (i) denominator of synthesis filter */ + float *weightDenum, /* (i) denominator of weighting filter */ + int *out, /* (o) vector of quantizer indexes */ + int len, /* (i) length of vector to encode and + vector of quantizer indexes */ + int state_first /* (i) position of start state in the + 80 vec */ + ){ + float *syntOut; + float syntOutBuf[LPC_FILTERORDER+STATE_SHORT_LEN_30MS]; + float toQ, xq; + int n; + int index; + + /* initialization of buffer for filtering */ + + memset(syntOutBuf, 0, LPC_FILTERORDER*sizeof(float)); + + + + + + + /* initialization of pointer for filtering */ + + syntOut = &syntOutBuf[LPC_FILTERORDER]; + + /* synthesis and weighting filters on input */ + + if (state_first) { + AllPoleFilter (in, weightDenum, SUBL, LPC_FILTERORDER); + } else { + AllPoleFilter (in, weightDenum, + iLBCenc_inst->state_short_len-SUBL, + LPC_FILTERORDER); + } + + /* encoding loop */ + + for (n=0; nstate_short_len-SUBL))) { + syntDenum += (LPC_FILTERORDER+1); + weightDenum += (LPC_FILTERORDER+1); + + /* synthesis and weighting filters on input */ + AllPoleFilter (&in[n], weightDenum, len-n, + LPC_FILTERORDER); + + } + + /* prediction of synthesized and weighted input */ + + syntOut[n] = 0.0; + AllPoleFilter (&syntOut[n], weightDenum, 1, + LPC_FILTERORDER); + + /* quantization */ + + toQ = in[n]-syntOut[n]; + + + + + + sort_sq(&xq, &index, toQ, state_sq3Tbl, 8); + out[n]=index; + syntOut[n] = state_sq3Tbl[out[n]]; + + /* update of the prediction filter */ + + AllPoleFilter(&syntOut[n], weightDenum, 1, + LPC_FILTERORDER); + } + } + + /*----------------------------------------------------------------* + * encoding of start state + *---------------------------------------------------------------*/ + + void StateSearchW( + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i) Encoder instance */ + float *residual,/* (i) target residual vector */ + float *syntDenum, /* (i) lpc synthesis filter */ + float *weightDenum, /* (i) weighting filter denuminator */ + int *idxForMax, /* (o) quantizer index for maximum + amplitude */ + int *idxVec, /* (o) vector of quantization indexes */ + int len, /* (i) length of all vectors */ + int state_first /* (i) position of start state in the + 80 vec */ + ){ + float dtmp, maxVal; + float tmpbuf[LPC_FILTERORDER+2*STATE_SHORT_LEN_30MS]; + float *tmp, numerator[1+LPC_FILTERORDER]; + float foutbuf[LPC_FILTERORDER+2*STATE_SHORT_LEN_30MS], *fout; + int k; + float qmax, scal; + + /* initialization of buffers and filter coefficients */ + + memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float)); + memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float)); + for (k=0; k maxVal*maxVal){ + maxVal = fout[k]; + } + } + maxVal=(float)fabs(maxVal); + + /* encoding of the maximum amplitude value */ + + if (maxVal < 10.0) { + maxVal = 10.0; + } + maxVal = (float)log10(maxVal); + sort_sq(&dtmp, idxForMax, maxVal, state_frgqTbl, 64); + + /* decoding of the maximum amplitude representation value, + and corresponding scaling of start state */ + + maxVal=state_frgqTbl[*idxForMax]; + qmax = (float)pow(10,maxVal); + scal = (float)(4.5)/qmax; + for (k=0; k + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * LP analysis filter. + *---------------------------------------------------------------*/ + + void anaFilter( + float *In, /* (i) Signal to be filtered */ + float *a, /* (i) LP parameters */ + int len,/* (i) Length of signal */ + float *Out, /* (o) Filtered signal */ + float *mem /* (i/o) Filter state */ + ){ + int i, j; + float *po, *pi, *pm, *pa; + + po = Out; + + /* Filter first part using memory from past */ + + for (i=0; i + #include + + /*----------------------------------------------------------------* + * Construct an additional codebook vector by filtering the + * initial codebook buffer. This vector is then used to expand + * the codebook with an additional section. + *---------------------------------------------------------------*/ + + void filteredCBvecs( + float *cbvectors, /* (o) Codebook vectors for the + higher section */ + float *mem, /* (i) Buffer to create codebook + vector from */ + int lMem /* (i) Length of buffer */ + ){ + int j, k; + float *pp, *pp1; + float tempbuff2[CB_MEML+CB_FILTERLEN]; + float *pos; + + memset(tempbuff2, 0, (CB_HALFFILTERLEN-1)*sizeof(float)); + memcpy(&tempbuff2[CB_HALFFILTERLEN-1], mem, lMem*sizeof(float)); + memset(&tempbuff2[lMem+CB_HALFFILTERLEN-1], 0, + (CB_HALFFILTERLEN+1)*sizeof(float)); + + /* Create codebook vector for higher section by filtering */ + + /* do filtering */ + pos=cbvectors; + memset(pos, 0, lMem*sizeof(float)); + for (k=0; k0.0) { + invenergy[tmpIndex]=(float)1.0/(energy[tmpIndex]+EPS); + } else { + invenergy[tmpIndex] = (float) 0.0; + } + + if (stage==0) { + measure = (float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot*invenergy[tmpIndex]; + } + } + else { + measure = crossDot*crossDot*invenergy[tmpIndex]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[tmpIndex]; + + if ((measure>*max_measure) && (fabs(ftmp) + #include + #include + + + + + + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * Compute cross correlation and pitch gain for pitch prediction + * of last subframe at given lag. + *---------------------------------------------------------------*/ + + void compCorr( + float *cc, /* (o) cross correlation coefficient */ + float *gc, /* (o) gain */ + float *pm, + float *buffer, /* (i) signal buffer */ + int lag, /* (i) pitch lag */ + int bLen, /* (i) length of buffer */ + int sRange /* (i) correlation search length */ + ){ + int i; + float ftmp1, ftmp2, ftmp3; + + /* Guard against getting outside buffer */ + if ((bLen-sRange-lag)<0) { + sRange=bLen-lag; + } + + ftmp1 = 0.0; + ftmp2 = 0.0; + ftmp3 = 0.0; + for (i=0; i 0.0) { + *cc = ftmp1*ftmp1/ftmp2; + *gc = (float)fabs(ftmp1/ftmp2); + *pm=(float)fabs(ftmp1)/ + ((float)sqrt(ftmp2)*(float)sqrt(ftmp3)); + } + else { + *cc = 0.0; + *gc = 0.0; + *pm=0.0; + } + } + + + + + + /*----------------------------------------------------------------* + * Packet loss concealment routine. Conceals a residual signal + * and LP parameters. If no packet loss, update state. + *---------------------------------------------------------------*/ + + void doThePLC( + float *PLCresidual, /* (o) concealed residual */ + float *PLClpc, /* (o) concealed LP parameters */ + int PLI, /* (i) packet loss indicator + 0 - no PL, 1 = PL */ + float *decresidual, /* (i) decoded residual */ + float *lpc, /* (i) decoded LPC (only used for no PL) */ + int inlag, /* (i) pitch lag */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i/o) decoder instance */ + ){ + int lag=20, randlag; + float gain, maxcc; + float use_gain; + float gain_comp, maxcc_comp, per, max_per; + int i, pick, use_lag; + float ftmp, randvec[BLOCKL_MAX], pitchfact, energy; + + /* Packet Loss */ + + if (PLI == 1) { + + iLBCdec_inst->consPLICount += 1; + + /* if previous frame not lost, + determine pitch pred. gain */ + + if (iLBCdec_inst->prevPLI != 1) { + + /* Search around the previous lag to find the + best pitch period */ + + lag=inlag-3; + compCorr(&maxcc, &gain, &max_per, + iLBCdec_inst->prevResidual, + lag, iLBCdec_inst->blockl, 60); + for (i=inlag-2;i<=inlag+3;i++) { + compCorr(&maxcc_comp, &gain_comp, &per, + iLBCdec_inst->prevResidual, + i, iLBCdec_inst->blockl, 60); + + if (maxcc_comp>maxcc) { + maxcc=maxcc_comp; + + + + + + gain=gain_comp; + lag=i; + max_per=per; + } + } + + } + + /* previous frame lost, use recorded lag and periodicity */ + + else { + lag=iLBCdec_inst->prevLag; + max_per=iLBCdec_inst->per; + } + + /* downscaling */ + + use_gain=1.0; + if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl>320) + use_gain=(float)0.9; + else if (iLBCdec_inst->consPLICount* + iLBCdec_inst->blockl>2*320) + use_gain=(float)0.7; + else if (iLBCdec_inst->consPLICount* + iLBCdec_inst->blockl>3*320) + use_gain=(float)0.5; + else if (iLBCdec_inst->consPLICount* + iLBCdec_inst->blockl>4*320) + use_gain=(float)0.0; + + /* mix noise and pitch repeatition */ + ftmp=(float)sqrt(max_per); + if (ftmp>(float)0.7) + pitchfact=(float)1.0; + else if (ftmp>(float)0.4) + pitchfact=(ftmp-(float)0.4)/((float)0.7-(float)0.4); + else + pitchfact=0.0; + + + /* avoid repetition of same pitch cycle */ + use_lag=lag; + if (lag<80) { + use_lag=2*lag; + } + + /* compute concealed residual */ + + + + + + + energy = 0.0; + for (i=0; iblockl; i++) { + + /* noise component */ + + iLBCdec_inst->seed=(iLBCdec_inst->seed*69069L+1) & + (0x80000000L-1); + randlag = 50 + ((signed long) iLBCdec_inst->seed)%70; + pick = i - randlag; + + if (pick < 0) { + randvec[i] = + iLBCdec_inst->prevResidual[ + iLBCdec_inst->blockl+pick]; + } else { + randvec[i] = randvec[pick]; + } + + /* pitch repeatition component */ + pick = i - use_lag; + + if (pick < 0) { + PLCresidual[i] = + iLBCdec_inst->prevResidual[ + iLBCdec_inst->blockl+pick]; + } else { + PLCresidual[i] = PLCresidual[pick]; + } + + /* mix random and periodicity component */ + + if (i<80) + PLCresidual[i] = use_gain*(pitchfact * + PLCresidual[i] + + ((float)1.0 - pitchfact) * randvec[i]); + else if (i<160) + PLCresidual[i] = (float)0.95*use_gain*(pitchfact * + PLCresidual[i] + + ((float)1.0 - pitchfact) * randvec[i]); + else + PLCresidual[i] = (float)0.9*use_gain*(pitchfact * + PLCresidual[i] + + ((float)1.0 - pitchfact) * randvec[i]); + + energy += PLCresidual[i] * PLCresidual[i]; + } + + /* less than 30 dB, use only noise */ + + + + + + + if (sqrt(energy/(float)iLBCdec_inst->blockl) < 30.0) { + gain=0.0; + for (i=0; iblockl; i++) { + PLCresidual[i] = randvec[i]; + } + } + + /* use old LPC */ + + memcpy(PLClpc,iLBCdec_inst->prevLpc, + (LPC_FILTERORDER+1)*sizeof(float)); + + } + + /* no packet loss, copy input */ + + else { + memcpy(PLCresidual, decresidual, + iLBCdec_inst->blockl*sizeof(float)); + memcpy(PLClpc, lpc, (LPC_FILTERORDER+1)*sizeof(float)); + iLBCdec_inst->consPLICount = 0; + } + + /* update state */ + + if (PLI) { + iLBCdec_inst->prevLag = lag; + iLBCdec_inst->per=max_per; + } + + iLBCdec_inst->prevPLI = PLI; + memcpy(iLBCdec_inst->prevLpc, PLClpc, + (LPC_FILTERORDER+1)*sizeof(float)); + memcpy(iLBCdec_inst->prevResidual, PLCresidual, + iLBCdec_inst->blockl*sizeof(float)); + } + diff --git a/asterisk/codecs/ilbc/doCPLC.h b/asterisk/codecs/ilbc/doCPLC.h new file mode 100644 index 00000000..2bda7a14 --- /dev/null +++ b/asterisk/codecs/ilbc/doCPLC.h @@ -0,0 +1,29 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + doCPLC.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_DOLPC_H + #define __iLBC_DOLPC_H + + void doThePLC( + float *PLCresidual, /* (o) concealed residual */ + float *PLClpc, /* (o) concealed LP parameters */ + int PLI, /* (i) packet loss indicator + 0 - no PL, 1 = PL */ + float *decresidual, /* (i) decoded residual */ + float *lpc, /* (i) decoded LPC (only used for no PL) */ + int inlag, /* (i) pitch lag */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i/o) decoder instance */ + ); + + #endif + diff --git a/asterisk/codecs/ilbc/enhancer.c b/asterisk/codecs/ilbc/enhancer.c new file mode 100644 index 00000000..1770207d --- /dev/null +++ b/asterisk/codecs/ilbc/enhancer.c @@ -0,0 +1,701 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + enhancer.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include "iLBC_define.h" + #include "constants.h" + #include "filter.h" + + /*----------------------------------------------------------------* + * Find index in array such that the array element with said + * index is the element of said array closest to "value" + * according to the squared-error criterion + *---------------------------------------------------------------*/ + + void NearestNeighbor( + + + + + + int *index, /* (o) index of array element closest + to value */ + float *array, /* (i) data array */ + float value,/* (i) value */ + int arlength/* (i) dimension of data array */ + ){ + int i; + float bestcrit,crit; + + crit=array[0]-value; + bestcrit=crit*crit; + *index=0; + for (i=1; i dim1 ) { + hfl2=(int) (dim1/2); + for (j=0; j= idatal) { + searchSegEndPos=idatal-ENH_BLOCKL-1; + } + corrdim=searchSegEndPos-searchSegStartPos+1; + + /* compute upsampled correlation (corr33) and find + location of max */ + + mycorr1(corrVec,idata+searchSegStartPos, + corrdim+ENH_BLOCKL-1,idata+centerStartPos,ENH_BLOCKL); + enh_upsample(corrVecUps,corrVec,corrdim,ENH_FL0); + tloc=0; maxv=corrVecUps[0]; + for (i=1; imaxv) { + tloc=i; + maxv=corrVecUps[i]; + } + } + + /* make vector can be upsampled without ever running outside + bounds */ + + *updStartPos= (float)searchSegStartPos + + (float)tloc/(float)ENH_UPS0+(float)1.0; + tloc2=(int)(tloc/ENH_UPS0); + + if (tloc>tloc2*ENH_UPS0) { + tloc2++; + } + st=searchSegStartPos+tloc2-ENH_FL0; + + if (st<0) { + memset(vect,0,-st*sizeof(float)); + memcpy(&vect[-st],idata, (ENH_VECTL+st)*sizeof(float)); + } + else { + + + + + + en=st+ENH_VECTL; + + if (en>idatal) { + memcpy(vect, &idata[st], + (ENH_VECTL-(en-idatal))*sizeof(float)); + memset(&vect[ENH_VECTL-(en-idatal)], 0, + (en-idatal)*sizeof(float)); + } + else { + memcpy(vect, &idata[st], ENH_VECTL*sizeof(float)); + } + } + fraction=tloc2*ENH_UPS0-tloc; + + /* compute the segment (this is actually a convolution) */ + + mycorr1(seg,vect,ENH_VECTL,polyphaserTbl+(2*ENH_FL0+1)*fraction, + 2*ENH_FL0+1); + } + + /*----------------------------------------------------------------* + * find the smoothed output data + *---------------------------------------------------------------*/ + + void smath( + float *odata, /* (o) smoothed output */ + float *sseq,/* (i) said second sequence of waveforms */ + int hl, /* (i) 2*hl+1 is sseq dimension */ + float alpha0/* (i) max smoothing energy fraction */ + ){ + int i,k; + float w00,w10,w11,A,B,C,*psseq,err,errs; + float surround[BLOCKL_MAX]; /* shape contributed by other than + current */ + float wt[2*ENH_HL+1]; /* waveform weighting to get + surround shape */ + float denom; + + /* create shape of contribution from all waveforms except the + current one */ + + for (i=1; i<=2*hl+1; i++) { + wt[i-1] = (float)0.5*(1 - (float)cos(2*PI*i/(2*hl+2))); + } + wt[hl]=0.0; /* for clarity, not used */ + for (i=0; i alpha0 * w00) { + if ( w00 < 1) { + w00=1; + } + denom = (w11*w00-w10*w10)/(w00*w00); + + if (denom > 0.0001) { /* eliminates numerical problems + for if smooth */ + + + + + + A = (float)sqrt( (alpha0- alpha0*alpha0/4)/denom); + B = -alpha0/2 - A * w10/w00; + B = B+1; + } + else { /* essentially no difference between cycles; + smoothing not needed */ + A= 0.0; + B= 1.0; + } + + /* create smoothed sequence */ + + psseq=sseq+hl*ENH_BLOCKL; + for (i=0; i=0; q--) { + blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]]; + NearestNeighbor(lagBlock+q,plocs, + blockStartPos[q]+ + ENH_BLOCKL_HALF-period[lagBlock[q+1]], periodl); + + + if (blockStartPos[q]-ENH_OVERHANG>=0) { + refiner(sseq+q*ENH_BLOCKL, blockStartPos+q, idata, + idatal, centerStartPos, blockStartPos[q], + period[lagBlock[q+1]]); + } else { + psseq=sseq+q*ENH_BLOCKL; + memset(psseq, 0, ENH_BLOCKL*sizeof(float)); + } + } + + /* future */ + + for (i=0; i 0.0) { + return (float)(ftmp1*ftmp1/ftmp2); + } + + + + + + else { + return (float)0.0; + } + } + + /*----------------------------------------------------------------* + * interface for enhancer + *---------------------------------------------------------------*/ + + int enhancerInterface( + float *out, /* (o) enhanced signal */ + float *in, /* (i) unenhanced signal */ + iLBC_Dec_Inst_t *iLBCdec_inst /* (i) buffers etc */ + ){ + float *enh_buf, *enh_period; + int iblock, isample; + int lag=0, ilag, i, ioffset; + float cc, maxcc; + float ftmp1, ftmp2; + float *inPtr, *enh_bufPtr1, *enh_bufPtr2; + float plc_pred[ENH_BLOCKL]; + + float lpState[6], downsampled[(ENH_NBLOCKS*ENH_BLOCKL+120)/2]; + int inLen=ENH_NBLOCKS*ENH_BLOCKL+120; + int start, plc_blockl, inlag; + + enh_buf=iLBCdec_inst->enh_buf; + enh_period=iLBCdec_inst->enh_period; + + memmove(enh_buf, &enh_buf[iLBCdec_inst->blockl], + (ENH_BUFL-iLBCdec_inst->blockl)*sizeof(float)); + + memcpy(&enh_buf[ENH_BUFL-iLBCdec_inst->blockl], in, + iLBCdec_inst->blockl*sizeof(float)); + + if (iLBCdec_inst->mode==30) + plc_blockl=ENH_BLOCKL; + else + plc_blockl=40; + + /* when 20 ms frame, move processing one block */ + ioffset=0; + if (iLBCdec_inst->mode==20) ioffset=1; + + i=3-ioffset; + memmove(enh_period, &enh_period[i], + (ENH_NBLOCKS_TOT-i)*sizeof(float)); + + + + + + + /* Set state information to the 6 samples right before + the samples to be downsampled. */ + + memcpy(lpState, + enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-126, + 6*sizeof(float)); + + /* Down sample a factor 2 to save computations */ + + DownSample(enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-120, + lpFilt_coefsTbl, inLen-ioffset*ENH_BLOCKL, + lpState, downsampled); + + /* Estimate the pitch in the down sampled domain. */ + for (iblock = 0; iblock maxcc) { + maxcc = cc; + lag = ilag; + } + } + + /* Store the estimated lag in the non-downsampled domain */ + enh_period[iblock+ENH_NBLOCKS_EXTRA+ioffset] = (float)lag*2; + + + } + + + /* PLC was performed on the previous packet */ + if (iLBCdec_inst->prev_enh_pl==1) { + + inlag=(int)enh_period[ENH_NBLOCKS_EXTRA+ioffset]; + + lag = inlag-1; + maxcc = xCorrCoef(in, in+lag, plc_blockl); + for (ilag=inlag; ilag<=inlag+1; ilag++) { + cc = xCorrCoef(in, in+ilag, plc_blockl); + + + + + + + if (cc > maxcc) { + maxcc = cc; + lag = ilag; + } + } + + enh_period[ENH_NBLOCKS_EXTRA+ioffset-1]=(float)lag; + + /* compute new concealed residual for the old lookahead, + mix the forward PLC with a backward PLC from + the new frame */ + + inPtr=&in[lag-1]; + + enh_bufPtr1=&plc_pred[plc_blockl-1]; + + if (lag>plc_blockl) { + start=plc_blockl; + } else { + start=lag; + } + + for (isample = start; isample>0; isample--) { + *enh_bufPtr1-- = *inPtr--; + } + + enh_bufPtr2=&enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl]; + for (isample = (plc_blockl-1-lag); isample>=0; isample--) { + *enh_bufPtr1-- = *enh_bufPtr2--; + } + + /* limit energy change */ + ftmp2=0.0; + ftmp1=0.0; + for (i=0;iblockl-i]* + enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl-i]; + ftmp1+=plc_pred[i]*plc_pred[i]; + } + ftmp1=(float)sqrt(ftmp1/(float)plc_blockl); + ftmp2=(float)sqrt(ftmp2/(float)plc_blockl); + if (ftmp1>(float)2.0*ftmp2 && ftmp1>0.0) { + for (i=0;iblockl]; + for (i=0; imode==20) { + /* Enhancer with 40 samples delay */ + for (iblock = 0; iblock<2; iblock++) { + enhancer(out+iblock*ENH_BLOCKL, enh_buf, + ENH_BUFL, (5+iblock)*ENH_BLOCKL+40, + ENH_ALPHA0, enh_period, enh_plocsTbl, + ENH_NBLOCKS_TOT); + } + } else if (iLBCdec_inst->mode==30) { + /* Enhancer with 80 samples delay */ + for (iblock = 0; iblock<3; iblock++) { + enhancer(out+iblock*ENH_BLOCKL, enh_buf, + ENH_BUFL, (4+iblock)*ENH_BLOCKL, + ENH_ALPHA0, enh_period, enh_plocsTbl, + ENH_NBLOCKS_TOT); + } + } + + return (lag*2); + } + diff --git a/asterisk/codecs/ilbc/enhancer.h b/asterisk/codecs/ilbc/enhancer.h new file mode 100644 index 00000000..8a081fb1 --- /dev/null +++ b/asterisk/codecs/ilbc/enhancer.h @@ -0,0 +1,36 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + enhancer.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + + + + + ******************************************************************/ + + #ifndef __ENHANCER_H + #define __ENHANCER_H + + #include "iLBC_define.h" + + float xCorrCoef( + float *target, /* (i) first array */ + float *regressor, /* (i) second array */ + int subl /* (i) dimension arrays */ + ); + + int enhancerInterface( + float *out, /* (o) the enhanced recidual signal */ + float *in, /* (i) the recidual signal to enhance */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i/o) the decoder state structure */ + ); + + #endif + diff --git a/asterisk/codecs/ilbc/extract-cfile.awk b/asterisk/codecs/ilbc/extract-cfile.awk new file mode 100644 index 00000000..e4b07bc0 --- /dev/null +++ b/asterisk/codecs/ilbc/extract-cfile.awk @@ -0,0 +1,24 @@ +BEGIN { srcname = "nothing"; } +{ if (/^A\.[0-9][0-9]*\.* *[a-zA-Z][a-zA-Z_0-9]*\.[ch]/) { + if (srcname != "nothing") + close(srcname); + srcname = $2; + printf("creating source file %s\n", srcname); + }else if (srcname != "nothing") { + if (/Andersen,* *et* *al\./) + printf("skipping %s\n", $0); + else if (/ /) + printf("skipping2 %s\n", $0); + else if (/Internet Low Bit Rate Codec *December 2004/) + printf("skipping3 %s\n", $0); + else if (/Authors' *Addresses/){ + close(srcname); + exit;} + else + print $0 >> srcname; + } +} +END { + printf("ending file %s\n", srcname); + close(srcname); +} diff --git a/asterisk/codecs/ilbc/filter.c b/asterisk/codecs/ilbc/filter.c new file mode 100644 index 00000000..6565c2be --- /dev/null +++ b/asterisk/codecs/ilbc/filter.c @@ -0,0 +1,175 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + filter.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * all-pole filter + *---------------------------------------------------------------*/ + + void AllPoleFilter( + float *InOut, /* (i/o) on entrance InOut[-orderCoef] to + InOut[-1] contain the state of the + filter (delayed samples). InOut[0] to + InOut[lengthInOut-1] contain the filter + input, on en exit InOut[-orderCoef] to + InOut[-1] is unchanged and InOut[0] to + InOut[lengthInOut-1] contain filtered + samples */ + float *Coef,/* (i) filter coefficients, Coef[0] is assumed + to be 1.0 */ + int lengthInOut,/* (i) number of input/output samples */ + int orderCoef /* (i) number of filter coefficients */ + ){ + int n,k; + + for(n=0;n + #include + #include "constants.h" + #include "filter.h" + + /*----------------------------------------------------------------* + * quantizer for the gain in the gain-shape coding of residual + *---------------------------------------------------------------*/ + + float gainquant(/* (o) quantized gain value */ + float in, /* (i) gain value */ + float maxIn,/* (i) maximum of gain value */ + int cblen, /* (i) number of quantization indices */ + int *index /* (o) quantization index */ + ){ + int i, tindex; + float minmeasure,measure, *cb, scale; + + /* ensure a lower bound on the scaling factor */ + + scale=maxIn; + + if (scale<0.1) { + scale=(float)0.1; + } + + /* select the quantization table */ + + if (cblen == 8) { + cb = gain_sq3Tbl; + } else if (cblen == 16) { + cb = gain_sq4Tbl; + } else { + cb = gain_sq5Tbl; + } + + /* select the best index in the quantization table */ + + minmeasure=10000000.0; + tindex=0; + for (i=0; i + + /*----------------------------------------------------------------* + * Construct codebook vector for given index. + *---------------------------------------------------------------*/ + + void getCBvec( + + + + + + float *cbvec, /* (o) Constructed codebook vector */ + float *mem, /* (i) Codebook buffer */ + int index, /* (i) Codebook index */ + int lMem, /* (i) Length of codebook buffer */ + int cbveclen/* (i) Codebook vector length */ + ){ + int j, k, n, memInd, sFilt; + float tmpbuf[CB_MEML]; + int base_size; + int ilow, ihigh; + float alfa, alfa1; + + /* Determine size of codebook sections */ + + base_size=lMem-cbveclen+1; + + if (cbveclen==SUBL) { + base_size+=cbveclen/2; + } + + /* No filter -> First codebook section */ + + if (index + + #include "iLBC_define.h" + #include "constants.h" + + /*----------------------------------------------------------------* + * calculation of auto correlation + *---------------------------------------------------------------*/ + + void autocorr( + float *r, /* (o) autocorrelation vector */ + const float *x, /* (i) data vector */ + int N, /* (i) length of data vector */ + int order /* largest lag for calculated + autocorrelations */ + ){ + int lag, n; + float sum; + + for (lag = 0; lag <= order; lag++) { + sum = 0; + for (n = 0; n < N - lag; n++) { + sum += x[n] * x[n+lag]; + } + r[lag] = sum; + } + + + + + + } + + /*----------------------------------------------------------------* + * window multiplication + *---------------------------------------------------------------*/ + + void window( + float *z, /* (o) the windowed data */ + const float *x, /* (i) the original data vector */ + const float *y, /* (i) the window */ + int N /* (i) length of all vectors */ + ){ + int i; + + for (i = 0; i < N; i++) { + z[i] = x[i] * y[i]; + } + } + + /*----------------------------------------------------------------* + * levinson-durbin solution for lpc coefficients + *---------------------------------------------------------------*/ + + void levdurb( + float *a, /* (o) lpc coefficient vector starting + with 1.0 */ + float *k, /* (o) reflection coefficients */ + float *r, /* (i) autocorrelation vector */ + int order /* (i) order of lpc filter */ + ){ + float sum, alpha; + int m, m_h, i; + + a[0] = 1.0; + + if (r[0] < EPS) { /* if r[0] <= 0, set LPC coeff. to zero */ + for (i = 0; i < order; i++) { + k[i] = 0; + a[i+1] = 0; + } + } else { + a[1] = k[0] = -r[1]/r[0]; + alpha = r[0] + r[1] * k[0]; + for (m = 1; m < order; m++){ + sum = r[m + 1]; + for (i = 0; i < m; i++){ + sum += a[i+1] * r[m - i]; + } + + + + + + k[m] = -sum / alpha; + alpha += k[m] * sum; + m_h = (m + 1) >> 1; + for (i = 0; i < m_h; i++){ + sum = a[i+1] + k[m] * a[m - i]; + a[m - i] += k[m] * a[i+1]; + a[i+1] = sum; + } + a[m+1] = k[m]; + } + } + } + + /*----------------------------------------------------------------* + * interpolation between vectors + *---------------------------------------------------------------*/ + + void interpolate( + float *out, /* (o) the interpolated vector */ + float *in1, /* (i) the first vector for the + interpolation */ + float *in2, /* (i) the second vector for the + interpolation */ + float coef, /* (i) interpolation weights */ + int length /* (i) length of all vectors */ + ){ + int i; + float invcoef; + + invcoef = (float)1.0 - coef; + for (i = 0; i < length; i++) { + out[i] = coef * in1[i] + invcoef * in2[i]; + } + } + + /*----------------------------------------------------------------* + * lpc bandwidth expansion + *---------------------------------------------------------------*/ + + void bwexpand( + float *out, /* (o) the bandwidth expanded lpc + coefficients */ + float *in, /* (i) the lpc coefficients before bandwidth + expansion */ + float coef, /* (i) the bandwidth expansion factor */ + int length /* (i) the length of lpc coefficient vectors */ + ){ + int i; + + + + + + float chirp; + + chirp = coef; + + out[0] = in[0]; + for (i = 1; i < length; i++) { + out[i] = chirp * in[i]; + chirp *= coef; + } + } + + /*----------------------------------------------------------------* + * vector quantization + *---------------------------------------------------------------*/ + + void vq( + float *Xq, /* (o) the quantized vector */ + int *index, /* (o) the quantization index */ + const float *CB,/* (i) the vector quantization codebook */ + float *X, /* (i) the vector to quantize */ + int n_cb, /* (i) the number of vectors in the codebook */ + int dim /* (i) the dimension of all vectors */ + ){ + int i, j; + int pos, minindex; + float dist, tmp, mindist; + + pos = 0; + mindist = FLOAT_MAX; + minindex = 0; + for (j = 0; j < n_cb; j++) { + dist = X[0] - CB[pos]; + dist *= dist; + for (i = 1; i < dim; i++) { + tmp = X[i] - CB[pos + i]; + dist += tmp*tmp; + } + + if (dist < mindist) { + mindist = dist; + minindex = j; + } + pos += dim; + } + for (i = 0; i < dim; i++) { + Xq[i] = CB[minindex*dim + i]; + } + *index = minindex; + + + + + + } + + /*----------------------------------------------------------------* + * split vector quantization + *---------------------------------------------------------------*/ + + void SplitVQ( + float *qX, /* (o) the quantized vector */ + int *index, /* (o) a vector of indexes for all vector + codebooks in the split */ + float *X, /* (i) the vector to quantize */ + const float *CB,/* (i) the quantizer codebook */ + int nsplit, /* the number of vector splits */ + const int *dim, /* the dimension of X and qX */ + const int *cbsize /* the number of vectors in the codebook */ + ){ + int cb_pos, X_pos, i; + + cb_pos = 0; + X_pos= 0; + for (i = 0; i < nsplit; i++) { + vq(qX + X_pos, index + i, CB + cb_pos, X + X_pos, + cbsize[i], dim[i]); + X_pos += dim[i]; + cb_pos += dim[i] * cbsize[i]; + } + } + + /*----------------------------------------------------------------* + * scalar quantization + *---------------------------------------------------------------*/ + + void sort_sq( + float *xq, /* (o) the quantized value */ + int *index, /* (o) the quantization index */ + float x, /* (i) the value to quantize */ + const float *cb,/* (i) the quantization codebook */ + int cb_size /* (i) the size of the quantization codebook */ + ){ + int i; + + if (x <= cb[0]) { + *index = 0; + *xq = cb[0]; + } else { + i = 0; + while ((x > cb[i]) && i < cb_size - 1) { + i++; + + + + + + } + + if (x > ((cb[i] + cb[i - 1])/2)) { + *index = i; + *xq = cb[i]; + } else { + *index = i - 1; + *xq = cb[i - 1]; + } + } + } + + /*----------------------------------------------------------------* + * check for stability of lsf coefficients + *---------------------------------------------------------------*/ + + int LSF_check( /* (o) 1 for stable lsf vectors and 0 for + nonstable ones */ + float *lsf, /* (i) a table of lsf vectors */ + int dim, /* (i) the dimension of each lsf vector */ + int NoAn /* (i) the number of lsf vectors in the + table */ + ){ + int k,n,m, Nit=2, change=0,pos; + float tmp; + static float eps=(float)0.039; /* 50 Hz */ + static float eps2=(float)0.0195; + static float maxlsf=(float)3.14; /* 4000 Hz */ + static float minlsf=(float)0.01; /* 0 Hz */ + + /* LSF separation check*/ + + for (n=0; nmaxlsf) { + lsf[pos]=maxlsf; + change=1; + } + } + } + } + + return change; + } + diff --git a/asterisk/codecs/ilbc/helpfun.h b/asterisk/codecs/ilbc/helpfun.h new file mode 100644 index 00000000..931ca68a --- /dev/null +++ b/asterisk/codecs/ilbc/helpfun.h @@ -0,0 +1,106 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + helpfun.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_HELPFUN_H + #define __iLBC_HELPFUN_H + + void autocorr( + float *r, /* (o) autocorrelation vector */ + const float *x, /* (i) data vector */ + int N, /* (i) length of data vector */ + int order /* largest lag for calculated + autocorrelations */ + ); + + void window( + float *z, /* (o) the windowed data */ + const float *x, /* (i) the original data vector */ + const float *y, /* (i) the window */ + int N /* (i) length of all vectors */ + ); + + void levdurb( + float *a, /* (o) lpc coefficient vector starting + with 1.0 */ + float *k, /* (o) reflection coefficients */ + float *r, /* (i) autocorrelation vector */ + int order /* (i) order of lpc filter */ + ); + + void interpolate( + + + + + + float *out, /* (o) the interpolated vector */ + float *in1, /* (i) the first vector for the + interpolation */ + float *in2, /* (i) the second vector for the + interpolation */ + float coef, /* (i) interpolation weights */ + int length /* (i) length of all vectors */ + ); + + void bwexpand( + float *out, /* (o) the bandwidth expanded lpc + coefficients */ + float *in, /* (i) the lpc coefficients before bandwidth + expansion */ + float coef, /* (i) the bandwidth expansion factor */ + int length /* (i) the length of lpc coefficient vectors */ + ); + + void vq( + float *Xq, /* (o) the quantized vector */ + int *index, /* (o) the quantization index */ + const float *CB,/* (i) the vector quantization codebook */ + float *X, /* (i) the vector to quantize */ + int n_cb, /* (i) the number of vectors in the codebook */ + int dim /* (i) the dimension of all vectors */ + ); + + void SplitVQ( + float *qX, /* (o) the quantized vector */ + int *index, /* (o) a vector of indexes for all vector + codebooks in the split */ + float *X, /* (i) the vector to quantize */ + const float *CB,/* (i) the quantizer codebook */ + int nsplit, /* the number of vector splits */ + const int *dim, /* the dimension of X and qX */ + const int *cbsize /* the number of vectors in the codebook */ + ); + + + void sort_sq( + float *xq, /* (o) the quantized value */ + int *index, /* (o) the quantization index */ + float x, /* (i) the value to quantize */ + const float *cb,/* (i) the quantization codebook */ + int cb_size /* (i) the size of the quantization codebook */ + ); + + int LSF_check( /* (o) 1 for stable lsf vectors and 0 for + + + + + + nonstable ones */ + float *lsf, /* (i) a table of lsf vectors */ + int dim, /* (i) the dimension of each lsf vector */ + int NoAn /* (i) the number of lsf vectors in the + table */ + ); + + #endif + diff --git a/asterisk/codecs/ilbc/hpInput.c b/asterisk/codecs/ilbc/hpInput.c new file mode 100644 index 00000000..7ceee096 --- /dev/null +++ b/asterisk/codecs/ilbc/hpInput.c @@ -0,0 +1,65 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + + + + + hpInput.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include "constants.h" + + /*----------------------------------------------------------------* + * Input high-pass filter + *---------------------------------------------------------------*/ + + void hpInput( + float *In, /* (i) vector to filter */ + int len, /* (i) length of vector to filter */ + float *Out, /* (o) the resulting filtered vector */ + float *mem /* (i/o) the filter state */ + ){ + int i; + float *pi, *po; + + /* all-zero section*/ + + pi = &In[0]; + po = &Out[0]; + for (i=0; i + + #include "iLBC_define.h" + #include "gainquant.h" + #include "getCBvec.h" + + /*----------------------------------------------------------------* + * Convert the codebook indexes to make the search easier + *---------------------------------------------------------------*/ + + + + + + + void index_conv_enc( + int *index /* (i/o) Codebook indexes */ + ){ + int k; + + for (k=1; k=108)&&(index[k]<172)) { + index[k]-=64; + } else if (index[k]>=236) { + index[k]-=128; + } else { + /* ERROR */ + } + } + } + + void index_conv_dec( + int *index /* (i/o) Codebook indexes */ + ){ + int k; + + for (k=1; k=44)&&(index[k]<108)) { + index[k]+=64; + } else if ((index[k]>=108)&&(index[k]<128)) { + index[k]+=128; + } else { + /* ERROR */ + } + } + } + + /*----------------------------------------------------------------* + * Construct decoded vector from codebook and gains. + *---------------------------------------------------------------*/ + + void iCBConstruct( + float *decvector, /* (o) Decoded vector */ + int *index, /* (i) Codebook indices */ + int *gain_index,/* (i) Gain quantization indices */ + float *mem, /* (i) Buffer for codevector construction */ + int lMem, /* (i) Length of buffer */ + int veclen, /* (i) Length of vector */ + int nStages /* (i) Number of codebook stages */ + ){ + int j,k; + + + + + + float gain[CB_NSTAGES]; + float cbvec[SUBL]; + + /* gain de-quantization */ + + gain[0] = gaindequant(gain_index[0], 1.0, 32); + if (nStages > 1) { + gain[1] = gaindequant(gain_index[1], + (float)fabs(gain[0]), 16); + } + if (nStages > 2) { + gain[2] = gaindequant(gain_index[2], + (float)fabs(gain[1]), 8); + } + + /* codebook vector construction and construction of + total vector */ + + getCBvec(cbvec, mem, index[0], lMem, veclen); + for (j=0;j 1) { + for (k=1; k + #include + + #include "iLBC_define.h" + #include "gainquant.h" + #include "createCB.h" + #include "filter.h" + #include "constants.h" + + /*----------------------------------------------------------------* + * Search routine for codebook encoding and gain quantization. + *---------------------------------------------------------------*/ + + void iCBSearch( + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i) the encoder state structure */ + int *index, /* (o) Codebook indices */ + int *gain_index,/* (o) Gain quantization indices */ + + + + + + float *intarget,/* (i) Target vector for encoding */ + float *mem, /* (i) Buffer for codebook construction */ + int lMem, /* (i) Length of buffer */ + int lTarget, /* (i) Length of vector */ + int nStages, /* (i) Number of codebook stages */ + float *weightDenum, /* (i) weighting filter coefficients */ + float *weightState, /* (i) weighting filter state */ + int block /* (i) the sub-block number */ + ){ + int i, j, icount, stage, best_index, range, counter; + float max_measure, gain, measure, crossDot, ftmp; + float gains[CB_NSTAGES]; + float target[SUBL]; + int base_index, sInd, eInd, base_size; + int sIndAug=0, eIndAug=0; + float buf[CB_MEML+SUBL+2*LPC_FILTERORDER]; + float invenergy[CB_EXPAND*128], energy[CB_EXPAND*128]; + float *pp, *ppi=0, *ppo=0, *ppe=0; + float cbvectors[CB_MEML]; + float tene, cene, cvec[SUBL]; + float aug_vec[SUBL]; + + memset(cvec,0,SUBL*sizeof(float)); + + /* Determine size of codebook sections */ + + base_size=lMem-lTarget+1; + + if (lTarget==SUBL) { + base_size=lMem-lTarget+1+lTarget/2; + } + + /* setup buffer for weighting */ + + memcpy(buf,weightState,sizeof(float)*LPC_FILTERORDER); + memcpy(buf+LPC_FILTERORDER,mem,lMem*sizeof(float)); + memcpy(buf+LPC_FILTERORDER+lMem,intarget,lTarget*sizeof(float)); + + /* weighting */ + + AllPoleFilter(buf+LPC_FILTERORDER, weightDenum, + lMem+lTarget, LPC_FILTERORDER); + + /* Construct the codebook and target needed */ + + memcpy(target, buf+LPC_FILTERORDER+lMem, lTarget*sizeof(float)); + + tene=0.0; + + + + + + for (i=0; i0.0) { + invenergy[0] = (float) 1.0 / (*ppe + EPS); + } else { + invenergy[0] = (float) 0.0; + + + + + + } + ppe++; + + measure=(float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot*invenergy[0]; + } + } + else { + measure = crossDot*crossDot*invenergy[0]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[0]; + + if ((measure>max_measure) && (fabs(ftmp)0.0) { + invenergy[icount] = + (float)1.0/(energy[icount]+EPS); + } else { + invenergy[icount] = (float) 0.0; + } + + + + + + measure=(float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot*invenergy[icount]; + } + } + else { + measure = crossDot*crossDot*invenergy[icount]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[icount]; + + if ((measure>max_measure) && (fabs(ftmp) range) { + sInd -= (eInd-range); + eInd = range; + } + } else { /* base_index >= (base_size-20) */ + + if (sInd < (base_size-20)) { + sIndAug = 20; + sInd = 0; + eInd = 0; + eIndAug = 19 + CB_RESRANGE; + + if(eIndAug > 39) { + eInd = eIndAug-39; + eIndAug = 39; + } + } else { + sIndAug = 20 + sInd - (base_size-20); + eIndAug = 39; + sInd = 0; + eInd = CB_RESRANGE - (eIndAug-sIndAug+1); + } + } + + } else { /* lTarget = 22 or 23 */ + + if (sInd < 0) { + eInd -= sInd; + + + + + + sInd = 0; + } + + if(eInd > range) { + sInd -= (eInd - range); + eInd = range; + } + } + } + + /* search of higher codebook section */ + + /* index search range */ + counter = sInd; + sInd += base_size; + eInd += base_size; + + + if (stage==0) { + ppe = energy+base_size; + *ppe=0.0; + + pp=cbvectors+lMem-lTarget; + for (j=0; j0.0) { + invenergy[icount] =(float)1.0/(energy[icount]+EPS); + } else { + invenergy[icount] =(float)0.0; + } + + if (stage==0) { + + measure=(float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot* + invenergy[icount]; + } + } + else { + measure = crossDot*crossDot*invenergy[icount]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[icount]; + + if ((measure>max_measure) && (fabs(ftmp)CB_MAXGAIN) { + gain = (float)CB_MAXGAIN; + } + gain = gainquant(gain, 1.0, 32, &gain_index[stage]); + } + else { + if (stage==1) { + gain = gainquant(gain, (float)fabs(gains[stage-1]), + 16, &gain_index[stage]); + } else { + gain = gainquant(gain, (float)fabs(gains[stage-1]), + 8, &gain_index[stage]); + } + } + + /* Extract the best (according to measure) + codebook vector */ + + if (lTarget==(STATE_LEN-iLBCenc_inst->state_short_len)) { + + if (index[stage] + #include + + #include "iLBC_define.h" + #include "StateConstructW.h" + #include "LPCdecode.h" + #include "iCBConstruct.h" + #include "doCPLC.h" + #include "helpfun.h" + #include "constants.h" + #include "packing.h" + #include "string.h" + #include "enhancer.h" + #include "hpOutput.h" + #include "syntFilter.h" + + /*----------------------------------------------------------------* + * Initiation of decoder instance. + *---------------------------------------------------------------*/ + + short initDecode( /* (o) Number of decoded + samples */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */ + int mode, /* (i) frame size mode */ + int use_enhancer /* (i) 1 to use enhancer + 0 to run without + enhancer */ + ){ + int i; + + iLBCdec_inst->mode = mode; + + + + + + if (mode==30) { + iLBCdec_inst->blockl = BLOCKL_30MS; + iLBCdec_inst->nsub = NSUB_30MS; + iLBCdec_inst->nasub = NASUB_30MS; + iLBCdec_inst->lpc_n = LPC_N_30MS; + iLBCdec_inst->no_of_bytes = NO_OF_BYTES_30MS; + iLBCdec_inst->no_of_words = NO_OF_WORDS_30MS; + iLBCdec_inst->state_short_len=STATE_SHORT_LEN_30MS; + /* ULP init */ + iLBCdec_inst->ULP_inst=&ULP_30msTbl; + } + else if (mode==20) { + iLBCdec_inst->blockl = BLOCKL_20MS; + iLBCdec_inst->nsub = NSUB_20MS; + iLBCdec_inst->nasub = NASUB_20MS; + iLBCdec_inst->lpc_n = LPC_N_20MS; + iLBCdec_inst->no_of_bytes = NO_OF_BYTES_20MS; + iLBCdec_inst->no_of_words = NO_OF_WORDS_20MS; + iLBCdec_inst->state_short_len=STATE_SHORT_LEN_20MS; + /* ULP init */ + iLBCdec_inst->ULP_inst=&ULP_20msTbl; + } + else { + exit(2); + } + + memset(iLBCdec_inst->syntMem, 0, + LPC_FILTERORDER*sizeof(float)); + memcpy((*iLBCdec_inst).lsfdeqold, lsfmeanTbl, + LPC_FILTERORDER*sizeof(float)); + + memset(iLBCdec_inst->old_syntdenum, 0, + ((LPC_FILTERORDER + 1)*NSUB_MAX)*sizeof(float)); + for (i=0; iold_syntdenum[i*(LPC_FILTERORDER+1)]=1.0; + + iLBCdec_inst->last_lag = 20; + + iLBCdec_inst->prevLag = 120; + iLBCdec_inst->per = 0.0; + iLBCdec_inst->consPLICount = 0; + iLBCdec_inst->prevPLI = 0; + iLBCdec_inst->prevLpc[0] = 1.0; + memset(iLBCdec_inst->prevLpc+1,0, + LPC_FILTERORDER*sizeof(float)); + memset(iLBCdec_inst->prevResidual, 0, BLOCKL_MAX*sizeof(float)); + iLBCdec_inst->seed=777; + + + + + + + memset(iLBCdec_inst->hpomem, 0, 4*sizeof(float)); + + iLBCdec_inst->use_enhancer = use_enhancer; + memset(iLBCdec_inst->enh_buf, 0, ENH_BUFL*sizeof(float)); + for (i=0;ienh_period[i]=(float)40.0; + + iLBCdec_inst->prev_enh_pl = 0; + + return (iLBCdec_inst->blockl); + } + + /*----------------------------------------------------------------* + * frame residual decoder function (subrutine to iLBC_decode) + *---------------------------------------------------------------*/ + + void Decode( + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state + structure */ + float *decresidual, /* (o) decoded residual frame */ + int start, /* (i) location of start + state */ + int idxForMax, /* (i) codebook index for the + maximum value */ + int *idxVec, /* (i) codebook indexes for the + samples in the start + state */ + float *syntdenum, /* (i) the decoded synthesis + filter coefficients */ + int *cb_index, /* (i) the indexes for the + adaptive codebook */ + int *gain_index, /* (i) the indexes for the + corresponding gains */ + int *extra_cb_index, /* (i) the indexes for the + adaptive codebook part + of start state */ + int *extra_gain_index, /* (i) the indexes for the + corresponding gains */ + int state_first /* (i) 1 if non adaptive part + of start state comes + first 0 if that part + comes last */ + ){ + float reverseDecresidual[BLOCKL_MAX], mem[CB_MEML]; + int k, meml_gotten, Nfor, Nback, i; + int diff, start_pos; + int subcount, subframe; + + + + + + + diff = STATE_LEN - iLBCdec_inst->state_short_len; + + if (state_first == 1) { + start_pos = (start-1)*SUBL; + } else { + start_pos = (start-1)*SUBL + diff; + } + + /* decode scalar part of start state */ + + StateConstructW(idxForMax, idxVec, + &syntdenum[(start-1)*(LPC_FILTERORDER+1)], + &decresidual[start_pos], iLBCdec_inst->state_short_len); + + + if (state_first) { /* put adaptive part in the end */ + + /* setup memory */ + + memset(mem, 0, + (CB_MEML-iLBCdec_inst->state_short_len)*sizeof(float)); + memcpy(mem+CB_MEML-iLBCdec_inst->state_short_len, + decresidual+start_pos, + iLBCdec_inst->state_short_len*sizeof(float)); + + /* construct decoded vector */ + + iCBConstruct( + &decresidual[start_pos+iLBCdec_inst->state_short_len], + extra_cb_index, extra_gain_index, mem+CB_MEML-stMemLTbl, + stMemLTbl, diff, CB_NSTAGES); + + } + else {/* put adaptive part in the beginning */ + + /* create reversed vectors for prediction */ + + for (k=0; kstate_short_len)]; + } + + /* setup memory */ + + meml_gotten = iLBCdec_inst->state_short_len; + for (k=0; knsub-start-1; + + if ( Nfor > 0 ){ + + /* setup memory */ + + memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float)); + memcpy(mem+CB_MEML-STATE_LEN, decresidual+(start-1)*SUBL, + STATE_LEN*sizeof(float)); + + /* loop over sub-frames to encode */ + + for (subframe=0; subframe 0 ) { + + /* setup memory */ + + meml_gotten = SUBL*(iLBCdec_inst->nsub+1-start); + + if ( meml_gotten > CB_MEML ) { + meml_gotten=CB_MEML; + } + for (k=0; k0) { /* the data are good */ + + /* decode data */ + + pbytes=bytes; + pos=0; + + + + + + + /* Set everything to zero before decoding */ + + for (k=0; kstate_short_len; k++) { + idxVec[k]=0; + } + for (k=0; knasub; i++) { + for (k=0; knasub; i++) { + for (k=0; klpc_n; k++){ + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->lsf_bits[k][ulp], &pos); + packcombine(&lsf_i[k], lastpart, + iLBCdec_inst->ULP_inst->lsf_bits[k][ulp]); + } + + /* Start block info */ + + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->start_bits[ulp], &pos); + packcombine(&start, lastpart, + iLBCdec_inst->ULP_inst->start_bits[ulp]); + + unpack( &pbytes, &lastpart, + + + + + + iLBCdec_inst->ULP_inst->startfirst_bits[ulp], &pos); + packcombine(&state_first, lastpart, + iLBCdec_inst->ULP_inst->startfirst_bits[ulp]); + + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->scale_bits[ulp], &pos); + packcombine(&idxForMax, lastpart, + iLBCdec_inst->ULP_inst->scale_bits[ulp]); + + for (k=0; kstate_short_len; k++) { + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->state_bits[ulp], &pos); + packcombine(idxVec+k, lastpart, + iLBCdec_inst->ULP_inst->state_bits[ulp]); + } + + /* 23/22 (20ms/30ms) sample block */ + + for (k=0; kULP_inst->extra_cb_index[k][ulp], + &pos); + packcombine(extra_cb_index+k, lastpart, + iLBCdec_inst->ULP_inst->extra_cb_index[k][ulp]); + } + for (k=0; kULP_inst->extra_cb_gain[k][ulp], + &pos); + packcombine(extra_gain_index+k, lastpart, + iLBCdec_inst->ULP_inst->extra_cb_gain[k][ulp]); + } + + /* The two/four (20ms/30ms) 40 sample sub-blocks */ + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_index[i][k][ulp], + &pos); + packcombine(cb_index+i*CB_NSTAGES+k, lastpart, + iLBCdec_inst->ULP_inst->cb_index[i][k][ulp]); + } + } + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_gain[i][k][ulp], + &pos); + packcombine(gain_index+i*CB_NSTAGES+k, lastpart, + iLBCdec_inst->ULP_inst->cb_gain[i][k][ulp]); + } + } + } + /* Extract last bit. If it is 1 this indicates an + empty/lost frame */ + unpack( &pbytes, &last_bit, 1, &pos); + + /* Check for bit errors or empty/lost frames */ + if (start<1) + mode = 0; + if (iLBCdec_inst->mode==20 && start>3) + mode = 0; + if (iLBCdec_inst->mode==30 && start>5) + mode = 0; + if (last_bit==1) + mode = 0; + + if (mode==1) { /* No bit errors was detected, + continue decoding */ + + /* adjust index */ + index_conv_dec(cb_index); + + /* decode the lsf */ + + SimplelsfDEQ(lsfdeq, lsf_i, iLBCdec_inst->lpc_n); + check=LSF_check(lsfdeq, LPC_FILTERORDER, + iLBCdec_inst->lpc_n); + DecoderInterpolateLSF(syntdenum, weightdenum, + lsfdeq, LPC_FILTERORDER, iLBCdec_inst); + + Decode(iLBCdec_inst, decresidual, start, idxForMax, + idxVec, syntdenum, cb_index, gain_index, + extra_cb_index, extra_gain_index, + state_first); + + /* preparing the plc for a future loss! */ + + doThePLC(PLCresidual, PLClpc, 0, decresidual, + syntdenum + + (LPC_FILTERORDER + 1)*(iLBCdec_inst->nsub - 1), + (*iLBCdec_inst).last_lag, iLBCdec_inst); + + + + + + + + memcpy(decresidual, PLCresidual, + iLBCdec_inst->blockl*sizeof(float)); + } + + } + + if (mode == 0) { + /* the data is bad (either a PLC call + * was made or a severe bit error was detected) + */ + + /* packet loss conceal */ + + memset(zeros, 0, BLOCKL_MAX*sizeof(float)); + + one[0] = 1; + memset(one+1, 0, LPC_FILTERORDER*sizeof(float)); + + start=0; + + doThePLC(PLCresidual, PLClpc, 1, zeros, one, + (*iLBCdec_inst).last_lag, iLBCdec_inst); + memcpy(decresidual, PLCresidual, + iLBCdec_inst->blockl*sizeof(float)); + + order_plus_one = LPC_FILTERORDER + 1; + for (i = 0; i < iLBCdec_inst->nsub; i++) { + memcpy(syntdenum+(i*order_plus_one), PLClpc, + order_plus_one*sizeof(float)); + } + } + + if (iLBCdec_inst->use_enhancer == 1) { + + /* post filtering */ + + iLBCdec_inst->last_lag = + enhancerInterface(data, decresidual, iLBCdec_inst); + + /* synthesis filtering */ + + if (iLBCdec_inst->mode==20) { + /* Enhancer has 40 samples delay */ + i=0; + syntFilter(data + i*SUBL, + iLBCdec_inst->old_syntdenum + + (i+iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1), + SUBL, iLBCdec_inst->syntMem); + + + + + + for (i=1; i < iLBCdec_inst->nsub; i++) { + syntFilter(data + i*SUBL, + syntdenum + (i-1)*(LPC_FILTERORDER+1), + SUBL, iLBCdec_inst->syntMem); + } + } else if (iLBCdec_inst->mode==30) { + /* Enhancer has 80 samples delay */ + for (i=0; i < 2; i++) { + syntFilter(data + i*SUBL, + iLBCdec_inst->old_syntdenum + + (i+iLBCdec_inst->nsub-2)*(LPC_FILTERORDER+1), + SUBL, iLBCdec_inst->syntMem); + } + for (i=2; i < iLBCdec_inst->nsub; i++) { + syntFilter(data + i*SUBL, + syntdenum + (i-2)*(LPC_FILTERORDER+1), SUBL, + iLBCdec_inst->syntMem); + } + } + + } else { + + /* Find last lag */ + lag = 20; + maxcc = xCorrCoef(&decresidual[BLOCKL_MAX-ENH_BLOCKL], + &decresidual[BLOCKL_MAX-ENH_BLOCKL-lag], ENH_BLOCKL); + + for (ilag=21; ilag<120; ilag++) { + cc = xCorrCoef(&decresidual[BLOCKL_MAX-ENH_BLOCKL], + &decresidual[BLOCKL_MAX-ENH_BLOCKL-ilag], + ENH_BLOCKL); + + if (cc > maxcc) { + maxcc = cc; + lag = ilag; + } + } + iLBCdec_inst->last_lag = lag; + + /* copy data and run synthesis filter */ + + memcpy(data, decresidual, + iLBCdec_inst->blockl*sizeof(float)); + for (i=0; i < iLBCdec_inst->nsub; i++) { + syntFilter(data + i*SUBL, + syntdenum + i*(LPC_FILTERORDER+1), SUBL, + iLBCdec_inst->syntMem); + } + + + + + + } + + /* high pass filtering on output if desired, otherwise + copy to out */ + + hpOutput(data, iLBCdec_inst->blockl, + decblock,iLBCdec_inst->hpomem); + + /* memcpy(decblock,data,iLBCdec_inst->blockl*sizeof(float));*/ + + memcpy(iLBCdec_inst->old_syntdenum, syntdenum, + + iLBCdec_inst->nsub*(LPC_FILTERORDER+1)*sizeof(float)); + + iLBCdec_inst->prev_enh_pl=0; + + if (mode==0) { /* PLC was used */ + iLBCdec_inst->prev_enh_pl=1; + } + } + diff --git a/asterisk/codecs/ilbc/iLBC_decode.h b/asterisk/codecs/ilbc/iLBC_decode.h new file mode 100644 index 00000000..5f4384dc --- /dev/null +++ b/asterisk/codecs/ilbc/iLBC_decode.h @@ -0,0 +1,42 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_decode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_ILBCDECODE_H + #define __iLBC_ILBCDECODE_H + + #include "iLBC_define.h" + + short initDecode( /* (o) Number of decoded + samples */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */ + int mode, /* (i) frame size mode */ + int use_enhancer /* (i) 1 to use enhancer + 0 to run without + enhancer */ + ); + + void iLBC_decode( + float *decblock, /* (o) decoded signal block */ + unsigned char *bytes, /* (i) encoded signal bits */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state + structure */ + int mode /* (i) 0: bad packet, PLC, + 1: normal */ + + + + + + ); + + #endif + diff --git a/asterisk/codecs/ilbc/iLBC_define.h b/asterisk/codecs/ilbc/iLBC_define.h new file mode 100644 index 00000000..480c834b --- /dev/null +++ b/asterisk/codecs/ilbc/iLBC_define.h @@ -0,0 +1,217 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_define.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + #include + + #ifndef __iLBC_ILBCDEFINE_H + #define __iLBC_ILBCDEFINE_H + + /* general codec settings */ + + #define FS (float)8000.0 + #define BLOCKL_20MS 160 + #define BLOCKL_30MS 240 + #define BLOCKL_MAX 240 + #define NSUB_20MS 4 + #define NSUB_30MS 6 + #define NSUB_MAX 6 + #define NASUB_20MS 2 + + + + + + #define NASUB_30MS 4 + #define NASUB_MAX 4 + #define SUBL 40 + #define STATE_LEN 80 + #define STATE_SHORT_LEN_30MS 58 + #define STATE_SHORT_LEN_20MS 57 + + /* LPC settings */ + + #define LPC_FILTERORDER 10 + #define LPC_CHIRP_SYNTDENUM (float)0.9025 + #define LPC_CHIRP_WEIGHTDENUM (float)0.4222 + #define LPC_LOOKBACK 60 + #define LPC_N_20MS 1 + #define LPC_N_30MS 2 + #define LPC_N_MAX 2 + #define LPC_ASYMDIFF 20 + #define LPC_BW (float)60.0 + #define LPC_WN (float)1.0001 + #define LSF_NSPLIT 3 + #define LSF_NUMBER_OF_STEPS 4 + #define LPC_HALFORDER (LPC_FILTERORDER/2) + + /* cb settings */ + + #define CB_NSTAGES 3 + #define CB_EXPAND 2 + #define CB_MEML 147 + #define CB_FILTERLEN 2*4 + #define CB_HALFFILTERLEN 4 + #define CB_RESRANGE 34 + #define CB_MAXGAIN (float)1.3 + + /* enhancer */ + + #define ENH_BLOCKL 80 /* block length */ + #define ENH_BLOCKL_HALF (ENH_BLOCKL/2) + #define ENH_HL 3 /* 2*ENH_HL+1 is number blocks + in said second sequence */ + #define ENH_SLOP 2 /* max difference estimated and + correct pitch period */ + #define ENH_PLOCSL 20 /* pitch-estimates and pitch- + locations buffer length */ + #define ENH_OVERHANG 2 + #define ENH_UPS0 4 /* upsampling rate */ + #define ENH_FL0 3 /* 2*FLO+1 is the length of + each filter */ + #define ENH_VECTL (ENH_BLOCKL+2*ENH_FL0) + + + + + + #define ENH_CORRDIM (2*ENH_SLOP+1) + #define ENH_NBLOCKS (BLOCKL_MAX/ENH_BLOCKL) + #define ENH_NBLOCKS_EXTRA 5 + #define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS + + ENH_NBLOCKS_EXTRA */ + #define ENH_BUFL (ENH_NBLOCKS_TOT)*ENH_BLOCKL + #define ENH_ALPHA0 (float)0.05 + + /* Down sampling */ + + #define FILTERORDER_DS 7 + #define DELAY_DS 3 + #define FACTOR_DS 2 + + /* bit stream defs */ + + #define NO_OF_BYTES_20MS 38 + #define NO_OF_BYTES_30MS 50 + #define NO_OF_WORDS_20MS 19 + #define NO_OF_WORDS_30MS 25 + #define STATE_BITS 3 + #define BYTE_LEN 8 + #define ULP_CLASSES 3 + + /* help parameters */ + + #define FLOAT_MAX (float)1.0e37 + #define EPS (float)2.220446049250313e-016 + #define PI (float)3.14159265358979323846 + #define MIN_SAMPLE -32768 + #define MAX_SAMPLE 32767 + #define TWO_PI (float)6.283185307 + #define PI2 (float)0.159154943 + + /* type definition encoder instance */ + typedef struct iLBC_ULP_Inst_t_ { + int lsf_bits[6][ULP_CLASSES+2]; + int start_bits[ULP_CLASSES+2]; + int startfirst_bits[ULP_CLASSES+2]; + int scale_bits[ULP_CLASSES+2]; + int state_bits[ULP_CLASSES+2]; + int extra_cb_index[CB_NSTAGES][ULP_CLASSES+2]; + int extra_cb_gain[CB_NSTAGES][ULP_CLASSES+2]; + int cb_index[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]; + int cb_gain[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]; + } iLBC_ULP_Inst_t; + + /* type definition encoder instance */ + + + + + + typedef struct iLBC_Enc_Inst_t_ { + + /* flag for frame size mode */ + int mode; + + /* basic parameters for different frame sizes */ + int blockl; + int nsub; + int nasub; + int no_of_bytes, no_of_words; + int lpc_n; + int state_short_len; + const iLBC_ULP_Inst_t *ULP_inst; + + /* analysis filter state */ + float anaMem[LPC_FILTERORDER]; + + /* old lsf parameters for interpolation */ + float lsfold[LPC_FILTERORDER]; + float lsfdeqold[LPC_FILTERORDER]; + + /* signal buffer for LP analysis */ + float lpc_buffer[LPC_LOOKBACK + BLOCKL_MAX]; + + /* state of input HP filter */ + float hpimem[4]; + + } iLBC_Enc_Inst_t; + + /* type definition decoder instance */ + typedef struct iLBC_Dec_Inst_t_ { + + /* flag for frame size mode */ + int mode; + + /* basic parameters for different frame sizes */ + int blockl; + int nsub; + int nasub; + int no_of_bytes, no_of_words; + int lpc_n; + int state_short_len; + const iLBC_ULP_Inst_t *ULP_inst; + + /* synthesis filter state */ + float syntMem[LPC_FILTERORDER]; + + /* old LSF for interpolation */ + + + + + + float lsfdeqold[LPC_FILTERORDER]; + + /* pitch lag estimated in enhancer and used in PLC */ + int last_lag; + + /* PLC state information */ + int prevLag, consPLICount, prevPLI, prev_enh_pl; + float prevLpc[LPC_FILTERORDER+1]; + float prevResidual[NSUB_MAX*SUBL]; + float per; + unsigned long seed; + + /* previous synthesis filter parameters */ + float old_syntdenum[(LPC_FILTERORDER + 1)*NSUB_MAX]; + + /* state of output HP filter */ + float hpomem[4]; + + /* enhancer state information */ + int use_enhancer; + float enh_buf[ENH_BUFL]; + float enh_period[ENH_NBLOCKS_TOT]; + + } iLBC_Dec_Inst_t; + + #endif + diff --git a/asterisk/codecs/ilbc/iLBC_encode.c b/asterisk/codecs/ilbc/iLBC_encode.c new file mode 100644 index 00000000..46364140 --- /dev/null +++ b/asterisk/codecs/ilbc/iLBC_encode.c @@ -0,0 +1,543 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_encode.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include + + #include "iLBC_define.h" + #include "LPCencode.h" + #include "FrameClassify.h" + #include "StateSearchW.h" + #include "StateConstructW.h" + #include "helpfun.h" + #include "constants.h" + #include "packing.h" + #include "iCBSearch.h" + #include "iCBConstruct.h" + #include "hpInput.h" + #include "anaFilter.h" + #include "syntFilter.h" + + /*----------------------------------------------------------------* + * Initiation of encoder instance. + *---------------------------------------------------------------*/ + + short initEncode( /* (o) Number of bytes + encoded */ + iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */ + int mode /* (i) frame size mode */ + ){ + iLBCenc_inst->mode = mode; + if (mode==30) { + iLBCenc_inst->blockl = BLOCKL_30MS; + iLBCenc_inst->nsub = NSUB_30MS; + iLBCenc_inst->nasub = NASUB_30MS; + iLBCenc_inst->lpc_n = LPC_N_30MS; + iLBCenc_inst->no_of_bytes = NO_OF_BYTES_30MS; + iLBCenc_inst->no_of_words = NO_OF_WORDS_30MS; + + + + + + iLBCenc_inst->state_short_len=STATE_SHORT_LEN_30MS; + /* ULP init */ + iLBCenc_inst->ULP_inst=&ULP_30msTbl; + } + else if (mode==20) { + iLBCenc_inst->blockl = BLOCKL_20MS; + iLBCenc_inst->nsub = NSUB_20MS; + iLBCenc_inst->nasub = NASUB_20MS; + iLBCenc_inst->lpc_n = LPC_N_20MS; + iLBCenc_inst->no_of_bytes = NO_OF_BYTES_20MS; + iLBCenc_inst->no_of_words = NO_OF_WORDS_20MS; + iLBCenc_inst->state_short_len=STATE_SHORT_LEN_20MS; + /* ULP init */ + iLBCenc_inst->ULP_inst=&ULP_20msTbl; + } + else { + exit(2); + } + + memset((*iLBCenc_inst).anaMem, 0, + LPC_FILTERORDER*sizeof(float)); + memcpy((*iLBCenc_inst).lsfold, lsfmeanTbl, + LPC_FILTERORDER*sizeof(float)); + memcpy((*iLBCenc_inst).lsfdeqold, lsfmeanTbl, + LPC_FILTERORDER*sizeof(float)); + memset((*iLBCenc_inst).lpc_buffer, 0, + (LPC_LOOKBACK+BLOCKL_MAX)*sizeof(float)); + memset((*iLBCenc_inst).hpimem, 0, 4*sizeof(float)); + + return (iLBCenc_inst->no_of_bytes); + } + + /*----------------------------------------------------------------* + * main encoder function + *---------------------------------------------------------------*/ + + void iLBC_encode( + unsigned char *bytes, /* (o) encoded data bits iLBC */ + float *block, /* (o) speech vector to + encode */ + iLBC_Enc_Inst_t *iLBCenc_inst /* (i/o) the general encoder + state */ + ){ + + float data[BLOCKL_MAX]; + float residual[BLOCKL_MAX], reverseResidual[BLOCKL_MAX]; + + int start, idxForMax, idxVec[STATE_LEN]; + + + + + + float reverseDecresidual[BLOCKL_MAX], mem[CB_MEML]; + int n, k, meml_gotten, Nfor, Nback, i, pos; + int gain_index[CB_NSTAGES*NASUB_MAX], + extra_gain_index[CB_NSTAGES]; + int cb_index[CB_NSTAGES*NASUB_MAX],extra_cb_index[CB_NSTAGES]; + int lsf_i[LSF_NSPLIT*LPC_N_MAX]; + unsigned char *pbytes; + int diff, start_pos, state_first; + float en1, en2; + int index, ulp, firstpart; + int subcount, subframe; + float weightState[LPC_FILTERORDER]; + float syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; + float weightdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; + float decresidual[BLOCKL_MAX]; + + /* high pass filtering of input signal if such is not done + prior to calling this function */ + + hpInput(block, iLBCenc_inst->blockl, + data, (*iLBCenc_inst).hpimem); + + /* otherwise simply copy */ + + /*memcpy(data,block,iLBCenc_inst->blockl*sizeof(float));*/ + + /* LPC of hp filtered input data */ + + LPCencode(syntdenum, weightdenum, lsf_i, data, iLBCenc_inst); + + + /* inverse filter to get residual */ + + for (n=0; nnsub; n++) { + anaFilter(&data[n*SUBL], &syntdenum[n*(LPC_FILTERORDER+1)], + SUBL, &residual[n*SUBL], iLBCenc_inst->anaMem); + } + + /* find state location */ + + start = FrameClassify(iLBCenc_inst, residual); + + /* check if state should be in first or last part of the + two subframes */ + + diff = STATE_LEN - iLBCenc_inst->state_short_len; + en1 = 0; + index = (start-1)*SUBL; + + + + + + for (i = 0; i < iLBCenc_inst->state_short_len; i++) { + en1 += residual[index+i]*residual[index+i]; + } + en2 = 0; + index = (start-1)*SUBL+diff; + for (i = 0; i < iLBCenc_inst->state_short_len; i++) { + en2 += residual[index+i]*residual[index+i]; + } + + + if (en1 > en2) { + state_first = 1; + start_pos = (start-1)*SUBL; + } else { + state_first = 0; + start_pos = (start-1)*SUBL + diff; + } + + /* scalar quantization of state */ + + StateSearchW(iLBCenc_inst, &residual[start_pos], + &syntdenum[(start-1)*(LPC_FILTERORDER+1)], + &weightdenum[(start-1)*(LPC_FILTERORDER+1)], &idxForMax, + idxVec, iLBCenc_inst->state_short_len, state_first); + + StateConstructW(idxForMax, idxVec, + &syntdenum[(start-1)*(LPC_FILTERORDER+1)], + &decresidual[start_pos], iLBCenc_inst->state_short_len); + + /* predictive quantization in state */ + + if (state_first) { /* put adaptive part in the end */ + + /* setup memory */ + + memset(mem, 0, + (CB_MEML-iLBCenc_inst->state_short_len)*sizeof(float)); + memcpy(mem+CB_MEML-iLBCenc_inst->state_short_len, + decresidual+start_pos, + iLBCenc_inst->state_short_len*sizeof(float)); + memset(weightState, 0, LPC_FILTERORDER*sizeof(float)); + + /* encode sub-frames */ + + iCBSearch(iLBCenc_inst, extra_cb_index, extra_gain_index, + &residual[start_pos+iLBCenc_inst->state_short_len], + mem+CB_MEML-stMemLTbl, + stMemLTbl, diff, CB_NSTAGES, + + + + + + &weightdenum[start*(LPC_FILTERORDER+1)], + weightState, 0); + + /* construct decoded vector */ + + iCBConstruct( + &decresidual[start_pos+iLBCenc_inst->state_short_len], + extra_cb_index, extra_gain_index, + mem+CB_MEML-stMemLTbl, + stMemLTbl, diff, CB_NSTAGES); + + } + else { /* put adaptive part in the beginning */ + + /* create reversed vectors for prediction */ + + for (k=0; kstate_short_len)]; + } + + /* setup memory */ + + meml_gotten = iLBCenc_inst->state_short_len; + for (k=0; knsub-start-1; + + + if ( Nfor > 0 ) { + + /* setup memory */ + + memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float)); + memcpy(mem+CB_MEML-STATE_LEN, decresidual+(start-1)*SUBL, + STATE_LEN*sizeof(float)); + memset(weightState, 0, LPC_FILTERORDER*sizeof(float)); + + /* loop over sub-frames to encode */ + + for (subframe=0; subframe 0 ) { + + /* create reverse order vectors */ + + for (n=0; nnsub+1-start); + + + if ( meml_gotten > CB_MEML ) { + meml_gotten=CB_MEML; + } + for (k=0; klpc_n; k++) { + packsplit(&lsf_i[k], &firstpart, &lsf_i[k], + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp]+ + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp+1]+ + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], &pos); + } + + /* Start block info */ + + packsplit(&start, &firstpart, &start, + iLBCenc_inst->ULP_inst->start_bits[ulp], + iLBCenc_inst->ULP_inst->start_bits[ulp]+ + iLBCenc_inst->ULP_inst->start_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->start_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->start_bits[ulp], &pos); + + packsplit(&state_first, &firstpart, &state_first, + iLBCenc_inst->ULP_inst->startfirst_bits[ulp], + iLBCenc_inst->ULP_inst->startfirst_bits[ulp]+ + iLBCenc_inst->ULP_inst->startfirst_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->startfirst_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->startfirst_bits[ulp], &pos); + + packsplit(&idxForMax, &firstpart, &idxForMax, + iLBCenc_inst->ULP_inst->scale_bits[ulp], + iLBCenc_inst->ULP_inst->scale_bits[ulp]+ + iLBCenc_inst->ULP_inst->scale_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->scale_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->scale_bits[ulp], &pos); + + for (k=0; kstate_short_len; k++) { + packsplit(idxVec+k, &firstpart, idxVec+k, + iLBCenc_inst->ULP_inst->state_bits[ulp], + iLBCenc_inst->ULP_inst->state_bits[ulp]+ + iLBCenc_inst->ULP_inst->state_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->state_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->state_bits[ulp], &pos); + } + + + + + + + /* 23/22 (20ms/30ms) sample block */ + + for (k=0;kULP_inst->extra_cb_index[k][ulp], + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp]+ + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp+1]+ + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp], + &pos); + } + + for (k=0;kULP_inst->extra_cb_gain[k][ulp], + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp]+ + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp+1]+ + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp], + &pos); + } + + /* The two/four (20ms/30ms) 40 sample sub-blocks */ + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_index[i][k][ulp], + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp]+ + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp+1]+ + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp], + &pos); + } + } + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_gain[i][k][ulp], + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp]+ + + + + + + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp+1]+ + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp], + &pos); + } + } + } + + /* set the last bit to zero (otherwise the decoder + will treat it as a lost frame) */ + dopack( &pbytes, 0, 1, &pos); + } + diff --git a/asterisk/codecs/ilbc/iLBC_encode.h b/asterisk/codecs/ilbc/iLBC_encode.h new file mode 100644 index 00000000..a3ab55f9 --- /dev/null +++ b/asterisk/codecs/ilbc/iLBC_encode.h @@ -0,0 +1,39 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_encode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_ILBCENCODE_H + #define __iLBC_ILBCENCODE_H + + #include "iLBC_define.h" + + short initEncode( /* (o) Number of bytes + encoded */ + iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */ + int mode /* (i) frame size mode */ + ); + + void iLBC_encode( + + unsigned char *bytes, /* (o) encoded data bits iLBC */ + float *block, /* (o) speech vector to + encode */ + iLBC_Enc_Inst_t *iLBCenc_inst /* (i/o) the general encoder + state */ + ); + + #endif + + + + + + diff --git a/asterisk/codecs/ilbc/iLBC_test.c b/asterisk/codecs/ilbc/iLBC_test.c new file mode 100644 index 00000000..473cc7b6 --- /dev/null +++ b/asterisk/codecs/ilbc/iLBC_test.c @@ -0,0 +1,310 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_test.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include + #include + #include "iLBC_define.h" + #include "iLBC_encode.h" + #include "iLBC_decode.h" + + /* Runtime statistics */ + #include + + #define ILBCNOOFWORDS_MAX (NO_OF_BYTES_30MS/2) + + /*----------------------------------------------------------------* + * Encoder interface function + + + + + + *---------------------------------------------------------------*/ + + short encode( /* (o) Number of bytes encoded */ + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i/o) Encoder instance */ + short *encoded_data, /* (o) The encoded bytes */ + short *data /* (i) The signal block to encode*/ + ){ + float block[BLOCKL_MAX]; + int k; + + /* convert signal to float */ + + for (k=0; kblockl; k++) + block[k] = (float)data[k]; + + /* do the actual encoding */ + + iLBC_encode((unsigned char *)encoded_data, block, iLBCenc_inst); + + + return (iLBCenc_inst->no_of_bytes); + } + + /*----------------------------------------------------------------* + * Decoder interface function + *---------------------------------------------------------------*/ + + short decode( /* (o) Number of decoded samples */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */ + short *decoded_data, /* (o) Decoded signal block*/ + short *encoded_data, /* (i) Encoded bytes */ + short mode /* (i) 0=PL, 1=Normal */ + ){ + int k; + float decblock[BLOCKL_MAX], dtmp; + + /* check if mode is valid */ + + if (mode<0 || mode>1) { + printf("\nERROR - Wrong mode - 0, 1 allowed\n"); exit(3);} + + /* do actual decoding of block */ + + iLBC_decode(decblock, (unsigned char *)encoded_data, + iLBCdec_inst, mode); + + /* convert to short */ + + + + + + for (k=0; kblockl; k++){ + dtmp=decblock[k]; + + if (dtmpMAX_SAMPLE) + dtmp=MAX_SAMPLE; + decoded_data[k] = (short) dtmp; + } + + return (iLBCdec_inst->blockl); + } + + /*---------------------------------------------------------------* + * Main program to test iLBC encoding and decoding + * + * Usage: + * exefile_name.exe + * + * : Input file, speech for encoder (16-bit pcm file) + * : Bit stream output from the encoder + * : Output file, decoded speech (16-bit pcm file) + * : Bit error file, optional (16-bit) + * 1 - Packet received correctly + * 0 - Packet Lost + * + *--------------------------------------------------------------*/ + + int main(int argc, char* argv[]) + { + + /* Runtime statistics */ + + float starttime; + float runtime; + float outtime; + + FILE *ifileid,*efileid,*ofileid, *cfileid; + short data[BLOCKL_MAX]; + short encoded_data[ILBCNOOFWORDS_MAX], decoded_data[BLOCKL_MAX]; + int len; + short pli, mode; + int blockcount = 0; + int packetlosscount = 0; + + /* Create structs */ + iLBC_Enc_Inst_t Enc_Inst; + iLBC_Dec_Inst_t Dec_Inst; + + + + + + /* get arguments and open files */ + + if ((argc!=5) && (argc!=6)) { + fprintf(stderr, + "\n*-----------------------------------------------*\n"); + fprintf(stderr, + " %s <20,30> input encoded decoded (channel)\n\n", + argv[0]); + fprintf(stderr, + " mode : Frame size for the encoding/decoding\n"); + fprintf(stderr, + " 20 - 20 ms\n"); + fprintf(stderr, + " 30 - 30 ms\n"); + fprintf(stderr, + " input : Speech for encoder (16-bit pcm file)\n"); + fprintf(stderr, + " encoded : Encoded bit stream\n"); + fprintf(stderr, + " decoded : Decoded speech (16-bit pcm file)\n"); + fprintf(stderr, + " channel : Packet loss pattern, optional (16-bit)\n"); + fprintf(stderr, + " 1 - Packet received correctly\n"); + fprintf(stderr, + " 0 - Packet Lost\n"); + fprintf(stderr, + "*-----------------------------------------------*\n\n"); + exit(1); + } + mode=atoi(argv[1]); + if (mode != 20 && mode != 30) { + fprintf(stderr,"Wrong mode %s, must be 20, or 30\n", + argv[1]); + exit(2); + } + if ( (ifileid=fopen(argv[2],"rb")) == NULL) { + fprintf(stderr,"Cannot open input file %s\n", argv[2]); + exit(2);} + if ( (efileid=fopen(argv[3],"wb")) == NULL) { + fprintf(stderr, "Cannot open encoded file %s\n", + argv[3]); exit(1);} + if ( (ofileid=fopen(argv[4],"wb")) == NULL) { + fprintf(stderr, "Cannot open decoded file %s\n", + argv[4]); exit(1);} + if (argc==6) { + if( (cfileid=fopen(argv[5],"rb")) == NULL) { + fprintf(stderr, "Cannot open channel file %s\n", + + + + + + argv[5]); + exit(1); + } + } else { + cfileid=NULL; + } + + /* print info */ + + fprintf(stderr, "\n"); + fprintf(stderr, + "*---------------------------------------------------*\n"); + fprintf(stderr, + "* *\n"); + fprintf(stderr, + "* iLBC test program *\n"); + fprintf(stderr, + "* *\n"); + fprintf(stderr, + "* *\n"); + fprintf(stderr, + "*---------------------------------------------------*\n"); + fprintf(stderr,"\nMode : %2d ms\n", mode); + fprintf(stderr,"Input file : %s\n", argv[2]); + fprintf(stderr,"Encoded file : %s\n", argv[3]); + fprintf(stderr,"Output file : %s\n", argv[4]); + if (argc==6) { + fprintf(stderr,"Channel file : %s\n", argv[5]); + } + fprintf(stderr,"\n"); + + /* Initialization */ + + initEncode(&Enc_Inst, mode); + initDecode(&Dec_Inst, mode, 1); + + /* Runtime statistics */ + + starttime=clock()/(float)CLOCKS_PER_SEC; + + /* loop over input blocks */ + + while (fread(data,sizeof(short),Enc_Inst.blockl,ifileid)== + Enc_Inst.blockl) { + + blockcount++; + + /* encoding */ + + + + + + fprintf(stderr, "--- Encoding block %i --- ",blockcount); + len=encode(&Enc_Inst, encoded_data, data); + fprintf(stderr, "\r"); + + /* write byte file */ + + fwrite(encoded_data, sizeof(unsigned char), len, efileid); + + /* get channel data if provided */ + if (argc==6) { + if (fread(&pli, sizeof(short), 1, cfileid)) { + if ((pli!=0)&&(pli!=1)) { + fprintf(stderr, "Error in channel file\n"); + exit(0); + } + if (pli==0) { + /* Packet loss -> remove info from frame */ + memset(encoded_data, 0, + sizeof(short)*ILBCNOOFWORDS_MAX); + packetlosscount++; + } + } else { + fprintf(stderr, "Error. Channel file too short\n"); + exit(0); + } + } else { + pli=1; + } + + /* decoding */ + + fprintf(stderr, "--- Decoding block %i --- ",blockcount); + + len=decode(&Dec_Inst, decoded_data, encoded_data, pli); + fprintf(stderr, "\r"); + + /* write output file */ + + fwrite(decoded_data,sizeof(short),len,ofileid); + } + + /* Runtime statistics */ + + runtime = (float)(clock()/(float)CLOCKS_PER_SEC-starttime); + outtime = (float)((float)blockcount*(float)mode/1000.0); + printf("\n\nLength of speech file: %.1f s\n", outtime); + printf("Packet loss : %.1f%%\n", + 100.0*(float)packetlosscount/(float)blockcount); + + + + + + printf("Time to run iLBC :"); + printf(" %.1f s (%.1f %% of realtime)\n\n", runtime, + (100*runtime/outtime)); + + /* close files */ + + fclose(ifileid); fclose(efileid); fclose(ofileid); + if (argc==6) { + fclose(cfileid); + } + return(0); + } + diff --git a/asterisk/codecs/ilbc/lsf.c b/asterisk/codecs/ilbc/lsf.c new file mode 100644 index 00000000..b4fe0eda --- /dev/null +++ b/asterisk/codecs/ilbc/lsf.c @@ -0,0 +1,283 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + lsf.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + + + + + + #include + + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * conversion from lpc coefficients to lsf coefficients + *---------------------------------------------------------------*/ + + void a2lsf( + float *freq,/* (o) lsf coefficients */ + float *a /* (i) lpc coefficients */ + ){ + float steps[LSF_NUMBER_OF_STEPS] = + {(float)0.00635, (float)0.003175, (float)0.0015875, + (float)0.00079375}; + float step; + int step_idx; + int lsp_index; + float p[LPC_HALFORDER]; + float q[LPC_HALFORDER]; + float p_pre[LPC_HALFORDER]; + float q_pre[LPC_HALFORDER]; + float old_p, old_q, *old; + float *pq_coef; + float omega, old_omega; + int i; + float hlp, hlp1, hlp2, hlp3, hlp4, hlp5; + + for (i=0; i= 0.5)){ + + if (step_idx == (LSF_NUMBER_OF_STEPS - 1)){ + + if (fabs(hlp5) >= fabs(*old)) { + freq[lsp_index] = omega - step; + } else { + freq[lsp_index] = omega; + } + + + + + + + + if ((*old) >= 0.0){ + *old = (float)-1.0 * FLOAT_MAX; + } else { + *old = FLOAT_MAX; + } + + omega = old_omega; + step_idx = 0; + + step_idx = LSF_NUMBER_OF_STEPS; + } else { + + if (step_idx == 0) { + old_omega = omega; + } + + step_idx++; + omega -= steps[step_idx]; + + /* Go back one grid step */ + + step = steps[step_idx]; + } + } else { + + /* increment omega until they are of different sign, + and we know there is at least one root between omega + and old_omega */ + *old = hlp5; + omega += step; + } + } + } + + for (i = 0; i= 0.5)){ + + + if (freq[0] <= 0.0) { + freq[0] = (float)0.022; + } + + + if (freq[LPC_FILTERORDER - 1] >= 0.5) { + freq[LPC_FILTERORDER - 1] = (float)0.499; + } + + hlp = (freq[LPC_FILTERORDER - 1] - freq[0]) / + (float) (LPC_FILTERORDER - 1); + + for (i=1; i + #include + + #include "iLBC_define.h" + #include "constants.h" + #include "helpfun.h" + #include "string.h" + + /*----------------------------------------------------------------* + * splitting an integer into first most significant bits and + * remaining least significant bits + *---------------------------------------------------------------*/ + + void packsplit( + int *index, /* (i) the value to split */ + int *firstpart, /* (o) the value specified by most + significant bits */ + int *rest, /* (o) the value specified by least + significant bits */ + + + + + + int bitno_firstpart, /* (i) number of bits in most + significant part */ + int bitno_total /* (i) number of bits in full range + of value */ + ){ + int bitno_rest = bitno_total-bitno_firstpart; + + *firstpart = *index>>(bitno_rest); + *rest = *index-(*firstpart<<(bitno_rest)); + } + + /*----------------------------------------------------------------* + * combining a value corresponding to msb's with a value + * corresponding to lsb's + *---------------------------------------------------------------*/ + + void packcombine( + int *index, /* (i/o) the msb value in the + combined value out */ + int rest, /* (i) the lsb value */ + int bitno_rest /* (i) the number of bits in the + lsb part */ + ){ + *index = *index<0) { + + /* Jump to the next byte if end of this byte is reached*/ + + if (*pos==8) { + *pos=0; + (*bitstream)++; + **bitstream=0; + } + + posLeft=8-(*pos); + + /* Insert index into the bitstream */ + + if (bitno <= posLeft) { + **bitstream |= (unsigned char)(index<<(posLeft-bitno)); + *pos+=bitno; + bitno=0; + } else { + **bitstream |= (unsigned char)(index>>(bitno-posLeft)); + + *pos=8; + index-=((index>>(bitno-posLeft))<<(bitno-posLeft)); + + bitno-=posLeft; + } + } + } + + /*----------------------------------------------------------------* + * unpacking of bits from bitstream, i.e., vector of bytes + *---------------------------------------------------------------*/ + + void unpack( + unsigned char **bitstream, /* (i/o) on entrance pointer to + place in bitstream to + unpack new data from, on + exit pointer to place in + bitstream to unpack future + data from */ + int *index, /* (o) resulting value */ + int bitno, /* (i) number of bits used to + represent the value */ + int *pos /* (i/o) read position in the + current byte */ + + + + + + ){ + int BitsLeft; + + *index=0; + + while (bitno>0) { + + /* move forward in bitstream when the end of the + byte is reached */ + + if (*pos==8) { + *pos=0; + (*bitstream)++; + } + + BitsLeft=8-(*pos); + + /* Extract bits to index */ + + if (BitsLeft>=bitno) { + *index+=((((**bitstream)<<(*pos)) & 0xFF)>>(8-bitno)); + + *pos+=bitno; + bitno=0; + } else { + + if ((8-bitno)>0) { + *index+=((((**bitstream)<<(*pos)) & 0xFF)>> + (8-bitno)); + *pos=8; + } else { + *index+=(((int)(((**bitstream)<<(*pos)) & 0xFF))<< + (bitno-8)); + *pos=8; + } + bitno-=BitsLeft; + } + } + } + diff --git a/asterisk/codecs/ilbc/packing.h b/asterisk/codecs/ilbc/packing.h new file mode 100644 index 00000000..cbb9f82d --- /dev/null +++ b/asterisk/codecs/ilbc/packing.h @@ -0,0 +1,68 @@ + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + packing.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __PACKING_H + #define __PACKING_H + + void packsplit( + int *index, /* (i) the value to split */ + int *firstpart, /* (o) the value specified by most + significant bits */ + int *rest, /* (o) the value specified by least + significant bits */ + int bitno_firstpart, /* (i) number of bits in most + significant part */ + int bitno_total /* (i) number of bits in full range + of value */ + ); + + void packcombine( + int *index, /* (i/o) the msb value in the + combined value out */ + int rest, /* (i) the lsb value */ + int bitno_rest /* (i) the number of bits in the + lsb part */ + ); + + void dopack( + unsigned char **bitstream, /* (i/o) on entrance pointer to + place in bitstream to pack + new data, on exit pointer + to place in bitstream to + pack future data */ + int index, /* (i) the value to pack */ + int bitno, /* (i) the number of bits that the + value will fit within */ + int *pos /* (i/o) write position in the + current byte */ + ); + + + + + + void unpack( + unsigned char **bitstream, /* (i/o) on entrance pointer to + place in bitstream to + unpack new data from, on + exit pointer to place in + bitstream to unpack future + data from */ + int *index, /* (o) resulting value */ + int bitno, /* (i) number of bits used to + represent the value */ + int *pos /* (i/o) read position in the + current byte */ + ); + + #endif + diff --git a/asterisk/codecs/ilbc/rfc3951.txt b/asterisk/codecs/ilbc/rfc3951.txt new file mode 100644 index 00000000..d4fba08e --- /dev/null +++ b/asterisk/codecs/ilbc/rfc3951.txt @@ -0,0 +1,10867 @@ + + + + + + +Network Working Group S. Andersen +Request for Comments: 3951 Aalborg University +Category: Experimental A. Duric + Telio + H. Astrom + R. Hagen + W. Kleijn + J. Linden + Global IP Sound + December 2004 + + + Internet Low Bit Rate Codec (iLBC) + +Status of this Memo + + This memo defines an Experimental Protocol for the Internet + community. It does not specify an Internet standard of any kind. + Discussion and suggestions for improvement are requested. + Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2004). + +Abstract + + This document specifies a speech codec suitable for robust voice + communication over IP. The codec is developed by Global IP Sound + (GIPS). It is designed for narrow band speech and results in a + payload bit rate of 13.33 kbit/s for 30 ms frames and 15.20 kbit/s + for 20 ms frames. The codec enables graceful speech quality + degradation in the case of lost frames, which occurs in connection + with lost or delayed IP packets. + + + + + + + + + + + + + + + + + +Andersen, et al. Experimental [Page 1] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +Table of Contents + + 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 + 2. Outline of the Codec . . . . . . . . . . . . . . . . . . . . . 5 + 2.1. Encoder. . . . . . . . . . . . . . . . . . . . . . . . . 5 + 2.2. Decoder. . . . . . . . . . . . . . . . . . . . . . . . . 7 + 3. Encoder Principles . . . . . . . . . . . . . . . . . . . . . . 7 + 3.1. Pre-processing . . . . . . . . . . . . . . . . . . . . . 9 + 3.2. LPC Analysis and Quantization. . . . . . . . . . . . . . 9 + 3.2.1. Computation of Autocorrelation Coefficients. . . 10 + 3.2.2. Computation of LPC Coefficients. . . . . . . . . 11 + 3.2.3. Computation of LSF Coefficients from LPC + Coefficients . . . . . . . . . . . . . . . . . . 11 + 3.2.4. Quantization of LSF Coefficients . . . . . . . . 12 + 3.2.5. Stability Check of LSF Coefficients. . . . . . . 13 + 3.2.6. Interpolation of LSF Coefficients. . . . . . . . 13 + 3.2.7. LPC Analysis and Quantization for 20 ms Frames . 14 + 3.3. Calculation of the Residual. . . . . . . . . . . . . . . 15 + 3.4. Perceptual Weighting Filter. . . . . . . . . . . . . . . 15 + 3.5. Start State Encoder. . . . . . . . . . . . . . . . . . . 15 + 3.5.1. Start State Estimation . . . . . . . . . . . . . 16 + 3.5.2. All-Pass Filtering and Scale Quantization. . . . 17 + 3.5.3. Scalar Quantization. . . . . . . . . . . . . . . 18 + 3.6. Encoding the Remaining Samples . . . . . . . . . . . . . 19 + 3.6.1. Codebook Memory. . . . . . . . . . . . . . . . . 20 + 3.6.2. Perceptual Weighting of Codebook Memory + and Target . . . . . . . . . . . . . . . . . . . 22 + 3.6.3. Codebook Creation. . . . . . . . . . . . . . . . 23 + 3.6.3.1. Creation of a Base Codebook . . . . . . 23 + 3.6.3.2. Codebook Expansion. . . . . . . . . . . 24 + 3.6.3.3. Codebook Augmentation . . . . . . . . . 24 + 3.6.4. Codebook Search. . . . . . . . . . . . . . . . . 26 + 3.6.4.1. Codebook Search at Each Stage . . . . . 26 + 3.6.4.2. Gain Quantization at Each Stage . . . . 27 + 3.6.4.3. Preparation of Target for Next Stage. . 28 + 3.7. Gain Correction Encoding . . . . . . . . . . . . . . . . 28 + 3.8. Bitstream Definition . . . . . . . . . . . . . . . . . . 29 + 4. Decoder Principles . . . . . . . . . . . . . . . . . . . . . . 32 + 4.1. LPC Filter Reconstruction. . . . . . . . . . . . . . . . 33 + 4.2. Start State Reconstruction . . . . . . . . . . . . . . . 33 + 4.3. Excitation Decoding Loop . . . . . . . . . . . . . . . . 34 + 4.4. Multistage Adaptive Codebook Decoding. . . . . . . . . . 35 + 4.4.1. Construction of the Decoded Excitation Signal. . 35 + 4.5. Packet Loss Concealment. . . . . . . . . . . . . . . . . 35 + 4.5.1. Block Received Correctly and Previous Block + Also Received. . . . . . . . . . . . . . . . . . 35 + 4.5.2. Block Not Received . . . . . . . . . . . . . . . 36 + + + + +Andersen, et al. Experimental [Page 2] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + 4.5.3. Block Received Correctly When Previous Block + Not Received . . . . . . . . . . . . . . . . . . 36 + 4.6. Enhancement. . . . . . . . . . . . . . . . . . . . . . . 37 + 4.6.1. Estimating the Pitch . . . . . . . . . . . . . . 39 + 4.6.2. Determination of the Pitch-Synchronous + Sequences. . . . . . . . . . . . . . . . . . . . 39 + 4.6.3. Calculation of the Smoothed Excitation . . . . . 41 + 4.6.4. Enhancer Criterion . . . . . . . . . . . . . . . 41 + 4.6.5. Enhancing the Excitation . . . . . . . . . . . . 42 + 4.7. Synthesis Filtering. . . . . . . . . . . . . . . . . . . 43 + 4.8. Post Filtering . . . . . . . . . . . . . . . . . . . . . 43 + 5. Security Considerations. . . . . . . . . . . . . . . . . . . . 43 + 6. Evaluation of the iLBC Implementations . . . . . . . . . . . . 43 + 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 43 + 7.1. Normative References . . . . . . . . . . . . . . . . . . 43 + 7.2. Informative References . . . . . . . . . . . . . . . . . 44 + 8. ACKNOWLEDGEMENTS . . . . . . . . . . . . . . . . . . . . . . . 44 + APPENDIX A: Reference Implementation . . . . . . . . . . . . . . . 45 + A.1. iLBC_test.c. . . . . . . . . . . . . . . . . . . . . . . 46 + A.2 iLBC_encode.h. . . . . . . . . . . . . . . . . . . . . . 52 + A.3. iLBC_encode.c. . . . . . . . . . . . . . . . . . . . . . 53 + A.4. iLBC_decode.h. . . . . . . . . . . . . . . . . . . . . . 63 + A.5. iLBC_decode.c. . . . . . . . . . . . . . . . . . . . . . 64 + A.6. iLBC_define.h. . . . . . . . . . . . . . . . . . . . . . 76 + A.7. constants.h. . . . . . . . . . . . . . . . . . . . . . . 80 + A.8. constants.c. . . . . . . . . . . . . . . . . . . . . . . 82 + A.9. anaFilter.h. . . . . . . . . . . . . . . . . . . . . . . 96 + A.10. anaFilter.c. . . . . . . . . . . . . . . . . . . . . . . 97 + A.11. createCB.h . . . . . . . . . . . . . . . . . . . . . . . 98 + A.12. createCB.c . . . . . . . . . . . . . . . . . . . . . . . 99 + A.13. doCPLC.h . . . . . . . . . . . . . . . . . . . . . . . .104 + A.14. doCPLC.c . . . . . . . . . . . . . . . . . . . . . . . .104 + A.15. enhancer.h . . . . . . . . . . . . . . . . . . . . . . .109 + A.16. enhancer.c . . . . . . . . . . . . . . . . . . . . . . .110 + A.17. filter.h . . . . . . . . . . . . . . . . . . . . . . . .123 + A.18. filter.c . . . . . . . . . . . . . . . . . . . . . . . .125 + A.19. FrameClassify.h. . . . . . . . . . . . . . . . . . . . .128 + A.20. FrameClassify.c. . . . . . . . . . . . . . . . . . . . .129 + A.21. gainquant.h. . . . . . . . . . . . . . . . . . . . . . .131 + A.22. gainquant.c. . . . . . . . . . . . . . . . . . . . . . .131 + A.23. getCBvec.h . . . . . . . . . . . . . . . . . . . . . . .134 + A.24. getCBvec.c . . . . . . . . . . . . . . . . . . . . . . .134 + A.25. helpfun.h. . . . . . . . . . . . . . . . . . . . . . . .138 + A.26. helpfun.c. . . . . . . . . . . . . . . . . . . . . . . .140 + A.27. hpInput.h. . . . . . . . . . . . . . . . . . . . . . . .146 + A.28. hpInput.c. . . . . . . . . . . . . . . . . . . . . . . .146 + A.29. hpOutput.h . . . . . . . . . . . . . . . . . . . . . . .148 + A.30. hpOutput.c . . . . . . . . . . . . . . . . . . . . . . .148 + + + +Andersen, et al. Experimental [Page 3] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + A.31. iCBConstruct.h . . . . . . . . . . . . . . . . . . . . .149 + A.32. iCBConstruct.c . . . . . . . . . . . . . . . . . . . . .150 + A.33. iCBSearch.h. . . . . . . . . . . . . . . . . . . . . . .152 + A.34. iCBSearch.c. . . . . . . . . . . . . . . . . . . . . . .153 + A.35. LPCdecode.h. . . . . . . . . . . . . . . . . . . . . . .163 + A.36. LPCdecode.c. . . . . . . . . . . . . . . . . . . . . . .164 + A.37. LPCencode.h. . . . . . . . . . . . . . . . . . . . . . .167 + A.38. LPCencode.c. . . . . . . . . . . . . . . . . . . . . . .167 + A.39. lsf.h. . . . . . . . . . . . . . . . . . . . . . . . . .172 + A.40. lsf.c. . . . . . . . . . . . . . . . . . . . . . . . . .172 + A.41. packing.h. . . . . . . . . . . . . . . . . . . . . . . .178 + A.42. packing.c. . . . . . . . . . . . . . . . . . . . . . . .179 + A.43. StateConstructW.h. . . . . . . . . . . . . . . . . . . .182 + A.44. StateConstructW.c. . . . . . . . . . . . . . . . . . . .183 + A.45. StateSearchW.h . . . . . . . . . . . . . . . . . . . . .185 + A.46. StateSearchW.c . . . . . . . . . . . . . . . . . . . . .186 + A.47. syntFilter.h . . . . . . . . . . . . . . . . . . . . . .190 + A.48. syntFilter.c . . . . . . . . . . . . . . . . . . . . . .190 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . .192 + Full Copyright Statement . . . . . . . . . . . . . . . . . . . . .194 + +1. Introduction + + This document contains the description of an algorithm for the coding + of speech signals sampled at 8 kHz. The algorithm, called iLBC, uses + a block-independent linear-predictive coding (LPC) algorithm and has + support for two basic frame lengths: 20 ms at 15.2 kbit/s and 30 ms + at 13.33 kbit/s. When the codec operates at block lengths of 20 ms, + it produces 304 bits per block, which SHOULD be packetized as in [1]. + Similarly, for block lengths of 30 ms it produces 400 bits per block, + which SHOULD be packetized as in [1]. The two modes for the + different frame sizes operate in a very similar way. When they + differ it is explicitly stated in the text, usually with the notation + x/y, where x refers to the 20 ms mode and y refers to the 30 ms mode. + + The described algorithm results in a speech coding system with a + controlled response to packet losses similar to what is known from + pulse code modulation (PCM) with packet loss concealment (PLC), such + as the ITU-T G.711 standard [4], which operates at a fixed bit rate + of 64 kbit/s. At the same time, the described algorithm enables + fixed bit rate coding with a quality-versus-bit rate tradeoff close + to state-of-the-art. A suitable RTP payload format for the iLBC + codec is specified in [1]. + + Some of the applications for which this coder is suitable are real + time communications such as telephony and videoconferencing, + streaming audio, archival, and messaging. + + + + +Andersen, et al. Experimental [Page 4] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + Cable Television Laboratories (CableLabs(R)) has adopted iLBC as a + mandatory PacketCable(TM) audio codec standard for VoIP over Cable + applications [3]. + + This document is organized as follows. Section 2 gives a brief + outline of the codec. The specific encoder and decoder algorithms + are explained in sections 3 and 4, respectively. Appendix A provides + a c-code reference implementation. + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in BCP 14, RFC 2119 [2]. + +2. Outline of the Codec + + The codec consists of an encoder and a decoder as described in + sections 2.1 and 2.2, respectively. + + The essence of the codec is LPC and block-based coding of the LPC + residual signal. For each 160/240 (20 ms/30 ms) sample block, the + following major steps are performed: A set of LPC filters are + computed, and the speech signal is filtered through them to produce + the residual signal. The codec uses scalar quantization of the + dominant part, in terms of energy, of the residual signal for the + block. The dominant state is of length 57/58 (20 ms/30 ms) samples + and forms a start state for dynamic codebooks constructed from the + already coded parts of the residual signal. These dynamic codebooks + are used to code the remaining parts of the residual signal. By this + method, coding independence between blocks is achieved, resulting in + elimination of propagation of perceptual degradations due to packet + loss. The method facilitates high-quality packet loss concealment + (PLC). + +2.1. Encoder + + The input to the encoder SHOULD be 16 bit uniform PCM sampled at 8 + kHz. It SHOULD be partitioned into blocks of BLOCKL=160/240 samples + for the 20/30 ms frame size. Each block is divided into NSUB=4/6 + consecutive sub-blocks of SUBL=40 samples each. For 30 ms frame + size, the encoder performs two LPC_FILTERORDER=10 linear-predictive + coding (LPC) analyses. The first analysis applies a smooth window + centered over the second sub-block and extending to the middle of the + fifth sub-block. The second LPC analysis applies a smooth asymmetric + window centered over the fifth sub-block and extending to the end of + the sixth sub-block. For 20 ms frame size, one LPC_FILTERORDER=10 + linear-predictive coding (LPC) analysis is performed with a smooth + window centered over the third sub-frame. + + + + +Andersen, et al. Experimental [Page 5] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + For each of the LPC analyses, a set of line-spectral frequencies + (LSFs) are obtained, quantized, and interpolated to obtain LSF + coefficients for each sub-block. Subsequently, the LPC residual is + computed by using the quantized and interpolated LPC analysis + filters. + + The two consecutive sub-blocks of the residual exhibiting the maximal + weighted energy are identified. Within these two sub-blocks, the + start state (segment) is selected from two choices: the first 57/58 + samples or the last 57/58 samples of the two consecutive sub-blocks. + The selected segment is the one of higher energy. The start state is + encoded with scalar quantization. + + A dynamic codebook encoding procedure is used to encode 1) the 23/22 + (20 ms/30 ms) remaining samples in the two sub-blocks containing the + start state; 2) the sub-blocks after the start state in time; and 3) + the sub-blocks before the start state in time. Thus, the encoding + target can be either the 23/22 samples remaining of the two sub- + blocks containing the start state or a 40-sample sub-block. This + target can consist of samples indexed forward in time or backward in + time, depending on the location of the start state. + + The codebook coding is based on an adaptive codebook built from a + codebook memory that contains decoded LPC excitation samples from the + already encoded part of the block. These samples are indexed in the + same time direction as the target vector, ending at the sample + instant prior to the first sample instant represented in the target + vector. The codebook is used in CB_NSTAGES=3 stages in a successive + refinement approach, and the resulting three code vector gains are + encoded with 5-, 4-, and 3-bit scalar quantization, respectively. + + The codebook search method employs noise shaping derived from the LPC + filters, and the main decision criterion is to minimize the squared + error between the target vector and the code vectors. Each code + vector in this codebook comes from one of CB_EXPAND=2 codebook + sections. The first section is filled with delayed, already encoded + residual vectors. The code vectors of the second codebook section + are constructed by predefined linear combinations of vectors in the + first section of the codebook. + + As codebook encoding with squared-error matching is known to produce + a coded signal of less power than does the scalar quantized start + state signal, a gain re-scaling method is implemented by a refined + search for a better set of codebook gains in terms of power matching + after encoding. This is done by searching for a higher value of the + gain factor for the first stage codebook, as the subsequent stage + codebook gains are scaled by the first stage gain. + + + + +Andersen, et al. Experimental [Page 6] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +2.2. Decoder + + Typically for packet communications, a jitter buffer placed at the + receiving end decides whether the packet containing an encoded signal + block has been received or lost. This logic is not part of the codec + described here. For each encoded signal block received the decoder + performs a decoding. For each lost signal block, the decoder + performs a PLC operation. + + The decoding for each block starts by decoding and interpolating the + LPC coefficients. Subsequently the start state is decoded. + + For codebook-encoded segments, each segment is decoded by + constructing the three code vectors given by the received codebook + indices in the same way that the code vectors were constructed in the + encoder. The three gain factors are also decoded and the resulting + decoded signal is given by the sum of the three codebook vectors + scaled with respective gain. + + An enhancement algorithm is applied to the reconstructed excitation + signal. This enhancement augments the periodicity of voiced speech + regions. The enhancement is optimized under the constraint that the + modification signal (defined as the difference between the enhanced + excitation and the excitation signal prior to enhancement) has a + short-time energy that does not exceed a preset fraction of the + short-time energy of the excitation signal prior to enhancement. + + A packet loss concealment (PLC) operation is easily embedded in the + decoder. The PLC operation can, e.g., be based on repeating LPC + filters and obtaining the LPC residual signal by using a long-term + prediction estimate from previous residual blocks. + +3. Encoder Principles + + The following block diagram is an overview of all the components of + the iLBC encoding procedure. The description of the blocks contains + references to the section where that particular procedure is further + described. + + + + + + + + + + + + + +Andersen, et al. Experimental [Page 7] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + +-----------+ +---------+ +---------+ + speech -> | 1. Pre P | -> | 2. LPC | -> | 3. Ana | -> + +-----------+ +---------+ +---------+ + + +---------------+ +--------------+ + -> | 4. Start Sel | ->| 5. Scalar Qu | -> + +---------------+ +--------------+ + + +--------------+ +---------------+ + -> |6. CB Search | -> | 7. Packetize | -> payload + | +--------------+ | +---------------+ + ----<---------<------ + sub-frame 0..2/4 (20 ms/30 ms) + + Figure 3.1. Flow chart of the iLBC encoder + + 1. Pre-process speech with a HP filter, if needed (section 3.1). + + 2. Compute LPC parameters, quantize, and interpolate (section 3.2). + + 3. Use analysis filters on speech to compute residual (section 3.3). + + 4. Select position of 57/58-sample start state (section 3.5). + + 5. Quantize the 57/58-sample start state with scalar quantization + (section 3.5). + + 6. Search the codebook for each sub-frame. Start with 23/22 sample + block, then encode sub-blocks forward in time, and then encode + sub-blocks backward in time. For each block, the steps in Figure + 3.4 are performed (section 3.6). + + 7. Packetize the bits into the payload specified in Table 3.2. + + The input to the encoder SHOULD be 16-bit uniform PCM sampled at 8 + kHz. Also it SHOULD be partitioned into blocks of BLOCKL=160/240 + samples. Each block input to the encoder is divided into NSUB=4/6 + consecutive sub-blocks of SUBL=40 samples each. + + + + + + + + + + + + + +Andersen, et al. Experimental [Page 8] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + 0 39 79 119 159 + +---------------------------------------+ + | 1 | 2 | 3 | 4 | + +---------------------------------------+ + 20 ms frame + + 0 39 79 119 159 199 239 + +-----------------------------------------------------------+ + | 1 | 2 | 3 | 4 | 5 | 6 | + +-----------------------------------------------------------+ + 30 ms frame + Figure 3.2. One input block to the encoder for 20 ms (with four sub- + frames) and 30 ms (with six sub-frames). + +3.1. Pre-processing + + In some applications, the recorded speech signal contains DC level + and/or 50/60 Hz noise. If these components have not been removed + prior to the encoder call, they should be removed by a high-pass + filter. A reference implementation of this, using a filter with a + cutoff frequency of 90 Hz, can be found in Appendix A.28. + +3.2. LPC Analysis and Quantization + + The input to the LPC analysis module is a possibly high-pass filtered + speech buffer, speech_hp, that contains 240/300 (LPC_LOOKBACK + + BLOCKL = 80/60 + 160/240 = 240/300) speech samples, where samples 0 + through 79/59 are from the previous block and samples 80/60 through + 239/299 are from the current block. No look-ahead into the next + block is used. For the very first block processed, the look-back + samples are assumed to be zeros. + + For each input block, the LPC analysis calculates one/two set(s) of + LPC_FILTERORDER=10 LPC filter coefficients using the autocorrelation + method and the Levinson-Durbin recursion. These coefficients are + converted to the Line Spectrum Frequency representation. In the 20 + ms case, the single lsf set represents the spectral characteristics + as measured at the center of the third sub-block. For 30 ms frames, + the first set, lsf1, represents the spectral properties of the input + signal at the center of the second sub-block, and the other set, + lsf2, represents the spectral characteristics as measured at the + center of the fifth sub-block. The details of the computation for 30 + ms frames are described in sections 3.2.1 through 3.2.6. Section + 3.2.7 explains how the LPC Analysis and Quantization differs for 20 + ms frames. + + + + + + +Andersen, et al. Experimental [Page 9] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +3.2.1. Computation of Autocorrelation Coefficients + + The first step in the LPC analysis procedure is to calculate + autocorrelation coefficients by using windowed speech samples. This + windowing is the only difference in the LPC analysis procedure for + the two sets of coefficients. For the first set, a 240-sample-long + standard symmetric Hanning window is applied to samples 0 through 239 + of the input data. The first window, lpc_winTbl, is defined as + + lpc_winTbl[i]= 0.5 * (1.0 - cos((2*PI*(i+1))/(BLOCKL+1))); + i=0,...,119 + lpc_winTbl[i] = winTbl[BLOCKL - i - 1]; i=120,...,239 + + The windowed speech speech_hp_win1 is then obtained by multiplying + the first 240 samples of the input speech buffer with the window + coefficients: + + speech_hp_win1[i] = speech_hp[i] * lpc_winTbl[i]; + i=0,...,BLOCKL-1 + + From these 240 windowed speech samples, 11 (LPC_FILTERORDER + 1) + autocorrelation coefficients, acf1, are calculated: + + acf1[lag] += speech_hp_win1[n] * speech_hp_win1[n + lag]; + lag=0,...,LPC_FILTERORDER; n=0,...,BLOCKL-lag-1 + + In order to make the analysis more robust against numerical precision + problems, a spectral smoothing procedure is applied by windowing the + autocorrelation coefficients before the LPC coefficients are + computed. Also, a white noise floor is added to the autocorrelation + function by multiplying coefficient zero by 1.0001 (40dB below the + energy of the windowed speech signal). These two steps are + implemented by multiplying the autocorrelation coefficients with the + following window: + + lpc_lagwinTbl[0] = 1.0001; + lpc_lagwinTbl[i] = exp(-0.5 * ((2 * PI * 60.0 * i) /FS)^2); + i=1,...,LPC_FILTERORDER + where FS=8000 is the sampling frequency + + Then, the windowed acf function acf1_win is obtained by + + acf1_win[i] = acf1[i] * lpc_lagwinTbl[i]; + i=0,...,LPC_FILTERORDER + + The second set of autocorrelation coefficients, acf2_win, are + obtained in a similar manner. The window, lpc_asymwinTbl, is applied + to samples 60 through 299, i.e., the entire current block. The + + + +Andersen, et al. Experimental [Page 10] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + window consists of two segments, the first (samples 0 to 219) being + half a Hanning window with length 440 and the second a quarter of a + cycle of a cosine wave. By using this asymmetric window, an LPC + analysis centered in the fifth sub-block is obtained without the need + for any look-ahead, which would add delay. The asymmetric window is + defined as + + lpc_asymwinTbl[i] = (sin(PI * (i + 1) / 441))^2; i=0,...,219 + + lpc_asymwinTbl[i] = cos((i - 220) * PI / 40); i=220,...,239 + + and the windowed speech is computed by + + speech_hp_win2[i] = speech_hp[i + LPC_LOOKBACK] * + lpc_asymwinTbl[i]; i=0,....BLOCKL-1 + + The windowed autocorrelation coefficients are then obtained in + exactly the same way as for the first analysis instance. + + The generation of the windows lpc_winTbl, lpc_asymwinTbl, and + lpc_lagwinTbl are typically done in advance, and the arrays are + stored in ROM rather than repeating the calculation for every block. + +3.2.2. Computation of LPC Coefficients + + From the 2 x 11 smoothed autocorrelation coefficients, acf1_win and + acf2_win, the 2 x 11 LPC coefficients, lp1 and lp2, are calculated + in the same way for both analysis locations by using the well known + Levinson-Durbin recursion. The first LPC coefficient is always 1.0, + resulting in ten unique coefficients. + + After determining the LPC coefficients, a bandwidth expansion + procedure is applied to smooth the spectral peaks in the + short-term spectrum. The bandwidth addition is obtained by the + following modification of the LPC coefficients: + + lp1_bw[i] = lp1[i] * chirp^i; i=0,...,LPC_FILTERORDER + lp2_bw[i] = lp2[i] * chirp^i; i=0,...,LPC_FILTERORDER + + where "chirp" is a real number between 0 and 1. It is RECOMMENDED to + use a value of 0.9. + +3.2.3. Computation of LSF Coefficients from LPC Coefficients + + Thus far, two sets of LPC coefficients that represent the short-term + spectral characteristics of the speech signal for two different time + locations within the current block have been determined. These + coefficients SHOULD be quantized and interpolated. Before this is + + + +Andersen, et al. Experimental [Page 11] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + done, it is advantageous to convert the LPC parameters into another + type of representation called Line Spectral Frequencies (LSF). The + LSF parameters are used because they are better suited for + quantization and interpolation than the regular LPC coefficients. + Many computationally efficient methods for calculating the LSFs from + the LPC coefficients have been proposed in the literature. The + detailed implementation of one applicable method can be found in + Appendix A.26. The two arrays of LSF coefficients obtained, lsf1 and + lsf2, are of dimension 10 (LPC_FILTERORDER). + +3.2.4. Quantization of LSF Coefficients + + Because the LPC filters defined by the two sets of LSFs are also + needed in the decoder, the LSF parameters need to be quantized and + transmitted as side information. The total number of bits required + to represent the quantization of the two LSF representations for one + block of speech is 40, with 20 bits used for each of lsf1 and lsf2. + + For computational and storage reasons, the LSF vectors are quantized + using three-split vector quantization (VQ). That is, the LSF vectors + are split into three sub-vectors that are each quantized with a + regular VQ. The quantized versions of lsf1 and lsf2, qlsf1 and + qlsf2, are obtained by using the same memoryless split VQ. The + length of each of these two LSF vectors is 10, and they are split + into three sub-vectors containing 3, 3, and 4 values, respectively. + + For each of the sub-vectors, a separate codebook of quantized values + has been designed with a standard VQ training method for a large + database containing speech from a large number of speakers recorded + under various conditions. The size of each of the three codebooks + associated with the split definitions above is + + int size_lsfCbTbl[LSF_NSPLIT] = {64,128,128}; + + The actual values of the vector quantization codebook that must be + used can be found in the reference code of Appendix A. Both sets of + LSF coefficients, lsf1 and lsf2, are quantized with a standard + memoryless split vector quantization (VQ) structure using the squared + error criterion in the LSF domain. The split VQ quantization + consists of the following steps: + + 1) Quantize the first three LSF coefficients (1 - 3) with a VQ + codebook of size 64. + 2) Quantize the next three LSF coefficients 4 - 6 with VQ a codebook + of size 128. + 3) Quantize the last four LSF coefficients (7 - 10) with a VQ + codebook of size 128. + + + + +Andersen, et al. Experimental [Page 12] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + This procedure, repeated for lsf1 and lsf2, gives six quantization + indices and the quantized sets of LSF coefficients qlsf1 and qlsf2. + Each set of three indices is encoded with 6 + 7 + 7 = 20 bits. The + total number of bits used for LSF quantization in a block is thus 40 + bits. + +3.2.5. Stability Check of LSF Coefficients + + The LSF representation of the LPC filter has the convenient property + that the coefficients are ordered by increasing value, i.e., lsf(n-1) + < lsf(n), 0 < n < 10, if the corresponding synthesis filter is + stable. As we are employing a split VQ scheme, it is possible that + at the split boundaries the LSF coefficients are not ordered + correctly and hence that the corresponding LP filter is unstable. To + ensure that the filter used is stable, a stability check is performed + for the quantized LSF vectors. If it turns out that the coefficients + are not ordered appropriately (with a safety margin of 50 Hz to + ensure that formant peaks are not too narrow), they will be moved + apart. The detailed method for this can be found in Appendix A.40. + The same procedure is performed in the decoder. This ensures that + exactly the same LSF representations are used in both encoder and + decoder. + +3.2.6. Interpolation of LSF Coefficients + + From the two sets of LSF coefficients that are computed for each + block of speech, different LSFs are obtained for each sub-block by + means of interpolation. This procedure is performed for the original + LSFs (lsf1 and lsf2), as well as the quantized versions qlsf1 and + qlsf2, as both versions are used in the encoder. Here follows a + brief summary of the interpolation scheme; the details are found in + the c-code of Appendix A. In the first sub-block, the average of the + second LSF vector from the previous block and the first LSF vector in + the current block is used. For sub-blocks two through five, the LSFs + used are obtained by linear interpolation from lsf1 (and qlsf1) to + lsf2 (and qlsf2), with lsf1 used in sub-block two and lsf2 in sub- + block five. In the last sub-block, lsf2 is used. For the very first + block it is assumed that the last LSF vector of the previous block is + equal to a predefined vector, lsfmeanTbl, obtained by calculating the + mean LSF vector of the LSF design database. + + lsfmeanTbl[LPC_FILTERORDER] = {0.281738, 0.445801, 0.663330, + 0.962524, 1.251831, 1.533081, 1.850586, 2.137817, + 2.481445, 2.777344} + + + + + + + +Andersen, et al. Experimental [Page 13] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + The interpolation method is standard linear interpolation in the LSF + domain. The interpolated LSF values are converted to LPC + coefficients for each sub-block. The unquantized and quantized LPC + coefficients form two sets of filters respectively. The unquantized + analysis filter for sub-block k is defined as follows + + ___ + \ + Ak(z)= 1 + > ak(i)*z^(-i) + /__ + i=1...LPC_FILTERORDER + + The quantized analysis filter for sub-block k is defined as follows + ___ + \ + A~k(z)= 1 + > a~k(i)*z^(-i) + /__ + i=1...LPC_FILTERORDER + + A reference implementation of the lsf encoding is given in Appendix + A.38. A reference implementation of the corresponding decoding can + be found in Appendix A.36. + +3.2.7. LPC Analysis and Quantization for 20 ms Frames + + As previously stated, the codec only calculates one set of LPC + parameters for the 20 ms frame size as opposed to two sets for 30 ms + frames. A single set of autocorrelation coefficients is calculated + on the LPC_LOOKBACK + BLOCKL = 80 + 160 = 240 samples. These samples + are windowed with the asymmetric window lpc_asymwinTbl, centered over + the third sub-frame, to form speech_hp_win. Autocorrelation + coefficients, acf, are calculated on the 240 samples in speech_hp_win + and then windowed exactly as in section 3.2.1 (resulting in + acf_win). + + This single set of windowed autocorrelation coefficients is used to + calculate LPC coefficients, LSF coefficients, and quantized LSF + coefficients in exactly the same manner as in sections 3.2.3 through + 3.2.4. As for the 30 ms frame size, the ten LSF coefficients are + divided into three sub-vectors of size 3, 3, and 4 and quantized by + using the same scheme and codebook as in section 3.2.4 to finally get + 3 quantization indices. The quantized LSF coefficients are + stabilized with the algorithm described in section 3.2.5. + + From the set of LSF coefficients computed for this block and those + from the previous block, different LSFs are obtained for each sub- + block by means of interpolation. The interpolation is done linearly + in the LSF domain over the four sub-blocks, so that the n-th sub- + + + +Andersen, et al. Experimental [Page 14] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + frame uses the weight (4-n)/4 for the LSF from old frame and the + weight n/4 of the LSF from the current frame. For the very first + block the mean LSF, lsfmeanTbl, is used as the LSF from the previous + block. Similarly as seen in section 3.2.6, both unquantized, A(z), + and quantized, A~(z), analysis filters are calculated for each of the + four sub-blocks. + +3.3. Calculation of the Residual + + The block of speech samples is filtered by the quantized and + interpolated LPC analysis filters to yield the residual signal. In + particular, the corresponding LPC analysis filter for each 40 sample + sub-block is used to filter the speech samples for the same sub- + block. The filter memory at the end of each sub-block is carried + over to the LPC filter of the next sub-block. The signal at the + output of each LP analysis filter constitutes the residual signal for + the corresponding sub-block. + + A reference implementation of the LPC analysis filters is given in + Appendix A.10. + +3.4. Perceptual Weighting Filter + + In principle any good design of a perceptual weighting filter can be + applied in the encoder without compromising this codec definition. + However, it is RECOMMENDED to use the perceptual weighting filter Wk + for sub-block k specified below: + + Wk(z)=1/Ak(z/LPC_CHIRP_WEIGHTDENUM), where + LPC_CHIRP_WEIGHTDENUM = 0.4222 + + This is a simple design with low complexity that is applied in the + LPC residual domain. Here Ak(z) is the filter obtained for sub-block + k from unquantized but interpolated LSF coefficients. + +3.5. Start State Encoder + + The start state is quantized by using a common 6-bit scalar quantizer + for the block and a 3-bit scalar quantizer operating on scaled + samples in the weighted speech domain. In the following we describe + the state encoding in greater detail. + + + + + + + + + + +Andersen, et al. Experimental [Page 15] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +3.5.1. Start State Estimation + + The two sub-blocks containing the start state are determined by + finding the two consecutive sub-blocks in the block having the + highest power. Advantageously, down-weighting is used in the + beginning and end of the sub-frames, i.e., the following measure is + computed (NSUB=4/6 for 20/30 ms frame size): + + nsub=1,...,NSUB-1 + ssqn[nsub] = 0.0; + for (i=(nsub-1)*SUBL; i<(nsub-1)*SUBL+5; i++) + ssqn[nsub] += sampEn_win[i-(nsub-1)*SUBL]* + residual[i]*residual[i]; + for (i=(nsub-1)*SUBL+5; i<(nsub+1)*SUBL-5; i++) + ssqn[nsub] += residual[i]*residual[i]; + for (i=(nsub+1)*SUBL-5; i<(nsub+1)*SUBL; i++) + ssqn[nsub] += sampEn_win[(nsub+1)*SUBL-i-1]* + residual[i]*residual[i]; + + where sampEn_win[5]={1/6, 2/6, 3/6, 4/6, 5/6}; MAY be used. The + sub-frame number corresponding to the maximum value of + ssqEn_win[nsub-1]*ssqn[nsub] is selected as the start state + indicator. A weighting of ssqEn_win[]={0.8,0.9,1.0,0.9,0.8} for 30 + ms frames and ssqEn_win[]={0.9,1.0,0.9} for 20 ms frames; MAY + advantageously be used to bias the start state towards the middle of + the frame. + + For 20 ms frames there are three possible positions for the two-sub- + block length maximum power segment; the start state position is + encoded with 2 bits. The start state position, start, MUST be + encoded as + + start=1: start state in sub-frame 0 and 1 + start=2: start state in sub-frame 1 and 2 + start=3: start state in sub-frame 2 and 3 + + For 30 ms frames there are five possible positions of the two-sub- + block length maximum power segment, the start state position is + encoded with 3 bits. The start state position, start, MUST be + encoded as + + start=1: start state in sub-frame 0 and 1 + start=2: start state in sub-frame 1 and 2 + start=3: start state in sub-frame 2 and 3 + start=4: start state in sub-frame 3 and 4 + start=5: start state in sub-frame 4 and 5 + + + + + +Andersen, et al. Experimental [Page 16] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + Hence, in both cases, index 0 is not used. In order to shorten the + start state for bit rate efficiency, the start state is brought down + to STATE_SHORT_LEN=57 samples for 20 ms frames and STATE_SHORT_LEN=58 + samples for 30 ms frames. The power of the first 23/22 and last + 23/22 samples of the two sub-frame blocks identified above is + computed as the sum of the squared signal sample values, and the + 23/22-sample segment with the lowest power is excluded from the start + state. One bit is transmitted to indicate which of the two possible + 57/58 sample segments is used. The start state position within the + two sub-frames determined above, state_first, MUST be encoded as + + state_first=1: start state is first STATE_SHORT_LEN samples + state_first=0: start state is last STATE_SHORT_LEN samples + +3.5.2. All-Pass Filtering and Scale Quantization + + The block of residual samples in the start state is first filtered by + an all-pass filter with the quantized LPC coefficients as denominator + and reversed quantized LPC coefficients as numerator. The purpose of + this phase-dispersion filter is to get a more even distribution of + the sample values in the residual signal. The filtering is performed + by circular convolution, where the initial filter memory is set to + zero. + + res(0..(STATE_SHORT_LEN-1)) = uncoded start state residual + res((STATE_SHORT_LEN)..(2*STATE_SHORT_LEN-1)) = 0 + + Pk(z) = A~rk(z)/A~k(z), where + ___ + \ + A~rk(z)= z^(-LPC_FILTERORDER)+>a~k(i+1)*z^(i-(LPC_FILTERORDER-1)) + /__ + i=0...(LPC_FILTERORDER-1) + + and A~k(z) is taken from the block where the start state begins + + res -> Pk(z) -> filtered + + ccres(k) = filtered(k) + filtered(k+STATE_SHORT_LEN), + k=0..(STATE_SHORT_LEN-1) + + The all-pass filtered block is searched for its largest magnitude + sample. The 10-logarithm of this magnitude is quantized with a 6-bit + quantizer, state_frgqTbl, by finding the nearest representation. + + + + + + + +Andersen, et al. Experimental [Page 17] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + This results in an index, idxForMax, corresponding to a quantized + value, qmax. The all-pass filtered residual samples in the block are + then multiplied with a scaling factor scal=4.5/(10^qmax) to yield + normalized samples. + + state_frgqTbl[64] = {1.000085, 1.071695, 1.140395, 1.206868, + 1.277188, 1.351503, 1.429380, 1.500727, 1.569049, + 1.639599, 1.707071, 1.781531, 1.840799, 1.901550, + 1.956695, 2.006750, 2.055474, 2.102787, 2.142819, + 2.183592, 2.217962, 2.257177, 2.295739, 2.332967, + 2.369248, 2.402792, 2.435080, 2.468598, 2.503394, + 2.539284, 2.572944, 2.605036, 2.636331, 2.668939, + 2.698780, 2.729101, 2.759786, 2.789834, 2.818679, + 2.848074, 2.877470, 2.906899, 2.936655, 2.967804, + 3.000115, 3.033367, 3.066355, 3.104231, 3.141499, + 3.183012, 3.222952, 3.265433, 3.308441, 3.350823, + 3.395275, 3.442793, 3.490801, 3.542514, 3.604064, + 3.666050, 3.740994, 3.830749, 3.938770, 4.101764} + +3.5.3. Scalar Quantization + + The normalized samples are quantized in the perceptually weighted + speech domain by a sample-by-sample scalar DPCM quantization as + depicted in Figure 3.3. Each sample in the block is filtered by a + weighting filter Wk(z), specified in section 3.4, to form a weighted + speech sample x[n]. The target sample d[n] is formed by subtracting + a predicted sample y[n], where the prediction filter is given by + + Pk(z) = 1 - 1 / Wk(z). + + +-------+ x[n] + d[n] +-----------+ u[n] + residual -->| Wk(z) |-------->(+)---->| Quantizer |------> quantized + +-------+ - /|\ +-----------+ | residual + | \|/ + y[n] +--------------------->(+) + | | + | +------+ | + +--------| Pk(z)|<------+ + +------+ + + Figure 3.3. Quantization of start state samples by DPCM in weighted + speech domain. + + The coded state sample u[n] is obtained by quantizing d[n] with a 3- + bit quantizer with quantization table state_sq3Tbl. + + state_sq3Tbl[8] = {-3.719849, -2.177490, -1.130005, -0.309692, + 0.444214, 1.329712, 2.436279, 3.983887} + + + +Andersen, et al. Experimental [Page 18] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + The quantized samples are transformed back to the residual domain by + 1) scaling with 1/scal; 2) time-reversing the scaled samples; 3) + filtering the time-reversed samples by the same all-pass filter, as + in section 3.5.2, by using circular convolution; and 4) time- + reversing the filtered samples. (More detail is in section 4.2.) + + A reference implementation of the start-state encoding can be found + in Appendix A.46. + +3.6. Encoding the Remaining Samples + + A dynamic codebook is used to encode 1) the 23/22 remaining samples + in the two sub-blocks containing the start state; 2) the sub-blocks + after the start state in time; and 3) the sub-blocks before the start + state in time. Thus, the encoding target can be either the 23/22 + samples remaining of the 2 sub-blocks containing the start state, or + a 40-sample sub-block. This target can consist of samples that are + indexed forward in time or backward in time, depending on the + location of the start state. The length of the target is denoted by + lTarget. + + The coding is based on an adaptive codebook that is built from a + codebook memory that contains decoded LPC excitation samples from the + already encoded part of the block. These samples are indexed in the + same time direction as is the target vector and end at the sample + instant prior to the first sample instant represented in the target + vector. The codebook memory has length lMem, which is equal to + CB_MEML=147 for the two/four 40-sample sub-blocks and 85 for the + 23/22-sample sub-block. + + The following figure shows an overview of the encoding procedure. + + +------------+ +---------------+ +-------------+ + -> | 1. Decode | -> | 2. Mem setup | -> | 3. Perc. W. | -> + +------------+ +---------------+ +-------------+ + + +------------+ +-----------------+ + -> | 4. Search | -> | 5. Upd. Target | ------------------> + | +------------+ +------------------ | + ----<-------------<-----------<---------- + stage=0..2 + + +----------------+ + -> | 6. Recalc G[0] | ---------------> gains and CB indices + +----------------+ + + Figure 3.4. Flow chart of the codebook search in the iLBC encoder. + + + + +Andersen, et al. Experimental [Page 19] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + 1. Decode the part of the residual that has been encoded so far, + using the codebook without perceptual weighting. + + 2. Set up the memory by taking data from the decoded residual. This + memory is used to construct codebooks. For blocks preceding the + start state, both the decoded residual and the target are time + reversed (section 3.6.1). + 3. Filter the memory + target with the perceptual weighting filter + (section 3.6.2). + + 4. Search for the best match between the target and the codebook + vector. Compute the optimal gain for this match and quantize that + gain (section 3.6.4). + + 5. Update the perceptually weighted target by subtracting the + contribution from the selected codebook vector from the + perceptually weighted memory (quantized gain times selected + vector). Repeat 4 and 5 for the two additional stages. + + 6. Calculate the energy loss due to encoding of the residual. If + needed, compensate for this loss by an upscaling and + requantization of the gain for the first stage (section 3.7). + + The following sections provide an in-depth description of the + different blocks of Figure 3.4. + +3.6.1. Codebook Memory + + The codebook memory is based on the already encoded sub-blocks, so + the available data for encoding increases for each new sub-block that + has been encoded. Until enough sub-blocks have been encoded to fill + the codebook memory with data, it is padded with zeros. The + following figure shows an example of the order in which the sub- + blocks are encoded for the 30 ms frame size if the start state is + located in the last 58 samples of sub-block 2 and 3. + + +-----------------------------------------------------+ + | 5 | 1 |///|////////| 2 | 3 | 4 | + +-----------------------------------------------------+ + + Figure 3.5. The order from 1 to 5 in which the sub-blocks are + encoded. The slashed area is the start state. + + + + + + + + + +Andersen, et al. Experimental [Page 20] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + The first target sub-block to be encoded is number 1, and the + corresponding codebook memory is shown in the following figure. As + the target vector comes before the start state in time, the codebook + memory and target vector are time reversed; thus, after the block has + been time reversed the search algorithm can be reused. As only the + start state has been encoded so far, the last samples of the codebook + memory are padded with zeros. + + +------------------------- + |zeros|\\\\\\\\|\\\\| 1 | + +------------------------- + + Figure 3.6. The codebook memory, length lMem=85 samples, and the + target vector 1, length 22 samples. + + The next step is to encode sub-block 2 by using the memory that now + has increased since sub-block 1 has been encoded. The following + figure shows the codebook memory for encoding of sub-block 2. + + +----------------------------------- + | zeros | 1 |///|////////| 2 | + +----------------------------------- + + Figure 3.7. The codebook memory, length lMem=147 samples, and the + target vector 2, length 40 samples. + + The next step is to encode sub-block 3 by using the memory which has + been increased yet again since sub-blocks 1 and 2 have been encoded, + but the sub-block still has to be padded with a few zeros. The + following figure shows the codebook memory for encoding of sub-block + 3. + + +------------------------------------------ + |zeros| 1 |///|////////| 2 | 3 | + +------------------------------------------ + + Figure 3.8. The codebook memory, length lMem=147 samples, and the + target vector 3, length 40 samples. + + The next step is to encode sub-block 4 by using the memory which now + has increased yet again since sub-blocks 1, 2, and 3 have been + encoded. This time, the memory does not have to be padded with + zeros. The following figure shows the codebook memory for encoding + of sub-block 4. + + + + + + + +Andersen, et al. Experimental [Page 21] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + +------------------------------------------ + |1|///|////////| 2 | 3 | 4 | + +------------------------------------------ + + Figure 3.9. The codebook memory, length lMem=147 samples, and the + target vector 4, length 40 samples. + + The final target sub-block to be encoded is number 5, and the + following figure shows the corresponding codebook memory. As the + target vector comes before the start state in time, the codebook + memory and target vector are time reversed. + + +------------------------------------------- + | 3 | 2 |\\\\\\\\|\\\\| 1 | 5 | + +------------------------------------------- + + Figure 3.10. The codebook memory, length lMem=147 samples, and the + target vector 5, length 40 samples. + + For the case of 20 ms frames, the encoding procedure looks almost + exactly the same. The only difference is that the size of the start + state is 57 samples and that there are only three sub-blocks to be + encoded. The encoding order is the same as above, starting with the + 23-sample target and then encoding the two remaining 40-sample sub- + blocks, first going forward in time and then going backward in time + relative to the start state. + +3.6.2. Perceptual Weighting of Codebook Memory and Target + + To provide a perceptual weighting of the coding error, a + concatenation of the codebook memory and the target to be coded is + all-pole filtered with the perceptual weighting filter specified in + section 3.4. The filter state of the weighting filter is set to + zero. + + in(0..(lMem-1)) = unweighted codebook memory + in(lMem..(lMem+lTarget-1)) = unweighted target signal + + + in -> Wk(z) -> filtered, + where Wk(z) is taken from the sub-block of the target + + weighted codebook memory = filtered(0..(lMem-1)) + weighted target signal = filtered(lMem..(lMem+lTarget-1)) + + The codebook search is done with the weighted codebook memory and the + weighted target, whereas the decoding and the codebook memory update + uses the unweighted codebook memory. + + + +Andersen, et al. Experimental [Page 22] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +3.6.3. Codebook Creation + + The codebook for the search is created from the perceptually weighted + codebook memory. It consists of two sections, where the first is + referred to as the base codebook and the second as the expanded + codebook, as it is created by linear combinations of the first. Each + of these two sections also has a subsection referred to as the + augmented codebook. The augmented codebook is only created and used + for the coding of the 40-sample sub-blocks and not for the 23/22- + sample sub-block case. The codebook size used for the different + sub-blocks and different stages are summarized in the table below. + + Stage + 1 2 & 3 + -------------------------------------------- + 22 128 (64+0)*2 128 (64+0)*2 + Sub- 1:st 40 256 (108+20)*2 128 (44+20)*2 + Blocks 2:nd 40 256 (108+20)*2 256 (108+20)*2 + 3:rd 40 256 (108+20)*2 256 (108+20)*2 + 4:th 40 256 (108+20)*2 256 (108+20)*2 + + Table 3.1. Codebook sizes for the 30 ms mode. + + Table 3.1 shows the codebook size for the different sub-blocks and + stages for 30 ms frames. Inside the parentheses it shows how the + number of codebook vectors is distributed, within the two sections, + between the base/expanded codebook and the augmented base/expanded + codebook. It should be interpreted in the following way: + (base/expanded cb + augmented base/expanded cb). The total number of + codebook vectors for a specific sub-block and stage is given by the + following formula: + + Tot. cb vectors = base cb + aug. base cb + exp. cb + aug. exp. cb + + The corresponding values to Figure 3.1 for 20 ms frames are only + slightly modified. The short sub-block is 23 instead of 22 samples, + and the 3:rd and 4:th sub-frame are not present. + +3.6.3.1. Creation of a Base Codebook + + The base codebook is given by the perceptually weighted codebook + memory that is mentioned in section 3.5.3. The different codebook + vectors are given by sliding a window of length 23/22 or 40, given by + variable lTarget, over the lMem-long perceptually weighted codebook + memory. The indices are ordered so that the codebook vector + containing sample (lMem-lTarget-n) to (lMem-n-1) of the codebook + + + + + +Andersen, et al. Experimental [Page 23] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + memory vector has index n, where n=0..lMem-lTarget. Thus the total + number of base codebook vectors is lMem-lTarget+1, and the indices + are ordered from sample delay lTarget (23/22 or 40) to lMem+1 (86 or + 148). + +3.6.3.2. Codebook Expansion + + The base codebook is expanded by a factor of 2, creating an + additional section in the codebook. This new section is obtained by + filtering the base codebook, base_cb, with a FIR filter with filter + length CB_FILTERLEN=8. The construction of the expanded codebook + compensates for the delay of four samples introduced by the FIR + filter. + + cbfiltersTbl[CB_FILTERLEN]={-0.033691, 0.083740, -0.144043, + 0.713379, 0.806152, -0.184326, + 0.108887, -0.034180}; + + ___ + \ + exp_cb(k)= + > cbfiltersTbl(i)*x(k-i+4) + /__ + i=0...(LPC_FILTERORDER-1) + + where x(j) = base_cb(j) for j=0..lMem-1 and 0 otherwise + + The individual codebook vectors of the new filtered codebook, exp_cb, + and their indices are obtained in the same fashion as described above + for the base codebook. + +3.6.3.3. Codebook Augmentation + + For cases where encoding entire sub-blocks, i.e., cbveclen=40, the + base and expanded codebooks are augmented to increase codebook + richness. The codebooks are augmented by vectors produced by + interpolation of segments. The base and expanded codebook, + constructed above, consists of vectors corresponding to sample delays + in the range from cbveclen to lMem. The codebook augmentation + attempts to augment these codebooks with vectors corresponding to + sample delays from 20 to 39. However, not all of these samples are + present in the base codebook and expanded codebook, respectively. + Therefore, the augmentation vectors are constructed as linear + combinations between samples corresponding to sample delays in the + range 20 to 39. The general idea of this procedure is presented in + the following figures and text. The procedure is performed for both + the base codebook and the expanded codebook. + + + + + +Andersen, et al. Experimental [Page 24] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + - - ------------------------| + codebook memory | + - - ------------------------| + |-5-|---15---|-5-| + pi pp po + + | | Codebook vector + |---15---|-5-|-----20-----| <- corresponding to + i ii iii sample delay 20 + + Figure 3.11. Generation of the first augmented codebook. + + Figure 3.11 shows the codebook memory with pointers pi, pp, and po, + where pi points to sample 25, pp to sample 20, and po to sample 5. + Below the codebook memory, the augmented codebook vector + corresponding to sample delay 20 is drawn. Segment i consists of + fifteen samples from pointer pp and forward in time. Segment ii + consists of five interpolated samples from pi and forward and from po + and forward. The samples are linearly interpolated with weights + [0.0, 0.2, 0.4, 0.6, 0.8] for pi and weights [1.0, 0.8, 0.6, 0.4, + 0.2] for po. Segment iii consists of twenty samples from pp and + forward. The augmented codebook vector corresponding to sample delay + 21 is produced by moving pointers pp and pi one sample backward in + time. This gives us the following figure. + + - - ------------------------| + codebook memory | + - - ------------------------| + |-5-|---16---|-5-| + pi pp po + + | | Codebook vector + |---16---|-5-|-----19-----| <- corresponding to + i ii iii sample delay 21 + + Figure 3.12. Generation of the second augmented codebook. + + Figure 3.12 shows the codebook memory with pointers pi, pp and po + where pi points to sample 26, pp to sample 21, and po to sample 5. + Below the codebook memory, the augmented codebook vector + corresponding to sample delay 21 is drawn. Segment i now consists of + sixteen samples from pp and forward. Segment ii consists of five + interpolated samples from pi and forward and from po and forward, and + the interpolation weights are the same throughout the procedure. + Segment iii consists of nineteen samples from pp and forward. The + same procedure of moving the two pointers is continued until the last + augmented vector corresponding to sample delay 39 has been created. + This gives a total of twenty new codebook vectors to each of the two + + + +Andersen, et al. Experimental [Page 25] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + sections. Thus the total number of codebook vectors for each of the + two sections, when including the augmented codebook, becomes lMem- + SUBL+1+SUBL/2. This is provided that augmentation is evoked, i.e., + that lTarget=SUBL. + +3.6.4. Codebook Search + + The codebook search uses the codebooks described in the sections + above to find the best match of the perceptually weighted target, see + section 3.6.2. The search method is a multi-stage gain-shape + matching performed as follows. At each stage the best shape vector + is identified, then the gain is calculated and quantized, and finally + the target is updated in preparation for the next codebook search + stage. The number of stages is CB_NSTAGES=3. + + If the target is the 23/22-sample vector the codebooks are indexed so + that the base codebook is followed by the expanded codebook. If the + target is 40 samples the order is as follows: base codebook, + augmented base codebook, expanded codebook, and augmented expanded + codebook. The size of each codebook section and its corresponding + augmented section is given by Table 3.1 in section 3.6.3. + + For example, when the second 40-sample sub-block is coded, indices 0 + - 107 correspond to the base codebook, 108 - 127 correspond to the + augmented base codebook, 128 - 235 correspond to the expanded + codebook, and indices 236 - 255 correspond to the augmented expanded + codebook. The indices are divided in the same fashion for all stages + in the example. Only in the case of coding the first 40-sample sub- + block is there a difference between stages (see Table 3.1). + +3.6.4.1. Codebook Search at Each Stage + + The codebooks are searched to find the best match to the target at + each stage. When the best match is found, the target is updated and + the next-stage search is started. The three chosen codebook vectors + and their corresponding gains constitute the encoded sub-block. The + best match is decided by the following three criteria: + + 1. Compute the measure + + (target*cbvec)^2 / ||cbvec||^2 + + for all codebook vectors, cbvec, and choose the codebook vector + maximizing the measure. The expression (target*cbvec) is the dot + product between the target vector to be coded and the codebook vector + for which we compute the measure. The norm, ||x||, is defined as the + square root of (x*x). + + + + +Andersen, et al. Experimental [Page 26] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + 2. The absolute value of the gain, corresponding to the chosen + codebook vector, cbvec, must be smaller than a fixed limit, + CB_MAXGAIN=1.3: + + |gain| < CB_MAXGAIN + + where the gain is computed in the following way: + + gain = (target*cbvec) / ||cbvec||^2 + + 3. For the first stage, the dot product of the chosen codebook vector + and target must be positive: + + target*cbvec > 0 + + In practice the above criteria are used in a sequential search + through all codebook vectors. The best match is found by registering + a new max measure and index whenever the previously registered max + measure is surpassed and all other criteria are fulfilled. If none + of the codebook vectors fulfill (2) and (3), the first codebook + vector is selected. + +3.6.4.2. Gain Quantization at Each Stage + + The gain follows as a result of the computation + + gain = (target*cbvec) / ||cbvec||^2 + + for the optimal codebook vector found by the procedure in section + 3.6.4.1. + + The three stages quantize the gain, using 5, 4, and 3 bits, + respectively. In the first stage, the gain is limited to positive + values. This gain is quantized by finding the nearest value in the + quantization table gain_sq5Tbl. + + gain_sq5Tbl[32]={0.037476, 0.075012, 0.112488, 0.150024, 0.187500, + 0.224976, 0.262512, 0.299988, 0.337524, 0.375000, + 0.412476, 0.450012, 0.487488, 0.525024, 0.562500, + 0.599976, 0.637512, 0.674988, 0.712524, 0.750000, + 0.787476, 0.825012, 0.862488, 0.900024, 0.937500, + 0.974976, 1.012512, 1.049988, 1.087524, 1.125000, + 1.162476, 1.200012} + + The gains of the subsequent two stages can be either positive or + negative. The gains are quantized by using a quantization table + times a scale factor. The second stage uses the table gain_sq4Tbl, + and the third stage uses gain_sq3Tbl. The scale factor equates 0.1 + + + +Andersen, et al. Experimental [Page 27] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + or the absolute value of the quantized gain representation value + obtained in the previous stage, whichever is larger. Again, the + resulting gain index is the index to the nearest value of the + quantization table times the scale factor. + + gainQ = scaleFact * gain_sqXTbl[index] + + gain_sq4Tbl[16]={-1.049988, -0.900024, -0.750000, -0.599976, + -0.450012, -0.299988, -0.150024, 0.000000, 0.150024, + 0.299988, 0.450012, 0.599976, 0.750000, 0.900024, + 1.049988, 1.200012} + + gain_sq3Tbl[8]={-1.000000, -0.659973, -0.330017,0.000000, + 0.250000, 0.500000, 0.750000, 1.00000} + +3.6.4.3. Preparation of Target for Next Stage + + Before performing the search for the next stage, the perceptually + weighted target vector is updated by subtracting from it the selected + codebook vector (from the perceptually weighted codebook) times the + corresponding quantized gain. + + target[i] = target[i] - gainQ * selected_vec[i]; + + A reference implementation of the codebook encoding is found in + Appendix A.34. + +3.7. Gain Correction Encoding + + The start state is quantized in a relatively model independent manner + using 3 bits per sample. In contrast, the remaining parts of the + block are encoded by using an adaptive codebook. This codebook will + produce high matching accuracy whenever there is a high correlation + between the target and the best codebook vector. For unvoiced speech + segments and background noises, this is not necessarily so, which, + due to the nature of the squared error criterion, results in a coded + signal with less power than the target signal. As the coded start + state has good power matching to the target, the result is a power + fluctuation within the encoded frame. Perceptually, the main problem + with this is that the time envelope of the signal energy becomes + unsteady. To overcome this problem, the gains for the codebooks are + re-scaled after the codebook encoding by searching for a new gain + factor for the first stage codebook that provides better power + matching. + + First, the energy for the target signal, tene, is computed along with + the energy for the coded signal, cene, given by the addition of the + three gain scaled codebook vectors. Because the gains of the second + + + +Andersen, et al. Experimental [Page 28] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + and third stage scale with the gain of the first stage, when the + first stage gain is changed from gain[0] to gain_sq5Tbl[i] the energy + of the coded signal changes from cene to + + cene*(gain_sq5Tbl[i]*gain_sq5Tbl[i])/(gain[0]*gain[0]) + + where gain[0] is the gain for the first stage found in the original + codebook search. A refined search is performed by testing the gain + indices i=0 to 31, and as long as the new codebook energy as given + above is less than tene, the gain index for stage 1 is increased. A + restriction is applied so that the new gain value for stage 1 cannot + be more than two times higher than the original value found in the + codebook search. Note that by using this method we do not change the + shape of the encoded vector, only the gain or amplitude. + +3.8. Bitstream Definition + + The total number of bits used to describe one frame of 20 ms speech + is 304, which fits in 38 bytes and results in a bit rate of 15.20 + kbit/s. For the case of a frame length of 30 ms speech, the total + number of bits used is 400, which fits in 50 bytes and results in a + bit rate of 13.33 kbit/s. In the bitstream definition, the bits are + distributed into three classes according to their bit error or loss + sensitivity. The most sensitive bits (class 1) are placed first in + the bitstream for each frame. The less sensitive bits (class 2) are + placed after the class 1 bits. The least sensitive bits (class 3) + are placed at the end of the bitstream for each frame. + + In the 20/30 ms frame length cases for each class, the following hold + true: The class 1 bits occupy a total of 6/8 bytes (48/64 bits), the + class 2 bits occupy 8/12 bytes (64/96 bits), and the class 3 bits + occupy 24/30 bytes (191/239 bits). This distribution of the bits + enables the use of uneven level protection (ULP) as is exploited in + the payload format definition for iLBC [1]. The detailed bit + allocation is shown in the table below. When a quantization index is + distributed between more classes, the more significant bits belong to + the lowest class. + + + + + + + + + + + + + + +Andersen, et al. Experimental [Page 29] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + Bitstream structure: + + ------------------------------------------------------------------+ + Parameter | Bits Class <1,2,3> | + | 20 ms frame | 30 ms frame | + ----------------------------------+---------------+---------------+ + Split 1 | 6 <6,0,0> | 6 <6,0,0> | + LSF 1 Split 2 | 7 <7,0,0> | 7 <7,0,0> | + LSF Split 3 | 7 <7,0,0> | 7 <7,0,0> | + ------------------+---------------+---------------+ + Split 1 | NA (Not Appl.)| 6 <6,0,0> | + LSF 2 Split 2 | NA | 7 <7,0,0> | + Split 3 | NA | 7 <7,0,0> | + ------------------+---------------+---------------+ + Sum | 20 <20,0,0> | 40 <40,0,0> | + ----------------------------------+---------------+---------------+ + Block Class | 2 <2,0,0> | 3 <3,0,0> | + ----------------------------------+---------------+---------------+ + Position 22 sample segment | 1 <1,0,0> | 1 <1,0,0> | + ----------------------------------+---------------+---------------+ + Scale Factor State Coder | 6 <6,0,0> | 6 <6,0,0> | + ----------------------------------+---------------+---------------+ + Sample 0 | 3 <0,1,2> | 3 <0,1,2> | + Quantized Sample 1 | 3 <0,1,2> | 3 <0,1,2> | + Residual : | : : | : : | + State : | : : | : : | + Samples : | : : | : : | + Sample 56 | 3 <0,1,2> | 3 <0,1,2> | + Sample 57 | NA | 3 <0,1,2> | + ------------------+---------------+---------------+ + Sum | 171 <0,57,114>| 174 <0,58,116>| + ----------------------------------+---------------+---------------+ + Stage 1 | 7 <6,0,1> | 7 <4,2,1> | + CB for 22/23 Stage 2 | 7 <0,0,7> | 7 <0,0,7> | + sample block Stage 3 | 7 <0,0,7> | 7 <0,0,7> | + ------------------+---------------+---------------+ + Sum | 21 <6,0,15> | 21 <4,2,15> | + ----------------------------------+---------------+---------------+ + Stage 1 | 5 <2,0,3> | 5 <1,1,3> | + Gain for 22/23 Stage 2 | 4 <1,1,2> | 4 <1,1,2> | + sample block Stage 3 | 3 <0,0,3> | 3 <0,0,3> | + ------------------+---------------+---------------+ + Sum | 12 <3,1,8> | 12 <2,2,8> | + ----------------------------------+---------------+---------------+ + Stage 1 | 8 <7,0,1> | 8 <6,1,1> | + sub-block 1 Stage 2 | 7 <0,0,7> | 7 <0,0,7> | + Stage 3 | 7 <0,0,7> | 7 <0,0,7> | + ------------------+---------------+---------------+ + + + +Andersen, et al. Experimental [Page 30] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + Stage 1 | 8 <0,0,8> | 8 <0,7,1> | + sub-block 2 Stage 2 | 8 <0,0,8> | 8 <0,0,8> | + Indices Stage 3 | 8 <0,0,8> | 8 <0,0,8> | + for CB ------------------+---------------+---------------+ + sub-blocks Stage 1 | NA | 8 <0,7,1> | + sub-block 3 Stage 2 | NA | 8 <0,0,8> | + Stage 3 | NA | 8 <0,0,8> | + ------------------+---------------+---------------+ + Stage 1 | NA | 8 <0,7,1> | + sub-block 4 Stage 2 | NA | 8 <0,0,8> | + Stage 3 | NA | 8 <0,0,8> | + ------------------+---------------+---------------+ + Sum | 46 <7,0,39> | 94 <6,22,66> | + ----------------------------------+---------------+---------------+ + Stage 1 | 5 <1,2,2> | 5 <1,2,2> | + sub-block 1 Stage 2 | 4 <1,1,2> | 4 <1,2,1> | + Stage 3 | 3 <0,0,3> | 3 <0,0,3> | + ------------------+---------------+---------------+ + Stage 1 | 5 <1,1,3> | 5 <0,2,3> | + sub-block 2 Stage 2 | 4 <0,2,2> | 4 <0,2,2> | + Stage 3 | 3 <0,0,3> | 3 <0,0,3> | + Gains for ------------------+---------------+---------------+ + sub-blocks Stage 1 | NA | 5 <0,1,4> | + sub-block 3 Stage 2 | NA | 4 <0,1,3> | + Stage 3 | NA | 3 <0,0,3> | + ------------------+---------------+---------------+ + Stage 1 | NA | 5 <0,1,4> | + sub-block 4 Stage 2 | NA | 4 <0,1,3> | + Stage 3 | NA | 3 <0,0,3> | + ------------------+---------------+---------------+ + Sum | 24 <3,6,15> | 48 <2,12,34> | + ----------------------------------+---------------+---------------+ + Empty frame indicator | 1 <0,0,1> | 1 <0,0,1> | + ------------------------------------------------------------------- + SUM 304 <48,64,192> 400 <64,96,240> + + Table 3.2. The bitstream definition for iLBC for both the 20 ms + frame size mode and the 30 ms frame size mode. + + When packetized into the payload, the bits MUST be sorted as follows: + All the class 1 bits in the order (from top to bottom) as specified + in the table, all the class 2 bits (from top to bottom), and all the + class 3 bits in the same sequential order. The last bit, the empty + frame indicator, SHOULD be set to zero by the encoder. If this bit + is set to 1 the decoder SHOULD treat the data as a lost frame. For + example, this bit can be set to 1 to indicate lost frame for file + storage format, as in [1]. + + + + +Andersen, et al. Experimental [Page 31] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +4. Decoder Principles + + This section describes the principles of each component of the + decoder algorithm. + + +-------------+ +--------+ +---------------+ + payload -> | 1. Get para | -> | 2. LPC | -> | 3. Sc Dequant | -> + +-------------+ +--------+ +---------------+ + + +-------------+ +------------------+ + -> | 4. Mem setup| -> | 5. Construct res |-------> + | +-------------+ +------------------- | + ---------<-----------<-----------<------------ + Sub-frame 0...2/4 (20 ms/30 ms) + + +----------------+ +----------+ + -> | 6. Enhance res | -> | 7. Synth | ------------> + +----------------+ +----------+ + + +-----------------+ + -> | 8. Post Process | ----------------> decoded speech + +-----------------+ + + Figure 4.1. Flow chart of the iLBC decoder. If a frame was lost, + steps 1 to 5 SHOULD be replaced by a PLC algorithm. + + 1. Extract the parameters from the bitstream. + + 2. Decode the LPC and interpolate (section 4.1). + + 3. Construct the 57/58-sample start state (section 4.2). + + 4. Set up the memory by using data from the decoded residual. This + memory is used for codebook construction. For blocks preceding + the start state, both the decoded residual and the target are time + reversed. Sub-frames are decoded in the same order as they were + encoded. + + 5. Construct the residuals of this sub-frame (gain[0]*cbvec[0] + + gain[1]*cbvec[1] + gain[2]*cbvec[2]). Repeat 4 and 5 until the + residual of all sub-blocks has been constructed. + + 6. Enhance the residual with the post filter (section 4.6). + + 7. Synthesis of the residual (section 4.7). + + 8. Post process with HP filter, if desired (section 4.8). + + + + +Andersen, et al. Experimental [Page 32] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +4.1. LPC Filter Reconstruction + + The decoding of the LP filter parameters is very straightforward. + For a set of three/six indices, the corresponding LSF vector(s) are + found by simple table lookup. For each of the LSF vectors, the three + split vectors are concatenated to obtain qlsf1 and qlsf2, + respectively (in the 20 ms mode only one LSF vector, qlsf, is + constructed). The next step is the stability check described in + section 3.2.5 followed by the interpolation scheme described in + section 3.2.6 (3.2.7 for 20 ms frames). The only difference is that + only the quantized LSFs are known at the decoder, and hence the + unquantized LSFs are not processed. + + A reference implementation of the LPC filter reconstruction is given + in Appendix A.36. + +4.2. Start State Reconstruction + + The scalar encoded STATE_SHORT_LEN=58 (STATE_SHORT_LEN=57 in the 20 + ms mode) state samples are reconstructed by 1) forming a set of + samples (by table lookup) from the index stream idxVec[n], 2) + multiplying the set with 1/scal=(10^qmax)/4.5, 3) time reversing the + 57/58 samples, 4) filtering the time reversed block with the + dispersion (all-pass) filter used in the encoder (as described in + section 3.5.2); this compensates for the phase distortion of the + earlier filter operation, and 5 reversing the 57/58 samples from the + previous step. + + in(0..(STATE_SHORT_LEN-1)) = time reversed samples from table + look-up, + idxVecDec((STATE_SHORT_LEN-1)..0) + + in(STATE_SHORT_LEN..(2*STATE_SHORT_LEN-1)) = 0 + + Pk(z) = A~rk(z)/A~k(z), where + ___ + \ + A~rk(z)= z^(-LPC_FILTERORDER) + > a~ki*z^(i-(LPC_FILTERORDER-1)) + /__ + i=0...(LPC_FILTERORDER-1) + + and A~k(z) is taken from the block where the start state begins + + in -> Pk(z) -> filtered + + out(k) = filtered(STATE_SHORT_LEN-1-k) + + filtered(2*STATE_SHORT_LEN-1-k), + k=0..(STATE_SHORT_LEN-1) + + + +Andersen, et al. Experimental [Page 33] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + The remaining 23/22 samples in the state are reconstructed by the + same adaptive codebook technique described in section 4.3. The + location bit determines whether these are the first or the last 23/22 + samples of the 80-sample state vector. If the remaining 23/22 + samples are the first samples, then the scalar encoded + STATE_SHORT_LEN state samples are time-reversed before initialization + of the adaptive codebook memory vector. + + A reference implementation of the start state reconstruction is given + in Appendix A.44. + +4.3. Excitation Decoding Loop + + The decoding of the LPC excitation vector proceeds in the same order + in which the residual was encoded at the encoder. That is, after the + decoding of the entire 80-sample state vector, the forward sub-blocks + (corresponding to samples occurring after the state vector samples) + are decoded, and then the backward sub-blocks (corresponding to + samples occurring before the state vector) are decoded, resulting in + a fully decoded block of excitation signal samples. + + In particular, each sub-block is decoded by using the multistage + adaptive codebook decoding module described in section 4.4. This + module relies upon an adaptive codebook memory constructed before + each run of the adaptive codebook decoding. The construction of the + adaptive codebook memory in the decoder is identical to the method + outlined in section 3.6.3, except that it is done on the codebook + memory without perceptual weighting. + + For the initial forward sub-block, the last STATE_LEN=80 samples of + the length CB_LMEM=147 adaptive codebook memory are filled with the + samples of the state vector. For subsequent forward sub-blocks, the + first SUBL=40 samples of the adaptive codebook memory are discarded, + the remaining samples are shifted by SUBL samples toward the + beginning of the vector, and the newly decoded SUBL=40 samples are + placed at the end of the adaptive codebook memory. For backward + sub-blocks, the construction is similar, except that every vector of + samples involved is first time reversed. + + A reference implementation of the excitation decoding loop is found + in Appendix A.5. + + + + + + + + + + +Andersen, et al. Experimental [Page 34] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +4.4. Multistage Adaptive Codebook Decoding + + The Multistage Adaptive Codebook Decoding module is used at both the + sender (encoder) and the receiver (decoder) ends to produce a + synthetic signal in the residual domain that is eventually used to + produce synthetic speech. The module takes the index values used to + construct vectors that are scaled and summed together to produce a + synthetic signal that is the output of the module. + +4.4.1. Construction of the Decoded Excitation Signal + + The unpacked index values provided at the input to the module are + references to extended codebooks, which are constructed as described + in section 3.6.3, except that they are based on the codebook memory + without the perceptual weighting. The unpacked three indices are + used to look up three codebook vectors. The unpacked three gain + indices are used to decode the corresponding 3 gains. In this + decoding, the successive rescaling, as described in section 3.6.4.2, + is applied. + + A reference implementation of the adaptive codebook decoding is + listed in Appendix A.32. + +4.5. Packet Loss Concealment + + If packet loss occurs, the decoder receives a signal saying that + information regarding a block is lost. For such blocks it is + RECOMMENDED to use a Packet Loss Concealment (PLC) unit to create a + decoded signal that masks the effect of that packet loss. In the + following we will describe an example of a PLC unit that can be used + with the iLBC codec. As the PLC unit is used only at the decoder, + the PLC unit does not affect interoperability between + implementations. Other PLC implementations MAY therefore be used. + + The PLC described operates on the LP filters and the excitation + signals and is based on the following principles: + +4.5.1. Block Received Correctly and Previous Block Also Received + + If the block is received correctly, the PLC only records state + information of the current block that can be used in case the next + block is lost. The LP filter coefficients for each sub-block and the + entire decoded excitation signal are all saved in the decoder state + structure. All of this information will be needed if the following + block is lost. + + + + + + +Andersen, et al. Experimental [Page 35] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +4.5.2. Block Not Received + + If the block is not received, the block substitution is based on a + pitch-synchronous repetition of the excitation signal, which is + filtered by the last LP filter of the previous block. The previous + block's information is stored in the decoder state structure. + + A correlation analysis is performed on the previous block's + excitation signal in order to detect the amount of pitch periodicity + and a pitch value. The correlation measure is also used to decide on + the voicing level (the degree to which the previous block's + excitation was a voiced or roughly periodic signal). The excitation + in the previous block is used to create an excitation for the block + to be substituted, such that the pitch of the previous block is + maintained. Therefore, the new excitation is constructed in a + pitch-synchronous manner. In order to avoid a buzzy-sounding + substituted block, a random excitation is mixed with the new pitch + periodic excitation, and the relative use of the two components is + computed from the correlation measure (voicing level). + + For the block to be substituted, the newly constructed excitation + signal is then passed through the LP filter to produce the speech + that will be substituted for the lost block. + + For several consecutive lost blocks, the packet loss concealment + continues in a similar manner. The correlation measure of the last + block received is still used along with the same pitch value. The LP + filters of the last block received are also used again. The energy + of the substituted excitation for consecutive lost blocks is + decreased, leading to a dampened excitation, and therefore to + dampened speech. + +4.5.3. Block Received Correctly When Previous Block Not Received + + For the case in which a block is received correctly when the previous + block was not, the correctly received block's directly decoded speech + (based solely on the received block) is not used as the actual + output. The reason for this is that the directly decoded speech does + not necessarily smoothly merge into the synthetic speech generated + for the previous lost block. If the two signals are not smoothly + merged, an audible discontinuity is accidentally produced. + Therefore, a correlation analysis between the two blocks of + excitation signal (the excitation of the previous concealed block and + that of the current received block) is performed to find the best + phase match. Then a simple overlap-add procedure is performed to + merge the previous excitation smoothly into the current block's + excitation. + + + + +Andersen, et al. Experimental [Page 36] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + The exact implementation of the packet loss concealment does not + influence interoperability of the codec. + + A reference implementation of the packet loss concealment is + suggested in Appendix A.14. Exact compliance with this suggested + algorithm is not needed for a reference implementation to be fully + compatible with the overall codec specification. + +4.6. Enhancement + + The decoder contains an enhancement unit that operates on the + reconstructed excitation signal. The enhancement unit increases the + perceptual quality of the reconstructed signal by reducing the + speech-correlated noise in the voiced speech segments. Compared to + traditional postfilters, the enhancer has an advantage in that it can + only modify the excitation signal slightly. This means that there is + no risk of over enhancement. The enhancer works very similarly for + both the 20 ms frame size mode and the 30 ms frame size mode. + + For the mode with 20 ms frame size, the enhancer uses a memory of six + 80-sample excitation blocks prior in time plus the two new 80-sample + excitation blocks. For each block of 160 new unenhanced excitation + samples, 160 enhanced excitation samples are produced. The enhanced + excitation is 40-sample delayed compared to the unenhanced + excitation, as the enhancer algorithm uses lookahead. + + For the mode with 30 ms frame size, the enhancer uses a memory of + five 80-sample excitation blocks prior in time plus the three new + 80-sample excitation blocks. For each block of 240 new unenhanced + excitation samples, 240 enhanced excitation samples are produced. + The enhanced excitation is 80-sample delayed compared to the + unenhanced excitation, as the enhancer algorithm uses lookahead. + + Outline of Enhancer + + The speech enhancement unit operates on sub-blocks of 80 samples, + which means that there are two/three 80 sample sub-blocks per frame. + Each of these two/three sub-blocks is enhanced separately, but in an + analogous manner. + + + + + + + + + + + + +Andersen, et al. Experimental [Page 37] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + unenhanced residual + | + | +---------------+ +--------------+ + +-> | 1. Pitch Est | -> | 2. Find PSSQ | --------> + +---------------+ | +--------------+ + +-----<-------<------<--+ + +------------+ enh block 0..1/2 | + -> | 3. Smooth | | + +------------+ | + \ | + /\ | + / \ Already | + / 4. \----------->----------->-----------+ | + \Crit/ Fulfilled | | + \? / v | + \/ | | + \ +-----------------+ +---------+ | | + Not +->| 5. Use Constr. | -> | 6. Mix | -----> + Fulfilled +-----------------+ +---------+ + + ---------------> enhanced residual + + Figure 4.2. Flow chart of the enhancer. + + 1. Pitch estimation of each of the two/three new 80-sample blocks. + + 2. Find the pitch-period-synchronous sequence n (for block k) by a + search around the estimated pitch value. Do this for n=1,2,3, + -1,-2,-3. + + 3. Calculate the smoothed residual generated by the six pitch- + period-synchronous sequences from prior step. + + 4. Check if the smoothed residual satisfies the criterion (section + 4.6.4). + + 5. Use constraint to calculate mixing factor (section 4.6.5). + + 6. Mix smoothed signal with unenhanced residual (pssq(n) n=0). + + The main idea of the enhancer is to find three 80 sample blocks + before and three 80-sample blocks after the analyzed unenhanced sub- + block and to use these to improve the quality of the excitation in + that sub-block. The six blocks are chosen so that they have the + highest possible correlation with the unenhanced sub-block that is + being enhanced. In other words, the six blocks are pitch-period- + synchronous sequences to the unenhanced sub-block. + + + + +Andersen, et al. Experimental [Page 38] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + A linear combination of the six pitch-period-synchronous sequences is + calculated that approximates the sub-block. If the squared error + between the approximation and the unenhanced sub-block is small + enough, the enhanced residual is set equal to this approximation. + For the cases when the squared error criterion is not fulfilled, a + linear combination of the approximation and the unenhanced residual + forms the enhanced residual. + +4.6.1. Estimating the Pitch + + Pitch estimates are needed to determine the locations of the pitch- + period-synchronous sequences in a complexity-efficient way. For each + of the new two/three sub-blocks, a pitch estimate is calculated by + finding the maximum correlation in the range from lag 20 to lag 120. + These pitch estimates are used to narrow down the search for the best + possible pitch-period-synchronous sequences. + +4.6.2. Determination of the Pitch-Synchronous Sequences + + Upon receiving the pitch estimates from the prior step, the enhancer + analyzes and enhances one 80-sample sub-block at a time. The pitch- + period-synchronous-sequences pssq(n) can be viewed as vectors of + length 80 samples each shifted n*lag samples from the current sub- + block. The six pitch-period-synchronous-sequences, pssq(-3) to + pssq(-1) and pssq(1) to pssq(3), are found one at a time by the steps + below: + + 1) Calculate the estimate of the position of the pssq(n). For + pssq(n) in front of pssq(0) (n > 0), the location of the pssq(n) + is estimated by moving one pitch estimate forward in time from the + exact location of pssq(n-1). Similarly, pssq(n) behind pssq(0) (n + < 0) is estimated by moving one pitch estimate backward in time + from the exact location of pssq(n+1). If the estimated pssq(n) + vector location is totally within the enhancer memory (Figure + 4.3), steps 2, 3, and 4 are performed, otherwise the pssq(n) is + set to zeros. + + 2) Compute the correlation between the unenhanced excitation and + vectors around the estimated location interval of pssq(n). The + correlation is calculated in the interval estimated location +/- 2 + samples. This results in five correlation values. + + 3) The five correlation values are upsampled by a factor of 4, by + using four simple upsampling filters (MA filters with coefficients + upsFilter1.. upsFilter4). Within these the maximum value is + found, which specifies the best pitch-period with a resolution of + a quarter of a sample. + + + + +Andersen, et al. Experimental [Page 39] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + upsFilter1[7]={0.000000 0.000000 0.000000 1.000000 + 0.000000 0.000000 0.000000} + upsFilter2[7]={0.015625 -0.076904 0.288330 0.862061 + -0.106445 0.018799 -0.015625} + upsFilter3[7]={0.023682 -0.124268 0.601563 0.601563 + -0.124268 0.023682 -0.023682} + upsFilter4[7]={0.018799 -0.106445 0.862061 0.288330 + -0.076904 0.015625 -0.018799} + + 4) Generate the pssq(n) vector by upsampling of the excitation memory + and extracting the sequence that corresponds to the lag delay that + was calculated in prior step. + + With the steps above, all the pssq(n) can be found in an iterative + manner, first moving backward in time from pssq(0) and then forward + in time from pssq(0). + + + 0 159 319 479 639 + +---------------------------------------------------------------+ + | -5 | -4 | -3 | -2 | -1 | 0 | 1 | 2 | + +---------------------------------------------------------------+ + |pssq 0 | + |pssq -1| |pssq 1 | + |pssq -2| |pssq 2 | + |pssq -3| |pssq 3 | + + Figure 4.3. Enhancement for 20 ms frame size. + + Figure 4.3 depicts pitch-period-synchronous sequences in the + enhancement of the first 80 sample block in the 20 ms frame size + mode. The unenhanced signal input is stored in the last two sub- + blocks (1 - 2), and the six other sub-blocks contain unenhanced + residual prior-in-time. We perform the enhancement algorithm on two + blocks of 80 samples, where the first of the two blocks consists of + the last 40 samples of sub-block 0 and the first 40 samples of sub- + block 1. The second 80-sample block consists of the last 40 samples + of sub-block 1 and the first 40 samples of sub-block 2. + + + + + + + + + + + + + +Andersen, et al. Experimental [Page 40] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + 0 159 319 479 639 + +---------------------------------------------------------------+ + | -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | + +---------------------------------------------------------------+ + |pssq 0 | + |pssq -1| |pssq 1 | + |pssq -2| |pssq 2 | + |pssq -3| |pssq 3 | + + Figure 4.4. Enhancement for 30 ms frame size. + + Figure 4.4 depicts pitch-period-synchronous sequences in the + enhancement of the first 80-sample block in the 30 ms frame size + mode. The unenhanced signal input is stored in the last three sub- + blocks (1 - 3). The five other sub-blocks contain unenhanced + residual prior-in-time. The enhancement algorithm is performed on + the three 80 sample sub-blocks 0, 1, and 2. + +4.6.3. Calculation of the Smoothed Excitation + + A linear combination of the six pssq(n) (n!=0) form a smoothed + approximation, z, of pssq(0). Most of the weight is put on the + sequences that are close to pssq(0), as these are likely to be most + similar to pssq(0). The smoothed vector is also rescaled so that the + energy of z is the same as the energy of pssq(0). + + ___ + \ + y = > pssq(i) * pssq_weight(i) + /__ + i=-3,-2,-1,1,2,3 + + pssq_weight(i) = 0.5*(1-cos(2*pi*(i+4)/(2*3+2))) + + z = C * y, where C = ||pssq(0)||/||y|| + +4.6.4. Enhancer Criterion + + The criterion of the enhancer is that the enhanced excitation is not + allowed to differ much from the unenhanced excitation. This + criterion is checked for each 80-sample sub-block. + + e < (b * ||pssq(0)||^2), where b=0.05 and (Constraint 1) + + e = (pssq(0)-z)*(pssq(0)-z), and "*" means the dot product + + + + + + +Andersen, et al. Experimental [Page 41] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +4.6.5. Enhancing the excitation + + From the criterion in the previous section, it is clear that the + excitation is not allowed to change much. The purpose of this + constraint is to prevent the creation of an enhanced signal + significantly different from the original signal. This also means + that the constraint limits the numerical size of the errors that the + enhancement procedure can make. That is especially important in + unvoiced segments and background noise segments for which increased + periodicity could lead to lower perceived quality. + + When the constraint in the prior section is not met, the enhanced + residual is instead calculated through a constrained optimization by + using the Lagrange multiplier technique. The new constraint is that + + e = (b * ||pssq(0)||^2) (Constraint 2) + + We distinguish two solution regions for the optimization: 1) the + region where the first constraint is fulfilled and 2) the region + where the first constraint is not fulfilled and the second constraint + must be used. + + In the first case, where the second constraint is not needed, the + optimized re-estimated vector is simply z, the energy-scaled version + of y. + + In the second case, where the second constraint is activated and + becomes an equality constraint, we have + + z= A*y + B*pssq(0) + + where + + A = sqrt((b-b^2/4)*(w00*w00)/ (w11*w00 + w10*w10)) and + + w11 = pssq(0)*pssq(0) + w00 = y*y + w10 = y*pssq(0) (* symbolizes the dot product) + + and + + B = 1 - b/2 - A * w10/w00 + + Appendix A.16 contains a listing of a reference implementation for + the enhancement method. + + + + + + +Andersen, et al. Experimental [Page 42] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +4.7. Synthesis Filtering + + Upon decoding or PLC of the LP excitation block, the decoded speech + block is obtained by running the decoded LP synthesis filter, + 1/A~k(z), over the block. The synthesis filters have to be shifted + to compensate for the delay in the enhancer. For 20 ms frame size + mode, they SHOULD be shifted one 40-sample sub-block, and for 30 ms + frame size mode, they SHOULD be shifted two 40-sample sub-blocks. + The LP coefficients SHOULD be changed at the first sample of every + sub-block while keeping the filter state. For PLC blocks, one + solution is to apply the last LP coefficients of the last decoded + speech block for all sub-blocks. + + The reference implementation for the synthesis filtering can be found + in Appendix A.48. + +4.8. Post Filtering + + If desired, the decoded block can be filtered by a high-pass filter. + This removes the low frequencies of the decoded signal. A reference + implementation of this, with cutoff at 65 Hz, is shown in Appendix + A.30. + +5. Security Considerations + + This algorithm for the coding of speech signals is not subject to any + known security consideration; however, its RTP payload format [1] is + subject to several considerations, which are addressed there. + Confidentiality of the media streams is achieved by encryption; + therefore external mechanisms, such as SRTP [5], MAY be used for that + purpose. + +6. Evaluation of the iLBC Implementations + + It is possible and suggested to evaluate certain iLBC implementation + by utilizing methodology and tools available at + http://www.ilbcfreeware.org/evaluation.html + +7. References + +7.1. Normative References + + [1] Duric, A. and S. Andersen, "Real-time Transport Protocol (RTP) + Payload Format for internet Low Bit Rate Codec (iLBC) Speech", + RFC 3952, December 2004. + + [2] Bradner, S., "Key words for use in RFCs to Indicate Requirement + Levels", BCP 14, RFC 2119, March 1997. + + + +Andersen, et al. Experimental [Page 43] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + [3] PacketCable(TM) Audio/Video Codecs Specification, Cable + Television Laboratories, Inc. + +7.2. Informative References + + [4] ITU-T Recommendation G.711, available online from the ITU + bookstore at http://www.itu.int. + + [5] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. Norman, + "The Secure Real Time Transport Protocol (SRTP)", RFC 3711, March + 2004. + +8. Acknowledgements + + This extensive work, besides listed authors, has the following + authors, who could not have been listed among "official" authors (due + to IESG restrictions in the number of authors who can be listed): + + Manohar N. Murthi (Department of Electrical and Computer + Engineering, University of Miami), Fredrik Galschiodt, Julian + Spittka, and Jan Skoglund (Global IP Sound). + + The authors are deeply indebted to the following people and thank + them sincerely: + + Henry Sinnreich, Patrik Faltstrom, Alan Johnston, and Jean- + Francois Mule for great support of the iLBC initiative and for + valuable feedback and comments. + + Peter Vary, Frank Mertz, and Christoph Erdmann (RWTH Aachen); + Vladimir Cuperman (Niftybox LLC); Thomas Eriksson (Chalmers Univ + of Tech), and Gernot Kubin (TU Graz), for thorough review of the + iLBC document and their valuable feedback and remarks. + + + + + + + + + + + + + + + + + + +Andersen, et al. Experimental [Page 44] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +APPENDIX A. Reference Implementation + + This appendix contains the complete c-code for a reference + implementation of encoder and decoder for the specified codec. + + The c-code consists of the following files with highest-level + functions: + + iLBC_test.c: main function for evaluation purpose + iLBC_encode.h: encoder header + iLBC_encode.c: encoder function + iLBC_decode.h: decoder header + iLBC_decode.c: decoder function + + The following files contain global defines and constants: + + iLBC_define.h: global defines + constants.h: global constants header + constants.c: global constants memory allocations + + The following files contain subroutines: + + anaFilter.h: lpc analysis filter header + anaFilter.c: lpc analysis filter function + createCB.h: codebook construction header + createCB.c: codebook construction function + doCPLC.h: packet loss concealment header + doCPLC.c: packet loss concealment function + enhancer.h: signal enhancement header + enhancer.c: signal enhancement function + filter.h: general filter header + filter.c: general filter functions + FrameClassify.h: start state classification header + FrameClassify.c: start state classification function + gainquant.h: gain quantization header + gainquant.c: gain quantization function + getCBvec.h: codebook vector construction header + getCBvec.c: codebook vector construction function + helpfun.h: general purpose header + helpfun.c: general purpose functions + hpInput.h: input high pass filter header + hpInput.c: input high pass filter function + hpOutput.h: output high pass filter header + hpOutput.c: output high pass filter function + iCBConstruct.h: excitation decoding header + iCBConstruct.c: excitation decoding function + iCBSearch.h: excitation encoding header + iCBSearch.c: excitation encoding function + + + +Andersen, et al. Experimental [Page 45] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + LPCdecode.h: lpc decoding header + LPCdecode.c: lpc decoding function + LPCencode.h: lpc encoding header + LPCencode.c: lpc encoding function + lsf.h: line spectral frequencies header + lsf.c: line spectral frequencies functions + packing.h: bitstream packetization header + packing.c: bitstream packetization functions + StateConstructW.h: state decoding header + StateConstructW.c: state decoding functions + StateSearchW.h: state encoding header + StateSearchW.c: state encoding function + syntFilter.h: lpc synthesis filter header + syntFilter.c: lpc synthesis filter function + + The implementation is portable and should work on many different + platforms. However, it is not difficult to optimize the + implementation on particular platforms, an exercise left to the + reader. + +A.1. iLBC_test.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_test.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include + #include + #include "iLBC_define.h" + #include "iLBC_encode.h" + #include "iLBC_decode.h" + + /* Runtime statistics */ + #include + + #define ILBCNOOFWORDS_MAX (NO_OF_BYTES_30MS/2) + + /*----------------------------------------------------------------* + * Encoder interface function + + + +Andersen, et al. Experimental [Page 46] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + *---------------------------------------------------------------*/ + + short encode( /* (o) Number of bytes encoded */ + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i/o) Encoder instance */ + short *encoded_data, /* (o) The encoded bytes */ + short *data /* (i) The signal block to encode*/ + ){ + float block[BLOCKL_MAX]; + int k; + + /* convert signal to float */ + + for (k=0; kblockl; k++) + block[k] = (float)data[k]; + + /* do the actual encoding */ + + iLBC_encode((unsigned char *)encoded_data, block, iLBCenc_inst); + + + return (iLBCenc_inst->no_of_bytes); + } + + /*----------------------------------------------------------------* + * Decoder interface function + *---------------------------------------------------------------*/ + + short decode( /* (o) Number of decoded samples */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */ + short *decoded_data, /* (o) Decoded signal block*/ + short *encoded_data, /* (i) Encoded bytes */ + short mode /* (i) 0=PL, 1=Normal */ + ){ + int k; + float decblock[BLOCKL_MAX], dtmp; + + /* check if mode is valid */ + + if (mode<0 || mode>1) { + printf("\nERROR - Wrong mode - 0, 1 allowed\n"); exit(3);} + + /* do actual decoding of block */ + + iLBC_decode(decblock, (unsigned char *)encoded_data, + iLBCdec_inst, mode); + + /* convert to short */ + + + +Andersen, et al. Experimental [Page 47] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + for (k=0; kblockl; k++){ + dtmp=decblock[k]; + + if (dtmpMAX_SAMPLE) + dtmp=MAX_SAMPLE; + decoded_data[k] = (short) dtmp; + } + + return (iLBCdec_inst->blockl); + } + + /*---------------------------------------------------------------* + * Main program to test iLBC encoding and decoding + * + * Usage: + * exefile_name.exe + * + * : Input file, speech for encoder (16-bit pcm file) + * : Bit stream output from the encoder + * : Output file, decoded speech (16-bit pcm file) + * : Bit error file, optional (16-bit) + * 1 - Packet received correctly + * 0 - Packet Lost + * + *--------------------------------------------------------------*/ + + int main(int argc, char* argv[]) + { + + /* Runtime statistics */ + + float starttime; + float runtime; + float outtime; + + FILE *ifileid,*efileid,*ofileid, *cfileid; + short data[BLOCKL_MAX]; + short encoded_data[ILBCNOOFWORDS_MAX], decoded_data[BLOCKL_MAX]; + int len; + short pli, mode; + int blockcount = 0; + int packetlosscount = 0; + + /* Create structs */ + iLBC_Enc_Inst_t Enc_Inst; + iLBC_Dec_Inst_t Dec_Inst; + + + +Andersen, et al. Experimental [Page 48] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* get arguments and open files */ + + if ((argc!=5) && (argc!=6)) { + fprintf(stderr, + "\n*-----------------------------------------------*\n"); + fprintf(stderr, + " %s <20,30> input encoded decoded (channel)\n\n", + argv[0]); + fprintf(stderr, + " mode : Frame size for the encoding/decoding\n"); + fprintf(stderr, + " 20 - 20 ms\n"); + fprintf(stderr, + " 30 - 30 ms\n"); + fprintf(stderr, + " input : Speech for encoder (16-bit pcm file)\n"); + fprintf(stderr, + " encoded : Encoded bit stream\n"); + fprintf(stderr, + " decoded : Decoded speech (16-bit pcm file)\n"); + fprintf(stderr, + " channel : Packet loss pattern, optional (16-bit)\n"); + fprintf(stderr, + " 1 - Packet received correctly\n"); + fprintf(stderr, + " 0 - Packet Lost\n"); + fprintf(stderr, + "*-----------------------------------------------*\n\n"); + exit(1); + } + mode=atoi(argv[1]); + if (mode != 20 && mode != 30) { + fprintf(stderr,"Wrong mode %s, must be 20, or 30\n", + argv[1]); + exit(2); + } + if ( (ifileid=fopen(argv[2],"rb")) == NULL) { + fprintf(stderr,"Cannot open input file %s\n", argv[2]); + exit(2);} + if ( (efileid=fopen(argv[3],"wb")) == NULL) { + fprintf(stderr, "Cannot open encoded file %s\n", + argv[3]); exit(1);} + if ( (ofileid=fopen(argv[4],"wb")) == NULL) { + fprintf(stderr, "Cannot open decoded file %s\n", + argv[4]); exit(1);} + if (argc==6) { + if( (cfileid=fopen(argv[5],"rb")) == NULL) { + fprintf(stderr, "Cannot open channel file %s\n", + + + +Andersen, et al. Experimental [Page 49] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + argv[5]); + exit(1); + } + } else { + cfileid=NULL; + } + + /* print info */ + + fprintf(stderr, "\n"); + fprintf(stderr, + "*---------------------------------------------------*\n"); + fprintf(stderr, + "* *\n"); + fprintf(stderr, + "* iLBC test program *\n"); + fprintf(stderr, + "* *\n"); + fprintf(stderr, + "* *\n"); + fprintf(stderr, + "*---------------------------------------------------*\n"); + fprintf(stderr,"\nMode : %2d ms\n", mode); + fprintf(stderr,"Input file : %s\n", argv[2]); + fprintf(stderr,"Encoded file : %s\n", argv[3]); + fprintf(stderr,"Output file : %s\n", argv[4]); + if (argc==6) { + fprintf(stderr,"Channel file : %s\n", argv[5]); + } + fprintf(stderr,"\n"); + + /* Initialization */ + + initEncode(&Enc_Inst, mode); + initDecode(&Dec_Inst, mode, 1); + + /* Runtime statistics */ + + starttime=clock()/(float)CLOCKS_PER_SEC; + + /* loop over input blocks */ + + while (fread(data,sizeof(short),Enc_Inst.blockl,ifileid)== + Enc_Inst.blockl) { + + blockcount++; + + /* encoding */ + + + +Andersen, et al. Experimental [Page 50] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + fprintf(stderr, "--- Encoding block %i --- ",blockcount); + len=encode(&Enc_Inst, encoded_data, data); + fprintf(stderr, "\r"); + + /* write byte file */ + + fwrite(encoded_data, sizeof(unsigned char), len, efileid); + + /* get channel data if provided */ + if (argc==6) { + if (fread(&pli, sizeof(short), 1, cfileid)) { + if ((pli!=0)&&(pli!=1)) { + fprintf(stderr, "Error in channel file\n"); + exit(0); + } + if (pli==0) { + /* Packet loss -> remove info from frame */ + memset(encoded_data, 0, + sizeof(short)*ILBCNOOFWORDS_MAX); + packetlosscount++; + } + } else { + fprintf(stderr, "Error. Channel file too short\n"); + exit(0); + } + } else { + pli=1; + } + + /* decoding */ + + fprintf(stderr, "--- Decoding block %i --- ",blockcount); + + len=decode(&Dec_Inst, decoded_data, encoded_data, pli); + fprintf(stderr, "\r"); + + /* write output file */ + + fwrite(decoded_data,sizeof(short),len,ofileid); + } + + /* Runtime statistics */ + + runtime = (float)(clock()/(float)CLOCKS_PER_SEC-starttime); + outtime = (float)((float)blockcount*(float)mode/1000.0); + printf("\n\nLength of speech file: %.1f s\n", outtime); + printf("Packet loss : %.1f%%\n", + 100.0*(float)packetlosscount/(float)blockcount); + + + +Andersen, et al. Experimental [Page 51] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + printf("Time to run iLBC :"); + printf(" %.1f s (%.1f %% of realtime)\n\n", runtime, + (100*runtime/outtime)); + + /* close files */ + + fclose(ifileid); fclose(efileid); fclose(ofileid); + if (argc==6) { + fclose(cfileid); + } + return(0); + } + +A.2. iLBC_encode.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_encode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_ILBCENCODE_H + #define __iLBC_ILBCENCODE_H + + #include "iLBC_define.h" + + short initEncode( /* (o) Number of bytes + encoded */ + iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */ + int mode /* (i) frame size mode */ + ); + + void iLBC_encode( + + unsigned char *bytes, /* (o) encoded data bits iLBC */ + float *block, /* (o) speech vector to + encode */ + iLBC_Enc_Inst_t *iLBCenc_inst /* (i/o) the general encoder + state */ + ); + + #endif + + + + +Andersen, et al. Experimental [Page 52] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +A.3. iLBC_encode.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_encode.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include + + #include "iLBC_define.h" + #include "LPCencode.h" + #include "FrameClassify.h" + #include "StateSearchW.h" + #include "StateConstructW.h" + #include "helpfun.h" + #include "constants.h" + #include "packing.h" + #include "iCBSearch.h" + #include "iCBConstruct.h" + #include "hpInput.h" + #include "anaFilter.h" + #include "syntFilter.h" + + /*----------------------------------------------------------------* + * Initiation of encoder instance. + *---------------------------------------------------------------*/ + + short initEncode( /* (o) Number of bytes + encoded */ + iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */ + int mode /* (i) frame size mode */ + ){ + iLBCenc_inst->mode = mode; + if (mode==30) { + iLBCenc_inst->blockl = BLOCKL_30MS; + iLBCenc_inst->nsub = NSUB_30MS; + iLBCenc_inst->nasub = NASUB_30MS; + iLBCenc_inst->lpc_n = LPC_N_30MS; + iLBCenc_inst->no_of_bytes = NO_OF_BYTES_30MS; + iLBCenc_inst->no_of_words = NO_OF_WORDS_30MS; + + + +Andersen, et al. Experimental [Page 53] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + iLBCenc_inst->state_short_len=STATE_SHORT_LEN_30MS; + /* ULP init */ + iLBCenc_inst->ULP_inst=&ULP_30msTbl; + } + else if (mode==20) { + iLBCenc_inst->blockl = BLOCKL_20MS; + iLBCenc_inst->nsub = NSUB_20MS; + iLBCenc_inst->nasub = NASUB_20MS; + iLBCenc_inst->lpc_n = LPC_N_20MS; + iLBCenc_inst->no_of_bytes = NO_OF_BYTES_20MS; + iLBCenc_inst->no_of_words = NO_OF_WORDS_20MS; + iLBCenc_inst->state_short_len=STATE_SHORT_LEN_20MS; + /* ULP init */ + iLBCenc_inst->ULP_inst=&ULP_20msTbl; + } + else { + exit(2); + } + + memset((*iLBCenc_inst).anaMem, 0, + LPC_FILTERORDER*sizeof(float)); + memcpy((*iLBCenc_inst).lsfold, lsfmeanTbl, + LPC_FILTERORDER*sizeof(float)); + memcpy((*iLBCenc_inst).lsfdeqold, lsfmeanTbl, + LPC_FILTERORDER*sizeof(float)); + memset((*iLBCenc_inst).lpc_buffer, 0, + (LPC_LOOKBACK+BLOCKL_MAX)*sizeof(float)); + memset((*iLBCenc_inst).hpimem, 0, 4*sizeof(float)); + + return (iLBCenc_inst->no_of_bytes); + } + + /*----------------------------------------------------------------* + * main encoder function + *---------------------------------------------------------------*/ + + void iLBC_encode( + unsigned char *bytes, /* (o) encoded data bits iLBC */ + float *block, /* (o) speech vector to + encode */ + iLBC_Enc_Inst_t *iLBCenc_inst /* (i/o) the general encoder + state */ + ){ + + float data[BLOCKL_MAX]; + float residual[BLOCKL_MAX], reverseResidual[BLOCKL_MAX]; + + int start, idxForMax, idxVec[STATE_LEN]; + + + +Andersen, et al. Experimental [Page 54] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float reverseDecresidual[BLOCKL_MAX], mem[CB_MEML]; + int n, k, meml_gotten, Nfor, Nback, i, pos; + int gain_index[CB_NSTAGES*NASUB_MAX], + extra_gain_index[CB_NSTAGES]; + int cb_index[CB_NSTAGES*NASUB_MAX],extra_cb_index[CB_NSTAGES]; + int lsf_i[LSF_NSPLIT*LPC_N_MAX]; + unsigned char *pbytes; + int diff, start_pos, state_first; + float en1, en2; + int index, ulp, firstpart; + int subcount, subframe; + float weightState[LPC_FILTERORDER]; + float syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; + float weightdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; + float decresidual[BLOCKL_MAX]; + + /* high pass filtering of input signal if such is not done + prior to calling this function */ + + hpInput(block, iLBCenc_inst->blockl, + data, (*iLBCenc_inst).hpimem); + + /* otherwise simply copy */ + + /*memcpy(data,block,iLBCenc_inst->blockl*sizeof(float));*/ + + /* LPC of hp filtered input data */ + + LPCencode(syntdenum, weightdenum, lsf_i, data, iLBCenc_inst); + + + /* inverse filter to get residual */ + + for (n=0; nnsub; n++) { + anaFilter(&data[n*SUBL], &syntdenum[n*(LPC_FILTERORDER+1)], + SUBL, &residual[n*SUBL], iLBCenc_inst->anaMem); + } + + /* find state location */ + + start = FrameClassify(iLBCenc_inst, residual); + + /* check if state should be in first or last part of the + two subframes */ + + diff = STATE_LEN - iLBCenc_inst->state_short_len; + en1 = 0; + index = (start-1)*SUBL; + + + +Andersen, et al. Experimental [Page 55] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + for (i = 0; i < iLBCenc_inst->state_short_len; i++) { + en1 += residual[index+i]*residual[index+i]; + } + en2 = 0; + index = (start-1)*SUBL+diff; + for (i = 0; i < iLBCenc_inst->state_short_len; i++) { + en2 += residual[index+i]*residual[index+i]; + } + + + if (en1 > en2) { + state_first = 1; + start_pos = (start-1)*SUBL; + } else { + state_first = 0; + start_pos = (start-1)*SUBL + diff; + } + + /* scalar quantization of state */ + + StateSearchW(iLBCenc_inst, &residual[start_pos], + &syntdenum[(start-1)*(LPC_FILTERORDER+1)], + &weightdenum[(start-1)*(LPC_FILTERORDER+1)], &idxForMax, + idxVec, iLBCenc_inst->state_short_len, state_first); + + StateConstructW(idxForMax, idxVec, + &syntdenum[(start-1)*(LPC_FILTERORDER+1)], + &decresidual[start_pos], iLBCenc_inst->state_short_len); + + /* predictive quantization in state */ + + if (state_first) { /* put adaptive part in the end */ + + /* setup memory */ + + memset(mem, 0, + (CB_MEML-iLBCenc_inst->state_short_len)*sizeof(float)); + memcpy(mem+CB_MEML-iLBCenc_inst->state_short_len, + decresidual+start_pos, + iLBCenc_inst->state_short_len*sizeof(float)); + memset(weightState, 0, LPC_FILTERORDER*sizeof(float)); + + /* encode sub-frames */ + + iCBSearch(iLBCenc_inst, extra_cb_index, extra_gain_index, + &residual[start_pos+iLBCenc_inst->state_short_len], + mem+CB_MEML-stMemLTbl, + stMemLTbl, diff, CB_NSTAGES, + + + +Andersen, et al. Experimental [Page 56] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + &weightdenum[start*(LPC_FILTERORDER+1)], + weightState, 0); + + /* construct decoded vector */ + + iCBConstruct( + &decresidual[start_pos+iLBCenc_inst->state_short_len], + extra_cb_index, extra_gain_index, + mem+CB_MEML-stMemLTbl, + stMemLTbl, diff, CB_NSTAGES); + + } + else { /* put adaptive part in the beginning */ + + /* create reversed vectors for prediction */ + + for (k=0; kstate_short_len)]; + } + + /* setup memory */ + + meml_gotten = iLBCenc_inst->state_short_len; + for (k=0; knsub-start-1; + + + if ( Nfor > 0 ) { + + /* setup memory */ + + memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float)); + memcpy(mem+CB_MEML-STATE_LEN, decresidual+(start-1)*SUBL, + STATE_LEN*sizeof(float)); + memset(weightState, 0, LPC_FILTERORDER*sizeof(float)); + + /* loop over sub-frames to encode */ + + for (subframe=0; subframe 0 ) { + + /* create reverse order vectors */ + + for (n=0; nnsub+1-start); + + + if ( meml_gotten > CB_MEML ) { + meml_gotten=CB_MEML; + } + for (k=0; klpc_n; k++) { + packsplit(&lsf_i[k], &firstpart, &lsf_i[k], + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp]+ + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp+1]+ + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], &pos); + } + + /* Start block info */ + + packsplit(&start, &firstpart, &start, + iLBCenc_inst->ULP_inst->start_bits[ulp], + iLBCenc_inst->ULP_inst->start_bits[ulp]+ + iLBCenc_inst->ULP_inst->start_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->start_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->start_bits[ulp], &pos); + + packsplit(&state_first, &firstpart, &state_first, + iLBCenc_inst->ULP_inst->startfirst_bits[ulp], + iLBCenc_inst->ULP_inst->startfirst_bits[ulp]+ + iLBCenc_inst->ULP_inst->startfirst_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->startfirst_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->startfirst_bits[ulp], &pos); + + packsplit(&idxForMax, &firstpart, &idxForMax, + iLBCenc_inst->ULP_inst->scale_bits[ulp], + iLBCenc_inst->ULP_inst->scale_bits[ulp]+ + iLBCenc_inst->ULP_inst->scale_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->scale_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->scale_bits[ulp], &pos); + + for (k=0; kstate_short_len; k++) { + packsplit(idxVec+k, &firstpart, idxVec+k, + iLBCenc_inst->ULP_inst->state_bits[ulp], + iLBCenc_inst->ULP_inst->state_bits[ulp]+ + iLBCenc_inst->ULP_inst->state_bits[ulp+1]+ + iLBCenc_inst->ULP_inst->state_bits[ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->state_bits[ulp], &pos); + } + + + + +Andersen, et al. Experimental [Page 61] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* 23/22 (20ms/30ms) sample block */ + + for (k=0;kULP_inst->extra_cb_index[k][ulp], + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp]+ + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp+1]+ + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp], + &pos); + } + + for (k=0;kULP_inst->extra_cb_gain[k][ulp], + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp]+ + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp+1]+ + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp], + &pos); + } + + /* The two/four (20ms/30ms) 40 sample sub-blocks */ + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_index[i][k][ulp], + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp]+ + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp+1]+ + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->cb_index[i][k][ulp], + &pos); + } + } + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_gain[i][k][ulp], + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp]+ + + + +Andersen, et al. Experimental [Page 62] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp+1]+ + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp+2]); + dopack( &pbytes, firstpart, + iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp], + &pos); + } + } + } + + /* set the last bit to zero (otherwise the decoder + will treat it as a lost frame) */ + dopack( &pbytes, 0, 1, &pos); + } + +A.4. iLBC_decode.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_decode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_ILBCDECODE_H + #define __iLBC_ILBCDECODE_H + + #include "iLBC_define.h" + + short initDecode( /* (o) Number of decoded + samples */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */ + int mode, /* (i) frame size mode */ + int use_enhancer /* (i) 1 to use enhancer + 0 to run without + enhancer */ + ); + + void iLBC_decode( + float *decblock, /* (o) decoded signal block */ + unsigned char *bytes, /* (i) encoded signal bits */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state + structure */ + int mode /* (i) 0: bad packet, PLC, + 1: normal */ + + + +Andersen, et al. Experimental [Page 63] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + ); + + #endif + +A.5. iLBC_decode.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_decode.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + + #include "iLBC_define.h" + #include "StateConstructW.h" + #include "LPCdecode.h" + #include "iCBConstruct.h" + #include "doCPLC.h" + #include "helpfun.h" + #include "constants.h" + #include "packing.h" + #include "string.h" + #include "enhancer.h" + #include "hpOutput.h" + #include "syntFilter.h" + + /*----------------------------------------------------------------* + * Initiation of decoder instance. + *---------------------------------------------------------------*/ + + short initDecode( /* (o) Number of decoded + samples */ + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) Decoder instance */ + int mode, /* (i) frame size mode */ + int use_enhancer /* (i) 1 to use enhancer + 0 to run without + enhancer */ + ){ + int i; + + iLBCdec_inst->mode = mode; + + + +Andersen, et al. Experimental [Page 64] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + if (mode==30) { + iLBCdec_inst->blockl = BLOCKL_30MS; + iLBCdec_inst->nsub = NSUB_30MS; + iLBCdec_inst->nasub = NASUB_30MS; + iLBCdec_inst->lpc_n = LPC_N_30MS; + iLBCdec_inst->no_of_bytes = NO_OF_BYTES_30MS; + iLBCdec_inst->no_of_words = NO_OF_WORDS_30MS; + iLBCdec_inst->state_short_len=STATE_SHORT_LEN_30MS; + /* ULP init */ + iLBCdec_inst->ULP_inst=&ULP_30msTbl; + } + else if (mode==20) { + iLBCdec_inst->blockl = BLOCKL_20MS; + iLBCdec_inst->nsub = NSUB_20MS; + iLBCdec_inst->nasub = NASUB_20MS; + iLBCdec_inst->lpc_n = LPC_N_20MS; + iLBCdec_inst->no_of_bytes = NO_OF_BYTES_20MS; + iLBCdec_inst->no_of_words = NO_OF_WORDS_20MS; + iLBCdec_inst->state_short_len=STATE_SHORT_LEN_20MS; + /* ULP init */ + iLBCdec_inst->ULP_inst=&ULP_20msTbl; + } + else { + exit(2); + } + + memset(iLBCdec_inst->syntMem, 0, + LPC_FILTERORDER*sizeof(float)); + memcpy((*iLBCdec_inst).lsfdeqold, lsfmeanTbl, + LPC_FILTERORDER*sizeof(float)); + + memset(iLBCdec_inst->old_syntdenum, 0, + ((LPC_FILTERORDER + 1)*NSUB_MAX)*sizeof(float)); + for (i=0; iold_syntdenum[i*(LPC_FILTERORDER+1)]=1.0; + + iLBCdec_inst->last_lag = 20; + + iLBCdec_inst->prevLag = 120; + iLBCdec_inst->per = 0.0; + iLBCdec_inst->consPLICount = 0; + iLBCdec_inst->prevPLI = 0; + iLBCdec_inst->prevLpc[0] = 1.0; + memset(iLBCdec_inst->prevLpc+1,0, + LPC_FILTERORDER*sizeof(float)); + memset(iLBCdec_inst->prevResidual, 0, BLOCKL_MAX*sizeof(float)); + iLBCdec_inst->seed=777; + + + + +Andersen, et al. Experimental [Page 65] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + memset(iLBCdec_inst->hpomem, 0, 4*sizeof(float)); + + iLBCdec_inst->use_enhancer = use_enhancer; + memset(iLBCdec_inst->enh_buf, 0, ENH_BUFL*sizeof(float)); + for (i=0;ienh_period[i]=(float)40.0; + + iLBCdec_inst->prev_enh_pl = 0; + + return (iLBCdec_inst->blockl); + } + + /*----------------------------------------------------------------* + * frame residual decoder function (subrutine to iLBC_decode) + *---------------------------------------------------------------*/ + + void Decode( + iLBC_Dec_Inst_t *iLBCdec_inst, /* (i/o) the decoder state + structure */ + float *decresidual, /* (o) decoded residual frame */ + int start, /* (i) location of start + state */ + int idxForMax, /* (i) codebook index for the + maximum value */ + int *idxVec, /* (i) codebook indexes for the + samples in the start + state */ + float *syntdenum, /* (i) the decoded synthesis + filter coefficients */ + int *cb_index, /* (i) the indexes for the + adaptive codebook */ + int *gain_index, /* (i) the indexes for the + corresponding gains */ + int *extra_cb_index, /* (i) the indexes for the + adaptive codebook part + of start state */ + int *extra_gain_index, /* (i) the indexes for the + corresponding gains */ + int state_first /* (i) 1 if non adaptive part + of start state comes + first 0 if that part + comes last */ + ){ + float reverseDecresidual[BLOCKL_MAX], mem[CB_MEML]; + int k, meml_gotten, Nfor, Nback, i; + int diff, start_pos; + int subcount, subframe; + + + + +Andersen, et al. Experimental [Page 66] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + diff = STATE_LEN - iLBCdec_inst->state_short_len; + + if (state_first == 1) { + start_pos = (start-1)*SUBL; + } else { + start_pos = (start-1)*SUBL + diff; + } + + /* decode scalar part of start state */ + + StateConstructW(idxForMax, idxVec, + &syntdenum[(start-1)*(LPC_FILTERORDER+1)], + &decresidual[start_pos], iLBCdec_inst->state_short_len); + + + if (state_first) { /* put adaptive part in the end */ + + /* setup memory */ + + memset(mem, 0, + (CB_MEML-iLBCdec_inst->state_short_len)*sizeof(float)); + memcpy(mem+CB_MEML-iLBCdec_inst->state_short_len, + decresidual+start_pos, + iLBCdec_inst->state_short_len*sizeof(float)); + + /* construct decoded vector */ + + iCBConstruct( + &decresidual[start_pos+iLBCdec_inst->state_short_len], + extra_cb_index, extra_gain_index, mem+CB_MEML-stMemLTbl, + stMemLTbl, diff, CB_NSTAGES); + + } + else {/* put adaptive part in the beginning */ + + /* create reversed vectors for prediction */ + + for (k=0; kstate_short_len)]; + } + + /* setup memory */ + + meml_gotten = iLBCdec_inst->state_short_len; + for (k=0; knsub-start-1; + + if ( Nfor > 0 ){ + + /* setup memory */ + + memset(mem, 0, (CB_MEML-STATE_LEN)*sizeof(float)); + memcpy(mem+CB_MEML-STATE_LEN, decresidual+(start-1)*SUBL, + STATE_LEN*sizeof(float)); + + /* loop over sub-frames to encode */ + + for (subframe=0; subframe 0 ) { + + /* setup memory */ + + meml_gotten = SUBL*(iLBCdec_inst->nsub+1-start); + + if ( meml_gotten > CB_MEML ) { + meml_gotten=CB_MEML; + } + for (k=0; k0) { /* the data are good */ + + /* decode data */ + + pbytes=bytes; + pos=0; + + + + +Andersen, et al. Experimental [Page 70] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* Set everything to zero before decoding */ + + for (k=0; kstate_short_len; k++) { + idxVec[k]=0; + } + for (k=0; knasub; i++) { + for (k=0; knasub; i++) { + for (k=0; klpc_n; k++){ + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->lsf_bits[k][ulp], &pos); + packcombine(&lsf_i[k], lastpart, + iLBCdec_inst->ULP_inst->lsf_bits[k][ulp]); + } + + /* Start block info */ + + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->start_bits[ulp], &pos); + packcombine(&start, lastpart, + iLBCdec_inst->ULP_inst->start_bits[ulp]); + + unpack( &pbytes, &lastpart, + + + +Andersen, et al. Experimental [Page 71] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + iLBCdec_inst->ULP_inst->startfirst_bits[ulp], &pos); + packcombine(&state_first, lastpart, + iLBCdec_inst->ULP_inst->startfirst_bits[ulp]); + + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->scale_bits[ulp], &pos); + packcombine(&idxForMax, lastpart, + iLBCdec_inst->ULP_inst->scale_bits[ulp]); + + for (k=0; kstate_short_len; k++) { + unpack( &pbytes, &lastpart, + iLBCdec_inst->ULP_inst->state_bits[ulp], &pos); + packcombine(idxVec+k, lastpart, + iLBCdec_inst->ULP_inst->state_bits[ulp]); + } + + /* 23/22 (20ms/30ms) sample block */ + + for (k=0; kULP_inst->extra_cb_index[k][ulp], + &pos); + packcombine(extra_cb_index+k, lastpart, + iLBCdec_inst->ULP_inst->extra_cb_index[k][ulp]); + } + for (k=0; kULP_inst->extra_cb_gain[k][ulp], + &pos); + packcombine(extra_gain_index+k, lastpart, + iLBCdec_inst->ULP_inst->extra_cb_gain[k][ulp]); + } + + /* The two/four (20ms/30ms) 40 sample sub-blocks */ + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_index[i][k][ulp], + &pos); + packcombine(cb_index+i*CB_NSTAGES+k, lastpart, + iLBCdec_inst->ULP_inst->cb_index[i][k][ulp]); + } + } + + for (i=0; inasub; i++) { + for (k=0; kULP_inst->cb_gain[i][k][ulp], + &pos); + packcombine(gain_index+i*CB_NSTAGES+k, lastpart, + iLBCdec_inst->ULP_inst->cb_gain[i][k][ulp]); + } + } + } + /* Extract last bit. If it is 1 this indicates an + empty/lost frame */ + unpack( &pbytes, &last_bit, 1, &pos); + + /* Check for bit errors or empty/lost frames */ + if (start<1) + mode = 0; + if (iLBCdec_inst->mode==20 && start>3) + mode = 0; + if (iLBCdec_inst->mode==30 && start>5) + mode = 0; + if (last_bit==1) + mode = 0; + + if (mode==1) { /* No bit errors was detected, + continue decoding */ + + /* adjust index */ + index_conv_dec(cb_index); + + /* decode the lsf */ + + SimplelsfDEQ(lsfdeq, lsf_i, iLBCdec_inst->lpc_n); + check=LSF_check(lsfdeq, LPC_FILTERORDER, + iLBCdec_inst->lpc_n); + DecoderInterpolateLSF(syntdenum, weightdenum, + lsfdeq, LPC_FILTERORDER, iLBCdec_inst); + + Decode(iLBCdec_inst, decresidual, start, idxForMax, + idxVec, syntdenum, cb_index, gain_index, + extra_cb_index, extra_gain_index, + state_first); + + /* preparing the plc for a future loss! */ + + doThePLC(PLCresidual, PLClpc, 0, decresidual, + syntdenum + + (LPC_FILTERORDER + 1)*(iLBCdec_inst->nsub - 1), + (*iLBCdec_inst).last_lag, iLBCdec_inst); + + + + + +Andersen, et al. Experimental [Page 73] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + memcpy(decresidual, PLCresidual, + iLBCdec_inst->blockl*sizeof(float)); + } + + } + + if (mode == 0) { + /* the data is bad (either a PLC call + * was made or a severe bit error was detected) + */ + + /* packet loss conceal */ + + memset(zeros, 0, BLOCKL_MAX*sizeof(float)); + + one[0] = 1; + memset(one+1, 0, LPC_FILTERORDER*sizeof(float)); + + start=0; + + doThePLC(PLCresidual, PLClpc, 1, zeros, one, + (*iLBCdec_inst).last_lag, iLBCdec_inst); + memcpy(decresidual, PLCresidual, + iLBCdec_inst->blockl*sizeof(float)); + + order_plus_one = LPC_FILTERORDER + 1; + for (i = 0; i < iLBCdec_inst->nsub; i++) { + memcpy(syntdenum+(i*order_plus_one), PLClpc, + order_plus_one*sizeof(float)); + } + } + + if (iLBCdec_inst->use_enhancer == 1) { + + /* post filtering */ + + iLBCdec_inst->last_lag = + enhancerInterface(data, decresidual, iLBCdec_inst); + + /* synthesis filtering */ + + if (iLBCdec_inst->mode==20) { + /* Enhancer has 40 samples delay */ + i=0; + syntFilter(data + i*SUBL, + iLBCdec_inst->old_syntdenum + + (i+iLBCdec_inst->nsub-1)*(LPC_FILTERORDER+1), + SUBL, iLBCdec_inst->syntMem); + + + +Andersen, et al. Experimental [Page 74] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + for (i=1; i < iLBCdec_inst->nsub; i++) { + syntFilter(data + i*SUBL, + syntdenum + (i-1)*(LPC_FILTERORDER+1), + SUBL, iLBCdec_inst->syntMem); + } + } else if (iLBCdec_inst->mode==30) { + /* Enhancer has 80 samples delay */ + for (i=0; i < 2; i++) { + syntFilter(data + i*SUBL, + iLBCdec_inst->old_syntdenum + + (i+iLBCdec_inst->nsub-2)*(LPC_FILTERORDER+1), + SUBL, iLBCdec_inst->syntMem); + } + for (i=2; i < iLBCdec_inst->nsub; i++) { + syntFilter(data + i*SUBL, + syntdenum + (i-2)*(LPC_FILTERORDER+1), SUBL, + iLBCdec_inst->syntMem); + } + } + + } else { + + /* Find last lag */ + lag = 20; + maxcc = xCorrCoef(&decresidual[BLOCKL_MAX-ENH_BLOCKL], + &decresidual[BLOCKL_MAX-ENH_BLOCKL-lag], ENH_BLOCKL); + + for (ilag=21; ilag<120; ilag++) { + cc = xCorrCoef(&decresidual[BLOCKL_MAX-ENH_BLOCKL], + &decresidual[BLOCKL_MAX-ENH_BLOCKL-ilag], + ENH_BLOCKL); + + if (cc > maxcc) { + maxcc = cc; + lag = ilag; + } + } + iLBCdec_inst->last_lag = lag; + + /* copy data and run synthesis filter */ + + memcpy(data, decresidual, + iLBCdec_inst->blockl*sizeof(float)); + for (i=0; i < iLBCdec_inst->nsub; i++) { + syntFilter(data + i*SUBL, + syntdenum + i*(LPC_FILTERORDER+1), SUBL, + iLBCdec_inst->syntMem); + } + + + +Andersen, et al. Experimental [Page 75] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + } + + /* high pass filtering on output if desired, otherwise + copy to out */ + + hpOutput(data, iLBCdec_inst->blockl, + decblock,iLBCdec_inst->hpomem); + + /* memcpy(decblock,data,iLBCdec_inst->blockl*sizeof(float));*/ + + memcpy(iLBCdec_inst->old_syntdenum, syntdenum, + + iLBCdec_inst->nsub*(LPC_FILTERORDER+1)*sizeof(float)); + + iLBCdec_inst->prev_enh_pl=0; + + if (mode==0) { /* PLC was used */ + iLBCdec_inst->prev_enh_pl=1; + } + } + +A.6. iLBC_define.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + iLBC_define.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + #include + + #ifndef __iLBC_ILBCDEFINE_H + #define __iLBC_ILBCDEFINE_H + + /* general codec settings */ + + #define FS (float)8000.0 + #define BLOCKL_20MS 160 + #define BLOCKL_30MS 240 + #define BLOCKL_MAX 240 + #define NSUB_20MS 4 + #define NSUB_30MS 6 + #define NSUB_MAX 6 + #define NASUB_20MS 2 + + + +Andersen, et al. Experimental [Page 76] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + #define NASUB_30MS 4 + #define NASUB_MAX 4 + #define SUBL 40 + #define STATE_LEN 80 + #define STATE_SHORT_LEN_30MS 58 + #define STATE_SHORT_LEN_20MS 57 + + /* LPC settings */ + + #define LPC_FILTERORDER 10 + #define LPC_CHIRP_SYNTDENUM (float)0.9025 + #define LPC_CHIRP_WEIGHTDENUM (float)0.4222 + #define LPC_LOOKBACK 60 + #define LPC_N_20MS 1 + #define LPC_N_30MS 2 + #define LPC_N_MAX 2 + #define LPC_ASYMDIFF 20 + #define LPC_BW (float)60.0 + #define LPC_WN (float)1.0001 + #define LSF_NSPLIT 3 + #define LSF_NUMBER_OF_STEPS 4 + #define LPC_HALFORDER (LPC_FILTERORDER/2) + + /* cb settings */ + + #define CB_NSTAGES 3 + #define CB_EXPAND 2 + #define CB_MEML 147 + #define CB_FILTERLEN 2*4 + #define CB_HALFFILTERLEN 4 + #define CB_RESRANGE 34 + #define CB_MAXGAIN (float)1.3 + + /* enhancer */ + + #define ENH_BLOCKL 80 /* block length */ + #define ENH_BLOCKL_HALF (ENH_BLOCKL/2) + #define ENH_HL 3 /* 2*ENH_HL+1 is number blocks + in said second sequence */ + #define ENH_SLOP 2 /* max difference estimated and + correct pitch period */ + #define ENH_PLOCSL 20 /* pitch-estimates and pitch- + locations buffer length */ + #define ENH_OVERHANG 2 + #define ENH_UPS0 4 /* upsampling rate */ + #define ENH_FL0 3 /* 2*FLO+1 is the length of + each filter */ + #define ENH_VECTL (ENH_BLOCKL+2*ENH_FL0) + + + +Andersen, et al. Experimental [Page 77] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + #define ENH_CORRDIM (2*ENH_SLOP+1) + #define ENH_NBLOCKS (BLOCKL_MAX/ENH_BLOCKL) + #define ENH_NBLOCKS_EXTRA 5 + #define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS + + ENH_NBLOCKS_EXTRA */ + #define ENH_BUFL (ENH_NBLOCKS_TOT)*ENH_BLOCKL + #define ENH_ALPHA0 (float)0.05 + + /* Down sampling */ + + #define FILTERORDER_DS 7 + #define DELAY_DS 3 + #define FACTOR_DS 2 + + /* bit stream defs */ + + #define NO_OF_BYTES_20MS 38 + #define NO_OF_BYTES_30MS 50 + #define NO_OF_WORDS_20MS 19 + #define NO_OF_WORDS_30MS 25 + #define STATE_BITS 3 + #define BYTE_LEN 8 + #define ULP_CLASSES 3 + + /* help parameters */ + + #define FLOAT_MAX (float)1.0e37 + #define EPS (float)2.220446049250313e-016 + #define PI (float)3.14159265358979323846 + #define MIN_SAMPLE -32768 + #define MAX_SAMPLE 32767 + #define TWO_PI (float)6.283185307 + #define PI2 (float)0.159154943 + + /* type definition encoder instance */ + typedef struct iLBC_ULP_Inst_t_ { + int lsf_bits[6][ULP_CLASSES+2]; + int start_bits[ULP_CLASSES+2]; + int startfirst_bits[ULP_CLASSES+2]; + int scale_bits[ULP_CLASSES+2]; + int state_bits[ULP_CLASSES+2]; + int extra_cb_index[CB_NSTAGES][ULP_CLASSES+2]; + int extra_cb_gain[CB_NSTAGES][ULP_CLASSES+2]; + int cb_index[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]; + int cb_gain[NSUB_MAX][CB_NSTAGES][ULP_CLASSES+2]; + } iLBC_ULP_Inst_t; + + /* type definition encoder instance */ + + + +Andersen, et al. Experimental [Page 78] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + typedef struct iLBC_Enc_Inst_t_ { + + /* flag for frame size mode */ + int mode; + + /* basic parameters for different frame sizes */ + int blockl; + int nsub; + int nasub; + int no_of_bytes, no_of_words; + int lpc_n; + int state_short_len; + const iLBC_ULP_Inst_t *ULP_inst; + + /* analysis filter state */ + float anaMem[LPC_FILTERORDER]; + + /* old lsf parameters for interpolation */ + float lsfold[LPC_FILTERORDER]; + float lsfdeqold[LPC_FILTERORDER]; + + /* signal buffer for LP analysis */ + float lpc_buffer[LPC_LOOKBACK + BLOCKL_MAX]; + + /* state of input HP filter */ + float hpimem[4]; + + } iLBC_Enc_Inst_t; + + /* type definition decoder instance */ + typedef struct iLBC_Dec_Inst_t_ { + + /* flag for frame size mode */ + int mode; + + /* basic parameters for different frame sizes */ + int blockl; + int nsub; + int nasub; + int no_of_bytes, no_of_words; + int lpc_n; + int state_short_len; + const iLBC_ULP_Inst_t *ULP_inst; + + /* synthesis filter state */ + float syntMem[LPC_FILTERORDER]; + + /* old LSF for interpolation */ + + + +Andersen, et al. Experimental [Page 79] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float lsfdeqold[LPC_FILTERORDER]; + + /* pitch lag estimated in enhancer and used in PLC */ + int last_lag; + + /* PLC state information */ + int prevLag, consPLICount, prevPLI, prev_enh_pl; + float prevLpc[LPC_FILTERORDER+1]; + float prevResidual[NSUB_MAX*SUBL]; + float per; + unsigned long seed; + + /* previous synthesis filter parameters */ + float old_syntdenum[(LPC_FILTERORDER + 1)*NSUB_MAX]; + + /* state of output HP filter */ + float hpomem[4]; + + /* enhancer state information */ + int use_enhancer; + float enh_buf[ENH_BUFL]; + float enh_period[ENH_NBLOCKS_TOT]; + + } iLBC_Dec_Inst_t; + + #endif + +A.7. constants.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + constants.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_CONSTANTS_H + #define __iLBC_CONSTANTS_H + + #include "iLBC_define.h" + + + /* ULP bit allocation */ + + + + +Andersen, et al. Experimental [Page 80] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + extern const iLBC_ULP_Inst_t ULP_20msTbl; + extern const iLBC_ULP_Inst_t ULP_30msTbl; + + /* high pass filters */ + + extern float hpi_zero_coefsTbl[]; + extern float hpi_pole_coefsTbl[]; + extern float hpo_zero_coefsTbl[]; + extern float hpo_pole_coefsTbl[]; + + /* low pass filters */ + extern float lpFilt_coefsTbl[]; + + /* LPC analysis and quantization */ + + extern float lpc_winTbl[]; + extern float lpc_asymwinTbl[]; + extern float lpc_lagwinTbl[]; + extern float lsfCbTbl[]; + extern float lsfmeanTbl[]; + extern int dim_lsfCbTbl[]; + extern int size_lsfCbTbl[]; + extern float lsf_weightTbl_30ms[]; + extern float lsf_weightTbl_20ms[]; + + /* state quantization tables */ + + extern float state_sq3Tbl[]; + extern float state_frgqTbl[]; + + /* gain quantization tables */ + + extern float gain_sq3Tbl[]; + extern float gain_sq4Tbl[]; + extern float gain_sq5Tbl[]; + + /* adaptive codebook definitions */ + + extern int search_rangeTbl[5][CB_NSTAGES]; + extern int memLfTbl[]; + extern int stMemLTbl; + extern float cbfiltersTbl[CB_FILTERLEN]; + + /* enhancer definitions */ + + extern float polyphaserTbl[]; + extern float enh_plocsTbl[]; + + + + +Andersen, et al. Experimental [Page 81] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + #endif + +A.8. constants.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + constants.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include "iLBC_define.h" + + /* ULP bit allocation */ + + /* 20 ms frame */ + + const iLBC_ULP_Inst_t ULP_20msTbl = { + /* LSF */ + { {6,0,0,0,0}, {7,0,0,0,0}, {7,0,0,0,0}, + {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, + /* Start state location, gain and samples */ + {2,0,0,0,0}, + {1,0,0,0,0}, + {6,0,0,0,0}, + {0,1,2,0,0}, + /* extra CB index and extra CB gain */ + {{6,0,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}}, + {{2,0,3,0,0}, {1,1,2,0,0}, {0,0,3,0,0}}, + /* CB index and CB gain */ + { {{7,0,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}}, + {{0,0,8,0,0}, {0,0,8,0,0}, {0,0,8,0,0}}, + {{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, + {{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}}, + { {{1,2,2,0,0}, {1,1,2,0,0}, {0,0,3,0,0}}, + {{1,1,3,0,0}, {0,2,2,0,0}, {0,0,3,0,0}}, + {{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, + {{0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}} + }; + + /* 30 ms frame */ + + const iLBC_ULP_Inst_t ULP_30msTbl = { + /* LSF */ + + + +Andersen, et al. Experimental [Page 82] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + { {6,0,0,0,0}, {7,0,0,0,0}, {7,0,0,0,0}, + {6,0,0,0,0}, {7,0,0,0,0}, {7,0,0,0,0}}, + /* Start state location, gain and samples */ + {3,0,0,0,0}, + {1,0,0,0,0}, + {6,0,0,0,0}, + {0,1,2,0,0}, + /* extra CB index and extra CB gain */ + {{4,2,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}}, + {{1,1,3,0,0}, {1,1,2,0,0}, {0,0,3,0,0}}, + /* CB index and CB gain */ + { {{6,1,1,0,0}, {0,0,7,0,0}, {0,0,7,0,0}}, + {{0,7,1,0,0}, {0,0,8,0,0}, {0,0,8,0,0}}, + {{0,7,1,0,0}, {0,0,8,0,0}, {0,0,8,0,0}}, + {{0,7,1,0,0}, {0,0,8,0,0}, {0,0,8,0,0}}}, + { {{1,2,2,0,0}, {1,2,1,0,0}, {0,0,3,0,0}}, + {{0,2,3,0,0}, {0,2,2,0,0}, {0,0,3,0,0}}, + {{0,1,4,0,0}, {0,1,3,0,0}, {0,0,3,0,0}}, + {{0,1,4,0,0}, {0,1,3,0,0}, {0,0,3,0,0}}} + }; + + /* HP Filters */ + + float hpi_zero_coefsTbl[3] = { + (float)0.92727436, (float)-1.8544941, (float)0.92727436 + }; + float hpi_pole_coefsTbl[3] = { + (float)1.0, (float)-1.9059465, (float)0.9114024 + }; + float hpo_zero_coefsTbl[3] = { + (float)0.93980581, (float)-1.8795834, (float)0.93980581 + }; + float hpo_pole_coefsTbl[3] = { + (float)1.0, (float)-1.9330735, (float)0.93589199 + }; + + /* LP Filter */ + + float lpFilt_coefsTbl[FILTERORDER_DS]={ + (float)-0.066650, (float)0.125000, (float)0.316650, + (float)0.414063, (float)0.316650, + (float)0.125000, (float)-0.066650 + }; + + /* State quantization tables */ + + float state_sq3Tbl[8] = { + (float)-3.719849, (float)-2.177490, (float)-1.130005, + + + +Andersen, et al. Experimental [Page 83] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)-0.309692, (float)0.444214, (float)1.329712, + (float)2.436279, (float)3.983887 + }; + + float state_frgqTbl[64] = { + (float)1.000085, (float)1.071695, (float)1.140395, + (float)1.206868, (float)1.277188, (float)1.351503, + (float)1.429380, (float)1.500727, (float)1.569049, + (float)1.639599, (float)1.707071, (float)1.781531, + (float)1.840799, (float)1.901550, (float)1.956695, + (float)2.006750, (float)2.055474, (float)2.102787, + (float)2.142819, (float)2.183592, (float)2.217962, + (float)2.257177, (float)2.295739, (float)2.332967, + (float)2.369248, (float)2.402792, (float)2.435080, + (float)2.468598, (float)2.503394, (float)2.539284, + (float)2.572944, (float)2.605036, (float)2.636331, + (float)2.668939, (float)2.698780, (float)2.729101, + (float)2.759786, (float)2.789834, (float)2.818679, + (float)2.848074, (float)2.877470, (float)2.906899, + (float)2.936655, (float)2.967804, (float)3.000115, + (float)3.033367, (float)3.066355, (float)3.104231, + (float)3.141499, (float)3.183012, (float)3.222952, + (float)3.265433, (float)3.308441, (float)3.350823, + (float)3.395275, (float)3.442793, (float)3.490801, + (float)3.542514, (float)3.604064, (float)3.666050, + (float)3.740994, (float)3.830749, (float)3.938770, + (float)4.101764 + }; + + /* CB tables */ + + int search_rangeTbl[5][CB_NSTAGES]={{58,58,58}, {108,44,44}, + {108,108,108}, {108,108,108}, {108,108,108}}; + int stMemLTbl=85; + int memLfTbl[NASUB_MAX]={147,147,147,147}; + + /* expansion filter(s) */ + + float cbfiltersTbl[CB_FILTERLEN]={ + (float)-0.034180, (float)0.108887, (float)-0.184326, + (float)0.806152, (float)0.713379, (float)-0.144043, + (float)0.083740, (float)-0.033691 + }; + + /* Gain Quantization */ + + float gain_sq3Tbl[8]={ + (float)-1.000000, (float)-0.659973, (float)-0.330017, + + + +Andersen, et al. Experimental [Page 84] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.000000, (float)0.250000, (float)0.500000, + (float)0.750000, (float)1.00000}; + + float gain_sq4Tbl[16]={ + (float)-1.049988, (float)-0.900024, (float)-0.750000, + (float)-0.599976, (float)-0.450012, (float)-0.299988, + (float)-0.150024, (float)0.000000, (float)0.150024, + (float)0.299988, (float)0.450012, (float)0.599976, + (float)0.750000, (float)0.900024, (float)1.049988, + (float)1.200012}; + + float gain_sq5Tbl[32]={ + (float)0.037476, (float)0.075012, (float)0.112488, + (float)0.150024, (float)0.187500, (float)0.224976, + (float)0.262512, (float)0.299988, (float)0.337524, + (float)0.375000, (float)0.412476, (float)0.450012, + (float)0.487488, (float)0.525024, (float)0.562500, + (float)0.599976, (float)0.637512, (float)0.674988, + (float)0.712524, (float)0.750000, (float)0.787476, + (float)0.825012, (float)0.862488, (float)0.900024, + (float)0.937500, (float)0.974976, (float)1.012512, + (float)1.049988, (float)1.087524, (float)1.125000, + (float)1.162476, (float)1.200012}; + + /* Enhancer - Upsamling a factor 4 (ENH_UPS0 = 4) */ + float polyphaserTbl[ENH_UPS0*(2*ENH_FL0+1)]={ + (float)0.000000, (float)0.000000, (float)0.000000, + (float)1.000000, + (float)0.000000, (float)0.000000, (float)0.000000, + (float)0.015625, (float)-0.076904, (float)0.288330, + (float)0.862061, + (float)-0.106445, (float)0.018799, (float)-0.015625, + (float)0.023682, (float)-0.124268, (float)0.601563, + (float)0.601563, + (float)-0.124268, (float)0.023682, (float)-0.023682, + (float)0.018799, (float)-0.106445, (float)0.862061, + (float)0.288330, + (float)-0.076904, (float)0.015625, (float)-0.018799}; + + float enh_plocsTbl[ENH_NBLOCKS_TOT] = {(float)40.0, (float)120.0, + (float)200.0, (float)280.0, (float)360.0, + (float)440.0, (float)520.0, (float)600.0}; + + /* LPC analysis and quantization */ + + int dim_lsfCbTbl[LSF_NSPLIT] = {3, 3, 4}; + int size_lsfCbTbl[LSF_NSPLIT] = {64,128,128}; + + + + +Andersen, et al. Experimental [Page 85] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float lsfmeanTbl[LPC_FILTERORDER] = { + (float)0.281738, (float)0.445801, (float)0.663330, + (float)0.962524, (float)1.251831, (float)1.533081, + (float)1.850586, (float)2.137817, (float)2.481445, + (float)2.777344}; + + float lsf_weightTbl_30ms[6] = {(float)(1.0/2.0), (float)1.0, + (float)(2.0/3.0), + (float)(1.0/3.0), (float)0.0, (float)0.0}; + + float lsf_weightTbl_20ms[4] = {(float)(3.0/4.0), (float)(2.0/4.0), + (float)(1.0/4.0), (float)(0.0)}; + + /* Hanning LPC window */ + float lpc_winTbl[BLOCKL_MAX]={ + (float)0.000183, (float)0.000671, (float)0.001526, + (float)0.002716, (float)0.004242, (float)0.006104, + (float)0.008301, (float)0.010834, (float)0.013702, + (float)0.016907, (float)0.020416, (float)0.024261, + (float)0.028442, (float)0.032928, (float)0.037750, + (float)0.042877, (float)0.048309, (float)0.054047, + (float)0.060089, (float)0.066437, (float)0.073090, + (float)0.080017, (float)0.087219, (float)0.094727, + (float)0.102509, (float)0.110535, (float)0.118835, + (float)0.127411, (float)0.136230, (float)0.145294, + (float)0.154602, (float)0.164154, (float)0.173920, + (float)0.183899, (float)0.194122, (float)0.204529, + (float)0.215149, (float)0.225952, (float)0.236938, + (float)0.248108, (float)0.259460, (float)0.270966, + (float)0.282654, (float)0.294464, (float)0.306396, + (float)0.318481, (float)0.330688, (float)0.343018, + (float)0.355438, (float)0.367981, (float)0.380585, + (float)0.393280, (float)0.406067, (float)0.418884, + (float)0.431763, (float)0.444702, (float)0.457672, + (float)0.470673, (float)0.483704, (float)0.496735, + (float)0.509766, (float)0.522797, (float)0.535828, + (float)0.548798, (float)0.561768, (float)0.574677, + (float)0.587524, (float)0.600342, (float)0.613068, + (float)0.625732, (float)0.638306, (float)0.650787, + (float)0.663147, (float)0.675415, (float)0.687561, + (float)0.699585, (float)0.711487, (float)0.723206, + (float)0.734802, (float)0.746216, (float)0.757477, + (float)0.768585, (float)0.779480, (float)0.790192, + (float)0.800720, (float)0.811005, (float)0.821106, + (float)0.830994, (float)0.840668, (float)0.850067, + (float)0.859253, (float)0.868225, (float)0.876892, + (float)0.885345, (float)0.893524, (float)0.901428, + (float)0.909058, (float)0.916412, (float)0.923492, + + + +Andersen, et al. Experimental [Page 86] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.930267, (float)0.936768, (float)0.942963, + (float)0.948853, (float)0.954437, (float)0.959717, + (float)0.964691, (float)0.969360, (float)0.973694, + (float)0.977692, (float)0.981384, (float)0.984741, + (float)0.987762, (float)0.990479, (float)0.992828, + (float)0.994873, (float)0.996552, (float)0.997925, + (float)0.998932, (float)0.999603, (float)0.999969, + (float)0.999969, (float)0.999603, (float)0.998932, + (float)0.997925, (float)0.996552, (float)0.994873, + (float)0.992828, (float)0.990479, (float)0.987762, + (float)0.984741, (float)0.981384, (float)0.977692, + (float)0.973694, (float)0.969360, (float)0.964691, + (float)0.959717, (float)0.954437, (float)0.948853, + (float)0.942963, (float)0.936768, (float)0.930267, + (float)0.923492, (float)0.916412, (float)0.909058, + (float)0.901428, (float)0.893524, (float)0.885345, + (float)0.876892, (float)0.868225, (float)0.859253, + (float)0.850067, (float)0.840668, (float)0.830994, + (float)0.821106, (float)0.811005, (float)0.800720, + (float)0.790192, (float)0.779480, (float)0.768585, + (float)0.757477, (float)0.746216, (float)0.734802, + (float)0.723206, (float)0.711487, (float)0.699585, + (float)0.687561, (float)0.675415, (float)0.663147, + (float)0.650787, (float)0.638306, (float)0.625732, + (float)0.613068, (float)0.600342, (float)0.587524, + (float)0.574677, (float)0.561768, (float)0.548798, + (float)0.535828, (float)0.522797, (float)0.509766, + (float)0.496735, (float)0.483704, (float)0.470673, + (float)0.457672, (float)0.444702, (float)0.431763, + (float)0.418884, (float)0.406067, (float)0.393280, + (float)0.380585, (float)0.367981, (float)0.355438, + (float)0.343018, (float)0.330688, (float)0.318481, + (float)0.306396, (float)0.294464, (float)0.282654, + (float)0.270966, (float)0.259460, (float)0.248108, + (float)0.236938, (float)0.225952, (float)0.215149, + (float)0.204529, (float)0.194122, (float)0.183899, + (float)0.173920, (float)0.164154, (float)0.154602, + (float)0.145294, (float)0.136230, (float)0.127411, + (float)0.118835, (float)0.110535, (float)0.102509, + (float)0.094727, (float)0.087219, (float)0.080017, + (float)0.073090, (float)0.066437, (float)0.060089, + (float)0.054047, (float)0.048309, (float)0.042877, + (float)0.037750, (float)0.032928, (float)0.028442, + (float)0.024261, (float)0.020416, (float)0.016907, + (float)0.013702, (float)0.010834, (float)0.008301, + (float)0.006104, (float)0.004242, (float)0.002716, + (float)0.001526, (float)0.000671, (float)0.000183 + }; + + + +Andersen, et al. Experimental [Page 87] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* Asymmetric LPC window */ + float lpc_asymwinTbl[BLOCKL_MAX]={ + (float)0.000061, (float)0.000214, (float)0.000458, + (float)0.000824, (float)0.001282, (float)0.001831, + (float)0.002472, (float)0.003235, (float)0.004120, + (float)0.005066, (float)0.006134, (float)0.007294, + (float)0.008545, (float)0.009918, (float)0.011383, + (float)0.012939, (float)0.014587, (float)0.016357, + (float)0.018219, (float)0.020172, (float)0.022217, + (float)0.024353, (float)0.026611, (float)0.028961, + (float)0.031372, (float)0.033905, (float)0.036530, + (float)0.039276, (float)0.042084, (float)0.044983, + (float)0.047974, (float)0.051086, (float)0.054260, + (float)0.057526, (float)0.060883, (float)0.064331, + (float)0.067871, (float)0.071503, (float)0.075226, + (float)0.079010, (float)0.082916, (float)0.086884, + (float)0.090942, (float)0.095062, (float)0.099304, + (float)0.103607, (float)0.107971, (float)0.112427, + (float)0.116974, (float)0.121582, (float)0.126282, + (float)0.131073, (float)0.135895, (float)0.140839, + (float)0.145813, (float)0.150879, (float)0.156006, + (float)0.161224, (float)0.166504, (float)0.171844, + (float)0.177246, (float)0.182709, (float)0.188263, + (float)0.193848, (float)0.199524, (float)0.205231, + (float)0.211029, (float)0.216858, (float)0.222778, + (float)0.228729, (float)0.234741, (float)0.240814, + (float)0.246918, (float)0.253082, (float)0.259308, + (float)0.265564, (float)0.271881, (float)0.278259, + (float)0.284668, (float)0.291107, (float)0.297607, + (float)0.304138, (float)0.310730, (float)0.317322, + (float)0.323975, (float)0.330658, (float)0.337372, + (float)0.344147, (float)0.350922, (float)0.357727, + (float)0.364594, (float)0.371460, (float)0.378357, + (float)0.385284, (float)0.392212, (float)0.399170, + (float)0.406158, (float)0.413177, (float)0.420197, + (float)0.427246, (float)0.434296, (float)0.441376, + (float)0.448456, (float)0.455536, (float)0.462646, + (float)0.469757, (float)0.476868, (float)0.483978, + (float)0.491089, (float)0.498230, (float)0.505341, + (float)0.512451, (float)0.519592, (float)0.526703, + (float)0.533813, (float)0.540924, (float)0.548004, + (float)0.555084, (float)0.562164, (float)0.569244, + (float)0.576294, (float)0.583313, (float)0.590332, + (float)0.597321, (float)0.604309, (float)0.611267, + (float)0.618195, (float)0.625092, (float)0.631989, + (float)0.638855, (float)0.645660, (float)0.652466, + (float)0.659241, (float)0.665985, (float)0.672668, + (float)0.679352, (float)0.685974, (float)0.692566, + + + +Andersen, et al. Experimental [Page 88] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.699127, (float)0.705658, (float)0.712128, + (float)0.718536, (float)0.724945, (float)0.731262, + (float)0.737549, (float)0.743805, (float)0.750000, + (float)0.756134, (float)0.762238, (float)0.768280, + (float)0.774261, (float)0.780182, (float)0.786072, + (float)0.791870, (float)0.797638, (float)0.803314, + (float)0.808960, (float)0.814514, (float)0.820038, + (float)0.825470, (float)0.830841, (float)0.836151, + (float)0.841400, (float)0.846558, (float)0.851654, + (float)0.856689, (float)0.861633, (float)0.866516, + (float)0.871338, (float)0.876068, (float)0.880737, + (float)0.885315, (float)0.889801, (float)0.894226, + (float)0.898560, (float)0.902832, (float)0.907013, + (float)0.911102, (float)0.915100, (float)0.919037, + (float)0.922882, (float)0.926636, (float)0.930328, + (float)0.933899, (float)0.937408, (float)0.940796, + (float)0.944122, (float)0.947357, (float)0.950470, + (float)0.953522, (float)0.956482, (float)0.959351, + (float)0.962097, (float)0.964783, (float)0.967377, + (float)0.969849, (float)0.972229, (float)0.974518, + (float)0.976715, (float)0.978821, (float)0.980835, + (float)0.982727, (float)0.984528, (float)0.986237, + (float)0.987854, (float)0.989380, (float)0.990784, + (float)0.992096, (float)0.993317, (float)0.994415, + (float)0.995422, (float)0.996338, (float)0.997162, + (float)0.997864, (float)0.998474, (float)0.998962, + (float)0.999390, (float)0.999695, (float)0.999878, + (float)0.999969, (float)0.999969, (float)0.996918, + (float)0.987701, (float)0.972382, (float)0.951050, + (float)0.923889, (float)0.891022, (float)0.852631, + (float)0.809021, (float)0.760406, (float)0.707092, + (float)0.649445, (float)0.587799, (float)0.522491, + (float)0.453979, (float)0.382690, (float)0.309021, + (float)0.233459, (float)0.156433, (float)0.078461 + }; + + /* Lag window for LPC */ + float lpc_lagwinTbl[LPC_FILTERORDER + 1]={ + (float)1.000100, (float)0.998890, (float)0.995569, + (float)0.990057, (float)0.982392, + (float)0.972623, (float)0.960816, (float)0.947047, + (float)0.931405, (float)0.913989, (float)0.894909}; + + /* LSF quantization*/ + float lsfCbTbl[64 * 3 + 128 * 3 + 128 * 4] = { + (float)0.155396, (float)0.273193, (float)0.451172, + (float)0.390503, (float)0.648071, (float)1.002075, + (float)0.440186, (float)0.692261, (float)0.955688, + + + +Andersen, et al. Experimental [Page 89] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.343628, (float)0.642334, (float)1.071533, + (float)0.318359, (float)0.491577, (float)0.670532, + (float)0.193115, (float)0.375488, (float)0.725708, + (float)0.364136, (float)0.510376, (float)0.658691, + (float)0.297485, (float)0.527588, (float)0.842529, + (float)0.227173, (float)0.365967, (float)0.563110, + (float)0.244995, (float)0.396729, (float)0.636475, + (float)0.169434, (float)0.300171, (float)0.520264, + (float)0.312866, (float)0.464478, (float)0.643188, + (float)0.248535, (float)0.429932, (float)0.626099, + (float)0.236206, (float)0.491333, (float)0.817139, + (float)0.334961, (float)0.625122, (float)0.895752, + (float)0.343018, (float)0.518555, (float)0.698608, + (float)0.372803, (float)0.659790, (float)0.945435, + (float)0.176880, (float)0.316528, (float)0.581421, + (float)0.416382, (float)0.625977, (float)0.805176, + (float)0.303223, (float)0.568726, (float)0.915039, + (float)0.203613, (float)0.351440, (float)0.588135, + (float)0.221191, (float)0.375000, (float)0.614746, + (float)0.199951, (float)0.323364, (float)0.476074, + (float)0.300781, (float)0.433350, (float)0.566895, + (float)0.226196, (float)0.354004, (float)0.507568, + (float)0.300049, (float)0.508179, (float)0.711670, + (float)0.312012, (float)0.492676, (float)0.763428, + (float)0.329956, (float)0.541016, (float)0.795776, + (float)0.373779, (float)0.604614, (float)0.928833, + (float)0.210571, (float)0.452026, (float)0.755249, + (float)0.271118, (float)0.473267, (float)0.662476, + (float)0.285522, (float)0.436890, (float)0.634399, + (float)0.246704, (float)0.565552, (float)0.859009, + (float)0.270508, (float)0.406250, (float)0.553589, + (float)0.361450, (float)0.578491, (float)0.813843, + (float)0.342651, (float)0.482788, (float)0.622437, + (float)0.340332, (float)0.549438, (float)0.743164, + (float)0.200439, (float)0.336304, (float)0.540894, + (float)0.407837, (float)0.644775, (float)0.895142, + (float)0.294678, (float)0.454834, (float)0.699097, + (float)0.193115, (float)0.344482, (float)0.643188, + (float)0.275757, (float)0.420776, (float)0.598755, + (float)0.380493, (float)0.608643, (float)0.861084, + (float)0.222778, (float)0.426147, (float)0.676514, + (float)0.407471, (float)0.700195, (float)1.053101, + (float)0.218384, (float)0.377197, (float)0.669922, + (float)0.313232, (float)0.454102, (float)0.600952, + (float)0.347412, (float)0.571533, (float)0.874146, + (float)0.238037, (float)0.405396, (float)0.729492, + (float)0.223877, (float)0.412964, (float)0.822021, + (float)0.395264, (float)0.582153, (float)0.743896, + + + +Andersen, et al. Experimental [Page 90] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.247925, (float)0.485596, (float)0.720581, + (float)0.229126, (float)0.496582, (float)0.907715, + (float)0.260132, (float)0.566895, (float)1.012695, + (float)0.337402, (float)0.611572, (float)0.978149, + (float)0.267822, (float)0.447632, (float)0.769287, + (float)0.250610, (float)0.381714, (float)0.530029, + (float)0.430054, (float)0.805054, (float)1.221924, + (float)0.382568, (float)0.544067, (float)0.701660, + (float)0.383545, (float)0.710327, (float)1.149170, + (float)0.271362, (float)0.529053, (float)0.775513, + (float)0.246826, (float)0.393555, (float)0.588623, + (float)0.266846, (float)0.422119, (float)0.676758, + (float)0.311523, (float)0.580688, (float)0.838623, + (float)1.331177, (float)1.576782, (float)1.779541, + (float)1.160034, (float)1.401978, (float)1.768188, + (float)1.161865, (float)1.525146, (float)1.715332, + (float)0.759521, (float)0.913940, (float)1.119873, + (float)0.947144, (float)1.121338, (float)1.282471, + (float)1.015015, (float)1.557007, (float)1.804932, + (float)1.172974, (float)1.402100, (float)1.692627, + (float)1.087524, (float)1.474243, (float)1.665405, + (float)0.899536, (float)1.105225, (float)1.406250, + (float)1.148438, (float)1.484741, (float)1.796265, + (float)0.785645, (float)1.209839, (float)1.567749, + (float)0.867798, (float)1.166504, (float)1.450684, + (float)0.922485, (float)1.229858, (float)1.420898, + (float)0.791260, (float)1.123291, (float)1.409546, + (float)0.788940, (float)0.966064, (float)1.340332, + (float)1.051147, (float)1.272827, (float)1.556641, + (float)0.866821, (float)1.181152, (float)1.538818, + (float)0.906738, (float)1.373535, (float)1.607910, + (float)1.244751, (float)1.581421, (float)1.933838, + (float)0.913940, (float)1.337280, (float)1.539673, + (float)0.680542, (float)0.959229, (float)1.662720, + (float)0.887207, (float)1.430542, (float)1.800781, + (float)0.912598, (float)1.433594, (float)1.683960, + (float)0.860474, (float)1.060303, (float)1.455322, + (float)1.005127, (float)1.381104, (float)1.706909, + (float)0.800781, (float)1.363892, (float)1.829102, + (float)0.781860, (float)1.124390, (float)1.505981, + (float)1.003662, (float)1.471436, (float)1.684692, + (float)0.981323, (float)1.309570, (float)1.618042, + (float)1.228760, (float)1.554321, (float)1.756470, + (float)0.734375, (float)0.895752, (float)1.225586, + (float)0.841797, (float)1.055664, (float)1.249268, + (float)0.920166, (float)1.119385, (float)1.486206, + (float)0.894409, (float)1.539063, (float)1.828979, + (float)1.283691, (float)1.543335, (float)1.858276, + + + +Andersen, et al. Experimental [Page 91] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.676025, (float)0.933105, (float)1.490845, + (float)0.821289, (float)1.491821, (float)1.739868, + (float)0.923218, (float)1.144653, (float)1.580566, + (float)1.057251, (float)1.345581, (float)1.635864, + (float)0.888672, (float)1.074951, (float)1.353149, + (float)0.942749, (float)1.195435, (float)1.505493, + (float)1.492310, (float)1.788086, (float)2.039673, + (float)1.070313, (float)1.634399, (float)1.860962, + (float)1.253296, (float)1.488892, (float)1.686035, + (float)0.647095, (float)0.864014, (float)1.401855, + (float)0.866699, (float)1.254883, (float)1.453369, + (float)1.063965, (float)1.532593, (float)1.731323, + (float)1.167847, (float)1.521484, (float)1.884033, + (float)0.956055, (float)1.502075, (float)1.745605, + (float)0.928711, (float)1.288574, (float)1.479614, + (float)1.088013, (float)1.380737, (float)1.570801, + (float)0.905029, (float)1.186768, (float)1.371948, + (float)1.057861, (float)1.421021, (float)1.617432, + (float)1.108276, (float)1.312500, (float)1.501465, + (float)0.979492, (float)1.416992, (float)1.624268, + (float)1.276001, (float)1.661011, (float)2.007935, + (float)0.993042, (float)1.168579, (float)1.331665, + (float)0.778198, (float)0.944946, (float)1.235962, + (float)1.223755, (float)1.491333, (float)1.815674, + (float)0.852661, (float)1.350464, (float)1.722290, + (float)1.134766, (float)1.593140, (float)1.787354, + (float)1.051392, (float)1.339722, (float)1.531006, + (float)0.803589, (float)1.271240, (float)1.652100, + (float)0.755737, (float)1.143555, (float)1.639404, + (float)0.700928, (float)0.837280, (float)1.130371, + (float)0.942749, (float)1.197876, (float)1.669800, + (float)0.993286, (float)1.378296, (float)1.566528, + (float)0.801025, (float)1.095337, (float)1.298950, + (float)0.739990, (float)1.032959, (float)1.383667, + (float)0.845703, (float)1.072266, (float)1.543823, + (float)0.915649, (float)1.072266, (float)1.224487, + (float)1.021973, (float)1.226196, (float)1.481323, + (float)0.999878, (float)1.204102, (float)1.555908, + (float)0.722290, (float)0.913940, (float)1.340210, + (float)0.673340, (float)0.835938, (float)1.259521, + (float)0.832397, (float)1.208374, (float)1.394165, + (float)0.962158, (float)1.576172, (float)1.912842, + (float)1.166748, (float)1.370850, (float)1.556763, + (float)0.946289, (float)1.138550, (float)1.400391, + (float)1.035034, (float)1.218262, (float)1.386475, + (float)1.393799, (float)1.717773, (float)2.000244, + (float)0.972656, (float)1.260986, (float)1.760620, + (float)1.028198, (float)1.288452, (float)1.484619, + + + +Andersen, et al. Experimental [Page 92] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)0.773560, (float)1.258057, (float)1.756714, + (float)1.080322, (float)1.328003, (float)1.742676, + (float)0.823975, (float)1.450806, (float)1.917725, + (float)0.859009, (float)1.016602, (float)1.191895, + (float)0.843994, (float)1.131104, (float)1.645020, + (float)1.189697, (float)1.702759, (float)1.894409, + (float)1.346680, (float)1.763184, (float)2.066040, + (float)0.980469, (float)1.253784, (float)1.441650, + (float)1.338135, (float)1.641968, (float)1.932739, + (float)1.223267, (float)1.424194, (float)1.626465, + (float)0.765747, (float)1.004150, (float)1.579102, + (float)1.042847, (float)1.269165, (float)1.647461, + (float)0.968750, (float)1.257568, (float)1.555786, + (float)0.826294, (float)0.993408, (float)1.275146, + (float)0.742310, (float)0.950439, (float)1.430542, + (float)1.054321, (float)1.439819, (float)1.828003, + (float)1.072998, (float)1.261719, (float)1.441895, + (float)0.859375, (float)1.036377, (float)1.314819, + (float)0.895752, (float)1.267212, (float)1.605591, + (float)0.805420, (float)0.962891, (float)1.142334, + (float)0.795654, (float)1.005493, (float)1.468506, + (float)1.105347, (float)1.313843, (float)1.584839, + (float)0.792236, (float)1.221802, (float)1.465698, + (float)1.170532, (float)1.467651, (float)1.664063, + (float)0.838257, (float)1.153198, (float)1.342163, + (float)0.968018, (float)1.198242, (float)1.391235, + (float)1.250122, (float)1.623535, (float)1.823608, + (float)0.711670, (float)1.058350, (float)1.512085, + (float)1.204834, (float)1.454468, (float)1.739136, + (float)1.137451, (float)1.421753, (float)1.620117, + (float)0.820435, (float)1.322754, (float)1.578247, + (float)0.798706, (float)1.005005, (float)1.213867, + (float)0.980713, (float)1.324951, (float)1.512939, + (float)1.112305, (float)1.438843, (float)1.735596, + (float)1.135498, (float)1.356689, (float)1.635742, + (float)1.101318, (float)1.387451, (float)1.686523, + (float)0.849854, (float)1.276978, (float)1.523438, + (float)1.377930, (float)1.627563, (float)1.858154, + (float)0.884888, (float)1.095459, (float)1.287476, + (float)1.289795, (float)1.505859, (float)1.756592, + (float)0.817505, (float)1.384155, (float)1.650513, + (float)1.446655, (float)1.702148, (float)1.931885, + (float)0.835815, (float)1.023071, (float)1.385376, + (float)0.916626, (float)1.139038, (float)1.335327, + (float)0.980103, (float)1.174072, (float)1.453735, + (float)1.705688, (float)2.153809, (float)2.398315, (float)2.743408, + (float)1.797119, (float)2.016846, (float)2.445679, (float)2.701904, + (float)1.990356, (float)2.219116, (float)2.576416, (float)2.813477, + + + +Andersen, et al. Experimental [Page 93] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)1.849365, (float)2.190918, (float)2.611572, (float)2.835083, + (float)1.657959, (float)1.854370, (float)2.159058, (float)2.726196, + (float)1.437744, (float)1.897705, (float)2.253174, (float)2.655396, + (float)2.028687, (float)2.247314, (float)2.542358, (float)2.875854, + (float)1.736938, (float)1.922119, (float)2.185913, (float)2.743408, + (float)1.521606, (float)1.870972, (float)2.526855, (float)2.786987, + (float)1.841431, (float)2.050659, (float)2.463623, (float)2.857666, + (float)1.590088, (float)2.067261, (float)2.427979, (float)2.794434, + (float)1.746826, (float)2.057373, (float)2.320190, (float)2.800781, + (float)1.734619, (float)1.940552, (float)2.306030, (float)2.826416, + (float)1.786255, (float)2.204468, (float)2.457520, (float)2.795288, + (float)1.861084, (float)2.170532, (float)2.414551, (float)2.763672, + (float)2.001465, (float)2.307617, (float)2.552734, (float)2.811890, + (float)1.784424, (float)2.124146, (float)2.381592, (float)2.645508, + (float)1.888794, (float)2.135864, (float)2.418579, (float)2.861206, + (float)2.301147, (float)2.531250, (float)2.724976, (float)2.913086, + (float)1.837769, (float)2.051270, (float)2.261963, (float)2.553223, + (float)2.012939, (float)2.221191, (float)2.440186, (float)2.678101, + (float)1.429565, (float)1.858276, (float)2.582275, (float)2.845703, + (float)1.622803, (float)1.897705, (float)2.367310, (float)2.621094, + (float)1.581543, (float)1.960449, (float)2.515869, (float)2.736450, + (float)1.419434, (float)1.933960, (float)2.394653, (float)2.746704, + (float)1.721924, (float)2.059570, (float)2.421753, (float)2.769653, + (float)1.911011, (float)2.220703, (float)2.461060, (float)2.740723, + (float)1.581177, (float)1.860840, (float)2.516968, (float)2.874634, + (float)1.870361, (float)2.098755, (float)2.432373, (float)2.656494, + (float)2.059692, (float)2.279785, (float)2.495605, (float)2.729370, + (float)1.815674, (float)2.181519, (float)2.451538, (float)2.680542, + (float)1.407959, (float)1.768311, (float)2.343018, (float)2.668091, + (float)2.168701, (float)2.394653, (float)2.604736, (float)2.829346, + (float)1.636230, (float)1.865723, (float)2.329102, (float)2.824219, + (float)1.878906, (float)2.139526, (float)2.376709, (float)2.679810, + (float)1.765381, (float)1.971802, (float)2.195435, (float)2.586914, + (float)2.164795, (float)2.410889, (float)2.673706, (float)2.903198, + (float)2.071899, (float)2.331055, (float)2.645874, (float)2.907104, + (float)2.026001, (float)2.311523, (float)2.594849, (float)2.863892, + (float)1.948975, (float)2.180786, (float)2.514893, (float)2.797852, + (float)1.881836, (float)2.130859, (float)2.478149, (float)2.804199, + (float)2.238159, (float)2.452759, (float)2.652832, (float)2.868286, + (float)1.897949, (float)2.101685, (float)2.524292, (float)2.880127, + (float)1.856445, (float)2.074585, (float)2.541016, (float)2.791748, + (float)1.695557, (float)2.199097, (float)2.506226, (float)2.742676, + (float)1.612671, (float)1.877075, (float)2.435425, (float)2.732910, + (float)1.568848, (float)1.786499, (float)2.194580, (float)2.768555, + (float)1.953369, (float)2.164551, (float)2.486938, (float)2.874023, + (float)1.388306, (float)1.725342, (float)2.384521, (float)2.771851, + (float)2.115356, (float)2.337769, (float)2.592896, (float)2.864014, + (float)1.905762, (float)2.111328, (float)2.363525, (float)2.789307, + + + +Andersen, et al. Experimental [Page 94] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)1.882568, (float)2.332031, (float)2.598267, (float)2.827637, + (float)1.683594, (float)2.088745, (float)2.361938, (float)2.608643, + (float)1.874023, (float)2.182129, (float)2.536133, (float)2.766968, + (float)1.861938, (float)2.070435, (float)2.309692, (float)2.700562, + (float)1.722168, (float)2.107422, (float)2.477295, (float)2.837646, + (float)1.926880, (float)2.184692, (float)2.442627, (float)2.663818, + (float)2.123901, (float)2.337280, (float)2.553101, (float)2.777466, + (float)1.588135, (float)1.911499, (float)2.212769, (float)2.543945, + (float)2.053955, (float)2.370850, (float)2.712158, (float)2.939941, + (float)2.210449, (float)2.519653, (float)2.770386, (float)2.958618, + (float)2.199463, (float)2.474731, (float)2.718262, (float)2.919922, + (float)1.960083, (float)2.175415, (float)2.608032, (float)2.888794, + (float)1.953735, (float)2.185181, (float)2.428223, (float)2.809570, + (float)1.615234, (float)2.036499, (float)2.576538, (float)2.834595, + (float)1.621094, (float)2.028198, (float)2.431030, (float)2.664673, + (float)1.824951, (float)2.267456, (float)2.514526, (float)2.747925, + (float)1.994263, (float)2.229126, (float)2.475220, (float)2.833984, + (float)1.746338, (float)2.011353, (float)2.588257, (float)2.826904, + (float)1.562866, (float)2.135986, (float)2.471680, (float)2.687256, + (float)1.748901, (float)2.083496, (float)2.460938, (float)2.686279, + (float)1.758057, (float)2.131470, (float)2.636597, (float)2.891602, + (float)2.071289, (float)2.299072, (float)2.550781, (float)2.814331, + (float)1.839600, (float)2.094360, (float)2.496460, (float)2.723999, + (float)1.882202, (float)2.088257, (float)2.636841, (float)2.923096, + (float)1.957886, (float)2.153198, (float)2.384399, (float)2.615234, + (float)1.992920, (float)2.351196, (float)2.654419, (float)2.889771, + (float)2.012817, (float)2.262451, (float)2.643799, (float)2.903076, + (float)2.025635, (float)2.254761, (float)2.508423, (float)2.784058, + (float)2.316040, (float)2.589355, (float)2.794189, (float)2.963623, + (float)1.741211, (float)2.279541, (float)2.578491, (float)2.816284, + (float)1.845337, (float)2.055786, (float)2.348511, (float)2.822021, + (float)1.679932, (float)1.926514, (float)2.499756, (float)2.835693, + (float)1.722534, (float)1.946899, (float)2.448486, (float)2.728760, + (float)1.829834, (float)2.043213, (float)2.580444, (float)2.867676, + (float)1.676636, (float)2.071655, (float)2.322510, (float)2.704834, + (float)1.791504, (float)2.113525, (float)2.469727, (float)2.784058, + (float)1.977051, (float)2.215088, (float)2.497437, (float)2.726929, + (float)1.800171, (float)2.106689, (float)2.357788, (float)2.738892, + (float)1.827759, (float)2.170166, (float)2.525879, (float)2.852417, + (float)1.918335, (float)2.132813, (float)2.488403, (float)2.728149, + (float)1.916748, (float)2.225098, (float)2.542603, (float)2.857666, + (float)1.761230, (float)1.976074, (float)2.507446, (float)2.884521, + (float)2.053711, (float)2.367432, (float)2.608032, (float)2.837646, + (float)1.595337, (float)2.000977, (float)2.307129, (float)2.578247, + (float)1.470581, (float)2.031250, (float)2.375854, (float)2.647583, + (float)1.801392, (float)2.128052, (float)2.399780, (float)2.822876, + (float)1.853638, (float)2.066650, (float)2.429199, (float)2.751465, + (float)1.956299, (float)2.163696, (float)2.394775, (float)2.734253, + + + +Andersen, et al. Experimental [Page 95] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + (float)1.963623, (float)2.275757, (float)2.585327, (float)2.865234, + (float)1.887451, (float)2.105469, (float)2.331787, (float)2.587402, + (float)2.120117, (float)2.443359, (float)2.733887, (float)2.941406, + (float)1.506348, (float)1.766968, (float)2.400513, (float)2.851807, + (float)1.664551, (float)1.981079, (float)2.375732, (float)2.774414, + (float)1.720703, (float)1.978882, (float)2.391479, (float)2.640991, + (float)1.483398, (float)1.814819, (float)2.434448, (float)2.722290, + (float)1.769043, (float)2.136597, (float)2.563721, (float)2.774414, + (float)1.810791, (float)2.049316, (float)2.373901, (float)2.613647, + (float)1.788330, (float)2.005981, (float)2.359131, (float)2.723145, + (float)1.785156, (float)1.993164, (float)2.399780, (float)2.832520, + (float)1.695313, (float)2.022949, (float)2.522583, (float)2.745117, + (float)1.584106, (float)1.965576, (float)2.299927, (float)2.715576, + (float)1.894897, (float)2.249878, (float)2.655884, (float)2.897705, + (float)1.720581, (float)1.995728, (float)2.299438, (float)2.557007, + (float)1.619385, (float)2.173950, (float)2.574219, (float)2.787964, + (float)1.883179, (float)2.220459, (float)2.474365, (float)2.825073, + (float)1.447632, (float)2.045044, (float)2.555542, (float)2.744873, + (float)1.502686, (float)2.156616, (float)2.653320, (float)2.846558, + (float)1.711548, (float)1.944092, (float)2.282959, (float)2.685791, + (float)1.499756, (float)1.867554, (float)2.341064, (float)2.578857, + (float)1.916870, (float)2.135132, (float)2.568237, (float)2.826050, + (float)1.498047, (float)1.711182, (float)2.223267, (float)2.755127, + (float)1.808716, (float)1.997559, (float)2.256470, (float)2.758545, + (float)2.088501, (float)2.402710, (float)2.667358, (float)2.890259, + (float)1.545044, (float)1.819214, (float)2.324097, (float)2.692993, + (float)1.796021, (float)2.012573, (float)2.505737, (float)2.784912, + (float)1.786499, (float)2.041748, (float)2.290405, (float)2.650757, + (float)1.938232, (float)2.264404, (float)2.529053, (float)2.796143 + }; + +A.9. anaFilter.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + anaFilter.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_ANAFILTER_H + #define __iLBC_ANAFILTER_H + + void anaFilter( + + + +Andersen, et al. Experimental [Page 96] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float *In, /* (i) Signal to be filtered */ + float *a, /* (i) LP parameters */ + int len,/* (i) Length of signal */ + float *Out, /* (o) Filtered signal */ + float *mem /* (i/o) Filter state */ + ); + + #endif + +A.10. anaFilter.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + anaFilter.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * LP analysis filter. + *---------------------------------------------------------------*/ + + void anaFilter( + float *In, /* (i) Signal to be filtered */ + float *a, /* (i) LP parameters */ + int len,/* (i) Length of signal */ + float *Out, /* (o) Filtered signal */ + float *mem /* (i/o) Filter state */ + ){ + int i, j; + float *po, *pi, *pm, *pa; + + po = Out; + + /* Filter first part using memory from past */ + + for (i=0; i + #include + + /*----------------------------------------------------------------* + * Construct an additional codebook vector by filtering the + * initial codebook buffer. This vector is then used to expand + * the codebook with an additional section. + *---------------------------------------------------------------*/ + + void filteredCBvecs( + float *cbvectors, /* (o) Codebook vectors for the + higher section */ + float *mem, /* (i) Buffer to create codebook + vector from */ + int lMem /* (i) Length of buffer */ + ){ + int j, k; + float *pp, *pp1; + float tempbuff2[CB_MEML+CB_FILTERLEN]; + float *pos; + + memset(tempbuff2, 0, (CB_HALFFILTERLEN-1)*sizeof(float)); + memcpy(&tempbuff2[CB_HALFFILTERLEN-1], mem, lMem*sizeof(float)); + memset(&tempbuff2[lMem+CB_HALFFILTERLEN-1], 0, + (CB_HALFFILTERLEN+1)*sizeof(float)); + + /* Create codebook vector for higher section by filtering */ + + /* do filtering */ + pos=cbvectors; + memset(pos, 0, lMem*sizeof(float)); + for (k=0; k0.0) { + invenergy[tmpIndex]=(float)1.0/(energy[tmpIndex]+EPS); + } else { + invenergy[tmpIndex] = (float) 0.0; + } + + if (stage==0) { + measure = (float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot*invenergy[tmpIndex]; + } + } + else { + measure = crossDot*crossDot*invenergy[tmpIndex]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[tmpIndex]; + + if ((measure>*max_measure) && (fabs(ftmp) + #include + #include + + + +Andersen, et al. Experimental [Page 104] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * Compute cross correlation and pitch gain for pitch prediction + * of last subframe at given lag. + *---------------------------------------------------------------*/ + + void compCorr( + float *cc, /* (o) cross correlation coefficient */ + float *gc, /* (o) gain */ + float *pm, + float *buffer, /* (i) signal buffer */ + int lag, /* (i) pitch lag */ + int bLen, /* (i) length of buffer */ + int sRange /* (i) correlation search length */ + ){ + int i; + float ftmp1, ftmp2, ftmp3; + + /* Guard against getting outside buffer */ + if ((bLen-sRange-lag)<0) { + sRange=bLen-lag; + } + + ftmp1 = 0.0; + ftmp2 = 0.0; + ftmp3 = 0.0; + for (i=0; i 0.0) { + *cc = ftmp1*ftmp1/ftmp2; + *gc = (float)fabs(ftmp1/ftmp2); + *pm=(float)fabs(ftmp1)/ + ((float)sqrt(ftmp2)*(float)sqrt(ftmp3)); + } + else { + *cc = 0.0; + *gc = 0.0; + *pm=0.0; + } + } + + + +Andersen, et al. Experimental [Page 105] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /*----------------------------------------------------------------* + * Packet loss concealment routine. Conceals a residual signal + * and LP parameters. If no packet loss, update state. + *---------------------------------------------------------------*/ + + void doThePLC( + float *PLCresidual, /* (o) concealed residual */ + float *PLClpc, /* (o) concealed LP parameters */ + int PLI, /* (i) packet loss indicator + 0 - no PL, 1 = PL */ + float *decresidual, /* (i) decoded residual */ + float *lpc, /* (i) decoded LPC (only used for no PL) */ + int inlag, /* (i) pitch lag */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i/o) decoder instance */ + ){ + int lag=20, randlag; + float gain, maxcc; + float use_gain; + float gain_comp, maxcc_comp, per, max_per; + int i, pick, use_lag; + float ftmp, randvec[BLOCKL_MAX], pitchfact, energy; + + /* Packet Loss */ + + if (PLI == 1) { + + iLBCdec_inst->consPLICount += 1; + + /* if previous frame not lost, + determine pitch pred. gain */ + + if (iLBCdec_inst->prevPLI != 1) { + + /* Search around the previous lag to find the + best pitch period */ + + lag=inlag-3; + compCorr(&maxcc, &gain, &max_per, + iLBCdec_inst->prevResidual, + lag, iLBCdec_inst->blockl, 60); + for (i=inlag-2;i<=inlag+3;i++) { + compCorr(&maxcc_comp, &gain_comp, &per, + iLBCdec_inst->prevResidual, + i, iLBCdec_inst->blockl, 60); + + if (maxcc_comp>maxcc) { + maxcc=maxcc_comp; + + + +Andersen, et al. Experimental [Page 106] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + gain=gain_comp; + lag=i; + max_per=per; + } + } + + } + + /* previous frame lost, use recorded lag and periodicity */ + + else { + lag=iLBCdec_inst->prevLag; + max_per=iLBCdec_inst->per; + } + + /* downscaling */ + + use_gain=1.0; + if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl>320) + use_gain=(float)0.9; + else if (iLBCdec_inst->consPLICount* + iLBCdec_inst->blockl>2*320) + use_gain=(float)0.7; + else if (iLBCdec_inst->consPLICount* + iLBCdec_inst->blockl>3*320) + use_gain=(float)0.5; + else if (iLBCdec_inst->consPLICount* + iLBCdec_inst->blockl>4*320) + use_gain=(float)0.0; + + /* mix noise and pitch repeatition */ + ftmp=(float)sqrt(max_per); + if (ftmp>(float)0.7) + pitchfact=(float)1.0; + else if (ftmp>(float)0.4) + pitchfact=(ftmp-(float)0.4)/((float)0.7-(float)0.4); + else + pitchfact=0.0; + + + /* avoid repetition of same pitch cycle */ + use_lag=lag; + if (lag<80) { + use_lag=2*lag; + } + + /* compute concealed residual */ + + + + +Andersen, et al. Experimental [Page 107] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + energy = 0.0; + for (i=0; iblockl; i++) { + + /* noise component */ + + iLBCdec_inst->seed=(iLBCdec_inst->seed*69069L+1) & + (0x80000000L-1); + randlag = 50 + ((signed long) iLBCdec_inst->seed)%70; + pick = i - randlag; + + if (pick < 0) { + randvec[i] = + iLBCdec_inst->prevResidual[ + iLBCdec_inst->blockl+pick]; + } else { + randvec[i] = randvec[pick]; + } + + /* pitch repeatition component */ + pick = i - use_lag; + + if (pick < 0) { + PLCresidual[i] = + iLBCdec_inst->prevResidual[ + iLBCdec_inst->blockl+pick]; + } else { + PLCresidual[i] = PLCresidual[pick]; + } + + /* mix random and periodicity component */ + + if (i<80) + PLCresidual[i] = use_gain*(pitchfact * + PLCresidual[i] + + ((float)1.0 - pitchfact) * randvec[i]); + else if (i<160) + PLCresidual[i] = (float)0.95*use_gain*(pitchfact * + PLCresidual[i] + + ((float)1.0 - pitchfact) * randvec[i]); + else + PLCresidual[i] = (float)0.9*use_gain*(pitchfact * + PLCresidual[i] + + ((float)1.0 - pitchfact) * randvec[i]); + + energy += PLCresidual[i] * PLCresidual[i]; + } + + /* less than 30 dB, use only noise */ + + + +Andersen, et al. Experimental [Page 108] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + + if (sqrt(energy/(float)iLBCdec_inst->blockl) < 30.0) { + gain=0.0; + for (i=0; iblockl; i++) { + PLCresidual[i] = randvec[i]; + } + } + + /* use old LPC */ + + memcpy(PLClpc,iLBCdec_inst->prevLpc, + (LPC_FILTERORDER+1)*sizeof(float)); + + } + + /* no packet loss, copy input */ + + else { + memcpy(PLCresidual, decresidual, + iLBCdec_inst->blockl*sizeof(float)); + memcpy(PLClpc, lpc, (LPC_FILTERORDER+1)*sizeof(float)); + iLBCdec_inst->consPLICount = 0; + } + + /* update state */ + + if (PLI) { + iLBCdec_inst->prevLag = lag; + iLBCdec_inst->per=max_per; + } + + iLBCdec_inst->prevPLI = PLI; + memcpy(iLBCdec_inst->prevLpc, PLClpc, + (LPC_FILTERORDER+1)*sizeof(float)); + memcpy(iLBCdec_inst->prevResidual, PLCresidual, + iLBCdec_inst->blockl*sizeof(float)); + } + +A.15. enhancer.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + enhancer.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + + +Andersen, et al. Experimental [Page 109] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + ******************************************************************/ + + #ifndef __ENHANCER_H + #define __ENHANCER_H + + #include "iLBC_define.h" + + float xCorrCoef( + float *target, /* (i) first array */ + float *regressor, /* (i) second array */ + int subl /* (i) dimension arrays */ + ); + + int enhancerInterface( + float *out, /* (o) the enhanced recidual signal */ + float *in, /* (i) the recidual signal to enhance */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i/o) the decoder state structure */ + ); + + #endif + +A.16. enhancer.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + enhancer.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include "iLBC_define.h" + #include "constants.h" + #include "filter.h" + + /*----------------------------------------------------------------* + * Find index in array such that the array element with said + * index is the element of said array closest to "value" + * according to the squared-error criterion + *---------------------------------------------------------------*/ + + void NearestNeighbor( + + + +Andersen, et al. Experimental [Page 110] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + int *index, /* (o) index of array element closest + to value */ + float *array, /* (i) data array */ + float value,/* (i) value */ + int arlength/* (i) dimension of data array */ + ){ + int i; + float bestcrit,crit; + + crit=array[0]-value; + bestcrit=crit*crit; + *index=0; + for (i=1; i dim1 ) { + hfl2=(int) (dim1/2); + for (j=0; j= idatal) { + searchSegEndPos=idatal-ENH_BLOCKL-1; + } + corrdim=searchSegEndPos-searchSegStartPos+1; + + /* compute upsampled correlation (corr33) and find + location of max */ + + mycorr1(corrVec,idata+searchSegStartPos, + corrdim+ENH_BLOCKL-1,idata+centerStartPos,ENH_BLOCKL); + enh_upsample(corrVecUps,corrVec,corrdim,ENH_FL0); + tloc=0; maxv=corrVecUps[0]; + for (i=1; imaxv) { + tloc=i; + maxv=corrVecUps[i]; + } + } + + /* make vector can be upsampled without ever running outside + bounds */ + + *updStartPos= (float)searchSegStartPos + + (float)tloc/(float)ENH_UPS0+(float)1.0; + tloc2=(int)(tloc/ENH_UPS0); + + if (tloc>tloc2*ENH_UPS0) { + tloc2++; + } + st=searchSegStartPos+tloc2-ENH_FL0; + + if (st<0) { + memset(vect,0,-st*sizeof(float)); + memcpy(&vect[-st],idata, (ENH_VECTL+st)*sizeof(float)); + } + else { + + + +Andersen, et al. Experimental [Page 114] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + en=st+ENH_VECTL; + + if (en>idatal) { + memcpy(vect, &idata[st], + (ENH_VECTL-(en-idatal))*sizeof(float)); + memset(&vect[ENH_VECTL-(en-idatal)], 0, + (en-idatal)*sizeof(float)); + } + else { + memcpy(vect, &idata[st], ENH_VECTL*sizeof(float)); + } + } + fraction=tloc2*ENH_UPS0-tloc; + + /* compute the segment (this is actually a convolution) */ + + mycorr1(seg,vect,ENH_VECTL,polyphaserTbl+(2*ENH_FL0+1)*fraction, + 2*ENH_FL0+1); + } + + /*----------------------------------------------------------------* + * find the smoothed output data + *---------------------------------------------------------------*/ + + void smath( + float *odata, /* (o) smoothed output */ + float *sseq,/* (i) said second sequence of waveforms */ + int hl, /* (i) 2*hl+1 is sseq dimension */ + float alpha0/* (i) max smoothing energy fraction */ + ){ + int i,k; + float w00,w10,w11,A,B,C,*psseq,err,errs; + float surround[BLOCKL_MAX]; /* shape contributed by other than + current */ + float wt[2*ENH_HL+1]; /* waveform weighting to get + surround shape */ + float denom; + + /* create shape of contribution from all waveforms except the + current one */ + + for (i=1; i<=2*hl+1; i++) { + wt[i-1] = (float)0.5*(1 - (float)cos(2*PI*i/(2*hl+2))); + } + wt[hl]=0.0; /* for clarity, not used */ + for (i=0; i alpha0 * w00) { + if ( w00 < 1) { + w00=1; + } + denom = (w11*w00-w10*w10)/(w00*w00); + + if (denom > 0.0001) { /* eliminates numerical problems + for if smooth */ + + + +Andersen, et al. Experimental [Page 116] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + A = (float)sqrt( (alpha0- alpha0*alpha0/4)/denom); + B = -alpha0/2 - A * w10/w00; + B = B+1; + } + else { /* essentially no difference between cycles; + smoothing not needed */ + A= 0.0; + B= 1.0; + } + + /* create smoothed sequence */ + + psseq=sseq+hl*ENH_BLOCKL; + for (i=0; i=0; q--) { + blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]]; + NearestNeighbor(lagBlock+q,plocs, + blockStartPos[q]+ + ENH_BLOCKL_HALF-period[lagBlock[q+1]], periodl); + + + if (blockStartPos[q]-ENH_OVERHANG>=0) { + refiner(sseq+q*ENH_BLOCKL, blockStartPos+q, idata, + idatal, centerStartPos, blockStartPos[q], + period[lagBlock[q+1]]); + } else { + psseq=sseq+q*ENH_BLOCKL; + memset(psseq, 0, ENH_BLOCKL*sizeof(float)); + } + } + + /* future */ + + for (i=0; i 0.0) { + return (float)(ftmp1*ftmp1/ftmp2); + } + + + +Andersen, et al. Experimental [Page 119] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + else { + return (float)0.0; + } + } + + /*----------------------------------------------------------------* + * interface for enhancer + *---------------------------------------------------------------*/ + + int enhancerInterface( + float *out, /* (o) enhanced signal */ + float *in, /* (i) unenhanced signal */ + iLBC_Dec_Inst_t *iLBCdec_inst /* (i) buffers etc */ + ){ + float *enh_buf, *enh_period; + int iblock, isample; + int lag=0, ilag, i, ioffset; + float cc, maxcc; + float ftmp1, ftmp2; + float *inPtr, *enh_bufPtr1, *enh_bufPtr2; + float plc_pred[ENH_BLOCKL]; + + float lpState[6], downsampled[(ENH_NBLOCKS*ENH_BLOCKL+120)/2]; + int inLen=ENH_NBLOCKS*ENH_BLOCKL+120; + int start, plc_blockl, inlag; + + enh_buf=iLBCdec_inst->enh_buf; + enh_period=iLBCdec_inst->enh_period; + + memmove(enh_buf, &enh_buf[iLBCdec_inst->blockl], + (ENH_BUFL-iLBCdec_inst->blockl)*sizeof(float)); + + memcpy(&enh_buf[ENH_BUFL-iLBCdec_inst->blockl], in, + iLBCdec_inst->blockl*sizeof(float)); + + if (iLBCdec_inst->mode==30) + plc_blockl=ENH_BLOCKL; + else + plc_blockl=40; + + /* when 20 ms frame, move processing one block */ + ioffset=0; + if (iLBCdec_inst->mode==20) ioffset=1; + + i=3-ioffset; + memmove(enh_period, &enh_period[i], + (ENH_NBLOCKS_TOT-i)*sizeof(float)); + + + + +Andersen, et al. Experimental [Page 120] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* Set state information to the 6 samples right before + the samples to be downsampled. */ + + memcpy(lpState, + enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-126, + 6*sizeof(float)); + + /* Down sample a factor 2 to save computations */ + + DownSample(enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-120, + lpFilt_coefsTbl, inLen-ioffset*ENH_BLOCKL, + lpState, downsampled); + + /* Estimate the pitch in the down sampled domain. */ + for (iblock = 0; iblock maxcc) { + maxcc = cc; + lag = ilag; + } + } + + /* Store the estimated lag in the non-downsampled domain */ + enh_period[iblock+ENH_NBLOCKS_EXTRA+ioffset] = (float)lag*2; + + + } + + + /* PLC was performed on the previous packet */ + if (iLBCdec_inst->prev_enh_pl==1) { + + inlag=(int)enh_period[ENH_NBLOCKS_EXTRA+ioffset]; + + lag = inlag-1; + maxcc = xCorrCoef(in, in+lag, plc_blockl); + for (ilag=inlag; ilag<=inlag+1; ilag++) { + cc = xCorrCoef(in, in+ilag, plc_blockl); + + + + +Andersen, et al. Experimental [Page 121] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + if (cc > maxcc) { + maxcc = cc; + lag = ilag; + } + } + + enh_period[ENH_NBLOCKS_EXTRA+ioffset-1]=(float)lag; + + /* compute new concealed residual for the old lookahead, + mix the forward PLC with a backward PLC from + the new frame */ + + inPtr=&in[lag-1]; + + enh_bufPtr1=&plc_pred[plc_blockl-1]; + + if (lag>plc_blockl) { + start=plc_blockl; + } else { + start=lag; + } + + for (isample = start; isample>0; isample--) { + *enh_bufPtr1-- = *inPtr--; + } + + enh_bufPtr2=&enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl]; + for (isample = (plc_blockl-1-lag); isample>=0; isample--) { + *enh_bufPtr1-- = *enh_bufPtr2--; + } + + /* limit energy change */ + ftmp2=0.0; + ftmp1=0.0; + for (i=0;iblockl-i]* + enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl-i]; + ftmp1+=plc_pred[i]*plc_pred[i]; + } + ftmp1=(float)sqrt(ftmp1/(float)plc_blockl); + ftmp2=(float)sqrt(ftmp2/(float)plc_blockl); + if (ftmp1>(float)2.0*ftmp2 && ftmp1>0.0) { + for (i=0;iblockl]; + for (i=0; imode==20) { + /* Enhancer with 40 samples delay */ + for (iblock = 0; iblock<2; iblock++) { + enhancer(out+iblock*ENH_BLOCKL, enh_buf, + ENH_BUFL, (5+iblock)*ENH_BLOCKL+40, + ENH_ALPHA0, enh_period, enh_plocsTbl, + ENH_NBLOCKS_TOT); + } + } else if (iLBCdec_inst->mode==30) { + /* Enhancer with 80 samples delay */ + for (iblock = 0; iblock<3; iblock++) { + enhancer(out+iblock*ENH_BLOCKL, enh_buf, + ENH_BUFL, (4+iblock)*ENH_BLOCKL, + ENH_ALPHA0, enh_period, enh_plocsTbl, + ENH_NBLOCKS_TOT); + } + } + + return (lag*2); + } + +A.17. filter.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + filter.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + + + +Andersen, et al. Experimental [Page 123] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + #ifndef __iLBC_FILTER_H + #define __iLBC_FILTER_H + + void AllPoleFilter( + float *InOut, /* (i/o) on entrance InOut[-orderCoef] to + InOut[-1] contain the state of the + filter (delayed samples). InOut[0] to + InOut[lengthInOut-1] contain the filter + input, on en exit InOut[-orderCoef] to + InOut[-1] is unchanged and InOut[0] to + InOut[lengthInOut-1] contain filtered + samples */ + float *Coef,/* (i) filter coefficients, Coef[0] is assumed + to be 1.0 */ + int lengthInOut,/* (i) number of input/output samples */ + int orderCoef /* (i) number of filter coefficients */ + ); + + void AllZeroFilter( + float *In, /* (i) In[0] to In[lengthInOut-1] contain + filter input samples */ + float *Coef,/* (i) filter coefficients (Coef[0] is assumed + to be 1.0) */ + int lengthInOut,/* (i) number of input/output samples */ + int orderCoef, /* (i) number of filter coefficients */ + float *Out /* (i/o) on entrance Out[-orderCoef] to Out[-1] + contain the filter state, on exit Out[0] + to Out[lengthInOut-1] contain filtered + samples */ + ); + + void ZeroPoleFilter( + float *In, /* (i) In[0] to In[lengthInOut-1] contain filter + input samples In[-orderCoef] to In[-1] + contain state of all-zero section */ + float *ZeroCoef,/* (i) filter coefficients for all-zero + section (ZeroCoef[0] is assumed to + be 1.0) */ + float *PoleCoef,/* (i) filter coefficients for all-pole section + (ZeroCoef[0] is assumed to be 1.0) */ + int lengthInOut,/* (i) number of input/output samples */ + int orderCoef, /* (i) number of filter coefficients */ + float *Out /* (i/o) on entrance Out[-orderCoef] to Out[-1] + contain state of all-pole section. On + exit Out[0] to Out[lengthInOut-1] + contain filtered samples */ + ); + + + + +Andersen, et al. Experimental [Page 124] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + void DownSample ( + float *In, /* (i) input samples */ + float *Coef, /* (i) filter coefficients */ + int lengthIn, /* (i) number of input samples */ + float *state, /* (i) filter state */ + float *Out /* (o) downsampled output */ + ); + + #endif + +A.18. filter.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + filter.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * all-pole filter + *---------------------------------------------------------------*/ + + void AllPoleFilter( + float *InOut, /* (i/o) on entrance InOut[-orderCoef] to + InOut[-1] contain the state of the + filter (delayed samples). InOut[0] to + InOut[lengthInOut-1] contain the filter + input, on en exit InOut[-orderCoef] to + InOut[-1] is unchanged and InOut[0] to + InOut[lengthInOut-1] contain filtered + samples */ + float *Coef,/* (i) filter coefficients, Coef[0] is assumed + to be 1.0 */ + int lengthInOut,/* (i) number of input/output samples */ + int orderCoef /* (i) number of filter coefficients */ + ){ + int n,k; + + for(n=0;nnsub-1; n++) { + pp=residual+n*SUBL; + for (l=0; l<5; l++) { + fssqEn[n] += sampEn_win[l] * (*pp) * (*pp); + bssqEn[n] += (*pp) * (*pp); + pp++; + } + for (l=5; lnsub-1; + pp=residual+n*SUBL; + for (l=0; lmode==20) l=1; + else l=0; + + max_ssqEn=(fssqEn[0]+bssqEn[1])*ssqEn_win[l]; + max_ssqEn_n=1; + for (n=2; nnsub; n++) { + + + + +Andersen, et al. Experimental [Page 130] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + l++; + if ((fssqEn[n-1]+bssqEn[n])*ssqEn_win[l] > max_ssqEn) { + max_ssqEn=(fssqEn[n-1]+bssqEn[n]) * + ssqEn_win[l]; + max_ssqEn_n=n; + } + } + + return max_ssqEn_n; + } + +A.21. gainquant.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + gainquant.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_GAINQUANT_H + #define __iLBC_GAINQUANT_H + + float gainquant(/* (o) quantized gain value */ + float in, /* (i) gain value */ + float maxIn,/* (i) maximum of gain value */ + int cblen, /* (i) number of quantization indices */ + int *index /* (o) quantization index */ + ); + + float gaindequant( /* (o) quantized gain value */ + int index, /* (i) quantization index */ + float maxIn,/* (i) maximum of unquantized gain */ + int cblen /* (i) number of quantization indices */ + ); + + #endif + +A.22. gainquant.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + + + +Andersen, et al. Experimental [Page 131] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + gainquant.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + #include "constants.h" + #include "filter.h" + + /*----------------------------------------------------------------* + * quantizer for the gain in the gain-shape coding of residual + *---------------------------------------------------------------*/ + + float gainquant(/* (o) quantized gain value */ + float in, /* (i) gain value */ + float maxIn,/* (i) maximum of gain value */ + int cblen, /* (i) number of quantization indices */ + int *index /* (o) quantization index */ + ){ + int i, tindex; + float minmeasure,measure, *cb, scale; + + /* ensure a lower bound on the scaling factor */ + + scale=maxIn; + + if (scale<0.1) { + scale=(float)0.1; + } + + /* select the quantization table */ + + if (cblen == 8) { + cb = gain_sq3Tbl; + } else if (cblen == 16) { + cb = gain_sq4Tbl; + } else { + cb = gain_sq5Tbl; + } + + /* select the best index in the quantization table */ + + minmeasure=10000000.0; + tindex=0; + for (i=0; i + + /*----------------------------------------------------------------* + * Construct codebook vector for given index. + *---------------------------------------------------------------*/ + + void getCBvec( + + + +Andersen, et al. Experimental [Page 134] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float *cbvec, /* (o) Constructed codebook vector */ + float *mem, /* (i) Codebook buffer */ + int index, /* (i) Codebook index */ + int lMem, /* (i) Length of codebook buffer */ + int cbveclen/* (i) Codebook vector length */ + ){ + int j, k, n, memInd, sFilt; + float tmpbuf[CB_MEML]; + int base_size; + int ilow, ihigh; + float alfa, alfa1; + + /* Determine size of codebook sections */ + + base_size=lMem-cbveclen+1; + + if (cbveclen==SUBL) { + base_size+=cbveclen/2; + } + + /* No filter -> First codebook section */ + + if (index + + #include "iLBC_define.h" + #include "constants.h" + + /*----------------------------------------------------------------* + * calculation of auto correlation + *---------------------------------------------------------------*/ + + void autocorr( + float *r, /* (o) autocorrelation vector */ + const float *x, /* (i) data vector */ + int N, /* (i) length of data vector */ + int order /* largest lag for calculated + autocorrelations */ + ){ + int lag, n; + float sum; + + for (lag = 0; lag <= order; lag++) { + sum = 0; + for (n = 0; n < N - lag; n++) { + sum += x[n] * x[n+lag]; + } + r[lag] = sum; + } + + + +Andersen, et al. Experimental [Page 140] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + } + + /*----------------------------------------------------------------* + * window multiplication + *---------------------------------------------------------------*/ + + void window( + float *z, /* (o) the windowed data */ + const float *x, /* (i) the original data vector */ + const float *y, /* (i) the window */ + int N /* (i) length of all vectors */ + ){ + int i; + + for (i = 0; i < N; i++) { + z[i] = x[i] * y[i]; + } + } + + /*----------------------------------------------------------------* + * levinson-durbin solution for lpc coefficients + *---------------------------------------------------------------*/ + + void levdurb( + float *a, /* (o) lpc coefficient vector starting + with 1.0 */ + float *k, /* (o) reflection coefficients */ + float *r, /* (i) autocorrelation vector */ + int order /* (i) order of lpc filter */ + ){ + float sum, alpha; + int m, m_h, i; + + a[0] = 1.0; + + if (r[0] < EPS) { /* if r[0] <= 0, set LPC coeff. to zero */ + for (i = 0; i < order; i++) { + k[i] = 0; + a[i+1] = 0; + } + } else { + a[1] = k[0] = -r[1]/r[0]; + alpha = r[0] + r[1] * k[0]; + for (m = 1; m < order; m++){ + sum = r[m + 1]; + for (i = 0; i < m; i++){ + sum += a[i+1] * r[m - i]; + } + + + +Andersen, et al. Experimental [Page 141] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + k[m] = -sum / alpha; + alpha += k[m] * sum; + m_h = (m + 1) >> 1; + for (i = 0; i < m_h; i++){ + sum = a[i+1] + k[m] * a[m - i]; + a[m - i] += k[m] * a[i+1]; + a[i+1] = sum; + } + a[m+1] = k[m]; + } + } + } + + /*----------------------------------------------------------------* + * interpolation between vectors + *---------------------------------------------------------------*/ + + void interpolate( + float *out, /* (o) the interpolated vector */ + float *in1, /* (i) the first vector for the + interpolation */ + float *in2, /* (i) the second vector for the + interpolation */ + float coef, /* (i) interpolation weights */ + int length /* (i) length of all vectors */ + ){ + int i; + float invcoef; + + invcoef = (float)1.0 - coef; + for (i = 0; i < length; i++) { + out[i] = coef * in1[i] + invcoef * in2[i]; + } + } + + /*----------------------------------------------------------------* + * lpc bandwidth expansion + *---------------------------------------------------------------*/ + + void bwexpand( + float *out, /* (o) the bandwidth expanded lpc + coefficients */ + float *in, /* (i) the lpc coefficients before bandwidth + expansion */ + float coef, /* (i) the bandwidth expansion factor */ + int length /* (i) the length of lpc coefficient vectors */ + ){ + int i; + + + +Andersen, et al. Experimental [Page 142] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float chirp; + + chirp = coef; + + out[0] = in[0]; + for (i = 1; i < length; i++) { + out[i] = chirp * in[i]; + chirp *= coef; + } + } + + /*----------------------------------------------------------------* + * vector quantization + *---------------------------------------------------------------*/ + + void vq( + float *Xq, /* (o) the quantized vector */ + int *index, /* (o) the quantization index */ + const float *CB,/* (i) the vector quantization codebook */ + float *X, /* (i) the vector to quantize */ + int n_cb, /* (i) the number of vectors in the codebook */ + int dim /* (i) the dimension of all vectors */ + ){ + int i, j; + int pos, minindex; + float dist, tmp, mindist; + + pos = 0; + mindist = FLOAT_MAX; + minindex = 0; + for (j = 0; j < n_cb; j++) { + dist = X[0] - CB[pos]; + dist *= dist; + for (i = 1; i < dim; i++) { + tmp = X[i] - CB[pos + i]; + dist += tmp*tmp; + } + + if (dist < mindist) { + mindist = dist; + minindex = j; + } + pos += dim; + } + for (i = 0; i < dim; i++) { + Xq[i] = CB[minindex*dim + i]; + } + *index = minindex; + + + +Andersen, et al. Experimental [Page 143] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + } + + /*----------------------------------------------------------------* + * split vector quantization + *---------------------------------------------------------------*/ + + void SplitVQ( + float *qX, /* (o) the quantized vector */ + int *index, /* (o) a vector of indexes for all vector + codebooks in the split */ + float *X, /* (i) the vector to quantize */ + const float *CB,/* (i) the quantizer codebook */ + int nsplit, /* the number of vector splits */ + const int *dim, /* the dimension of X and qX */ + const int *cbsize /* the number of vectors in the codebook */ + ){ + int cb_pos, X_pos, i; + + cb_pos = 0; + X_pos= 0; + for (i = 0; i < nsplit; i++) { + vq(qX + X_pos, index + i, CB + cb_pos, X + X_pos, + cbsize[i], dim[i]); + X_pos += dim[i]; + cb_pos += dim[i] * cbsize[i]; + } + } + + /*----------------------------------------------------------------* + * scalar quantization + *---------------------------------------------------------------*/ + + void sort_sq( + float *xq, /* (o) the quantized value */ + int *index, /* (o) the quantization index */ + float x, /* (i) the value to quantize */ + const float *cb,/* (i) the quantization codebook */ + int cb_size /* (i) the size of the quantization codebook */ + ){ + int i; + + if (x <= cb[0]) { + *index = 0; + *xq = cb[0]; + } else { + i = 0; + while ((x > cb[i]) && i < cb_size - 1) { + i++; + + + +Andersen, et al. Experimental [Page 144] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + } + + if (x > ((cb[i] + cb[i - 1])/2)) { + *index = i; + *xq = cb[i]; + } else { + *index = i - 1; + *xq = cb[i - 1]; + } + } + } + + /*----------------------------------------------------------------* + * check for stability of lsf coefficients + *---------------------------------------------------------------*/ + + int LSF_check( /* (o) 1 for stable lsf vectors and 0 for + nonstable ones */ + float *lsf, /* (i) a table of lsf vectors */ + int dim, /* (i) the dimension of each lsf vector */ + int NoAn /* (i) the number of lsf vectors in the + table */ + ){ + int k,n,m, Nit=2, change=0,pos; + float tmp; + static float eps=(float)0.039; /* 50 Hz */ + static float eps2=(float)0.0195; + static float maxlsf=(float)3.14; /* 4000 Hz */ + static float minlsf=(float)0.01; /* 0 Hz */ + + /* LSF separation check*/ + + for (n=0; nmaxlsf) { + lsf[pos]=maxlsf; + change=1; + } + } + } + } + + return change; + } + +A.27. hpInput.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + hpInput.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_HPINPUT_H + #define __iLBC_HPINPUT_H + + void hpInput( + float *In, /* (i) vector to filter */ + int len, /* (i) length of vector to filter */ + float *Out, /* (o) the resulting filtered vector */ + float *mem /* (i/o) the filter state */ + ); + + #endif + +A.28. hpInput.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + + +Andersen, et al. Experimental [Page 146] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + hpInput.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include "constants.h" + + /*----------------------------------------------------------------* + * Input high-pass filter + *---------------------------------------------------------------*/ + + void hpInput( + float *In, /* (i) vector to filter */ + int len, /* (i) length of vector to filter */ + float *Out, /* (o) the resulting filtered vector */ + float *mem /* (i/o) the filter state */ + ){ + int i; + float *pi, *po; + + /* all-zero section*/ + + pi = &In[0]; + po = &Out[0]; + for (i=0; i + + #include "iLBC_define.h" + #include "gainquant.h" + #include "getCBvec.h" + + /*----------------------------------------------------------------* + * Convert the codebook indexes to make the search easier + *---------------------------------------------------------------*/ + + + + +Andersen, et al. Experimental [Page 150] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + void index_conv_enc( + int *index /* (i/o) Codebook indexes */ + ){ + int k; + + for (k=1; k=108)&&(index[k]<172)) { + index[k]-=64; + } else if (index[k]>=236) { + index[k]-=128; + } else { + /* ERROR */ + } + } + } + + void index_conv_dec( + int *index /* (i/o) Codebook indexes */ + ){ + int k; + + for (k=1; k=44)&&(index[k]<108)) { + index[k]+=64; + } else if ((index[k]>=108)&&(index[k]<128)) { + index[k]+=128; + } else { + /* ERROR */ + } + } + } + + /*----------------------------------------------------------------* + * Construct decoded vector from codebook and gains. + *---------------------------------------------------------------*/ + + void iCBConstruct( + float *decvector, /* (o) Decoded vector */ + int *index, /* (i) Codebook indices */ + int *gain_index,/* (i) Gain quantization indices */ + float *mem, /* (i) Buffer for codevector construction */ + int lMem, /* (i) Length of buffer */ + int veclen, /* (i) Length of vector */ + int nStages /* (i) Number of codebook stages */ + ){ + int j,k; + + + +Andersen, et al. Experimental [Page 151] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float gain[CB_NSTAGES]; + float cbvec[SUBL]; + + /* gain de-quantization */ + + gain[0] = gaindequant(gain_index[0], 1.0, 32); + if (nStages > 1) { + gain[1] = gaindequant(gain_index[1], + (float)fabs(gain[0]), 16); + } + if (nStages > 2) { + gain[2] = gaindequant(gain_index[2], + (float)fabs(gain[1]), 8); + } + + /* codebook vector construction and construction of + total vector */ + + getCBvec(cbvec, mem, index[0], lMem, veclen); + for (j=0;j 1) { + for (k=1; k + #include + + #include "iLBC_define.h" + #include "gainquant.h" + #include "createCB.h" + #include "filter.h" + #include "constants.h" + + /*----------------------------------------------------------------* + * Search routine for codebook encoding and gain quantization. + *---------------------------------------------------------------*/ + + void iCBSearch( + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i) the encoder state structure */ + int *index, /* (o) Codebook indices */ + int *gain_index,/* (o) Gain quantization indices */ + + + +Andersen, et al. Experimental [Page 153] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float *intarget,/* (i) Target vector for encoding */ + float *mem, /* (i) Buffer for codebook construction */ + int lMem, /* (i) Length of buffer */ + int lTarget, /* (i) Length of vector */ + int nStages, /* (i) Number of codebook stages */ + float *weightDenum, /* (i) weighting filter coefficients */ + float *weightState, /* (i) weighting filter state */ + int block /* (i) the sub-block number */ + ){ + int i, j, icount, stage, best_index, range, counter; + float max_measure, gain, measure, crossDot, ftmp; + float gains[CB_NSTAGES]; + float target[SUBL]; + int base_index, sInd, eInd, base_size; + int sIndAug=0, eIndAug=0; + float buf[CB_MEML+SUBL+2*LPC_FILTERORDER]; + float invenergy[CB_EXPAND*128], energy[CB_EXPAND*128]; + float *pp, *ppi=0, *ppo=0, *ppe=0; + float cbvectors[CB_MEML]; + float tene, cene, cvec[SUBL]; + float aug_vec[SUBL]; + + memset(cvec,0,SUBL*sizeof(float)); + + /* Determine size of codebook sections */ + + base_size=lMem-lTarget+1; + + if (lTarget==SUBL) { + base_size=lMem-lTarget+1+lTarget/2; + } + + /* setup buffer for weighting */ + + memcpy(buf,weightState,sizeof(float)*LPC_FILTERORDER); + memcpy(buf+LPC_FILTERORDER,mem,lMem*sizeof(float)); + memcpy(buf+LPC_FILTERORDER+lMem,intarget,lTarget*sizeof(float)); + + /* weighting */ + + AllPoleFilter(buf+LPC_FILTERORDER, weightDenum, + lMem+lTarget, LPC_FILTERORDER); + + /* Construct the codebook and target needed */ + + memcpy(target, buf+LPC_FILTERORDER+lMem, lTarget*sizeof(float)); + + tene=0.0; + + + +Andersen, et al. Experimental [Page 154] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + for (i=0; i0.0) { + invenergy[0] = (float) 1.0 / (*ppe + EPS); + } else { + invenergy[0] = (float) 0.0; + + + +Andersen, et al. Experimental [Page 155] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + } + ppe++; + + measure=(float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot*invenergy[0]; + } + } + else { + measure = crossDot*crossDot*invenergy[0]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[0]; + + if ((measure>max_measure) && (fabs(ftmp)0.0) { + invenergy[icount] = + (float)1.0/(energy[icount]+EPS); + } else { + invenergy[icount] = (float) 0.0; + } + + + +Andersen, et al. Experimental [Page 156] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + measure=(float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot*invenergy[icount]; + } + } + else { + measure = crossDot*crossDot*invenergy[icount]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[icount]; + + if ((measure>max_measure) && (fabs(ftmp) range) { + sInd -= (eInd-range); + eInd = range; + } + } else { /* base_index >= (base_size-20) */ + + if (sInd < (base_size-20)) { + sIndAug = 20; + sInd = 0; + eInd = 0; + eIndAug = 19 + CB_RESRANGE; + + if(eIndAug > 39) { + eInd = eIndAug-39; + eIndAug = 39; + } + } else { + sIndAug = 20 + sInd - (base_size-20); + eIndAug = 39; + sInd = 0; + eInd = CB_RESRANGE - (eIndAug-sIndAug+1); + } + } + + } else { /* lTarget = 22 or 23 */ + + if (sInd < 0) { + eInd -= sInd; + + + +Andersen, et al. Experimental [Page 158] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + sInd = 0; + } + + if(eInd > range) { + sInd -= (eInd - range); + eInd = range; + } + } + } + + /* search of higher codebook section */ + + /* index search range */ + counter = sInd; + sInd += base_size; + eInd += base_size; + + + if (stage==0) { + ppe = energy+base_size; + *ppe=0.0; + + pp=cbvectors+lMem-lTarget; + for (j=0; j0.0) { + invenergy[icount] =(float)1.0/(energy[icount]+EPS); + } else { + invenergy[icount] =(float)0.0; + } + + if (stage==0) { + + measure=(float)-10000000.0; + + if (crossDot > 0.0) { + measure = crossDot*crossDot* + invenergy[icount]; + } + } + else { + measure = crossDot*crossDot*invenergy[icount]; + } + + /* check if measure is better */ + ftmp = crossDot*invenergy[icount]; + + if ((measure>max_measure) && (fabs(ftmp)CB_MAXGAIN) { + gain = (float)CB_MAXGAIN; + } + gain = gainquant(gain, 1.0, 32, &gain_index[stage]); + } + else { + if (stage==1) { + gain = gainquant(gain, (float)fabs(gains[stage-1]), + 16, &gain_index[stage]); + } else { + gain = gainquant(gain, (float)fabs(gains[stage-1]), + 8, &gain_index[stage]); + } + } + + /* Extract the best (according to measure) + codebook vector */ + + if (lTarget==(STATE_LEN-iLBCenc_inst->state_short_len)) { + + if (index[stage] + #include + + #include "helpfun.h" + #include "lsf.h" + #include "iLBC_define.h" + #include "constants.h" + + /*---------------------------------------------------------------* + * interpolation of lsf coefficients for the decoder + *--------------------------------------------------------------*/ + + void LSFinterpolate2a_dec( + float *a, /* (o) lpc coefficients for a sub-frame */ + float *lsf1, /* (i) first lsf coefficient vector */ + float *lsf2, /* (i) second lsf coefficient vector */ + float coef, /* (i) interpolation weight */ + int length /* (i) length of lsf vectors */ + ){ + float lsftmp[LPC_FILTERORDER]; + + interpolate(lsftmp, lsf1, lsf2, coef, length); + lsf2a(a, lsftmp); + } + + /*---------------------------------------------------------------* + * obtain dequantized lsf coefficients from quantization index + *--------------------------------------------------------------*/ + + void SimplelsfDEQ( + float *lsfdeq, /* (o) dequantized lsf coefficients */ + int *index, /* (i) quantization index */ + int lpc_n /* (i) number of LPCs */ + ){ + int i, j, pos, cb_pos; + + + +Andersen, et al. Experimental [Page 164] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* decode first LSF */ + + pos = 0; + cb_pos = 0; + for (i = 0; i < LSF_NSPLIT; i++) { + for (j = 0; j < dim_lsfCbTbl[i]; j++) { + lsfdeq[pos + j] = lsfCbTbl[cb_pos + + (long)(index[i])*dim_lsfCbTbl[i] + j]; + } + pos += dim_lsfCbTbl[i]; + cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i]; + } + + if (lpc_n>1) { + + /* decode last LSF */ + + pos = 0; + cb_pos = 0; + for (i = 0; i < LSF_NSPLIT; i++) { + for (j = 0; j < dim_lsfCbTbl[i]; j++) { + lsfdeq[LPC_FILTERORDER + pos + j] = + lsfCbTbl[cb_pos + + (long)(index[LSF_NSPLIT + i])* + dim_lsfCbTbl[i] + j]; + } + pos += dim_lsfCbTbl[i]; + cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i]; + } + } + } + + /*----------------------------------------------------------------* + * obtain synthesis and weighting filters form lsf coefficients + *---------------------------------------------------------------*/ + + void DecoderInterpolateLSF( + float *syntdenum, /* (o) synthesis filter coefficients */ + float *weightdenum, /* (o) weighting denumerator + coefficients */ + float *lsfdeq, /* (i) dequantized lsf coefficients */ + int length, /* (i) length of lsf coefficient vector */ + iLBC_Dec_Inst_t *iLBCdec_inst + /* (i) the decoder state structure */ + ){ + int i, pos, lp_length; + float lp[LPC_FILTERORDER + 1], *lsfdeq2; + + + + +Andersen, et al. Experimental [Page 165] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + lsfdeq2 = lsfdeq + length; + lp_length = length + 1; + + if (iLBCdec_inst->mode==30) { + /* sub-frame 1: Interpolation between old and first */ + + LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq, + lsf_weightTbl_30ms[0], length); + memcpy(syntdenum,lp,lp_length*sizeof(float)); + bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, + lp_length); + + /* sub-frames 2 to 6: interpolation between first + and last LSF */ + + pos = lp_length; + for (i = 1; i < 6; i++) { + LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2, + lsf_weightTbl_30ms[i], length); + memcpy(syntdenum + pos,lp,lp_length*sizeof(float)); + bwexpand(weightdenum + pos, lp, + LPC_CHIRP_WEIGHTDENUM, lp_length); + pos += lp_length; + } + } + else { + pos = 0; + for (i = 0; i < iLBCdec_inst->nsub; i++) { + LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, + lsfdeq, lsf_weightTbl_20ms[i], length); + memcpy(syntdenum+pos,lp,lp_length*sizeof(float)); + bwexpand(weightdenum+pos, lp, LPC_CHIRP_WEIGHTDENUM, + lp_length); + pos += lp_length; + } + } + + /* update memory */ + + if (iLBCdec_inst->mode==30) + memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2, + length*sizeof(float)); + else + memcpy(iLBCdec_inst->lsfdeqold, lsfdeq, + length*sizeof(float)); + + } + + + + +Andersen, et al. Experimental [Page 166] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + +A.37. LPCencode.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + LPCencode.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_LPCENCOD_H + #define __iLBC_LPCENCOD_H + + void LPCencode( + float *syntdenum, /* (i/o) synthesis filter coefficients + before/after encoding */ + float *weightdenum, /* (i/o) weighting denumerator coefficients + before/after encoding */ + int *lsf_index, /* (o) lsf quantization index */ + float *data, /* (i) lsf coefficients to quantize */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ); + + #endif + +A.38. LPCencode.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + LPCencode.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + + #include "iLBC_define.h" + #include "helpfun.h" + #include "lsf.h" + #include "constants.h" + + + +Andersen, et al. Experimental [Page 167] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /*----------------------------------------------------------------* + * lpc analysis (subrutine to LPCencode) + *---------------------------------------------------------------*/ + + void SimpleAnalysis( + float *lsf, /* (o) lsf coefficients */ + float *data, /* (i) new data vector */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ){ + int k, is; + float temp[BLOCKL_MAX], lp[LPC_FILTERORDER + 1]; + float lp2[LPC_FILTERORDER + 1]; + float r[LPC_FILTERORDER + 1]; + + is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl; + memcpy(iLBCenc_inst->lpc_buffer+is,data, + iLBCenc_inst->blockl*sizeof(float)); + + /* No lookahead, last window is asymmetric */ + + for (k = 0; k < iLBCenc_inst->lpc_n; k++) { + + is = LPC_LOOKBACK; + + if (k < (iLBCenc_inst->lpc_n - 1)) { + window(temp, lpc_winTbl, + iLBCenc_inst->lpc_buffer, BLOCKL_MAX); + } else { + window(temp, lpc_asymwinTbl, + iLBCenc_inst->lpc_buffer + is, BLOCKL_MAX); + } + + autocorr(r, temp, BLOCKL_MAX, LPC_FILTERORDER); + window(r, r, lpc_lagwinTbl, LPC_FILTERORDER + 1); + + levdurb(lp, temp, r, LPC_FILTERORDER); + bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, LPC_FILTERORDER+1); + + a2lsf(lsf + k*LPC_FILTERORDER, lp2); + } + is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl; + memmove(iLBCenc_inst->lpc_buffer, + iLBCenc_inst->lpc_buffer+LPC_LOOKBACK+BLOCKL_MAX-is, + is*sizeof(float)); + } + + /*----------------------------------------------------------------* + + + +Andersen, et al. Experimental [Page 168] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + * lsf interpolator and conversion from lsf to a coefficients + * (subrutine to SimpleInterpolateLSF) + *---------------------------------------------------------------*/ + + void LSFinterpolate2a_enc( + float *a, /* (o) lpc coefficients */ + float *lsf1,/* (i) first set of lsf coefficients */ + float *lsf2,/* (i) second set of lsf coefficients */ + float coef, /* (i) weighting coefficient to use between + lsf1 and lsf2 */ + long length /* (i) length of coefficient vectors */ + ){ + float lsftmp[LPC_FILTERORDER]; + + interpolate(lsftmp, lsf1, lsf2, coef, length); + lsf2a(a, lsftmp); + } + + /*----------------------------------------------------------------* + * lsf interpolator (subrutine to LPCencode) + *---------------------------------------------------------------*/ + + void SimpleInterpolateLSF( + float *syntdenum, /* (o) the synthesis filter denominator + resulting from the quantized + interpolated lsf */ + float *weightdenum, /* (o) the weighting filter denominator + resulting from the unquantized + interpolated lsf */ + float *lsf, /* (i) the unquantized lsf coefficients */ + float *lsfdeq, /* (i) the dequantized lsf coefficients */ + float *lsfold, /* (i) the unquantized lsf coefficients of + the previous signal frame */ + float *lsfdeqold, /* (i) the dequantized lsf coefficients of + the previous signal frame */ + int length, /* (i) should equate LPC_FILTERORDER */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ){ + int i, pos, lp_length; + float lp[LPC_FILTERORDER + 1], *lsf2, *lsfdeq2; + + lsf2 = lsf + length; + lsfdeq2 = lsfdeq + length; + lp_length = length + 1; + + if (iLBCenc_inst->mode==30) { + /* sub-frame 1: Interpolation between old and first + + + +Andersen, et al. Experimental [Page 169] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + set of lsf coefficients */ + + LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, + lsf_weightTbl_30ms[0], length); + memcpy(syntdenum,lp,lp_length*sizeof(float)); + LSFinterpolate2a_enc(lp, lsfold, lsf, + lsf_weightTbl_30ms[0], length); + bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length); + + /* sub-frame 2 to 6: Interpolation between first + and second set of lsf coefficients */ + + pos = lp_length; + for (i = 1; i < iLBCenc_inst->nsub; i++) { + LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2, + lsf_weightTbl_30ms[i], length); + memcpy(syntdenum + pos,lp,lp_length*sizeof(float)); + + LSFinterpolate2a_enc(lp, lsf, lsf2, + lsf_weightTbl_30ms[i], length); + bwexpand(weightdenum + pos, lp, + LPC_CHIRP_WEIGHTDENUM, lp_length); + pos += lp_length; + } + } + else { + pos = 0; + for (i = 0; i < iLBCenc_inst->nsub; i++) { + LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, + lsf_weightTbl_20ms[i], length); + memcpy(syntdenum+pos,lp,lp_length*sizeof(float)); + LSFinterpolate2a_enc(lp, lsfold, lsf, + lsf_weightTbl_20ms[i], length); + bwexpand(weightdenum+pos, lp, + LPC_CHIRP_WEIGHTDENUM, lp_length); + pos += lp_length; + } + } + + /* update memory */ + + if (iLBCenc_inst->mode==30) { + memcpy(lsfold, lsf2, length*sizeof(float)); + memcpy(lsfdeqold, lsfdeq2, length*sizeof(float)); + } + else { + memcpy(lsfold, lsf, length*sizeof(float)); + memcpy(lsfdeqold, lsfdeq, length*sizeof(float)); + + + +Andersen, et al. Experimental [Page 170] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + } + } + + /*----------------------------------------------------------------* + * lsf quantizer (subrutine to LPCencode) + *---------------------------------------------------------------*/ + + void SimplelsfQ( + float *lsfdeq, /* (o) dequantized lsf coefficients + (dimension FILTERORDER) */ + int *index, /* (o) quantization index */ + float *lsf, /* (i) the lsf coefficient vector to be + quantized (dimension FILTERORDER ) */ + int lpc_n /* (i) number of lsf sets to quantize */ + ){ + /* Quantize first LSF with memoryless split VQ */ + SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT, + dim_lsfCbTbl, size_lsfCbTbl); + + if (lpc_n==2) { + /* Quantize second LSF with memoryless split VQ */ + SplitVQ(lsfdeq + LPC_FILTERORDER, index + LSF_NSPLIT, + lsf + LPC_FILTERORDER, lsfCbTbl, LSF_NSPLIT, + dim_lsfCbTbl, size_lsfCbTbl); + } + } + + /*----------------------------------------------------------------* + * lpc encoder + *---------------------------------------------------------------*/ + + void LPCencode( + float *syntdenum, /* (i/o) synthesis filter coefficients + before/after encoding */ + float *weightdenum, /* (i/o) weighting denumerator + coefficients before/after + encoding */ + int *lsf_index, /* (o) lsf quantization index */ + float *data, /* (i) lsf coefficients to quantize */ + iLBC_Enc_Inst_t *iLBCenc_inst + /* (i/o) the encoder state structure */ + ){ + float lsf[LPC_FILTERORDER * LPC_N_MAX]; + float lsfdeq[LPC_FILTERORDER * LPC_N_MAX]; + int change=0; + + SimpleAnalysis(lsf, data, iLBCenc_inst); + SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n); + + + +Andersen, et al. Experimental [Page 171] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + change=LSF_check(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n); + SimpleInterpolateLSF(syntdenum, weightdenum, + lsf, lsfdeq, iLBCenc_inst->lsfold, + iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst); + } + +A.39. lsf.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + lsf.h + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_LSF_H + #define __iLBC_LSF_H + + void a2lsf( + float *freq,/* (o) lsf coefficients */ + float *a /* (i) lpc coefficients */ + ); + + void lsf2a( + float *a_coef, /* (o) lpc coefficients */ + float *freq /* (i) lsf coefficients */ + ); + + #endif + +A.40. lsf.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + lsf.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + + + +Andersen, et al. Experimental [Page 172] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + #include + + #include "iLBC_define.h" + + /*----------------------------------------------------------------* + * conversion from lpc coefficients to lsf coefficients + *---------------------------------------------------------------*/ + + void a2lsf( + float *freq,/* (o) lsf coefficients */ + float *a /* (i) lpc coefficients */ + ){ + float steps[LSF_NUMBER_OF_STEPS] = + {(float)0.00635, (float)0.003175, (float)0.0015875, + (float)0.00079375}; + float step; + int step_idx; + int lsp_index; + float p[LPC_HALFORDER]; + float q[LPC_HALFORDER]; + float p_pre[LPC_HALFORDER]; + float q_pre[LPC_HALFORDER]; + float old_p, old_q, *old; + float *pq_coef; + float omega, old_omega; + int i; + float hlp, hlp1, hlp2, hlp3, hlp4, hlp5; + + for (i=0; i= 0.5)){ + + if (step_idx == (LSF_NUMBER_OF_STEPS - 1)){ + + if (fabs(hlp5) >= fabs(*old)) { + freq[lsp_index] = omega - step; + } else { + freq[lsp_index] = omega; + } + + + +Andersen, et al. Experimental [Page 174] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + + + if ((*old) >= 0.0){ + *old = (float)-1.0 * FLOAT_MAX; + } else { + *old = FLOAT_MAX; + } + + omega = old_omega; + step_idx = 0; + + step_idx = LSF_NUMBER_OF_STEPS; + } else { + + if (step_idx == 0) { + old_omega = omega; + } + + step_idx++; + omega -= steps[step_idx]; + + /* Go back one grid step */ + + step = steps[step_idx]; + } + } else { + + /* increment omega until they are of different sign, + and we know there is at least one root between omega + and old_omega */ + *old = hlp5; + omega += step; + } + } + } + + for (i = 0; i= 0.5)){ + + + if (freq[0] <= 0.0) { + freq[0] = (float)0.022; + } + + + if (freq[LPC_FILTERORDER - 1] >= 0.5) { + freq[LPC_FILTERORDER - 1] = (float)0.499; + } + + hlp = (freq[LPC_FILTERORDER - 1] - freq[0]) / + (float) (LPC_FILTERORDER - 1); + + for (i=1; i + #include + + #include "iLBC_define.h" + #include "constants.h" + #include "helpfun.h" + #include "string.h" + + /*----------------------------------------------------------------* + * splitting an integer into first most significant bits and + * remaining least significant bits + *---------------------------------------------------------------*/ + + void packsplit( + int *index, /* (i) the value to split */ + int *firstpart, /* (o) the value specified by most + significant bits */ + int *rest, /* (o) the value specified by least + significant bits */ + + + +Andersen, et al. Experimental [Page 179] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + int bitno_firstpart, /* (i) number of bits in most + significant part */ + int bitno_total /* (i) number of bits in full range + of value */ + ){ + int bitno_rest = bitno_total-bitno_firstpart; + + *firstpart = *index>>(bitno_rest); + *rest = *index-(*firstpart<<(bitno_rest)); + } + + /*----------------------------------------------------------------* + * combining a value corresponding to msb's with a value + * corresponding to lsb's + *---------------------------------------------------------------*/ + + void packcombine( + int *index, /* (i/o) the msb value in the + combined value out */ + int rest, /* (i) the lsb value */ + int bitno_rest /* (i) the number of bits in the + lsb part */ + ){ + *index = *index<0) { + + /* Jump to the next byte if end of this byte is reached*/ + + if (*pos==8) { + *pos=0; + (*bitstream)++; + **bitstream=0; + } + + posLeft=8-(*pos); + + /* Insert index into the bitstream */ + + if (bitno <= posLeft) { + **bitstream |= (unsigned char)(index<<(posLeft-bitno)); + *pos+=bitno; + bitno=0; + } else { + **bitstream |= (unsigned char)(index>>(bitno-posLeft)); + + *pos=8; + index-=((index>>(bitno-posLeft))<<(bitno-posLeft)); + + bitno-=posLeft; + } + } + } + + /*----------------------------------------------------------------* + * unpacking of bits from bitstream, i.e., vector of bytes + *---------------------------------------------------------------*/ + + void unpack( + unsigned char **bitstream, /* (i/o) on entrance pointer to + place in bitstream to + unpack new data from, on + exit pointer to place in + bitstream to unpack future + data from */ + int *index, /* (o) resulting value */ + int bitno, /* (i) number of bits used to + represent the value */ + int *pos /* (i/o) read position in the + current byte */ + + + +Andersen, et al. Experimental [Page 181] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + ){ + int BitsLeft; + + *index=0; + + while (bitno>0) { + + /* move forward in bitstream when the end of the + byte is reached */ + + if (*pos==8) { + *pos=0; + (*bitstream)++; + } + + BitsLeft=8-(*pos); + + /* Extract bits to index */ + + if (BitsLeft>=bitno) { + *index+=((((**bitstream)<<(*pos)) & 0xFF)>>(8-bitno)); + + *pos+=bitno; + bitno=0; + } else { + + if ((8-bitno)>0) { + *index+=((((**bitstream)<<(*pos)) & 0xFF)>> + (8-bitno)); + *pos=8; + } else { + *index+=(((int)(((**bitstream)<<(*pos)) & 0xFF))<< + (bitno-8)); + *pos=8; + } + bitno-=BitsLeft; + } + } + } + +A.43. StateConstructW.h + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + StateConstructW.h + + + + +Andersen, et al. Experimental [Page 182] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #ifndef __iLBC_STATECONSTRUCTW_H + #define __iLBC_STATECONSTRUCTW_H + + void StateConstructW( + int idxForMax, /* (i) 6-bit index for the quantization of + max amplitude */ + int *idxVec, /* (i) vector of quantization indexes */ + float *syntDenum, /* (i) synthesis filter denumerator */ + float *out, /* (o) the decoded state vector */ + int len /* (i) length of a state vector */ + ); + + #endif + +A.44. StateConstructW.c + + /****************************************************************** + + iLBC Speech Coder ANSI-C Source Code + + StateConstructW.c + + Copyright (C) The Internet Society (2004). + All Rights Reserved. + + ******************************************************************/ + + #include + #include + + #include "iLBC_define.h" + #include "constants.h" + #include "filter.h" + + /*----------------------------------------------------------------* + * decoding of the start state + *---------------------------------------------------------------*/ + + void StateConstructW( + int idxForMax, /* (i) 6-bit index for the quantization of + max amplitude */ + int *idxVec, /* (i) vector of quantization indexes */ + float *syntDenum, /* (i) synthesis filter denumerator */ + + + +Andersen, et al. Experimental [Page 183] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + float *out, /* (o) the decoded state vector */ + int len /* (i) length of a state vector */ + ){ + float maxVal, tmpbuf[LPC_FILTERORDER+2*STATE_LEN], *tmp, + numerator[LPC_FILTERORDER+1]; + float foutbuf[LPC_FILTERORDER+2*STATE_LEN], *fout; + int k,tmpi; + + /* decoding of the maximum value */ + + maxVal = state_frgqTbl[idxForMax]; + maxVal = (float)pow(10,maxVal)/(float)4.5; + + /* initialization of buffers and coefficients */ + + memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float)); + memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float)); + for (k=0; k + #include + + #include "iLBC_define.h" + #include "constants.h" + #include "filter.h" + #include "helpfun.h" + + /*----------------------------------------------------------------* + * predictive noise shaping encoding of scaled start state + * (subrutine for StateSearchW) + *---------------------------------------------------------------*/ + + void AbsQuantW( + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i) Encoder instance */ + float *in, /* (i) vector to encode */ + float *syntDenum, /* (i) denominator of synthesis filter */ + float *weightDenum, /* (i) denominator of weighting filter */ + int *out, /* (o) vector of quantizer indexes */ + int len, /* (i) length of vector to encode and + vector of quantizer indexes */ + int state_first /* (i) position of start state in the + 80 vec */ + ){ + float *syntOut; + float syntOutBuf[LPC_FILTERORDER+STATE_SHORT_LEN_30MS]; + float toQ, xq; + int n; + int index; + + /* initialization of buffer for filtering */ + + memset(syntOutBuf, 0, LPC_FILTERORDER*sizeof(float)); + + + + +Andersen, et al. Experimental [Page 186] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + /* initialization of pointer for filtering */ + + syntOut = &syntOutBuf[LPC_FILTERORDER]; + + /* synthesis and weighting filters on input */ + + if (state_first) { + AllPoleFilter (in, weightDenum, SUBL, LPC_FILTERORDER); + } else { + AllPoleFilter (in, weightDenum, + iLBCenc_inst->state_short_len-SUBL, + LPC_FILTERORDER); + } + + /* encoding loop */ + + for (n=0; nstate_short_len-SUBL))) { + syntDenum += (LPC_FILTERORDER+1); + weightDenum += (LPC_FILTERORDER+1); + + /* synthesis and weighting filters on input */ + AllPoleFilter (&in[n], weightDenum, len-n, + LPC_FILTERORDER); + + } + + /* prediction of synthesized and weighted input */ + + syntOut[n] = 0.0; + AllPoleFilter (&syntOut[n], weightDenum, 1, + LPC_FILTERORDER); + + /* quantization */ + + toQ = in[n]-syntOut[n]; + + + +Andersen, et al. Experimental [Page 187] + +RFC 3951 Internet Low Bit Rate Codec December 2004 + + + sort_sq(&xq, &index, toQ, state_sq3Tbl, 8); + out[n]=index; + syntOut[n] = state_sq3Tbl[out[n]]; + + /* update of the prediction filter */ + + AllPoleFilter(&syntOut[n], weightDenum, 1, + LPC_FILTERORDER); + } + } + + /*----------------------------------------------------------------* + * encoding of start state + *---------------------------------------------------------------*/ + + void StateSearchW( + iLBC_Enc_Inst_t *iLBCenc_inst, + /* (i) Encoder instance */ + float *residual,/* (i) target residual vector */ + float *syntDenum, /* (i) lpc synthesis filter */ + float *weightDenum, /* (i) weighting filter denuminator */ + int *idxForMax, /* (o) quantizer index for maximum + amplitude */ + int *idxVec, /* (o) vector of quantization indexes */ + int len, /* (i) length of all vectors */ + int state_first /* (i) position of start state in the + 80 vec */ + ){ + float dtmp, maxVal; + float tmpbuf[LPC_FILTERORDER+2*STATE_SHORT_LEN_30MS]; + float *tmp, numerator[1+LPC_FILTERORDER]; + float foutbuf[LPC_FILTERORDER+2*STATE_SHORT_LEN_30MS], *fout; + int k; + float qmax, scal; + + /* initialization of buffers and filter coefficients */ + + memset(tmpbuf, 0, LPC_FILTERORDER*sizeof(float)); + memset(foutbuf, 0, LPC_FILTERORDER*sizeof(float)); + for (k=0; k maxVal*maxVal){ + maxVal = fout[k]; + } + } + maxVal=(float)fabs(maxVal); + + /* encoding of the maximum amplitude value */ + + if (maxVal < 10.0) { + maxVal = 10.0; + } + maxVal = (float)log10(maxVal); + sort_sq(&dtmp, idxForMax, maxVal, state_frgqTbl, 64); + + /* decoding of the maximum amplitude representation value, + and corresponding scaling of start state */ + + maxVal=state_frgqTbl[*idxForMax]; + qmax = (float)pow(10,maxVal); + scal = (float)(4.5)/qmax; + for (k=0; ksubclass); return -1; } - if (f->datalen % 50) { - ast_log(LOG_WARNING, "Invalid data length, %d, should be multiple of 50\n", f->datalen); + if (f->datalen % 38) { + ast_log(LOG_WARNING, "Invalid data length, %d, should be multiple of 38\n", f->datalen); return -1; } if ((res = fwrite(f->data, 1, f->datalen, fs->f)) != f->datalen) { - ast_log(LOG_WARNING, "Bad write (%d/50): %s\n", res, strerror(errno)); + ast_log(LOG_WARNING, "Bad write (%d/38): %s\n", res, strerror(errno)); return -1; } return 0; diff --git a/asterisk/include/asterisk/frame.h b/asterisk/include/asterisk/frame.h index 30686efd..c41ffb1d 100644 --- a/asterisk/include/asterisk/frame.h +++ b/asterisk/include/asterisk/frame.h @@ -553,7 +553,7 @@ struct ast_frame *ast_frame_enqueue(struct ast_frame *head, struct ast_frame *f, /*! \brief Gets duration in ms of interpolation frame for a format */ static inline int ast_codec_interp_len(int format) { - return (format == AST_FORMAT_ILBC) ? 30 : 20; + return 20; } /*! diff --git a/asterisk/main/frame.c b/asterisk/main/frame.c index 04b006a0..6476c6f3 100644 --- a/asterisk/main/frame.c +++ b/asterisk/main/frame.c @@ -116,7 +116,7 @@ static struct ast_format_list AST_FORMAT_LIST[] = { /*!< Bit number: comment { 1, AST_FORMAT_LPC10, "lpc10", "LPC10", 7, 20, 20, 20, 20 }, /*!< 8: codec_lpc10.c */ { 1, AST_FORMAT_G729A, "g729", "G.729A", 10, 10, 230, 10, 20, AST_SMOOTHER_FLAG_G729 }, /*!< 9: Binary commercial distribution */ { 1, AST_FORMAT_SPEEX, "speex", "SpeeX", 10, 10, 60, 10, 20 }, /*!< 10: codec_speex.c */ - { 1, AST_FORMAT_ILBC, "ilbc", "iLBC", 50, 30, 30, 30, 30 }, /*!< 11: codec_ilbc.c */ /* inc=30ms - workaround */ + { 1, AST_FORMAT_ILBC, "ilbc", "iLBC", 38, 20, 20, 20, 20 }, /*!< 11: codec_ilbc.c */ /* inc=20ms - workaround */ { 1, AST_FORMAT_G726_AAL2, "g726aal2", "G.726 AAL2", 40, 10, 300, 10, 20 }, /*!< 12: codec_g726.c */ { 1, AST_FORMAT_G722, "g722", "G722"}, /*!< 13 */ { 0, 0, "nothing", "undefined" }, @@ -1487,7 +1487,7 @@ int ast_codec_get_samples(struct ast_frame *f) samples = g723_samples(f->data, f->datalen); break; case AST_FORMAT_ILBC: - samples = 240 * (f->datalen / 50); + samples = 160 * (f->datalen / 38); break; case AST_FORMAT_GSM: samples = 160 * (f->datalen / 33); @@ -1526,7 +1526,7 @@ int ast_codec_get_len(int format, int samples) /* XXX Still need speex, g723, and lpc10 XXX */ switch(format) { case AST_FORMAT_ILBC: - len = (samples / 240) * 50; + len = (samples / 160) * 38; break; case AST_FORMAT_GSM: len = (samples / 160) * 33; diff --git a/asterisk/menuselect.makeopts b/asterisk/menuselect.makeopts index 8bb5652f..ae6030b6 100644 --- a/asterisk/menuselect.makeopts +++ b/asterisk/menuselect.makeopts @@ -1,7 +1,7 @@ MENUSELECT_APPS=app_ivrdemo app_osplookup app_skel MENUSELECT_CDR=cdr_odbc cdr_pgsql cdr_radius cdr_sqlite cdr_tds MENUSELECT_CHANNELS=chan_alsa chan_features chan_gtalk chan_h323 chan_mgcp chan_misdn chan_nbs chan_oss chan_phone chan_skinny chan_vpb -MENUSELECT_CODECS=codec_ilbc codec_lpc10 codec_speex +MENUSELECT_CODECS=codec_lpc10 codec_speex MENUSELECT_FORMATS=format_ogg_vorbis MENUSELECT_FUNCS=func_curl func_odbc MENUSELECT_PBX=pbx_gtkconsole From 7b6035314e5fd58f93aa63337d40985dad7b21ec Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Tue, 13 Feb 2018 15:14:57 -0500 Subject: [PATCH 33/96] move pocsag to allstar directories --- asterisk/{channels => allstar}/pocsag.c | 2 +- asterisk/channels/chan_simpleusb.c | 6 +++--- asterisk/channels/chan_voter.c | 6 +++--- asterisk/{channels => include/allstar}/pocsag.h | 0 4 files changed, 7 insertions(+), 7 deletions(-) rename asterisk/{channels => allstar}/pocsag.c (99%) rename asterisk/{channels => include/allstar}/pocsag.h (100%) diff --git a/asterisk/channels/pocsag.c b/asterisk/allstar/pocsag.c similarity index 99% rename from asterisk/channels/pocsag.c rename to asterisk/allstar/pocsag.c index 04b3980b..c86f3cdd 100644 --- a/asterisk/channels/pocsag.c +++ b/asterisk/allstar/pocsag.c @@ -22,7 +22,7 @@ #include #include #include -#include "pocsag.h" +#include "allstar/pocsag.h" /* String values for numeric paging */ static char nstr[] = "0123456789*U -()"; diff --git a/asterisk/channels/chan_simpleusb.c b/asterisk/channels/chan_simpleusb.c index 85a3bed7..41495686 100644 --- a/asterisk/channels/chan_simpleusb.c +++ b/asterisk/channels/chan_simpleusb.c @@ -35,10 +35,10 @@ /* * Please change this revision number when you make a edit - * use the simple format MMDDYY + * use the simple format YYMMDD */ -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180213 $") // ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") #include @@ -60,7 +60,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") #include #include -#include "pocsag.c" +#include "../allstar/pocsag.c" #define DEBUG_CAPTURES 1 diff --git a/asterisk/channels/chan_voter.c b/asterisk/channels/chan_voter.c index 1675d2d9..60cae77e 100644 --- a/asterisk/channels/chan_voter.c +++ b/asterisk/channels/chan_voter.c @@ -210,10 +210,10 @@ Obviously, it is not valid to use *ANY* of the duplex=3 modes in a voted and/or /* * Please change this revision number when you make a edit - * use the simple format MMDDYY + * use the simple format YYMMDD */ -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 180213 $") // ASTERISK_FILE_VERSION(__FILE__, "$"ASTERISK_VERSION" $") @@ -255,7 +255,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 011218 $") #include "asterisk/manager.h" -#include "pocsag.c" +#include "../allstar/pocsag.c" /* Un-comment this if you wish Digital milliwatt output rather then real audio when transmitting (for debugging only) */ diff --git a/asterisk/channels/pocsag.h b/asterisk/include/allstar/pocsag.h similarity index 100% rename from asterisk/channels/pocsag.h rename to asterisk/include/allstar/pocsag.h From c11177690c748b5942e41451a448aa5cef107a5c Mon Sep 17 00:00:00 2001 From: Steve N4IRS Date: Wed, 14 Feb 2018 09:20:26 -0500 Subject: [PATCH 34/96] Add ASL config files to samples --- asterisk/configs/asterisk.conf.sample | 44 + asterisk/configs/beagle.conf.sample | 41 +- asterisk/configs/dnsmgr.conf.sample | 8 +- asterisk/configs/dundi.conf.sample | 232 ---- asterisk/configs/echolink.conf.sample | 46 + asterisk/configs/extensions.conf.sample | 753 +++--------- asterisk/configs/features.conf.sample | 87 -- asterisk/configs/gps.conf.sample | 138 +-- asterisk/configs/iax.conf.sample | 521 ++------ asterisk/configs/indications.conf.sample | 745 ++---------- asterisk/configs/logger.conf.sample | 52 - asterisk/configs/manager.conf.sample | 101 +- asterisk/configs/modules.conf.sample | 237 +++- asterisk/configs/pi-dsp.conf.sample | 167 +++ asterisk/configs/pi-nodsp.conf.sample | 79 ++ asterisk/configs/pi.conf.sample | 79 ++ asterisk/configs/pi_tune_1.conf.sample | 0 asterisk/configs/pi_tune_2.conf.sample | 0 asterisk/configs/rpt.conf.sample | 1080 +++++++++-------- asterisk/configs/savenode.conf.sample | 5 + asterisk/configs/simpleusb.conf.sample | 63 + .../simpleusb_tune_usb_1999.conf.sample | 0 asterisk/configs/sip.conf.sample | 692 +---------- asterisk/configs/tlb.conf.sample | 12 + asterisk/configs/usbradio.conf.sample | 200 +-- .../usbradio_tune_usb_1999.conf.sample | 0 asterisk/configs/voter.conf.sample | 43 + 27 files changed, 1880 insertions(+), 3545 deletions(-) create mode 100644 asterisk/configs/asterisk.conf.sample create mode 100644 asterisk/configs/echolink.conf.sample create mode 100644 asterisk/configs/pi-dsp.conf.sample create mode 100644 asterisk/configs/pi-nodsp.conf.sample create mode 100644 asterisk/configs/pi.conf.sample create mode 100644 asterisk/configs/pi_tune_1.conf.sample create mode 100644 asterisk/configs/pi_tune_2.conf.sample create mode 100644 asterisk/configs/savenode.conf.sample create mode 100644 asterisk/configs/simpleusb.conf.sample create mode 100644 asterisk/configs/simpleusb_tune_usb_1999.conf.sample create mode 100644 asterisk/configs/tlb.conf.sample create mode 100644 asterisk/configs/usbradio_tune_usb_1999.conf.sample create mode 100644 asterisk/configs/voter.conf.sample diff --git a/asterisk/configs/asterisk.conf.sample b/asterisk/configs/asterisk.conf.sample new file mode 100644 index 00000000..a04983ae --- /dev/null +++ b/asterisk/configs/asterisk.conf.sample @@ -0,0 +1,44 @@ +[directories] +astetcdir => /etc/asterisk +astmoddir => /usr/lib/asterisk/modules +astvarlibdir => /var/lib/asterisk +astdatadir => /var/lib/asterisk +astagidir => /var/lib/asterisk/agi-bin +astspooldir => /var/spool/asterisk +astrundir => /var/run +astlogdir => /var/log/asterisk + +[options] +languageprefix = yes ; Use the new sound prefix path syntax +;verbose = 3 +;debug = 3 +;alwaysfork = yes ; same as -F at startup +;nofork = yes ; same as -f at startup +;quiet = yes ; same as -q at startup +;timestamp = yes ; same as -T at startup +;execincludes = yes ; support #exec in config files +;console = yes ; Run as console (same as -c at startup) +;highpriority = yes ; Run realtime priority (same as -p at startup) +;initcrypto = yes ; Initialize crypto keys (same as -i at startup) +;nocolor = yes ; Disable console colors +;dontwarn = yes ; Disable some warnings +;dumpcore = yes ; Dump core on crash (same as -g at startup) +;internal_timing = yes +;systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues +;maxcalls = 10 ; Maximum amount of calls allowed +;maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit +;cache_record_files = yes ; Cache recorded sound files to another directory during recording +;record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files) +;transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded +;transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated +;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly +;runuser = asterisk ; The user to run as +;rungroup = asterisk ; The group to run as +;dahdichanname = yes ; Channels created by chan_dahdi will be called 'DAHDI', otherwise 'Zap' + +; Changing the following lines may compromise your security. +;[files] +;astctlpermissions = 0660 +;astctlowner = root +;astctlgroup = apache +;astctl = asterisk.ctl diff --git a/asterisk/configs/beagle.conf.sample b/asterisk/configs/beagle.conf.sample index a6a34d4b..8672c1c7 100644 --- a/asterisk/configs/beagle.conf.sample +++ b/asterisk/configs/beagle.conf.sample @@ -1,29 +1,18 @@ -; -; chan_beagle.c configuration file -; +[general] -[ch0] ; left channel - ; this starts the definition block for a device +[1] +carrierfrom = hwinvert +ctcssfrom = hwinvert +invertptt = 0 +duplex = 1 +rxondelay = 0 +eeprom = 0 - -carrierfrom=hw ; Carrier Detect Source - ; Options - no,hw,hwinvert - ; no - no carrier detection at all - ; hw - via GPIO COR connection - ; hwinvert - same as above but inverted polarity. - -ctcssfrom=dsp ; CTCSS Decoder Source - ; Options - no,hw,hwinvert - ; no - no carrier detection at all - ; hw - via GPIO CTCSS connection - ; hwinvert - same as above but inverted polarity. - -invertptt=0 ; Invert PTT - ; 0 = ground to transmit, 1 = open to transmit - ; This is the collector lead of the 2N4401 transistor - ; on the modified usb sound adapter. - -duplex=0 ; Connected Radio Device Duplex Capability - ; 0 = Simplex (PTT / Release to Listen) - ; 1 = Duplex (simultaneous Tx and Rx) +[2] +carrierfrom = hwinvert +ctcssfrom = hwinvert +invertptt = 0 +duplex = 1 +rxondelay = 0 +eeprom = 0 diff --git a/asterisk/configs/dnsmgr.conf.sample b/asterisk/configs/dnsmgr.conf.sample index e34dbcf0..31965a8f 100644 --- a/asterisk/configs/dnsmgr.conf.sample +++ b/asterisk/configs/dnsmgr.conf.sample @@ -1,5 +1,5 @@ [general] -;enable=yes ; enable creation of managed DNS lookups - ; default is 'no' -;refreshinterval=1200 ; refresh managed DNS lookups every seconds - ; default is 300 (5 minutes) \ No newline at end of file +enable=yes ; enable creation of managed DNS lookups + ; default is 'no' +refreshinterval=300 ; refresh managed DNS lookups every seconds + ; default is 300 (5 minutes) diff --git a/asterisk/configs/dundi.conf.sample b/asterisk/configs/dundi.conf.sample index a1e99972..5f8ebacc 100644 --- a/asterisk/configs/dundi.conf.sample +++ b/asterisk/configs/dundi.conf.sample @@ -5,235 +5,3 @@ ; ; [general] -; -; The "general" section contains general parameters relating -; to the operation of the dundi client and server. -; -; The first part should be your complete contact information -; should someone else in your peer group need to contact you. -; -;department=Your Department -;organization=Your Company, Inc. -;locality=Your City -;stateprov=ST -;country=US -;email=your@email.com -;phone=+12565551212 -; -; -; Specify bind address and port number. Default is -; 4520 -; -;bindaddr=0.0.0.0 -;port=4520 -; -; Our entity identifier (Should generally be the MAC address of the -; machine it's running on. Defaults to the first eth address, but you -; can override it here, as long as you set it to the MAC of *something* -; you own!) -; -;entityid=00:07:E9:3B:76:60 -; -; Peers shall cache our query responses for the specified time, -; given in seconds. Default is 3600. -; -;cachetime=3600 -; -; This defines the max depth in which to search the DUNDi system. -; Note that the maximum time that we will wait for a response is -; (2000 + 200 * ttl) ms. -; -ttl=32 -; -; If we don't get ACK to our DPDISCOVER within 2000ms, and autokill is set -; to yes, then we cancel the whole thing (that's enough time for one -; retransmission only). This is used to keep things from stalling for a long -; time for a host that is not available, but would be ill advised for bad -; connections. In addition to 'yes' or 'no' you can also specify a number -; of milliseconds. See 'qualify' for individual peers to turn on for just -; a specific peer. -; -autokill=yes -; -; pbx_dundi creates a rotating key called "secret", under the family -; 'secretpath'. The default family is dundi (resulting in -; the key being held at dundi/secret). -; -;secretpath=dundi -; -; The 'storehistory' option (also changeable at runtime with -; 'dundi store history' and 'dundi no store history') will -; cause the DUNDi engine to keep track of the last several -; queries and the amount of time each query took to execute -; for the purpose of tracking slow nodes. This option is -; off by default due to performance impacts. -; -;storehistory=yes - -[mappings] -; -; The "mappings" section maps DUNDi contexts -; to contexts on the local asterisk system. Remember -; that numbers that are made available under the e164 -; DUNDi context are regulated by the DUNDi General Peering -; Agreement (GPA) if you are a member of the DUNDi E.164 -; Peering System. -; -; dundi_context => local_context,weight,tech,dest[,options]] -; -; 'dundi_context' is the name of the context being requested -; within the DUNDi request -; -; 'local_context' is the name of the context on the local system -; in which numbers can be looked up for which responses shall be given. -; -; 'weight' is the weight to use for the responses provided from this -; mapping. The number must be >= 0 and < 60000. Since it is totally -; valid to receive multiple responses to a query, responses received -; with a lower weight are tried first. Note that the weight has a -; special meaning in the e164 context - see the GPA for more details. -; -; 'tech' is the technology to use (IAX, SIP, H323) -; -; 'dest' is the destination to supply for reaching that number. The -; following variables can be used in the destination string and will -; be automatically substituted: -; ${NUMBER}: The number being requested -; ${IPADDR}: The IP address to connect to -; ${SECRET}: The current rotating secret key to be used -; -; Further options may include: -; -; nounsolicited: No unsolicited calls of any type permitted via this -; route -; nocomunsolicit: No commercial unsolicited calls permitted via -; this route -; residential: This number is known to be a residence -; commercial: This number is known to be a business -; mobile: This number is known to be a mobile phone -; nocomunsolicit: No commercial unsolicited calls permitted via -; this route -; nopartial: Do not search for partial matches -; -; There *must* exist an entry in mappings for DUNDi to respond -; to any request, although it may be empty. -; -;e164 => dundi-e164-canonical,0,IAX2,dundi:${SECRET}@${IPADDR}/${NUMBER},nounsolicited,nocomunsolicit,nopartial -;e164 => dundi-e164-customers,100,IAX2,dundi:${SECRET}@${IPADDR}/${NUMBER},nounsolicited,nocomunsolicit,nopartial -;e164 => dundi-e164-via-pstn,400,IAX2,dundi:${SECRET}@${IPADDR}/${NUMBER},nounsolicited,nocomunsolicit,nopartial - -;digexten => default,0,IAX2,guest@lappy/${NUMBER} -;asdf => - - -; -; -; The remaining sections represent the peers -; that we fundamentally trust. The section name -; represents the name and optionally at a specific -; DUNDi context if you want the trust to be established -; for only a specific DUNDi context. -; -; inkey - What key they will be authenticating to us with -; -; outkey - What key we use to authenticate to them -; -; host - What their host is -; -; order - What search order to use. May be 'primary', 'secondary', -; 'tertiary' or 'quartiary'. In large systems, it is beneficial -; to only query one up-stream host in order to maximize caching -; value. Adding one with primary and one with secondary gives you -; redundancy without sacrificing performance. -; -; include - Includes this peer when searching a particular context -; for lookup (set "all" to perform all lookups with that -; host. This is also the context in which peers are permitted -; to precache. -; -; noinclude - Disincludes this peer when searching a particular context -; for lookup (set "all" to perform no lookups with that -; host. -; -; permit - Permits this peer to search a given DUNDi context on -; the local system. Set "all" to permit this host to -; lookup all contexts. This is also a context for which -; we will create/forward PRECACHE commands. -; -; deny - Denies this peer to search a given DUNDi context on -; the local system. Set "all" to deny this host to -; lookup all contexts. -; -; model - inbound, outbound, or symmetric for whether we receive -; requests only, transmit requests only, or do both. -; -; precache - Utilize/Permit precaching with this peer (to pre -; cache means to provide an answer when no request -; was made and is used so that machines with few -; routes can push those routes up a to a higher level). -; outgoing means we send precache routes to this peer, -; incoming means we permit this peer to send us -; precache routes. symmetric means we do both. -; -; Note: You cannot mix symmetric/outbound model with symmetric/inbound -; precache, nor can you mix symmetric/inbound model with symmetric/outbound -; precache. -; -; -; The '*' peer is special and matches an unspecified entity -; - -; -; Sample Primary e164 DUNDi peer -; -;[00:50:8B:F3:75:BB] -;model = symmetric -;host = 64.215.96.114 -;inkey = digium -;outkey = misery -;include = e164 -;permit = e164 -;qualify = yes - -; -; Sample Secondary e164 DUNDi peer -; -;[00:A0:C9:96:92:84] -;model = symmetric -;host = misery.digium.com -;inkey = misery -;outkey = ourkey -;include = e164 -;permit = e164 -;qualify = yes -;order = secondary - -; -; Sample "push mode" downstream host -; -;[00:0C:76:96:75:28] -;model = inbound -;host = dynamic -;precache = inbound -;inkey = littleguy -;outkey = ourkey -;include = e164 ; In this case used only for precaching -;permit = e164 -;qualify = yes - -; -; Sample "push mode" upstream host -; -;[00:07:E9:3B:76:60] -;model = outbound -;precache = outbound -;host = 216.207.245.34 -;register = yes -;inkey = dhcp34 -;permit = all ; In this case used only for precaching -;include = all -;qualify = yes -;outkey=foo - -;[*] -; diff --git a/asterisk/configs/echolink.conf.sample b/asterisk/configs/echolink.conf.sample new file mode 100644 index 00000000..a6f9ca54 --- /dev/null +++ b/asterisk/configs/echolink.conf.sample @@ -0,0 +1,46 @@ +[el0] +call = INVALID ; Change this! +pwd = INVALID ; Change this! +name = YOUR NAME ; Change this! +qth = INVALID ; Change this! +email = INVALID ; Change this! +node = 000000 ; Change this! +; Data for EchoLink Status Page +lat = 0.0 ; Latitude in decimal degrees +lon = 0.0 ; Longitude in decimal degrees +freq = 0.0 ; not mandatory Frequency in MHz +tone = 0.0 ; not mandatory CTCSS Tone (0 for none) +power = 0 ; 0=0W, 1=1W, 2=4W, 3=9W, 4=16W, 5=25W, 6=36W, 7=49W, 8=64W, 9=81W (Power in Watts) +height = 0 ; 0=10 1=20 2=40 3=80 4=160 5=320 6=640 7=1280 8=2560 9=5120 (AMSL in Feet) +gain = 0 ; Gain in db (0-9) +dir = 0 ; 0=omni 1=45deg 2=90deg 3=135deg 4=180deg 5=225deg 6=270deg 7=315deg 8=360deg (Direction) + +maxstns = 20 ; Max Stations + +rtcptimeout = 10 ; Max number of missed heartbeats from EL +recfile = /tmp/echolink_recorded.gsm ; +astnode = 1999 ; Change this! +context = radio-secure ; Default in code is echolink-in + +; Max 3 servers +server1 = nasouth.echolink.org +server2 = naeast.echolink.org +server3 = server3.echolink.org + +; To deny w6xxx you would add the statement: deny = w6xxx +; To prohibit computer-based connections you would write: permit = *-* +; To allow access to only a select group of callsigns: permit = w6abc,w6def,... + +; permit ; comma delimited list of callsign, type (-r) +; deny + + +; Remote text commands thru netcat: +; o.conip (request a connect) +; o.dconip (request a disconnect) +; o.rec (turn on/off recording) + +; ipaddr +; port + +#includeifexists custom/echolink.conf diff --git a/asterisk/configs/extensions.conf.sample b/asterisk/configs/extensions.conf.sample index b7151f4c..85ace8b2 100644 --- a/asterisk/configs/extensions.conf.sample +++ b/asterisk/configs/extensions.conf.sample @@ -1,614 +1,151 @@ -; extensions.conf - the Asterisk dial plan -; -; Static extension configuration file, used by -; the pbx_config module. This is where you configure all your -; inbound and outbound calls in Asterisk. -; -; This configuration file is reloaded -; - With the "dialplan reload" command in the CLI -; - With the "reload" command (that reloads everything) in the CLI - -; -; The "General" category is for certain variables. -; [general] -; -; If static is set to no, or omitted, then the pbx_config will rewrite -; this file when extensions are modified. Remember that all comments -; made in the file will be lost when that happens. -; -; XXX Not yet implemented XXX -; -static=yes -; -; if static=yes and writeprotect=no, you can save dialplan by -; CLI command "dialplan save" too -; -writeprotect=no -; -; If autofallthrough is set, then if an extension runs out of -; things to do, it will terminate the call with BUSY, CONGESTION -; or HANGUP depending on Asterisk's best guess. This is the default. -; -; If autofallthrough is not set, then if an extension runs out of -; things to do, Asterisk will wait for a new extension to be dialed -; (this is the original behavior of Asterisk 1.0 and earlier). -; -;autofallthrough=no -; -; If clearglobalvars is set, global variables will be cleared -; and reparsed on an extensions reload, or Asterisk reload. -; -; If clearglobalvars is not set, then global variables will persist -; through reloads, and even if deleted from the extensions.conf or -; one of its included files, will remain set to the previous value. -; -; NOTE: A complication sets in, if you put your global variables into -; the AEL file, instead of the extensions.conf file. With clearglobalvars -; set, a "reload" will often leave the globals vars cleared, because it -; is not unusual to have extensions.conf (which will have no globals) -; load after the extensions.ael file (where the global vars are stored). -; So, with "reload" in this particular situation, first the AEL file will -; clear and then set all the global vars, then, later, when the extensions.conf -; file is loaded, the global vars are all cleared, and then not set, because -; they are not stored in the extensions.conf file. -; -clearglobalvars=no -; -; If priorityjumping is set to 'yes', then applications that support -; 'jumping' to a different priority based on the result of their operations -; will do so (this is backwards compatible behavior with pre-1.2 releases -; of Asterisk). Individual applications can also be requested to do this -; by passing a 'j' option in their arguments. -; -;priorityjumping=yes -; -; User context is where entries from users.conf are registered. The -; default value is 'default' -; -;userscontext=default -; -; You can include other config files, use the #include command -; (without the ';'). Note that this is different from the "include" command -; that includes contexts within other contexts. The #include command works -; in all asterisk configuration files. -;#include "filename.conf" - -; The "Globals" category contains global variables that can be referenced -; in the dialplan with the GLOBAL dialplan function: -; ${GLOBAL(VARIABLE)} -; ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid -; Unix/Linux environmental variables can be reached with the ENV dialplan -; function: ${ENV(VARIABLE)} -; -[globals] -CONSOLE=Console/dsp ; Console interface for demo -;CONSOLE=Zap/1 -;CONSOLE=Phone/phone0 -IAXINFO=guest ; IAXtel username/password -;IAXINFO=myuser:mypass -TRUNK=Zap/G2 ; Trunk interface -; -; Note the 'G2' in the TRUNK variable above. It specifies which group (defined -; in chan_dahdi.conf) to dial, i.e. group 2, and how to choose a channel to use in -; the specified group. The four possible options are: -; -; g: select the lowest-numbered non-busy Zap channel -; (aka. ascending sequential hunt group). -; G: select the highest-numbered non-busy Zap channel -; (aka. descending sequential hunt group). -; r: use a round-robin search, starting at the next highest channel than last -; time (aka. ascending rotary hunt group). -; R: use a round-robin search, starting at the next lowest channel than last -; time (aka. descending rotary hunt group). -; -TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0) -;TRUNK=IAX2/user:pass@provider - -; -; Any category other than "General" and "Globals" represent -; extension contexts, which are collections of extensions. -; -; Extension names may be numbers, letters, or combinations -; thereof. If an extension name is prefixed by a '_' -; character, it is interpreted as a pattern rather than a -; literal. In patterns, some characters have special meanings: -; -; X - any digit from 0-9 -; Z - any digit from 1-9 -; N - any digit from 2-9 -; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) -; . - wildcard, matches anything remaining (e.g. _9011. matches -; anything starting with 9011 excluding 9011 itself) -; ! - wildcard, causes the matching process to complete as soon as -; it can unambiguously determine that no other matches are possible -; -; For example the extension _NXXXXXX would match normal 7 digit dialings, -; while _1NXXNXXXXXX would represent an area code plus phone number -; preceded by a one. -; -; Each step of an extension is ordered by priority, which must -; always start with 1 to be considered a valid extension. The priority -; "next" or "n" means the previous priority plus one, regardless of whether -; the previous priority was associated with the current extension or not. -; The priority "same" or "s" means the same as the previously specified -; priority, again regardless of whether the previous entry was for the -; same extension. Priorities may be immediately followed by a plus sign -; and another integer to add that amount (most useful with 's' or 'n'). -; Priorities may then also have an alias, or label, in -; parenthesis after their name which can be used in goto situations -; -; Contexts contain several lines, one for each step of each -; extension, which can take one of two forms as listed below, -; with the first form being preferred. -; -;[context] -;exten => someexten,{priority|label{+|-}offset}[(alias)],application(arg1,arg2,...) -;exten => someexten,{priority|label{+|-}offset}[(alias)],application,arg1|arg2... -; -; Included Contexts -; -; One may include another context in the current one as well, optionally with a -; date and time. Included contexts are included in the order -; they are listed. -; The reason a context would include other contexts is for their -; extensions. -; The algorithm to find an extension is recursive, and works in this -; fashion: -; first, given a stack on which to store context references, -; push the context to find the extension onto the stack... -; a) Try to find a matching extension in the context at the top of -; the stack, and, if found, begin executing the priorities -; there in sequence. -; b) If not found, Search the switches, if any declared, in -; sequence. -; c) If still not found, for each include, push that context onto -; the top of the context stack, and recurse to a). -; d) If still not found, pop the entry from the top of the stack; -; if the stack is empty, the search has failed. If it's not, -; continue with the next context in c). -; This is a depth-first traversal, and stops with the first context -; that provides a matching extension. As usual, if more than one -; pattern in a context will match, the 'best' match will win. -; Please note that that extensions found in an included context are -; treated as if they were in the context from which the search began. -; The PBX's notion of the "current context" is not changed. -; Please note that in a context, it does not matter where an include -; directive occurs. Whether at the top, or near the bottom, the effect -; will be the same. The only thing that matters is that if there is -; more than one include directive, they will be searched for extensions -; in order, first to last. -; Also please note that pattern matches (like _9XX) are not treated -; any differently than exact matches (like 987). Also note that the -; order of extensions in a context have no affect on the outcome. -; -; Timing list for includes is -; -;